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.
367 lines
1.0 MiB
367 lines
1.0 MiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[249,5,7,10],{"+NIl":function(zt,xt,ee){(function(le){le(ee("VrN/"))})(function(le){"use strict";le.defineMode("stex",function(Y,L){"use strict";function z(R,k){R.cmdState.push(k)}function A(R){return R.cmdState.length>0?R.cmdState[R.cmdState.length-1]:null}function I(R){var k=R.cmdState.pop();k&&k.closeBracket()}function W(R){for(var k=R.cmdState,S=k.length-1;S>=0;S--){var c=k[S];if(c.name=="DEFAULT")continue;return c}return{styleIdentifier:function(){return null}}}function j(R,k,S){return function(){this.name=R,this.bracketNo=0,this.style=k,this.styles=S,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var P={};P.importmodule=j("importmodule","tag",["string","builtin"]),P.documentclass=j("documentclass","tag",["","atom"]),P.usepackage=j("usepackage","tag",["atom"]),P.begin=j("begin","tag",["atom"]),P.end=j("end","tag",["atom"]),P.label=j("label","tag",["atom"]),P.ref=j("ref","tag",["atom"]),P.eqref=j("eqref","tag",["atom"]),P.cite=j("cite","tag",["atom"]),P.bibitem=j("bibitem","tag",["atom"]),P.Bibitem=j("Bibitem","tag",["atom"]),P.RBibitem=j("RBibitem","tag",["atom"]),P.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function D(R,k){R.f=k}function E(R,k){var S;if(R.match(/^\\[a-zA-Z@]+/)){var c=R.current().slice(1);return S=P.hasOwnProperty(c)?P[c]:P.DEFAULT,S=new S,z(k,S),D(k,M),S.style}if(R.match(/^\\[$&%#{}_]/))return"tag";if(R.match(/^\\[,;!\/\\]/))return"tag";if(R.match("\\["))return D(k,function(l,u){return _(l,u,"\\]")}),"keyword";if(R.match("\\("))return D(k,function(l,u){return _(l,u,"\\)")}),"keyword";if(R.match("$$"))return D(k,function(l,u){return _(l,u,"$$")}),"keyword";if(R.match("$"))return D(k,function(l,u){return _(l,u,"$")}),"keyword";var o=R.next();if(o=="%")return R.skipToEnd(),"comment";if(o=="}"||o=="]"){if(S=A(k),S)S.closeBracket(o),D(k,M);else return"error";return"bracket"}else return o=="{"||o=="["?(S=P.DEFAULT,S=new S,z(k,S),"bracket"):/\d/.test(o)?(R.eatWhile(/[\w.%]/),"atom"):(R.eatWhile(/[\w\-_]/),S=W(k),S.name=="begin"&&(S.argument=R.current()),S.styleIdentifier())}function _(R,k,S){if(R.eatSpace())return null;if(S&&R.match(S))return D(k,E),"keyword";if(R.match(/^\\[a-zA-Z@]+/))return"tag";if(R.match(/^[a-zA-Z]+/))return"variable-2";if(R.match(/^\\[$&%#{}_]/))return"tag";if(R.match(/^\\[,;!\/]/))return"tag";if(R.match(/^[\^_&]/))return"tag";if(R.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(R.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var c=R.next();return c=="{"||c=="}"||c=="["||c=="]"||c=="("||c==")"?"bracket":c=="%"?(R.skipToEnd(),"comment"):"error"}function M(R,k){var S=R.peek(),c;return S=="{"||S=="["?(c=A(k),c.openBracket(S),R.eat(S),D(k,E),"bracket"):/[ \t\r]/.test(S)?(R.eat(S),null):(D(k,E),I(k),E(R,k))}return{startState:function(){var R=L.inMathMode?function(k,S){return _(k,S)}:E;return{cmdState:[],f:R}},copyState:function(R){return{cmdState:R.cmdState.slice(),f:R.f}},token:function(R,k){return k.f(R,k)},blankLine:function(R){R.f=E,R.cmdState.length=0},lineComment:"%"}}),le.defineMIME("text/x-stex","stex"),le.defineMIME("text/x-latex","stex")})},"19Vz":function(zt,xt,ee){(function(le){le(ee("VrN/"))})(function(le){le.defineOption("placeholder","",function(j,P,D){var E=D&&D!=le.Init;if(P&&!E)j.on("blur",A),j.on("change",I),j.on("swapDoc",I),le.on(j.getInputField(),"compositionupdate",j.state.placeholderCompose=function(){z(j)}),I(j);else if(!P&&E){j.off("blur",A),j.off("change",I),j.off("swapDoc",I),le.off(j.getInputField(),"compositionupdate",j.state.placeholderCompose),Y(j);var _=j.getWrapperElement();_.className=_.className.replace(" CodeMirror-empty","")}P&&!j.hasFocus()&&A(j)});function Y(j){j.state.placeholder&&(j.state.placeholder.parentNode.removeChild(j.state.placeholder),j.state.placeholder=null)}function L(j){Y(j);var P=j.state.placeholder=document.createElement("pre");P.style.cssText="height: 0; overflow: visible",P.style.direction=j.getOption("direction"),P.className="CodeMirror-placeholder CodeMirror-line-like";var D=j.getOption("placeholder");typeof D=="string"&&(D=document.createTextNode(D)),P.appendChild(D),j.display.lineSpace.insertBefore(P,j.display.lineSpace.firstChild)}function z(j){setTimeout(function(){var P=!1,D=j.getInputField();D.nodeName=="TEXTAREA"?P=!D.value:j.lineCount()==1&&(P=!/[^\u200b]/.test(D.querySelector(".CodeMirror-line").textContent)),P?L(j):Y(j)},20)}function A(j){W(j)&&L(j)}function I(j){var P=j.getWrapperElement(),D=W(j);P.className=P.className.replace(" CodeMirror-empty","")+(D?" CodeMirror-empty":""),D?L(j):Y(j)}function W(j){return j.lineCount()===1&&j.getLine(0)===""}})},"1eCo":function(zt,xt,ee){(function(le){le(ee("VrN/"))})(function(le){"use strict";var Y={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},L={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};le.defineMode("xml",function(z,A){var I=z.indentUnit,W={},j=A.htmlMode?Y:L;for(var P in j)W[P]=j[P];for(var P in A)W[P]=A[P];var D,E;function _(a,C){function v(G){return C.tokenize=G,G(a,C)}var b=a.next();if(b=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?v(k("atom","]]>")):null:a.match("--")?v(k("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),v(S(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),C.tokenize=k("meta","?>"),"meta"):(D=a.eat("/")?"closeTag":"openTag",C.tokenize=M,"tag bracket");if(b=="&"){var y;return a.eat("#")?a.eat("x")?y=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):y=a.eatWhile(/[\d]/)&&a.eat(";"):y=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),y?"atom":"error"}else return a.eatWhile(/[^&<]/),null}_.isInText=!0;function M(a,C){var v=a.next();if(v==">"||v=="/"&&a.eat(">"))return C.tokenize=_,D=v==">"?"endTag":"selfcloseTag","tag bracket";if(v=="=")return D="equals",null;if(v=="<"){C.tokenize=_,C.state=u,C.tagName=C.tagStart=null;var b=C.tokenize(a,C);return b?b+" tag error":"tag error"}else return/[\'\"]/.test(v)?(C.tokenize=R(v),C.stringStartCol=a.column(),C.tokenize(a,C)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function R(a){var C=function(v,b){for(;!v.eol();)if(v.next()==a){b.tokenize=M;break}return"string"};return C.isInAttribute=!0,C}function k(a,C){return function(v,b){for(;!v.eol();){if(v.match(C)){b.tokenize=_;break}v.next()}return a}}function S(a){return function(C,v){for(var b;(b=C.next())!=null;){if(b=="<")return v.tokenize=S(a+1),v.tokenize(C,v);if(b==">")if(a==1){v.tokenize=_;break}else return v.tokenize=S(a-1),v.tokenize(C,v)}return"meta"}}function c(a,C,v){this.prev=a.context,this.tagName=C,this.indent=a.indented,this.startOfLine=v,(W.doNotIndent.hasOwnProperty(C)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function l(a,C){for(var v;;){if(!a.context)return;if(v=a.context.tagName,!W.contextGrabbers.hasOwnProperty(v)||!W.contextGrabbers[v].hasOwnProperty(C))return;o(a)}}function u(a,C,v){return a=="openTag"?(v.tagStart=C.column(),T):a=="closeTag"?m:u}function T(a,C,v){return a=="word"?(v.tagName=C.current(),E="tag",x):W.allowMissingTagName&&a=="endTag"?(E="tag bracket",x(a,C,v)):(E="error",T)}function m(a,C,v){if(a=="word"){var b=C.current();return v.context&&v.context.tagName!=b&&W.implicitlyClosed.hasOwnProperty(v.context.tagName)&&o(v),v.context&&v.context.tagName==b||W.matchClosing===!1?(E="tag",p):(E="tag error",w)}else return W.allowMissingTagName&&a=="endTag"?(E="tag bracket",p(a,C,v)):(E="error",w)}function p(a,C,v){return a!="endTag"?(E="error",p):(o(v),u)}function w(a,C,v){return E="error",p(a,C,v)}function x(a,C,v){if(a=="word")return E="attribute",g;if(a=="endTag"||a=="selfcloseTag"){var b=v.tagName,y=v.tagStart;return v.tagName=v.tagStart=null,a=="selfcloseTag"||W.autoSelfClosers.hasOwnProperty(b)?l(v,b):(l(v,b),v.context=new c(v,b,y==v.indented)),u}return E="error",x}function g(a,C,v){return a=="equals"?f:(W.allowMissing||(E="error"),x(a,C,v))}function f(a,C,v){return a=="string"?d:a=="word"&&W.allowUnquoted?(E="string",x):(E="error",x(a,C,v))}function d(a,C,v){return a=="string"?d:x(a,C,v)}return{startState:function(a){var C={tokenize:_,state:u,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(C.baseIndent=a),C},token:function(a,C){if(!C.tagName&&a.sol()&&(C.indented=a.indentation()),a.eatSpace())return null;D=null;var v=C.tokenize(a,C);return(v||D)&&v!="comment"&&(E=null,C.state=C.state(D||v,a,C),E&&(v=E=="error"?v+" error":E)),v},indent:function(a,C,v){var b=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+I;if(b&&b.noIndent)return le.Pass;if(a.tokenize!=M&&a.tokenize!=_)return v?v.match(/^(\s*)/)[0].length:0;if(a.tagName)return W.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+I*(W.multilineTagIndentFactor||1);if(W.alignCDATA&&/<!\[CDATA\[/.test(C))return 0;var y=C&&/^<(\/)?([\w_:\.-]*)/.exec(C);if(y&&y[1])for(;b;)if(b.tagName==y[2]){b=b.prev;break}else if(W.implicitlyClosed.hasOwnProperty(b.tagName))b=b.prev;else break;else if(y)for(;b;){var G=W.contextGrabbers[b.tagName];if(G&&G.hasOwnProperty(y[2]))b=b.prev;else break}for(;b&&b.prev&&!b.startOfLine;)b=b.prev;return b?b.indent+I:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:W.htmlMode?"html":"xml",helperType:W.htmlMode?"html":"xml",skipAttribute:function(a){a.state==f&&(a.state=x)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var C=[],v=a.context;v;v=v.prev)v.tagName&&C.push(v.tagName);return C.reverse()}}}),le.defineMIME("text/xml","xml"),le.defineMIME("application/xml","xml"),le.mimeModes.hasOwnProperty("text/html")||le.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"55Ip":function(zt,xt,ee){"use strict";ee.d(xt,"a",function(){return l}),ee.d(xt,"b",function(){return x});var le=ee("Ty5D"),Y=ee("dI71"),L=ee("q1tI"),z=ee.n(L),A=ee("YS25"),I=ee("17x9"),W=ee.n(I),j=ee("wx14"),P=ee("zLVn"),D=ee("9R94"),E=function(f){Object(Y.a)(d,f);function d(){for(var C,v=arguments.length,b=new Array(v),y=0;y<v;y++)b[y]=arguments[y];return C=f.call.apply(f,[this].concat(b))||this,C.history=Object(A.a)(C.props),C}var a=d.prototype;return a.render=function(){return z.a.createElement(le.c,{history:this.history,children:this.props.children})},d}(z.a.Component),_=function(f){Object(Y.a)(d,f);function d(){for(var C,v=arguments.length,b=new Array(v),y=0;y<v;y++)b[y]=arguments[y];return C=f.call.apply(f,[this].concat(b))||this,C.history=Object(A.b)(C.props),C}var a=d.prototype;return a.render=function(){return z.a.createElement(le.c,{history:this.history,children:this.props.children})},d}(z.a.Component),M=function(d,a){return typeof d=="function"?d(a):d},R=function(d,a){return typeof d=="string"?Object(A.c)(d,null,null,a):d},k=function(d){return d},S=z.a.forwardRef;typeof S=="undefined"&&(S=k);function c(f){return!!(f.metaKey||f.altKey||f.ctrlKey||f.shiftKey)}var o=S(function(f,d){var a=f.innerRef,C=f.navigate,v=f.onClick,b=Object(P.a)(f,["innerRef","navigate","onClick"]),y=b.target,G=Object(j.a)({},b,{onClick:function(Z){try{v&&v(Z)}catch(V){throw Z.preventDefault(),V}!Z.defaultPrevented&&Z.button===0&&(!y||y==="_self")&&!c(Z)&&(Z.preventDefault(),C())}});return k!==S?G.ref=d||a:G.ref=a,z.a.createElement("a",G)}),l=S(function(f,d){var a=f.component,C=a===void 0?o:a,v=f.replace,b=f.to,y=f.innerRef,G=Object(P.a)(f,["component","replace","to","innerRef"]);return z.a.createElement(le.e.Consumer,null,function($){$||Object(D.a)(!1);var Z=$.history,V=R(M(b,$.location),$.location),H=V?Z.createHref(V):"",re=Object(j.a)({},G,{href:H,navigate:function(){var Ee=M(b,$.location),we=v?Z.replace:Z.push;we(Ee)}});return k!==S?re.ref=d||y:re.innerRef=y,z.a.createElement(C,re)})});if(!1)var u,T;var m=function(d){return d},p=z.a.forwardRef;typeof p=="undefined"&&(p=m);function w(){for(var f=arguments.length,d=new Array(f),a=0;a<f;a++)d[a]=arguments[a];return d.filter(function(C){return C}).join(" ")}var x=p(function(f,d){var a=f["aria-current"],C=a===void 0?"page":a,v=f.activeClassName,b=v===void 0?"active":v,y=f.activeStyle,G=f.className,$=f.exact,Z=f.isActive,V=f.location,H=f.sensitive,re=f.strict,ce=f.style,Ee=f.to,we=f.innerRef,Ye=Object(P.a)(f,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return z.a.createElement(le.e.Consumer,null,function(Ne){Ne||Object(D.a)(!1);var Ie=V||Ne.location,We=R(M(Ee,Ie),Ie),Ue=We.pathname,xe=Ue&&Ue.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),se=xe?Object(le.f)(Ie.pathname,{path:xe,exact:$,sensitive:H,strict:re}):null,ke=!!(Z?Z(se,Ie):se),dt=ke?w(G,b):G,at=ke?Object(j.a)({},ce,{},y):ce,rt=Object(j.a)({"aria-current":ke&&C||null,className:dt,style:at,to:We},Ye);return m!==p?rt.ref=d||we:rt.innerRef=we,z.a.createElement(l,rt)})});if(!1)var g},"7Cbv":function(zt,xt,ee){"use strict";var le=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Y=new Uint8Array(16);function L(){if(!le)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return le(Y)}var z=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function A(M){return typeof M=="string"&&z.test(M)}for(var I=A,W=[],j=0;j<256;++j)W.push((j+256).toString(16).substr(1));function P(M){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,k=(W[M[R+0]]+W[M[R+1]]+W[M[R+2]]+W[M[R+3]]+"-"+W[M[R+4]]+W[M[R+5]]+"-"+W[M[R+6]]+W[M[R+7]]+"-"+W[M[R+8]]+W[M[R+9]]+"-"+W[M[R+10]]+W[M[R+11]]+W[M[R+12]]+W[M[R+13]]+W[M[R+14]]+W[M[R+15]]).toLowerCase();if(!I(k))throw TypeError("Stringified UUID is invalid");return k}var D=P;function E(M,R,k){M=M||{};var S=M.random||(M.rng||L)();if(S[6]=S[6]&15|64,S[8]=S[8]&63|128,R){k=k||0;for(var c=0;c<16;++c)R[k+c]=S[c];return R}return D(S)}var _=xt.a=E},"7ahc":function(zt,xt,ee){"use strict";ee.d(xt,"a",function(){return T});var le=ee("k1fw"),Y=ee("0Owb"),L=ee("+L6B"),z=ee("2/Rp"),A=ee("y8nQ"),I=ee("Vl3Y"),W=ee("tJVT"),j=ee("OaEy"),P=ee("2fM7"),D=ee("q1tI"),E=ee.n(D),_=ee("VrN/"),M=ee.n(_),R=ee("p77/"),k=ee.n(R),S=ee("c5Ni"),c=ee.n(S),o=P.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},u={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};xt.b=function(m){var p=m.callback,w=m.onCancel,x=Object(D.useState)("python"),g=Object(W.a)(x,2),f=g[0],d=g[1];function a(v){d(u[v][1])}function C(v){p(v)}return E.a.createElement(I.a,Object(Y.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:C}),E.a.createElement(I.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},E.a.createElement(P.a,{onChange:a},Object.keys(u).map(function(v){return E.a.createElement(o,{key:v,value:v},u[v][0])}))),E.a.createElement(I.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},E.a.createElement(T,{mode:f})),E.a.createElement("div",{className:"flex-container flex-end"},E.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),E.a.createElement(z.a,{type:"ghost",onClick:w},"\u53D6\u6D88")))};function T(m){var p=m.value,w=m.onChange,x=m.mode,g=m.options,f=g===void 0?{}:g,d=Object(D.useRef)(),a=Object(D.useState)(),C=Object(W.a)(a,2),v=C[0],b=C[1];return Object(D.useEffect)(function(){if(v){function y(G){var $=G.getValue();w&&w($)}return v.on("change",y),function(){v.off("change",y)}}},[v,w]),Object(D.useEffect)(function(){v&&v.setOption("mode",x)},[v,x]),Object(D.useEffect)(function(){v&&((p!==v.getValue()||p==="")&&setTimeout(function(){v.setValue(p||" ")},300))},[v,p]),Object(D.useEffect)(function(){if(d.current&&!v){var y=M.a.fromTextArea(d.current,Object(le.a)({mode:x,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},f));b(y)}},[d.current,v]),E.a.createElement("div",{className:"my-codemirror-container"},E.a.createElement("textarea",{ref:d}))}},"7qnI":function(zt,xt,ee){"use strict";var le=ee("5Dmo"),Y=ee("3S7+"),L=ee("fWQN"),z=ee("mtLc"),A=ee("yKVA"),I=ee("879j"),W=ee("5NDa"),j=ee("5rEg"),P=ee("q1tI"),D=ee.n(P),E=ee("O2Wb"),_=ee.n(E),M=j.a.TextArea,R=function(k){Object(A.a)(c,k);var S=Object(I.a)(c);function c(){return Object(L.a)(this,c),S.apply(this,arguments)}return Object(z.a)(c,[{key:"render",value:function(){var l=this,u=this.props,T=u.index,m=u.onAnswerChange,p=u.addChildAnswer,w=u.exerciseIsPublish,x=u.answers,g=u.activeOptionErrorIndex,f=u.flex,d=f===void 0?"0 0 1000px":f;return D.a.createElement("div",{className:_.a.flex},D.a.createElement("div",{className:"".concat(_.a.color666," mb5 mt6"),style:{flex:"0 0 90px"}},"\u7B54\u6848(\u586B\u7A7A",T+1,"):"),D.a.createElement("div",{className:"".concat(_.a.flex," ").concat(_.a.flex1),style:{flexDirection:"column"}},x.map(function(a,C){var v="".concat(T,"-").concat(C);return D.a.createElement("div",{className:"".concat(_.a.flex," ").concat(_.a.flex1),key:C},D.a.createElement("div",{className:_.a.flex1,style:{flex:d}},D.a.createElement("div",null,D.a.createElement(M,{className:v===g?_.a.error:"",spellCheck:!1,rows:4,value:a||"",defaultValue:"\u8BF7\u8F93\u5165\u53C2\u8003\u7B54\u6848".concat(C==0?"":"(\u53EF\u9009)"),onChange:function(y){return m(T,C,y.target.value)},style:{minHeight:95}}))),!w&&D.a.createElement(D.a.Fragment,null,C!=0&&D.a.createElement(Y.a,{title:"\u5220\u9664"},D.a.createElement("i",{className:"".concat(_.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return l.props.deleteChildAnswer(T,C)},style:{float:"right"}})),C===0&&D.a.createElement(Y.a,{title:"\u5220\u9664"},D.a.createElement("i",{className:"".concat(_.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return l.props.deleteChildAnswermain(T,C)},style:{float:"right"}})),D.a.createElement(Y.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},D.a.createElement("i",{className:"".concat(_.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return p(T)},style:{float:"right",visibility:C==x.length-1?"":"hidden"}}))))})))}}]),c}(P.Component);xt.a=R},"8EBN":function(zt,xt,ee){(function(le){le(ee("VrN/"))})(function(le){"use strict";le.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var Y=0;Y<le.modeInfo.length;Y++){var L=le.modeInfo[Y];L.mimes&&(L.mime=L.mimes[0])}le.findModeByMIME=function(z){z=z.toLowerCase();for(var A=0;A<le.modeInfo.length;A++){var I=le.modeInfo[A];if(I.mime==z)return I;if(I.mimes){for(var W=0;W<I.mimes.length;W++)if(I.mimes[W]==z)return I}}if(/\+xml$/.test(z))return le.findModeByMIME("application/xml");if(/\+json$/.test(z))return le.findModeByMIME("application/json")},le.findModeByExtension=function(z){z=z.toLowerCase();for(var A=0;A<le.modeInfo.length;A++){var I=le.modeInfo[A];if(I.ext){for(var W=0;W<I.ext.length;W++)if(I.ext[W]==z)return I}}},le.findModeByFileName=function(z){for(var A=0;A<le.modeInfo.length;A++){var I=le.modeInfo[A];if(I.file&&I.file.test(z))return I}var W=z.lastIndexOf("."),j=W>-1&&z.substring(W+1,z.length);if(j)return le.findModeByExtension(j)},le.findModeByName=function(z){z=z.toLowerCase();for(var A=0;A<le.modeInfo.length;A++){var I=le.modeInfo[A];if(I.name.toLowerCase()==z)return I;if(I.alias){for(var W=0;W<I.alias.length;W++)if(I.alias[W].toLowerCase()==z)return I}}}})},"8hTe":function(zt,xt,ee){zt.exports={button:"button___1wy9m"}},"9Bee":function(zt,xt,ee){"use strict";var le=ee("DYRE"),Y=ee("zeV3"),L=ee("+L6B"),z=ee("2/Rp"),A=ee("k1fw"),I=ee("9og8"),W=ee("tJVT"),j=ee("WmNS"),P=ee.n(j),D=ee("q1tI"),E=ee.n(D),_=ee("vg9a"),M=ee("DlQD"),R=ee.n(M),k=ee("rUJ1");function S(U,s){var h=U.match(/^(\s+)(?:```)/);if(h===null)return s;var B=h[1];return s.split(`
|
|
`).map(function(K){var N=K.match(/^\s+/);if(N===null)return K;var ae=Object(W.a)(N,1),Be=ae[0];return Be.length>=B.length?K.slice(B.length):K}).join(`
|
|
`)}var c=[],o=["<ul>"],l=new R.a.Renderer,u=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function T(){c.length=0,o=["<ul>"]}var m={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function p(U,s,h,B){if(s>=U.length||U[s].level<=h)return s;var K=U[s];B.push("<li><a href='#"+K.anchor+"'>"+K.text+"</a>"),s++;var N=[];return s=p(U,s,K.level,N),N.length>0&&(B.push("<ul>"),N.forEach(function(ae){B.push(ae)}),B.push("</ul>")),B.push("</li>"),s=p(U,s,h,B),s}function w(){return p(c,0,0,o),o.push("</ul>"),o.join("")}var x={heading:function(s){var h=u.exec(s);if(h)return{type:"heading",raw:h[0],depth:h[1].length,text:h[2]}},fences:function(s){var h=this.rules.block.fences.exec(s);if(h){var B=h[0],K=S(B,h[3]||""),N=h[2]?h[2].trim():h[2];if(["latex","katex","math"].indexOf(N)>=0){var ae=d(),Be=K;K=ae,a[ae]={type:"block",expression:Be}}return{type:"code",raw:B,lang:N,text:K}}}},g=/(?:\${2})([^\n`]+?)(?:\${2})/gi,f=0,d=function(){return"__special_katext_id_".concat(f++,"__")},a={};function C(){return a}function v(){f=0,a={}}function b(U){return U=U.replace(g,function(s,h){var B=d();return a[B]={type:"inline",expression:h},B}),U}var y=l.listitem;l.listitem=function(U){return y(b(U))};var G=l.paragraph;l.paragraph=function(U){return G(b(U))};var $=l.tablecell;l.tablecell=function(U,s){return $(b(U),s)},l.code=function(U,s,h){var B=(s||"").match(/\S*/)[0];return B?["latex","katex","math"].indexOf(B)>=0?"<p class='editormd-tex'>".concat(U,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(s,'">').concat(h?U:Object(k.escape)(U,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(h?U:Object(k.escape)(U,!0))+"</code></pre>"},l.heading=function(U,s,h){var B=this.options.headerPrefix+h.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return c.push({anchor:B,level:s,text:U}),"<h"+s+' id="'+B+'">'+U+"</h"+s+">"},R.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),R.a.use({tokenizer:x,renderer:l});var Z=R.a,V=ee("SJMd"),H=ee("ulZh"),re=ee.n(H),ce=ee("m3rI"),Ee=ee("Oy/b"),we=ee("p5ED"),Ye=ee("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 Ne=function(U,s){return(Ne=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,B){h.__proto__=B}||function(h,B){for(var K in B)Object.prototype.hasOwnProperty.call(B,K)&&(h[K]=B[K])})(U,s)};function Ie(U,s){function h(){this.constructor=U}Ne(U,s),U.prototype=s===null?Object.create(s):(h.prototype=s.prototype,new h)}function We(U,s,h,B){return new(h||(h=Promise))(function(K,N){function ae(gt){try{ze(B.next(gt))}catch(je){N(je)}}function Be(gt){try{ze(B.throw(gt))}catch(je){N(je)}}function ze(gt){var je;gt.done?K(gt.value):(je=gt.value,je instanceof h?je:new h(function(ct){ct(je)})).then(ae,Be)}ze((B=B.apply(U,s||[])).next())})}function Ue(U,s){var h,B,K,N,ae={label:0,sent:function(){if(1&K[0])throw K[1];return K[1]},trys:[],ops:[]};return N={next:Be(0),throw:Be(1),return:Be(2)},typeof Symbol=="function"&&(N[Symbol.iterator]=function(){return this}),N;function Be(ze){return function(gt){return function(je){if(h)throw new TypeError("Generator is already executing.");for(;ae;)try{if(h=1,B&&(K=2&je[0]?B.return:je[0]?B.throw||((K=B.return)&&K.call(B),0):B.next)&&!(K=K.call(B,je[1])).done)return K;switch(B=0,K&&(je=[2&je[0],K.value]),je[0]){case 0:case 1:K=je;break;case 4:return ae.label++,{value:je[1],done:!1};case 5:ae.label++,B=je[1],je=[0];continue;case 7:je=ae.ops.pop(),ae.trys.pop();continue;default:if(!(K=ae.trys,(K=K.length>0&&K[K.length-1])||je[0]!==6&&je[0]!==2)){ae=0;continue}if(je[0]===3&&(!K||je[1]>K[0]&&je[1]<K[3])){ae.label=je[1];break}if(je[0]===6&&ae.label<K[1]){ae.label=K[1],K=je;break}if(K&&ae.label<K[2]){ae.label=K[2],ae.ops.push(je);break}K[2]&&ae.ops.pop(),ae.trys.pop();continue}je=s.call(U,ae)}catch(ct){je=[6,ct],B=0}finally{h=K=0}if(5&je[0])throw je[1];return{value:je[0]?je[1]:void 0,done:!0}}([ze,gt])}}}function xe(){for(var U=0,s=0,h=arguments.length;s<h;s++)U+=arguments[s].length;var B=Array(U),K=0;for(s=0;s<h;s++)for(var N=arguments[s],ae=0,Be=N.length;ae<Be;ae++,K++)B[K]=N[ae];return B}var se=function(){function U(){}return U.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},U.setAttributes=function(s,h){for(var B=0,K=h;B<K.length;B++){var N=K[B],ae=N[0],Be=N[1];s.setAttribute(ae,Be)}},U.createRect=function(s,h,B){var K=document.createElementNS("http://www.w3.org/2000/svg","rect");return K.setAttribute("width",s.toString()),K.setAttribute("height",h.toString()),B&&U.setAttributes(K,B),K},U.createLine=function(s,h,B,K,N){var ae=document.createElementNS("http://www.w3.org/2000/svg","line");return ae.setAttribute("x1",s.toString()),ae.setAttribute("y1",h.toString()),ae.setAttribute("x2",B.toString()),ae.setAttribute("y2",K.toString()),N&&U.setAttributes(ae,N),ae},U.createPolygon=function(s,h){var B=document.createElementNS("http://www.w3.org/2000/svg","polygon");return B.setAttribute("points",s),h&&U.setAttributes(B,h),B},U.createCircle=function(s,h){var B=document.createElementNS("http://www.w3.org/2000/svg","circle");return B.setAttribute("cx",(s/2).toString()),B.setAttribute("cy",(s/2).toString()),B.setAttribute("r",s.toString()),h&&U.setAttributes(B,h),B},U.createEllipse=function(s,h,B){var K=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return K.setAttribute("cx",(s/2).toString()),K.setAttribute("cy",(h/2).toString()),K.setAttribute("rx",(s/2).toString()),K.setAttribute("ry",(h/2).toString()),B&&U.setAttributes(K,B),K},U.createGroup=function(s){var h=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&U.setAttributes(h,s),h},U.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},U.createMarker=function(s,h,B,K,N,ae,Be){var ze=document.createElementNS("http://www.w3.org/2000/svg","marker");return U.setAttributes(ze,[["id",s],["orient",h],["markerWidth",B.toString()],["markerHeight",K.toString()],["refX",N.toString()],["refY",ae.toString()]]),ze.appendChild(Be),ze},U.createText=function(s){var h=document.createElementNS("http://www.w3.org/2000/svg","text");return h.setAttribute("x","0"),h.setAttribute("y","0"),s&&U.setAttributes(h,s),h},U.createTSpan=function(s,h){var B=document.createElementNS("http://www.w3.org/2000/svg","tspan");return B.textContent=s,h&&U.setAttributes(B,h),B},U.createImage=function(s){var h=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&U.setAttributes(h,s),h},U.createPoint=function(s,h){var B=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return B.x=s,B.y=h,B},U.createPath=function(s,h){var B=document.createElementNS("http://www.w3.org/2000/svg","path");return B.setAttribute("d",s),h&&U.setAttributes(B,h),B},U}(),ke=function(){function U(){}return U.addKey=function(s){U.key=s},Object.defineProperty(U,"isLicensed",{get:function(){return!!U.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(U.key)},enumerable:!1,configurable:!0}),U}(),dt=function(){function U(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return U.prototype.rasterize=function(s,h,B){var K=this;return new Promise(function(N){var ae=B!==void 0?B:document.createElement("canvas");s===null&&(K.markersOnly=!0,K.naturalSize=!1);var Be=document.createElementNS("http://www.w3.org/2000/svg","svg");Be.setAttribute("xmlns","http://www.w3.org/2000/svg"),Be.setAttribute("width",h.width.baseVal.valueAsString),Be.setAttribute("height",h.height.baseVal.valueAsString),Be.setAttribute("viewBox","0 0 "+h.viewBox.baseVal.width.toString()+" "+h.viewBox.baseVal.height.toString()),Be.innerHTML=h.innerHTML,K.naturalSize===!0?(Be.width.baseVal.value=s.naturalWidth,Be.height.baseVal.value=s.naturalHeight):K.width!==void 0&&K.height!==void 0&&(Be.width.baseVal.value=K.width,Be.height.baseVal.value=K.height),ae.width=Be.width.baseVal.value,ae.height=Be.height.baseVal.value;var ze=Be.outerHTML,gt=ae.getContext("2d");K.markersOnly!==!0&>.drawImage(s,0,0,ae.width,ae.height);var je=window.URL,ct=new Image(ae.width,ae.height);ct.setAttribute("crossOrigin","anonymous");var Wt=new Blob([ze],{type:"image/svg+xml"}),Dr=je.createObjectURL(Wt);ct.onload=function(){gt.drawImage(ct,0,0),je.revokeObjectURL(Dr);var qr=ae.toDataURL(K.imageType,K.imageQuality);N(qr)},ct.src=Dr})},U}(),at=function(){},rt=function(){function U(s){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(U.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(U.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(U.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),U.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},U.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)},U.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 lt("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new lt("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new lt("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Ke("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Ke("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},U.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},U}(),lt=function(U,s){this.selector=U,this.style=s},Ke=function(U,s){this.localName=U,this.style=s},$e=function(){function U(s,h,B,K,N){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=s,this.displayMode=h,this.markerItems=B,this.uiStyleSettings=K,this.styles=N,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return U.prototype.show=function(s){var h=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 B=document.createElement("div");B.className=this.toolbarBlockStyleClass.name,B.style.whiteSpace="nowrap",this.uiContainer.appendChild(B),this.addActionButton(B,'<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(B,'<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(B,'<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(B,'<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(B,'<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(B,'<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(B,'<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(B,'<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(N){var ae=document.createElement("div");ae.className=""+h.toolbarButtonStyleClass.name,ae.setAttribute("data-type-name",N.typeName),ae.innerHTML=N.icon,ae.addEventListener("click",function(){h.markerToolbarButtonClicked(ae,N)}),h.buttons.push(ae),h.markerButtons.push(ae)}),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 K=document.createElement("div");K.className=this.toolbarBlockStyleClass.name,K.style.whiteSpace="nowrap",K.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(K),this.addActionButton(K,'<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(K,'<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()},U.prototype.addButtonClickListener=function(s){this.buttonClickListeners.push(s)},U.prototype.removeButtonClickListener=function(s){this.buttonClickListeners.indexOf(s)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(s),1)},U.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},U.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 h=0;h<this.markerButtons.length;h++)h<s||h===s&&this.markerButtons.length-1===s?this.markerButtonBlock.appendChild(this.markerButtons[h]):(h===s&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[h]))}},U.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")},U.prototype.resetButtonStyles=function(){var s=this;this.buttons.forEach(function(h){h.className=h.className.replace(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name,"").trim(),h.className=h.className.replace(s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:s.toolbarActiveButtonStyleColorsClass.name,"").trim(),h.className+=" "+(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name)})},U.prototype.addActionButton=function(s,h,B){var K=this,N=document.createElement("div");switch(N.className=""+this.toolbarButtonStyleClass.name,N.innerHTML=h,N.setAttribute("data-action",B),N.addEventListener("click",function(){K.actionToolbarButtonClicked(N,B)}),B){case"select":N.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":N.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":N.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":N.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":N.style.fill=this.uiStyleSettings.closeButtonColor}s.appendChild(N),this.buttons.push(N)},U.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ke("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 Ke("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Ke("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Ke("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 Ke("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var s=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ke("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 Ke("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ke("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new lt("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new lt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},U.prototype.markerToolbarButtonClicked=function(s,h){this.setActiveButton(s),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(B){return B("marker",h)}),this.markerButtonOverflowBlock.style.display="none"},U.prototype.actionToolbarButtonClicked=function(s,h){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(B){return B("action",h)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},U.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)},U.prototype.setActiveMarkerButton=function(s){var h=this.markerButtons.find(function(B){return B.getAttribute("data-type-name")===s});h&&this.setActiveButton(h)},U.prototype.setCurrentMarker=function(s){var h=this;this.currentMarker=s,this.buttons.filter(function(B){return/delete|notes/.test(B.getAttribute("data-action"))}).forEach(function(B){h.currentMarker===void 0?(B.style.fillOpacity="0.4",B.style.pointerEvents="none"):(B.style.fillOpacity="1",B.style.pointerEvents="all")})},U}(),it=function(){function U(s,h,B,K){this.panels=[],this.panelButtons=[],this.markerjsContainer=s,this.displayMode=h,this.uiStyleSettings=B,this.styles=K,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return U.prototype.addStyles=function(){var s;this.toolboxStyleClass=this.styles.addClass(new Ke("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 Ke("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var h=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Ke("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Ke("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Ke("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 Ke("toolbox-panel-row_colors",`
|
|
background-color: `+((s=this.uiStyleSettings.toolboxBackgroundColor)!==null&&s!==void 0?s:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Ke("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*h)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*h)+`px;
|
|
padding: `+h+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Ke("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Ke("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new lt("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new lt("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},U.prototype.show=function(s){var h;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolboxStyleClass.name+" "+((h=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&h!==void 0?h:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},U.prototype.setPanelButtons=function(s){var h,B,K=this;this.panels=s,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((h=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&h!==void 0?h:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((B=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&B!==void 0?B:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(N){var ae;N.uiStyleSettings=K.uiStyleSettings;var Be=document.createElement("div");Be.className=K.toolboxButtonStyleClass.name+" "+((ae=K.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ae!==void 0?ae:K.toolboxButtonStyleColorsClass.name),Be.innerHTML=N.icon,Be.title=N.title,Be.addEventListener("click",function(){K.panelButtonClick(N)}),K.panelButtons.push(Be),K.buttonRow.appendChild(Be)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},U.prototype.panelButtonClick=function(s){var h=this,B=-1;if(s!==this.activePanel){B=this.panels.indexOf(s),this.panelRow.innerHTML="";var K=s.getUi();K.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(K),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(){h.displayMode==="inline"?h.panelRow.style.display="none":h.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(N,ae){var Be,ze;N.className=h.toolboxButtonStyleClass.name+" "+(ae===B?""+((Be=h.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Be!==void 0?Be:h.toolboxActiveButtonStyleColorsClass.name):""+((ze=h.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ze!==void 0?ze:h.toolboxButtonStyleColorsClass.name))})},U}(),ft=function(U,s){this.title=U,this.icon=s},ut=function(U){function s(h,B,K,N){var ae=U.call(this,h,N||'<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 ae.colors=[],ae.addTransparent=!1,ae.colorBoxes=[],ae.colors=B,ae.currentColor=K,ae.setCurrentColor=ae.setCurrentColor.bind(ae),ae.getColorBox=ae.getColorBox.bind(ae),ae}return Ie(s,U),s.prototype.getUi=function(){var h=this,B=document.createElement("div");return B.style.overflow="hidden",B.style.whiteSpace="nowrap",this.colors.forEach(function(K){var N=h.getColorBox(K);B.appendChild(N),h.colorBoxes.push(N)}),B},s.prototype.getColorBox=function(h){var B=this,K=this.uiStyleSettings.toolbarHeight/4,N=this.uiStyleSettings.toolbarHeight-K,ae=document.createElement("div");ae.style.display="inline-block",ae.style.boxSizing="content-box",ae.style.width=N-2+"px",ae.style.height=N-2+"px",ae.style.padding="1px",ae.style.marginRight="2px",ae.style.marginBottom="2px",ae.style.borderWidth="2px",ae.style.borderStyle="solid",ae.style.borderRadius=(N+2)/2+"px",ae.style.borderColor=h===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ae.addEventListener("click",function(){B.setCurrentColor(h,ae)});var Be=document.createElement("div");return Be.style.display="inline-block",Be.style.width=N-2+"px",Be.style.height=N-2+"px",Be.style.backgroundColor=h,Be.style.borderRadius=N/2+"px",h==="transparent"&&(Be.style.fill=this.uiStyleSettings.toolboxAccentColor,Be.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>`),ae.appendChild(Be),ae},s.prototype.setCurrentColor=function(h,B){var K=this;this.currentColor=h,this.colorBoxes.forEach(function(N){N.style.borderColor=N===B?K.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(h)},s}(ft),Ze=function(){function U(s,h,B){this._state="new",this._isSelected=!1,this._container=s,this._overlayContainer=h,this.globalSettings=B,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(U.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),U.prototype.ownsTarget=function(s){return!1},Object.defineProperty(U.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),U.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},U.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},U.prototype.pointerDown=function(s,h){},U.prototype.dblClick=function(s,h){},U.prototype.manipulate=function(s){},U.prototype.pointerUp=function(s){this.stateChanged()},U.prototype.dispose=function(){},U.prototype.addMarkerVisualToContainer=function(s){this.container.childNodes.length>0?this.container.insertBefore(s,this.container.childNodes[0]):this.container.appendChild(s)},U.prototype.getState=function(){return{typeName:U.typeName,state:this.state,notes:this.notes}},U.prototype.restoreState=function(s){this._state=s.state,this.notes=s.notes},U.prototype.scale=function(s,h){},U.prototype.colorChanged=function(s){this.onColorChanged&&this.onColorChanged(s),this.stateChanged()},U.prototype.fillColorChanged=function(s){this.onFillColorChanged&&this.onFillColorChanged(s),this.stateChanged()},U.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)}},U.typeName="MarkerBase",U}(),qe=function(){function U(){this.findGripByVisual=this.findGripByVisual.bind(this)}return U.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},U}(),Dt=function(){function U(){this.GRIP_SIZE=10,this.visual=se.createGroup(),this.visual.appendChild(se.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(se.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return U.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},U}(),wt=function(){function U(){}return U.toITransformMatrix=function(s){return{a:s.a,b:s.b,c:s.c,d:s.d,e:s.e,f:s.f}},U.toSVGMatrix=function(s,h){return s.a=h.a,s.b=h.b,s.c=h.c,s.d=h.d,s.e=h.e,s.f=h.f,s},U}(),vt=function(U){function s(h,B,K){var N=U.call(this,h,B,K)||this;return N.left=0,N.top=0,N.width=0,N.height=0,N.defaultSize={x:50,y:20},N.offsetX=0,N.offsetY=0,N.rotationAngle=0,N.CB_DISTANCE=10,N._suppressMarkerCreateEvent=!1,N.container.transform.baseVal.appendItem(se.createTransform()),N.setupControlBox(),N}return Ie(s,U),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(h){this._visual=h;var B=se.createTransform();this._visual.transform.baseVal.appendItem(B)},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(h){return!!U.prototype.ownsTarget.call(this,h)||!!(this.controlGrips.findGripByVisual(h)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(h))},s.prototype.pointerDown=function(h,B){U.prototype.pointerDown.call(this,h,B),this.state==="new"&&(this.left=h.x,this.top=h.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var K=this.unrotatePoint(h);if(this.manipulationStartX=K.x,this.manipulationStartY=K.y,this.offsetX=K.x-this.left,this.offsetY=K.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(B),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(B)){this.activeGrip=this.rotatorGrip;var N=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=N.x-this.width/2,this.top=N.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ae=this.container.transform.baseVal.getItem(0);ae.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ae,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},s.prototype.pointerUp=function(h){var B=this.state;U.prototype.pointerUp.call(this,h),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(h),this._state="select",B==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},s.prototype.moveVisual=function(h){this.visual.style.transform="translate("+h.x+"px, "+h.y+"px)"},s.prototype.manipulate=function(h){var B=this.unrotatePoint(h);this.state==="creating"?this.resize(h):this.state==="move"?(this.left=this.manipulationStartLeft+(B.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(B.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(B):this.state==="rotate"&&this.rotate(h)},s.prototype.resize=function(h){var B=this.manipulationStartLeft,K=this.manipulationStartWidth,N=this.manipulationStartTop,ae=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:B=this.manipulationStartLeft+h.x-this.manipulationStartX,K=this.manipulationStartWidth+this.manipulationStartLeft-B;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:K=this.manipulationStartWidth+h.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:N=this.manipulationStartTop+h.y-this.manipulationStartY,ae=this.manipulationStartHeight+this.manipulationStartTop-N;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ae=this.manipulationStartHeight+h.y-this.manipulationStartY}K>=0?(this.left=B,this.width=K):(this.left=B+K,this.width=-K),ae>=0?(this.top=N,this.height=ae):(this.top=N+ae,this.height=-ae),this.setSize()},s.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},s.prototype.rotate=function(h){if(Math.abs(h.x-this.centerX)>.1){var B=Math.sign(h.x-this.centerX);this.rotationAngle=180*Math.atan((h.y-this.centerY)/(h.x-this.centerX))/Math.PI+90*B,this.applyRotation()}},s.prototype.applyRotation=function(){var h=this.container.transform.baseVal.getItem(0);h.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(h,0)},s.prototype.rotatePoint=function(h){if(this.rotationAngle===0)return h;var B=this.container.getCTM(),K=se.createPoint(h.x,h.y);return{x:(K=K.matrixTransform(B)).x,y:K.y}},s.prototype.unrotatePoint=function(h){if(this.rotationAngle===0)return h;var B=this.container.getCTM();B=B.inverse();var K=se.createPoint(h.x,h.y);return{x:(K=K.matrixTransform(B)).x,y:K.y}},s.prototype.select=function(){U.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){U.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=se.createGroup();var h=se.createTransform();h.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(h),this.container.appendChild(this.controlBox),this.controlRect=se.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=se.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new qe,this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){var h=this.controlBox.transform.baseVal.getItem(0);h.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(h,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 h=new Dt;return h.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(h.visual),h},s.prototype.positionGrips=function(){var h=this.controlGrips.topLeft.GRIP_SIZE,B=-h/2,K=B,N=(this.width+this.CB_DISTANCE)/2-h/2,ae=(this.height+this.CB_DISTANCE)/2-h/2,Be=this.height+this.CB_DISTANCE-h/2,ze=this.width+this.CB_DISTANCE-h/2;this.positionGrip(this.controlGrips.topLeft.visual,B,K),this.positionGrip(this.controlGrips.topCenter.visual,N,K),this.positionGrip(this.controlGrips.topRight.visual,ze,K),this.positionGrip(this.controlGrips.centerLeft.visual,B,ae),this.positionGrip(this.controlGrips.centerRight.visual,ze,ae),this.positionGrip(this.controlGrips.bottomLeft.visual,B,Be),this.positionGrip(this.controlGrips.bottomCenter.visual,N,Be),this.positionGrip(this.controlGrips.bottomRight.visual,ze,Be),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,N,K-3*this.CB_DISTANCE)},s.prototype.positionGrip=function(h,B,K){var N=h.transform.baseVal.getItem(0);N.setTranslate(B,K),h.transform.baseVal.replaceItem(N,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:wt.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:wt.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},U.prototype.getState.call(this))},s.prototype.restoreState=function(h){U.prototype.restoreState.call(this,h);var B=h;this.left=B.left,this.top=B.top,this.width=B.width,this.height=B.height,this.rotationAngle=B.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(wt.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,B.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(wt.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,B.containerTransformMatrix))},s.prototype.scale=function(h,B){U.prototype.scale.call(this,h,B);var K=this.rotatePoint({x:this.left,y:this.top}),N=this.unrotatePoint({x:K.x*h,y:K.y*B});this.left=N.x,this.top=N.y,this.width=this.width*h,this.height=this.height*B,this.adjustControlBox()},s}(Ze),mt=function(U){function s(h,B,K){var N=U.call(this,h,B,K)||this;return N.fillColor="transparent",N.strokeColor="transparent",N.strokeWidth=0,N.strokeDasharray="",N.opacity=1,N.setStrokeColor=N.setStrokeColor.bind(N),N.setFillColor=N.setFillColor.bind(N),N.setStrokeWidth=N.setStrokeWidth.bind(N),N.setStrokeDasharray=N.setStrokeDasharray.bind(N),N.createVisual=N.createVisual.bind(N),N}return Ie(s,U),s.prototype.ownsTarget=function(h){return!(!U.prototype.ownsTarget.call(this,h)&&h!==this.visual)},s.prototype.createVisual=function(){this.visual=se.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(h,B){U.prototype.pointerDown.call(this,h,B),this.state==="new"&&(this.createVisual(),this.moveVisual(h),this._state="creating")},s.prototype.manipulate=function(h){U.prototype.manipulate.call(this,h)},s.prototype.resize=function(h){U.prototype.resize.call(this,h),this.setSize()},s.prototype.setSize=function(){U.prototype.setSize.call(this),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(h){U.prototype.pointerUp.call(this,h),this.setSize()},s.prototype.setStrokeColor=function(h){this.strokeColor=h,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(h),this.stateChanged()},s.prototype.setFillColor=function(h){this.fillColor=h,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},s.prototype.setStrokeWidth=function(h){this.strokeWidth=h,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(h){this.strokeDasharray=h,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},U.prototype.getState.call(this))},s.prototype.restoreState=function(h){var B=h;this.fillColor=B.fillColor,this.strokeColor=B.strokeColor,this.strokeWidth=B.strokeWidth,this.strokeDasharray=B.strokeDasharray,this.opacity=B.opacity,this.createVisual(),U.prototype.restoreState.call(this,h),this.setSize()},s.prototype.scale=function(h,B){U.prototype.scale.call(this,h,B),this.setSize()},s.title="Rectangle marker",s}(vt),Nt=function(U){function s(h,B,K,N){var ae=U.call(this,h,N||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ae.widths=[],ae.widthBoxes=[],ae.widths=B,ae.currentWidth=K,ae.setCurrentWidth=ae.setCurrentWidth.bind(ae),ae}return Ie(s,U),s.prototype.getUi=function(){var h=this,B=document.createElement("div");return B.style.display="flex",B.style.overflow="hidden",B.style.flexGrow="2",this.widths.forEach(function(K){var N=document.createElement("div");N.style.display="flex",N.style.flexGrow="2",N.style.alignItems="center",N.style.justifyContent="space-between",N.style.padding="5px",N.style.borderWidth="2px",N.style.borderStyle="solid",N.style.borderColor=K===h.currentWidth?h.uiStyleSettings.toolboxAccentColor:"transparent",N.addEventListener("click",function(){h.setCurrentWidth(K,N)}),B.appendChild(N);var ae=document.createElement("div");ae.innerText=K.toString(),ae.style.marginRight="5px",N.appendChild(ae);var Be=document.createElement("div");Be.style.minHeight="20px",Be.style.flexGrow="2",Be.style.display="flex",Be.style.alignItems="center";var ze=document.createElement("hr");ze.style.minWidth="20px",ze.style.border="0px",ze.style.borderTop=K+"px solid "+h.uiStyleSettings.toolboxColor,ze.style.flexGrow="2",Be.appendChild(ze),N.appendChild(Be),h.widthBoxes.push(N)}),B},s.prototype.setCurrentWidth=function(h,B){var K=this;this.currentWidth=h,this.widthBoxes.forEach(function(N){N.style.borderColor=N===B?K.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},s}(ft),At=function(U){function s(h,B,K,N){var ae=U.call(this,h,N||'<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 ae.styles=[],ae.styleBoxes=[],ae.styles=B,ae.currentStyle=K,ae.setCurrentStyle=ae.setCurrentStyle.bind(ae),ae}return Ie(s,U),s.prototype.getUi=function(){var h=this,B=document.createElement("div");return B.style.display="flex",B.style.overflow="hidden",B.style.flexGrow="2",this.styles.forEach(function(K){var N=document.createElement("div");N.style.display="flex",N.style.alignItems="center",N.style.justifyContent="space-between",N.style.padding="5px",N.style.borderWidth="2px",N.style.borderStyle="solid",N.style.overflow="hidden",N.style.maxWidth=100/h.styles.length-5+"%",N.style.borderColor=K===h.currentStyle?h.uiStyleSettings.toolboxAccentColor:"transparent",N.addEventListener("click",function(){h.setCurrentStyle(K,N)}),B.appendChild(N);var ae=document.createElement("div");ae.style.minHeight="20px",ae.style.flexGrow="2",ae.style.overflow="hidden";var Be=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+h.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(K!==""?'stroke-dasharray="'+K+'"':"")+` />
|
|
</svg>`;ae.innerHTML=Be,N.appendChild(ae),h.styleBoxes.push(N)}),B},s.prototype.setCurrentStyle=function(h,B){var K=this;this.currentStyle=h,this.styleBoxes.forEach(function(N){N.style.borderColor=N===B?K.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},s}(ft),Ot=function(U){function s(h,B,K){var N=U.call(this,h,B,K)||this;return N.strokeColor=K.defaultColor,N.strokeWidth=K.defaultStrokeWidth,N.strokeDasharray=K.defaultStrokeDasharray,N.strokePanel=new ut("Line color",K.defaultColorSet,K.defaultColor),N.strokePanel.onColorChanged=N.setStrokeColor,N.strokeWidthPanel=new Nt("Line width",K.defaultStrokeWidths,K.defaultStrokeWidth),N.strokeWidthPanel.onWidthChanged=N.setStrokeWidth,N.strokeStylePanel=new At("Line style",K.defaultStrokeDasharrays,K.defaultStrokeDasharray),N.strokeStylePanel.onStyleChanged=N.setStrokeDasharray,N}return Ie(s,U),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var h=U.prototype.getState.call(this);return h.typeName=s.typeName,h},s.typeName="FrameMarker",s.title="Frame marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',s}(mt),He=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(U){function s(h,B,K){var N=U.call(this,h,B,K)||this;return N.x1=0,N.y1=0,N.x2=0,N.y2=0,N.defaultLength=50,N.manipulationStartX=0,N.manipulationStartY=0,N.manipulationStartX1=0,N.manipulationStartY1=0,N.manipulationStartX2=0,N.manipulationStartY2=0,N.setupControlBox(),N}return Ie(s,U),s.prototype.ownsTarget=function(h){return!!U.prototype.ownsTarget.call(this,h)||!(!this.grip1.ownsTarget(h)&&!this.grip2.ownsTarget(h))},s.prototype.pointerDown=function(h,B){U.prototype.pointerDown.call(this,h,B),this.manipulationStartX=h.x,this.manipulationStartY=h.y,this.state==="new"&&(this.x1=h.x,this.y1=h.y,this.x2=h.x,this.y2=h.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(B)?this.activeGrip=this.grip1:this.grip2.ownsTarget(B)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},s.prototype.pointerUp=function(h){var B=this.state;U.prototype.pointerUp.call(this,h),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(h),this._state="select",B==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},s.prototype.adjustVisual=function(){},s.prototype.manipulate=function(h){this.state==="creating"?this.resize(h):this.state==="move"?(this.x1=this.manipulationStartX1+h.x-this.manipulationStartX,this.y1=this.manipulationStartY1+h.y-this.manipulationStartY,this.x2=this.manipulationStartX2+h.x-this.manipulationStartX,this.y2=this.manipulationStartY2+h.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(h)},s.prototype.resize=function(h){switch(this.activeGrip){case this.grip1:this.x1=h.x,this.y1=h.y;break;case this.grip2:case void 0:this.x2=h.x,this.y2=h.y}this.adjustVisual(),this.adjustControlBox()},s.prototype.select=function(){U.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){U.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=se.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){this.positionGrips()},s.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},s.prototype.createGrip=function(){var h=new Dt;return h.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(h.visual),h},s.prototype.positionGrips=function(){var h=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-h/2,this.y1-h/2),this.positionGrip(this.grip2.visual,this.x2-h/2,this.y2-h/2)},s.prototype.positionGrip=function(h,B,K){var N=h.transform.baseVal.getItem(0);N.setTranslate(B,K),h.transform.baseVal.replaceItem(N,0)},s.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},U.prototype.getState.call(this))},s.prototype.restoreState=function(h){U.prototype.restoreState.call(this,h);var B=h;this.x1=B.x1,this.y1=B.y1,this.x2=B.x2,this.y2=B.y2},s.prototype.scale=function(h,B){U.prototype.scale.call(this,h,B),this.x1=this.x1*h,this.y1=this.y1*B,this.x2=this.x2*h,this.y2=this.y2*B,this.adjustVisual(),this.adjustControlBox()},s}(Ze),Lt=function(U){function s(h,B,K){var N=U.call(this,h,B,K)||this;return N.strokeColor="transparent",N.strokeWidth=0,N.strokeDasharray="",N.setStrokeColor=N.setStrokeColor.bind(N),N.setStrokeWidth=N.setStrokeWidth.bind(N),N.setStrokeDasharray=N.setStrokeDasharray.bind(N),N.strokeColor=K.defaultColor,N.strokeWidth=K.defaultStrokeWidth,N.strokeDasharray=K.defaultStrokeDasharray,N.strokePanel=new ut("Line color",K.defaultColorSet,K.defaultColor),N.strokePanel.onColorChanged=N.setStrokeColor,N.strokeWidthPanel=new Nt("Line width",K.defaultStrokeWidths,K.defaultStrokeWidth),N.strokeWidthPanel.onWidthChanged=N.setStrokeWidth,N.strokeStylePanel=new At("Line style",K.defaultStrokeDasharrays,K.defaultStrokeDasharray),N.strokeStylePanel.onStyleChanged=N.setStrokeDasharray,N}return Ie(s,U),s.prototype.ownsTarget=function(h){return!(!U.prototype.ownsTarget.call(this,h)&&h!==this.visual&&h!==this.selectorLine&&h!==this.visibleLine)},s.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorLine=se.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=se.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(h,B){U.prototype.pointerDown.call(this,h,B),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},s.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),se.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setStrokeColor=function(h){this.strokeColor=h,this.adjustVisual(),this.colorChanged(h)},s.prototype.setStrokeWidth=function(h){this.strokeWidth=h,this.adjustVisual()},s.prototype.setStrokeDasharray=function(h){this.strokeDasharray=h,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 h=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},U.prototype.getState.call(this));return h.typeName=s.typeName,h},s.prototype.restoreState=function(h){U.prototype.restoreState.call(this,h);var B=h;this.strokeColor=B.strokeColor,this.strokeWidth=B.strokeWidth,this.strokeDasharray=B.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),Xe=function(U){function s(h,B,K,N){var ae=U.call(this,h,N||'<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 ae.fonts=[],ae.fontBoxes=[],ae.fonts=B,ae.currentFont=K,ae.setCurrentFont=ae.setCurrentFont.bind(ae),ae}return Ie(s,U),s.prototype.getUi=function(){var h=this,B=document.createElement("div");return B.style.overflow="hidden",B.style.flexGrow="2",this.fonts.forEach(function(K){var N=document.createElement("div");N.style.display="inline-block",N.style.alignItems="center",N.style.justifyContent="space-between",N.style.padding="5px",N.style.borderWidth="2px",N.style.borderStyle="solid",N.style.overflow="hidden",N.style.maxWidth=100/h.fonts.length-5+"%",N.style.borderColor=K===h.currentFont?h.uiStyleSettings.toolboxAccentColor:"transparent",N.addEventListener("click",function(){h.setCurrentFont(K,N)}),B.appendChild(N);var ae=document.createElement("div");ae.style.display="flex",ae.style.minHeight="20px",ae.style.flexGrow="2",ae.style.fontFamily=K,ae.style.overflow="hidden";var Be=document.createElement("div");Be.style.whiteSpace="nowrap",Be.style.overflow="hidden",Be.style.textOverflow="ellipsis",Be.innerHTML="The quick brown fox jumps over the lazy dog",ae.appendChild(Be),N.appendChild(ae),h.fontBoxes.push(N)}),B},s.prototype.setCurrentFont=function(h,B){var K=this;this.currentFont=h,this.fontBoxes.forEach(function(N){N.style.borderColor=N===B?K.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},s}(ft),nt=function(U){function s(h,B,K){var N=U.call(this,h,B,K)||this;return N.color="transparent",N.padding=5,N.DEFAULT_TEXT="your text here",N.text=N.DEFAULT_TEXT,N.isMoved=!1,N.color=K.defaultColor,N.fontFamily=K.defaultFontFamily,N.defaultSize={x:100,y:30},N.setColor=N.setColor.bind(N),N.setFont=N.setFont.bind(N),N.renderText=N.renderText.bind(N),N.sizeText=N.sizeText.bind(N),N.textEditDivClicked=N.textEditDivClicked.bind(N),N.showTextEditor=N.showTextEditor.bind(N),N.setSize=N.setSize.bind(N),N.positionTextEditor=N.positionTextEditor.bind(N),N.colorPanel=new ut("Color",K.defaultColorSet,K.defaultColor),N.colorPanel.onColorChanged=N.setColor,N.fontFamilyPanel=new Xe("Font",K.defaultFontFamilies,K.defaultFontFamily),N.fontFamilyPanel.onFontChanged=N.setFont,N}return Ie(s,U),s.prototype.ownsTarget=function(h){if(U.prototype.ownsTarget.call(this,h)||h===this.visual||h===this.textElement||h===this.bgRectangle)return!0;var B=!1;return this.textElement.childNodes.forEach(function(K){K===h&&(B=!0)}),B},s.prototype.createVisual=function(){this.visual=se.createGroup(),this.bgRectangle=se.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=se.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},s.prototype.pointerDown=function(h,B){U.prototype.pointerDown.call(this,h,B),this.isMoved=!1,this.pointerDownPoint=h,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(h),this._state="creating")},s.prototype.renderText=function(){var h=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(B){h.textElement.appendChild(se.createTSpan(B.trim()===""?" ":B.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},s.prototype.getTextScale=function(){var h=this.textElement.getBBox(),B=1;if(h.width>0&&h.height>0){var K=(1*this.width-this.width*this.padding*2/100)/h.width,N=(1*this.height-this.height*this.padding*2/100)/h.height;B=Math.min(K,N)}return B},s.prototype.getTextPosition=function(h){var B=this.textElement.getBBox(),K=0,N=0;return B.width>0&&B.height>0&&(K=(this.width-B.width*h)/2,N=this.height/2-B.height*h/2),{x:K,y:N}},s.prototype.sizeText=function(){var h=this.textElement.getBBox(),B=this.getTextScale(),K=this.getTextPosition(B);K.y-=h.y*B,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+K.x+"px, "+K.y+"px) scale("+B+", "+B+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(K.x,K.y),this.textElement.transform.baseVal.getItem(1).setScale(B,B))},s.prototype.manipulate=function(h){U.prototype.manipulate.call(this,h),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(h.x-this.pointerDownPoint.x)>5||Math.abs(h.y-this.pointerDownPoint.y)>5)},s.prototype.resize=function(h){U.prototype.resize.call(this,h),this.isMoved=!0,this.setSize(),this.sizeText()},s.prototype.setSize=function(){U.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},s.prototype.pointerUp=function(h){var B=this.state;B==="creating"&&(this._suppressMarkerCreateEvent=!0),U.prototype.pointerUp.call(this,h),this.setSize(),(B==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},s.prototype.showTextEditor=function(){var h=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(B){B.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var B=Number.parseFloat(h.textEditor.style.fontSize);h.textEditor.clientWidth>=Number.parseInt(h.textEditor.style.maxWidth)&&B>.9;)B-=.1,h.textEditor.style.fontSize=Math.max(B,.9)+"em"}),this.textEditor.addEventListener("keyup",function(B){B.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(B){if(B.clipboardData){var K=B.clipboardData.getData("text"),N=window.getSelection();if(!N.rangeCount)return!1;N.deleteFromDocument(),N.getRangeAt(0).insertNode(document.createTextNode(K)),B.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){h.textEditDivClicked(h.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 h=this.getTextScale(),B=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),K=this.textElement.getBBox(),N={x:K.width*h,y:K.height*h};B.x-=N.x/2,B.y-=N.y/2,this.textEditor.style.top=B.y+"px",this.textEditor.style.left=B.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-B.x+"px",this.textEditor.style.fontSize=Math.max(16*h,12)+"px",this.textElement.style.display="none"}},s.prototype.textEditDivClicked=function(h){this.text=h.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},s.prototype.select=function(){U.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},s.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),U.prototype.deselect.call(this)},s.prototype.dblClick=function(h,B){U.prototype.dblClick.call(this,h,B),this.showTextEditor()},s.prototype.setColor=function(h){this.textElement&&se.setAttributes(this.textElement,[["fill",h]]),this.color=h,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(h)},s.prototype.setFont=function(h){this.textElement&&se.setAttributes(this.textElement,[["font-family",h]]),this.fontFamily=h,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 h=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},U.prototype.getState.call(this));return h.typeName=s.typeName,h},s.prototype.restoreState=function(h){var B=h;this.color=B.color,this.fontFamily=B.fontFamily,this.padding=B.padding,this.text=B.text,this.createVisual(),U.prototype.restoreState.call(this,h),this.setSize()},s.prototype.scale=function(h,B){U.prototype.scale.call(this,h,B),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}(vt),_e=function(U){function s(h,B,K){var N=U.call(this,h,B,K)||this;return N.color="transparent",N.lineWidth=3,N.drawing=!1,N.pixelRatio=1,N.color=K.defaultColor,N.lineWidth=K.defaultStrokeWidth,N.pixelRatio=K.freehandPixelRatio,N.setColor=N.setColor.bind(N),N.addCanvas=N.addCanvas.bind(N),N.finishCreation=N.finishCreation.bind(N),N.setLineWidth=N.setLineWidth.bind(N),N.colorPanel=new ut("Color",K.defaultColorSet,K.defaultColor),N.colorPanel.onColorChanged=N.setColor,N.lineWidthPanel=new Nt("Line width",K.defaultStrokeWidths,K.defaultStrokeWidth),N.lineWidthPanel.onWidthChanged=N.setLineWidth,N}return Ie(s,U),s.prototype.ownsTarget=function(h){return!(!U.prototype.ownsTarget.call(this,h)&&h!==this.visual&&h!==this.drawingImage)},s.prototype.createVisual=function(){this.visual=se.createGroup(),this.drawingImage=se.createImage(),this.visual.appendChild(this.drawingImage);var h=se.createTransform();this.visual.transform.baseVal.appendItem(h),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(h,B){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(h.x,h.y),this.drawing=!0):U.prototype.pointerDown.call(this,h,B)},s.prototype.manipulate=function(h){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(h.x,h.y),this.canvasContext.stroke()):U.prototype.manipulate.call(this,h)},s.prototype.resize=function(h){U.prototype.resize.call(this,h),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(h){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):U.prototype.pointerUp.call(this,h)},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(),U.prototype.select.call(this)},s.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),U.prototype.deselect.call(this)},s.prototype.finishCreation=function(){for(var h=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),B=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],K=B[0],N=B[1],ae=B[2],Be=B[3],ze=!1,gt=0;gt<this.canvasElement.height;gt++)for(var je=0;je<this.canvasElement.width;je++)h.data[gt*this.canvasElement.width*4+4*je+3]>0&&(ze=!0,gt<N&&(N=gt),je<K&&(K=je),gt>Be&&(Be=gt),je>ae&&(ae=je));if(ze){this.left=K/this.pixelRatio,this.top=N/this.pixelRatio,this.width=(ae-K)/this.pixelRatio,this.height=(Be-N)/this.pixelRatio;var ct=document.createElement("canvas");ct.width=ae-K,ct.height=Be-N,ct.getContext("2d").putImageData(this.canvasContext.getImageData(K,N,ae-K,Be-N),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(){se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},s.prototype.setColor=function(h){this.color=h,this.colorChanged(h)},s.prototype.setLineWidth=function(h){this.lineWidth=h},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 h=Object.assign({drawingImgUrl:this.drawingImgUrl},U.prototype.getState.call(this));return h.typeName=s.typeName,h},s.prototype.restoreState=function(h){this.createVisual(),U.prototype.restoreState.call(this,h),this.drawingImgUrl=h.drawingImgUrl,this.setDrawingImage()},s.prototype.scale=function(h,B){U.prototype.scale.call(this,h,B),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}(vt),ve=function(U){function s(h,B,K){var N=U.call(this,h,K||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return N.typeBoxes=[],N.currentType=B,N.setCurrentType=N.setCurrentType.bind(N),N}return Ie(s,U),s.prototype.getUi=function(){var h=this,B=document.createElement("div");B.style.display="flex",B.style.overflow="hidden",B.style.flexGrow="2";for(var K=function(Be){var ze="both";switch(Be){case 0:ze="both";break;case 1:ze="start";break;case 2:ze="end";break;case 3:ze="none"}var gt=document.createElement("div");if(gt.style.display="flex",gt.style.flexGrow="2",gt.style.alignItems="center",gt.style.justifyContent="space-between",gt.style.padding="5px",gt.style.borderWidth="2px",gt.style.borderStyle="solid",gt.style.borderColor=ze===N.currentType?N.uiStyleSettings.toolboxAccentColor:"transparent",gt.addEventListener("click",function(){h.setCurrentType(ze,gt)}),B.appendChild(gt),ze==="both"||ze==="start"){var je=document.createElement("div");je.style.display="flex",je.style.alignItems="center",je.style.minHeight="20px",je.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="`+(N.uiStyleSettings!==void 0?N.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,je.style.marginLeft="5px",gt.appendChild(je)}var ct=document.createElement("div");ct.style.display="flex",ct.style.alignItems="center",ct.style.minHeight="20px",ct.style.flexGrow="2";var Wt=document.createElement("hr");if(Wt.style.minWidth="20px",Wt.style.border="0px",Wt.style.borderTop="3px solid "+(N.uiStyleSettings!==void 0?N.uiStyleSettings.toolboxColor:"#eeeeee"),Wt.style.flexGrow="2",ct.appendChild(Wt),gt.appendChild(ct),ze==="both"||ze==="end"){var Dr=document.createElement("div");Dr.style.display="flex",Dr.style.alignItems="center",Dr.style.minHeight="20px",Dr.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="`+(N.uiStyleSettings!==void 0?N.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Dr.style.marginRight="5px",gt.appendChild(Dr)}N.typeBoxes.push(gt)},N=this,ae=0;ae<4;ae++)K(ae);return B},s.prototype.setCurrentType=function(h,B){var K=this;this.currentType=h,this.typeBoxes.forEach(function(N){N.style.borderColor=N===B?K.uiStyleSettings!==void 0?K.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},s}(ft),Ce=function(U){function s(h,B,K){var N=U.call(this,h,B,K)||this;return N.arrowType="end",N.arrowBaseHeight=10,N.arrowBaseWidth=10,N.getArrowPoints=N.getArrowPoints.bind(N),N.setArrowType=N.setArrowType.bind(N),N.arrowTypePanel=new ve("Arrow type","end"),N.arrowTypePanel.onArrowTypeChanged=N.setArrowType,N}return Ie(s,U),s.prototype.ownsTarget=function(h){return!(!U.prototype.ownsTarget.call(this,h)&&h!==this.arrow1&&h!==this.arrow2)},s.prototype.getArrowPoints=function(h,B){var K=this.arrowBaseWidth+2*this.strokeWidth,N=this.arrowBaseHeight+2*this.strokeWidth;return h-K/2+","+(B+N/2)+" "+h+","+(B-N/2)+" "+(h+K/2)+","+(B+N/2)},s.prototype.createTips=function(){this.arrow1=se.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=se.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow2)},s.prototype.pointerDown=function(h,B){U.prototype.pointerDown.call(this,h,B),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(U.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",se.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),se.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var h=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),B=this.arrow1.transform.baseVal.getItem(0);B.setRotate(h,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(B,0);var K=this.arrow2.transform.baseVal.getItem(0);K.setRotate(h+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(K,0)}},s.prototype.setArrowType=function(h){this.arrowType=h,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 h=Object.assign({arrowType:this.arrowType},U.prototype.getState.call(this));return h.typeName=s.typeName,h},s.prototype.restoreState=function(h){U.prototype.restoreState.call(this,h);var B=h;this.arrowType=B.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}(Lt),ne=function(U){function s(h,B,K){var N=U.call(this,h,B,K)||this;return N.fillColor=K.defaultFillColor,N.strokeWidth=0,N.fillPanel=new ut("Color",K.defaultColorSet,K.defaultFillColor),N.fillPanel.onColorChanged=N.setFillColor,N}return Ie(s,U),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var h=U.prototype.getState.call(this);return h.typeName=s.typeName,h},s.typeName="CoverMarker",s.title="Cover marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',s}(mt),ie=function(U){function s(h,B,K,N){var ae=U.call(this,h,N||'<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 ae.opacities=[],ae.opacityBoxes=[],ae.opacities=B,ae.currentOpacity=K,ae.setCurrentOpacity=ae.setCurrentOpacity.bind(ae),ae}return Ie(s,U),s.prototype.getUi=function(){var h=this,B=document.createElement("div");return B.style.display="flex",B.style.overflow="hidden",B.style.flexGrow="2",B.style.justifyContent="space-between",this.opacities.forEach(function(K){var N=document.createElement("div");N.style.display="flex",N.style.alignItems="center",N.style.justifyContent="center",N.style.padding="5px",N.style.borderWidth="2px",N.style.borderStyle="solid",N.style.borderColor=K===h.currentOpacity?h.uiStyleSettings.toolboxAccentColor:"transparent",N.addEventListener("click",function(){h.setCurrentOpacity(K,N)}),B.appendChild(N);var ae=document.createElement("div");ae.innerText=100*K+"%",N.appendChild(ae),h.opacityBoxes.push(N)}),B},s.prototype.setCurrentOpacity=function(h,B){var K=this;this.currentOpacity=h,this.opacityBoxes.forEach(function(N){N.style.borderColor=N===B?K.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},s}(ft),ue=function(U){function s(h,B,K){var N=U.call(this,h,B,K)||this;return N.setOpacity=N.setOpacity.bind(N),N.fillColor=K.defaultHighlightColor,N.strokeWidth=0,N.opacity=K.defaultHighlightOpacity,N.fillPanel=new ut("Color",K.defaultColorSet,N.fillColor),N.fillPanel.onColorChanged=N.setFillColor,N.opacityPanel=new ie("Opacity",K.defaultOpacitySteps,N.opacity),N.opacityPanel.onOpacityChanged=N.setOpacity,N}return Ie(s,U),s.prototype.setOpacity=function(h){this.opacity=h,this.visual&&se.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var h=U.prototype.getState.call(this);return h.typeName=s.typeName,h},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}(ne),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>',Me=function(U){function s(h,B,K){var N=U.call(this,h,B,K)||this;return N.bgColor="transparent",N.tipPosition={x:0,y:0},N.tipBase1Position={x:0,y:0},N.tipBase2Position={x:0,y:0},N.tipMoving=!1,N.color=K.defaultStrokeColor,N.bgColor=K.defaultFillColor,N.fontFamily=K.defaultFontFamily,N.defaultSize={x:100,y:30},N.setBgColor=N.setBgColor.bind(N),N.getTipPoints=N.getTipPoints.bind(N),N.positionTip=N.positionTip.bind(N),N.setTipPoints=N.setTipPoints.bind(N),N.colorPanel=new ut("Text color",K.defaultColorSet,N.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>'),N.colorPanel.onColorChanged=N.setColor,N.bgColorPanel=new ut("Fill color",K.defaultColorSet,N.bgColor,he),N.bgColorPanel.onColorChanged=N.setBgColor,N.fontFamilyPanel=new Xe("Font",K.defaultFontFamilies,K.defaultFontFamily),N.fontFamilyPanel.onFontChanged=N.setFont,N.tipGrip=new Dt,N.tipGrip.visual.transform.baseVal.appendItem(se.createTransform()),N.controlBox.appendChild(N.tipGrip.visual),N}return Ie(s,U),s.prototype.ownsTarget=function(h){return U.prototype.ownsTarget.call(this,h)||this.tipGrip.ownsTarget(h)||this.tip===h},s.prototype.createTip=function(){se.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=se.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},s.prototype.pointerDown=function(h,B){this.state==="new"&&U.prototype.pointerDown.call(this,h,B),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(B)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):U.prototype.pointerDown.call(this,h,B)},s.prototype.pointerUp=function(h){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,U.prototype.pointerUp.call(this,h);else{var B=this.state==="creating";U.prototype.pointerUp.call(this,h),this.setTipPoints(B),this.positionTip()}},s.prototype.manipulate=function(h){if(this.tipMoving){var B=this.unrotatePoint(h);this.tipPosition={x:B.x-this.manipulationStartLeft,y:B.y-this.manipulationStartTop},this.positionTip()}else U.prototype.manipulate.call(this,h)},s.prototype.setBgColor=function(h){this.bgRectangle&&this.tip&&(se.setAttributes(this.bgRectangle,[["fill",h]]),se.setAttributes(this.tip,[["fill",h]])),this.bgColor=h,this.fillColorChanged(h)},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(h){h===void 0&&(h=!1);var B=Math.min(this.height/2,15),K=this.height/5;h&&(this.tipPosition={x:B+K/2,y:this.height+20});var N=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?N<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(K=this.width/5,B=Math.min(this.width/2,15),this.tipBase1Position={x:B,y:0},this.tipBase2Position={x:B+K,y:0}):(this.tipBase1Position={x:0,y:B},this.tipBase2Position={x:0,y:B+K}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?N<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(K=this.width/5,B=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-B-K,y:0},this.tipBase2Position={x:this.width-B,y:0}):(this.tipBase1Position={x:this.width,y:B},this.tipBase2Position={x:this.width,y:B+K}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?N<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(K=this.width/5,B=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-B-K,y:this.height},this.tipBase2Position={x:this.width-B,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-B-K},this.tipBase2Position={x:this.width,y:this.height-B}):N<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(K=this.width/5,B=Math.min(this.width/2,15),this.tipBase1Position={x:B,y:this.height},this.tipBase2Position={x:B+K,y:this.height}):(this.tipBase1Position={x:0,y:this.height-B},this.tipBase2Position={x:0,y:this.height-B-K})},s.prototype.resize=function(h){U.prototype.resize.call(this,h),this.positionTip()},s.prototype.positionTip=function(){se.setAttributes(this.tip,[["points",this.getTipPoints()]]);var h=this.tipGrip.visual.transform.baseVal.getItem(0);h.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(h,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(),U.prototype.select.call(this)},s.prototype.getState=function(){var h=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},U.prototype.getState.call(this));return h.typeName=s.typeName,h},s.prototype.restoreState=function(h){var B=h;this.bgColor=B.bgColor,this.tipPosition=B.tipPosition,U.prototype.restoreState.call(this,h),this.createTip(),this.setTipPoints()},s.prototype.scale=function(h,B){U.prototype.scale.call(this,h,B),this.tipPosition={x:this.tipPosition.x*h,y:this.tipPosition.y*B},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}(nt),be=function(U){function s(h,B,K){var N=U.call(this,h,B,K)||this;return N.fillColor="transparent",N.strokeColor="transparent",N.strokeWidth=0,N.strokeDasharray="",N.opacity=1,N.strokeColor=K.defaultColor,N.strokeWidth=K.defaultStrokeWidth,N.strokeDasharray=K.defaultStrokeDasharray,N.fillColor=K.defaultFillColor,N.setStrokeColor=N.setStrokeColor.bind(N),N.setFillColor=N.setFillColor.bind(N),N.setStrokeWidth=N.setStrokeWidth.bind(N),N.setStrokeDasharray=N.setStrokeDasharray.bind(N),N.setOpacity=N.setOpacity.bind(N),N.createVisual=N.createVisual.bind(N),N.strokePanel=new ut("Line color",xe(K.defaultColorSet,["transparent"]),K.defaultColor),N.strokePanel.onColorChanged=N.setStrokeColor,N.fillPanel=new ut("Fill color",xe(K.defaultColorSet,["transparent"]),N.fillColor,he),N.fillPanel.onColorChanged=N.setFillColor,N.strokeWidthPanel=new Nt("Line width",K.defaultStrokeWidths,K.defaultStrokeWidth),N.strokeWidthPanel.onWidthChanged=N.setStrokeWidth,N.strokeStylePanel=new At("Line style",K.defaultStrokeDasharrays,K.defaultStrokeDasharray),N.strokeStylePanel.onStyleChanged=N.setStrokeDasharray,N.opacityPanel=new ie("Opacity",K.defaultOpacitySteps,N.opacity),N.opacityPanel.onOpacityChanged=N.setOpacity,N}return Ie(s,U),s.prototype.ownsTarget=function(h){return!(!U.prototype.ownsTarget.call(this,h)&&h!==this.visual)},s.prototype.createVisual=function(){this.visual=se.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(h,B){U.prototype.pointerDown.call(this,h,B),this.state==="new"&&(this.createVisual(),this.moveVisual(h),this._state="creating")},s.prototype.manipulate=function(h){U.prototype.manipulate.call(this,h)},s.prototype.resize=function(h){U.prototype.resize.call(this,h),this.setSize()},s.prototype.setSize=function(){U.prototype.setSize.call(this),se.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},s.prototype.pointerUp=function(h){U.prototype.pointerUp.call(this,h),this.setSize()},s.prototype.setStrokeColor=function(h){this.strokeColor=h,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(h),this.stateChanged()},s.prototype.setFillColor=function(h){this.fillColor=h,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(h),this.stateChanged()},s.prototype.setStrokeWidth=function(h){this.strokeWidth=h,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(h){this.strokeDasharray=h,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.setOpacity=function(h){this.opacity=h,this.visual&&se.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var h=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},U.prototype.getState.call(this));return h.typeName=s.typeName,h},s.prototype.restoreState=function(h){var B=h;this.fillColor=B.fillColor,this.strokeColor=B.strokeColor,this.strokeWidth=B.strokeWidth,this.strokeDasharray=B.strokeDasharray,this.opacity=B.opacity,this.createVisual(),U.prototype.restoreState.call(this,h),this.setSize()},s.prototype.scale=function(h,B){U.prototype.scale.call(this,h,B),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}(vt),Le=function(U){function s(h,B,K){return U.call(this,h,B,K)||this}return Ie(s,U),Object.defineProperty(s.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(h){return!(!U.prototype.ownsTarget.call(this,h)&&h!==this.tip1&&h!==this.tip2)},s.prototype.createTips=function(){this.tip1=se.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.tip1),this.tip2=se.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.tip2)},s.prototype.pointerDown=function(h,B){U.prototype.pointerDown.call(this,h,B),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(U.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(se.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var h=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),B=this.tip1.transform.baseVal.getItem(0);B.setRotate(h,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(B,0);var K=this.tip2.transform.baseVal.getItem(0);K.setRotate(h+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(K,0)}},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var h=U.prototype.getState.call(this);return h.typeName=s.typeName,h},s.prototype.restoreState=function(h){U.prototype.restoreState.call(this,h),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}(Lt),tt=function(U){function s(h,B,K){var N=U.call(this,h,B,K)||this;return N.strokePanel.colors=K.defaultColorSet,N.fillColor="transparent",N}return Ie(s,U),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var h=U.prototype.getState.call(this);return h.typeName=s.typeName,h},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}(be),pt=function(){function U(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(U.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),U.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))},U.prototype.replaceLastUndoStep=function(s){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=s)},U.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},U.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}},U.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},U}(),yt=function(U){function s(h,B,K){var N=U.call(this,h,B,K)||this;return N.strokeColor="transparent",N.strokeWidth=0,N.strokeDasharray="",N.curveX=0,N.curveY=0,N.manipulationStartCurveX=0,N.manipulationStartCurveY=0,N.setStrokeColor=N.setStrokeColor.bind(N),N.setStrokeWidth=N.setStrokeWidth.bind(N),N.setStrokeDasharray=N.setStrokeDasharray.bind(N),N.positionGrips=N.positionGrips.bind(N),N.addControlGrips=N.addControlGrips.bind(N),N.adjustVisual=N.adjustVisual.bind(N),N.setupControlBox=N.setupControlBox.bind(N),N.resize=N.resize.bind(N),N.strokeColor=K.defaultColor,N.strokeWidth=K.defaultStrokeWidth,N.strokeDasharray=K.defaultStrokeDasharray,N.strokePanel=new ut("Line color",K.defaultColorSet,K.defaultColor),N.strokePanel.onColorChanged=N.setStrokeColor,N.strokeWidthPanel=new Nt("Line width",K.defaultStrokeWidths,K.defaultStrokeWidth),N.strokeWidthPanel.onWidthChanged=N.setStrokeWidth,N.strokeStylePanel=new At("Line style",K.defaultStrokeDasharrays,K.defaultStrokeDasharray),N.strokeStylePanel.onStyleChanged=N.setStrokeDasharray,N}return Ie(s,U),s.prototype.ownsTarget=function(h){return!(!U.prototype.ownsTarget.call(this,h)&&h!==this.visual&&h!==this.selectorCurve&&h!==this.visibleCurve&&!this.curveGrip.ownsTarget(h))},s.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},s.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorCurve=se.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=se.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(h,B){U.prototype.pointerDown.call(this,h,B),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=h.x,this.curveY=h.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(B)&&(this.activeGrip=this.curveGrip,this._state="resize")},s.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),se.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setupControlBox=function(){U.prototype.setupControlBox.call(this),this.curveControlLine1=se.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=se.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},s.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,U.prototype.addControlGrips.call(this)},s.prototype.positionGrips=function(){U.prototype.positionGrips.call(this);var h=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-h/2,this.curveY-h/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(h){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+h.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+h.y-this.manipulationStartY),U.prototype.manipulate.call(this,h)},s.prototype.resize=function(h){this.activeGrip===this.curveGrip&&(this.curveX=h.x,this.curveY=h.y),U.prototype.resize.call(this,h),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(h){this.strokeColor=h,this.adjustVisual(),this.colorChanged(h)},s.prototype.setStrokeWidth=function(h){this.strokeWidth=h,this.adjustVisual()},s.prototype.setStrokeDasharray=function(h){this.strokeDasharray=h,this.adjustVisual()},s.prototype.scale=function(h,B){this.curveX=this.curveX*h,this.curveY=this.curveY*B,U.prototype.scale.call(this,h,B)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var h=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},U.prototype.getState.call(this));return h.typeName=s.typeName,h},s.prototype.restoreState=function(h){U.prototype.restoreState.call(this,h);var B=h;this.strokeColor=B.strokeColor,this.strokeWidth=B.strokeWidth,this.strokeDasharray=B.strokeDasharray,this.curveX=B.curveX,this.curveY=B.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),Gt=function(){function U(s,h){h===void 0&&(h=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=s,this.cancelable=h}return Object.defineProperty(U.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),U.prototype.preventDefault=function(){this._defaultPrevented=!0},U}(),Tt=function(U){function s(h,B,K){var N=U.call(this,h,!1)||this;return N.dataUrl=B,N.state=K,N}return Ie(s,U),s}(Gt),Ge=function(U){function s(h,B,K){K===void 0&&(K=!1);var N=U.call(this,h,K)||this;return N.marker=B,N}return Ie(s,U),s}(Gt),gr=function(){function U(){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 U.prototype.addEventListener=function(s,h){this[s].push(h)},U.prototype.removeEventListener=function(s,h){var B=this[s].indexOf(h);B>-1&&this[s].splice(B,1)},U}(),Fe=function(){function U(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 He,this._isOpen=!1,this.undoRedoManager=new pt,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 gr,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=U.instanceCounter++,this.styles=new rt(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(U.prototype,"ALL_MARKER_TYPES",{get:function(){return[Ot,_e,Ce,nt,tt,be,ue,Me,Le,ne,Lt,yt]},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Ot,_e,Ce,nt,be,ue,Me]},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Ot,_e,Ce,nt,ue]},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(s){var h=this;this._availableMarkerTypes.splice(0),s.forEach(function(B){if(typeof B=="string"){var K=h.ALL_MARKER_TYPES.find(function(N){return N.typeName===B});K!==void 0&&h._availableMarkerTypes.push(K)}else h._availableMarkerTypes.push(B)})},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(U.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(U.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),U.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),ke.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},U.prototype.show=function(){var s=this;this.styles.styleSheetRoot===void 0&&at.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=at.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(h){return h(new Gt(s))})},U.prototype.render=function(){return We(this,void 0,void 0,function(){var s;return Ue(this,function(h){switch(h.label){case 0:return this.setCurrentMarker(),(s=new dt).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 h.sent(),[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,h.sent()]}})})},U.prototype.close=function(s){var h=this;if(s===void 0&&(s=!1),this.isOpen){var B=!1;s||this.eventListeners.beforeclose.forEach(function(K){var N=new Gt(h,!0);K(N),N.defaultPrevented&&(B=!0)}),B||(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(K){return K(new Gt(h))}),this.detachEvents(),this._isOpen=!1)}},U.prototype.addMarkersToToolbar=function(){for(var s,h=[],B=0;B<arguments.length;B++)h[B]=arguments[B];(s=this._availableMarkerTypes).push.apply(s,h)},U.prototype.addRenderEventListener=function(s){this.addEventListener("render",function(h){s(h.dataUrl,h.state)})},U.prototype.removeRenderEventListener=function(s){},U.prototype.addCloseEventListener=function(s){this.addEventListener("close",function(){s()})},U.prototype.removeCloseEventListener=function(s){},U.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))},U.prototype.onPopupTargetResize=function(){var s=1*this.target.clientWidth/this.target.clientHeight,h=this.editorCanvas.clientWidth/s>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*s:this.editorCanvas.clientWidth,B=h<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/s;this.resize(h,B)},U.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},U.prototype.resize=function(s,h){this._isResizing=!0;var B=s/this.imageWidth,K=h/this.imageHeight;this.imageWidth=Math.round(s),this.imageHeight=Math.round(h),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(B,K),this._isResizing=!1},U.prototype.scaleMarkers=function(s,h){var B,K=this;this._currentMarker&&this._currentMarker instanceof nt?this._currentMarker.scale(s,h):(B=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(N){N!==K._currentMarker&&N.scale(s,h)}),B!==void 0&&this.setCurrentMarker(B)},U.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"},U.prototype.setTopLeft=function(){var s=this.editingTarget.getBoundingClientRect(),h=this.editorCanvas.getBoundingClientRect();this.left=s.left-h.left,this.top=s.top-h.top},U.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)},U.prototype.addDefs=function(){for(var s,h=[],B=0;B<arguments.length;B++)h[B]=arguments[B];this.defs=se.createDefs(),this.addDefsToImage(),(s=this.defs).append.apply(s,h)},U.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},U.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)},U.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},U.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},U.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)},U.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},U.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)},U.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()},U.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")},U.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"},U.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},U.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 $e(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 it(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},U.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},U.prototype.removeMarker=function(s){this.markerImage.removeChild(s.container),this.markers.indexOf(s)>-1&&this.markers.splice(this.markers.indexOf(s),1),s.dispose()},U.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())},U.prototype.toolbarButtonClicked=function(s,h){if(s==="marker"&&h!==void 0)this.createNewMarker(h);else if(s==="action")switch(h){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()}},U.prototype.deleteSelectedMarker=function(){var s=this;if(this._currentMarker!==void 0){var h=!1;if(this.eventListeners.markerbeforedelete.forEach(function(K){var N=new Ge(s,s._currentMarker,!0);K(N),N.defaultPrevented&&(h=!0)}),!h){var B=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(K){return K(new Ge(s,B))})}}},U.prototype.clear=function(){var s=this,h=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ae){var Be=new Ge(s,void 0,!0);ae(Be),Be.defaultPrevented&&(h=!0)}),!h)){this.setCurrentMarker();for(var B=function(ae){var Be=K.markers[ae];K.setCurrentMarker(K.markers[ae]),K._currentMarker.dispose(),K.markerImage.removeChild(K._currentMarker.container),K.markers.splice(K.markers.indexOf(K._currentMarker),1),K.eventListeners.markerdelete.forEach(function(ze){return ze(new Ge(s,Be))})},K=this,N=this.markers.length-1;N>=0;N--)B(N);this.addUndoStep()}},Object.defineProperty(U.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),U.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))},U.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)},U.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},U.prototype.addUndoStep=function(){var s=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var h=this.getState(),B=this.undoRedoManager.getLastUndoStep();if(!B||B.width===h.width&&B.height===h.height){var K=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(h),K<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(N){return N(new Gt(s))})}else this.undoRedoManager.replaceLastUndoStep(h),this.eventListeners.statechange.forEach(function(N){return N(new Gt(s))})}},U.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},U.prototype.undoStep=function(){var s=this,h=this.undoRedoManager.undo();h!==void 0&&(this.restoreState(h),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(B){return B(new Gt(s))}))},U.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},U.prototype.redoStep=function(){var s=this,h=this.undoRedoManager.redo();h!==void 0&&(this.restoreState(h),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(B){return B(new Gt(s))}))},U.prototype.stepZoom=function(){var s=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=s<this.zoomSteps.length-1?this.zoomSteps[s+1]:this.zoomSteps[0]},U.prototype.panTo=function(s){this.contentDiv.scrollBy({left:this.prevPanPoint.x-s.x,top:this.prevPanPoint.y-s.y}),this.prevPanPoint=s},U.prototype.startRenderAndClose=function(){return We(this,void 0,void 0,function(){var s,h,B=this;return Ue(this,function(K){switch(K.label){case 0:return[4,this.render()];case 1:return s=K.sent(),h=this.getState(),this.eventListeners.render.forEach(function(N){return N(new Tt(B,s,h))}),this.close(!0),[2]}})})},U.prototype.getState=function(s){s===!0&&this.setCurrentMarker();var h={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(B){return h.markers.push(B.getState())}),h},U.prototype.restoreState=function(s){var h=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);s.markers.forEach(function(B){var K=h._availableMarkerTypes.find(function(ae){return ae.typeName===B.typeName});if(K!==void 0){var N=h.addNewMarker(K);N.restoreState(B),h.markers.push(N)}}),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(B){return B(new Gt(h))})},U.prototype.addNewMarker=function(s){var h=se.createGroup();return this.markerImage.appendChild(h),new s(h,this.overlayContainer,this.settings)},U.prototype.createNewMarker=function(s){var h,B=this;(h=typeof s=="string"?this._availableMarkerTypes.find(function(K){return K.typeName===s}):s)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(h),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(h.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(K){return K(new Ge(B,B._currentMarker))}))},U.prototype.markerCreated=function(s){var h=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(s),this.setCurrentMarker(s),s instanceof _e&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(_e):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(B){return B(new Ge(h,h._currentMarker))})},U.prototype.colorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=s,this.settings.defaultStrokeColor=s)},U.prototype.fillColorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=s)},U.prototype.markerStateChanged=function(s){var h=this;this.eventListeners.markerchange.forEach(function(B){return B(new Ge(h,s))})},U.prototype.setCurrentMarker=function(s){var h=this;this._currentMarker!==s&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(B){return B(new Ge(h,h._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(B){return B(new Ge(h,h._currentMarker))}))},U.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 h=this.markers.find(function(B){return B.ownsTarget(s.target)});h!==void 0?(this.setCurrentMarker(h),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))},U.prototype.onDblClick=function(s){if(this._isFocused||this.focus(),this.mode==="select"){var h=this.markers.find(function(B){return B.ownsTarget(s.target)});h!==void 0&&h!==this._currentMarker&&this.setCurrentMarker(h),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target):this.setCurrentMarker()}},U.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}))},U.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()},U.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},U.prototype.onKeyUp=function(s){this._currentMarker===void 0||this.notesArea!==void 0||s.key!=="Delete"&&s.key!=="Backspace"||this.deleteSelectedMarker()},U.prototype.clientToLocalCoordinates=function(s,h){var B=this.markerImage.getBoundingClientRect();return{x:(s-B.left)/this.zoomLevel,y:(h-B.top)/this.zoomLevel}},U.prototype.onWindowResize=function(){this.positionUI()},U.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()},U.prototype.addLicenseKey=function(s){ke.addKey(s)},U.prototype.addEventListener=function(s,h){this.eventListeners.addEventListener(s,h)},U.prototype.removeEventListener=function(s,h){this.eventListeners.removeEventListener(s,h)},U.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(U.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),U.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(h){return h(new Gt(s))}))},U.prototype.blur=function(){var s=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(h){return h(new Gt(s))}))},U.instanceCounter=0,U}();/* **********************************
|
|
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 or=function(U,s){return(or=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,B){h.__proto__=B}||function(h,B){for(var K in B)Object.prototype.hasOwnProperty.call(B,K)&&(h[K]=B[K])})(U,s)};function er(U,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function h(){this.constructor=U}or(U,s),U.prototype=s===null?Object.create(s):(h.prototype=s.prototype,new h)}function Bt(U,s,h,B){return new(h||(h=Promise))(function(K,N){function ae(gt){try{ze(B.next(gt))}catch(je){N(je)}}function Be(gt){try{ze(B.throw(gt))}catch(je){N(je)}}function ze(gt){var je;gt.done?K(gt.value):(je=gt.value,je instanceof h?je:new h(function(ct){ct(je)})).then(ae,Be)}ze((B=B.apply(U,s||[])).next())})}function qt(U,s){var h,B,K,N,ae={label:0,sent:function(){if(1&K[0])throw K[1];return K[1]},trys:[],ops:[]};return N={next:Be(0),throw:Be(1),return:Be(2)},typeof Symbol=="function"&&(N[Symbol.iterator]=function(){return this}),N;function Be(ze){return function(gt){return function(je){if(h)throw new TypeError("Generator is already executing.");for(;ae;)try{if(h=1,B&&(K=2&je[0]?B.return:je[0]?B.throw||((K=B.return)&&K.call(B),0):B.next)&&!(K=K.call(B,je[1])).done)return K;switch(B=0,K&&(je=[2&je[0],K.value]),je[0]){case 0:case 1:K=je;break;case 4:return ae.label++,{value:je[1],done:!1};case 5:ae.label++,B=je[1],je=[0];continue;case 7:je=ae.ops.pop(),ae.trys.pop();continue;default:if(!(K=ae.trys,(K=K.length>0&&K[K.length-1])||je[0]!==6&&je[0]!==2)){ae=0;continue}if(je[0]===3&&(!K||je[1]>K[0]&&je[1]<K[3])){ae.label=je[1];break}if(je[0]===6&&ae.label<K[1]){ae.label=K[1],K=je;break}if(K&&ae.label<K[2]){ae.label=K[2],ae.ops.push(je);break}K[2]&&ae.ops.pop(),ae.trys.pop();continue}je=s.call(U,ae)}catch(ct){je=[6,ct],B=0}finally{h=K=0}if(5&je[0])throw je[1];return{value:je[0]?je[1]:void 0,done:!0}}([ze,gt])}}}var pr=function(){function U(){}return U.addKey=function(s){U.key=s},Object.defineProperty(U,"isLicensed",{get:function(){return!!U.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(U.key)},enumerable:!1,configurable:!0}),U}(),kt=function(){function U(){}return U.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},U.setAttributes=function(s,h){for(var B=0,K=h;B<K.length;B++){var N=K[B],ae=N[0],Be=N[1];s.setAttribute(ae,Be)}},U.createRect=function(s,h,B){var K=document.createElementNS("http://www.w3.org/2000/svg","rect");return K.setAttribute("width",s.toString()),K.setAttribute("height",h.toString()),B&&U.setAttributes(K,B),K},U.createLine=function(s,h,B,K,N){var ae=document.createElementNS("http://www.w3.org/2000/svg","line");return ae.setAttribute("x1",s.toString()),ae.setAttribute("y1",h.toString()),ae.setAttribute("x2",B.toString()),ae.setAttribute("y2",K.toString()),N&&U.setAttributes(ae,N),ae},U.createPolygon=function(s,h){var B=document.createElementNS("http://www.w3.org/2000/svg","polygon");return B.setAttribute("points",s),h&&U.setAttributes(B,h),B},U.createCircle=function(s,h){var B=document.createElementNS("http://www.w3.org/2000/svg","circle");return B.setAttribute("cx",(s/2).toString()),B.setAttribute("cy",(s/2).toString()),B.setAttribute("r",s.toString()),h&&U.setAttributes(B,h),B},U.createEllipse=function(s,h,B){var K=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return K.setAttribute("cx",(s/2).toString()),K.setAttribute("cy",(h/2).toString()),K.setAttribute("rx",(s/2).toString()),K.setAttribute("ry",(h/2).toString()),B&&U.setAttributes(K,B),K},U.createGroup=function(s){var h=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&U.setAttributes(h,s),h},U.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},U.createMarker=function(s,h,B,K,N,ae,Be){var ze=document.createElementNS("http://www.w3.org/2000/svg","marker");return U.setAttributes(ze,[["id",s],["orient",h],["markerWidth",B.toString()],["markerHeight",K.toString()],["refX",N.toString()],["refY",ae.toString()]]),ze.appendChild(Be),ze},U.createText=function(s){var h=document.createElementNS("http://www.w3.org/2000/svg","text");return h.setAttribute("x","0"),h.setAttribute("y","0"),s&&U.setAttributes(h,s),h},U.createTSpan=function(s,h){var B=document.createElementNS("http://www.w3.org/2000/svg","tspan");return B.textContent=s,h&&U.setAttributes(B,h),B},U.createImage=function(s){var h=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&U.setAttributes(h,s),h},U.createPoint=function(s,h){var B=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return B.x=s,B.y=h,B},U.createPath=function(s,h){var B=document.createElementNS("http://www.w3.org/2000/svg","path");return B.setAttribute("d",s),h&&U.setAttributes(B,h),B},U.createElement=function(s,h){var B=document.createElementNS("http://www.w3.org/2000/svg",s);return h&&U.setAttributes(B,h),B},U.getHollowRectanglePath=function(s,h,B,K,N,ae,Be,ze){return"M"+s+","+h+"V"+(h+K)+"H"+(s+B)+"V"+h+"H"+N+"V"+ae+"H"+(N+Be)+"V"+(ae+ze)+"H"+N+"V"+h+"Z"},U}(),Gr=function(){function U(s){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(U.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(U.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(U.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),U.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},U.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)},U.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 br("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new br("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new br("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new wr("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new wr("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},U.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},U}(),br=function(U,s){this.selector=U,this.style=s},wr=function(U,s){this.localName=U,this.style=s},Lr=function(){function U(){this.blocks=[],this.display=""}return U.prototype.addButtonBlock=function(s){s.className=this.blockClassName,s.buttonClassName=this.buttonClassName,s.buttonColorsClassName=this.buttonColorsClassName,s.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(s)},U.prototype.addElementBlock=function(s){s.className===void 0&&(s.className=this.blockClassName),this.blocks.push(s)},U.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(h){return s.appendChild(h.getUI())}),s},U}(),Br=function(){function U(){}return U.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},U}(),ur=function(U){function s(){var h=U!==null&&U.apply(this,arguments)||this;return h.buttons=[],h}return er(s,U),s.prototype.addButton=function(h){h.className=this.buttonClassName,h.colorsClassName=this.buttonColorsClassName,h.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(h)},s.prototype.getUI=function(){var h=U.prototype.getUI.call(this);return this.buttons.forEach(function(B){return h.appendChild(B.getUI())}),h},s}(Br),Ht=function(){function U(s,h){this._isActive=!1,this._isHidden=!1,this._icon=s,this.title=h,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(U.prototype,"icon",{get:function(){return this._icon},set:function(s){this._icon=s,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"isActive",{get:function(){return this._isActive},set:function(s){this._isActive=s,this.adjustClassName()},enumerable:!1,configurable:!0}),U.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},U.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,"")))},U.prototype.hide=function(){this._isHidden=!0},U}(),_t=function(U){function s(){var h=U!==null&&U.apply(this,arguments)||this;return h.elements=[],h}return er(s,U),s.prototype.addElement=function(h){this.elements.push(h)},s.prototype.getUI=function(){var h=U.prototype.getUI.call(this);return this.elements.forEach(function(B){return h.appendChild(B)}),h},s}(Br),Vr=function(){function U(s,h){this.horizontal=s,this.vertical=h}return Object.defineProperty(U.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),U.prototype.getVerticalLength=function(s){return s/this.ratio},U.prototype.getHorizontalLength=function(s){return s*this.ratio},U}(),Fr=function(){function U(){}return U.getIcon=function(s,h){if(s>0&&h>0){var B=new Vr(s,h),K=B.ratio>=1?20:B.getHorizontalLength(20),N=B.ratio<1?20:B.getVerticalLength(20),ae=document.createElementNS("http://www.w3.org/2000/svg","svg");ae.setAttribute("xmlns","http://www.w3.org/2000/svg"),ae.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ae);var Be=kt.createDefs();ae.appendChild(Be);var ze=kt.createElement("clipPath",[["id","text-bg-clip"]]);Be.appendChild(ze);var gt=kt.createPath(kt.getHollowRectanglePath((24-K)/2,(24-N)/2,K,N,(24-K)/2+2,(24-N)/2+2,K-4,N-4));ae.appendChild(gt);var je=kt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);je.appendChild(kt.createTSpan(s+":"+h)),ae.appendChild(je);var ct=je.getBBox();kt.setAttributes(je,[["x",((24-ct.width)/2).toString()],["y",((24-ct.height)/2-ct.y).toString()]]);var Wt=kt.createPath(kt.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 ze.appendChild(Wt),kt.setAttributes(gt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ae),ae.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>'},U}(),Ar=function(U){function s(h,B,K){var N=U.call(this,h,B)||this;return N.isDropdownOpen=!1,N.onClick=N.dropdownButtonClicked,N.dropdownButtons=K,N}return er(s,U),s.prototype.setupDropdown=function(){var h=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(B){B.className=h.className,B.colorsClassName=h.colorsClassName,h.dropdownBlock.appendChild(B.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}(Ht),Kt=function(){function U(s,h){this.GRIP_SIZE=10,this.color=s,this.fillColor=h,this.visual=kt.createGroup(),this.visual.appendChild(kt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(kt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return U.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},U.prototype.setCenter=function(s,h){this.visual.childNodes.forEach(function(B){return kt.setAttributes(B,[["cx",s.toString()],["cy",h.toString()]])})},U}(),Xr=function(){function U(s,h,B,K){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=s,this.canvasHeight=h,this.margin=B,this.container=K,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(U.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(U.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.gridContainer&&kt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(s){this._zoomFactor=s,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),U.prototype.open=function(){var s=this;this.cropShadeElement=kt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=kt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var h=0;h<this.numberOfGridLines;h++)this.horizontalGridLines.push(kt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(kt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(B){return s.gridContainer.appendChild(B)}),this.verticalGridLines.forEach(function(B){return s.gridContainer.appendChild(B)}),this.cropRectElement=kt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},U.prototype.setCropRectangle=function(s){this.cropRect=s;var h=Object.assign({},this.cropRect);this.zoomFactor!==1&&(h.width=this.cropRect.width*this.zoomFactor,h.height=this.cropRect.height*this.zoomFactor,h.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-h.width/2,h.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-h.height/2),kt.setAttributes(this.cropRectElement,[["x",h.x.toString()],["y",h.y.toString()],["width",h.width.toString()],["height",h.height.toString()]]);var B=h.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(N,ae){var Be=h.y+B*(ae+1);kt.setAttributes(N,[["x1",""+h.x],["y1",""+Be],["x2",""+(h.x+h.width)],["y2",""+Be]])});var K=h.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(N,ae){var Be=h.x+K*(ae+1);kt.setAttributes(N,[["x1",""+Be],["y1",""+h.y],["x2",""+Be],["y2",""+(h.y+h.height)]])}),kt.setAttributes(this.cropShadeElement,[["d",kt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,h.x,h.y,h.width,h.height)]]),this.topLeftGrip.setCenter(h.x,h.y),this.topRightGrip.setCenter(h.x+h.width,h.y),this.bottomLeftGrip.setCenter(h.x,h.y+h.height),this.bottomRightGrip.setCenter(h.x+h.width,h.y+h.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},U.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)},U.prototype.clientToLocalCoordinates=function(s,h){var B=this.container.getBoundingClientRect();return{x:s-B.left+this.margin,y:h-B.top+this.margin}},U.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)},U.prototype.onPointerMove=function(s){if(this.isMoving)this.move(this.clientToLocalCoordinates(s.clientX,s.clientY));else if(this.activeGrip){var h=this.clientToLocalCoordinates(s.clientX,s.clientY);this.resize(h)}s.preventDefault()},U.prototype.onPointerUp=function(s){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(s.pointerId)},U.prototype.move=function(s){var h=s.x-this.previousPoint.x,B=s.y-this.previousPoint.y;this.zoomFactor!==1&&(h=-h/this.zoomFactor,B=-B/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+h),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+B),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=s},U.prototype.resize=function(s){var h=Object.assign({},this.cropRect),B=s.x-this.previousPoint.x,K=s.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:h.x+B<this.margin&&(B=this.margin-h.x),h.x+=B,h.width=this.cropRect.x+this.cropRect.width-h.x;break;case this.bottomRightGrip:case this.topRightGrip:h.width+B>this.canvasWidth*this.zoomFactor&&(B=this.canvasWidth*this.zoomFactor-h.width),h.width+=B}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(h.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(B),h.height=this.aspectRatio.getVerticalLength(h.width)):(h.y+=K,h.height=this.cropRect.y+this.cropRect.height-h.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?h.height=this.aspectRatio.getVerticalLength(h.width):h.height+=K}h.width<10&&(h.x=this.cropRect.x,h.width=10),h.height<10&&(h.y=this.cropRect.y,h.height=10),this.previousPoint=s,h.x>=this.margin&&h.y>=this.margin&&h.x-this.margin+h.width<=this.canvasWidth&&h.y-this.margin+h.height<=this.canvasHeight&&(this.cropRect=h,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},U.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,h=this.cropRect.y+this.cropRect.height/2,B=this.aspectRatio.getHorizontalLength(this.cropRect.height),K=this.aspectRatio.getVerticalLength(this.cropRect.width);B/this.canvasWidth<K/this.canvasHeight?this.cropRect.width=B:this.cropRect.height=K,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=h-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)}},U.prototype.getRescaledRect=function(s,h,B,K,N,ae){var Be=B/s,ze=K/h;return{x:(N.x-ae)*Be+ae,y:(N.y-ae)*ze+ae,width:N.width*Be,height:N.height*ze}},U.prototype.scaleCanvas=function(s,h){var B=this.getRescaledRect(this.canvasWidth,this.canvasHeight,s,h,this.cropRect,this.margin);this.canvasWidth=s,this.canvasHeight=h,this.onCropChange&&this.onCropChange(B),this.setCropRectangle(B)},U}(),Zr=function(){function U(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(U.prototype,"angle",{get:function(){return this._angle},set:function(s){this._angle=s,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),U.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},U.prototype.onPointerDown=function(s){this.controlContainer.setPointerCapture(s.pointerId),this.isDragging=!0,this.previousPoint={x:s.clientX,y:s.clientY}},U.prototype.onPointerMove=function(s){this.isDragging&&(this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.previousPoint.x=s.clientX)},U.prototype.onPointerUp=function(s){this.isDragging&&this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(s.pointerId)},U.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var s=this.angleLabelText.getBBox();kt.setAttributes(this.angleLabelElement,[["x",((this.width-s.width)/2).toString()],["y",(this.height/2).toString()]])}},U.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)}},U.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 h="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,B=1;B<=this.width/5+10;B++){var K=B%5==0?this.height/3:this.height/6;h+="h4v"+-K+"h1v"+K}h+="v1H0Z",this.scaleShape=kt.createPath(h);var N=kt.createTransform();this.scaleShape.transform.baseVal.appendItem(N),s.appendChild(this.scaleShape),this.angleLabelElement=kt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=kt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ae=kt.createTSpan("");return ae.innerHTML="°",this.angleLabelElement.appendChild(ae),s.appendChild(this.angleLabelElement),document.body.removeChild(s),s},U}(),Yr=function(){function U(){this.naturalSize=!1,this.imageType="image/png"}return U.prototype.rasterize=function(s,h,B,K,N,ae,Be){var ze=this;return new Promise(function(gt){var je=document.createElement("canvas");je.width=s.width.baseVal.value-2*K,je.height=s.height.baseVal.value-2*K;var ct=1,Wt=1;ze.naturalSize===!0?(ct=h.naturalWidth/(s.width.baseVal.value-2*K)/ae,Wt=h.naturalHeight/(s.height.baseVal.value-2*K)/Be,je.width=h.naturalWidth/ae,je.height=h.naturalHeight/Be):ze.width!==void 0&&ze.height!==void 0&&(ct=ze.width/B.width,Wt=ze.height/B.height,je.width*=ct,je.height*=Wt);var Dr=je.getContext("2d");Dr.translate(je.width/2,je.height/2),Dr.rotate(N*Math.PI/180),Dr.scale(ae,Be),Dr.translate(-je.width/2,-je.height/2),Dr.drawImage(h,0,0,je.width,je.height);var qr=document.createElement("canvas");qr.width=B.width*ct,qr.height=B.height*Wt,qr.getContext("2d").putImageData(Dr.getImageData((B.x-K)*ct,(B.y-K)*Wt,B.width*ct,B.height*Wt),0,0),gt(qr.toDataURL(ze.imageType,ze.imageQuality))})},U}(),Je=function(){function U(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=U.instanceCounter++,this.styles=new Gr(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(U.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(s){this._zoomToCropEnabled=s,s?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(U.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(U.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(U.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(U.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(U.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}),U.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},U.prototype.show=function(){this.showUI(),this.open()},U.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(h){return h()}),this._isOpen=!1)},U.prototype.addRenderEventListener=function(s){this.renderEventListeners.push(s)},U.prototype.removeRenderEventListener=function(s){this.renderEventListeners.indexOf(s)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(s),1)},U.prototype.addCloseEventListener=function(s){this.closeEventListeners.push(s)},U.prototype.removeCloseEventListener=function(s){this.closeEventListeners.indexOf(s)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(s),1)},U.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))},U.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var s=1*this.target.clientWidth/this.target.clientHeight,h=this.contentDiv.clientWidth/s>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*s:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,B=h+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/s;this.resize(h,B)}},U.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},U.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",kt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},U.prototype.resize=function(s,h){this.imageWidth=Math.round(s),this.imageHeight=Math.round(h),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()},U.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 h=s.toDataURL();kt.setAttributes(this.editingTarget,[["href",h]]),this.setEditingTargetSize()},U.prototype.setTopLeft=function(){var s=this.target.getBoundingClientRect(),h=this.editorCanvas.getBoundingClientRect();this.left=s.left-h.left-this.CANVAS_MARGIN,this.top=s.top-h.top-this.CANVAS_MARGIN},U.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=kt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=kt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=kt.createGroup(),this.editingTargetRotationScaleContainer=kt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var s=kt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(s);var h=kt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(h),this.editingTargetContainer=kt.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)},U.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},U.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=kt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Xr(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()},U.prototype.zoomToCrop=function(){if(this.cropRect){var s=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,h=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 "+h+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-s+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-h+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},U.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)},U.prototype.cropRectChanged=function(s){this.cropRect=s,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},U.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},U.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"},U.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},U.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,h=this.target.offsetTop>s+this.CANVAS_MARGIN?this.target.offsetTop-(s+this.CANVAS_MARGIN):0;this.coverDiv.style.top=h+"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},U.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},U.prototype.addTopToolbar=function(){var s=this;this.topToolbar=new Lr,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 h=new ur;h.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(h);var B=[];this.aspectRatios.forEach(function(Wt){var Dr=new Ht(Fr.getIcon(Wt.horizontal,Wt.vertical),Wt.horizontal===0&&Wt.vertical===0?"FREE":Wt.horizontal+":"+Wt.vertical);Dr.onClick=function(){return s.ratioButtonClicked(Wt)},B.push(Dr)}),this.aspectRatioButton=new Ar(Fr.getIcon(0,0),"Aspect ratio",B),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,h.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var K=new Ht('<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");K.isActive=this.isGridVisible,K.onClick=function(){s.isGridVisible=!s.isGridVisible,K.isActive=s.isGridVisible},h.addButton(K);var N=new Ht('<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(N.isActive=this.zoomToCropEnabled,N.onClick=function(){s.zoomToCropEnabled=!s.zoomToCropEnabled,N.isActive=s.zoomToCropEnabled},h.addButton(N),!pr.isLicensed){var ae=new _t;this.topToolbar.addElementBlock(ae);var Be=document.createElement("div");Be.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var ze=document.createElement("a");ze.style.color="currentColor",ze.href="https://markerjs.com/products/cropro",ze.target="_blank",ze.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>',Be.appendChild(ze),ae.addElement(Be)}var gt=new ur;gt.minWidth=3*this.toolbarHeight+"px",gt.contentAlign="end",this.topToolbar.addButtonBlock(gt);var je=new Ht('<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");je.onClick=this.startRenderAndClose,gt.addButton(je),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(je.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var ct=new Ht('<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,gt.addButton(ct),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(ct.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},U.prototype.addBottomToolbar=function(){var s=this;this.bottomToolbar=new Lr,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 h=new ur;h.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(h);var B=new Ht('<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");B.onClick=this.rotateLeftButtonClicked,h.addButton(B);var K=new Ht('<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");K.onClick=this.rotateRightButtonClicked,h.addButton(K);var N=new _t;N.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(N),this.straightener=new Zr("Straighten"),this.straightener.className=this.toolbarStraightenerStyleClass.name,this.straightener.colorsClassName=this.styles.settings.toolbarStraightenerColorsClassName?this.styles.settings.toolbarStraightenerColorsClassName:this.toolbarStraightenerStyleColorsClass.name,this.straightener.onAngleChange=function(gt){s.rotateBy(gt),s.straightener.angle=s.rotationAngle},N.addElement(this.straightener.getUI());var ae=new ur;ae.minWidth=2*this.toolbarHeight+"px",ae.contentAlign="end",this.bottomToolbar.addButtonBlock(ae);var Be=new Ht('<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");Be.onClick=this.flipHorizontallyButtonClicked,ae.addButton(Be);var ze=new Ht('<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");ze.onClick=this.flipVerticallyButtonClicked,ae.addButton(ze)},U.prototype.ratioButtonClicked=function(s){this.aspectRatio=s,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},U.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Fr.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},U.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Vr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},U.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},U.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},U.prototype.restoreState=function(s){if(s){var h=this.cropLayer.getRescaledRect(s.width,s.height,this.imageWidth,this.imageHeight,s.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(h),this.cropRectChanged(h),this.flippedHorizontally=s.flippedHorizontally,this.flippedVertically=s.flippedVertically,this.applyFlip(),this.rotationAngle=s.rotationAngle,this.applyRotation()}},U.prototype.clientToLocalCoordinates=function(s,h){var B=this.cropImage.getBoundingClientRect();return{x:s-B.left,y:h-B.top}},U.prototype.onWindowResize=function(){this.positionUI()},U.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()},U.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)},U.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)},U.prototype.rotateTo=function(s){s=(s=s>180?s-360:s)<=-180?s+360:s,this.rotationAngle=s,this.applyRotation()},U.prototype.rotateBy=function(s){this.rotateTo((this.rotationAngle+s)%360)},U.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 h=this.editingTargetRotationContainer.transform.baseVal.getItem(0);h.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(h,0);var B=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/B.width,this.imageHeight/B.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=s},U.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},U.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},U.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},U.prototype.startRenderAndClose=function(){return Bt(this,void 0,void 0,function(){var s,h;return qt(this,function(B){switch(B.label){case 0:return[4,this.render()];case 1:return s=B.sent(),h=this.getState(),this.renderEventListeners.forEach(function(K){return K(s,h)}),this.close(!0),[2]}})})},U.prototype.render=function(){return Bt(this,void 0,void 0,function(){var s;return qt(this,function(h){switch(h.label){case 0:return(s=new Yr).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.width=this.renderWidth,s.height=this.renderHeight,this.unzoomFromCrop(),kt.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 h.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,h.sent()]}})})},U.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new wr("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 wr("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new wr("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var s=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new wr("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 wr("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new wr("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new br("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new br("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new wr("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 wr("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new wr("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 wr("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 wr("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},U.instanceCounter=0,U}(),Pt=ee("8hTe"),jr=ee.n(Pt),sr=/<pre[^>]*>/g;function Zt(U){var s=document.createElement("div");return s.innerHTML=U,s.childNodes.length===0?"":s.childNodes[0].nodeValue}var Or=xt.a=function(U){var s=U.value,h=s===void 0?"":s,B=U.edit,K=B===void 0?!1:B,N=U.className,ae=U.showTextOnly,Be=U.showLines,ze=U.replaces,gt=U.zoomImg,je=U.hasMask,ct=U.style,Wt=ct===void 0?{}:ct,Dr=U.stylesPrev,qr=Dr===void 0?{}:Dr,ar=String(h),bt=Object(D.useRef)(),Rt=Object(D.useRef)(),Qt=Object(D.useState)(""),tr=Object(W.a)(Qt,2),dr=tr[0],Mr=tr[1],rr=Object(D.useState)("office"),En=Object(W.a)(rr,2),Jn=En[0],ri=En[1],_i=function(){var Pr=new Je(Rt.current);Pr.displayMode="popup",Pr.addRenderEventListener(function(){var fn=Object(I.a)(P.a.mark(function cr(pn){var Kr;return P.a.wrap(function(gn){for(;;)switch(gn.prev=gn.next){case 0:return bt.current.style.display="none",gn.next=3,Object(Ye.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:pn}});case 3:Kr=gn.sent,Kr!=null&&Kr.id&&ze(Rt.current.getAttribute("src").replace(ce.a.API_SERVER,""),"/api/attachments/".concat(Kr==null?void 0:Kr.id,"?type=").concat(Kr.content_type));case 5:case"end":return gn.stop()}},cr)}));return function(cr){return fn.apply(this,arguments)}}()),Pr.show()},Ki=function(){var Pr=new Fe(Rt.current);Pr.settings.displayMode="popup",Pr.addEventListener("render",function(){var fn=Object(I.a)(P.a.mark(function cr(pn){var Kr;return P.a.wrap(function(gn){for(;;)switch(gn.prev=gn.next){case 0:if(bt.current.style.display="none",!Rt.current){gn.next=6;break}return gn.next=4,Object(Ye.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:pn.dataUrl}});case 4:Kr=gn.sent,Kr!=null&&Kr.id&&ze(Rt.current.getAttribute("src").replace(ce.a.API_SERVER,""),"/api/attachments/".concat(Kr==null?void 0:Kr.id,"?type=").concat(Kr.content_type));case 6:case"end":return gn.stop()}},cr)}));return function(cr){return fn.apply(this,arguments)}}()),Pr.show(),window.markerArea=Pr},hn=Object(D.useMemo)(function(){try{var rn=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Pr=/\"\/api\/attachments\/|\"\/attachments\/download\//g,fn=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;ar=ar.replace(rn,"("+ce.a.API_SERVER+"/api/attachments/").replace(Pr,'"'+ce.a.API_SERVER+"/api/attachments/").replace(fn,'"'+ce.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,`
|
|
`),ar=ar.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
`)}catch(ni){}var cr=Z(ar),pn=C();if(ar.match(/\[TOC\]/)&&(cr=cr.replace("<p>[TOC]</p>",w()),T()),cr=cr.replace(/(__special_katext_id_\d+__)/g,function(ni,gn){var jn=pn[gn],zi=jn.type,ci=jn.expression;return Object(Ee.renderToString)(Zt(ci)||"",{displayMode:zi==="block",throwOnError:!1,output:"html"})}),cr=cr.replace(/▁/g,"\u2581\u2581\u2581"),v(),ae){var Kr=document.createElement("div");return Kr.innerHTML=cr,Kr.innerText}return setTimeout(function(){return Oi()},500),cr},[ar]),wn=Object(D.useRef)();m.WebkitLineClamp=Be,Be&&(Wt=Object(A.a)(Object(A.a)({},Wt),m));function vi(rn){var Pr=rn.target;if(Pr.tagName.toUpperCase()==="IMG"){if(gt){var fn=Pr.getAttribute("src");Mr(fn),ri("image")}}else if(Pr.tagName.toUpperCase()==="A"){var cr=Pr.getAttribute("href");if(cr.indexOf("office")>-1)rn.preventDefault(),Mr(cr),ri("office");else if(cr.indexOf("application/pdf")>-1)rn.preventDefault(),Mr(cr),ri("pdf");else if(cr.indexOf("type=text")>-1)rn.preventDefault(),Mr(cr),ri("html");else if(cr.startsWith("#")){rn.preventDefault();var pn=document.getElementById(cr.replace("#",""));pn&&pn.scrollIntoView(!0)}}}var Oi=function(){var Pr,fn=(Pr=wn.current)===null||Pr===void 0?void 0:Pr.querySelectorAll("video");fn==null||fn.forEach(function(cr){if(cr.oncontextmenu=function(){return!1},cr.src.indexOf(".m3u8")>-1&&!cr.canPlayType("application/vnd.apple.mpegurl")){if(re.a.isSupported()){var pn=new re.a;pn.loadSource(cr.src),pn.attachMedia(cr)}}})};Object(D.useEffect)(function(){if(wn.current&&hn&&(hn.match(sr)&&window.PR.prettyPrint()),wn.current)return wn.current.addEventListener("click",vi),function(){wn.current.removeEventListener("click",vi),v(),T()}},[hn,wn.current,vi]);var qi=function(Pr){if(!K)return;Pr.target.nodeName==="IMG"?(bt.current.style.display="flex",bt.current.style.width=Pr.target.clientWidth+"px",bt.current.style.height=Pr.target.clientHeight+"px",bt.current.style.top=Pr.target.offsetTop+"px",bt.current.style.left=Pr.target.offsetLeft+"px",Rt.current.src=Pr.target.getAttribute("src")):bt.current.style.display="none"};return E.a.createElement("div",{style:{position:"relative"}},E.a.createElement("div",{ref:wn,style:Object(A.a)({},Wt),className:"".concat(N||""," markdown-body ").concat(jr.a.mdBody),onMouseOver:qi,dangerouslySetInnerHTML:{__html:hn}}),E.a.createElement("div",{ref:bt,className:jr.a.button},E.a.createElement(Y.a,null,E.a.createElement(z.a,{onClick:function(){return _i()}},"\u88C1\u526A"),E.a.createElement(z.a,{onClick:function(){return Ki()}},"\u7F16\u8F91"))),E.a.createElement("img",{ref:Rt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),E.a.createElement(we.a,{close:!0,data:dr,hasMask:je,type:dr!=null&&dr.length?Jn:"",style:Object(A.a)({},qr),onClose:function(){return Mr("")}}))}},"9VGf":function(zt,xt,ee){"use strict";ee.d(xt,"a",function(){return L});var le=ee("q1tI"),Y=ee.n(le);function L(z,A){var I=Object(le.useRef)();Object(le.useEffect)(function(){I.current=z}),Object(le.useEffect)(function(){function W(){I.current()}if(A!==null){var j=setInterval(W,A);return function(){return clearInterval(j)}}},[A])}},BU3w:function(zt,xt,ee){"use strict";ee.d(xt,"a",function(){return I});var le=ee("MNnm"),Y="rc-util-key";function L(W){if(W.attachTo)return W.attachTo;var j=document.querySelector("head");return j||document.body}function z(W){var j,P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(le.a)())return null;var D=document.createElement("style");if((j=P.csp)===null||j===void 0?void 0:j.nonce){var E;D.nonce=(E=P.csp)===null||E===void 0?void 0:E.nonce}D.innerHTML=W;var _=L(P),M=_.firstChild;return P.prepend&&_.prepend?_.prepend(D):P.prepend&&M?_.insertBefore(D,M):_.appendChild(D),D}var A=new Map;function I(W,j){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},D=L(P);if(!A.has(D)){var E=z("",P),_=E.parentNode;A.set(D,_),_.removeChild(E)}var M=Array.from(A.get(D).children).find(function(o){return o.tagName==="STYLE"&&o[Y]===j});if(M){var R,k;if(((R=P.csp)===null||R===void 0?void 0:R.nonce)&&M.nonce!==((k=P.csp)===null||k===void 0?void 0:k.nonce)){var S;M.nonce=(S=P.csp)===null||S===void 0?void 0:S.nonce}return M.innerHTML!==W&&(M.innerHTML=W),M}var c=z(W,P);return c[Y]=j,c}},Bd2K:function(zt,xt,ee){(function(le){le(ee("VrN/"),ee("osHv"))})(function(le){le.defineOption("autoCloseTags",!1,function(P,D,E){if(E!=le.Init&&E&&P.removeKeyMap("autoCloseTags"),!D)return;var _={name:"autoCloseTags"};(typeof D!="object"||D.whenClosing!==!1)&&(_["'/'"]=function(M){return I(M)}),(typeof D!="object"||D.whenOpening!==!1)&&(_["'>'"]=function(M){return z(M)}),P.addKeyMap(_)});var Y=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],L=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function z(P){if(P.getOption("disableInput"))return le.Pass;for(var D=P.listSelections(),E=[],_=P.getOption("autoCloseTags"),M=0;M<D.length;M++){if(!D[M].empty())return le.Pass;var R=D[M].head,k=P.getTokenAt(R),S=le.innerMode(P.getMode(),k.state),c=S.state,o=S.mode.xmlCurrentTag&&S.mode.xmlCurrentTag(c),l=o&&o.name;if(!l)return le.Pass;var u=S.mode.configuration=="html",T=typeof _=="object"&&_.dontCloseTags||u&&Y,m=typeof _=="object"&&_.indentTags||u&&L;k.end>R.ch&&(l=l.slice(0,l.length-k.end+R.ch));var p=l.toLowerCase();if(!l||k.type=="string"&&(k.end!=R.ch||!/[\"\']/.test(k.string.charAt(k.string.length-1))||k.string.length==1)||k.type=="tag"&&o.close||k.string.indexOf("/")==R.ch-k.start-1||T&&W(T,p)>-1||j(P,S.mode.xmlCurrentContext&&S.mode.xmlCurrentContext(c)||[],l,R,!0))return le.Pass;var w=typeof _=="object"&&_.emptyTags;if(w&&W(w,l)>-1){E[M]={text:"/>",newPos:le.Pos(R.line,R.ch+2)};continue}var x=m&&W(m,p)>-1;E[M]={indent:x,text:">"+(x?`
|
|
|
|
`:"")+"</"+l+">",newPos:x?le.Pos(R.line+1,0):le.Pos(R.line,R.ch+1)}}for(var g=typeof _=="object"&&_.dontIndentOnAutoClose,M=D.length-1;M>=0;M--){var f=E[M];P.replaceRange(f.text,D[M].head,D[M].anchor,"+insert");var d=P.listSelections().slice(0);d[M]={head:f.newPos,anchor:f.newPos},P.setSelections(d),!g&&f.indent&&(P.indentLine(f.newPos.line,null,!0),P.indentLine(f.newPos.line+1,null,!0))}}function A(P,D){for(var E=P.listSelections(),_=[],M=D?"/":"</",R=P.getOption("autoCloseTags"),k=typeof R=="object"&&R.dontIndentOnSlash,S=0;S<E.length;S++){if(!E[S].empty())return le.Pass;var c=E[S].head,o=P.getTokenAt(c),l=le.innerMode(P.getMode(),o.state),u=l.state;if(D&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=c.ch-1))return le.Pass;var T,m=l.mode.name!="xml"&&P.getMode().name=="htmlmixed";if(m&&l.mode.name=="javascript")T=M+"script";else if(m&&l.mode.name=="css")T=M+"style";else{var p=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(u);if(!p||p.length&&j(P,p,p[p.length-1],c))return le.Pass;T=M+p[p.length-1]}P.getLine(c.line).charAt(o.end)!=">"&&(T+=">"),_[S]=T}if(P.replaceSelections(_),E=P.listSelections(),!k)for(var S=0;S<E.length;S++)(S==E.length-1||E[S].head.line<E[S+1].head.line)&&P.indentLine(E[S].head.line)}function I(P){return P.getOption("disableInput")?le.Pass:A(P,!0)}le.commands.closeTag=function(P){return A(P)};function W(P,D){if(P.indexOf)return P.indexOf(D);for(var E=0,_=P.length;E<_;++E)if(P[E]==D)return E;return-1}function j(P,D,E,_,M){if(!le.scanForClosingTag)return!1;var R=Math.min(P.lastLine()+1,_.line+500),k=le.scanForClosingTag(P,_,null,R);if(!k||k.tag!=E)return!1;for(var S=M?1:0,c=D.length-1;c>=0&&D[c]==E;c--)++S;_=k.to;for(var c=1;c<S;c++){var o=le.scanForClosingTag(P,_,null,R);if(!o||o.tag!=E)return!1;_=o.to}return!0}})},BdwD:function(zt,xt,ee){"use strict";var le=ee("+L6B"),Y=ee("2/Rp"),L=ee("0Owb"),z=ee("k1fw"),A=ee("q1tI"),I=ee.n(A),W=ee("FOrL"),j=ee.n(W),P=function(E){var _=E.buttonProps,M=_===void 0?{}:_,R=E.styles,k=R===void 0?{}:R,S=E.customText,c=E.ButtonText,o=E.ButtonClick,l=E.Buttonclass,u=E.ButtonTwo;return I.a.createElement("section",{className:"tc animated fadeIn",style:Object(z.a)(Object(z.a)({},{color:"#999",margin:"200px auto"}),k)},I.a.createElement("img",{src:j.a}),I.a.createElement("p",{className:"mt20 font14"},S||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),c&&I.a.createElement(Y.a,Object(L.a)({className:l,onClick:o},M),c),u&&u)};xt.a=P},BjJ7:function(zt,xt,ee){"use strict";ee.d(xt,"d",function(){return Y}),ee.d(xt,"c",function(){return L}),ee.d(xt,"e",function(){return z}),ee.d(xt,"b",function(){return A}),ee.d(xt,"a",function(){return W});var le=ee("m3rI");function Y(j){var P=!0;if(j.length>0){for(var D=0;D<j.length;D++)if(j[D].compile_success==0||!j[D].compile_success){P=!1;break}}else P=!1;return P}function L(j){for(var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",D=[],E=0;E<j.length;E++){var _=j[E],M=P?"".concat(P,"/").concat(_.name):"".concat(_.name);D.push({title:_.name,isLeaf:!(_.type==="tree"),key:M})}return D}function z(j,P,D){for(var E=0;E<j.length;E++){var _=j[E];if(_.key===P){_.children=D;break}_.children&&z(_.children,P,D)}return j}function A(j,P,D){var E;return function(){var _=this,M=arguments,R=function(){E=null,D||j.apply(_,M)},k=D&&!E;clearTimeout(E),E=setTimeout(R,P),k&&j.apply(_,M)}}var I=!0,W=le.a.API_SERVER},"C+DQ":function(zt,xt,ee){},DlQD:function(zt,xt,ee){(function(le,Y){zt.exports=Y()})(this,function(){"use strict";function le(_e,ve){for(var Ce=0;Ce<ve.length;Ce++){var ne=ve[Ce];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(_e,ne.key,ne)}}function Y(_e,ve,Ce){return ve&&le(_e.prototype,ve),Ce&&le(_e,Ce),_e}function L(_e,ve){if(!_e)return;if(typeof _e=="string")return z(_e,ve);var Ce=Object.prototype.toString.call(_e).slice(8,-1);if(Ce==="Object"&&_e.constructor&&(Ce=_e.constructor.name),Ce==="Map"||Ce==="Set")return Array.from(_e);if(Ce==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ce))return z(_e,ve)}function z(_e,ve){(ve==null||ve>_e.length)&&(ve=_e.length);for(var Ce=0,ne=new Array(ve);Ce<ve;Ce++)ne[Ce]=_e[Ce];return ne}function A(_e,ve){var Ce;if(typeof Symbol=="undefined"||_e[Symbol.iterator]==null){if(Array.isArray(_e)||(Ce=L(_e))||ve&&_e&&typeof _e.length=="number"){Ce&&(_e=Ce);var ne=0;return function(){return ne>=_e.length?{done:!0}:{done:!1,value:_e[ne++]}}}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 Ce=_e[Symbol.iterator](),Ce.next.bind(Ce)}function I(_e,ve){return ve={exports:{}},_e(ve,ve.exports),ve.exports}var W=I(function(_e){function ve(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function Ce(ne){_e.exports.defaults=ne}_e.exports={defaults:ve(),getDefaults:ve,changeDefaults:Ce}}),j=W.defaults,P=W.getDefaults,D=W.changeDefaults,E=/[&<>"']/,_=/[&<>"']/g,M=/[<>"']|&(?!#?\w+;)/,R=/[<>"']|&(?!#?\w+;)/g,k={"&":"&","<":"<",">":">",'"':""","'":"'"},S=function(ve){return k[ve]};function c(_e,ve){if(ve){if(E.test(_e))return _e.replace(_,S)}else if(M.test(_e))return _e.replace(R,S);return _e}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(_e){return _e.replace(o,function(ve,Ce){return Ce=Ce.toLowerCase(),Ce==="colon"?":":Ce.charAt(0)==="#"?Ce.charAt(1)==="x"?String.fromCharCode(parseInt(Ce.substring(2),16)):String.fromCharCode(+Ce.substring(1)):""})}var u=/(^|[^\[])\^/g;function T(_e,ve){_e=_e.source||_e,ve=ve||"";var Ce={replace:function(ie,ue){return ue=ue.source||ue,ue=ue.replace(u,"$1"),_e=_e.replace(ie,ue),Ce},getRegex:function(){return new RegExp(_e,ve)}};return Ce}var m=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function w(_e,ve,Ce){if(_e){var ne;try{ne=decodeURIComponent(l(Ce)).replace(m,"").toLowerCase()}catch(ie){return null}if(ne.indexOf("javascript:")===0||ne.indexOf("vbscript:")===0||ne.indexOf("data:")===0)return null}ve&&!p.test(Ce)&&(Ce=a(ve,Ce));try{Ce=encodeURI(Ce).replace(/%25/g,"%")}catch(ie){return null}return Ce}var x={},g=/^[^:]+:\/*[^/]*$/,f=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(_e,ve){x[" "+_e]||(g.test(_e)?x[" "+_e]=_e+"/":x[" "+_e]=y(_e,"/",!0)),_e=x[" "+_e];var Ce=_e.indexOf(":")===-1;return ve.substring(0,2)==="//"?Ce?ve:_e.replace(f,"$1")+ve:ve.charAt(0)==="/"?Ce?ve:_e.replace(d,"$1")+ve:_e+ve}var C={exec:function(){}};function v(_e){for(var ve=1,Ce,ne;ve<arguments.length;ve++){Ce=arguments[ve];for(ne in Ce)Object.prototype.hasOwnProperty.call(Ce,ne)&&(_e[ne]=Ce[ne])}return _e}function b(_e,ve){var Ce=_e.replace(/\|/g,function(ue,he,Me){for(var be=!1,Le=he;--Le>=0&&Me[Le]==="\\";)be=!be;return be?"|":" |"}),ne=Ce.split(/ \|/),ie=0;if(ne.length>ve)ne.splice(ve);else for(;ne.length<ve;)ne.push("");for(;ie<ne.length;ie++)ne[ie]=ne[ie].trim().replace(/\\\|/g,"|");return ne}function y(_e,ve,Ce){var ne=_e.length;if(ne===0)return"";for(var ie=0;ie<ne;){var ue=_e.charAt(ne-ie-1);if(ue===ve&&!Ce)ie++;else if(ue!==ve&&Ce)ie++;else break}return _e.substr(0,ne-ie)}function G(_e,ve){if(_e.indexOf(ve[1])===-1)return-1;for(var Ce=_e.length,ne=0,ie=0;ie<Ce;ie++)if(_e[ie]==="\\")ie++;else if(_e[ie]===ve[0])ne++;else if(_e[ie]===ve[1]&&(ne--,ne<0))return ie;return-1}function $(_e){_e&&_e.sanitize&&!_e.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 Z={escape:c,unescape:l,edit:T,cleanUrl:w,resolveUrl:a,noopTest:C,merge:v,splitCells:b,rtrim:y,findClosingBracket:G,checkSanitizeDeprecation:$},V=W.defaults,H=Z.rtrim,re=Z.splitCells,ce=Z.escape,Ee=Z.findClosingBracket;function we(_e,ve,Ce){var ne=ve.href,ie=ve.title?ce(ve.title):null,ue=_e[1].replace(/\\([\[\]])/g,"$1");return _e[0].charAt(0)!=="!"?{type:"link",raw:Ce,href:ne,title:ie,text:ue}:{type:"image",raw:Ce,href:ne,title:ie,text:ce(ue)}}function Ye(_e,ve){var Ce=_e.match(/^(\s+)(?:```)/);if(Ce===null)return ve;var ne=Ce[1];return ve.split(`
|
|
`).map(function(ie){var ue=ie.match(/^\s+/);if(ue===null)return ie;var he=ue[0];return he.length>=ne.length?ie.slice(ne.length):ie}).join(`
|
|
`)}var Ne=function(){function _e(Ce){this.options=Ce||V}var ve=_e.prototype;return ve.space=function(ne){var ie=this.rules.block.newline.exec(ne);if(ie)return ie[0].length>1?{type:"space",raw:ie[0]}:{raw:`
|
|
`}},ve.code=function(ne,ie){var ue=this.rules.block.code.exec(ne);if(ue){var he=ie[ie.length-1];if(he&&he.type==="paragraph")return{raw:ue[0],text:ue[0].trimRight()};var Me=ue[0].replace(/^ {4}/gm,"");return{type:"code",raw:ue[0],codeBlockStyle:"indented",text:this.options.pedantic?Me:H(Me,`
|
|
`)}}},ve.fences=function(ne){var ie=this.rules.block.fences.exec(ne);if(ie){var ue=ie[0],he=Ye(ue,ie[3]||"");return{type:"code",raw:ue,lang:ie[2]?ie[2].trim():ie[2],text:he}}},ve.heading=function(ne){var ie=this.rules.block.heading.exec(ne);if(ie)return{type:"heading",raw:ie[0],depth:ie[1].length,text:ie[2]}},ve.nptable=function(ne){var ie=this.rules.block.nptable.exec(ne);if(ie){var ue={type:"table",header:re(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
|
|
`):[],raw:ie[0]};if(ue.header.length===ue.align.length){var he=ue.align.length,Me;for(Me=0;Me<he;Me++)/^ *-+: *$/.test(ue.align[Me])?ue.align[Me]="right":/^ *:-+: *$/.test(ue.align[Me])?ue.align[Me]="center":/^ *:-+ *$/.test(ue.align[Me])?ue.align[Me]="left":ue.align[Me]=null;for(he=ue.cells.length,Me=0;Me<he;Me++)ue.cells[Me]=re(ue.cells[Me],ue.header.length);return ue}}},ve.hr=function(ne){var ie=this.rules.block.hr.exec(ne);if(ie)return{type:"hr",raw:ie[0]}},ve.blockquote=function(ne){var ie=this.rules.block.blockquote.exec(ne);if(ie){var ue=ie[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ie[0],text:ue}}},ve.list=function(ne){var ie=this.rules.block.list.exec(ne);if(ie){for(var ue=ie[0],he=ie[2],Me=he.length>1,be=he[he.length-1]===")",Le={type:"list",raw:ue,ordered:Me,start:Me?+he.slice(0,-1):"",loose:!1,items:[]},tt=ie[0].match(this.rules.block.item),pt=!1,yt,Gt,Tt,Ge,gr,Fe,or,er=tt.length,Bt=0;Bt<er;Bt++)yt=tt[Bt],ue=yt,Gt=yt.length,yt=yt.replace(/^ *([*+-]|\d+[.)]) */,""),~yt.indexOf(`
|
|
`)&&(Gt-=yt.length,yt=this.options.pedantic?yt.replace(/^ {1,4}/gm,""):yt.replace(new RegExp("^ {1,"+Gt+"}","gm"),"")),Bt!==er-1&&(Tt=this.rules.block.bullet.exec(tt[Bt+1])[0],(Me?Tt.length===1||!be&&Tt[Tt.length-1]===")":Tt.length>1||this.options.smartLists&&Tt!==he)&&(Ge=tt.slice(Bt+1).join(`
|
|
`),Le.raw=Le.raw.substring(0,Le.raw.length-Ge.length),Bt=er-1)),gr=pt||/\n\n(?!\s*$)/.test(yt),Bt!==er-1&&(pt=yt.charAt(yt.length-1)===`
|
|
`,gr||(gr=pt)),gr&&(Le.loose=!0),Fe=/^\[[ xX]\] /.test(yt),or=void 0,Fe&&(or=yt[1]!==" ",yt=yt.replace(/^\[[ xX]\] +/,"")),Le.items.push({type:"list_item",raw:ue,task:Fe,checked:or,loose:gr,text:yt});return Le}},ve.html=function(ne){var ie=this.rules.block.html.exec(ne);if(ie)return{type:this.options.sanitize?"paragraph":"html",raw:ie[0],pre:!this.options.sanitizer&&(ie[1]==="pre"||ie[1]==="script"||ie[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ie[0]):ce(ie[0]):ie[0]}},ve.def=function(ne){var ie=this.rules.block.def.exec(ne);if(ie){ie[3]&&(ie[3]=ie[3].substring(1,ie[3].length-1));var ue=ie[1].toLowerCase().replace(/\s+/g," ");return{tag:ue,raw:ie[0],href:ie[2],title:ie[3]}}},ve.table=function(ne){var ie=this.rules.block.table.exec(ne);if(ie){var ue={type:"table",header:re(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
|
|
`):[]};if(ue.header.length===ue.align.length){ue.raw=ie[0];var he=ue.align.length,Me;for(Me=0;Me<he;Me++)/^ *-+: *$/.test(ue.align[Me])?ue.align[Me]="right":/^ *:-+: *$/.test(ue.align[Me])?ue.align[Me]="center":/^ *:-+ *$/.test(ue.align[Me])?ue.align[Me]="left":ue.align[Me]=null;for(he=ue.cells.length,Me=0;Me<he;Me++)ue.cells[Me]=re(ue.cells[Me].replace(/^ *\| *| *\| *$/g,""),ue.header.length);return ue}}},ve.lheading=function(ne){var ie=this.rules.block.lheading.exec(ne);if(ie)return{type:"heading",raw:ie[0],depth:ie[2].charAt(0)==="="?1:2,text:ie[1]}},ve.paragraph=function(ne){var ie=this.rules.block.paragraph.exec(ne);if(ie)return{type:"paragraph",raw:ie[0],text:ie[1].charAt(ie[1].length-1)===`
|
|
`?ie[1].slice(0,-1):ie[1]}},ve.text=function(ne,ie){var ue=this.rules.block.text.exec(ne);if(ue){var he=ie[ie.length-1];return he&&he.type==="text"?{raw:ue[0],text:ue[0]}:{type:"text",raw:ue[0],text:ue[0]}}},ve.escape=function(ne){var ie=this.rules.inline.escape.exec(ne);if(ie)return{type:"escape",raw:ie[0],text:ce(ie[1])}},ve.tag=function(ne,ie,ue){var he=this.rules.inline.tag.exec(ne);if(he)return!ie&&/^<a /i.test(he[0])?ie=!0:ie&&/^<\/a>/i.test(he[0])&&(ie=!1),!ue&&/^<(pre|code|kbd|script)(\s|>)/i.test(he[0])?ue=!0:ue&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(he[0])&&(ue=!1),{type:this.options.sanitize?"text":"html",raw:he[0],inLink:ie,inRawBlock:ue,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):ce(he[0]):he[0]}},ve.link=function(ne){var ie=this.rules.inline.link.exec(ne);if(ie){var ue=Ee(ie[2],"()");if(ue>-1){var he=ie[0].indexOf("!")===0?5:4,Me=he+ie[1].length+ue;ie[2]=ie[2].substring(0,ue),ie[0]=ie[0].substring(0,Me).trim(),ie[3]=""}var be=ie[2],Le="";if(this.options.pedantic){var tt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(be);tt?(be=tt[1],Le=tt[3]):Le=""}else Le=ie[3]?ie[3].slice(1,-1):"";be=be.trim().replace(/^<([\s\S]*)>$/,"$1");var pt=we(ie,{href:be&&be.replace(this.rules.inline._escapes,"$1"),title:Le&&Le.replace(this.rules.inline._escapes,"$1")},ie[0]);return pt}},ve.reflink=function(ne,ie){var ue;if((ue=this.rules.inline.reflink.exec(ne))||(ue=this.rules.inline.nolink.exec(ne))){var he=(ue[2]||ue[1]).replace(/\s+/g," ");if(he=ie[he.toLowerCase()],!he||!he.href){var Me=ue[0].charAt(0);return{type:"text",raw:Me,text:Me}}var be=we(ue,he,ue[0]);return be}},ve.strong=function(ne,ie,ue){ue===void 0&&(ue="");var he=this.rules.inline.strong.start.exec(ne);if(he&&(!he[1]||he[1]&&(ue===""||this.rules.inline.punctuation.exec(ue)))){ie=ie.slice(-1*ne.length);var Me=he[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Me.lastIndex=0;for(var be;(he=Me.exec(ie))!=null;)if(be=this.rules.inline.strong.middle.exec(ie.slice(0,he.index+3)),be)return{type:"strong",raw:ne.slice(0,be[0].length),text:ne.slice(2,be[0].length-2)}}},ve.em=function(ne,ie,ue){ue===void 0&&(ue="");var he=this.rules.inline.em.start.exec(ne);if(he&&(!he[1]||he[1]&&(ue===""||this.rules.inline.punctuation.exec(ue)))){ie=ie.slice(-1*ne.length);var Me=he[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Me.lastIndex=0;for(var be;(he=Me.exec(ie))!=null;)if(be=this.rules.inline.em.middle.exec(ie.slice(0,he.index+2)),be)return{type:"em",raw:ne.slice(0,be[0].length),text:ne.slice(1,be[0].length-1)}}},ve.codespan=function(ne){var ie=this.rules.inline.code.exec(ne);if(ie){var ue=ie[2].replace(/\n/g," "),he=/[^ ]/.test(ue),Me=ue.startsWith(" ")&&ue.endsWith(" ");return he&&Me&&(ue=ue.substring(1,ue.length-1)),ue=ce(ue,!0),{type:"codespan",raw:ie[0],text:ue}}},ve.br=function(ne){var ie=this.rules.inline.br.exec(ne);if(ie)return{type:"br",raw:ie[0]}},ve.del=function(ne){var ie=this.rules.inline.del.exec(ne);if(ie)return{type:"del",raw:ie[0],text:ie[1]}},ve.autolink=function(ne,ie){var ue=this.rules.inline.autolink.exec(ne);if(ue){var he,Me;return ue[2]==="@"?(he=ce(this.options.mangle?ie(ue[1]):ue[1]),Me="mailto:"+he):(he=ce(ue[1]),Me=he),{type:"link",raw:ue[0],text:he,href:Me,tokens:[{type:"text",raw:he,text:he}]}}},ve.url=function(ne,ie){var ue;if(ue=this.rules.inline.url.exec(ne)){var he,Me;if(ue[2]==="@")he=ce(this.options.mangle?ie(ue[0]):ue[0]),Me="mailto:"+he;else{var be;do be=ue[0],ue[0]=this.rules.inline._backpedal.exec(ue[0])[0];while(be!==ue[0]);he=ce(ue[0]),ue[1]==="www."?Me="http://"+he:Me=he}return{type:"link",raw:ue[0],text:he,href:Me,tokens:[{type:"text",raw:he,text:he}]}}},ve.inlineText=function(ne,ie,ue){var he=this.rules.inline.text.exec(ne);if(he){var Me;return ie?Me=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):ce(he[0]):he[0]:Me=ce(this.options.smartypants?ue(he[0]):he[0]),{type:"text",raw:he[0],text:Me}}},_e}(),Ie=Z.noopTest,We=Z.edit,Ue=Z.merge,xe={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:Ie,table:Ie,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};xe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,xe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,xe.def=We(xe.def).replace("label",xe._label).replace("title",xe._title).getRegex(),xe.bullet=/(?:[*+-]|\d{1,9}[.)])/,xe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,xe.item=We(xe.item,"gm").replace(/bull/g,xe.bullet).getRegex(),xe.list=We(xe.list).replace(/bull/g,xe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+xe.def.source+")").getRegex(),xe._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",xe._comment=/<!--(?!-?>)[\s\S]*?-->/,xe.html=We(xe.html,"i").replace("comment",xe._comment).replace("tag",xe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),xe.paragraph=We(xe._paragraph).replace("hr",xe.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",xe._tag).getRegex(),xe.blockquote=We(xe.blockquote).replace("paragraph",xe.paragraph).getRegex(),xe.normal=Ue({},xe),xe.gfm=Ue({},xe.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*|$)"}),xe.gfm.nptable=We(xe.gfm.nptable).replace("hr",xe.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",xe._tag).getRegex(),xe.gfm.table=We(xe.gfm.table).replace("hr",xe.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",xe._tag).getRegex(),xe.pedantic=Ue({},xe.normal,{html:We(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",xe._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:Ie,paragraph:We(xe.normal._paragraph).replace("hr",xe.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",xe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var se={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ie,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:Ie,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};se._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",se.punctuation=We(se.punctuation).replace(/punctuation/g,se._punctuation).getRegex(),se._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",se._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",se.em.start=We(se.em.start).replace(/punctuation/g,se._punctuation).getRegex(),se.em.middle=We(se.em.middle).replace(/punctuation/g,se._punctuation).replace(/overlapSkip/g,se._overlapSkip).getRegex(),se.em.endAst=We(se.em.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.em.endUnd=We(se.em.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.start=We(se.strong.start).replace(/punctuation/g,se._punctuation).getRegex(),se.strong.middle=We(se.strong.middle).replace(/punctuation/g,se._punctuation).replace(/blockSkip/g,se._blockSkip).getRegex(),se.strong.endAst=We(se.strong.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.endUnd=We(se.strong.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.blockSkip=We(se._blockSkip,"g").getRegex(),se.overlapSkip=We(se._overlapSkip,"g").getRegex(),se._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,se._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,se._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,se.autolink=We(se.autolink).replace("scheme",se._scheme).replace("email",se._email).getRegex(),se._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,se.tag=We(se.tag).replace("comment",xe._comment).replace("attribute",se._attribute).getRegex(),se._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,se._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,se._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,se.link=We(se.link).replace("label",se._label).replace("href",se._href).replace("title",se._title).getRegex(),se.reflink=We(se.reflink).replace("label",se._label).getRegex(),se.reflinkSearch=We(se.reflinkSearch,"g").replace("reflink",se.reflink).replace("nolink",se.nolink).getRegex(),se.normal=Ue({},se),se.pedantic=Ue({},se.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:We(/^!?\[(label)\]\((.*?)\)/).replace("label",se._label).getRegex(),reflink:We(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",se._label).getRegex()}),se.gfm=Ue({},se.normal,{escape:We(se.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),se.gfm.url=We(se.gfm.url,"i").replace("email",se.gfm._extended_email).getRegex(),se.breaks=Ue({},se.gfm,{br:We(se.br).replace("{2,}","*").getRegex(),text:We(se.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var ke={block:xe,inline:se},dt=W.defaults,at=ke.block,rt=ke.inline;function lt(_e){return _e.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 Ke(_e){var ve="",Ce,ne,ie=_e.length;for(Ce=0;Ce<ie;Ce++)ne=_e.charCodeAt(Ce),Math.random()>.5&&(ne="x"+ne.toString(16)),ve+="&#"+ne+";";return ve}var $e=function(){function _e(Ce){this.tokens=[],this.tokens.links=Object.create(null),this.options=Ce||dt,this.options.tokenizer=this.options.tokenizer||new Ne,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ne={block:at.normal,inline:rt.normal};this.options.pedantic?(ne.block=at.pedantic,ne.inline=rt.pedantic):this.options.gfm&&(ne.block=at.gfm,this.options.breaks?ne.inline=rt.breaks:ne.inline=rt.gfm),this.tokenizer.rules=ne}_e.lex=function(ne,ie){var ue=new _e(ie);return ue.lex(ne)};var ve=_e.prototype;return ve.lex=function(ne){return ne=ne.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(ne,this.tokens,!0),this.inline(this.tokens),this.tokens},ve.blockTokens=function(ne,ie,ue){ie===void 0&&(ie=[]),ue===void 0&&(ue=!0),ne=ne.replace(/^ +$/gm,"");for(var he,Me,be,Le;ne;){if(he=this.tokenizer.space(ne)){ne=ne.substring(he.raw.length),he.type&&ie.push(he);continue}if(he=this.tokenizer.code(ne,ie)){ne=ne.substring(he.raw.length),he.type?ie.push(he):(Le=ie[ie.length-1],Le.raw+=`
|
|
`+he.raw,Le.text+=`
|
|
`+he.text);continue}if(he=this.tokenizer.fences(ne)){ne=ne.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.heading(ne)){ne=ne.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.nptable(ne)){ne=ne.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.hr(ne)){ne=ne.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.blockquote(ne)){ne=ne.substring(he.raw.length),he.tokens=this.blockTokens(he.text,[],ue),ie.push(he);continue}if(he=this.tokenizer.list(ne)){for(ne=ne.substring(he.raw.length),be=he.items.length,Me=0;Me<be;Me++)he.items[Me].tokens=this.blockTokens(he.items[Me].text,[],!1);ie.push(he);continue}if(he=this.tokenizer.html(ne)){ne=ne.substring(he.raw.length),ie.push(he);continue}if(ue&&(he=this.tokenizer.def(ne))){ne=ne.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(ne)){ne=ne.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.lheading(ne)){ne=ne.substring(he.raw.length),ie.push(he);continue}if(ue&&(he=this.tokenizer.paragraph(ne))){ne=ne.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.text(ne,ie)){ne=ne.substring(he.raw.length),he.type?ie.push(he):(Le=ie[ie.length-1],Le.raw+=`
|
|
`+he.raw,Le.text+=`
|
|
`+he.text);continue}if(ne){var tt="Infinite loop on byte: "+ne.charCodeAt(0);if(this.options.silent){console.error(tt);break}else throw new Error(tt)}}return ie},ve.inline=function(ne){var ie,ue,he,Me,be,Le,tt=ne.length;for(ie=0;ie<tt;ie++){Le=ne[ie];switch(Le.type){case"paragraph":case"text":case"heading":{Le.tokens=[],this.inlineTokens(Le.text,Le.tokens);break}case"table":{for(Le.tokens={header:[],cells:[]},Me=Le.header.length,ue=0;ue<Me;ue++)Le.tokens.header[ue]=[],this.inlineTokens(Le.header[ue],Le.tokens.header[ue]);for(Me=Le.cells.length,ue=0;ue<Me;ue++)for(be=Le.cells[ue],Le.tokens.cells[ue]=[],he=0;he<be.length;he++)Le.tokens.cells[ue][he]=[],this.inlineTokens(be[he],Le.tokens.cells[ue][he]);break}case"blockquote":{this.inline(Le.tokens);break}case"list":{for(Me=Le.items.length,ue=0;ue<Me;ue++)this.inline(Le.items[ue].tokens);break}}}return ne},ve.inlineTokens=function(ne,ie,ue,he,Me){ie===void 0&&(ie=[]),ue===void 0&&(ue=!1),he===void 0&&(he=!1),Me===void 0&&(Me="");var be,Le=ne,tt;if(this.tokens.links){var pt=Object.keys(this.tokens.links);if(pt.length>0)for(;(tt=this.tokenizer.rules.inline.reflinkSearch.exec(Le))!=null;)pt.includes(tt[0].slice(tt[0].lastIndexOf("[")+1,-1))&&(Le=Le.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+Le.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(tt=this.tokenizer.rules.inline.blockSkip.exec(Le))!=null;)Le=Le.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+Le.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ne;){if(be=this.tokenizer.escape(ne)){ne=ne.substring(be.raw.length),ie.push(be);continue}if(be=this.tokenizer.tag(ne,ue,he)){ne=ne.substring(be.raw.length),ue=be.inLink,he=be.inRawBlock,ie.push(be);continue}if(be=this.tokenizer.link(ne)){ne=ne.substring(be.raw.length),be.type==="link"&&(be.tokens=this.inlineTokens(be.text,[],!0,he)),ie.push(be);continue}if(be=this.tokenizer.reflink(ne,this.tokens.links)){ne=ne.substring(be.raw.length),be.type==="link"&&(be.tokens=this.inlineTokens(be.text,[],!0,he)),ie.push(be);continue}if(be=this.tokenizer.strong(ne,Le,Me)){ne=ne.substring(be.raw.length),be.tokens=this.inlineTokens(be.text,[],ue,he),ie.push(be);continue}if(be=this.tokenizer.em(ne,Le,Me)){ne=ne.substring(be.raw.length),be.tokens=this.inlineTokens(be.text,[],ue,he),ie.push(be);continue}if(be=this.tokenizer.codespan(ne)){ne=ne.substring(be.raw.length),ie.push(be);continue}if(be=this.tokenizer.br(ne)){ne=ne.substring(be.raw.length),ie.push(be);continue}if(be=this.tokenizer.del(ne)){ne=ne.substring(be.raw.length),be.tokens=this.inlineTokens(be.text,[],ue,he),ie.push(be);continue}if(be=this.tokenizer.autolink(ne,Ke)){ne=ne.substring(be.raw.length),ie.push(be);continue}if(!ue&&(be=this.tokenizer.url(ne,Ke))){ne=ne.substring(be.raw.length),ie.push(be);continue}if(be=this.tokenizer.inlineText(ne,he,lt)){ne=ne.substring(be.raw.length),Me=be.raw.slice(-1),ie.push(be);continue}if(ne){var yt="Infinite loop on byte: "+ne.charCodeAt(0);if(this.options.silent){console.error(yt);break}else throw new Error(yt)}}return ie},Y(_e,null,[{key:"rules",get:function(){return{block:at,inline:rt}}}]),_e}(),it=W.defaults,ft=Z.cleanUrl,ut=Z.escape,Ze=function(){function _e(Ce){this.options=Ce||it}var ve=_e.prototype;return ve.code=function(ne,ie,ue){var he=(ie||"").match(/\S*/)[0];if(this.options.highlight){var Me=this.options.highlight(ne,he);Me!=null&&Me!==ne&&(ue=!0,ne=Me)}return he?'<pre><code class="'+this.options.langPrefix+ut(he,!0)+'">'+(ue?ne:ut(ne,!0))+`</code></pre>
|
|
`:"<pre><code>"+(ue?ne:ut(ne,!0))+`</code></pre>
|
|
`},ve.blockquote=function(ne){return`<blockquote>
|
|
`+ne+`</blockquote>
|
|
`},ve.html=function(ne){return ne},ve.heading=function(ne,ie,ue,he){return this.options.headerIds?"<h"+ie+' id="'+this.options.headerPrefix+he.slug(ue)+'">'+ne+"</h"+ie+`>
|
|
`:"<h"+ie+">"+ne+"</h"+ie+`>
|
|
`},ve.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ve.list=function(ne,ie,ue){var he=ie?"ol":"ul",Me=ie&&ue!==1?' start="'+ue+'"':"";return"<"+he+Me+`>
|
|
`+ne+"</"+he+`>
|
|
`},ve.listitem=function(ne){return"<li>"+ne+`</li>
|
|
`},ve.checkbox=function(ne){return"<input "+(ne?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ve.paragraph=function(ne){return"<p>"+ne+`</p>
|
|
`},ve.table=function(ne,ie){return ie&&(ie="<tbody>"+ie+"</tbody>"),`<table>
|
|
<thead>
|
|
`+ne+`</thead>
|
|
`+ie+`</table>
|
|
`},ve.tablerow=function(ne){return`<tr>
|
|
`+ne+`</tr>
|
|
`},ve.tablecell=function(ne,ie){var ue=ie.header?"th":"td",he=ie.align?"<"+ue+' align="'+ie.align+'">':"<"+ue+">";return he+ne+"</"+ue+`>
|
|
`},ve.strong=function(ne){return"<strong>"+ne+"</strong>"},ve.em=function(ne){return"<em>"+ne+"</em>"},ve.codespan=function(ne){return"<code>"+ne+"</code>"},ve.br=function(){return this.options.xhtml?"<br/>":"<br>"},ve.del=function(ne){return"<del>"+ne+"</del>"},ve.link=function(ne,ie,ue){if(ne=ft(this.options.sanitize,this.options.baseUrl,ne),ne===null)return ue;var he='<a href="'+ut(ne)+'"';return ie&&(he+=' title="'+ie+'"'),he+=">"+ue+"</a>",he},ve.image=function(ne,ie,ue){if(ne=ft(this.options.sanitize,this.options.baseUrl,ne),ne===null)return ue;var he='<img src="'+ne+'" alt="'+ue+'"';return ie&&(he+=' title="'+ie+'"'),he+=this.options.xhtml?"/>":">",he},ve.text=function(ne){return ne},_e}(),qe=function(){function _e(){}var ve=_e.prototype;return ve.strong=function(ne){return ne},ve.em=function(ne){return ne},ve.codespan=function(ne){return ne},ve.del=function(ne){return ne},ve.html=function(ne){return ne},ve.text=function(ne){return ne},ve.link=function(ne,ie,ue){return""+ue},ve.image=function(ne,ie,ue){return""+ue},ve.br=function(){return""},_e}(),Dt=function(){function _e(){this.seen={}}var ve=_e.prototype;return ve.slug=function(ne){var ie=ne.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ie)){var ue=ie;do this.seen[ue]++,ie=ue+"-"+this.seen[ue];while(this.seen.hasOwnProperty(ie))}return this.seen[ie]=0,ie},_e}(),wt=W.defaults,vt=Z.unescape,mt=function(){function _e(Ce){this.options=Ce||wt,this.options.renderer=this.options.renderer||new Ze,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new qe,this.slugger=new Dt}_e.parse=function(ne,ie){var ue=new _e(ie);return ue.parse(ne)};var ve=_e.prototype;return ve.parse=function(ne,ie){ie===void 0&&(ie=!0);var ue="",he,Me,be,Le,tt,pt,yt,Gt,Tt,Ge,gr,Fe,or,er,Bt,qt,pr,kt,Gr=ne.length;for(he=0;he<Gr;he++){Ge=ne[he];switch(Ge.type){case"space":continue;case"hr":{ue+=this.renderer.hr();continue}case"heading":{ue+=this.renderer.heading(this.parseInline(Ge.tokens),Ge.depth,vt(this.parseInline(Ge.tokens,this.textRenderer)),this.slugger);continue}case"code":{ue+=this.renderer.code(Ge.text,Ge.lang,Ge.escaped);continue}case"table":{for(Gt="",yt="",Le=Ge.header.length,Me=0;Me<Le;Me++)yt+=this.renderer.tablecell(this.parseInline(Ge.tokens.header[Me]),{header:!0,align:Ge.align[Me]});for(Gt+=this.renderer.tablerow(yt),Tt="",Le=Ge.cells.length,Me=0;Me<Le;Me++){for(pt=Ge.tokens.cells[Me],yt="",tt=pt.length,be=0;be<tt;be++)yt+=this.renderer.tablecell(this.parseInline(pt[be]),{header:!1,align:Ge.align[be]});Tt+=this.renderer.tablerow(yt)}ue+=this.renderer.table(Gt,Tt);continue}case"blockquote":{Tt=this.parse(Ge.tokens),ue+=this.renderer.blockquote(Tt);continue}case"list":{for(gr=Ge.ordered,Fe=Ge.start,or=Ge.loose,Le=Ge.items.length,Tt="",Me=0;Me<Le;Me++)Bt=Ge.items[Me],qt=Bt.checked,pr=Bt.task,er="",Bt.task&&(kt=this.renderer.checkbox(qt),or?Bt.tokens.length>0&&Bt.tokens[0].type==="text"?(Bt.tokens[0].text=kt+" "+Bt.tokens[0].text,Bt.tokens[0].tokens&&Bt.tokens[0].tokens.length>0&&Bt.tokens[0].tokens[0].type==="text"&&(Bt.tokens[0].tokens[0].text=kt+" "+Bt.tokens[0].tokens[0].text)):Bt.tokens.unshift({type:"text",text:kt}):er+=kt),er+=this.parse(Bt.tokens,or),Tt+=this.renderer.listitem(er,pr,qt);ue+=this.renderer.list(Tt,gr,Fe);continue}case"html":{ue+=this.renderer.html(Ge.text);continue}case"paragraph":{ue+=this.renderer.paragraph(this.parseInline(Ge.tokens));continue}case"text":{for(Tt=Ge.tokens?this.parseInline(Ge.tokens):Ge.text;he+1<Gr&&ne[he+1].type==="text";)Ge=ne[++he],Tt+=`
|
|
`+(Ge.tokens?this.parseInline(Ge.tokens):Ge.text);ue+=ie?this.renderer.paragraph(Tt):Tt;continue}default:{var br='Token with "'+Ge.type+'" type was not found.';if(this.options.silent){console.error(br);return}else throw new Error(br)}}}return ue},ve.parseInline=function(ne,ie){ie=ie||this.renderer;var ue="",he,Me,be=ne.length;for(he=0;he<be;he++){Me=ne[he];switch(Me.type){case"escape":{ue+=ie.text(Me.text);break}case"html":{ue+=ie.html(Me.text);break}case"link":{ue+=ie.link(Me.href,Me.title,this.parseInline(Me.tokens,ie));break}case"image":{ue+=ie.image(Me.href,Me.title,Me.text);break}case"strong":{ue+=ie.strong(this.parseInline(Me.tokens,ie));break}case"em":{ue+=ie.em(this.parseInline(Me.tokens,ie));break}case"codespan":{ue+=ie.codespan(Me.text);break}case"br":{ue+=ie.br();break}case"del":{ue+=ie.del(this.parseInline(Me.tokens,ie));break}case"text":{ue+=ie.text(Me.text);break}default:{var Le='Token with "'+Me.type+'" type was not found.';if(this.options.silent){console.error(Le);return}else throw new Error(Le)}}}return ue},_e}(),Nt=Z.merge,At=Z.checkSanitizeDeprecation,Ot=Z.escape,He=W.getDefaults,Ut=W.changeDefaults,Lt=W.defaults;function Xe(_e,ve,Ce){if(typeof _e=="undefined"||_e===null)throw new Error("marked(): input parameter is undefined or null");if(typeof _e!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(_e)+", string expected");if(typeof ve=="function"&&(Ce=ve,ve=null),ve=Nt({},Xe.defaults,ve||{}),At(ve),Ce){var ne=ve.highlight,ie;try{ie=$e.lex(_e,ve)}catch(be){return Ce(be)}var ue=function(Le){var tt;if(!Le)try{tt=mt.parse(ie,ve)}catch(pt){Le=pt}return ve.highlight=ne,Le?Ce(Le):Ce(null,tt)};if(!ne||ne.length<3)return ue();if(delete ve.highlight,!ie.length)return ue();var he=0;Xe.walkTokens(ie,function(be){be.type==="code"&&(he++,setTimeout(function(){ne(be.text,be.lang,function(Le,tt){if(Le)return ue(Le);tt!=null&&tt!==be.text&&(be.text=tt,be.escaped=!0),he--,he===0&&ue()})},0))}),he===0&&ue();return}try{var Me=$e.lex(_e,ve);return ve.walkTokens&&Xe.walkTokens(Me,ve.walkTokens),mt.parse(Me,ve)}catch(be){if(be.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ve.silent)return"<p>An error occurred:</p><pre>"+Ot(be.message+"",!0)+"</pre>";throw be}}Xe.options=Xe.setOptions=function(_e){return Nt(Xe.defaults,_e),Ut(Xe.defaults),Xe},Xe.getDefaults=He,Xe.defaults=Lt,Xe.use=function(_e){var ve=Nt({},_e);if(_e.renderer&&function(){var ne=Xe.defaults.renderer||new Ze,ie=function(Me){var be=ne[Me];ne[Me]=function(){for(var Le=arguments.length,tt=new Array(Le),pt=0;pt<Le;pt++)tt[pt]=arguments[pt];var yt=_e.renderer[Me].apply(ne,tt);return yt===!1&&(yt=be.apply(ne,tt)),yt}};for(var ue in _e.renderer)ie(ue);ve.renderer=ne}(),_e.tokenizer&&function(){var ne=Xe.defaults.tokenizer||new Ne,ie=function(Me){var be=ne[Me];ne[Me]=function(){for(var Le=arguments.length,tt=new Array(Le),pt=0;pt<Le;pt++)tt[pt]=arguments[pt];var yt=_e.tokenizer[Me].apply(ne,tt);return yt===!1&&(yt=be.apply(ne,tt)),yt}};for(var ue in _e.tokenizer)ie(ue);ve.tokenizer=ne}(),_e.walkTokens){var Ce=Xe.defaults.walkTokens;ve.walkTokens=function(ne){_e.walkTokens(ne),Ce&&Ce(ne)}}Xe.setOptions(ve)},Xe.walkTokens=function(_e,ve){for(var Ce=A(_e),ne;!(ne=Ce()).done;){var ie=ne.value;ve(ie);switch(ie.type){case"table":{for(var ue=A(ie.tokens.header),he;!(he=ue()).done;){var Me=he.value;Xe.walkTokens(Me,ve)}for(var be=A(ie.tokens.cells),Le;!(Le=be()).done;)for(var tt=Le.value,pt=A(tt),yt;!(yt=pt()).done;){var Gt=yt.value;Xe.walkTokens(Gt,ve)}break}case"list":{Xe.walkTokens(ie.items,ve);break}default:ie.tokens&&Xe.walkTokens(ie.tokens,ve)}}},Xe.Parser=mt,Xe.parser=mt.parse,Xe.Renderer=Ze,Xe.TextRenderer=qe,Xe.Lexer=$e,Xe.lexer=$e.lex,Xe.Tokenizer=Ne,Xe.Slugger=Dt,Xe.parse=Xe;var nt=Xe;return nt})},ELLl:function(zt,xt,ee){(function(le){le(ee("VrN/"))})(function(le){var Y={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},L=le.Pos;le.defineOption("autoCloseBrackets",!1,function(k,S,c){c&&c!=le.Init&&(k.removeKeyMap(A),k.state.closeBrackets=null),S&&(I(z(S,"pairs")),k.state.closeBrackets=S,k.addKeyMap(A))});function z(k,S){return S=="pairs"&&typeof k=="string"?k:typeof k=="object"&&k[S]!=null?k[S]:Y[S]}var A={Backspace:P,Enter:D};function I(k){for(var S=0;S<k.length;S++){var c=k.charAt(S),o="'"+c+"'";A[o]||(A[o]=W(c))}}I(Y.pairs+"`");function W(k){return function(S){return _(S,k)}}function j(k){var S=k.state.closeBrackets;if(!S||S.override)return S;var c=k.getModeAt(k.getCursor());return c.closeBrackets||S}function P(k){var S=j(k);if(!S||k.getOption("disableInput"))return le.Pass;for(var c=z(S,"pairs"),o=k.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return le.Pass;var u=M(k,o[l].head);if(!u||c.indexOf(u)%2!=0)return le.Pass}for(var l=o.length-1;l>=0;l--){var T=o[l].head;k.replaceRange("",L(T.line,T.ch-1),L(T.line,T.ch+1),"+delete")}}function D(k){var S=j(k),c=S&&z(S,"explode");if(!c||k.getOption("disableInput"))return le.Pass;for(var o=k.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return le.Pass;var u=M(k,o[l].head);if(!u||c.indexOf(u)%2!=0)return le.Pass}k.operation(function(){var T=k.lineSeparator()||`
|
|
`;k.replaceSelection(T+T,null),k.execCommand("goCharLeft"),o=k.listSelections();for(var m=0;m<o.length;m++){var p=o[m].head.line;k.indentLine(p,null,!0),k.indentLine(p+1,null,!0)}})}function E(k){var S=le.cmpPos(k.anchor,k.head)>0;return{anchor:new L(k.anchor.line,k.anchor.ch+(S?-1:1)),head:new L(k.head.line,k.head.ch+(S?1:-1))}}function _(k,S){var c=j(k);if(!c||k.getOption("disableInput"))return le.Pass;var o=z(c,"pairs"),l=o.indexOf(S);if(l==-1)return le.Pass;for(var u=z(c,"closeBefore"),T=z(c,"triples"),m=o.charAt(l+1)==S,p=k.listSelections(),w=l%2==0,x,g=0;g<p.length;g++){var f=p[g],d=f.head,a,C=k.getRange(d,L(d.line,d.ch+1));if(w&&!f.empty())a="surround";else if((m||!w)&&C==S)m&&R(k,d)?a="both":T.indexOf(S)>=0&&k.getRange(d,L(d.line,d.ch+3))==S+S+S?a="skipThree":a="skip";else if(m&&d.ch>1&&T.indexOf(S)>=0&&k.getRange(L(d.line,d.ch-2),d)==S+S){if(d.ch>2&&/\bstring/.test(k.getTokenTypeAt(L(d.line,d.ch-2))))return le.Pass;a="addFour"}else if(m){var v=d.ch==0?" ":k.getRange(L(d.line,d.ch-1),d);if(!le.isWordChar(C)&&v!=S&&!le.isWordChar(v))a="both";else return le.Pass}else if(w&&(C.length===0||/\s/.test(C)||u.indexOf(C)>-1))a="both";else return le.Pass;if(!x)x=a;else if(x!=a)return le.Pass}var b=l%2?o.charAt(l-1):S,y=l%2?S:o.charAt(l+1);k.operation(function(){if(x=="skip")k.execCommand("goCharRight");else if(x=="skipThree")for(var G=0;G<3;G++)k.execCommand("goCharRight");else if(x=="surround"){for(var $=k.getSelections(),G=0;G<$.length;G++)$[G]=b+$[G]+y;k.replaceSelections($,"around"),$=k.listSelections().slice();for(var G=0;G<$.length;G++)$[G]=E($[G]);k.setSelections($)}else x=="both"?(k.replaceSelection(b+y,null),k.triggerElectric(b+y),k.execCommand("goCharLeft")):x=="addFour"&&(k.replaceSelection(b+b+b+b,"before"),k.execCommand("goCharRight"))})}function M(k,S){var c=k.getRange(L(S.line,S.ch-1),L(S.line,S.ch+1));return c.length==2?c:null}function R(k,S){var c=k.getTokenAt(L(S.line,S.ch+1));return/\bstring/.test(c.type)&&c.start==S.ch&&(S.ch==0||!/\bstring/.test(k.getTokenTypeAt(S)))}})},FOrL:function(zt,xt,ee){zt.exports=ee.p+"static/nodata.a6b3f948.png"},HmJG:function(zt,xt,ee){},LdHM:function(zt,xt,ee){"use strict";ee.d(xt,"b",function(){return u}),ee.d(xt,"a",function(){return m});var le=ee("1OyB"),Y=ee("vuIU"),L=ee("Ji7U"),z=ee("LK+K"),A=ee("q1tI"),I=ee("rePB"),W=ee("Ff2n"),j=ee("ODXe"),P=ee("4IlW"),D=ee("bX4T"),E=ee("YrtM"),_=ee("TSYQ"),M=ee.n(_),R=ee("+nKL"),k=ee("8OUc"),S=function(re,ce){var Ee=re.prefixCls,we=re.id,Ye=re.flattenOptions,Ne=re.childrenAsData,Ie=re.values,We=re.searchValue,Ue=re.multiple,xe=re.defaultActiveFirstOption,se=re.height,ke=re.itemHeight,dt=re.notFoundContent,at=re.open,rt=re.menuItemSelectedIcon,lt=re.virtual,Ke=re.onSelect,$e=re.onToggleOpen,it=re.onActiveValue,ft=re.onScroll,ut=re.onMouseEnter,Ze="".concat(Ee,"-item"),qe=Object(E.a)(function(){return Ye},[at,Ye],function(nt,_e){return _e[0]&&nt[1]!==_e[1]}),Dt=A.useRef(null),wt=function(_e){_e.preventDefault()},vt=function(_e){Dt.current&&Dt.current.scrollTo({index:_e})},mt=function(_e){for(var ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,Ce=qe.length,ne=0;ne<Ce;ne+=1){var ie=(_e+ne*ve+Ce)%Ce,ue=qe[ie],he=ue.group,Me=ue.data;if(!he&&!Me.disabled)return ie}return-1},Nt=A.useState(function(){return mt(0)}),At=Object(j.a)(Nt,2),Ot=At[0],He=At[1],Ut=function(_e){He(_e);var ve=qe[_e];if(!ve){it(null,-1);return}it(ve.data.value,_e)};A.useEffect(function(){Ut(xe!==!1?mt(0):-1)},[qe.length,We]),A.useEffect(function(){var nt=setTimeout(function(){if(!Ue&&at&&Ie.size===1){var _e=Array.from(Ie)[0],ve=qe.findIndex(function(Ce){var ne=Ce.data;return ne.value===_e});Ut(ve),vt(ve)}});return function(){return clearTimeout(nt)}},[at]);var Lt=function(_e){_e!==void 0&&Ke(_e,{selected:!Ie.has(_e)}),Ue||$e(!1)};if(A.useImperativeHandle(ce,function(){return{onKeyDown:function(_e){var ve=_e.which;switch(ve){case P.a.UP:case P.a.DOWN:{var Ce=0;if(ve===P.a.UP?Ce=-1:ve===P.a.DOWN&&(Ce=1),Ce!==0){var ne=mt(Ot+Ce,Ce);vt(ne),Ut(ne)}break}case P.a.ENTER:{var ie=qe[Ot];ie&&!ie.data.disabled?Lt(ie.data.value):Lt(void 0),at&&_e.preventDefault();break}case P.a.ESC:$e(!1)}},onKeyUp:function(){},scrollTo:function(_e){vt(_e)}}}),qe.length===0)return A.createElement("div",{role:"listbox",id:"".concat(we,"_list"),className:"".concat(Ze,"-empty"),onMouseDown:wt},dt);function Xe(nt){var _e=qe[nt];if(!_e)return null;var ve=_e.data||{},Ce=ve.value,ne=ve.label,ie=ve.children,ue=Object(D.a)(ve,!0),he=Ne?ie:ne;return _e?A.createElement("div",Object.assign({"aria-label":typeof he=="string"?he:null},ue,{key:nt,role:"option",id:"".concat(we,"_list_").concat(nt),"aria-selected":Ie.has(Ce)}),Ce):null}return A.createElement(A.Fragment,null,A.createElement("div",{role:"listbox",id:"".concat(we,"_list"),style:{height:0,width:0,overflow:"hidden"}},Xe(Ot-1),Xe(Ot),Xe(Ot+1)),A.createElement(R.a,{itemKey:"key",ref:Dt,data:qe,height:se,itemHeight:ke,fullHeight:!1,onMouseDown:wt,onScroll:ft,virtual:lt,onMouseEnter:ut},function(nt,_e){var ve,Ce=nt.group,ne=nt.groupOption,ie=nt.data,ue=ie.label,he=ie.key;if(Ce)return A.createElement("div",{className:M()(Ze,"".concat(Ze,"-group"))},ue!==void 0?ue:he);var Me=ie.disabled,be=ie.value,Le=ie.title,tt=ie.children,pt=ie.style,yt=ie.className,Gt=Object(W.a)(ie,["disabled","value","title","children","style","className"]),Tt=Ie.has(be),Ge="".concat(Ze,"-option"),gr=M()(Ze,Ge,yt,(ve={},Object(I.a)(ve,"".concat(Ge,"-grouped"),ne),Object(I.a)(ve,"".concat(Ge,"-active"),Ot===_e&&!Me),Object(I.a)(ve,"".concat(Ge,"-disabled"),Me),Object(I.a)(ve,"".concat(Ge,"-selected"),Tt),ve)),Fe=Ne?tt:ue,or=!rt||typeof rt=="function"||Tt;return A.createElement("div",Object.assign({},Gt,{"aria-selected":Tt,className:gr,title:Le,onMouseMove:function(){if(Ot===_e||Me)return;Ut(_e)},onClick:function(){Me||Lt(be)},style:pt}),A.createElement("div",{className:"".concat(Ge,"-content")},Fe||be),A.isValidElement(rt)||Tt,or&&A.createElement(k.a,{className:"".concat(Ze,"-option-state"),customizeIcon:rt,customizeIconProps:{isSelected:Tt}},Tt?"\u2713":null))}))},c=A.forwardRef(S);c.displayName="OptionList";var o=c,l=function(){return null};l.isSelectOption=!0;var u=l,T=function(){return null};T.isSelectOptGroup=!0;var m=T,p=ee("VTBJ"),w=ee("Zm9Q");function x(H){var re=H.key,ce=H.props,Ee=ce.children,we=ce.value,Ye=Object(W.a)(ce,["children","value"]);return Object(p.a)({key:re,value:we!==void 0?we:re,children:Ee},Ye)}function g(H){var re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(w.a)(H).map(function(ce,Ee){if(!A.isValidElement(ce)||!ce.type)return null;var we=ce.type.isSelectOptGroup,Ye=ce.key,Ne=ce.props,Ie=Ne.children,We=Object(W.a)(Ne,["children"]);return re||!we?x(ce):Object(p.a)(Object(p.a)({key:"__RC_SELECT_GRP__".concat(Ye===null?Ee:Ye,"__"),label:Ye},We),{},{options:g(Ie)})}).filter(function(ce){return ce})}var f=ee("2Qr1"),d=ee("qNPg"),a=ee("U8pU"),C=ee("Kwbf"),v=ee("WKfj");function b(H){var re=H.mode,ce=H.options,Ee=H.children,we=H.backfill,Ye=H.allowClear,Ne=H.placeholder,Ie=H.getInputElement,We=H.showSearch,Ue=H.onSearch,xe=H.defaultOpen,se=H.autoFocus,ke=H.labelInValue,dt=H.value,at=H.inputValue,rt=H.optionLabelProp,lt=re==="multiple"||re==="tags",Ke=We!==void 0?We:lt||re==="combobox",$e=ce||g(Ee);if(Object(C.a)(re!=="tags"||$e.every(function(Ze){return!Ze.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),re==="tags"||re==="combobox"){var it=$e.some(function(Ze){return Ze.options?Ze.options.some(function(qe){return typeof("value"in qe?qe.value:qe.key)=="number"}):typeof("value"in Ze?Ze.value:Ze.key)=="number"});Object(C.a)(!it,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(C.a)(re!=="combobox"||!rt,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(C.a)(re==="combobox"||!we,"`backfill` only works with `combobox` mode."),Object(C.a)(re==="combobox"||!Ie,"`getInputElement` only work with `combobox` mode."),Object(C.b)(re!=="combobox"||!Ie||!Ye||!Ne,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Ue&&!Ke&&re!=="combobox"&&re!=="tags"&&Object(C.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(C.b)(!xe||se,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),dt!=null){var ft=Object(v.d)(dt);Object(C.a)(!ke||ft.every(function(Ze){return Object(a.a)(Ze)==="object"&&("key"in Ze||"value"in Ze)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(C.a)(!lt||Array.isArray(dt),"`value` should be array when `mode` is `multiple` or `tags`")}if(Ee){var ut=null;Object(w.a)(Ee).some(function(Ze){if(!A.isValidElement(Ze)||!Ze.type)return!1;var qe=Ze.type;if(qe.isSelectOption)return!1;if(qe.isSelectOptGroup){var Dt=Object(w.a)(Ze.props.children).every(function(wt){return!A.isValidElement(wt)||!Ze.type||wt.type.isSelectOption?!0:(ut=wt.type,!1)});return!Dt}return ut=qe,!0}),ut&&Object(C.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(ut.displayName||ut.name||ut,"`.")),Object(C.a)(at===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var y=b,G=Object(d.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:g,flattenOptions:f.d,getLabeledValue:f.e,filterOptions:f.b,isValueDisabled:f.g,findValueOption:f.c,warningProps:y,fillOptionsWithMissingValue:f.a}),$=function(H){Object(L.a)(ce,H);var re=Object(z.a)(ce);function ce(){var Ee;return Object(le.a)(this,ce),Ee=re.apply(this,arguments),Ee.selectRef=A.createRef(),Ee.focus=function(){Ee.selectRef.current.focus()},Ee.blur=function(){Ee.selectRef.current.blur()},Ee}return Object(Y.a)(ce,[{key:"render",value:function(){return A.createElement(G,Object.assign({ref:this.selectRef},this.props))}}]),ce}(A.Component);$.Option=u,$.OptGroup=m;var Z=$,V=xt.c=Z},M8RZ:function(zt,xt,ee){"use strict";ee.d(xt,"a",function(){return P});var le=ee("fWQN"),Y=ee("mtLc"),L=ee("yKVA"),z=ee("879j"),A=ee("q1tI"),I=ee.n(A),W=ee("i8i4"),j=ee.n(W),P=function(D){Object(L.a)(_,D);var E=Object(z.a)(_);function _(M){var R;Object(le.a)(this,_),R=E.call(this,M);var k=window.document;return R.node=k.createElement("div"),k.body.appendChild(R.node),R}return Object(Y.a)(_,[{key:"render",value:function(){var R=this.props.children;return Object(W.createPortal)(R,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),_}(I.a.Component)},NcEG:function(zt,xt,ee){"use strict";ee.r(xt);var le=ee("+L6B"),Y=ee("2/Rp"),L=ee("5NDa"),z=ee("5rEg"),A=ee("Znn+"),I=ee("ZTPi"),W=ee("2qtc"),j=ee("kLXV"),P=ee("14J3"),D=ee("BMrR"),E=ee("jCWc"),_=ee("kPKH"),M=ee("sPJy"),R=ee("bE4q"),k=ee("/zsF"),S=ee("PArb"),c=ee("miYZ"),o=ee("tsqr"),l=ee("9og8"),u=ee("k1fw"),T=ee("oBTY"),m=ee("y8nQ"),p=ee("Vl3Y"),w=ee("tJVT"),x=ee("PpiC"),g=ee("B9cy"),f=ee("Ol7k"),d=ee("lUTK"),a=ee("BvKs"),C=ee("WmNS"),v=ee.n(C),b=ee("q1tI"),y=ee.n(b),G=ee("Ty5D"),$=ee("55Ip"),Z=ee("9kvl"),V=ee("tgas"),H=ee("jb+D"),re=ee("BdwD"),ce=ee("giR+"),Ee=ee("fyUT"),we=ee("sRBo"),Ye=ee("kaz8"),Ne=ee("5Dmo"),Ie=ee("3S7+"),We=ee("V0Rq"),Ue=ee("Ot1p"),xe=ee("9Bee"),se=ee("xvzu"),ke=ee.n(se),dt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],at=function(Le,tt){var pt=Le.problemset,yt=Le.globalSetting,Gt=Le.loading,Tt=Le.dispatch,Ge=Le.onRef,gr=Ge===void 0?function(){}:Ge,Fe=Le.editData,or=Object(x.a)(Le,["problemset","globalSetting","loading","dispatch","onRef","editData"]),er=Object(b.useState)([]),Bt=Object(w.a)(er,2),qt=Bt[0],pr=Bt[1],kt=Object(b.useState)(),Gr=Object(w.a)(kt,2),br=Gr[0],wr=Gr[1],Lr=Object(b.useState)([]),Br=Object(w.a)(Lr,2),ur=Br[0],Ht=Br[1],_t=Object(b.useState)(""),Vr=Object(w.a)(_t,2),Fr=Vr[0],Ar=Vr[1],Kt=Object(b.useState)(5),Xr=Object(w.a)(Kt,2),Zr=Xr[0],Yr=Xr[1],Je=Object(b.useState)(!1),Pt=Object(w.a)(Je,2),jr=Pt[0],sr=Pt[1],Zt=Object(G.i)();Object(b.useEffect)(function(){pr(["","","",""])},[]),Object(b.useEffect)(function(){if(!(Fe!=null&&Fe.question_choices)){sr(!0);return}Ar(Fe==null?void 0:Fe.question_title),Yr(parseInt(Fe==null?void 0:Fe.question_score)),pr(Fe==null?void 0:Fe.question_choices.map(function(N){return N.choice_text}));var K=[];Fe==null||Fe.standard_answer.map(function(N,ae){K.push(N-1)}),Ht(K)},[Fe]),Object(b.useImperativeHandle)(tt,function(){return{onSave:Or,isEdit:jr}});var Or=function(){var K=Object(l.a)(v.a.mark(function N(){var ae,Be,ze;return v.a.wrap(function(je){for(;;)switch(je.prev=je.next){case 0:if(Fr){je.next=3;break}return o.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),je.abrupt("return",!1);case 3:if(ae=qt.findIndex(function(ct){return!ct}),!(ae>-1)){je.next=7;break}return o.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(dt[ae]," \u9009\u9879\u7684\u5185\u5BB9")),je.abrupt("return",!1);case 7:if(ur.length){je.next=10;break}return o.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),je.abrupt("return",!1);case 10:if(!(ur.length<1)){je.next=13;break}return o.b.info("\u8BF7\u9009\u62E9\u7B54\u6848"),je.abrupt("return",!1);case 13:if(Be=qt.map(function(ct,Wt){return{choice_text:ct,is_answer:ur.includes(Wt)?Wt+1:0}}),!Fe.question_id){je.next=20;break}return je.next=17,Tt({type:"exercise/editExerciseQuestion",payload:{id:Fe.question_id,question_title:Fr,question_type:1,question_score:"5.0",question_choices:Be.map(function(ct){return ct.choice_text}),standard_answers:Be.filter(function(ct){return ct.is_answer}).map(function(ct){return ct.is_answer})}});case 17:ze=je.sent,je.next=23;break;case 20:return je.next=22,Tt({type:"exercise/addExerciseQuestion",payload:{categoryId:Zt.categoryId,question_title:Fr,question_type:1,question_score:"5.0",question_choices:Be.map(function(ct){return ct.choice_text}),standard_answers:Be.filter(function(ct){return ct.is_answer}).map(function(ct){return ct.is_answer})}});case 22:ze=je.sent;case 23:ze.status===0&&(o.b.success("\u4FDD\u5B58\u6210\u529F"),sr(!1),Tt({type:"exercise/editExercise",payload:Object(u.a)({},Zt)}));case 24:case"end":return je.stop()}},N)}));return function(){return K.apply(this,arguments)}}(),U=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],s=function(){var K=Object(l.a)(v.a.mark(function N(ae){return v.a.wrap(function(ze){for(;;)switch(ze.prev=ze.next){case 0:ze.t0=ae.id,ze.next=ze.t0==="del"?3:ze.t0==="up"||ze.t0==="down"?5:ze.t0==="edit"?9:11;break;case 3:return j.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(l.a)(v.a.mark(function je(){return v.a.wrap(function(Wt){for(;;)switch(Wt.prev=Wt.next){case 0:return Wt.next=2,Object(We.m)({id:Fe.question_id});case 2:Tt({type:"exercise/editExercise",payload:Object(u.a)({},Zt)});case 3:case"end":return Wt.stop()}},je)}))()}}),ze.abrupt("break",11);case 5:return ze.next=7,Tt({type:"exercise/exeriseMoveUpDown",payload:{id:Fe.question_id,opr:ae.id}});case 7:return Tt({type:"exercise/editExercise",payload:Object(u.a)({},Zt)}),ze.abrupt("break",11);case 9:return sr(!0),ze.abrupt("break",11);case 11:case"end":return ze.stop()}},N)}));return function(ae){return K.apply(this,arguments)}}(),h=function(){var N;return y.a.createElement("aside",null,y.a.createElement("div",{className:ke.a.questionType},y.a.createElement("div",null,y.a.createElement("span",{className:"font16 c-blue"},Fe.key,"\u3001\u591A\u9009\u9898"),"\uFF08",Fe.question_score,"\u5206\uFF09"),!Fe.hideAction&&U.map(function(ae,Be){return ae.id==="up"&&Fe.key===1||ae.id==="down"&&Fe.key===Fe.len?null:y.a.createElement(Ie.a,{key:Be,placement:"bottom",title:ae.name},y.a.createElement("span",{onClick:function(){return s(ae)},className:ae.icon}))})),y.a.createElement("div",{className:"mt5"},y.a.createElement(xe.a,{value:Fe.question_title})),y.a.createElement("div",{className:ke.a.questionChoices},Fe==null||((N=Fe.question_choices)===null||N===void 0)?void 0:N.map(function(ae,Be){return y.a.createElement(D.a,null,y.a.createElement(_.a,null,y.a.createElement(Ye.a,{key:Be,checked:Fe.standard_answer.includes(Be+1),disabled:!0},dt[Be],".")),y.a.createElement(_.a,{flex:"1"},y.a.createElement("span",{className:"c-black font14"},y.a.createElement(xe.a,{value:ae.choice_text}))))})))},B=function(){return y.a.createElement("aside",null,y.a.createElement("div",{className:ke.a.questionType},y.a.createElement("div",null,y.a.createElement("span",{className:"font16 c-blue"},"\u9009\u62E9\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09")),y.a.createElement("p",{className:ke.a.titleWrap},y.a.createElement("span",{className:ke.a.required},"*"),y.a.createElement("span",{className:ke.a.title},"\u9898\u5E72\uFF1A")),y.a.createElement(Ue.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Fr,onChange:function(ae){return Ar(ae)}}),y.a.createElement("p",{className:ke.a.titleWrap},y.a.createElement("span",{className:ke.a.required},"*"),y.a.createElement("span",{className:ke.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",y.a.createElement("span",{className:ke.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),qt.map(function(N,ae){return y.a.createElement("div",{className:ke.a.choiceWrap,key:ae},y.a.createElement(Ie.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},y.a.createElement("div",{className:"".concat(ke.a.answer," ").concat(ur.includes(ae)?ke.a.activeAnswer:""),onClick:function(){ur.includes(ae)?Ht(ur.filter(function(ze){return ze!==ae})):Ht([].concat(Object(T.a)(ur),[ae]))}},dt[ae])),y.a.createElement("div",{className:ke.a.editorWrap},br===ae?y.a.createElement(Ue.a,{id:"single-question-option-".concat(ae),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:N,onChange:function(ze){qt[ae]=ze,pr(qt)}}):y.a.createElement("div",{className:ke.a.htmlWrap,onClick:function(){return wr(ae)}},y.a.createElement(xe.a,{value:N}))),ae>1&&y.a.createElement(Ie.a,{title:"\u5220\u9664"},y.a.createElement("i",{className:"".concat(ke.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return pr(qt.filter(function(ze,gt){return gt!==ae}))}})),ae<7&&ae===qt.length-1&&y.a.createElement(Ie.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},y.a.createElement("i",{className:"".concat(ke.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return pr([].concat(Object(T.a)(qt),[""]))}})))}),y.a.createElement("p",{className:"c-orange"},"\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\u8F93\u5165\u6846\u53EF\u8BBE\u7F6E\u7B54\u6848\uFF1B\u9009\u4E2D\u7684\u9009\u9879\u5373\u4E3A\u6B63\u786E\u7B54\u6848\uFF0C\u9009\u62E9\u591A\u4E2A\u7B54\u6848\u5373\u4E3A\u591A\u9009\u9898"),y.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",y.a.createElement(Ee.a,{value:Zr,max:1e4,min:-1,onChange:function(ae){Yr(ae)}})," \u5206"),y.a.createElement("aside",{className:"tr"},Fe.question_id&&y.a.createElement(Y.a,{type:"default",onClick:function(){return sr(!1)}},"\u53D6\u6D88"),y.a.createElement(Y.a,{className:"ml20",type:"primary",onClick:function(){return Or()}},"\u4FDD\u5B58")))};return y.a.createElement("section",{className:ke.a.wrap},!jr&&h(),jr&&B())},rt=Object(Z.a)(function(be){var Le=be.problemset,tt=be.loading,pt=be.globalSetting;return{problemset:Le,globalSetting:pt,loading:tt.effects}},null,null,{forwardRef:!0})(Object(b.forwardRef)(at)),lt=ee("7Kak"),Ke=ee("9yH6"),$e=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],it=function(Le,tt){var pt=Le.problemset,yt=Le.globalSetting,Gt=Le.loading,Tt=Le.dispatch,Ge=Le.onRef,gr=Ge===void 0?function(){}:Ge,Fe=Le.editData,or=Object(x.a)(Le,["problemset","globalSetting","loading","dispatch","onRef","editData"]),er=Object(b.useState)([]),Bt=Object(w.a)(er,2),qt=Bt[0],pr=Bt[1],kt=Object(b.useState)(),Gr=Object(w.a)(kt,2),br=Gr[0],wr=Gr[1],Lr=Object(b.useState)([]),Br=Object(w.a)(Lr,2),ur=Br[0],Ht=Br[1],_t=Object(b.useState)(""),Vr=Object(w.a)(_t,2),Fr=Vr[0],Ar=Vr[1],Kt=Object(b.useState)(0),Xr=Object(w.a)(Kt,2),Zr=Xr[0],Yr=Xr[1],Je=Object(b.useState)(!1),Pt=Object(w.a)(Je,2),jr=Pt[0],sr=Pt[1],Zt=Object(G.i)();Object(b.useEffect)(function(){pr(["","","",""])},[]),Object(b.useEffect)(function(){if(!(Fe!=null&&Fe.question_choices)){sr(!0);return}Ar(Fe==null?void 0:Fe.question_title),Yr(parseInt(Fe==null?void 0:Fe.question_score)),pr(Fe==null?void 0:Fe.question_choices.map(function(N){return N.choice_text}));var K=[];Fe==null||Fe.standard_answer.map(function(N,ae){K.push(N-1)}),Ht(K)},[Fe]),Object(b.useImperativeHandle)(tt,function(){return{onSave:Or,isEdit:jr}});var Or=function(){var K=Object(l.a)(v.a.mark(function N(){var ae,Be,ze;return v.a.wrap(function(je){for(;;)switch(je.prev=je.next){case 0:if(Fr){je.next=3;break}return o.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),je.abrupt("return",!1);case 3:if(ae=qt.findIndex(function(ct){return!ct}),!(ae>-1)){je.next=7;break}return o.b.info("\u8BF7\u5148\u8F93\u5165 ".concat($e[ae]," \u9009\u9879\u7684\u5185\u5BB9")),je.abrupt("return",!1);case 7:if(ur.length){je.next=10;break}return o.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),je.abrupt("return",!1);case 10:if(!(ur.length<1)){je.next=13;break}return o.b.info("\u8BF7\u9009\u62E9\u7B54\u6848"),je.abrupt("return",!1);case 13:if(Be=qt.map(function(ct,Wt){return{choice_text:ct,is_answer:ur.includes(Wt)?Wt+1:0}}),!Fe.question_id){je.next=20;break}return je.next=17,Object(V.u)({id:Fe.question_id,question_title:Fr,question_type:1,question_score:Zr,question_choices:Be.map(function(ct){return ct.choice_text}),standard_answers:Be.filter(function(ct){return ct.is_answer}).map(function(ct){return ct.is_answer})});case 17:ze=je.sent,je.next=23;break;case 20:return je.next=22,Object(V.a)({exercise_bank_id:Zt.topicId,question_title:Fr,question_type:1,question_score:"5.0",question_choices:Be.map(function(ct){return ct.choice_text}),standard_answers:Be.filter(function(ct){return ct.is_answer}).map(function(ct){return ct.is_answer})});case 22:ze=je.sent;case 23:return ze.status===0&&(o.b.success("\u4FDD\u5B58\u6210\u529F"),sr(!1)),je.next=26,Tt({type:"polls/getExerciseBanks",payload:Object(u.a)({},Zt)});case 26:case"end":return je.stop()}},N)}));return function(){return K.apply(this,arguments)}}(),U=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],s=function(){var K=Object(l.a)(v.a.mark(function N(ae){return v.a.wrap(function(ze){for(;;)switch(ze.prev=ze.next){case 0:ze.t0=ae.id,ze.next=ze.t0==="del"?3:ze.t0==="up"||ze.t0==="down"?5:ze.t0==="edit"?9:11;break;case 3:return j.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(l.a)(v.a.mark(function je(){return v.a.wrap(function(Wt){for(;;)switch(Wt.prev=Wt.next){case 0:return Wt.next=2,Object(V.e)({pollsId:Fe.question_id});case 2:Tt({type:"polls/getExerciseBanks",payload:Object(u.a)({},Zt)});case 3:case"end":return Wt.stop()}},je)}))()}}),ze.abrupt("break",11);case 5:return ze.next=7,Object(V.j)({exerciseId:Fe==null?void 0:Fe.question_id,opr:ae.id});case 7:return Tt({type:"polls/getExerciseBanks",payload:Object(u.a)({},Zt)}),ze.abrupt("break",11);case 9:return sr(!0),ze.abrupt("break",11);case 11:case"end":return ze.stop()}},N)}));return function(ae){return K.apply(this,arguments)}}(),h=function(){var N;return y.a.createElement("aside",null,y.a.createElement("div",{className:ke.a.questionType},y.a.createElement("div",null,y.a.createElement("span",{className:"font16 c-blue"},Fe.key,"\u3001\u5355\u9009\u9898"),"\uFF08",Fe.question_score,"\u5206\uFF09"),!Fe.hideAction&&U.map(function(ae,Be){return ae.id==="up"&&Fe.key===1||ae.id==="down"&&Fe.key===Fe.len?null:y.a.createElement(Ie.a,{key:Be,placement:"bottom",title:ae.name},y.a.createElement("span",{onClick:function(){return s(ae)},className:ae.icon}))})),y.a.createElement("div",{className:"mt5"},y.a.createElement(xe.a,{value:Fe.question_title})),y.a.createElement("div",{className:ke.a.questionChoices},Fe==null||((N=Fe.question_choices)===null||N===void 0)?void 0:N.map(function(ae,Be){return y.a.createElement(D.a,null,y.a.createElement(_.a,null,y.a.createElement(Ke.a,{key:Be,checked:Fe.standard_answer.includes(Be+1),disabled:!0},$e[Be],".")),y.a.createElement(_.a,{flex:"1"},y.a.createElement("span",{className:"c-black font14"},y.a.createElement(xe.a,{value:ae.choice_text}))))})))},B=function(){return y.a.createElement("aside",null,y.a.createElement("div",{className:ke.a.questionType},y.a.createElement("div",null,y.a.createElement("span",{className:"font16 c-blue"},"\u9009\u62E9\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09")),y.a.createElement("p",{className:ke.a.titleWrap},y.a.createElement("span",{className:ke.a.required},"*"),y.a.createElement("span",{className:ke.a.title},"\u9898\u5E72\uFF1A")),y.a.createElement(Ue.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Fr,onChange:function(ae){return Ar(ae)}}),y.a.createElement("p",{className:ke.a.titleWrap},y.a.createElement("span",{className:ke.a.required},"*"),y.a.createElement("span",{className:ke.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",y.a.createElement("span",{className:ke.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),qt.map(function(N,ae){return y.a.createElement("div",{className:ke.a.choiceWrap,key:ae},y.a.createElement(Ie.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},y.a.createElement("div",{className:"".concat(ke.a.answer," ").concat(ur.includes(ae)?ke.a.activeAnswer:""),onClick:function(){ur.includes(ae)?Ht(ur.filter(function(ze){return ze!==ae})):Ht([].concat(Object(T.a)(ur),[ae]))}},$e[ae])),y.a.createElement("div",{className:ke.a.editorWrap},br===ae?y.a.createElement(Ue.a,{id:"single-question-option-".concat(ae),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:N,onChange:function(ze){qt[ae]=ze,pr(qt)}}):y.a.createElement("div",{className:ke.a.htmlWrap,onClick:function(){return wr(ae)}},y.a.createElement(xe.a,{value:N}))),ae>1&&y.a.createElement(Ie.a,{title:"\u5220\u9664"},y.a.createElement("i",{className:"".concat(ke.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return pr(qt.filter(function(ze,gt){return gt!==ae}))}})),ae<7&&ae===qt.length-1&&y.a.createElement(Ie.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},y.a.createElement("i",{className:"".concat(ke.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return pr([].concat(Object(T.a)(qt),[""]))}})))}),y.a.createElement("p",{className:"c-orange"},"\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\u8F93\u5165\u6846\u53EF\u8BBE\u7F6E\u7B54\u6848\uFF1B\u9009\u4E2D\u7684\u9009\u9879\u5373\u4E3A\u6B63\u786E\u7B54\u6848\uFF0C\u9009\u62E9\u591A\u4E2A\u7B54\u6848\u5373\u4E3A\u591A\u9009\u9898"),y.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",y.a.createElement(Ee.a,{value:Zr,max:1e4,min:-1,onChange:function(ae){Yr(ae)}})," \u5206"),y.a.createElement("aside",{className:"tr"},Fe.question_id&&y.a.createElement(Y.a,{type:"default",onClick:function(){return sr(!1)}},"\u53D6\u6D88"),y.a.createElement(Y.a,{className:"ml20",type:"primary",onClick:function(){return Or()}},"\u4FDD\u5B58")))};return y.a.createElement("section",{className:ke.a.wrap},!jr&&h(),jr&&B())},ft=Object(Z.a)(function(be){var Le=be.problemset,tt=be.loading,pt=be.globalSetting;return{problemset:Le,globalSetting:pt,loading:tt.effects}},null,null,{forwardRef:!0})(Object(b.forwardRef)(it)),ut=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Ze=function(Le,tt){var pt=Le.problemset,yt=Le.globalSetting,Gt=Le.loading,Tt=Le.dispatch,Ge=Le.onRef,gr=Ge===void 0?function(){}:Ge,Fe=Le.editData,or=Object(x.a)(Le,["problemset","globalSetting","loading","dispatch","onRef","editData"]),er=Object(b.useState)(),Bt=Object(w.a)(er,2),qt=Bt[0],pr=Bt[1],kt=Object(b.useState)(""),Gr=Object(w.a)(kt,2),br=Gr[0],wr=Gr[1],Lr=Object(b.useState)(!1),Br=Object(w.a)(Lr,2),ur=Br[0],Ht=Br[1],_t=Object(b.useState)(5),Vr=Object(w.a)(_t,2),Fr=Vr[0],Ar=Vr[1],Kt=Object(G.i)();Object(b.useEffect)(function(){if(!(Fe!=null&&Fe.question_choices)){Ht(!0);return}wr(Fe==null?void 0:Fe.question_title),Ar(Fe==null?void 0:Fe.question_score),pr(Fe.standard_answer[0]+"")},[Fe]),Object(b.useImperativeHandle)(tt,function(){return{onSave:Xr,isEdit:ur}});var Xr=function(){var jr=Object(l.a)(v.a.mark(function sr(){var Zt,Or;return v.a.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(br){s.next=3;break}return o.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),s.abrupt("return",!1);case 3:if(qt){s.next=6;break}return o.b.info("\u8BF7\u5148\u70B9\u51FB\u9009\u62E9\u672C\u9009\u62E9\u9898\u7684\u6B63\u786E\u9009\u9879"),s.abrupt("return",!1);case 6:if(Zt=[{choice_text:"\u6B63\u786E",is_answer:qt==="1"?1:0},{choice_text:"\u9519\u8BEF",is_answer:qt==="2"?2:0}],!Fe.question_id){s.next=13;break}return s.next=10,Object(V.u)({id:Fe.question_id,question_title:br,question_type:2,question_score:Fr,question_choices:Zt.map(function(h){return h.choice_text}),standard_answers:Zt.filter(function(h){return h.is_answer}).map(function(h){return h.is_answer})});case 10:Or=s.sent,s.next=16;break;case 13:return s.next=15,Object(V.a)({exercise_bank_id:Kt.topicId,question_title:br,question_type:2,question_score:Fr,question_choices:Zt.map(function(h){return h.choice_text}),standard_answers:Zt.filter(function(h){return h.is_answer}).map(function(h){return h.is_answer})});case 15:Or=s.sent;case 16:return Or.status===0&&(o.b.success("\u4FDD\u5B58\u6210\u529F"),Ht(!1)),Tt({type:"polls/getExerciseBanks",payload:Object(u.a)({},Kt)}),s.abrupt("return",{name:br,choices:Zt});case 19:case"end":return s.stop()}},sr)}));return function(){return jr.apply(this,arguments)}}(),Zr=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],Yr=function(){var jr=Object(l.a)(v.a.mark(function sr(Zt){return v.a.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:U.t0=Zt.id,U.next=U.t0==="del"?3:U.t0==="up"||U.t0==="down"?5:U.t0==="edit"?9:11;break;case 3:return j.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(l.a)(v.a.mark(function h(){return v.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(V.e)({pollsId:Fe.question_id});case 2:Tt({type:"polls/getExerciseBanks",payload:Object(u.a)({},Kt)});case 3:case"end":return K.stop()}},h)}))()}}),U.abrupt("break",11);case 5:return U.next=7,Object(V.j)({exerciseId:Fe==null?void 0:Fe.question_id,opr:Zt.id});case 7:return Tt({type:"polls/getExerciseBanks",payload:Object(u.a)({},Kt)}),U.abrupt("break",11);case 9:return Ht(!0),U.abrupt("break",11);case 11:case"end":return U.stop()}},sr)}));return function(Zt){return jr.apply(this,arguments)}}(),Je=function(){var sr;return y.a.createElement("aside",null,y.a.createElement("div",{className:ke.a.questionType},y.a.createElement("div",null,y.a.createElement("span",{className:"font16 c-blue"},Fe.key,"\u3001\u5224\u65AD\u9898"),"\uFF08",Fe.question_score,"\u5206\uFF09"),!Fe.hideAction&&Zr.map(function(Zt,Or){return Zt.id==="up"&&Fe.key===1||Zt.id==="down"&&Fe.key===Fe.len?null:y.a.createElement(Ie.a,{key:Or,placement:"bottom",title:Zt.name},y.a.createElement("span",{onClick:function(){return Yr(Zt)},className:Zt.icon}))})),y.a.createElement("div",{className:"mt5"},Fe.question_title),y.a.createElement("div",{className:ke.a.questionChoices},Fe==null||((sr=Fe.question_choices)===null||sr===void 0)?void 0:sr.map(function(Zt,Or){return y.a.createElement(Ke.a,{key:Or,checked:Fe.standard_answer.includes(Or+1),disabled:!0},ut[Or],". ",y.a.createElement("span",{className:"c-black font14"},Zt.choice_text))})))},Pt=function(){return y.a.createElement("aside",null,y.a.createElement("div",null,y.a.createElement("span",{className:"font16 c-blue"},"\u5224\u65AD\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09"),y.a.createElement("p",{className:ke.a.titleWrap},y.a.createElement("span",{className:ke.a.required},"*"),y.a.createElement("span",{className:ke.a.title},"\u9898\u5E72\uFF1A")),y.a.createElement(Ue.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:br,onChange:function(Zt){return wr(Zt)}}),y.a.createElement("p",{className:ke.a.titleWrap},y.a.createElement("span",{className:ke.a.required},"*"),y.a.createElement("span",{className:ke.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",y.a.createElement("span",{className:ke.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),y.a.createElement(Ke.a.Group,{buttonStyle:"solid",value:qt,onChange:function(Zt){return pr(Zt.target.value)}},y.a.createElement(Ke.a.Button,{value:"1",className:"".concat(ke.a.radio," mr40")},"\u6B63\u786E"),y.a.createElement(Ke.a.Button,{value:"2",className:ke.a.radio},"\u9519\u8BEF")),y.a.createElement("p",{className:"c-orange"},"\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\uFF0C\u53EF\u4EE5\u76F4\u63A5\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848"),y.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",y.a.createElement(Ee.a,{value:Fr,max:1e4,min:-1,onChange:function(Zt){Ar(Zt)}})," \u5206"),y.a.createElement("aside",{className:"tr"},Fe.question_id&&y.a.createElement(Y.a,{type:"default",onClick:function(){return Ht(!1)}},"\u53D6\u6D88"),y.a.createElement(Y.a,{className:"ml20",type:"primary",onClick:function(){return Xr()}},"\u4FDD\u5B58")))};return y.a.createElement("section",{className:ke.a.wrap},!ur&&Je(),ur&&Pt())},qe=Object(Z.a)(function(be){var Le=be.problemset,tt=be.loading,pt=be.globalSetting;return{problemset:Le,globalSetting:pt,loading:tt.effects}},null,null,{forwardRef:!0})(Object(b.forwardRef)(Ze)),Dt=ee("kqOp"),wt=ee("7qnI"),vt=ee("1vsH"),mt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Nt=function(Le,tt){var pt=Le.problemset,yt=Le.globalSetting,Gt=Le.loading,Tt=Le.dispatch,Ge=Le.editData,gr=Object(x.a)(Le,["problemset","globalSetting","loading","dispatch","editData"]),Fe=Object(b.useState)(""),or=Object(w.a)(Fe,2),er=or[0],Bt=or[1],qt=Object(b.useState)(""),pr=Object(w.a)(qt,2),kt=pr[0],Gr=pr[1],br=Object(b.useState)([]),wr=Object(w.a)(br,2),Lr=wr[0],Br=wr[1],ur=Object(b.useState)(""),Ht=Object(w.a)(ur,2),_t=Ht[0],Vr=Ht[1],Fr=Object(b.useState)(),Ar=Object(w.a)(Fr,2),Kt=Ar[0],Xr=Ar[1],Zr=Object(b.useState)(!1),Yr=Object(w.a)(Zr,2),Je=Yr[0],Pt=Yr[1],jr=Object(b.useState)(5),sr=Object(w.a)(jr,2),Zt=sr[0],Or=sr[1],U=Object(b.useState)(!1),s=Object(w.a)(U,2),h=s[0],B=s[1],K=Object(G.i)();Object(b.useEffect)(function(){if(!(Ge!=null&&Ge.question_title)){B(!0);return}Bt(Ge==null?void 0:Ge.question_title),Xr(Ge==null?void 0:Ge.is_ordered),Or(Ge==null?void 0:Ge.question_score);var ar=Ge==null?void 0:Ge.standard_answer.map(function(bt){return bt.answer_text});Br(ar)},[pt.editData]),Object(b.useEffect)(function(){Pt(!1)},[h]),Object(b.useImperativeHandle)(tt,function(){return{onSave:N,isEdit:h}});var N=function(){var ar=Object(l.a)(v.a.mark(function bt(){var Rt,Qt,tr;return v.a.wrap(function(Mr){for(;;)switch(Mr.prev=Mr.next){case 0:if(Rt=[],Qt=!1,Lr.forEach(function(rr,En){Rt.push({choice_id:En+1,answer_text:[]}),rr.forEach(function(Jn,ri){Rt[En].answer_text.push(Jn),(!Jn||!Object(vt.Z)(Jn,1e4))&&(Vr("".concat(En,"-").concat(ri)),o.b.info(Jn?"\u7B54\u6848\u4E0D\u80FD\u8D85\u8FC710000\u5B57\u7B26":"\u7B54\u6848\uFF1A\u4E0D\u80FD\u4E3A\u7A7A"),Qt=!0)})}),!Qt){Mr.next=5;break}return Mr.abrupt("return",!1);case 5:if(!Ge.question_id){Mr.next=11;break}return Mr.next=8,Object(V.u)({id:Ge.question_id,question_title:er,question_type:3,question_score:Zt,is_ordered:Kt,standard_answers:Rt});case 8:tr=Mr.sent,Mr.next=14;break;case 11:return Mr.next=13,Object(V.a)({exercise_bank_id:K.topicId,question_title:er,question_type:3,question_score:Zt,is_ordered:Kt,standard_answers:Rt});case 13:tr=Mr.sent;case 14:return tr.status===0&&(o.b.success("\u4FDD\u5B58\u6210\u529F"),B(!1)),Tt({type:"polls/getExerciseBanks",payload:Object(u.a)({},K)}),Mr.abrupt("return",{name:er,analysis:kt,standard_answers:Rt,is_ordered:Kt});case 17:case"end":return Mr.stop()}},bt)}));return function(){return ar.apply(this,arguments)}}(),ae=function(bt,Rt,Qt){var tr=Lr.slice();if(Rt&&tr.splice(bt,Rt),Qt&&Je)for(var dr=0;dr<Qt;dr++)tr.splice(bt+dr,0,[""]);Pt(!0),Br(tr)},Be=function(bt,Rt,Qt){Vr("");var tr=Lr.slice();tr[bt][Rt]=Qt,Br(tr)},ze=function(bt){var Rt=Lr.slice();Rt[bt]=[].concat(Object(T.a)(Rt[bt]),[""]),Br(Rt)},gt=function(bt,Rt){var Qt=Lr.slice();if(!Qt[bt][Rt]){Qt[bt]=Qt[bt].filter(function(tr,dr){return dr!==Rt}),Br(Qt);return}j.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:ke.a.modal,onOk:function(){Qt[bt]=Qt[bt].filter(function(dr,Mr){return Mr!==Rt}),Br(Qt)}})},je=function(bt){j.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:ke.a.modal,onOk:function(){var Qt=Lr.slice();Qt=Lr.filter(function(tr,dr){return bt!==dr}),Br(Qt)}})},ct=function(){return y.a.createElement("aside",null,y.a.createElement("div",{className:ke.a.questionType},y.a.createElement("div",null,y.a.createElement("span",{className:"font16 c-blue"},"\u586B\u7A7A\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u5141\u8BB8\u624B\u52A8\u8C03\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848 \uFF1B\u652F\u6301\u6700\u591A5\u4E2A\u7A7A\uFF0C\u6BCF\u7A7A\u5F97\u5206\u6309\u7167\u672C\u9898\u7684\u603B\u5206\u5E73\u5747\u8BA1\u7B97\uFF09")),y.a.createElement("div",null,y.a.createElement(Dt.a,{id:"completion-question-tittle",placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE",height:155,defaultValue:er,onChange:function(Rt){return Bt(Rt)},showNullButton:!0,onPlaceholderChange:ae})),y.a.createElement("div",{className:"mt20"},Lr.map(function(bt,Rt){return y.a.createElement(wt.a,{key:Rt,answers:bt,index:Rt,is_md:!0,activeOptionErrorIndex:_t,onAnswerChange:Be,addChildAnswer:ze,deleteChildAnswer:gt,deleteChildAnswermain:je})})),y.a.createElement("div",{className:"mt20"},Lr.length>1&&y.a.createElement("span",null,y.a.createElement(Ye.a,{checked:Kt,onChange:function(Rt){return Xr(Rt.target.checked)},className:"".concat(ke.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),y.a.createElement("span",{className:"".concat(ke.a.color999," font12")},"\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"))),y.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",y.a.createElement(Ee.a,{value:Zt,max:1e4,min:-1,onChange:function(Rt){Or(Rt)}})," \u5206"),y.a.createElement("aside",{className:"tr"},Ge.question_id&&y.a.createElement(Y.a,{type:"default",onClick:function(){return B(!1)}},"\u53D6\u6D88"),y.a.createElement(Y.a,{className:"ml20",type:"primary",onClick:function(){return N()}},"\u4FDD\u5B58")))},Wt=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],Dr=function(){var ar=Object(l.a)(v.a.mark(function bt(Rt){return v.a.wrap(function(tr){for(;;)switch(tr.prev=tr.next){case 0:tr.t0=Rt.id,tr.next=tr.t0==="del"?3:tr.t0==="up"||tr.t0==="down"?5:tr.t0==="edit"?9:11;break;case 3:return j.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(l.a)(v.a.mark(function Mr(){return v.a.wrap(function(En){for(;;)switch(En.prev=En.next){case 0:return En.next=2,Object(V.e)({pollsId:Ge.question_id});case 2:Tt({type:"polls/getExerciseBanks",payload:Object(u.a)({},K)});case 3:case"end":return En.stop()}},Mr)}))()}}),tr.abrupt("break",11);case 5:return tr.next=7,Object(V.j)({exerciseId:Ge==null?void 0:Ge.question_id,opr:Rt.id});case 7:return Tt({type:"polls/getExerciseBanks",payload:Object(u.a)({},K)}),tr.abrupt("break",11);case 9:return B(!0),tr.abrupt("break",11);case 11:case"end":return tr.stop()}},bt)}));return function(Rt){return ar.apply(this,arguments)}}(),qr=function(){var bt;return y.a.createElement("aside",null,y.a.createElement("div",{className:ke.a.questionType},y.a.createElement("div",null,y.a.createElement("span",{className:"font16 c-blue"},Ge.key,"\u3001\u586B\u7A7A\u9898"),"\uFF08",Ge.question_score,"\u5206\uFF09"),!Ge.hideAction&&Wt.map(function(Rt,Qt){return Rt.id==="up"&&Ge.key===1||Rt.id==="down"&&Ge.key===Ge.len?null:y.a.createElement(Ie.a,{key:Qt,placement:"bottom",title:Rt.name},y.a.createElement("span",{onClick:function(){return Dr(Rt)},className:Rt.icon}))})),y.a.createElement("div",{className:"mt5"},Ge.question_title),y.a.createElement("div",{className:ke.a.questionChoices},Ge==null||((bt=Ge.standard_answer)===null||bt===void 0)?void 0:bt.map(function(Rt,Qt){return y.a.createElement(D.a,null,y.a.createElement(_.a,null,"\u7B54\u6848\uFF08\u586B\u7A7A",Rt.choice_id,"\uFF09\uFF1A"),y.a.createElement(_.a,{flex:"1"},y.a.createElement(z.a,{key:Qt,checked:Ge.standard_answer.includes(Qt),disabled:!0,value:Rt.answer_text})))})))};return y.a.createElement("section",{className:ke.a.wrap},!h&&qr(),h&&ct())},At=Object(Z.a)(function(be){var Le=be.problemset,tt=be.loading,pt=be.globalSetting;return{problemset:Le,globalSetting:pt,loading:tt.effects}},null,null,{forwardRef:!0})(Object(b.forwardRef)(Nt)),Ot=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],He=function(Le,tt){var pt=Le.problemset,yt=Le.globalSetting,Gt=Le.loading,Tt=Le.dispatch,Ge=Le.onRef,gr=Ge===void 0?function(){}:Ge,Fe=Le.editData,or=Object(x.a)(Le,["problemset","globalSetting","loading","dispatch","onRef","editData"]),er=Object(b.useState)(""),Bt=Object(w.a)(er,2),qt=Bt[0],pr=Bt[1],kt=Object(b.useState)(""),Gr=Object(w.a)(kt,2),br=Gr[0],wr=Gr[1],Lr=Object(b.useState)(""),Br=Object(w.a)(Lr,2),ur=Br[0],Ht=Br[1],_t=Object(b.useState)(5),Vr=Object(w.a)(_t,2),Fr=Vr[0],Ar=Vr[1],Kt=Object(b.useState)(!1),Xr=Object(w.a)(Kt,2),Zr=Xr[0],Yr=Xr[1],Je=Object(G.i)();Object(b.useEffect)(function(){var U;if(!(Fe!=null&&Fe.question_title)){Yr(!0);return}pr(Fe==null?void 0:Fe.question_title),Ht(Fe==null||((U=Fe.standard_answer)===null||U===void 0)?void 0:U[0]),Ar(Fe==null?void 0:Fe.question_score)},[pt.editData]),Object(b.useImperativeHandle)(tt,function(){return{onSave:Pt,isEdit:Zr}});var Pt=function(){var U=Object(l.a)(v.a.mark(function s(){var h;return v.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:if(qt){K.next=3;break}return o.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),K.abrupt("return",!1);case 3:if(!Fe.question_id){K.next=9;break}return K.next=6,Object(V.u)({id:Fe.question_id,question_title:qt,question_type:4,question_score:Fr,standard_answers:[ur]});case 6:h=K.sent,K.next=12;break;case 9:return K.next=11,Object(V.a)({exercise_bank_id:Je.topicId,question_title:qt,question_type:4,question_score:Fr,standard_answers:[ur]});case 11:h=K.sent;case 12:return h.status===0&&(o.b.success("\u4FDD\u5B58\u6210\u529F"),Yr(!1),Tt({type:"polls/getExerciseBanks",payload:Object(u.a)({},Je)})),K.abrupt("return",{name:qt,answer_texts:[ur],analysis:br});case 14:case"end":return K.stop()}},s)}));return function(){return U.apply(this,arguments)}}(),jr=function(){return y.a.createElement("aside",null,y.a.createElement("div",{className:ke.a.questionType},y.a.createElement("div",null,y.a.createElement("span",{className:"font16 c-blue"},"\u7B80\u7B54\u9898"),"\uFF08\u4E3B\u89C2\u9898\uFF0C\u672A\u4F5C\u7B54\u7684\u60C5\u51B5\u4E0B\u81EA\u52A8\u8BC4\u4E3A\u96F6\u5206\uFF09")),y.a.createElement(Ue.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:qt,onChange:function(h){return pr(h)}}),y.a.createElement("p",{className:ke.a.titleWrap},y.a.createElement("span",{className:ke.a.title},"\u53C2\u8003\u7B54\u6848\uFF1A")),y.a.createElement(Ue.a,{id:"single-question-reference-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848",defaultValue:ur,onChange:function(h){return Ht(h)}}),y.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",y.a.createElement(Ee.a,{value:Fr,max:1e4,min:-1,onChange:function(h){Ar(h)}})," \u5206"),y.a.createElement("aside",{className:"tr"},Fe.question_id&&y.a.createElement(Y.a,{type:"default",onClick:function(){return Yr(!1)}},"\u53D6\u6D88"),y.a.createElement(Y.a,{className:"ml20",type:"primary",onClick:function(){return Pt()}},"\u4FDD\u5B58")))},sr=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],Zt=function(){var U=Object(l.a)(v.a.mark(function s(h){return v.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:K.t0=h.id,K.next=K.t0==="del"?3:K.t0==="up"||K.t0==="down"?5:K.t0==="edit"?9:11;break;case 3:return j.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(l.a)(v.a.mark(function ae(){return v.a.wrap(function(ze){for(;;)switch(ze.prev=ze.next){case 0:return ze.next=2,Object(V.e)({pollsId:Fe.question_id});case 2:Tt({type:"polls/getExerciseBanks",payload:Object(u.a)({},Je)});case 3:case"end":return ze.stop()}},ae)}))()}}),K.abrupt("break",11);case 5:return K.next=7,Object(V.j)({exerciseId:Fe==null?void 0:Fe.question_id,opr:h.id});case 7:return Tt({type:"polls/getExerciseBanks",payload:Object(u.a)({},Je)}),K.abrupt("break",11);case 9:return Yr(!0),K.abrupt("break",11);case 11:case"end":return K.stop()}},s)}));return function(h){return U.apply(this,arguments)}}(),Or=function(){return y.a.createElement("aside",null,y.a.createElement("div",{className:ke.a.questionType},y.a.createElement("div",null,y.a.createElement("span",{className:"font16 c-blue"},Fe.key,"\u3001\u7B80\u7B54\u9898"),"\uFF08",Fe.question_score,"\u5206\uFF09"),!Fe.hideAction&&sr.map(function(s,h){return s.id==="up"&&Fe.key===1||s.id==="down"&&Fe.key===Fe.len?null:y.a.createElement(Ie.a,{key:h,placement:"bottom",title:s.name},y.a.createElement("span",{onClick:function(){return Zt(s)},className:s.icon}))})),y.a.createElement("div",{className:"mt5"},Fe.question_title),y.a.createElement("div",{className:ke.a.questionChoices},y.a.createElement("p",null,y.a.createElement("strong",null,"\u53C2\u8003\u7B54\u6848\uFF1A")),y.a.createElement(xe.a,{value:ur})))};return y.a.createElement("section",{className:ke.a.wrap},!Zr&&Or(),Zr&&jr())},Ut=Object(Z.a)(function(be){var Le=be.problemset,tt=be.loading,pt=be.globalSetting;return{problemset:Le,globalSetting:pt,loading:tt.effects}},null,null,{forwardRef:!0})(Object(b.forwardRef)(He)),Lt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Xe=function(Le,tt){var pt=Le.problemset,yt=Le.globalSetting,Gt=Le.loading,Tt=Le.dispatch,Ge=Le.editData,gr=Object(x.a)(Le,["problemset","globalSetting","loading","dispatch","editData"]),Fe=Object(b.useState)(""),or=Object(w.a)(Fe,2),er=or[0],Bt=or[1],qt=Object(b.useState)(""),pr=Object(w.a)(qt,2),kt=pr[0],Gr=pr[1],br=Object(b.useState)(""),wr=Object(w.a)(br,2),Lr=wr[0],Br=wr[1],ur=Object(b.useState)([]),Ht=Object(w.a)(ur,2),_t=Ht[0],Vr=Ht[1],Fr=Object(b.useState)(""),Ar=Object(w.a)(Fr,2),Kt=Ar[0],Xr=Ar[1],Zr=Object(b.useState)(),Yr=Object(w.a)(Zr,2),Je=Yr[0],Pt=Yr[1],jr=Object(b.useState)(!1),sr=Object(w.a)(jr,2),Zt=sr[0],Or=sr[1],U=Object(b.useState)([]),s=Object(w.a)(U,2),h=s[0],B=s[1],K=Object(b.useState)(!1),N=Object(w.a)(K,2),ae=N[0],Be=N[1],ze=Object(G.i)();Object(b.useEffect)(function(){var qr;Ge.edit&&Be(!0),Bt(Ge.shixun_name),Gr(Ge.question_title);var ar=[];(qr=Ge.shixun)===null||qr===void 0||qr.map(function(bt){ar.push(bt.challenge_score)}),B(ar)},[Ge]),Object(b.useEffect)(function(){Or(!1)},[ae]),Object(b.useImperativeHandle)(tt,function(){return{onSave:gt,isEdit:ae}});var gt=function(){var qr=Object(l.a)(v.a.mark(function ar(){var bt,Rt,Qt;return v.a.wrap(function(dr){for(;;)switch(dr.prev=dr.next){case 0:if(bt=[],Rt=!1,!Rt){dr.next=4;break}return dr.abrupt("return",!1);case 4:if(!Ge.question_id){dr.next=10;break}return dr.next=7,Object(V.u)({id:Ge.question_id,question_title:kt,shixun_name:er,shixun_id:Ge.shixun_id,question_type:5,question_scores:h});case 7:Qt=dr.sent,dr.next=13;break;case 10:return dr.next=12,Object(V.a)({exercise_bank_id:ze.topicId,question_title:kt,shixun_name:er,shixun_id:Ge.shixun_id,question_type:5,question_scores:h});case 12:Qt=dr.sent;case 13:return Qt.status===0&&(o.b.success("\u4FDD\u5B58\u6210\u529F"),Be(!1)),dr.next=16,Tt({type:"polls/getExerciseBanks",payload:Object(u.a)({},ze)});case 16:return dr.abrupt("return",{name:kt,analysis:Lr,standard_answers:bt,is_ordered:Je});case 17:case"end":return dr.stop()}},ar)}));return function(){return qr.apply(this,arguments)}}(),je=function(){var ar;return y.a.createElement("aside",null,y.a.createElement("div",{className:ke.a.questionType},y.a.createElement("div",null,y.a.createElement("span",{className:"font16 c-blue"},"\u5B9E\u8BAD\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u5141\u8BB8\u624B\u52A8\u8C03\u5206\uFF09")),y.a.createElement("div",{className:"mt10"},y.a.createElement(z.a,{defaultValue:er,onChange:function(Rt){Bt(Rt.target.value)}})),y.a.createElement("div",{className:"mt10"},y.a.createElement(Ue.a,{id:"single-question-option-0",height:155,placeholder:"\u8BF7\u8F93\u5165\u5B9E\u8BAD\u9898\u5B8C\u6210\u8981\u6C42",defaultValue:kt,onChange:function(Rt){Gr(Rt)}})),y.a.createElement("div",{className:"mt20"},(ar=Ge.shixun)===null||ar===void 0?void 0:ar.map(function(bt,Rt){return y.a.createElement(D.a,{gutter:[20,20]},y.a.createElement(_.a,{flex:"1"},Rt+1,".",bt.challenge_name),y.a.createElement(_.a,null,y.a.createElement(Ee.a,{defaultValue:h[Rt],onChange:function(tr){h[Rt]=tr,B(h),console.log("srore:L",h[Rt])}})))})),y.a.createElement("div",{className:"mt20"},_t.length>1&&y.a.createElement("span",null,y.a.createElement(Ye.a,{checked:Je,onChange:function(Rt){return Pt(Rt.target.checked)},className:"".concat(ke.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),y.a.createElement("span",{className:"".concat(ke.a.color999," font12")},"\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"))),y.a.createElement("aside",{className:"tr"},!(Ge!=null&&Ge.edit)&&y.a.createElement(Y.a,{type:"default",onClick:function(){return Be(!1)}},"\u53D6\u6D88"),y.a.createElement(Y.a,{className:"ml20",type:"primary",onClick:function(){return gt()}},"\u4FDD\u5B58")))},ct=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],Wt=function(){var qr=Object(l.a)(v.a.mark(function ar(bt){return v.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:Qt.t0=bt.id,Qt.next=Qt.t0==="del"?3:Qt.t0==="up"||Qt.t0==="down"?5:Qt.t0==="edit"?9:11;break;case 3:return j.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(l.a)(v.a.mark(function dr(){return v.a.wrap(function(rr){for(;;)switch(rr.prev=rr.next){case 0:return rr.next=2,Object(V.e)({pollsId:Ge.question_id});case 2:Tt({type:"polls/getExerciseBanks",payload:Object(u.a)({},ze)});case 3:case"end":return rr.stop()}},dr)}))()}}),Qt.abrupt("break",11);case 5:return Qt.next=7,Object(V.j)({exerciseId:Ge==null?void 0:Ge.question_id,opr:bt.id});case 7:return Tt({type:"polls/getExerciseBanks",payload:Object(u.a)({},ze)}),Qt.abrupt("break",11);case 9:return Be(!0),Qt.abrupt("break",11);case 11:case"end":return Qt.stop()}},ar)}));return function(bt){return qr.apply(this,arguments)}}(),Dr=function(){var ar;return y.a.createElement("aside",null,y.a.createElement("div",{className:ke.a.questionType},y.a.createElement("div",null,y.a.createElement("span",{className:"font16 c-blue"},Ge.key,"\u3001\u5B9E\u8BAD\u9898"),"\uFF08",Ge.question_score,"\u5206\uFF09"),y.a.createElement("div",{className:"tr"},y.a.createElement($.a,{target:"_blank",to:"/shixuns/".concat(Ge.shixun_identifier,"/challenges")},"\u5B9E\u8BAD\u8BE6\u60C5"),!Ge.hideAction&&ct.map(function(bt,Rt){return bt.id==="up"&&Ge.key===1||bt.id==="down"&&Ge.key===Ge.len?null:y.a.createElement(Ie.a,{key:Rt,placement:"bottom",title:bt.name},y.a.createElement("span",{onClick:function(){return Wt(bt)},className:bt.icon}))}))),y.a.createElement("div",{className:"font16"},Ge.shixun_name),y.a.createElement("div",{className:"mt30"}),(ar=Ge.shixun)===null||ar===void 0?void 0:ar.map(function(bt,Rt){return y.a.createElement("div",{key:Rt},"\u7B2C",Rt+1,"\u5173 ",y.a.createElement("span",{className:"ml10"},bt.challenge_name)," ",y.a.createElement("span",{className:"ml10"},bt.challenge_score))}))};return y.a.createElement("section",{className:ke.a.wrap},!ae&&Dr(),ae&&je())},nt=Object(Z.a)(function(be){var Le=be.problemset,tt=be.loading,pt=be.globalSetting;return{problemset:Le,globalSetting:pt,loading:tt.effects}},null,null,{forwardRef:!0})(Object(b.forwardRef)(Xe)),_e=ee("UU91"),ve=ee.n(_e),Ce=ee("fJjg"),ne=a.a.SubMenu,ie=f.a.Content,ue=f.a.Sider,he=function(Le){var tt,pt,yt,Gt,Tt,Ge,gr,Fe,or,er,Bt,qt,pr,kt,Gr,br,wr,Lr,Br,ur,Ht,_t,Vr,Fr,Ar,Kt,Xr,Zr,Yr,Je,Pt,jr,sr,Zt,Or,U,s,h,B,K,N,ae,Be,ze,gt,je,ct,Wt,Dr,qr,ar,bt,Rt,Qt,tr,dr,Mr,rr=Le.polls,En=Le.globalSetting,Jn=Le.loading,ri=Le.user,_i=Le.dispatch,Ki=Object(x.a)(Le,["polls","globalSetting","loading","user","dispatch"]),hn=Object(G.i)(),wn=Object(G.h)(),vi=ri.userInfo,Oi=p.a.useForm(),qi=Object(w.a)(Oi,1),rn=qi[0],Pr=Object(b.useState)([]),fn=Object(w.a)(Pr,2),cr=fn[0],pn=fn[1],Kr=Object(b.useState)(!1),ni=Object(w.a)(Kr,2),gn=ni[0],jn=ni[1],zi=[{name:"\u9009\u62E9\u9898",id:0},{name:"\u5224\u65AD\u9898",id:2},{name:"\u586B\u7A7A\u9898",id:3},{name:"\u7B80\u7B54\u9898",id:4},{name:"\u5B9E\u8BAD\u9898",id:5}],ci=Object(b.useRef)();Object(b.useEffect)(function(){var mn;if((mn=rr.exerciseBanks)!==null&&mn!==void 0&&mn.exercise_questions){var Wr,An,Tn,ii,Ln;pn(Object(T.a)((Wr=rr.exerciseBanks)===null||Wr===void 0?void 0:Wr.exercise_questions)),rn.setFieldsValue({exercise_name:(An=rr.exerciseBanks)===null||An===void 0||((Tn=An.exercise)===null||Tn===void 0)?void 0:Tn.exercise_name,exercise_description:(ii=rr.exerciseBanks)===null||ii===void 0||((Ln=ii.exercise)===null||Ln===void 0)?void 0:Ln.exercise_description})}},[rr.exerciseBanks]),Object(b.useEffect)(function(){_i({type:"polls/getExerciseBanks",payload:Object(u.a)({},hn)})},[hn.categoryId]);var hi=function(){var mn=Object(l.a)(v.a.mark(function Wr(){var An,Tn,ii;return v.a.wrap(function(It){for(;;)switch(It.prev=It.next){case 0:return It.next=2,rn.validateFields();case 2:return ii=rn.getFieldValue(),ii.is_md=!0,ii.topicId=(An=rr.exerciseBanks)===null||An===void 0||((Tn=An.exercise)===null||Tn===void 0)?void 0:Tn.id,jn(!1),It.next=8,Object(V.v)(Object(u.a)({},ii));case 8:_i({type:"polls/getExerciseBanks",payload:Object(u.a)({},hn)});case 9:case"end":return It.stop()}},Wr)}));return function(){return mn.apply(this,arguments)}}(),wi=function(){var mn=Object(l.a)(v.a.mark(function Wr(An){var Tn;return v.a.wrap(function(Ln){for(;;)switch(Ln.prev=Ln.next){case 0:return Ln.next=2,ci==null?void 0:ci.current;case 2:if(Tn=Ln.sent,!(Tn!=null&&Tn.isEdit)){Ln.next=6;break}return o.b.error("\u4E0D\u80FD\u540C\u65F6\u7F16\u8F91\u4E24\u9898"),Ln.abrupt("return");case 6:An===5?_i({type:"classroomList/setActionTabs",payload:{key:"\u9009\u7528\u5B9E\u8DF5\u9879\u76EE"}}):pn([].concat(Object(T.a)(cr),[{question_type:An}]));case 7:case"end":return Ln.stop()}},Wr)}));return function(An){return mn.apply(this,arguments)}}(),Nn=function(){_i({type:"userDetail/setActionTabs",payload:{key:"UserDetail-SendToClass",params:{object_id:[hn.topicId],object_type:"exercise"}}})},Gi=function(){return cr==null?void 0:cr.map(function(Wr,An){if(Wr.key=An+1,Wr.len=cr.length,Wr.question_type===0)return y.a.createElement("aside",null,y.a.createElement(ft,{ref:ci,editData:Wr}),y.a.createElement(S.a,null));if(Wr.question_type===1)return y.a.createElement("aside",null,y.a.createElement(rt,{ref:ci,editData:Wr}),y.a.createElement(S.a,null));if(Wr.question_type===2)return y.a.createElement("aside",null,y.a.createElement(qe,{ref:ci,editData:Wr}),y.a.createElement(S.a,null));if(Wr.question_type===3)return y.a.createElement("aside",null,y.a.createElement(At,{editData:Wr}),y.a.createElement(S.a,null));if(Wr.question_type===4)return y.a.createElement("aside",null,y.a.createElement(Ut,{editData:Wr}),y.a.createElement(S.a,null));if(Wr.question_type===5)return y.a.createElement("aside",null,y.a.createElement(nt,{editData:Wr}),y.a.createElement(S.a,null))})};return y.a.createElement("section",{className:"edu-container"},y.a.createElement("section",{className:"animated fadeIn"},y.a.createElement("aside",{className:"mt10"},vi&&y.a.createElement(R.a,{separator:">"},y.a.createElement(R.a.Item,null,y.a.createElement($.a,{to:"/users/".concat(hn.username,"/").concat(hn.topictype==="personal"?"topics":"topicbank","/").concat(hn.topictype)},hn.topictype==="personal"?"\u6211\u7684\u9898\u5E93":"\u516C\u5171\u9898\u5E93")),y.a.createElement(R.a.Item,null,"\u8BE6\u60C5"))),y.a.createElement("aside",{className:[ve.a.title,"mt20"].join(" ")},y.a.createElement(D.a,{style:{width:"100%"},align:"middle"},y.a.createElement(_.a,{flex:"1"},y.a.createElement("strong",{className:"font20 ml5"},(tt=rr.exerciseBanks)===null||tt===void 0||((pt=tt.exercise)===null||pt===void 0)?void 0:pt.exercise_name),y.a.createElement(vt.k,{status:[(yt=rr.exerciseBanks)!==null&&yt!==void 0&&(Gt=yt.exercise)!==null&&Gt!==void 0&&Gt.is_public?"\u516C\u5F00":"\u79C1\u6709"]})),y.a.createElement(_.a,null,y.a.createElement($.a,{className:"font16 c-light-black",to:"/users/".concat(vi.login,"/topics/").concat(hn.topictype)},"\u8FD4\u56DE"))))),y.a.createElement("section",{className:[ve.a.bg,"pl30","pr30","pb30","mt20 relative"].join(" ")},y.a.createElement("div",{className:ve.a.export},((Tt=rr.exerciseBanks)===null||Tt===void 0?void 0:Tt.authorize)&&y.a.createElement(y.a.Fragment,null,y.a.createElement("a",{onClick:function(Wr){Wr.preventDefault(),j.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u662F\u5426\u786E\u8BA4\u5220\u9664?",onOk:function(){var An=Object(l.a)(v.a.mark(function ii(){var Ln;return v.a.wrap(function(Vt){for(;;)switch(Vt.prev=Vt.next){case 0:return Vt.next=2,Object(H.g)({object_type:"normal",object_id:[hn.topicId]});case 2:Ln=Vt.sent,Ln.status===0&&Z.d.push("/users/".concat(hn.username,"/topics/personal"));case 4:case"end":return Vt.stop()}},ii)}));function Tn(){return An.apply(this,arguments)}return Tn}()})}},"\u5220\u9664"),y.a.createElement($.a,{to:"/users/".concat(vi.login,"/topics/").concat(hn.topicId,"/").concat(hn.topictype,"/exercise/edit")},"\u7F16\u8F91")),y.a.createElement("a",{onClick:function(Wr){Wr.preventDefault(),Nn()}},"\u53D1\u9001")),y.a.createElement(I.a,{className:ve.a.tabs},y.a.createElement(I.a.TabPane,{tab:y.a.createElement("span",{className:"font16 pt10 pb12"},"\u5185\u5BB9\u8BE6\u60C5"),key:"1"},y.a.createElement("div",{className:"c-light-black"},(Ge=rr.exerciseBanks)===null||Ge===void 0||((gr=Ge.exercise)===null||gr===void 0)?void 0:gr.exercise_description))),gn&&y.a.createElement(p.a,{layout:"vertical",form:rn},y.a.createElement(p.a.Item,{name:"exercise_name",label:"\u8BD5\u5377\u6807\u9898\uFF1A",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BD5\u5377\u6807\u9898"}]},y.a.createElement(z.a,{maxLength:60,placeholder:"\u8BD5\u5377\u6807\u9898\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26"})),y.a.createElement(p.a.Item,{label:"\u8BD5\u5377\u987B\u77E5\uFF1A",name:"exercise_description"},y.a.createElement(z.a.TextArea,{rows:6,placeholder:"\u8BF7\u5728\u6B64\u8F93\u5165\u672C\u6B21\u8BD5\u5377\u7B54\u9898\u7684\u76F8\u5173\u8BF4\u660E\uFF0C\u6700\u5927\u9650\u5236100\u4E2A\u5B57\u7B26"})),y.a.createElement(p.a.Item,{className:"tr"},y.a.createElement(Y.a,{type:"primary",onClick:function(){hi()}},"\u4FDD\u5B58")))),y.a.createElement("p",{className:"mt10",style:{display:"flex"}},y.a.createElement("span",{className:"fl",style:{flex:"1"}},!!((Fe=rr.exerciseBanks)!==null&&Fe!==void 0&&(or=Fe.exercise_types)!==null&&or!==void 0&&or.q_singles)&&y.a.createElement("span",{className:"ml20"},"\u5355\u9009\u9898",(er=rr.exerciseBanks)===null||er===void 0||((Bt=er.exercise_types)===null||Bt===void 0)?void 0:Bt.q_singles,"\u9898\uFF0C\u5171",(qt=rr.exerciseBanks)===null||qt===void 0||((pr=qt.exercise_types)===null||pr===void 0)?void 0:pr.q_singles_scores,"\u5206"),!!((kt=rr.exerciseBanks)!==null&&kt!==void 0&&(Gr=kt.exercise_types)!==null&&Gr!==void 0&&Gr.q_doubles)&&y.a.createElement("span",{className:"ml20"},"\u591A\u9009\u9898",(br=rr.exerciseBanks)===null||br===void 0||((wr=br.exercise_types)===null||wr===void 0)?void 0:wr.q_doubles,"\u9898\uFF0C\u5171",(Lr=rr.exerciseBanks)===null||Lr===void 0||((Br=Lr.exercise_types)===null||Br===void 0)?void 0:Br.q_doubles_scores,"\u5206"),!!((ur=rr.exerciseBanks)!==null&&ur!==void 0&&(Ht=ur.exercise_types)!==null&&Ht!==void 0&&Ht.q_judges)&&y.a.createElement("span",{className:"ml20"},"\u5224\u65AD\u9898",(_t=rr.exerciseBanks)===null||_t===void 0||((Vr=_t.exercise_types)===null||Vr===void 0)?void 0:Vr.q_judges,"\u9898\uFF0C\u5171",(Fr=rr.exerciseBanks)===null||Fr===void 0||((Ar=Fr.exercise_types)===null||Ar===void 0)?void 0:Ar.q_judges_scores,"\u5206"),!!((Kt=rr.exerciseBanks)!==null&&Kt!==void 0&&(Xr=Kt.exercise_types)!==null&&Xr!==void 0&&Xr.q_nulls)&&y.a.createElement("span",{className:"ml20"},"\u586B\u7A7A\u9898",(Zr=rr.exerciseBanks)===null||Zr===void 0||((Yr=Zr.exercise_types)===null||Yr===void 0)?void 0:Yr.q_nulls,"\u9898\uFF0C\u5171",(Je=rr.exerciseBanks)===null||Je===void 0||((Pt=Je.exercise_types)===null||Pt===void 0)?void 0:Pt.q_nulls_scores,"\u5206"),!!((jr=rr.exerciseBanks)!==null&&jr!==void 0&&(sr=jr.exercise_types)!==null&&sr!==void 0&&sr.q_mains)&&y.a.createElement("span",{className:"ml20"},"\u7B80\u7B54\u9898",(Zt=rr.exerciseBanks)===null||Zt===void 0||((Or=Zt.exercise_types)===null||Or===void 0)?void 0:Or.q_mains,"\u9898\uFF0C\u5171",(U=rr.exerciseBanks)===null||U===void 0||((s=U.exercise_types)===null||s===void 0)?void 0:s.q_mains_scores,"\u5206"),!!((h=rr.exerciseBanks)!==null&&h!==void 0&&(B=h.exercise_types)!==null&&B!==void 0&&B.q_shixuns)&&y.a.createElement("span",{className:"ml20"},"\u5B9E\u8BAD\u9898",(K=rr.exerciseBanks)===null||K===void 0||((N=K.exercise_types)===null||N===void 0)?void 0:N.q_shixuns,"\u9898\uFF0C\u5171",(ae=rr.exerciseBanks)===null||ae===void 0||((Be=ae.exercise_types)===null||Be===void 0)?void 0:Be.q_shixuns_scores,"\u5206"),!!((ze=rr.exerciseBanks)!==null&&ze!==void 0&&(gt=ze.exercise_types)!==null&>!==void 0&>.q_pros)&&y.a.createElement("span",{className:"ml20"},"\u7F16\u7A0B\u9898",(je=rr.exerciseBanks)===null||je===void 0||((ct=je.exercise_types)===null||ct===void 0)?void 0:ct.q_pros,"\u9898\uFF0C\u5171",(Wt=rr.exerciseBanks)===null||Wt===void 0||((Dr=Wt.exercise_types)===null||Dr===void 0)?void 0:Dr.q_pros_scores,"\u5206")),y.a.createElement("span",{className:"fr"},!!((qr=rr.exerciseBanks)!==null&&qr!==void 0&&(ar=qr.exercise_types)!==null&&ar!==void 0&&ar.q_counts)&&y.a.createElement("span",null,"\u5408\u8BA1 ",y.a.createElement("span",{className:"color-blue"},(bt=rr.exerciseBanks)===null||bt===void 0||((Rt=bt.exercise_types)===null||Rt===void 0)?void 0:Rt.q_counts)," \u9898\uFF0C \u5171 ",y.a.createElement("span",{className:"".concat(((Qt=rr.exerciseBanks)===null||Qt===void 0||((tr=Qt.exercise_types)===null||tr===void 0)?void 0:tr.q_scores)>100?"color-red font-bd":"color-orange")},(dr=rr.exerciseBanks)===null||dr===void 0||((Mr=dr.exercise_types)===null||Mr===void 0)?void 0:Mr.q_scores)," \u5206"))),y.a.createElement("section",{className:[ve.a.bg,"pt30","pl20","pr20","pb20","mt20"].join(" ")},cr!=""&&Gi(),cr==""&&y.a.createElement(re.a,null)),y.a.createElement(Ce.a,null))},Me=xt.default=Object(Z.a)(function(be){var Le=be.polls,tt=be.loading,pt=be.user,yt=be.globalSetting;return{polls:Le,globalSetting:yt,user:pt,loading:tt.effects}})(he)},Nska:function(zt,xt,ee){zt.exports={wrap:"wrap___1qNoS",title:"title___18s87",radioWrap:"radioWrap___3ZobS",radio:"radio___19YEl",colorFF0000:"colorFF0000___2BuLq",pagination:"pagination___18hXH"}},O2Wb:function(zt,xt,ee){zt.exports={flex:"flex___2gmSR",flex1:"flex1___3Tu1g",color666:"color666___2uyGL",error:"error___yJ86W",deleteIcon:"deleteIcon___1D2tg",addIcon:"addIcon___2VIYB"}},Ot1p:function(zt,xt,ee){"use strict";var le=ee("2qtc"),Y=ee("kLXV"),L=ee("rAM+"),z=ee("miYZ"),A=ee("tsqr"),I=ee("9og8"),W=ee("tJVT"),j=ee("jrin"),P=ee("WmNS"),D=ee.n(P),E=ee("q1tI"),_=ee.n(E),M=ee("VrN/"),R=ee.n(M),k=ee("bdgK"),S=ee("p77/"),c=ee("Bd2K"),o=ee("ELLl"),l=ee("19Vz"),u=ee("lZu9"),T=ee("+NIl"),m=ee("kSUc"),p=ee("9Bee"),w=function(be){var Le=be.value,tt=Le===void 0?"":Le,pt=be.className,yt=be.showTextOnly,Gt=be.showLines,Tt=be.style,Ge=Tt===void 0?{}:Tt,gr=Object(E.useMemo)(function(){return""},[tt]);return _.a.createElement(_.a.Fragment,null,_.a.createElement("div",{dangerouslySetInnerHTML:{__html:gr}}))},x=ee("0Owb"),g=ee("dejd"),f=ee("C+DQ"),d=ee("1vsH"),a=ee("m3rI"),C=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function v(be){var Le=be.onActionCallback,tt=be.title,pt=be.icon,yt=be.actionName,Gt=be.className,Tt=Gt===void 0?"":Gt,Ge=be.children;function gr(){Le(yt)}return _.a.createElement("a",{title:tt,className:Tt,onClick:gr},_.a.createElement("i",{className:"md-iconfont ".concat(pt)}),Ge)}var b=function(be){var Le=be.watch,tt=be.showNullButton,pt=be.onActionCallback,yt=be.fullScreen,Gt=be.insertTemp,Tt=be.hidetoolBar,Ge=be.uuid,gr=be.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(d.D)("_educoder_session_login"),"&_educoder_session=").concat(Object(d.D)("_educoder_session"),"&key=").concat(Ge,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Fe=[].concat(C,[{title:"".concat(Le?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Le?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return _.a.createElement("ul",{className:"markdown-toolbar-container"},!Tt&&Fe.map(function(or,er){return _.a.createElement("li",{key:er},or.actionName?_.a.createElement(v,Object(x.a)({},or,{onActionCallback:pt})):_.a.createElement("span",{className:"v-line"}))}),tt?_.a.createElement("li",null,_.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:pt},_.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Gt&&_.a.createElement("li",null,_.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Gt),onActionCallback:pt},_.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),_.a.createElement("li",{className:"btn-full-screen"},_.a.createElement(v,{icon:"".concat(yt?"icon-shrink":"icon-enlarge"),title:yt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:pt})))},y=ee("M8RZ"),G=ee("+L6B"),$=ee("2/Rp"),Z=ee("y8nQ"),V=ee("Vl3Y"),H=ee("5NDa"),re=ee("5rEg"),ce={labelCol:{span:4},wrapperCol:{span:20}},Ee=function(be){var Le=be.callback,tt=be.onCancel;function pt(yt){Le(yt)}return _.a.createElement(V.a,Object(x.a)({},ce,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:pt}),_.a.createElement(V.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},_.a.createElement(re.a,null)),_.a.createElement(V.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},_.a.createElement(re.a,null)),_.a.createElement("div",{className:"flex-container flex-end"},_.a.createElement($.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),_.a.createElement($.a,{type:"ghost",onClick:tt},"\u53D6\u6D88")))},we=ee("7ahc"),Ye=ee("k1fw"),Ne=ee("HmJG"),Ie=ee("BjJ7"),We=V.a.useForm,Ue={width:280,marginRight:10},xe={labelCol:{span:5},wrapperCol:{span:19}},se=function(be){var Le=be.callback,tt=be.onCancel,pt=We(),yt=Object(W.a)(pt,1),Gt=yt[0],Tt=Object(E.useRef)();function Ge(or){Le(Object(Ye.a)(Object(Ye.a)({},or),{},{name:Tt.current}))}function gr(or,er){Gt.setFieldsValue({src:"/api/attachments/".concat(or.id,"?type=").concat(or.content_type),type:er.type})}function Fe(or){var er=or.target.files[0];Tt.current=er.name,dt(er,gr)}return _.a.createElement(V.a,Object(x.a)({form:Gt},xe,{className:"upload-image-panel",onFinish:Ge}),_.a.createElement(V.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},_.a.createElement("div",{className:"flex-container"},_.a.createElement(V.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},_.a.createElement(re.a,{style:Ue})),_.a.createElement(ke,{onFileChange:Fe}))),_.a.createElement(V.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},_.a.createElement(re.a,{style:{width:264}})),_.a.createElement(V.a.Item,{style:{textAlign:"right"}},_.a.createElement($.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),_.a.createElement($.a,{type:"ghost",onClick:tt},"\u53D6\u6D88")))};function ke(be){var Le=be.onFileChange;return _.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",_.a.createElement("input",{type:"file",onChange:Le}))}function dt(be,Le){if(!be)throw new String("\u6CA1\u6709\u6587\u4EF6");var tt=new FormData;tt.append("editormd-image-file",be),tt.append("file_param_name","editormd-image-file"),tt.append("byxhr","true");var pt=new window.XMLHttpRequest;pt.withCredentials=!0,pt.addEventListener("load",function(yt){Le(JSON.parse(yt.target.responseText),be)},!1),pt.addEventListener("error",function(yt){console.error(yt)},!1),pt.open("POST","".concat(Ie.a,"/api/attachments.json")),pt.send(tt)}var at=ee("giR+"),rt=ee("fyUT"),lt=ee("7Kak"),Ke=ee("9yH6"),$e=Ke.a.Group,it={margin:"0 8px"},ft=function(be){var Le=be.callback,tt=be.onCancel;function pt(yt){Le(yt)}return _.a.createElement(V.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:pt},_.a.createElement("div",{className:"flex-container"},_.a.createElement("span",{style:it},"\u5355\u5143\u683C\u6570\uFF1A"),_.a.createElement("span",{style:it},"\u884C\u6570"),_.a.createElement(V.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},_.a.createElement(rt.a,null)),_.a.createElement("span",{style:it},"\u5217\u6570"),_.a.createElement(V.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},_.a.createElement(rt.a,null))),_.a.createElement("div",{className:"flex-container",style:{marginTop:12}},_.a.createElement("span",{style:it},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),_.a.createElement(V.a.Item,{name:"align"},_.a.createElement($e,null,_.a.createElement(Ke.a,{value:"default"},_.a.createElement("i",{className:"fa fa-align-justify"})),_.a.createElement(Ke.a,{value:"left"},_.a.createElement("i",{className:"fa fa-align-left"})),_.a.createElement(Ke.a,{value:"center"},_.a.createElement("i",{className:"fa fa-align-center"})),_.a.createElement(Ke.a,{value:"right"},_.a.createElement("i",{className:"fa fa-align-right"}))))),_.a.createElement("div",{className:"flex-container flex-end"},_.a.createElement($.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),_.a.createElement($.a,{type:"ghost",onClick:tt},"\u53D6\u6D88")))},ut=ee("ErOA"),Ze=ee("7Cbv"),qe="link",Dt="upload-image",wt="code-block",vt="add-table",mt="------------",Nt={default:mt,left:":".concat(mt),center:":".concat(mt,":"),right:"".concat(mt,":")},At=ee("9VGf"),Ot,He;function Ut(){}var Lt=0,Xe=1e4,nt="\u2581",_e=`
|
|
**\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 ve(be){return/^\d+$/.test(be)?"".concat(be,"px"):be}var Ce=navigator.platform.toUpperCase().indexOf("MAC")>=0,ne=Ce?"Cmd":"Ctrl",ie=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],ue=(Ot={},Object(j.a)(Ot,ne+"-B","bold"),Object(j.a)(Ot,ne+"-I","italic"),Ot),he=(He={},Object(j.a)(He,qe,"\u6DFB\u52A0\u94FE\u63A5"),Object(j.a)(He,wt,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(j.a)(He,Dt,"\u6DFB\u52A0\u6587\u4EF6"),Object(j.a)(He,vt,"\u6DFB\u52A0\u8868\u683C"),He),Me=xt.a=function(be){var Le=be.defaultValue,tt=Le===void 0?"":Le,pt=be.onChange,yt=be.width,Gt=yt===void 0?"100%":yt,Tt=be.height,Ge=Tt===void 0?400:Tt,gr=be.miniToolbar,Fe=gr===void 0?!1:gr,or=be.isFocus,er=or===void 0?!1:or,Bt=be.watch,qt=be.insertTemp,pr=be.mode,kt=pr===void 0?"markdown":pr,Gr=be.id,br=Gr===void 0?"markdown-editor-id":Gr,wr=be.showResizeBar,Lr=wr===void 0?!1:wr,Br=be.noStorage,ur=Br===void 0?!1:Br,Ht=be.showNullButton,_t=Ht===void 0?!1:Ht,Vr=be.hidetoolBar,Fr=Vr===void 0?!1:Vr,Ar=be.fullScreen,Kt=Ar===void 0?!1:Ar,Xr=be.onBlur,Zr=be.onCMBeforeChange,Yr=be.onFullScreen,Je=be.className,Pt=Je===void 0?"":Je,jr=be.disablePaste,sr=jr===void 0?!1:jr,Zt=be.placeholder,Or=Zt===void 0?"":Zt,U=be.values,s=U===void 0?"":U,h=Object(E.useState)(null),B=Object(W.a)(h,2),K=B[0],N=B[1],ae=Object(E.useState)(tt),Be=Object(W.a)(ae,2),ze=Be[0],gt=Be[1],je=Object(E.useState)(Bt),ct=Object(W.a)(je,2),Wt=ct[0],Dr=ct[1],qr=Object(E.useState)(Kt),ar=Object(W.a)(qr,2),bt=ar[0],Rt=ar[1],Qt=Object(E.useState)(""),tr=Object(W.a)(Qt,2),dr=tr[0],Mr=tr[1],rr=Object(E.useState)(0),En=Object(W.a)(rr,2),Jn=En[0],ri=En[1],_i=Object(E.useState)(Ge),Ki=Object(W.a)(_i,2),hn=Ki[0],wn=Ki[1],vi=Object(E.useState)(!1),Oi=Object(W.a)(vi,2),qi=Oi[0],rn=Oi[1],Pr=Object(E.useRef)(Object(Ze.a)()),fn=Object(E.useRef)(!1),cr=Object(E.useRef)(),pn=Object(E.useRef)(),Kr=Object(E.useRef)(),ni=Object(E.useRef)(),gn=Object(E.useRef)(),jn=function(){var It=Object(I.a)(D.a.mark(function Vt(){var Xt,Er;return D.a.wrap(function(en){for(;;)switch(en.prev=en.next){case 0:return en.next=2,Object(ut.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Pr.current}});case 2:Er=en.sent,Er!=null&&(Xt=Er.attachments)!==null&&Xt!==void 0&&Xt.length&&(console.log("cm:",K,pn),Er.attachments.map(function(kr){kr.content_type.indexOf("image")>-1?K.replaceSelection(".concat(kr.content_type,")")):kr.content_type.indexOf("video")>-1?K.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):kr.content_type.indexOf("pdf")>-1?K.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(kr.id,"?type=").concat(kr.content_type,'&disposition=inline" target="_blank">').concat(kr.name,"</a>")):K.replaceSelection("[".concat(kr.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(kr.id,"?type=").concat(kr.content_type,")"))}));case 4:case"end":return en.stop()}},Vt)}));return function(){return It.apply(this,arguments)}}();Object(E.useEffect)(function(){gt(s),K==null||K.setValue(s)},[s]),Object(E.useEffect)(function(){Yr==null||Yr(bt)},[bt]),Object(E.useEffect)(function(){if(pn.current){var It=R.a.fromTextArea(pn.current,{mode:kt,lineNumbers:!Fe,lineWrapping:!0,value:tt,autoCloseTags:!0,autoCloseBrackets:!0});er&&It.focus();function Vt(Xt,Er){if(sr){Er.preventDefault();return}var Ir=Er.clipboardData;if(Ir){var en=Ir.types.toString(),kr=Ir.items;if(en==="Files"||Ir.types.indexOf("Files")>-1){if(Er.preventDefault(),kt=="stex")return;try{var Dn,Zn=kr[1];((Dn=kr[0])===null||Dn===void 0?void 0:Dn.kind)==="file"&&(Zn=kr[0]);var Cr=Zn.getAsFile(),Pi=Cr.name.split(".").pop();dt(Cr,function(zr){if(zr.id){var Un,yi,ai;(Cr==null||((Un=Cr.type)===null||Un===void 0)?void 0:Un.indexOf("image"))>-1?It.replaceSelection(".concat(zr.content_type,")")):(Cr==null||((yi=Cr.type)===null||yi===void 0)?void 0:yi.indexOf("video"))>-1?It.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(zr.id,'"></video>')):(Cr==null||((ai=Cr.type)===null||ai===void 0)?void 0:ai.indexOf("pdf"))>-1?It.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(zr.id,"?type=").concat(Cr.type,'&disposition=inline" target="_blank">').concat(Cr.name,"</a>")):ie.includes(Pi)?It.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(zr.id,'?type=office&disposition=inline" target="_blank">').concat(Cr.name,"</a>")):It.replaceSelection("[".concat(Cr.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(zr.id,"?type=").concat(zr.content_type,")"))}else(zr==null?void 0:zr.status)===401&&(document.location.href="/user/login")})}catch(zr){A.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return It.on("paste",Vt),It.on("dragleave",function(Xt,Er){Kr.current.classList.remove("mouse-hover-md")}),It.on("dragover",function(Xt,Er){Kr.current.classList.add("mouse-hover-md")}),It.on("drop",function(Xt,Er){Kr.current.classList.add("mouse-hover-md");var Ir;if(Ir=Er.dataTransfer.files,Ir.length>0){Er.preventDefault(),Er.stopPropagation();for(var en=function(Zn){var Cr=Ir[Zn],Pi=Cr.name.split(".").pop();dt(Cr,function(zr){if(zr.id){var Un,yi,ai;(Cr==null||((Un=Cr.type)===null||Un===void 0)?void 0:Un.indexOf("image"))>-1?It.replaceSelection(".concat(zr.content_type,")")):(Cr==null||((yi=Cr.type)===null||yi===void 0)?void 0:yi.indexOf("video"))>-1?It.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(zr.id,'"></video>')):(Cr==null||((ai=Cr.type)===null||ai===void 0)?void 0:ai.indexOf("pdf"))>-1?It.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(zr.id,"?type=").concat(Cr.type,'&disposition=inline" target="_blank">').concat(Cr.name,"</a>")):ie.includes(Pi)?It.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(zr.id,'?type=office&disposition=inline" target="_blank">').concat(Cr.name,"</a>")):It.replaceSelection("[".concat(Cr.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(zr.id,"?type=").concat(zr.content_type,")"))}else(zr==null?void 0:zr.status)===401&&(document.location.href="/user/login")})},kr=0;kr<Ir.length;kr++)en(kr)}}),N(It),function(){It.off("paste",Vt)}}},[]);var zi=Object(E.useCallback)(function(){if(Kr.current)try{}catch(It){console.log(It,"---- to set md editor body height")}},[hn,Kr,bt]);Object(E.useEffect)(function(){function It(){var Xt=new k.default(function(Er){var Ir=Object(L.a)(Er),en;try{for(Ir.s();!(en=Ir.n()).done;){var kr=en.value;(kr.target.offsetHeight>0||kr.target.offsetWidth>0)&&(zi(),K.setSize("100%","100%"),K.refresh())}}catch(Dn){Ir.e(Dn)}finally{Ir.f()}});return Xt.observe(pn.current.parentElement),Xt}if(K){var Vt=It();return function(){Vt.unobserve(pn.current.parentElement)}}},[K,zi]),Object(E.useEffect)(function(){if(K){for(var It=[],Vt=function(){var kr=Er[Xt];Ir=Object(W.a)(kr,2);var Dn=Ir[0],Zn=Ir[1],Cr=Object(j.a)({},Dn,function(){ci(Zn)});It.push(Cr),K.addKeyMap(Cr)},Xt=0,Er=Object.entries(ue);Xt<Er.length;Xt++){var Ir;Vt()}return cr.current=setInterval(function(){fn.current&&jn()},4e3),function(){clearInterval(cr.current);var en=Object(L.a)(It),kr;try{for(en.s();!(kr=en.n()).done;){var Dn=kr.value;K.removeKeyMap(Dn)}}catch(Zn){en.e(Zn)}finally{en.f()}}}},[K]),Object(E.useEffect)(function(){Kt!==bt&&Rt(Kt)},[Kt]),Object(At.a)(function(){if(!ur&&Jn>0){var It=new Date().getTime(),Vt=window.sessionStorage.getItem(br);It>=Jn+Xe&&(!Vt||Vt!==ze)&&(window.sessionStorage.setItem(br,ze),rn(!0))}},Xe),Object(E.useEffect)(function(){Dr(Bt)},[K,Bt]),Object(E.useEffect)(function(){K&&(er&&K.focus())},[K,er]),Object(E.useEffect)(function(){if(Wt&&K){var It=K.getScrollerElement();function Vt(Xt){var Er=Xt.target;if(gn.current){var Ir=Er.scrollTop/Er.scrollHeight;gn.current.scrollTop=gn.current.scrollHeight*Ir}}return It.addEventListener("scroll",Vt),function(){It.removeEventListener("scroll",Vt)}}},[K,Wt]),Object(E.useEffect)(function(){if(K&&Zr){function It(Vt,Xt){Zr(Vt,Xt)}return K.on("beforeChange",It),function(){K.off("beforeChange",It)}}},[K,Zr]),Object(E.useEffect)(function(){if(K&&Xr){function It(){Xr(K.getValue())}return K.on("blur",It),function(){K.off("blur",It)}}},[K,Xr]),Object(E.useEffect)(function(){if(K){function It(Vt){var Xt=Vt.getValue();gt(Xt),ri(new Date().getTime()),Vt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),pt&&pt(Xt)}return K.on("change",It),function(){K.off("change",It)}}},[K,pt]),Object(E.useEffect)(function(){K&&(tt==null?(K.setValue(""),gt("")):tt!==K.getValue()&&(K.setValue(tt),gt(tt),K.setCursor(K.lineCount(),0)))},[K,tt]);var ci=Object(E.useCallback)(function(It){var Vt=K.getCursor(),Xt=K.getSelection(),Er=Xt.split(`
|
|
`);switch(It){case"bold":return K.replaceSelection("**"+Xt+"**"),Xt===""&&K.setCursor(Vt.line,Vt.ch+2),K.focus();case"italic":return K.replaceSelection("*"+Xt+"*"),Xt===""&&K.setCursor(Vt.line,Vt.ch+1),K.focus();case"code":return K.replaceSelection("`"+Xt+"`"),Xt===""&&K.setCursor(Vt.line,Vt.ch+1),K.focus();case"inline-latex":return K.replaceSelection("`$$"+Xt+"$$`"),Xt===""&&K.setCursor(Vt.line,Vt.ch+3),K.focus();case"latex":return K.replaceSelection("```latex\n"+Xt+"\n```"),K.setCursor(Vt.line+1,Xt.length+1),K.focus();case"line-break":return K.replaceSelection(`<br/>
|
|
`),K.focus();case"list-ul":return Xt===""?K.replaceSelection("- "+Xt):K.replaceSelection(Er.map(function(Ir){return Ir===""?"":"- ".concat(Ir)}).join(`
|
|
`)),K.focus();case"list-ol":return Xt===""?K.replaceSelection("1. "+Xt):K.replaceSelection(Er.map(function(Ir,en){return Ir===""?"":"".concat(en+1,". ").concat(Ir)}).join(`
|
|
`)),K.focus();case"add-null-ch":return Xt===""&&K.setCursor(Vt.line,Vt.ch+1),K.replaceSelection(nt),K.focus();case"inster-template-1":return Xt===""&&K.setCursor(Vt.line,Vt.ch),K.replaceSelection(_e),K.focus();case"eraser":return K.setValue(""),K.focus();case"trigger-watch":return Dr(!Wt),K.focus();case"trigger-full-screen":return Rt(!bt),K.focus();case qe:Mr(qe);return;case wt:Mr(wt);return;case Dt:Mr(Dt);return;case vt:Mr(vt);return;default:throw new Error}},[K,Wt,bt]),hi=Object(E.useCallback)(function(It){Mr("");switch(dr){case qe:var Vt=It.title,Xt=It.link;return K.replaceSelection("[".concat(Vt,"](").concat(Xt,")")),K.focus();case wt:var Er=It.language,Ir=It.content;return K.replaceSelection(["```"+Er,Ir,"```"].join(`
|
|
`)),K.focus();case Dt:var en=It.src,kr=It.alt,Dn=It.name;return en.indexOf("type=image")>-1?K.replaceSelection(".concat(en,' "').concat(kr||"",'" )')):en.indexOf("type=application/pdf")>-1?K.replaceSelection('<a href="'.concat(en,'&disposition=inline" target="_blank">').concat(Dn,"</a>")):K.replaceSelection('<a href="'.concat(en,'" target="_blank">').concat(Dn,"</a>")),K.focus();case vt:for(var Zn=It.row,Cr=It.col,Pi=It.align,zr=`
|
|
`,Un=0;Un<Zn;Un++){for(var yi=[],ai=[],Ea=0;Ea<Cr;Ea++)Un===1&&ai.push(Nt[Pi]),yi.push(" ");Un===1&&(zr+="| ".concat(ai.join(" | "),` |
|
|
`)),zr+="| ".concat(yi.join(Cr===1?"":" | "),` |
|
|
`)}return K.replaceSelection(zr+`
|
|
`),K.focus();default:throw new Error}},[K,dr]),wi=Object(E.useMemo)(function(){switch(dr){case qe:return _.a.createElement(Ee,{callback:hi,onCancel:Nn});case wt:return _.a.createElement(we.b,{callback:hi,onCancel:Nn});case Dt:return _.a.createElement(se,{callback:hi,onCancel:Nn});case vt:return _.a.createElement(ft,{callback:hi,onCancel:Nn});default:return null}},[dr]);function Nn(){Mr("")}Object(E.useEffect)(function(){if(ni.current){var It=ni.current,Vt=!1,Xt=0;function Er(kr){Vt=!0,Xt=kr.pageY}function Ir(){Vt=!1}function en(kr){if(Vt){var Dn=kr.pageY-Xt;Dn<0&&(Dn=0),Dn>300&&(Dn=300);var Zn=Ge+Dn+"px";wn(Zn)}}return It.addEventListener("mousedown",Er),document.addEventListener("mousemove",en),document.addEventListener("mouseup",Ir),function(){It.removeEventListener("mousedown",Er),document.removeEventListener("mousemove",en),document.removeEventListener("mouseup",Ir)}}},[K,ni]),Object(E.useEffect)(function(){wn(Ge)},[Ge]);var Gi=ve(Gt),mn=ve(hn),Wr={width:Gi,height:mn},An=Object(E.useMemo)(function(){if(Jn){var It=new Date(Jn),Vt=It.getHours(),Xt=It.getMinutes(),Er=It.getSeconds();return Vt=Vt<10?"0"+Vt:Vt,Xt=Xt<10?"0"+Xt:Xt,Er=Er<10?"0"+Er:Er,"".concat(Vt,":").concat(Xt,":").concat(Er)}return 0},[Jn]);function Tn(){window.sessionStorage.removeItem(br),rn(!1),ri(0)}function ii(){rn(!1),ri(0),K.setValue(window.sessionStorage.getItem(br))}function Ln(It,Vt){var Xt=K.getValue();Xt=Xt.replace(It,Vt),gt(Xt),K==null||K.setValue(Xt)}return _.a.createElement(E.Fragment,null,_.a.createElement("div",{className:"markdown-editor-wrapper",ref:Kr},_.a.createElement("div",{className:"markdown-editor-container ".concat(Pt," ").concat(Wt?"on-preview":""," ").concat(Fe?"mini":""," ").concat(bt?"full-screen":""),style:Wr},_.a.createElement(b,{insertTemp:qt,watch:Wt,fullScreen:bt,showNullButton:_t,onActionCallback:ci,hidetoolBar:Fr,uuid:Pr.current,setOpenPhones:function(){fn.current=!0}}),_.a.createElement("div",{className:"markdown-editor-body"},_.a.createElement("div",{className:"codemirror-container"},_.a.createElement("textarea",{ref:pn,placeholder:Or})),Wt?_.a.createElement("div",{ref:gn,className:"preview-container"},kt==="stex"&&_.a.createElement(w,{value:ze}),kt!=="stex"&&_.a.createElement(p.a,{edit:!0,value:ze,replaces:Ln})):null))),Lr?_.a.createElement("a",{ref:ni,className:"editor-resize"}):null,_.a.createElement(y.a,null,he[dr]?_.a.createElement(Y.a,{centered:!0,title:he[dr],visible:!0,onCancel:Nn,footer:null},wi):null))}},SJMd:function(zt,xt){/**
|
|
* @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 ee,le,Y,L=!1,z,A;window.PR_SHOULD_USE_CONTINUATION=!0;var I,W;(function(){var j=window,P=["break,continue,do,else,for,if,return,while"],D=[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"],E=[D,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],_=[E,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],M=[E,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],R=[E,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],k="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",S=[E,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],c="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"],u=[P,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],T=[_,R,M,S,c,o,l,u],m=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,p="str",w="kwd",x="com",g="typ",f="lit",d="pun",a="pln",C="tag",v="dec",b="src",y="atn",G="atv",$="nocode",Z="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function V(Ke){for(var $e=0,it=!1,ft=!1,ut=0,Ze=Ke.length;ut<Ze;++ut){var qe=Ke[ut];if(qe.ignoreCase)ft=!0;else if(/[a-z]/i.test(qe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){it=!0,ft=!1;break}}var Dt={b:8,t:9,n:10,v:11,f:12,r:13};function wt(Ot){var He=Ot.charCodeAt(0);if(He!==92)return He;var Ut=Ot.charAt(1);return He=Dt[Ut],He||("0"<=Ut&&Ut<="7"?parseInt(Ot.substring(1),8):Ut==="u"||Ut==="x"?parseInt(Ot.substring(2),16):Ot.charCodeAt(1))}function vt(Ot){if(Ot<32)return(Ot<16?"\\x0":"\\x")+Ot.toString(16);var He=String.fromCharCode(Ot);return He==="\\"||He==="-"||He==="]"||He==="^"?"\\"+He:He}function mt(Ot){var He=Ot.substring(1,Ot.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=[],Lt=He[0]==="^",Xe=["["];Lt&&Xe.push("^");for(var nt=Lt?1:0,_e=He.length;nt<_e;++nt){var ve=He[nt];if(/\\[bdsw]/i.test(ve))Xe.push(ve);else{var Ce=wt(ve),ne;nt+2<_e&&He[nt+1]==="-"?(ne=wt(He[nt+2]),nt+=2):ne=Ce,Ut.push([Ce,ne]),ne<65||Ce>122||(ne<65||Ce>90||Ut.push([Math.max(65,Ce)|32,Math.min(ne,90)|32]),ne<97||Ce>122||Ut.push([Math.max(97,Ce)&~32,Math.min(ne,122)&~32]))}}Ut.sort(function(Me,be){return Me[0]-be[0]||be[1]-Me[1]});for(var ie=[],ue=[],nt=0;nt<Ut.length;++nt){var he=Ut[nt];he[0]<=ue[1]+1?ue[1]=Math.max(ue[1],he[1]):ie.push(ue=he)}for(var nt=0;nt<ie.length;++nt){var he=ie[nt];Xe.push(vt(he[0])),he[1]>he[0]&&(he[1]+1>he[0]&&Xe.push("-"),Xe.push(vt(he[1])))}return Xe.push("]"),Xe.join("")}function Nt(Ot){for(var He=Ot.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=He.length,Lt=[],Xe=0,nt=0;Xe<Ut;++Xe){var _e=He[Xe];if(_e==="(")++nt;else if(_e.charAt(0)==="\\"){var ve=+_e.substring(1);ve&&(ve<=nt?Lt[ve]=-1:He[Xe]=vt(ve))}}for(var Xe=1;Xe<Lt.length;++Xe)Lt[Xe]===-1&&(Lt[Xe]=++$e);for(var Xe=0,nt=0;Xe<Ut;++Xe){var _e=He[Xe];if(_e==="(")++nt,Lt[nt]||(He[Xe]="(?:");else if(_e.charAt(0)==="\\"){var ve=+_e.substring(1);ve&&ve<=nt&&(He[Xe]="\\"+Lt[ve])}}for(var Xe=0;Xe<Ut;++Xe)He[Xe]==="^"&&He[Xe+1]!=="^"&&(He[Xe]="");if(Ot.ignoreCase&&it)for(var Xe=0;Xe<Ut;++Xe){var _e=He[Xe],Ce=_e.charAt(0);_e.length>=2&&Ce==="["?He[Xe]=mt(_e):Ce!=="\\"&&(He[Xe]=_e.replace(/[a-zA-Z]/g,function(ue){var he=ue.charCodeAt(0);return"["+String.fromCharCode(he&~32,he|32)+"]"}))}return He.join("")}for(var At=[],ut=0,Ze=Ke.length;ut<Ze;++ut){var qe=Ke[ut];if(qe.global||qe.multiline)throw new Error(""+qe);At.push("(?:"+Nt(qe)+")")}return new RegExp(At.join("|"),ft?"gi":"g")}function H(Ke,$e){var it=/(?:^|\s)nocode(?:\s|$)/,ft=[],ut=0,Ze=[],qe=0;function Dt(wt){var vt=wt.nodeType;if(vt==1){if(it.test(wt.className))return;for(var mt=wt.firstChild;mt;mt=mt.nextSibling)Dt(mt);var Nt=wt.nodeName.toLowerCase();(Nt==="br"||Nt==="li")&&(ft[qe]=`
|
|
`,Ze[qe<<1]=ut++,Ze[qe++<<1|1]=wt)}else if(vt==3||vt==4){var At=wt.nodeValue;At.length&&($e?At=At.replace(/\r\n?/g,`
|
|
`):At=At.replace(/[ \t\r\n]+/g," "),ft[qe]=At,Ze[qe<<1]=ut,ut+=At.length,Ze[qe++<<1|1]=wt)}}return Dt(Ke),{sourceCode:ft.join("").replace(/\n$/,""),spans:Ze}}function re(Ke,$e,it,ft,ut){if(!it)return;var Ze={sourceNode:Ke,pre:1,langExtension:null,numberLines:null,sourceCode:it,spans:null,basePos:$e,decorations:null};ft(Ze),ut.push.apply(ut,Ze.decorations)}var ce=/\S/;function Ee(Ke){for(var $e=void 0,it=Ke.firstChild;it;it=it.nextSibling){var ft=it.nodeType;$e=ft===1?$e?Ke:it:ft===3&&ce.test(it.nodeValue)?Ke:$e}return $e===Ke?void 0:$e}function we(Ke,$e){var it={},ft;(function(){for(var qe=Ke.concat($e),Dt=[],wt={},vt=0,mt=qe.length;vt<mt;++vt){var Nt=qe[vt],At=Nt[3];if(At)for(var Ot=At.length;--Ot>=0;)it[At.charAt(Ot)]=Nt;var He=Nt[1],Ut=""+He;wt.hasOwnProperty(Ut)||(Dt.push(He),wt[Ut]=null)}Dt.push(/[\0-\uffff]/),ft=V(Dt)})();var ut=$e.length,Ze=function(qe){for(var Dt=qe.sourceCode,wt=qe.basePos,vt=qe.sourceNode,mt=[wt,a],Nt=0,At=Dt.match(ft)||[],Ot={},He=0,Ut=At.length;He<Ut;++He){var Lt=At[He],Xe=Ot[Lt],nt=void 0,_e;if(typeof Xe=="string")_e=!1;else{var ve=it[Lt.charAt(0)];if(ve)nt=Lt.match(ve[1]),Xe=ve[0];else{for(var Ce=0;Ce<ut;++Ce)if(ve=$e[Ce],nt=Lt.match(ve[1]),nt){Xe=ve[0];break}nt||(Xe=a)}_e=Xe.length>=5&&Xe.substring(0,5)==="lang-",_e&&!(nt&&typeof nt[1]=="string")&&(_e=!1,Xe=b),_e||(Ot[Lt]=Xe)}var ne=Nt;if(Nt+=Lt.length,!_e)mt.push(wt+ne,Xe);else{var ie=nt[1],ue=Lt.indexOf(ie),he=ue+ie.length;nt[2]&&(he=Lt.length-nt[2].length,ue=he-ie.length);var Me=Xe.substring(5);re(vt,wt+ne,Lt.substring(0,ue),Ze,mt),re(vt,wt+ne+ue,ie,se(Me,ie),mt),re(vt,wt+ne+he,Lt.substring(he),Ze,mt)}}qe.decorations=mt};return Ze}function Ye(Ke){var $e=[],it=[];Ke.tripleQuotedStrings?$e.push([p,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ke.multiLineStrings?$e.push([p,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):$e.push([p,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ke.verbatimStrings&&it.push([p,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ft=Ke.hashComments;ft&&(Ke.cStyleComments?(ft>1?$e.push([x,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):$e.push([x,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),it.push([p,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):$e.push([x,/^#[^\r\n]*/,null,"#"])),Ke.cStyleComments&&(it.push([x,/^\/\/[^\r\n]*/,null]),it.push([x,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ut=Ke.regexLiterals;if(ut){var Ze=ut>1?"":`
|
|
\r`,qe=Ze?".":"[\\S\\s]",Dt="/(?=[^/*"+Ze+"])(?:[^/\\x5B\\x5C"+Ze+"]|\\x5C"+qe+"|\\x5B(?:[^\\x5C\\x5D"+Ze+"]|\\x5C"+qe+")*(?:\\x5D|$))+/";it.push(["lang-regex",RegExp("^"+Z+"("+Dt+")")])}var wt=Ke.types;wt&&it.push([g,wt]);var vt=(""+Ke.keywords).replace(/^ | $/g,"");vt.length&&it.push([w,new RegExp("^(?:"+vt.replace(/[\s,]+/g,"|")+")\\b"),null]),$e.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var mt="^.[^\\s\\w.$@'\"`/\\\\]*";return Ke.regexLiterals&&(mt+="(?!s*/)"),it.push([f,/^@[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],[f,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[d,new RegExp(mt),null]),we($e,it)}var Ne=Ye({keywords:T,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ie(Ke,$e,it){for(var ft=/(?:^|\s)nocode(?:\s|$)/,ut=/\r\n?|\n/,Ze=Ke.ownerDocument,qe=Ze.createElement("li");Ke.firstChild;)qe.appendChild(Ke.firstChild);var Dt=[qe];function wt(He){var Ut=He.nodeType;if(Ut==1&&!ft.test(He.className))if(He.nodeName==="br")vt(He),He.parentNode&&He.parentNode.removeChild(He);else for(var Lt=He.firstChild;Lt;Lt=Lt.nextSibling)wt(Lt);else if((Ut==3||Ut==4)&&it){var Xe=He.nodeValue,nt=Xe.match(ut);if(nt){var _e=Xe.substring(0,nt.index);He.nodeValue=_e;var ve=Xe.substring(nt.index+nt[0].length);if(ve){var Ce=He.parentNode;Ce.insertBefore(Ze.createTextNode(ve),He.nextSibling)}vt(He),_e||He.parentNode.removeChild(He)}}}function vt(He){for(;!He.nextSibling;)if(He=He.parentNode,!He)return;function Ut(nt,_e){var ve=_e?nt.cloneNode(!1):nt,Ce=nt.parentNode;if(Ce){var ne=Ut(Ce,1),ie=nt.nextSibling;ne.appendChild(ve);for(var ue=ie;ue;ue=ie)ie=ue.nextSibling,ne.appendChild(ue)}return ve}for(var Lt=Ut(He.nextSibling,0),Xe;(Xe=Lt.parentNode)&&Xe.nodeType===1;)Lt=Xe;Dt.push(Lt)}for(var mt=0;mt<Dt.length;++mt)wt(Dt[mt]);$e===($e|0)&&Dt[0].setAttribute("value",$e);var Nt=Ze.createElement("ol");Nt.className="linenums";for(var At=Math.max(0,$e-1|0)||0,mt=0,Ot=Dt.length;mt<Ot;++mt)qe=Dt[mt],qe.className="L"+(mt+At)%10,qe.firstChild||qe.appendChild(Ze.createTextNode("\xA0")),Nt.appendChild(qe);Ke.appendChild(Nt)}function We(Ke){var $e=/\bMSIE\s(\d+)/.exec(navigator.userAgent);$e=$e&&+$e[1]<=8;var it=/\n/g,ft=Ke.sourceCode,ut=ft.length,Ze=0,qe=Ke.spans,Dt=qe.length,wt=0,vt=Ke.decorations,mt=vt.length,Nt=0;vt[mt]=ut;var At,Ot;for(Ot=At=0;Ot<mt;)vt[Ot]!==vt[Ot+2]?(vt[At++]=vt[Ot++],vt[At++]=vt[Ot++]):Ot+=2;for(mt=At,Ot=At=0;Ot<mt;){for(var He=vt[Ot],Ut=vt[Ot+1],Lt=Ot+2;Lt+2<=mt&&vt[Lt+1]===Ut;)Lt+=2;vt[At++]=He,vt[At++]=Ut,Ot=Lt}mt=vt.length=At;var Xe=Ke.sourceNode,nt="";Xe&&(nt=Xe.style.display,Xe.style.display="none");try{for(var _e=null;wt<Dt;){var ve=qe[wt],Ce=qe[wt+2]||ut,ne=vt[Nt+2]||ut,Lt=Math.min(Ce,ne),ie=qe[wt+1],ue;if(ie.nodeType!==1&&(ue=ft.substring(Ze,Lt))){$e&&(ue=ue.replace(it,"\r")),ie.nodeValue=ue;var he=ie.ownerDocument,Me=he.createElement("span");Me.className=vt[Nt+1];var be=ie.parentNode;be.replaceChild(Me,ie),Me.appendChild(ie),Ze<Ce&&(qe[wt+1]=ie=he.createTextNode(ft.substring(Lt,Ce)),be.insertBefore(ie,Me.nextSibling))}Ze=Lt,Ze>=Ce&&(wt+=2),Ze>=ne&&(Nt+=2)}}finally{Xe&&(Xe.style.display=nt)}}var Ue={};function xe(Ke,$e){for(var it=$e.length;--it>=0;){var ft=$e[it];Ue.hasOwnProperty(ft)?j.console&&console.warn("cannot override language handler %s",ft):Ue[ft]=Ke}}function se(Ke,$e){return Ke&&Ue.hasOwnProperty(Ke)||(Ke=/^\s*</.test($e)?"default-markup":"default-code"),Ue[Ke]}xe(Ne,["default-code"]),xe(we([],[[a,/^[^<?]+/],[v,/^<!\w[^>]*(?:>|$)/],[x,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[d,/^(?:<[%?]|[%?]>)/],["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"]),xe(we([[a,/^[\s]+/,null,` \r
|
|
`],[G,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[C,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[y,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[d,/^[=<>\/]+/],["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"]),xe(we([],[[G,/^[\s\S]+/]]),["uq.val"]),xe(Ye({keywords:_,hashComments:!0,cStyleComments:!0,types:m}),["c","cc","cpp","cxx","cyc","m"]),xe(Ye({keywords:"null,true,false"}),["json"]),xe(Ye({keywords:R,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:m}),["cs"]),xe(Ye({keywords:M,cStyleComments:!0}),["java"]),xe(Ye({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),xe(Ye({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),xe(Ye({keywords:c,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),xe(Ye({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),xe(Ye({keywords:S,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),xe(Ye({keywords:k,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),xe(we([],[[p,/^[\s\S]+/]]),["regex"]);function ke(Ke){var $e=Ke.langExtension;try{var it=H(Ke.sourceNode,Ke.pre),ft=it.sourceCode;Ke.sourceCode=ft,Ke.spans=it.spans,Ke.basePos=0,se($e,ft)(Ke),We(Ke)}catch(ut){j.console&&console.log(ut&&ut.stack||ut)}}function dt(Ke,$e,it){var ft=it||!1,ut=$e||null,Ze=document.createElement("div");Ze.innerHTML="<pre>"+Ke+"</pre>",Ze=Ze.firstChild,ft&&Ie(Ze,ft,!0);var qe={langExtension:ut,numberLines:ft,sourceNode:Ze,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return ke(qe),Ze.innerHTML}function at(Ke,$e){var it=$e||document.body,ft=it.ownerDocument||document;function ut(ve){return it.getElementsByTagName(ve)}for(var Ze=[ut("pre"),ut("code"),ut("xmp")],qe=[],Dt=0;Dt<Ze.length;++Dt)for(var wt=0,vt=Ze[Dt].length;wt<vt;++wt)qe.push(Ze[Dt][wt]);Ze=null;var mt=Date;mt.now||(mt={now:function(){return+new Date}});var Nt=0,At=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ot=/\bprettyprint\b/,He=/\bprettyprinted\b/,Ut=/pre|xmp/i,Lt=/^code$/i,Xe=/^(?:pre|code|xmp)$/i,nt={};function _e(){for(var ve=j.PR_SHOULD_USE_CONTINUATION?mt.now()+250:Infinity;Nt<qe.length&&mt.now()<ve;Nt++){for(var Ce=qe[Nt],ne=nt,ie=Ce;ie=ie.previousSibling;){var ue=ie.nodeType,he=(ue===7||ue===8)&&ie.nodeValue;if(he?!/^\??prettify\b/.test(he):ue!==3||/\S/.test(ie.nodeValue))break;if(he){ne={},he.replace(/\b(\w+)=([\w:.%+-]+)/g,function(er,Bt,qt){ne[Bt]=qt});break}}var Me=Ce.className;if((ne!==nt||Ot.test(Me))&&!He.test(Me)){for(var be=!1,Le=Ce.parentNode;Le;Le=Le.parentNode){var tt=Le.tagName;if(Xe.test(tt)&&Le.className&&Ot.test(Le.className)){be=!0;break}}if(!be){Ce.className+=" prettyprinted";var pt=ne.lang;if(!pt){pt=Me.match(At);var yt;!pt&&(yt=Ee(Ce))&&Lt.test(yt.tagName)&&(pt=yt.className.match(At)),pt&&(pt=pt[1])}var Gt;if(Ut.test(Ce.tagName))Gt=1;else{var Tt=Ce.currentStyle,Ge=ft.defaultView,gr=Tt?Tt.whiteSpace:Ge&&Ge.getComputedStyle?Ge.getComputedStyle(Ce,null).getPropertyValue("white-space"):0;Gt=gr&&gr.substring(0,3)==="pre"}var Fe=ne.linenums;(Fe=Fe==="true"||+Fe)||(Fe=Me.match(/\blinenums\b(?::(\d+))?/),Fe=Fe?Fe[1]&&Fe[1].length?+Fe[1]:!0:!1),Fe&&Ie(Ce,Fe,Gt);var or={langExtension:pt,sourceNode:Ce,numberLines:Fe,pre:Gt,sourceCode:null,basePos:null,spans:null,decorations:null};ke(or)}}}Nt<qe.length?j.setTimeout(_e,250):typeof Ke=="function"&&Ke()}_e()}var rt=j.PR={createSimpleLexer:we,registerLangHandler:xe,sourceDecorator:Ye,PR_ATTRIB_NAME:y,PR_ATTRIB_VALUE:G,PR_COMMENT:x,PR_DECLARATION:v,PR_KEYWORD:w,PR_LITERAL:f,PR_NOCODE:$,PR_PLAIN:a,PR_PUNCTUATION:d,PR_SOURCE:b,PR_STRING:p,PR_TAG:C,PR_TYPE:g,prettyPrintOne:L?j.prettyPrintOne=dt:I=dt,prettyPrint:W=L?j.prettyPrint=at:W=at},lt=j.define;typeof lt=="function"&<.amd&<("google-code-prettify",[],function(){return rt})})()},UU91:function(zt,xt,ee){zt.exports={flex_box_center:"flex_box_center___W-luD",flex_space_between:"flex_space_between___MDZOl",flex_box_vertical_center:"flex_box_vertical_center___GF3w8",flex_box_center_end:"flex_box_center_end___UZLKo",flex_box_column:"flex_box_column___26ZEG",bg:"bg___Lrg3h",containerTitle:"containerTitle___36aFc",containerDesc:"containerDesc___1ITIo",listItem:"listItem___3yIgk",info:"info___1J349",title:"title___1poFp",titleLeft:"titleLeft___1G4yJ",titleRight:"titleRight___3ZAtk",acitons:"acitons___rsUze",export:"export___23Ina"}},"VrN/":function(zt,xt,ee){(function(le,Y){zt.exports=Y()})(this,function(){"use strict";var le=navigator.userAgent,Y=navigator.platform,L=/gecko\/\d/i.test(le),z=/MSIE \d/.test(le),A=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(le),I=/Edge\/(\d+)/.exec(le),W=z||A||I,j=W&&(z?document.documentMode||6:+(I||A)[1]),P=!I&&/WebKit\//.test(le),D=P&&/Qt\/\d+\.\d+/.test(le),E=!I&&/Chrome\//.test(le),_=/Opera\//.test(le),M=/Apple Computer/.test(navigator.vendor),R=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(le),k=/PhantomJS/.test(le),S=!I&&/AppleWebKit/.test(le)&&/Mobile\/\w+/.test(le),c=/Android/.test(le),o=S||c||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(le),l=S||/Mac/.test(Y),u=/\bCrOS\b/.test(le),T=/win/i.test(Y),m=_&&le.match(/Version\/(\d*\.\d*)/);m&&(m=Number(m[1])),m&&m>=15&&(_=!1,P=!0);var p=l&&(D||_&&(m==null||m<12.11)),w=L||W&&j>=9;function x(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var g=function(e,t){var n=e.className,r=x(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function f(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function d(e,t){return f(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var O=0;O<t.length;++O)i.appendChild(t[O]);return i}function C(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var v;document.createRange?v=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:v=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function b(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 y(){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 G(e,t){var n=e.className;x(t).test(n)||(e.className+=(n?" ":"")+t)}function $(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!x(n[r]).test(t)&&(t+=" "+n[r]);return t}var Z=function(e){e.select()};S?Z=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:W&&(Z=function(e){try{e.select()}catch(t){}});function V(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function H(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function re(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var O=r||0,F=i||0;;){var X=e.indexOf(" ",O);if(X<0||X>=t)return F+(t-O);F+=X-O,F+=n-F%n,O=X+1}}var ce=function(){this.id=null,this.f=null,this.time=0,this.handler=V(this.onTimeout,this)};ce.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ce.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function Ee(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var we=50,Ye={toString:function(){return"CodeMirror.Pass"}},Ne={scroll:!1},Ie={origin:"*mouse"},We={origin:"+move"};function Ue(e,t,n){for(var r=0,i=0;;){var O=e.indexOf(" ",r);O==-1&&(O=e.length);var F=O-r;if(O==e.length||i+F>=t)return r+Math.min(F,t-i);if(i+=O-r,i+=n-i%n,r=O+1,i>=t)return r}}var xe=[""];function se(e){for(;xe.length<=e;)xe.push(ke(xe)+" ");return xe[e]}function ke(e){return e[e.length-1]}function dt(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function at(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function rt(){}function lt(e,t){var n;return Object.create?n=Object.create(e):(rt.prototype=e,n=new rt),t&&H(t,n),n}var Ke=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function $e(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Ke.test(e))}function it(e,t){return t?t.source.indexOf("\\w")>-1&&$e(e)?!0:t.test(e):$e(e)}function ft(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ut=/[\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 Ze(e){return e.charCodeAt(0)>=768&&ut.test(e)}function qe(e,t,n){for(;(n<0?t>0:t<e.length)&&Ze(e.charAt(t));)t+=n;return t}function Dt(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,O=r<0?Math.ceil(i):Math.floor(i);if(O==t)return e(O)?t:n;e(O)?n=O:t=O+r}}function wt(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,O=0;O<e.length;++O){var F=e[O];(F.from<n&&F.to>t||t==n&&F.to==t)&&(r(Math.max(F.from,t),Math.min(F.to,n),F.level==1?"rtl":"ltr",O),i=!0)}i||r(t,n,"ltr")}var vt=null;function mt(e,t,n){var r;vt=null;for(var i=0;i<e.length;++i){var O=e[i];if(O.from<t&&O.to>t)return i;O.to==t&&(O.from!=O.to&&n=="before"?r=i:vt=i),O.from==t&&(O.from!=O.to&&n!="before"?r=i:vt=i)}return r!=null?r:vt}var Nt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(q){return q<=247?e.charAt(q):1424<=q&&q<=1524?"R":1536<=q&&q<=1785?t.charAt(q-1536):1774<=q&&q<=2220?"r":8192<=q&&q<=8203?"w":q==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,O=/[LRr]/,F=/[Lb1n]/,X=/[1n]/;function Q(q,pe,ye){this.level=q,this.from=pe,this.to=ye}return function(q,pe){var ye=pe=="ltr"?"L":"R";if(q.length==0||pe=="ltr"&&!r.test(q))return!1;for(var Pe=q.length,Re=[],Qe=0;Qe<Pe;++Qe)Re.push(n(q.charCodeAt(Qe)));for(var et=0,ht=ye;et<Pe;++et){var Ct=Re[et];Ct=="m"?Re[et]=ht:ht=Ct}for(var Mt=0,St=ye;Mt<Pe;++Mt){var Ft=Re[Mt];Ft=="1"&&St=="r"?Re[Mt]="n":O.test(Ft)&&(St=Ft,Ft=="r"&&(Re[Mt]="R"))}for(var ir=1,$t=Re[0];ir<Pe-1;++ir){var xr=Re[ir];xr=="+"&&$t=="1"&&Re[ir+1]=="1"?Re[ir]="1":xr==","&&$t==Re[ir+1]&&($t=="1"||$t=="n")&&(Re[ir]=$t),$t=xr}for(var cn=0;cn<Pe;++cn){var Xn=Re[cn];if(Xn==",")Re[cn]="N";else if(Xn=="%"){var _n=void 0;for(_n=cn+1;_n<Pe&&Re[_n]=="%";++_n);for(var bi=cn&&Re[cn-1]=="!"||_n<Pe&&Re[_n]=="1"?"1":"N",pi=cn;pi<_n;++pi)Re[pi]=bi;cn=_n-1}}for(var Bn=0,mi=ye;Bn<Pe;++Bn){var Qn=Re[Bn];mi=="L"&&Qn=="1"?Re[Bn]="L":O.test(Qn)&&(mi=Qn)}for(var Vn=0;Vn<Pe;++Vn)if(i.test(Re[Vn])){var Fn=void 0;for(Fn=Vn+1;Fn<Pe&&i.test(Re[Fn]);++Fn);for(var Rn=(Vn?Re[Vn-1]:ye)=="L",gi=(Fn<Pe?Re[Fn]:ye)=="L",Fa=Rn==gi?Rn?"L":"R":ye,ca=Vn;ca<Fn;++ca)Re[ca]=Fa;Vn=Fn-1}for(var ti=[],Hi,Yn=0;Yn<Pe;)if(F.test(Re[Yn])){var ps=Yn;for(++Yn;Yn<Pe&&F.test(Re[Yn]);++Yn);ti.push(new Q(0,ps,Yn))}else{var Zi=Yn,ya=ti.length,ba=pe=="rtl"?1:0;for(++Yn;Yn<Pe&&Re[Yn]!="L";++Yn);for(var di=Zi;di<Yn;)if(X.test(Re[di])){Zi<di&&(ti.splice(ya,0,new Q(1,Zi,di)),ya+=ba);var ja=di;for(++di;di<Yn&&X.test(Re[di]);++di);ti.splice(ya,0,new Q(2,ja,di)),ya+=ba,Zi=di}else++di;Zi<Yn&&ti.splice(ya,0,new Q(1,Zi,Yn))}return pe=="ltr"&&(ti[0].level==1&&(Hi=q.match(/^\s+/))&&(ti[0].from=Hi[0].length,ti.unshift(new Q(0,0,Hi[0].length))),ke(ti).level==1&&(Hi=q.match(/\s+$/))&&(ke(ti).to-=Hi[0].length,ti.push(new Q(0,Pe-Hi[0].length,Pe)))),pe=="rtl"?ti.reverse():ti}}();function At(e,t){var n=e.order;return n==null&&(n=e.order=Nt(e.text,t)),n}var Ot=[],He=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Ot).concat(n)}};function Ut(e,t){return e._handlers&&e._handlers[t]||Ot}function Lt(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var O=Ee(i,n);O>-1&&(r[t]=i.slice(0,O).concat(i.slice(O+1)))}}}function Xe(e,t){var n=Ut(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function nt(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Xe(e,n||t.type,e,t),ue(t)||t.codemirrorIgnore}function _e(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)Ee(n,t[r])==-1&&n.push(t[r])}function ve(e,t){return Ut(e,t).length>0}function Ce(e){e.prototype.on=function(t,n){He(this,t,n)},e.prototype.off=function(t,n){Lt(this,t,n)}}function ne(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ie(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ue(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function he(e){ne(e),ie(e)}function Me(e){return e.target||e.srcElement}function be(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 Le=function(){if(W&&j<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),tt;function pt(e){if(tt==null){var t=a("span","\u200B");d(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(tt=t.offsetWidth<=1&&t.offsetHeight>2&&!(W&&j<8))}var n=tt?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var yt;function Gt(e){if(yt!=null)return yt;var t=d(e,document.createTextNode("A\u062EA")),n=v(t,0,1).getBoundingClientRect(),r=v(t,1,2).getBoundingClientRect();return f(e),!n||n.left==n.right?!1:yt=r.right-n.right<3}var Tt=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
|
|
`,t);i==-1&&(i=e.length);var O=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),F=O.indexOf("\r");F!=-1?(n.push(O.slice(0,F)),t+=F+1):(n.push(O),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Ge=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(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},gr=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Fe=null;function or(e){if(Fe!=null)return Fe;var t=d(e,a("span","x")),n=t.getBoundingClientRect(),r=v(t,0,1).getBoundingClientRect();return Fe=Math.abs(n.left-r.left)>1}var er={},Bt={};function qt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),er[e]=t}function pr(e,t){Bt[e]=t}function kt(e){if(typeof e=="string"&&Bt.hasOwnProperty(e))e=Bt[e];else if(e&&typeof e.name=="string"&&Bt.hasOwnProperty(e.name)){var t=Bt[e.name];typeof t=="string"&&(t={name:t}),e=lt(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return kt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return kt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Gr(e,t){t=kt(t);var n=er[t.name];if(!n)return Gr(e,"text/plain");var r=n(e,t);if(br.hasOwnProperty(t.name)){var i=br[t.name];for(var O in i){if(!i.hasOwnProperty(O))continue;r.hasOwnProperty(O)&&(r["_"+O]=r[O]),r[O]=i[O]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var F in t.modeProps)r[F]=t.modeProps[F];return r}var br={};function wr(e,t){var n=br.hasOwnProperty(e)?br[e]:br[e]={};H(t,n)}function Lr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Br(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function ur(e,t,n){return e.startState?e.startState(t,n):!0}var Ht=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Ht.prototype.eol=function(){return this.pos>=this.string.length},Ht.prototype.sol=function(){return this.pos==this.lineStart},Ht.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ht.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ht.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Ht.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ht.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ht.prototype.skipToEnd=function(){this.pos=this.string.length},Ht.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ht.prototype.backUp=function(e){this.pos-=e},Ht.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=re(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?re(this.string,this.lineStart,this.tabSize):0)},Ht.prototype.indentation=function(){return re(this.string,null,this.tabSize)-(this.lineStart?re(this.string,this.lineStart,this.tabSize):0)},Ht.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(F){return n?F.toLowerCase():F},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var O=this.string.slice(this.pos).match(e);return O&&O.index>0?null:(O&&t!==!1&&(this.pos+=O[0].length),O)}},Ht.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ht.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ht.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ht.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function _t(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 n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],O=i.chunkSize();if(t<O){n=i;break}t-=O}return n.lines[t]}function Vr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(O){var F=O.text;i==n.line&&(F=F.slice(0,n.ch)),i==t.line&&(F=F.slice(t.ch)),r.push(F),++i}),r}function Fr(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function Ar(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Kt(e){if(e.parent==null)return null;for(var t=e.parent,n=Ee(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function Xr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],O=i.height;if(t<O){e=i;continue e}t-=O,n+=i.chunkSize()}return n}while(!e.lines);for(var F=0;F<e.lines.length;++F){var X=e.lines[F],Q=X.height;if(t<Q)break;t-=Q}return n+F}function Zr(e,t){return t>=e.first&&t<e.first+e.size}function Yr(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Je(e,t,n){if(n===void 0&&(n=null),!(this instanceof Je))return new Je(e,t,n);this.line=e,this.ch=t,this.sticky=n}function Pt(e,t){return e.line-t.line||e.ch-t.ch}function jr(e,t){return e.sticky==t.sticky&&Pt(e,t)==0}function sr(e){return Je(e.line,e.ch)}function Zt(e,t){return Pt(e,t)<0?t:e}function Or(e,t){return Pt(e,t)<0?e:t}function U(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 Je(e.first,0);var n=e.first+e.size-1;return t.line>n?Je(n,_t(e,n).text.length):h(t,_t(e,t.line).text.length)}function h(e,t){var n=e.ch;return n==null||n>t?Je(e.line,t):n<0?Je(e.line,0):e}function B(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=s(e,t[r]);return n}var K=function(e,t){this.state=e,this.lookAhead=t},N=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};N.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},N.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}},N.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},N.fromSaved=function(e,t,n){return t instanceof K?new N(e,Lr(e.mode,t.state),n,t.lookAhead):new N(e,Lr(e.mode,t),n)},N.prototype.save=function(e){var t=e!==!1?Lr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new K(t,this.maxLookAhead):t};function ae(e,t,n,r){var i=[e.state.modeGen],O={};ar(e,t.text,e.doc.mode,n,function(q,pe){return i.push(q,pe)},O,r);for(var F=n.state,X=function(q){n.baseTokens=i;var pe=e.state.overlays[q],ye=1,Pe=0;n.state=!0,ar(e,t.text,pe.mode,n,function(Re,Qe){for(var et=ye;Pe<Re;){var ht=i[ye];ht>Re&&i.splice(ye,1,Re,i[ye+1],ht),ye+=2,Pe=Math.min(Re,ht)}if(!Qe)return;if(pe.opaque)i.splice(et,ye-et,Re,"overlay "+Qe),ye=et+2;else for(;et<ye;et+=2){var Ct=i[et+1];i[et+1]=(Ct?Ct+" ":"")+"overlay "+Qe}},O),n.state=F,n.baseTokens=null,n.baseTokenPos=1},Q=0;Q<e.state.overlays.length;++Q)X(Q);return{styles:i,classes:O.bgClass||O.textClass?O:null}}function Be(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=ze(e,Kt(t)),i=t.text.length>e.options.maxHighlightLength&&Lr(e.doc.mode,r.state),O=ae(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=O.styles,O.classes?t.styleClasses=O.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function ze(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new N(r,!0,t);var O=bt(e,t,n),F=O>r.first&&_t(r,O-1).stateAfter,X=F?N.fromSaved(r,F,O):new N(r,ur(r.mode),O);return r.iter(O,t,function(Q){gt(e,Q.text,X);var q=X.line;Q.stateAfter=q==t-1||q%5==0||q>=i.viewFrom&&q<i.viewTo?X.save():null,X.nextLine()}),n&&(r.modeFrontier=X.line),X}function gt(e,t,n,r){var i=e.doc.mode,O=new Ht(t,e.options.tabSize,n);for(O.start=O.pos=r||0,t==""&&je(i,n.state);!O.eol();)ct(i,O,n.state),O.start=O.pos}function je(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Br(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function ct(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Br(e,n).mode);var O=e.token(t,n);if(t.pos>t.start)return O}throw new Error("Mode "+e.name+" failed to advance stream.")}var Wt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Dr(e,t,n,r){var i=e.doc,O=i.mode,F;t=s(i,t);var X=_t(i,t.line),Q=ze(e,t.line,n),q=new Ht(X.text,e.options.tabSize,Q),pe;for(r&&(pe=[]);(r||q.pos<t.ch)&&!q.eol();)q.start=q.pos,F=ct(O,q,Q.state),r&&pe.push(new Wt(q,F,Lr(i.mode,Q.state)));return r?pe:new Wt(q,F,Q.state)}function qr(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function ar(e,t,n,r,i,O,F){var X=n.flattenSpans;X==null&&(X=e.options.flattenSpans);var Q=0,q=null,pe=new Ht(t,e.options.tabSize,r),ye,Pe=e.options.addModeClass&&[null];for(t==""&&qr(je(n,r.state),O);!pe.eol();){if(pe.pos>e.options.maxHighlightLength?(X=!1,F&>(e,t,r,pe.pos),pe.pos=t.length,ye=null):ye=qr(ct(n,pe,r.state,Pe),O),Pe){var Re=Pe[0].name;Re&&(ye="m-"+(ye?Re+" "+ye:Re))}if(!X||q!=ye){for(;Q<pe.start;)Q=Math.min(pe.start,Q+5e3),i(Q,q);q=ye}pe.start=pe.pos}for(;Q<pe.pos;){var Qe=Math.min(pe.pos,Q+5e3);i(Qe,q),Q=Qe}}function bt(e,t,n){for(var r,i,O=e.doc,F=n?-1:t-(e.doc.mode.innerMode?1e3:100),X=t;X>F;--X){if(X<=O.first)return O.first;var Q=_t(O,X-1),q=Q.stateAfter;if(q&&(!n||X+(q instanceof K?q.lookAhead:0)<=O.modeFrontier))return X;var pe=re(Q.text,null,e.options.tabSize);(i==null||r>pe)&&(i=X-1,r=pe)}return i}function Rt(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var i=_t(e,r).stateAfter;if(i&&(!(i instanceof K)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Qt=!1,tr=!1;function dr(){Qt=!0}function Mr(){tr=!0}function rr(e,t,n){this.marker=e,this.from=t,this.to=n}function En(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Jn(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function ri(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function _i(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var O=e[i],F=O.marker,X=O.from==null||(F.inclusiveLeft?O.from<=t:O.from<t);if(X||O.from==t&&F.type=="bookmark"&&(!n||!O.marker.insertLeft)){var Q=O.to==null||(F.inclusiveRight?O.to>=t:O.to>t);(r||(r=[])).push(new rr(F,O.from,Q?null:O.to))}}return r}function Ki(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var O=e[i],F=O.marker,X=O.to==null||(F.inclusiveRight?O.to>=t:O.to>t);if(X||O.from==t&&F.type=="bookmark"&&(!n||O.marker.insertLeft)){var Q=O.from==null||(F.inclusiveLeft?O.from<=t:O.from<t);(r||(r=[])).push(new rr(F,Q?null:O.from-t,O.to==null?null:O.to-t))}}return r}function hn(e,t){if(t.full)return null;var n=Zr(e,t.from.line)&&_t(e,t.from.line).markedSpans,r=Zr(e,t.to.line)&&_t(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,O=t.to.ch,F=Pt(t.from,t.to)==0,X=_i(n,i,F),Q=Ki(r,O,F),q=t.text.length==1,pe=ke(t.text).length+(q?i:0);if(X)for(var ye=0;ye<X.length;++ye){var Pe=X[ye];if(Pe.to==null){var Re=En(Q,Pe.marker);Re?q&&(Pe.to=Re.to==null?null:Re.to+pe):Pe.to=i}}if(Q)for(var Qe=0;Qe<Q.length;++Qe){var et=Q[Qe];if(et.to!=null&&(et.to+=pe),et.from==null){var ht=En(X,et.marker);ht||(et.from=pe,q&&(X||(X=[])).push(et))}else et.from+=pe,q&&(X||(X=[])).push(et)}X&&(X=wn(X)),Q&&Q!=X&&(Q=wn(Q));var Ct=[X];if(!q){var Mt=t.text.length-2,St;if(Mt>0&&X)for(var Ft=0;Ft<X.length;++Ft)X[Ft].to==null&&(St||(St=[])).push(new rr(X[Ft].marker,null,null));for(var ir=0;ir<Mt;++ir)Ct.push(St);Ct.push(Q)}return Ct}function wn(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function vi(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(Re){if(Re.markedSpans)for(var Qe=0;Qe<Re.markedSpans.length;++Qe){var et=Re.markedSpans[Qe].marker;et.readOnly&&(!r||Ee(r,et)==-1)&&(r||(r=[])).push(et)}}),!r)return null;for(var i=[{from:t,to:n}],O=0;O<r.length;++O)for(var F=r[O],X=F.find(0),Q=0;Q<i.length;++Q){var q=i[Q];if(Pt(q.to,X.from)<0||Pt(q.from,X.to)>0)continue;var pe=[Q,1],ye=Pt(q.from,X.from),Pe=Pt(q.to,X.to);(ye<0||!F.inclusiveLeft&&!ye)&&pe.push({from:q.from,to:X.from}),(Pe>0||!F.inclusiveRight&&!Pe)&&pe.push({from:X.to,to:q.to}),i.splice.apply(i,pe),Q+=pe.length-3}return i}function Oi(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function qi(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function rn(e){return e.inclusiveLeft?-1:0}function Pr(e){return e.inclusiveRight?1:0}function fn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),O=Pt(r.from,i.from)||rn(e)-rn(t);if(O)return-O;var F=Pt(r.to,i.to)||Pr(e)-Pr(t);return F||t.id-e.id}function cr(e,t){var n=tr&&e.markedSpans,r;if(n)for(var i=void 0,O=0;O<n.length;++O)i=n[O],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||fn(r,i.marker)<0)&&(r=i.marker);return r}function pn(e){return cr(e,!0)}function Kr(e){return cr(e,!1)}function ni(e,t){var n=tr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var O=n[i];O.marker.collapsed&&(O.from==null||O.from<t)&&(O.to==null||O.to>t)&&(!r||fn(r,O.marker)<0)&&(r=O.marker)}return r}function gn(e,t,n,r,i){var O=_t(e,t),F=tr&&O.markedSpans;if(F)for(var X=0;X<F.length;++X){var Q=F[X];if(!Q.marker.collapsed)continue;var q=Q.marker.find(0),pe=Pt(q.from,n)||rn(Q.marker)-rn(i),ye=Pt(q.to,r)||Pr(Q.marker)-Pr(i);if(pe>=0&&ye<=0||pe<=0&&ye>=0)continue;if(pe<=0&&(Q.marker.inclusiveRight&&i.inclusiveLeft?Pt(q.to,n)>=0:Pt(q.to,n)>0)||pe>=0&&(Q.marker.inclusiveRight&&i.inclusiveLeft?Pt(q.from,r)<=0:Pt(q.from,r)<0))return!0}}function jn(e){for(var t;t=pn(e);)e=t.find(-1,!0).line;return e}function zi(e){for(var t;t=Kr(e);)e=t.find(1,!0).line;return e}function ci(e){for(var t,n;t=Kr(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function hi(e,t){var n=_t(e,t),r=jn(n);return n==r?t:Kt(r)}function wi(e,t){if(t>e.lastLine())return t;var n=_t(e,t),r;if(!Nn(e,n))return t;for(;r=Kr(n);)n=r.find(1,!0).line;return Kt(n)+1}function Nn(e,t){var n=tr&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i){if(r=n[i],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&Gi(e,t,r))return!0}}function Gi(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Gi(e,r.line,En(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,O=0;O<t.markedSpans.length;++O)if(i=t.markedSpans[O],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Gi(e,t,i))return!0}function mn(e){e=jn(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var O=n.parent;O;n=O,O=n.parent)for(var F=0;F<O.children.length;++F){var X=O.children[F];if(X==n)break;t+=X.height}return t}function Wr(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=pn(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Kr(r);){var O=n.find(0,!0);t-=r.text.length-O.from.ch,r=O.to.line,t+=r.text.length-O.to.ch}return t}function An(e){var t=e.display,n=e.doc;t.maxLine=_t(n,n.first),t.maxLineLength=Wr(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Wr(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Tn=function(e,t,n){this.text=e,qi(this,t),this.height=n?n(this):1};Tn.prototype.lineNo=function(){return Kt(this)},Ce(Tn);function ii(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Oi(e),qi(e,n);var i=r?r(e):1;i!=e.height&&Ar(e,i)}function Ln(e){e.parent=null,Oi(e)}var It={},Vt={};function Xt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Vt:It;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Er(e,t){var n=C("span",null,null,P?"padding-right: .1px":null),r={pre:C("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var O=i?t.rest[i-1]:t.line,F=void 0;r.pos=0,r.addToken=en,Gt(e.display.measure)&&(F=At(O,e.doc.direction))&&(r.addToken=Dn(r.addToken,F)),r.map=[];var X=t!=e.display.externalMeasured&&Kt(O);Cr(O,r,Be(e,O,X)),O.styleClasses&&(O.styleClasses.bgClass&&(r.bgClass=$(O.styleClasses.bgClass,r.bgClass||"")),O.styleClasses.textClass&&(r.textClass=$(O.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(pt(e.display.measure))),i==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 Q=r.content.lastChild;(/\bcm-tab\b/.test(Q.className)||Q.querySelector&&Q.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Xe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=$(r.pre.className,r.textClass||"")),r}function Ir(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 en(e,t,n,r,i,O,F){if(!t)return;var X=e.splitSpaces?kr(t,e.trailingSpace):t,Q=e.cm.state.specialChars,q=!1,pe;if(!Q.test(t))e.col+=t.length,pe=document.createTextNode(X),e.map.push(e.pos,e.pos+t.length,pe),W&&j<9&&(q=!0),e.pos+=t.length;else{pe=document.createDocumentFragment();for(var ye=0;;){Q.lastIndex=ye;var Pe=Q.exec(t),Re=Pe?Pe.index-ye:t.length-ye;if(Re){var Qe=document.createTextNode(X.slice(ye,ye+Re));W&&j<9?pe.appendChild(a("span",[Qe])):pe.appendChild(Qe),e.map.push(e.pos,e.pos+Re,Qe),e.col+=Re,e.pos+=Re}if(!Pe)break;ye+=Re+1;var et=void 0;if(Pe[0]==" "){var ht=e.cm.options.tabSize,Ct=ht-e.col%ht;et=pe.appendChild(a("span",se(Ct),"cm-tab")),et.setAttribute("role","presentation"),et.setAttribute("cm-text"," "),e.col+=Ct}else Pe[0]=="\r"||Pe[0]==`
|
|
`?(et=pe.appendChild(a("span",Pe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),et.setAttribute("cm-text",Pe[0]),e.col+=1):(et=e.cm.options.specialCharPlaceholder(Pe[0]),et.setAttribute("cm-text",Pe[0]),W&&j<9?pe.appendChild(a("span",[et])):pe.appendChild(et),e.col+=1);e.map.push(e.pos,e.pos+1,et),e.pos++}}if(e.trailingSpace=X.charCodeAt(t.length-1)==32,n||r||i||q||O||F){var Mt=n||"";r&&(Mt+=r),i&&(Mt+=i);var St=a("span",[pe],Mt,O);if(F)for(var Ft in F)F.hasOwnProperty(Ft)&&Ft!="style"&&Ft!="class"&&St.setAttribute(Ft,F[Ft]);return e.content.appendChild(St)}e.content.appendChild(pe)}function kr(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var O=e.charAt(i);O==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(O="\xA0"),r+=O,n=O==" "}return r}function Dn(e,t){return function(n,r,i,O,F,X,Q){i=i?i+" cm-force-border":"cm-force-border";for(var q=n.pos,pe=q+r.length;;){for(var ye=void 0,Pe=0;Pe<t.length&&!(ye=t[Pe],ye.to>q&&ye.from<=q);Pe++);if(ye.to>=pe)return e(n,r,i,O,F,X,Q);e(n,r.slice(0,ye.to-q),i,O,null,X,Q),O=null,r=r.slice(ye.to-q),q=ye.to}}}function Zn(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Cr(e,t,n){var r=e.markedSpans,i=e.text,O=0;if(!r){for(var F=1;F<n.length;F+=2)t.addToken(t,i.slice(O,O=n[F]),Xt(n[F+1],t.cm.options));return}for(var X=i.length,Q=0,q=1,pe="",ye,Pe,Re=0,Qe,et,ht,Ct,Mt;;){if(Re==Q){Qe=et=ht=Pe="",Mt=null,Ct=null,Re=Infinity;for(var St=[],Ft=void 0,ir=0;ir<r.length;++ir){var $t=r[ir],xr=$t.marker;if(xr.type=="bookmark"&&$t.from==Q&&xr.widgetNode)St.push(xr);else if($t.from<=Q&&($t.to==null||$t.to>Q||xr.collapsed&&$t.to==Q&&$t.from==Q)){if($t.to!=null&&$t.to!=Q&&Re>$t.to&&(Re=$t.to,et=""),xr.className&&(Qe+=" "+xr.className),xr.css&&(Pe=(Pe?Pe+";":"")+xr.css),xr.startStyle&&$t.from==Q&&(ht+=" "+xr.startStyle),xr.endStyle&&$t.to==Re&&(Ft||(Ft=[])).push(xr.endStyle,$t.to),xr.title&&((Mt||(Mt={})).title=xr.title),xr.attributes)for(var cn in xr.attributes)(Mt||(Mt={}))[cn]=xr.attributes[cn];xr.collapsed&&(!Ct||fn(Ct.marker,xr)<0)&&(Ct=$t)}else $t.from>Q&&Re>$t.from&&(Re=$t.from)}if(Ft)for(var Xn=0;Xn<Ft.length;Xn+=2)Ft[Xn+1]==Re&&(et+=" "+Ft[Xn]);if(!Ct||Ct.from==Q)for(var _n=0;_n<St.length;++_n)Zn(t,0,St[_n]);if(Ct&&(Ct.from||0)==Q){if(Zn(t,(Ct.to==null?X+1:Ct.to)-Q,Ct.marker,Ct.from==null),Ct.to==null)return;Ct.to==Q&&(Ct=!1)}}if(Q>=X)break;for(var bi=Math.min(X,Re);;){if(pe){var pi=Q+pe.length;if(!Ct){var Bn=pi>bi?pe.slice(0,bi-Q):pe;t.addToken(t,Bn,ye?ye+Qe:Qe,ht,Q+Bn.length==Re?et:"",Pe,Mt)}if(pi>=bi){pe=pe.slice(bi-Q),Q=bi;break}Q=pi,ht=""}pe=i.slice(O,O=n[q++]),ye=Xt(n[q++],t.cm.options)}}}function Pi(e,t,n){this.line=t,this.rest=ci(t),this.size=this.rest?Kt(ke(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Nn(e,t)}function zr(e,t,n){for(var r=[],i,O=t;O<n;O=i){var F=new Pi(e.doc,_t(e.doc,O),O);i=O+F.size,r.push(F)}return r}var Un=null;function yi(e){Un?Un.ops.push(e):e.ownsGroup=Un={ops:[e],delayedCallbacks:[]}}function ai(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Ea(e,t){var n=e.ownsGroup;if(!n)return;try{ai(n)}finally{Un=null,t(n)}}var ea=null;function On(e,t){var n=Ut(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Un?i=Un.delayedCallbacks:ea?i=ea:(i=ea=[],setTimeout(vo,0));for(var O=function(X){i.push(function(){return n[X].apply(null,r)})},F=0;F<n.length;++F)O(F)}function vo(){var e=ea;ea=null;for(var t=0;t<e.length;++t)e[t]()}function yo(e,t,n,r){for(var i=0;i<t.changes.length;i++){var O=t.changes[i];O=="text"?bo(e,t):O=="gutter"?Ka(e,t,n,r):O=="class"?Ha(e,t):O=="widget"&&Go(e,t,r)}t.changes=null}function ha(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),W&&j<8&&(e.node.style.zIndex=2)),e.node}function zo(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=ha(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Wa(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Er(e,t)}function bo(e,t){var n=t.text.className,r=Wa(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,Ha(e,t)):n&&(t.text.className=n)}function Ha(e,t){zo(e,t),t.line.wrapClass?ha(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Ka(e,t,n,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 i=ha(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),i.insertBefore(t.gutterBackground,t.text)}var O=t.line.gutterMarkers;if(e.options.lineNumbers||O){var F=ha(t),X=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(X),F.insertBefore(X,t.text),t.line.gutterClass&&(X.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!O||!O["CodeMirror-linenumbers"])&&(t.lineNumber=X.appendChild(a("div",Yr(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),O)for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var q=e.display.gutterSpecs[Q].className,pe=O.hasOwnProperty(q)&&O[q];pe&&X.appendChild(a("div",[pe],"CodeMirror-gutter-elt","left: "+r.gutterLeft[q]+"px; width: "+r.gutterWidth[q]+"px"))}}}function Go(e,t,n){t.alignable&&(t.alignable=null);for(var r=x("CodeMirror-linewidget"),i=t.node.firstChild,O=void 0;i;i=O)O=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);za(e,t,n)}function Eo(e,t,n,r){var i=Wa(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),Ha(e,t),Ka(e,t,n,r),za(e,t,r),t.node}function za(e,t,n){if(xo(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)xo(e,t.rest[r],t,n,!1)}function xo(e,t,n,r,i){if(!t.widgets)return;for(var O=ha(n),F=0,X=t.widgets;F<X.length;++F){var Q=X[F],q=a("div",[Q.node],"CodeMirror-linewidget"+(Q.className?" "+Q.className:""));Q.handleMouseEvents||q.setAttribute("cm-ignore-events","true"),Vo(Q,q,n,r),e.display.input.setUneditable(q),i&&Q.above?O.insertBefore(q,n.gutter||n.text):O.appendChild(q),On(Q,"redraw")}}function Vo(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function ta(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!b(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),d(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function ki(e,t){for(var n=Me(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Ga(e){return e.lineSpace.offsetTop}function de(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Se(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=d(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Ae(e){return we-e.display.nativeBarWidth}function fe(e){return e.display.scroller.clientWidth-Ae(e)-e.display.barWidth}function J(e){return e.display.scroller.clientHeight-Ae(e)-e.display.barHeight}function oe(e,t,n){var r=e.options.lineWrapping,i=r&&fe(e);if(!t.measure.heights||r&&t.measure.width!=i){var O=t.measure.heights=[];if(r){t.measure.width=i;for(var F=t.text.firstChild.getClientRects(),X=0;X<F.length-1;X++){var Q=F[X],q=F[X+1];Math.abs(Q.bottom-q.bottom)>2&&O.push((Q.bottom+q.top)/2-n.top)}}O.push(n.bottom-n.top)}}function te(e,t,n){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 i=0;i<e.rest.length;i++)if(Kt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function me(e,t){t=jn(t);var n=Kt(t),r=e.display.externalMeasured=new Pi(e.doc,t,n);r.lineN=n;var i=r.built=Er(e,r);return r.text=i.pre,d(e.display.lineMeasure,i.pre),r}function ge(e,t,n,r){return De(e,Te(e,t),n,r)}function Oe(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[dn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Te(e,t){var n=Kt(t),r=Oe(e,n);r&&!r.text?r=null:r&&r.changes&&(yo(e,r,n,xn(e)),e.curOp.forceUpdate=!0),r||(r=me(e,t));var i=te(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function De(e,t,n,r,i){t.before&&(n=-1);var O=n+(r||""),F;return t.cache.hasOwnProperty(O)?F=t.cache[O]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(oe(e,t.view,t.rect),t.hasHeights=!0),F=Et(e,t,n,r),F.bogus||(t.cache[O]=F)),{left:F.left,right:F.right,top:i?F.rtop:F.top,bottom:i?F.rbottom:F.bottom}}var Ve={left:0,right:0,top:0,bottom:0};function st(e,t,n){for(var r,i,O,F,X,Q,q=0;q<e.length;q+=3)if(X=e[q],Q=e[q+1],t<X?(i=0,O=1,F="left"):t<Q?(i=t-X,O=i+1):(q==e.length-3||t==Q&&e[q+3]>t)&&(O=Q-X,i=O-1,t>=Q&&(F="right")),i!=null){if(r=e[q+2],X==Q&&n==(r.insertLeft?"left":"right")&&(F=n),n=="left"&&i==0)for(;q&&e[q-2]==e[q-3]&&e[q-1].insertLeft;)r=e[(q-=3)+2],F="left";if(n=="right"&&i==Q-X)for(;q<e.length-3&&e[q+3]==e[q+4]&&!e[q+5].insertLeft;)r=e[(q+=3)+2],F="right";break}return{node:r,start:i,end:O,collapse:F,coverStart:X,coverEnd:Q}}function ot(e,t){var n=Ve;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function Et(e,t,n,r){var i=st(t.map,n,r),O=i.node,F=i.start,X=i.end,Q=i.collapse,q;if(O.nodeType==3){for(var pe=0;pe<4;pe++){for(;F&&Ze(t.line.text.charAt(i.coverStart+F));)--F;for(;i.coverStart+X<i.coverEnd&&Ze(t.line.text.charAt(i.coverStart+X));)++X;if(W&&j<9&&F==0&&X==i.coverEnd-i.coverStart?q=O.parentNode.getBoundingClientRect():q=ot(v(O,F,X).getClientRects(),r),q.left||q.right||F==0)break;X=F,F=F-1,Q="right"}W&&j<11&&(q=nr(e.display.measure,q))}else{F>0&&(Q=r="right");var ye;e.options.lineWrapping&&(ye=O.getClientRects()).length>1?q=ye[r=="right"?ye.length-1:0]:q=O.getBoundingClientRect()}if(W&&j<9&&!F&&(!q||!q.left&&!q.right)){var Pe=O.parentNode.getClientRects()[0];Pe?q={left:Pe.left,right:Pe.left+Wn(e.display),top:Pe.top,bottom:Pe.bottom}:q=Ve}for(var Re=q.top-t.rect.top,Qe=q.bottom-t.rect.top,et=(Re+Qe)/2,ht=t.view.measure.heights,Ct=0;Ct<ht.length-1&&!(et<ht[Ct]);Ct++);var Mt=Ct?ht[Ct-1]:0,St=ht[Ct],Ft={left:(Q=="right"?q.right:q.left)-t.rect.left,right:(Q=="left"?q.left:q.right)-t.rect.left,top:Mt,bottom:St};return!q.left&&!q.right&&(Ft.bogus=!0),e.options.singleCursorHeightPerLine||(Ft.rtop=Re,Ft.rbottom=Qe),Ft}function nr(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!or(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function vr(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 lr(e){e.display.externalMeasure=null,f(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)vr(e.display.view[t])}function hr(e){lr(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function yr(){return E&&c?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function mr(){return E&&c?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function fr(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=ta(e.widgets[n]));return t}function Nr(e,t,n,r,i){if(!i){var O=fr(t);n.top+=O,n.bottom+=O}if(r=="line")return n;r||(r="local");var F=mn(t);if(r=="local"?F+=Ga(e.display):F-=e.display.viewOffset,r=="page"||r=="window"){var X=e.display.lineSpace.getBoundingClientRect();F+=X.top+(r=="window"?0:mr());var Q=X.left+(r=="window"?0:yr());n.left+=Q,n.right+=Q}return n.top+=F,n.bottom+=F,n}function Sr(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=yr(),i-=mr();else if(n=="local"||!n){var O=e.display.sizer.getBoundingClientRect();r+=O.left,i+=O.top}var F=e.display.lineSpace.getBoundingClientRect();return{left:r-F.left,top:i-F.top}}function vn(e,t,n,r,i){return r||(r=_t(e.doc,t.line)),Nr(e,r,ge(e,r,t.ch,i),n)}function Tr(e,t,n,r,i,O){r=r||_t(e.doc,t.line),i||(i=Te(e,r));function F(Qe,et){var ht=De(e,i,Qe,et?"right":"left",O);return et?ht.left=ht.right:ht.right=ht.left,Nr(e,r,ht,n)}var X=At(r,e.doc.direction),Q=t.ch,q=t.sticky;if(Q>=r.text.length?(Q=r.text.length,q="before"):Q<=0&&(Q=0,q="after"),!X)return F(q=="before"?Q-1:Q,q=="before");function pe(Qe,et,ht){var Ct=X[et],Mt=Ct.level==1;return F(ht?Qe-1:Qe,Mt!=ht)}var ye=mt(X,Q,q),Pe=vt,Re=pe(Q,ye,q=="before");return Pe!=null&&(Re.other=pe(Q,Pe,q!="before")),Re}function Jt(e,t){var n=0;t=s(e.doc,t),e.options.lineWrapping||(n=Wn(e.display)*t.ch);var r=_t(e.doc,t.line),i=mn(r)+Ga(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Yt(e,t,n,r,i){var O=Je(e,t,n);return O.xRel=i,r&&(O.outside=r),O}function _r(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return Yt(r.first,0,null,-1,-1);var i=Xr(r,n),O=r.first+r.size-1;if(i>O)return Yt(r.first+r.size-1,_t(r,O).text.length,null,1,1);t<0&&(t=0);for(var F=_t(r,i);;){var X=yn(e,F,i,t,n),Q=ni(F,X.ch+(X.xRel>0||X.outside>0?1:0));if(!Q)return X;var q=Q.find(1);if(q.line==i)return q;F=_t(r,i=q.line)}}function Ur(e,t,n,r){r-=fr(t);var i=t.text.length,O=Dt(function(F){return De(e,n,F-1).bottom<=r},i,0);return i=Dt(function(F){return De(e,n,F).top>r},O,i),{begin:O,end:i}}function jt(e,t,n,r){n||(n=Te(e,t));var i=Nr(e,t,De(e,n,r),"line").top;return Ur(e,t,n,i)}function Hr(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function yn(e,t,n,r,i){i-=mn(t);var O=Te(e,t),F=fr(t),X=0,Q=t.text.length,q=!0,pe=At(t,e.doc.direction);if(pe){var ye=(e.options.lineWrapping?on:$r)(e,t,n,O,pe,r,i);q=ye.level!=1,X=q?ye.from:ye.to-1,Q=q?ye.to:ye.from-1}var Pe=null,Re=null,Qe=Dt(function(ir){var $t=De(e,O,ir);return $t.top+=F,$t.bottom+=F,Hr($t,r,i,!1)?($t.top<=i&&$t.left<=r&&(Pe=ir,Re=$t),!0):!1},X,Q),et,ht,Ct=!1;if(Re){var Mt=r-Re.left<Re.right-r,St=Mt==q;Qe=Pe+(St?0:1),ht=St?"after":"before",et=Mt?Re.left:Re.right}else{!q&&(Qe==Q||Qe==X)&&Qe++,ht=Qe==0?"after":Qe==t.text.length?"before":De(e,O,Qe-(q?1:0)).bottom+F<=i==q?"after":"before";var Ft=Tr(e,Je(n,Qe,ht),"line",t,O);et=Ft.left,Ct=i<Ft.top?-1:i>=Ft.bottom?1:0}return Qe=qe(t.text,Qe,1),Yt(n,Qe,ht,Ct,r-et)}function $r(e,t,n,r,i,O,F){var X=Dt(function(ye){var Pe=i[ye],Re=Pe.level!=1;return Hr(Tr(e,Je(n,Re?Pe.to:Pe.from,Re?"before":"after"),"line",t,r),O,F,!0)},0,i.length-1),Q=i[X];if(X>0){var q=Q.level!=1,pe=Tr(e,Je(n,q?Q.from:Q.to,q?"after":"before"),"line",t,r);Hr(pe,O,F,!0)&&pe.top>F&&(Q=i[X-1])}return Q}function on(e,t,n,r,i,O,F){var X=Ur(e,t,r,F),Q=X.begin,q=X.end;/\s/.test(t.text.charAt(q-1))&&q--;for(var pe=null,ye=null,Pe=0;Pe<i.length;Pe++){var Re=i[Pe];if(Re.from>=q||Re.to<=Q)continue;var Qe=Re.level!=1,et=De(e,r,Qe?Math.min(q,Re.to)-1:Math.max(Q,Re.from)).right,ht=et<O?O-et+1e9:et-O;(!pe||ye>ht)&&(pe=Re,ye=ht)}return pe||(pe=i[i.length-1]),pe.from<Q&&(pe={from:Q,to:pe.to,level:pe.level}),pe.to>q&&(pe={from:pe.from,to:q,level:pe.level}),pe}var nn;function kn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(nn==null){nn=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)nn.appendChild(document.createTextNode("x")),nn.appendChild(a("br"));nn.appendChild(document.createTextNode("x"))}d(e.measure,nn);var n=nn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),f(e.measure),n||1}function Wn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");d(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function xn(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,O=t.gutters.firstChild,F=0;O;O=O.nextSibling,++F){var X=e.display.gutterSpecs[F].className;n[X]=O.offsetLeft+O.clientLeft+i,r[X]=O.clientWidth}return{fixedPos:qn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function qn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Ei(e){var t=kn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Wn(e.display)-3);return function(i){if(Nn(e.doc,i))return 0;var O=0;if(i.widgets)for(var F=0;F<i.widgets.length;F++)i.widgets[F].height&&(O+=i.widgets[F].height);return n?O+(Math.ceil(i.text.length/r)||1)*t:O+t}}function oi(e){var t=e.doc,n=Ei(e);t.iter(function(r){var i=n(r);i!=r.height&&Ar(r,i)})}function Hn(e,t,n,r){var i=e.display;if(!n&&Me(t).getAttribute("cm-not-content")=="true")return null;var O,F,X=i.lineSpace.getBoundingClientRect();try{O=t.clientX-X.left,F=t.clientY-X.top}catch(ye){return null}var Q=_r(e,O,F),q;if(r&&Q.xRel>0&&(q=_t(e.doc,Q.line).text).length==Q.ch){var pe=re(q,q.length,e.options.tabSize)-q.length;Q=Je(Q.line,Math.max(0,Math.round((O-Se(e.display).left)/Wn(e.display))-pe))}return Q}function dn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function sn(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)tr&&hi(e.doc,t)<i.viewTo&&bn(e);else if(n<=i.viewFrom)tr&&wi(e.doc,n+r)>i.viewFrom?bn(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)bn(e);else if(t<=i.viewFrom){var O=xi(e,n,n+r,1);O?(i.view=i.view.slice(O.index),i.viewFrom=O.lineN,i.viewTo+=r):bn(e)}else if(n>=i.viewTo){var F=xi(e,t,t,-1);F?(i.view=i.view.slice(0,F.index),i.viewTo=F.lineN):bn(e)}else{var X=xi(e,t,t,-1),Q=xi(e,n,n+r,1);X&&Q?(i.view=i.view.slice(0,X.index).concat(zr(e,X.lineN,Q.lineN)).concat(i.view.slice(Q.index)),i.viewTo+=r):bn(e)}var q=i.externalMeasured;q&&(n<q.lineN?q.lineN+=r:t<q.lineN+q.size&&(i.externalMeasured=null))}function Cn(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var O=r.view[dn(e,t)];if(O.node==null)return;var F=O.changes||(O.changes=[]);Ee(F,n)==-1&&F.push(n)}function bn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function xi(e,t,n,r){var i=dn(e,t),O,F=e.display.view;if(!tr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var X=e.display.viewFrom,Q=0;Q<i;Q++)X+=F[Q].size;if(X!=t){if(r>0){if(i==F.length-1)return null;O=X+F[i].size-t,i++}else O=X-t;t+=O,n+=O}for(;hi(e.doc,n)!=n;){if(i==(r<0?0:F.length-1))return null;n+=r*F[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Ii(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=zr(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=zr(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(dn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(zr(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,dn(e,n)))),r.viewTo=n}function Ni(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function an(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Ai(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),O=r.selection=document.createDocumentFragment(),F=0;F<n.sel.ranges.length;F++){if(!t&&F==n.sel.primIndex)continue;var X=n.sel.ranges[F];if(X.from().line>=e.display.viewTo||X.to().line<e.display.viewFrom)continue;var Q=X.empty();(Q||e.options.showCursorWhenSelecting)&&Ui(e,X.head,i),Q||tn(e,X,O)}return r}function Ui(e,t,n){var r=Tr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(a("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var O=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));O.style.display="",O.style.left=r.other.left+"px",O.style.top=r.other.top+"px",O.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function un(e,t){return e.top-t.top||e.left-t.left}function tn(e,t,n){var r=e.display,i=e.doc,O=document.createDocumentFragment(),F=Se(e.display),X=F.left,Q=Math.max(r.sizerWidth,fe(e)-r.sizer.offsetLeft)-F.right,q=i.direction=="ltr";function pe(St,Ft,ir,$t){Ft<0&&(Ft=0),Ft=Math.round(Ft),$t=Math.round($t),O.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+St+`px;
|
|
top: `+Ft+"px; width: "+(ir==null?Q-St:ir)+`px;
|
|
height: `+($t-Ft)+"px"))}function ye(St,Ft,ir){var $t=_t(i,St),xr=$t.text.length,cn,Xn;function _n(Bn,mi){return vn(e,Je(St,Bn),"div",$t,mi)}function bi(Bn,mi,Qn){var Vn=jt(e,$t,null,Bn),Fn=mi=="ltr"==(Qn=="after")?"left":"right",Rn=Qn=="after"?Vn.begin:Vn.end-(/\s/.test($t.text.charAt(Vn.end-1))?2:1);return _n(Rn,Fn)[Fn]}var pi=At($t,i.direction);return wt(pi,Ft||0,ir==null?xr:ir,function(Bn,mi,Qn,Vn){var Fn=Qn=="ltr",Rn=_n(Bn,Fn?"left":"right"),gi=_n(mi-1,Fn?"right":"left"),Fa=Ft==null&&Bn==0,ca=ir==null&&mi==xr,ti=Vn==0,Hi=!pi||Vn==pi.length-1;if(gi.top-Rn.top<=3){var Yn=(q?Fa:ca)&&ti,ps=(q?ca:Fa)&&Hi,Zi=Yn?X:(Fn?Rn:gi).left,ya=ps?Q:(Fn?gi:Rn).right;pe(Zi,Rn.top,ya-Zi,Rn.bottom)}else{var ba,di,ja,ms;Fn?(ba=q&&Fa&&ti?X:Rn.left,di=q?Q:bi(Bn,Qn,"before"),ja=q?X:bi(mi,Qn,"after"),ms=q&&ca&&Hi?Q:gi.right):(ba=q?bi(Bn,Qn,"before"):X,di=!q&&Fa&&ti?Q:Rn.right,ja=!q&&ca&&Hi?X:gi.left,ms=q?bi(mi,Qn,"after"):Q),pe(ba,Rn.top,di-ba,Rn.bottom),Rn.bottom<gi.top&&pe(X,Rn.bottom,null,gi.top),pe(ja,gi.top,ms-ja,gi.bottom)}(!cn||un(Rn,cn)<0)&&(cn=Rn),un(gi,cn)<0&&(cn=gi),(!Xn||un(Rn,Xn)<0)&&(Xn=Rn),un(gi,Xn)<0&&(Xn=gi)}),{start:cn,end:Xn}}var Pe=t.from(),Re=t.to();if(Pe.line==Re.line)ye(Pe.line,Pe.ch,Re.ch);else{var Qe=_t(i,Pe.line),et=_t(i,Re.line),ht=jn(Qe)==jn(et),Ct=ye(Pe.line,Pe.ch,ht?Qe.text.length+1:null).end,Mt=ye(Re.line,ht?0:null,Re.ch).start;ht&&(Ct.top<Mt.top-2?(pe(Ct.right,Ct.top,null,Ct.bottom),pe(X,Mt.top,Mt.left,Mt.bottom)):pe(Ct.right,Ct.top,Mt.left-Ct.right,Ct.bottom)),Ct.bottom<Mt.top&&pe(X,Ct.bottom,null,Mt.top)}n.appendChild(O)}function Kn(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||ra(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Co(e){e.state.focused||(e.display.input.focus(),Bi(e))}function Va(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,ra(e))},100)}function Bi(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Xe(e,"focus",e,t),e.state.focused=!0,G(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()),Kn(e)}function ra(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Xe(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 xa(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],O=e.options.lineWrapping,F=void 0,X=0;if(i.hidden)continue;if(W&&j<8){var Q=i.node.offsetTop+i.node.offsetHeight;F=Q-n,n=Q}else{var q=i.node.getBoundingClientRect();F=q.bottom-q.top,!O&&i.text.firstChild&&(X=i.text.firstChild.getBoundingClientRect().right-q.left-1)}var pe=i.line.height-F;if((pe>.005||pe<-.005)&&(Ar(i.line,F),Xa(i.line),i.rest))for(var ye=0;ye<i.rest.length;ye++)Xa(i.rest[ye]);if(X>e.display.sizerWidth){var Pe=Math.ceil(X/Wn(e.display));Pe>e.display.maxLineLength&&(e.display.maxLineLength=Pe,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function Xa(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Ca(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Ga(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,O=Xr(t,r),F=Xr(t,i);if(n&&n.ensure){var X=n.ensure.from.line,Q=n.ensure.to.line;X<O?(O=X,F=Xr(t,mn(_t(t,X))+e.wrapper.clientHeight)):Math.min(Q,t.lastLine())>=F&&(O=Xr(t,mn(_t(t,Q))-e.wrapper.clientHeight),F=Q)}return{from:O,to:Math.max(F,O+1)}}function Xo(e,t){if(nt(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!k){var O=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Ga(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Ae(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(O),O.scrollIntoView(i),e.display.lineSpace.removeChild(O)}}function Yo(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Je(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Je(t.line,t.ch+1,"before"):t);for(var O=0;O<5;O++){var F=!1,X=Tr(e,t),Q=!n||n==t?X:Tr(e,n);i={left:Math.min(X.left,Q.left),top:Math.min(X.top,Q.top)-r,right:Math.max(X.left,Q.left),bottom:Math.max(X.bottom,Q.bottom)+r};var q=Ya(e,i),pe=e.doc.scrollTop,ye=e.doc.scrollLeft;if(q.scrollTop!=null&&(aa(e,q.scrollTop),Math.abs(e.doc.scrollTop-pe)>1&&(F=!0)),q.scrollLeft!=null&&(Ci(e,q.scrollLeft),Math.abs(e.doc.scrollLeft-ye)>1&&(F=!0)),!F)break}return i}function So(e,t){var n=Ya(e,t);n.scrollTop!=null&&aa(e,n.scrollTop),n.scrollLeft!=null&&Ci(e,n.scrollLeft)}function Ya(e,t){var n=e.display,r=kn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,O=J(e),F={};t.bottom-t.top>O&&(t.bottom=t.top+O);var X=e.doc.height+de(n),Q=t.top<r,q=t.bottom>X-r;if(t.top<i)F.scrollTop=Q?0:t.top;else if(t.bottom>i+O){var pe=Math.min(t.top,(q?X:t.bottom)-O);pe!=i&&(F.scrollTop=pe)}var ye=e.options.fixedGutter?0:n.gutters.offsetWidth,Pe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ye,Re=fe(e)-n.gutters.offsetWidth,Qe=t.right-t.left>Re;return Qe&&(t.right=t.left+Re),t.left<10?F.scrollLeft=0:t.left<Pe?F.scrollLeft=Math.max(0,t.left+ye-(Qe?0:10)):t.right>Re+Pe-3&&(F.scrollLeft=t.right+(Qe?0:10)-Re),F}function $a(e,t){if(t==null)return;Sa(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function na(e){Sa(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function ia(e,t,n){(t!=null||n!=null)&&Sa(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function $o(e,t){Sa(e),e.curOp.scrollToPos=t}function Sa(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=Jt(e,t.from),r=Jt(e,t.to);fa(e,n,r,t.margin)}}function fa(e,t,n,r){var i=Ya(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});ia(e,i.scrollLeft,i.scrollTop)}function aa(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;L||ga(e,{top:t}),oa(e,t,!0),L&&ga(e),ma(e,100)}function oa(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Ci(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Rr(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Vi(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+de(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?n:0,docHeight:r,scrollHeight:r+Ae(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Fi=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),He(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),He(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,W&&j<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Fi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var O=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+O)+"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:n?r:0,bottom:t?r:0}},Fi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Fi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Fi.prototype.zeroWidthHack=function(){var e=l&&!R?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ce,this.disableVert=new ce},Fi.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),O=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);O!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Fi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var pa=function(){};pa.prototype.update=function(){return{bottom:0,right:0}},pa.prototype.setScrollLeft=function(){},pa.prototype.setScrollTop=function(){},pa.prototype.clear=function(){};function Xi(e,t){t||(t=Vi(e));var n=e.display.barWidth,r=e.display.barHeight;Ta(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&xa(e),Ta(e,Vi(e)),n=e.display.barWidth,r=e.display.barHeight}function Ta(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var Qa={native:Fi,null:pa};function _a(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&g(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Qa[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),He(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?Ci(e,t):aa(e,t)},e),e.display.scrollbars.addClass&&G(e.display.wrapper,e.display.scrollbars.addClass)}var Ja=0;function ji(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ja},yi(e.curOp)}function Yi(e){var t=e.curOp;t&&Ea(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;To(n)})}function To(e){for(var t=e.ops,n=0;n<t.length;n++)Qo(t[n]);for(var r=0;r<t.length;r++)Jo(t[r]);for(var i=0;i<t.length;i++)Zo(t[i]);for(var O=0;O<t.length;O++)Za(t[O]);for(var F=0;F<t.length;F++)qo(t[F])}function Qo(e){var t=e.cm,n=t.display;_o(t),e.updateMaxLine&&An(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Si(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Jo(e){e.updatedDisplay=e.mustUpdate&&$i(e.cm,e.update)}function Zo(e){var t=e.cm,n=t.display;e.updatedDisplay&&xa(t),e.barMeasure=Vi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ge(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Ae(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-fe(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Za(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Ci(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==y();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Xi(t,e.barMeasure),e.updatedDisplay&&Jr(t,e.barMeasure),e.selectionChanged&&Kn(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Co(e.cm)}function qo(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&wa(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&oa(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Ci(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=Yo(t,s(r,e.scrollToPos.from),s(r,e.scrollToPos.to),e.scrollToPos.margin);Xo(t,i)}var O=e.maybeHiddenMarkers,F=e.maybeUnhiddenMarkers;if(O)for(var X=0;X<O.length;++X)O[X].lines.length||Xe(O[X],"hide");if(F)for(var Q=0;Q<F.length;++Q)F[Q].lines.length&&Xe(F[Q],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Xe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function si(e,t){if(e.curOp)return t();ji(e);try{return t()}finally{Yi(e)}}function Mn(e,t){return function(){if(e.curOp)return t.apply(e,arguments);ji(e);try{return t.apply(e,arguments)}finally{Yi(e)}}}function $n(e){return function(){if(this.curOp)return e.apply(this,arguments);ji(this);try{return e.apply(this,arguments)}finally{Yi(this)}}}function Pn(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);ji(t);try{return e.apply(this,arguments)}finally{Yi(t)}}}function ma(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,V(es,e))}function es(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=ze(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(O){if(r.line>=e.display.viewFrom){var F=O.styles,X=O.text.length>e.options.maxHighlightLength?Lr(t.mode,r.state):null,Q=ae(e,O,r,!0);X&&(r.state=X),O.styles=Q.styles;var q=O.styleClasses,pe=Q.classes;pe?O.styleClasses=pe:q&&(O.styleClasses=null);for(var ye=!F||F.length!=O.styles.length||q!=pe&&(!q||!pe||q.bgClass!=pe.bgClass||q.textClass!=pe.textClass),Pe=0;!ye&&Pe<F.length;++Pe)ye=F[Pe]!=O.styles[Pe];ye&&i.push(r.line),O.stateAfter=r.save(),r.nextLine()}else O.text.length<=e.options.maxHighlightLength&>(e,O.text,r),O.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return ma(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&si(e,function(){for(var O=0;O<i.length;O++)Cn(e,i[O],"text")})}var Si=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Ca(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=fe(e),this.force=n,this.dims=xn(e),this.events=[]};Si.prototype.signal=function(e,t){ve(e,t)&&this.events.push(arguments)},Si.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Xe.apply(null,this.events[e])};function _o(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Ae(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ae(e)+"px",t.scrollbarsClipped=!0)}function wo(e){if(e.hasFocus())return null;var t=y();if(!t||!b(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&b(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function Ao(e){if(!e||!e.activeElt||e.activeElt==y())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&b(document.body,e.anchorNode)&&b(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function $i(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return bn(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&Ni(e)==0)return!1;zn(e)&&(bn(e),t.dims=xn(e));var i=r.first+r.size,O=Math.max(t.visible.from-e.options.viewportMargin,r.first),F=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<O&&O-n.viewFrom<20&&(O=Math.max(r.first,n.viewFrom)),n.viewTo>F&&n.viewTo-F<20&&(F=Math.min(i,n.viewTo)),tr&&(O=hi(e.doc,O),F=wi(e.doc,F));var X=O!=n.viewFrom||F!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Ii(e,O,F),n.viewOffset=mn(_t(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var Q=Ni(e);if(!X&&Q==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var q=wo(e);return Q>4&&(n.lineDiv.style.display="none"),Oo(e,n.updateLineNumbers,t.dims),Q>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,Ao(q),f(n.cursorDiv),f(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,X&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ma(e,400)),n.updateLineNumbers=null,!0}function wa(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==fe(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+de(e.display)-J(e),n.top)}),t.visible=Ca(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Ca(e.display,e.doc,n));if(!$i(e,t))break;xa(e);var i=Vi(e);an(e),Xi(e,i),Jr(e,i),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 ga(e,t){var n=new Si(e,t);if($i(e,n)){xa(e),wa(e,n);var r=Vi(e);an(e),Xi(e,r),Jr(e,r),n.finish()}}function Oo(e,t,n){var r=e.display,i=e.options.lineNumbers,O=r.lineDiv,F=O.firstChild;function X(Qe){var et=Qe.nextSibling;return P&&l&&e.display.currentWheelTarget==Qe?Qe.style.display="none":Qe.parentNode.removeChild(Qe),et}for(var Q=r.view,q=r.viewFrom,pe=0;pe<Q.length;pe++){var ye=Q[pe];if(!ye.hidden)if(!ye.node||ye.node.parentNode!=O){var Pe=Eo(e,ye,q,n);O.insertBefore(Pe,F)}else{for(;F!=ye.node;)F=X(F);var Re=i&&t!=null&&t<=q&&ye.lineNumber;ye.changes&&(Ee(ye.changes,"gutter")>-1&&(Re=!1),yo(e,ye,q,n)),Re&&(f(ye.lineNumber),ye.lineNumber.appendChild(document.createTextNode(Yr(e.options,q)))),F=ye.node.nextSibling}q+=ye.size}for(;F;)F=X(F)}function Aa(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Jr(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+Ae(e)+"px"}function Rr(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=qn(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,O=r+"px",F=0;F<n.length;F++)if(!n[F].hidden){e.options.fixedGutter&&(n[F].gutter&&(n[F].gutter.style.left=O),n[F].gutterBackground&&(n[F].gutterBackground.style.left=O));var X=n[F].alignable;if(X)for(var Q=0;Q<X.length;Q++)X[Q].style.left=O}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function zn(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=Yr(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(a("div",[a("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),O=i.firstChild.offsetWidth,F=i.offsetWidth-O;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(O,r.lineGutter.offsetWidth-F)+1,r.lineNumWidth=r.lineNumInnerWidth+F,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Aa(e.display),!0}return!1}function li(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var O=e[i],F=null;if(typeof O!="string"&&(F=O.style,O=O.className),O=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:O,style:F})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function sa(e){var t=e.gutters,n=e.gutterSpecs;f(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],O=i.className,F=i.style,X=t.appendChild(a("div",null,"CodeMirror-gutter "+O));F&&(X.style.cssText=F),O=="CodeMirror-linenumbers"&&(e.lineGutter=X,X.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Aa(e)}function Ri(e){sa(e.display),sn(e),Rr(e)}function va(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=C("div",null,"CodeMirror-code"),i.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=a("div",null,"CodeMirror-cursors"),i.measure=a("div",null,"CodeMirror-measure"),i.lineMeasure=a("div",null,"CodeMirror-measure"),i.lineSpace=C("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var O=C("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[O],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+we+"px; width: 1px;"),i.gutters=a("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=a("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=a("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),W&&j<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!P&&!(L&&o)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=li(r.gutters,r.lineNumbers),sa(i),n.init(i)}var Wi=0,Gn=null;W?Gn=-.53:L?Gn=15:E?Gn=-.7:M&&(Gn=-1/3);function Oa(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function qa(e){var t=Oa(e);return t.x*=Gn,t.y*=Gn,t}function eo(e,t){var n=Oa(t),r=n.x,i=n.y,O=e.display,F=O.scroller,X=F.scrollWidth>F.clientWidth,Q=F.scrollHeight>F.clientHeight;if(!(r&&X||i&&Q))return;if(i&&l&&P){e:for(var q=t.target,pe=O.view;q!=F;q=q.parentNode)for(var ye=0;ye<pe.length;ye++)if(pe[ye].node==q){e.display.currentWheelTarget=q;break e}}if(r&&!L&&!_&&Gn!=null){i&&Q&&aa(e,Math.max(0,F.scrollTop+i*Gn)),Ci(e,Math.max(0,F.scrollLeft+r*Gn)),(!i||i&&Q)&&ne(t),O.wheelStartX=null;return}if(i&&Gn!=null){var Pe=i*Gn,Re=e.doc.scrollTop,Qe=Re+O.wrapper.clientHeight;Pe<0?Re=Math.max(0,Re+Pe-50):Qe=Math.min(e.doc.height,Qe+Pe+50),ga(e,{top:Re,bottom:Qe})}Wi<20&&(O.wheelStartX==null?(O.wheelStartX=F.scrollLeft,O.wheelStartY=F.scrollTop,O.wheelDX=r,O.wheelDY=i,setTimeout(function(){if(O.wheelStartX==null)return;var et=F.scrollLeft-O.wheelStartX,ht=F.scrollTop-O.wheelStartY,Ct=ht&&O.wheelDY&&ht/O.wheelDY||et&&O.wheelDX&&et/O.wheelDX;if(O.wheelStartX=O.wheelStartY=null,!Ct)return;Gn=(Gn*Wi+Ct)/(Wi+1),++Wi},200)):(O.wheelDX+=r,O.wheelDY+=i))}var ui=function(e,t){this.ranges=e,this.primIndex=t};ui.prototype.primary=function(){return this.ranges[this.primIndex]},ui.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 n=this.ranges[t],r=e.ranges[t];if(!jr(n.anchor,r.anchor)||!jr(n.head,r.head))return!1}return!0},ui.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Qr(sr(this.ranges[t].anchor),sr(this.ranges[t].head));return new ui(e,this.primIndex)},ui.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},ui.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(Pt(t,r.from())>=0&&Pt(e,r.to())<=0)return n}return-1};var Qr=function(e,t){this.anchor=e,this.head=t};Qr.prototype.from=function(){return Or(this.anchor,this.head)},Qr.prototype.to=function(){return Zt(this.anchor,this.head)},Qr.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Ti(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(Pe,Re){return Pt(Pe.from(),Re.from())}),n=Ee(t,i);for(var O=1;O<t.length;O++){var F=t[O],X=t[O-1],Q=Pt(X.to(),F.from());if(r&&!F.empty()?Q>0:Q>=0){var q=Or(X.from(),F.from()),pe=Zt(X.to(),F.to()),ye=X.empty()?F.from()==F.head:X.from()==X.head;O<=n&&--n,t.splice(--O,2,new Qr(ye?pe:q,ye?q:pe))}}return new ui(t,n)}function Li(e,t){return new ui([new Qr(e,t||e)],0)}function Di(e){return e.text?Je(e.from.line+e.text.length-1,ke(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function to(e,t){if(Pt(e,t.from)<0)return e;if(Pt(e,t.to)<=0)return Di(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Di(t).ch-t.to.ch),Je(n,r)}function ka(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new Qr(to(i.anchor,t),to(i.head,t)))}return Ti(e.cm,n,e.sel.primIndex)}function ko(e,t,n){return e.line==t.line?Je(n.line,e.ch-t.ch+n.ch):Je(n.line+(e.line-t.line),e.ch)}function Ro(e,t,n){for(var r=[],i=Je(e.first,0),O=i,F=0;F<t.length;F++){var X=t[F],Q=ko(X.from,i,O),q=ko(Di(X),i,O);if(i=X.to,O=q,n=="around"){var pe=e.sel.ranges[F],ye=Pt(pe.head,pe.anchor)<0;r[F]=new Qr(ye?q:Q,ye?Q:q)}else r[F]=new Qr(Q,Q)}return new ui(r,e.sel.primIndex)}function Qi(e){e.doc.mode=Gr(e.options,e.doc.modeOption),ro(e)}function ro(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,ma(e,100),e.state.modeGen++,e.curOp&&sn(e)}function gs(e,t){return t.from.ch==0&&t.to.ch==0&&ke(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ts(e,t,n,r){function i(Mt){return n?n[Mt]:null}function O(Mt,St,Ft){ii(Mt,St,Ft,r),On(Mt,"change",Mt,t)}function F(Mt,St){for(var Ft=[],ir=Mt;ir<St;++ir)Ft.push(new Tn(q[ir],i(ir),r));return Ft}var X=t.from,Q=t.to,q=t.text,pe=_t(e,X.line),ye=_t(e,Q.line),Pe=ke(q),Re=i(q.length-1),Qe=Q.line-X.line;if(t.full)e.insert(0,F(0,q.length)),e.remove(q.length,e.size-q.length);else if(gs(e,t)){var et=F(0,q.length-1);O(ye,ye.text,Re),Qe&&e.remove(X.line,Qe),et.length&&e.insert(X.line,et)}else if(pe==ye)if(q.length==1)O(pe,pe.text.slice(0,X.ch)+Pe+pe.text.slice(Q.ch),Re);else{var ht=F(1,q.length-1);ht.push(new Tn(Pe+pe.text.slice(Q.ch),Re,r)),O(pe,pe.text.slice(0,X.ch)+q[0],i(0)),e.insert(X.line+1,ht)}else if(q.length==1)O(pe,pe.text.slice(0,X.ch)+q[0]+ye.text.slice(Q.ch),i(0)),e.remove(X.line+1,Qe);else{O(pe,pe.text.slice(0,X.ch)+q[0],i(0)),O(ye,Pe+ye.text.slice(Q.ch),Re);var Ct=F(1,q.length-1);Qe>1&&e.remove(X.line+1,Qe-1),e.insert(X.line+1,Ct)}On(e,"change",e,t)}function la(e,t,n){function r(i,O,F){if(i.linked)for(var X=0;X<i.linked.length;++X){var Q=i.linked[X];if(Q.doc==O)continue;var q=F&&Q.sharedHist;if(n&&!q)continue;t(Q.doc,q),r(Q.doc,i,q)}}r(e,null,!0)}function vs(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,oi(e),Qi(e),ys(e),e.options.lineWrapping||An(e),e.options.mode=t.modeOption,sn(e)}function ys(e){(e.doc.direction=="rtl"?G:g)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){si(e,function(){ys(e),sn(e)})}function Lo(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 rs(e,t){var n={from:sr(t.from),to:Di(t),text:Vr(e,t.from,t.to)};return xs(e,n,t.from.line,t.to.line+1),la(e,function(r){return xs(r,n,t.from.line,t.to.line+1)},!0),n}function bs(e){for(;e.length;){var t=ke(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return bs(e.done),ke(e.done);if(e.done.length&&!ke(e.done).ranges)return ke(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),ke(e.done)}function Es(e,t,n,r){var i=e.history;i.undone.length=0;var O=+new Date,F,X;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>O-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(F=pl(i,i.lastOp==r)))X=ke(F.changes),Pt(t.from,t.to)==0&&Pt(t.from,X.to)==0?X.to=Di(t):F.changes.push(rs(e,t));else{var Q=ke(i.done);for((!Q||!Q.ranges)&&Do(e.sel,i.done),F={changes:[rs(e,t)],generation:i.generation},i.done.push(F);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=O,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,X||Xe(e,"historyAdded")}function ml(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,O=r&&r.origin;n==i.lastSelOp||O&&i.lastSelOrigin==O&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==O||ml(e,O,ke(i.done),t))?i.done[i.done.length-1]=t:Do(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=O,i.lastSelOp=n,r&&r.clearRedo!==!1&&bs(i.undone)}function Do(e,t){var n=ke(t);n&&n.ranges&&n.equals(e)||t.push(e)}function xs(e,t,n,r){var i=t["spans_"+e.id],O=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(F){F.markedSpans&&((i||(i=t["spans_"+e.id]={}))[O]=F.markedSpans),++O})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function Cs(e,t){var n=yl(e,t),r=hn(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var O=n[i],F=r[i];if(O&&F){e:for(var X=0;X<F.length;++X){for(var Q=F[X],q=0;q<O.length;++q)if(O[q].marker==Q.marker)continue e;O.push(Q)}}else F&&(n[i]=F)}return n}function Ra(e,t,n){for(var r=[],i=0;i<e.length;++i){var O=e[i];if(O.ranges){r.push(n?ui.prototype.deepCopy.call(O):O);continue}var F=O.changes,X=[];r.push({changes:X});for(var Q=0;Q<F.length;++Q){var q=F[Q],pe=void 0;if(X.push({from:q.from,to:q.to,text:q.text}),t)for(var ye in q)(pe=ye.match(/^spans_(\d+)$/))&&(Ee(t,Number(pe[1]))>-1&&(ke(X)[ye]=q[ye],delete q[ye]))}}return r}function ns(e,t,n,r){if(r){var i=e.anchor;if(n){var O=Pt(t,i)<0;O!=Pt(n,i)<0?(i=t,t=n):O!=Pt(t,n)<0&&(t=n)}return new Qr(i,t)}else return new Qr(n||t,t)}function Mo(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),ei(e,new ui([ns(e.sel.primary(),t,n,i)],0),r)}function Ss(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),O=0;O<e.sel.ranges.length;O++)r[O]=ns(e.sel.ranges[O],t[O],null,i);var F=Ti(e.cm,r,e.sel.primIndex);ei(e,F,n)}function is(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,ei(e,Ti(e.cm,i,e.sel.primIndex),r)}function Ts(e,t,n,r){ei(e,Li(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var O=0;O<i.length;O++)this.ranges[O]=new Qr(s(e,i[O].anchor),s(e,i[O].head))},origin:n&&n.origin};return Xe(e,"beforeSelectionChange",e,r),e.cm&&Xe(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Ti(e.cm,r.ranges,r.ranges.length-1):t}function _s(e,t,n){var r=e.history.done,i=ke(r);i&&i.ranges?(r[r.length-1]=t,Po(e,t,n)):ei(e,t,n)}function ei(e,t,n){Po(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Po(e,t,n){(ve(e,"beforeSelectionChange")||e.cm&&ve(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(Pt(t.primary().head,e.sel.primary().head)<0?-1:1);ws(e,Os(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&na(e.cm)}function ws(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,_e(e.cm)),On(e,"cursorActivity",e)}function As(e){ws(e,Os(e,e.sel,null,!1))}function Os(e,t,n,r){for(var i,O=0;O<t.ranges.length;O++){var F=t.ranges[O],X=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[O],Q=Io(e,F.anchor,X&&X.anchor,n,r),q=Io(e,F.head,X&&X.head,n,r);(i||Q!=F.anchor||q!=F.head)&&(i||(i=t.ranges.slice(0,O)),i[O]=new Qr(Q,q))}return i?Ti(e.cm,i,t.primIndex):t}function La(e,t,n,r,i){var O=_t(e,t.line);if(O.markedSpans)for(var F=0;F<O.markedSpans.length;++F){var X=O.markedSpans[F],Q=X.marker,q="selectLeft"in Q?!Q.selectLeft:Q.inclusiveLeft,pe="selectRight"in Q?!Q.selectRight:Q.inclusiveRight;if((X.from==null||(q?X.from<=t.ch:X.from<t.ch))&&(X.to==null||(pe?X.to>=t.ch:X.to>t.ch))){if(i&&(Xe(Q,"beforeCursorEnter"),Q.explicitlyCleared))if(O.markedSpans){--F;continue}else break;if(!Q.atomic)continue;if(n){var ye=Q.find(r<0?1:-1),Pe=void 0;if((r<0?pe:q)&&(ye=ks(e,ye,-r,ye&&ye.line==t.line?O:null)),ye&&ye.line==t.line&&(Pe=Pt(ye,n))&&(r<0?Pe<0:Pe>0))return La(e,ye,t,r,i)}var Re=Q.find(r<0?-1:1);return(r<0?q:pe)&&(Re=ks(e,Re,r,Re.line==t.line?O:null)),Re?La(e,Re,t,r,i):null}}return t}function Io(e,t,n,r,i){var O=r||1,F=La(e,t,n,O,i)||!i&&La(e,t,n,O,!0)||La(e,t,n,-O,i)||!i&&La(e,t,n,-O,!0);return F||(e.cantEdit=!0,Je(e.first,0))}function ks(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?s(e,Je(t.line-1)):null:n>0&&t.ch==(r||_t(e,t.line)).text.length?t.line<e.first+e.size-1?Je(t.line+1,0):null:new Je(t.line,t.ch+n)}function Rs(e){e.setSelection(Je(e.firstLine(),0),Je(e.lastLine()),Ne)}function Ls(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,O,F,X){i&&(r.from=s(e,i)),O&&(r.to=s(e,O)),F&&(r.text=F),X!==void 0&&(r.origin=X)}),Xe(e,"beforeChange",e,r),e.cm&&Xe(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 Da(e,t,n){if(e.cm){if(!e.cm.curOp)return Mn(e.cm,Da)(e,t,n);if(e.cm.state.suppressEdits)return}if((ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"))&&(t=Ls(e,t,!0),!t))return;var r=Qt&&!n&&vi(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Ds(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Ds(e,t)}function Ds(e,t){if(t.text.length==1&&t.text[0]==""&&Pt(t.from,t.to)==0)return;var n=ka(e,t);Es(e,t,n,e.cm?e.cm.curOp.id:NaN),no(e,t,n,hn(e,t));var r=[];la(e,function(i,O){!O&&Ee(r,i.history)==-1&&(Ns(i.history,t),r.push(i.history)),no(i,t,null,hn(i,t))})}function No(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,O,F=e.sel,X=t=="undo"?i.done:i.undone,Q=t=="undo"?i.undone:i.done,q=0;q<X.length&&!(O=X[q],n?O.ranges&&!O.equals(e.sel):!O.ranges);q++);if(q==X.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(O=X.pop(),O.ranges){if(Do(O,Q),n&&!O.equals(e.sel)){ei(e,O,{clearRedo:!1});return}F=O}else if(r){X.push(O);return}else break;var pe=[];Do(F,Q),Q.push({changes:pe,generation:i.generation}),i.generation=O.generation||++i.maxGeneration;for(var ye=ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"),Pe=function(et){var ht=O.changes[et];if(ht.origin=t,ye&&!Ls(e,ht,!1))return X.length=0,{};pe.push(rs(e,ht));var Ct=et?ka(e,ht):ke(X);no(e,ht,Ct,Cs(e,ht)),!et&&e.cm&&e.cm.scrollIntoView({from:ht.from,to:Di(ht)});var Mt=[];la(e,function(St,Ft){!Ft&&Ee(Mt,St.history)==-1&&(Ns(St.history,ht),Mt.push(St.history)),no(St,ht,null,Cs(St,ht))})},Re=O.changes.length-1;Re>=0;--Re){var Qe=Pe(Re);if(Qe)return Qe.v}}function Ms(e,t){if(t==0)return;if(e.first+=t,e.sel=new ui(dt(e.sel.ranges,function(i){return new Qr(Je(i.anchor.line+t,i.anchor.ch),Je(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){sn(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Cn(e.cm,r,"gutter")}}function no(e,t,n,r){if(e.cm&&!e.cm.curOp)return Mn(e.cm,no)(e,t,n,r);if(t.to.line<e.first){Ms(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 i=t.text.length-1-(e.first-t.from.line);Ms(e,i),t={from:Je(e.first,0),to:Je(t.to.line+i,t.to.ch),text:[ke(t.text)],origin:t.origin}}var O=e.lastLine();t.to.line>O&&(t={from:t.from,to:Je(O,_t(e,O).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Vr(e,t.from,t.to),n||(n=ka(e,t)),e.cm?El(e.cm,t,r):ts(e,t,r),Po(e,n,Ne),e.cantEdit&&Io(e,Je(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,O=t.from,F=t.to,X=!1,Q=O.line;e.options.lineWrapping||(Q=Kt(jn(_t(r,O.line))),r.iter(Q,F.line+1,function(Re){if(Re==i.maxLine)return X=!0,!0})),r.sel.contains(t.from,t.to)>-1&&_e(e),ts(r,t,n,Ei(e)),e.options.lineWrapping||(r.iter(Q,O.line+t.text.length,function(Re){var Qe=Wr(Re);Qe>i.maxLineLength&&(i.maxLine=Re,i.maxLineLength=Qe,i.maxLineChanged=!0,X=!1)}),X&&(e.curOp.updateMaxLine=!0)),Rt(r,O.line),ma(e,400);var q=t.text.length-(F.line-O.line)-1;t.full?sn(e):O.line==F.line&&t.text.length==1&&!gs(e.doc,t)?Cn(e,O.line,"text"):sn(e,O.line,F.line+1,q);var pe=ve(e,"changes"),ye=ve(e,"change");if(ye||pe){var Pe={from:O,to:F,text:t.text,removed:t.removed,origin:t.origin};ye&&On(e,"change",e,Pe),pe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Pe)}e.display.selForContextMenu=null}function Ma(e,t,n,r,i){var O;r||(r=n),Pt(r,n)<0&&(O=[r,n],n=O[0],r=O[1]),typeof t=="string"&&(t=e.splitLines(t)),Da(e,{from:n,to:r,text:t,origin:i})}function Ps(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Is(e,t,n,r){for(var i=0;i<e.length;++i){var O=e[i],F=!0;if(O.ranges){O.copied||(O=e[i]=O.deepCopy(),O.copied=!0);for(var X=0;X<O.ranges.length;X++)Ps(O.ranges[X].anchor,t,n,r),Ps(O.ranges[X].head,t,n,r);continue}for(var Q=0;Q<O.changes.length;++Q){var q=O.changes[Q];if(n<q.from.line)q.from=Je(q.from.line+r,q.from.ch),q.to=Je(q.to.line+r,q.to.ch);else if(t<=q.to.line){F=!1;break}}F||(e.splice(0,i+1),i=0)}}function Ns(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Is(e.done,n,r,i),Is(e.undone,n,r,i)}function io(e,t,n,r){var i=t,O=t;return typeof t=="number"?O=_t(e,U(e,t)):i=Kt(t),i==null?null:(r(O,i)&&e.cm&&Cn(e.cm,i,n),O)}function ao(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}ao.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,Ln(i),On(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,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,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function oo(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}oo.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var O=Math.min(t,i-e),F=r.height;if(r.removeInner(e,O),this.height-=F-r.height,i==O&&(this.children.splice(n--,1),r.parent=null),(t-=O)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof ao))){var X=[];this.collapse(X),this.children=[new ao(X)],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,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],O=i.chunkSize();if(e<=O){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var F=i.lines.length%25+25,X=F;X<i.lines.length;){var Q=new ao(i.lines.slice(X,X+=25));i.height-=Q.height,this.children.splice(++r,0,Q),Q.parent=this}i.lines=i.lines.slice(0,F),this.maybeSpill()}break}e-=O}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new oo(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=Ee(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new oo(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],O=i.chunkSize();if(e<O){var F=Math.min(t,O-e);if(i.iterN(e,F,n))return!0;if((t-=F)==0)break;e=0}else e-=O}}};var so=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};so.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Kt(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var O=ta(this);Ar(n,Math.max(0,n.height-O)),e&&(si(e,function(){Us(e,n,-O),Cn(e,r,"widget")}),On(e,"lineWidgetCleared",e,this,r))},so.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ta(this)-t;if(!i)return;Nn(this.doc,r)||Ar(r,r.height+i),n&&si(n,function(){n.curOp.forceUpdate=!0,Us(n,r,i),On(n,"lineWidgetChanged",n,e,Kt(r))})},Ce(so);function Us(e,t,n){mn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&$a(e,n)}function xl(e,t,n,r){var i=new so(e,n,r),O=e.cm;return O&&i.noHScroll&&(O.display.alignWidgets=!0),io(e,t,"widget",function(F){var X=F.widgets||(F.widgets=[]);if(i.insertAt==null?X.push(i):X.splice(Math.min(X.length-1,Math.max(0,i.insertAt)),0,i),i.line=F,O&&!Nn(e,F)){var Q=mn(F)<e.scrollTop;Ar(F,F.height+ta(i)),Q&&$a(O,i.height),O.curOp.forceUpdate=!0}return!0}),O&&On(O,"lineWidgetAdded",O,i,typeof t=="number"?t:Kt(t)),i}var Bs=0,ua=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Bs};ua.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&ji(e),ve(this,"clear")){var n=this.find();n&&On(this,"clear",n.from,n.to)}for(var r=null,i=null,O=0;O<this.lines.length;++O){var F=this.lines[O],X=En(F.markedSpans,this);e&&!this.collapsed?Cn(e,Kt(F),"text"):e&&(X.to!=null&&(i=Kt(F)),X.from!=null&&(r=Kt(F))),F.markedSpans=Jn(F.markedSpans,X),X.from==null&&this.collapsed&&!Nn(this.doc,F)&&e&&Ar(F,kn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Q=0;Q<this.lines.length;++Q){var q=jn(this.lines[Q]),pe=Wr(q);pe>e.display.maxLineLength&&(e.display.maxLine=q,e.display.maxLineLength=pe,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&sn(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&As(e.doc)),e&&On(e,"markerCleared",e,this,r,i),t&&Yi(e),this.parent&&this.parent.clear()},ua.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var O=this.lines[i],F=En(O.markedSpans,this);if(F.from!=null&&(n=Je(t?O:Kt(O),F.from),e==-1))return n;if(F.to!=null&&(r=Je(t?O:Kt(O),F.to),e==1))return r}return n&&{from:n,to:r}},ua.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;si(r,function(){var i=t.line,O=Kt(t.line),F=Oe(r,O);if(F&&(vr(F),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Nn(n.doc,i)&&n.height!=null){var X=n.height;n.height=null;var Q=ta(n)-X;Q&&Ar(i,i.height+Q)}On(r,"markerChanged",r,e)})},ua.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||Ee(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ua.prototype.detachLine=function(e){if(this.lines.splice(Ee(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},Ce(ua);function Pa(e,t,n,r,i){if(r&&r.shared)return Cl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Mn(e.cm,Pa)(e,t,n,r,i);var O=new ua(e,i),F=Pt(t,n);if(r&&H(r,O,!1),F>0||F==0&&O.clearWhenEmpty!==!1)return O;if(O.replacedWith&&(O.collapsed=!0,O.widgetNode=C("span",[O.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||O.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(O.widgetNode.insertLeft=!0)),O.collapsed){if(gn(e,t.line,t,n,O)||t.line!=n.line&&gn(e,n.line,t,n,O))throw new Error("Inserting collapsed marker partially overlapping an existing one");Mr()}O.addToHistory&&Es(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var X=t.line,Q=e.cm,q;if(e.iter(X,n.line+1,function(ye){Q&&O.collapsed&&!Q.options.lineWrapping&&jn(ye)==Q.display.maxLine&&(q=!0),O.collapsed&&X!=t.line&&Ar(ye,0),ri(ye,new rr(O,X==t.line?t.ch:null,X==n.line?n.ch:null)),++X}),O.collapsed&&e.iter(t.line,n.line+1,function(ye){Nn(e,ye)&&Ar(ye,0)}),O.clearOnEnter&&He(O,"beforeCursorEnter",function(){return O.clear()}),O.readOnly&&(dr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),O.collapsed&&(O.id=++Bs,O.atomic=!0),Q){if(q&&(Q.curOp.updateMaxLine=!0),O.collapsed)sn(Q,t.line,n.line+1);else if(O.className||O.startStyle||O.endStyle||O.css||O.attributes||O.title)for(var pe=t.line;pe<=n.line;pe++)Cn(Q,pe,"text");O.atomic&&As(Q.doc),On(Q,"markerAdded",Q,O)}return O}var lo=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};lo.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();On(this,"clear")},lo.prototype.find=function(e,t){return this.primary.find(e,t)},Ce(lo);function Cl(e,t,n,r,i){r=H(r),r.shared=!1;var O=[Pa(e,t,n,r,i)],F=O[0],X=r.widgetNode;return la(e,function(Q){X&&(r.widgetNode=X.cloneNode(!0)),O.push(Pa(Q,s(Q,t),s(Q,n),r,i));for(var q=0;q<Q.linked.length;++q)if(Q.linked[q].isParent)return;F=ke(O)}),new lo(O,F)}function Fs(e){return e.findMarks(Je(e.first,0),e.clipPos(Je(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),O=e.clipPos(i.from),F=e.clipPos(i.to);if(Pt(O,F)){var X=Pa(e,O,F,r.primary,r.primary.type);r.markers.push(X),X.parent=r}}}function Tl(e){for(var t=function(r){var i=e[r],O=[i.primary.doc];la(i.primary.doc,function(Q){return O.push(Q)});for(var F=0;F<i.markers.length;F++){var X=i.markers[F];Ee(O,X.doc)==-1&&(X.parent=null,i.markers.splice(F--,1))}},n=0;n<e.length;n++)t(n)}var _l=0,fi=function(e,t,n,r,i){if(!(this instanceof fi))return new fi(e,t,n,r,i);n==null&&(n=0),oo.call(this,[new ao([new Tn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var O=Je(n,0);this.sel=Li(O),this.history=new Lo(null),this.id=++_l,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),ts(this,{from:O,to:O,text:e}),ei(this,Li(O),Ne)};fi.prototype=lt(oo.prototype,{constructor:fi,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Fr(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Pn(function(e){var t=Je(this.first,0),n=this.first+this.size-1;Da(this,{from:t,to:Je(n,_t(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&ia(this.cm,0,0),ei(this,Li(t),Ne)}),replaceRange:function(e,t,n,r){t=s(this,t),n=n?s(this,n):t,Ma(this,e,t,n,r)},getRange:function(e,t,n){var r=Vr(this,s(this,e),s(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Zr(this,e))return _t(this,e)},getLineNumber:function(e){return Kt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=_t(this,e)),jn(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(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Pn(function(e,t,n){Ts(this,s(this,typeof e=="number"?Je(e,t||0):e),null,n)}),setSelection:Pn(function(e,t,n){Ts(this,s(this,e),s(this,t||e),n)}),extendSelection:Pn(function(e,t,n){Mo(this,s(this,e),t&&s(this,t),n)}),extendSelections:Pn(function(e,t){Ss(this,B(this,e),t)}),extendSelectionsBy:Pn(function(e,t){var n=dt(this.sel.ranges,e);Ss(this,B(this,n),t)}),setSelections:Pn(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new Qr(s(this,e[i].anchor),s(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),ei(this,Ti(this.cm,r,t),n)}),addSelection:Pn(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Qr(s(this,e),s(this,t||e))),ei(this,Ti(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=Vr(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=Vr(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Pn(function(e,t,n){for(var r=[],i=this.sel,O=0;O<i.ranges.length;O++){var F=i.ranges[O];r[O]={from:F.from(),to:F.to(),text:this.splitLines(e[O]),origin:n}}for(var X=t&&t!="end"&&Ro(this,r,t),Q=r.length-1;Q>=0;Q--)Da(this,r[Q]);X?_s(this,X):this.cm&&na(this.cm)}),undo:Pn(function(){No(this,"undo")}),redo:Pn(function(){No(this,"redo")}),undoSelection:Pn(function(){No(this,"undo",!0)}),redoSelection:Pn(function(){No(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Lo(this.history.maxGeneration),la(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:Ra(this.history.done),undone:Ra(this.history.undone)}},setHistory:function(e){var t=this.history=new Lo(this.history.maxGeneration);t.done=Ra(e.done.slice(0),null,!0),t.undone=Ra(e.undone.slice(0),null,!0)},setGutterMarker:Pn(function(e,t,n){return io(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&ft(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Pn(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&io(t,n,"gutter",function(){return n.gutterMarkers[e]=null,ft(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Zr(this,e))return null;if(t=e,e=_t(this,e),!e)return null}else if(t=Kt(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Pn(function(e,t,n){return io(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(x(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Pn(function(e,t,n){return io(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",O=r[i];if(O)if(n==null)r[i]=null;else{var F=O.match(x(n));if(!F)return!1;var X=F.index+F[0].length;r[i]=O.slice(0,F.index)+(!F.index||X==O.length?"":" ")+O.slice(X)||null}else return!1;return!0})}),addLineWidget:Pn(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Pa(this,s(this,e),s(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={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),Pa(this,e,e,n,"bookmark")},findMarksAt:function(e){e=s(this,e);var t=[],n=_t(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=s(this,e),t=s(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(O){var F=O.markedSpans;if(F)for(var X=0;X<F.length;X++){var Q=F[X];!(Q.to!=null&&i==e.line&&e.ch>=Q.to||Q.from==null&&i!=e.line||Q.from!=null&&i==t.line&&Q.from>=t.ch)&&(!n||n(Q.marker))&&r.push(Q.marker.parent||Q.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var O=i.text.length+r;if(O>e)return t=e,!0;e-=O,++n}),s(this,Je(n,t))},indexFromPos:function(e){e=s(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new fi(Fr(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,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new fi(Fr(this,t,n),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}],Sl(r,Fs(this)),r},unlinkDoc:function(e){if(e instanceof Sn&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Tl(Fs(this));break}if(e.history==this.history){var r=[e.id];la(e,function(i){return r.push(i.id)},!0),e.history=new Lo(null),e.history.done=Ra(this.history.done,r),e.history.undone=Ra(this.history.undone,r)}},iterLinkedDocs:function(e){la(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Tt(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Pn(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)})}),fi.prototype.eachLine=fi.prototype.iter;var js=0;function wl(e){var t=this;if(Ws(t),nt(t,e)||ki(t.display,e))return;ne(e),W&&(js=+new Date);var n=Hn(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,O=Array(i),F=0,X=function(){++F==i&&Mn(t,function(){n=s(t.doc,n);var Re={from:n,to:n,text:t.doc.splitLines(O.filter(function(Qe){return Qe!=null}).join(t.doc.lineSeparator())),origin:"paste"};Da(t.doc,Re),_s(t.doc,Li(s(t.doc,n),s(t.doc,Di(Re))))})()},Q=function(Re,Qe){if(t.options.allowDropFileTypes&&Ee(t.options.allowDropFileTypes,Re.type)==-1){X();return}var et=new FileReader;et.onerror=function(){return X()},et.onload=function(){var ht=et.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(ht)){X();return}O[Qe]=ht,X()},et.readAsText(Re)},q=0;q<r.length;q++)Q(r[q],q);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var pe=e.dataTransfer.getData("Text");if(pe){var ye;if(t.state.draggingText&&!t.state.draggingText.copy&&(ye=t.listSelections()),Po(t.doc,Li(n,n)),ye)for(var Pe=0;Pe<ye.length;++Pe)Ma(t.doc,"",ye[Pe].anchor,ye[Pe].head,"drag");t.replaceSelection(pe,"around","paste"),t.display.input.focus()}}catch(Re){}}}function Al(e,t){if(W&&(!e.state.draggingText||+new Date-js<100)){he(t);return}if(nt(e,t)||ki(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!M){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",_&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),_&&n.parentNode.removeChild(n)}}function Ol(e,t){var n=Hn(e,t);if(!n)return;var r=document.createDocumentFragment();Ui(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),d(e.display.dragCursor,r)}function Ws(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Hs(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var O=0;O<n.length;O++)e(n[O])})}var Ks=!1;function kl(){if(Ks)return;Rl(),Ks=!0}function Rl(){var e;He(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,Hs(Ll)},100))}),He(window,"blur",function(){return Hs(ra)})}function Ll(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var da={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"},uo=0;uo<10;uo++)da[uo+48]=da[uo+96]=String(uo);for(var Uo=65;Uo<=90;Uo++)da[Uo]=String.fromCharCode(Uo);for(var co=1;co<=12;co++)da[co+111]=da[co+63235]="F"+co;var Ji={};Ji.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"},Ji.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"},Ji.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"},Ji.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"]},Ji.default=l?Ji.macDefault:Ji.pcDefault;function Dl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,O,F=0;F<t.length-1;F++){var X=t[F];if(/^(cmd|meta|m)$/i.test(X))O=!0;else if(/^a(lt)?$/i.test(X))n=!0;else if(/^(c|ctrl|control)$/i.test(X))r=!0;else if(/^s(hift)?$/i.test(X))i=!0;else throw new Error("Unrecognized modifier name: "+X)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),O&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Ml(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=dt(n.split(" "),Dl),O=0;O<i.length;O++){var F=void 0,X=void 0;O==i.length-1?(X=i.join(" "),F=r):(X=i.slice(0,O+1).join(" "),F="...");var Q=t[X];if(!Q)t[X]=F;else if(Q!=F)throw new Error("Inconsistent bindings for "+X)}delete e[n]}for(var q in t)e[q]=t[q];return e}function Ia(e,t,n,r){t=Bo(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Ia(e,t.fallthrough,n,r);for(var O=0;O<t.fallthrough.length;O++){var F=Ia(e,t.fallthrough[O],n,r);if(F)return F}}}function zs(e){var t=typeof e=="string"?e:da[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function Gs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(p?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(p?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function Vs(e,t){if(_&&e.keyCode==34&&e.char)return!1;var n=da[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),Gs(n,e,t))}function Bo(e){return typeof e=="string"?Ji[e]:e}function Na(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var O=t(n[i]);r.length&&Pt(O.from,ke(r).to)<=0;){var F=r.pop();if(Pt(F.from,O.from)<0){O.from=F.from;break}}r.push(O)}si(e,function(){for(var X=r.length-1;X>=0;X--)Ma(e.doc,"",r[X].from,r[X].to,"+delete");na(e)})}function as(e,t,n){var r=qe(e.text,t+n,n);return r<0||r>e.text.length?null:r}function os(e,t,n){var r=as(e,t.ch,n);return r==null?null:new Je(t.line,r,n<0?"after":"before")}function ss(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var O=At(n,t.doc.direction);if(O){var F=i<0?ke(O):O[0],X=i<0==(F.level==1),Q=X?"after":"before",q;if(F.level>0||t.doc.direction=="rtl"){var pe=Te(t,n);q=i<0?n.text.length-1:0;var ye=De(t,pe,q).top;q=Dt(function(Pe){return De(t,pe,Pe).top==ye},i<0==(F.level==1)?F.from:F.to-1,q),Q=="before"&&(q=as(n,q,1))}else q=i<0?F.to:F.from;return new Je(r,q,Q)}}return new Je(r,i<0?n.text.length:0,i<0?"before":"after")}function Pl(e,t,n,r){var i=At(t,e.doc.direction);if(!i)return os(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var O=mt(i,n.ch,n.sticky),F=i[O];if(e.doc.direction=="ltr"&&F.level%2==0&&(r>0?F.to>n.ch:F.from<n.ch))return os(t,n,r);var X=function(Ct,Mt){return as(t,Ct instanceof Je?Ct.ch:Ct,Mt)},Q,q=function(Ct){return e.options.lineWrapping?(Q=Q||Te(e,t),jt(e,t,Q,Ct)):{begin:0,end:t.text.length}},pe=q(n.sticky=="before"?X(n,-1):n.ch);if(e.doc.direction=="rtl"||F.level==1){var ye=F.level==1==r<0,Pe=X(n,ye?1:-1);if(Pe!=null&&(ye?Pe<=F.to&&Pe<=pe.end:Pe>=F.from&&Pe>=pe.begin)){var Re=ye?"before":"after";return new Je(n.line,Pe,Re)}}var Qe=function(Ct,Mt,St){for(var Ft=function(cn,Xn){return Xn?new Je(n.line,X(cn,1),"before"):new Je(n.line,cn,"after")};Ct>=0&&Ct<i.length;Ct+=Mt){var ir=i[Ct],$t=Mt>0==(ir.level!=1),xr=$t?St.begin:X(St.end,-1);if(ir.from<=xr&&xr<ir.to)return Ft(xr,$t);if(xr=$t?ir.from:X(ir.to,-1),St.begin<=xr&&xr<St.end)return Ft(xr,$t)}},et=Qe(O+r,r,pe);if(et)return et;var ht=r>0?pe.end:X(pe.begin,-1);return ht!=null&&!(r>0&&ht==t.text.length)&&(et=Qe(r>0?0:i.length-1,r,q(ht)),et)?et:null}var ho={selectAll:Rs,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ne)},killLine:function(e){return Na(e,function(t){if(t.empty()){var n=_t(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Je(t.head.line+1,0)}:{from:t.head,to:Je(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Na(e,function(t){return{from:Je(t.from().line,0),to:s(e.doc,Je(t.to().line+1,0))}})},delLineLeft:function(e){return Na(e,function(t){return{from:Je(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Na(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return Na(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"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(Je(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Je(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return Xs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return Ys(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 n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},We)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},We)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?Ys(e,t.head):r},We)},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=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var O=n[i].from(),F=re(e.getLine(O.line),O.ch,r);t.push(se(r-F%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return si(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,O=_t(e.doc,i.line).text;if(O){if(i.ch==O.length&&(i=new Je(i.line,i.ch-1)),i.ch>0)i=new Je(i.line,i.ch+1),e.replaceRange(O.charAt(i.ch-1)+O.charAt(i.ch-2),Je(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var F=_t(e.doc,i.line-1).text;F&&(i=new Je(i.line,1),e.replaceRange(O.charAt(0)+e.doc.lineSeparator()+F.charAt(F.length-1),Je(i.line-1,F.length-1),i,"+transpose"))}}n.push(new Qr(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return si(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);na(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Xs(e,t){var n=_t(e.doc,t),r=jn(n);return r!=n&&(t=Kt(r)),ss(!0,e,r,t,1)}function Il(e,t){var n=_t(e.doc,t),r=zi(n);return r!=n&&(t=Kt(r)),ss(!0,e,n,t,-1)}function Ys(e,t){var n=Xs(e,t.line),r=_t(e.doc,n.line),i=At(r,e.doc.direction);if(!i||i[0].level==0){var O=Math.max(n.ch,r.text.search(/\S/)),F=t.line==n.line&&t.ch<=O&&t.ch;return Je(n.line,F?0:O,n.sticky)}return n}function Fo(e,t,n){if(typeof t=="string"&&(t=ho[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ye}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Nl(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Ia(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Ia(t,e.options.extraKeys,n,e)||Ia(t,e.options.keyMap,n,e)}var Ul=new ce;function fo(e,t,n,r){var i=e.state.keySeq;if(i){if(zs(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),$s(e,i+" "+t,n,r))return!0}return $s(e,t,n,r)}function $s(e,t,n,r){var i=Nl(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&On(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(ne(n),Kn(e)),!!i}function Qs(e,t){var n=Vs(t,!0);return n?t.shiftKey&&!e.state.keySeq?fo(e,"Shift-"+n,t,function(r){return Fo(e,r,!0)})||fo(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Fo(e,r)}):fo(e,n,t,function(r){return Fo(e,r)}):!1}function Bl(e,t,n){return fo(e,"'"+n+"'",t,function(r){return Fo(e,r,!0)})}var ls=null;function Js(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=y(),nt(t,e))return;W&&j<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=Qs(t,e);_&&(ls=r?n:null,!r&&n==88&&!gr&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),L&&!l&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Fl(t)}function Fl(e){var t=e.display.lineDiv;G(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(g(t,"CodeMirror-crosshair"),Lt(document,"keyup",n),Lt(document,"mouseover",n))}He(document,"keyup",n),He(document,"mouseover",n)}function Zs(e){e.keyCode==16&&(this.doc.sel.shift=!1),nt(this,e)}function qs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(ki(t.display,e)||nt(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(_&&n==ls){ls=null,ne(e);return}if(_&&(!e.which||e.which<10)&&Qs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Bl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,us=function(e,t,n){this.time=e,this.pos=t,this.button=n};us.prototype.compare=function(e,t,n){return this.time+jl>e&&Pt(t,this.pos)==0&&n==this.button};var po,mo;function Wl(e,t){var n=+new Date;return mo&&mo.compare(n,e,t)?(po=mo=null,"triple"):po&&po.compare(n,e,t)?(mo=new us(n,e,t),po=null,"double"):(po=new us(n,e,t),mo=null,"single")}function el(e){var t=this,n=t.display;if(nt(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,ki(n,e)){P||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(ds(t,e))return;var r=Hn(t,e),i=be(e),O=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,O,e))return;i==1?r?zl(t,r,O,e):Me(e)==n.scroller&&ne(e):i==2?(r&&Mo(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(w?t.display.input.onContextMenu(e):Va(t))}function Hl(e,t,n,r,i){var O="Click";return r=="double"?O="Double"+O:r=="triple"&&(O="Triple"+O),O=(t==1?"Left":t==2?"Middle":"Right")+O,fo(e,Gs(O,i),i,function(F){if(typeof F=="string"&&(F=ho[F]),!F)return!1;var X=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),X=F(e,n)!=Ye}finally{e.state.suppressEdits=!1}return X})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var O=u?n.shiftKey&&n.metaKey:n.altKey;i.unit=O?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=l?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(l?n.altKey:n.ctrlKey)),i}function zl(e,t,n,r){W?setTimeout(V(Co,e),0):e.curOp.focus=y();var i=Kl(e,n,r),O=e.doc.sel,F;e.options.dragDrop&&Le&&!e.isReadOnly()&&n=="single"&&(F=O.contains(t))>-1&&(Pt((F=O.ranges[F]).from(),t)<0||t.xRel>0)&&(Pt(F.to(),t)>0||t.xRel<0)?Gl(e,r,t,i):Vl(e,r,t,i)}function Gl(e,t,n,r){var i=e.display,O=!1,F=Mn(e,function(q){P&&(i.scroller.draggable=!1),e.state.draggingText=!1,Lt(i.wrapper.ownerDocument,"mouseup",F),Lt(i.wrapper.ownerDocument,"mousemove",X),Lt(i.scroller,"dragstart",Q),Lt(i.scroller,"drop",F),O||(ne(q),r.addNew||Mo(e.doc,n,null,null,r.extend),P&&!M||W&&j==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),X=function(q){O=O||Math.abs(t.clientX-q.clientX)+Math.abs(t.clientY-q.clientY)>=10},Q=function(){return O=!0};P&&(i.scroller.draggable=!0),e.state.draggingText=F,F.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),He(i.wrapper.ownerDocument,"mouseup",F),He(i.wrapper.ownerDocument,"mousemove",X),He(i.scroller,"dragstart",Q),He(i.scroller,"drop",F),Va(e),setTimeout(function(){return i.input.focus()},20)}function tl(e,t,n){if(n=="char")return new Qr(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Qr(Je(t.line,0),s(e.doc,Je(t.line+1,0)));var r=n(e,t);return new Qr(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,O=e.doc;ne(t);var F,X,Q=O.sel,q=Q.ranges;if(r.addNew&&!r.extend?(X=O.sel.contains(n),X>-1?F=q[X]:F=new Qr(n,n)):(F=O.sel.primary(),X=O.sel.primIndex),r.unit=="rectangle")r.addNew||(F=new Qr(n,n)),n=Hn(e,t,!0,!0),X=-1;else{var pe=tl(e,n,r.unit);r.extend?F=ns(F,pe.anchor,pe.head,r.extend):F=pe}r.addNew?X==-1?(X=q.length,ei(O,Ti(e,q.concat([F]),X),{scroll:!1,origin:"*mouse"})):q.length>1&&q[X].empty()&&r.unit=="char"&&!r.extend?(ei(O,Ti(e,q.slice(0,X).concat(q.slice(X+1)),0),{scroll:!1,origin:"*mouse"}),Q=O.sel):is(O,X,F,Ie):(X=0,ei(O,new ui([F],0),Ie),Q=O.sel);var ye=n;function Pe(St){if(Pt(ye,St)==0)return;if(ye=St,r.unit=="rectangle"){for(var Ft=[],ir=e.options.tabSize,$t=re(_t(O,n.line).text,n.ch,ir),xr=re(_t(O,St.line).text,St.ch,ir),cn=Math.min($t,xr),Xn=Math.max($t,xr),_n=Math.min(n.line,St.line),bi=Math.min(e.lastLine(),Math.max(n.line,St.line));_n<=bi;_n++){var pi=_t(O,_n).text,Bn=Ue(pi,cn,ir);cn==Xn?Ft.push(new Qr(Je(_n,Bn),Je(_n,Bn))):pi.length>Bn&&Ft.push(new Qr(Je(_n,Bn),Je(_n,Ue(pi,Xn,ir))))}Ft.length||Ft.push(new Qr(n,n)),ei(O,Ti(e,Q.ranges.slice(0,X).concat(Ft),X),{origin:"*mouse",scroll:!1}),e.scrollIntoView(St)}else{var mi=F,Qn=tl(e,St,r.unit),Vn=mi.anchor,Fn;Pt(Qn.anchor,Vn)>0?(Fn=Qn.head,Vn=Or(mi.from(),Qn.anchor)):(Fn=Qn.anchor,Vn=Zt(mi.to(),Qn.head));var Rn=Q.ranges.slice(0);Rn[X]=Xl(e,new Qr(s(O,Vn),Fn)),ei(O,Ti(e,Rn,X),Ie)}}var Re=i.wrapper.getBoundingClientRect(),Qe=0;function et(St){var Ft=++Qe,ir=Hn(e,St,!0,r.unit=="rectangle");if(!ir)return;if(Pt(ir,ye)!=0){e.curOp.focus=y(),Pe(ir);var $t=Ca(i,O);(ir.line>=$t.to||ir.line<$t.from)&&setTimeout(Mn(e,function(){Qe==Ft&&et(St)}),150)}else{var xr=St.clientY<Re.top?-20:St.clientY>Re.bottom?20:0;xr&&setTimeout(Mn(e,function(){if(Qe!=Ft)return;i.scroller.scrollTop+=xr,et(St)}),50)}}function ht(St){e.state.selectingText=!1,Qe=Infinity,St&&(ne(St),i.input.focus()),Lt(i.wrapper.ownerDocument,"mousemove",Ct),Lt(i.wrapper.ownerDocument,"mouseup",Mt),O.history.lastSelOrigin=null}var Ct=Mn(e,function(St){St.buttons===0||!be(St)?ht(St):et(St)}),Mt=Mn(e,ht);e.state.selectingText=Mt,He(i.wrapper.ownerDocument,"mousemove",Ct),He(i.wrapper.ownerDocument,"mouseup",Mt)}function Xl(e,t){var n=t.anchor,r=t.head,i=_t(e.doc,n.line);if(Pt(n,r)==0&&n.sticky==r.sticky)return t;var O=At(i);if(!O)return t;var F=mt(O,n.ch,n.sticky),X=O[F];if(X.from!=n.ch&&X.to!=n.ch)return t;var Q=F+(X.from==n.ch==(X.level!=1)?0:1);if(Q==0||Q==O.length)return t;var q;if(r.line!=n.line)q=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var pe=mt(O,r.ch,r.sticky),ye=pe-F||(r.ch-n.ch)*(X.level==1?-1:1);pe==Q-1||pe==Q?q=ye<0:q=ye>0}var Pe=O[Q+(q?-1:0)],Re=q==(Pe.level==1),Qe=Re?Pe.from:Pe.to,et=Re?"after":"before";return n.ch==Qe&&n.sticky==et?t:new Qr(new Je(n.line,Qe,et),r)}function rl(e,t,n,r){var i,O;if(t.touches)i=t.touches[0].clientX,O=t.touches[0].clientY;else try{i=t.clientX,O=t.clientY}catch(Pe){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&ne(t);var F=e.display,X=F.lineDiv.getBoundingClientRect();if(O>X.bottom||!ve(e,n))return ue(t);O-=X.top-F.viewOffset;for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var q=F.gutters.childNodes[Q];if(q&&q.getBoundingClientRect().right>=i){var pe=Xr(e.doc,O),ye=e.display.gutterSpecs[Q];return Xe(e,n,e,pe,ye.className,t),ue(t)}}}function ds(e,t){return rl(e,t,"gutterClick",!0)}function nl(e,t){if(ki(e.display,t)||Yl(e,t))return;if(nt(e,t,"contextmenu"))return;w||e.display.input.onContextMenu(t)}function Yl(e,t){return ve(e,"gutterContextMenu")?rl(e,t,"gutterContextMenu",!1):!1}function il(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),hr(e)}var Ua={toString:function(){return"CodeMirror.Init"}},al={},jo={};function $l(e){var t=e.optionHandlers;function n(r,i,O,F){e.defaults[r]=i,O&&(t[r]=F?function(X,Q,q){q!=Ua&&O(X,Q,q)}:O)}e.defineOption=n,e.Init=Ua,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Qi(r)},!0),n("indentUnit",2,Qi,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){ro(r),hr(r),sn(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var O=[],F=r.doc.first;r.doc.iter(function(Q){for(var q=0;;){var pe=Q.text.indexOf(i,q);if(pe==-1)break;q=pe+i.length,O.push(Je(F,pe))}F++});for(var X=O.length-1;X>=0;X--)Ma(r.doc,i,O[X],Je(O[X].line,O[X].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,O){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),O!=Ua&&r.refresh()}),n("specialCharPlaceholder",Ir,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!T),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){il(r),Ri(r)},!0),n("keyMap","default",function(r,i,O){var F=Bo(i),X=O!=Ua&&Bo(O);X&&X.detach&&X.detach(r,F),F.attach&&F.attach(r,X||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=li(i,r.options.lineNumbers),Ri(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?qn(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Xi(r)},!0),n("scrollbarStyle","native",function(r){_a(r),Xi(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=li(r.options.gutters,i),Ri(r)},!0),n("firstLineNumber",1,Ri,!0),n("lineNumberFormatter",function(r){return r},Ri,!0),n("showCursorWhenSelecting",!1,an,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(ra(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Ql),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,an,!0),n("singleCursorHeightPerLine",!0,an,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,ro,!0),n("addModeClass",!1,ro,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,ro,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Ql(e,t,n){var r=n&&n!=Ua;if(!t!=!r){var i=e.display.dragFunctions,O=t?He:Lt;O(e.display.scroller,"dragstart",i.start),O(e.display.scroller,"dragenter",i.enter),O(e.display.scroller,"dragover",i.over),O(e.display.scroller,"dragleave",i.leave),O(e.display.scroller,"drop",i.drop)}}function Jl(e){e.options.lineWrapping?(G(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(g(e.display.wrapper,"CodeMirror-wrap"),An(e)),oi(e),sn(e),hr(e),setTimeout(function(){return Xi(e)},100)}function Sn(e,t){var n=this;if(!(this instanceof Sn))return new Sn(e,t);this.options=t=t?H(t):{},H(al,t,!1);var r=t.value;typeof r=="string"?r=new fi(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Sn.inputStyles[t.inputStyle](this),O=this.display=new va(e,r,i,t);O.wrapper.CodeMirror=this,il(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),_a(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 ce,keySeq:null,specialChars:null},t.autofocus&&!o&&O.input.focus(),W&&j<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),kl(),ji(this),this.curOp.forceUpdate=!0,vs(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Bi(n)},20):ra(this);for(var F in jo)jo.hasOwnProperty(F)&&jo[F](this,t[F],Ua);zn(this),t.finishInit&&t.finishInit(this);for(var X=0;X<cs.length;++X)cs[X](this);Yi(this),P&&t.lineWrapping&&getComputedStyle(O.lineDiv).textRendering=="optimizelegibility"&&(O.lineDiv.style.textRendering="auto")}Sn.defaults=al,Sn.optionHandlers=jo;function Zl(e){var t=e.display;He(t.scroller,"mousedown",Mn(e,el)),W&&j<11?He(t.scroller,"dblclick",Mn(e,function(Q){if(nt(e,Q))return;var q=Hn(e,Q);if(!q||ds(e,Q)||ki(e.display,Q))return;ne(Q);var pe=e.findWordAt(q);Mo(e.doc,pe.anchor,pe.head)})):He(t.scroller,"dblclick",function(Q){return nt(e,Q)||ne(Q)}),He(t.scroller,"contextmenu",function(Q){return nl(e,Q)}),He(t.input.getField(),"contextmenu",function(Q){t.scroller.contains(Q.target)||nl(e,Q)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function O(Q){if(Q.touches.length!=1)return!1;var q=Q.touches[0];return q.radiusX<=1&&q.radiusY<=1}function F(Q,q){if(q.left==null)return!0;var pe=q.left-Q.left,ye=q.top-Q.top;return pe*pe+ye*ye>20*20}He(t.scroller,"touchstart",function(Q){if(!nt(e,Q)&&!O(Q)&&!ds(e,Q)){t.input.ensurePolled(),clearTimeout(n);var q=+new Date;t.activeTouch={start:q,moved:!1,prev:q-r.end<=300?r:null},Q.touches.length==1&&(t.activeTouch.left=Q.touches[0].pageX,t.activeTouch.top=Q.touches[0].pageY)}}),He(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),He(t.scroller,"touchend",function(Q){var q=t.activeTouch;if(q&&!ki(t,Q)&&q.left!=null&&!q.moved&&new Date-q.start<300){var pe=e.coordsChar(t.activeTouch,"page"),ye;!q.prev||F(q,q.prev)?ye=new Qr(pe,pe):!q.prev.prev||F(q,q.prev.prev)?ye=e.findWordAt(pe):ye=new Qr(Je(pe.line,0),s(e.doc,Je(pe.line+1,0))),e.setSelection(ye.anchor,ye.head),e.focus(),ne(Q)}i()}),He(t.scroller,"touchcancel",i),He(t.scroller,"scroll",function(){t.scroller.clientHeight&&(aa(e,t.scroller.scrollTop),Ci(e,t.scroller.scrollLeft,!0),Xe(e,"scroll",e))}),He(t.scroller,"mousewheel",function(Q){return eo(e,Q)}),He(t.scroller,"DOMMouseScroll",function(Q){return eo(e,Q)}),He(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Q){nt(e,Q)||he(Q)},over:function(Q){nt(e,Q)||(Ol(e,Q),he(Q))},start:function(Q){return Al(e,Q)},drop:Mn(e,wl),leave:function(Q){nt(e,Q)||Ws(e)}};var X=t.input.getField();He(X,"keyup",function(Q){return Zs.call(e,Q)}),He(X,"keydown",Mn(e,Js)),He(X,"keypress",Mn(e,qs)),He(X,"focus",function(Q){return Bi(e,Q)}),He(X,"blur",function(Q){return ra(e,Q)})}var cs=[];Sn.defineInitHook=function(e){return cs.push(e)};function go(e,t,n,r){var i=e.doc,O;n==null&&(n="add"),n=="smart"&&(i.mode.indent?O=ze(e,t).state:n="prev");var F=e.options.tabSize,X=_t(i,t),Q=re(X.text,null,F);X.stateAfter&&(X.stateAfter=null);var q=X.text.match(/^\s*/)[0],pe;if(!r&&!/\S/.test(X.text))pe=0,n="not";else if(n=="smart"&&(pe=i.mode.indent(O,X.text.slice(q.length),X.text),pe==Ye||pe>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?pe=re(_t(i,t-1).text,null,F):pe=0:n=="add"?pe=Q+e.options.indentUnit:n=="subtract"?pe=Q-e.options.indentUnit:typeof n=="number"&&(pe=Q+n),pe=Math.max(0,pe);var ye="",Pe=0;if(e.options.indentWithTabs)for(var Re=Math.floor(pe/F);Re;--Re)Pe+=F,ye+=" ";if(Pe<pe&&(ye+=se(pe-Pe)),ye!=q)return Ma(i,ye,Je(t,0),Je(t,q.length),"+input"),X.stateAfter=null,!0;for(var Qe=0;Qe<i.sel.ranges.length;Qe++){var et=i.sel.ranges[Qe];if(et.head.line==t&&et.head.ch<q.length){var ht=Je(t,q.length);is(i,Qe,new Qr(ht,ht));break}}}var Mi=null;function Wo(e){Mi=e}function hs(e,t,n,r,i){var O=e.doc;e.display.shift=!1,r||(r=O.sel);var F=+new Date-200,X=i=="paste"||e.state.pasteIncoming>F,Q=Tt(t),q=null;if(X&&r.ranges.length>1)if(Mi&&Mi.text.join(`
|
|
`)==t){if(r.ranges.length%Mi.text.length==0){q=[];for(var pe=0;pe<Mi.text.length;pe++)q.push(O.splitLines(Mi.text[pe]))}}else Q.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(q=dt(Q,function(Ct){return[Ct]}));for(var ye=e.curOp.updateInput,Pe=r.ranges.length-1;Pe>=0;Pe--){var Re=r.ranges[Pe],Qe=Re.from(),et=Re.to();Re.empty()&&(n&&n>0?Qe=Je(Qe.line,Qe.ch-n):e.state.overwrite&&!X?et=Je(et.line,Math.min(_t(O,et.line).text.length,et.ch+ke(Q).length)):X&&Mi&&Mi.lineWise&&Mi.text.join(`
|
|
`)==Q.join(`
|
|
`)&&(Qe=et=Je(Qe.line,0)));var ht={from:Qe,to:et,text:q?q[Pe%q.length]:Q,origin:i||(X?"paste":e.state.cutIncoming>F?"cut":"+input")};Da(e.doc,ht),On(e,"inputRead",e,ht)}t&&!X&&sl(e,t),na(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ye),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ol(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&si(t,function(){return hs(t,n,0,null,"paste")}),!0}function sl(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var O=e.getModeAt(i.head),F=!1;if(O.electricChars){for(var X=0;X<O.electricChars.length;X++)if(t.indexOf(O.electricChars.charAt(X))>-1){F=go(e,i.head.line,"smart");break}}else O.electricInput&&(O.electricInput.test(_t(e.doc,i.head.line).text.slice(0,i.head.ch))&&(F=go(e,i.head.line,"smart")));F&&On(e,"electricInput",e,i.head.line)}}function ll(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,O={anchor:Je(i,0),head:Je(i+1,0)};n.push(O),t.push(e.getRange(O.anchor,O.head))}return{text:t,ranges:n}}function ul(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function dl(){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"),S&&(e.style.border="1px solid black"),ul(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var O=this.options,F=O[r];if(O[r]==i&&r!="mode")return;O[r]=i,t.hasOwnProperty(r)&&Mn(this,t[r])(this,i,F),Xe(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](Bo(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,O=0;O<i.length;++O)if(i[O]==r||i[O].name==r)return i.splice(O,1),!0},addOverlay:$n(function(r,i){var O=r.token?r:e.getMode(this.options,r);if(O.startState)throw new Error("Overlays may not be stateful.");at(this.state.overlays,{mode:O,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(F){return F.priority}),this.state.modeGen++,sn(this)}),removeOverlay:$n(function(r){for(var i=this.state.overlays,O=0;O<i.length;++O){var F=i[O].modeSpec;if(F==r||typeof r=="string"&&F.name==r){i.splice(O,1),this.state.modeGen++,sn(this);return}}}),indentLine:$n(function(r,i,O){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Zr(this.doc,r)&&go(this,r,i,O)}),indentSelection:$n(function(r){for(var i=this.doc.sel.ranges,O=-1,F=0;F<i.length;F++){var X=i[F];if(X.empty())X.head.line>O&&(go(this,X.head.line,r,!0),O=X.head.line,F==this.doc.sel.primIndex&&na(this));else{var Q=X.from(),q=X.to(),pe=Math.max(O,Q.line);O=Math.min(this.lastLine(),q.line-(q.ch?0:1))+1;for(var ye=pe;ye<O;++ye)go(this,ye,r);var Pe=this.doc.sel.ranges;Q.ch==0&&i.length==Pe.length&&Pe[F].from().ch>0&&is(this.doc,F,new Qr(Q,Pe[F].to()),Ne)}}}),getTokenAt:function(r,i){return Dr(this,r,i)},getLineTokens:function(r,i){return Dr(this,Je(r),i,!0)},getTokenTypeAt:function(r){r=s(this.doc,r);var i=Be(this,_t(this.doc,r.line)),O=0,F=(i.length-1)/2,X=r.ch,Q;if(X==0)Q=i[2];else for(;;){var q=O+F>>1;if((q?i[q*2-1]:0)>=X)F=q;else if(i[q*2+1]<X)O=q+1;else{Q=i[q*2+2];break}}var pe=Q?Q.indexOf("overlay "):-1;return pe<0?Q:pe==0?null:Q.slice(0,pe-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var O=[];if(!n.hasOwnProperty(i))return O;var F=n[i],X=this.getModeAt(r);if(typeof X[i]=="string")F[X[i]]&&O.push(F[X[i]]);else if(X[i])for(var Q=0;Q<X[i].length;Q++){var q=F[X[i][Q]];q&&O.push(q)}else X.helperType&&F[X.helperType]?O.push(F[X.helperType]):F[X.name]&&O.push(F[X.name]);for(var pe=0;pe<F._global.length;pe++){var ye=F._global[pe];ye.pred(X,this)&&Ee(O,ye.val)==-1&&O.push(ye.val)}return O},getStateAfter:function(r,i){var O=this.doc;return r=U(O,r==null?O.first+O.size-1:r),ze(this,r+1,i).state},cursorCoords:function(r,i){var O,F=this.doc.sel.primary();return r==null?O=F.head:typeof r=="object"?O=s(this.doc,r):O=r?F.from():F.to(),Tr(this,O,i||"page")},charCoords:function(r,i){return vn(this,s(this.doc,r),i||"page")},coordsChar:function(r,i){return r=Sr(this,r,i||"page"),_r(this,r.left,r.top)},lineAtHeight:function(r,i){return r=Sr(this,{top:r,left:0},i||"page").top,Xr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,O){var F=!1,X;if(typeof r=="number"){var Q=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>Q&&(r=Q,F=!0),X=_t(this.doc,r)}else X=r;return Nr(this,X,{top:0,left:0},i||"page",O||F).top+(F?this.doc.height-mn(X):0)},defaultTextHeight:function(){return kn(this.display)},defaultCharWidth:function(){return Wn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,O,F,X){var Q=this.display;r=Tr(this,s(this.doc,r));var q=r.bottom,pe=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),Q.sizer.appendChild(i),F=="over")q=r.top;else if(F=="above"||F=="near"){var ye=Math.max(Q.wrapper.clientHeight,this.doc.height),Pe=Math.max(Q.sizer.clientWidth,Q.lineSpace.clientWidth);(F=="above"||r.bottom+i.offsetHeight>ye)&&r.top>i.offsetHeight?q=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=ye&&(q=r.bottom),pe+i.offsetWidth>Pe&&(pe=Pe-i.offsetWidth)}i.style.top=q+"px",i.style.left=i.style.right="",X=="right"?(pe=Q.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(X=="left"?pe=0:X=="middle"&&(pe=(Q.sizer.clientWidth-i.offsetWidth)/2),i.style.left=pe+"px"),O&&So(this,{left:pe,top:q,right:pe+i.offsetWidth,bottom:q+i.offsetHeight})},triggerOnKeyDown:$n(Js),triggerOnKeyPress:$n(qs),triggerOnKeyUp:Zs,triggerOnMouseDown:$n(el),execCommand:function(r){if(ho.hasOwnProperty(r))return ho[r].call(null,this)},triggerElectric:$n(function(r){sl(this,r)}),findPosH:function(r,i,O,F){var X=1;i<0&&(X=-1,i=-i);for(var Q=s(this.doc,r),q=0;q<i&&!(Q=fs(this.doc,Q,X,O,F),Q.hitSide);++q);return Q},moveH:$n(function(r,i){var O=this;this.extendSelectionsBy(function(F){return O.display.shift||O.doc.extend||F.empty()?fs(O.doc,F.head,r,i,O.options.rtlMoveVisually):r<0?F.from():F.to()},We)}),deleteH:$n(function(r,i){var O=this.doc.sel,F=this.doc;O.somethingSelected()?F.replaceSelection("",null,"+delete"):Na(this,function(X){var Q=fs(F,X.head,r,i,!1);return r<0?{from:Q,to:X.head}:{from:X.head,to:Q}})}),findPosV:function(r,i,O,F){var X=1,Q=F;i<0&&(X=-1,i=-i);for(var q=s(this.doc,r),pe=0;pe<i;++pe){var ye=Tr(this,q,"div");if(Q==null?Q=ye.left:ye.left=Q,q=cl(this,ye,X,O),q.hitSide)break}return q},moveV:$n(function(r,i){var O=this,F=this.doc,X=[],Q=!this.display.shift&&!F.extend&&F.sel.somethingSelected();if(F.extendSelectionsBy(function(pe){if(Q)return r<0?pe.from():pe.to();var ye=Tr(O,pe.head,"div");pe.goalColumn!=null&&(ye.left=pe.goalColumn),X.push(ye.left);var Pe=cl(O,ye,r,i);return i=="page"&&pe==F.sel.primary()&&$a(O,vn(O,Pe,"div").top-ye.top),Pe},We),X.length)for(var q=0;q<F.sel.ranges.length;q++)F.sel.ranges[q].goalColumn=X[q]}),findWordAt:function(r){var i=this.doc,O=_t(i,r.line).text,F=r.ch,X=r.ch;if(O){var Q=this.getHelper(r,"wordChars");(r.sticky=="before"||X==O.length)&&F?--F:++X;for(var q=O.charAt(F),pe=it(q,Q)?function(ye){return it(ye,Q)}:/\s/.test(q)?function(ye){return/\s/.test(ye)}:function(ye){return!/\s/.test(ye)&&!it(ye)};F>0&&pe(O.charAt(F-1));)--F;for(;X<O.length&&pe(O.charAt(X));)++X}return new Qr(Je(r.line,F),Je(r.line,X))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?G(this.display.cursorDiv,"CodeMirror-overwrite"):g(this.display.cursorDiv,"CodeMirror-overwrite"),Xe(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==y()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:$n(function(r,i){ia(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Ae(this)-this.display.barHeight,width:r.scrollWidth-Ae(this)-this.display.barWidth,clientHeight:J(this),clientWidth:fe(this)}},scrollIntoView:$n(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Je(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?$o(this,r):fa(this,r.from,r.to,r.margin)}),setSize:$n(function(r,i){var O=this,F=function(Q){return typeof Q=="number"||/^\d+$/.test(String(Q))?Q+"px":Q};r!=null&&(this.display.wrapper.style.width=F(r)),i!=null&&(this.display.wrapper.style.height=F(i)),this.options.lineWrapping&&lr(this);var X=this.display.viewFrom;this.doc.iter(X,this.display.viewTo,function(Q){if(Q.widgets){for(var q=0;q<Q.widgets.length;q++)if(Q.widgets[q].noHScroll){Cn(O,X,"widget");break}}++X}),this.curOp.forceUpdate=!0,Xe(this,"refresh",this)}),operation:function(r){return si(this,r)},startOperation:function(){return ji(this)},endOperation:function(){return Yi(this)},refresh:$n(function(){var r=this.display.cachedTextHeight;sn(this),this.curOp.forceUpdate=!0,hr(this),ia(this,this.doc.scrollLeft,this.doc.scrollTop),Aa(this.display),(r==null||Math.abs(r-kn(this.display))>.5||this.options.lineWrapping)&&oi(this),Xe(this,"refresh",this)}),swapDoc:$n(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),vs(this,r),hr(this),this.display.input.reset(),ia(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,On(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[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}},Ce(e),e.registerHelper=function(r,i,O){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=O},e.registerGlobalHelper=function(r,i,O,F){e.registerHelper(r,i,F),n[r]._global.push({pred:O,val:F})}}function fs(e,t,n,r,i){var O=t,F=n,X=_t(e,t.line),Q=i&&e.direction=="rtl"?-n:n;function q(){var Mt=t.line+Q;return Mt<e.first||Mt>=e.first+e.size?!1:(t=new Je(Mt,t.ch,t.sticky),X=_t(e,Mt))}function pe(Mt){var St;if(r=="codepoint"){var Ft=X.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(Ft)?St=null:St=new Je(t.line,Math.max(0,Math.min(X.text.length,t.ch+n*(Ft>=55296&&Ft<56320?2:1))),-n)}else i?St=Pl(e.cm,X,t,n):St=os(X,t,n);if(St==null)if(!Mt&&q())t=ss(i,e.cm,X,t.line,Q);else return!1;else t=St;return!0}if(r=="char"||r=="codepoint")pe();else if(r=="column")pe(!0);else if(r=="word"||r=="group")for(var ye=null,Pe=r=="group",Re=e.cm&&e.cm.getHelper(t,"wordChars"),Qe=!0;!(n<0&&!pe(!Qe));Qe=!1){var et=X.text.charAt(t.ch)||`
|
|
`,ht=it(et,Re)?"w":Pe&&et==`
|
|
`?"n":!Pe||/\s/.test(et)?null:"p";if(Pe&&!Qe&&!ht&&(ht="s"),ye&&ye!=ht){n<0&&(n=1,pe(),t.sticky="after");break}if(ht&&(ye=ht),n>0&&!pe(!Qe))break}var Ct=Io(e,t,O,F,!0);return jr(O,Ct)&&(Ct.hitSide=!0),Ct}function cl(e,t,n,r){var i=e.doc,O=t.left,F;if(r=="page"){var X=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Q=Math.max(X-.5*kn(e.display),3);F=(n>0?t.bottom:t.top)+n*Q}else r=="line"&&(F=n>0?t.bottom+3:t.top-3);for(var q;!(q=_r(e,O,F),!q.outside);){if(n<0?F<=0:F>=i.height){q.hitSide=!0;break}F+=n*5}return q}var ln=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ce,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};ln.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;ul(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function O(X){for(var Q=X.target;Q;Q=Q.parentNode){if(Q==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Q.className))break}return!1}He(i,"paste",function(X){if(!O(X)||nt(r,X)||ol(X,r))return;j<=11&&setTimeout(Mn(r,function(){return t.updateFromDOM()}),20)}),He(i,"compositionstart",function(X){t.composing={data:X.data,done:!1}}),He(i,"compositionupdate",function(X){t.composing||(t.composing={data:X.data,done:!1})}),He(i,"compositionend",function(X){t.composing&&(X.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),He(i,"touchstart",function(){return n.forceCompositionEnd()}),He(i,"input",function(){t.composing||t.readFromDOMSoon()});function F(X){if(!O(X)||nt(r,X))return;if(r.somethingSelected())Wo({lineWise:!1,text:r.getSelections()}),X.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var Q=ll(r);Wo({lineWise:!0,text:Q.text}),X.type=="cut"&&r.operation(function(){r.setSelections(Q.ranges,0,Ne),r.replaceSelection("",null,"cut")})}else return;if(X.clipboardData){X.clipboardData.clearData();var q=Mi.text.join(`
|
|
`);if(X.clipboardData.setData("Text",q),X.clipboardData.getData("Text")==q){X.preventDefault();return}}var pe=dl(),ye=pe.firstChild;r.display.lineSpace.insertBefore(pe,r.display.lineSpace.firstChild),ye.value=Mi.text.join(`
|
|
`);var Pe=document.activeElement;Z(ye),setTimeout(function(){r.display.lineSpace.removeChild(pe),Pe.focus(),Pe==i&&n.showPrimarySelection()},50)}He(i,"copy",F),He(i,"cut",F)},ln.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},ln.prototype.prepareSelection=function(){var e=Ai(this.cm,!1);return e.focus=document.activeElement==this.div,e},ln.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},ln.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},ln.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var O=Ho(t,e.anchorNode,e.anchorOffset),F=Ho(t,e.focusNode,e.focusOffset);if(O&&!O.bad&&F&&!F.bad&&Pt(Or(O,F),r)==0&&Pt(Zt(O,F),i)==0)return;var X=t.display.view,Q=r.line>=t.display.viewFrom&&hl(t,r)||{node:X[0].measure.map[2],offset:0},q=i.line<t.display.viewTo&&hl(t,i);if(!q){var pe=X[X.length-1].measure,ye=pe.maps?pe.maps[pe.maps.length-1]:pe.map;q={node:ye[ye.length-1],offset:ye[ye.length-2]-ye[ye.length-3]}}if(!Q||!q){e.removeAllRanges();return}var Pe=e.rangeCount&&e.getRangeAt(0),Re;try{Re=v(Q.node,Q.offset,q.offset,q.node)}catch(Qe){}Re&&(!L&&t.state.focused?(e.collapse(Q.node,Q.offset),Re.collapsed||(e.removeAllRanges(),e.addRange(Re))):(e.removeAllRanges(),e.addRange(Re)),Pe&&e.anchorNode==null?e.addRange(Pe):L&&this.startGracePeriod()),this.rememberSelection()},ln.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)},ln.prototype.showMultipleSelections=function(e){d(this.cm.display.cursorDiv,e.cursors),d(this.cm.display.selectionDiv,e.selection)},ln.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},ln.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return b(this.div,t)},ln.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},ln.prototype.blur=function(){this.div.blur()},ln.prototype.getField=function(){return this.div},ln.prototype.supportsTouch=function(){return!0},ln.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():si(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)},ln.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},ln.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(c&&E&&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 n=Ho(t,e.anchorNode,e.anchorOffset),r=Ho(t,e.focusNode,e.focusOffset);n&&r&&si(t,function(){ei(t.doc,Li(n,r),Ne),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},ln.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Je(r.line-1,_t(e.doc,r.line-1).length)),i.ch==_t(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Je(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var O,F,X;r.line==t.viewFrom||(O=dn(e,r.line))==0?(F=Kt(t.view[0].line),X=t.view[0].node):(F=Kt(t.view[O].line),X=t.view[O-1].node.nextSibling);var Q=dn(e,i.line),q,pe;if(Q==t.view.length-1?(q=t.viewTo-1,pe=t.lineDiv.lastChild):(q=Kt(t.view[Q+1].line)-1,pe=t.view[Q+1].node.previousSibling),!X)return!1;for(var ye=e.doc.splitLines(tu(e,X,pe,F,q)),Pe=Vr(e.doc,Je(F,0),Je(q,_t(e.doc,q).text.length));ye.length>1&&Pe.length>1;)if(ke(ye)==ke(Pe))ye.pop(),Pe.pop(),q--;else if(ye[0]==Pe[0])ye.shift(),Pe.shift(),F++;else break;for(var Re=0,Qe=0,et=ye[0],ht=Pe[0],Ct=Math.min(et.length,ht.length);Re<Ct&&et.charCodeAt(Re)==ht.charCodeAt(Re);)++Re;for(var Mt=ke(ye),St=ke(Pe),Ft=Math.min(Mt.length-(ye.length==1?Re:0),St.length-(Pe.length==1?Re:0));Qe<Ft&&Mt.charCodeAt(Mt.length-Qe-1)==St.charCodeAt(St.length-Qe-1);)++Qe;if(ye.length==1&&Pe.length==1&&F==r.line)for(;Re&&Re>r.ch&&Mt.charCodeAt(Mt.length-Qe-1)==St.charCodeAt(St.length-Qe-1);)Re--,Qe++;ye[ye.length-1]=Mt.slice(0,Mt.length-Qe).replace(/^\u200b+/,""),ye[0]=ye[0].slice(Re).replace(/\u200b+$/,"");var ir=Je(F,Re),$t=Je(q,Pe.length?ke(Pe).length-Qe:0);if(ye.length>1||ye[0]||Pt(ir,$t))return Ma(e.doc,ye,ir,$t,"+input"),!0},ln.prototype.ensurePolled=function(){this.forceCompositionEnd()},ln.prototype.reset=function(){this.forceCompositionEnd()},ln.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},ln.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)},ln.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&si(this.cm,function(){return sn(e.cm)})},ln.prototype.setUneditable=function(e){e.contentEditable="false"},ln.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Mn(this.cm,hs)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},ln.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},ln.prototype.onContextMenu=function(){},ln.prototype.resetPosition=function(){},ln.prototype.needsContentAttribute=!0;function hl(e,t){var n=Oe(e,t.line);if(!n||n.hidden)return null;var r=_t(e.doc,t.line),i=te(n,r,t.line),O=At(r,e.doc.direction),F="left";if(O){var X=mt(O,t.ch);F=X%2?"right":"left"}var Q=st(i.map,t.ch,F);return Q.offset=Q.collapse=="right"?Q.end:Q.start,Q}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Ba(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var O="",F=!1,X=e.doc.lineSeparator(),Q=!1;function q(Re){return function(Qe){return Qe.id==Re}}function pe(){F&&(O+=X,Q&&(O+=X),F=Q=!1)}function ye(Re){Re&&(pe(),O+=Re)}function Pe(Re){if(Re.nodeType==1){var Qe=Re.getAttribute("cm-text");if(Qe){ye(Qe);return}var et=Re.getAttribute("cm-marker"),ht;if(et){var Ct=e.findMarks(Je(r,0),Je(i+1,0),q(+et));Ct.length&&(ht=Ct[0].find(0))&&ye(Vr(e.doc,ht.from,ht.to).join(X));return}if(Re.getAttribute("contenteditable")=="false")return;var Mt=/^(pre|div|p|li|table|br)$/i.test(Re.nodeName);if(!/^br$/i.test(Re.nodeName)&&Re.textContent.length==0)return;Mt&&pe();for(var St=0;St<Re.childNodes.length;St++)Pe(Re.childNodes[St]);/^(pre|p)$/i.test(Re.nodeName)&&(Q=!0),Mt&&(F=!0)}else Re.nodeType==3&&ye(Re.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Pe(t),t==n);)t=t.nextSibling,Q=!1;return O}function Ho(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Ba(e.clipPos(Je(e.display.viewTo-1)),!0);t=null,n=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 i=0;i<e.display.view.length;i++){var O=e.display.view[i];if(O.node==r)return ru(O,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!b(r,t))return Ba(Je(Kt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var O=e.rest?ke(e.rest):e.line;return Ba(Je(Kt(O),O.text.length),i)}var F=t.nodeType==3?t:null,X=t;for(!F&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(F=t.firstChild,n&&(n=F.nodeValue.length));X.parentNode!=r;)X=X.parentNode;var Q=e.measure,q=Q.maps;function pe(ht,Ct,Mt){for(var St=-1;St<(q?q.length:0);St++)for(var Ft=St<0?Q.map:q[St],ir=0;ir<Ft.length;ir+=3){var $t=Ft[ir+2];if($t==ht||$t==Ct){var xr=Kt(St<0?e.line:e.rest[St]),cn=Ft[ir]+Mt;return(Mt<0||$t!=ht)&&(cn=Ft[ir+(Mt?1:0)]),Je(xr,cn)}}}var ye=pe(F,X,n);if(ye)return Ba(ye,i);for(var Pe=X.nextSibling,Re=F?F.nodeValue.length-n:0;Pe;Pe=Pe.nextSibling){if(ye=pe(Pe,Pe.firstChild,0),ye)return Ba(Je(ye.line,ye.ch-Re),i);Re+=Pe.textContent.length}for(var Qe=X.previousSibling,et=n;Qe;Qe=Qe.previousSibling){if(ye=pe(Qe,Qe.firstChild,-1),ye)return Ba(Je(ye.line,ye.ch+et),i);et+=Qe.textContent.length}}var In=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ce,this.hasSelection=!1,this.composing=null};In.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),S&&(i.style.width="0px"),He(i,"input",function(){W&&j>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),He(i,"paste",function(F){if(nt(r,F)||ol(F,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function O(F){if(nt(r,F))return;if(r.somethingSelected())Wo({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var X=ll(r);Wo({lineWise:!0,text:X.text}),F.type=="cut"?r.setSelections(X.ranges,null,Ne):(n.prevInput="",i.value=X.text.join(`
|
|
`),Z(i))}else return;F.type=="cut"&&(r.state.cutIncoming=+new Date)}He(i,"cut",O),He(i,"copy",O),He(e.scroller,"paste",function(F){if(ki(e,F)||nt(r,F))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var X=new Event("paste");X.clipboardData=F.clipboardData,i.dispatchEvent(X)}),He(e.lineSpace,"selectstart",function(F){ki(e,F)||ne(F)}),He(i,"compositionstart",function(){var F=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:F,range:r.markText(F,r.getCursor("to"),{className:"CodeMirror-composing"})}}),He(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},In.prototype.createField=function(e){this.wrapper=dl(),this.textarea=this.wrapper.firstChild},In.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},In.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=Ai(e);if(e.options.moveInputWithCursor){var i=Tr(e,n.sel.primary().head,"div"),O=t.wrapper.getBoundingClientRect(),F=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+F.top-O.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+F.left-O.left))}return r},In.prototype.showSelection=function(e){var t=this.cm,n=t.display;d(n.cursorDiv,e.cursors),d(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},In.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&Z(this.textarea),W&&j>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",W&&j>=9&&(this.hasSelection=null))},In.prototype.getField=function(){return this.textarea},In.prototype.supportsTouch=function(){return!1},In.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||y()!=this.textarea))try{this.textarea.focus()}catch(e){}},In.prototype.blur=function(){this.textarea.blur()},In.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},In.prototype.receivedFocus=function(){this.slowPoll()},In.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()})},In.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},In.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Ge(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(W&&j>=9&&this.hasSelection===i||l&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var O=i.charCodeAt(0);if(O==8203&&!r&&(r="\u200B"),O==8666)return this.reset(),this.cm.execCommand("undo")}for(var F=0,X=Math.min(r.length,i.length);F<X&&r.charCodeAt(F)==i.charCodeAt(F);)++F;return si(t,function(){hs(t,i.slice(F),r.length-F,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},In.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},In.prototype.onKeyPress=function(){W&&j>=9&&(this.hasSelection=null),this.fastPoll()},In.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var O=Hn(n,e),F=r.scroller.scrollTop;if(!O||_)return;var X=n.options.resetSelectionOnContextMenu;X&&n.doc.sel.contains(O)==-1&&Mn(n,ei)(n.doc,Li(O),Ne);var Q=i.style.cssText,q=t.wrapper.style.cssText,pe=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-pe.top-5)+"px; left: "+(e.clientX-pe.left-5)+`px;
|
|
z-index: 1000; background: `+(W?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ye;P&&(ye=window.scrollY),r.input.focus(),P&&window.scrollTo(null,ye),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=Re,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function Pe(){if(i.selectionStart!=null){var et=n.somethingSelected(),ht="\u200B"+(et?i.value:"");i.value="\u21DA",i.value=ht,t.prevInput=et?"":"\u200B",i.selectionStart=1,i.selectionEnd=ht.length,r.selForContextMenu=n.doc.sel}}function Re(){if(t.contextMenuPending!=Re)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=q,i.style.cssText=Q,W&&j<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=F),i.selectionStart!=null){(!W||W&&j<9)&&Pe();var et=0,ht=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Mn(n,Rs)(n):et++<10?r.detectingSelectAll=setTimeout(ht,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(ht,200)}}if(W&&j>=9&&Pe(),w){he(e);var Qe=function(){Lt(window,"mouseup",Qe),setTimeout(Re,20)};He(window,"mouseup",Qe)}else setTimeout(Re,50)},In.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},In.prototype.setUneditable=function(){},In.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?H(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 n=y();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=X.getValue()}var i;if(e.form&&(He(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var O=e.form;i=O.submit;try{var F=O.submit=function(){r(),O.submit=i,O.submit(),O.submit=F}}catch(Q){}}t.finishInit=function(Q){Q.save=r,Q.getTextArea=function(){return e},Q.toTextArea=function(){Q.toTextArea=isNaN,r(),e.parentNode.removeChild(Q.getWrapperElement()),e.style.display="",e.form&&(Lt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var X=Sn(function(Q){return e.parentNode.insertBefore(Q,e.nextSibling)},t);return X}function iu(e){e.off=Lt,e.on=He,e.wheelEventPixels=qa,e.Doc=fi,e.splitLines=Tt,e.countColumn=re,e.findColumn=Ue,e.isWordChar=$e,e.Pass=Ye,e.signal=Xe,e.Line=Tn,e.changeEnd=Di,e.scrollbarModel=Qa,e.Pos=Je,e.cmpPos=Pt,e.modes=er,e.mimeModes=Bt,e.resolveMode=kt,e.getMode=Gr,e.modeExtensions=br,e.extendMode=wr,e.copyState=Lr,e.startState=ur,e.innerMode=Br,e.commands=ho,e.keyMap=Ji,e.keyName=Vs,e.isModifierKey=zs,e.lookupKey=Ia,e.normalizeKeyMap=Ml,e.StringStream=Ht,e.SharedTextMarker=lo,e.TextMarker=ua,e.LineWidget=so,e.e_preventDefault=ne,e.e_stopPropagation=ie,e.e_stop=he,e.addClass=G,e.contains=b,e.rmClass=g,e.keyNames=da}$l(Sn),ql(Sn);var au="iter insert remove copy getEditor constructor".split(" ");for(var Ko in fi.prototype)fi.prototype.hasOwnProperty(Ko)&&Ee(au,Ko)<0&&(Sn.prototype[Ko]=function(e){return function(){return e.apply(this.doc,arguments)}}(fi.prototype[Ko]));return Ce(fi),Sn.inputStyles={textarea:In,contenteditable:ln},Sn.defineMode=function(e){!Sn.defaults.mode&&e!="null"&&(Sn.defaults.mode=e),qt.apply(this,arguments)},Sn.defineMIME=pr,Sn.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Sn.defineMIME("text/plain","null"),Sn.defineExtension=function(e,t){Sn.prototype[e]=t},Sn.defineDocExtension=function(e,t){fi.prototype[e]=t},Sn.fromTextArea=nu,iu(Sn),Sn.version="5.58.2",Sn})},Y1PL:function(zt,xt,ee){"use strict";ee.r(xt),ee.d(xt,"ResizableTextArea",function(){return Ee});var le=ee("wx14"),Y=ee("1OyB"),L=ee("vuIU"),z=ee("Ji7U"),A=ee("LK+K"),I=ee("q1tI"),W=ee("VTBJ"),j=ee("rePB"),P=ee("Zm9Q"),D=ee("Kwbf"),E=ee("c+Xe"),_=ee("m+aA"),M=ee("bdgK"),R=new Map;function k(Ne){Ne.forEach(function(Ie){var We,Ue=Ie.target;(We=R.get(Ue))===null||We===void 0||We.forEach(function(xe){return xe(Ue)})})}var S=new M.default(k),c=null,o=null;function l(Ne,Ie){R.has(Ne)||(R.set(Ne,new Set),S.observe(Ne)),R.get(Ne).add(Ie)}function u(Ne,Ie){R.has(Ne)&&(R.get(Ne).delete(Ie),R.get(Ne).size||(S.unobserve(Ne),R.delete(Ne)))}var T=function(Ne){Object(z.a)(We,Ne);var Ie=Object(A.a)(We);function We(){return Object(Y.a)(this,We),Ie.apply(this,arguments)}return Object(L.a)(We,[{key:"render",value:function(){return this.props.children}}]),We}(I.Component),m=I.createContext(null);function p(Ne){var Ie=Ne.children,We=Ne.onBatchResize,Ue=I.useRef(0),xe=I.useRef([]),se=I.useContext(m),ke=I.useCallback(function(dt,at,rt){Ue.current+=1;var lt=Ue.current;xe.current.push({size:dt,element:at,data:rt}),Promise.resolve().then(function(){lt===Ue.current&&(We==null||We(xe.current),xe.current=[])}),se==null||se(dt,at,rt)},[We,se]);return I.createElement(m.Provider,{value:ke},Ie)}function w(Ne){var Ie=Ne.children,We=Ne.disabled,Ue=I.useRef(null),xe=I.useRef(null),se=I.useContext(m),ke=I.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),dt=I.isValidElement(Ie)&&Object(E.c)(Ie),at=dt?Ie.ref:null,rt=I.useMemo(function(){return Object(E.a)(at,Ue)},[at,Ue]),lt=I.useRef(Ne);lt.current=Ne;var Ke=I.useCallback(function($e){var it=lt.current,ft=it.onResize,ut=it.data,Ze=$e.getBoundingClientRect(),qe=Ze.width,Dt=Ze.height,wt=$e.offsetWidth,vt=$e.offsetHeight,mt=Math.floor(qe),Nt=Math.floor(Dt);if(ke.current.width!==mt||ke.current.height!==Nt||ke.current.offsetWidth!==wt||ke.current.offsetHeight!==vt){var At={width:mt,height:Nt,offsetWidth:wt,offsetHeight:vt};ke.current=At;var Ot=wt===Math.round(qe)?qe:wt,He=vt===Math.round(Dt)?Dt:vt,Ut=Object(W.a)(Object(W.a)({},At),{},{offsetWidth:Ot,offsetHeight:He});se==null||se(Ut,$e,ut),ft&&Promise.resolve().then(function(){ft(Ut,$e)})}},[]);return I.useEffect(function(){var $e=Object(_.a)(Ue.current)||Object(_.a)(xe.current);return $e&&!We&&l($e,Ke),function(){return u($e,Ke)}},[Ue.current,We]),I.createElement(T,{ref:xe},dt?I.cloneElement(Ie,{ref:rt}):Ie)}var x="rc-observer-key";function g(Ne){var Ie=Ne.children,We=Object(P.a)(Ie);return We.map(function(Ue,xe){var se=(Ue==null?void 0:Ue.key)||"".concat(x,"-").concat(xe);return I.createElement(w,Object(le.a)({},Ne,{key:se}),Ue)})}g.Collection=p;var f=g,d=ee("bT9E"),a=ee("TSYQ"),C=ee.n(a),v=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,b=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],y={},G;function $(Ne){var Ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,We=Ne.getAttribute("id")||Ne.getAttribute("data-reactid")||Ne.getAttribute("name");if(Ie&&y[We])return y[We];var Ue=window.getComputedStyle(Ne),xe=Ue.getPropertyValue("box-sizing")||Ue.getPropertyValue("-moz-box-sizing")||Ue.getPropertyValue("-webkit-box-sizing"),se=parseFloat(Ue.getPropertyValue("padding-bottom"))+parseFloat(Ue.getPropertyValue("padding-top")),ke=parseFloat(Ue.getPropertyValue("border-bottom-width"))+parseFloat(Ue.getPropertyValue("border-top-width")),dt=b.map(function(rt){return"".concat(rt,":").concat(Ue.getPropertyValue(rt))}).join(";"),at={sizingStyle:dt,paddingSize:se,borderSize:ke,boxSizing:xe};return Ie&&We&&(y[We]=at),at}function Z(Ne){var Ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,We=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Ue=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;G||(G=document.createElement("textarea"),G.setAttribute("tab-index","-1"),G.setAttribute("aria-hidden","true"),document.body.appendChild(G)),Ne.getAttribute("wrap")?G.setAttribute("wrap",Ne.getAttribute("wrap")):G.removeAttribute("wrap");var xe=$(Ne,Ie),se=xe.paddingSize,ke=xe.borderSize,dt=xe.boxSizing,at=xe.sizingStyle;G.setAttribute("style","".concat(at,";").concat(v)),G.value=Ne.value||Ne.placeholder||"";var rt=Number.MIN_SAFE_INTEGER,lt=Number.MAX_SAFE_INTEGER,Ke=G.scrollHeight,$e;if(dt==="border-box"?Ke+=ke:dt==="content-box"&&(Ke-=se),We!==null||Ue!==null){G.value=" ";var it=G.scrollHeight-se;We!==null&&(rt=it*We,dt==="border-box"&&(rt=rt+se+ke),Ke=Math.max(rt,Ke)),Ue!==null&&(lt=it*Ue,dt==="border-box"&&(lt=lt+se+ke),$e=Ke>lt?"":"hidden",Ke=Math.min(lt,Ke))}return{height:Ke,minHeight:rt,maxHeight:lt,overflowY:$e,resize:"none"}}var V=ee("Gytx"),H=ee.n(V),re;(function(Ne){Ne[Ne.NONE=0]="NONE",Ne[Ne.RESIZING=1]="RESIZING",Ne[Ne.RESIZED=2]="RESIZED"})(re||(re={}));var ce=function(Ne){Object(z.a)(We,Ne);var Ie=Object(A.a)(We);function We(Ue){var xe;return Object(Y.a)(this,We),xe=Ie.call(this,Ue),xe.nextFrameActionId=void 0,xe.resizeFrameId=void 0,xe.textArea=void 0,xe.saveTextArea=function(se){xe.textArea=se},xe.handleResize=function(se){var ke=xe.state.resizeStatus,dt=xe.props,at=dt.autoSize,rt=dt.onResize;if(ke!==re.NONE)return;typeof rt=="function"&&rt(se),at&&xe.resizeOnNextFrame()},xe.resizeOnNextFrame=function(){cancelAnimationFrame(xe.nextFrameActionId),xe.nextFrameActionId=requestAnimationFrame(xe.resizeTextarea)},xe.resizeTextarea=function(){var se=xe.props.autoSize;if(!se||!xe.textArea)return;var ke=se.minRows,dt=se.maxRows,at=Z(xe.textArea,!1,ke,dt);xe.setState({textareaStyles:at,resizeStatus:re.RESIZING},function(){cancelAnimationFrame(xe.resizeFrameId),xe.resizeFrameId=requestAnimationFrame(function(){xe.setState({resizeStatus:re.RESIZED},function(){xe.resizeFrameId=requestAnimationFrame(function(){xe.setState({resizeStatus:re.NONE}),xe.fixFirefoxAutoScroll()})})})})},xe.renderTextArea=function(){var se=xe.props,ke=se.prefixCls,dt=ke===void 0?"rc-textarea":ke,at=se.autoSize,rt=se.onResize,lt=se.className,Ke=se.disabled,$e=xe.state,it=$e.textareaStyles,ft=$e.resizeStatus,ut=Object(d.a)(xe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ze=C()(dt,lt,Object(j.a)({},"".concat(dt,"-disabled"),Ke));"value"in ut&&(ut.value=ut.value||"");var qe=Object(W.a)(Object(W.a)(Object(W.a)({},xe.props.style),it),ft===re.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return I.createElement(f,{onResize:xe.handleResize,disabled:!(at||rt)},I.createElement("textarea",Object(le.a)({},ut,{className:Ze,style:qe,ref:xe.saveTextArea})))},xe.state={textareaStyles:{},resizeStatus:re.NONE},xe}return Object(L.a)(We,[{key:"componentDidUpdate",value:function(xe){(xe.value!==this.props.value||!H()(xe.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 xe=this.textArea.selectionStart,se=this.textArea.selectionEnd;this.textArea.setSelectionRange(xe,se)}}catch(ke){}}},{key:"render",value:function(){return this.renderTextArea()}}]),We}(I.Component),Ee=ce,we=function(Ne){Object(z.a)(We,Ne);var Ie=Object(A.a)(We);function We(Ue){var xe;Object(Y.a)(this,We),xe=Ie.call(this,Ue),xe.resizableTextArea=void 0,xe.focus=function(){xe.resizableTextArea.textArea.focus()},xe.saveTextArea=function(ke){xe.resizableTextArea=ke},xe.handleChange=function(ke){var dt=xe.props.onChange;xe.setValue(ke.target.value,function(){xe.resizableTextArea.resizeTextarea()}),dt&&dt(ke)},xe.handleKeyDown=function(ke){var dt=xe.props,at=dt.onPressEnter,rt=dt.onKeyDown;ke.keyCode===13&&at&&at(ke),rt&&rt(ke)};var se=typeof Ue.value=="undefined"||Ue.value===null?Ue.defaultValue:Ue.value;return xe.state={value:se},xe}return Object(L.a)(We,[{key:"setValue",value:function(xe,se){"value"in this.props||this.setState({value:xe},se)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return I.createElement(Ee,Object(le.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(xe){return"value"in xe?{value:xe.value}:null}}]),We}(I.Component),Ye=xt.default=we},ZW9T:function(zt,xt,ee){"use strict";ee.d(xt,"a",function(){return T});var le=ee("k1fw"),Y=ee("miYZ"),L=ee("tsqr"),z=ee("rAM+"),A=ee("tJVT"),I=ee("PpiC"),W=ee("q1tI"),j=ee.n(W),P=ee("bdgK");function D(m,p,w,x,g){var f=p.getWordUntilPosition(w),d={startLineNumber:w.lineNumber,endLineNumber:w.lineNumber,startColumn:f.startColumn,endColumn:f.endColumn},a=x.map(function(C){return{label:C,kind:m.languages.CompletionItemKind.Keyword,insertText:C,insertTextRules:m.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:d}});return g.map(function(C){a.push(Object(le.a)(Object(le.a)({},C),{},{range:d}))}),a}var E=function(m){var p={label:"ifelse",kind:m.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:m.languages.CompletionItemInsertTextRule.InsertAsSnippet},w=["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"];m.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(d,a){var C=D(m,d,a,w,[p]);return{suggestions:C}}});var x=["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"];m.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(d,a){var C=[{label:"print",kind:m.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:m.languages.CompletionItemInsertTextRule.InsertAsSnippet}],v=D(m,d,a,x,C);return{suggestions:v}}});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"];m.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(d,a){var C=[p,{label:"main",kind:m.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`),insertTextRules:m.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:m.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
|
|
`),insertTextRules:m.languages.CompletionItemInsertTextRule.InsertAsSnippet}],v=D(m,d,a,g,C);return{suggestions:v}}})},_="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",M=ee("LvDl");function R(m){return/^\d+$/.test(m)?"".concat(m,"px"):m}function k(){}var S=!1,c={"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 m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],p=m;if(Array.isArray(m)){for(var w=0;w<m.length;w++){var x=c[m[w]];if(x)return x}return p[0]}return c[p]||p}var l=null,u=xt.b=function(m){var p=m.width,w=p===void 0?"100%":p,x=m.height,g=x===void 0?"100%":x,f=m.value,d=m.language,a=d===void 0?"javascript":d,C=m.style,v=C===void 0?{}:C,b=m.options,y=b===void 0?{}:b,G=m.overrideServices,$=G===void 0?{}:G,Z=m.theme,V=Z===void 0?"vs-dark":Z,H=m.onEditBlur,re=m.onSave,ce=m.autoHeight,Ee=ce===void 0?!1:ce,we=m.forbidCopy,Ye=we===void 0?!1:we,Ne=m.onChange,Ie=Ne===void 0?k:Ne,We=m.editorDidMount,Ue=We===void 0?k:We,xe=m.onFocus,se=xe===void 0?k:xe,ke=m.filename,dt=ke===void 0?"educoder.txt":ke,at=Object(I.a)(m,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),rt=Object(W.useRef)(),lt=Object(W.useRef)({}),Ke=Object(W.useRef)(),$e=Object(W.useRef)(!1),it=Object(W.useRef)(),ft=Object(W.useState)(!1),ut=Object(A.a)(ft,2),Ze=ut[0],qe=ut[1];function Dt(){var ue;return rt.current&&(ue=new P.default(function(he){var Me=Object(z.a)(he),be;try{for(Me.s();!(be=Me.n()).done;){var Le=be.value;(Le.target.offsetHeight>0||Le.target.offsetWidth>0)&<.current.instance.layout()}}catch(tt){Me.e(tt)}finally{Me.f()}}),ue.observe(rt.current)),ue}function wt(){L.b.warn(decodeURIComponent(_))}var vt=function(){var he=lt.current.instance;if(f!=null&&he&&Ze){var Me=he.getModel();Me&&f!==Me.getValue()&&(S=!0,Me.setValue(f),he.layout(),S=!1)}};Object(W.useEffect)(function(){Ke.current&&clearTimeout(Ke.current),Ke.current=setTimeout(function(){vt()},500)},[f,Ze,lt.current]);function mt(){var ue=lt.current.instance;if(ue){var he=ue.getSelection(),Me=lt.current.pastePos||{},be=new l.Range(Me.startLineNumber||he.endLineNumber,Me.startColumn||he.endColumn,Me.endLineNumber||he.endLineNumber,Me.endColumn||he.endColumn);setTimeout(function(){ue.executeEdits("",[{range:be,text:""}])},300)}}function Nt(ue){(window.navigator.platform.match("Mac")?ue.metaKey:ue.ctrlKey)&&ue.keyCode==83&&(ue.preventDefault(),re())}var At=function(){if(Ee&<.current.instance){var he=lt.current.instance.getContentHeight();ne(he<g?g:he)}else ne(g)};function Ot(ue){var he=document.createEvent("MouseEvents");he.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),ue.dispatchEvent(he)}function He(ue,he){var Me=window.URL||window.webkitURL||window,be=new Blob([he]),Le=document.createElementNS("http://www.w3.org/1999/xhtml","a");Le.href=Me.createObjectURL(be),Le.download=ue,Ot(Le)}Object(W.useEffect)(function(){At()},[At]),Object(W.useEffect)(function(){rt.current&&!Ze&&ee.e(27).then(ee.t.bind(null,"M/lh",7)).then(function(ue){try{l=ue,lt.current.instance=l.editor.create(rt.current,{value:f,language:o(a),theme:V,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},$);var he=lt.current.instance;if(Ue(he,l),setTimeout(function(){At(),lt.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){He(dt||"educoder.txt",he.getValue())}})},500),lt.current.subscription=he.onDidChangeModelContent(function(be){$e.current?clearTimeout(it.current):(At(),Ie(he.getValue(),be)),it.current=setTimeout(function(){$e.current=!1},500)}),window.Monaco||E(l),Ye&&(he.addCommand(l.KeyMod.CtrlCmd|l.KeyMod.Shift|l.KeyCode.KEY_V,function(){return wt(),null}),he.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_C,function(){return wt(),null})),window.Monaco=l,H&&he.onDidBlurEditorWidget(function(){H(he.getValue())}),se&&he.onDidFocusEditorText(function(){se(he.getValue())}),Ye){he.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_V,function(){return wt(),null}),he.onDidPaste(function(be){lt.current.pastePos=be});try{window.addEventListener("paste",mt)}catch(be){}}var Me=Dt();return qe(!0),function(){var be=lt.current.instance;be.dispose();var Le=be.getModel();Le&&Le.dispose(),lt.current.subscription&<.current.subscription.dispose(),Ye&&window.removeEventListener("paste",mt),Me.unobserve(rt.current)}}catch(be){}})},[]),Object(W.useEffect)(function(){var ue=lt.current.instance;if(ue&&Ze)return document.addEventListener("keydown",Nt,!1),function(){document.removeEventListener("keydown",Nt)}},[re,Ze]),Object(W.useEffect)(function(){var ue=lt.current.instance;if(ue&&Ze){var he=o(a);l.editor.setModelLanguage(ue.getModel(),he),console.log("language:",a,ue.getModel(),he)}},[a,Ze]),Object(W.useEffect)(function(){var ue=lt.current.instance;ue&&Ze&&l.editor.setTheme(V)},[V,Ze]),Object(W.useEffect)(function(){var ue=lt.current.instance;ue&&Ze&&(ue.updateOptions(Object(le.a)({},y)),setTimeout(function(){ue.getModel().updateOptions(Object(le.a)({},y))},200))},[JSON.stringify(y),Ze]),Object(W.useEffect)(function(){var ue=lt.current.instance;ue&&Ze&&ue.layout()},[w,g,Ze]);var Ut=Object(W.useState)(R(w)),Lt=Object(A.a)(Ut,2),Xe=Lt[0],nt=Lt[1],_e=Object(W.useState)(R(g)),ve=Object(A.a)(_e,2),Ce=ve[0],ne=ve[1],ie=Object(le.a)(Object(le.a)({},v),{},{width:Xe,height:Ce});return j.a.createElement("div",{className:"my-monaco-editor",ref:rt,style:ie})};function T(m){var p=m.width,w=p===void 0?"100%":p,x=m.height,g=x===void 0?"100%":x,f=m.original,d=m.modified,a=m.language,C=m.options,v=C===void 0?{}:C,b=Object(W.useRef)(),y=Object(W.useState)(null),G=Object(A.a)(y,2),$=G[0],Z=G[1];function V(Ee){var we;return b.current&&(we=new P.default(function(Ye){var Ne=Object(z.a)(Ye),Ie;try{for(Ne.s();!(Ie=Ne.n()).done;){var We=Ie.value;(We.target.offsetHeight>0||We.target.offsetWidth>0)&&Ee.layout()}}catch(Ue){Ne.e(Ue)}finally{Ne.f()}}),we.observe(b.current)),we}Object(W.useEffect)(function(){b.current&&ee.e(27).then(ee.t.bind(null,"M/lh",7)).then(function(Ee){l=Ee;var we=l.editor.createDiffEditor(b.current,Object(le.a)(Object(le.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},v),{},{wordWrap:!0}));Z(we);var Ye=V(we);return function(){we.dispose();var Ne=we.getModel();Ne&&Ne.dispose(),Ye.unobserve(b.current)}})},[]),Object(W.useEffect)(function(){$&&$.setModel({original:l.editor.createModel(f,a),modified:l.editor.createModel(d,a)})},[f,d,a,$]);var H=R(w),re=R(g),ce={width:H,height:re};return j.a.createElement("div",{className:"my-diff-editor",ref:b,style:ce})}},ZpRC:function(zt,xt,ee){"use strict";function le(E){return typeof E=="object"&&E!=null&&E.nodeType===1}function Y(E,_){return(!_||E!=="hidden")&&E!=="visible"&&E!=="clip"}function L(E,_){if(E.clientHeight<E.scrollHeight||E.clientWidth<E.scrollWidth){var M=getComputedStyle(E,null);return Y(M.overflowY,_)||Y(M.overflowX,_)||function(R){var k=function(S){if(!S.ownerDocument||!S.ownerDocument.defaultView)return null;try{return S.ownerDocument.defaultView.frameElement}catch(c){return null}}(R);return!!k&&(k.clientHeight<R.scrollHeight||k.clientWidth<R.scrollWidth)}(E)}return!1}function z(E,_,M,R,k,S,c,o){return S<E&&c>_||S>E&&c<_?0:S<=E&&o<=M||c>=_&&o>=M?S-E-R:c>_&&o<M||S<E&&o>M?c-_+k:0}var A=function(E,_){var M=window,R=_.scrollMode,k=_.block,S=_.inline,c=_.boundary,o=_.skipOverflowHiddenElements,l=typeof c=="function"?c:function(it){return it!==c};if(!le(E))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,T=[],m=E;le(m)&&l(m);){if((m=m.parentElement)===u){T.push(m);break}m!=null&&m===document.body&&L(m)&&!L(document.documentElement)||m!=null&&L(m,o)&&T.push(m)}for(var p=M.visualViewport?M.visualViewport.width:innerWidth,w=M.visualViewport?M.visualViewport.height:innerHeight,x=window.scrollX||pageXOffset,g=window.scrollY||pageYOffset,f=E.getBoundingClientRect(),d=f.height,a=f.width,C=f.top,v=f.right,b=f.bottom,y=f.left,G=k==="start"||k==="nearest"?C:k==="end"?b:C+d/2,$=S==="center"?y+a/2:S==="end"?v:y,Z=[],V=0;V<T.length;V++){var H=T[V],re=H.getBoundingClientRect(),ce=re.height,Ee=re.width,we=re.top,Ye=re.right,Ne=re.bottom,Ie=re.left;if(R==="if-needed"&&C>=0&&y>=0&&b<=w&&v<=p&&C>=we&&b<=Ne&&y>=Ie&&v<=Ye)return Z;var We=getComputedStyle(H),Ue=parseInt(We.borderLeftWidth,10),xe=parseInt(We.borderTopWidth,10),se=parseInt(We.borderRightWidth,10),ke=parseInt(We.borderBottomWidth,10),dt=0,at=0,rt="offsetWidth"in H?H.offsetWidth-H.clientWidth-Ue-se:0,lt="offsetHeight"in H?H.offsetHeight-H.clientHeight-xe-ke:0;if(u===H)dt=k==="start"?G:k==="end"?G-w:k==="nearest"?z(g,g+w,w,xe,ke,g+G,g+G+d,d):G-w/2,at=S==="start"?$:S==="center"?$-p/2:S==="end"?$-p:z(x,x+p,p,Ue,se,x+$,x+$+a,a),dt=Math.max(0,dt+g),at=Math.max(0,at+x);else{dt=k==="start"?G-we-xe:k==="end"?G-Ne+ke+lt:k==="nearest"?z(we,Ne,ce,xe,ke+lt,G,G+d,d):G-(we+ce/2)+lt/2,at=S==="start"?$-Ie-Ue:S==="center"?$-(Ie+Ee/2)+rt/2:S==="end"?$-Ye+se+rt:z(Ie,Ye,Ee,Ue,se+rt,$,$+a,a);var Ke=H.scrollLeft,$e=H.scrollTop;G+=$e-(dt=Math.max(0,Math.min($e+dt,H.scrollHeight-ce+lt))),$+=Ke-(at=Math.max(0,Math.min(Ke+at,H.scrollWidth-Ee+rt)))}Z.push({el:H,top:dt,left:at})}return Z};function I(E){return E===Object(E)&&Object.keys(E).length!==0}function W(E,_){_===void 0&&(_="auto");var M="scrollBehavior"in document.body.style;E.forEach(function(R){var k=R.el,S=R.top,c=R.left;k.scroll&&M?k.scroll({top:S,left:c,behavior:_}):(k.scrollTop=S,k.scrollLeft=c)})}function j(E){return E===!1?{block:"end",inline:"nearest"}:I(E)?E:{block:"start",inline:"nearest"}}function P(E,_){var M=!E.ownerDocument.documentElement.contains(E);if(I(_)&&typeof _.behavior=="function")return _.behavior(M?[]:A(E,_));if(M)return;var R=j(_);return W(A(E,R),R.behavior)}var D=xt.a=P},bT9E:function(zt,xt,ee){"use strict";ee.d(xt,"a",function(){return Y});var le=ee("VTBJ");function Y(L,z){var A=Object(le.a)({},L);return Array.isArray(z)&&z.forEach(function(I){delete A[I]}),A}},c5Ni:function(zt,xt,ee){},dejd:function(zt,xt,ee){},dmUQ:function(zt,xt,ee){"use strict";var le=ee("Ff2n"),Y=ee("rePB"),L=ee("1OyB"),z=ee("vuIU"),A=ee("Ji7U"),I=ee("md7G"),W=ee("foSv"),j=ee("q1tI"),P=ee.n(j),D=ee("TSYQ"),E=ee.n(D),_=ee("4IlW");function M(d,a){var C=Object.keys(d);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(d);a&&(v=v.filter(function(b){return Object.getOwnPropertyDescriptor(d,b).enumerable})),C.push.apply(C,v)}return C}function R(d){for(var a=1;a<arguments.length;a++){var C=arguments[a]!=null?arguments[a]:{};a%2?M(Object(C),!0).forEach(function(v){Object(Y.a)(d,v,C[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(C)):M(Object(C)).forEach(function(v){Object.defineProperty(d,v,Object.getOwnPropertyDescriptor(C,v))})}return d}function k(d){var a=S();return function(){var v=Object(W.a)(d),b;if(a){var y=Object(W.a)(this).constructor;b=Reflect.construct(v,arguments,y)}else b=v.apply(this,arguments);return Object(I.a)(this,b)}}function S(){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(d){return!1}}function c(){}function o(d){d.preventDefault()}var l=function(a){return a.replace(/[^\w.-]+/g,"")},u=200,T=600,m=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,p=function(a){return a!=null},w=function(a,C){return C===a||typeof C=="number"&&typeof a=="number"&&isNaN(C)&&isNaN(a)},x=function(d){Object(A.a)(C,d);var a=k(C);function C(v){var b;Object(L.a)(this,C),b=a.call(this,v),b.onKeyDown=function($){var Z=b.props,V=Z.onKeyDown,H=Z.onPressEnter;if($.keyCode===_.a.UP){var re=b.getRatio($);b.up($,re,null),b.stop()}else if($.keyCode===_.a.DOWN){var ce=b.getRatio($);b.down($,ce,null),b.stop()}else $.keyCode===_.a.ENTER&&H&&H($);if(b.recordCursorPosition(),b.lastKeyCode=$.keyCode,V){for(var Ee=arguments.length,we=new Array(Ee>1?Ee-1:0),Ye=1;Ye<Ee;Ye++)we[Ye-1]=arguments[Ye];V.apply(void 0,[$].concat(we))}},b.onKeyUp=function($){var Z=b.props.onKeyUp;if(b.stop(),b.recordCursorPosition(),Z){for(var V=arguments.length,H=new Array(V>1?V-1:0),re=1;re<V;re++)H[re-1]=arguments[re];Z.apply(void 0,[$].concat(H))}},b.onChange=function($){var Z=b.props.onChange;b.state.focused&&(b.inputting=!0),b.rawInput=b.props.parser(b.getValueFromEvent($)),b.setState({inputValue:b.rawInput}),Z(b.toNumber(b.rawInput))},b.onMouseUp=function(){var $=b.props.onMouseUp;b.recordCursorPosition(),$&&$.apply(void 0,arguments)},b.onFocus=function(){var $;b.setState({focused:!0}),($=b.props).onFocus.apply($,arguments)},b.onBlur=function(){var $=b.props.onBlur;b.inputting=!1,b.setState({focused:!1});var Z=b.getCurrentValidValue(b.state.inputValue),V=b.setValue(Z,c);if($){var H=b.input.value,re=b.getInputDisplayValue({focus:!1,value:V});b.input.value=re&&Number(re),$.apply(void 0,arguments),b.input.value=H}},b.getRatio=function($){var Z=1;return $.metaKey||$.ctrlKey?Z=.1:$.shiftKey&&(Z=10),Z},b.getFullNum=function($){return isNaN($)?$:/e/i.test(String($))?Number($).toFixed(18).replace(/\.?0+$/,""):$},b.getPrecision=function($){if(p(b.props.precision))return b.props.precision;var Z=String($);if(Z.indexOf("e-")>=0)return parseInt(Z.slice(Z.indexOf("e-")+2),10);var V=0;return Z.indexOf(".")>=0&&(V=Z.length-Z.indexOf(".")-1),V},b.getInputDisplayValue=function($){var Z=$||b.state,V=Z.focused,H=Z.inputValue,re=Z.value,ce;V?ce=H:ce=b.toPrecisionAsStep(re),ce==null&&(ce="");var Ee=b.formatWrapper(ce);return p(b.props.decimalSeparator)&&(Ee=Ee.toString().replace(".",b.props.decimalSeparator)),Ee},b.recordCursorPosition=function(){try{b.cursorStart=b.input.selectionStart,b.cursorEnd=b.input.selectionEnd,b.currentValue=b.input.value,b.cursorBefore=b.input.value.substring(0,b.cursorStart),b.cursorAfter=b.input.value.substring(b.cursorEnd)}catch($){}},b.restoreByAfter=function($){if($===void 0)return!1;var Z=b.input.value,V=Z.lastIndexOf($);if(V===-1)return!1;var H=b.cursorBefore.length;return b.lastKeyCode===_.a.DELETE&&b.cursorBefore.charAt(H-1)===$[0]?(b.fixCaret(H,H),!0):V+$.length===Z.length?(b.fixCaret(V,V),!0):!1},b.partRestoreByAfter=function($){return $===void 0?!1:Array.prototype.some.call($,function(Z,V){var H=$.substring(V);return b.restoreByAfter(H)})},b.isNotCompleteNumber=function($){return isNaN($)||$===""||$===null||$&&$.toString().indexOf(".")===$.toString().length-1},b.stop=function(){b.autoStepTimer&&clearTimeout(b.autoStepTimer)},b.down=function($,Z,V){b.pressingUpOrDown=!0,b.step("down",$,Z,V)},b.up=function($,Z,V){b.pressingUpOrDown=!0,b.step("up",$,Z,V)},b.saveInput=function($){b.input=$};var y=v.value;y===void 0&&(y=v.defaultValue),b.state={focused:v.autoFocus};var G=b.getValidValue(b.toNumber(y));return b.state=R(R({},b.state),{},{inputValue:b.toPrecisionAsStep(G),value:G}),b}return Object(z.a)(C,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(b){var y=this.props,G=y.value,$=y.onChange,Z=y.max,V=y.min,H=this.state.focused;if(b){if(!w(b.value,G)||!w(b.max,Z)||!w(b.min,V)){var re=H?G:this.getValidValue(G),ce;this.pressingUpOrDown?ce=re:this.inputting?ce=this.rawInput:ce=this.toPrecisionAsStep(re),this.setState({value:re,inputValue:ce})}var Ee="value"in this.props?G:this.state.value;"max"in this.props&&b.max!==Z&&typeof Ee=="number"&&Ee>Z&&$&&$(Z),"min"in this.props&&b.min!==V&&typeof Ee=="number"&&Ee<V&&$&&$(V)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var we=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===_.a.BACKSPACE?we=this.cursorStart-1:this.lastKeyCode===_.a.DELETE&&(we=this.cursorStart):we=this.input.value.length,this.fixCaret(we,we)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case _.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case _.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ye){}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(b){var y=b;return y===""?y="":this.isNotCompleteNumber(parseFloat(y))?y=this.state.value:y=this.getValidValue(y),this.toNumber(y)}},{key:"getValueFromEvent",value:function(b){var y=b.target.value.trim().replace(/。/g,".");return p(this.props.decimalSeparator)&&(y=y.replace(this.props.decimalSeparator,".")),y}},{key:"getValidValue",value:function(b){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,$=parseFloat(b);return isNaN($)?b:($<y&&($=y),$>G&&($=G),$)}},{key:"setValue",value:function(b,y){var G=this.props.precision,$=this.isNotCompleteNumber(parseFloat(b))?null:parseFloat(b),Z=this.state.value,V=Z===void 0?null:Z,H=this.state.inputValue,re=H===void 0?null:H,ce=typeof $=="number"?$.toFixed(G):"".concat($),Ee=$!==V||ce!=="".concat(re);return"value"in this.props?(re=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:re},y)):this.setState({value:$,inputValue:this.toPrecisionAsStep(b)},y),Ee&&this.props.onChange($),$}},{key:"getMaxPrecision",value:function(b){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,G=this.props,$=G.precision,Z=G.step;if(p($))return $;var V=this.getPrecision(y),H=this.getPrecision(Z),re=this.getPrecision(b);return b?Math.max(re,V+H):V+H}},{key:"getPrecisionFactor",value:function(b){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,G=this.getMaxPrecision(b,y);return Math.pow(10,G)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(b){return this.props.formatter?this.props.formatter(b):b}},{key:"toPrecisionAsStep",value:function(b){if(this.isNotCompleteNumber(b)||b==="")return b;var y=Math.abs(this.getMaxPrecision(b));return isNaN(y)?b.toString():Number(b).toFixed(y)}},{key:"toNumber",value:function(b){var y=this.props.precision,G=this.state.focused,$=b&&b.length>16&&G;return this.isNotCompleteNumber(b)||$?b:p(y)?Math.round(b*Math.pow(10,y))/Math.pow(10,y):Number(b)}},{key:"upStep",value:function(b,y){var G=this.props.step,$=this.getPrecisionFactor(b,y),Z=Math.abs(this.getMaxPrecision(b,y)),V=(($*b+$*G*y)/$).toFixed(Z);return this.toNumber(V)}},{key:"downStep",value:function(b,y){var G=this.props.step,$=this.getPrecisionFactor(b,y),Z=Math.abs(this.getMaxPrecision(b,y)),V=(($*b-$*G*y)/$).toFixed(Z);return this.toNumber(V)}},{key:"step",value:function(b,y){var G=this,$=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,Z=arguments.length>3?arguments[3]:void 0;this.stop(),y&&(y.persist(),y.preventDefault());var V=this.props;if(V.disabled)return;var H=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(H))return;var re=this["".concat(b,"Step")](H,$),ce=re>V.max||re<V.min;if(re>V.max?re=V.max:re<V.min&&(re=V.min),this.setValue(re,null),this.setState({focused:!0},function(){G.pressingUpOrDown=!1}),ce)return;this.autoStepTimer=setTimeout(function(){G[b](y,$,!0)},Z?u:T)}},{key:"fixCaret",value:function(b,y){if(b===void 0||y===void 0||!this.input||!this.input.value)return;try{var G=this.input.selectionStart,$=this.input.selectionEnd;(b!==G||y!==$)&&this.input.setSelectionRange(b,y)}catch(Z){}}},{key:"render",value:function(){var b,y=this.props,G=y.prefixCls,$=y.disabled,Z=y.readOnly,V=y.useTouch,H=y.autoComplete,re=y.upHandler,ce=y.downHandler,Ee=y.className,we=y.max,Ye=y.min,Ne=y.style,Ie=y.title,We=y.onMouseEnter,Ue=y.onMouseLeave,xe=y.onMouseOver,se=y.onMouseOut,ke=y.required,dt=y.onClick,at=y.tabIndex,rt=y.type,lt=y.placeholder,Ke=y.id,$e=y.inputMode,it=y.pattern,ft=y.step,ut=y.maxLength,Ze=y.autoFocus,qe=y.name,Dt=y.onPaste,wt=y.onInput,vt=Object(le.a)(y,["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"]),mt=this.state,Nt=mt.value,At=mt.focused,Ot=E()(G,(b={},Object(Y.a)(b,Ee,!!Ee),Object(Y.a)(b,"".concat(G,"-disabled"),$),Object(Y.a)(b,"".concat(G,"-focused"),At),b)),He={};Object.keys(vt).forEach(function(he){(he.substr(0,5)==="data-"||he.substr(0,5)==="aria-"||he==="role")&&(He[he]=vt[he])});var Ut=!Z&&!$,Lt=this.getInputDisplayValue(null),Xe=(Nt||Nt===0)&&(isNaN(Nt)||Number(Nt)>=we),nt=(Nt||Nt===0)&&(isNaN(Nt)||Number(Nt)<=Ye),_e=Xe||$||Z,ve=nt||$||Z,Ce=E()("".concat(G,"-handler"),"".concat(G,"-handler-up"),Object(Y.a)({},"".concat(G,"-handler-up-disabled"),_e)),ne=E()("".concat(G,"-handler"),"".concat(G,"-handler-down"),Object(Y.a)({},"".concat(G,"-handler-down-disabled"),ve)),ie=V?{onTouchStart:_e?c:this.up,onTouchEnd:this.stop}:{onMouseDown:_e?c:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ue=V?{onTouchStart:ve?c:this.down,onTouchEnd:this.stop}:{onMouseDown:ve?c:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return P.a.createElement("div",{className:Ot,style:Ne,title:Ie,onMouseEnter:We,onMouseLeave:Ue,onMouseOver:xe,onMouseOut:se,onFocus:function(){return null},onBlur:function(){return null}},P.a.createElement("div",{className:"".concat(G,"-handler-wrap")},P.a.createElement("span",Object.assign({unselectable:"on"},ie,{role:"button","aria-label":"Increase Value","aria-disabled":_e,className:Ce}),re||P.a.createElement("span",{unselectable:"on",className:"".concat(G,"-handler-up-inner"),onClick:o})),P.a.createElement("span",Object.assign({unselectable:"on"},ue,{role:"button","aria-label":"Decrease Value","aria-disabled":ve,className:ne}),ce||P.a.createElement("span",{unselectable:"on",className:"".concat(G,"-handler-down-inner"),onClick:o}))),P.a.createElement("div",{className:"".concat(G,"-input-wrap")},P.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ye,"aria-valuemax":we,"aria-valuenow":Nt,required:ke,type:rt,placeholder:lt,onPaste:Dt,onClick:dt,onMouseUp:this.onMouseUp,className:"".concat(G,"-input"),tabIndex:at,autoComplete:H,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Ut?this.onKeyDown:c,onKeyUp:Ut?this.onKeyUp:c,autoFocus:Ze,maxLength:ut,readOnly:Z,disabled:$,max:we,min:Ye,step:ft,name:qe,title:Ie,id:Ke,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Lt),pattern:it,inputMode:$e,onInput:wt},He))))}}]),C}(P.a.Component);x.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:m,min:-m,step:1,style:{},onChange:c,onKeyDown:c,onPressEnter:c,onFocus:c,onBlur:c,parser:l,required:!1,autoComplete:"off"};var g=x,f=xt.a=g},fJjg:function(zt,xt,ee){"use strict";var le=ee("2qtc"),Y=ee("kLXV"),L=ee("7Kak"),z=ee("9yH6"),A=ee("k1fw"),I=ee("miYZ"),W=ee("tsqr"),j=ee("9og8"),P=ee("tJVT"),D=ee("PpiC"),E=ee("5NDa"),_=ee("5rEg"),M=ee("WmNS"),R=ee.n(M),k=ee("q1tI"),S=ee.n(k),c=ee("9kvl"),o=ee("Nska"),l=ee.n(o),u=ee("1vsH"),T=_.a.Search,m=function(w){var x=w.userDetail,g=w.globalSetting,f=w.loading,d=w.dispatch,a=Object(D.a)(w,["userDetail","globalSetting","loading","dispatch"]),C=Object(k.useState)(""),v=Object(P.a)(C,2),b=v[0],y=v[1],G=Object(k.useState)([]),$=Object(P.a)(G,2),Z=$[0],V=$[1],H=Object(k.useState)(),re=Object(P.a)(H,2),ce=re[0],Ee=re[1],we=Object(k.useState)(!1),Ye=Object(P.a)(we,2),Ne=Ye[0],Ie=Ye[1];Object(k.useEffect)(function(){We()},[]);var We=function(){var xe=Object(j.a)(R.a.mark(function se(){var ke;return R.a.wrap(function(at){for(;;)switch(at.prev=at.next){case 0:return at.next=2,d({type:"userDetail/topicGetCourseList",payload:{search:b}});case 2:ke=at.sent,ke&&V((ke==null?void 0:ke.courses)||[]);case 4:case"end":return at.stop()}},se)}));return function(){return xe.apply(this,arguments)}}(),Ue=function(){var xe=Object(j.a)(R.a.mark(function se(){var ke,dt,at,rt,lt;return R.a.wrap(function($e){for(;;)switch($e.prev=$e.next){case 0:if(ce){$e.next=4;break}return W.b.info("\u60A8\u9700\u8981\u521B\u5EFA\u8BFE\u5802\uFF0C\u624D\u80FD\u53D1\u9001"),Ie(!0),$e.abrupt("return");case 4:return $e.next=6,d({type:"userDetail/topicSendToClass",payload:Object(A.a)({course_id:ce},(ke=x.actionTabs)===null||ke===void 0?void 0:ke.params)});case 6:dt=$e.sent,d({type:"userDetail/setActionTabs",payload:{}}),dt&&dt.status===0&&(lt={normal:"common_homework",group:"group_homework",exercise:"exercise",poll:"poll"},Object(u.O)("/classrooms/".concat(ce,"/").concat(lt[(at=x.actionTabs)===null||at===void 0||((rt=at.params)===null||rt===void 0)?void 0:rt.object_type])));case 9:case"end":return $e.stop()}},se)}));return function(){return xe.apply(this,arguments)}}();return S.a.createElement(Y.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:x.actionTabs.key==="UserDetail-SendToClass",title:"\u53D1\u9001\u81F3\u8BFE\u5802",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",confirmLoading:f["userDetail/sendToClass"],width:600,onOk:Ue,onCancel:function(){d({type:"userDetail/setActionTabs",payload:{}})}},S.a.createElement("div",{className:l.a.wrap},S.a.createElement("div",{className:l.a.title},"\u6E29\u99A8\u63D0\u793A\uFF1A\u9009\u62E9\u7684\u9898\u5C06\u4F1A\u53D1\u9001\u5230\u6307\u5B9A\u8BFE\u5802"),S.a.createElement("div",{className:"mb10"},S.a.createElement(T,{placeholder:"\u8F93\u5165\u8BFE\u5802\u540D\u79F0\u7684\u5173\u952E\u5B57\u8FDB\u884C\u641C\u7D22",value:b,onChange:function(se){return y(se.target.value)},onSearch:function(se){y(se),We()}})),S.a.createElement("div",{className:l.a.radioWrap},S.a.createElement(z.a.Group,{value:ce,onChange:function(se){Ee(se.target.value),Ie(!1)}},Z.map(function(xe,se){return S.a.createElement(z.a,{className:l.a.radio,value:xe.course_id,key:xe.course_id},xe.course_name)}))),Ne&&S.a.createElement("div",{className:l.a.colorFF0000},"\u8BF7\u5148\u9009\u62E9\u8BFE\u5802")))};xt.a=Object(c.a)(function(p){var w=p.userDetail,x=p.loading,g=p.globalSetting;return{userDetail:w,globalSetting:g,loading:x.effects}})(m)},k3GJ:function(zt,xt,ee){"use strict";ee.d(xt,"a",function(){return Eo});var le=ee("rePB"),Y=ee("ODXe"),L=ee("Ff2n"),z=ee("VTBJ"),A=ee("q1tI"),I=ee("TSYQ"),W=ee.n(I),j=ee("Zm9Q"),P=ee("6cGi"),D=ee("KQm4"),E=ee("xEkU"),_=ee.n(E),M=ee("t23M");function R(de){var Se=Object(A.useRef)(),Ae=Object(A.useRef)(!1);function fe(){for(var J=arguments.length,oe=new Array(J),te=0;te<J;te++)oe[te]=arguments[te];Ae.current||(_.a.cancel(Se.current),Se.current=_()(function(){de.apply(void 0,oe)}))}return Object(A.useEffect)(function(){return function(){Ae.current=!0,_.a.cancel(Se.current)}},[]),fe}function k(de){var Se=Object(A.useRef)([]),Ae=Object(A.useState)({}),fe=Object(Y.a)(Ae,2),J=fe[1],oe=Object(A.useRef)(typeof de=="function"?de():de),te=R(function(){var ge=oe.current;Se.current.forEach(function(Oe){ge=Oe(ge)}),Se.current=[],oe.current=ge,J({})});function me(ge){Se.current.push(ge),te()}return[oe.current,me]}var S=ee("4IlW");function c(de,Se){var Ae,fe=de.prefixCls,J=de.id,oe=de.active,te=de.rtl,me=de.tab,ge=me.key,Oe=me.tab,Te=me.disabled,De=me.closeIcon,Ve=de.tabBarGutter,st=de.tabPosition,ot=de.closable,Et=de.renderWrapper,nr=de.removeAriaLabel,vr=de.editable,lr=de.onClick,hr=de.onRemove,yr=de.onFocus,mr="".concat(fe,"-tab");A.useEffect(function(){return hr},[]);var fr={};st==="top"||st==="bottom"?fr[te?"marginLeft":"marginRight"]=Ve:fr.marginBottom=Ve;var Nr=vr&&ot!==!1&&!Te;function Sr(Jt){if(Te)return;lr(Jt)}function vn(Jt){Jt.preventDefault(),Jt.stopPropagation(),vr.onEdit("remove",{key:ge,event:Jt})}var Tr=A.createElement("div",{key:ge,ref:Se,className:W()(mr,(Ae={},Object(le.a)(Ae,"".concat(mr,"-with-remove"),Nr),Object(le.a)(Ae,"".concat(mr,"-active"),oe),Object(le.a)(Ae,"".concat(mr,"-disabled"),Te),Ae)),style:fr,onClick:Sr},A.createElement("div",{role:"tab","aria-selected":oe,id:J&&"".concat(J,"-tab-").concat(ge),className:"".concat(mr,"-btn"),"aria-controls":J&&"".concat(J,"-panel-").concat(ge),"aria-disabled":Te,tabIndex:Te?null:0,onClick:function(Yt){Yt.stopPropagation(),Sr(Yt)},onKeyDown:function(Yt){[S.a.SPACE,S.a.ENTER].includes(Yt.which)&&(Yt.preventDefault(),Sr(Yt))},onFocus:yr},Oe),Nr&&A.createElement("button",{type:"button","aria-label":nr||"remove",tabIndex:0,className:"".concat(mr,"-remove"),onClick:function(Yt){Yt.stopPropagation(),vn(Yt)}},De||vr.removeIcon||"\xD7"));return Et&&(Tr=Et(Tr)),Tr}var o=A.forwardRef(c),l={width:0,height:0,left:0,top:0};function u(de,Se,Ae){return Object(A.useMemo)(function(){for(var fe,J=new Map,oe=Se.get((fe=de[0])===null||fe===void 0?void 0:fe.key)||l,te=oe.left+oe.width,me=0;me<de.length;me+=1){var ge=de[me].key,Oe=Se.get(ge);if(!Oe){var Te;Oe=Se.get((Te=de[me-1])===null||Te===void 0?void 0:Te.key)||l}var De=J.get(ge)||Object(z.a)({},Oe);De.right=te-De.left-De.width,J.set(ge,De)}return J},[de.map(function(fe){return fe.key}).join("_"),Se,Ae])}var T={width:0,height:0,left:0,top:0,right:0};function m(de,Se,Ae,fe,J){var oe=J.tabs,te=J.tabPosition,me=J.rtl,ge,Oe,Te;["top","bottom"].includes(te)?(ge="width",Oe=me?"right":"left",Te=Math.abs(Se.left)):(ge="height",Oe="top",Te=-Se.top);var De=Se[ge],Ve=Ae[ge],st=fe[ge],ot=De;return Ve+st>De&&(ot=De-st),Object(A.useMemo)(function(){if(!oe.length)return[0,0];for(var Et=oe.length,nr=Et,vr=0;vr<Et;vr+=1){var lr=de.get(oe[vr].key)||T;if(lr[Oe]+lr[ge]>Te+ot){nr=vr-1;break}}for(var hr=0,yr=Et-1;yr>=0;yr-=1){var mr=de.get(oe[yr].key)||T;if(mr[Oe]<Te){hr=yr+1;break}}return[hr,nr]},[de,Te,ot,te,oe.map(function(Et){return Et.key}).join("_"),me])}var p=ee("wx14"),w=ee("1OyB"),x=ee("vuIU"),g=ee("JX7q"),f=ee("Ji7U"),d=ee("LK+K"),a=ee("I8Z2"),C=ee("bT9E"),v=ee("2GS6"),b=ee("Gytx"),y=ee.n(b),G=ee("U8pU"),$=/iPhone/i,Z=/iPod/i,V=/iPad/i,H=/\bAndroid(?:.+)Mobile\b/i,re=/Android/i,ce=/\bAndroid(?:.+)SD4930UR\b/i,Ee=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,we=/Windows Phone/i,Ye=/\bWindows(?:.+)ARM\b/i,Ne=/BlackBerry/i,Ie=/BB10/i,We=/Opera Mini/i,Ue=/\b(CriOS|Chrome)(?:.+)Mobile/i,xe=/Mobile(?:.+)Firefox\b/i;function se(de,Se){return de.test(Se)}function ke(de){var Se=de||(typeof navigator!="undefined"?navigator.userAgent:""),Ae=(Se||"").split("[FBAN");if(typeof Ae[1]!="undefined"){var fe=Ae,J=Object(Y.a)(fe,1);Se=J[0]}if(Ae=Se.split("Twitter"),typeof Ae[1]!="undefined"){var oe=Ae,te=Object(Y.a)(oe,1);Se=te[0]}var me={apple:{phone:se($,Se)&&!se(we,Se),ipod:se(Z,Se),tablet:!se($,Se)&&se(V,Se)&&!se(we,Se),device:(se($,Se)||se(Z,Se)||se(V,Se))&&!se(we,Se)},amazon:{phone:se(ce,Se),tablet:!se(ce,Se)&&se(Ee,Se),device:se(ce,Se)||se(Ee,Se)},android:{phone:!se(we,Se)&&se(ce,Se)||!se(we,Se)&&se(H,Se),tablet:!se(we,Se)&&!se(ce,Se)&&!se(H,Se)&&(se(Ee,Se)||se(re,Se)),device:!se(we,Se)&&(se(ce,Se)||se(Ee,Se)||se(H,Se)||se(re,Se))||se(/\bokhttp\b/i,Se)},windows:{phone:se(we,Se),tablet:se(Ye,Se),device:se(we,Se)||se(Ye,Se)},other:{blackberry:se(Ne,Se),blackberry10:se(Ie,Se),opera:se(We,Se),firefox:se(xe,Se),chrome:se(Ue,Se),device:se(Ne,Se)||se(Ie,Se)||se(We,Se)||se(xe,Se)||se(Ue,Se)},any:null,phone:null,tablet:null};return me.any=me.apple.device||me.android.device||me.windows.device||me.other.device,me.phone=me.apple.phone||me.android.phone||me.windows.phone,me.tablet=me.apple.tablet||me.android.tablet||me.windows.tablet,me}var dt=Object(z.a)(Object(z.a)({},ke()),{},{isMobile:ke}),at=dt;function rt(){}function lt(de,Se,Ae){var fe=Se||"";return de.key||"".concat(fe,"item_").concat(Ae)}function Ke(de){return"".concat(de,"-menu-")}function $e(de,Se){var Ae=-1;A.Children.forEach(de,function(fe){Ae+=1,fe&&fe.type&&fe.type.isMenuItemGroup?A.Children.forEach(fe.props.children,function(J){Ae+=1,Se(J,Ae)}):Se(fe,Ae)})}function it(de,Se,Ae){if(!de||Ae.find)return;A.Children.forEach(de,function(fe){if(fe){var J=fe.type;if(!J||!(J.isSubMenu||J.isMenuItem||J.isMenuItemGroup))return;Se.indexOf(fe.key)!==-1?Ae.find=!0:fe.props.children&&it(fe.props.children,Se,Ae)}})}var ft=["defaultSelectedKeys","selectedKeys","defaultOpenKeys","openKeys","mode","getPopupContainer","onSelect","onDeselect","onDestroy","openTransitionName","openAnimation","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","triggerSubMenuAction","level","selectable","multiple","onOpenChange","visible","focusable","defaultActiveFirst","prefixCls","inlineIndent","parentMenu","title","rootPrefixCls","eventKey","active","onItemHover","onTitleMouseEnter","onTitleMouseLeave","onTitleClick","popupAlign","popupOffset","isOpen","renderMenuItem","manualRef","subMenuKey","disabled","index","isSelected","store","activeKey","builtinPlacements","overflowedIndicator","motion","attribute","value","popupClassName","inlineCollapsed","menu","theme","itemIcon","expandIcon"],ut=function(Se){var Ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,fe=Se&&typeof Se.getBoundingClientRect=="function"&&Se.getBoundingClientRect().width;if(fe){if(Ae){var J=getComputedStyle(Se),oe=J.marginLeft,te=J.marginRight;fe+=+oe.replace("px","")+ +te.replace("px","")}fe=+fe.toFixed(6)}return fe||0},Ze=function(Se,Ae,fe){Se&&Object(G.a)(Se.style)==="object"&&(Se.style[Ae]=fe)},qe=function(){return at.any},Dt=ee("bdgK"),wt=ee("i8i4"),vt=ee.n(wt),mt=ee("wgJM"),Nt=ee("l4aY"),At=ee("m+aA"),Ot=ee("c+Xe"),He=ee("zT1h"),Ut=ee("QC+M");function Lt(de,Se,Ae){return Ae?de[0]===Se[0]:de[0]===Se[0]&&de[1]===Se[1]}function Xe(de,Se,Ae){var fe=de[Se]||{};return Object(z.a)(Object(z.a)({},fe),Ae)}function nt(de,Se,Ae,fe){for(var J=Ae.points,oe=Object.keys(de),te=0;te<oe.length;te+=1){var me=oe[te];if(Lt(de[me].points,J,fe))return"".concat(Se,"-placement-").concat(me)}return""}var _e=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var de=navigator.userAgent||navigator.vendor||window.opera;return!!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(de)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(de==null?void 0:de.substr(0,4)))},ve=ee("MNnm");function Ce(de,Se){var Ae={};return Ae[de.toLowerCase()]=Se.toLowerCase(),Ae["Webkit".concat(de)]="webkit".concat(Se),Ae["Moz".concat(de)]="moz".concat(Se),Ae["ms".concat(de)]="MS".concat(Se),Ae["O".concat(de)]="o".concat(Se.toLowerCase()),Ae}function ne(de,Se){var Ae={animationend:Ce("Animation","AnimationEnd"),transitionend:Ce("Transition","TransitionEnd")};return de&&("AnimationEvent"in Se||delete Ae.animationend.animation,"TransitionEvent"in Se||delete Ae.transitionend.transition),Ae}var ie=ne(Object(ve.a)(),typeof window!="undefined"?window:{}),ue={};if(Object(ve.a)()){var he=document.createElement("div");ue=he.style}var Me={};function be(de){if(Me[de])return Me[de];var Se=ie[de];if(Se)for(var Ae=Object.keys(Se),fe=Ae.length,J=0;J<fe;J+=1){var oe=Ae[J];if(Object.prototype.hasOwnProperty.call(Se,oe)&&oe in ue)return Me[de]=Se[oe],Me[de]}return""}var Le=be("animationend"),tt=be("transitionend"),pt=!!(Le&&tt),yt=Le||"animationend",Gt=tt||"transitionend";function Tt(de,Se){if(!de)return null;if(Object(G.a)(de)==="object"){var Ae=Se.replace(/-\w/g,function(fe){return fe[1].toUpperCase()});return de[Ae]}return"".concat(de,"-").concat(Se)}var Ge="none",gr="appear",Fe="enter",or="leave",er="none",Bt="prepare",qt="start",pr="active",kt="end";function Gr(de){var Se=Object(A.useRef)(!1),Ae=Object(A.useState)(de),fe=Object(Y.a)(Ae,2),J=fe[0],oe=fe[1];function te(me){Se.current||oe(me)}return Object(A.useEffect)(function(){return function(){Se.current=!0}},[]),[J,te]}var br=Object(ve.a)()?A.useLayoutEffect:A.useEffect,wr=br,Lr=function(){var de=A.useRef(null);function Se(){mt.a.cancel(de.current)}function Ae(fe){var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;Se();var oe=Object(mt.a)(function(){J<=1?fe({isCanceled:function(){return oe!==de.current}}):Ae(fe,J-1)});de.current=oe}return A.useEffect(function(){return function(){Se()}},[]),[Ae,Se]},Br=[Bt,qt,pr,kt],ur=!1,Ht=!0;function _t(de){return de===pr||de===kt}var Vr=function(de,Se){var Ae=A.useState(er),fe=Object(Y.a)(Ae,2),J=fe[0],oe=fe[1],te=Lr(),me=Object(Y.a)(te,2),ge=me[0],Oe=me[1];function Te(){oe(Bt)}return wr(function(){if(J!==er&&J!==kt){var De=Br.indexOf(J),Ve=Br[De+1],st=Se(J);st===ur?oe(Ve):ge(function(ot){function Et(){if(ot.isCanceled())return;oe(Ve)}st===!0?Et():Promise.resolve(st).then(Et)})}},[de,J]),A.useEffect(function(){return function(){Oe()}},[]),[Te,J]},Fr=function(de){var Se=Object(A.useRef)(),Ae=Object(A.useRef)(de);Ae.current=de;var fe=A.useCallback(function(te){Ae.current(te)},[]);function J(te){te&&(te.removeEventListener(Gt,fe),te.removeEventListener(yt,fe))}function oe(te){Se.current&&Se.current!==te&&J(Se.current),te&&te!==Se.current&&(te.addEventListener(Gt,fe),te.addEventListener(yt,fe),Se.current=te)}return A.useEffect(function(){return function(){J(Se.current)}},[]),[oe,J]};function Ar(de,Se,Ae,fe){var J=fe.motionEnter,oe=J===void 0?!0:J,te=fe.motionAppear,me=te===void 0?!0:te,ge=fe.motionLeave,Oe=ge===void 0?!0:ge,Te=fe.motionDeadline,De=fe.motionLeaveImmediately,Ve=fe.onAppearPrepare,st=fe.onEnterPrepare,ot=fe.onLeavePrepare,Et=fe.onAppearStart,nr=fe.onEnterStart,vr=fe.onLeaveStart,lr=fe.onAppearActive,hr=fe.onEnterActive,yr=fe.onLeaveActive,mr=fe.onAppearEnd,fr=fe.onEnterEnd,Nr=fe.onLeaveEnd,Sr=fe.onVisibleChanged,vn=Gr(),Tr=Object(Y.a)(vn,2),Jt=Tr[0],Yt=Tr[1],_r=Gr(Ge),Ur=Object(Y.a)(_r,2),jt=Ur[0],Hr=Ur[1],yn=Gr(null),$r=Object(Y.a)(yn,2),on=$r[0],nn=$r[1],kn=Object(A.useRef)(!1),Wn=Object(A.useRef)(null),xn=Object(A.useRef)(!1),qn=Object(A.useRef)(null);function Ei(){var un=Ae();return un||qn.current}var oi=Object(A.useRef)(!1);function Hn(un){var tn=Ei();if(un&&!un.deadline&&un.target!==tn)return;var Kn;jt===gr&&oi.current?Kn=mr==null?void 0:mr(tn,un):jt===Fe&&oi.current?Kn=fr==null?void 0:fr(tn,un):jt===or&&oi.current&&(Kn=Nr==null?void 0:Nr(tn,un)),Kn!==!1&&!xn.current&&(Hr(Ge),nn(null))}var dn=Fr(Hn),sn=Object(Y.a)(dn,1),Cn=sn[0],bn=A.useMemo(function(){var un,tn,Kn;switch(jt){case"appear":return un={},Object(le.a)(un,Bt,Ve),Object(le.a)(un,qt,Et),Object(le.a)(un,pr,lr),un;case"enter":return tn={},Object(le.a)(tn,Bt,st),Object(le.a)(tn,qt,nr),Object(le.a)(tn,pr,hr),tn;case"leave":return Kn={},Object(le.a)(Kn,Bt,ot),Object(le.a)(Kn,qt,vr),Object(le.a)(Kn,pr,yr),Kn;default:return{}}},[jt]),xi=Vr(jt,function(un){if(un===Bt){var tn=bn[Bt];return tn?tn(Ei()):ur}if(an in bn){var Kn;nn(((Kn=bn[an])===null||Kn===void 0?void 0:Kn.call(bn,Ei(),null))||null)}return an===pr&&(Cn(Ei()),Te>0&&(clearTimeout(Wn.current),Wn.current=setTimeout(function(){Hn({deadline:!0})},Te))),Ht}),Ii=Object(Y.a)(xi,2),Ni=Ii[0],an=Ii[1],Ai=_t(an);oi.current=Ai,wr(function(){Yt(Se);var un=kn.current;if(kn.current=!0,!de)return;var tn;!un&&Se&&me&&(tn=gr),un&&Se&&oe&&(tn=Fe),(un&&!Se&&Oe||!un&&De&&!Se&&Oe)&&(tn=or),tn&&(Hr(tn),Ni())},[Se]),Object(A.useEffect)(function(){(jt===gr&&!me||jt===Fe&&!oe||jt===or&&!Oe)&&Hr(Ge)},[me,oe,Oe]),Object(A.useEffect)(function(){return function(){clearTimeout(Wn.current),xn.current=!0}},[]),Object(A.useEffect)(function(){Jt!==void 0&&jt===Ge&&(Sr==null||Sr(Jt))},[Jt,jt]);var Ui=on;return bn[Bt]&&an===qt&&(Ui=Object(z.a)({transition:"none"},Ui)),[jt,an,Ui,Jt!=null?Jt:Se]}var Kt=function(de){Object(f.a)(Ae,de);var Se=Object(d.a)(Ae);function Ae(){return Object(w.a)(this,Ae),Se.apply(this,arguments)}return Object(x.a)(Ae,[{key:"render",value:function(){return this.props.children}}]),Ae}(A.Component),Xr=Kt;function Zr(de){var Se=de;Object(G.a)(de)==="object"&&(Se=de.transitionSupport);function Ae(J){return!!(J.motionName&&Se)}var fe=A.forwardRef(function(J,oe){var te=J.visible,me=te===void 0?!0:te,ge=J.removeOnLeave,Oe=ge===void 0?!0:ge,Te=J.forceRender,De=J.children,Ve=J.motionName,st=J.leavedClassName,ot=J.eventProps,Et=Ae(J),nr=Object(A.useRef)(),vr=Object(A.useRef)();function lr(){try{return Object(At.a)(nr.current||vr.current)}catch(Hr){return null}}var hr=Ar(Et,me,lr,J),yr=Object(Y.a)(hr,4),mr=yr[0],fr=yr[1],Nr=yr[2],Sr=yr[3],vn=A.useRef(Sr);Sr&&(vn.current=!0);var Tr=Object(A.useRef)(oe);Tr.current=oe;var Jt=A.useCallback(function(Hr){nr.current=Hr,Object(Ot.b)(Tr.current,Hr)},[]),Yt,_r=Object(z.a)(Object(z.a)({},ot),{},{visible:me});if(!De)Yt=null;else if(mr===Ge||!Ae(J))Sr?Yt=De(Object(z.a)({},_r),Jt):!Oe&&vn.current?Yt=De(Object(z.a)(Object(z.a)({},_r),{},{className:st}),Jt):Te?Yt=De(Object(z.a)(Object(z.a)({},_r),{},{style:{display:"none"}}),Jt):Yt=null;else{var Ur,jt;fr===Bt?jt="prepare":_t(fr)?jt="active":fr===qt&&(jt="start"),Yt=De(Object(z.a)(Object(z.a)({},_r),{},{className:W()(Tt(Ve,mr),(Ur={},Object(le.a)(Ur,Tt(Ve,"".concat(mr,"-").concat(jt)),jt),Object(le.a)(Ur,Ve,typeof Ve=="string"),Ur)),style:Nr}),Jt)}return A.createElement(Xr,{ref:vr},Yt)});return fe.displayName="CSSMotion",fe}var Yr=Zr(pt),Je="add",Pt="keep",jr="remove",sr="removed";function Zt(de){var Se;return de&&Object(G.a)(de)==="object"&&"key"in de?Se=de:Se={key:de},Object(z.a)(Object(z.a)({},Se),{},{key:String(Se.key)})}function Or(){var de=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return de.map(Zt)}function U(){var de=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],Ae=[],fe=0,J=Se.length,oe=Or(de),te=Or(Se);oe.forEach(function(Oe){for(var Te=!1,De=fe;De<J;De+=1){var Ve=te[De];if(Ve.key===Oe.key){fe<De&&(Ae=Ae.concat(te.slice(fe,De).map(function(st){return Object(z.a)(Object(z.a)({},st),{},{status:Je})})),fe=De),Ae.push(Object(z.a)(Object(z.a)({},Ve),{},{status:Pt})),fe+=1,Te=!0;break}}Te||Ae.push(Object(z.a)(Object(z.a)({},Oe),{},{status:jr}))}),fe<J&&(Ae=Ae.concat(te.slice(fe).map(function(Oe){return Object(z.a)(Object(z.a)({},Oe),{},{status:Je})})));var me={};Ae.forEach(function(Oe){var Te=Oe.key;me[Te]=(me[Te]||0)+1});var ge=Object.keys(me).filter(function(Oe){return me[Oe]>1});return ge.forEach(function(Oe){Ae=Ae.filter(function(Te){var De=Te.key,Ve=Te.status;return De!==Oe||Ve!==jr}),Ae.forEach(function(Te){Te.key===Oe&&(Te.status=Pt)})}),Ae}var s=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function h(de){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Yr,Ae=function(fe){Object(f.a)(oe,fe);var J=Object(d.a)(oe);function oe(){var te;return Object(w.a)(this,oe),te=J.apply(this,arguments),te.state={keyEntities:[]},te.removeKey=function(me){te.setState(function(ge){var Oe=ge.keyEntities;return{keyEntities:Oe.map(function(Te){return Te.key!==me?Te:Object(z.a)(Object(z.a)({},Te),{},{status:sr})})}})},te}return Object(x.a)(oe,[{key:"render",value:function(){var me=this,ge=this.state.keyEntities,Oe=this.props,Te=Oe.component,De=Oe.children,Ve=Oe.onVisibleChanged,st=Object(L.a)(Oe,["component","children","onVisibleChanged"]),ot=Te||A.Fragment,Et={};return s.forEach(function(nr){Et[nr]=st[nr],delete st[nr]}),delete st.keys,A.createElement(ot,st,ge.map(function(nr){var vr=nr.status,lr=Object(L.a)(nr,["status"]),hr=vr===Je||vr===Pt;return A.createElement(Se,Object(p.a)({},Et,{key:lr.key,visible:hr,eventProps:lr,onVisibleChanged:function(mr){Ve==null||Ve(mr,{key:lr.key}),mr||me.removeKey(lr.key)}}),De)}))}}],[{key:"getDerivedStateFromProps",value:function(me,ge){var Oe=me.keys,Te=ge.keyEntities,De=Or(Oe),Ve=U(Te,De);return{keyEntities:Ve.filter(function(st){var ot=Te.find(function(Et){var nr=Et.key;return st.key===nr});return!(ot&&ot.status===sr&&st.status===jr)})}}}]),oe}(A.Component);return Ae.defaultProps={component:"div"},Ae}var B=h(pt),K=Yr;function N(de){var Se=de.prefixCls,Ae=de.motion,fe=de.animation,J=de.transitionName;return Ae||(fe?{motionName:"".concat(Se,"-").concat(fe)}:J?{motionName:J}:null)}function ae(de){var Se=de.prefixCls,Ae=de.visible,fe=de.zIndex,J=de.mask,oe=de.maskMotion,te=de.maskAnimation,me=de.maskTransitionName;if(!J)return null;var ge={};return(oe||me||te)&&(ge=Object(z.a)({motionAppear:!0},N({motion:oe,prefixCls:Se,transitionName:me,animation:te}))),A.createElement(K,Object(p.a)({},ge,{visible:Ae,removeOnLeave:!0}),function(Oe){var Te=Oe.className;return A.createElement("div",{style:{zIndex:fe},className:W()("".concat(Se,"-mask"),Te)})})}var Be=ee("9mu1"),ze=ee("o0o1"),gt=ee.n(ze),je=ee("HaE+"),ct=["measure","align",null,"motion"],Wt=function(de,Se){var Ae=Object(A.useState)(null),fe=Object(Y.a)(Ae,2),J=fe[0],oe=fe[1],te=Object(A.useRef)(),me=Object(A.useRef)(!1);function ge(De){me.current||oe(De)}function Oe(){mt.a.cancel(te.current)}function Te(De){Oe(),te.current=Object(mt.a)(function(){ge(function(Ve){switch(J){case"align":return"motion";case"motion":return"stable";default:}return Ve}),De==null||De()})}return Object(A.useEffect)(function(){ge("measure")},[de]),Object(A.useEffect)(function(){switch(J){case"measure":Se();break;default:}J&&(te.current=Object(mt.a)(Object(je.a)(gt.a.mark(function De(){var Ve,st;return gt.a.wrap(function(Et){for(;;)switch(Et.prev=Et.next){case 0:Ve=ct.indexOf(J),st=ct[Ve+1],st&&Ve!==-1&&ge(st);case 3:case"end":return Et.stop()}},De)}))))},[J]),Object(A.useEffect)(function(){return function(){me.current=!0,Oe()}},[]),[J,Te]},Dr=function(de){var Se=A.useState({width:0,height:0}),Ae=Object(Y.a)(Se,2),fe=Ae[0],J=Ae[1];function oe(me){J({width:me.offsetWidth,height:me.offsetHeight})}var te=A.useMemo(function(){var me={};if(de){var ge=fe.width,Oe=fe.height;de.indexOf("height")!==-1&&Oe?me.height=Oe:de.indexOf("minHeight")!==-1&&Oe&&(me.minHeight=Oe),de.indexOf("width")!==-1&&ge?me.width=ge:de.indexOf("minWidth")!==-1&&ge&&(me.minWidth=ge)}return me},[de,fe]);return[te,oe]},qr=A.forwardRef(function(de,Se){var Ae=de.visible,fe=de.prefixCls,J=de.className,oe=de.style,te=de.children,me=de.zIndex,ge=de.stretch,Oe=de.destroyPopupOnHide,Te=de.forceRender,De=de.align,Ve=de.point,st=de.getRootDomNode,ot=de.getClassNameFromAlign,Et=de.onAlign,nr=de.onMouseEnter,vr=de.onMouseLeave,lr=de.onMouseDown,hr=de.onTouchStart,yr=Object(A.useRef)(),mr=Object(A.useRef)(),fr=Object(A.useState)(),Nr=Object(Y.a)(fr,2),Sr=Nr[0],vn=Nr[1],Tr=Dr(ge),Jt=Object(Y.a)(Tr,2),Yt=Jt[0],_r=Jt[1];function Ur(){ge&&_r(st())}var jt=Wt(Ae,Ur),Hr=Object(Y.a)(jt,2),yn=Hr[0],$r=Hr[1],on=Object(A.useRef)();function nn(){return Ve||st}function kn(){var dn;(dn=yr.current)===null||dn===void 0||dn.forceAlign()}function Wn(dn,sn){var Cn=ot(sn);Sr!==Cn&&vn(Cn),yn==="align"&&(Sr!==Cn?Promise.resolve().then(function(){kn()}):$r(function(){var bn;(bn=on.current)===null||bn===void 0||bn.call(on)}),Et==null||Et(dn,sn))}var xn=Object(z.a)({},N(de));["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach(function(dn){var sn=xn[dn];xn[dn]=function(Cn,bn){return $r(),sn==null?void 0:sn(Cn,bn)}});function qn(){return new Promise(function(dn){on.current=dn})}A.useEffect(function(){!xn.motionName&&yn==="motion"&&$r()},[xn.motionName,yn]),A.useImperativeHandle(Se,function(){return{forceAlign:kn,getElement:function(){return mr.current}}});var Ei=Object(z.a)(Object(z.a)({},Yt),{},{zIndex:me,opacity:yn==="motion"||yn==="stable"||!Ae?void 0:0,pointerEvents:yn==="stable"?void 0:"none"},oe),oi=!0;(De==null?void 0:De.points)&&(yn==="align"||yn==="stable")&&(oi=!1);var Hn=te;return A.Children.count(te)>1&&(Hn=A.createElement("div",{className:"".concat(fe,"-content")},te)),A.createElement(K,Object(p.a)({visible:Ae,ref:mr,leavedClassName:"".concat(fe,"-hidden")},xn,{onAppearPrepare:qn,onEnterPrepare:qn,removeOnLeave:Oe,forceRender:Te}),function(dn,sn){var Cn=dn.className,bn=dn.style,xi=W()(fe,J,Sr,Cn);return A.createElement(Be.a,{target:nn(),key:"popup",ref:yr,monitorWindowResize:!0,disabled:oi,align:De,onAlign:Wn},A.createElement("div",{ref:sn,className:xi,onMouseEnter:nr,onMouseLeave:vr,onMouseDownCapture:lr,onTouchStartCapture:hr,style:Object(z.a)(Object(z.a)({},bn),Ei)},Hn))})});qr.displayName="PopupInner";var ar=qr,bt=A.forwardRef(function(de,Se){var Ae=de.prefixCls,fe=de.visible,J=de.zIndex,oe=de.children,te=de.mobile;te=te===void 0?{}:te;var me=te.popupClassName,ge=te.popupStyle,Oe=te.popupMotion,Te=Oe===void 0?{}:Oe,De=te.popupRender,Ve=A.useRef();A.useImperativeHandle(Se,function(){return{forceAlign:function(){},getElement:function(){return Ve.current}}});var st=Object(z.a)({zIndex:J},ge),ot=oe;return A.Children.count(oe)>1&&(ot=A.createElement("div",{className:"".concat(Ae,"-content")},oe)),De&&(ot=De(ot)),A.createElement(K,Object(p.a)({visible:fe,ref:Ve,removeOnLeave:!0},Te),function(Et,nr){var vr=Et.className,lr=Et.style,hr=W()(Ae,me,vr);return A.createElement("div",{ref:nr,className:hr,style:Object(z.a)(Object(z.a)({},lr),st)},ot)})});bt.displayName="MobilePopupInner";var Rt=bt,Qt=["visible","mobile"],tr=A.forwardRef(function(de,Se){var Ae=de.visible,fe=de.mobile,J=Object(L.a)(de,Qt),oe=Object(A.useState)(Ae),te=Object(Y.a)(oe,2),me=te[0],ge=te[1],Oe=Object(A.useState)(!1),Te=Object(Y.a)(Oe,2),De=Te[0],Ve=Te[1],st=Object(z.a)(Object(z.a)({},J),{},{visible:me});Object(A.useEffect)(function(){ge(Ae),Ae&&fe&&Ve(_e())},[Ae,fe]);var ot=De?A.createElement(Rt,Object(p.a)({},st,{mobile:fe,ref:Se})):A.createElement(ar,Object(p.a)({},st,{ref:Se}));return A.createElement("div",null,A.createElement(ae,st),ot)});tr.displayName="Popup";var dr=tr,Mr=A.createContext(null),rr=Mr;function En(){}function Jn(){return""}function ri(de){return de?de.ownerDocument:window.document}var _i=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];function Ki(de){var Se=function(Ae){Object(f.a)(J,Ae);var fe=Object(d.a)(J);function J(oe){var te;Object(w.a)(this,J),te=fe.call(this,oe),te.popupRef=A.createRef(),te.triggerRef=A.createRef(),te.attachId=void 0,te.clickOutsideHandler=void 0,te.touchOutsideHandler=void 0,te.contextMenuOutsideHandler1=void 0,te.contextMenuOutsideHandler2=void 0,te.mouseDownTimeout=void 0,te.focusTime=void 0,te.preClickTime=void 0,te.preTouchTime=void 0,te.delayTimer=void 0,te.hasPopupMouseDown=void 0,te.onMouseEnter=function(ge){var Oe=te.props.mouseEnterDelay;te.fireEvents("onMouseEnter",ge),te.delaySetPopupVisible(!0,Oe,Oe?null:ge)},te.onMouseMove=function(ge){te.fireEvents("onMouseMove",ge),te.setPoint(ge)},te.onMouseLeave=function(ge){te.fireEvents("onMouseLeave",ge),te.delaySetPopupVisible(!1,te.props.mouseLeaveDelay)},te.onPopupMouseEnter=function(){te.clearDelayTimer()},te.onPopupMouseLeave=function(ge){var Oe;if(ge.relatedTarget&&!ge.relatedTarget.setTimeout&&Object(Nt.a)((Oe=te.popupRef.current)===null||Oe===void 0?void 0:Oe.getElement(),ge.relatedTarget))return;te.delaySetPopupVisible(!1,te.props.mouseLeaveDelay)},te.onFocus=function(ge){te.fireEvents("onFocus",ge),te.clearDelayTimer(),te.isFocusToShow()&&(te.focusTime=Date.now(),te.delaySetPopupVisible(!0,te.props.focusDelay))},te.onMouseDown=function(ge){te.fireEvents("onMouseDown",ge),te.preClickTime=Date.now()},te.onTouchStart=function(ge){te.fireEvents("onTouchStart",ge),te.preTouchTime=Date.now()},te.onBlur=function(ge){te.fireEvents("onBlur",ge),te.clearDelayTimer(),te.isBlurToHide()&&te.delaySetPopupVisible(!1,te.props.blurDelay)},te.onContextMenu=function(ge){ge.preventDefault(),te.fireEvents("onContextMenu",ge),te.setPopupVisible(!0,ge)},te.onContextMenuClose=function(){te.isContextMenuToShow()&&te.close()},te.onClick=function(ge){if(te.fireEvents("onClick",ge),te.focusTime){var Oe;if(te.preClickTime&&te.preTouchTime?Oe=Math.min(te.preClickTime,te.preTouchTime):te.preClickTime?Oe=te.preClickTime:te.preTouchTime&&(Oe=te.preTouchTime),Math.abs(Oe-te.focusTime)<20)return;te.focusTime=0}te.preClickTime=0,te.preTouchTime=0,te.isClickToShow()&&(te.isClickToHide()||te.isBlurToHide())&&ge&&ge.preventDefault&&ge.preventDefault();var Te=!te.state.popupVisible;(te.isClickToHide()&&!Te||Te&&te.isClickToShow())&&te.setPopupVisible(!te.state.popupVisible,ge)},te.onPopupMouseDown=function(){if(te.hasPopupMouseDown=!0,clearTimeout(te.mouseDownTimeout),te.mouseDownTimeout=window.setTimeout(function(){te.hasPopupMouseDown=!1},0),te.context){var ge;(ge=te.context).onPopupMouseDown.apply(ge,arguments)}},te.onDocumentClick=function(ge){if(te.props.mask&&!te.props.maskClosable)return;var Oe=ge.target,Te=te.getRootDomNode(),De=te.getPopupDomNode();(!Object(Nt.a)(Te,Oe)||te.isContextMenuOnly())&&!Object(Nt.a)(De,Oe)&&!te.hasPopupMouseDown&&te.close()},te.getRootDomNode=function(){var ge=te.props.getTriggerDOMNode;if(ge)return ge(te.triggerRef.current);try{var Oe=Object(At.a)(te.triggerRef.current);if(Oe)return Oe}catch(Te){}return vt.a.findDOMNode(Object(g.a)(te))},te.getPopupClassNameFromAlign=function(ge){var Oe=[],Te=te.props,De=Te.popupPlacement,Ve=Te.builtinPlacements,st=Te.prefixCls,ot=Te.alignPoint,Et=Te.getPopupClassNameFromAlign;return De&&Ve&&Oe.push(nt(Ve,st,ge,ot)),Et&&Oe.push(Et(ge)),Oe.join(" ")},te.getComponent=function(){var ge=te.props,Oe=ge.prefixCls,Te=ge.destroyPopupOnHide,De=ge.popupClassName,Ve=ge.onPopupAlign,st=ge.popupMotion,ot=ge.popupAnimation,Et=ge.popupTransitionName,nr=ge.popupStyle,vr=ge.mask,lr=ge.maskAnimation,hr=ge.maskTransitionName,yr=ge.maskMotion,mr=ge.zIndex,fr=ge.popup,Nr=ge.stretch,Sr=ge.alignPoint,vn=ge.mobile,Tr=ge.forceRender,Jt=te.state,Yt=Jt.popupVisible,_r=Jt.point,Ur=te.getPopupAlign(),jt={};return te.isMouseEnterToShow()&&(jt.onMouseEnter=te.onPopupMouseEnter),te.isMouseLeaveToHide()&&(jt.onMouseLeave=te.onPopupMouseLeave),jt.onMouseDown=te.onPopupMouseDown,jt.onTouchStart=te.onPopupMouseDown,A.createElement(dr,Object(p.a)({prefixCls:Oe,destroyPopupOnHide:Te,visible:Yt,point:Sr&&_r,className:De,align:Ur,onAlign:Ve,animation:ot,getClassNameFromAlign:te.getPopupClassNameFromAlign},jt,{stretch:Nr,getRootDomNode:te.getRootDomNode,style:nr,mask:vr,zIndex:mr,transitionName:Et,maskAnimation:lr,maskTransitionName:hr,maskMotion:yr,ref:te.popupRef,motion:st,mobile:vn,forceRender:Tr}),typeof fr=="function"?fr():fr)},te.attachParent=function(ge){mt.a.cancel(te.attachId);var Oe=te.props,Te=Oe.getPopupContainer,De=Oe.getDocument,Ve=te.getRootDomNode(),st;Te?(Ve||Te.length===0)&&(st=Te(Ve)):st=De(te.getRootDomNode()).body,st?st.appendChild(ge):te.attachId=Object(mt.a)(function(){te.attachParent(ge)})},te.getContainer=function(){var ge=te.props.getDocument,Oe=ge(te.getRootDomNode()).createElement("div");return Oe.style.position="absolute",Oe.style.top="0",Oe.style.left="0",Oe.style.width="100%",te.attachParent(Oe),Oe},te.setPoint=function(ge){var Oe=te.props.alignPoint;if(!Oe||!ge)return;te.setState({point:{pageX:ge.pageX,pageY:ge.pageY}})},te.handlePortalUpdate=function(){te.state.prevPopupVisible!==te.state.popupVisible&&te.props.afterPopupVisibleChange(te.state.popupVisible)},te.triggerContextValue={onPopupMouseDown:te.onPopupMouseDown};var me;return"popupVisible"in oe?me=!!oe.popupVisible:me=!!oe.defaultPopupVisible,te.state={prevPopupVisible:me,popupVisible:me},_i.forEach(function(ge){te["fire".concat(ge)]=function(Oe){te.fireEvents(ge,Oe)}}),te}return Object(x.a)(J,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var te=this.props,me=this.state;if(me.popupVisible){var ge;!this.clickOutsideHandler&&(this.isClickToHide()||this.isContextMenuToShow())&&(ge=te.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Object(He.a)(ge,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(ge=ge||te.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Object(He.a)(ge,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(ge=ge||te.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Object(He.a)(ge,"scroll",this.onContextMenuClose)),!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Object(He.a)(window,"blur",this.onContextMenuClose));return}this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),mt.a.cancel(this.attachId)}},{key:"getPopupDomNode",value:function(){var te;return((te=this.popupRef.current)===null||te===void 0?void 0:te.getElement())||null}},{key:"getPopupAlign",value:function(){var te=this.props,me=te.popupPlacement,ge=te.popupAlign,Oe=te.builtinPlacements;return me&&Oe?Xe(Oe,me,ge):ge}},{key:"setPopupVisible",value:function(te,me){var ge=this.props.alignPoint,Oe=this.state.popupVisible;this.clearDelayTimer(),Oe!==te&&("popupVisible"in this.props||this.setState({popupVisible:te,prevPopupVisible:Oe}),this.props.onPopupVisibleChange(te)),ge&&me&&te&&this.setPoint(me)}},{key:"delaySetPopupVisible",value:function(te,me,ge){var Oe=this,Te=me*1e3;if(this.clearDelayTimer(),Te){var De=ge?{pageX:ge.pageX,pageY:ge.pageY}:null;this.delayTimer=window.setTimeout(function(){Oe.setPopupVisible(te,De),Oe.clearDelayTimer()},Te)}else this.setPopupVisible(te,ge)}},{key:"clearDelayTimer",value:function(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)}},{key:"clearOutsideHandler",value:function(){this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.clickOutsideHandler=null),this.contextMenuOutsideHandler1&&(this.contextMenuOutsideHandler1.remove(),this.contextMenuOutsideHandler1=null),this.contextMenuOutsideHandler2&&(this.contextMenuOutsideHandler2.remove(),this.contextMenuOutsideHandler2=null),this.touchOutsideHandler&&(this.touchOutsideHandler.remove(),this.touchOutsideHandler=null)}},{key:"createTwoChains",value:function(te){var me=this.props.children.props,ge=this.props;return me[te]&&ge[te]?this["fire".concat(te)]:me[te]||ge[te]}},{key:"isClickToShow",value:function(){var te=this.props,me=te.action,ge=te.showAction;return me.indexOf("click")!==-1||ge.indexOf("click")!==-1}},{key:"isContextMenuOnly",value:function(){var te=this.props.action;return te==="contextMenu"||te.length===1&&te[0]==="contextMenu"}},{key:"isContextMenuToShow",value:function(){var te=this.props,me=te.action,ge=te.showAction;return me.indexOf("contextMenu")!==-1||ge.indexOf("contextMenu")!==-1}},{key:"isClickToHide",value:function(){var te=this.props,me=te.action,ge=te.hideAction;return me.indexOf("click")!==-1||ge.indexOf("click")!==-1}},{key:"isMouseEnterToShow",value:function(){var te=this.props,me=te.action,ge=te.showAction;return me.indexOf("hover")!==-1||ge.indexOf("mouseEnter")!==-1}},{key:"isMouseLeaveToHide",value:function(){var te=this.props,me=te.action,ge=te.hideAction;return me.indexOf("hover")!==-1||ge.indexOf("mouseLeave")!==-1}},{key:"isFocusToShow",value:function(){var te=this.props,me=te.action,ge=te.showAction;return me.indexOf("focus")!==-1||ge.indexOf("focus")!==-1}},{key:"isBlurToHide",value:function(){var te=this.props,me=te.action,ge=te.hideAction;return me.indexOf("focus")!==-1||ge.indexOf("blur")!==-1}},{key:"forcePopupAlign",value:function(){if(this.state.popupVisible){var te;(te=this.popupRef.current)===null||te===void 0||te.forceAlign()}}},{key:"fireEvents",value:function(te,me){var ge=this.props.children.props[te];ge&&ge(me);var Oe=this.props[te];Oe&&Oe(me)}},{key:"close",value:function(){this.setPopupVisible(!1)}},{key:"render",value:function(){var te=this.state.popupVisible,me=this.props,ge=me.children,Oe=me.forceRender,Te=me.alignPoint,De=me.className,Ve=me.autoDestroy,st=A.Children.only(ge),ot={key:"trigger"};this.isContextMenuToShow()?ot.onContextMenu=this.onContextMenu:ot.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(ot.onClick=this.onClick,ot.onMouseDown=this.onMouseDown,ot.onTouchStart=this.onTouchStart):(ot.onClick=this.createTwoChains("onClick"),ot.onMouseDown=this.createTwoChains("onMouseDown"),ot.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(ot.onMouseEnter=this.onMouseEnter,Te&&(ot.onMouseMove=this.onMouseMove)):ot.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?ot.onMouseLeave=this.onMouseLeave:ot.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(ot.onFocus=this.onFocus,ot.onBlur=this.onBlur):(ot.onFocus=this.createTwoChains("onFocus"),ot.onBlur=this.createTwoChains("onBlur"));var Et=W()(st&&st.props&&st.props.className,De);Et&&(ot.className=Et);var nr=Object(z.a)({},ot);Object(Ot.c)(st)&&(nr.ref=Object(Ot.a)(this.triggerRef,st.ref));var vr=A.cloneElement(st,nr),lr;return(te||this.popupRef.current||Oe)&&(lr=A.createElement(de,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!te&&Ve&&(lr=null),A.createElement(rr.Provider,{value:this.triggerContextValue},vr,lr)}}],[{key:"getDerivedStateFromProps",value:function(te,me){var ge=te.popupVisible,Oe={};return ge!==void 0&&me.popupVisible!==ge&&(Oe.popupVisible=ge,Oe.prevPopupVisible=me.popupVisible),Oe}}]),J}(A.Component);return Se.contextType=rr,Se.defaultProps={prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:Jn,getDocument:ri,onPopupVisibleChange:En,afterPopupVisibleChange:En,onPopupAlign:En,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[],autoDestroy:!1},Se}var hn=Ki(Ut.a),wn={adjustX:1,adjustY:1},vi={topLeft:{points:["bl","tl"],overflow:wn,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:wn,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:wn,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:wn,offset:[4,0]}},Oi={topLeft:{points:["bl","tl"],overflow:wn,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:wn,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:wn,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:wn,offset:[4,0]}},qi=vi,rn=0,Pr={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},fn=function(Se,Ae,fe){var J=Ke(Ae),oe=Se.getState();Se.setState({defaultActiveFirst:Object(z.a)(Object(z.a)({},oe.defaultActiveFirst),{},Object(le.a)({},J,fe))})},cr=function(de){Object(f.a)(Ae,de);var Se=Object(d.a)(Ae);function Ae(fe){var J;Object(w.a)(this,Ae),J=Se.call(this,fe),J.onDestroy=function(Te){J.props.onDestroy(Te)},J.onKeyDown=function(Te){var De=Te.keyCode,Ve=J.menuInstance,st=J.props.store,ot=J.getVisible();if(De===S.a.ENTER)return J.onTitleClick(Te),fn(st,J.props.eventKey,!0),!0;if(De===S.a.RIGHT)return ot?Ve.onKeyDown(Te):(J.triggerOpenChange(!0),fn(st,J.props.eventKey,!0)),!0;if(De===S.a.LEFT){var Et;if(ot)Et=Ve.onKeyDown(Te);else return;return Et||(J.triggerOpenChange(!1),Et=!0),Et}return ot&&(De===S.a.UP||De===S.a.DOWN)?Ve.onKeyDown(Te):void 0},J.onOpenChange=function(Te){J.props.onOpenChange(Te)},J.onPopupVisibleChange=function(Te){J.triggerOpenChange(Te,Te?"mouseenter":"mouseleave")},J.onMouseEnter=function(Te){var De=J.props,Ve=De.eventKey,st=De.onMouseEnter,ot=De.store;fn(ot,J.props.eventKey,!1),st({key:Ve,domEvent:Te})},J.onMouseLeave=function(Te){var De=J.props,Ve=De.parentMenu,st=De.eventKey,ot=De.onMouseLeave;Ve.subMenuInstance=Object(g.a)(J),ot({key:st,domEvent:Te})},J.onTitleMouseEnter=function(Te){var De=J.props,Ve=De.eventKey,st=De.onItemHover,ot=De.onTitleMouseEnter;st({key:Ve,hover:!0}),ot({key:Ve,domEvent:Te})},J.onTitleMouseLeave=function(Te){var De=J.props,Ve=De.parentMenu,st=De.eventKey,ot=De.onItemHover,Et=De.onTitleMouseLeave;Ve.subMenuInstance=Object(g.a)(J),ot({key:st,hover:!1}),Et({key:st,domEvent:Te})},J.onTitleClick=function(Te){var De=Object(g.a)(J),Ve=De.props;if(Ve.onTitleClick({key:Ve.eventKey,domEvent:Te}),Ve.triggerSubMenuAction==="hover")return;J.triggerOpenChange(!J.getVisible(),"click"),fn(Ve.store,J.props.eventKey,!1)},J.onSubMenuClick=function(Te){typeof J.props.onClick=="function"&&J.props.onClick(J.addKeyPath(Te))},J.onSelect=function(Te){J.props.onSelect(Te)},J.onDeselect=function(Te){J.props.onDeselect(Te)},J.getPrefixCls=function(){return"".concat(J.props.rootPrefixCls,"-submenu")},J.getActiveClassName=function(){return"".concat(J.getPrefixCls(),"-active")},J.getDisabledClassName=function(){return"".concat(J.getPrefixCls(),"-disabled")},J.getSelectedClassName=function(){return"".concat(J.getPrefixCls(),"-selected")},J.getOpenClassName=function(){return"".concat(J.props.rootPrefixCls,"-submenu-open")},J.getVisible=function(){return J.state.isOpen},J.getMode=function(){return J.state.mode},J.saveMenuInstance=function(Te){J.menuInstance=Te},J.addKeyPath=function(Te){return Object(z.a)(Object(z.a)({},Te),{},{keyPath:(Te.keyPath||[]).concat(J.props.eventKey)})},J.triggerOpenChange=function(Te,De){var Ve=J.props.eventKey,st=function(){J.onOpenChange({key:Ve,item:Object(g.a)(J),trigger:De,open:Te})};De==="mouseenter"?J.mouseenterTimeout=setTimeout(function(){st()},0):st()},J.isChildrenSelected=function(){var Te={find:!1};return it(J.props.children,J.props.selectedKeys,Te),Te.find},J.isInlineMode=function(){return J.getMode()==="inline"},J.adjustWidth=function(){if(!J.subMenuTitle||!J.menuInstance)return;var Te=wt.findDOMNode(J.menuInstance);if(Te.offsetWidth>=J.subMenuTitle.offsetWidth)return;Te.style.minWidth="".concat(J.subMenuTitle.offsetWidth,"px")},J.saveSubMenuTitle=function(Te){J.subMenuTitle=Te},J.getBaseProps=function(){var Te=Object(g.a)(J),De=Te.props,Ve=J.getMode();return{mode:Ve==="horizontal"?"vertical":Ve,visible:J.getVisible(),level:De.level+1,inlineIndent:De.inlineIndent,focusable:!1,onClick:J.onSubMenuClick,onSelect:J.onSelect,onDeselect:J.onDeselect,onDestroy:J.onDestroy,selectedKeys:De.selectedKeys,eventKey:"".concat(De.eventKey,"-menu-"),openKeys:De.openKeys,motion:De.motion,onOpenChange:J.onOpenChange,subMenuOpenDelay:De.subMenuOpenDelay,parentMenu:Object(g.a)(J),subMenuCloseDelay:De.subMenuCloseDelay,forceSubMenuRender:De.forceSubMenuRender,triggerSubMenuAction:De.triggerSubMenuAction,builtinPlacements:De.builtinPlacements,defaultActiveFirst:De.store.getState().defaultActiveFirst[Ke(De.eventKey)],multiple:De.multiple,prefixCls:De.rootPrefixCls,id:J.internalMenuId,manualRef:J.saveMenuInstance,itemIcon:De.itemIcon,expandIcon:De.expandIcon,direction:De.direction}},J.getMotion=function(Te,De){var Ve=Object(g.a)(J),st=Ve.haveRendered,ot=J.props,Et=ot.motion,nr=ot.rootPrefixCls,vr=Object(z.a)(Object(z.a)({},Et),{},{leavedClassName:"".concat(nr,"-hidden"),removeOnLeave:!1,motionAppear:st||!De||Te!=="inline"});return vr};var oe=fe.store,te=fe.eventKey,me=oe.getState(),ge=me.defaultActiveFirst;J.isRootMenu=!1;var Oe=!1;return ge&&(Oe=ge[te]),fn(oe,te,Oe),J.state={mode:fe.mode,isOpen:fe.isOpen},J}return Object(x.a)(Ae,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var J=this,oe=this.props,te=oe.mode,me=oe.parentMenu,ge=oe.manualRef,Oe=oe.isOpen,Te=function(){J.setState({mode:te,isOpen:Oe})},De=Oe!==this.state.isOpen,Ve=te!==this.state.mode;if((Ve||De)&&(mt.a.cancel(this.updateStateRaf),Ve?this.updateStateRaf=Object(mt.a)(Te):Te()),ge&&ge(this),te!=="horizontal"||!(me==null?void 0:me.isRootMenu)||!Oe)return;this.minWidthTimeout=setTimeout(function(){return J.adjustWidth()},0)}},{key:"componentWillUnmount",value:function(){var J=this.props,oe=J.onDestroy,te=J.eventKey;oe&&oe(te),this.minWidthTimeout&&clearTimeout(this.minWidthTimeout),this.mouseenterTimeout&&clearTimeout(this.mouseenterTimeout),mt.a.cancel(this.updateStateRaf)}},{key:"renderPopupMenu",value:function(J,oe){var te=this.getBaseProps();return A.createElement(An,Object(p.a)({},te,{id:this.internalMenuId,className:J,style:oe}),this.props.children)}},{key:"renderChildren",value:function(){var J=this,oe=this.getBaseProps(),te=oe.mode,me=oe.visible,ge=oe.forceSubMenuRender,Oe=oe.direction,Te=this.getMotion(te,me);if(this.haveRendered=!0,this.haveOpened=this.haveOpened||me||ge,!this.haveOpened)return A.createElement("div",null);var De=W()("".concat(oe.prefixCls,"-sub"),Object(le.a)({},"".concat(oe.prefixCls,"-rtl"),Oe==="rtl"));return this.isInlineMode()?A.createElement(K,Object(p.a)({visible:oe.visible,forceRender:ge},Te),function(Ve){var st=Ve.className,ot=Ve.style,Et=W()(De,st);return J.renderPopupMenu(Et,ot)}):this.renderPopupMenu(De)}},{key:"render",value:function(){var J,oe,te,me=Object(z.a)({},this.props),ge=this.getVisible(),Oe=this.getPrefixCls(),Te=this.isInlineMode(),De=this.getMode(),Ve=W()(Oe,"".concat(Oe,"-").concat(De),(J={},Object(le.a)(J,me.className,!!me.className),Object(le.a)(J,this.getOpenClassName(),ge),Object(le.a)(J,this.getActiveClassName(),me.active||ge&&!Te),Object(le.a)(J,this.getDisabledClassName(),me.disabled),Object(le.a)(J,this.getSelectedClassName(),this.isChildrenSelected()),J));this.internalMenuId||(me.eventKey?this.internalMenuId="".concat(me.eventKey,"$Menu"):(rn+=1,this.internalMenuId="$__$".concat(rn,"$Menu")));var st={},ot={},Et={};me.disabled||(st={onMouseLeave:this.onMouseLeave,onMouseEnter:this.onMouseEnter},ot={onClick:this.onTitleClick},Et={onMouseEnter:this.onTitleMouseEnter,onMouseLeave:this.onTitleMouseLeave});var nr={},vr=me.direction,lr=vr==="rtl";Te&&(lr?nr.paddingRight=me.inlineIndent*me.level:nr.paddingLeft=me.inlineIndent*me.level);var hr={};this.getVisible()&&(hr={"aria-owns":this.internalMenuId});var yr=null;De!=="horizontal"&&(yr=this.props.expandIcon,typeof this.props.expandIcon=="function"&&(yr=A.createElement(this.props.expandIcon,Object(z.a)({},this.props))));var mr=A.createElement("div",Object(p.a)({ref:this.saveSubMenuTitle,style:nr,className:"".concat(Oe,"-title"),role:"button"},Et,ot,{"aria-expanded":ge},hr,{"aria-haspopup":"true",title:typeof me.title=="string"?me.title:void 0}),me.title,yr||A.createElement("i",{className:"".concat(Oe,"-arrow")})),fr=this.renderChildren(),Nr=((oe=me.parentMenu)===null||oe===void 0?void 0:oe.isRootMenu)?me.parentMenu.props.getPopupContainer:function(nn){return nn.parentNode},Sr=Pr[De],vn=me.popupOffset?{offset:me.popupOffset}:{},Tr=W()((te={},Object(le.a)(te,me.popupClassName,me.popupClassName&&!Te),Object(le.a)(te,"".concat(Oe,"-rtl"),lr),te)),Jt=me.disabled,Yt=me.triggerSubMenuAction,_r=me.subMenuOpenDelay,Ur=me.forceSubMenuRender,jt=me.subMenuCloseDelay,Hr=me.builtinPlacements;ft.forEach(function(nn){return delete me[nn]}),delete me.onClick;var yn=lr?Object(z.a)(Object(z.a)({},Oi),Hr):Object(z.a)(Object(z.a)({},vi),Hr);delete me.direction;var $r=this.getBaseProps(),on=Te?null:this.getMotion($r.mode,$r.visible);return A.createElement("li",Object(p.a)({},me,st,{className:Ve,role:"menuitem"}),A.createElement(hn,{prefixCls:Oe,popupClassName:W()("".concat(Oe,"-popup"),Tr),getPopupContainer:Nr,builtinPlacements:yn,popupPlacement:Sr,popupVisible:Te?!1:ge,popupAlign:vn,popup:Te?null:fr,action:Jt||Te?[]:[Yt],mouseEnterDelay:_r,mouseLeaveDelay:jt,onPopupVisibleChange:this.onPopupVisibleChange,forceRender:Ur,popupMotion:on},mr),Te?fr:null)}}]),Ae}(A.Component);cr.defaultProps={onMouseEnter:rt,onMouseLeave:rt,onTitleMouseEnter:rt,onTitleMouseLeave:rt,onTitleClick:rt,manualRef:rt,mode:"vertical",title:""};var pn=Object(a.b)(function(de,Se){var Ae=de.openKeys,fe=de.activeKey,J=de.selectedKeys,oe=Se.eventKey,te=Se.subMenuKey;return{isOpen:Ae.indexOf(oe)>-1,active:fe[te]===oe,selectedKeys:J}})(cr);pn.isSubMenu=!0;var Kr=pn,ni="menuitem-overflowed",gn=.5,jn=function(de){Object(f.a)(Ae,de);var Se=Object(d.a)(Ae);function Ae(){var fe;return Object(w.a)(this,Ae),fe=Se.apply(this,arguments),fe.resizeObserver=null,fe.mutationObserver=null,fe.originalTotalWidth=0,fe.overflowedItems=[],fe.menuItemSizes=[],fe.cancelFrameId=null,fe.state={lastVisibleIndex:void 0},fe.childRef=A.createRef(),fe.getMenuItemNodes=function(){var J=fe.props.prefixCls,oe=fe.childRef.current;return oe?[].slice.call(oe.children).filter(function(te){return te.className.split(" ").indexOf("".concat(J,"-overflowed-submenu"))<0}):[]},fe.getOverflowedSubMenuItem=function(J,oe,te){var me=fe.props,ge=me.overflowedIndicator,Oe=me.level,Te=me.mode,De=me.prefixCls,Ve=me.theme;if(Oe!==1||Te!=="horizontal")return null;var st=fe.props.children[0],ot=st.props,Et=ot.children,nr=ot.title,vr=ot.style,lr=Object(L.a)(ot,["children","title","style"]),hr=Object(z.a)({},vr),yr="".concat(J,"-overflowed-indicator"),mr="".concat(J,"-overflowed-indicator");oe.length===0&&te!==!0?hr=Object(z.a)(Object(z.a)({},hr),{},{display:"none"}):te&&(hr=Object(z.a)(Object(z.a)({},hr),{},{visibility:"hidden",position:"absolute"}),yr="".concat(yr,"-placeholder"),mr="".concat(mr,"-placeholder"));var fr=Ve?"".concat(De,"-").concat(Ve):"",Nr={};return ft.forEach(function(Sr){lr[Sr]!==void 0&&(Nr[Sr]=lr[Sr])}),A.createElement(Kr,Object(p.a)({title:ge,className:"".concat(De,"-overflowed-submenu"),popupClassName:fr},Nr,{key:yr,eventKey:mr,disabled:!1,style:hr}),oe)},fe.setChildrenWidthAndResize=function(){if(fe.props.mode!=="horizontal")return;var J=fe.childRef.current;if(!J)return;var oe=J.children;if(!oe||oe.length===0)return;var te=J.children[oe.length-1];Ze(te,"display","inline-block");var me=fe.getMenuItemNodes(),ge=me.filter(function(Oe){return Oe.className.split(" ").indexOf(ni)>=0});ge.forEach(function(Oe){Ze(Oe,"display","inline-block")}),fe.menuItemSizes=me.map(function(Oe){return ut(Oe,!0)}),ge.forEach(function(Oe){Ze(Oe,"display","none")}),fe.overflowedIndicatorWidth=ut(J.children[J.children.length-1],!0),fe.originalTotalWidth=fe.menuItemSizes.reduce(function(Oe,Te){return Oe+Te},0),fe.handleResize(),Ze(te,"display","none")},fe.handleResize=function(){if(fe.props.mode!=="horizontal")return;var J=fe.childRef.current;if(!J)return;var oe=ut(J);fe.overflowedItems=[];var te=0,me;fe.originalTotalWidth>oe+gn&&(me=-1,fe.menuItemSizes.forEach(function(ge){te+=ge,te+fe.overflowedIndicatorWidth<=oe&&(me+=1)})),fe.setState({lastVisibleIndex:me})},fe}return Object(x.a)(Ae,[{key:"componentDidMount",value:function(){var J=this;if(this.setChildrenWidthAndResize(),this.props.level===1&&this.props.mode==="horizontal"){var oe=this.childRef.current;if(!oe)return;this.resizeObserver=new Dt.default(function(te){te.forEach(function(){var me=J.cancelFrameId;cancelAnimationFrame(me),J.cancelFrameId=requestAnimationFrame(J.setChildrenWidthAndResize)})}),[].slice.call(oe.children).concat(oe).forEach(function(te){J.resizeObserver.observe(te)}),typeof MutationObserver!="undefined"&&(this.mutationObserver=new MutationObserver(function(){J.resizeObserver.disconnect(),[].slice.call(oe.children).concat(oe).forEach(function(te){J.resizeObserver.observe(te)}),J.setChildrenWidthAndResize()}),this.mutationObserver.observe(oe,{attributes:!1,childList:!0,subTree:!1}))}}},{key:"componentWillUnmount",value:function(){this.resizeObserver&&this.resizeObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),cancelAnimationFrame(this.cancelFrameId)}},{key:"renderChildren",value:function(J){var oe=this,te=this.state.lastVisibleIndex;return(J||[]).reduce(function(me,ge,Oe){var Te=ge;if(oe.props.mode==="horizontal"){var De=oe.getOverflowedSubMenuItem(ge.props.eventKey,[]);te!==void 0&&oe.props.className.indexOf("".concat(oe.props.prefixCls,"-root"))!==-1&&(Oe>te&&(Te=A.cloneElement(ge,{style:{display:"none"},eventKey:"".concat(ge.props.eventKey,"-hidden"),className:"".concat(ni)})),Oe===te+1&&(oe.overflowedItems=J.slice(te+1).map(function(st){return A.cloneElement(st,{key:st.props.eventKey,mode:"vertical-left"})}),De=oe.getOverflowedSubMenuItem(ge.props.eventKey,oe.overflowedItems)));var Ve=[].concat(Object(D.a)(me),[De,Te]);return Oe===J.length-1&&Ve.push(oe.getOverflowedSubMenuItem(ge.props.eventKey,[],!0)),Ve}return[].concat(Object(D.a)(me),[Te])},[])}},{key:"render",value:function(){var J=this.props,oe=J.visible,te=J.prefixCls,me=J.overflowedIndicator,ge=J.mode,Oe=J.level,Te=J.tag,De=J.children,Ve=J.theme,st=Object(L.a)(J,["visible","prefixCls","overflowedIndicator","mode","level","tag","children","theme"]),ot=Te;return A.createElement(ot,Object(p.a)({ref:this.childRef},st),this.renderChildren(De))}}]),Ae}(A.Component);jn.defaultProps={tag:"div",className:""};var zi=jn;function ci(de){return de.length?de.every(function(Se){return!!Se.props.disabled}):!0}function hi(de,Se,Ae){var fe=de.getState();de.setState({activeKey:Object(z.a)(Object(z.a)({},fe.activeKey),{},Object(le.a)({},Se,Ae))})}function wi(de){return de.eventKey||"0-menu-"}function Nn(de,Se){var Ae=Se,fe=de.children,J=de.eventKey;if(Ae){var oe;if($e(fe,function(te,me){te&&te.props&&!te.props.disabled&&Ae===lt(te,J,me)&&(oe=!0)}),oe)return Ae}return Ae=null,de.defaultActiveFirst&&$e(fe,function(te,me){!Ae&&te&&!te.props.disabled&&(Ae=lt(te,J,me))}),Ae}function Gi(de){if(!de)return;var Se=this.instanceArray.indexOf(de);Se!==-1?this.instanceArray[Se]=de:this.instanceArray.push(de)}var mn=function(de){Object(f.a)(Ae,de);var Se=Object(d.a)(Ae);function Ae(fe){var J;return Object(w.a)(this,Ae),J=Se.call(this,fe),J.onKeyDown=function(oe,te){var me=oe.keyCode,ge;if(J.getFlatInstanceArray().forEach(function(Te){Te&&Te.props.active&&Te.onKeyDown&&(ge=Te.onKeyDown(oe))}),ge)return 1;var Oe=null;return(me===S.a.UP||me===S.a.DOWN)&&(Oe=J.step(me===S.a.UP?-1:1)),Oe?(oe.preventDefault(),hi(J.props.store,wi(J.props),Oe.props.eventKey),typeof te=="function"&&te(Oe),1):void 0},J.onItemHover=function(oe){var te=oe.key,me=oe.hover;hi(J.props.store,wi(J.props),me?te:null)},J.onDeselect=function(oe){J.props.onDeselect(oe)},J.onSelect=function(oe){J.props.onSelect(oe)},J.onClick=function(oe){J.props.onClick(oe)},J.onOpenChange=function(oe){J.props.onOpenChange(oe)},J.onDestroy=function(oe){J.props.onDestroy(oe)},J.getFlatInstanceArray=function(){return J.instanceArray},J.step=function(oe){var te=J.getFlatInstanceArray(),me=J.props.store.getState().activeKey[wi(J.props)],ge=te.length;if(!ge)return null;oe<0&&(te=te.concat().reverse());var Oe=-1;if(te.every(function(st,ot){return st&&st.props.eventKey===me?(Oe=ot,!1):!0}),!J.props.defaultActiveFirst&&Oe!==-1&&ci(te.slice(Oe,ge-1)))return;var Te=(Oe+1)%ge,De=Te;do{var Ve=te[De];if(!Ve||Ve.props.disabled)De=(De+1)%ge;else return Ve}while(De!==Te);return null},J.renderCommonMenuItem=function(oe,te,me){var ge=J.props.store.getState(),Oe=Object(g.a)(J),Te=Oe.props,De=lt(oe,Te.eventKey,te),Ve=oe.props;if(!Ve||typeof oe.type=="string")return oe;var st=De===ge.activeKey,ot=Object(z.a)(Object(z.a)({mode:Ve.mode||Te.mode,level:Te.level,inlineIndent:Te.inlineIndent,renderMenuItem:J.renderMenuItem,rootPrefixCls:Te.prefixCls,index:te,parentMenu:Te.parentMenu,manualRef:Ve.disabled?void 0:Object(v.a)(oe.ref,Gi.bind(Object(g.a)(J))),eventKey:De,active:!Ve.disabled&&st,multiple:Te.multiple,onClick:function(nr){(Ve.onClick||rt)(nr),J.onClick(nr)},onItemHover:J.onItemHover,motion:Te.motion,subMenuOpenDelay:Te.subMenuOpenDelay,subMenuCloseDelay:Te.subMenuCloseDelay,forceSubMenuRender:Te.forceSubMenuRender,onOpenChange:J.onOpenChange,onDeselect:J.onDeselect,onSelect:J.onSelect,builtinPlacements:Te.builtinPlacements,itemIcon:Ve.itemIcon||J.props.itemIcon,expandIcon:Ve.expandIcon||J.props.expandIcon},me),{},{direction:Te.direction});return(Te.mode==="inline"||qe())&&(ot.triggerSubMenuAction="click"),A.cloneElement(oe,Object(z.a)(Object(z.a)({},ot),{},{key:De||te}))},J.renderMenuItem=function(oe,te,me){if(!oe)return null;var ge=J.props.store.getState(),Oe={openKeys:ge.openKeys,selectedKeys:ge.selectedKeys,triggerSubMenuAction:J.props.triggerSubMenuAction,subMenuKey:me};return J.renderCommonMenuItem(oe,te,Oe)},fe.store.setState({activeKey:Object(z.a)(Object(z.a)({},fe.store.getState().activeKey),{},Object(le.a)({},fe.eventKey,Nn(fe,fe.activeKey)))}),J.instanceArray=[],J}return Object(x.a)(Ae,[{key:"componentDidMount",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"shouldComponentUpdate",value:function(J){return this.props.visible||J.visible||this.props.className!==J.className||!y()(this.props.style,J.style)}},{key:"componentDidUpdate",value:function(J){var oe=this.props,te="activeKey"in oe?oe.activeKey:oe.store.getState().activeKey[wi(oe)],me=Nn(oe,te);if(me!==te)hi(oe.store,wi(oe),me);else if("activeKey"in J){var ge=Nn(J,J.activeKey);me!==ge&&hi(oe.store,wi(oe),me)}}},{key:"render",value:function(){var J=this,oe=Object(p.a)({},this.props);this.instanceArray=[];var te=W()(oe.prefixCls,oe.className,"".concat(oe.prefixCls,"-").concat(oe.mode)),me={className:te,role:oe.role||"menu"};oe.id&&(me.id=oe.id),oe.focusable&&(me.tabIndex=0,me.onKeyDown=this.onKeyDown);var ge=oe.prefixCls,Oe=oe.eventKey,Te=oe.visible,De=oe.level,Ve=oe.mode,st=oe.overflowedIndicator,ot=oe.theme;return ft.forEach(function(Et){return delete oe[Et]}),delete oe.onClick,A.createElement(zi,Object(p.a)({},oe,{prefixCls:ge,mode:Ve,tag:"ul",level:De,theme:ot,visible:Te,overflowedIndicator:st},me),Object(j.a)(oe.children).map(function(Et,nr){return J.renderMenuItem(Et,nr,Oe||"0-menu-")}))}}]),Ae}(A.Component);mn.defaultProps={prefixCls:"rc-menu",className:"",mode:"vertical",level:1,inlineIndent:24,visible:!0,focusable:!0,style:{},manualRef:rt};var Wr=Object(a.b)()(mn),An=Wr,Tn=ee("Kwbf");function ii(de,Se,Ae){var fe=de.prefixCls,J=de.motion,oe=de.defaultMotions,te=oe===void 0?{}:oe,me=de.openAnimation,ge=de.openTransitionName,Oe=Se.switchingModeFromInline;if(J)return J;if(Object(G.a)(me)==="object"&&me)Object(Tn.a)(!1,"Object type of `openAnimation` is removed. Please use `motion` instead.");else if(typeof me=="string")return{motionName:"".concat(fe,"-open-").concat(me)};if(ge)return{motionName:ge};var Te=te[Ae];return Te||(Oe?null:te.other)}var Ln=function(de){Object(f.a)(Ae,de);var Se=Object(d.a)(Ae);function Ae(fe){var J;Object(w.a)(this,Ae),J=Se.call(this,fe),J.onSelect=function(me){var ge=Object(g.a)(J),Oe=ge.props;if(Oe.selectable){var Te=J.store.getState(),De=Te.selectedKeys,Ve=me.key;Oe.multiple?De=De.concat([Ve]):De=[Ve],"selectedKeys"in Oe||J.store.setState({selectedKeys:De}),Oe.onSelect(Object(z.a)(Object(z.a)({},me),{},{selectedKeys:De}))}},J.onClick=function(me){var ge=J.getRealMenuMode(),Oe=Object(g.a)(J),Te=Oe.store,De=Oe.props.onOpenChange;ge!=="inline"&&!("openKeys"in J.props)&&(Te.setState({openKeys:[]}),De([])),J.props.onClick(me)},J.onKeyDown=function(me,ge){J.innerMenu.getWrappedInstance().onKeyDown(me,ge)},J.onOpenChange=function(me){var ge=Object(g.a)(J),Oe=ge.props,Te=J.store.getState().openKeys.concat(),De=!1,Ve=function(ot){var Et=!1;if(ot.open)Et=Te.indexOf(ot.key)===-1,Et&&Te.push(ot.key);else{var nr=Te.indexOf(ot.key);Et=nr!==-1,Et&&Te.splice(nr,1)}De=De||Et};Array.isArray(me)?me.forEach(Ve):Ve(me),De&&("openKeys"in J.props||J.store.setState({openKeys:Te}),Oe.onOpenChange(Te))},J.onDeselect=function(me){var ge=Object(g.a)(J),Oe=ge.props;if(Oe.selectable){var Te=J.store.getState().selectedKeys.concat(),De=me.key,Ve=Te.indexOf(De);Ve!==-1&&Te.splice(Ve,1),"selectedKeys"in Oe||J.store.setState({selectedKeys:Te}),Oe.onDeselect(Object(z.a)(Object(z.a)({},me),{},{selectedKeys:Te}))}},J.onMouseEnter=function(me){J.restoreModeVerticalFromInline();var ge=J.props.onMouseEnter;ge&&ge(me)},J.onTransitionEnd=function(me){var ge=me.propertyName==="width"&&me.target===me.currentTarget,Oe=me.target.className,Te=Object.prototype.toString.call(Oe)==="[object SVGAnimatedString]"?Oe.animVal:Oe,De=me.propertyName==="font-size"&&Te.indexOf("anticon")>=0;(ge||De)&&J.restoreModeVerticalFromInline()},J.setInnerMenu=function(me){J.innerMenu=me},J.isRootMenu=!0;var oe=fe.defaultSelectedKeys,te=fe.defaultOpenKeys;return"selectedKeys"in fe&&(oe=fe.selectedKeys||[]),"openKeys"in fe&&(te=fe.openKeys||[]),J.store=Object(a.c)({selectedKeys:oe,openKeys:te,activeKey:{"0-menu-":Nn(fe,fe.activeKey)}}),J.state={switchingModeFromInline:!1,prevProps:fe,inlineOpenKeys:[],store:J.store},J}return Object(x.a)(Ae,[{key:"componentDidMount",value:function(){this.updateMiniStore(),this.updateMenuDisplay()}},{key:"componentDidUpdate",value:function(J){var oe=this.props,te=oe.siderCollapsed,me=oe.inlineCollapsed,ge=oe.onOpenChange;(!J.inlineCollapsed&&me||!J.siderCollapsed&&te)&&ge([]),this.updateMiniStore(),this.updateMenuDisplay()}},{key:"updateMenuDisplay",value:function(){var J=this.props.collapsedWidth,oe=this.store,te=this.prevOpenKeys,me=this.getInlineCollapsed()&&(J===0||J==="0"||J==="0px");me?(this.prevOpenKeys=oe.getState().openKeys.concat(),this.store.setState({openKeys:[]})):te&&(this.store.setState({openKeys:te}),this.prevOpenKeys=null)}},{key:"getRealMenuMode",value:function(){var J=this.props.mode,oe=this.state.switchingModeFromInline,te=this.getInlineCollapsed();return oe&&te?"inline":te?"vertical":J}},{key:"getInlineCollapsed",value:function(){var J=this.props,oe=J.inlineCollapsed,te=J.siderCollapsed;return te!==void 0?te:oe}},{key:"restoreModeVerticalFromInline",value:function(){var J=this.state.switchingModeFromInline;J&&this.setState({switchingModeFromInline:!1})}},{key:"updateMiniStore",value:function(){"selectedKeys"in this.props&&this.store.setState({selectedKeys:this.props.selectedKeys||[]}),"openKeys"in this.props&&this.store.setState({openKeys:this.props.openKeys||[]})}},{key:"render",value:function(){var J=Object(z.a)({},Object(C.a)(this.props,["collapsedWidth","siderCollapsed","defaultMotions"])),oe=this.getRealMenuMode();return J.className+=" ".concat(J.prefixCls,"-root"),J.direction==="rtl"&&(J.className+=" ".concat(J.prefixCls,"-rtl")),J=Object(z.a)(Object(z.a)({},J),{},{mode:oe,onClick:this.onClick,onOpenChange:this.onOpenChange,onDeselect:this.onDeselect,onSelect:this.onSelect,onMouseEnter:this.onMouseEnter,onTransitionEnd:this.onTransitionEnd,parentMenu:this,motion:ii(this.props,this.state,oe)}),delete J.openAnimation,delete J.openTransitionName,A.createElement(a.a,{store:this.store},A.createElement(An,Object(p.a)({},J,{ref:this.setInnerMenu}),this.props.children))}}],[{key:"getDerivedStateFromProps",value:function(J,oe){var te=oe.prevProps,me=oe.store,ge=me.getState(),Oe={},Te={prevProps:J};return te.mode==="inline"&&J.mode!=="inline"&&(Te.switchingModeFromInline=!0),"openKeys"in J?Oe.openKeys=J.openKeys||[]:((J.inlineCollapsed&&!te.inlineCollapsed||J.siderCollapsed&&!te.siderCollapsed)&&(Te.switchingModeFromInline=!0,Te.inlineOpenKeys=ge.openKeys,Oe.openKeys=[]),(!J.inlineCollapsed&&te.inlineCollapsed||!J.siderCollapsed&&te.siderCollapsed)&&(Oe.openKeys=oe.inlineOpenKeys,Te.inlineOpenKeys=[])),Object.keys(Oe).length&&me.setState(Oe),Te}}]),Ae}(A.Component);Ln.defaultProps={selectable:!0,onClick:rt,onSelect:rt,onOpenChange:rt,onDeselect:rt,defaultSelectedKeys:[],defaultOpenKeys:[],subMenuOpenDelay:.1,subMenuCloseDelay:.1,triggerSubMenuAction:"hover",prefixCls:"rc-menu",className:"",mode:"vertical",style:{},builtinPlacements:{},overflowedIndicator:A.createElement("span",null,"\xB7\xB7\xB7")};var It=Ln,Vt=function(de){Object(f.a)(Ae,de);var Se=Object(d.a)(Ae);function Ae(){var fe;return Object(w.a)(this,Ae),fe=Se.apply(this,arguments),fe.onKeyDown=function(J){var oe=J.keyCode;return oe===S.a.ENTER?(fe.onClick(J),!0):void 0},fe.onMouseLeave=function(J){var oe=fe.props,te=oe.eventKey,me=oe.onItemHover,ge=oe.onMouseLeave;me({key:te,hover:!1}),ge({key:te,domEvent:J})},fe.onMouseEnter=function(J){var oe=fe.props,te=oe.eventKey,me=oe.onItemHover,ge=oe.onMouseEnter;me({key:te,hover:!0}),ge({key:te,domEvent:J})},fe.onClick=function(J){var oe=fe.props,te=oe.eventKey,me=oe.multiple,ge=oe.onClick,Oe=oe.onSelect,Te=oe.onDeselect,De=oe.isSelected,Ve={key:te,keyPath:[te],item:Object(g.a)(fe),domEvent:J};ge(Ve),me?De?Te(Ve):Oe(Ve):De||Oe(Ve)},fe.saveNode=function(J){fe.node=J},fe}return Object(x.a)(Ae,[{key:"componentDidMount",value:function(){this.callRef()}},{key:"componentDidUpdate",value:function(){this.callRef()}},{key:"componentWillUnmount",value:function(){var J=this.props;J.onDestroy&&J.onDestroy(J.eventKey)}},{key:"getPrefixCls",value:function(){return"".concat(this.props.rootPrefixCls,"-item")}},{key:"getActiveClassName",value:function(){return"".concat(this.getPrefixCls(),"-active")}},{key:"getSelectedClassName",value:function(){return"".concat(this.getPrefixCls(),"-selected")}},{key:"getDisabledClassName",value:function(){return"".concat(this.getPrefixCls(),"-disabled")}},{key:"callRef",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"render",value:function(){var J,oe=Object(z.a)({},this.props),te=W()(this.getPrefixCls(),oe.className,(J={},Object(le.a)(J,this.getActiveClassName(),!oe.disabled&&oe.active),Object(le.a)(J,this.getSelectedClassName(),oe.isSelected),Object(le.a)(J,this.getDisabledClassName(),oe.disabled),J)),me=Object(z.a)(Object(z.a)({},oe.attribute),{},{title:typeof oe.title=="string"?oe.title:void 0,className:te,role:oe.role||"menuitem","aria-disabled":oe.disabled});oe.role==="option"?me=Object(z.a)(Object(z.a)({},me),{},{role:"option","aria-selected":oe.isSelected}):(oe.role===null||oe.role==="none")&&(me.role="none");var ge={onClick:oe.disabled?null:this.onClick,onMouseLeave:oe.disabled?null:this.onMouseLeave,onMouseEnter:oe.disabled?null:this.onMouseEnter},Oe=Object(z.a)({},oe.style);oe.mode==="inline"&&(oe.direction==="rtl"?Oe.paddingRight=oe.inlineIndent*oe.level:Oe.paddingLeft=oe.inlineIndent*oe.level),ft.forEach(function(De){return delete oe[De]}),delete oe.direction;var Te=this.props.itemIcon;return typeof this.props.itemIcon=="function"&&(Te=A.createElement(this.props.itemIcon,this.props)),A.createElement("li",Object(p.a)({},Object(C.a)(oe,["onClick","onMouseEnter","onMouseLeave","onSelect"]),me,ge,{style:Oe,ref:this.saveNode}),oe.children,Te)}}]),Ae}(A.Component);Vt.isMenuItem=!0,Vt.defaultProps={onSelect:rt,onMouseEnter:rt,onMouseLeave:rt,manualRef:rt};var Xt=Object(a.b)(function(de,Se){var Ae=de.activeKey,fe=de.selectedKeys,J=Se.eventKey,oe=Se.subMenuKey;return{active:Ae[oe]===J,isSelected:Array.isArray(fe)?fe.indexOf(J)!==-1:fe===J}})(Vt),Er=Xt,Ir=function(de){Object(f.a)(Ae,de);var Se=Object(d.a)(Ae);function Ae(){var fe;return Object(w.a)(this,Ae),fe=Se.apply(this,arguments),fe.renderInnerMenuItem=function(J){var oe=fe.props,te=oe.renderMenuItem,me=oe.index;return te(J,me,fe.props.subMenuKey)},fe}return Object(x.a)(Ae,[{key:"render",value:function(){var J=Object(p.a)({},this.props),oe=J.className,te=oe===void 0?"":oe,me=J.rootPrefixCls,ge="".concat(me,"-item-group-title"),Oe="".concat(me,"-item-group-list"),Te=J.title,De=J.children;return ft.forEach(function(Ve){return delete J[Ve]}),delete J.direction,A.createElement("li",Object(p.a)({},J,{onClick:function(st){return st.stopPropagation()},className:"".concat(te," ").concat(me,"-item-group")}),A.createElement("div",{className:ge,title:typeof Te=="string"?Te:void 0},Te),A.createElement("ul",{className:Oe},A.Children.map(De,this.renderInnerMenuItem)))}}]),Ae}(A.Component);Ir.isMenuItemGroup=!0,Ir.defaultProps={disabled:!0};var en=Ir,kr=function(Se){var Ae=Se.className,fe=Se.rootPrefixCls,J=Se.style;return A.createElement("li",{className:"".concat(Ae," ").concat(fe,"-item-divider"),style:J})};kr.defaultProps={disabled:!0,className:"",style:{}};var Dn=kr,Zn=It,Cr=ee("eDIo");function Pi(de,Se){var Ae=de.prefixCls,fe=de.editable,J=de.locale,oe=de.style;return!fe||fe.showAdd===!1?null:A.createElement("button",{ref:Se,type:"button",className:"".concat(Ae,"-nav-add"),style:oe,"aria-label":(J==null?void 0:J.addAriaLabel)||"Add tab",onClick:function(me){fe.onEdit("add",{event:me})}},fe.addIcon||"+")}var zr=A.forwardRef(Pi);function Un(de,Se){var Ae=de.prefixCls,fe=de.id,J=de.tabs,oe=de.locale,te=de.mobile,me=de.moreIcon,ge=me===void 0?"More":me,Oe=de.moreTransitionName,Te=de.style,De=de.className,Ve=de.editable,st=de.tabBarGutter,ot=de.rtl,Et=de.onTabClick,nr=Object(A.useState)(!1),vr=Object(Y.a)(nr,2),lr=vr[0],hr=vr[1],yr=Object(A.useState)(null),mr=Object(Y.a)(yr,2),fr=mr[0],Nr=mr[1],Sr="".concat(fe,"-more-popup"),vn="".concat(Ae,"-dropdown"),Tr=fr!==null?"".concat(Sr,"-").concat(fr):null,Jt=oe==null?void 0:oe.dropdownAriaLabel,Yt=A.createElement(Zn,{onClick:function(on){var nn=on.key,kn=on.domEvent;Et(nn,kn),hr(!1)},id:Sr,tabIndex:-1,role:"listbox","aria-activedescendant":Tr,selectedKeys:[fr],"aria-label":Jt!==void 0?Jt:"expanded dropdown"},J.map(function($r){return A.createElement(Er,{key:$r.key,id:"".concat(Sr,"-").concat($r.key),role:"option","aria-controls":fe&&"".concat(fe,"-panel-").concat($r.key),disabled:$r.disabled},$r.tab)}));function _r($r){for(var on=J.filter(function(qn){return!qn.disabled}),nn=on.findIndex(function(qn){return qn.key===fr})||0,kn=on.length,Wn=0;Wn<kn;Wn+=1){nn=(nn+$r+kn)%kn;var xn=on[nn];if(!xn.disabled){Nr(xn.key);return}}}function Ur($r){var on=$r.which;if(!lr){[S.a.DOWN,S.a.SPACE,S.a.ENTER].includes(on)&&(hr(!0),$r.preventDefault());return}switch(on){case S.a.UP:_r(-1),$r.preventDefault();break;case S.a.DOWN:_r(1),$r.preventDefault();break;case S.a.ESC:hr(!1);break;case S.a.SPACE:case S.a.ENTER:fr!==null&&Et(fr,$r);break}}Object(A.useEffect)(function(){var $r=document.getElementById(Tr);$r&&$r.scrollIntoView&&$r.scrollIntoView(!1)},[fr]),Object(A.useEffect)(function(){lr||Nr(null)},[lr]);var jt=Object(le.a)({},ot?"marginLeft":"marginRight",st);J.length||(jt.visibility="hidden",jt.order=1);var Hr=W()(Object(le.a)({},"".concat(vn,"-rtl"),ot)),yn=te?null:A.createElement(Cr.a,{prefixCls:vn,overlay:Yt,trigger:["hover"],visible:lr,transitionName:Oe,onVisibleChange:hr,overlayClassName:Hr,mouseEnterDelay:.1,mouseLeaveDelay:.1},A.createElement("button",{type:"button",className:"".concat(Ae,"-nav-more"),style:jt,tabIndex:-1,"aria-hidden":"true","aria-haspopup":"listbox","aria-controls":Sr,id:"".concat(fe,"-more"),"aria-expanded":lr,onKeyDown:Ur},ge));return A.createElement("div",{className:W()("".concat(Ae,"-nav-operations"),De),style:Te,ref:Se},yn,A.createElement(zr,{prefixCls:Ae,locale:oe,editable:Ve}))}var yi=A.forwardRef(Un),ai=Object(A.createContext)(null),Ea=.1,ea=.01,On=20,vo=Math.pow(.995,On);function yo(){var de=navigator.userAgent||navigator.vendor||window.opera;return!!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(de)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(de.substr(0,4)))}function ha(de,Se){var Ae=Object(A.useState)(),fe=Object(Y.a)(Ae,2),J=fe[0],oe=fe[1],te=Object(A.useState)(0),me=Object(Y.a)(te,2),ge=me[0],Oe=me[1],Te=Object(A.useState)(0),De=Object(Y.a)(Te,2),Ve=De[0],st=De[1],ot=Object(A.useState)(),Et=Object(Y.a)(ot,2),nr=Et[0],vr=Et[1],lr=Object(A.useRef)();function hr(Jt){var Yt=Jt.touches[0],_r=Yt.screenX,Ur=Yt.screenY;oe({x:_r,y:Ur}),window.clearInterval(lr.current)}function yr(Jt){if(!J)return;Jt.preventDefault();var Yt=Jt.touches[0],_r=Yt.screenX,Ur=Yt.screenY;oe({x:_r,y:Ur});var jt=_r-J.x,Hr=Ur-J.y;Se(jt,Hr);var yn=Date.now();Oe(yn),st(yn-ge),vr({x:jt,y:Hr})}function mr(){if(!J)return;if(oe(null),vr(null),nr){var Jt=nr.x/Ve,Yt=nr.y/Ve,_r=Math.abs(Jt),Ur=Math.abs(Yt);if(Math.max(_r,Ur)<Ea)return;var jt=Jt,Hr=Yt;lr.current=window.setInterval(function(){if(Math.abs(jt)<ea&&Math.abs(Hr)<ea){window.clearInterval(lr.current);return}jt*=vo,Hr*=vo,Se(jt*On,Hr*On)},On)}}var fr=Object(A.useRef)(0),Nr=Object(A.useRef)(!1),Sr=Object(A.useRef)();function vn(Jt){var Yt=Jt.deltaX,_r=Jt.deltaY,Ur=0,jt=Math.abs(Yt),Hr=Math.abs(_r);jt===Hr?Ur=Sr.current==="x"?Yt:_r:jt>Hr?(Ur=Yt,Sr.current="x"):(Ur=_r,Sr.current="y");var yn=Date.now();yn-fr.current>100&&(Nr.current=!1),(Se(-Ur,-Ur)||Nr.current)&&(Jt.preventDefault(),Nr.current=!0),fr.current=yn}var Tr=Object(A.useRef)(null);Tr.current={onTouchStart:hr,onTouchMove:yr,onTouchEnd:mr,onWheel:vn},A.useEffect(function(){function Jt(jt){Tr.current.onTouchStart(jt)}function Yt(jt){Tr.current.onTouchMove(jt)}function _r(jt){Tr.current.onTouchEnd(jt)}function Ur(jt){Tr.current.onWheel(jt)}return document.addEventListener("touchmove",Yt,{passive:!1}),document.addEventListener("touchend",_r,{passive:!1}),de.current.addEventListener("touchstart",Jt,{passive:!1}),de.current.addEventListener("wheel",Ur),function(){document.removeEventListener("touchmove",Yt),document.removeEventListener("touchend",_r)}},[])}function zo(){var de=Object(A.useRef)(new Map);function Se(fe){return de.current.has(fe)||de.current.set(fe,A.createRef()),de.current.get(fe)}function Ae(fe){de.current.delete(fe)}return[Se,Ae]}function Wa(de,Se){var Ae=A.useRef(de),fe=A.useState({}),J=Object(Y.a)(fe,2),oe=J[1];function te(me){var ge=typeof me=="function"?me(Ae.current):me;ge!==Ae.current&&Se(ge,Ae.current),Ae.current=ge,oe({})}return[Ae.current,te]}var bo=function(Se){var Ae=Se.position,fe=Se.prefixCls,J=Se.extra;if(!J)return null;var oe,te=J;return Ae==="right"&&(oe=te.right||!te.left&&te||null),Ae==="left"&&(oe=te.left||null),oe?A.createElement("div",{className:"".concat(fe,"-extra-content")},oe):null};function Ha(de,Se){var Ae,fe=A.useContext(ai),J=fe.prefixCls,oe=fe.tabs,te=de.className,me=de.style,ge=de.id,Oe=de.animated,Te=de.activeKey,De=de.rtl,Ve=de.extra,st=de.editable,ot=de.locale,Et=de.tabPosition,nr=de.tabBarGutter,vr=de.children,lr=de.onTabClick,hr=de.onTabScroll,yr=Object(A.useRef)(),mr=Object(A.useRef)(),fr=Object(A.useRef)(),Nr=Object(A.useRef)(),Sr=zo(),vn=Object(Y.a)(Sr,2),Tr=vn[0],Jt=vn[1],Yt=Et==="top"||Et==="bottom",_r=Wa(0,function(Jr,Rr){Yt&&hr&&hr({direction:Jr>Rr?"left":"right"})}),Ur=Object(Y.a)(_r,2),jt=Ur[0],Hr=Ur[1],yn=Wa(0,function(Jr,Rr){!Yt&&hr&&hr({direction:Jr>Rr?"top":"bottom"})}),$r=Object(Y.a)(yn,2),on=$r[0],nn=$r[1],kn=Object(A.useState)(0),Wn=Object(Y.a)(kn,2),xn=Wn[0],qn=Wn[1],Ei=Object(A.useState)(0),oi=Object(Y.a)(Ei,2),Hn=oi[0],dn=oi[1],sn=Object(A.useState)(0),Cn=Object(Y.a)(sn,2),bn=Cn[0],xi=Cn[1],Ii=Object(A.useState)(0),Ni=Object(Y.a)(Ii,2),an=Ni[0],Ai=Ni[1],Ui=Object(A.useState)(null),un=Object(Y.a)(Ui,2),tn=un[0],Kn=un[1],Co=Object(A.useState)(null),Va=Object(Y.a)(Co,2),Bi=Va[0],ra=Va[1],xa=Object(A.useState)(0),Xa=Object(Y.a)(xa,2),Ca=Xa[0],Xo=Xa[1],Yo=Object(A.useState)(0),So=Object(Y.a)(Yo,2),Ya=So[0],$a=So[1],na=k(new Map),ia=Object(Y.a)(na,2),$o=ia[0],Sa=ia[1],fa=u(oe,$o,xn),aa="".concat(J,"-nav-operations-hidden"),oa=0,Ci=0;Yt?De?(oa=0,Ci=Math.max(0,xn-tn)):(oa=Math.min(0,tn-xn),Ci=0):(oa=Math.min(0,Bi-Hn),Ci=0);function Vi(Jr){return Jr<oa?[oa,!1]:Jr>Ci?[Ci,!1]:[Jr,!0]}var Fi=Object(A.useRef)(),pa=Object(A.useState)(),Xi=Object(Y.a)(pa,2),Ta=Xi[0],Qa=Xi[1];function _a(){Qa(Date.now())}function Ja(){window.clearTimeout(Fi.current)}ha(yr,function(Jr,Rr){var zn=!1;function li(sa,Ri){sa(function(va){var Wi=Vi(va+Ri),Gn=Object(Y.a)(Wi,2),Oa=Gn[0],qa=Gn[1];return zn=qa,Oa})}if(Yt){if(tn>=xn)return zn;li(Hr,Jr)}else{if(Bi>=Hn)return zn;li(nn,Rr)}return Ja(),_a(),zn}),Object(A.useEffect)(function(){return Ja(),Ta&&(Fi.current=window.setTimeout(function(){Qa(0)},100)),Ja},[Ta]);function ji(){var Jr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Te,Rr=fa.get(Jr);if(!Rr)return;if(Yt){var zn=jt;De?Rr.right<jt?zn=Rr.right:Rr.right+Rr.width>jt+tn&&(zn=Rr.right+Rr.width-tn):Rr.left<-jt?zn=-Rr.left:Rr.left+Rr.width>-jt+tn&&(zn=-(Rr.left+Rr.width-tn)),nn(0),Hr(Vi(zn)[0])}else{var li=on;Rr.top<-on?li=-Rr.top:Rr.top+Rr.height>-on+Bi&&(li=-(Rr.top+Rr.height-Bi)),Hr(0),nn(Vi(li)[0])}}var Yi=m(fa,{width:tn,height:Bi,left:jt,top:on},{width:bn,height:an},{width:Ca,height:Ya},Object(z.a)(Object(z.a)({},de),{},{tabs:oe})),To=Object(Y.a)(Yi,2),Qo=To[0],Jo=To[1],Zo=oe.map(function(Jr){var Rr=Jr.key;return A.createElement(o,{id:ge,prefixCls:J,key:Rr,rtl:De,tab:Jr,closable:Jr.closable,editable:st,active:Rr===Te,tabPosition:Et,tabBarGutter:nr,renderWrapper:vr,removeAriaLabel:ot==null?void 0:ot.removeAriaLabel,ref:Tr(Rr),onClick:function(li){lr(Rr,li)},onRemove:function(){Jt(Rr)},onFocus:function(){ji(Rr),_a(),De||(yr.current.scrollLeft=0),yr.current.scrollTop=0}})}),Za=R(function(){var Jr,Rr,zn,li,sa,Ri,va,Wi,Gn,Oa=((Jr=yr.current)===null||Jr===void 0?void 0:Jr.offsetWidth)||0,qa=((Rr=yr.current)===null||Rr===void 0?void 0:Rr.offsetHeight)||0,eo=((zn=Nr.current)===null||zn===void 0?void 0:zn.offsetWidth)||0,ui=((li=Nr.current)===null||li===void 0?void 0:li.offsetHeight)||0,Qr=((sa=fr.current)===null||sa===void 0?void 0:sa.offsetWidth)||0,Ti=((Ri=fr.current)===null||Ri===void 0?void 0:Ri.offsetHeight)||0;Kn(Oa),ra(qa),Xo(eo),$a(ui);var Li=(((va=mr.current)===null||va===void 0?void 0:va.offsetWidth)||0)-eo,Di=(((Wi=mr.current)===null||Wi===void 0?void 0:Wi.offsetHeight)||0)-ui;qn(Li),dn(Di);var to=(Gn=fr.current)===null||Gn===void 0?void 0:Gn.className.includes(aa);xi(Li-(to?0:Qr)),Ai(Di-(to?0:Ti)),Sa(function(){var ka=new Map;return oe.forEach(function(ko){var Ro=ko.key,Qi=Tr(Ro).current;Qi&&ka.set(Ro,{width:Qi.offsetWidth,height:Qi.offsetHeight,left:Qi.offsetLeft,top:Qi.offsetTop})}),ka})}),qo=oe.slice(0,Qo),si=oe.slice(Jo+1),Mn=[].concat(Object(D.a)(qo),Object(D.a)(si)),$n=Object(A.useState)(),Pn=Object(Y.a)($n,2),ma=Pn[0],es=Pn[1],Si=fa.get(Te),_o=Object(A.useRef)();function wo(){_.a.cancel(_o.current)}Object(A.useEffect)(function(){var Jr={};return Si&&(Yt?(De?Jr.right=Si.right:Jr.left=Si.left,Jr.width=Si.width):(Jr.top=Si.top,Jr.height=Si.height)),wo(),_o.current=_()(function(){es(Jr)}),wo},[Si,Yt,De]),Object(A.useEffect)(function(){ji()},[Te,Si,fa,Yt]),Object(A.useEffect)(function(){Za()},[De,nr,Te,oe.map(function(Jr){return Jr.key}).join("_")]);var Ao=!!Mn.length,$i="".concat(J,"-nav-wrap"),wa,ga,Oo,Aa;return Yt?De?(ga=jt>0,wa=jt+tn<xn):(wa=jt<0,ga=-jt+tn<xn):(Oo=on<0,Aa=-on+Bi<Hn),A.createElement("div",{ref:Se,role:"tablist",className:W()("".concat(J,"-nav"),te),style:me,onKeyDown:function(){_a()}},A.createElement(bo,{position:"left",extra:Ve,prefixCls:J}),A.createElement(M.a,{onResize:Za},A.createElement("div",{className:W()($i,(Ae={},Object(le.a)(Ae,"".concat($i,"-ping-left"),wa),Object(le.a)(Ae,"".concat($i,"-ping-right"),ga),Object(le.a)(Ae,"".concat($i,"-ping-top"),Oo),Object(le.a)(Ae,"".concat($i,"-ping-bottom"),Aa),Ae)),ref:yr},A.createElement(M.a,{onResize:Za},A.createElement("div",{ref:mr,className:"".concat(J,"-nav-list"),style:{transform:"translate(".concat(jt,"px, ").concat(on,"px)"),transition:Ta?"none":void 0}},Zo,A.createElement(zr,{ref:Nr,prefixCls:J,locale:ot,editable:st,style:{visibility:Ao?"hidden":null}}),A.createElement("div",{className:W()("".concat(J,"-ink-bar"),Object(le.a)({},"".concat(J,"-ink-bar-animated"),Oe.inkBar)),style:ma}))))),A.createElement(yi,Object.assign({},de,{ref:fr,prefixCls:J,tabs:Mn,className:!Ao&&aa})),A.createElement(bo,{position:"right",extra:Ve,prefixCls:J}))}var Ka=A.forwardRef(Ha);function Go(de){var Se=de.id,Ae=de.activeKey,fe=de.animated,J=de.tabPosition,oe=de.rtl,te=de.destroyInactiveTabPane,me=A.useContext(ai),ge=me.prefixCls,Oe=me.tabs,Te=fe.tabPane,De=Oe.findIndex(function(Ve){return Ve.key===Ae});return A.createElement("div",{className:W()("".concat(ge,"-content-holder"))},A.createElement("div",{className:W()("".concat(ge,"-content"),"".concat(ge,"-content-").concat(J),Object(le.a)({},"".concat(ge,"-content-animated"),Te)),style:De&&Te?Object(le.a)({},oe?"marginRight":"marginLeft","-".concat(De,"00%")):null},Oe.map(function(Ve){return A.cloneElement(Ve.node,{key:Ve.key,prefixCls:ge,tabKey:Ve.key,id:Se,animated:Te,active:Ve.key===Ae,destroyInactiveTabPane:te})})))}function Eo(de){var Se=de.prefixCls,Ae=de.forceRender,fe=de.className,J=de.style,oe=de.id,te=de.active,me=de.animated,ge=de.destroyInactiveTabPane,Oe=de.tabKey,Te=de.children,De=A.useState(Ae),Ve=Object(Y.a)(De,2),st=Ve[0],ot=Ve[1];A.useEffect(function(){te?ot(!0):ge&&ot(!1)},[te,ge]);var Et={};return te||(me?(Et.visibility="hidden",Et.height=0,Et.overflowY="hidden"):Et.display="none"),A.createElement("div",{id:oe&&"".concat(oe,"-panel-").concat(Oe),role:"tabpanel",tabIndex:te?0:-1,"aria-labelledby":oe&&"".concat(oe,"-tab-").concat(Oe),"aria-hidden":!te,style:Object(z.a)(Object(z.a)({},Et),J),className:W()("".concat(Se,"-tabpane"),te&&"".concat(Se,"-tabpane-active"),fe)},(te||st||Ae)&&Te)}var za=0;function xo(de){return Object(j.a)(de).map(function(Se){if(A.isValidElement(Se)){var Ae=Se.key!==void 0?String(Se.key):void 0;return Object(z.a)(Object(z.a)({key:Ae},Se.props),{},{node:Se})}return null}).filter(function(Se){return Se})}function Vo(de,Se){var Ae,fe=de.id,J=de.prefixCls,oe=J===void 0?"rc-tabs":J,te=de.className,me=de.children,ge=de.direction,Oe=de.activeKey,Te=de.defaultActiveKey,De=de.editable,Ve=de.animated,st=de.tabPosition,ot=st===void 0?"top":st,Et=de.tabBarGutter,nr=de.tabBarStyle,vr=de.tabBarExtraContent,lr=de.locale,hr=de.moreIcon,yr=de.moreTransitionName,mr=de.destroyInactiveTabPane,fr=de.renderTabBar,Nr=de.onChange,Sr=de.onTabClick,vn=de.onTabScroll,Tr=Object(L.a)(de,["id","prefixCls","className","children","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","moreIcon","moreTransitionName","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll"]),Jt=xo(me),Yt=ge==="rtl",_r;Ve===!1?_r={inkBar:!1,tabPane:!1}:_r=Object(z.a)({inkBar:!0,tabPane:!1},Ve!==!0?Ve:null);var Ur=Object(A.useState)(!1),jt=Object(Y.a)(Ur,2),Hr=jt[0],yn=jt[1];Object(A.useEffect)(function(){yn(yo())},[]);var $r=Object(P.a)(function(){var an;return(an=Jt[0])===null||an===void 0?void 0:an.key},{value:Oe,defaultValue:Te}),on=Object(Y.a)($r,2),nn=on[0],kn=on[1],Wn=Object(A.useState)(function(){return Jt.findIndex(function(an){return an.key===nn})}),xn=Object(Y.a)(Wn,2),qn=xn[0],Ei=xn[1];Object(A.useEffect)(function(){var an=Jt.findIndex(function(Ui){return Ui.key===nn});if(an===-1){var Ai;an=Math.max(0,Math.min(qn,Jt.length-1)),kn((Ai=Jt[an])===null||Ai===void 0?void 0:Ai.key)}Ei(an)},[Jt.map(function(an){return an.key}).join("_"),nn,qn]);var oi=Object(P.a)(null,{value:fe}),Hn=Object(Y.a)(oi,2),dn=Hn[0],sn=Hn[1],Cn=ot;Hr&&!["left","right"].includes(ot)&&(Cn="top"),Object(A.useEffect)(function(){fe||(sn("rc-tabs-".concat(za)),za+=1)},[]);function bn(an,Ai){Sr==null||Sr(an,Ai),kn(an),Nr==null||Nr(an)}var xi={id:dn,activeKey:nn,animated:_r,tabPosition:Cn,rtl:Yt,mobile:Hr},Ii,Ni=Object(z.a)(Object(z.a)({},xi),{},{editable:De,locale:lr,moreIcon:hr,moreTransitionName:yr,tabBarGutter:Et,onTabClick:bn,onTabScroll:vn,extra:vr,style:nr,panes:me});return fr?Ii=fr(Ni,Ka):Ii=A.createElement(Ka,Object.assign({},Ni)),A.createElement(ai.Provider,{value:{tabs:Jt,prefixCls:oe}},A.createElement("div",Object.assign({ref:Se,id:fe,className:W()(oe,"".concat(oe,"-").concat(Cn),(Ae={},Object(le.a)(Ae,"".concat(oe,"-mobile"),Hr),Object(le.a)(Ae,"".concat(oe,"-editable"),De),Object(le.a)(Ae,"".concat(oe,"-rtl"),Yt),Ae),te)},Tr),Ii,A.createElement(Go,Object.assign({destroyInactiveTabPane:mr},xi,{animated:_r}))))}var ta=A.forwardRef(Vo);ta.TabPane=Eo;var ki=ta,Ga=xt.b=ki},kSUc:function(zt,xt,ee){},kqOp:function(zt,xt,ee){"use strict";ee.d(xt,"a",function(){return D});var le=ee("0Owb"),Y=ee("fWQN"),L=ee("mtLc"),z=ee("yKVA"),A=ee("879j"),I=ee("q1tI"),W=ee.n(I),j=ee("Ot1p"),P="\u2581",D=function(E){Object(z.a)(M,E);var _=Object(A.a)(M);function M(){var R;Object(Y.a)(this,M);for(var k=arguments.length,S=new Array(k),c=0;c<k;c++)S[c]=arguments[c];return R=_.call.apply(_,[this].concat(S)),R.getChCountBeforeCursor=function(o,l){for(var u=l.line,T=0,m=0;m<u;m++)T+=o.getLine(m).split(P).length-1;var p=o.getLine(u).substring(0,l.ch);return T+=p.split(P).length-1,T},R.onCMBeforeChange=function(o,l){var u=o.getRange(l.from,l.to),T=0;if(l.text.forEach(function(x){T+=x.split(P).length-1}),u&&u.indexOf(P)!=-1){var m=u.split(P).length-1,p=R.getChCountBeforeCursor(o,l.from);console.log("\u5220\u9664".concat(m,"\u4E2A\uFF0C \u4E4B\u524D\u6709").concat(p,"\u4E2A\uFF0C\u65B0\u589E").concat(T,"\u4E2A")),R.props.deleteEmptyDisabled?l.cancel():R.props.onPlaceholderChange&&R.props.onPlaceholderChange(p,m,T)}else if(T){var w=R.getChCountBeforeCursor(o,l.from);console.log("\u65B0\u589E".concat(T,"\u4E2A\uFF0C\u4E4B\u524D\u6709").concat(w,"\u4E2A")),R.props.onPlaceholderChange&&R.props.onPlaceholderChange(w,0,T)}},R}return Object(L.a)(M,[{key:"render",value:function(){return W.a.createElement(j.a,Object(le.a)({},this.props,{onCMBeforeChange:this.onCMBeforeChange}))}}]),M}(I.Component)},lZu9:function(zt,xt,ee){(function(le){le(ee("VrN/"),ee("1eCo"),ee("8EBN"))})(function(le){"use strict";le.defineMode("markdown",function(Y,L){var z=le.getMode(Y,"text/html"),A=z.name=="null";function I(V){if(le.findModeByName){var H=le.findModeByName(V);H&&(V=H.mime||H.mimes[0])}var re=le.getMode(Y,V);return re.name=="null"?null:re}L.highlightFormatting===void 0&&(L.highlightFormatting=!1),L.maxBlockquoteDepth===void 0&&(L.maxBlockquoteDepth=0),L.taskLists===void 0&&(L.taskLists=!1),L.strikethrough===void 0&&(L.strikethrough=!1),L.emoji===void 0&&(L.emoji=!1),L.fencedCodeBlockHighlighting===void 0&&(L.fencedCodeBlockHighlighting=!0),L.fencedCodeBlockDefaultMode===void 0&&(L.fencedCodeBlockDefaultMode="text/plain"),L.xml===void 0&&(L.xml=!0),L.tokenTypeOverrides===void 0&&(L.tokenTypeOverrides={});var W={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 j in W)W.hasOwnProperty(j)&&L.tokenTypeOverrides[j]&&(W[j]=L.tokenTypeOverrides[j]);var P=/^([*\-_])(?:\s*\1){2,}\s*$/,D=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,E=/^\[(x| )\](?=\s)/i,_=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,M=/^ {0,3}(?:\={1,}|-{2,})\s*$/,R=/^[^#!\[\]*_\\<>` "'(~:]+/,k=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,S=/^\s*\[[^\]]+?\]:.*$/,c=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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(V,H,re){return H.f=H.inline=re,re(V,H)}function u(V,H,re){return H.f=H.block=re,re(V,H)}function T(V){return!V||!/\S/.test(V.string)}function m(V){if(V.linkTitle=!1,V.linkHref=!1,V.linkText=!1,V.em=!1,V.strong=!1,V.strikethrough=!1,V.quote=0,V.indentedCode=!1,V.f==w){var H=A;if(!H){var re=le.innerMode(z,V.htmlState);H=re.mode.name=="xml"&&re.state.tagStart===null&&!re.state.context&&re.state.tokenize.isInText}H&&(V.f=d,V.block=p,V.htmlState=null)}return V.trailingSpace=0,V.trailingSpaceNewLine=!1,V.prevLine=V.thisLine,V.thisLine={stream:null},null}function p(V,H){var re=V.column()===H.indentation,ce=T(H.prevLine.stream),Ee=H.indentedCode,we=H.prevLine.hr,Ye=H.list!==!1,Ne=(H.listStack[H.listStack.length-1]||0)+3;H.indentedCode=!1;var Ie=H.indentation;if(H.indentationDiff===null&&(H.indentationDiff=H.indentation,Ye)){for(H.list=null;Ie<H.listStack[H.listStack.length-1];)H.listStack.pop(),H.listStack.length?H.indentation=H.listStack[H.listStack.length-1]:H.list=!1;H.list!==!1&&(H.indentationDiff=Ie-H.listStack[H.listStack.length-1])}var We=!ce&&!we&&!H.prevLine.header&&(!Ye||!Ee)&&!H.prevLine.fencedCodeEnd,Ue=(H.list===!1||we||ce)&&H.indentation<=Ne&&V.match(P),xe=null;if(H.indentationDiff>=4&&(Ee||H.prevLine.fencedCodeEnd||H.prevLine.header||ce))return V.skipToEnd(),H.indentedCode=!0,W.code;if(V.eatSpace())return null;if(re&&H.indentation<=Ne&&(xe=V.match(_))&&xe[1].length<=6)return H.quote=0,H.header=xe[1].length,H.thisLine.header=!0,L.highlightFormatting&&(H.formatting="header"),H.f=H.inline,g(H);if(H.indentation<=Ne&&V.eat(">"))return H.quote=re?1:H.quote+1,L.highlightFormatting&&(H.formatting="quote"),V.eatSpace(),g(H);if(!Ue&&!H.setext&&re&&H.indentation<=Ne&&(xe=V.match(D))){var se=xe[1]?"ol":"ul";return H.indentation=Ie+V.current().length,H.list=!0,H.quote=0,H.listStack.push(H.indentation),H.em=!1,H.strong=!1,H.code=!1,H.strikethrough=!1,L.taskLists&&V.match(E,!1)&&(H.taskList=!0),H.f=H.inline,L.highlightFormatting&&(H.formatting=["list","list-"+se]),g(H)}else{if(re&&H.indentation<=Ne&&(xe=V.match(k,!0)))return H.quote=0,H.fencedEndRE=new RegExp(xe[1]+"+ *$"),H.localMode=L.fencedCodeBlockHighlighting&&I(xe[2]||L.fencedCodeBlockDefaultMode),H.localMode&&(H.localState=le.startState(H.localMode)),H.f=H.block=x,L.highlightFormatting&&(H.formatting="code-block"),H.code=-1,g(H);if(H.setext||(!We||!Ye)&&!H.quote&&H.list===!1&&!H.code&&!Ue&&!S.test(V.string)&&(xe=V.lookAhead(1))&&(xe=xe.match(M)))return H.setext?(H.header=H.setext,H.setext=0,V.skipToEnd(),L.highlightFormatting&&(H.formatting="header")):(H.header=xe[0].charAt(0)=="="?1:2,H.setext=H.header),H.thisLine.header=!0,H.f=H.inline,g(H);if(Ue)return V.skipToEnd(),H.hr=!0,H.thisLine.hr=!0,W.hr;if(V.peek()==="[")return l(V,H,y)}return l(V,H,H.inline)}function w(V,H){var re=z.token(V,H.htmlState);if(!A){var ce=le.innerMode(z,H.htmlState);(ce.mode.name=="xml"&&ce.state.tagStart===null&&!ce.state.context&&ce.state.tokenize.isInText||H.md_inside&&V.current().indexOf(">")>-1)&&(H.f=d,H.block=p,H.htmlState=null)}return re}function x(V,H){var re=H.listStack[H.listStack.length-1]||0,ce=H.indentation<re,Ee=re+3;if(H.fencedEndRE&&H.indentation<=Ee&&(ce||V.match(H.fencedEndRE))){L.highlightFormatting&&(H.formatting="code-block");var we;return ce||(we=g(H)),H.localMode=H.localState=null,H.block=p,H.f=d,H.fencedEndRE=null,H.code=0,H.thisLine.fencedCodeEnd=!0,ce?u(V,H,H.block):we}else return H.localMode?H.localMode.token(V,H.localState):(V.skipToEnd(),W.code)}function g(V){var H=[];if(V.formatting){H.push(W.formatting),typeof V.formatting=="string"&&(V.formatting=[V.formatting]);for(var re=0;re<V.formatting.length;re++)H.push(W.formatting+"-"+V.formatting[re]),V.formatting[re]==="header"&&H.push(W.formatting+"-"+V.formatting[re]+"-"+V.header),V.formatting[re]==="quote"&&(!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=V.quote?H.push(W.formatting+"-"+V.formatting[re]+"-"+V.quote):H.push("error"))}if(V.taskOpen)return H.push("meta"),H.length?H.join(" "):null;if(V.taskClosed)return H.push("property"),H.length?H.join(" "):null;if(V.linkHref?H.push(W.linkHref,"url"):(V.strong&&H.push(W.strong),V.em&&H.push(W.em),V.strikethrough&&H.push(W.strikethrough),V.emoji&&H.push(W.emoji),V.linkText&&H.push(W.linkText),V.code&&H.push(W.code),V.image&&H.push(W.image),V.imageAltText&&H.push(W.imageAltText,"link"),V.imageMarker&&H.push(W.imageMarker)),V.header&&H.push(W.header,W.header+"-"+V.header),V.quote&&(H.push(W.quote),!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=V.quote?H.push(W.quote+"-"+V.quote):H.push(W.quote+"-"+L.maxBlockquoteDepth)),V.list!==!1){var ce=(V.listStack.length-1)%3;ce?ce===1?H.push(W.list2):H.push(W.list3):H.push(W.list1)}return V.trailingSpaceNewLine?H.push("trailing-space-new-line"):V.trailingSpace&&H.push("trailing-space-"+(V.trailingSpace%2?"a":"b")),H.length?H.join(" "):null}function f(V,H){return V.match(R,!0)?g(H):void 0}function d(V,H){var re=H.text(V,H);if(typeof re!="undefined")return re;if(H.list)return H.list=null,g(H);if(H.taskList){var ce=V.match(E,!0)[1]===" ";return ce?H.taskOpen=!0:H.taskClosed=!0,L.highlightFormatting&&(H.formatting="task"),H.taskList=!1,g(H)}if(H.taskOpen=!1,H.taskClosed=!1,H.header&&V.match(/^#+$/,!0))return L.highlightFormatting&&(H.formatting="header"),g(H);var Ee=V.next();if(H.linkTitle){H.linkTitle=!1;var we=Ee;Ee==="("&&(we=")"),we=(we+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ye="^\\s*(?:[^"+we+"\\\\]+|\\\\\\\\|\\\\.)"+we;if(V.match(new RegExp(Ye),!0))return W.linkHref}if(Ee==="`"){var Ne=H.formatting;L.highlightFormatting&&(H.formatting="code"),V.eatWhile("`");var Ie=V.current().length;if(H.code==0&&(!H.quote||Ie==1))return H.code=Ie,g(H);if(Ie==H.code){var We=g(H);return H.code=0,We}else return H.formatting=Ne,g(H)}else if(H.code)return g(H);if(Ee==="\\"&&(V.next(),L.highlightFormatting)){var Ue=g(H),xe=W.formatting+"-escape";return Ue?Ue+" "+xe:xe}if(Ee==="!"&&V.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return H.imageMarker=!0,H.image=!0,L.highlightFormatting&&(H.formatting="image"),g(H);if(Ee==="["&&H.imageMarker&&V.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return H.imageMarker=!1,H.imageAltText=!0,L.highlightFormatting&&(H.formatting="image"),g(H);if(Ee==="]"&&H.imageAltText){L.highlightFormatting&&(H.formatting="image");var Ue=g(H);return H.imageAltText=!1,H.image=!1,H.inline=H.f=C,Ue}if(Ee==="["&&!H.image)return H.linkText&&V.match(/^.*?\]/)||(H.linkText=!0,L.highlightFormatting&&(H.formatting="link")),g(H);if(Ee==="]"&&H.linkText){L.highlightFormatting&&(H.formatting="link");var Ue=g(H);return H.linkText=!1,H.inline=H.f=V.match(/\(.*?\)| ?\[.*?\]/,!1)?C:d,Ue}if(Ee==="<"&&V.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){H.f=H.inline=a,L.highlightFormatting&&(H.formatting="link");var Ue=g(H);return Ue?Ue+=" ":Ue="",Ue+W.linkInline}if(Ee==="<"&&V.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){H.f=H.inline=a,L.highlightFormatting&&(H.formatting="link");var Ue=g(H);return Ue?Ue+=" ":Ue="",Ue+W.linkEmail}if(L.xml&&Ee==="<"&&V.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var se=V.string.indexOf(">",V.pos);if(se!=-1){var ke=V.string.substring(V.start,se);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(ke)&&(H.md_inside=!0)}return V.backUp(1),H.htmlState=le.startState(z),u(V,H,w)}if(L.xml&&Ee==="<"&&V.match(/^\/\w*?>/))return H.md_inside=!1,"tag";if(Ee==="*"||Ee==="_"){for(var dt=1,at=V.pos==1?" ":V.string.charAt(V.pos-2);dt<3&&V.eat(Ee);)dt++;var rt=V.peek()||" ",lt=!/\s/.test(rt)&&(!c.test(rt)||/\s/.test(at)||c.test(at)),Ke=!/\s/.test(at)&&(!c.test(at)||/\s/.test(rt)||c.test(rt)),$e=null,it=null;if(dt%2&&(!H.em&<&&(Ee==="*"||!Ke||c.test(at))?$e=!0:H.em==Ee&&Ke&&(Ee==="*"||!lt||c.test(rt))&&($e=!1)),dt>1&&(!H.strong&<&&(Ee==="*"||!Ke||c.test(at))?it=!0:H.strong==Ee&&Ke&&(Ee==="*"||!lt||c.test(rt))&&(it=!1)),it!=null||$e!=null){L.highlightFormatting&&(H.formatting=$e==null?"strong":it==null?"em":"strong em"),$e===!0&&(H.em=Ee),it===!0&&(H.strong=Ee);var We=g(H);return $e===!1&&(H.em=!1),it===!1&&(H.strong=!1),We}}else if(Ee===" "&&(V.eat("*")||V.eat("_"))){if(V.peek()===" ")return g(H);V.backUp(1)}if(L.strikethrough){if(Ee==="~"&&V.eatWhile(Ee)){if(H.strikethrough){L.highlightFormatting&&(H.formatting="strikethrough");var We=g(H);return H.strikethrough=!1,We}else if(V.match(/^[^\s]/,!1))return H.strikethrough=!0,L.highlightFormatting&&(H.formatting="strikethrough"),g(H)}else if(Ee===" "&&V.match(/^~~/,!0)){if(V.peek()===" ")return g(H);V.backUp(2)}}if(L.emoji&&Ee===":"&&V.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){H.emoji=!0,L.highlightFormatting&&(H.formatting="emoji");var ft=g(H);return H.emoji=!1,ft}return Ee===" "&&(V.match(/^ +$/,!1)?H.trailingSpace++:H.trailingSpace&&(H.trailingSpaceNewLine=!0)),g(H)}function a(V,H){var re=V.next();if(re===">"){H.f=H.inline=d,L.highlightFormatting&&(H.formatting="link");var ce=g(H);return ce?ce+=" ":ce="",ce+W.linkInline}return V.match(/^[^>]+/,!0),W.linkInline}function C(V,H){if(V.eatSpace())return null;var re=V.next();return re==="("||re==="["?(H.f=H.inline=b(re==="("?")":"]"),L.highlightFormatting&&(H.formatting="link-string"),H.linkHref=!0,g(H)):"error"}var v={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function b(V){return function(H,re){var ce=H.next();if(ce===V){re.f=re.inline=d,L.highlightFormatting&&(re.formatting="link-string");var Ee=g(re);return re.linkHref=!1,Ee}return H.match(v[V]),re.linkHref=!0,g(re)}}function y(V,H){return V.match(/^([^\]\\]|\\.)*\]:/,!1)?(H.f=G,V.next(),L.highlightFormatting&&(H.formatting="link"),H.linkText=!0,g(H)):l(V,H,d)}function G(V,H){if(V.match(/^\]:/,!0)){H.f=H.inline=$,L.highlightFormatting&&(H.formatting="link");var re=g(H);return H.linkText=!1,re}return V.match(/^([^\]\\]|\\.)+/,!0),W.linkText}function $(V,H){return V.eatSpace()?null:(V.match(/^[^\s]+/,!0),V.peek()===void 0?H.linkTitle=!0:V.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),H.f=H.inline=d,W.linkHref+" url")}var Z={startState:function(){return{f:p,prevLine:{stream:null},thisLine:{stream:null},block:p,htmlState:null,indentation:0,inline:d,text:f,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(V){return{f:V.f,prevLine:V.prevLine,thisLine:V.thisLine,block:V.block,htmlState:V.htmlState&&le.copyState(z,V.htmlState),indentation:V.indentation,localMode:V.localMode,localState:V.localMode?le.copyState(V.localMode,V.localState):null,inline:V.inline,text:V.text,formatting:!1,linkText:V.linkText,linkTitle:V.linkTitle,linkHref:V.linkHref,code:V.code,em:V.em,strong:V.strong,strikethrough:V.strikethrough,emoji:V.emoji,header:V.header,setext:V.setext,hr:V.hr,taskList:V.taskList,list:V.list,listStack:V.listStack.slice(0),quote:V.quote,indentedCode:V.indentedCode,trailingSpace:V.trailingSpace,trailingSpaceNewLine:V.trailingSpaceNewLine,md_inside:V.md_inside,fencedEndRE:V.fencedEndRE}},token:function(V,H){if(H.formatting=!1,V!=H.thisLine.stream){if(H.header=0,H.hr=!1,V.match(/^\s*$/,!0))return m(H),null;if(H.prevLine=H.thisLine,H.thisLine={stream:V},H.taskList=!1,H.trailingSpace=0,H.trailingSpaceNewLine=!1,!H.localState&&(H.f=H.block,H.f!=w)){var re=V.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(H.indentation=re,H.indentationDiff=null,re>0)return null}}return H.f(V,H)},innerMode:function(V){return V.block==w?{state:V.htmlState,mode:z}:V.localState?{state:V.localState,mode:V.localMode}:{state:V,mode:Z}},indent:function(V,H,re){return V.block==w&&z.indent?z.indent(V.htmlState,H,re):V.localState&&V.localMode.indent?V.localMode.indent(V.localState,H,re):le.Pass},blankLine:m,getType:g,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Z},"xml"),le.defineMIME("text/markdown","markdown"),le.defineMIME("text/x-markdown","markdown")})},osHv:function(zt,xt,ee){(function(le){le(ee("VrN/"))})(function(le){"use strict";var Y=le.Pos;function L(c,o){return c.line-o.line||c.ch-o.ch}var z="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",A=z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",I=new RegExp("<(/?)(["+z+"]["+A+"]*)","g");function W(c,o,l,u){this.line=o,this.ch=l,this.cm=c,this.text=c.getLine(o),this.min=u?Math.max(u.from,c.firstLine()):c.firstLine(),this.max=u?Math.min(u.to-1,c.lastLine()):c.lastLine()}function j(c,o){var l=c.cm.getTokenTypeAt(Y(c.line,o));return l&&/\btag\b/.test(l)}function P(c){return c.line>=c.max?void 0:(c.ch=0,c.text=c.cm.getLine(++c.line),!0)}function D(c){return c.line<=c.min?void 0:(c.text=c.cm.getLine(--c.line),c.ch=c.text.length,!0)}function E(c){for(;;){var o=c.text.indexOf(">",c.ch);if(o==-1){if(P(c))continue;return}if(!j(c,o+1)){c.ch=o+1;continue}var l=c.text.lastIndexOf("/",o),u=l>-1&&!/\S/.test(c.text.slice(l+1,o));return c.ch=o+1,u?"selfClose":"regular"}}function _(c){for(;;){var o=c.ch?c.text.lastIndexOf("<",c.ch-1):-1;if(o==-1){if(D(c))continue;return}if(!j(c,o+1)){c.ch=o;continue}I.lastIndex=o,c.ch=o;var l=I.exec(c.text);if(l&&l.index==o)return l}}function M(c){for(;;){I.lastIndex=c.ch;var o=I.exec(c.text);if(!o){if(P(c))continue;return}if(!j(c,o.index+1)){c.ch=o.index+1;continue}return c.ch=o.index+o[0].length,o}}function R(c){for(;;){var o=c.ch?c.text.lastIndexOf(">",c.ch-1):-1;if(o==-1){if(D(c))continue;return}if(!j(c,o+1)){c.ch=o;continue}var l=c.text.lastIndexOf("/",o),u=l>-1&&!/\S/.test(c.text.slice(l+1,o));return c.ch=o+1,u?"selfClose":"regular"}}function k(c,o){for(var l=[];;){var u=M(c),T,m=c.line,p=c.ch-(u?u[0].length:0);if(!u||!(T=E(c)))return;if(T=="selfClose")continue;if(u[1]){for(var w=l.length-1;w>=0;--w)if(l[w]==u[2]){l.length=w;break}if(w<0&&(!o||o==u[2]))return{tag:u[2],from:Y(m,p),to:Y(c.line,c.ch)}}else l.push(u[2])}}function S(c,o){for(var l=[];;){var u=R(c);if(!u)return;if(u=="selfClose"){_(c);continue}var T=c.line,m=c.ch,p=_(c);if(!p)return;if(p[1])l.push(p[2]);else{for(var w=l.length-1;w>=0;--w)if(l[w]==p[2]){l.length=w;break}if(w<0&&(!o||o==p[2]))return{tag:p[2],from:Y(c.line,c.ch),to:Y(T,m)}}}}le.registerHelper("fold","xml",function(c,o){for(var l=new W(c,o.line,0);;){var u=M(l);if(!u||l.line!=o.line)return;var T=E(l);if(!T)return;if(!u[1]&&T!="selfClose"){var m=Y(l.line,l.ch),p=k(l,u[2]);return p&&L(p.from,m)>0?{from:m,to:p.from}:null}}}),le.findMatchingTag=function(c,o,l){var u=new W(c,o.line,o.ch,l);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var T=E(u),m=T&&Y(u.line,u.ch),p=T&&_(u);if(!T||!p||L(u,o)>0)return;var w={from:Y(u.line,u.ch),to:m,tag:p[2]};return T=="selfClose"?{open:w,close:null,at:"open"}:p[1]?{open:S(u,p[2]),close:w,at:"close"}:(u=new W(c,m.line,m.ch,l),{open:w,close:k(u,p[2]),at:"open"})},le.findEnclosingTag=function(c,o,l,u){for(var T=new W(c,o.line,o.ch,l);;){var m=S(T,u);if(!m)break;var p=new W(c,o.line,o.ch,l),w=k(p,m.tag);if(w)return{open:m,close:w}}},le.scanForClosingTag=function(c,o,l,u){var T=new W(c,o.line,o.ch,u?{from:0,to:u}:null);return k(T,l)}})},p5ED:function(zt,xt,ee){"use strict";var le=ee("+L6B"),Y=ee("2/Rp"),L=ee("5Dmo"),z=ee("3S7+"),A=ee("k1fw"),I=ee("9og8"),W=ee("tJVT"),j=ee("WmNS"),P=ee.n(j),D=ee("q1tI"),E=ee.n(D),_=ee("vHTk"),M=ee.n(_),R=ee("yEEn"),k=ee("ZW9T"),S=ee("1vsH"),c=ee("V0Rq"),o=ee("m3rI"),l=function(T){var m=T.name,p=T.data,w=T.theme,x=T.type,g=T.filename,f=T.monacoEditor,d=T.className,a=T.style,C=T.close,v=T.onClose,b=T.hasMask,y=T.otherData,G=y===void 0?{}:y,$=Object(D.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),Z=Object(W.a)($,2),V=Z[0],H=Z[1],re=Object(D.useState)(""),ce=Object(W.a)(re,2),Ee=ce[0],we=ce[1],Ye=Object(D.useState)(),Ne=Object(W.a)(Ye,2),Ie=Ne[0],We=Ne[1],Ue=window.ENV==="build"?"/react/build/office.html":"/office.html",xe,se=1024*1024,ke=10*se,dt=Object(D.useRef)();x==="office"&&(xe=Object(S.P)(p).filesize,xe>ke&&(x="other")),g&&(f.filename=g),Object(D.useEffect)(function(){var Ke,$e,it=(Ke=document.cookie)===null||Ke===void 0||(($e=Ke.replace(/\s/g,""))===null||$e===void 0)?void 0:$e.split(";");it==null||it.map(function(ft){var ut=ft.split("=");ut[0]==="_educoder_session"&&we(ut[1])})},[]),Object(D.useEffect)(function(){x==="office"&&at()},[x]);var at=function(){var Ke=Object(I.a)(P.a.mark(function $e(){var it,ft,ut;return P.a.wrap(function(qe){for(;;)switch(qe.prev=qe.next){case 0:return console.log("data:",p),it=p,p.startsWith("http")||(it=location.origin+it),ft=new URL(it).pathname.split("/").pop(),qe.next=6,Object(c.U)({attachment_id:ft});case 6:ut=qe.sent,We(ut);case 8:case"end":return qe.stop()}},$e)}));return function(){return Ke.apply(this,arguments)}}(),rt=function(){if(p.startsWith("http")||p.startsWith("blob:")){lt();return}Object(S.x)(g||"educoder",p,g)},lt=function(){Object(S.v)(g||"educoder",decodeURIComponent(p))};return E.a.createElement("div",{style:Object(A.a)({},a||{}),className:"".concat(b&&M.a.bgBlack," ").concat(x?M.a.wrp:"hide")},C&&E.a.createElement("div",{className:M.a.close,ref:dt},E.a.createElement(z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return dt.current}},E.a.createElement("span",{onClick:lt},E.a.createElement("i",{className:"icon-quxiaozhiding"}))),E.a.createElement(z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return dt.current}},E.a.createElement("span",{className:"",onClick:function(){v(),We(null)}},E.a.createElement("i",{className:"icon-guanbi1"})))),E.a.createElement("div",{className:"".concat(M.a[d]," ").concat(d," ").concat(M.a.monaco," ").concat(x==="txt"?"show":"hide")},x==="txt"&&E.a.createElement(k.b,f)),x==="audio"&&E.a.createElement("audio",{src:"".concat((p==null?void 0:p.indexOf("http://"))>-1||(p==null?void 0:p.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(p),autoPlay:!0}),x==="video"&&E.a.createElement(E.a.Fragment,null,(p==null?void 0:p.indexOf("/api"))>-1?E.a.createElement("video",{controls:!0,src:"".concat(p),autoPlay:!0}):E.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(p),autoPlay:!0})),x==="office"&&Ie&&E.a.createElement("iframe",{src:"".concat(Ue,"?key=").concat(Ie.key,"&url=").concat(o.a.API_SERVER+Ie.url,"&callbackUrl=").concat(o.a.API_SERVER+Ie.callbackUrl,"&fileType=").concat(Ie.fileType,"&title=").concat(Ie.title,"&model=view")}),(x==="xlsx"||x==="doc"||x==="pptx"||x==="docx")&&E.a.createElement("iframe",{src:"".concat(Ue,"?key=").concat(G.key,"&url=").concat(o.a.API_SERVER+G.url,"&callbackUrl=").concat(o.a.API_SERVER+G.callbackUrl,"&fileType=").concat(G.fileType,"&title=").concat(G.title,"&model=").concat(G.model)}),x==="html"&&E.a.createElement("iframe",{src:p+"&disposition=inline"}),x==="pdf"&&E.a.createElement("embed",{className:M.a.embed,src:p,type:"application/pdf"}),x==="image"&&E.a.createElement("img",{src:"".concat((p==null?void 0:p.indexOf("http://"))>-1||(p==null?void 0:p.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(p)}),x==="other"&&E.a.createElement("div",null,E.a.createElement(Y.a,{type:"primary",size:"large",onClick:rt},E.a.createElement(R.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),x==="download"&&E.a.createElement(Y.a,{type:"primary",size:"large",onClick:rt},E.a.createElement(R.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))};xt.a=l},"p77/":function(zt,xt,ee){},"rAM+":function(zt,xt,ee){"use strict";ee.d(xt,"a",function(){return Y});var le=ee("Qw5x");function Y(L,z){var A;if(typeof Symbol=="undefined"||L[Symbol.iterator]==null){if(Array.isArray(L)||(A=Object(le.a)(L))||z&&L&&typeof L.length=="number"){A&&(L=A);var I=0,W=function(){};return{s:W,n:function(){return I>=L.length?{done:!0}:{done:!1,value:L[I++]}},e:function(_){throw _},f:W}}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 j=!0,P=!1,D;return{s:function(){A=L[Symbol.iterator]()},n:function(){var _=A.next();return j=_.done,_},e:function(_){P=!0,D=_},f:function(){try{!j&&A.return!=null&&A.return()}finally{if(P)throw D}}}}},rUJ1:function(zt,xt){const ee=/[&<>"']/,le=/[&<>"']/g,Y=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,z={"&":"&","<":"<",">":">",'"':""","'":"'"},A=x=>z[x];function I(x,g){if(g){if(ee.test(x))return x.replace(le,A)}else if(Y.test(x))return x.replace(L,A);return x}const W=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function j(x){return x.replace(W,(g,f)=>(f=f.toLowerCase(),f==="colon"?":":f.charAt(0)==="#"?f.charAt(1)==="x"?String.fromCharCode(parseInt(f.substring(2),16)):String.fromCharCode(+f.substring(1)):""))}const P=/(^|[^\[])\^/g;function D(x,g){x=x.source||x,g=g||"";const f={replace:(d,a)=>(a=a.source||a,a=a.replace(P,"$1"),x=x.replace(d,a),f),getRegex:()=>new RegExp(x,g)};return f}const E=/[^\w:]/g,_=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function M(x,g,f){if(x){let d;try{d=decodeURIComponent(j(f)).replace(E,"").toLowerCase()}catch(a){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}g&&!_.test(f)&&(f=o(g,f));try{f=encodeURI(f).replace(/%25/g,"%")}catch(d){return null}return f}const R={},k=/^[^:]+:\/*[^/]*$/,S=/^([^:]+:)[\s\S]*$/,c=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(x,g){R[" "+x]||(k.test(x)?R[" "+x]=x+"/":R[" "+x]=m(x,"/",!0)),x=R[" "+x];const f=x.indexOf(":")===-1;return g.substring(0,2)==="//"?f?g:x.replace(S,"$1")+g:g.charAt(0)==="/"?f?g:x.replace(c,"$1")+g:x+g}const l={exec:function(){}};function u(x){let g=1,f,d;for(;g<arguments.length;g++){f=arguments[g];for(d in f)Object.prototype.hasOwnProperty.call(f,d)&&(x[d]=f[d])}return x}function T(x,g){const f=x.replace(/\|/g,(C,v,b)=>{let y=!1,G=v;for(;--G>=0&&b[G]==="\\";)y=!y;return y?"|":" |"}),d=f.split(/ \|/);let a=0;if(d.length>g)d.splice(g);else for(;d.length<g;)d.push("");for(;a<d.length;a++)d[a]=d[a].trim().replace(/\\\|/g,"|");return d}function m(x,g,f){const d=x.length;if(d===0)return"";let a=0;for(;a<d;){const C=x.charAt(d-a-1);if(C===g&&!f)a++;else if(C!==g&&f)a++;else break}return x.substr(0,d-a)}function p(x,g){if(x.indexOf(g[1])===-1)return-1;const f=x.length;let d=0,a=0;for(;a<f;a++)if(x[a]==="\\")a++;else if(x[a]===g[0])d++;else if(x[a]===g[1]&&(d--,d<0))return a;return-1}function w(x){x&&x.sanitize&&!x.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")}zt.exports={escape:I,unescape:j,edit:D,cleanUrl:M,resolveUrl:o,noopTest:l,merge:u,splitCells:T,rtrim:m,findClosingBracket:p,checkSanitizeDeprecation:w}},t23M:function(zt,xt,ee){"use strict";var le=ee("VTBJ"),Y=ee("1OyB"),L=ee("vuIU"),z=ee("Ji7U"),A=ee("LK+K"),I=ee("q1tI"),W=ee.n(I),j=ee("m+aA"),P=ee("Zm9Q"),D=ee("Kwbf"),E=ee("c+Xe"),_=ee("bdgK"),M="rc-observer-key",R=function(k){Object(z.a)(c,k);var S=Object(A.a)(c);function c(){var o;return Object(Y.a)(this,c),o=S.apply(this,arguments),o.resizeObserver=null,o.childNode=null,o.currentElement=null,o.state={width:0,height:0,offsetHeight:0,offsetWidth:0},o.onResize=function(l){var u=o.props.onResize,T=l[0].target,m=T.getBoundingClientRect(),p=m.width,w=m.height,x=T.offsetWidth,g=T.offsetHeight,f=Math.floor(p),d=Math.floor(w);if(o.state.width!==f||o.state.height!==d||o.state.offsetWidth!==x||o.state.offsetHeight!==g){var a={width:f,height:d,offsetWidth:x,offsetHeight:g};o.setState(a),u&&Promise.resolve().then(function(){u(Object(le.a)(Object(le.a)({},a),{},{offsetWidth:x,offsetHeight:g}))})}},o.setChildNode=function(l){o.childNode=l},o}return Object(L.a)(c,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){var l=this.props.disabled;if(l){this.destroyObserver();return}var u=Object(j.a)(this.childNode||this),T=u!==this.currentElement;T&&(this.destroyObserver(),this.currentElement=u),!this.resizeObserver&&u&&(this.resizeObserver=new _.default(this.onResize),this.resizeObserver.observe(u))}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var l=this.props.children,u=Object(P.a)(l);if(u.length>1)Object(D.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(u.length===0)return Object(D.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var T=u[0];if(I.isValidElement(T)&&Object(E.c)(T)){var m=T.ref;u[0]=I.cloneElement(T,{ref:Object(E.a)(m,this.setChildNode)})}return u.length===1?u[0]:u.map(function(p,w){return!I.isValidElement(p)||"key"in p&&p.key!==null?p:I.cloneElement(p,{key:"".concat(M,"-").concat(w)})})}}]),c}(I.Component);R.displayName="ResizeObserver",xt.a=R},ulZh:function(zt,xt,ee){typeof window!="undefined"&&function(Y,L){zt.exports=L()}(this,function(){return function(le){var Y={};function L(z){if(Y[z])return Y[z].exports;var A=Y[z]={i:z,l:!1,exports:{}};return le[z].call(A.exports,A,A.exports,L),A.l=!0,A.exports}return L.m=le,L.c=Y,L.d=function(z,A,I){L.o(z,A)||Object.defineProperty(z,A,{enumerable:!0,get:I})},L.r=function(z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(z,"__esModule",{value:!0})},L.t=function(z,A){if(A&1&&(z=L(z)),A&8)return z;if(A&4&&typeof z=="object"&&z&&z.__esModule)return z;var I=Object.create(null);if(L.r(I),Object.defineProperty(I,"default",{enumerable:!0,value:z}),A&2&&typeof z!="string")for(var W in z)L.d(I,W,function(j){return z[j]}.bind(null,W));return I},L.n=function(z){var A=z&&z.__esModule?function(){return z.default}:function(){return z};return L.d(A,"a",A),A},L.o=function(z,A){return Object.prototype.hasOwnProperty.call(z,A)},L.p="/dist/",L(L.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(le,Y,L){"use strict";var z=Object.prototype.hasOwnProperty,A="~";function I(){}Object.create&&(I.prototype=Object.create(null),new I().__proto__||(A=!1));function W(E,_,M){this.fn=E,this.context=_,this.once=M||!1}function j(E,_,M,R,k){if(typeof M!="function")throw new TypeError("The listener must be a function");var S=new W(M,R||E,k),c=A?A+_:_;return E._events[c]?E._events[c].fn?E._events[c]=[E._events[c],S]:E._events[c].push(S):(E._events[c]=S,E._eventsCount++),E}function P(E,_){--E._eventsCount===0?E._events=new I:delete E._events[_]}function D(){this._events=new I,this._eventsCount=0}D.prototype.eventNames=function(){var _=[],M,R;if(this._eventsCount===0)return _;for(R in M=this._events)z.call(M,R)&&_.push(A?R.slice(1):R);return Object.getOwnPropertySymbols?_.concat(Object.getOwnPropertySymbols(M)):_},D.prototype.listeners=function(_){var M=A?A+_:_,R=this._events[M];if(!R)return[];if(R.fn)return[R.fn];for(var k=0,S=R.length,c=new Array(S);k<S;k++)c[k]=R[k].fn;return c},D.prototype.listenerCount=function(_){var M=A?A+_:_,R=this._events[M];return R?R.fn?1:R.length:0},D.prototype.emit=function(_,M,R,k,S,c){var o=A?A+_:_;if(!this._events[o])return!1;var l=this._events[o],u=arguments.length,T,m;if(l.fn){l.once&&this.removeListener(_,l.fn,void 0,!0);switch(u){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,R),!0;case 4:return l.fn.call(l.context,M,R,k),!0;case 5:return l.fn.call(l.context,M,R,k,S),!0;case 6:return l.fn.call(l.context,M,R,k,S,c),!0}for(m=1,T=new Array(u-1);m<u;m++)T[m-1]=arguments[m];l.fn.apply(l.context,T)}else{var p=l.length,w;for(m=0;m<p;m++){l[m].once&&this.removeListener(_,l[m].fn,void 0,!0);switch(u){case 1:l[m].fn.call(l[m].context);break;case 2:l[m].fn.call(l[m].context,M);break;case 3:l[m].fn.call(l[m].context,M,R);break;case 4:l[m].fn.call(l[m].context,M,R,k);break;default:if(!T)for(w=1,T=new Array(u-1);w<u;w++)T[w-1]=arguments[w];l[m].fn.apply(l[m].context,T)}}}return!0},D.prototype.on=function(_,M,R){return j(this,_,M,R,!1)},D.prototype.once=function(_,M,R){return j(this,_,M,R,!0)},D.prototype.removeListener=function(_,M,R,k){var S=A?A+_:_;if(!this._events[S])return this;if(!M)return P(this,S),this;var c=this._events[S];if(c.fn)c.fn===M&&(!k||c.once)&&(!R||c.context===R)&&P(this,S);else{for(var o=0,l=[],u=c.length;o<u;o++)(c[o].fn!==M||k&&!c[o].once||R&&c[o].context!==R)&&l.push(c[o]);l.length?this._events[S]=l.length===1?l[0]:l:P(this,S)}return this},D.prototype.removeAllListeners=function(_){var M;return _?(M=A?A+_:_,this._events[M]&&P(this,M)):(this._events=new I,this._eventsCount=0),this},D.prototype.off=D.prototype.removeListener,D.prototype.addListener=D.prototype.on,D.prefixed=A,D.EventEmitter=D,le.exports=D},"./node_modules/url-toolkit/src/url-toolkit.js":function(le,Y,L){(function(z){var A=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,I=/^([^\/?#]*)([^]*)$/,W=/(?:\/|^)\.(?=\/)/g,j=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,P={buildAbsoluteURL:function(D,E,_){if(_=_||{},D=D.trim(),E=E.trim(),!E){if(!_.alwaysNormalize)return D;var M=P.parseURL(D);if(!M)throw new Error("Error trying to parse base URL.");return M.path=P.normalizePath(M.path),P.buildURLFromParts(M)}var R=P.parseURL(E);if(!R)throw new Error("Error trying to parse relative URL.");if(R.scheme)return _.alwaysNormalize?(R.path=P.normalizePath(R.path),P.buildURLFromParts(R)):E;var k=P.parseURL(D);if(!k)throw new Error("Error trying to parse base URL.");if(!k.netLoc&&k.path&&k.path[0]!=="/"){var S=I.exec(k.path);k.netLoc=S[1],k.path=S[2]}k.netLoc&&!k.path&&(k.path="/");var c={scheme:k.scheme,netLoc:R.netLoc,path:null,params:R.params,query:R.query,fragment:R.fragment};if(!R.netLoc&&(c.netLoc=k.netLoc,R.path[0]!=="/"))if(!R.path)c.path=k.path,R.params||(c.params=k.params,R.query||(c.query=k.query));else{var o=k.path,l=o.substring(0,o.lastIndexOf("/")+1)+R.path;c.path=P.normalizePath(l)}return c.path===null&&(c.path=_.alwaysNormalize?P.normalizePath(R.path):R.path),P.buildURLFromParts(c)},parseURL:function(D){var E=A.exec(D);return E?{scheme:E[1]||"",netLoc:E[2]||"",path:E[3]||"",params:E[4]||"",query:E[5]||"",fragment:E[6]||""}:null},normalizePath:function(D){for(D=D.split("").reverse().join("").replace(W,"");D.length!==(D=D.replace(j,"")).length;);return D.split("").reverse().join("")},buildURLFromParts:function(D){return D.scheme+D.netLoc+D.path+D.params+D.query+D.fragment}};le.exports=P})(this)},"./node_modules/webworkify-webpack/index.js":function(le,Y,L){function z(_){var M={};function R(S){if(M[S])return M[S].exports;var c=M[S]={i:S,l:!1,exports:{}};return _[S].call(c.exports,c,c.exports,R),c.l=!0,c.exports}R.m=_,R.c=M,R.i=function(S){return S},R.d=function(S,c,o){R.o(S,c)||Object.defineProperty(S,c,{configurable:!1,enumerable:!0,get:o})},R.r=function(S){Object.defineProperty(S,"__esModule",{value:!0})},R.n=function(S){var c=S&&S.__esModule?function(){return S.default}:function(){return S};return R.d(c,"a",c),c},R.o=function(S,c){return Object.prototype.hasOwnProperty.call(S,c)},R.p="/",R.oe=function(S){throw console.error(S),S};var k=R(R.s=ENTRY_MODULE);return k.default||k}var A="[\\.|\\-|\\+|\\w|/|@]+",I="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+A+").*?\\)";function W(_){return(_+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function j(_){return!isNaN(1*_)}function P(_,M,R){var k={};k[R]=[];var S=M.toString(),c=S.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!c)return k;for(var o=c[1],l=new RegExp("(\\\\n|\\W)"+W(o)+I,"g"),u;u=l.exec(S);){if(u[3]==="dll-reference")continue;k[R].push(u[3])}for(l=new RegExp("\\("+W(o)+'\\("(dll-reference\\s('+A+'))"\\)\\)'+I,"g");u=l.exec(S);)_[u[2]]||(k[R].push(u[1]),_[u[2]]=L(u[1]).m),k[u[2]]=k[u[2]]||[],k[u[2]].push(u[4]);for(var T=Object.keys(k),m=0;m<T.length;m++)for(var p=0;p<k[T[m]].length;p++)j(k[T[m]][p])&&(k[T[m]][p]=1*k[T[m]][p]);return k}function D(_){var M=Object.keys(_);return M.reduce(function(R,k){return R||_[k].length>0},!1)}function E(_,M){for(var R={main:[M]},k={main:[]},S={main:{}};D(R);)for(var c=Object.keys(R),o=0;o<c.length;o++){var l=c[o],u=R[l],T=u.pop();if(S[l]=S[l]||{},S[l][T]||!_[l][T])continue;S[l][T]=!0,k[l]=k[l]||[],k[l].push(T);for(var m=P(_,_[l][T],l),p=Object.keys(m),w=0;w<p.length;w++)R[p[w]]=R[p[w]]||[],R[p[w]]=R[p[w]].concat(m[p[w]])}return k}le.exports=function(_,M){M=M||{};var R={main:L.m},k=M.all?{main:Object.keys(R.main)}:E(R,_),S="";Object.keys(k).filter(function(T){return T!=="main"}).forEach(function(T){for(var m=0;k[T][m];)m++;k[T].push(m),R[T][m]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",S=S+"var "+T+" = ("+z.toString().replace("ENTRY_MODULE",JSON.stringify(m))+")({"+k[T].map(function(p){return""+JSON.stringify(p)+": "+R[T][p].toString()}).join(",")+`});
|
|
`}),S=S+"new (("+z.toString().replace("ENTRY_MODULE",JSON.stringify(_))+")({"+k.main.map(function(T){return""+JSON.stringify(T)+": "+R.main[T].toString()}).join(",")+"}))(self);";var c=new window.Blob([S],{type:"text/javascript"});if(M.bare)return c;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,l=o.createObjectURL(c),u=new window.Worker(l);return u.objectURL=l,u}},"./src/config.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"hlsDefaultConfig",function(){return w}),L.d(Y,"mergeConfig",function(){return g}),L.d(Y,"enableStreamingMode",function(){return f});var z=L("./src/controller/abr-controller.ts"),A=L("./src/controller/audio-stream-controller.ts"),I=L("./src/controller/audio-track-controller.ts"),W=L("./src/controller/subtitle-stream-controller.ts"),j=L("./src/controller/subtitle-track-controller.ts"),P=L("./src/controller/buffer-controller.ts"),D=L("./src/controller/timeline-controller.ts"),E=L("./src/controller/cap-level-controller.ts"),_=L("./src/controller/fps-controller.ts"),M=L("./src/controller/eme-controller.ts"),R=L("./src/controller/cmcd-controller.ts"),k=L("./src/utils/xhr-loader.ts"),S=L("./src/utils/fetch-loader.ts"),c=L("./src/utils/cues.ts"),o=L("./src/utils/mediakeys-helper.ts"),l=L("./src/utils/logger.ts");function u(){return u=Object.assign||function(d){for(var a=1;a<arguments.length;a++){var C=arguments[a];for(var v in C)Object.prototype.hasOwnProperty.call(C,v)&&(d[v]=C[v])}return d},u.apply(this,arguments)}function T(d,a){var C=Object.keys(d);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(d);a&&(v=v.filter(function(b){return Object.getOwnPropertyDescriptor(d,b).enumerable})),C.push.apply(C,v)}return C}function m(d){for(var a=1;a<arguments.length;a++){var C=arguments[a]!=null?arguments[a]:{};a%2?T(Object(C),!0).forEach(function(v){p(d,v,C[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(C)):T(Object(C)).forEach(function(v){Object.defineProperty(d,v,Object.getOwnPropertyDescriptor(C,v))})}return d}function p(d,a,C){return a in d?Object.defineProperty(d,a,{value:C,enumerable:!0,configurable:!0,writable:!0}):d[a]=C,d}var w=m(m({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:k.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:z.default,bufferController:P.default,capLevelController:E.default,fpsController:_.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},x()),{},{subtitleStreamController:W.SubtitleStreamController,subtitleTrackController:j.default,timelineController:D.TimelineController,audioStreamController:A.default,audioTrackController:I.default,emeController:M.default,cmcdController:R.default});function x(){return{cueHandler:c.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(d,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 u({},d,a)}function f(d){var a=d.loader;if(a!==S.default&&a!==k.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var C=Object(S.fetchSupported)();C&&(d.loader=S.default,d.progressive=!0,d.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(le,Y,L){"use strict";L.r(Y);var z=L("./src/polyfills/number.ts"),A=L("./src/utils/ewma-bandwidth-estimator.ts"),I=L("./src/events.ts"),W=L("./src/utils/buffer-helper.ts"),j=L("./src/errors.ts"),P=L("./src/types/loader.ts"),D=L("./src/utils/logger.ts");function E(R,k){for(var S=0;S<k.length;S++){var c=k[S];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(R,c.key,c)}}function _(R,k,S){return k&&E(R.prototype,k),S&&E(R,S),R}var M=function(){function R(S){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=S;var c=S.config;this.bwEstimator=new A.default(c.abrEwmaSlowVoD,c.abrEwmaFastVoD,c.abrEwmaDefaultEstimate),this.registerListeners()}var k=R.prototype;return k.registerListeners=function(){var c=this.hls;c.on(I.Events.FRAG_LOADING,this.onFragLoading,this),c.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),c.on(I.Events.FRAG_BUFFERED,this.onFragBuffered,this),c.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(I.Events.ERROR,this.onError,this)},k.unregisterListeners=function(){var c=this.hls;c.off(I.Events.FRAG_LOADING,this.onFragLoading,this),c.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),c.off(I.Events.FRAG_BUFFERED,this.onFragBuffered,this),c.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(I.Events.ERROR,this.onError,this)},k.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},k.onFragLoading=function(c,o){var l=o.frag;if(l.type===P.PlaylistLevelType.MAIN&&!this.timer){var u;this.fragCurrent=l,this.partCurrent=(u=o.part)!=null?u:null,this.timer=self.setInterval(this.onCheck,100)}},k.onLevelLoaded=function(c,o){var l=this.hls.config;o.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},k._abandonRulesCheck=function(){var c=this.fragCurrent,o=this.partCurrent,l=this.hls,u=l.autoLevelEnabled,T=l.config,m=l.media;if(!c||!m)return;var p=o?o.stats:c.stats,w=o?o.duration:c.duration;if(p.aborted){D.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!u||m.paused||!m.playbackRate||!m.readyState)return;var x=performance.now()-p.loading.start,g=Math.abs(m.playbackRate);if(x<=500*w/g)return;var f=l.levels,d=l.minAutoLevel,a=f[c.level],C=p.total||Math.max(p.loaded,Math.round(w*a.maxBitrate/8)),v=Math.max(1,p.bwEstimate?p.bwEstimate/8:p.loaded*1e3/x),b=(C-p.loaded)/v,y=m.currentTime,G=(W.BufferHelper.bufferInfo(m,y,T.maxBufferHole).end-y)/g;if(G>=2*w/g||b<=G)return;var $=Number.POSITIVE_INFINITY,Z;for(Z=c.level-1;Z>d;Z--){var V=f[Z].maxBitrate;if($=w*V/(8*.8*v),$<G)break}if($>=b)return;var H=this.bwEstimator.getEstimate();D.logger.warn("Fragment "+c.sn+(o?" part "+o.index:"")+" of level "+c.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+Z+`
|
|
Current BW estimate: `+(Object(z.isFiniteNumber)(H)?(H/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+b.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+$.toFixed(3)+` s
|
|
Time to underbuffer: `+G.toFixed(3)+" s"),l.nextLoadLevel=Z,this.bwEstimator.sample(x,p.loaded),this.clearTimer(),c.loader&&(this.fragCurrent=this.partCurrent=null,c.loader.abort()),l.trigger(I.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:c,part:o,stats:p})},k.onFragLoaded=function(c,o){var l=o.frag,u=o.part;if(l.type===P.PlaylistLevelType.MAIN&&Object(z.isFiniteNumber)(l.sn)){var T=u?u.stats:l.stats,m=u?u.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var p=this.hls.levels[l.level],w=(p.loaded?p.loaded.bytes:0)+T.loaded,x=(p.loaded?p.loaded.duration:0)+m;p.loaded={bytes:w,duration:x},p.realBitrate=Math.round(8*w/x)}if(l.bitrateTest){var g={stats:T,frag:l,part:u,id:l.type};this.onFragBuffered(I.Events.FRAG_BUFFERED,g),l.bitrateTest=!1}}},k.onFragBuffered=function(c,o){var l=o.frag,u=o.part,T=u?u.stats:l.stats;if(T.aborted)return;if(l.type!==P.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var m=T.parsing.end-T.loading.start;this.bwEstimator.sample(m,T.loaded),T.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=m/1e3:this.bitrateTestDelay=0},k.onError=function(c,o){switch(o.details){case j.ErrorDetails.FRAG_LOAD_ERROR:case j.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},k.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},k.getNextABRAutoLevel=function(){var c=this.fragCurrent,o=this.partCurrent,l=this.hls,u=l.maxAutoLevel,T=l.config,m=l.minAutoLevel,p=l.media,w=o?o.duration:c?c.duration:0,x=p?p.currentTime:0,g=p&&p.playbackRate!==0?Math.abs(p.playbackRate):1,f=this.bwEstimator?this.bwEstimator.getEstimate():T.abrEwmaDefaultEstimate,d=(W.BufferHelper.bufferInfo(p,x,T.maxBufferHole).end-x)/g,a=this.findBestLevel(f,m,u,d,T.abrBandWidthFactor,T.abrBandWidthUpFactor);if(a>=0)return a;D.logger.trace((d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var C=w?Math.min(w,T.maxStarvationDelay):T.maxStarvationDelay,v=T.abrBandWidthFactor,b=T.abrBandWidthUpFactor;if(!d){var y=this.bitrateTestDelay;if(y){var G=w?Math.min(w,T.maxLoadingDelay):T.maxLoadingDelay;C=G-y,D.logger.trace("bitrate test took "+Math.round(1e3*y)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*C)+" ms"),v=b=1}}return a=this.findBestLevel(f,m,u,d+C,v,b),Math.max(a,0)},k.findBestLevel=function(c,o,l,u,T,m){for(var p,w=this.fragCurrent,x=this.partCurrent,g=this.lastLoadedFragLevel,f=this.hls.levels,d=f[g],a=!!(d!=null&&(p=d.details)!==null&&p!==void 0&&p.live),C=d==null?void 0:d.codecSet,v=x?x.duration:w?w.duration:0,b=l;b>=o;b--){var y=f[b];if(!y||C&&y.codecSet!==C)continue;var G=y.details,$=(x?G==null?void 0:G.partTarget:G==null?void 0:G.averagetargetduration)||v,Z=void 0;b<=g?Z=T*c:Z=m*c;var V=f[b].maxBitrate,H=V*$/Z;if(D.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+b+"/"+Math.round(Z)+"/"+V+"/"+$+"/"+u+"/"+H),Z>V&&(!H||a&&!this.bitrateTestDelay||H<u))return b}return-1},_(R,[{key:"nextAutoLevel",get:function(){var c=this._nextAutoLevel,o=this.bwEstimator;if(c!==-1&&(!o||!o.canEstimate()))return c;var l=this.getNextABRAutoLevel();return c!==-1&&(l=Math.min(c,l)),l},set:function(c){this._nextAutoLevel=c}}]),R}();Y.default=M},"./src/controller/audio-stream-controller.ts":function(le,Y,L){"use strict";L.r(Y);var z=L("./src/polyfills/number.ts"),A=L("./src/controller/base-stream-controller.ts"),I=L("./src/events.ts"),W=L("./src/utils/buffer-helper.ts"),j=L("./src/controller/fragment-tracker.ts"),P=L("./src/types/level.ts"),D=L("./src/types/loader.ts"),E=L("./src/loader/fragment.ts"),_=L("./src/demux/chunk-cache.ts"),M=L("./src/demux/transmuxer-interface.ts"),R=L("./src/types/transmuxer.ts"),k=L("./src/controller/fragment-finders.ts"),S=L("./src/utils/discontinuities.ts"),c=L("./src/errors.ts"),o=L("./src/utils/logger.ts");function l(){return l=Object.assign||function(w){for(var x=1;x<arguments.length;x++){var g=arguments[x];for(var f in g)Object.prototype.hasOwnProperty.call(g,f)&&(w[f]=g[f])}return w},l.apply(this,arguments)}function u(w,x){w.prototype=Object.create(x.prototype),w.prototype.constructor=w,T(w,x)}function T(w,x){return T=Object.setPrototypeOf||function(f,d){return f.__proto__=d,f},T(w,x)}var m=100,p=function(w){u(x,w);function x(f,d){var a;return a=w.call(this,f,d,"[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=x.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var d=this.hls;d.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(I.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.on(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(I.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(I.Events.ERROR,this.onError,this),d.on(I.Events.BUFFER_RESET,this.onBufferReset,this),d.on(I.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g._unregisterListeners=function(){var d=this.hls;d.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(I.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.off(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(I.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(I.Events.ERROR,this.onError,this),d.off(I.Events.BUFFER_RESET,this.onBufferReset,this),d.off(I.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g.onInitPtsFound=function(d,a){var C=a.frag,v=a.id,b=a.initPTS;if(v==="main"){var y=C.cc;this.initPTS[C.cc]=b,this.log("InitPTS for cc: "+y+" found from main: "+b),this.videoTrackCC=y,this.state===A.State.WAITING_INIT_PTS&&this.tick()}},g.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=A.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(m),this.fragLoadError=0,a>0&&d===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=A.State.IDLE):(this.loadedmetadata=!1,this.state=A.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()},g.doTick=function(){switch(this.state){case A.State.IDLE:this.doTickIdle();break;case A.State.WAITING_TRACK:{var d,a=this.levels,C=this.trackId,v=a==null||((d=a[C])===null||d===void 0)?void 0:d.details;if(v){if(this.waitForCdnTuneIn(v))break;this.state=A.State.WAITING_INIT_PTS}break}case A.State.FRAG_LOADING_WAITING_RETRY:{var b,y=performance.now(),G=this.retryDate;(!G||y>=G||(b=this.media)!==null&&b!==void 0&&b.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=A.State.IDLE);break}case A.State.WAITING_INIT_PTS:{var $=this.waitingData;if($){var Z=$.frag,V=$.part,H=$.cache,re=$.complete;if(this.initPTS[Z.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=A.State.FRAG_LOADING;var ce=H.flush(),Ee={frag:Z,part:V,payload:ce,networkDetails:null};this._handleFragmentLoadProgress(Ee),re&&w.prototype._handleFragmentLoadComplete.call(this,Ee)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+Z.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var we=this.getLoadPosition(),Ye=W.BufferHelper.bufferInfo(this.mediaBuffer,we,this.config.maxBufferHole),Ne=Object(k.fragmentWithinToleranceTest)(Ye.end,this.config.maxFragLookUpTolerance,Z);Ne<0&&(o.logger.log("Waiting fragment cc ("+Z.cc+") @ "+Z.start+" cancelled because another fragment at "+Ye.end+" is needed"),this.clearWaitingFragment())}}else this.state=A.State.IDLE}}this.onTickEnd()},g.clearWaitingFragment=function(){var d=this.waitingData;d&&(this.fragmentTracker.removeFragment(d.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=A.State.IDLE)},g.onTickEnd=function(){var d=this.media;if(!d||!d.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:d,C=a.buffered;!this.loadedmetadata&&C.length&&(this.loadedmetadata=!0),this.lastCurrentTime=d.currentTime},g.doTickIdle=function(){var d,a,C=this.hls,v=this.levels,b=this.media,y=this.trackId,G=C.config;if(!v||!v[y])return;if(!b&&(this.startFragRequested||!G.startFragPrefetch))return;var $=v[y],Z=$.details;if(!Z||Z.live&&this.levelLastLoaded!==y||this.waitForCdnTuneIn(Z)){this.state=A.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,E.ElementaryStreamTypes.AUDIO,D.PlaylistLevelType.AUDIO));var V=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,D.PlaylistLevelType.AUDIO);if(V===null)return;var H=V.len,re=this.getMaxBufferLength(),ce=this.audioSwitch;if(H>=re&&!ce)return;if(!ce&&this._streamEnded(V,Z)){C.trigger(I.Events.BUFFER_EOS,{type:"audio"}),this.state=A.State.ENDED;return}var Ee=Z.fragments,we=Ee[0].start,Ye=V.end;if(ce){var Ne=this.getLoadPosition();Ye=Ne,Z.PTSKnown&&Ne<we&&((V.end>we||V.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),b.currentTime=we+.05))}var Ie=this.getNextFragment(Ye,Z);if(!Ie){this.bufferFlushed=!0;return}((d=Ie.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((a=Ie.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Ie,Z):this.loadFragment(Ie,Z,Ye)},g.getMaxBufferLength=function(){var d=w.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,D.PlaylistLevelType.MAIN);return a===null?d:Math.max(d,a.len)},g.onMediaDetaching=function(){this.videoBuffer=null,w.prototype.onMediaDetaching.call(this)},g.onAudioTracksUpdated=function(d,a){var C=a.audioTracks;this.resetTransmuxer(),this.levels=C.map(function(v){return new P.Level(v)})},g.onAudioTrackSwitching=function(d,a){var C=!!a.url;this.trackId=a.id;var v=this.fragCurrent;v!=null&&v.loader&&v.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),C?this.setInterval(m):this.resetTransmuxer(),C?(this.audioSwitch=!0,this.state=A.State.IDLE):this.state=A.State.STOPPED,this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},g.onLevelLoaded=function(d,a){this.mainDetails=a.details},g.onAudioTrackLoaded=function(d,a){var C,v=this.levels,b=a.details,y=a.id;if(!v){this.warn("Audio tracks were reset while loading level "+y);return}this.log("Track "+y+" loaded ["+b.startSN+","+b.endSN+"],duration:"+b.totalduration);var G=v[y],$=0;if(b.live||(C=G.details)!==null&&C!==void 0&&C.live){var Z=this.mainDetails;if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed||!Z)return;!G.details&&b.hasProgramDateTime&&Z.hasProgramDateTime?(Object(S.alignMediaPlaylistByPDT)(b,Z),$=b.fragments[0].start):$=this.alignPlaylists(b,G.details)}G.details=b,this.levelLastLoaded=y,!this.startFragRequested&&(this.mainDetails||!b.live)&&this.setStartPosition(G.details,$),this.state===A.State.WAITING_TRACK&&!this.waitForCdnTuneIn(b)&&(this.state=A.State.IDLE),this.tick()},g._handleFragmentLoadProgress=function(d){var a,C=d.frag,v=d.part,b=d.payload,y=this.config,G=this.trackId,$=this.levels;if(!$){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+C.sn+" of level "+C.level+" will not be buffered");return}var Z=$[G];console.assert(Z,"Audio track is defined on fragment load progress");var V=Z.details;console.assert(V,"Audio track details are defined on fragment load progress");var H=y.defaultAudioCodec||Z.audioCodec||"mp4a.40.2",re=this.transmuxer;re||(re=this.transmuxer=new M.default(this.hls,D.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ce=this.initPTS[C.cc],Ee=(a=C.initSegment)===null||a===void 0?void 0:a.data;if(ce!==void 0){var we=!1,Ye=v?v.index:-1,Ne=Ye!==-1,Ie=new R.ChunkMetadata(C.level,C.sn,C.stats.chunkCount,b.byteLength,Ye,Ne);re.push(b,Ee,H,"",C,v,V.totalduration,we,Ie,ce)}else{o.logger.log("Unknown video PTS for cc "+C.cc+", waiting for video PTS before demuxing audio frag "+C.sn+" of ["+V.startSN+" ,"+V.endSN+"],track "+G);var We=this.waitingData=this.waitingData||{frag:C,part:v,cache:new _.default,complete:!1},Ue=We.cache;Ue.push(new Uint8Array(b)),this.waitingVideoCC=this.videoTrackCC,this.state=A.State.WAITING_INIT_PTS}},g._handleFragmentLoadComplete=function(d){if(this.waitingData){this.waitingData.complete=!0;return}w.prototype._handleFragmentLoadComplete.call(this,d)},g.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},g.onBufferCreated=function(d,a){var C=a.tracks.audio;C&&(this.mediaBuffer=C.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},g.onFragBuffered=function(d,a){var C=a.frag,v=a.part;if(C.type!==D.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(C)){this.warn("Fragment "+C.sn+(v?" p: "+v.index:"")+" of level "+C.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}C.sn!=="initSegment"&&(this.fragPrevious=C,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(I.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(C,v)},g.onError=function(d,a){switch(a.details){case c.ErrorDetails.FRAG_LOAD_ERROR:case c.ErrorDetails.FRAG_LOAD_TIMEOUT:case c.ErrorDetails.KEY_LOAD_ERROR:case c.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.AUDIO,a);break;case c.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case c.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==A.State.ERROR&&this.state!==A.State.STOPPED&&(this.state=a.fatal?A.State.ERROR:A.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case c.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===A.State.PARSING||this.state===A.State.PARSED)){var C=!0,v=this.getFwdBufferInfo(this.mediaBuffer,D.PlaylistLevelType.AUDIO);v&&v.len>.5&&(C=!this.reduceMaxBufferLength(v.len)),C&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,w.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},g.onBufferFlushed=function(d,a){var C=a.type;C===E.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},g._handleTransmuxComplete=function(d){var a,C="audio",v=this.hls,b=d.remuxResult,y=d.chunkMeta,G=this.getCurrentContext(y);if(!G){this.warn("The loading context changed while buffering fragment "+y.sn+" of level "+y.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(y.level);return}var $=G.frag,Z=G.part,V=b.audio,H=b.text,re=b.id3,ce=b.initSegment;if(this.fragContextChanged($))return;if(this.state=A.State.PARSING,this.audioSwitch&&V&&this.completeAudioSwitch(),ce!=null&&ce.tracks&&(this._bufferInitSegment(ce.tracks,$,y),v.trigger(I.Events.FRAG_PARSING_INIT_SEGMENT,{frag:$,id:C,tracks:ce.tracks})),V){var Ee=V.startPTS,we=V.endPTS,Ye=V.startDTS,Ne=V.endDTS;Z&&(Z.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:Ee,endPTS:we,startDTS:Ye,endDTS:Ne}),$.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,Ee,we,Ye,Ne),this.bufferFragmentData(V,$,Z,y)}if(re!=null&&(a=re.samples)!==null&&a!==void 0&&a.length){var Ie=l({frag:$,id:C},re);v.trigger(I.Events.FRAG_PARSING_METADATA,Ie)}if(H){var We=l({frag:$,id:C},H);v.trigger(I.Events.FRAG_PARSING_USERDATA,We)}},g._bufferInitSegment=function(d,a,C){if(this.state!==A.State.PARSING)return;d.video&&delete d.video;var v=d.audio;if(!v)return;v.levelCodec=v.codec,v.id="audio",this.log("Init audio buffer, container:"+v.container+", codecs[parsed]=["+v.codec+"]"),this.hls.trigger(I.Events.BUFFER_CODECS,d);var b=v.initSegment;if(b!=null&&b.byteLength){var y={type:"audio",frag:a,part:null,chunkMeta:C,parent:a.type,data:b};this.hls.trigger(I.Events.BUFFER_APPENDING,y)}this.tick()},g.loadFragment=function(d,a,C){var v=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||v===j.FragmentState.NOT_LOADED||v===j.FragmentState.PARTIAL)&&(d.sn==="initSegment"?this._loadInitSegment(d):a.live&&!Object(z.isFiniteNumber)(this.initPTS[d.cc])?(this.log("Waiting for video PTS in continuity counter "+d.cc+" of live stream before loading audio fragment "+d.sn+" of level "+this.trackId),this.state=A.State.WAITING_INIT_PTS):(this.startFragRequested=!0,w.prototype.loadFragment.call(this,d,a,C)))},g.completeAudioSwitch=function(){var d=this.hls,a=this.media,C=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),w.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,d.trigger(I.Events.AUDIO_TRACK_SWITCHED,{id:C})},x}(A.default);Y.default=p},"./src/controller/audio-track-controller.ts":function(le,Y,L){"use strict";L.r(Y);var z=L("./src/events.ts"),A=L("./src/errors.ts"),I=L("./src/controller/base-playlist-controller.ts"),W=L("./src/types/loader.ts");function j(M,R){for(var k=0;k<R.length;k++){var S=R[k];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(M,S.key,S)}}function P(M,R,k){return R&&j(M.prototype,R),k&&j(M,k),M}function D(M,R){M.prototype=Object.create(R.prototype),M.prototype.constructor=M,E(M,R)}function E(M,R){return E=Object.setPrototypeOf||function(S,c){return S.__proto__=c,S},E(M,R)}var _=function(M){D(R,M);function R(S){var c;return c=M.call(this,S,"[audio-track-controller]")||this,c.tracks=[],c.groupId=null,c.tracksInGroup=[],c.trackId=-1,c.trackName="",c.selectDefaultTrack=!0,c.registerListeners(),c}var k=R.prototype;return k.registerListeners=function(){var c=this.hls;c.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),c.on(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.on(z.Events.ERROR,this.onError,this)},k.unregisterListeners=function(){var c=this.hls;c.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),c.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),c.off(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.off(z.Events.ERROR,this.onError,this)},k.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,M.prototype.destroy.call(this)},k.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},k.onManifestParsed=function(c,o){this.tracks=o.audioTracks||[]},k.onAudioTrackLoaded=function(c,o){var l=o.id,u=o.details,T=this.tracksInGroup[l];if(!T){this.warn("Invalid audio track id "+l);return}var m=T.details;T.details=o.details,this.log("audioTrack "+l+" loaded ["+u.startSN+"-"+u.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,o,m))},k.onLevelLoading=function(c,o){this.switchLevel(o.level)},k.onLevelSwitching=function(c,o){this.switchLevel(o.level)},k.switchLevel=function(c){var o=this.hls.levels[c];if(!(o!=null&&o.audioGroupIds))return;var l=o.audioGroupIds[o.urlId];if(this.groupId!==l){this.groupId=l;var u=this.tracks.filter(function(m){return!l||m.groupId===l});this.selectDefaultTrack&&!u.some(function(m){return m.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var T={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(z.Events.AUDIO_TRACKS_UPDATED,T),this.selectInitialTrack()}},k.onError=function(c,o){if(M.prototype.onError.call(this,c,o),o.fatal||!o.context)return;o.context.type===W.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},k.setAudioTrack=function(c){var o=this.tracksInGroup;if(c<0||c>=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 "+c);var u=o[c],T=u.id,m=u.groupId,p=m===void 0?"":m,w=u.name,x=u.type,g=u.url;if(this.trackId=c,this.trackName=w,this.selectDefaultTrack=!1,this.hls.trigger(z.Events.AUDIO_TRACK_SWITCHING,{id:T,groupId:p,name:w,type:x,url:g}),u.details&&!u.details.live)return;var f=this.switchParams(u.url,l==null?void 0:l.details);this.loadPlaylist(f)},k.selectInitialTrack=function(){var c=this.tracksInGroup;console.assert(c.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(z.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},k.findTrackId=function(c){for(var o=this.tracksInGroup,l=0;l<o.length;l++){var u=o[l];if((!this.selectDefaultTrack||u.default)&&(!c||c===u.name))return u.id}return-1},k.loadPlaylist=function(c){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var l=o.id,u=o.groupId,T=o.url;if(c)try{T=c.addDirectives(T)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(z.Events.AUDIO_TRACK_LOADING,{url:T,id:l,groupId:u,deliveryDirectives:c||null})}},P(R,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(c){this.selectDefaultTrack=!1,this.setAudioTrack(c)}}]),R}(I.default);Y.default=_},"./src/controller/base-playlist-controller.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return P});var z=L("./src/polyfills/number.ts"),A=L("./src/types/level.ts"),I=L("./src/controller/level-helper.ts"),W=L("./src/utils/logger.ts"),j=L("./src/errors.ts"),P=function(){function D(_,M){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=W.logger.log.bind(W.logger,M+":"),this.warn=W.logger.warn.bind(W.logger,M+":"),this.hls=_}var E=D.prototype;return E.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},E.onError=function(M,R){R.fatal&&R.type===j.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},E.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},E.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},E.stopLoad=function(){this.canLoad=!1,this.clearTimer()},E.switchParams=function(M,R){var k=R==null?void 0:R.renditionReports;if(k)for(var S=0;S<k.length;S++){var c=k[S],o=""+c.URI;if(o===M.substr(-o.length)){var l=parseInt(c["LAST-MSN"]),u=parseInt(c["LAST-PART"]);if(R&&this.hls.config.lowLatencyMode){var T=Math.min(R.age-R.partTarget,R.targetduration);u!==void 0&&T>R.partTarget&&(u+=1)}if(Object(z.isFiniteNumber)(l))return new A.HlsUrlParameters(l,Object(z.isFiniteNumber)(u)?u:void 0,A.HlsSkip.No)}}},E.loadPlaylist=function(M){},E.shouldLoadTrack=function(M){return this.canLoad&&M&&!!M.url&&(!M.details||M.details.live)},E.playlistLoaded=function(M,R,k){var S=this,c=R.details,o=R.stats,l=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(c.advancedDateTime=Date.now()-l,c.live||k!=null&&k.live){if(c.reloaded(k),k&&this.log("live playlist "+M+" "+(c.advanced?"REFRESHED "+c.lastPartSn+"-"+c.lastPartIndex:"MISSED")),k&&c.fragments.length>0&&Object(I.mergeDetails)(k,c),!this.canLoad||!c.live)return;var u,T=void 0,m=void 0;if(c.canBlockReload&&c.endSN&&c.advanced){var p=this.hls.config.lowLatencyMode,w=c.lastPartSn,x=c.endSN,g=c.lastPartIndex,f=g!==-1,d=w===x,a=p?0:g;f?(T=d?x+1:w,m=d?a:g+1):T=x+1;var C=c.age,v=C+c.ageHeader,b=Math.min(v-c.partTarget,c.targetduration*1.5);if(b>0){if(k&&b>k.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+k.tuneInGoal+" to: "+b+" with playlist age: "+c.age),b=0;else{var y=Math.floor(b/c.targetduration);if(T+=y,m!==void 0){var G=Math.round(b%c.targetduration/c.partTarget);m+=G}this.log("CDN Tune-in age: "+c.ageHeader+"s last advanced "+C.toFixed(2)+"s goal: "+b+" skip sn "+y+" to part "+m)}c.tuneInGoal=b}if(u=this.getDeliveryDirectives(c,R.deliveryDirectives,T,m),p||!d){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(c,R.deliveryDirectives,T,m);var $=Object(I.computeReloadInterval)(c,o);T!==void 0&&c.canBlockReload&&($-=c.partTarget||1),this.log("reload live playlist "+M+" in "+Math.round($)+" ms"),this.timer=self.setTimeout(function(){return S.loadPlaylist(u)},$)}else this.clearTimer()},E.getDeliveryDirectives=function(M,R,k,S){var c=Object(A.getSkipValue)(M,k);return R!=null&&R.skip&&M.deltaUpdateFailed&&(k=R.msn,S=R.part,c=A.HlsSkip.No),new A.HlsUrlParameters(k,S,c)},E.retryLoadingOrFail=function(M){var R=this,k=this.hls.config,S=this.retryCount<k.levelLoadingMaxRetry;if(S){var c;if(this.retryCount++,M.details.indexOf("LoadTimeOut")>-1&&(c=M.context)!==null&&c!==void 0&&c.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+M.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*k.levelLoadingRetryDelay,k.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return R.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+M.details+'"')}}else this.warn('cannot recover from error "'+M.details+'"'),this.clearTimer(),M.fatal=!0;return S},D}()},"./src/controller/base-stream-controller.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"State",function(){return x}),L.d(Y,"default",function(){return g});var z=L("./src/polyfills/number.ts"),A=L("./src/task-loop.ts"),I=L("./src/controller/fragment-tracker.ts"),W=L("./src/utils/buffer-helper.ts"),j=L("./src/utils/logger.ts"),P=L("./src/events.ts"),D=L("./src/errors.ts"),E=L("./src/types/transmuxer.ts"),_=L("./src/utils/mp4-tools.ts"),M=L("./src/utils/discontinuities.ts"),R=L("./src/controller/fragment-finders.ts"),k=L("./src/controller/level-helper.ts"),S=L("./src/loader/fragment-loader.ts"),c=L("./src/crypt/decrypter.ts"),o=L("./src/utils/time-ranges.ts"),l=L("./src/types/loader.ts");function u(f,d){for(var a=0;a<d.length;a++){var C=d[a];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(f,C.key,C)}}function T(f,d,a){return d&&u(f.prototype,d),a&&u(f,a),f}function m(f){if(f===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f}function p(f,d){f.prototype=Object.create(d.prototype),f.prototype.constructor=f,w(f,d)}function w(f,d){return w=Object.setPrototypeOf||function(C,v){return C.__proto__=v,C},w(f,d)}var x={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(f){p(d,f);function d(C,v,b){var y;return y=f.call(this)||this,y.hls=void 0,y.fragPrevious=null,y.fragCurrent=null,y.fragmentTracker=void 0,y.transmuxer=null,y._state=x.STOPPED,y.media=void 0,y.mediaBuffer=void 0,y.config=void 0,y.bitrateTest=!1,y.lastCurrentTime=0,y.nextLoadPosition=0,y.startPosition=0,y.loadedmetadata=!1,y.fragLoadError=0,y.retryDate=0,y.levels=null,y.fragmentLoader=void 0,y.levelLastLoaded=null,y.startFragRequested=!1,y.decrypter=void 0,y.initPTS=[],y.onvseeking=null,y.onvended=null,y.logPrefix="",y.log=void 0,y.warn=void 0,y.logPrefix=b,y.log=j.logger.log.bind(j.logger,b+":"),y.warn=j.logger.warn.bind(j.logger,b+":"),y.hls=C,y.fragmentLoader=new S.default(C.config),y.fragmentTracker=v,y.config=C.config,y.decrypter=new c.default(C,C.config),C.on(P.Events.KEY_LOADED,y.onKeyLoaded,m(y)),y}var a=d.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(v){},a.stopLoad=function(){this.fragmentLoader.abort();var v=this.fragCurrent;v&&this.fragmentTracker.removeFragment(v),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=x.STOPPED},a._streamEnded=function(v,b){var y=this.fragCurrent,G=this.fragmentTracker;if(!b.live&&y&&y.sn===b.endSN&&!v.nextStart){var $=G.getState(y);return $===I.FragmentState.PARTIAL||$===I.FragmentState.OK}return!1},a.onMediaAttached=function(v,b){var y=this.media=this.mediaBuffer=b.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),y.addEventListener("seeking",this.onvseeking),y.addEventListener("ended",this.onvended);var G=this.config;this.levels&&G.autoStartLoad&&this.state===x.STOPPED&&this.startLoad(G.startPosition)},a.onMediaDetaching=function(){var v=this.media;v!=null&&v.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),v&&(v.removeEventListener("seeking",this.onvseeking),v.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var v=this.config,b=this.fragCurrent,y=this.media,G=this.mediaBuffer,$=this.state,Z=y?y.currentTime:0,V=W.BufferHelper.bufferInfo(G||y,Z,v.maxBufferHole);if(this.log("media seeking to "+(Object(z.isFiniteNumber)(Z)?Z.toFixed(3):Z)+", state: "+$),$===x.ENDED)this.resetLoadingState();else if(b&&!V.len){var H=v.maxFragLookUpTolerance,re=b.start-H,ce=b.start+b.duration+H,Ee=Z>ce;(Z<re||Ee)&&(Ee&&b.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),b.loader.abort()),this.resetLoadingState())}y&&(this.lastCurrentTime=Z),!this.loadedmetadata&&!V.len&&(this.nextLoadPosition=this.startPosition=Z),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(v,b){if(this.state!==x.KEY_LOADING||b.frag!==this.fragCurrent||!this.levels)return;this.state=x.IDLE;var y=this.levels[b.frag.level].details;y&&this.loadFragment(b.frag,y,b.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),f.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=x.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,f.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(v,b){this.log("Loading key for "+v.sn+" of ["+b.startSN+"-"+b.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level),this.state=x.KEY_LOADING,this.fragCurrent=v,this.hls.trigger(P.Events.KEY_LOADING,{frag:v})},a.loadFragment=function(v,b,y){this._loadFragForPlayback(v,b,y)},a._loadFragForPlayback=function(v,b,y){var G=this,$=function(V){if(G.fragContextChanged(v)){G.warn("Fragment "+v.sn+(V.part?" p: "+V.part.index:"")+" of level "+v.level+" was dropped during download."),G.fragmentTracker.removeFragment(v);return}v.stats.chunkCount++,G._handleFragmentLoadProgress(V)};this._doFragLoad(v,b,y,$).then(function(Z){if(!Z)return;G.fragLoadError=0;var V=G.state;if(G.fragContextChanged(v)){(V===x.FRAG_LOADING||V===x.BACKTRACKING||!G.fragCurrent&&V===x.PARSING)&&(G.fragmentTracker.removeFragment(v),G.state=x.IDLE);return}if("payload"in Z&&(G.log("Loaded fragment "+v.sn+" of level "+v.level),G.hls.trigger(P.Events.FRAG_LOADED,Z),G.state===x.BACKTRACKING)){G.fragmentTracker.backtrack(v,Z),G.resetFragmentLoading(v);return}G._handleFragmentLoadComplete(Z)}).catch(function(Z){G.warn(Z),G.resetFragmentLoading(v)})},a.flushMainBuffer=function(v,b,y){if(y===void 0&&(y=null),!(v-b))return;var G={startOffset:v,endOffset:b,type:y};this.fragLoadError=0,this.hls.trigger(P.Events.BUFFER_FLUSHING,G)},a._loadInitSegment=function(v){var b=this;this._doFragLoad(v).then(function(y){if(!y||b.fragContextChanged(v)||!b.levels)throw new Error("init load aborted");return y}).then(function(y){var G=b.hls,$=y.payload,Z=v.decryptdata;if($&&$.byteLength>0&&Z&&Z.key&&Z.iv&&Z.method==="AES-128"){var V=self.performance.now();return b.decrypter.webCryptoDecrypt(new Uint8Array($),Z.key.buffer,Z.iv.buffer).then(function(H){var re=self.performance.now();return G.trigger(P.Events.FRAG_DECRYPTED,{frag:v,payload:H,stats:{tstart:V,tdecrypt:re}}),y.payload=H,y})}return y}).then(function(y){var G=b.fragCurrent,$=b.hls,Z=b.levels;if(!Z)throw new Error("init load aborted, missing levels");var V=Z[v.level].details;console.assert(V,"Level details are defined when init segment is loaded");var H=v.stats;b.state=x.IDLE,b.fragLoadError=0,v.data=new Uint8Array(y.payload),H.parsing.start=H.buffering.start=self.performance.now(),H.parsing.end=H.buffering.end=self.performance.now(),y.frag===G&&$.trigger(P.Events.FRAG_BUFFERED,{stats:H,frag:G,part:null,id:v.type}),b.tick()}).catch(function(y){b.warn(y),b.resetFragmentLoading(v)})},a.fragContextChanged=function(v){var b=this.fragCurrent;return!v||!b||v.level!==b.level||v.sn!==b.sn||v.urlId!==b.urlId},a.fragBufferedComplete=function(v,b){var y=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+v.type+" sn: "+v.sn+(b?" part: "+b.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level+" "+o.default.toString(W.BufferHelper.getBuffered(y))),this.state=x.IDLE,this.tick()},a._handleFragmentLoadComplete=function(v){var b=this.transmuxer;if(!b)return;var y=v.frag,G=v.part,$=v.partsLoaded,Z=!$||$.length===0||$.some(function(H){return!H}),V=new E.ChunkMetadata(y.level,y.sn,y.stats.chunkCount+1,0,G?G.index:-1,!Z);b.flush(V)},a._handleFragmentLoadProgress=function(v){},a._doFragLoad=function(v,b,y,G){var $=this;if(y===void 0&&(y=null),!this.levels)throw new Error("frag load aborted, missing levels");if(y=Math.max(v.start,y||0),this.config.lowLatencyMode&&b){var Z=b.partList;if(Z&&G){y>v.end&&b.fragmentHint&&(v=b.fragmentHint);var V=this.getNextPart(Z,v,y);if(V>-1){var H=Z[V];return this.log("Loading part sn: "+v.sn+" p: "+H.index+" cc: "+v.cc+" of playlist ["+b.startSN+"-"+b.endSN+"] parts [0-"+V+"-"+(Z.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(y.toFixed(3))),this.nextLoadPosition=H.start+H.duration,this.state=x.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:v,part:Z[V],targetBufferTime:y}),this.doFragPartsLoad(v,Z,V,G).catch(function(re){return $.handleFragLoadError(re)})}else if(!v.url||this.loadedEndOfParts(Z,y))return Promise.resolve(null)}}return this.log("Loading fragment "+v.sn+" cc: "+v.cc+" "+(b?"of ["+b.startSN+"-"+b.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(y.toFixed(3))),Object(z.isFiniteNumber)(v.sn)&&!this.bitrateTest&&(this.nextLoadPosition=v.start+v.duration),this.state=x.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:v,targetBufferTime:y}),this.fragmentLoader.load(v,G).catch(function(re){return $.handleFragLoadError(re)})},a.doFragPartsLoad=function(v,b,y,G){var $=this;return new Promise(function(Z,V){var H=[],re=function ce(Ee){var we=b[Ee];$.fragmentLoader.loadPart(v,we,G).then(function(Ye){H[we.index]=Ye;var Ne=Ye.part;$.hls.trigger(P.Events.FRAG_LOADED,Ye);var Ie=b[Ee+1];if(Ie&&Ie.fragment===v)ce(Ee+1);else return Z({frag:v,part:Ne,partsLoaded:H})}).catch(V)};re(y)})},a.handleFragLoadError=function(v){var b=v.data;return b&&b.details===D.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(b.frag,b.part):this.hls.trigger(P.Events.ERROR,b),null},a._handleTransmuxerFlush=function(v){var b=this.getCurrentContext(v);if(!b||this.state!==x.PARSING){this.fragCurrent||(this.state=x.IDLE);return}var y=b.frag,G=b.part,$=b.level,Z=self.performance.now();y.stats.parsing.end=Z,G&&(G.stats.parsing.end=Z),this.updateLevelTiming(y,G,$,v.partial)},a.getCurrentContext=function(v){var b=this.levels,y=v.level,G=v.sn,$=v.part;if(!b||!b[y])return this.warn("Levels object was unset while buffering fragment "+G+" of level "+y+". The current chunk will not be buffered."),null;var Z=b[y],V=$>-1?Object(k.getPartWith)(Z,G,$):null,H=V?V.fragment:Object(k.getFragmentWithSN)(Z,G,this.fragCurrent);return H?{frag:H,part:V,level:Z}:null},a.bufferFragmentData=function(v,b,y,G){if(!v||this.state!==x.PARSING)return;var $=v.data1,Z=v.data2,V=$;if($&&Z&&(V=Object(_.appendUint8Array)($,Z)),!V||!V.length)return;var H={type:v.type,frag:b,part:y,chunkMeta:G,parent:b.type,data:V};this.hls.trigger(P.Events.BUFFER_APPENDING,H),v.dropped&&v.independent&&!y&&this.flushBufferGap(b)},a.flushBufferGap=function(v){var b=this.media;if(!b)return;if(!W.BufferHelper.isBuffered(b,b.currentTime)){this.flushMainBuffer(0,v.start);return}var y=b.currentTime,G=W.BufferHelper.bufferInfo(b,y,0),$=v.duration,Z=Math.min(this.config.maxFragLookUpTolerance*2,$*.25),V=Math.max(Math.min(v.start-Z,G.end-Z),y+Z);v.start-V>Z&&this.flushMainBuffer(V,v.start)},a.getFwdBufferInfo=function(v,b){var y=this.config,G=this.getLoadPosition();if(!Object(z.isFiniteNumber)(G))return null;var $=W.BufferHelper.bufferInfo(v,G,y.maxBufferHole);if($.len===0&&$.nextStart!==void 0){var Z=this.fragmentTracker.getBufferedFrag(G,b);if(Z&&$.nextStart<Z.end)return W.BufferHelper.bufferInfo(v,G,Math.max($.nextStart,y.maxBufferHole))}return $},a.getMaxBufferLength=function(v){var b=this.config,y;return v?y=Math.max(8*b.maxBufferSize/v,b.maxBufferLength):y=b.maxBufferLength,Math.min(y,b.maxMaxBufferLength)},a.reduceMaxBufferLength=function(v){var b=this.config,y=v||b.maxBufferLength;return b.maxMaxBufferLength>=y?(b.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+b.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(v,b){var y,G,$=b.fragments,Z=$.length;if(!Z)return null;var V=this.config,H=$[0].start,re;if(b.live){var ce=V.initialLiveManifestSize;if(Z<ce)return this.warn("Not enough fragments to start playback (have: "+Z+", need: "+ce+")"),null;!b.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(re=this.getInitialLiveFragment(b,$),this.startPosition=re?this.hls.liveSyncPosition||re.start:v)}else v<=H&&(re=$[0]);if(!re){var Ee=V.lowLatencyMode?b.partEnd:b.fragmentEnd;re=this.getFragmentAtPosition(v,Ee,b)}return(y=re)!==null&&y!==void 0&&y.initSegment&&!((G=re)!==null&&G!==void 0&&G.initSegment.data)&&!this.bitrateTest&&(re=re.initSegment),re},a.getNextPart=function(v,b,y){for(var G=-1,$=!1,Z=!0,V=0,H=v.length;V<H;V++){var re=v[V];if(Z=Z&&!re.independent,G>-1&&y<re.start)break;var ce=re.loaded;!ce&&($||re.independent||Z)&&re.fragment===b&&(G=V),$=ce}return G},a.loadedEndOfParts=function(v,b){var y=v[v.length-1];return y&&b>y.start&&y.loaded},a.getInitialLiveFragment=function(v,b){var y=this.fragPrevious,G=null;if(y){if(v.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+y.programDateTime),G=Object(R.findFragmentByPDT)(b,y.endProgramDateTime,this.config.maxFragLookUpTolerance)),!G){var $=y.sn+1;if($>=v.startSN&&$<=v.endSN){var Z=b[$-v.startSN];y.cc===Z.cc&&(G=Z,this.log("Live playlist, switching playlist, load frag with next SN: "+G.sn))}G||(G=Object(R.findFragWithCC)(b,y.cc),G&&this.log("Live playlist, switching playlist, load frag with same CC: "+G.sn))}}else{var V=this.hls.liveSyncPosition;V!==null&&(G=this.getFragmentAtPosition(V,this.bitrateTest?v.fragmentEnd:v.edge,v))}return G},a.getFragmentAtPosition=function(v,b,y){var G=this.config,$=this.fragPrevious,Z=y.fragments,V=y.endSN,H=y.fragmentHint,re=G.maxFragLookUpTolerance,ce=!!(G.lowLatencyMode&&y.partList&&H);ce&&H&&!this.bitrateTest&&(Z=Z.concat(H),V=H.sn);var Ee;if(v<b){var we=v>b-re?0:re;Ee=Object(R.findFragmentByPTS)($,Z,v,we)}else Ee=Z[Z.length-1];if(Ee){var Ye=Ee.sn-y.startSN,Ne=$&&Ee.level===$.level,Ie=Z[Ye+1],We=this.fragmentTracker.getState(Ee);if(We===I.FragmentState.BACKTRACKED){Ee=null;for(var Ue=Ye;Z[Ue]&&this.fragmentTracker.getState(Z[Ue])===I.FragmentState.BACKTRACKED;)$?Ee=Z[Ue--]:Ee=Z[--Ue];Ee||(Ee=Ie)}else $&&Ee.sn===$.sn&&!ce&&(Ne&&(Ee.sn<V&&this.fragmentTracker.getState(Ie)!==I.FragmentState.OK?(this.log("SN "+Ee.sn+" just loaded, load next one: "+Ie.sn),Ee=Ie):Ee=null))}return Ee},a.synchronizeToLiveEdge=function(v){var b=this.config,y=this.media;if(!y)return;var G=this.hls.liveSyncPosition,$=y.currentTime,Z=v.fragments[0].start,V=v.edge,H=$>=Z-b.maxFragLookUpTolerance&&$<=V;if(G!==null&&y.duration>G&&($<G||!H)){var re=b.liveMaxLatencyDuration!==void 0?b.liveMaxLatencyDuration:b.liveMaxLatencyDurationCount*v.targetduration;(!H&&y.readyState<4||$<V-re)&&(this.loadedmetadata||(this.nextLoadPosition=G),y.readyState&&(this.warn("Playback: "+$.toFixed(3)+" is located too far from the end of live sliding playlist: "+V+", reset currentTime to : "+G.toFixed(3)),y.currentTime=G))}},a.alignPlaylists=function(v,b){var y=this.levels,G=this.levelLastLoaded,$=this.fragPrevious,Z=G!==null?y[G]:null,V=v.fragments.length;if(!V)return this.warn("No fragments in live playlist"),0;var H=v.fragments[0].start,re=!b,ce=v.alignedSliding&&Object(z.isFiniteNumber)(H);if(re||!ce&&!H){Object(M.alignStream)($,Z,v);var Ee=v.fragments[0].start;return this.log("Live playlist sliding: "+Ee.toFixed(2)+" start-sn: "+(b?b.startSN:"na")+"->"+v.startSN+" prev-sn: "+($?$.sn:"na")+" fragments: "+V),Ee}return H},a.waitForCdnTuneIn=function(v){var b=3;return v.live&&v.canBlockReload&&v.tuneInGoal>Math.max(v.partHoldBack,v.partTarget*b)},a.setStartPosition=function(v,b){var y=this.startPosition;if(y<b&&(y=-1),y===-1||this.lastCurrentTime===-1){var G=v.startTimeOffset;Object(z.isFiniteNumber)(G)?(y=b+G,G<0&&(y+=v.totalduration),y=Math.min(Math.max(b,y),b+v.totalduration),this.log("Start time offset "+G+" found in playlist, adjust startPosition to "+y),this.startPosition=y):v.live?y=this.hls.liveSyncPosition||b:this.startPosition=y=0,this.lastCurrentTime=y}this.nextLoadPosition=y},a.getLoadPosition=function(){var v=this.media,b=0;return this.loadedmetadata&&v?b=v.currentTime:this.nextLoadPosition&&(b=this.nextLoadPosition),b},a.handleFragLoadAborted=function(v,b){this.transmuxer&&v.sn!=="initSegment"&&v.stats.aborted&&(this.warn("Fragment "+v.sn+(b?" part"+b.index:"")+" of level "+v.level+" was aborted"),this.resetFragmentLoading(v))},a.resetFragmentLoading=function(v){(!this.fragCurrent||!this.fragContextChanged(v))&&(this.state=x.IDLE)},a.onFragmentOrKeyLoadError=function(v,b){if(b.fatal)return;var y=b.frag;if(!y||y.type!==v)return;var G=this.fragCurrent;console.assert(G&&y.sn===G.sn&&y.level===G.level&&y.urlId===G.urlId,"Frag load error must match current frag to retry");var $=this.config;if(this.fragLoadError+1<=$.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(y.level))return;var Z=Math.min(Math.pow(2,this.fragLoadError)*$.fragLoadingRetryDelay,$.fragLoadingMaxRetryTimeout);this.warn("Fragment "+y.sn+" of "+v+" "+y.level+" failed to load, retrying in "+Z+"ms"),this.retryDate=self.performance.now()+Z,this.fragLoadError++,this.state=x.FRAG_LOADING_WAITING_RETRY}else b.levelRetry?(v===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=x.IDLE):(j.logger.error(b.details+" reaches max retry, redispatch as fatal ..."),b.fatal=!0,this.hls.stopLoad(),this.state=x.ERROR)},a.afterBufferFlushed=function(v,b,y){if(!v)return;var G=W.BufferHelper.getBuffered(v);this.fragmentTracker.detectEvictedFragments(b,G,y),this.state===x.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=x.IDLE},a.resetLiveStartWhenNotLoaded=function(v){if(!this.loadedmetadata){this.startFragRequested=!1;var b=this.levels?this.levels[v].details:null;if(b!=null&&b.live)return this.startPosition=-1,this.setStartPosition(b,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(v,b,y,G){var $=this,Z=y.details;console.assert(!!Z,"level.details must be defined");var V=Object.keys(v.elementaryStreams).reduce(function(H,re){var ce=v.elementaryStreams[re];if(ce){var Ee=ce.endPTS-ce.startPTS;if(Ee<=0)return $.warn("Could not parse fragment "+v.sn+" "+re+" duration reliably ("+Ee+") resetting transmuxer to fallback to playlist timing"),$.resetTransmuxer(),H||!1;var we=G?0:Object(k.updateFragPTSDTS)(Z,v,ce.startPTS,ce.endPTS,ce.startDTS,ce.endDTS);return $.hls.trigger(P.Events.LEVEL_PTS_UPDATED,{details:Z,level:y,drift:we,type:re,frag:v,start:ce.startPTS,end:ce.endPTS}),!0}return H},!1);V?(this.state=x.PARSED,this.hls.trigger(P.Events.FRAG_PARSED,{frag:v,part:b})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},T(d,[{key:"state",get:function(){return this._state},set:function(v){var b=this._state;b!==v&&(this._state=v,this.log(b+"->"+v))}}]),d}(A.default)},"./src/controller/buffer-controller.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return R});var z=L("./src/polyfills/number.ts"),A=L("./src/events.ts"),I=L("./src/utils/logger.ts"),W=L("./src/errors.ts"),j=L("./src/utils/buffer-helper.ts"),P=L("./src/utils/mediasource-helper.ts"),D=L("./src/loader/fragment.ts"),E=L("./src/controller/buffer-operation-queue.ts"),_=Object(P.getMediaSource)(),M=/([ha]vc.)(?:\.[^.,]+)+/,R=function(){function k(c){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var l=o.hls,u=o.media,T=o.mediaSource;I.logger.log("[buffer-controller]: Media source opened"),u&&(o.updateMediaElementDuration(),l.trigger(A.Events.MEDIA_ATTACHED,{media:u})),T&&T.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){I.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){I.logger.log("[buffer-controller]: Media source ended")},this.hls=c,this._initSourceBuffer(),this.registerListeners()}var S=k.prototype;return S.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},S.destroy=function(){this.unregisterListeners(),this.details=null},S.registerListeners=function(){var o=this.hls;o.on(A.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(A.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(A.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(A.Events.BUFFER_RESET,this.onBufferReset,this),o.on(A.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(A.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(A.Events.BUFFER_EOS,this.onBufferEos,this),o.on(A.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(A.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(A.Events.FRAG_PARSED,this.onFragParsed,this),o.on(A.Events.FRAG_CHANGED,this.onFragChanged,this)},S.unregisterListeners=function(){var o=this.hls;o.off(A.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(A.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(A.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(A.Events.BUFFER_RESET,this.onBufferReset,this),o.off(A.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(A.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(A.Events.BUFFER_EOS,this.onBufferEos,this),o.off(A.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(A.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(A.Events.FRAG_PARSED,this.onFragParsed,this),o.off(A.Events.FRAG_CHANGED,this.onFragChanged,this)},S._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new E.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},S.onManifestParsed=function(o,l){var u=2;(l.audio&&!l.video||!l.altAudio)&&(u=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=u,this.details=null,I.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},S.onMediaAttaching=function(o,l){var u=this.media=l.media;if(u&&_){var T=this.mediaSource=new _;T.addEventListener("sourceopen",this._onMediaSourceOpen),T.addEventListener("sourceended",this._onMediaSourceEnded),T.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(T),this._objectUrl=u.src}},S.onMediaDetaching=function(){var o=this.media,l=this.mediaSource,u=this._objectUrl;if(l){if(I.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(T){I.logger.warn("[buffer-controller]: onMediaDetaching: "+T.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(u&&self.URL.revokeObjectURL(u),o.src===u?(o.removeAttribute("src"),o.load()):I.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(A.Events.MEDIA_DETACHED,void 0)},S.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(l){var u=o.sourceBuffer[l];try{u&&(o.removeBufferListeners(l),o.mediaSource&&o.mediaSource.removeSourceBuffer(u),o.sourceBuffer[l]=void 0)}catch(T){I.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",T)}}),this._initSourceBuffer()},S.onBufferCodecs=function(o,l){var u=this,T=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(m){if(T){var p=u.tracks[m];if(p&&typeof p.buffer.changeType=="function"){var w=l[m],x=w.codec,g=w.levelCodec,f=w.container,d=(p.levelCodec||p.codec).replace(M,"$1"),a=(g||x).replace(M,"$1");if(d!==a){var C=f+";codecs="+(g||x);u.appendChangeType(m,C)}}}else u.pendingTracks[m]=l[m]}),T)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},S.appendChangeType=function(o,l){var u=this,T=this.operationQueue,m={execute:function(){var w=u.sourceBuffer[o];w&&(I.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+l),w.changeType(l)),T.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(w){I.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",w)}};T.append(m,o)},S.onBufferAppending=function(o,l){var u=this,T=this.hls,m=this.operationQueue,p=this.tracks,w=l.data,x=l.type,g=l.frag,f=l.part,d=l.chunkMeta,a=d.buffering[x],C=self.performance.now();a.start=C;var v=g.stats.buffering,b=f?f.stats.buffering:null;v.start===0&&(v.start=C),b&&b.start===0&&(b.start=C);var y=p.audio,G=x==="audio"&&d.id===1&&(y==null?void 0:y.container)==="audio/mpeg",$={execute:function(){if(a.executeStart=self.performance.now(),G){var V=u.sourceBuffer[x];if(V){var H=g.start-V.timestampOffset;Math.abs(H)>=.1&&(I.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+g.start+" (delta: "+H+") sn: "+g.sn+")"),V.timestampOffset=g.start)}}u.appendExecutor(w,x)},onStart:function(){},onComplete:function(){var V=self.performance.now();a.executeEnd=a.end=V,v.first===0&&(v.first=V),b&&b.first===0&&(b.first=V);var H=u.sourceBuffer,re={};for(var ce in H)re[ce]=j.BufferHelper.getBuffered(H[ce]);u.appendError=0,u.hls.trigger(A.Events.BUFFER_APPENDED,{type:x,frag:g,part:f,chunkMeta:d,parent:g.type,timeRanges:re})},onError:function(V){I.logger.error("[buffer-controller]: Error encountered while trying to append to the "+x+" SourceBuffer",V);var H={type:W.ErrorTypes.MEDIA_ERROR,parent:g.type,details:W.ErrorDetails.BUFFER_APPEND_ERROR,err:V,fatal:!1};V.code===DOMException.QUOTA_EXCEEDED_ERR?H.details=W.ErrorDetails.BUFFER_FULL_ERROR:(u.appendError++,H.details=W.ErrorDetails.BUFFER_APPEND_ERROR,u.appendError>T.config.appendErrorMaxRetry&&(I.logger.error("[buffer-controller]: Failed "+T.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),H.fatal=!0)),T.trigger(A.Events.ERROR,H)}};m.append($,x)},S.onBufferFlushing=function(o,l){var u=this,T=this.operationQueue,m=function(w){return{execute:u.removeExecutor.bind(u,w,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(A.Events.BUFFER_FLUSHED,{type:w})},onError:function(g){I.logger.warn("[buffer-controller]: Failed to remove from "+w+" SourceBuffer",g)}}};l.type?T.append(m(l.type),l.type):this.getSourceBufferTypes().forEach(function(p){T.append(m(p),p)})},S.onFragParsed=function(o,l){var u=this,T=l.frag,m=l.part,p=[],w=m?m.elementaryStreams:T.elementaryStreams;w[D.ElementaryStreamTypes.AUDIOVIDEO]?p.push("audiovideo"):(w[D.ElementaryStreamTypes.AUDIO]&&p.push("audio"),w[D.ElementaryStreamTypes.VIDEO]&&p.push("video"));var x=function(){var f=self.performance.now();T.stats.buffering.end=f,m&&(m.stats.buffering.end=f);var d=m?m.stats:T.stats;u.hls.trigger(A.Events.FRAG_BUFFERED,{frag:T,part:m,stats:d,id:T.type})};p.length===0&&I.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+T.type+" level: "+T.level+" sn: "+T.sn),this.blockBuffers(x,p)},S.onFragChanged=function(o,l){this.flushBackBuffer()},S.onBufferEos=function(o,l){var u=this,T=this.getSourceBufferTypes().reduce(function(m,p){var w=u.sourceBuffer[p];return(!l.type||l.type===p)&&(w&&!w.ended&&(w.ended=!0,I.logger.log("[buffer-controller]: "+p+" sourceBuffer now EOS"))),m&&!!(!w||w.ended)},!0);T&&this.blockBuffers(function(){var m=u.mediaSource;if(!m||m.readyState!=="open")return;m.endOfStream()})},S.onLevelUpdated=function(o,l){var u=l.details;if(!u.fragments.length)return;this.details=u,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},S.flushBackBuffer=function(){var o=this.hls,l=this.details,u=this.media,T=this.sourceBuffer;if(!u||l===null)return;var m=this.getSourceBufferTypes();if(!m.length)return;var p=l.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(z.isFiniteNumber)(p)||p<0)return;var w=u.currentTime,x=l.levelTargetDuration,g=Math.max(p,x),f=Math.floor(w/x)*x-g;m.forEach(function(d){var a=T[d];if(a){var C=j.BufferHelper.getBuffered(a);C.length>0&&f>C.start(0)&&(o.trigger(A.Events.BACK_BUFFER_REACHED,{bufferEnd:f}),l.live&&o.trigger(A.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:f}),o.trigger(A.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:f,type:d}))}})},S.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,l=this.hls,u=this.media,T=this.mediaSource,m=o.fragments[0].start+o.totalduration,p=u.duration,w=Object(z.isFiniteNumber)(T.duration)?T.duration:0;o.live&&l.config.liveDurationInfinity?(I.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),T.duration=Infinity,this.updateSeekableRange(o)):(m>w&&m>p||!Object(z.isFiniteNumber)(p))&&(I.logger.log("[buffer-controller]: Updating Media Source duration to "+m.toFixed(3)),T.duration=m)},S.updateSeekableRange=function(o){var l=this.mediaSource,u=o.fragments,T=u.length;if(T&&o.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var m=Math.max(0,u[0].start),p=Math.max(m,m+o.totalduration);l.setLiveSeekableRange(m,p)}},S.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,l=this.operationQueue,u=this.pendingTracks,T=Object.keys(u).length;if(T&&!o||T===2){this.createSourceBuffers(u),this.pendingTracks={};var m=this.getSourceBufferTypes();if(m.length===0){this.hls.trigger(A.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}m.forEach(function(p){l.executeNext(p)})}},S.createSourceBuffers=function(o){var l=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var T=0;for(var m in o)if(!l[m]){var p=o[m];if(!p)throw Error("source buffer exists for track "+m+", however track does not");var w=p.levelCodec||p.codec,x=p.container+";codecs="+w;I.logger.log("[buffer-controller]: creating sourceBuffer("+x+")");try{var g=l[m]=u.addSourceBuffer(x),f=m;this.addBufferListener(f,"updatestart",this._onSBUpdateStart),this.addBufferListener(f,"updateend",this._onSBUpdateEnd),this.addBufferListener(f,"error",this._onSBUpdateError),this.tracks[m]={buffer:g,codec:w,container:p.container,levelCodec:p.levelCodec,id:p.id},T++}catch(d){I.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+d.message),this.hls.trigger(A.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,mimeType:x})}}T&&this.hls.trigger(A.Events.BUFFER_CREATED,{tracks:this.tracks})},S._onSBUpdateStart=function(o){var l=this.operationQueue,u=l.current(o);u.onStart()},S._onSBUpdateEnd=function(o){var l=this.operationQueue,u=l.current(o);u.onComplete(),l.shiftAndExecuteNext(o)},S._onSBUpdateError=function(o,l){I.logger.error("[buffer-controller]: "+o+" SourceBuffer error",l),this.hls.trigger(A.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var u=this.operationQueue.current(o);u&&u.onError(l)},S.removeExecutor=function(o,l,u){var T=this.media,m=this.mediaSource,p=this.operationQueue,w=this.sourceBuffer,x=w[o];if(!T||!m||!x){I.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),p.shiftAndExecuteNext(o);return}var g=Object(z.isFiniteNumber)(T.duration)?T.duration:Infinity,f=Object(z.isFiniteNumber)(m.duration)?m.duration:Infinity,d=Math.max(0,l),a=Math.min(u,g,f);a>d?(I.logger.log("[buffer-controller]: Removing ["+d+","+a+"] from the "+o+" SourceBuffer"),console.assert(!x.updating,o+" sourceBuffer must not be updating"),x.remove(d,a)):p.shiftAndExecuteNext(o)},S.appendExecutor=function(o,l){var u=this.operationQueue,T=this.sourceBuffer,m=T[l];if(!m){I.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(l);return}m.ended=!1,console.assert(!m.updating,l+" sourceBuffer must not be updating"),m.appendBuffer(o)},S.blockBuffers=function(o,l){var u=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){I.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var T=this.operationQueue,m=l.map(function(p){return T.appendBlocker(p)});Promise.all(m).then(function(){o(),l.forEach(function(p){var w=u.sourceBuffer[p];(!w||!w.updating)&&T.shiftAndExecuteNext(p)})})},S.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},S.addBufferListener=function(o,l,u){var T=this.sourceBuffer[o];if(!T)return;var m=u.bind(this,o);this.listeners[o].push({event:l,listener:m}),T.addEventListener(l,m)},S.removeBufferListeners=function(o){var l=this.sourceBuffer[o];if(!l)return;this.listeners[o].forEach(function(u){l.removeEventListener(u.event,u.listener)})},k}()},"./src/controller/buffer-operation-queue.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return A});var z=L("./src/utils/logger.ts"),A=function(){function I(j){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=j}var W=I.prototype;return W.append=function(P,D){var E=this.queues[D];E.push(P),E.length===1&&this.buffers[D]&&this.executeNext(D)},W.insertAbort=function(P,D){var E=this.queues[D];E.unshift(P),this.executeNext(D)},W.appendBlocker=function(P){var D,E=new Promise(function(M){D=M}),_={execute:D,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(_,P),E},W.executeNext=function(P){var D=this.buffers,E=this.queues,_=D[P],M=E[P];if(M.length){var R=M[0];try{R.execute()}catch(k){z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),R.onError(k),(!_||!_.updating)&&(M.shift(),this.executeNext(P))}}},W.shiftAndExecuteNext=function(P){this.queues[P].shift(),this.executeNext(P)},W.current=function(P){return this.queues[P][0]},I}()},"./src/controller/cap-level-controller.ts":function(le,Y,L){"use strict";L.r(Y);var z=L("./src/events.ts");function A(j,P){for(var D=0;D<P.length;D++){var E=P[D];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(j,E.key,E)}}function I(j,P,D){return P&&A(j.prototype,P),D&&A(j,D),j}var W=function(){function j(D){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=D,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var P=j.prototype;return P.setStreamController=function(E){this.streamController=E},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 E=this.hls;E.on(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.on(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.unregisterListener=function(){var E=this.hls;E.off(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.off(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.onFpsDropLevelCapping=function(E,_){j.isLevelAllowed(_.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(_.droppedLevel)},P.onMediaAttaching=function(E,_){this.media=_.media instanceof HTMLVideoElement?_.media:null},P.onManifestParsed=function(E,_){var M=this.hls;this.restrictedLevels=[],this.firstLevel=_.firstLevel,M.config.capLevelToPlayerSize&&_.video&&this.startCapping()},P.onBufferCodecs=function(E,_){var M=this.hls;M.config.capLevelToPlayerSize&&_.video&&this.startCapping()},P.onMediaDetaching=function(){this.stopCapping()},P.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var E=this.hls.levels;if(E.length){var _=this.hls;_.autoLevelCapping=this.getMaxLevel(E.length-1),_.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=_.autoLevelCapping}}},P.getMaxLevel=function(E){var _=this,M=this.hls.levels;if(!M.length)return-1;var R=M.filter(function(k,S){return j.isLevelAllowed(S,_.restrictedLevels)&&S<=E});return this.clientRect=null,j.getMaxLevelByMediaSize(R,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 E=this.media,_={width:0,height:0};if(E){var M=E.getBoundingClientRect();_.width=M.width,_.height=M.height,!_.width&&!_.height&&(_.width=M.right-M.left||E.width||0,_.height=M.bottom-M.top||E.height||0)}return this.clientRect=_,_},j.isLevelAllowed=function(E,_){return _===void 0&&(_=[]),_.indexOf(E)===-1},j.getMaxLevelByMediaSize=function(E,_,M){if(!E||!E.length)return-1;for(var R=function(l,u){return u?l.width!==u.width||l.height!==u.height:!0},k=E.length-1,S=0;S<E.length;S+=1){var c=E[S];if((c.width>=_||c.height>=M)&&R(c,E[S+1])){k=S;break}}return k},I(j,[{key:"mediaWidth",get:function(){return this.getDimensions().width*j.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*j.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var E=1;try{E=self.devicePixelRatio}catch(_){}return E}}]),j}();Y.default=W},"./src/controller/cmcd-controller.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return R});var z=L("./src/events.ts"),A=L("./src/types/cmcd.ts"),I=L("./src/utils/buffer-helper.ts"),W=L("./src/utils/logger.ts");function j(k,S){for(var c=0;c<S.length;c++){var o=S[c];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(k,o.key,o)}}function P(k,S,c){return S&&j(k.prototype,S),c&&j(k,c),k}function D(k,S){var c=typeof Symbol!="undefined"&&k[Symbol.iterator]||k["@@iterator"];if(c)return(c=c.call(k)).next.bind(c);if(Array.isArray(k)||(c=E(k))||S&&k&&typeof k.length=="number"){c&&(k=c);var o=0;return function(){return o>=k.length?{done:!0}:{done:!1,value:k[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E(k,S){if(!k)return;if(typeof k=="string")return _(k,S);var c=Object.prototype.toString.call(k).slice(8,-1);if(c==="Object"&&k.constructor&&(c=k.constructor.name),c==="Map"||c==="Set")return Array.from(k);if(c==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return _(k,S)}function _(k,S){(S==null||S>k.length)&&(S=k.length);for(var c=0,o=new Array(S);c<S;c++)o[c]=k[c];return o}function M(){return M=Object.assign||function(k){for(var S=1;S<arguments.length;S++){var c=arguments[S];for(var o in c)Object.prototype.hasOwnProperty.call(c,o)&&(k[o]=c[o])}return k},M.apply(this,arguments)}var R=function(){function k(c){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(T){try{o.apply(T,{ot:A.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(m){W.logger.warn("Could not generate manifest CMCD data.",m)}},this.applyFragmentData=function(T){try{var m=T.frag,p=o.hls.levels[m.level],w=o.getObjectType(m),x={d:m.duration*1e3,ot:w};(w===A.CMCDObjectType.VIDEO||w===A.CMCDObjectType.AUDIO||w==A.CMCDObjectType.MUXED)&&(x.br=p.bitrate/1e3,x.tb=o.getTopBandwidth(w),x.bl=o.getBufferLength(w)),o.apply(T,x)}catch(g){W.logger.warn("Could not generate segment CMCD data.",g)}},this.hls=c;var l=this.config=c.config,u=l.cmcd;u!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=u.sessionId||k.uuid(),this.cid=u.contentId,this.useHeaders=u.useHeaders===!0,this.registerListeners())}var S=k.prototype;return S.registerListeners=function(){var o=this.hls;o.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(z.Events.BUFFER_CREATED,this.onBufferCreated,this)},S.unregisterListeners=function(){var o=this.hls;o.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(z.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},S.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},S.onMediaAttached=function(o,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},S.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},S.onBufferCreated=function(o,l){var u,T;this.audioBuffer=(u=l.tracks.audio)===null||u===void 0?void 0:u.buffer,this.videoBuffer=(T=l.tracks.video)===null||T===void 0?void 0:T.buffer},S.createData=function(){var o;return{v:A.CMCDVersion,sf:A.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}},S.apply=function(o,l){l===void 0&&(l={}),M(l,this.createData());var u=l.ot===A.CMCDObjectType.INIT||l.ot===A.CMCDObjectType.VIDEO||l.ot===A.CMCDObjectType.MUXED;if(this.starved&&u&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var T=k.toHeaders(l);if(!Object.keys(T).length)return;o.headers||(o.headers={}),M(o.headers,T)}else{var m=k.toQuery(l);if(!m)return;o.url=k.appendQueryToUri(o.url,m)}},S.getObjectType=function(o){var l=o.type;return l==="subtitle"?A.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?A.CMCDObjectType.INIT:l==="audio"?A.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?A.CMCDObjectType.VIDEO:A.CMCDObjectType.MUXED:void 0},S.getTopBandwidth=function(o){for(var l=0,u=o===A.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,T=D(u),m;!(m=T()).done;){var p=m.value;p.bitrate>l&&(l=p.bitrate)}return l>0?l:NaN},S.getBufferLength=function(o){var l=this.hls.media,u=o===A.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!l)return NaN;var T=I.BufferHelper.bufferInfo(u,l.currentTime,this.config.maxBufferHole);return T.len*1e3},S.createPlaylistLoader=function(){var o=this.config.pLoader,l=this.applyPlaylistData,u=o||this.config.loader;return function(){function T(p){this.loader=void 0,this.loader=new u(p)}var m=T.prototype;return m.destroy=function(){this.loader.destroy()},m.abort=function(){this.loader.abort()},m.load=function(w,x,g){l(w),this.loader.load(w,x,g)},P(T,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),T}()},S.createFragmentLoader=function(){var o=this.config.fLoader,l=this.applyFragmentData,u=o||this.config.loader;return function(){function T(p){this.loader=void 0,this.loader=new u(p)}var m=T.prototype;return m.destroy=function(){this.loader.destroy()},m.abort=function(){this.loader.abort()},m.load=function(w,x,g){l(w),this.loader.load(w,x,g)},P(T,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),T}()},k.uuid=function(){var o=URL.createObjectURL(new Blob),l=o.toString();return URL.revokeObjectURL(o),l.substr(l.lastIndexOf("/")+1)},k.serialize=function(o){for(var l=[],u=function(G){return!Number.isNaN(G)&&G!=null&&G!==""&&G!==!1},T=function(G){return Math.round(G)},m=function(G){return T(G/100)*100},p=function(G){return encodeURIComponent(G)},w={br:T,d:T,bl:m,dl:m,mtp:m,nor:p,rtp:m,tb:T},x=Object.keys(o||{}).sort(),g=D(x),f;!(f=g()).done;){var d=f.value,a=o[d];if(!u(a))continue;if(d==="v"&&a===1)continue;if(d=="pr"&&a===1)continue;var C=w[d];C&&(a=C(a));var v=typeof a,b=void 0;d==="ot"||d==="sf"||d==="st"?b=d+"="+a:v==="boolean"?b=d:v==="number"?b=d+"="+a:b=d+"="+JSON.stringify(a),l.push(b)}return l.join(",")},k.toHeaders=function(o){for(var l=Object.keys(o),u={},T=["Object","Request","Session","Status"],m=[{},{},{},{}],p={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},w=0,x=l;w<x.length;w++){var g=x[w],f=p[g]!=null?p[g]:1;m[f][g]=o[g]}for(var d=0;d<m.length;d++){var a=k.serialize(m[d]);a&&(u["CMCD-"+T[d]]=a)}return u},k.toQuery=function(o){return"CMCD="+encodeURIComponent(k.serialize(o))},k.appendQueryToUri=function(o,l){if(!l)return o;var u=o.includes("?")?"&":"?";return""+o+u+l},k}()},"./src/controller/eme-controller.ts":function(le,Y,L){"use strict";L.r(Y);var z=L("./src/events.ts"),A=L("./src/errors.ts"),I=L("./src/utils/logger.ts"),W=L("./src/utils/mediakeys-helper.ts");function j(R,k){for(var S=0;S<k.length;S++){var c=k[S];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(R,c.key,c)}}function P(R,k,S){return k&&j(R.prototype,k),S&&j(R,S),R}var D=3,E=function(k,S,c){var o={audioCapabilities:[],videoCapabilities:[]};return k.forEach(function(l){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:c.audioRobustness||""})}),S.forEach(function(l){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:c.videoRobustness||""})}),[o]},_=function(k,S,c,o){switch(k){case W.KeySystems.WIDEVINE:return E(S,c,o);default:throw new Error("Unknown key-system: "+k)}},M=function(){function R(S){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=S,this._config=S.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 k=R.prototype;return k.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},k._registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},k._unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},k.getLicenseServerUrl=function(c){switch(c){case W.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+c+'"')},k._attemptKeySystemAccess=function(c,o,l){var u=this,T=_(c,o,l,this._drmSystemOptions);I.logger.log("Requesting encrypted media key-system access");var m=this.requestMediaKeySystemAccess(c,T);this.mediaKeysPromise=m.then(function(p){return u._onMediaKeySystemAccessObtained(c,p)}),m.catch(function(p){I.logger.error('Failed to obtain key-system "'+c+'" access:',p)})},k._onMediaKeySystemAccessObtained=function(c,o){var l=this;I.logger.log('Access for key-system "'+c+'" obtained');var u={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:c};this._mediaKeysList.push(u);var T=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(m){return u.mediaKeys=m,I.logger.log('Media-keys created for key-system "'+c+'"'),l._onMediaKeysCreated(),m});return T.catch(function(m){I.logger.error("Failed to create media-keys:",m)}),T},k._onMediaKeysCreated=function(){var c=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),c._onNewMediaKeySession(o.mediaKeysSession))})},k._onNewMediaKeySession=function(c){var o=this;I.logger.log("New key-system session "+c.sessionId),c.addEventListener("message",function(l){o._onKeySessionMessage(c,l.message)},!1)},k._onKeySessionMessage=function(c,o){I.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(l){I.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),c.update(l)})},k.onMediaEncrypted=function(c){var o=this;if(I.logger.log('Media is encrypted using "'+c.initDataType+'" init data type'),!this.mediaKeysPromise){I.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(z.Events.ERROR,{type:A.ErrorTypes.KEY_SYSTEM_ERROR,details:A.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(T){if(!o._media)return;o._attemptSetMediaKeys(T),o._generateRequestWithPreferredKeySession(c.initDataType,c.initData)};this.mediaKeysPromise.then(l).catch(l)},k._attemptSetMediaKeys=function(c){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){I.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:A.ErrorTypes.KEY_SYSTEM_ERROR,details:A.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}I.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},k._generateRequestWithPreferredKeySession=function(c,o){var l=this,u=this._mediaKeysList[0];if(!u){I.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:A.ErrorTypes.KEY_SYSTEM_ERROR,details:A.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(u.mediaKeysSessionInitialized){I.logger.warn("Key-Session already initialized but requested again");return}var T=u.mediaKeysSession;if(!T){I.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(z.Events.ERROR,{type:A.ErrorTypes.KEY_SYSTEM_ERROR,details:A.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){I.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(z.Events.ERROR,{type:A.ErrorTypes.KEY_SYSTEM_ERROR,details:A.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}I.logger.log('Generating key-session request for "'+c+'" init data type'),u.mediaKeysSessionInitialized=!0,T.generateRequest(c,o).then(function(){I.logger.debug("Key-session generation succeeded")}).catch(function(m){I.logger.error("Error generating key-session request:",m),l.hls.trigger(z.Events.ERROR,{type:A.ErrorTypes.KEY_SYSTEM_ERROR,details:A.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},k._createLicenseXhr=function(c,o,l){var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,u,c,o,l);var T=this._licenseXhrSetup;if(T)try{T.call(this.hls,u,c),T=void 0}catch(m){I.logger.error(m)}try{u.readyState||u.open("POST",c,!0),T&&T.call(this.hls,u,c)}catch(m){throw new Error("issue setting up KeySystem license XHR "+m)}return u},k._onLicenseRequestReadyStageChange=function(c,o,l,u){switch(c.readyState){case 4:if(c.status===200){this._requestLicenseFailureCount=0,I.logger.log("License request succeeded");var T=c.response,m=this._licenseResponseCallback;if(m)try{T=m.call(this.hls,c,o)}catch(w){I.logger.error(w)}u(T)}else{if(I.logger.error("License Request XHR failed ("+o+"). Status: "+c.status+" ("+c.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>D){this.hls.trigger(z.Events.ERROR,{type:A.ErrorTypes.KEY_SYSTEM_ERROR,details:A.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var p=D-this._requestLicenseFailureCount+1;I.logger.warn("Retrying license request, "+p+" attempts left"),this._requestLicense(l,u)}break}},k._generateLicenseRequestChallenge=function(c,o){switch(c.mediaKeySystemDomain){case W.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+c.mediaKeySystemDomain)},k._requestLicense=function(c,o){I.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){I.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:A.ErrorTypes.KEY_SYSTEM_ERROR,details:A.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var u=this.getLicenseServerUrl(l.mediaKeySystemDomain),T=this._createLicenseXhr(u,c,o);I.logger.log("Sending license request to URL: "+u);var m=this._generateLicenseRequestChallenge(l,c);T.send(m)}catch(p){I.logger.error("Failure requesting DRM license: "+p),this.hls.trigger(z.Events.ERROR,{type:A.ErrorTypes.KEY_SYSTEM_ERROR,details:A.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},k.onMediaAttached=function(c,o){if(!this._emeEnabled)return;var l=o.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},k.onMediaDetached=function(){var c=this._media,o=this._mediaKeysList;if(!c)return;c.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 c.setMediaKeys(null)}).catch(function(){})},k.onManifestParsed=function(c,o){if(!this._emeEnabled)return;var l=o.levels.map(function(T){return T.audioCodec}).filter(function(T){return!!T}),u=o.levels.map(function(T){return T.videoCodec}).filter(function(T){return!!T});this._attemptKeySystemAccess(W.KeySystems.WIDEVINE,l,u)},P(R,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),R}();Y.default=M},"./src/controller/fps-controller.ts":function(le,Y,L){"use strict";L.r(Y);var z=L("./src/events.ts"),A=L("./src/utils/logger.ts"),I=function(){function W(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 j=W.prototype;return j.setStreamController=function(D){this.streamController=D},j.registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},j.unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},j.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},j.onMediaAttaching=function(D,E){var _=this.hls.config;if(_.capLevelOnFPSDrop){var M=E.media instanceof self.HTMLVideoElement?E.media:null;this.media=M,M&&typeof M.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),_.fpsDroppedMonitoringPeriod)}},j.checkFPS=function(D,E,_){var M=performance.now();if(E){if(this.lastTime){var R=M-this.lastTime,k=_-this.lastDroppedFrames,S=E-this.lastDecodedFrames,c=1e3*k/R,o=this.hls;if(o.trigger(z.Events.FPS_DROP,{currentDropped:k,currentDecoded:S,totalDroppedFrames:_}),c>0&&k>o.config.fpsDroppedMonitoringThreshold*S){var l=o.currentLevel;A.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(z.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:o.currentLevel}),o.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=M,this.lastDroppedFrames=_,this.lastDecodedFrames=E}},j.checkFPSInterval=function(){var D=this.media;if(D)if(this.isVideoPlaybackQualityAvailable){var E=D.getVideoPlaybackQuality();this.checkFPS(D,E.totalVideoFrames,E.droppedVideoFrames)}else this.checkFPS(D,D.webkitDecodedFrameCount,D.webkitDroppedFrameCount)},W}();Y.default=I},"./src/controller/fragment-finders.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"findFragmentByPDT",function(){return I}),L.d(Y,"findFragmentByPTS",function(){return W}),L.d(Y,"fragmentWithinToleranceTest",function(){return j}),L.d(Y,"pdtWithinToleranceTest",function(){return P}),L.d(Y,"findFragWithCC",function(){return D});var z=L("./src/polyfills/number.ts"),A=L("./src/utils/binary-search.ts");function I(E,_,M){if(_===null||!Array.isArray(E)||!E.length||!Object(z.isFiniteNumber)(_))return null;var R=E[0].programDateTime;if(_<(R||0))return null;var k=E[E.length-1].endProgramDateTime;if(_>=(k||0))return null;M=M||0;for(var S=0;S<E.length;++S){var c=E[S];if(P(_,M,c))return c}return null}function W(E,_,M,R){M===void 0&&(M=0),R===void 0&&(R=0);var k=null;if(E?k=_[E.sn-_[0].sn+1]||null:M===0&&_[0].start===0&&(k=_[0]),k&&j(M,R,k)===0)return k;var S=A.default.search(_,j.bind(null,M,R));return S||k}function j(E,_,M){E===void 0&&(E=0),_===void 0&&(_=0);var R=Math.min(_,M.duration+(M.deltaPTS?M.deltaPTS:0));return M.start+M.duration-R<=E?1:M.start-R>E&&M.start?-1:0}function P(E,_,M){var R=Math.min(_,M.duration+(M.deltaPTS?M.deltaPTS:0))*1e3,k=M.endProgramDateTime||0;return k-R>E}function D(E,_){return A.default.search(E,function(M){return M.cc<_?1:M.cc>_?-1:0})}},"./src/controller/fragment-tracker.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"FragmentState",function(){return I}),L.d(Y,"FragmentTracker",function(){return W});var z=L("./src/events.ts"),A=L("./src/types/loader.ts"),I;(function(D){D.NOT_LOADED="NOT_LOADED",D.BACKTRACKED="BACKTRACKED",D.APPENDING="APPENDING",D.PARTIAL="PARTIAL",D.OK="OK"})(I||(I={}));var W=function(){function D(_){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=_,this._registerListeners()}var E=D.prototype;return E._registerListeners=function(){var M=this.hls;M.on(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.on(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.on(z.Events.FRAG_LOADED,this.onFragLoaded,this)},E._unregisterListeners=function(){var M=this.hls;M.off(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.off(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.off(z.Events.FRAG_LOADED,this.onFragLoaded,this)},E.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},E.getAppendedFrag=function(M,R){if(R===A.PlaylistLevelType.MAIN){var k=this.activeFragment,S=this.activeParts;if(!k)return null;if(S)for(var c=S.length;c--;){var o=S[c],l=o?o.end:k.appendedPTS;if(o.start<=M&&l!==void 0&&M<=l)return c>9&&(this.activeParts=S.slice(c-9)),o}else if(k.start<=M&&k.appendedPTS!==void 0&&M<=k.appendedPTS)return k}return this.getBufferedFrag(M,R)},E.getBufferedFrag=function(M,R){for(var k=this.fragments,S=Object.keys(k),c=S.length;c--;){var o=k[S[c]];if((o==null?void 0:o.body.type)===R&&o.buffered){var l=o.body;if(l.start<=M&&M<=l.end)return l}}return null},E.detectEvictedFragments=function(M,R,k){var S=this;Object.keys(this.fragments).forEach(function(c){var o=S.fragments[c];if(!o)return;if(!o.buffered){o.body.type===k&&S.removeFragment(o.body);return}var l=o.range[M];if(!l)return;l.time.some(function(u){var T=!S.isTimeBuffered(u.startPTS,u.endPTS,R);return T&&S.removeFragment(o.body),T})})},E.detectPartialFragments=function(M){var R=this,k=this.timeRanges,S=M.frag,c=M.part;if(!k||S.sn==="initSegment")return;var o=P(S),l=this.fragments[o];if(!l)return;Object.keys(k).forEach(function(u){var T=S.elementaryStreams[u];if(!T)return;var m=k[u],p=c!==null||T.partial===!0;l.range[u]=R.getBufferedTimes(S,c,p,m)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},E.fragBuffered=function(M){var R=P(M),k=this.fragments[R];k&&(k.backtrack=k.loaded=null,k.buffered=!0)},E.getBufferedTimes=function(M,R,k,S){for(var c={time:[],partial:k},o=R?R.start:M.start,l=R?R.end:M.end,u=M.minEndPTS||l,T=M.maxStartPTS||o,m=0;m<S.length;m++){var p=S.start(m)-this.bufferPadding,w=S.end(m)+this.bufferPadding;if(T>=p&&u<=w){c.time.push({startPTS:Math.max(o,S.start(m)),endPTS:Math.min(l,S.end(m))});break}else if(o<w&&l>p)c.partial=!0,c.time.push({startPTS:Math.max(o,S.start(m)),endPTS:Math.min(l,S.end(m))});else if(l<=p)break}return c},E.getPartialFragment=function(M){var R=null,k,S,c,o=0,l=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(T){var m=u[T];if(!m)return;j(m)&&(S=m.body.start-l,c=m.body.end+l,M>=S&&M<=c&&(k=Math.min(M-S,c-M),o<=k&&(R=m.body,o=k)))}),R},E.getState=function(M){var R=P(M),k=this.fragments[R];return k?k.buffered?j(k)?I.PARTIAL:I.OK:k.backtrack?I.BACKTRACKED:I.APPENDING:I.NOT_LOADED},E.backtrack=function(M,R){var k=P(M),S=this.fragments[k];if(!S||S.backtrack)return null;var c=S.backtrack=R||S.loaded;return S.loaded=null,c},E.getBacktrackData=function(M){var R=P(M),k=this.fragments[R];if(k){var S,c=k.backtrack;if(c!=null&&(S=c.payload)!==null&&S!==void 0&&S.byteLength)return c;this.removeFragment(M)}return null},E.isTimeBuffered=function(M,R,k){for(var S,c,o=0;o<k.length;o++){if(S=k.start(o)-this.bufferPadding,c=k.end(o)+this.bufferPadding,M>=S&&R<=c)return!0;if(R<=S)return!1}return!1},E.onFragLoaded=function(M,R){var k=R.frag,S=R.part;if(k.sn==="initSegment"||k.bitrateTest||S)return;var c=P(k);this.fragments[c]={body:k,loaded:R,backtrack:null,buffered:!1,range:Object.create(null)}},E.onBufferAppended=function(M,R){var k=this,S=R.frag,c=R.part,o=R.timeRanges;if(S.type===A.PlaylistLevelType.MAIN)if(this.activeFragment=S,c){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(c)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(u){var T=o[u];if(k.detectEvictedFragments(u,T),!c)for(var m=0;m<T.length;m++)S.appendedPTS=Math.max(T.end(m),S.appendedPTS||0)})},E.onFragBuffered=function(M,R){this.detectPartialFragments(R)},E.hasFragment=function(M){var R=P(M);return!!this.fragments[R]},E.removeFragmentsInRange=function(M,R,k){var S=this;Object.keys(this.fragments).forEach(function(c){var o=S.fragments[c];if(!o)return;if(o.buffered){var l=o.body;l.type===k&&l.start<R&&l.end>M&&S.removeFragment(l)}})},E.removeFragment=function(M){var R=P(M);M.stats.loaded=0,M.clearElementaryStreamInfo(),delete this.fragments[R]},E.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},D}();function j(D){var E,_;return D.buffered&&(((E=D.range.video)===null||E===void 0?void 0:E.partial)||((_=D.range.audio)===null||_===void 0?void 0:_.partial))}function P(D){return D.type+"_"+D.level+"_"+D.urlId+"_"+D.sn}},"./src/controller/gap-controller.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"STALL_MINIMUM_DURATION_MS",function(){return j}),L.d(Y,"MAX_START_GAP_JUMP",function(){return P}),L.d(Y,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return D}),L.d(Y,"SKIP_BUFFER_RANGE_START",function(){return E}),L.d(Y,"default",function(){return _});var z=L("./src/utils/buffer-helper.ts"),A=L("./src/errors.ts"),I=L("./src/events.ts"),W=L("./src/utils/logger.ts"),j=250,P=2,D=.1,E=.05,_=function(){function M(k,S,c,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=k,this.media=S,this.fragmentTracker=c,this.hls=o}var R=M.prototype;return R.destroy=function(){this.hls=this.fragmentTracker=this.media=null},R.poll=function(S){var c=this.config,o=this.media,l=this.stalled,u=o.currentTime,T=o.seeking,m=this.seeking&&!T,p=!this.seeking&&T;if(this.seeking=T,u!==S){if(this.moved=!0,l!==null){if(this.stallReported){var w=self.performance.now()-l;W.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(w)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((p||m)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!z.BufferHelper.getBuffered(o).length)return;var x=z.BufferHelper.bufferInfo(o,u,0),g=x.len>0,f=x.nextStart||0;if(!g&&!f)return;if(T){var d=x.len>P,a=!f||f-u>P&&!this.fragmentTracker.getPartialFragment(u);if(d||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var C,v=Math.max(f,x.start||0)-u,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,y=b==null||((C=b.details)===null||C===void 0)?void 0:C.live,G=y?b.details.targetduration*2:P;if(v>0&&v<=G){this._trySkipBufferHole(null);return}}var $=self.performance.now();if(l===null){this.stalled=$;return}var Z=$-l;!T&&Z>=j&&this._reportStall(x.len);var V=z.BufferHelper.bufferInfo(o,u,c.maxBufferHole);this._tryFixBufferStall(V,Z)},R._tryFixBufferStall=function(S,c){var o=this.config,l=this.fragmentTracker,u=this.media,T=u.currentTime,m=l.getPartialFragment(T);if(m){var p=this._trySkipBufferHole(m);if(p)return}S.len>o.maxBufferHole&&c>o.highBufferWatchdogPeriod*1e3&&(W.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},R._reportStall=function(S){var c=this.hls,o=this.media,l=this.stallReported;l||(this.stallReported=!0,W.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+S+")"),c.trigger(I.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:S}))},R._trySkipBufferHole=function(S){for(var c=this.config,o=this.hls,l=this.media,u=l.currentTime,T=0,m=z.BufferHelper.getBuffered(l),p=0;p<m.length;p++){var w=m.start(p);if(u+c.maxBufferHole>=T&&u<w){var x=Math.max(w+E,l.currentTime+D);return W.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+x),this.moved=!0,this.stalled=null,l.currentTime=x,S&&o.trigger(I.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+u+" to "+x,frag:S}),x}T=m.end(p)}return 0},R._tryNudgeBuffer=function(){var S=this.config,c=this.hls,o=this.media,l=o.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u<S.nudgeMaxRetry){var T=l+u*S.nudgeOffset;W.logger.warn("Nudging 'currentTime' from "+l+" to "+T),o.currentTime=T,c.trigger(I.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else W.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+S.nudgeMaxRetry+" nudges"),c.trigger(I.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},M}()},"./src/controller/id3-track-controller.ts":function(le,Y,L){"use strict";L.r(Y);var z=L("./src/events.ts"),A=L("./src/utils/texttrack-utils.ts"),I=L("./src/demux/id3.ts"),W=.25,j=function(){function P(E){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=E,this._registerListeners()}var D=P.prototype;return D.destroy=function(){this._unregisterListeners()},D._registerListeners=function(){var _=this.hls;_.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.on(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),_.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D._unregisterListeners=function(){var _=this.hls;_.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.off(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),_.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D.onMediaAttached=function(_,M){this.media=M.media},D.onMediaDetaching=function(){if(!this.id3Track)return;Object(A.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},D.getID3Track=function(_){if(!this.media)return;for(var M=0;M<_.length;M++){var R=_[M];if(R.kind==="metadata"&&R.label==="id3")return Object(A.sendAddTrackEvent)(R,this.media),R}return this.media.addTextTrack("metadata","id3")},D.onFragParsingMetadata=function(_,M){if(!this.media)return;var R=M.frag,k=M.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var S=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,c=0;c<k.length;c++){var o=I.getID3Frames(k[c].data);if(o){var l=k[c].pts,u=c<k.length-1?k[c+1].pts:R.end,T=u-l;T<=0&&(u=l+W);for(var m=0;m<o.length;m++){var p=o[m];if(!I.isTimeStampFrame(p)){var w=new S(l,u,"");w.value=p,this.id3Track.addCue(w)}}}}},D.onBufferFlushing=function(_,M){var R=M.startOffset,k=M.endOffset,S=M.type;if(!S||S==="audio"){var c=this.id3Track;c&&Object(A.removeCuesInRange)(c,R,k)}},P}();Y.default=j},"./src/controller/latency-controller.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return P});var z=L("./src/errors.ts"),A=L("./src/events.ts"),I=L("./src/utils/logger.ts");function W(D,E){for(var _=0;_<E.length;_++){var M=E[_];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(D,M.key,M)}}function j(D,E,_){return E&&W(D.prototype,E),_&&W(D,_),D}var P=function(){function D(_){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=_,this.config=_.config,this.registerListeners()}var E=D.prototype;return E.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},E.registerListeners=function(){this.hls.on(A.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(A.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(A.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(A.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(A.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){this.hls.off(A.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(A.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(A.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(A.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(A.Events.ERROR,this.onError)},E.onMediaAttached=function(M,R){this.media=R.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},E.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},E.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},E.onLevelUpdated=function(M,R){var k=R.details;this.levelDetails=k,k.advanced&&this.timeupdate(),!k.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},E.onError=function(M,R){if(R.details!==z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,I.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},E.timeupdate=function(){var M=this.media,R=this.levelDetails;if(!M||!R)return;this.currentTime=M.currentTime;var k=this.computeLatency();if(k===null)return;this._latency=k;var S=this.config,c=S.lowLatencyMode,o=S.maxLiveSyncPlaybackRate;if(!c||o===1)return;var l=this.targetLatency;if(l===null)return;var u=k-l,T=Math.min(this.maxLatency,l+R.targetduration),m=u<T;if(R.live&&m&&u>.05&&this.forwardBufferLength>1){var p=Math.min(2,Math.max(1,o)),w=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;M.playbackRate=Math.min(p,Math.max(1,w))}else M.playbackRate!==1&&M.playbackRate!==0&&(M.playbackRate=1)},E.estimateLiveEdge=function(){var M=this.levelDetails;return M===null?null:M.edge+M.age},E.computeLatency=function(){var M=this.estimateLiveEdge();return M===null?null:M-this.currentTime},j(D,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var M=this.config,R=this.levelDetails;return M.liveMaxLatencyDuration!==void 0?M.liveMaxLatencyDuration:R?M.liveMaxLatencyDurationCount*R.targetduration:0}},{key:"targetLatency",get:function(){var M=this.levelDetails;if(M===null)return null;var R=M.holdBack,k=M.partHoldBack,S=M.targetduration,c=this.config,o=c.liveSyncDuration,l=c.liveSyncDurationCount,u=c.lowLatencyMode,T=this.hls.userConfig,m=u&&k||R;(T.liveSyncDuration||T.liveSyncDurationCount||m===0)&&(m=o!==void 0?o:l*S);var p=S,w=1;return m+Math.min(this.stallCount*w,p)}},{key:"liveSyncPosition",get:function(){var M=this.estimateLiveEdge(),R=this.targetLatency,k=this.levelDetails;if(M===null||R===null||k===null)return null;var S=k.edge,c=M-R-this.edgeStalled,o=S-k.totalduration,l=S-(this.config.lowLatencyMode&&k.partTarget||k.targetduration);return Math.min(Math.max(o,c),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 R=(this.config.lowLatencyMode&&M.partTarget||M.targetduration)*3;return Math.max(M.age-R,0)}},{key:"forwardBufferLength",get:function(){var M=this.media,R=this.levelDetails;if(!M||!R)return 0;var k=M.buffered.length;return k?M.buffered.end(k-1):R.edge-this.currentTime}}]),D}()},"./src/controller/level-controller.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return c});var z=L("./src/types/level.ts"),A=L("./src/events.ts"),I=L("./src/errors.ts"),W=L("./src/utils/codecs.ts"),j=L("./src/controller/level-helper.ts"),P=L("./src/controller/base-playlist-controller.ts"),D=L("./src/types/loader.ts");function E(){return E=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var u=arguments[l];for(var T in u)Object.prototype.hasOwnProperty.call(u,T)&&(o[T]=u[T])}return o},E.apply(this,arguments)}function _(o,l){for(var u=0;u<l.length;u++){var T=l[u];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(o,T.key,T)}}function M(o,l,u){return l&&_(o.prototype,l),u&&_(o,u),o}function R(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,k(o,l)}function k(o,l){return k=Object.setPrototypeOf||function(T,m){return T.__proto__=m,T},k(o,l)}var S=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),c=function(o){R(l,o);function l(T){var m;return m=o.call(this,T,"[level-controller]")||this,m._levels=[],m._firstLevel=-1,m._startLevel=void 0,m.currentLevelIndex=-1,m.manualLevelIndex=-1,m.onParsedComplete=void 0,m._registerListeners(),m}var u=l.prototype;return u._registerListeners=function(){var m=this.hls;m.on(A.Events.MANIFEST_LOADED,this.onManifestLoaded,this),m.on(A.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.on(A.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.on(A.Events.FRAG_LOADED,this.onFragLoaded,this),m.on(A.Events.ERROR,this.onError,this)},u._unregisterListeners=function(){var m=this.hls;m.off(A.Events.MANIFEST_LOADED,this.onManifestLoaded,this),m.off(A.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.off(A.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.off(A.Events.FRAG_LOADED,this.onFragLoaded,this),m.off(A.Events.ERROR,this.onError,this)},u.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},u.startLoad=function(){var m=this._levels;m.forEach(function(p){p.loadError=0}),o.prototype.startLoad.call(this)},u.onManifestLoaded=function(m,p){var w=[],x=[],g=[],f,d={},a,C=!1,v=!1,b=!1;if(p.levels.forEach(function(Z){var V=Z.attrs;C=C||!!(Z.width&&Z.height),v=v||!!Z.videoCodec,b=b||!!Z.audioCodec,S&&Z.audioCodec&&Z.audioCodec.indexOf("mp4a.40.34")!==-1&&(Z.audioCodec=void 0);var H=Z.bitrate+"-"+Z.attrs.RESOLUTION+"-"+Z.attrs.CODECS;a=d[H],a?a.url.push(Z.url):(a=new z.Level(Z),d[H]=a,w.push(a)),V&&(V.AUDIO&&Object(j.addGroupId)(a,"audio",V.AUDIO),V.SUBTITLES&&Object(j.addGroupId)(a,"text",V.SUBTITLES))}),(C||v)&&b&&(w=w.filter(function(Z){var V=Z.videoCodec,H=Z.width,re=Z.height;return!!V||!!(H&&re)})),w=w.filter(function(Z){var V=Z.audioCodec,H=Z.videoCodec;return(!V||Object(W.isCodecSupportedInMp4)(V,"audio"))&&(!H||Object(W.isCodecSupportedInMp4)(H,"video"))}),p.audioTracks&&(x=p.audioTracks.filter(function(Z){return!Z.audioCodec||Object(W.isCodecSupportedInMp4)(Z.audioCodec,"audio")}),Object(j.assignTrackIdsByGroup)(x)),p.subtitles&&(g=p.subtitles,Object(j.assignTrackIdsByGroup)(g)),w.length>0){f=w[0].bitrate,w.sort(function(Z,V){return Z.bitrate-V.bitrate}),this._levels=w;for(var y=0;y<w.length;y++)if(w[y].bitrate===f){this._firstLevel=y,this.log("manifest loaded, "+w.length+" level(s) found, first bitrate: "+f);break}var G=b&&!v,$={levels:w,audioTracks:x,subtitleTracks:g,firstLevel:this._firstLevel,stats:p.stats,audio:b,video:v,altAudio:!G&&x.some(function(Z){return!!Z.url})};this.hls.trigger(A.Events.MANIFEST_PARSED,$),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(A.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:p.url,reason:"no level with compatible codecs found in manifest"})},u.onError=function(m,p){if(o.prototype.onError.call(this,m,p),p.fatal)return;var w=p.context,x=this._levels[this.currentLevelIndex];if(w&&(w.type===D.PlaylistContextType.AUDIO_TRACK&&x.audioGroupIds&&w.groupId===x.audioGroupIds[x.urlId]||w.type===D.PlaylistContextType.SUBTITLE_TRACK&&x.textGroupIds&&w.groupId===x.textGroupIds[x.urlId])){this.redundantFailover(this.currentLevelIndex);return}var g=!1,f=!0,d;switch(p.details){case I.ErrorDetails.FRAG_LOAD_ERROR:case I.ErrorDetails.FRAG_LOAD_TIMEOUT:case I.ErrorDetails.KEY_LOAD_ERROR:case I.ErrorDetails.KEY_LOAD_TIMEOUT:if(p.frag){var a=this._levels[p.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(d=p.frag.level)):d=p.frag.level}break;case I.ErrorDetails.LEVEL_LOAD_ERROR:case I.ErrorDetails.LEVEL_LOAD_TIMEOUT:w&&(w.deliveryDirectives&&(f=!1),d=w.level),g=!0;break;case I.ErrorDetails.REMUX_ALLOC_ERROR:d=p.level,g=!0;break}d!==void 0&&this.recoverLevel(p,d,g,f)},u.recoverLevel=function(m,p,w,x){var g=m.details,f=this._levels[p];if(f.loadError++,w){var d=this.retryLoadingOrFail(m);if(d)m.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(x){var a=f.url.length;if(a>1&&f.loadError<a)m.levelRetry=!0,this.redundantFailover(p);else if(this.manualLevelIndex===-1){var C=p===0?this._levels.length-1:p-1;this.currentLevelIndex!==C&&this._levels[C].loadError===0&&(this.warn(g+": switch to "+C),m.levelRetry=!0,this.hls.nextAutoLevel=C)}}},u.redundantFailover=function(m){var p=this._levels[m],w=p.url.length;if(w>1){var x=(p.urlId+1)%w;this.warn("Switching to redundant URL-id "+x),this._levels.forEach(function(g){g.urlId=x}),this.level=m}},u.onFragLoaded=function(m,p){var w=p.frag;if(w!==void 0&&w.type===D.PlaylistLevelType.MAIN){var x=this._levels[w.level];x!==void 0&&(x.fragmentError=0,x.loadError=0)}},u.onLevelLoaded=function(m,p){var w,x=p.level,g=p.details,f=this._levels[x];if(!f){var d;this.warn("Invalid level index "+x),(d=p.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(g.deltaUpdateFailed=!0);return}x===this.currentLevelIndex?(f.fragmentError===0&&(f.loadError=0,this.retryCount=0),this.playlistLoaded(x,p,f.details)):(w=p.deliveryDirectives)!==null&&w!==void 0&&w.skip&&(g.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(m,p){var w=this.hls.levels[this.currentLevelIndex];if(!w)return;if(w.audioGroupIds){for(var x=-1,g=this.hls.audioTracks[p.id].groupId,f=0;f<w.audioGroupIds.length;f++)if(w.audioGroupIds[f]===g){x=f;break}x!==w.urlId&&(w.urlId=x,this.startLoad())}},u.loadPlaylist=function(m){var p=this.currentLevelIndex,w=this._levels[p];if(this.canLoad&&w&&w.url.length>0){var x=w.urlId,g=w.url[x];if(m)try{g=m.addDirectives(g)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Attempt loading level index "+p+(m?" at sn "+m.msn+" part "+m.part:"")+" with URL-id "+x+" "+g),this.clearTimer(),this.hls.trigger(A.Events.LEVEL_LOADING,{url:g,level:p,id:x,deliveryDirectives:m||null})}},u.removeLevel=function(m,p){var w=function(f,d){return d!==p},x=this._levels.filter(function(g,f){return f!==m?!0:g.url.length>1&&p!==void 0?(g.url=g.url.filter(w),g.audioGroupIds&&(g.audioGroupIds=g.audioGroupIds.filter(w)),g.textGroupIds&&(g.textGroupIds=g.textGroupIds.filter(w)),g.urlId=0,!0):!1}).map(function(g,f){var d=g.details;return d!=null&&d.fragments&&d.fragments.forEach(function(a){a.level=f}),g});this._levels=x,this.hls.trigger(A.Events.LEVELS_UPDATED,{levels:x})},M(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(m){var p,w=this._levels;if(w.length===0)return;if(this.currentLevelIndex===m&&(p=w[m])!==null&&p!==void 0&&p.details)return;if(m<0||m>=w.length){var x=m<0;if(this.hls.trigger(A.Events.ERROR,{type:I.ErrorTypes.OTHER_ERROR,details:I.ErrorDetails.LEVEL_SWITCH_ERROR,level:m,fatal:x,reason:"invalid level idx"}),x)return;m=Math.min(m,w.length-1)}this.clearTimer();var g=this.currentLevelIndex,f=w[g],d=w[m];this.log("switching to level "+m+" from "+g),this.currentLevelIndex=m;var a=E({},d,{level:m,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete a._urlId,this.hls.trigger(A.Events.LEVEL_SWITCHING,a);var C=d.details;if(!C||C.live){var v=this.switchParams(d.uri,f==null?void 0:f.details);this.loadPlaylist(v)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(m){this.manualLevelIndex=m,this._startLevel===void 0&&(this._startLevel=m),m!==-1&&(this.level=m)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(m){this._firstLevel=m}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var m=this.hls.config.startLevel;return m!==void 0?m:this._firstLevel}else return this._startLevel},set:function(m){this._startLevel=m}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(m){this.level=m,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=m)}}]),l}(P.default)},"./src/controller/level-helper.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"addGroupId",function(){return I}),L.d(Y,"assignTrackIdsByGroup",function(){return W}),L.d(Y,"updatePTS",function(){return j}),L.d(Y,"updateFragPTSDTS",function(){return D}),L.d(Y,"mergeDetails",function(){return E}),L.d(Y,"mapPartIntersection",function(){return _}),L.d(Y,"mapFragmentIntersection",function(){return M}),L.d(Y,"adjustSliding",function(){return R}),L.d(Y,"addSliding",function(){return k}),L.d(Y,"computeReloadInterval",function(){return S}),L.d(Y,"getFragmentWithSN",function(){return c}),L.d(Y,"getPartWith",function(){return o});var z=L("./src/polyfills/number.ts"),A=L("./src/utils/logger.ts");function I(l,u,T){switch(u){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(T);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(T);break}}function W(l){var u={};l.forEach(function(T){var m=T.groupId||"";T.id=u[m]=u[m]||0,u[m]++})}function j(l,u,T){var m=l[u],p=l[T];P(m,p)}function P(l,u){var T=u.startPTS;if(Object(z.isFiniteNumber)(T)){var m=0,p;u.sn>l.sn?(m=T-l.start,p=l):(m=l.start-T,p=u),p.duration!==m&&(p.duration=m)}else if(u.sn>l.sn){var w=l.cc===u.cc;w&&l.minEndPTS?u.start=l.start+(l.minEndPTS-l.start):u.start=l.start+l.duration}else u.start=Math.max(l.start-u.duration,0)}function D(l,u,T,m,p,w){var x=m-T;x<=0&&(A.logger.warn("Fragment should have a positive duration",u),m=T+u.duration,w=p+u.duration);var g=T,f=m,d=u.startPTS,a=u.endPTS;if(Object(z.isFiniteNumber)(d)){var C=Math.abs(d-T);Object(z.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(C,u.deltaPTS):u.deltaPTS=C,g=Math.max(T,d),T=Math.min(T,d),p=Math.min(p,u.startDTS),f=Math.min(m,a),m=Math.max(m,a),w=Math.max(w,u.endDTS)}u.duration=m-T;var v=T-u.start;u.appendedPTS=m,u.start=u.startPTS=T,u.maxStartPTS=g,u.startDTS=p,u.endPTS=m,u.minEndPTS=f,u.endDTS=w;var b=u.sn;if(!l||b<l.startSN||b>l.endSN)return 0;var y,G=b-l.startSN,$=l.fragments;for($[G]=u,y=G;y>0;y--)P($[y],$[y-1]);for(y=G;y<$.length-1;y++)P($[y],$[y+1]);return l.fragmentHint&&P($[$.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,v}function E(l,u){for(var T=null,m=l.fragments,p=m.length-1;p>=0;p--){var w=m[p].initSegment;if(w){T=w;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var x=0,g;if(M(l,u,function(y,G){y.relurl&&(x=y.cc-G.cc),Object(z.isFiniteNumber)(y.startPTS)&&Object(z.isFiniteNumber)(y.endPTS)&&(G.start=G.startPTS=y.startPTS,G.startDTS=y.startDTS,G.appendedPTS=y.appendedPTS,G.maxStartPTS=y.maxStartPTS,G.endPTS=y.endPTS,G.endDTS=y.endDTS,G.minEndPTS=y.minEndPTS,G.duration=y.endPTS-y.startPTS,G.duration&&(g=G),u.PTSKnown=u.alignedSliding=!0),G.elementaryStreams=y.elementaryStreams,G.loader=y.loader,G.stats=y.stats,G.urlId=y.urlId,y.initSegment&&(G.initSegment=y.initSegment,T=y.initSegment)}),T){var f=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;f.forEach(function(y){var G;(!y.initSegment||y.initSegment.relurl===((G=T)===null||G===void 0?void 0:G.relurl))&&(y.initSegment=T)})}if(u.skippedSegments&&(u.deltaUpdateFailed=u.fragments.some(function(y){return!y}),u.deltaUpdateFailed)){A.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var d=u.skippedSegments;d--;)u.fragments.shift();u.startSN=u.fragments[0].sn,u.startCC=u.fragments[0].cc}var a=u.fragments;if(x){A.logger.warn("discontinuity sliding from playlist, take drift into account");for(var C=0;C<a.length;C++)a[C].cc+=x}u.skippedSegments&&(u.startCC=u.fragments[0].cc),_(l.partList,u.partList,function(y,G){G.elementaryStreams=y.elementaryStreams,G.stats=y.stats}),g?D(u,g,g.startPTS,g.endPTS,g.startDTS,g.endDTS):R(l,u),a.length&&(u.totalduration=u.edge-a[0].start),u.driftStartTime=l.driftStartTime,u.driftStart=l.driftStart;var v=u.advancedDateTime;if(u.advanced&&v){var b=u.edge;u.driftStart||(u.driftStartTime=v,u.driftStart=b),u.driftEndTime=v,u.driftEnd=b}else u.driftEndTime=l.driftEndTime,u.driftEnd=l.driftEnd,u.advancedDateTime=l.advancedDateTime}function _(l,u,T){if(l&&u)for(var m=0,p=0,w=l.length;p<=w;p++){var x=l[p],g=u[p+m];x&&g&&x.index===g.index&&x.fragment.sn===g.fragment.sn?T(x,g):m--}}function M(l,u,T){for(var m=u.skippedSegments,p=Math.max(l.startSN,u.startSN)-u.startSN,w=(l.fragmentHint?1:0)+(m?u.endSN:Math.min(l.endSN,u.endSN))-u.startSN,x=u.startSN-l.startSN,g=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,f=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,d=p;d<=w;d++){var a=f[x+d],C=g[d];m&&!C&&d<m&&(C=u.fragments[d]=a),a&&C&&T(a,C)}}function R(l,u){var T=u.startSN+u.skippedSegments-l.startSN,m=l.fragments;if(T<0||T>=m.length)return;k(u,m[T].start)}function k(l,u){if(u){for(var T=l.fragments,m=l.skippedSegments;m<T.length;m++)T[m].start+=u;l.fragmentHint&&(l.fragmentHint.start+=u)}}function S(l,u){var T=1e3*l.levelTargetDuration,m=T/2,p=l.age,w=p>0&&p<T*3,x=u.loading.end-u.loading.start,g,f=l.availabilityDelay;if(l.updated===!1)if(w){var d=333*l.misses;g=Math.max(Math.min(m,x*2),d),l.availabilityDelay=(l.availabilityDelay||0)+g}else g=m;else w?(f=Math.min(f||T/2,p),l.availabilityDelay=f,g=f+T-p):g=T-x;return Math.round(g)}function c(l,u,T){if(!l||!l.details)return null;var m=l.details,p=m.fragments[u-m.startSN];return p||(p=m.fragmentHint,p&&p.sn===u?p:u<m.startSN&&T&&T.sn===u?T:null)}function o(l,u,T){if(!l||!l.details)return null;var m=l.details.partList;if(m)for(var p=m.length;p--;){var w=m[p];if(w.index===T&&w.fragment.sn===u)return w}return null}},"./src/controller/stream-controller.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return m});var z=L("./src/polyfills/number.ts"),A=L("./src/controller/base-stream-controller.ts"),I=L("./src/is-supported.ts"),W=L("./src/events.ts"),j=L("./src/utils/buffer-helper.ts"),P=L("./src/controller/fragment-tracker.ts"),D=L("./src/types/loader.ts"),E=L("./src/loader/fragment.ts"),_=L("./src/demux/transmuxer-interface.ts"),M=L("./src/types/transmuxer.ts"),R=L("./src/controller/gap-controller.ts"),k=L("./src/errors.ts"),S=L("./src/utils/logger.ts");function c(p,w){for(var x=0;x<w.length;x++){var g=w[x];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(p,g.key,g)}}function o(p,w,x){return w&&c(p.prototype,w),x&&c(p,x),p}function l(p,w){p.prototype=Object.create(w.prototype),p.prototype.constructor=p,u(p,w)}function u(p,w){return u=Object.setPrototypeOf||function(g,f){return g.__proto__=f,g},u(p,w)}var T=100,m=function(p){l(w,p);function w(g,f){var d;return d=p.call(this,g,f,"[stream-controller]")||this,d.audioCodecSwap=!1,d.gapController=null,d.level=-1,d._forceStartLoad=!1,d.altAudio=!1,d.audioOnly=!1,d.fragPlaying=null,d.onvplaying=null,d.onvseeked=null,d.fragLastKbps=0,d.stalled=!1,d.couldBacktrack=!1,d.audioCodecSwitch=!1,d.videoBuffer=null,d._registerListeners(),d}var x=w.prototype;return x._registerListeners=function(){var f=this.hls;f.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),f.on(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.on(W.Events.ERROR,this.onError,this),f.on(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.on(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(W.Events.BUFFER_CREATED,this.onBufferCreated,this),f.on(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.on(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x._unregisterListeners=function(){var f=this.hls;f.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.off(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.off(W.Events.ERROR,this.onError,this),f.off(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.off(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(W.Events.BUFFER_CREATED,this.onBufferCreated,this),f.off(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.off(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},x.startLoad=function(f){if(this.levels){var d=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(T),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var C=a.startLevel;C===-1&&(a.config.testBandwidth?(C=0,this.bitrateTest=!0):C=a.nextAutoLevel),this.level=a.nextLoadLevel=C,this.loadedmetadata=!1}d>0&&f===-1&&(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),f=d),this.state=A.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=f,this.tick()}else this._forceStartLoad=!0,this.state=A.State.STOPPED},x.stopLoad=function(){this._forceStartLoad=!1,p.prototype.stopLoad.call(this)},x.doTick=function(){switch(this.state){case A.State.IDLE:this.doTickIdle();break;case A.State.WAITING_LEVEL:{var f,d=this.levels,a=this.level,C=d==null||((f=d[a])===null||f===void 0)?void 0:f.details;if(C&&(!C.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(C))break;this.state=A.State.IDLE;break}break}case A.State.FRAG_LOADING_WAITING_RETRY:{var v,b=self.performance.now(),y=this.retryDate;(!y||b>=y||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=A.State.IDLE)}break;default:break}this.onTickEnd()},x.onTickEnd=function(){p.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},x.doTickIdle=function(){var f,d,a=this.hls,C=this.levelLastLoaded,v=this.levels,b=this.media,y=a.config,G=a.nextLoadLevel;if(C===null||!b&&(this.startFragRequested||!y.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!v||!v[G])return;var $=v[G];this.level=a.nextLoadLevel=G;var Z=$.details;if(!Z||this.state===A.State.WAITING_LEVEL||Z.live&&this.levelLastLoaded!==G){this.state=A.State.WAITING_LEVEL;return}var V=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:b,D.PlaylistLevelType.MAIN);if(V===null)return;var H=V.len,re=this.getMaxBufferLength($.maxBitrate);if(H>=re)return;if(this._streamEnded(V,Z)){var ce={};this.altAudio&&(ce.type="video"),this.hls.trigger(W.Events.BUFFER_EOS,ce),this.state=A.State.ENDED;return}var Ee=V.end,we=this.getNextFragment(Ee,Z);if(this.couldBacktrack&&!this.fragPrevious&&we&&we.sn!=="initSegment"){var Ye=we.sn-Z.startSN;Ye>1&&(we=Z.fragments[Ye-1],this.fragmentTracker.removeFragment(we))}if(we&&this.fragmentTracker.getState(we)===P.FragmentState.OK&&this.nextLoadPosition>Ee){var Ne=this.audioOnly&&!this.altAudio?E.ElementaryStreamTypes.AUDIO:E.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(b,Ne,D.PlaylistLevelType.MAIN),we=this.getNextFragment(this.nextLoadPosition,Z)}if(!we)return;we.initSegment&&!we.initSegment.data&&!this.bitrateTest&&(we=we.initSegment),((f=we.decryptdata)===null||f===void 0?void 0:f.keyFormat)==="identity"&&!((d=we.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(we,Z):this.loadFragment(we,Z,Ee)},x.loadFragment=function(f,d,a){var C,v=this.fragmentTracker.getState(f);if(this.fragCurrent=f,v===P.FragmentState.BACKTRACKED){var b=this.fragmentTracker.getBacktrackData(f);if(b){this._handleFragmentLoadProgress(b),this._handleFragmentLoadComplete(b);return}else v=P.FragmentState.NOT_LOADED}v===P.FragmentState.NOT_LOADED||v===P.FragmentState.PARTIAL?f.sn==="initSegment"?this._loadInitSegment(f):this.bitrateTest?(f.bitrateTest=!0,this.log("Fragment "+f.sn+" of level "+f.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(f)):(this.startFragRequested=!0,p.prototype.loadFragment.call(this,f,d,a)):v===P.FragmentState.APPENDING?this.reduceMaxBufferLength(f.duration)&&this.fragmentTracker.removeFragment(f):((C=this.media)===null||C===void 0?void 0:C.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},x.getAppendedFrag=function(f){var d=this.fragmentTracker.getAppendedFrag(f,D.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},x.getBufferedFrag=function(f){return this.fragmentTracker.getBufferedFrag(f,D.PlaylistLevelType.MAIN)},x.followingBufferedFrag=function(f){return f?this.getBufferedFrag(f.end+.5):null},x.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},x.nextLevelSwitch=function(){var f=this.levels,d=this.media;if(d!=null&&d.readyState){var a,C=this.getAppendedFrag(d.currentTime);if(C&&C.start>1&&this.flushMainBuffer(0,C.start-1),!d.paused&&f){var v=this.hls.nextLoadLevel,b=f[v],y=this.fragLastKbps;y&&this.fragCurrent?a=this.fragCurrent.duration*b.maxBitrate/(1e3*y)+1:a=0}else a=0;var G=this.getBufferedFrag(d.currentTime+a);if(G){var $=this.followingBufferedFrag(G);if($){this.abortCurrentFrag();var Z=$.maxStartPTS?$.maxStartPTS:$.start,V=$.duration,H=Math.max(G.end,Z+Math.min(Math.max(V-this.config.maxFragLookUpTolerance,V*.5),V*.75));this.flushMainBuffer(H,Number.POSITIVE_INFINITY)}}}},x.abortCurrentFrag=function(){var f=this.fragCurrent;this.fragCurrent=null,f!=null&&f.loader&&f.loader.abort(),this.state===A.State.KEY_LOADING&&(this.state=A.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},x.flushMainBuffer=function(f,d){p.prototype.flushMainBuffer.call(this,f,d,this.altAudio?"video":null)},x.onMediaAttached=function(f,d){p.prototype.onMediaAttached.call(this,f,d);var a=d.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 R.default(this.config,a,this.fragmentTracker,this.hls)},x.onMediaDetaching=function(){var f=this.media;f&&(f.removeEventListener("playing",this.onvplaying),f.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),p.prototype.onMediaDetaching.call(this)},x.onMediaPlaying=function(){this.tick()},x.onMediaSeeked=function(){var f=this.media,d=f?f.currentTime:null;Object(z.isFiniteNumber)(d)&&this.log("Media seeked to "+d.toFixed(3)),this.tick()},x.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(W.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},x.onManifestParsed=function(f,d){var a=!1,C=!1,v;d.levels.forEach(function(b){v=b.audioCodec,v&&(v.indexOf("mp4a.40.2")!==-1&&(a=!0),v.indexOf("mp4a.40.5")!==-1&&(C=!0))}),this.audioCodecSwitch=a&&C&&!Object(I.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=d.levels,this.startFragRequested=!1},x.onLevelLoading=function(f,d){var a=this.levels;if(!a||this.state!==A.State.IDLE)return;var C=a[d.level];(!C.details||C.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(C.details))&&(this.state=A.State.WAITING_LEVEL)},x.onLevelLoaded=function(f,d){var a,C=this.levels,v=d.level,b=d.details,y=b.totalduration;if(!C){this.warn("Levels were reset while loading level "+v);return}this.log("Level "+v+" loaded ["+b.startSN+","+b.endSN+"], cc ["+b.startCC+", "+b.endCC+"] duration:"+y);var G=this.fragCurrent;G&&(this.state===A.State.FRAG_LOADING||this.state===A.State.FRAG_LOADING_WAITING_RETRY)&&(G.level!==d.level&&G.loader&&(this.state=A.State.IDLE,G.loader.abort()));var $=C[v],Z=0;if(b.live||(a=$.details)!==null&&a!==void 0&&a.live){if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed)return;Z=this.alignPlaylists(b,$.details)}if($.details=b,this.levelLastLoaded=v,this.hls.trigger(W.Events.LEVEL_UPDATED,{details:b,level:v}),this.state===A.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(b))return;this.state=A.State.IDLE}this.startFragRequested?b.live&&this.synchronizeToLiveEdge(b):this.setStartPosition(b,Z),this.tick()},x._handleFragmentLoadProgress=function(f){var d,a=f.frag,C=f.part,v=f.payload,b=this.levels;if(!b){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var y=b[a.level],G=y.details;if(!G){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var $=y.videoCodec,Z=G.PTSKnown||!G.live,V=(d=a.initSegment)===null||d===void 0?void 0:d.data,H=this._getAudioCodec(y),re=this.transmuxer=this.transmuxer||new _.default(this.hls,D.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ce=C?C.index:-1,Ee=ce!==-1,we=new M.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,v.byteLength,ce,Ee),Ye=this.initPTS[a.cc];re.push(v,V,H,$,a,C,G.totalduration,Z,we,Ye)},x.onAudioTrackSwitching=function(f,d){var a=this.altAudio,C=!!d.url,v=d.id;if(!C){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var b=this.fragCurrent;b!=null&&b.loader&&(this.log("Switching to main audio track, cancel main fragment load"),b.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var y=this.hls;a&&y.trigger(W.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),y.trigger(W.Events.AUDIO_TRACK_SWITCHED,{id:v})}},x.onAudioTrackSwitched=function(f,d){var a=d.id,C=!!this.hls.audioTracks[a].url;if(C){var v=this.videoBuffer;v&&this.mediaBuffer!==v&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=v)}this.altAudio=C,this.tick()},x.onBufferCreated=function(f,d){var a=d.tracks,C,v,b=!1;for(var y in a){var G=a[y];if(G.id==="main"){if(v=y,C=G,y==="video"){var $=a[y];$&&(this.videoBuffer=$.buffer)}}else b=!0}b&&C?(this.log("Alternate track found, use "+v+".buffered to schedule main fragment loading"),this.mediaBuffer=C.buffer):this.mediaBuffer=this.media},x.onFragBuffered=function(f,d){var a=d.frag,C=d.part;if(a&&a.type!==D.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(C?" p: "+C.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===A.State.PARSED&&(this.state=A.State.IDLE);return}var v=C?C.stats:a.stats;this.fragLastKbps=Math.round(8*v.total/(v.buffering.end-v.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,C)},x.onError=function(f,d){switch(d.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:case k.ErrorDetails.KEY_LOAD_ERROR:case k.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.MAIN,d);break;case k.ErrorDetails.LEVEL_LOAD_ERROR:case k.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==A.State.ERROR&&(d.fatal?(this.warn(""+d.details),this.state=A.State.ERROR):!d.levelRetry&&this.state===A.State.WAITING_LEVEL&&(this.state=A.State.IDLE));break;case k.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="main"&&(this.state===A.State.PARSING||this.state===A.State.PARSED)){var a=!0,C=this.getFwdBufferInfo(this.media,D.PlaylistLevelType.MAIN);C&&C.len>.5&&(a=!this.reduceMaxBufferLength(C.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},x.checkBuffer=function(){var f=this.media,d=this.gapController;if(!f||!d||!f.readyState)return;var a=j.BufferHelper.getBuffered(f);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.poll(this.lastCurrentTime),this.lastCurrentTime=f.currentTime},x.onFragLoadEmergencyAborted=function(){this.state=A.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},x.onBufferFlushed=function(f,d){var a=d.type;if(a!==E.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var C=(a===E.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(C,a,D.PlaylistLevelType.MAIN)}},x.onLevelsUpdated=function(f,d){this.levels=d.levels},x.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},x.seekToStartPos=function(){var f=this.media,d=f.currentTime,a=this.startPosition;if(a>=0&&d<a){if(f.seeking){S.logger.log("could not seek to "+a+", already seeking at "+d);return}var C=j.BufferHelper.getBuffered(f),v=C.length?C.start(0):0,b=v-a;b>0&&(b<this.config.maxBufferHole||b<this.config.maxFragLookUpTolerance)&&(S.logger.log("adjusting start position by "+b+" to match buffer start"),a+=b,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+d),f.currentTime=a}},x._getAudioCodec=function(f){var d=this.config.defaultAudioCodec||f.audioCodec;return this.audioCodecSwap&&d&&(this.log("Swapping audio codec"),d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5"),d},x._loadBitrateTestFrag=function(f){var d=this;this._doFragLoad(f).then(function(a){var C=d.hls;if(!a||C.nextLoadLevel||d.fragContextChanged(f))return;d.fragLoadError=0,d.state=A.State.IDLE,d.startFragRequested=!1,d.bitrateTest=!1;var v=f.stats;v.parsing.start=v.parsing.end=v.buffering.start=v.buffering.end=self.performance.now(),C.trigger(W.Events.FRAG_LOADED,a)})},x._handleTransmuxComplete=function(f){var d,a="main",C=this.hls,v=f.remuxResult,b=f.chunkMeta,y=this.getCurrentContext(b);if(!y){this.warn("The loading context changed while buffering fragment "+b.sn+" of level "+b.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(b.level);return}var G=y.frag,$=y.part,Z=y.level,V=v.video,H=v.text,re=v.id3,ce=v.initSegment,Ee=this.altAudio?void 0:v.audio;if(this.fragContextChanged(G))return;if(this.state=A.State.PARSING,ce){ce.tracks&&(this._bufferInitSegment(Z,ce.tracks,G,b),C.trigger(W.Events.FRAG_PARSING_INIT_SEGMENT,{frag:G,id:a,tracks:ce.tracks}));var we=ce.initPTS,Ye=ce.timescale;Object(z.isFiniteNumber)(we)&&(this.initPTS[G.cc]=we,C.trigger(W.Events.INIT_PTS_FOUND,{frag:G,id:a,initPTS:we,timescale:Ye}))}if(V&&v.independent!==!1){if(Z.details){var Ne=V.startPTS,Ie=V.endPTS,We=V.startDTS,Ue=V.endDTS;if($)$.elementaryStreams[V.type]={startPTS:Ne,endPTS:Ie,startDTS:We,endDTS:Ue};else if(V.firstKeyFrame&&V.independent&&(this.couldBacktrack=!0),V.dropped&&V.independent){var xe=this.getLoadPosition()+this.config.maxBufferHole;if(xe<Ne){this.backtrack(G);return}G.setElementaryStreamInfo(V.type,G.start,Ie,G.start,Ue,!0)}G.setElementaryStreamInfo(V.type,Ne,Ie,We,Ue),this.bufferFragmentData(V,G,$,b)}}else if(v.independent===!1){this.backtrack(G);return}if(Ee){var se=Ee.startPTS,ke=Ee.endPTS,dt=Ee.startDTS,at=Ee.endDTS;$&&($.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:se,endPTS:ke,startDTS:dt,endDTS:at}),G.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,se,ke,dt,at),this.bufferFragmentData(Ee,G,$,b)}if(re!=null&&(d=re.samples)!==null&&d!==void 0&&d.length){var rt={frag:G,id:a,samples:re.samples};C.trigger(W.Events.FRAG_PARSING_METADATA,rt)}if(H){var lt={frag:G,id:a,samples:H.samples};C.trigger(W.Events.FRAG_PARSING_USERDATA,lt)}},x._bufferInitSegment=function(f,d,a,C){var v=this;if(this.state!==A.State.PARSING)return;this.audioOnly=!!d.audio&&!d.video,this.altAudio&&!this.audioOnly&&delete d.audio;var b=d.audio,y=d.video,G=d.audiovideo;if(b){var $=f.audioCodec,Z=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&($&&($.indexOf("mp4a.40.5")!==-1?$="mp4a.40.2":$="mp4a.40.5"),b.metadata.channelCount!==1&&Z.indexOf("firefox")===-1&&($="mp4a.40.5")),Z.indexOf("android")!==-1&&b.container!=="audio/mpeg"&&($="mp4a.40.2",this.log("Android: force audio codec to "+$)),f.audioCodec&&f.audioCodec!==$&&this.log('Swapping manifest audio codec "'+f.audioCodec+'" for "'+$+'"'),b.levelCodec=$,b.id="main",this.log("Init audio buffer, container:"+b.container+", codecs[selected/level/parsed]=["+($||"")+"/"+(f.audioCodec||"")+"/"+b.codec+"]")}y&&(y.levelCodec=f.videoCodec,y.id="main",this.log("Init video buffer, container:"+y.container+", codecs[level/parsed]=["+(f.videoCodec||"")+"/"+y.codec+"]")),G&&this.log("Init audiovideo buffer, container:"+G.container+", codecs[level/parsed]=["+(f.attrs.CODECS||"")+"/"+G.codec+"]"),this.hls.trigger(W.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(V){var H=d[V],re=H.initSegment;re!=null&&re.byteLength&&v.hls.trigger(W.Events.BUFFER_APPENDING,{type:V,data:re,frag:a,part:null,chunkMeta:C,parent:a.type})}),this.tick()},x.backtrack=function(f){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(f);var d=this.fragmentTracker.backtrack(f);this.fragPrevious=null,this.nextLoadPosition=f.start,d?this.resetFragmentLoading(f):this.state=A.State.BACKTRACKING},x.checkFragmentChanged=function(){var f=this.media,d=null;if(f&&f.readyState>1&&f.seeking===!1){var a=f.currentTime;if(j.BufferHelper.isBuffered(f,a)?d=this.getAppendedFrag(a):j.BufferHelper.isBuffered(f,a+.1)&&(d=this.getAppendedFrag(a+.1)),d){var C=this.fragPlaying,v=d.level;(!C||d.sn!==C.sn||C.level!==v||d.urlId!==C.urlId)&&(this.hls.trigger(W.Events.FRAG_CHANGED,{frag:d}),(!C||C.level!==v)&&this.hls.trigger(W.Events.LEVEL_SWITCHED,{level:v}),this.fragPlaying=d)}}},o(w,[{key:"nextLevel",get:function(){var f=this.nextBufferedFrag;return f?f.level:-1}},{key:"currentLevel",get:function(){var f=this.media;if(f){var d=this.getAppendedFrag(f.currentTime);if(d)return d.level}return-1}},{key:"nextBufferedFrag",get:function(){var f=this.media;if(f){var d=this.getAppendedFrag(f.currentTime);return this.followingBufferedFrag(d)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),w}(A.default)},"./src/controller/subtitle-stream-controller.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"SubtitleStreamController",function(){return l});var z=L("./src/events.ts"),A=L("./src/utils/logger.ts"),I=L("./src/utils/buffer-helper.ts"),W=L("./src/controller/fragment-finders.ts"),j=L("./src/utils/discontinuities.ts"),P=L("./src/controller/level-helper.ts"),D=L("./src/controller/fragment-tracker.ts"),E=L("./src/controller/base-stream-controller.ts"),_=L("./src/types/loader.ts"),M=L("./src/types/level.ts");function R(u,T){for(var m=0;m<T.length;m++){var p=T[m];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(u,p.key,p)}}function k(u,T,m){return T&&R(u.prototype,T),m&&R(u,m),u}function S(u,T){u.prototype=Object.create(T.prototype),u.prototype.constructor=u,c(u,T)}function c(u,T){return c=Object.setPrototypeOf||function(p,w){return p.__proto__=w,p},c(u,T)}var o=500,l=function(u){S(T,u);function T(p,w){var x;return x=u.call(this,p,w,"[subtitle-stream-controller]")||this,x.levels=[],x.currentTrackId=-1,x.tracksBuffered=[],x.mainDetails=null,x._registerListeners(),x}var m=T.prototype;return m.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},m._registerListeners=function(){var w=this.hls;w.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.on(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.on(z.Events.ERROR,this.onError,this),w.on(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),w.on(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),w.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),w.on(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),w.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m._unregisterListeners=function(){var w=this.hls;w.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.off(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.off(z.Events.ERROR,this.onError,this),w.off(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),w.off(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),w.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),w.off(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),w.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m.startLoad=function(){this.stopLoad(),this.state=E.State.IDLE,this.setInterval(o),this.tick()},m.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},m.onLevelLoaded=function(w,x){this.mainDetails=x.details},m.onSubtitleFragProcessed=function(w,x){var g=x.frag,f=x.success;if(this.fragPrevious=g,this.state=E.State.IDLE,!f)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var a,C=g.start,v=0;v<d.length;v++)if(C>=d[v].start&&C<=d[v].end){a=d[v];break}var b=g.start+g.duration;a?a.end=b:(a={start:C,end:b},d.push(a)),this.fragmentTracker.fragBuffered(g)},m.onBufferFlushing=function(w,x){var g=x.startOffset,f=x.endOffset;if(g===0&&f!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,a=this.levels;if(!a.length||!a[d]||!a[d].details)return;var C=a[d].details,v=C.targetduration,b=f-v;if(b<=0)return;x.endOffsetSubtitles=Math.max(0,b),this.tracksBuffered.forEach(function(y){for(var G=0;G<y.length;){if(y[G].end<=b){y.shift();continue}else if(y[G].start<b)y[G].start=b;else break;G++}}),this.fragmentTracker.removeFragmentsInRange(g,b,_.PlaylistLevelType.SUBTITLE)}},m.onError=function(w,x){var g,f=x.frag;if(!f||f.type!==_.PlaylistLevelType.SUBTITLE)return;(g=this.fragCurrent)!==null&&g!==void 0&&g.loader&&this.fragCurrent.loader.abort(),this.state=E.State.IDLE},m.onSubtitleTracksUpdated=function(w,x){var g=this,f=x.subtitleTracks;this.tracksBuffered=[],this.levels=f.map(function(d){return new M.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){g.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},m.onSubtitleTrackSwitch=function(w,x){if(this.currentTrackId=x.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)},m.onSubtitleTrackLoaded=function(w,x){var g,f=x.details,d=x.id,a=this.currentTrackId,C=this.levels;if(!C.length)return;var v=C[a];if(d>=C.length||d!==a||!v)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,f.live||(g=v.details)!==null&&g!==void 0&&g.live){var b=this.mainDetails;if(f.deltaUpdateFailed||!b)return;var y=b.fragments[0];if(!v.details)f.hasProgramDateTime&&b.hasProgramDateTime?Object(j.alignMediaPlaylistByPDT)(f,b):y&&Object(P.addSliding)(f,y.start);else{var G=this.alignPlaylists(f,v.details);G===0&&y&&Object(P.addSliding)(f,y.start)}}if(v.details=f,this.levelLastLoaded=d,this.tick(),f.live&&!this.fragCurrent&&this.media&&this.state===E.State.IDLE){var $=Object(W.findFragmentByPTS)(null,f.fragments,this.media.currentTime,0);$||(this.warn("Subtitle playlist not aligned with playback"),v.details=void 0)}},m._handleFragmentLoadComplete=function(w){var x=w.frag,g=w.payload,f=x.decryptdata,d=this.hls;if(this.fragContextChanged(x))return;if(g&&g.byteLength>0&&f&&f.key&&f.iv&&f.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(g),f.key.buffer,f.iv.buffer).then(function(C){var v=performance.now();d.trigger(z.Events.FRAG_DECRYPTED,{frag:x,payload:C,stats:{tstart:a,tdecrypt:v}})})}},m.doTick=function(){if(!this.media){this.state=E.State.IDLE;return}if(this.state===E.State.IDLE){var w,x=this.currentTrackId,g=this.levels;if(!g.length||!g[x]||!g[x].details)return;var f=g[x].details,d=f.targetduration,a=this.config,C=this.media,v=I.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,C.currentTime-d,a.maxBufferHole),b=v.end,y=v.len,G=this.getMaxBufferLength()+d;if(y>G)return;console.assert(f,"Subtitle track details are defined on idle subtitle stream controller tick");var $=f.fragments,Z=$.length,V=f.edge,H,re=this.fragPrevious;if(b<V){var ce=a.maxFragLookUpTolerance;re&&f.hasProgramDateTime&&(H=Object(W.findFragmentByPDT)($,re.endProgramDateTime,ce)),H||(H=Object(W.findFragmentByPTS)(re,$,b,ce),!H&&re&&re.start<$[0].start&&(H=$[0]))}else H=$[Z-1];(w=H)!==null&&w!==void 0&&w.encrypted?(A.logger.log("Loading key for "+H.sn),this.state=E.State.KEY_LOADING,this.hls.trigger(z.Events.KEY_LOADING,{frag:H})):H&&this.fragmentTracker.getState(H)===D.FragmentState.NOT_LOADED&&this.loadFragment(H,f,b)}},m.loadFragment=function(w,x,g){this.fragCurrent=w,u.prototype.loadFragment.call(this,w,x,g)},k(T,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),T}(E.default)},"./src/controller/subtitle-track-controller.ts":function(le,Y,L){"use strict";L.r(Y);var z=L("./src/events.ts"),A=L("./src/utils/texttrack-utils.ts"),I=L("./src/controller/base-playlist-controller.ts"),W=L("./src/types/loader.ts");function j(R,k){for(var S=0;S<k.length;S++){var c=k[S];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(R,c.key,c)}}function P(R,k,S){return k&&j(R.prototype,k),S&&j(R,S),R}function D(R,k){R.prototype=Object.create(k.prototype),R.prototype.constructor=R,E(R,k)}function E(R,k){return E=Object.setPrototypeOf||function(c,o){return c.__proto__=o,c},E(R,k)}var _=function(R){D(k,R);function k(c){var o;return o=R.call(this,c,"[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 S=k.prototype;return S.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,R.prototype.destroy.call(this)},S.registerListeners=function(){var o=this.hls;o.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(z.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var o=this.hls;o.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(z.Events.ERROR,this.onError,this)},S.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)},S.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},S.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=M(this.media.textTracks);o.forEach(function(l){Object(A.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},S.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},S.onManifestParsed=function(o,l){this.tracks=l.subtitleTracks},S.onSubtitleTrackLoaded=function(o,l){var u=l.id,T=l.details,m=this.trackId,p=this.tracksInGroup[m];if(!p){this.warn("Invalid subtitle track id "+u);return}var w=p.details;p.details=l.details,this.log("subtitle track "+u+" loaded ["+T.startSN+"-"+T.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,l,w))},S.onLevelLoading=function(o,l){this.switchLevel(l.level)},S.onLevelSwitching=function(o,l){this.switchLevel(l.level)},S.switchLevel=function(o){var l=this.hls.levels[o];if(!(l!=null&&l.textGroupIds))return;var u=l.textGroupIds[l.urlId];if(this.groupId!==u){var T=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,m=this.tracks.filter(function(x){return!u||x.groupId===u});this.tracksInGroup=m;var p=this.findTrackId(T==null?void 0:T.name)||this.findTrackId();this.groupId=u;var w={subtitleTracks:m};this.log("Updating subtitle tracks, "+m.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(z.Events.SUBTITLE_TRACKS_UPDATED,w),p!==-1&&this.setSubtitleTrack(p,T)}},S.findTrackId=function(o){for(var l=this.tracksInGroup,u=0;u<l.length;u++){var T=l[u];if((!this.selectDefaultTrack||T.default)&&(!o||o===T.name))return T.id}return-1},S.onError=function(o,l){if(R.prototype.onError.call(this,o,l),l.fatal||!l.context)return;l.context.type===W.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},S.loadPlaylist=function(o){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var u=l.id,T=l.groupId,m=l.url;if(o)try{m=o.addDirectives(m)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Loading subtitle playlist for id "+u),this.hls.trigger(z.Events.SUBTITLE_TRACK_LOADING,{url:m,id:u,groupId:T,deliveryDirectives:o||null})}},S.toggleTrackModes=function(o){var l=this,u=this.media,T=this.subtitleDisplay,m=this.trackId;if(!u)return;var p=M(u.textTracks),w=p.filter(function(f){return f.groupId===l.groupId});if(o===-1)[].slice.call(p).forEach(function(f){f.mode="disabled"});else{var x=w[m];x&&(x.mode="disabled")}var g=w[o];g&&(g.mode=T?"showing":"hidden")},S.setSubtitleTrack=function(o,l){var u,T=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(u=T[o])!==null&&u!==void 0&&u.details)||o<-1||o>=T.length)return;this.clearTimer();var m=T[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,m){var p=m.id,w=m.groupId,x=w===void 0?"":w,g=m.name,f=m.type,d=m.url;this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:p,groupId:x,name:g,type:f,url:d});var a=this.switchParams(m.url,l==null?void 0:l.details);this.loadPlaylist(a)}else this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:o})},S.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,l=M(this.media.textTracks),u=0;u<l.length;u++)if(l[u].mode==="hidden")o=u;else if(l[u].mode==="showing"){o=u;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},P(k,[{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)}}]),k}(I.default);function M(R){for(var k=[],S=0;S<R.length;S++){var c=R[S];c.kind==="subtitles"&&c.label&&k.push(R[S])}return k}Y.default=_},"./src/controller/timeline-controller.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"TimelineController",function(){return M});var z=L("./src/polyfills/number.ts"),A=L("./src/events.ts"),I=L("./src/utils/cea-608-parser.ts"),W=L("./src/utils/output-filter.ts"),j=L("./src/utils/webvtt-parser.ts"),P=L("./src/utils/texttrack-utils.ts"),D=L("./src/utils/imsc1-ttml-parser.ts"),E=L("./src/types/loader.ts"),_=L("./src/utils/logger.ts"),M=function(){function c(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=S(),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 u=new W.default(this,"textTrack1"),T=new W.default(this,"textTrack2"),m=new W.default(this,"textTrack3"),p=new W.default(this,"textTrack4");this.cea608Parser1=new I.default(1,u,T),this.cea608Parser2=new I.default(3,m,p)}l.on(A.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(A.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(A.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(A.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(A.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(A.Events.FRAG_LOADING,this.onFragLoading,this),l.on(A.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(A.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(A.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(A.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(A.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(A.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=c.prototype;return o.destroy=function(){var u=this.hls;u.off(A.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.off(A.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(A.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(A.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.off(A.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(A.Events.FRAG_LOADING,this.onFragLoading,this),u.off(A.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(A.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.off(A.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.off(A.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(A.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.off(A.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(u,T,m,p,w){for(var x=!1,g=w.length;g--;){var f=w[g],d=k(f[0],f[1],T,m);if(d>=0&&(f[0]=Math.min(f[0],T),f[1]=Math.max(f[1],m),x=!0,d/(m-T)>.5))return}if(x||w.push([T,m]),this.config.renderTextTracksNatively){var a=this.captionsTracks[u];this.Cues.newCue(a,T,m,p)}else{var C=this.Cues.newCue(null,T,m,p);this.hls.trigger(A.Events.CUES_PARSED,{type:"captions",cues:C,track:u})}},o.onInitPtsFound=function(u,T){var m=this,p=T.frag,w=T.id,x=T.initPTS,g=T.timescale,f=this.unparsedVttFrags;w==="main"&&(this.initPTS[p.cc]=x,this.timescale[p.cc]=g),f.length&&(this.unparsedVttFrags=[],f.forEach(function(d){m.onFragLoaded(A.Events.FRAG_LOADED,d)}))},o.getExistingTrack=function(u){var T=this.media;if(T)for(var m=0;m<T.textTracks.length;m++){var p=T.textTracks[m];if(p[u])return p}return null},o.createCaptionsTrack=function(u){this.config.renderTextTracksNatively?this.createNativeTrack(u):this.createNonNativeTrack(u)},o.createNativeTrack=function(u){if(this.captionsTracks[u])return;var T=this.captionsProperties,m=this.captionsTracks,p=this.media,w=T[u],x=w.label,g=w.languageCode,f=this.getExistingTrack(u);if(f)m[u]=f,Object(P.clearCurrentCues)(m[u]),Object(P.sendAddTrackEvent)(m[u],p);else{var d=this.createTextTrack("captions",x,g);d&&(d[u]=!0,m[u]=d)}},o.createNonNativeTrack=function(u){if(this.nonNativeCaptionsTracks[u])return;var T=this.captionsProperties[u];if(!T)return;var m=T.label,p={_id:u,label:m,kind:"captions",default:T.media?!!T.media.default:!1,closedCaptions:T.media};this.nonNativeCaptionsTracks[u]=p,this.hls.trigger(A.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[p]})},o.createTextTrack=function(u,T,m){var p=this.media;return p?p.addTextTrack(u,T,m):void 0},o.onMediaAttaching=function(u,T){this.media=T.media,this._cleanTracks()},o.onMediaDetaching=function(){var u=this.captionsTracks;Object.keys(u).forEach(function(T){Object(P.clearCurrentCues)(u[T]),delete u[T]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=S(),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 u=this.media;if(!u)return;var T=u.textTracks;if(T)for(var m=0;m<T.length;m++)Object(P.clearCurrentCues)(T[m])},o.onSubtitleTracksUpdated=function(u,T){var m=this;this.textTracks=[];var p=T.subtitleTracks||[],w=p.some(function(d){return d.textCodec===D.IMSC1_CODEC});if(this.config.enableWebVTT||w&&this.config.enableIMSC1){var x=this.tracks&&p&&this.tracks.length===p.length;if(this.tracks=p||[],this.config.renderTextTracksNatively){var g=this.media?this.media.textTracks:[];this.tracks.forEach(function(d,a){var C;if(a<g.length){for(var v=null,b=0;b<g.length;b++)if(R(g[b],d)){v=g[b];break}v&&(C=v)}C?Object(P.clearCurrentCues)(C):(C=m.createTextTrack("subtitles",d.name,d.lang),C&&(C.mode="disabled")),C&&(C.groupId=d.groupId,m.textTracks.push(C))})}else if(!x&&this.tracks&&this.tracks.length){var f=this.tracks.map(function(d){return{label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}});this.hls.trigger(A.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:f})}}},o.onManifestLoaded=function(u,T){var m=this;this.config.enableCEA708Captions&&T.captions&&T.captions.forEach(function(p){var w=/(?:CC|SERVICE)([1-4])/.exec(p.instreamId);if(!w)return;var x="textTrack"+w[1],g=m.captionsProperties[x];if(!g)return;g.label=p.name,p.lang&&(g.languageCode=p.lang),g.media=p})},o.onFragLoading=function(u,T){var m=this.cea608Parser1,p=this.cea608Parser2,w=this.lastSn,x=this.lastPartIndex;if(!this.enabled||!(m&&p))return;if(T.frag.type===E.PlaylistLevelType.MAIN){var g,f,d=T.frag.sn,a=(g=T==null||((f=T.part)===null||f===void 0)?void 0:f.index)!=null?g:-1;d===w+1||d===w&&a===x+1||(m.reset(),p.reset()),this.lastSn=d,this.lastPartIndex=a}},o.onFragLoaded=function(u,T){var m=T.frag,p=T.payload,w=this.initPTS,x=this.unparsedVttFrags;if(m.type===E.PlaylistLevelType.SUBTITLE)if(p.byteLength){if(!Object(z.isFiniteNumber)(w[m.cc])){x.push(T),w.length&&this.hls.trigger(A.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:m,error:new Error("Missing initial subtitle PTS")});return}var g=m.decryptdata;if(g==null||g.key==null||g.method!=="AES-128"){var f=this.tracks[m.level],d=this.vttCCs;d[m.cc]||(d[m.cc]={start:m.start,prevCC:this.prevCC,new:!0},this.prevCC=m.cc),f&&f.textCodec===D.IMSC1_CODEC?this._parseIMSC1(m,p):this._parseVTTs(m,p,d)}}else this.hls.trigger(A.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:m,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(u,T){var m=this,p=this.hls;Object(D.parseIMSC1)(T,this.initPTS[u.cc],this.timescale[u.cc],function(w){m._appendCues(w,u.level),p.trigger(A.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(w){_.logger.log("Failed to parse IMSC1: "+w),p.trigger(A.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:w})})},o._parseVTTs=function(u,T,m){var p=this,w=this.hls;Object(j.parseWebVTT)(T,this.initPTS[u.cc],this.timescale[u.cc],m,u.cc,u.start,function(x){p._appendCues(x,u.level),w.trigger(A.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(x){p._fallbackToIMSC1(u,T),_.logger.log("Failed to parse VTT cue: "+x),w.trigger(A.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:x})})},o._fallbackToIMSC1=function(u,T){var m=this,p=this.tracks[u.level];p.textCodec||Object(D.parseIMSC1)(T,this.initPTS[u.cc],this.timescale[u.cc],function(){p.textCodec=D.IMSC1_CODEC,m._parseIMSC1(u,T)},function(){p.textCodec="wvtt"})},o._appendCues=function(u,T){var m=this.hls;if(this.config.renderTextTracksNatively){var p=this.textTracks[T];if(p.mode==="disabled")return;u.forEach(function(g){return Object(P.addCueToTrack)(p,g)})}else{var w=this.tracks[T],x=w.default?"default":"subtitles"+T;m.trigger(A.Events.CUES_PARSED,{type:"subtitles",cues:u,track:x})}},o.onFragDecrypted=function(u,T){var m=T.frag;if(m.type===E.PlaylistLevelType.SUBTITLE){if(!Object(z.isFiniteNumber)(this.initPTS[m.cc])){this.unparsedVttFrags.push(T);return}this.onFragLoaded(A.Events.FRAG_LOADED,T)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(u,T){var m=this.cea608Parser1,p=this.cea608Parser2;if(!this.enabled||!(m&&p))return;for(var w=0;w<T.samples.length;w++){var x=T.samples[w].bytes;if(x){var g=this.extractCea608Data(x);m.addData(T.samples[w].pts,g[0]),p.addData(T.samples[w].pts,g[1])}}},o.onBufferFlushing=function(u,T){var m=T.startOffset,p=T.endOffset,w=T.endOffsetSubtitles,x=T.type,g=this.media;if(!g||g.currentTime<p)return;if(!x||x==="video"){var f=this.captionsTracks;Object.keys(f).forEach(function(a){return Object(P.removeCuesInRange)(f[a],m,p)})}if(this.config.renderTextTracksNatively&&(m===0&&w!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(a){return Object(P.removeCuesInRange)(d[a],m,w)})}},o.extractCea608Data=function(u){for(var T=u[0]&31,m=2,p=[[],[]],w=0;w<T;w++){var x=u[m++],g=127&u[m++],f=127&u[m++],d=(4&x)!==0,a=3&x;if(g===0&&f===0)continue;d&&((a===0||a===1)&&(p[a].push(g),p[a].push(f)))}return p},c}();function R(c,o){return c&&c.label===o.name&&!(c.textTrack1||c.textTrack2)}function k(c,o,l,u){return Math.min(o,u)-Math.max(c,l)}function S(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return z});var z=function(){function A(W,j){this.subtle=void 0,this.aesIV=void 0,this.subtle=W,this.aesIV=j}var I=A.prototype;return I.decrypt=function(j,P){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},P,j)},A}()},"./src/crypt/aes-decryptor.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"removePadding",function(){return A}),L.d(Y,"default",function(){return I});var z=L("./src/utils/typed-array.ts");function A(W){var j=W.byteLength,P=j&&new DataView(W.buffer).getUint8(j-1);return P?Object(z.sliceUint8)(W,0,j-P):W}var I=function(){function W(){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 j=W.prototype;return j.uint8ArrayToUint32Array_=function(D){for(var E=new DataView(D),_=new Uint32Array(4),M=0;M<4;M++)_[M]=E.getUint32(M*4);return _},j.initTable=function(){var D=this.sBox,E=this.invSBox,_=this.subMix,M=_[0],R=_[1],k=_[2],S=_[3],c=this.invSubMix,o=c[0],l=c[1],u=c[2],T=c[3],m=new Uint32Array(256),p=0,w=0,x=0;for(x=0;x<256;x++)x<128?m[x]=x<<1:m[x]=x<<1^283;for(x=0;x<256;x++){var g=w^w<<1^w<<2^w<<3^w<<4;g=g>>>8^g&255^99,D[p]=g,E[g]=p;var f=m[p],d=m[f],a=m[d],C=m[g]*257^g*16843008;M[p]=C<<24|C>>>8,R[p]=C<<16|C>>>16,k[p]=C<<8|C>>>24,S[p]=C,C=a*16843009^d*65537^f*257^p*16843008,o[g]=C<<24|C>>>8,l[g]=C<<16|C>>>16,u[g]=C<<8|C>>>24,T[g]=C,p?(p=f^m[m[m[a^f]]],w^=m[m[w]]):p=w=1}},j.expandKey=function(D){for(var E=this.uint8ArrayToUint32Array_(D),_=!0,M=0;M<E.length&&_;)_=E[M]===this.key[M],M++;if(_)return;this.key=E;var R=this.keySize=E.length;if(R!==4&&R!==6&&R!==8)throw new Error("Invalid aes key size="+R);var k=this.ksRows=(R+6+1)*4,S,c,o=this.keySchedule=new Uint32Array(k),l=this.invKeySchedule=new Uint32Array(k),u=this.sBox,T=this.rcon,m=this.invSubMix,p=m[0],w=m[1],x=m[2],g=m[3],f,d;for(S=0;S<k;S++){if(S<R){f=o[S]=E[S];continue}d=f,S%R===0?(d=d<<8|d>>>24,d=u[d>>>24]<<24|u[d>>>16&255]<<16|u[d>>>8&255]<<8|u[d&255],d^=T[S/R|0]<<24):R>6&&S%R===4&&(d=u[d>>>24]<<24|u[d>>>16&255]<<16|u[d>>>8&255]<<8|u[d&255]),o[S]=f=(o[S-R]^d)>>>0}for(c=0;c<k;c++)S=k-c,c&3?d=o[S]:d=o[S-4],c<4||S<=4?l[c]=d:l[c]=p[u[d>>>24]]^w[u[d>>>16&255]]^x[u[d>>>8&255]]^g[u[d&255]],l[c]=l[c]>>>0},j.networkToHostOrderSwap=function(D){return D<<24|(D&65280)<<8|(D&16711680)>>8|D>>>24},j.decrypt=function(D,E,_){for(var M=this.keySize+6,R=this.invKeySchedule,k=this.invSBox,S=this.invSubMix,c=S[0],o=S[1],l=S[2],u=S[3],T=this.uint8ArrayToUint32Array_(_),m=T[0],p=T[1],w=T[2],x=T[3],g=new Int32Array(D),f=new Int32Array(g.length),d,a,C,v,b,y,G,$,Z,V,H,re,ce,Ee,we=this.networkToHostOrderSwap;E<g.length;){for(Z=we(g[E]),V=we(g[E+1]),H=we(g[E+2]),re=we(g[E+3]),b=Z^R[0],y=re^R[1],G=H^R[2],$=V^R[3],ce=4,Ee=1;Ee<M;Ee++)d=c[b>>>24]^o[y>>16&255]^l[G>>8&255]^u[$&255]^R[ce],a=c[y>>>24]^o[G>>16&255]^l[$>>8&255]^u[b&255]^R[ce+1],C=c[G>>>24]^o[$>>16&255]^l[b>>8&255]^u[y&255]^R[ce+2],v=c[$>>>24]^o[b>>16&255]^l[y>>8&255]^u[G&255]^R[ce+3],b=d,y=a,G=C,$=v,ce=ce+4;d=k[b>>>24]<<24^k[y>>16&255]<<16^k[G>>8&255]<<8^k[$&255]^R[ce],a=k[y>>>24]<<24^k[G>>16&255]<<16^k[$>>8&255]<<8^k[b&255]^R[ce+1],C=k[G>>>24]<<24^k[$>>16&255]<<16^k[b>>8&255]<<8^k[y&255]^R[ce+2],v=k[$>>>24]<<24^k[b>>16&255]<<16^k[y>>8&255]<<8^k[G&255]^R[ce+3],f[E]=we(d^m),f[E+1]=we(v^p),f[E+2]=we(C^w),f[E+3]=we(a^x),m=Z,p=V,w=H,x=re,E=E+4}return f.buffer},W}()},"./src/crypt/decrypter.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return E});var z=L("./src/crypt/aes-crypto.ts"),A=L("./src/crypt/fast-aes-key.ts"),I=L("./src/crypt/aes-decryptor.ts"),W=L("./src/utils/logger.ts"),j=L("./src/utils/mp4-tools.ts"),P=L("./src/utils/typed-array.ts"),D=16,E=function(){function _(R,k,S){var c=S===void 0?{}:S,o=c.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=R,this.config=k,this.removePKCS7Padding=l,l)try{var u=self.crypto;u&&(this.subtle=u.subtle||u.webkitSubtle)}catch(T){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var M=_.prototype;return M.destroy=function(){this.observer=null},M.isSync=function(){return this.config.enableSoftwareAES},M.flush=function(){var k=this.currentResult;if(!k){this.reset();return}var S=new Uint8Array(k);return this.reset(),this.removePKCS7Padding?Object(I.removePadding)(S):S},M.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},M.decrypt=function(k,S,c,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(k),S,c);var l=this.flush();l&&o(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(k),S,c).then(o)},M.softwareDecrypt=function(k,S,c){var o=this.currentIV,l=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(k=Object(j.appendUint8Array)(u,k),this.remainderData=null);var T=this.getValidChunk(k);if(!T.length)return null;o&&(c=o);var m=this.softwareDecrypter;m||(m=this.softwareDecrypter=new I.default),m.expandKey(S);var p=l;return this.currentResult=m.decrypt(T.buffer,0,c),this.currentIV=Object(P.sliceUint8)(T,-16).buffer,p||null},M.webCryptoDecrypt=function(k,S,c){var o=this,l=this.subtle;return(this.key!==S||!this.fastAesKey)&&(this.key=S,this.fastAesKey=new A.default(l,S)),this.fastAesKey.expandKey().then(function(u){if(!l)return Promise.reject(new Error("web crypto not initialized"));var T=new z.default(l,c);return T.decrypt(k.buffer,u)}).catch(function(u){return o.onWebCryptoError(u,k,S,c)})},M.onWebCryptoError=function(k,S,c,o){return W.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",k),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(S,c,o)},M.getValidChunk=function(k){var S=k,c=k.length-k.length%D;return c!==k.length&&(S=Object(P.sliceUint8)(k,0,c),this.remainderData=Object(P.sliceUint8)(k,c)),S},M.logOnce=function(k){if(!this.logEnabled)return;W.logger.log("[decrypter.ts]: "+k),this.logEnabled=!1},_}()},"./src/crypt/fast-aes-key.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return z});var z=function(){function A(W,j){this.subtle=void 0,this.key=void 0,this.subtle=W,this.key=j}var I=A.prototype;return I.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},A}()},"./src/demux/aacdemuxer.ts":function(le,Y,L){"use strict";L.r(Y);var z=L("./src/demux/base-audio-demuxer.ts"),A=L("./src/demux/adts.ts"),I=L("./src/utils/logger.ts"),W=L("./src/demux/id3.ts");function j(E,_){E.prototype=Object.create(_.prototype),E.prototype.constructor=E,P(E,_)}function P(E,_){return P=Object.setPrototypeOf||function(R,k){return R.__proto__=k,R},P(E,_)}var D=function(E){j(_,E);function _(R,k){var S;return S=E.call(this)||this,S.observer=void 0,S.config=void 0,S.observer=R,S.config=k,S}var M=_.prototype;return M.resetInitSegment=function(k,S,c){E.prototype.resetInitSegment.call(this,k,S,c),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:k,duration:c,inputTimeScale:9e4,dropped:0}},_.probe=function(k){if(!k)return!1;for(var S=W.getID3Data(k,0)||[],c=S.length,o=k.length;c<o;c++)if(A.probe(k,c))return I.logger.log("ADTS sync word found !"),!0;return!1},M.canParse=function(k,S){return A.canParse(k,S)},M.appendFrame=function(k,S,c){A.initTrackConfig(k,this.observer,S,c,k.manifestCodec);var o=A.appendFrame(k,S,c,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},_}(z.default);D.minProbeByteLength=9,Y.default=D},"./src/demux/adts.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"getAudioConfig",function(){return W}),L.d(Y,"isHeaderPattern",function(){return j}),L.d(Y,"getHeaderLength",function(){return P}),L.d(Y,"getFullFrameLength",function(){return D}),L.d(Y,"canGetFrameLength",function(){return E}),L.d(Y,"isHeader",function(){return _}),L.d(Y,"canParse",function(){return M}),L.d(Y,"probe",function(){return R}),L.d(Y,"initTrackConfig",function(){return k}),L.d(Y,"getFrameDuration",function(){return S}),L.d(Y,"parseFrameHeader",function(){return c}),L.d(Y,"appendFrame",function(){return o});var z=L("./src/utils/logger.ts"),A=L("./src/errors.ts"),I=L("./src/events.ts");function W(l,u,T,m){var p,w,x,g,f=navigator.userAgent.toLowerCase(),d=m,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];p=((u[T+2]&192)>>>6)+1;var C=(u[T+2]&60)>>>2;if(C>a.length-1){l.trigger(I.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+C});return}return x=(u[T+2]&1)<<2,x|=(u[T+3]&192)>>>6,z.logger.log("manifest codec:"+m+", ADTS type:"+p+", samplingIndex:"+C),/firefox/i.test(f)?C>=6?(p=5,g=new Array(4),w=C-3):(p=2,g=new Array(2),w=C):f.indexOf("android")!==-1?(p=2,g=new Array(2),w=C):(p=5,g=new Array(4),m&&(m.indexOf("mp4a.40.29")!==-1||m.indexOf("mp4a.40.5")!==-1)||!m&&C>=6?w=C-3:((m&&m.indexOf("mp4a.40.2")!==-1&&(C>=6&&x===1||/vivaldi/i.test(f))||!m&&x===1)&&(p=2,g=new Array(2)),w=C)),g[0]=p<<3,g[0]|=(C&14)>>1,g[1]|=(C&1)<<7,g[1]|=x<<3,p===5&&(g[1]|=(w&14)>>1,g[2]=(w&1)<<7,g[2]|=2<<2,g[3]=0),{config:g,samplerate:a[C],channelCount:x,codec:"mp4a.40."+p,manifestCodec:d}}function j(l,u){return l[u]===255&&(l[u+1]&246)===240}function P(l,u){return l[u+1]&1?7:9}function D(l,u){return(l[u+3]&3)<<11|l[u+4]<<3|(l[u+5]&224)>>>5}function E(l,u){return u+5<l.length}function _(l,u){return u+1<l.length&&j(l,u)}function M(l,u){return E(l,u)&&j(l,u)&&D(l,u)<=l.length-u}function R(l,u){if(_(l,u)){var T=P(l,u);if(u+T>=l.length)return!1;var m=D(l,u);if(m<=T)return!1;var p=u+m;return p===l.length||_(l,p)}return!1}function k(l,u,T,m,p){if(!l.samplerate){var w=W(u,T,m,p);if(!w)return;l.config=w.config,l.samplerate=w.samplerate,l.channelCount=w.channelCount,l.codec=w.codec,l.manifestCodec=w.manifestCodec,z.logger.log("parsed codec:"+l.codec+", rate:"+w.samplerate+", channels:"+w.channelCount)}}function S(l){return 1024*9e4/l}function c(l,u,T,m,p){var w=P(l,u),x=D(l,u);if(x-=w,x>0){var g=T+m*p;return{headerLength:w,frameLength:x,stamp:g}}}function o(l,u,T,m,p){var w=S(l.samplerate),x=c(u,T,m,p,w);if(x){var g=x.frameLength,f=x.headerLength,d=x.stamp,a=f+g,C=Math.max(0,T+a-u.length),v;C?(v=new Uint8Array(a-f),v.set(u.subarray(T+f,u.length),0)):v=u.subarray(T+f,T+a);var b={unit:v,pts:d};return C||l.samples.push(b),{sample:b,length:a,missing:C}}}},"./src/demux/base-audio-demuxer.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"initPTSFn",function(){return D});var z=L("./src/polyfills/number.ts"),A=L("./src/demux/id3.ts"),I=L("./src/demux/dummy-demuxed-track.ts"),W=L("./src/utils/mp4-tools.ts"),j=L("./src/utils/typed-array.ts"),P=function(){function E(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var _=E.prototype;return _.resetInitSegment=function(R,k,S){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},_.resetTimeStamp=function(){},_.resetContiguity=function(){},_.canParse=function(R,k){return!1},_.appendFrame=function(R,k,S){},_.demux=function(R,k){this.cachedData&&(R=Object(W.appendUint8Array)(this.cachedData,R),this.cachedData=null);var S=A.getID3Data(R,0),c=S?S.length:0,o,l,u=this._audioTrack,T=this._id3Track,m=S?A.getTimeStamp(S):void 0,p=R.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=D(m,k)),S&&S.length>0&&T.samples.push({pts:this.initPTS,dts:this.initPTS,data:S}),l=this.initPTS;c<p;){if(this.canParse(R,c)){var w=this.appendFrame(u,R,c);w?(this.frameIndex++,l=w.sample.pts,c+=w.length,o=c):c=p}else A.canParse(R,c)?(S=A.getID3Data(R,c),T.samples.push({pts:l,dts:l,data:S}),c+=S.length,o=c):c++;if(c===p&&o!==p){var x=Object(j.sliceUint8)(R,o);this.cachedData?this.cachedData=Object(W.appendUint8Array)(this.cachedData,x):this.cachedData=x}}return{audioTrack:u,avcTrack:Object(I.dummyTrack)(),id3Track:T,textTrack:Object(I.dummyTrack)()}},_.demuxSampleAes=function(R,k,S){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},_.flush=function(R){var k=this.cachedData;return k&&(this.cachedData=null,this.demux(k,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(I.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(I.dummyTrack)()}},_.destroy=function(){},E}(),D=function(_,M){return Object(z.isFiniteNumber)(_)?_*90:M*9e4};Y.default=P},"./src/demux/chunk-cache.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return z});var z=function(){function I(){this.chunks=[],this.dataLength=0}var W=I.prototype;return W.push=function(P){this.chunks.push(P),this.dataLength+=P.length},W.flush=function(){var P=this.chunks,D=this.dataLength,E;if(P.length)P.length===1?E=P[0]:E=A(P,D);else return new Uint8Array(0);return this.reset(),E},W.reset=function(){this.chunks.length=0,this.dataLength=0},I}();function A(I,W){for(var j=new Uint8Array(W),P=0,D=0;D<I.length;D++){var E=I[D];j.set(E,P),P+=E.length}return j}},"./src/demux/dummy-demuxed-track.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"dummyTrack",function(){return z});function z(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(le,Y,L){"use strict";L.r(Y);var z=L("./src/utils/logger.ts"),A=function(){function I(j){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=j,this.bytesAvailable=j.byteLength,this.word=0,this.bitsAvailable=0}var W=I.prototype;return W.loadWord=function(){var P=this.data,D=this.bytesAvailable,E=P.byteLength-D,_=new Uint8Array(4),M=Math.min(4,D);if(M===0)throw new Error("no bytes available");_.set(P.subarray(E,E+M)),this.word=new DataView(_.buffer).getUint32(0),this.bitsAvailable=M*8,this.bytesAvailable-=M},W.skipBits=function(P){var D;this.bitsAvailable>P?(this.word<<=P,this.bitsAvailable-=P):(P-=this.bitsAvailable,D=P>>3,P-=D>>3,this.bytesAvailable-=D,this.loadWord(),this.word<<=P,this.bitsAvailable-=P)},W.readBits=function(P){var D=Math.min(this.bitsAvailable,P),E=this.word>>>32-D;return P>32&&z.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=D,this.bitsAvailable>0?this.word<<=D:this.bytesAvailable>0&&this.loadWord(),D=P-D,D>0&&this.bitsAvailable?E<<D|this.readBits(D):E},W.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()},W.skipUEG=function(){this.skipBits(1+this.skipLZ())},W.skipEG=function(){this.skipBits(1+this.skipLZ())},W.readUEG=function(){var P=this.skipLZ();return this.readBits(P+1)-1},W.readEG=function(){var P=this.readUEG();return 1&P?1+P>>>1:-1*(P>>>1)},W.readBoolean=function(){return this.readBits(1)===1},W.readUByte=function(){return this.readBits(8)},W.readUShort=function(){return this.readBits(16)},W.readUInt=function(){return this.readBits(32)},W.skipScalingList=function(P){for(var D=8,E=8,_,M=0;M<P;M++)E!==0&&(_=this.readEG(),E=(D+_+256)%256),D=E===0?D:E},W.readSPS=function(){var P=0,D=0,E=0,_=0,M,R,k,S=this.readUByte.bind(this),c=this.readBits.bind(this),o=this.readUEG.bind(this),l=this.readBoolean.bind(this),u=this.skipBits.bind(this),T=this.skipEG.bind(this),m=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);S();var w=S();if(c(5),u(3),S(),m(),w===100||w===110||w===122||w===244||w===44||w===83||w===86||w===118||w===128){var x=o();if(x===3&&u(1),m(),m(),u(1),l())for(R=x!==3?8:12,k=0;k<R;k++)l()&&(k<6?p(16):p(64))}m();var g=o();if(g===0)o();else if(g===1)for(u(1),T(),T(),M=o(),k=0;k<M;k++)T();m(),u(1);var f=o(),d=o(),a=c(1);a===0&&u(1),u(1),l()&&(P=o(),D=o(),E=o(),_=o());var C=[1,1];if(l()&&l()){var v=S();switch(v){case 1:C=[1,1];break;case 2:C=[12,11];break;case 3:C=[10,11];break;case 4:C=[16,11];break;case 5:C=[40,33];break;case 6:C=[24,11];break;case 7:C=[20,11];break;case 8:C=[32,11];break;case 9:C=[80,33];break;case 10:C=[18,11];break;case 11:C=[15,11];break;case 12:C=[64,33];break;case 13:C=[160,99];break;case 14:C=[4,3];break;case 15:C=[3,2];break;case 16:C=[2,1];break;case 255:{C=[S()<<8|S(),S()<<8|S()];break}}}return{width:Math.ceil((f+1)*16-P*2-D*2),height:(2-a)*(d+1)*16-(a?2:4)*(E+_),pixelRatio:C}},W.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},I}();Y.default=A},"./src/demux/id3.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"isHeader",function(){return z}),L.d(Y,"isFooter",function(){return A}),L.d(Y,"getID3Data",function(){return I}),L.d(Y,"canParse",function(){return j}),L.d(Y,"getTimeStamp",function(){return P}),L.d(Y,"isTimeStampFrame",function(){return D}),L.d(Y,"getID3Frames",function(){return _}),L.d(Y,"decodeFrame",function(){return M}),L.d(Y,"utf8ArrayToStr",function(){return o}),L.d(Y,"testables",function(){return l});var z=function(p,w){return w+10<=p.length&&(p[w]===73&&p[w+1]===68&&p[w+2]===51&&(p[w+3]<255&&p[w+4]<255&&(p[w+6]<128&&p[w+7]<128&&p[w+8]<128&&p[w+9]<128)))},A=function(p,w){return w+10<=p.length&&(p[w]===51&&p[w+1]===68&&p[w+2]===73&&(p[w+3]<255&&p[w+4]<255&&(p[w+6]<128&&p[w+7]<128&&p[w+8]<128&&p[w+9]<128)))},I=function(p,w){for(var x=w,g=0;z(p,w);){g+=10;var f=W(p,w+6);g+=f,A(p,w+10)&&(g+=10),w+=g}return g>0?p.subarray(x,x+g):void 0},W=function(p,w){var x=0;return x=(p[w]&127)<<21,x|=(p[w+1]&127)<<14,x|=(p[w+2]&127)<<7,x|=p[w+3]&127,x},j=function(p,w){return z(p,w)&&W(p,w+6)+10<=p.length-w},P=function(p){for(var w=_(p),x=0;x<w.length;x++){var g=w[x];if(D(g))return c(g)}return},D=function(p){return p&&p.key==="PRIV"&&p.info==="com.apple.streaming.transportStreamTimestamp"},E=function(p){var w=String.fromCharCode(p[0],p[1],p[2],p[3]),x=W(p,4),g=10;return{type:w,size:x,data:p.subarray(g,g+x)}},_=function(p){for(var w=0,x=[];z(p,w);){var g=W(p,w+6);w+=10;for(var f=w+g;w+8<f;){var d=E(p.subarray(w)),a=M(d);a&&x.push(a),w+=d.size+10}A(p,w)&&(w+=10)}return x},M=function(p){return p.type==="PRIV"?R(p):p.type[0]==="W"?S(p):k(p)},R=function(p){if(p.size<2)return;var w=o(p.data,!0),x=new Uint8Array(p.data.subarray(w.length+1));return{key:p.type,info:w,data:x.buffer}},k=function(p){if(p.size<2)return;if(p.type==="TXXX"){var w=1,x=o(p.data.subarray(w),!0);w+=x.length+1;var g=o(p.data.subarray(w));return{key:p.type,info:x,data:g}}var f=o(p.data.subarray(1));return{key:p.type,data:f}},S=function(p){if(p.type==="WXXX"){if(p.size<2)return;var w=1,x=o(p.data.subarray(w),!0);w+=x.length+1;var g=o(p.data.subarray(w));return{key:p.type,info:x,data:g}}var f=o(p.data);return{key:p.type,data:f}},c=function(p){if(p.data.byteLength===8){var w=new Uint8Array(p.data),x=w[3]&1,g=(w[4]<<23)+(w[5]<<15)+(w[6]<<7)+w[7];return g/=45,x&&(g+=4772185884e-2),Math.round(g)}return},o=function(p,w){w===void 0&&(w=!1);var x=T();if(x){var g=x.decode(p);if(w){var f=g.indexOf("\0");return f!==-1?g.substring(0,f):g}return g.replace(/\0/g,"")}for(var d=p.length,a,C,v,b="",y=0;y<d;){if(a=p[y++],a===0&&w)return b;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:b+=String.fromCharCode(a);break;case 12:case 13:C=p[y++],b+=String.fromCharCode((a&31)<<6|C&63);break;case 14:C=p[y++],v=p[y++],b+=String.fromCharCode((a&15)<<12|(C&63)<<6|(v&63)<<0);break;default:}}return b},l={decodeTextFrame:k},u;function T(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(le,Y,L){"use strict";L.r(Y);var z=L("./src/demux/base-audio-demuxer.ts"),A=L("./src/demux/id3.ts"),I=L("./src/utils/logger.ts"),W=L("./src/demux/mpegaudio.ts");function j(E,_){E.prototype=Object.create(_.prototype),E.prototype.constructor=E,P(E,_)}function P(E,_){return P=Object.setPrototypeOf||function(R,k){return R.__proto__=k,R},P(E,_)}var D=function(E){j(_,E);function _(){return E.apply(this,arguments)||this}var M=_.prototype;return M.resetInitSegment=function(k,S,c){E.prototype.resetInitSegment.call(this,k,S,c),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:k,duration:c,inputTimeScale:9e4,dropped:0}},_.probe=function(k){if(!k)return!1;for(var S=A.getID3Data(k,0)||[],c=S.length,o=k.length;c<o;c++)if(W.probe(k,c))return I.logger.log("MPEG Audio sync word found !"),!0;return!1},M.canParse=function(k,S){return W.canParse(k,S)},M.appendFrame=function(k,S,c){return this.initPTS===null?void 0:W.appendFrame(k,S,c,this.initPTS,this.frameIndex)},_}(z.default);D.minProbeByteLength=4,Y.default=D},"./src/demux/mp4demuxer.ts":function(le,Y,L){"use strict";L.r(Y);var z=L("./src/utils/mp4-tools.ts"),A=L("./src/demux/dummy-demuxed-track.ts"),I=function(){function W(P,D){this.remainderData=null,this.config=void 0,this.config=D}var j=W.prototype;return j.resetTimeStamp=function(){},j.resetInitSegment=function(){},j.resetContiguity=function(){},W.probe=function(D){return Object(z.findBox)({data:D,start:0,end:Math.min(D.length,16384)},["moof"]).length>0},j.demux=function(D){var E=D,_=Object(A.dummyTrack)();if(this.config.progressive){this.remainderData&&(E=Object(z.appendUint8Array)(this.remainderData,D));var M=Object(z.segmentValidRange)(E);this.remainderData=M.remainder,_.samples=M.valid||new Uint8Array}else _.samples=E;return{audioTrack:Object(A.dummyTrack)(),avcTrack:_,id3Track:Object(A.dummyTrack)(),textTrack:Object(A.dummyTrack)()}},j.flush=function(){var D=Object(A.dummyTrack)();return D.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(A.dummyTrack)(),avcTrack:D,id3Track:Object(A.dummyTrack)(),textTrack:Object(A.dummyTrack)()}},j.demuxSampleAes=function(D,E,_){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},j.destroy=function(){},W}();I.minProbeByteLength=1024,Y.default=I},"./src/demux/mpegaudio.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"appendFrame",function(){return P}),L.d(Y,"parseHeader",function(){return D}),L.d(Y,"isHeaderPattern",function(){return E}),L.d(Y,"isHeader",function(){return _}),L.d(Y,"canParse",function(){return M}),L.d(Y,"probe",function(){return R});var z=null,A=[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],I=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],W=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],j=[0,1,1,4];function P(k,S,c,o,l){if(c+24>S.length)return;var u=D(S,c);if(u&&c+u.frameLength<=S.length){var T=u.samplesPerFrame*9e4/u.sampleRate,m=o+l*T,p={unit:S.subarray(c,c+u.frameLength),pts:m,dts:m};return k.config=[],k.channelCount=u.channelCount,k.samplerate=u.sampleRate,k.samples.push(p),{sample:p,length:u.frameLength,missing:0}}}function D(k,S){var c=k[S+1]>>3&3,o=k[S+1]>>1&3,l=k[S+2]>>4&15,u=k[S+2]>>2&3;if(c!==1&&l!==0&&l!==15&&u!==3){var T=k[S+2]>>1&1,m=k[S+3]>>6,p=c===3?3-o:o===3?3:4,w=A[p*14+l-1]*1e3,x=c===3?0:c===2?1:2,g=I[x*3+u],f=m===3?1:2,d=W[c][o],a=j[o],C=d*8*a,v=Math.floor(d*w/g+T)*a;if(z===null){var b=navigator.userAgent||"",y=b.match(/Chrome\/(\d+)/i);z=y?parseInt(y[1]):0}var G=!!z&&z<=87;return G&&o===2&&w>=224e3&&m===0&&(k[S+3]=k[S+3]|128),{sampleRate:g,channelCount:f,frameLength:v,samplesPerFrame:C}}}function E(k,S){return k[S]===255&&(k[S+1]&224)===224&&(k[S+1]&6)!==0}function _(k,S){return S+1<k.length&&E(k,S)}function M(k,S){var c=4;return E(k,S)&&c<=k.length-S}function R(k,S){if(S+1<k.length&&E(k,S)){var c=4,o=D(k,S),l=c;o!=null&&o.frameLength&&(l=o.frameLength);var u=S+l;return u===k.length||_(k,u)}return!1}},"./src/demux/sample-aes.ts":function(le,Y,L){"use strict";L.r(Y);var z=L("./src/crypt/decrypter.ts"),A=L("./src/demux/tsdemuxer.ts"),I=function(){function W(P,D,E){this.keyData=void 0,this.decrypter=void 0,this.keyData=E,this.decrypter=new z.default(P,D,{removePKCS7Padding:!1})}var j=W.prototype;return j.decryptBuffer=function(D,E){this.decrypter.decrypt(D,this.keyData.key.buffer,this.keyData.iv.buffer,E)},j.decryptAacSample=function(D,E,_,M){var R=D[E].unit,k=R.subarray(16,R.length-R.length%16),S=k.buffer.slice(k.byteOffset,k.byteOffset+k.length),c=this;this.decryptBuffer(S,function(o){var l=new Uint8Array(o);R.set(l,16),M||c.decryptAacSamples(D,E+1,_)})},j.decryptAacSamples=function(D,E,_){for(;;E++){if(E>=D.length){_();return}if(D[E].unit.length<32)continue;var M=this.decrypter.isSync();if(this.decryptAacSample(D,E,_,M),!M)return}},j.getAvcEncryptedData=function(D){for(var E=Math.floor((D.length-48)/160)*16+16,_=new Int8Array(E),M=0,R=32;R<=D.length-16;R+=160,M+=16)_.set(D.subarray(R,R+16),M);return _},j.getAvcDecryptedUnit=function(D,E){for(var _=new Uint8Array(E),M=0,R=32;R<=D.length-16;R+=160,M+=16)D.set(_.subarray(M,M+16),R);return D},j.decryptAvcSample=function(D,E,_,M,R,k){var S=Object(A.discardEPB)(R.data),c=this.getAvcEncryptedData(S),o=this;this.decryptBuffer(c.buffer,function(l){R.data=o.getAvcDecryptedUnit(S,l),k||o.decryptAvcSamples(D,E,_+1,M)})},j.decryptAvcSamples=function(D,E,_,M){if(D instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;E++,_=0){if(E>=D.length){M();return}for(var R=D[E].units;!(_>=R.length);_++){var k=R[_];if(k.data.length<=48||k.type!==1&&k.type!==5)continue;var S=this.decrypter.isSync();if(this.decryptAvcSample(D,E,_,M,k,S),!S)return}}},W}();Y.default=I},"./src/demux/transmuxer-interface.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return R});var z=L("./node_modules/webworkify-webpack/index.js"),A=L.n(z),I=L("./src/events.ts"),W=L("./src/demux/transmuxer.ts"),j=L("./src/utils/logger.ts"),P=L("./src/errors.ts"),D=L("./src/utils/mediasource-helper.ts"),E=L("./node_modules/eventemitter3/index.js"),_=L.n(E),M=Object(D.getMediaSource)()||{isTypeSupported:function(){return!1}},R=function(){function k(c,o,l,u){var T=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=c,this.id=o,this.onTransmuxComplete=l,this.onFlush=u;var m=c.config,p=function(d,a){a=a||{},a.frag=T.frag,a.id=T.id,c.trigger(d,a)};this.observer=new E.EventEmitter,this.observer.on(I.Events.FRAG_DECRYPTED,p),this.observer.on(I.Events.ERROR,p);var w={mp4:M.isTypeSupported("video/mp4"),mpeg:M.isTypeSupported("audio/mpeg"),mp3:M.isTypeSupported('audio/mp4; codecs="mp3"')},x=navigator.vendor;if(m.enableWorker&&typeof Worker!="undefined"){j.logger.log("demuxing in webworker");var g;try{g=this.worker=z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),g.addEventListener("message",this.onwmsg),g.onerror=function(f){c.trigger(I.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(f.message+" ("+f.filename+":"+f.lineno+")")})},g.postMessage({cmd:"init",typeSupported:w,vendor:x,id:o,config:JSON.stringify(m)})}catch(f){j.logger.warn("Error in worker:",f),j.logger.error("Error while initializing DemuxerWorker, fallback to inline"),g&&self.URL.revokeObjectURL(g.objectURL),this.transmuxer=new W.default(this.observer,w,m,x,o),this.worker=null}}else this.transmuxer=new W.default(this.observer,w,m,x,o)}var S=k.prototype;return S.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var u=this.observer;u&&u.removeAllListeners(),this.observer=null},S.push=function(o,l,u,T,m,p,w,x,g,f){var d=this;g.transmuxing.start=self.performance.now();var a=this.transmuxer,C=this.worker,v=p?p.start:m.start,b=m.decryptdata,y=this.frag,G=!(y&&m.cc===y.cc),$=!(y&&g.level===y.level),Z=y?g.sn-y.sn:-1,V=this.part?g.part-this.part.index:1,H=!$&&(Z===1||Z===0&&V===1),re=self.performance.now();($||Z||m.stats.parsing.start===0)&&(m.stats.parsing.start=re),p&&(V||!H)&&(p.stats.parsing.start=re);var ce=new W.TransmuxState(G,H,x,$,v);if(!H||G){j.logger.log("[transmuxer-interface, "+m.type+"]: Starting new transmux session for sn: "+g.sn+" p: "+g.part+" level: "+g.level+" id: "+g.id+`
|
|
discontinuity: `+G+`
|
|
trackSwitch: `+$+`
|
|
contiguous: `+H+`
|
|
accurateTimeOffset: `+x+`
|
|
timeOffset: `+v);var Ee=new W.TransmuxConfig(u,T,l,w,f);this.configureTransmuxer(Ee)}if(this.frag=m,this.part=p,C)C.postMessage({cmd:"demux",data:o,decryptdata:b,chunkMeta:g,state:ce},o instanceof ArrayBuffer?[o]:[]);else if(a){var we=a.push(o,b,g,ce);Object(W.isPromise)(we)?we.then(function(Ye){d.handleTransmuxComplete(Ye)}):this.handleTransmuxComplete(we)}},S.flush=function(o){var l=this;o.transmuxing.start=self.performance.now();var u=this.transmuxer,T=this.worker;if(T)T.postMessage({cmd:"flush",chunkMeta:o});else if(u){var m=u.flush(o);Object(W.isPromise)(m)?m.then(function(p){l.handleFlushResult(p,o)}):this.handleFlushResult(m,o)}},S.handleFlushResult=function(o,l){var u=this;o.forEach(function(T){u.handleTransmuxComplete(T)}),this.onFlush(l)},S.onWorkerMessage=function(o){var l=o.data,u=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,u.trigger(l.event,l.data);break}}},S.configureTransmuxer=function(o){var l=this.worker,u=this.transmuxer;l?l.postMessage({cmd:"configure",config:o}):u&&u.configure(o)},S.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},k}()},"./src/demux/transmuxer-worker.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return P});var z=L("./src/demux/transmuxer.ts"),A=L("./src/events.ts"),I=L("./src/utils/logger.ts"),W=L("./node_modules/eventemitter3/index.js"),j=L.n(W);function P(R){var k=new W.EventEmitter,S=function(o,l){R.postMessage({event:o,data:l})};k.on(A.Events.FRAG_DECRYPTED,S),k.on(A.Events.ERROR,S),R.addEventListener("message",function(c){var o=c.data;switch(o.cmd){case"init":{var l=JSON.parse(o.config);R.transmuxer=new z.default(k,o.typeSupported,l,o.vendor,o.id),Object(I.enableLogs)(l.debug),S("init",null);break}case"configure":{R.transmuxer.configure(o.config);break}case"demux":{var u=R.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(z.isPromise)(u)?u.then(function(p){D(R,p)}):D(R,u);break}case"flush":{var T=o.chunkMeta,m=R.transmuxer.flush(T);Object(z.isPromise)(m)?m.then(function(p){_(R,p,T)}):_(R,m,T);break}default:break}})}function D(R,k){if(M(k.remuxResult))return;var S=[],c=k.remuxResult,o=c.audio,l=c.video;o&&E(S,o),l&&E(S,l),R.postMessage({event:"transmuxComplete",data:k},S)}function E(R,k){k.data1&&R.push(k.data1.buffer),k.data2&&R.push(k.data2.buffer)}function _(R,k,S){k.forEach(function(c){D(R,c)}),R.postMessage({event:"flush",data:S})}function M(R){return!R.audio&&!R.video&&!R.text&&!R.id3&&!R.initSegment}},"./src/demux/transmuxer.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return l}),L.d(Y,"isPromise",function(){return m}),L.d(Y,"TransmuxConfig",function(){return p}),L.d(Y,"TransmuxState",function(){return w});var z=L("./src/events.ts"),A=L("./src/errors.ts"),I=L("./src/crypt/decrypter.ts"),W=L("./src/demux/aacdemuxer.ts"),j=L("./src/demux/mp4demuxer.ts"),P=L("./src/demux/tsdemuxer.ts"),D=L("./src/demux/mp3demuxer.ts"),E=L("./src/remux/mp4-remuxer.ts"),_=L("./src/remux/passthrough-remuxer.ts"),M=L("./src/demux/chunk-cache.ts"),R=L("./src/utils/mp4-tools.ts"),k=L("./src/utils/logger.ts"),S;try{S=self.performance.now.bind(self.performance)}catch(x){k.logger.debug("Unable to use Performance API on this environment"),S=self.Date.now}var c=[{demux:P.default,remux:E.default},{demux:j.default,remux:_.default},{demux:W.default,remux:E.default},{demux:D.default,remux:E.default}],o=1024;c.forEach(function(x){var g=x.demux;o=Math.max(o,g.minProbeByteLength)});var l=function(){function x(f,d,a,C,v){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new M.default,this.observer=f,this.typeSupported=d,this.config=a,this.vendor=C,this.id=v}var g=x.prototype;return g.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},g.push=function(d,a,C,v){var b=this,y=C.transmuxing;y.executeStart=S();var G=new Uint8Array(d),$=this.cache,Z=this.config,V=this.currentTransmuxState,H=this.transmuxConfig;v&&(this.currentTransmuxState=v);var re=u(G,a);if(re&&re.method==="AES-128"){var ce=this.getDecrypter();if(Z.enableSoftwareAES){var Ee=ce.softwareDecrypt(G,re.key.buffer,re.iv.buffer);if(!Ee)return y.executeEnd=S(),T(C);G=new Uint8Array(Ee)}else return this.decryptionPromise=ce.webCryptoDecrypt(G,re.key.buffer,re.iv.buffer).then(function($e){var it=b.push($e,null,C);return b.decryptionPromise=null,it}),this.decryptionPromise}var we=v||V,Ye=we.contiguous,Ne=we.discontinuity,Ie=we.trackSwitch,We=we.accurateTimeOffset,Ue=we.timeOffset,xe=H.audioCodec,se=H.videoCodec,ke=H.defaultInitPts,dt=H.duration,at=H.initSegmentData;if((Ne||Ie)&&this.resetInitSegment(at,xe,se,dt),Ne&&this.resetInitialTimestamp(ke),Ye||this.resetContiguity(),this.needsProbing(G,Ne,Ie)){if($.dataLength){var rt=$.flush();G=Object(R.appendUint8Array)(rt,G)}this.configureTransmuxer(G,H)}var lt=this.transmux(G,re,Ue,We,C),Ke=this.currentTransmuxState;return Ke.contiguous=!0,Ke.discontinuity=!1,Ke.trackSwitch=!1,y.executeEnd=S(),lt},g.flush=function(d){var a=this,C=d.transmuxing;C.executeStart=S();var v=this.decrypter,b=this.cache,y=this.currentTransmuxState,G=this.decryptionPromise;if(G)return G.then(function(){return a.flush(d)});var $=[],Z=y.timeOffset;if(v){var V=v.flush();V&&$.push(this.push(V,null,d))}var H=b.dataLength;b.reset();var re=this.demuxer,ce=this.remuxer;if(!re||!ce)return H>=o&&this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),C.executeEnd=S(),[T(d)];var Ee=re.flush(Z);return m(Ee)?Ee.then(function(we){return a.flushRemux($,we,d),$}):(this.flushRemux($,Ee,d),$)},g.flushRemux=function(d,a,C){var v=a.audioTrack,b=a.avcTrack,y=a.id3Track,G=a.textTrack,$=this.currentTransmuxState,Z=$.accurateTimeOffset,V=$.timeOffset;k.logger.log("[transmuxer.ts]: Flushed fragment "+C.sn+(C.part>-1?" p: "+C.part:"")+" of level "+C.level);var H=this.remuxer.remux(v,b,y,G,V,Z,!0,this.id);d.push({remuxResult:H,chunkMeta:C}),C.transmuxing.executeEnd=S()},g.resetInitialTimestamp=function(d){var a=this.demuxer,C=this.remuxer;if(!a||!C)return;a.resetTimeStamp(d),C.resetTimeStamp(d)},g.resetContiguity=function(){var d=this.demuxer,a=this.remuxer;if(!d||!a)return;d.resetContiguity(),a.resetNextTimestamp()},g.resetInitSegment=function(d,a,C,v){var b=this.demuxer,y=this.remuxer;if(!b||!y)return;b.resetInitSegment(a,C,v),y.resetInitSegment(d,a,C)},g.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},g.transmux=function(d,a,C,v,b){var y;return a&&a.method==="SAMPLE-AES"?y=this.transmuxSampleAes(d,a,C,v,b):y=this.transmuxUnencrypted(d,C,v,b),y},g.transmuxUnencrypted=function(d,a,C,v){var b=this.demuxer.demux(d,a,!1,!this.config.progressive),y=b.audioTrack,G=b.avcTrack,$=b.id3Track,Z=b.textTrack,V=this.remuxer.remux(y,G,$,Z,a,C,!1,this.id);return{remuxResult:V,chunkMeta:v}},g.transmuxSampleAes=function(d,a,C,v,b){var y=this;return this.demuxer.demuxSampleAes(d,a,C).then(function(G){var $=y.remuxer.remux(G.audioTrack,G.avcTrack,G.id3Track,G.textTrack,C,v,!1,y.id);return{remuxResult:$,chunkMeta:b}})},g.configureTransmuxer=function(d,a){for(var C=this.config,v=this.observer,b=this.typeSupported,y=this.vendor,G=a.audioCodec,$=a.defaultInitPts,Z=a.duration,V=a.initSegmentData,H=a.videoCodec,re,ce=0,Ee=c.length;ce<Ee;ce++)if(c[ce].demux.probe(d)){re=c[ce];break}re||(k.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),re={demux:j.default,remux:_.default});var we=this.demuxer,Ye=this.remuxer,Ne=re.remux,Ie=re.demux;(!Ye||!(Ye instanceof Ne))&&(this.remuxer=new Ne(v,C,b,y)),(!we||!(we instanceof Ie))&&(this.demuxer=new Ie(v,C,b),this.probe=Ie.probe),this.resetInitSegment(V,G,H,Z),this.resetInitialTimestamp($)},g.needsProbing=function(d,a,C){return!this.demuxer||!this.remuxer||a||C},g.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new I.default(this.observer,this.config)),d},x}();function u(x,g){var f=null;return x.byteLength>0&&g!=null&&g.key!=null&&g.iv!==null&&g.method!=null&&(f=g),f}var T=function(g){return{remuxResult:{},chunkMeta:g}};function m(x){return"then"in x&&x.then instanceof Function}var p=function(g,f,d,a,C){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=f,this.initSegmentData=d,this.duration=a,this.defaultInitPts=C},w=function(g,f,d,a,C){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=f,this.accurateTimeOffset=d,this.trackSwitch=a,this.timeOffset=C}},"./src/demux/tsdemuxer.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"discardEPB",function(){return T});var z=L("./src/demux/adts.ts"),A=L("./src/demux/mpegaudio.ts"),I=L("./src/demux/exp-golomb.ts"),W=L("./src/demux/id3.ts"),j=L("./src/demux/sample-aes.ts"),P=L("./src/events.ts"),D=L("./src/utils/mp4-tools.ts"),E=L("./src/utils/logger.ts"),_=L("./src/errors.ts"),M={video:1,audio:2,id3:3,text:4},R=function(){function m(w,x,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=w,this.config=x,this.typeSupported=g}m.probe=function(x){var g=m.syncOffset(x);return g<0?!1:(g&&E.logger.warn("MPEG2-TS detected but first sync word found @ offset "+g+", junk ahead ?"),!0)},m.syncOffset=function(x){for(var g=Math.min(1e3,x.length-3*188),f=0;f<g;){if(x[f]===71&&x[f+188]===71&&x[f+2*188]===71)return f;f++}return-1},m.createTrack=function(x,g){return{container:x==="video"||x==="audio"?"video/mp2t":void 0,type:x,id:M[x],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:x==="audio"?g:void 0}};var p=m.prototype;return p.resetInitSegment=function(x,g,f){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=m.createTrack("video",f),this._audioTrack=m.createTrack("audio",f),this._id3Track=m.createTrack("id3",f),this._txtTrack=m.createTrack("text",f),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=x,this.videoCodec=g,this._duration=f},p.resetTimeStamp=function(){},p.resetContiguity=function(){var x=this._audioTrack,g=this._avcTrack,f=this._id3Track;x&&(x.pesData=null),g&&(g.pesData=null),f&&(f.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},p.demux=function(x,g,f,d){f===void 0&&(f=!1),d===void 0&&(d=!1),f||(this.sampleAes=null);var a,C=this._avcTrack,v=this._audioTrack,b=this._id3Track,y=C.pid,G=C.pesData,$=v.pid,Z=b.pid,V=v.pesData,H=b.pesData,re=!1,ce=this.pmtParsed,Ee=this._pmtId,we=x.length;if(this.remainderData&&(x=Object(D.appendUint8Array)(this.remainderData,x),we=x.length,this.remainderData=null),we<188&&!d)return this.remainderData=x,{audioTrack:v,avcTrack:C,id3Track:b,textTrack:this._txtTrack};var Ye=Math.max(0,m.syncOffset(x));we-=(we+Ye)%188,we<x.byteLength&&!d&&(this.remainderData=new Uint8Array(x.buffer,we,x.buffer.byteLength-we));for(var Ne=Ye;Ne<we;Ne+=188)if(x[Ne]===71){var Ie=!!(x[Ne+1]&64),We=((x[Ne+1]&31)<<8)+x[Ne+2],Ue=(x[Ne+3]&48)>>4,xe=void 0;if(Ue>1){if(xe=Ne+5+x[Ne+4],xe===Ne+188)continue}else xe=Ne+4;switch(We){case y:Ie&&(G&&(a=o(G))&&this.parseAVCPES(a,!1),G={data:[],size:0}),G&&(G.data.push(x.subarray(xe,Ne+188)),G.size+=Ne+188-xe);break;case $:Ie&&(V&&(a=o(V))&&(v.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),V={data:[],size:0}),V&&(V.data.push(x.subarray(xe,Ne+188)),V.size+=Ne+188-xe);break;case Z:Ie&&(H&&(a=o(H))&&this.parseID3PES(a),H={data:[],size:0}),H&&(H.data.push(x.subarray(xe,Ne+188)),H.size+=Ne+188-xe);break;case 0:Ie&&(xe+=x[xe]+1),Ee=this._pmtId=S(x,xe);break;case Ee:{Ie&&(xe+=x[xe]+1);var se=c(x,xe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,f);y=se.avc,y>0&&(C.pid=y),$=se.audio,$>0&&(v.pid=$,v.isAAC=se.isAAC),Z=se.id3,Z>0&&(b.pid=Z),re&&!ce&&(E.logger.log("reparse from beginning"),re=!1,Ne=Ye-188),ce=this.pmtParsed=!0;break}case 17:case 8191:break;default:re=!0;break}}else this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});C.pesData=G,v.pesData=V,b.pesData=H;var ke={audioTrack:v,avcTrack:C,id3Track:b,textTrack:this._txtTrack};return d&&this.extractRemainingSamples(ke),ke},p.flush=function(){var x=this.remainderData;this.remainderData=null;var g;return x?g=this.demux(x,-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},p.extractRemainingSamples=function(x){var g=x.audioTrack,f=x.avcTrack,d=x.id3Track,a=f.pesData,C=g.pesData,v=d.pesData,b;a&&(b=o(a))?(this.parseAVCPES(b,!0),f.pesData=null):f.pesData=a,C&&(b=o(C))?(g.isAAC?this.parseAACPES(b):this.parseMPEGPES(b),g.pesData=null):(C!=null&&C.size&&E.logger.log("last AAC PES packet truncated,might overlap between fragments"),g.pesData=C),v&&(b=o(v))?(this.parseID3PES(b),d.pesData=null):d.pesData=v},p.demuxSampleAes=function(x,g,f){var d=this.demux(x,f,!0,!this.config.progressive),a=this.sampleAes=new j.default(this.observer,this.config,g);return this.decrypt(d,a)},p.decrypt=function(x,g){return new Promise(function(f){var d=x.audioTrack,a=x.avcTrack;d.samples&&d.isAAC?g.decryptAacSamples(d.samples,0,function(){a.samples?g.decryptAvcSamples(a.samples,0,0,function(){f(x)}):f(x)}):a.samples&&g.decryptAvcSamples(a.samples,0,0,function(){f(x)})})},p.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},p.parseAVCPES=function(x,g){var f=this,d=this._avcTrack,a=this.parseAVCNALu(x.data),C=!1,v=this.avcSample,b,y=!1;x.data=null,v&&a.length&&!d.audFound&&(l(v,d),v=this.avcSample=k(!1,x.pts,x.dts,"")),a.forEach(function(G){switch(G.type){case 1:{b=!0,v||(v=f.avcSample=k(!0,x.pts,x.dts,"")),C&&(v.debug+="NDR "),v.frame=!0;var $=G.data;if(y&&$.length>4){var Z=new I.default($).readSliceType();(Z===2||Z===4||Z===7||Z===9)&&(v.key=!0)}break}case 5:b=!0,v||(v=f.avcSample=k(!0,x.pts,x.dts,"")),C&&(v.debug+="IDR "),v.key=!0,v.frame=!0;break;case 6:{b=!0,C&&v&&(v.debug+="SEI ");var V=new I.default(T(G.data));V.readUByte();for(var H=0,re=0,ce=!1,Ee=0;!ce&&V.bytesAvailable>1;){H=0;do Ee=V.readUByte(),H+=Ee;while(Ee===255);re=0;do Ee=V.readUByte(),re+=Ee;while(Ee===255);if(H===4&&V.bytesAvailable!==0){ce=!0;var we=V.readUByte();if(we===181){var Ye=V.readUShort();if(Ye===49){var Ne=V.readUInt();if(Ne===1195456820){var Ie=V.readUByte();if(Ie===3){for(var We=V.readUByte(),Ue=V.readUByte(),xe=31&We,se=[We,Ue],ke=0;ke<xe;ke++)se.push(V.readUByte()),se.push(V.readUByte()),se.push(V.readUByte());u(f._txtTrack.samples,{type:3,pts:x.pts,bytes:se})}}}}}else if(H===5&&V.bytesAvailable!==0){if(ce=!0,re>16){for(var dt=[],at=0;at<16;at++)dt.push(V.readUByte().toString(16)),(at===3||at===5||at===7||at===9)&&dt.push("-");for(var rt=re-16,lt=new Uint8Array(rt),Ke=0;Ke<rt;Ke++)lt[Ke]=V.readUByte();u(f._txtTrack.samples,{pts:x.pts,payloadType:H,uuid:dt.join(""),userData:Object(W.utf8ArrayToStr)(lt),userDataBytes:lt})}}else if(re<V.bytesAvailable)for(var $e=0;$e<re;$e++)V.readUByte()}break}case 7:if(b=!0,y=!0,C&&v&&(v.debug+="SPS "),!d.sps){var it=new I.default(G.data),ft=it.readSPS();d.width=ft.width,d.height=ft.height,d.pixelRatio=ft.pixelRatio,d.sps=[G.data],d.duration=f._duration;for(var ut=G.data.subarray(1,4),Ze="avc1.",qe=0;qe<3;qe++){var Dt=ut[qe].toString(16);Dt.length<2&&(Dt="0"+Dt),Ze+=Dt}d.codec=Ze}break;case 8:b=!0,C&&v&&(v.debug+="PPS "),d.pps||(d.pps=[G.data]);break;case 9:b=!1,d.audFound=!0,v&&l(v,d),v=f.avcSample=k(!1,x.pts,x.dts,C?"AUD ":"");break;case 12:b=!1;break;default:b=!1,v&&(v.debug+="unknown NAL "+G.type+" ");break}if(v&&b){var wt=v.units;wt.push(G)}}),g&&v&&(l(v,d),this.avcSample=null)},p.getLastNalUnit=function(){var x,g=this.avcSample,f;if(!g||g.units.length===0){var d=this._avcTrack.samples;g=d[d.length-1]}if((x=g)!==null&&x!==void 0&&x.units){var a=g.units;f=a[a.length-1]}return f},p.parseAVCNALu=function(x){var g=x.byteLength,f=this._avcTrack,d=f.naluState||0,a=d,C=[],v=0,b,y,G,$=-1,Z=0;for(d===-1&&($=0,Z=x[0]&31,d=0,v=1);v<g;){if(b=x[v++],!d){d=b?0:1;continue}if(d===1){d=b?0:2;continue}if(!b)d=3;else if(b===1){if($>=0){var V={data:x.subarray($,v-d-1),type:Z};C.push(V)}else{var H=this.getLastNalUnit();if(H&&(a&&v<=4-a&&(H.state&&(H.data=H.data.subarray(0,H.data.byteLength-a))),y=v-d-1,y>0)){var re=new Uint8Array(H.data.byteLength+y);re.set(H.data,0),re.set(x.subarray(0,y),H.data.byteLength),H.data=re,H.state=0}}v<g?(G=x[v]&31,$=v,Z=G,d=0):d=-1}else d=0}if($>=0&&d>=0){var ce={data:x.subarray($,g),type:Z,state:d};C.push(ce)}if(C.length===0){var Ee=this.getLastNalUnit();if(Ee){var we=new Uint8Array(Ee.data.byteLength+x.byteLength);we.set(Ee.data,0),we.set(x,Ee.data.byteLength),Ee.data=we}}return f.naluState=d,C},p.parseAACPES=function(x){var g=0,f=this._audioTrack,d=this.aacOverFlow,a=x.data;if(d){this.aacOverFlow=null;var C=d.sample.unit.byteLength,v=Math.min(d.missing,C),b=C-v;d.sample.unit.set(a.subarray(0,v),b),f.samples.push(d.sample),g=d.missing}var y,G;for(y=g,G=a.length;y<G-1&&!z.isHeader(a,y);y++);if(y!==g){var $,Z;if(y<G-1?($="AAC PES did not start with ADTS header,offset:"+y,Z=!1):($="no ADTS header found in AAC PES",Z=!0),E.logger.warn("parsing error:"+$),this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.FRAG_PARSING_ERROR,fatal:Z,reason:$}),Z)return}z.initTrackConfig(f,this.observer,a,y,this.audioCodec);var V;if(x.pts!==void 0)V=x.pts;else if(d){var H=z.getFrameDuration(f.samplerate);V=d.sample.pts+H}else{E.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var re=0;y<G;)if(z.isHeader(a,y)){if(y+5<G){var ce=z.appendFrame(f,a,y,V,re);if(ce)if(ce.missing)this.aacOverFlow=ce;else{y+=ce.length,re++;continue}}break}else y++},p.parseMPEGPES=function(x){var g=x.data,f=g.length,d=0,a=0,C=x.pts;if(C===void 0){E.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<f;)if(A.isHeader(g,a)){var v=A.appendFrame(this._audioTrack,g,a,C,d);if(v)a+=v.length,d++;else break}else a++},p.parseID3PES=function(x){if(x.pts===void 0){E.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(x)},m}();R.minProbeByteLength=188;function k(m,p,w,x){return{key:m,frame:!1,pts:p,dts:w,units:[],debug:x,length:0}}function S(m,p){return(m[p+10]&31)<<8|m[p+11]}function c(m,p,w,x){var g={audio:-1,avc:-1,id3:-1,isAAC:!0},f=(m[p+1]&15)<<8|m[p+2],d=p+3+f-4,a=(m[p+10]&15)<<8|m[p+11];for(p+=12+a;p<d;){var C=(m[p+1]&31)<<8|m[p+2];switch(m[p]){case 207:if(!x){E.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:g.audio===-1&&(g.audio=C);break;case 21:g.id3===-1&&(g.id3=C);break;case 219:if(!x){E.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:g.avc===-1&&(g.avc=C);break;case 3:case 4:w?g.audio===-1&&(g.audio=C,g.isAAC=!1):E.logger.log("MPEG audio found, not supported in this browser");break;case 36:E.logger.warn("Unsupported HEVC stream type found");break;default:break}p+=((m[p+3]&15)<<8|m[p+4])+5}return g}function o(m){var p=0,w,x,g,f,d,a=m.data;if(!m||m.size===0)return null;for(;a[0].length<19&&a.length>1;){var C=new Uint8Array(a[0].length+a[1].length);C.set(a[0]),C.set(a[1],a[0].length),a[0]=C,a.splice(1,1)}w=a[0];var v=(w[0]<<16)+(w[1]<<8)+w[2];if(v===1){if(x=(w[4]<<8)+w[5],x&&x>m.size-6)return null;var b=w[7];b&192&&(f=(w[9]&14)*536870912+(w[10]&255)*4194304+(w[11]&254)*16384+(w[12]&255)*128+(w[13]&254)/2,b&64?(d=(w[14]&14)*536870912+(w[15]&255)*4194304+(w[16]&254)*16384+(w[17]&255)*128+(w[18]&254)/2,f-d>60*9e4&&(E.logger.warn(Math.round((f-d)/9e4)+"s delta between PTS and DTS, align them"),f=d)):d=f),g=w[8];var y=g+9;if(m.size<=y)return null;m.size-=y;for(var G=new Uint8Array(m.size),$=0,Z=a.length;$<Z;$++){w=a[$];var V=w.byteLength;if(y)if(y>V){y-=V;continue}else w=w.subarray(y),V-=y,y=0;G.set(w,p),p+=V}return x&&(x-=g+3),{data:G,pts:f,dts:d,len:x}}return null}function l(m,p){if(m.units.length&&m.frame){if(m.pts===void 0){var w=p.samples,x=w.length;if(x){var g=w[x-1];m.pts=g.pts,m.dts=g.dts}else{p.dropped++;return}}p.samples.push(m)}m.debug.length&&E.logger.log(m.pts+"/"+m.dts+":"+m.debug)}function u(m,p){var w=m.length;if(w>0){if(p.pts>=m[w-1].pts)m.push(p);else for(var x=w-1;x>=0;x--)if(p.pts<m[x].pts){m.splice(x,0,p);break}}else m.push(p)}function T(m){for(var p=m.byteLength,w=[],x=1;x<p-2;)m[x]===0&&m[x+1]===0&&m[x+2]===3?(w.push(x+2),x+=2):x++;if(w.length===0)return m;var g=p-w.length,f=new Uint8Array(g),d=0;for(x=0;x<g;d++,x++)d===w[0]&&(d++,w.shift()),f[x]=m[d];return f}Y.default=R},"./src/errors.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"ErrorTypes",function(){return z}),L.d(Y,"ErrorDetails",function(){return A});var z;(function(I){I.NETWORK_ERROR="networkError",I.MEDIA_ERROR="mediaError",I.KEY_SYSTEM_ERROR="keySystemError",I.MUX_ERROR="muxError",I.OTHER_ERROR="otherError"})(z||(z={}));var A;(function(I){I.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",I.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",I.KEY_SYSTEM_NO_SESSION="keySystemNoSession",I.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",I.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",I.MANIFEST_LOAD_ERROR="manifestLoadError",I.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",I.MANIFEST_PARSING_ERROR="manifestParsingError",I.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",I.LEVEL_EMPTY_ERROR="levelEmptyError",I.LEVEL_LOAD_ERROR="levelLoadError",I.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",I.LEVEL_SWITCH_ERROR="levelSwitchError",I.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",I.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",I.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",I.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",I.FRAG_LOAD_ERROR="fragLoadError",I.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",I.FRAG_DECRYPT_ERROR="fragDecryptError",I.FRAG_PARSING_ERROR="fragParsingError",I.REMUX_ALLOC_ERROR="remuxAllocError",I.KEY_LOAD_ERROR="keyLoadError",I.KEY_LOAD_TIMEOUT="keyLoadTimeOut",I.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",I.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",I.BUFFER_APPEND_ERROR="bufferAppendError",I.BUFFER_APPENDING_ERROR="bufferAppendingError",I.BUFFER_STALLED_ERROR="bufferStalledError",I.BUFFER_FULL_ERROR="bufferFullError",I.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",I.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",I.INTERNAL_EXCEPTION="internalException",I.INTERNAL_ABORTED="aborted",I.UNKNOWN="unknown"})(A||(A={}))},"./src/events.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"Events",function(){return z});var z;(function(A){A.MEDIA_ATTACHING="hlsMediaAttaching",A.MEDIA_ATTACHED="hlsMediaAttached",A.MEDIA_DETACHING="hlsMediaDetaching",A.MEDIA_DETACHED="hlsMediaDetached",A.BUFFER_RESET="hlsBufferReset",A.BUFFER_CODECS="hlsBufferCodecs",A.BUFFER_CREATED="hlsBufferCreated",A.BUFFER_APPENDING="hlsBufferAppending",A.BUFFER_APPENDED="hlsBufferAppended",A.BUFFER_EOS="hlsBufferEos",A.BUFFER_FLUSHING="hlsBufferFlushing",A.BUFFER_FLUSHED="hlsBufferFlushed",A.MANIFEST_LOADING="hlsManifestLoading",A.MANIFEST_LOADED="hlsManifestLoaded",A.MANIFEST_PARSED="hlsManifestParsed",A.LEVEL_SWITCHING="hlsLevelSwitching",A.LEVEL_SWITCHED="hlsLevelSwitched",A.LEVEL_LOADING="hlsLevelLoading",A.LEVEL_LOADED="hlsLevelLoaded",A.LEVEL_UPDATED="hlsLevelUpdated",A.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",A.LEVELS_UPDATED="hlsLevelsUpdated",A.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",A.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",A.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",A.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",A.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",A.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",A.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",A.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",A.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",A.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",A.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",A.CUES_PARSED="hlsCuesParsed",A.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",A.INIT_PTS_FOUND="hlsInitPtsFound",A.FRAG_LOADING="hlsFragLoading",A.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",A.FRAG_LOADED="hlsFragLoaded",A.FRAG_DECRYPTED="hlsFragDecrypted",A.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",A.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",A.FRAG_PARSING_METADATA="hlsFragParsingMetadata",A.FRAG_PARSED="hlsFragParsed",A.FRAG_BUFFERED="hlsFragBuffered",A.FRAG_CHANGED="hlsFragChanged",A.FPS_DROP="hlsFpsDrop",A.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",A.ERROR="hlsError",A.DESTROYING="hlsDestroying",A.KEY_LOADING="hlsKeyLoading",A.KEY_LOADED="hlsKeyLoaded",A.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",A.BACK_BUFFER_REACHED="hlsBackBufferReached"})(z||(z={}))},"./src/hls.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return m});var z=L("./node_modules/url-toolkit/src/url-toolkit.js"),A=L.n(z),I=L("./src/loader/playlist-loader.ts"),W=L("./src/loader/key-loader.ts"),j=L("./src/controller/id3-track-controller.ts"),P=L("./src/controller/latency-controller.ts"),D=L("./src/controller/level-controller.ts"),E=L("./src/controller/fragment-tracker.ts"),_=L("./src/controller/stream-controller.ts"),M=L("./src/is-supported.ts"),R=L("./src/utils/logger.ts"),k=L("./src/config.ts"),S=L("./node_modules/eventemitter3/index.js"),c=L.n(S),o=L("./src/events.ts"),l=L("./src/errors.ts");function u(p,w){for(var x=0;x<w.length;x++){var g=w[x];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(p,g.key,g)}}function T(p,w,x){return w&&u(p.prototype,w),x&&u(p,x),p}var m=function(){p.isSupported=function(){return Object(M.isSupported)()};function p(x){x===void 0&&(x={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new S.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(k.mergeConfig)(p.DefaultConfig,x);this.userConfig=x,Object(R.enableLogs)(g.debug),this._autoLevelCapping=-1,g.progressive&&Object(k.enableStreamingMode)(g);var f=g.abrController,d=g.bufferController,a=g.capLevelController,C=g.fpsController,v=this.abrController=new f(this),b=this.bufferController=new d(this),y=this.capLevelController=new a(this),G=new C(this),$=new I.default(this),Z=new W.default(this),V=new j.default(this),H=this.levelController=new D.default(this),re=new E.FragmentTracker(this),ce=this.streamController=new _.default(this,re);y.setStreamController(ce),G.setStreamController(ce);var Ee=[H,ce];this.networkControllers=Ee;var we=[$,Z,v,b,y,G,V,re];this.audioTrackController=this.createController(g.audioTrackController,null,Ee),this.createController(g.audioStreamController,re,Ee),this.subtitleTrackController=this.createController(g.subtitleTrackController,null,Ee),this.createController(g.subtitleStreamController,re,Ee),this.createController(g.timelineController,null,we),this.emeController=this.createController(g.emeController,null,we),this.cmcdController=this.createController(g.cmcdController,null,we),this.latencyController=this.createController(P.default,null,we),this.coreComponents=we}var w=p.prototype;return w.createController=function(g,f,d){if(g){var a=f?new g(this,f):new g(this);return d&&d.push(a),a}return null},w.on=function(g,f,d){d===void 0&&(d=this),this._emitter.on(g,f,d)},w.once=function(g,f,d){d===void 0&&(d=this),this._emitter.once(g,f,d)},w.removeAllListeners=function(g){this._emitter.removeAllListeners(g)},w.off=function(g,f,d,a){d===void 0&&(d=this),this._emitter.off(g,f,d,a)},w.listeners=function(g){return this._emitter.listeners(g)},w.emit=function(g,f,d){return this._emitter.emit(g,f,d)},w.trigger=function(g,f){if(this.config.debug)return this.emit(g,g,f);try{return this.emit(g,g,f)}catch(d){R.logger.error("An internal error happened while handling event "+g+'. Error message: "'+d.message+'". Here is a stacktrace:',d),this.trigger(o.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:g,error:d})}return!1},w.listenerCount=function(g){return this._emitter.listenerCount(g)},w.destroy=function(){R.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},w.attachMedia=function(g){R.logger.log("attachMedia"),this._media=g,this.trigger(o.Events.MEDIA_ATTACHING,{media:g})},w.detachMedia=function(){R.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},w.loadSource=function(g){this.stopLoad();var f=this.media,d=this.url,a=this.url=z.buildAbsoluteURL(self.location.href,g,{alwaysNormalize:!0});R.logger.log("loadSource:"+a),f&&d&&d!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(f)),this.trigger(o.Events.MANIFEST_LOADING,{url:g})},w.startLoad=function(g){g===void 0&&(g=-1),R.logger.log("startLoad("+g+")"),this.networkControllers.forEach(function(f){f.startLoad(g)})},w.stopLoad=function(){R.logger.log("stopLoad"),this.networkControllers.forEach(function(g){g.stopLoad()})},w.swapAudioCodec=function(){R.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},w.recoverMediaError=function(){R.logger.log("recoverMediaError");var g=this._media;this.detachMedia(),g&&this.attachMedia(g)},w.removeLevel=function(g,f){f===void 0&&(f=0),this.levelController.removeLevel(g,f)},T(p,[{key:"levels",get:function(){var g=this.levelController.levels;return g||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(g){R.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){R.logger.log("set nextLevel:"+g),this.levelController.manualLevel=g,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(g){R.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){R.logger.log("set firstLevel:"+g),this.levelController.firstLevel=g}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(g){R.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 f=!!g;f!==this.config.capLevelToPlayerSize&&(f?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=f)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(g){this._autoLevelCapping!==g&&(R.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,f=this.config.minAutoBitrate;if(!g)return 0;for(var d=g.length,a=0;a<d;a++)if(g[a].maxBitrate>f)return a;return 0}},{key:"maxAutoLevel",get:function(){var g=this.levels,f=this.autoLevelCapping,d;return f===-1&&g&&g.length?d=g.length-1:d=f,d}},{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 f=this.audioTrackController;f&&(f.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 f=this.subtitleTrackController;f&&(f.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 f=this.subtitleTrackController;f&&(f.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 p.defaultConfig?p.defaultConfig:k.hlsDefaultConfig},set:function(g){p.defaultConfig=g}}]),p}();m.defaultConfig=void 0},"./src/is-supported.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"isSupported",function(){return I}),L.d(Y,"changeTypeSupported",function(){return W});var z=L("./src/utils/mediasource-helper.ts");function A(){return self.SourceBuffer||self.WebKitSourceBuffer}function I(){var j=Object(z.getMediaSource)();if(!j)return!1;var P=A(),D=j&&typeof j.isTypeSupported=="function"&&j.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),E=!P||P.prototype&&typeof P.prototype.appendBuffer=="function"&&typeof P.prototype.remove=="function";return!!D&&!!E}function W(){var j,P=A();return typeof(P==null||((j=P.prototype)===null||j===void 0)?void 0:j.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return R}),L.d(Y,"LoadError",function(){return S});var z=L("./src/polyfills/number.ts"),A=L("./src/errors.ts");function I(c,o){c.prototype=Object.create(o.prototype),c.prototype.constructor=c,E(c,o)}function W(c){var o=typeof Map=="function"?new Map:void 0;return W=function(u){if(u===null||!D(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(u))return o.get(u);o.set(u,T)}function T(){return j(u,arguments,_(this).constructor)}return T.prototype=Object.create(u.prototype,{constructor:{value:T,enumerable:!1,writable:!0,configurable:!0}}),E(T,u)},W(c)}function j(c,o,l){return P()?j=Reflect.construct:j=function(T,m,p){var w=[null];w.push.apply(w,m);var x=Function.bind.apply(T,w),g=new x;return p&&E(g,p.prototype),g},j.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(c){return!1}}function D(c){return Function.toString.call(c).indexOf("[native code]")!==-1}function E(c,o){return E=Object.setPrototypeOf||function(u,T){return u.__proto__=T,u},E(c,o)}function _(c){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},_(c)}var M=Math.pow(2,17),R=function(){function c(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var o=c.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(u,T){var m=this,p=u.url;if(!p)return Promise.reject(new S({type:A.ErrorTypes.NETWORK_ERROR,details:A.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,networkDetails:null},"Fragment does not have a "+(p?"part list":"url")));this.abort();var w=this.config,x=w.fLoader,g=w.loader;return new Promise(function(f,d){m.loader&&m.loader.destroy();var a=m.loader=u.loader=x?new x(w):new g(w),C=k(u),v={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:M};u.stats=a.stats,a.load(C,v,{onSuccess:function(y,G,$,Z){m.resetLoader(u,a),f({frag:u,part:null,payload:y.data,networkDetails:Z})},onError:function(y,G,$){m.resetLoader(u,a),d(new S({type:A.ErrorTypes.NETWORK_ERROR,details:A.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:y,networkDetails:$}))},onAbort:function(y,G,$){m.resetLoader(u,a),d(new S({type:A.ErrorTypes.NETWORK_ERROR,details:A.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:$}))},onTimeout:function(y,G,$){m.resetLoader(u,a),d(new S({type:A.ErrorTypes.NETWORK_ERROR,details:A.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:$}))},onProgress:function(y,G,$,Z){T&&T({frag:u,part:null,payload:$,networkDetails:Z})}})})},o.loadPart=function(u,T,m){var p=this;this.abort();var w=this.config,x=w.fLoader,g=w.loader;return new Promise(function(f,d){p.loader&&p.loader.destroy();var a=p.loader=u.loader=x?new x(w):new g(w),C=k(u,T),v={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:M};T.stats=a.stats,a.load(C,v,{onSuccess:function(y,G,$,Z){p.resetLoader(u,a),p.updateStatsFromPart(u,T);var V={frag:u,part:T,payload:y.data,networkDetails:Z};m(V),f(V)},onError:function(y,G,$){p.resetLoader(u,a),d(new S({type:A.ErrorTypes.NETWORK_ERROR,details:A.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:T,response:y,networkDetails:$}))},onAbort:function(y,G,$){u.stats.aborted=T.stats.aborted,p.resetLoader(u,a),d(new S({type:A.ErrorTypes.NETWORK_ERROR,details:A.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:T,networkDetails:$}))},onTimeout:function(y,G,$){p.resetLoader(u,a),d(new S({type:A.ErrorTypes.NETWORK_ERROR,details:A.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:T,networkDetails:$}))}})})},o.updateStatsFromPart=function(u,T){var m=u.stats,p=T.stats,w=p.total;if(m.loaded+=p.loaded,w){var x=Math.round(u.duration/T.duration),g=Math.min(Math.round(m.loaded/w),x),f=x-g,d=f*Math.round(m.loaded/g);m.total=m.loaded+d}else m.total=Math.max(m.loaded,m.total);var a=m.loading,C=p.loading;a.start?a.first+=C.first-C.start:(a.start=C.start,a.first=C.first),a.end=C.end},o.resetLoader=function(u,T){u.loader=null,this.loader===T&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),T.destroy()},c}();function k(c,o){o===void 0&&(o=null);var l=o||c,u={frag:c,part:o,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},T=l.byteRangeStartOffset,m=l.byteRangeEndOffset;return Object(z.isFiniteNumber)(T)&&Object(z.isFiniteNumber)(m)&&(u.rangeStart=T,u.rangeEnd=m),u}var S=function(c){I(o,c);function o(l){for(var u,T=arguments.length,m=new Array(T>1?T-1:0),p=1;p<T;p++)m[p-1]=arguments[p];return u=c.call.apply(c,[this].concat(m))||this,u.data=void 0,u.data=l,u}return o}(W(Error))},"./src/loader/fragment.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"ElementaryStreamTypes",function(){return R}),L.d(Y,"BaseSegment",function(){return k}),L.d(Y,"Fragment",function(){return S}),L.d(Y,"Part",function(){return c});var z=L("./src/polyfills/number.ts"),A=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(A),W=L("./src/utils/logger.ts"),j=L("./src/loader/level-key.ts"),P=L("./src/loader/load-stats.ts");function D(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,E(o,l)}function E(o,l){return E=Object.setPrototypeOf||function(T,m){return T.__proto__=m,T},E(o,l)}function _(o,l){for(var u=0;u<l.length;u++){var T=l[u];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(o,T.key,T)}}function M(o,l,u){return l&&_(o.prototype,l),u&&_(o,u),o}var R;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(R||(R={}));var k=function(){function o(u){var T;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(T={},T[R.AUDIO]=null,T[R.VIDEO]=null,T[R.AUDIOVIDEO]=null,T),this.baseurl=u}var l=o.prototype;return l.setByteRange=function(T,m){var p=T.split("@",2),w=[];p.length===1?w[0]=m?m.byteRangeEndOffset:0:w[0]=parseInt(p[1]),w[1]=parseInt(p[0])+w[0],this._byteRange=w},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(A.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(T){this._url=T}}]),o}(),S=function(o){D(l,o);function l(T,m){var p;return p=o.call(this,m)||this,p._decryptdata=null,p.rawProgramDateTime=null,p.programDateTime=null,p.tagList=[],p.duration=0,p.sn=0,p.levelkey=void 0,p.type=void 0,p.loader=null,p.level=-1,p.cc=0,p.startPTS=void 0,p.endPTS=void 0,p.appendedPTS=void 0,p.startDTS=void 0,p.endDTS=void 0,p.start=0,p.deltaPTS=void 0,p.maxStartPTS=void 0,p.minEndPTS=void 0,p.stats=new P.LoadStats,p.urlId=0,p.data=void 0,p.bitrateTest=!1,p.title=null,p.initSegment=null,p.type=T,p}var u=l.prototype;return u.createInitializationVector=function(m){for(var p=new Uint8Array(16),w=12;w<16;w++)p[w]=m>>8*(15-w)&255;return p},u.setDecryptDataFromLevelKey=function(m,p){var w=m;return(m==null?void 0:m.method)==="AES-128"&&m.uri&&!m.iv&&(w=j.LevelKey.fromURI(m.uri),w.method=m.method,w.iv=this.createInitializationVector(p),w.keyFormat="identity"),w},u.setElementaryStreamInfo=function(m,p,w,x,g,f){f===void 0&&(f=!1);var d=this.elementaryStreams,a=d[m];if(!a){d[m]={startPTS:p,endPTS:w,startDTS:x,endDTS:g,partial:f};return}a.startPTS=Math.min(a.startPTS,p),a.endPTS=Math.max(a.endPTS,w),a.startDTS=Math.min(a.startDTS,x),a.endDTS=Math.max(a.endDTS,g)},u.clearElementaryStreamInfo=function(){var m=this.elementaryStreams;m[R.AUDIO]=null,m[R.VIDEO]=null,m[R.AUDIOVIDEO]=null},M(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var m=this.sn;typeof m!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&W.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),m=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,m)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(z.isFiniteNumber)(this.programDateTime))return null;var m=Object(z.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+m*1e3}},{key:"encrypted",get:function(){var m;return!!((m=this.decryptdata)!==null&&m!==void 0&&m.keyFormat&&this.decryptdata.uri)}}]),l}(k),c=function(o){D(l,o);function l(u,T,m,p,w){var x;x=o.call(this,m)||this,x.fragOffset=0,x.duration=0,x.gap=!1,x.independent=!1,x.relurl=void 0,x.fragment=void 0,x.index=void 0,x.stats=new P.LoadStats,x.duration=u.decimalFloatingPoint("DURATION"),x.gap=u.bool("GAP"),x.independent=u.bool("INDEPENDENT"),x.relurl=u.enumeratedString("URI"),x.fragment=T,x.index=p;var g=u.enumeratedString("BYTERANGE");return g&&x.setByteRange(g,w),w&&(x.fragOffset=w.fragOffset+w.duration),x}return M(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var T=this.elementaryStreams;return!!(T.audio||T.video||T.audiovideo)}}]),l}(k)},"./src/loader/key-loader.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return W});var z=L("./src/events.ts"),A=L("./src/errors.ts"),I=L("./src/utils/logger.ts"),W=function(){function j(D){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=D,this._registerListeners()}var P=j.prototype;return P._registerListeners=function(){this.hls.on(z.Events.KEY_LOADING,this.onKeyLoading,this)},P._unregisterListeners=function(){this.hls.off(z.Events.KEY_LOADING,this.onKeyLoading)},P.destroy=function(){this._unregisterListeners();for(var E in this.loaders){var _=this.loaders[E];_&&_.destroy()}this.loaders={}},P.onKeyLoading=function(E,_){var M=_.frag,R=M.type,k=this.loaders[R];if(!M.decryptdata){I.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var S=M.decryptdata.uri;if(S!==this.decrypturl||this.decryptkey===null){var c=this.hls.config;if(k&&(I.logger.warn("abort previous key loader for type:"+R),k.abort()),!S){I.logger.warn("key uri is falsy");return}var o=c.loader,l=M.loader=this.loaders[R]=new o(c);this.decrypturl=S,this.decryptkey=null;var u={url:S,frag:M,responseType:"arraybuffer"},T={timeout:c.fragLoadingTimeOut,maxRetry:0,retryDelay:c.fragLoadingRetryDelay,maxRetryDelay:c.fragLoadingMaxRetryTimeout,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(u,T,m)}else this.decryptkey&&(M.decryptdata.key=this.decryptkey,this.hls.trigger(z.Events.KEY_LOADED,{frag:M}))},P.loadsuccess=function(E,_,M){var R=M.frag;if(!R.decryptdata){I.logger.error("after key load, decryptdata unset");return}this.decryptkey=R.decryptdata.key=new Uint8Array(E.data),R.loader=null,delete this.loaders[R.type],this.hls.trigger(z.Events.KEY_LOADED,{frag:R})},P.loaderror=function(E,_){var M=_.frag,R=M.loader;R&&R.abort(),delete this.loaders[M.type],this.hls.trigger(z.Events.ERROR,{type:A.ErrorTypes.NETWORK_ERROR,details:A.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:M,response:E})},P.loadtimeout=function(E,_){var M=_.frag,R=M.loader;R&&R.abort(),delete this.loaders[M.type],this.hls.trigger(z.Events.ERROR,{type:A.ErrorTypes.NETWORK_ERROR,details:A.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:M})},j}()},"./src/loader/level-details.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"LevelDetails",function(){return j});var z=L("./src/polyfills/number.ts");function A(P,D){for(var E=0;E<D.length;E++){var _=D[E];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(P,_.key,_)}}function I(P,D,E){return D&&A(P.prototype,D),E&&A(P,E),P}var W=10,j=function(){function P(E){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=E}var D=P.prototype;return D.reloaded=function(_){if(!_){this.advanced=!0,this.updated=!0;return}var M=this.lastPartSn-_.lastPartSn,R=this.lastPartIndex-_.lastPartIndex;this.updated=this.endSN!==_.endSN||!!R||!!M,this.advanced=this.endSN>_.endSN||M>0||M===0&&R>0,this.updated||this.advanced?this.misses=Math.floor(_.misses*.6):this.misses=_.misses+1,this.availabilityDelay=_.availabilityDelay},I(P,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(z.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||W}},{key:"drift",get:function(){var _=this.driftEndTime-this.driftStartTime;if(_>0){var M=this.driftEnd-this.driftStart;return M*1e3/_}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var _;return(_=this.partList)!==null&&_!==void 0&&_.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var _;return(_=this.fragments)!==null&&_!==void 0&&_.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var _;return(_=this.partList)!==null&&_!==void 0&&_.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var _;return(_=this.partList)!==null&&_!==void 0&&_.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),P}()},"./src/loader/level-key.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"LevelKey",function(){return j});var z=L("./node_modules/url-toolkit/src/url-toolkit.js"),A=L.n(z);function I(P,D){for(var E=0;E<D.length;E++){var _=D[E];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(P,_.key,_)}}function W(P,D,E){return D&&I(P.prototype,D),E&&I(P,E),P}var j=function(){P.fromURL=function(E,_){return new P(E,_)},P.fromURI=function(E){return new P(E)};function P(D,E){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,E?this._uri=Object(z.buildAbsoluteURL)(D,E,{alwaysNormalize:!0}):this._uri=D}return W(P,[{key:"uri",get:function(){return this._uri}}]),P}()},"./src/loader/load-stats.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"LoadStats",function(){return z});var z=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return l});var z=L("./src/polyfills/number.ts"),A=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(A),W=L("./src/loader/fragment.ts"),j=L("./src/loader/level-details.ts"),P=L("./src/loader/level-key.ts"),D=L("./src/utils/attr-list.ts"),E=L("./src/utils/logger.ts"),_=L("./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,R=/#EXT-X-MEDIA:(.*)/g,k=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),S=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("|")),c=/\.(mp4|m4s|m4v|m4a)$/i;function o(w){var x,g;return c.test((x=(g=A.parseURL(w))===null||g===void 0?void 0:g.path)!=null?x:"")}var l=function(){function w(){}return w.findGroup=function(g,f){for(var d=0;d<g.length;d++){var a=g[d];if(a.id===f)return a}},w.convertAVC1ToAVCOTI=function(g){var f=g.split(".");if(f.length>2){var d=f.shift()+".";return d+=parseInt(f.shift()).toString(16),d+=("000"+parseInt(f.shift()).toString(16)).substr(-4),d}return g},w.resolve=function(g,f){return A.buildAbsoluteURL(f,g,{alwaysNormalize:!0})},w.parseMasterPlaylist=function(g,f){var d=[],a={},C=!1;M.lastIndex=0;for(var v;(v=M.exec(g))!=null;)if(v[1]){var b=new D.AttrList(v[1]),y={attrs:b,bitrate:b.decimalInteger("AVERAGE-BANDWIDTH")||b.decimalInteger("BANDWIDTH"),name:b.NAME,url:w.resolve(v[2],f)},G=b.decimalResolution("RESOLUTION");G&&(y.width=G.width,y.height=G.height),u((b.CODECS||"").split(/[ ,]+/).filter(function(Z){return Z}),y),y.videoCodec&&y.videoCodec.indexOf("avc1")!==-1&&(y.videoCodec=w.convertAVC1ToAVCOTI(y.videoCodec)),d.push(y)}else if(v[3]){var $=new D.AttrList(v[3]);$["DATA-ID"]&&(C=!0,a[$["DATA-ID"]]=$)}return{levels:d,sessionData:C?a:null}},w.parseMasterPlaylistMedia=function(g,f,d,a){a===void 0&&(a=[]);var C,v=[],b=0;for(R.lastIndex=0;(C=R.exec(g))!==null;){var y=new D.AttrList(C[1]);if(y.TYPE===d){var G={attrs:y,bitrate:0,id:b++,groupId:y["GROUP-ID"],instreamId:y["INSTREAM-ID"],name:y.NAME||y.LANGUAGE||"",type:d,default:y.bool("DEFAULT"),autoselect:y.bool("AUTOSELECT"),forced:y.bool("FORCED"),lang:y.LANGUAGE,url:y.URI?w.resolve(y.URI,f):""};if(a.length){var $=w.findGroup(a,G.groupId)||a[0];T(G,$,"audioCodec"),T(G,$,"textCodec")}v.push(G)}}return v},w.parseLevelPlaylist=function(g,f,d,a,C){var v=new j.LevelDetails(f),b=v.fragments,y=null,G=0,$=0,Z=0,V=0,H=null,re=new W.Fragment(a,f),ce,Ee,we,Ye=-1,Ne=!1;for(k.lastIndex=0,v.m3u8=g;(ce=k.exec(g))!==null;){Ne&&(Ne=!1,re=new W.Fragment(a,f),re.start=Z,re.sn=G,re.cc=V,re.level=d,y&&(re.initSegment=y,re.rawProgramDateTime=y.rawProgramDateTime));var Ie=ce[1];if(Ie){re.duration=parseFloat(Ie);var We=(" "+ce[2]).slice(1);re.title=We||null,re.tagList.push(We?["INF",Ie,We]:["INF",Ie])}else if(ce[3])Object(z.isFiniteNumber)(re.duration)&&(re.start=Z,we&&(re.levelkey=we),re.sn=G,re.level=d,re.cc=V,re.urlId=C,b.push(re),re.relurl=(" "+ce[3]).slice(1),p(re,H),H=re,Z+=re.duration,G++,$=0,Ne=!0);else if(ce[4]){var Ue=(" "+ce[4]).slice(1);H?re.setByteRange(Ue,H):re.setByteRange(Ue)}else if(ce[5])re.rawProgramDateTime=(" "+ce[5]).slice(1),re.tagList.push(["PROGRAM-DATE-TIME",re.rawProgramDateTime]),Ye===-1&&(Ye=b.length);else{if(ce=ce[0].match(S),!ce){E.logger.warn("No matches on slow regex match for level playlist!");continue}for(Ee=1;Ee<ce.length&&!(typeof ce[Ee]!="undefined");Ee++);var xe=(" "+ce[Ee]).slice(1),se=(" "+ce[Ee+1]).slice(1),ke=ce[Ee+2]?(" "+ce[Ee+2]).slice(1):"";switch(xe){case"PLAYLIST-TYPE":v.type=se.toUpperCase();break;case"MEDIA-SEQUENCE":G=v.startSN=parseInt(se);break;case"SKIP":{var dt=new D.AttrList(se),at=dt.decimalInteger("SKIPPED-SEGMENTS");if(Object(z.isFiniteNumber)(at)){v.skippedSegments=at;for(var rt=at;rt--;)b.unshift(null);G+=at}var lt=dt.enumeratedString("RECENTLY-REMOVED-DATERANGES");lt&&(v.recentlyRemovedDateranges=lt.split(" "));break}case"TARGETDURATION":v.targetduration=parseFloat(se);break;case"VERSION":v.version=parseInt(se);break;case"EXTM3U":break;case"ENDLIST":v.live=!1;break;case"#":(se||ke)&&re.tagList.push(ke?[se,ke]:[se]);break;case"DIS":V++;case"GAP":re.tagList.push([xe]);break;case"BITRATE":re.tagList.push([xe,se]);break;case"DISCONTINUITY-SEQ":V=parseInt(se);break;case"KEY":{var Ke,$e=new D.AttrList(se),it=$e.enumeratedString("METHOD"),ft=$e.URI,ut=$e.hexadecimalInteger("IV"),Ze=$e.enumeratedString("KEYFORMATVERSIONS"),qe=$e.enumeratedString("KEYID"),Dt=(Ke=$e.enumeratedString("KEYFORMAT"))!=null?Ke:"identity",wt=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(wt.indexOf(Dt)>-1){E.logger.warn("Keyformat "+Dt+" is not supported from the manifest");continue}else if(Dt!=="identity")continue;it&&(we=P.LevelKey.fromURL(f,ft),ft&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(it)>=0&&(we.method=it,we.keyFormat=Dt,qe&&(we.keyID=qe),Ze&&(we.keyFormatVersions=Ze),we.iv=ut));break}case"START":{var vt=new D.AttrList(se),mt=vt.decimalFloatingPoint("TIME-OFFSET");Object(z.isFiniteNumber)(mt)&&(v.startTimeOffset=mt);break}case"MAP":{var Nt=new D.AttrList(se);re.relurl=Nt.URI,Nt.BYTERANGE&&re.setByteRange(Nt.BYTERANGE),re.level=d,re.sn="initSegment",we&&(re.levelkey=we),re.initSegment=null,y=re,Ne=!0;break}case"SERVER-CONTROL":{var At=new D.AttrList(se);v.canBlockReload=At.bool("CAN-BLOCK-RELOAD"),v.canSkipUntil=At.optionalFloat("CAN-SKIP-UNTIL",0),v.canSkipDateRanges=v.canSkipUntil>0&&At.bool("CAN-SKIP-DATERANGES"),v.partHoldBack=At.optionalFloat("PART-HOLD-BACK",0),v.holdBack=At.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ot=new D.AttrList(se);v.partTarget=Ot.decimalFloatingPoint("PART-TARGET");break}case"PART":{var He=v.partList;He||(He=v.partList=[]);var Ut=$>0?He[He.length-1]:void 0,Lt=$++,Xe=new W.Part(new D.AttrList(se),re,f,Lt,Ut);He.push(Xe),re.duration+=Xe.duration;break}case"PRELOAD-HINT":{var nt=new D.AttrList(se);v.preloadHint=nt;break}case"RENDITION-REPORT":{var _e=new D.AttrList(se);v.renditionReports=v.renditionReports||[],v.renditionReports.push(_e);break}default:E.logger.warn("line parsed but not handled: "+ce);break}}}H&&!H.relurl?(b.pop(),Z-=H.duration,v.partList&&(v.fragmentHint=H)):v.partList&&(p(re,H),re.cc=V,v.fragmentHint=re);var ve=b.length,Ce=b[0],ne=b[ve-1];if(Z+=v.skippedSegments*v.targetduration,Z>0&&ve&&ne){v.averagetargetduration=Z/ve;var ie=ne.sn;v.endSN=ie!=="initSegment"?ie:0,Ce&&(v.startCC=Ce.cc,Ce.initSegment||v.fragments.every(function(ue){return ue.relurl&&o(ue.relurl)})&&(E.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),re=new W.Fragment(a,f),re.relurl=ne.relurl,re.level=d,re.sn="initSegment",Ce.initSegment=re,v.needSidxRanges=!0))}else v.endSN=0,v.startCC=0;return v.fragmentHint&&(Z+=v.fragmentHint.duration),v.totalduration=Z,v.endCC=V,Ye>0&&m(b,Ye),v},w}();function u(w,x){["video","audio","text"].forEach(function(g){var f=w.filter(function(a){return Object(_.isCodecType)(a,g)});if(f.length){var d=f.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});x[g+"Codec"]=d.length>0?d[0]:f[0],w=w.filter(function(a){return f.indexOf(a)===-1})}}),x.unknownCodecs=w}function T(w,x,g){var f=x[g];f&&(w[g]=f)}function m(w,x){for(var g=w[x],f=x;f--;){var d=w[f];if(!d)return;d.programDateTime=g.programDateTime-d.duration*1e3,g=d}}function p(w,x){w.rawProgramDateTime?w.programDateTime=Date.parse(w.rawProgramDateTime):x!=null&&x.programDateTime&&(w.programDateTime=x.endProgramDateTime),Object(z.isFiniteNumber)(w.programDateTime)||(w.programDateTime=null,w.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(le,Y,L){"use strict";L.r(Y);var z=L("./src/polyfills/number.ts"),A=L("./src/events.ts"),I=L("./src/errors.ts"),W=L("./src/utils/logger.ts"),j=L("./src/utils/mp4-tools.ts"),P=L("./src/loader/m3u8-parser.ts"),D=L("./src/types/loader.ts"),E=L("./src/utils/attr-list.ts");function _(k){var S=k.type;switch(S){case D.PlaylistContextType.AUDIO_TRACK:return D.PlaylistLevelType.AUDIO;case D.PlaylistContextType.SUBTITLE_TRACK:return D.PlaylistLevelType.SUBTITLE;default:return D.PlaylistLevelType.MAIN}}function M(k,S){var c=k.url;return(c===void 0||c.indexOf("data:")===0)&&(c=S.url),c}var R=function(){function k(c){this.hls=void 0,this.loaders=Object.create(null),this.hls=c,this.registerListeners()}var S=k.prototype;return S.registerListeners=function(){var o=this.hls;o.on(A.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(A.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(A.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(A.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},S.unregisterListeners=function(){var o=this.hls;o.off(A.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(A.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(A.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(A.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},S.createInternalLoader=function(o){var l=this.hls.config,u=l.pLoader,T=l.loader,m=u||T,p=new m(l);return o.loader=p,this.loaders[o.type]=p,p},S.getInternalLoader=function(o){return this.loaders[o.type]},S.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},S.destroyInternalLoaders=function(){for(var o in this.loaders){var l=this.loaders[o];l&&l.destroy(),this.resetInternalLoader(o)}},S.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},S.onManifestLoading=function(o,l){var u=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:D.PlaylistContextType.MANIFEST,url:u,deliveryDirectives:null})},S.onLevelLoading=function(o,l){var u=l.id,T=l.level,m=l.url,p=l.deliveryDirectives;this.load({id:u,groupId:null,level:T,responseType:"text",type:D.PlaylistContextType.LEVEL,url:m,deliveryDirectives:p})},S.onAudioTrackLoading=function(o,l){var u=l.id,T=l.groupId,m=l.url,p=l.deliveryDirectives;this.load({id:u,groupId:T,level:null,responseType:"text",type:D.PlaylistContextType.AUDIO_TRACK,url:m,deliveryDirectives:p})},S.onSubtitleTrackLoading=function(o,l){var u=l.id,T=l.groupId,m=l.url,p=l.deliveryDirectives;this.load({id:u,groupId:T,level:null,responseType:"text",type:D.PlaylistContextType.SUBTITLE_TRACK,url:m,deliveryDirectives:p})},S.load=function(o){var l,u=this.hls.config,T=this.getInternalLoader(o);if(T){var m=T.context;if(m&&m.url===o.url){W.logger.trace("[playlist-loader]: playlist request ongoing");return}W.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),T.abort()}var p,w,x,g;switch(o.type){case D.PlaylistContextType.MANIFEST:p=u.manifestLoadingMaxRetry,w=u.manifestLoadingTimeOut,x=u.manifestLoadingRetryDelay,g=u.manifestLoadingMaxRetryTimeout;break;case D.PlaylistContextType.LEVEL:case D.PlaylistContextType.AUDIO_TRACK:case D.PlaylistContextType.SUBTITLE_TRACK:p=0,w=u.levelLoadingTimeOut;break;default:p=u.levelLoadingMaxRetry,w=u.levelLoadingTimeOut,x=u.levelLoadingRetryDelay,g=u.levelLoadingMaxRetryTimeout;break}if(T=this.createInternalLoader(o),(l=o.deliveryDirectives)!==null&&l!==void 0&&l.part){var f;if(o.type===D.PlaylistContextType.LEVEL&&o.level!==null?f=this.hls.levels[o.level].details:o.type===D.PlaylistContextType.AUDIO_TRACK&&o.id!==null?f=this.hls.audioTracks[o.id].details:o.type===D.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(f=this.hls.subtitleTracks[o.id].details),f){var d=f.partTarget,a=f.targetduration;d&&a&&(w=Math.min(Math.max(d*3,a*.8)*1e3,w))}}var C={timeout:w,maxRetry:p,retryDelay:x,maxRetryDelay:g,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};T.load(o,C,v)},S.loadsuccess=function(o,l,u,T){if(T===void 0&&(T=null),u.isSidxRequest){this.handleSidxRequest(o,u),this.handlePlaylistLoaded(o,l,u,T);return}this.resetInternalLoader(u.type);var m=o.data;if(m.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,u,"no EXTM3U delimiter",T);return}l.parsing.start=performance.now(),m.indexOf("#EXTINF:")>0||m.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,l,u,T):this.handleMasterPlaylist(o,l,u,T)},S.loaderror=function(o,l,u){u===void 0&&(u=null),this.handleNetworkError(l,u,!1,o)},S.loadtimeout=function(o,l,u){u===void 0&&(u=null),this.handleNetworkError(l,u,!0)},S.handleMasterPlaylist=function(o,l,u,T){var m=this.hls,p=o.data,w=M(o,u),x=P.default.parseMasterPlaylist(p,w),g=x.levels,f=x.sessionData;if(!g.length){this.handleManifestParsingError(o,u,"no level found in manifest",T);return}var d=g.map(function(G){return{id:G.attrs.AUDIO,audioCodec:G.audioCodec}}),a=g.map(function(G){return{id:G.attrs.SUBTITLES,textCodec:G.textCodec}}),C=P.default.parseMasterPlaylistMedia(p,w,"AUDIO",d),v=P.default.parseMasterPlaylistMedia(p,w,"SUBTITLES",a),b=P.default.parseMasterPlaylistMedia(p,w,"CLOSED-CAPTIONS");if(C.length){var y=C.some(function(G){return!G.url});!y&&g[0].audioCodec&&!g[0].attrs.AUDIO&&(W.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),C.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new E.AttrList({}),bitrate:0,url:""}))}m.trigger(A.Events.MANIFEST_LOADED,{levels:g,audioTracks:C,subtitles:v,captions:b,url:w,stats:l,networkDetails:T,sessionData:f})},S.handleTrackOrLevelPlaylist=function(o,l,u,T){var m=this.hls,p=u.id,w=u.level,x=u.type,g=M(o,u),f=Object(z.isFiniteNumber)(p)?p:0,d=Object(z.isFiniteNumber)(w)?w:f,a=_(u),C=P.default.parseLevelPlaylist(o.data,g,d,a,f);if(!C.fragments.length){m.trigger(A.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:g,reason:"no fragments found in level",level:typeof u.level=="number"?u.level:void 0});return}if(x===D.PlaylistContextType.MANIFEST){var v={attrs:new E.AttrList({}),bitrate:0,details:C,name:"",url:g};m.trigger(A.Events.MANIFEST_LOADED,{levels:[v],audioTracks:[],url:g,stats:l,networkDetails:T,sessionData:null})}if(l.parsing.end=performance.now(),C.needSidxRanges){var b,y=(b=C.fragments[0].initSegment)===null||b===void 0?void 0:b.url;this.load({url:y,isSidxRequest:!0,type:x,level:w,levelDetails:C,id:p,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=C,this.handlePlaylistLoaded(o,l,u,T)},S.handleSidxRequest=function(o,l){var u=Object(j.parseSegmentIndex)(new Uint8Array(o.data));if(!u)return;var T=u.references,m=l.levelDetails;T.forEach(function(p,w){var x=p.info,g=m.fragments[w];g.byteRange.length===0&&g.setByteRange(String(1+x.end-x.start)+"@"+String(x.start)),g.initSegment&&g.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},S.handleManifestParsingError=function(o,l,u,T){this.hls.trigger(A.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===D.PlaylistContextType.MANIFEST,url:o.url,reason:u,response:o,context:l,networkDetails:T})},S.handleNetworkError=function(o,l,u,T){u===void 0&&(u=!1),W.logger.warn("[playlist-loader]: A network "+(u?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var m=I.ErrorDetails.UNKNOWN,p=!1,w=this.getInternalLoader(o);switch(o.type){case D.PlaylistContextType.MANIFEST:m=u?I.ErrorDetails.MANIFEST_LOAD_TIMEOUT:I.ErrorDetails.MANIFEST_LOAD_ERROR,p=!0;break;case D.PlaylistContextType.LEVEL:m=u?I.ErrorDetails.LEVEL_LOAD_TIMEOUT:I.ErrorDetails.LEVEL_LOAD_ERROR,p=!1;break;case D.PlaylistContextType.AUDIO_TRACK:m=u?I.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,p=!1;break;case D.PlaylistContextType.SUBTITLE_TRACK:m=u?I.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:I.ErrorDetails.SUBTITLE_LOAD_ERROR,p=!1;break}w&&this.resetInternalLoader(o.type);var x={type:I.ErrorTypes.NETWORK_ERROR,details:m,fatal:p,url:o.url,loader:w,context:o,networkDetails:l};T&&(x.response=T),this.hls.trigger(A.Events.ERROR,x)},S.handlePlaylistLoaded=function(o,l,u,T){var m=u.type,p=u.level,w=u.id,x=u.groupId,g=u.loader,f=u.levelDetails,d=u.deliveryDirectives;if(!(f!=null&&f.targetduration)){this.handleManifestParsingError(o,u,"invalid target duration",T);return}if(!g)return;f.live&&(g.getCacheAge&&(f.ageHeader=g.getCacheAge()||0),(!g.getCacheAge||isNaN(f.ageHeader))&&(f.ageHeader=0));switch(m){case D.PlaylistContextType.MANIFEST:case D.PlaylistContextType.LEVEL:this.hls.trigger(A.Events.LEVEL_LOADED,{details:f,level:p||0,id:w||0,stats:l,networkDetails:T,deliveryDirectives:d});break;case D.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(A.Events.AUDIO_TRACK_LOADED,{details:f,id:w||0,groupId:x||"",stats:l,networkDetails:T,deliveryDirectives:d});break;case D.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(A.Events.SUBTITLE_TRACK_LOADED,{details:f,id:w||0,groupId:x||"",stats:l,networkDetails:T,deliveryDirectives:d});break}},k}();Y.default=R},"./src/polyfills/number.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"isFiniteNumber",function(){return z}),L.d(Y,"MAX_SAFE_INTEGER",function(){return A});var z=Number.isFinite||function(I){return typeof I=="number"&&isFinite(I)},A=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(le,Y,L){"use strict";L.r(Y);var z=function(){function A(){}return A.getSilentFrame=function(W,j){switch(W){case"mp4a.40.2":if(j===1)return new Uint8Array([0,200,0,128,35,128]);if(j===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(j===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(j===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(j===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(j===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(j===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(j===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(j===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},A}();Y.default=z},"./src/remux/mp4-generator.ts":function(le,Y,L){"use strict";L.r(Y);var z=Math.pow(2,32)-1,A=function(){function I(){}return I.init=function(){I.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 j;for(j in I.types)I.types.hasOwnProperty(j)&&(I.types[j]=[j.charCodeAt(0),j.charCodeAt(1),j.charCodeAt(2),j.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]),D=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);I.HDLR_TYPES={video:P,audio:D};var E=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),_=new Uint8Array([0,0,0,0,0,0,0,0]);I.STTS=I.STSC=I.STCO=_,I.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),I.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),I.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),I.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var M=new Uint8Array([105,115,111,109]),R=new Uint8Array([97,118,99,49]),k=new Uint8Array([0,0,0,1]);I.FTYP=I.box(I.types.ftyp,M,k,M,R),I.DINF=I.box(I.types.dinf,I.box(I.types.dref,E))},I.box=function(j){for(var P=8,D=arguments.length,E=new Array(D>1?D-1:0),_=1;_<D;_++)E[_-1]=arguments[_];for(var M=E.length,R=M;M--;)P+=E[M].byteLength;var k=new Uint8Array(P);for(k[0]=P>>24&255,k[1]=P>>16&255,k[2]=P>>8&255,k[3]=P&255,k.set(j,4),M=0,P=8;M<R;M++)k.set(E[M],P),P+=E[M].byteLength;return k},I.hdlr=function(j){return I.box(I.types.hdlr,I.HDLR_TYPES[j])},I.mdat=function(j){return I.box(I.types.mdat,j)},I.mdhd=function(j,P){P*=j;var D=Math.floor(P/(z+1)),E=Math.floor(P%(z+1));return I.box(I.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,j>>24&255,j>>16&255,j>>8&255,j&255,D>>24,D>>16&255,D>>8&255,D&255,E>>24,E>>16&255,E>>8&255,E&255,85,196,0,0]))},I.mdia=function(j){return I.box(I.types.mdia,I.mdhd(j.timescale,j.duration),I.hdlr(j.type),I.minf(j))},I.mfhd=function(j){return I.box(I.types.mfhd,new Uint8Array([0,0,0,0,j>>24,j>>16&255,j>>8&255,j&255]))},I.minf=function(j){return j.type==="audio"?I.box(I.types.minf,I.box(I.types.smhd,I.SMHD),I.DINF,I.stbl(j)):I.box(I.types.minf,I.box(I.types.vmhd,I.VMHD),I.DINF,I.stbl(j))},I.moof=function(j,P,D){return I.box(I.types.moof,I.mfhd(j),I.traf(D,P))},I.moov=function(j){for(var P=j.length,D=[];P--;)D[P]=I.trak(j[P]);return I.box.apply(null,[I.types.moov,I.mvhd(j[0].timescale,j[0].duration)].concat(D).concat(I.mvex(j)))},I.mvex=function(j){for(var P=j.length,D=[];P--;)D[P]=I.trex(j[P]);return I.box.apply(null,[I.types.mvex].concat(D))},I.mvhd=function(j,P){P*=j;var D=Math.floor(P/(z+1)),E=Math.floor(P%(z+1)),_=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,j>>24&255,j>>16&255,j>>8&255,j&255,D>>24,D>>16&255,D>>8&255,D&255,E>>24,E>>16&255,E>>8&255,E&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return I.box(I.types.mvhd,_)},I.sdtp=function(j){var P=j.samples||[],D=new Uint8Array(4+P.length),E,_;for(E=0;E<P.length;E++)_=P[E].flags,D[E+4]=_.dependsOn<<4|_.isDependedOn<<2|_.hasRedundancy;return I.box(I.types.sdtp,D)},I.stbl=function(j){return I.box(I.types.stbl,I.stsd(j),I.box(I.types.stts,I.STTS),I.box(I.types.stsc,I.STSC),I.box(I.types.stsz,I.STSZ),I.box(I.types.stco,I.STCO))},I.avc1=function(j){var P=[],D=[],E,_,M;for(E=0;E<j.sps.length;E++)_=j.sps[E],M=_.byteLength,P.push(M>>>8&255),P.push(M&255),P=P.concat(Array.prototype.slice.call(_));for(E=0;E<j.pps.length;E++)_=j.pps[E],M=_.byteLength,D.push(M>>>8&255),D.push(M&255),D=D.concat(Array.prototype.slice.call(_));var R=I.box(I.types.avcC,new Uint8Array([1,P[3],P[4],P[5],252|3,224|j.sps.length].concat(P).concat([j.pps.length]).concat(D))),k=j.width,S=j.height,c=j.pixelRatio[0],o=j.pixelRatio[1];return I.box(I.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,k>>8&255,k&255,S>>8&255,S&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),R,I.box(I.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),I.box(I.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,c&255,o>>24,o>>16&255,o>>8&255,o&255])))},I.esds=function(j){var P=j.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(j.config).concat([6,1,2]))},I.mp4a=function(j){var P=j.samplerate;return I.box(I.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,j.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]),I.box(I.types.esds,I.esds(j)))},I.mp3=function(j){var P=j.samplerate;return I.box(I.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,j.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]))},I.stsd=function(j){return j.type==="audio"?!j.isAAC&&j.codec==="mp3"?I.box(I.types.stsd,I.STSD,I.mp3(j)):I.box(I.types.stsd,I.STSD,I.mp4a(j)):I.box(I.types.stsd,I.STSD,I.avc1(j))},I.tkhd=function(j){var P=j.id,D=j.duration*j.timescale,E=j.width,_=j.height,M=Math.floor(D/(z+1)),R=Math.floor(D%(z+1));return I.box(I.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,R>>24,R>>16&255,R>>8&255,R&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,E>>8&255,E&255,0,0,_>>8&255,_&255,0,0]))},I.traf=function(j,P){var D=I.sdtp(j),E=j.id,_=Math.floor(P/(z+1)),M=Math.floor(P%(z+1));return I.box(I.types.traf,I.box(I.types.tfhd,new Uint8Array([0,0,0,0,E>>24,E>>16&255,E>>8&255,E&255])),I.box(I.types.tfdt,new Uint8Array([1,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,M>>24,M>>16&255,M>>8&255,M&255])),I.trun(j,D.length+16+20+8+16+8+8),D)},I.trak=function(j){return j.duration=j.duration||4294967295,I.box(I.types.trak,I.tkhd(j),I.mdia(j))},I.trex=function(j){var P=j.id;return I.box(I.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]))},I.trun=function(j,P){var D=j.samples||[],E=D.length,_=12+16*E,M=new Uint8Array(_),R,k,S,c,o,l;for(P+=8+_,M.set([0,0,15,1,E>>>24&255,E>>>16&255,E>>>8&255,E&255,P>>>24&255,P>>>16&255,P>>>8&255,P&255],0),R=0;R<E;R++)k=D[R],S=k.duration,c=k.size,o=k.flags,l=k.cts,M.set([S>>>24&255,S>>>16&255,S>>>8&255,S&255,c>>>24&255,c>>>16&255,c>>>8&255,c&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*R);return I.box(I.types.trun,M)},I.initSegment=function(j){I.types||I.init();var P=I.moov(j),D=new Uint8Array(I.FTYP.byteLength+P.byteLength);return D.set(I.FTYP),D.set(P,I.FTYP.byteLength),D},I}();A.types=void 0,A.HDLR_TYPES=void 0,A.STTS=void 0,A.STSC=void 0,A.STCO=void 0,A.STSZ=void 0,A.VMHD=void 0,A.SMHD=void 0,A.STSD=void 0,A.FTYP=void 0,A.DINF=void 0,Y.default=A},"./src/remux/mp4-remuxer.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return l}),L.d(Y,"normalizePts",function(){return u});var z=L("./src/polyfills/number.ts"),A=L("./src/remux/aac-helper.ts"),I=L("./src/remux/mp4-generator.ts"),W=L("./src/events.ts"),j=L("./src/errors.ts"),P=L("./src/utils/logger.ts"),D=L("./src/types/loader.ts"),E=L("./src/utils/timescale-conversion.ts");function _(){return _=Object.assign||function(w){for(var x=1;x<arguments.length;x++){var g=arguments[x];for(var f in g)Object.prototype.hasOwnProperty.call(g,f)&&(w[f]=g[f])}return w},_.apply(this,arguments)}var M=10*1e3,R=1024,k=1152,S=null,c=null,o=!1,l=function(){function w(g,f,d,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=f,this.typeSupported=d,this.ISGenerated=!1,S===null){var C=navigator.userAgent||"",v=C.match(/Chrome\/(\d+)/i);S=v?parseInt(v[1]):0}if(c===null){var b=navigator.userAgent.match(/Safari\/(\d+)/i);c=b?parseInt(b[1]):0}o=!!S&&S<75||!!c&&c<600}var x=w.prototype;return x.destroy=function(){},x.resetTimeStamp=function(f){P.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=f},x.resetNextTimestamp=function(){P.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},x.resetInitSegment=function(){P.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},x.getVideoStartPts=function(f){var d=!1,a=f.reduce(function(C,v){var b=v.pts-C;return b<-4294967296?(d=!0,u(C,v.pts)):b>0?C:v.pts},f[0].pts);return d&&P.logger.debug("PTS rollover detected"),a},x.remux=function(f,d,a,C,v,b,y,G){var $,Z,V,H,re,ce,Ee=v,we=v,Ye=f.pid>-1,Ne=d.pid>-1,Ie=d.samples.length,We=f.samples.length>0,Ue=Ie>1,xe=(!Ye||We)&&(!Ne||Ue)||this.ISGenerated||y;if(xe){this.ISGenerated||(V=this.generateIS(f,d,v));var se=this.isVideoContiguous,ke=-1;if(Ue&&(ke=T(d.samples),!se&&this.config.forceKeyFrameOnDiscontinuity))if(ce=!0,ke>0){P.logger.warn("[mp4-remuxer]: Dropped "+ke+" out of "+Ie+" video samples due to a missing keyframe");var dt=this.getVideoStartPts(d.samples);d.samples=d.samples.slice(ke),d.dropped+=ke,we+=(d.samples[0].pts-dt)/(d.timescale||9e4)}else ke===-1&&(P.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ie+" video samples"),ce=!1);if(this.ISGenerated){if(We&&Ue){var at=this.getVideoStartPts(d.samples),rt=u(f.samples[0].pts,at)-at,lt=rt/d.inputTimeScale;Ee+=Math.max(0,lt),we+=Math.max(0,-lt)}if(We){if(f.samplerate||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),V=this.generateIS(f,d,v)),Z=this.remuxAudio(f,Ee,this.isAudioContiguous,b,Ne||Ue||G===D.PlaylistLevelType.AUDIO?we:void 0),Ue){var Ke=Z?Z.endPTS-Z.startPTS:0;d.inputTimeScale||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),V=this.generateIS(f,d,v)),$=this.remuxVideo(d,we,se,Ke)}}else Ue&&($=this.remuxVideo(d,we,se,0));$&&($.firstKeyFrame=ke,$.independent=ke!==-1)}}return this.ISGenerated&&(a.samples.length&&(re=this.remuxID3(a,v)),C.samples.length&&(H=this.remuxText(C,v))),{audio:Z,video:$,initSegment:V,independent:ce,text:H,id3:re}},x.generateIS=function(f,d,a){var C=f.samples,v=d.samples,b=this.typeSupported,y={},G=!Object(z.isFiniteNumber)(this._initPTS),$="audio/mp4",Z,V,H;if(G&&(Z=V=Infinity),f.config&&C.length&&(f.timescale=f.samplerate,f.isAAC||(b.mpeg?($="audio/mpeg",f.codec=""):b.mp3&&(f.codec="mp3")),y.audio={id:"audio",container:$,codec:f.codec,initSegment:!f.isAAC&&b.mpeg?new Uint8Array(0):I.default.initSegment([f]),metadata:{channelCount:f.channelCount}},G&&(H=f.inputTimeScale,Z=V=C[0].pts-Math.round(H*a))),d.sps&&d.pps&&v.length&&(d.timescale=d.inputTimeScale,y.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:I.default.initSegment([d]),metadata:{width:d.width,height:d.height}},G)){H=d.inputTimeScale;var re=this.getVideoStartPts(v),ce=Math.round(H*a);V=Math.min(V,u(v[0].dts,re)-ce),Z=Math.min(Z,re-ce)}if(Object.keys(y).length)return this.ISGenerated=!0,G&&(this._initPTS=Z,this._initDTS=V),{tracks:y,initPTS:Z,timescale:H}},x.remuxVideo=function(f,d,a,C){var v=f.inputTimeScale,b=f.samples,y=[],G=b.length,$=this._initPTS,Z=this.nextAvcDts,V=8,H,re,ce,Ee=Number.POSITIVE_INFINITY,we=Number.NEGATIVE_INFINITY,Ye=0,Ne=!1;if(!a||Z===null){var Ie=d*v,We=b[0].pts-u(b[0].dts,b[0].pts);Z=Ie-We}for(var Ue=0;Ue<G;Ue++){var xe=b[Ue];if(xe.pts=u(xe.pts-$,Z),xe.dts=u(xe.dts-$,Z),xe.dts>xe.pts){var se=9e4*.2;Ye=Math.max(Math.min(Ye,xe.pts-xe.dts),-1*se)}xe.dts<b[Ue>0?Ue-1:Ue].dts&&(Ne=!0)}Ne&&b.sort(function(Gt,Tt){var Ge=Gt.dts-Tt.dts,gr=Gt.pts-Tt.pts;return Ge||gr}),re=b[0].dts,ce=b[b.length-1].dts;var ke=Math.round((ce-re)/(G-1));if(Ye<0){if(Ye<ke*-2){P.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(E.toMsFromMpegTsClock)(-ke,!0)+" ms");for(var dt=Ye,at=0;at<G;at++)b[at].dts=dt=Math.max(dt,b[at].pts-ke),b[at].pts=Math.max(dt,b[at].pts)}else{P.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(E.toMsFromMpegTsClock)(Ye,!0)+" ms to overcome this issue");for(var rt=0;rt<G;rt++)b[rt].dts=b[rt].dts+Ye}re=b[0].dts}if(a){var lt=re-Z,Ke=lt>ke,$e=lt<-1;if(Ke||$e){Ke?P.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(lt,!0)+" ms ("+lt+"dts) hole between fragments detected, filling it"):P.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(-lt,!0)+" ms ("+lt+"dts) overlapping between fragments detected"),re=Z;var it=b[0].pts-lt;b[0].dts=re,b[0].pts=it,P.logger.log("Video: First PTS/DTS adjusted: "+Object(E.toMsFromMpegTsClock)(it,!0)+"/"+Object(E.toMsFromMpegTsClock)(re,!0)+", delta: "+Object(E.toMsFromMpegTsClock)(lt,!0)+" ms")}}o&&(re=Math.max(0,re));for(var ft=0,ut=0,Ze=0;Ze<G;Ze++){for(var qe=b[Ze],Dt=qe.units,wt=Dt.length,vt=0,mt=0;mt<wt;mt++)vt+=Dt[mt].data.length;ut+=vt,ft+=wt,qe.length=vt,qe.dts=Math.max(qe.dts,re),qe.pts=Math.max(qe.pts,qe.dts,0),Ee=Math.min(qe.pts,Ee),we=Math.max(qe.pts,we)}ce=b[G-1].dts;var Nt=ut+4*ft+8,At;try{At=new Uint8Array(Nt)}catch(Gt){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:j.ErrorTypes.MUX_ERROR,details:j.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Nt,reason:"fail allocating video mdat "+Nt});return}var Ot=new DataView(At.buffer);Ot.setUint32(0,Nt),At.set(I.default.types.mdat,4);for(var He=0;He<G;He++){for(var Ut=b[He],Lt=Ut.units,Xe=0,nt=0,_e=Lt.length;nt<_e;nt++){var ve=Lt[nt],Ce=ve.data,ne=ve.data.byteLength;Ot.setUint32(V,ne),V+=4,At.set(Ce,V),V+=ne,Xe+=4+ne}if(He<G-1)H=b[He+1].dts-Ut.dts;else{var ie=this.config,ue=Ut.dts-b[He>0?He-1:He].dts;if(ie.stretchShortVideoTrack&&this.nextAudioPts!==null){var he=Math.floor(ie.maxBufferHole*v),Me=(C?Ee+C*v:this.nextAudioPts)-Ut.pts;Me>he?(H=Me-ue,H<0&&(H=ue),P.logger.log("[mp4-remuxer]: It is approximately "+Me/90+" ms to the next segment; using duration "+H/90+" ms for the last video frame.")):H=ue}else H=ue}var be=Math.round(Ut.pts-Ut.dts);y.push(new m(Ut.key,H,Xe,be))}if(y.length&&S&&S<70){var Le=y[0].flags;Le.dependsOn=2,Le.isNonSync=0}console.assert(H!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=Z=ce+H,this.isVideoContiguous=!0;var tt=I.default.moof(f.sequenceNumber++,re,_({},f,{samples:y})),pt="video",yt={data1:tt,data2:At,startPTS:Ee/v,endPTS:(we+H)/v,startDTS:re/v,endDTS:Z/v,type:pt,hasAudio:!1,hasVideo:!0,nb:y.length,dropped:f.dropped};return f.samples=[],f.dropped=0,console.assert(At.length,"MDAT length must not be zero"),yt},x.remuxAudio=function(f,d,a,C,v){var b=f.inputTimeScale,y=f.samplerate?f.samplerate:b,G=b/y,$=f.isAAC?R:k,Z=$*G,V=this._initPTS,H=!f.isAAC&&this.typeSupported.mpeg,re=[],ce=f.samples,Ee=H?0:8,we=this.nextAudioPts||-1,Ye=d*b;if(this.isAudioContiguous=a=a||ce.length&&we>0&&(C&&Math.abs(Ye-we)<9e3||Math.abs(u(ce[0].pts-V,Ye)-we)<20*Z),ce.forEach(function(Ce){Ce.pts=u(Ce.pts-V,Ye)}),!a||we<0){if(ce=ce.filter(function(Ce){return Ce.pts>=0}),!ce.length)return;v===0?we=0:C?we=Math.max(0,Ye):we=ce[0].pts}if(f.isAAC)for(var Ne=v!==void 0,Ie=this.config.maxAudioFramesDrift,We=0,Ue=we;We<ce.length;We++){var xe=ce[We],se=xe.pts,ke=se-Ue,dt=Math.abs(1e3*ke/b);if(ke<=-Ie*Z&&Ne)We===0&&(P.logger.warn("Audio frame @ "+(se/b).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*ke/b)+" ms."),this.nextAudioPts=we=Ue=se);else if(ke>=Ie*Z&&dt<M&&Ne){var at=Math.round(ke/Z);Ue=se-at*Z,Ue<0&&(at--,Ue+=Z),We===0&&(this.nextAudioPts=we=Ue),P.logger.warn("[mp4-remuxer]: Injecting "+at+" audio frame @ "+(Ue/b).toFixed(3)+"s due to "+Math.round(1e3*ke/b)+" ms gap.");for(var rt=0;rt<at;rt++){var lt=Math.max(Ue,0),Ke=A.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);Ke||(P.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ke=xe.unit.subarray()),ce.splice(We,0,{unit:Ke,pts:lt}),Ue+=Z,We++}}xe.pts=Ue,Ue+=Z}for(var $e=null,it=null,ft,ut=0,Ze=ce.length;Ze--;)ut+=ce[Ze].unit.byteLength;for(var qe=0,Dt=ce.length;qe<Dt;qe++){var wt=ce[qe],vt=wt.unit,mt=wt.pts;if(it!==null){var Nt=re[qe-1];Nt.duration=Math.round((mt-it)/G)}else if(a&&f.isAAC&&(mt=we),$e=mt,ut>0){ut+=Ee;try{ft=new Uint8Array(ut)}catch(Ce){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:j.ErrorTypes.MUX_ERROR,details:j.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ut,reason:"fail allocating audio mdat "+ut});return}if(!H){var At=new DataView(ft.buffer);At.setUint32(0,ut),ft.set(I.default.types.mdat,4)}}else return;ft.set(vt,Ee);var Ot=vt.byteLength;Ee+=Ot,re.push(new m(!0,$,Ot,0)),it=mt}var He=re.length;if(!He)return;var Ut=re[re.length-1];this.nextAudioPts=we=it+G*Ut.duration;var Lt=H?new Uint8Array(0):I.default.moof(f.sequenceNumber++,$e/G,_({},f,{samples:re}));f.samples=[];var Xe=$e/b,nt=we/b,_e="audio",ve={data1:Lt,data2:ft,startPTS:Xe,endPTS:nt,startDTS:Xe,endDTS:nt,type:_e,hasAudio:!0,hasVideo:!1,nb:He};return this.isAudioContiguous=!0,console.assert(ft.length,"MDAT length must not be zero"),ve},x.remuxEmptyAudio=function(f,d,a,C){var v=f.inputTimeScale,b=f.samplerate?f.samplerate:v,y=v/b,G=this.nextAudioPts,$=(G!==null?G:C.startDTS*v)+this._initDTS,Z=C.endDTS*v+this._initDTS,V=y*R,H=Math.ceil((Z-$)/V),re=A.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);if(P.logger.warn("[mp4-remuxer]: remux empty Audio"),!re){P.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ce=[],Ee=0;Ee<H;Ee++){var we=$+Ee*V;ce.push({unit:re,pts:we,dts:we})}return f.samples=ce,this.remuxAudio(f,d,a,!1)},x.remuxID3=function(f,d){var a=f.samples.length;if(!a)return;for(var C=f.inputTimeScale,v=this._initPTS,b=this._initDTS,y=0;y<a;y++){var G=f.samples[y];G.pts=u(G.pts-v,d*C)/C,G.dts=u(G.dts-b,d*C)/C}var $=f.samples;return f.samples=[],{samples:$}},x.remuxText=function(f,d){var a=f.samples.length;if(!a)return;for(var C=f.inputTimeScale,v=this._initPTS,b=0;b<a;b++){var y=f.samples[b];y.pts=u(y.pts-v,d*C)/C}f.samples.sort(function($,Z){return $.pts-Z.pts});var G=f.samples;return f.samples=[],{samples:G}},w}();function u(w,x){var g;if(x===null)return w;for(x<w?g=-8589934592:g=8589934592;Math.abs(w-x)>4294967296;)w+=g;return w}function T(w){for(var x=0;x<w.length;x++)if(w[x].key)return x;return-1}var m=function(x,g,f,d){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=g,this.size=f,this.cts=d,this.flags=new p(x)},p=function(x){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=x?2:1,this.isNonSync=x?0:1}},"./src/remux/passthrough-remuxer.ts":function(le,Y,L){"use strict";L.r(Y);var z=L("./src/polyfills/number.ts"),A=L("./src/utils/mp4-tools.ts"),I=L("./src/loader/fragment.ts"),W=L("./src/utils/logger.ts"),j=function(){function E(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var _=E.prototype;return _.destroy=function(){},_.resetTimeStamp=function(R){this.initPTS=R,this.lastEndDTS=null},_.resetNextTimestamp=function(){this.lastEndDTS=null},_.resetInitSegment=function(R,k,S){this.audioCodec=k,this.videoCodec=S,this.generateInitSegment(R),this.emitInitSegment=!0},_.generateInitSegment=function(R){var k=this.audioCodec,S=this.videoCodec;if(!R||!R.byteLength){this.initTracks=void 0,this.initData=void 0;return}var c=this.initData=Object(A.parseInitSegment)(R);k||(k=D(c.audio,I.ElementaryStreamTypes.AUDIO)),S||(S=D(c.video,I.ElementaryStreamTypes.VIDEO));var o={};c.audio&&c.video?o.audiovideo={container:"video/mp4",codec:k+","+S,initSegment:R,id:"main"}:c.audio?o.audio={container:"audio/mp4",codec:k,initSegment:R,id:"audio"}:c.video?o.video={container:"video/mp4",codec:S,initSegment:R,id:"main"}:W.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},_.remux=function(R,k,S,c,o){var l=this.initPTS,u=this.lastEndDTS,T={audio:void 0,video:void 0,text:c,id3:S,initSegment:void 0};Object(z.isFiniteNumber)(u)||(u=this.lastEndDTS=o||0);var m=k.samples;if(!m||!m.length)return T;var p={initPTS:void 0,timescale:1},w=this.initData;if((!w||!w.length)&&(this.generateInitSegment(m),w=this.initData),!w||!w.length)return W.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),T;this.emitInitSegment&&(p.tracks=this.initTracks,this.emitInitSegment=!1),Object(z.isFiniteNumber)(l)||(this.initPTS=p.initPTS=l=P(w,m,u));var x=Object(A.getDuration)(m,w),g=u,f=x+g;Object(A.offsetStartDTS)(w,m,l),x>0?this.lastEndDTS=f:(W.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!w.audio,a=!!w.video,C="";d&&(C+="audio"),a&&(C+="video");var v={data1:m,startPTS:g,startDTS:g,endPTS:f,endDTS:f,type:C,hasAudio:d,hasVideo:a,nb:1,dropped:0};return T.audio=v.type==="audio"?v:void 0,T.video=v.type!=="audio"?v:void 0,T.text=c,T.id3=S,T.initSegment=p,T},E}(),P=function(_,M,R){return Object(A.getStartDTS)(_,M)-R};function D(E,_){var M=E==null?void 0:E.codec;return M&&M.length>4?M:M==="hvc1"?"hvc1.1.c.L120.90":M==="av01"?"av01.0.04M.08":M==="avc1"||_===I.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Y.default=j},"./src/task-loop.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return z});var z=function(){function A(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var I=A.prototype;return I.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},I.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},I.onHandlerDestroyed=function(){},I.hasInterval=function(){return!!this._tickInterval},I.hasNextTick=function(){return!!this._tickTimer},I.setInterval=function(j){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,j),!0)},I.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},I.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},I.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},I.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},I.doTick=function(){},A}()},"./src/types/cmcd.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"CMCDVersion",function(){return z}),L.d(Y,"CMCDObjectType",function(){return A}),L.d(Y,"CMCDStreamingFormat",function(){return I}),L.d(Y,"CMCDStreamType",function(){return W});var z=1,A;(function(j){j.MANIFEST="m",j.AUDIO="a",j.VIDEO="v",j.MUXED="av",j.INIT="i",j.CAPTION="c",j.TIMED_TEXT="tt",j.KEY="k",j.OTHER="o"})(A||(A={}));var I;(function(j){j.DASH="d",j.HLS="h",j.SMOOTH="s",j.OTHER="o"})(I||(I={}));var W;(function(j){j.VOD="v",j.LIVE="l"})(W||(W={}))},"./src/types/level.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"HlsSkip",function(){return I}),L.d(Y,"getSkipValue",function(){return W}),L.d(Y,"HlsUrlParameters",function(){return j}),L.d(Y,"Level",function(){return P});function z(D,E){for(var _=0;_<E.length;_++){var M=E[_];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(D,M.key,M)}}function A(D,E,_){return E&&z(D.prototype,E),_&&z(D,_),D}var I;(function(D){D.No="",D.Yes="YES",D.v2="v2"})(I||(I={}));function W(D,E){var _=D.canSkipUntil,M=D.canSkipDateRanges,R=D.endSN,k=E!==void 0?E-R:0;return _&&k<_?M?I.v2:I.Yes:I.No}var j=function(){function D(_,M,R){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=_,this.part=M,this.skip=R}var E=D.prototype;return E.addDirectives=function(M){var R=new self.URL(M);return this.msn!==void 0&&R.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&R.searchParams.set("_HLS_part",this.part.toString()),this.skip&&R.searchParams.set("_HLS_skip",this.skip),R.toString()},D}(),P=function(){function D(E){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=[E.url],this.attrs=E.attrs,this.bitrate=E.bitrate,E.details&&(this.details=E.details),this.id=E.id||0,this.name=E.name,this.width=E.width||0,this.height=E.height||0,this.audioCodec=E.audioCodec,this.videoCodec=E.videoCodec,this.unknownCodecs=E.unknownCodecs,this.codecSet=[E.videoCodec,E.audioCodec].filter(function(_){return _}).join(",").replace(/\.[^.,]+/g,"")}return A(D,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(_){var M=_%this.url.length;this._urlId!==M&&(this.details=void 0,this._urlId=M)}}]),D}()},"./src/types/loader.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"PlaylistContextType",function(){return z}),L.d(Y,"PlaylistLevelType",function(){return A});var z;(function(I){I.MANIFEST="manifest",I.LEVEL="level",I.AUDIO_TRACK="audioTrack",I.SUBTITLE_TRACK="subtitleTrack"})(z||(z={}));var A;(function(I){I.MAIN="main",I.AUDIO="audio",I.SUBTITLE="subtitle"})(A||(A={}))},"./src/types/transmuxer.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"ChunkMetadata",function(){return z});var z=function(W,j,P,D,E,_){D===void 0&&(D=0),E===void 0&&(E=-1),_===void 0&&(_=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=A(),this.buffering={audio:A(),video:A(),audiovideo:A()},this.level=W,this.sn=j,this.id=P,this.size=D,this.part=E,this.partial=_};function A(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"AttrList",function(){return I});var z=/^(\d+)x(\d+)$/,A=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,I=function(){function W(P){typeof P=="string"&&(P=W.parseAttrList(P));for(var D in P)P.hasOwnProperty(D)&&(this[D]=P[D])}var j=W.prototype;return j.decimalInteger=function(D){var E=parseInt(this[D],10);return E>Number.MAX_SAFE_INTEGER?Infinity:E},j.hexadecimalInteger=function(D){if(this[D]){var E=(this[D]||"0x").slice(2);E=(E.length&1?"0":"")+E;for(var _=new Uint8Array(E.length/2),M=0;M<E.length/2;M++)_[M]=parseInt(E.slice(M*2,M*2+2),16);return _}else return null},j.hexadecimalIntegerAsNumber=function(D){var E=parseInt(this[D],16);return E>Number.MAX_SAFE_INTEGER?Infinity:E},j.decimalFloatingPoint=function(D){return parseFloat(this[D])},j.optionalFloat=function(D,E){var _=this[D];return _?parseFloat(_):E},j.enumeratedString=function(D){return this[D]},j.bool=function(D){return this[D]==="YES"},j.decimalResolution=function(D){var E=z.exec(this[D]);return E===null?void 0:{width:parseInt(E[1],10),height:parseInt(E[2],10)}},W.parseAttrList=function(D){var E,_={},M='"';for(A.lastIndex=0;(E=A.exec(D))!==null;){var R=E[2];R.indexOf(M)===0&&R.lastIndexOf(M)===R.length-1&&(R=R.slice(1,-1)),_[E[1]]=R}return _},W}()},"./src/utils/binary-search.ts":function(le,Y,L){"use strict";L.r(Y);var z={search:function(I,W){for(var j=0,P=I.length-1,D=null,E=null;j<=P;){D=(j+P)/2|0,E=I[D];var _=W(E);if(_>0)j=D+1;else if(_<0)P=D-1;else return E}return null}};Y.default=z},"./src/utils/buffer-helper.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"BufferHelper",function(){return I});var z=L("./src/utils/logger.ts"),A={length:0,start:function(){return 0},end:function(){return 0}},I=function(){function W(){}return W.isBuffered=function(P,D){try{if(P){for(var E=W.getBuffered(P),_=0;_<E.length;_++)if(D>=E.start(_)&&D<=E.end(_))return!0}}catch(M){}return!1},W.bufferInfo=function(P,D,E){try{if(P){var _=W.getBuffered(P),M=[],R;for(R=0;R<_.length;R++)M.push({start:_.start(R),end:_.end(R)});return this.bufferedInfo(M,D,E)}}catch(k){}return{len:0,start:D,end:D,nextStart:void 0}},W.bufferedInfo=function(P,D,E){D=Math.max(0,D),P.sort(function(p,w){var x=p.start-w.start;return x||w.end-p.end});var _=[];if(E)for(var M=0;M<P.length;M++){var R=_.length;if(R){var k=_[R-1].end;P[M].start-k<E?P[M].end>k&&(_[R-1].end=P[M].end):_.push(P[M])}else _.push(P[M])}else _=P;for(var S=0,c,o=D,l=D,u=0;u<_.length;u++){var T=_[u].start,m=_[u].end;if(D+E>=T&&D<m)o=T,l=m,S=l-D;else if(D+E<T){c=T;break}}return{len:S,start:o||0,end:l||0,nextStart:c}},W.getBuffered=function(P){try{return P.buffered}catch(D){return z.logger.log("failed to get media.buffered",D),A}},W}()},"./src/utils/cea-608-parser.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"Row",function(){return l}),L.d(Y,"CaptionScreen",function(){return u});var z=L("./src/utils/logger.ts"),A={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},I=function(f){var d=f;return A.hasOwnProperty(f)&&(d=A[f]),String.fromCharCode(d)},W=15,j=100,P={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},D={17:2,18:4,21:6,22:8,23:10,19:13,20:15},E={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},_={25:2,26:4,29:6,30:8,31:10,27:13,28:15},M=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],R;(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"})(R||(R={}));var k=function(){function g(){this.time=null,this.verboseLevel=R.ERROR}var f=g.prototype;return f.log=function(a,C){this.verboseLevel>=a&&z.logger.log(this.time+" ["+a+"] "+C)},g}(),S=function(f){for(var d=[],a=0;a<f.length;a++)d.push(f[a].toString(16));return d},c=function(){function g(d,a,C,v,b){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=d||"white",this.underline=a||!1,this.italics=C||!1,this.background=v||"black",this.flash=b||!1}var f=g.prototype;return f.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},f.setStyles=function(a){for(var C=["foreground","underline","italics","background","flash"],v=0;v<C.length;v++){var b=C[v];a.hasOwnProperty(b)&&(this[b]=a[b])}},f.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},f.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},f.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},f.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},g}(),o=function(){function g(d,a,C,v,b,y){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new c(a,C,v,b,y)}var f=g.prototype;return f.reset=function(){this.uchar=" ",this.penState.reset()},f.setChar=function(a,C){this.uchar=a,this.penState.copy(C)},f.setPenState=function(a){this.penState.copy(a)},f.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},f.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},f.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},g}(),l=function(){function g(d){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<j;a++)this.chars.push(new o);this.logger=d,this.pos=0,this.currPenState=new c}var f=g.prototype;return f.equals=function(a){for(var C=!0,v=0;v<j;v++)if(!this.chars[v].equals(a.chars[v])){C=!1;break}return C},f.copy=function(a){for(var C=0;C<j;C++)this.chars[C].copy(a.chars[C])},f.isEmpty=function(){for(var a=!0,C=0;C<j;C++)if(!this.chars[C].isEmpty()){a=!1;break}return a},f.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(R.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>j&&(this.logger.log(R.DEBUG,"Too large cursor position "+this.pos),this.pos=j)},f.moveCursor=function(a){var C=this.pos+a;if(a>1)for(var v=this.pos+1;v<C+1;v++)this.chars[v].setPenState(this.currPenState);this.setCursor(C)},f.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},f.insertChar=function(a){a>=144&&this.backSpace();var C=I(a);if(this.pos>=j){this.logger.log(R.ERROR,"Cannot insert "+a.toString(16)+" ("+C+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(C,this.currPenState),this.moveCursor(1)},f.clearFromPos=function(a){var C;for(C=a;C<j;C++)this.chars[C].reset()},f.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},f.clearToEndOfRow=function(){this.clearFromPos(this.pos)},f.getTextString=function(){for(var a=[],C=!0,v=0;v<j;v++){var b=this.chars[v].uchar;b!==" "&&(C=!1),a.push(b)}return C?"":a.join("")},f.setPenStyles=function(a){this.currPenState.setStyles(a);var C=this.chars[this.pos];C.setPenState(this.currPenState)},g}(),u=function(){function g(d){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<W;a++)this.rows.push(new l(d));this.logger=d,this.currRow=W-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var f=g.prototype;return f.reset=function(){for(var a=0;a<W;a++)this.rows[a].clear();this.currRow=W-1},f.equals=function(a){for(var C=!0,v=0;v<W;v++)if(!this.rows[v].equals(a.rows[v])){C=!1;break}return C},f.copy=function(a){for(var C=0;C<W;C++)this.rows[C].copy(a.rows[C])},f.isEmpty=function(){for(var a=!0,C=0;C<W;C++)if(!this.rows[C].isEmpty()){a=!1;break}return a},f.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},f.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},f.insertChar=function(a){var C=this.rows[this.currRow];C.insertChar(a)},f.setPen=function(a){var C=this.rows[this.currRow];C.setPenStyles(a)},f.moveCursor=function(a){var C=this.rows[this.currRow];C.moveCursor(a)},f.setCursor=function(a){this.logger.log(R.INFO,"setCursor: "+a);var C=this.rows[this.currRow];C.setCursor(a)},f.setPAC=function(a){this.logger.log(R.INFO,"pacData = "+JSON.stringify(a));var C=a.row-1;if(this.nrRollUpRows&&C<this.nrRollUpRows-1&&(C=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==C){for(var v=0;v<W;v++)this.rows[v].clear();var b=this.currRow+1-this.nrRollUpRows,y=this.lastOutputScreen;if(y){var G=y.rows[b].cueStartTime,$=this.logger.time;if(G&&$!==null&&G<$)for(var Z=0;Z<this.nrRollUpRows;Z++)this.rows[C-this.nrRollUpRows+Z+1].copy(y.rows[b+Z])}}this.currRow=C;var V=this.rows[this.currRow];if(a.indent!==null){var H=a.indent,re=Math.max(H-1,0);V.setCursor(a.indent),a.color=V.chars[re].penState.foreground}var ce={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(ce)},f.setBkgData=function(a){this.logger.log(R.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},f.setRollUpRows=function(a){this.nrRollUpRows=a},f.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(R.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(R.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,C=this.rows.splice(a,1)[0];C.clear(),this.rows.splice(this.currRow,0,C),this.logger.log(R.INFO,"Rolling up")},f.getDisplayText=function(a){a=a||!1;for(var C=[],v="",b=-1,y=0;y<W;y++){var G=this.rows[y].getTextString();G&&(b=y+1,a?C.push("Row "+b+": '"+G+"'"):C.push(G.trim()))}return C.length>0&&(a?v="["+C.join(" | ")+"]":v=C.join(`
|
|
`)),v},f.getTextAndFormat=function(){return this.rows},g}(),T=function(){function g(d,a,C){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=d,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new u(C),this.nonDisplayedMemory=new u(C),this.lastOutputScreen=new u(C),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=C}var f=g.prototype;return f.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},f.getHandler=function(){return this.outputFilter},f.setHandler=function(a){this.outputFilter=a},f.setPAC=function(a){this.writeScreen.setPAC(a)},f.setBkgData=function(a){this.writeScreen.setBkgData(a)},f.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(R.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},f.insertChars=function(a){for(var C=0;C<a.length;C++)this.writeScreen.insertChar(a[C]);var v=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(R.INFO,v+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(R.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},f.ccRCL=function(){this.logger.log(R.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},f.ccBS=function(){if(this.logger.log(R.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},f.ccAOF=function(){},f.ccAON=function(){},f.ccDER=function(){this.logger.log(R.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},f.ccRU=function(a){this.logger.log(R.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},f.ccFON=function(){this.logger.log(R.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},f.ccRDC=function(){this.logger.log(R.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},f.ccTR=function(){this.logger.log(R.INFO,"TR"),this.setMode("MODE_TEXT")},f.ccRTD=function(){this.logger.log(R.INFO,"RTD"),this.setMode("MODE_TEXT")},f.ccEDM=function(){this.logger.log(R.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},f.ccCR=function(){this.logger.log(R.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},f.ccENM=function(){this.logger.log(R.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},f.ccEOC=function(){if(this.logger.log(R.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(R.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},f.ccTO=function(a){this.logger.log(R.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},f.ccMIDROW=function(a){var C={flash:!1};if(C.underline=a%2===1,C.italics=a>=46,C.italics)C.foreground="white";else{var v=Math.floor(a/2)-16,b=["white","green","blue","cyan","red","yellow","magenta"];C.foreground=b[v]}this.logger.log(R.INFO,"MIDROW: "+JSON.stringify(C)),this.writeScreen.setPen(C)},f.outputDataUpdate=function(a){a===void 0&&(a=!1);var C=this.logger.time;if(C===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=C:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,C,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:C),this.lastOutputScreen.copy(this.displayedMemory))},f.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},g}(),m=function(){function g(d,a,C){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var v=new k;this.channels=[null,new T(d,a,v),new T(d+1,C,v)],this.cmdHistory=x(),this.logger=v}var f=g.prototype;return f.getHandler=function(a){return this.channels[a].getHandler()},f.setHandler=function(a,C){this.channels[a].setHandler(C)},f.addData=function(a,C){var v,b,y,G=!1;this.logger.time=a;for(var $=0;$<C.length;$+=2){if(b=C[$]&127,y=C[$+1]&127,b===0&&y===0)continue;if(this.logger.log(R.DATA,"["+S([C[$],C[$+1]])+"] -> ("+S([b,y])+")"),v=this.parseCmd(b,y),v||(v=this.parseMidrow(b,y)),v||(v=this.parsePAC(b,y)),v||(v=this.parseBackgroundAttributes(b,y)),!v&&(G=this.parseChars(b,y),G)){var Z=this.currentChannel;if(Z&&Z>0){var V=this.channels[Z];V.insertChars(G)}else this.logger.log(R.WARNING,"No channel found yet. TEXT-MODE?")}!v&&!G&&this.logger.log(R.WARNING,"Couldn't parse cleaned data "+S([b,y])+" orig: "+S([C[$],C[$+1]]))}},f.parseCmd=function(a,C){var v=this.cmdHistory,b=(a===20||a===28||a===21||a===29)&&C>=32&&C<=47,y=(a===23||a===31)&&C>=33&&C<=35;if(!(b||y))return!1;if(w(a,C,v))return p(null,null,v),this.logger.log(R.DEBUG,"Repeated command ("+S([a,C])+") is dropped"),!0;var G=a===20||a===21||a===23?1:2,$=this.channels[G];return a===20||a===21||a===28||a===29?C===32?$.ccRCL():C===33?$.ccBS():C===34?$.ccAOF():C===35?$.ccAON():C===36?$.ccDER():C===37?$.ccRU(2):C===38?$.ccRU(3):C===39?$.ccRU(4):C===40?$.ccFON():C===41?$.ccRDC():C===42?$.ccTR():C===43?$.ccRTD():C===44?$.ccEDM():C===45?$.ccCR():C===46?$.ccENM():C===47&&$.ccEOC():$.ccTO(C-32),p(a,C,v),this.currentChannel=G,!0},f.parseMidrow=function(a,C){var v=0;if((a===17||a===25)&&C>=32&&C<=47){if(a===17?v=1:v=2,v!==this.currentChannel)return this.logger.log(R.ERROR,"Mismatch channel in midrow parsing"),!1;var b=this.channels[v];return b?(b.ccMIDROW(C),this.logger.log(R.DEBUG,"MIDROW ("+S([a,C])+")"),!0):!1}return!1},f.parsePAC=function(a,C){var v,b=this.cmdHistory,y=(a>=17&&a<=23||a>=25&&a<=31)&&C>=64&&C<=127,G=(a===16||a===24)&&C>=64&&C<=95;if(!(y||G))return!1;if(w(a,C,b))return p(null,null,b),!0;var $=a<=23?1:2;C>=64&&C<=95?v=$===1?P[a]:E[a]:v=$===1?D[a]:_[a];var Z=this.channels[$];return Z?(Z.setPAC(this.interpretPAC(v,C)),p(a,C,b),this.currentChannel=$,!0):!1},f.interpretPAC=function(a,C){var v,b={color:null,italics:!1,indent:null,underline:!1,row:a};return C>95?v=C-96:v=C-64,b.underline=(v&1)===1,v<=13?b.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(v/2)]:v<=15?(b.italics=!0,b.color="white"):b.indent=Math.floor((v-16)/2)*4,b},f.parseChars=function(a,C){var v,b=null,y=null;if(a>=25?(v=2,y=a-8):(v=1,y=a),y>=17&&y<=19){var G;y===17?G=C+80:y===18?G=C+112:G=C+144,this.logger.log(R.INFO,"Special char '"+I(G)+"' in channel "+v),b=[G]}else a>=32&&a<=127&&(b=C===0?[a]:[a,C]);if(b){var $=S(b);this.logger.log(R.DEBUG,"Char codes = "+$.join(",")),p(a,C,this.cmdHistory)}return b},f.parseBackgroundAttributes=function(a,C){var v=(a===16||a===24)&&C>=32&&C<=47,b=(a===23||a===31)&&C>=45&&C<=47;if(!(v||b))return!1;var y,G={};a===16||a===24?(y=Math.floor((C-32)/2),G.background=M[y],C%2===1&&(G.background=G.background+"_semi")):C===45?G.background="transparent":(G.foreground="black",C===47&&(G.underline=!0));var $=a<=23?1:2,Z=this.channels[$];return Z.setBkgData(G),p(a,C,this.cmdHistory),!0},f.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var C=this.channels[a];C&&C.reset()}this.cmdHistory=x()},f.cueSplitAtTime=function(a){for(var C=0;C<this.channels.length;C++){var v=this.channels[C];v&&v.cueSplitAtTime(a)}},g}();function p(g,f,d){d.a=g,d.b=f}function w(g,f,d){return d.a===g&&d.b===f}function x(){return{a:null,b:null}}Y.default=m},"./src/utils/codecs.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"isCodecType",function(){return A}),L.d(Y,"isCodecSupportedInMp4",function(){return I});var z={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function A(W,j){var P=z[j];return!!P&&P[W.slice(0,4)]===!0}function I(W,j){return MediaSource.isTypeSupported((j||"video")+'/mp4;codecs="'+W+'"')}},"./src/utils/cues.ts":function(le,Y,L){"use strict";L.r(Y);var z=L("./src/utils/vttparser.ts"),A=L("./src/utils/webvtt-parser.ts"),I=L("./src/utils/texttrack-utils.ts"),W=/\s/,j={newCue:function(D,E,_,M){for(var R=[],k,S,c,o,l,u=self.VTTCue||self.TextTrackCue,T=0;T<M.rows.length;T++)if(k=M.rows[T],c=!0,o=0,l="",!k.isEmpty()){for(var m=0;m<k.chars.length;m++)W.test(k.chars[m].uchar)&&c?o++:(l+=k.chars[m].uchar,c=!1);k.cueStartTime=E,E===_&&(_+=1e-4),o>=16?o--:o++;var p=Object(z.fixLineBreaks)(l.trim()),w=Object(A.generateCueId)(E,_,p);(!D||!D.cues||!D.cues.getCueById(w))&&(S=new u(E,_,p),S.id=w,S.line=T+1,S.align="left",S.position=10+Math.min(80,Math.floor(o*8/32)*10),R.push(S))}return D&&R.length&&(R.sort(function(x,g){return x.line==="auto"||g.line==="auto"?0:x.line>8&&g.line>8?g.line-x.line:x.line-g.line}),R.forEach(function(x){return Object(I.addCueToTrack)(D,x)})),R}};Y.default=j},"./src/utils/discontinuities.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"findFirstFragWithCC",function(){return W}),L.d(Y,"shouldAlignOnDiscontinuities",function(){return j}),L.d(Y,"findDiscontinuousReferenceFrag",function(){return P}),L.d(Y,"adjustSlidingStart",function(){return E}),L.d(Y,"alignStream",function(){return _}),L.d(Y,"alignPDT",function(){return R}),L.d(Y,"alignFragmentByPDTDelta",function(){return k}),L.d(Y,"alignMediaPlaylistByPDT",function(){return S});var z=L("./src/polyfills/number.ts"),A=L("./src/utils/logger.ts"),I=L("./src/controller/level-helper.ts");function W(c,o){for(var l=null,u=0,T=c.length;u<T;u++){var m=c[u];if(m&&m.cc===o){l=m;break}}return l}function j(c,o,l){return!!(o.details&&(l.endCC>l.startCC||c&&c.cc<l.startCC))}function P(c,o){var l=c.fragments,u=o.fragments;if(!u.length||!l.length){A.logger.log("No fragments to align");return}var T=W(l,u[0].cc);if(!T||T&&!T.startPTS){A.logger.log("No frag in previous level to align on");return}return T}function D(c,o){if(c){var l=c.start+o;c.start=c.startPTS=l,c.endPTS=l+c.duration}}function E(c,o){for(var l=o.fragments,u=0,T=l.length;u<T;u++)D(l[u],c);o.fragmentHint&&D(o.fragmentHint,c),o.alignedSliding=!0}function _(c,o,l){if(!o)return;M(c,l,o),!l.alignedSliding&&o.details&&R(l,o.details),!l.alignedSliding&&o.details&&!l.skippedSegments&&Object(I.adjustSliding)(o.details,l)}function M(c,o,l){if(j(c,l,o)){var u=P(l.details,o);u&&Object(z.isFiniteNumber)(u.start)&&(A.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),E(u.start,o))}}function R(c,o){if(!o.fragments.length||!c.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,u=c.fragments[0].programDateTime,T=(u-l)/1e3+o.fragments[0].start;T&&Object(z.isFiniteNumber)(T)&&(A.logger.log("Adjusting PTS using programDateTime delta "+(u-l)+"ms, sliding:"+T.toFixed(3)+" "+c.url+" "),E(T,c))}function k(c,o){var l=c.programDateTime;if(!l)return;var u=(l-o)/1e3;c.start=c.startPTS=u,c.endPTS=u+c.duration}function S(c,o){if(!o.fragments.length||!c.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,u=o.fragments[0].start,T=l-u*1e3;c.fragments.forEach(function(m){k(m,T)}),c.fragmentHint&&k(c.fragmentHint,T),c.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(le,Y,L){"use strict";L.r(Y);var z=L("./src/utils/ewma.ts"),A=function(){function I(j,P,D){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=D,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new z.default(j),this.fast_=new z.default(P)}var W=I.prototype;return W.update=function(P,D){var E=this.slow_,_=this.fast_;this.slow_.halfLife!==P&&(this.slow_=new z.default(P,E.getEstimate(),E.getTotalWeight())),this.fast_.halfLife!==D&&(this.fast_=new z.default(D,_.getEstimate(),_.getTotalWeight()))},W.sample=function(P,D){P=Math.max(P,this.minDelayMs_);var E=8*D,_=P/1e3,M=E/_;this.fast_.sample(_,M),this.slow_.sample(_,M)},W.canEstimate=function(){var P=this.fast_;return P&&P.getTotalWeight()>=this.minWeight_},W.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},W.destroy=function(){},I}();Y.default=A},"./src/utils/ewma.ts":function(le,Y,L){"use strict";L.r(Y);var z=function(){function A(W,j,P){j===void 0&&(j=0),P===void 0&&(P=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=W,this.alpha_=W?Math.exp(Math.log(.5)/W):0,this.estimate_=j,this.totalWeight_=P}var I=A.prototype;return I.sample=function(j,P){var D=Math.pow(this.alpha_,j);this.estimate_=P*(1-D)+D*this.estimate_,this.totalWeight_+=j},I.getTotalWeight=function(){return this.totalWeight_},I.getEstimate=function(){if(this.alpha_){var j=1-Math.pow(this.alpha_,this.totalWeight_);if(j)return this.estimate_/j}return this.estimate_},A}();Y.default=z},"./src/utils/fetch-loader.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"fetchSupported",function(){return k});var z=L("./src/polyfills/number.ts"),A=L("./src/loader/load-stats.ts"),I=L("./src/demux/chunk-cache.ts");function W(u,T){u.prototype=Object.create(T.prototype),u.prototype.constructor=u,_(u,T)}function j(u){var T=typeof Map=="function"?new Map:void 0;return j=function(p){if(p===null||!E(p))return p;if(typeof p!="function")throw new TypeError("Super expression must either be null or a function");if(typeof T!="undefined"){if(T.has(p))return T.get(p);T.set(p,w)}function w(){return P(p,arguments,M(this).constructor)}return w.prototype=Object.create(p.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),_(w,p)},j(u)}function P(u,T,m){return D()?P=Reflect.construct:P=function(w,x,g){var f=[null];f.push.apply(f,x);var d=Function.bind.apply(w,f),a=new d;return g&&_(a,g.prototype),a},P.apply(null,arguments)}function D(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function E(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function _(u,T){return _=Object.setPrototypeOf||function(p,w){return p.__proto__=w,p},_(u,T)}function M(u){return M=Object.setPrototypeOf?Object.getPrototypeOf:function(m){return m.__proto__||Object.getPrototypeOf(m)},M(u)}function R(){return R=Object.assign||function(u){for(var T=1;T<arguments.length;T++){var m=arguments[T];for(var p in m)Object.prototype.hasOwnProperty.call(m,p)&&(u[p]=m[p])}return u},R.apply(this,arguments)}function k(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(u){}return!1}var S=function(){function u(m){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=m.fetchSetup||o,this.controller=new self.AbortController,this.stats=new A.LoadStats}var T=u.prototype;return T.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},T.abortInternal=function(){var p=this.response;(!p||!p.ok)&&(this.stats.aborted=!0,this.controller.abort())},T.abort=function(){var p;this.abortInternal(),(p=this.callbacks)!==null&&p!==void 0&&p.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},T.load=function(p,w,x){var g=this,f=this.stats;if(f.loading.start)throw new Error("Loader can only be used once.");f.loading.start=self.performance.now();var d=c(p,this.controller.signal),a=x.onProgress,C=p.responseType==="arraybuffer",v=C?"byteLength":"length";this.context=p,this.config=w,this.callbacks=x,this.request=this.fetchSetup(p,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){g.abortInternal(),x.onTimeout(f,p,g.response)},w.timeout),self.fetch(this.request).then(function(b){if(g.response=g.loader=b,!b.ok){var y=b.status,G=b.statusText;throw new l(G||"fetch, bad network response",y,b)}return f.loading.first=Math.max(self.performance.now(),f.loading.start),f.total=parseInt(b.headers.get("Content-Length")||"0"),a&&Object(z.isFiniteNumber)(w.highWaterMark)?g.loadProgressively(b,f,p,w.highWaterMark,a):C?b.arrayBuffer():b.text()}).then(function(b){var y=g.response;self.clearTimeout(g.requestTimeout),f.loading.end=Math.max(self.performance.now(),f.loading.first),f.loaded=f.total=b[v];var G={url:y.url,data:b};a&&!Object(z.isFiniteNumber)(w.highWaterMark)&&a(f,p,b,y),x.onSuccess(G,f,p,y)}).catch(function(b){if(self.clearTimeout(g.requestTimeout),f.aborted)return;var y=b.code||0;x.onError({code:y,text:b.message},p,b.details)})},T.getCacheAge=function(){var p=null;if(this.response){var w=this.response.headers.get("age");p=w?parseFloat(w):null}return p},T.loadProgressively=function(p,w,x,g,f){g===void 0&&(g=0);var d=new I.default,a=p.body.getReader(),C=function v(){return a.read().then(function(b){if(b.done)return d.dataLength&&f(w,x,d.flush(),p),Promise.resolve(new ArrayBuffer(0));var y=b.value,G=y.length;return w.loaded+=G,G<g||d.dataLength?(d.push(y),d.dataLength>=g&&f(w,x,d.flush(),p)):f(w,x,y,p),v()}).catch(function(){return Promise.reject()})};return C()},u}();function c(u,T){var m={method:"GET",mode:"cors",credentials:"same-origin",signal:T,headers:new self.Headers(R({},u.headers))};return u.rangeEnd&&m.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),m}function o(u,T){return new self.Request(u.url,T)}var l=function(u){W(T,u);function T(m,p,w){var x;return x=u.call(this,m)||this,x.code=void 0,x.details=void 0,x.code=p,x.details=w,x}return T}(j(Error));Y.default=S},"./src/utils/imsc1-ttml-parser.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"IMSC1_CODEC",function(){return E}),L.d(Y,"parseIMSC1",function(){return k});var z=L("./src/utils/mp4-tools.ts"),A=L("./src/utils/vttparser.ts"),I=L("./src/utils/vttcue.ts"),W=L("./src/demux/id3.ts"),j=L("./src/utils/timescale-conversion.ts"),P=L("./src/utils/webvtt-parser.ts");function D(){return D=Object.assign||function(g){for(var f=1;f<arguments.length;f++){var d=arguments[f];for(var a in d)Object.prototype.hasOwnProperty.call(d,a)&&(g[a]=d[a])}return g},D.apply(this,arguments)}var E="stpp.ttml.im1t",_=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,M=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,R={left:"start",center:"center",right:"end",start:"start",end:"end"};function k(g,f,d,a,C){var v=Object(z.findBox)(new Uint8Array(g),["mdat"]);if(v.length===0){C(new Error("Could not parse IMSC1 mdat"));return}var b=v[0],y=Object(W.utf8ArrayToStr)(new Uint8Array(g,b.start,b.end-b.start)),G=Object(j.toTimescaleFromScale)(f,1,d);try{a(S(y,G))}catch($){C($)}}function S(g,f){var d=new DOMParser,a=d.parseFromString(g,"text/xml"),C=a.getElementsByTagName("tt")[0];if(!C)throw new Error("Invalid ttml");var v={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},b=Object.keys(v).reduce(function(V,H){return V[H]=C.getAttribute("ttp:"+H)||v[H],V},{}),y=C.getAttribute("xml:space")!=="preserve",G=o(c(C,"styling","style")),$=o(c(C,"layout","region")),Z=c(C,"body","[begin]");return[].map.call(Z,function(V){var H=l(V,y);if(!H||!V.hasAttribute("begin"))return null;var re=p(V.getAttribute("begin"),b),ce=p(V.getAttribute("dur"),b),Ee=p(V.getAttribute("end"),b);if(re===null)throw m(V);if(Ee===null){if(ce===null)throw m(V);Ee=re+ce}var we=new I.default(re-f,Ee-f,H);we.id=Object(P.generateCueId)(we.startTime,we.endTime,we.text);var Ye=$[V.getAttribute("region")],Ne=G[V.getAttribute("style")];we.position=10,we.size=80;var Ie=u(Ye,Ne),We=Ie.textAlign;if(We){var Ue=R[We];Ue&&(we.lineAlign=Ue),we.align=We}return D(we,Ie),we}).filter(function(V){return V!==null})}function c(g,f,d){var a=g.getElementsByTagName(f)[0];return a?[].slice.call(a.querySelectorAll(d)):[]}function o(g){return g.reduce(function(f,d){var a=d.getAttribute("xml:id");return a&&(f[a]=d),f},{})}function l(g,f){return[].slice.call(g.childNodes).reduce(function(d,a,C){var v;return a.nodeName==="br"&&C?d+`
|
|
`:(v=a.childNodes)!==null&&v!==void 0&&v.length?l(a,f):f?d+a.textContent.trim().replace(/\s+/g," "):d+a.textContent},"")}function u(g,f){var d="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(C,v){var b=T(f,d,v)||T(g,d,v);return b&&(C[v]=b),C},{})}function T(g,f,d){return g.hasAttributeNS(f,d)?g.getAttributeNS(f,d):null}function m(g){return new Error("Could not parse ttml timestamp "+g)}function p(g,f){if(!g)return null;var d=Object(A.parseTimeStamp)(g);return d===null&&(_.test(g)?d=w(g,f):M.test(g)&&(d=x(g,f))),d}function w(g,f){var d=_.exec(g),a=(d[4]|0)+(d[5]|0)/f.subFrameRate;return(d[1]|0)*3600+(d[2]|0)*60+(d[3]|0)+a/f.frameRate}function x(g,f){var d=M.exec(g),a=Number(d[1]),C=d[2];switch(C){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/f.frameRate;case"t":return a/f.tickRate}return a}},"./src/utils/logger.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"enableLogs",function(){return P}),L.d(Y,"logger",function(){return D});var z=function(){},A={trace:z,debug:z,log:z,warn:z,info:z,error:z},I=A;function W(E){var _=self.console[E];return _?_.bind(self.console,"["+E+"] >"):z}function j(E){for(var _=arguments.length,M=new Array(_>1?_-1:0),R=1;R<_;R++)M[R-1]=arguments[R];M.forEach(function(k){I[k]=E[k]?E[k].bind(E):W(k)})}function P(E){if(self.console&&E===!0||typeof E=="object"){j(E,"debug","log","info","warn","error");try{I.log()}catch(_){I=A}}else I=A}var D=I},"./src/utils/mediakeys-helper.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"KeySystems",function(){return z}),L.d(Y,"requestMediaKeySystemAccess",function(){return A});var z;(function(I){I.WIDEVINE="com.widevine.alpha",I.PLAYREADY="com.microsoft.playready"})(z||(z={}));var A=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"getMediaSource",function(){return z});function z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"bin2str",function(){return j}),L.d(Y,"readUint16",function(){return P}),L.d(Y,"readUint32",function(){return D}),L.d(Y,"writeUint32",function(){return E}),L.d(Y,"findBox",function(){return _}),L.d(Y,"parseSegmentIndex",function(){return M}),L.d(Y,"parseInitSegment",function(){return R}),L.d(Y,"getStartDTS",function(){return k}),L.d(Y,"getDuration",function(){return S}),L.d(Y,"computeRawDurationFromSamples",function(){return c}),L.d(Y,"offsetStartDTS",function(){return o}),L.d(Y,"segmentValidRange",function(){return l}),L.d(Y,"appendUint8Array",function(){return u});var z=L("./src/utils/typed-array.ts"),A=L("./src/loader/fragment.ts"),I=Math.pow(2,32)-1,W=[].push;function j(T){return String.fromCharCode.apply(null,T)}function P(T,m){"data"in T&&(m+=T.start,T=T.data);var p=T[m]<<8|T[m+1];return p<0?65536+p:p}function D(T,m){"data"in T&&(m+=T.start,T=T.data);var p=T[m]<<24|T[m+1]<<16|T[m+2]<<8|T[m+3];return p<0?4294967296+p:p}function E(T,m,p){"data"in T&&(m+=T.start,T=T.data),T[m]=p>>24,T[m+1]=p>>16&255,T[m+2]=p>>8&255,T[m+3]=p&255}function _(T,m){var p=[];if(!m.length)return p;var w,x,g;"data"in T?(w=T.data,x=T.start,g=T.end):(w=T,x=0,g=w.byteLength);for(var f=x;f<g;){var d=D(w,f),a=j(w.subarray(f+4,f+8)),C=d>1?f+d:g;if(a===m[0])if(m.length===1)p.push({data:w,start:f+8,end:C});else{var v=_({data:w,start:f+8,end:C},m.slice(1));v.length&&W.apply(p,v)}f=C}return p}function M(T){var m=_(T,["moov"]),p=m[0],w=p?p.end:null,x=_(T,["sidx"]);if(!x||!x[0])return null;var g=[],f=x[0],d=f.data[0],a=d===0?8:16,C=D(f,a);a+=4;var v=0,b=0;d===0?a+=8:a+=16,a+=2;var y=f.end+b,G=P(f,a);a+=2;for(var $=0;$<G;$++){var Z=a,V=D(f,Z);Z+=4;var H=V&2147483647,re=(V&2147483648)>>>31;if(re===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ce=D(f,Z);Z+=4,g.push({referenceSize:H,subsegmentDuration:ce,info:{duration:ce/C,start:y,end:y+H-1}}),y+=H,Z+=4,a=Z}return{earliestPresentationTime:v,timescale:C,version:d,referencesCount:G,references:g,moovEndOffset:w}}function R(T){for(var m=[],p=_(T,["moov","trak"]),w=0;w<p.length;w++){var x=p[w],g=_(x,["tkhd"])[0];if(g){var f=g.data[g.start],d=f===0?12:20,a=D(g,d),C=_(x,["mdia","mdhd"])[0];if(C){f=C.data[C.start],d=f===0?12:20;var v=D(C,d),b=_(x,["mdia","hdlr"])[0];if(b){var y=j(b.data.subarray(b.start+8,b.start+12)),G={soun:A.ElementaryStreamTypes.AUDIO,vide:A.ElementaryStreamTypes.VIDEO}[y];if(G){var $=_(x,["mdia","minf","stbl","stsd"])[0],Z=void 0;$&&(Z=j($.data.subarray($.start+12,$.start+16))),m[a]={timescale:v,type:G},m[G]={timescale:v,id:a,codec:Z}}}}}}var V=_(T,["moov","mvex","trex"]);return V.forEach(function(H){var re=D(H,4),ce=m[re];ce&&(ce.default={duration:D(H,12),flags:D(H,20)})}),m}function k(T,m){return _(m,["moof","traf"]).reduce(function(p,w){var x=_(w,["tfdt"])[0],g=x.data[x.start],f=_(w,["tfhd"]).reduce(function(d,a){var C=D(a,4),v=T[C];if(v){var b=D(x,4);g===1&&(b*=Math.pow(2,32),b+=D(x,8));var y=v.timescale||9e4,G=b/y;if(isFinite(G)&&(d===null||G<d))return G}return d},null);return f!==null&&isFinite(f)&&(p===null||f<p)?f:p},null)||0}function S(T,m){for(var p=0,w=0,x=0,g=_(T,["moof","traf"]),f=0;f<g.length;f++){var d=g[f],a=_(d,["tfhd"])[0],C=D(a,4),v=m[C];if(!v)continue;var b=v.default,y=D(a,0)|(b==null?void 0:b.flags),G=b==null?void 0:b.duration;y&8&&(y&2?G=D(a,12):G=D(a,8));for(var $=v.timescale||9e4,Z=_(d,["trun"]),V=0;V<Z.length;V++){if(G){var H=D(Z[V],4);p=G*H}else p=c(Z[V]);v.type===A.ElementaryStreamTypes.VIDEO?w+=p/$:v.type===A.ElementaryStreamTypes.AUDIO&&(x+=p/$)}}if(w===0&&x===0){var re=M(T);if(re!=null&&re.references)return re.references.reduce(function(ce,Ee){return ce+Ee.info.duration||0},0)}return w||x}function c(T){var m=D(T,0),p=8;m&1&&(p+=4),m&4&&(p+=4);for(var w=0,x=D(T,4),g=0;g<x;g++){if(m&256){var f=D(T,p);w+=f,p+=4}m&512&&(p+=4),m&1024&&(p+=4),m&2048&&(p+=4)}return w}function o(T,m,p){_(m,["moof","traf"]).forEach(function(w){_(w,["tfhd"]).forEach(function(x){var g=D(x,4),f=T[g];if(!f)return;var d=f.timescale||9e4;_(w,["tfdt"]).forEach(function(a){var C=a.data[a.start],v=D(a,4);if(C===0)E(a,4,v-p*d);else{v*=Math.pow(2,32),v+=D(a,8),v-=p*d,v=Math.max(v,0);var b=Math.floor(v/(I+1)),y=Math.floor(v%(I+1));E(a,4,b),E(a,8,y)}})})})}function l(T){var m={valid:null,remainder:null},p=_(T,["moof"]);if(p){if(p.length<2)return m.remainder=T,m}else return m;var w=p[p.length-1];return m.valid=Object(z.sliceUint8)(T,0,w.start-8),m.remainder=Object(z.sliceUint8)(T,w.start-8),m}function u(T,m){var p=new Uint8Array(T.length+m.length);return p.set(T),p.set(m,T.length),p}},"./src/utils/output-filter.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return z});var z=function(){function A(W,j){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=W,this.trackName=j}var I=A.prototype;return I.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},I.newCue=function(j,P,D){(this.startTime===null||this.startTime>j)&&(this.startTime=j),this.endTime=P,this.screen=D,this.timelineController.createCaptionsTrack(this.trackName)},I.reset=function(){this.cueRanges=[]},A}()},"./src/utils/texttrack-utils.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"sendAddTrackEvent",function(){return A}),L.d(Y,"addCueToTrack",function(){return I}),L.d(Y,"clearCurrentCues",function(){return W}),L.d(Y,"removeCuesInRange",function(){return j}),L.d(Y,"getCuesInRange",function(){return D});var z=L("./src/utils/logger.ts");function A(E,_){var M;try{M=new Event("addtrack")}catch(R){M=document.createEvent("Event"),M.initEvent("addtrack",!1,!1)}M.track=E,_.dispatchEvent(M)}function I(E,_){var M=E.mode;if(M==="disabled"&&(E.mode="hidden"),E.cues&&!E.cues.getCueById(_.id))try{if(E.addCue(_),!E.cues.getCueById(_.id))throw new Error("addCue is failed for: "+_)}catch(k){z.logger.debug("[texttrack-utils]: "+k);var R=new self.TextTrackCue(_.startTime,_.endTime,_.text);R.id=_.id,E.addCue(R)}M==="disabled"&&(E.mode=M)}function W(E){var _=E.mode;if(_==="disabled"&&(E.mode="hidden"),E.cues)for(var M=E.cues.length;M--;)E.removeCue(E.cues[M]);_==="disabled"&&(E.mode=_)}function j(E,_,M){var R=E.mode;if(R==="disabled"&&(E.mode="hidden"),E.cues&&E.cues.length>0)for(var k=D(E.cues,_,M),S=0;S<k.length;S++)E.removeCue(k[S]);R==="disabled"&&(E.mode=R)}function P(E,_){if(_<E[0].startTime)return 0;var M=E.length-1;if(_>E[M].endTime)return-1;for(var R=0,k=M;R<=k;){var S=Math.floor((k+R)/2);if(_<E[S].startTime)k=S-1;else if(_>E[S].startTime&&R<M)R=S+1;else return S}return E[R].startTime-_<_-E[k].startTime?R:k}function D(E,_,M){var R=[],k=P(E,_);if(k>-1)for(var S=k,c=E.length;S<c;S++){var o=E[S];if(o.startTime>=_&&o.endTime<=M)R.push(o);else if(o.startTime>M)return R}return R}},"./src/utils/time-ranges.ts":function(le,Y,L){"use strict";L.r(Y);var z={toString:function(I){for(var W="",j=I.length,P=0;P<j;P++)W+="["+I.start(P).toFixed(3)+","+I.end(P).toFixed(3)+"]";return W}};Y.default=z},"./src/utils/timescale-conversion.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"toTimescaleFromBase",function(){return A}),L.d(Y,"toTimescaleFromScale",function(){return I}),L.d(Y,"toMsFromMpegTsClock",function(){return W}),L.d(Y,"toMpegTsClockFromTimescale",function(){return j});var z=9e4;function A(P,D,E,_){E===void 0&&(E=1),_===void 0&&(_=!1);var M=P*D*E;return _?Math.round(M):M}function I(P,D,E,_){return E===void 0&&(E=1),_===void 0&&(_=!1),A(P,D,1/E,_)}function W(P,D){return D===void 0&&(D=!1),A(P,1e3,1/z,D)}function j(P,D){return D===void 0&&(D=1),A(P,z,1/D)}},"./src/utils/typed-array.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"sliceUint8",function(){return z});function z(A,I,W){return Uint8Array.prototype.slice?A.slice(I,W):new Uint8Array(Array.prototype.slice.call(A,I,W))}},"./src/utils/vttcue.ts":function(le,Y,L){"use strict";L.r(Y),Y.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var z=["","lr","rl"],A=["start","middle","end","left","right"];function I(E,_){if(typeof _!="string")return!1;if(!Array.isArray(E))return!1;var M=_.toLowerCase();return~E.indexOf(M)?M:!1}function W(E){return I(z,E)}function j(E){return I(A,E)}function P(E){for(var _=arguments.length,M=new Array(_>1?_-1:0),R=1;R<_;R++)M[R-1]=arguments[R];for(var k=1;k<arguments.length;k++){var S=arguments[k];for(var c in S)E[c]=S[c]}return E}function D(E,_,M){var R=this,k={enumerable:!0};R.hasBeenReset=!1;var S="",c=!1,o=E,l=_,u=M,T=null,m="",p=!0,w="auto",x="start",g=50,f="middle",d=50,a="middle";Object.defineProperty(R,"id",P({},k,{get:function(){return S},set:function(v){S=""+v}})),Object.defineProperty(R,"pauseOnExit",P({},k,{get:function(){return c},set:function(v){c=!!v}})),Object.defineProperty(R,"startTime",P({},k,{get:function(){return o},set:function(v){if(typeof v!="number")throw new TypeError("Start time must be set to a number.");o=v,this.hasBeenReset=!0}})),Object.defineProperty(R,"endTime",P({},k,{get:function(){return l},set:function(v){if(typeof v!="number")throw new TypeError("End time must be set to a number.");l=v,this.hasBeenReset=!0}})),Object.defineProperty(R,"text",P({},k,{get:function(){return u},set:function(v){u=""+v,this.hasBeenReset=!0}})),Object.defineProperty(R,"region",P({},k,{get:function(){return T},set:function(v){T=v,this.hasBeenReset=!0}})),Object.defineProperty(R,"vertical",P({},k,{get:function(){return m},set:function(v){var b=W(v);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");m=b,this.hasBeenReset=!0}})),Object.defineProperty(R,"snapToLines",P({},k,{get:function(){return p},set:function(v){p=!!v,this.hasBeenReset=!0}})),Object.defineProperty(R,"line",P({},k,{get:function(){return w},set:function(v){if(typeof v!="number"&&v!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");w=v,this.hasBeenReset=!0}})),Object.defineProperty(R,"lineAlign",P({},k,{get:function(){return x},set:function(v){var b=j(v);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");x=b,this.hasBeenReset=!0}})),Object.defineProperty(R,"position",P({},k,{get:function(){return g},set:function(v){if(v<0||v>100)throw new Error("Position must be between 0 and 100.");g=v,this.hasBeenReset=!0}})),Object.defineProperty(R,"positionAlign",P({},k,{get:function(){return f},set:function(v){var b=j(v);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");f=b,this.hasBeenReset=!0}})),Object.defineProperty(R,"size",P({},k,{get:function(){return d},set:function(v){if(v<0||v>100)throw new Error("Size must be between 0 and 100.");d=v,this.hasBeenReset=!0}})),Object.defineProperty(R,"align",P({},k,{get:function(){return a},set:function(v){var b=j(v);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");a=b,this.hasBeenReset=!0}})),R.displayState=void 0}return D.prototype.getCueAsHTML=function(){var E=self.WebVTT;return E.convertCueToDOMTree(self,this.text)},D}()},"./src/utils/vttparser.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"parseTimeStamp",function(){return I}),L.d(Y,"fixLineBreaks",function(){return _}),L.d(Y,"VTTParser",function(){return M});var z=L("./src/utils/vttcue.ts"),A=function(){function R(){}var k=R.prototype;return k.decode=function(c,o){if(!c)return"";if(typeof c!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(c))},R}();function I(R){function k(c,o,l,u){return(c|0)*3600+(o|0)*60+(l|0)+parseFloat(u||0)}var S=R.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return S?parseFloat(S[2])>59?k(S[2],S[3],0,S[4]):k(S[1],S[2],S[3],S[4]):null}var W=function(){function R(){this.values=Object.create(null)}var k=R.prototype;return k.set=function(c,o){!this.get(c)&&o!==""&&(this.values[c]=o)},k.get=function(c,o,l){return l?this.has(c)?this.values[c]:o[l]:this.has(c)?this.values[c]:o},k.has=function(c){return c in this.values},k.alt=function(c,o,l){for(var u=0;u<l.length;++u)if(o===l[u]){this.set(c,o);break}},k.integer=function(c,o){/^-?\d+$/.test(o)&&this.set(c,parseInt(o,10))},k.percent=function(c,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var l=parseFloat(o);if(l>=0&&l<=100)return this.set(c,l),!0}return!1},R}();function j(R,k,S,c){var o=c?R.split(c):[R];for(var l in o){if(typeof o[l]!="string")continue;var u=o[l].split(S);if(u.length!==2)continue;var T=u[0],m=u[1];k(T,m)}}var P=new z.default(0,0,""),D=P.align==="middle"?"middle":"center";function E(R,k,S){var c=R;function o(){var T=I(R);if(T===null)throw new Error("Malformed timestamp: "+c);return R=R.replace(/^[^\sa-zA-Z-]+/,""),T}function l(T,m){var p=new W;j(T,function(g,f){var d;switch(g){case"region":for(var a=S.length-1;a>=0;a--)if(S[a].id===f){p.set(g,S[a].region);break}break;case"vertical":p.alt(g,f,["rl","lr"]);break;case"line":d=f.split(","),p.integer(g,d[0]),p.percent(g,d[0])&&p.set("snapToLines",!1),p.alt(g,d[0],["auto"]),d.length===2&&p.alt("lineAlign",d[1],["start",D,"end"]);break;case"position":d=f.split(","),p.percent(g,d[0]),d.length===2&&p.alt("positionAlign",d[1],["start",D,"end","line-left","line-right","auto"]);break;case"size":p.percent(g,f);break;case"align":p.alt(g,f,["start",D,"end","left","right"]);break}},/:/,/\s/),m.region=p.get("region",null),m.vertical=p.get("vertical","");var w=p.get("line","auto");w==="auto"&&P.line===-1&&(w=-1),m.line=w,m.lineAlign=p.get("lineAlign","start"),m.snapToLines=p.get("snapToLines",!0),m.size=p.get("size",100),m.align=p.get("align",D);var x=p.get("position","auto");x==="auto"&&P.position===50&&(x=m.align==="start"||m.align==="left"?0:m.align==="end"||m.align==="right"?100:50),m.position=x}function u(){R=R.replace(/^\s+/,"")}if(u(),k.startTime=o(),u(),R.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+c);R=R.substr(3),u(),k.endTime=o(),u(),l(R,k)}function _(R){return R.replace(/<br(?: \/)?>/gi,`
|
|
`)}var M=function(){function R(){this.state="INITIAL",this.buffer="",this.decoder=new A,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var k=R.prototype;return k.parse=function(c){var o=this;c&&(o.buffer+=o.decoder.decode(c,{stream:!0}));function l(){var x=o.buffer,g=0;for(x=_(x);g<x.length&&x[g]!=="\r"&&x[g]!==`
|
|
`;)++g;var f=x.substr(0,g);return x[g]==="\r"&&++g,x[g]===`
|
|
`&&++g,o.buffer=x.substr(g),f}function u(x){j(x,function(g,f){},/:/)}try{var T="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;T=l();var m=T.match(/^()?WEBVTT([ \t].*)?$/);if(!m||!m[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var p=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;p?p=!1:T=l();switch(o.state){case"HEADER":/:/.test(T)?u(T):T||(o.state="ID");continue;case"NOTE":T||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(T)){o.state="NOTE";break}if(!T)continue;if(o.cue=new z.default(0,0,""),o.state="CUE",T.indexOf("-->")===-1){o.cue.id=T;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{E(T,o.cue,o.regionList)}catch(x){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var w=T.indexOf("-->")!==-1;if(!T||w&&(p=!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+=T}continue;case"BADCUE":T||(o.state="ID")}}}catch(x){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},k.flush=function(){var c=this;try{if((c.cue||c.state==="HEADER")&&(c.buffer+=`
|
|
|
|
`,c.parse()),c.state==="INITIAL"||c.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){c.onparsingerror&&c.onparsingerror(o)}return c.onflush&&c.onflush(),this},R}()},"./src/utils/webvtt-parser.ts":function(le,Y,L){"use strict";L.r(Y),L.d(Y,"generateCueId",function(){return M}),L.d(Y,"parseWebVTT",function(){return k});var z=L("./src/polyfills/number.ts"),A=L("./src/utils/vttparser.ts"),I=L("./src/demux/id3.ts"),W=L("./src/utils/timescale-conversion.ts"),j=L("./src/remux/mp4-remuxer.ts"),P=/\r\n|\n\r|\n|\r/g,D=function(c,o,l){return l===void 0&&(l=0),c.substr(l,o.length)===o},E=function(c){var o=parseInt(c.substr(-3)),l=parseInt(c.substr(-6,2)),u=parseInt(c.substr(-9,2)),T=c.length>9?parseInt(c.substr(0,c.indexOf(":"))):0;if(!Object(z.isFiniteNumber)(o)||!Object(z.isFiniteNumber)(l)||!Object(z.isFiniteNumber)(u)||!Object(z.isFiniteNumber)(T))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+c);return o+=1e3*l,o+=60*1e3*u,o+=60*60*1e3*T,o},_=function(c){for(var o=5381,l=c.length;l;)o=o*33^c.charCodeAt(--l);return(o>>>0).toString()};function M(S,c,o){return _(S.toString())+_(c.toString())+_(o)}var R=function(c,o,l){var u=c[o],T=c[u.prevCC];if(!T||!T.new&&u.new){c.ccOffset=c.presentationOffset=u.start,u.new=!1;return}for(;(m=T)!==null&&m!==void 0&&m.new;){var m;c.ccOffset+=u.start-T.start,u.new=!1,u=T,T=c[u.prevCC]}c.presentationOffset=l};function k(S,c,o,l,u,T,m,p){var w=new A.VTTParser,x=Object(I.utf8ArrayToStr)(new Uint8Array(S)).trim().replace(P,`
|
|
`).split(`
|
|
`),g=[],f=Object(W.toMpegTsClockFromTimescale)(c,o),d="00:00.000",a=0,C=0,v,b=!0,y=!1;w.oncue=function(G){var $=l[u],Z=l.ccOffset,V=(a-f)/9e4;if($!=null&&$.new&&(C!==void 0?Z=l.ccOffset=$.start:R(l,u,V)),V&&(Z=V-l.presentationOffset),y){var H=G.endTime-G.startTime,re=Object(j.normalizePts)((G.startTime+Z-C)*9e4,T*9e4)/9e4;G.startTime=re,G.endTime=re+H}var ce=G.text.trim();G.text=decodeURIComponent(encodeURIComponent(ce)),G.id||(G.id=M(G.startTime,G.endTime,ce)),G.endTime>0&&g.push(G)},w.onparsingerror=function(G){v=G},w.onflush=function(){if(v){p(v);return}m(g)},x.forEach(function(G){if(b)if(D(G,"X-TIMESTAMP-MAP=")){b=!1,y=!0,G.substr(16).split(",").forEach(function($){D($,"LOCAL:")?d=$.substr(6):D($,"MPEGTS:")&&(a=parseInt($.substr(7)))});try{C=E(d)/1e3}catch($){y=!1,v=$}return}else G===""&&(b=!1);w.parse(G+`
|
|
`)}),w.flush()}},"./src/utils/xhr-loader.ts":function(le,Y,L){"use strict";L.r(Y);var z=L("./src/utils/logger.ts"),A=L("./src/loader/load-stats.ts"),I=/^age:\s*[\d.]+\s*$/m,W=function(){function j(D){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=D?D.xhrSetup:null,this.stats=new A.LoadStats,this.retryDelay=0}var P=j.prototype;return P.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},P.abortInternal=function(){var E=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),E&&(E.onreadystatechange=null,E.onprogress=null,E.readyState!==4&&(this.stats.aborted=!0,E.abort()))},P.abort=function(){var E;this.abortInternal(),(E=this.callbacks)!==null&&E!==void 0&&E.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},P.load=function(E,_,M){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=E,this.config=_,this.callbacks=M,this.retryDelay=_.retryDelay,this.loadInternal()},P.loadInternal=function(){var E=this.config,_=this.context;if(!E)return;var M=this.loader=new self.XMLHttpRequest,R=this.stats;R.loading.first=0,R.loaded=0;var k=this.xhrSetup;try{if(k)try{k(M,_.url)}catch(o){M.open("GET",_.url,!0),k(M,_.url)}M.readyState||M.open("GET",_.url,!0);var S=this.context.headers;if(S)for(var c in S)M.setRequestHeader(c,S[c])}catch(o){this.callbacks.onError({code:M.status,text:o.message},_,M);return}_.rangeEnd&&M.setRequestHeader("Range","bytes="+_.rangeStart+"-"+(_.rangeEnd-1)),M.onreadystatechange=this.readystatechange.bind(this),M.onprogress=this.loadprogress.bind(this),M.responseType=_.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),E.timeout),M.send()},P.readystatechange=function(){var E=this.context,_=this.loader,M=this.stats;if(!E||!_)return;var R=_.readyState,k=this.config;if(M.aborted)return;if(R>=2)if(self.clearTimeout(this.requestTimeout),M.loading.first===0&&(M.loading.first=Math.max(self.performance.now(),M.loading.start)),R===4){_.onreadystatechange=null,_.onprogress=null;var S=_.status;if(S>=200&&S<300){M.loading.end=Math.max(self.performance.now(),M.loading.first);var c,o;if(E.responseType==="arraybuffer"?(c=_.response,o=c.byteLength):(c=_.responseText,o=c.length),M.loaded=M.total=o,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(M,E,c,_),!this.callbacks)return;var u={url:_.responseURL,data:c};this.callbacks.onSuccess(u,M,E,_)}else M.retry>=k.maxRetry||S>=400&&S<499?(z.logger.error(S+" while loading "+E.url),this.callbacks.onError({code:S,text:_.statusText},E,_)):(z.logger.warn(S+" while loading "+E.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,k.maxRetryDelay),M.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),k.timeout)},P.loadtimeout=function(){z.logger.warn("timeout while loading "+this.context.url);var E=this.callbacks;E&&(this.abortInternal(),E.onTimeout(this.stats,this.context,this.loader))},P.loadprogress=function(E){var _=this.stats;_.loaded=E.loaded,E.lengthComputable&&(_.total=E.total)},P.getCacheAge=function(){var E=null;if(this.loader&&I.test(this.loader.getAllResponseHeaders())){var _=this.loader.getResponseHeader("age");E=_?parseFloat(_):null}return E},j}();Y.default=W}}).default})},vHTk:function(zt,xt,ee){zt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},xvzu:function(zt,xt,ee){zt.exports={flex_box_center:"flex_box_center___11Yx1",flex_space_between:"flex_space_between___3B8wg",flex_box_vertical_center:"flex_box_vertical_center___1cm8r",flex_box_center_end:"flex_box_center_end___2h7Wz",flex_box_column:"flex_box_column___1vJbd",wrap:"wrap___30mNN",modal:"modal___39YWi",titleWrap:"titleWrap___25lJO",required:"required___2_KP9",title:"title___dFjtB",colorGray:"colorGray___3RoHj",choiceWrap:"choiceWrap___14CFD",answer:"answer___10oFr",activeAnswer:"activeAnswer___S76uT",deleteIcon:"deleteIcon___kKaJg",addIcon:"addIcon___3w3u_",editorWrap:"editorWrap___3DrnO",htmlWrap:"htmlWrap___1tGnP",radio:"radio___24YhJ",color333:"color333___1O71o",color999:"color999___xHfER",questionType:"questionType___22Z7J",questionChoices:"questionChoices____Unas"}}}]);
|