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.
138 lines
738 KiB
138 lines
738 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[186,6,7],{"+NIl":function(ut,Ye,ie){(function(ee){ee(ie("VrN/"))})(function(ee){"use strict";ee.defineMode("stex",function(z,L){"use strict";function G(C,T){C.cmdState.push(T)}function I(C){return C.cmdState.length>0?C.cmdState[C.cmdState.length-1]:null}function P(C){var T=C.cmdState.pop();T&&T.closeBracket()}function B(C){for(var T=C.cmdState,E=T.length-1;E>=0;E--){var u=T[E];if(u.name=="DEFAULT")continue;return u}return{styleIdentifier:function(){return null}}}function N(C,T,E){return function(){this.name=C,this.bracketNo=0,this.style=T,this.styles=E,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var k={};k.importmodule=N("importmodule","tag",["string","builtin"]),k.documentclass=N("documentclass","tag",["","atom"]),k.usepackage=N("usepackage","tag",["atom"]),k.begin=N("begin","tag",["atom"]),k.end=N("end","tag",["atom"]),k.label=N("label","tag",["atom"]),k.ref=N("ref","tag",["atom"]),k.eqref=N("eqref","tag",["atom"]),k.cite=N("cite","tag",["atom"]),k.bibitem=N("bibitem","tag",["atom"]),k.Bibitem=N("Bibitem","tag",["atom"]),k.RBibitem=N("RBibitem","tag",["atom"]),k.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function D(C,T){C.f=T}function v(C,T){var E;if(C.match(/^\\[a-zA-Z@]+/)){var u=C.current().slice(1);return E=k.hasOwnProperty(u)?k[u]:k.DEFAULT,E=new E,G(T,E),D(T,R),E.style}if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/\\]/))return"tag";if(C.match("\\["))return D(T,function(s,d){return w(s,d,"\\]")}),"keyword";if(C.match("\\("))return D(T,function(s,d){return w(s,d,"\\)")}),"keyword";if(C.match("$$"))return D(T,function(s,d){return w(s,d,"$$")}),"keyword";if(C.match("$"))return D(T,function(s,d){return w(s,d,"$")}),"keyword";var o=C.next();if(o=="%")return C.skipToEnd(),"comment";if(o=="}"||o=="]"){if(E=I(T),E)E.closeBracket(o),D(T,R);else return"error";return"bracket"}else return o=="{"||o=="["?(E=k.DEFAULT,E=new E,G(T,E),"bracket"):/\d/.test(o)?(C.eatWhile(/[\w.%]/),"atom"):(C.eatWhile(/[\w\-_]/),E=B(T),E.name=="begin"&&(E.argument=C.current()),E.styleIdentifier())}function w(C,T,E){if(C.eatSpace())return null;if(E&&C.match(E))return D(T,v),"keyword";if(C.match(/^\\[a-zA-Z@]+/))return"tag";if(C.match(/^[a-zA-Z]+/))return"variable-2";if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/]/))return"tag";if(C.match(/^[\^_&]/))return"tag";if(C.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(C.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var u=C.next();return u=="{"||u=="}"||u=="["||u=="]"||u=="("||u==")"?"bracket":u=="%"?(C.skipToEnd(),"comment"):"error"}function R(C,T){var E=C.peek(),u;return E=="{"||E=="["?(u=I(T),u.openBracket(E),C.eat(E),D(T,v),"bracket"):/[ \t\r]/.test(E)?(C.eat(E),null):(D(T,v),P(T),v(C,T))}return{startState:function(){var C=L.inMathMode?function(T,E){return w(T,E)}:v;return{cmdState:[],f:C}},copyState:function(C){return{cmdState:C.cmdState.slice(),f:C.f}},token:function(C,T){return T.f(C,T)},blankLine:function(C){C.f=v,C.cmdState.length=0},lineComment:"%"}}),ee.defineMIME("text/x-stex","stex"),ee.defineMIME("text/x-latex","stex")})},"19Vz":function(ut,Ye,ie){(function(ee){ee(ie("VrN/"))})(function(ee){ee.defineOption("placeholder","",function(N,k,D){var v=D&&D!=ee.Init;if(k&&!v)N.on("blur",I),N.on("change",P),N.on("swapDoc",P),ee.on(N.getInputField(),"compositionupdate",N.state.placeholderCompose=function(){G(N)}),P(N);else if(!k&&v){N.off("blur",I),N.off("change",P),N.off("swapDoc",P),ee.off(N.getInputField(),"compositionupdate",N.state.placeholderCompose),z(N);var w=N.getWrapperElement();w.className=w.className.replace(" CodeMirror-empty","")}k&&!N.hasFocus()&&I(N)});function z(N){N.state.placeholder&&(N.state.placeholder.parentNode.removeChild(N.state.placeholder),N.state.placeholder=null)}function L(N){z(N);var k=N.state.placeholder=document.createElement("pre");k.style.cssText="height: 0; overflow: visible",k.style.direction=N.getOption("direction"),k.className="CodeMirror-placeholder CodeMirror-line-like";var D=N.getOption("placeholder");typeof D=="string"&&(D=document.createTextNode(D)),k.appendChild(D),N.display.lineSpace.insertBefore(k,N.display.lineSpace.firstChild)}function G(N){setTimeout(function(){var k=!1,D=N.getInputField();D.nodeName=="TEXTAREA"?k=!D.value:N.lineCount()==1&&(k=!/[^\u200b]/.test(D.querySelector(".CodeMirror-line").textContent)),k?L(N):z(N)},20)}function I(N){B(N)&&L(N)}function P(N){var k=N.getWrapperElement(),D=B(N);k.className=k.className.replace(" CodeMirror-empty","")+(D?" CodeMirror-empty":""),D?L(N):z(N)}function B(N){return N.lineCount()===1&&N.getLine(0)===""}})},"1eCo":function(ut,Ye,ie){(function(ee){ee(ie("VrN/"))})(function(ee){"use strict";var z={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},L={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ee.defineMode("xml",function(G,I){var P=G.indentUnit,B={},N=I.htmlMode?z:L;for(var k in N)B[k]=N[k];for(var k in I)B[k]=I[k];var D,v;function w(a,g){function m(F){return g.tokenize=F,F(a,g)}var y=a.next();if(y=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?m(T("atom","]]>")):null:a.match("--")?m(T("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),m(E(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),g.tokenize=T("meta","?>"),"meta"):(D=a.eat("/")?"closeTag":"openTag",g.tokenize=R,"tag bracket");if(y=="&"){var M;return a.eat("#")?a.eat("x")?M=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):M=a.eatWhile(/[\d]/)&&a.eat(";"):M=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),M?"atom":"error"}else return a.eatWhile(/[^&<]/),null}w.isInText=!0;function R(a,g){var m=a.next();if(m==">"||m=="/"&&a.eat(">"))return g.tokenize=w,D=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return D="equals",null;if(m=="<"){g.tokenize=w,g.state=d,g.tagName=g.tagStart=null;var y=g.tokenize(a,g);return y?y+" tag error":"tag error"}else return/[\'\"]/.test(m)?(g.tokenize=C(m),g.stringStartCol=a.column(),g.tokenize(a,g)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function C(a){var g=function(m,y){for(;!m.eol();)if(m.next()==a){y.tokenize=R;break}return"string"};return g.isInAttribute=!0,g}function T(a,g){return function(m,y){for(;!m.eol();){if(m.match(g)){y.tokenize=w;break}m.next()}return a}}function E(a){return function(g,m){for(var y;(y=g.next())!=null;){if(y=="<")return m.tokenize=E(a+1),m.tokenize(g,m);if(y==">")if(a==1){m.tokenize=w;break}else return m.tokenize=E(a-1),m.tokenize(g,m)}return"meta"}}function u(a,g,m){this.prev=a.context,this.tagName=g,this.indent=a.indented,this.startOfLine=m,(B.doNotIndent.hasOwnProperty(g)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function s(a,g){for(var m;;){if(!a.context)return;if(m=a.context.tagName,!B.contextGrabbers.hasOwnProperty(m)||!B.contextGrabbers[m].hasOwnProperty(g))return;o(a)}}function d(a,g,m){return a=="openTag"?(m.tagStart=g.column(),S):a=="closeTag"?p:d}function S(a,g,m){return a=="word"?(m.tagName=g.current(),v="tag",b):B.allowMissingTagName&&a=="endTag"?(v="tag bracket",b(a,g,m)):(v="error",S)}function p(a,g,m){if(a=="word"){var y=g.current();return m.context&&m.context.tagName!=y&&B.implicitlyClosed.hasOwnProperty(m.context.tagName)&&o(m),m.context&&m.context.tagName==y||B.matchClosing===!1?(v="tag",h):(v="tag error",A)}else return B.allowMissingTagName&&a=="endTag"?(v="tag bracket",h(a,g,m)):(v="error",A)}function h(a,g,m){return a!="endTag"?(v="error",h):(o(m),d)}function A(a,g,m){return v="error",h(a,g,m)}function b(a,g,m){if(a=="word")return v="attribute",f;if(a=="endTag"||a=="selfcloseTag"){var y=m.tagName,M=m.tagStart;return m.tagName=m.tagStart=null,a=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(y)?s(m,y):(s(m,y),m.context=new u(m,y,M==m.indented)),d}return v="error",b}function f(a,g,m){return a=="equals"?c:(B.allowMissing||(v="error"),b(a,g,m))}function c(a,g,m){return a=="string"?l:a=="word"&&B.allowUnquoted?(v="string",b):(v="error",b(a,g,m))}function l(a,g,m){return a=="string"?l:b(a,g,m)}return{startState:function(a){var g={tokenize:w,state:d,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(g.baseIndent=a),g},token:function(a,g){if(!g.tagName&&a.sol()&&(g.indented=a.indentation()),a.eatSpace())return null;D=null;var m=g.tokenize(a,g);return(m||D)&&m!="comment"&&(v=null,g.state=g.state(D||m,a,g),v&&(m=v=="error"?m+" error":v)),m},indent:function(a,g,m){var y=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+P;if(y&&y.noIndent)return ee.Pass;if(a.tokenize!=R&&a.tokenize!=w)return m?m.match(/^(\s*)/)[0].length:0;if(a.tagName)return B.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+P*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/<!\[CDATA\[/.test(g))return 0;var M=g&&/^<(\/)?([\w_:\.-]*)/.exec(g);if(M&&M[1])for(;y;)if(y.tagName==M[2]){y=y.prev;break}else if(B.implicitlyClosed.hasOwnProperty(y.tagName))y=y.prev;else break;else if(M)for(;y;){var F=B.contextGrabbers[y.tagName];if(F&&F.hasOwnProperty(M[2]))y=y.prev;else break}for(;y&&y.prev&&!y.startOfLine;)y=y.prev;return y?y.indent+P:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:B.htmlMode?"html":"xml",helperType:B.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=b)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var g=[],m=a.context;m;m=m.prev)m.tagName&&g.push(m.tagName);return g.reverse()}}}),ee.defineMIME("text/xml","xml"),ee.defineMIME("application/xml","xml"),ee.mimeModes.hasOwnProperty("text/html")||ee.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"55Ip":function(ut,Ye,ie){"use strict";ie.d(Ye,"a",function(){return s});var ee=ie("Ty5D"),z=ie("dI71"),L=ie("cDcd"),G=ie.n(L),I=ie("YS25"),P=ie("17x9"),B=ie.n(P),N=ie("wx14"),k=ie("zLVn"),D=ie("9R94"),v=function(c){Object(z.a)(l,c);function l(){for(var g,m=arguments.length,y=new Array(m),M=0;M<m;M++)y[M]=arguments[M];return g=c.call.apply(c,[this].concat(y))||this,g.history=Object(I.a)(g.props),g}var a=l.prototype;return a.render=function(){return G.a.createElement(ee.c,{history:this.history,children:this.props.children})},l}(G.a.Component),w=function(c){Object(z.a)(l,c);function l(){for(var g,m=arguments.length,y=new Array(m),M=0;M<m;M++)y[M]=arguments[M];return g=c.call.apply(c,[this].concat(y))||this,g.history=Object(I.b)(g.props),g}var a=l.prototype;return a.render=function(){return G.a.createElement(ee.c,{history:this.history,children:this.props.children})},l}(G.a.Component),R=function(l,a){return typeof l=="function"?l(a):l},C=function(l,a){return typeof l=="string"?Object(I.c)(l,null,null,a):l},T=function(l){return l},E=G.a.forwardRef;typeof E=="undefined"&&(E=T);function u(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=E(function(c,l){var a=c.innerRef,g=c.navigate,m=c.onClick,y=Object(k.a)(c,["innerRef","navigate","onClick"]),M=y.target,F=Object(N.a)({},y,{onClick:function(W){try{m&&m(W)}catch(O){throw W.preventDefault(),O}!W.defaultPrevented&&W.button===0&&(!M||M==="_self")&&!u(W)&&(W.preventDefault(),g())}});return T!==E?F.ref=l||a:F.ref=a,G.a.createElement("a",F)}),s=E(function(c,l){var a=c.component,g=a===void 0?o:a,m=c.replace,y=c.to,M=c.innerRef,F=Object(k.a)(c,["component","replace","to","innerRef"]);return G.a.createElement(ee.e.Consumer,null,function(j){j||Object(D.a)(!1);var W=j.history,O=C(R(y,j.location),j.location),_=O?W.createHref(O):"",K=Object(N.a)({},F,{href:_,navigate:function(){var q=R(y,j.location),ne=m?W.replace:W.push;ne(q)}});return T!==E?K.ref=l||M:K.innerRef=M,G.a.createElement(g,K)})});if(!1)var d,S;var p=function(l){return l},h=G.a.forwardRef;typeof h=="undefined"&&(h=p);function A(){for(var c=arguments.length,l=new Array(c),a=0;a<c;a++)l[a]=arguments[a];return l.filter(function(g){return g}).join(" ")}var b=h(function(c,l){var a=c["aria-current"],g=a===void 0?"page":a,m=c.activeClassName,y=m===void 0?"active":m,M=c.activeStyle,F=c.className,j=c.exact,W=c.isActive,O=c.location,_=c.sensitive,K=c.strict,$=c.style,q=c.to,ne=c.innerRef,Te=Object(k.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return G.a.createElement(ee.e.Consumer,null,function(ve){ve||Object(D.a)(!1);var ge=O||ve.location,ce=C(R(q,ge),ge),he=ce.pathname,oe=he&&he.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),pe=oe?Object(ee.f)(ge.pathname,{path:oe,exact:j,sensitive:_,strict:K}):null,Y=!!(W?W(pe,ge):pe),ae=Y?A(F,y):F,Z=Y?Object(N.a)({},$,{},M):$,xe=Object(N.a)({"aria-current":Y&&g||null,className:ae,style:Z,to:ce},Te);return p!==h?xe.ref=l||ne:xe.innerRef=ne,G.a.createElement(s,xe)})});if(!1)var f},"7Cbv":function(ut,Ye,ie){"use strict";var ee=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),z=new Uint8Array(16);function L(){if(!ee)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ee(z)}var G=/^(?:[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 I(R){return typeof R=="string"&&G.test(R)}for(var P=I,B=[],N=0;N<256;++N)B.push((N+256).toString(16).substr(1));function k(R){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,T=(B[R[C+0]]+B[R[C+1]]+B[R[C+2]]+B[R[C+3]]+"-"+B[R[C+4]]+B[R[C+5]]+"-"+B[R[C+6]]+B[R[C+7]]+"-"+B[R[C+8]]+B[R[C+9]]+"-"+B[R[C+10]]+B[R[C+11]]+B[R[C+12]]+B[R[C+13]]+B[R[C+14]]+B[R[C+15]]).toLowerCase();if(!P(T))throw TypeError("Stringified UUID is invalid");return T}var D=k;function v(R,C,T){R=R||{};var E=R.random||(R.rng||L)();if(E[6]=E[6]&15|64,E[8]=E[8]&63|128,C){T=T||0;for(var u=0;u<16;++u)C[T+u]=E[u];return C}return D(E)}var w=Ye.a=v},"7ahc":function(ut,Ye,ie){"use strict";ie.d(Ye,"a",function(){return S});var ee=ie("k1fw"),z=ie("0Owb"),L=ie("+L6B"),G=ie("2/Rp"),I=ie("y8nQ"),P=ie("Vl3Y"),B=ie("tJVT"),N=ie("OaEy"),k=ie("2fM7"),D=ie("cDcd"),v=ie.n(D),w=ie("VrN/"),R=ie.n(w),C=ie("p77/"),T=ie.n(C),E=ie("c5Ni"),u=ie.n(E),o=k.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},d={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};Ye.b=function(p){var h=p.callback,A=p.onCancel,b=Object(D.useState)("python"),f=Object(B.a)(b,2),c=f[0],l=f[1];function a(m){l(d[m][1])}function g(m){h(m)}return v.a.createElement(P.a,Object(z.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:g}),v.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},v.a.createElement(k.a,{onChange:a},Object.keys(d).map(function(m){return v.a.createElement(o,{key:m,value:m},d[m][0])}))),v.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},v.a.createElement(S,{mode:c})),v.a.createElement("div",{className:"flex-container flex-end"},v.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(G.a,{type:"ghost",onClick:A},"\u53D6\u6D88")))};function S(p){var h=p.value,A=p.onChange,b=p.mode,f=p.options,c=f===void 0?{}:f,l=Object(D.useRef)(),a=Object(D.useState)(),g=Object(B.a)(a,2),m=g[0],y=g[1];return Object(D.useEffect)(function(){if(m){function M(F){var j=F.getValue();A&&A(j)}return m.on("change",M),function(){m.off("change",M)}}},[m,A]),Object(D.useEffect)(function(){m&&m.setOption("mode",b)},[m,b]),Object(D.useEffect)(function(){m&&((h!==m.getValue()||h==="")&&setTimeout(function(){m.setValue(h||" ")},300))},[m,h]),Object(D.useEffect)(function(){if(l.current&&!m){var M=R.a.fromTextArea(l.current,Object(ee.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));y(M)}},[l.current,m]),v.a.createElement("div",{className:"my-codemirror-container"},v.a.createElement("textarea",{ref:l}))}},"7ixt":function(ut,Ye,ie){"use strict";ie.d(Ye,"a",function(){return L});var ee={adjustX:1,adjustY:1},z=[0,0],L={left:{points:["cr","cl"],overflow:ee,offset:[-4,0],targetOffset:z},right:{points:["cl","cr"],overflow:ee,offset:[4,0],targetOffset:z},top:{points:["bc","tc"],overflow:ee,offset:[0,-4],targetOffset:z},bottom:{points:["tc","bc"],overflow:ee,offset:[0,4],targetOffset:z},topLeft:{points:["bl","tl"],overflow:ee,offset:[0,-4],targetOffset:z},leftTop:{points:["tr","tl"],overflow:ee,offset:[-4,0],targetOffset:z},topRight:{points:["br","tr"],overflow:ee,offset:[0,-4],targetOffset:z},rightTop:{points:["tl","tr"],overflow:ee,offset:[4,0],targetOffset:z},bottomRight:{points:["tr","br"],overflow:ee,offset:[0,4],targetOffset:z},rightBottom:{points:["bl","br"],overflow:ee,offset:[4,0],targetOffset:z},bottomLeft:{points:["tl","bl"],overflow:ee,offset:[0,4],targetOffset:z},leftBottom:{points:["br","bl"],overflow:ee,offset:[-4,0],targetOffset:z}},G=L},"8EBN":function(ut,Ye,ie){(function(ee){ee(ie("VrN/"))})(function(ee){"use strict";ee.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var z=0;z<ee.modeInfo.length;z++){var L=ee.modeInfo[z];L.mimes&&(L.mime=L.mimes[0])}ee.findModeByMIME=function(G){G=G.toLowerCase();for(var I=0;I<ee.modeInfo.length;I++){var P=ee.modeInfo[I];if(P.mime==G)return P;if(P.mimes){for(var B=0;B<P.mimes.length;B++)if(P.mimes[B]==G)return P}}if(/\+xml$/.test(G))return ee.findModeByMIME("application/xml");if(/\+json$/.test(G))return ee.findModeByMIME("application/json")},ee.findModeByExtension=function(G){G=G.toLowerCase();for(var I=0;I<ee.modeInfo.length;I++){var P=ee.modeInfo[I];if(P.ext){for(var B=0;B<P.ext.length;B++)if(P.ext[B]==G)return P}}},ee.findModeByFileName=function(G){for(var I=0;I<ee.modeInfo.length;I++){var P=ee.modeInfo[I];if(P.file&&P.file.test(G))return P}var B=G.lastIndexOf("."),N=B>-1&&G.substring(B+1,G.length);if(N)return ee.findModeByExtension(N)},ee.findModeByName=function(G){G=G.toLowerCase();for(var I=0;I<ee.modeInfo.length;I++){var P=ee.modeInfo[I];if(P.name.toLowerCase()==G)return P;if(P.alias){for(var B=0;B<P.alias.length;B++)if(P.alias[B].toLowerCase()==G)return P}}}})},"8hTe":function(ut,Ye,ie){ut.exports={button:"button___1wy9m"}},"9Bee":function(ut,Ye,ie){"use strict";var ee=ie("DYRE"),z=ie("zeV3"),L=ie("+L6B"),G=ie("2/Rp"),I=ie("k1fw"),P=ie("tJVT"),B=ie("cDcd"),N=ie.n(B),k=ie("vg9a"),D=ie("DlQD"),v=ie.n(D),w=ie("rUJ1");function R(ge,ce){var he=ge.match(/^(\s+)(?:```)/);if(he===null)return ce;var oe=he[1];return ce.split(`
|
|
`).map(function(pe){var Y=pe.match(/^\s+/);if(Y===null)return pe;var ae=Object(P.a)(Y,1),Z=ae[0];return Z.length>=oe.length?pe.slice(oe.length):pe}).join(`
|
|
`)}var C=[],T=["<ul>"],E=new v.a.Renderer,u=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function o(){C.length=0,T=["<ul>"]}var s={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function d(ge,ce,he,oe){if(ce>=ge.length||ge[ce].level<=he)return ce;var pe=ge[ce];oe.push("<li><a href='#"+pe.anchor+"'>"+pe.text+"</a>"),ce++;var Y=[];return ce=d(ge,ce,pe.level,Y),Y.length>0&&(oe.push("<ul>"),Y.forEach(function(ae){oe.push(ae)}),oe.push("</ul>")),oe.push("</li>"),ce=d(ge,ce,he,oe),ce}function S(){return d(C,0,0,T),T.push("</ul>"),T.join("")}var p={heading:function(ce){var he=u.exec(ce);if(he)return{type:"heading",raw:he[0],depth:he[1].length,text:he[2]}},fences:function(ce){var he=this.rules.block.fences.exec(ce);if(he){var oe=he[0],pe=R(oe,he[3]||""),Y=he[2]?he[2].trim():he[2];if(["latex","katex","math"].indexOf(Y)>=0){var ae=b(),Z=pe;pe=ae,f[ae]={type:"block",expression:Z}}return{type:"code",raw:oe,lang:Y,text:pe}}}},h=/(?:\${2})([^\n`]+?)(?:\${2})/gi,A=0,b=function(){return"__special_katext_id_".concat(A++,"__")},f={};function c(){return f}function l(){A=0,f={}}function a(ge){return ge=ge.replace(h,function(ce,he){var oe=b();return f[oe]={type:"inline",expression:he},oe}),ge}var g=E.listitem;E.listitem=function(ge){return g(a(ge))};var m=E.paragraph;E.paragraph=function(ge){return m(a(ge))};var y=E.tablecell;E.tablecell=function(ge,ce){return y(a(ge),ce)},E.code=function(ge,ce,he){var oe=(ce||"").match(/\S*/)[0];return oe?["latex","katex","math"].indexOf(oe)>=0?"<p class='editormd-tex'>".concat(ge,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(ce,'">').concat(he?ge:Object(w.escape)(ge,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(he?ge:Object(w.escape)(ge,!0))+"</code></pre>"},E.heading=function(ge,ce,he){var oe=this.options.headerPrefix+he.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return C.push({anchor:oe,level:ce,text:ge}),"<h"+ce+' id="'+oe+'">'+ge+"</h"+ce+">"},v.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),v.a.use({tokenizer:p,renderer:E});var M=v.a,F=ie("SJMd"),j=ie("ulZh"),W=ie.n(j),O=ie("m3rI"),_=ie("Oy/b"),K=ie("p5ED"),$=ie("8hTe"),q=ie.n($),ne=/<pre[^>]*>/g;function Te(ge){var ce=document.createElement("div");return ce.innerHTML=ge,ce.childNodes.length===0?"":ce.childNodes[0].nodeValue}var ve=Ye.a=function(ge){var ce=ge.value,he=ce===void 0?"":ce,oe=ge.edit,pe=oe===void 0?!1:oe,Y=ge.className,ae=ge.showTextOnly,Z=ge.showLines,xe=ge.replaces,we=ge.zoomImg,ye=ge.hasMask,Se=ge.style,Oe=Se===void 0?{}:Se,Pe=ge.stylesPrev,_e=Pe===void 0?{}:Pe,De=String(he),Le=Object(B.useRef)(),Ue=Object(B.useRef)(),Ve=Object(B.useState)(""),We=Object(P.a)(Ve,2),Ge=We[0],et=We[1],Je=Object(B.useState)("office"),ze=Object(P.a)(Je,2),Ce=ze[0],qe=ze[1],$e=Object(B.useMemo)(function(){try{var de=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Q=/\"\/api\/attachments\/|\"\/attachments\/download\//g,J=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;De=De.replace(de,"("+O.a.API_SERVER+"/api/attachments/").replace(Q,'"'+O.a.API_SERVER+"/api/attachments/").replace(J,'"'+O.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`)}catch(Ae){}var te=M(De),se=c();if(De.match(/\[TOC\]/)&&(te=te.replace("<p>[TOC]</p>",S()),o()),te=te.replace(/(__special_katext_id_\d+__)/g,function(Ae,Me){var Xe=se[Me],it=Xe.type,tt=Xe.expression;return Object(_.renderToString)(Te(tt)||"",{displayMode:it==="block",throwOnError:!1,output:"html"})}),te=te.replace(/▁/g,"\u2581\u2581\u2581"),l(),ae){var fe=document.createElement("div");return fe.innerHTML=te,fe.innerText}return setTimeout(function(){return me()},500),te},[De]),Re=Object(B.useRef)();s.WebkitLineClamp=Z,Z&&(Oe=Object(I.a)(Object(I.a)({},Oe),s));function Fe(de){var Q=de.target;if(Q.tagName.toUpperCase()==="IMG"){if(we){var J=Q.getAttribute("src");et(J),qe("image")}}else if(Q.tagName.toUpperCase()==="A"){var te=Q.getAttribute("href");if(te.indexOf("office")>-1)de.preventDefault(),et(te),qe("office");else if(te.indexOf("application/pdf")>-1)de.preventDefault(),et(te),qe("pdf");else if(te.indexOf("text/html")>-1)de.preventDefault(),et(te),qe("html");else if(te.startsWith("#")){de.preventDefault();var se=document.getElementById(te.replace("#",""));se&&se.scrollIntoView(!0)}}}var me=function(){var Q,J=(Q=Re.current)===null||Q===void 0?void 0:Q.querySelectorAll("video");J==null||J.forEach(function(te){if(te.oncontextmenu=function(){return!1},te.src.indexOf(".m3u8")>-1&&!te.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var se=new W.a;se.loadSource(te.src),se.attachMedia(te)}}})};Object(B.useEffect)(function(){if(Re.current&&$e&&($e.match(ne)&&window.PR.prettyPrint()),Re.current)return Re.current.addEventListener("click",Fe),function(){Re.current.removeEventListener("click",Fe),l(),o()}},[$e,Re.current,Fe]);var ue=function(Q){if(!pe)return;Q.target.nodeName==="IMG"?(Le.current.style.display="flex",Le.current.style.width=Q.target.clientWidth+"px",Le.current.style.height=Q.target.clientHeight+"px",Le.current.style.top=Q.target.offsetTop+"px",Le.current.style.left=Q.target.offsetLeft+"px",Ue.current.src=Q.target.getAttribute("src")):Le.current.style.display="none"};return N.a.createElement("div",{style:{position:"relative"}},N.a.createElement("div",{ref:Re,style:Object(I.a)({},Oe),className:"".concat(Y||""," markdown-body ").concat(q.a.mdBody),onMouseOver:ue,dangerouslySetInnerHTML:{__html:$e}}),N.a.createElement("div",{ref:Le,className:q.a.button},N.a.createElement(z.a,null,N.a.createElement(G.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),N.a.createElement(G.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),N.a.createElement("img",{ref:Ue,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),N.a.createElement(K.a,{close:!0,data:Ge,type:Ge!=null&&Ge.length?Ce:"",style:Object(I.a)({},_e),onClose:function(){return et("")}}))}},"9VGf":function(ut,Ye,ie){"use strict";ie.d(Ye,"a",function(){return L});var ee=ie("cDcd"),z=ie.n(ee);function L(G,I){var P=Object(ee.useRef)();Object(ee.useEffect)(function(){P.current=G}),Object(ee.useEffect)(function(){function B(){P.current()}if(I!==null){var N=setInterval(B,I);return function(){return clearInterval(N)}}},[I])}},Bd2K:function(ut,Ye,ie){(function(ee){ee(ie("VrN/"),ie("osHv"))})(function(ee){ee.defineOption("autoCloseTags",!1,function(k,D,v){if(v!=ee.Init&&v&&k.removeKeyMap("autoCloseTags"),!D)return;var w={name:"autoCloseTags"};(typeof D!="object"||D.whenClosing!==!1)&&(w["'/'"]=function(R){return P(R)}),(typeof D!="object"||D.whenOpening!==!1)&&(w["'>'"]=function(R){return G(R)}),k.addKeyMap(w)});var z=["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 G(k){if(k.getOption("disableInput"))return ee.Pass;for(var D=k.listSelections(),v=[],w=k.getOption("autoCloseTags"),R=0;R<D.length;R++){if(!D[R].empty())return ee.Pass;var C=D[R].head,T=k.getTokenAt(C),E=ee.innerMode(k.getMode(),T.state),u=E.state,o=E.mode.xmlCurrentTag&&E.mode.xmlCurrentTag(u),s=o&&o.name;if(!s)return ee.Pass;var d=E.mode.configuration=="html",S=typeof w=="object"&&w.dontCloseTags||d&&z,p=typeof w=="object"&&w.indentTags||d&&L;T.end>C.ch&&(s=s.slice(0,s.length-T.end+C.ch));var h=s.toLowerCase();if(!s||T.type=="string"&&(T.end!=C.ch||!/[\"\']/.test(T.string.charAt(T.string.length-1))||T.string.length==1)||T.type=="tag"&&o.close||T.string.indexOf("/")==C.ch-T.start-1||S&&B(S,h)>-1||N(k,E.mode.xmlCurrentContext&&E.mode.xmlCurrentContext(u)||[],s,C,!0))return ee.Pass;var A=typeof w=="object"&&w.emptyTags;if(A&&B(A,s)>-1){v[R]={text:"/>",newPos:ee.Pos(C.line,C.ch+2)};continue}var b=p&&B(p,h)>-1;v[R]={indent:b,text:">"+(b?`
|
|
|
|
`:"")+"</"+s+">",newPos:b?ee.Pos(C.line+1,0):ee.Pos(C.line,C.ch+1)}}for(var f=typeof w=="object"&&w.dontIndentOnAutoClose,R=D.length-1;R>=0;R--){var c=v[R];k.replaceRange(c.text,D[R].head,D[R].anchor,"+insert");var l=k.listSelections().slice(0);l[R]={head:c.newPos,anchor:c.newPos},k.setSelections(l),!f&&c.indent&&(k.indentLine(c.newPos.line,null,!0),k.indentLine(c.newPos.line+1,null,!0))}}function I(k,D){for(var v=k.listSelections(),w=[],R=D?"/":"</",C=k.getOption("autoCloseTags"),T=typeof C=="object"&&C.dontIndentOnSlash,E=0;E<v.length;E++){if(!v[E].empty())return ee.Pass;var u=v[E].head,o=k.getTokenAt(u),s=ee.innerMode(k.getMode(),o.state),d=s.state;if(D&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=u.ch-1))return ee.Pass;var S,p=s.mode.name!="xml"&&k.getMode().name=="htmlmixed";if(p&&s.mode.name=="javascript")S=R+"script";else if(p&&s.mode.name=="css")S=R+"style";else{var h=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(d);if(!h||h.length&&N(k,h,h[h.length-1],u))return ee.Pass;S=R+h[h.length-1]}k.getLine(u.line).charAt(o.end)!=">"&&(S+=">"),w[E]=S}if(k.replaceSelections(w),v=k.listSelections(),!T)for(var E=0;E<v.length;E++)(E==v.length-1||v[E].head.line<v[E+1].head.line)&&k.indentLine(v[E].head.line)}function P(k){return k.getOption("disableInput")?ee.Pass:I(k,!0)}ee.commands.closeTag=function(k){return I(k)};function B(k,D){if(k.indexOf)return k.indexOf(D);for(var v=0,w=k.length;v<w;++v)if(k[v]==D)return v;return-1}function N(k,D,v,w,R){if(!ee.scanForClosingTag)return!1;var C=Math.min(k.lastLine()+1,w.line+500),T=ee.scanForClosingTag(k,w,null,C);if(!T||T.tag!=v)return!1;for(var E=R?1:0,u=D.length-1;u>=0&&D[u]==v;u--)++E;w=T.to;for(var u=1;u<E;u++){var o=ee.scanForClosingTag(k,w,null,C);if(!o||o.tag!=v)return!1;w=o.to}return!0}})},BjJ7:function(ut,Ye,ie){"use strict";ie.d(Ye,"d",function(){return z}),ie.d(Ye,"c",function(){return L}),ie.d(Ye,"e",function(){return G}),ie.d(Ye,"b",function(){return I}),ie.d(Ye,"a",function(){return B});var ee=ie("m3rI");function z(N){var k=!0;if(N.length>0){for(var D=0;D<N.length;D++)if(N[D].compile_success==0||!N[D].compile_success){k=!1;break}}else k=!1;return k}function L(N){for(var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",D=[],v=0;v<N.length;v++){var w=N[v],R=k?"".concat(k,"/").concat(w.name):"".concat(w.name);D.push({title:w.name,isLeaf:!(w.type==="tree"),key:R})}return D}function G(N,k,D){for(var v=0;v<N.length;v++){var w=N[v];if(w.key===k){w.children=D;break}w.children&&G(w.children,k,D)}return N}function I(N,k,D){var v;return function(){var w=this,R=arguments,C=function(){v=null,D||N.apply(w,R)},T=D&&!v;clearTimeout(v),v=setTimeout(C,k),T&&N.apply(w,R)}}var P=!0,B=ee.a.API_SERVER},"C+DQ":function(ut,Ye,ie){},DlQD:function(ut,Ye,ie){(function(ee,z){ut.exports=z()})(this,function(){"use strict";function ee(me,ue){for(var de=0;de<ue.length;de++){var Q=ue[de];Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q&&(Q.writable=!0),Object.defineProperty(me,Q.key,Q)}}function z(me,ue,de){return ue&&ee(me.prototype,ue),de&&ee(me,de),me}function L(me,ue){if(!me)return;if(typeof me=="string")return G(me,ue);var de=Object.prototype.toString.call(me).slice(8,-1);if(de==="Object"&&me.constructor&&(de=me.constructor.name),de==="Map"||de==="Set")return Array.from(me);if(de==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(de))return G(me,ue)}function G(me,ue){(ue==null||ue>me.length)&&(ue=me.length);for(var de=0,Q=new Array(ue);de<ue;de++)Q[de]=me[de];return Q}function I(me,ue){var de;if(typeof Symbol=="undefined"||me[Symbol.iterator]==null){if(Array.isArray(me)||(de=L(me))||ue&&me&&typeof me.length=="number"){de&&(me=de);var Q=0;return function(){return Q>=me.length?{done:!0}:{done:!1,value:me[Q++]}}}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 de=me[Symbol.iterator](),de.next.bind(de)}function P(me,ue){return ue={exports:{}},me(ue,ue.exports),ue.exports}var B=P(function(me){function ue(){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 de(Q){me.exports.defaults=Q}me.exports={defaults:ue(),getDefaults:ue,changeDefaults:de}}),N=B.defaults,k=B.getDefaults,D=B.changeDefaults,v=/[&<>"']/,w=/[&<>"']/g,R=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,T={"&":"&","<":"<",">":">",'"':""","'":"'"},E=function(ue){return T[ue]};function u(me,ue){if(ue){if(v.test(me))return me.replace(w,E)}else if(R.test(me))return me.replace(C,E);return me}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(me){return me.replace(o,function(ue,de){return de=de.toLowerCase(),de==="colon"?":":de.charAt(0)==="#"?de.charAt(1)==="x"?String.fromCharCode(parseInt(de.substring(2),16)):String.fromCharCode(+de.substring(1)):""})}var d=/(^|[^\[])\^/g;function S(me,ue){me=me.source||me,ue=ue||"";var de={replace:function(J,te){return te=te.source||te,te=te.replace(d,"$1"),me=me.replace(J,te),de},getRegex:function(){return new RegExp(me,ue)}};return de}var p=/[^\w:]/g,h=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function A(me,ue,de){if(me){var Q;try{Q=decodeURIComponent(s(de)).replace(p,"").toLowerCase()}catch(J){return null}if(Q.indexOf("javascript:")===0||Q.indexOf("vbscript:")===0||Q.indexOf("data:")===0)return null}ue&&!h.test(de)&&(de=a(ue,de));try{de=encodeURI(de).replace(/%25/g,"%")}catch(J){return null}return de}var b={},f=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(me,ue){b[" "+me]||(f.test(me)?b[" "+me]=me+"/":b[" "+me]=M(me,"/",!0)),me=b[" "+me];var de=me.indexOf(":")===-1;return ue.substring(0,2)==="//"?de?ue:me.replace(c,"$1")+ue:ue.charAt(0)==="/"?de?ue:me.replace(l,"$1")+ue:me+ue}var g={exec:function(){}};function m(me){for(var ue=1,de,Q;ue<arguments.length;ue++){de=arguments[ue];for(Q in de)Object.prototype.hasOwnProperty.call(de,Q)&&(me[Q]=de[Q])}return me}function y(me,ue){var de=me.replace(/\|/g,function(te,se,fe){for(var Ae=!1,Me=se;--Me>=0&&fe[Me]==="\\";)Ae=!Ae;return Ae?"|":" |"}),Q=de.split(/ \|/),J=0;if(Q.length>ue)Q.splice(ue);else for(;Q.length<ue;)Q.push("");for(;J<Q.length;J++)Q[J]=Q[J].trim().replace(/\\\|/g,"|");return Q}function M(me,ue,de){var Q=me.length;if(Q===0)return"";for(var J=0;J<Q;){var te=me.charAt(Q-J-1);if(te===ue&&!de)J++;else if(te!==ue&&de)J++;else break}return me.substr(0,Q-J)}function F(me,ue){if(me.indexOf(ue[1])===-1)return-1;for(var de=me.length,Q=0,J=0;J<de;J++)if(me[J]==="\\")J++;else if(me[J]===ue[0])Q++;else if(me[J]===ue[1]&&(Q--,Q<0))return J;return-1}function j(me){me&&me.sanitize&&!me.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 W={escape:u,unescape:s,edit:S,cleanUrl:A,resolveUrl:a,noopTest:g,merge:m,splitCells:y,rtrim:M,findClosingBracket:F,checkSanitizeDeprecation:j},O=B.defaults,_=W.rtrim,K=W.splitCells,$=W.escape,q=W.findClosingBracket;function ne(me,ue,de){var Q=ue.href,J=ue.title?$(ue.title):null,te=me[1].replace(/\\([\[\]])/g,"$1");return me[0].charAt(0)!=="!"?{type:"link",raw:de,href:Q,title:J,text:te}:{type:"image",raw:de,href:Q,title:J,text:$(te)}}function Te(me,ue){var de=me.match(/^(\s+)(?:```)/);if(de===null)return ue;var Q=de[1];return ue.split(`
|
|
`).map(function(J){var te=J.match(/^\s+/);if(te===null)return J;var se=te[0];return se.length>=Q.length?J.slice(Q.length):J}).join(`
|
|
`)}var ve=function(){function me(de){this.options=de||O}var ue=me.prototype;return ue.space=function(Q){var J=this.rules.block.newline.exec(Q);if(J)return J[0].length>1?{type:"space",raw:J[0]}:{raw:`
|
|
`}},ue.code=function(Q,J){var te=this.rules.block.code.exec(Q);if(te){var se=J[J.length-1];if(se&&se.type==="paragraph")return{raw:te[0],text:te[0].trimRight()};var fe=te[0].replace(/^ {4}/gm,"");return{type:"code",raw:te[0],codeBlockStyle:"indented",text:this.options.pedantic?fe:_(fe,`
|
|
`)}}},ue.fences=function(Q){var J=this.rules.block.fences.exec(Q);if(J){var te=J[0],se=Te(te,J[3]||"");return{type:"code",raw:te,lang:J[2]?J[2].trim():J[2],text:se}}},ue.heading=function(Q){var J=this.rules.block.heading.exec(Q);if(J)return{type:"heading",raw:J[0],depth:J[1].length,text:J[2]}},ue.nptable=function(Q){var J=this.rules.block.nptable.exec(Q);if(J){var te={type:"table",header:K(J[1].replace(/^ *| *\| *$/g,"")),align:J[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:J[3]?J[3].replace(/\n$/,"").split(`
|
|
`):[],raw:J[0]};if(te.header.length===te.align.length){var se=te.align.length,fe;for(fe=0;fe<se;fe++)/^ *-+: *$/.test(te.align[fe])?te.align[fe]="right":/^ *:-+: *$/.test(te.align[fe])?te.align[fe]="center":/^ *:-+ *$/.test(te.align[fe])?te.align[fe]="left":te.align[fe]=null;for(se=te.cells.length,fe=0;fe<se;fe++)te.cells[fe]=K(te.cells[fe],te.header.length);return te}}},ue.hr=function(Q){var J=this.rules.block.hr.exec(Q);if(J)return{type:"hr",raw:J[0]}},ue.blockquote=function(Q){var J=this.rules.block.blockquote.exec(Q);if(J){var te=J[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:J[0],text:te}}},ue.list=function(Q){var J=this.rules.block.list.exec(Q);if(J){for(var te=J[0],se=J[2],fe=se.length>1,Ae=se[se.length-1]===")",Me={type:"list",raw:te,ordered:fe,start:fe?+se.slice(0,-1):"",loose:!1,items:[]},Xe=J[0].match(this.rules.block.item),it=!1,tt,xt,ht,ot,Ct,yt,Bt,Ft=Xe.length,bt=0;bt<Ft;bt++)tt=Xe[bt],te=tt,xt=tt.length,tt=tt.replace(/^ *([*+-]|\d+[.)]) */,""),~tt.indexOf(`
|
|
`)&&(xt-=tt.length,tt=this.options.pedantic?tt.replace(/^ {1,4}/gm,""):tt.replace(new RegExp("^ {1,"+xt+"}","gm"),"")),bt!==Ft-1&&(ht=this.rules.block.bullet.exec(Xe[bt+1])[0],(fe?ht.length===1||!Ae&&ht[ht.length-1]===")":ht.length>1||this.options.smartLists&&ht!==se)&&(ot=Xe.slice(bt+1).join(`
|
|
`),Me.raw=Me.raw.substring(0,Me.raw.length-ot.length),bt=Ft-1)),Ct=it||/\n\n(?!\s*$)/.test(tt),bt!==Ft-1&&(it=tt.charAt(tt.length-1)===`
|
|
`,Ct||(Ct=it)),Ct&&(Me.loose=!0),yt=/^\[[ xX]\] /.test(tt),Bt=void 0,yt&&(Bt=tt[1]!==" ",tt=tt.replace(/^\[[ xX]\] +/,"")),Me.items.push({type:"list_item",raw:te,task:yt,checked:Bt,loose:Ct,text:tt});return Me}},ue.html=function(Q){var J=this.rules.block.html.exec(Q);if(J)return{type:this.options.sanitize?"paragraph":"html",raw:J[0],pre:!this.options.sanitizer&&(J[1]==="pre"||J[1]==="script"||J[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(J[0]):$(J[0]):J[0]}},ue.def=function(Q){var J=this.rules.block.def.exec(Q);if(J){J[3]&&(J[3]=J[3].substring(1,J[3].length-1));var te=J[1].toLowerCase().replace(/\s+/g," ");return{tag:te,raw:J[0],href:J[2],title:J[3]}}},ue.table=function(Q){var J=this.rules.block.table.exec(Q);if(J){var te={type:"table",header:K(J[1].replace(/^ *| *\| *$/g,"")),align:J[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:J[3]?J[3].replace(/\n$/,"").split(`
|
|
`):[]};if(te.header.length===te.align.length){te.raw=J[0];var se=te.align.length,fe;for(fe=0;fe<se;fe++)/^ *-+: *$/.test(te.align[fe])?te.align[fe]="right":/^ *:-+: *$/.test(te.align[fe])?te.align[fe]="center":/^ *:-+ *$/.test(te.align[fe])?te.align[fe]="left":te.align[fe]=null;for(se=te.cells.length,fe=0;fe<se;fe++)te.cells[fe]=K(te.cells[fe].replace(/^ *\| *| *\| *$/g,""),te.header.length);return te}}},ue.lheading=function(Q){var J=this.rules.block.lheading.exec(Q);if(J)return{type:"heading",raw:J[0],depth:J[2].charAt(0)==="="?1:2,text:J[1]}},ue.paragraph=function(Q){var J=this.rules.block.paragraph.exec(Q);if(J)return{type:"paragraph",raw:J[0],text:J[1].charAt(J[1].length-1)===`
|
|
`?J[1].slice(0,-1):J[1]}},ue.text=function(Q,J){var te=this.rules.block.text.exec(Q);if(te){var se=J[J.length-1];return se&&se.type==="text"?{raw:te[0],text:te[0]}:{type:"text",raw:te[0],text:te[0]}}},ue.escape=function(Q){var J=this.rules.inline.escape.exec(Q);if(J)return{type:"escape",raw:J[0],text:$(J[1])}},ue.tag=function(Q,J,te){var se=this.rules.inline.tag.exec(Q);if(se)return!J&&/^<a /i.test(se[0])?J=!0:J&&/^<\/a>/i.test(se[0])&&(J=!1),!te&&/^<(pre|code|kbd|script)(\s|>)/i.test(se[0])?te=!0:te&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(se[0])&&(te=!1),{type:this.options.sanitize?"text":"html",raw:se[0],inLink:J,inRawBlock:te,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):$(se[0]):se[0]}},ue.link=function(Q){var J=this.rules.inline.link.exec(Q);if(J){var te=q(J[2],"()");if(te>-1){var se=J[0].indexOf("!")===0?5:4,fe=se+J[1].length+te;J[2]=J[2].substring(0,te),J[0]=J[0].substring(0,fe).trim(),J[3]=""}var Ae=J[2],Me="";if(this.options.pedantic){var Xe=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ae);Xe?(Ae=Xe[1],Me=Xe[3]):Me=""}else Me=J[3]?J[3].slice(1,-1):"";Ae=Ae.trim().replace(/^<([\s\S]*)>$/,"$1");var it=ne(J,{href:Ae&&Ae.replace(this.rules.inline._escapes,"$1"),title:Me&&Me.replace(this.rules.inline._escapes,"$1")},J[0]);return it}},ue.reflink=function(Q,J){var te;if((te=this.rules.inline.reflink.exec(Q))||(te=this.rules.inline.nolink.exec(Q))){var se=(te[2]||te[1]).replace(/\s+/g," ");if(se=J[se.toLowerCase()],!se||!se.href){var fe=te[0].charAt(0);return{type:"text",raw:fe,text:fe}}var Ae=ne(te,se,te[0]);return Ae}},ue.strong=function(Q,J,te){te===void 0&&(te="");var se=this.rules.inline.strong.start.exec(Q);if(se&&(!se[1]||se[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){J=J.slice(-1*Q.length);var fe=se[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;fe.lastIndex=0;for(var Ae;(se=fe.exec(J))!=null;)if(Ae=this.rules.inline.strong.middle.exec(J.slice(0,se.index+3)),Ae)return{type:"strong",raw:Q.slice(0,Ae[0].length),text:Q.slice(2,Ae[0].length-2)}}},ue.em=function(Q,J,te){te===void 0&&(te="");var se=this.rules.inline.em.start.exec(Q);if(se&&(!se[1]||se[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){J=J.slice(-1*Q.length);var fe=se[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;fe.lastIndex=0;for(var Ae;(se=fe.exec(J))!=null;)if(Ae=this.rules.inline.em.middle.exec(J.slice(0,se.index+2)),Ae)return{type:"em",raw:Q.slice(0,Ae[0].length),text:Q.slice(1,Ae[0].length-1)}}},ue.codespan=function(Q){var J=this.rules.inline.code.exec(Q);if(J){var te=J[2].replace(/\n/g," "),se=/[^ ]/.test(te),fe=te.startsWith(" ")&&te.endsWith(" ");return se&&fe&&(te=te.substring(1,te.length-1)),te=$(te,!0),{type:"codespan",raw:J[0],text:te}}},ue.br=function(Q){var J=this.rules.inline.br.exec(Q);if(J)return{type:"br",raw:J[0]}},ue.del=function(Q){var J=this.rules.inline.del.exec(Q);if(J)return{type:"del",raw:J[0],text:J[1]}},ue.autolink=function(Q,J){var te=this.rules.inline.autolink.exec(Q);if(te){var se,fe;return te[2]==="@"?(se=$(this.options.mangle?J(te[1]):te[1]),fe="mailto:"+se):(se=$(te[1]),fe=se),{type:"link",raw:te[0],text:se,href:fe,tokens:[{type:"text",raw:se,text:se}]}}},ue.url=function(Q,J){var te;if(te=this.rules.inline.url.exec(Q)){var se,fe;if(te[2]==="@")se=$(this.options.mangle?J(te[0]):te[0]),fe="mailto:"+se;else{var Ae;do Ae=te[0],te[0]=this.rules.inline._backpedal.exec(te[0])[0];while(Ae!==te[0]);se=$(te[0]),te[1]==="www."?fe="http://"+se:fe=se}return{type:"link",raw:te[0],text:se,href:fe,tokens:[{type:"text",raw:se,text:se}]}}},ue.inlineText=function(Q,J,te){var se=this.rules.inline.text.exec(Q);if(se){var fe;return J?fe=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):$(se[0]):se[0]:fe=$(this.options.smartypants?te(se[0]):se[0]),{type:"text",raw:se[0],text:fe}}},me}(),ge=W.noopTest,ce=W.edit,he=W.merge,oe={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:ge,table:ge,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};oe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,oe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,oe.def=ce(oe.def).replace("label",oe._label).replace("title",oe._title).getRegex(),oe.bullet=/(?:[*+-]|\d{1,9}[.)])/,oe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,oe.item=ce(oe.item,"gm").replace(/bull/g,oe.bullet).getRegex(),oe.list=ce(oe.list).replace(/bull/g,oe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+oe.def.source+")").getRegex(),oe._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",oe._comment=/<!--(?!-?>)[\s\S]*?-->/,oe.html=ce(oe.html,"i").replace("comment",oe._comment).replace("tag",oe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),oe.paragraph=ce(oe._paragraph).replace("hr",oe.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",oe._tag).getRegex(),oe.blockquote=ce(oe.blockquote).replace("paragraph",oe.paragraph).getRegex(),oe.normal=he({},oe),oe.gfm=he({},oe.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*|$)"}),oe.gfm.nptable=ce(oe.gfm.nptable).replace("hr",oe.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",oe._tag).getRegex(),oe.gfm.table=ce(oe.gfm.table).replace("hr",oe.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",oe._tag).getRegex(),oe.pedantic=he({},oe.normal,{html:ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",oe._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:ge,paragraph:ce(oe.normal._paragraph).replace("hr",oe.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",oe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var pe={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ge,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:ge,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};pe._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",pe.punctuation=ce(pe.punctuation).replace(/punctuation/g,pe._punctuation).getRegex(),pe._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",pe._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",pe.em.start=ce(pe.em.start).replace(/punctuation/g,pe._punctuation).getRegex(),pe.em.middle=ce(pe.em.middle).replace(/punctuation/g,pe._punctuation).replace(/overlapSkip/g,pe._overlapSkip).getRegex(),pe.em.endAst=ce(pe.em.endAst,"g").replace(/punctuation/g,pe._punctuation).getRegex(),pe.em.endUnd=ce(pe.em.endUnd,"g").replace(/punctuation/g,pe._punctuation).getRegex(),pe.strong.start=ce(pe.strong.start).replace(/punctuation/g,pe._punctuation).getRegex(),pe.strong.middle=ce(pe.strong.middle).replace(/punctuation/g,pe._punctuation).replace(/blockSkip/g,pe._blockSkip).getRegex(),pe.strong.endAst=ce(pe.strong.endAst,"g").replace(/punctuation/g,pe._punctuation).getRegex(),pe.strong.endUnd=ce(pe.strong.endUnd,"g").replace(/punctuation/g,pe._punctuation).getRegex(),pe.blockSkip=ce(pe._blockSkip,"g").getRegex(),pe.overlapSkip=ce(pe._overlapSkip,"g").getRegex(),pe._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,pe._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,pe._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])?)+(?![-_])/,pe.autolink=ce(pe.autolink).replace("scheme",pe._scheme).replace("email",pe._email).getRegex(),pe._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,pe.tag=ce(pe.tag).replace("comment",oe._comment).replace("attribute",pe._attribute).getRegex(),pe._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,pe._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,pe._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,pe.link=ce(pe.link).replace("label",pe._label).replace("href",pe._href).replace("title",pe._title).getRegex(),pe.reflink=ce(pe.reflink).replace("label",pe._label).getRegex(),pe.reflinkSearch=ce(pe.reflinkSearch,"g").replace("reflink",pe.reflink).replace("nolink",pe.nolink).getRegex(),pe.normal=he({},pe),pe.pedantic=he({},pe.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:ce(/^!?\[(label)\]\((.*?)\)/).replace("label",pe._label).getRegex(),reflink:ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",pe._label).getRegex()}),pe.gfm=he({},pe.normal,{escape:ce(pe.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),pe.gfm.url=ce(pe.gfm.url,"i").replace("email",pe.gfm._extended_email).getRegex(),pe.breaks=he({},pe.gfm,{br:ce(pe.br).replace("{2,}","*").getRegex(),text:ce(pe.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Y={block:oe,inline:pe},ae=B.defaults,Z=Y.block,xe=Y.inline;function we(me){return me.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 ye(me){var ue="",de,Q,J=me.length;for(de=0;de<J;de++)Q=me.charCodeAt(de),Math.random()>.5&&(Q="x"+Q.toString(16)),ue+="&#"+Q+";";return ue}var Se=function(){function me(de){this.tokens=[],this.tokens.links=Object.create(null),this.options=de||ae,this.options.tokenizer=this.options.tokenizer||new ve,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Q={block:Z.normal,inline:xe.normal};this.options.pedantic?(Q.block=Z.pedantic,Q.inline=xe.pedantic):this.options.gfm&&(Q.block=Z.gfm,this.options.breaks?Q.inline=xe.breaks:Q.inline=xe.gfm),this.tokenizer.rules=Q}me.lex=function(Q,J){var te=new me(J);return te.lex(Q)};var ue=me.prototype;return ue.lex=function(Q){return Q=Q.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(Q,this.tokens,!0),this.inline(this.tokens),this.tokens},ue.blockTokens=function(Q,J,te){J===void 0&&(J=[]),te===void 0&&(te=!0),Q=Q.replace(/^ +$/gm,"");for(var se,fe,Ae,Me;Q;){if(se=this.tokenizer.space(Q)){Q=Q.substring(se.raw.length),se.type&&J.push(se);continue}if(se=this.tokenizer.code(Q,J)){Q=Q.substring(se.raw.length),se.type?J.push(se):(Me=J[J.length-1],Me.raw+=`
|
|
`+se.raw,Me.text+=`
|
|
`+se.text);continue}if(se=this.tokenizer.fences(Q)){Q=Q.substring(se.raw.length),J.push(se);continue}if(se=this.tokenizer.heading(Q)){Q=Q.substring(se.raw.length),J.push(se);continue}if(se=this.tokenizer.nptable(Q)){Q=Q.substring(se.raw.length),J.push(se);continue}if(se=this.tokenizer.hr(Q)){Q=Q.substring(se.raw.length),J.push(se);continue}if(se=this.tokenizer.blockquote(Q)){Q=Q.substring(se.raw.length),se.tokens=this.blockTokens(se.text,[],te),J.push(se);continue}if(se=this.tokenizer.list(Q)){for(Q=Q.substring(se.raw.length),Ae=se.items.length,fe=0;fe<Ae;fe++)se.items[fe].tokens=this.blockTokens(se.items[fe].text,[],!1);J.push(se);continue}if(se=this.tokenizer.html(Q)){Q=Q.substring(se.raw.length),J.push(se);continue}if(te&&(se=this.tokenizer.def(Q))){Q=Q.substring(se.raw.length),this.tokens.links[se.tag]||(this.tokens.links[se.tag]={href:se.href,title:se.title});continue}if(se=this.tokenizer.table(Q)){Q=Q.substring(se.raw.length),J.push(se);continue}if(se=this.tokenizer.lheading(Q)){Q=Q.substring(se.raw.length),J.push(se);continue}if(te&&(se=this.tokenizer.paragraph(Q))){Q=Q.substring(se.raw.length),J.push(se);continue}if(se=this.tokenizer.text(Q,J)){Q=Q.substring(se.raw.length),se.type?J.push(se):(Me=J[J.length-1],Me.raw+=`
|
|
`+se.raw,Me.text+=`
|
|
`+se.text);continue}if(Q){var Xe="Infinite loop on byte: "+Q.charCodeAt(0);if(this.options.silent){console.error(Xe);break}else throw new Error(Xe)}}return J},ue.inline=function(Q){var J,te,se,fe,Ae,Me,Xe=Q.length;for(J=0;J<Xe;J++){Me=Q[J];switch(Me.type){case"paragraph":case"text":case"heading":{Me.tokens=[],this.inlineTokens(Me.text,Me.tokens);break}case"table":{for(Me.tokens={header:[],cells:[]},fe=Me.header.length,te=0;te<fe;te++)Me.tokens.header[te]=[],this.inlineTokens(Me.header[te],Me.tokens.header[te]);for(fe=Me.cells.length,te=0;te<fe;te++)for(Ae=Me.cells[te],Me.tokens.cells[te]=[],se=0;se<Ae.length;se++)Me.tokens.cells[te][se]=[],this.inlineTokens(Ae[se],Me.tokens.cells[te][se]);break}case"blockquote":{this.inline(Me.tokens);break}case"list":{for(fe=Me.items.length,te=0;te<fe;te++)this.inline(Me.items[te].tokens);break}}}return Q},ue.inlineTokens=function(Q,J,te,se,fe){J===void 0&&(J=[]),te===void 0&&(te=!1),se===void 0&&(se=!1),fe===void 0&&(fe="");var Ae,Me=Q,Xe;if(this.tokens.links){var it=Object.keys(this.tokens.links);if(it.length>0)for(;(Xe=this.tokenizer.rules.inline.reflinkSearch.exec(Me))!=null;)it.includes(Xe[0].slice(Xe[0].lastIndexOf("[")+1,-1))&&(Me=Me.slice(0,Xe.index)+"["+"a".repeat(Xe[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Xe=this.tokenizer.rules.inline.blockSkip.exec(Me))!=null;)Me=Me.slice(0,Xe.index)+"["+"a".repeat(Xe[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Q;){if(Ae=this.tokenizer.escape(Q)){Q=Q.substring(Ae.raw.length),J.push(Ae);continue}if(Ae=this.tokenizer.tag(Q,te,se)){Q=Q.substring(Ae.raw.length),te=Ae.inLink,se=Ae.inRawBlock,J.push(Ae);continue}if(Ae=this.tokenizer.link(Q)){Q=Q.substring(Ae.raw.length),Ae.type==="link"&&(Ae.tokens=this.inlineTokens(Ae.text,[],!0,se)),J.push(Ae);continue}if(Ae=this.tokenizer.reflink(Q,this.tokens.links)){Q=Q.substring(Ae.raw.length),Ae.type==="link"&&(Ae.tokens=this.inlineTokens(Ae.text,[],!0,se)),J.push(Ae);continue}if(Ae=this.tokenizer.strong(Q,Me,fe)){Q=Q.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],te,se),J.push(Ae);continue}if(Ae=this.tokenizer.em(Q,Me,fe)){Q=Q.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],te,se),J.push(Ae);continue}if(Ae=this.tokenizer.codespan(Q)){Q=Q.substring(Ae.raw.length),J.push(Ae);continue}if(Ae=this.tokenizer.br(Q)){Q=Q.substring(Ae.raw.length),J.push(Ae);continue}if(Ae=this.tokenizer.del(Q)){Q=Q.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],te,se),J.push(Ae);continue}if(Ae=this.tokenizer.autolink(Q,ye)){Q=Q.substring(Ae.raw.length),J.push(Ae);continue}if(!te&&(Ae=this.tokenizer.url(Q,ye))){Q=Q.substring(Ae.raw.length),J.push(Ae);continue}if(Ae=this.tokenizer.inlineText(Q,se,we)){Q=Q.substring(Ae.raw.length),fe=Ae.raw.slice(-1),J.push(Ae);continue}if(Q){var tt="Infinite loop on byte: "+Q.charCodeAt(0);if(this.options.silent){console.error(tt);break}else throw new Error(tt)}}return J},z(me,null,[{key:"rules",get:function(){return{block:Z,inline:xe}}}]),me}(),Oe=B.defaults,Pe=W.cleanUrl,_e=W.escape,De=function(){function me(de){this.options=de||Oe}var ue=me.prototype;return ue.code=function(Q,J,te){var se=(J||"").match(/\S*/)[0];if(this.options.highlight){var fe=this.options.highlight(Q,se);fe!=null&&fe!==Q&&(te=!0,Q=fe)}return se?'<pre><code class="'+this.options.langPrefix+_e(se,!0)+'">'+(te?Q:_e(Q,!0))+`</code></pre>
|
|
`:"<pre><code>"+(te?Q:_e(Q,!0))+`</code></pre>
|
|
`},ue.blockquote=function(Q){return`<blockquote>
|
|
`+Q+`</blockquote>
|
|
`},ue.html=function(Q){return Q},ue.heading=function(Q,J,te,se){return this.options.headerIds?"<h"+J+' id="'+this.options.headerPrefix+se.slug(te)+'">'+Q+"</h"+J+`>
|
|
`:"<h"+J+">"+Q+"</h"+J+`>
|
|
`},ue.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ue.list=function(Q,J,te){var se=J?"ol":"ul",fe=J&&te!==1?' start="'+te+'"':"";return"<"+se+fe+`>
|
|
`+Q+"</"+se+`>
|
|
`},ue.listitem=function(Q){return"<li>"+Q+`</li>
|
|
`},ue.checkbox=function(Q){return"<input "+(Q?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ue.paragraph=function(Q){return"<p>"+Q+`</p>
|
|
`},ue.table=function(Q,J){return J&&(J="<tbody>"+J+"</tbody>"),`<table>
|
|
<thead>
|
|
`+Q+`</thead>
|
|
`+J+`</table>
|
|
`},ue.tablerow=function(Q){return`<tr>
|
|
`+Q+`</tr>
|
|
`},ue.tablecell=function(Q,J){var te=J.header?"th":"td",se=J.align?"<"+te+' align="'+J.align+'">':"<"+te+">";return se+Q+"</"+te+`>
|
|
`},ue.strong=function(Q){return"<strong>"+Q+"</strong>"},ue.em=function(Q){return"<em>"+Q+"</em>"},ue.codespan=function(Q){return"<code>"+Q+"</code>"},ue.br=function(){return this.options.xhtml?"<br/>":"<br>"},ue.del=function(Q){return"<del>"+Q+"</del>"},ue.link=function(Q,J,te){if(Q=Pe(this.options.sanitize,this.options.baseUrl,Q),Q===null)return te;var se='<a href="'+_e(Q)+'"';return J&&(se+=' title="'+J+'"'),se+=">"+te+"</a>",se},ue.image=function(Q,J,te){if(Q=Pe(this.options.sanitize,this.options.baseUrl,Q),Q===null)return te;var se='<img src="'+Q+'" alt="'+te+'"';return J&&(se+=' title="'+J+'"'),se+=this.options.xhtml?"/>":">",se},ue.text=function(Q){return Q},me}(),Le=function(){function me(){}var ue=me.prototype;return ue.strong=function(Q){return Q},ue.em=function(Q){return Q},ue.codespan=function(Q){return Q},ue.del=function(Q){return Q},ue.html=function(Q){return Q},ue.text=function(Q){return Q},ue.link=function(Q,J,te){return""+te},ue.image=function(Q,J,te){return""+te},ue.br=function(){return""},me}(),Ue=function(){function me(){this.seen={}}var ue=me.prototype;return ue.slug=function(Q){var J=Q.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(J)){var te=J;do this.seen[te]++,J=te+"-"+this.seen[te];while(this.seen.hasOwnProperty(J))}return this.seen[J]=0,J},me}(),Ve=B.defaults,We=W.unescape,Ge=function(){function me(de){this.options=de||Ve,this.options.renderer=this.options.renderer||new De,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Le,this.slugger=new Ue}me.parse=function(Q,J){var te=new me(J);return te.parse(Q)};var ue=me.prototype;return ue.parse=function(Q,J){J===void 0&&(J=!0);var te="",se,fe,Ae,Me,Xe,it,tt,xt,ht,ot,Ct,yt,Bt,Ft,bt,Cr,kr,lr,mr=Q.length;for(se=0;se<mr;se++){ot=Q[se];switch(ot.type){case"space":continue;case"hr":{te+=this.renderer.hr();continue}case"heading":{te+=this.renderer.heading(this.parseInline(ot.tokens),ot.depth,We(this.parseInline(ot.tokens,this.textRenderer)),this.slugger);continue}case"code":{te+=this.renderer.code(ot.text,ot.lang,ot.escaped);continue}case"table":{for(xt="",tt="",Me=ot.header.length,fe=0;fe<Me;fe++)tt+=this.renderer.tablecell(this.parseInline(ot.tokens.header[fe]),{header:!0,align:ot.align[fe]});for(xt+=this.renderer.tablerow(tt),ht="",Me=ot.cells.length,fe=0;fe<Me;fe++){for(it=ot.tokens.cells[fe],tt="",Xe=it.length,Ae=0;Ae<Xe;Ae++)tt+=this.renderer.tablecell(this.parseInline(it[Ae]),{header:!1,align:ot.align[Ae]});ht+=this.renderer.tablerow(tt)}te+=this.renderer.table(xt,ht);continue}case"blockquote":{ht=this.parse(ot.tokens),te+=this.renderer.blockquote(ht);continue}case"list":{for(Ct=ot.ordered,yt=ot.start,Bt=ot.loose,Me=ot.items.length,ht="",fe=0;fe<Me;fe++)bt=ot.items[fe],Cr=bt.checked,kr=bt.task,Ft="",bt.task&&(lr=this.renderer.checkbox(Cr),Bt?bt.tokens.length>0&&bt.tokens[0].type==="text"?(bt.tokens[0].text=lr+" "+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=lr+" "+bt.tokens[0].tokens[0].text)):bt.tokens.unshift({type:"text",text:lr}):Ft+=lr),Ft+=this.parse(bt.tokens,Bt),ht+=this.renderer.listitem(Ft,kr,Cr);te+=this.renderer.list(ht,Ct,yt);continue}case"html":{te+=this.renderer.html(ot.text);continue}case"paragraph":{te+=this.renderer.paragraph(this.parseInline(ot.tokens));continue}case"text":{for(ht=ot.tokens?this.parseInline(ot.tokens):ot.text;se+1<mr&&Q[se+1].type==="text";)ot=Q[++se],ht+=`
|
|
`+(ot.tokens?this.parseInline(ot.tokens):ot.text);te+=J?this.renderer.paragraph(ht):ht;continue}default:{var fr='Token with "'+ot.type+'" type was not found.';if(this.options.silent){console.error(fr);return}else throw new Error(fr)}}}return te},ue.parseInline=function(Q,J){J=J||this.renderer;var te="",se,fe,Ae=Q.length;for(se=0;se<Ae;se++){fe=Q[se];switch(fe.type){case"escape":{te+=J.text(fe.text);break}case"html":{te+=J.html(fe.text);break}case"link":{te+=J.link(fe.href,fe.title,this.parseInline(fe.tokens,J));break}case"image":{te+=J.image(fe.href,fe.title,fe.text);break}case"strong":{te+=J.strong(this.parseInline(fe.tokens,J));break}case"em":{te+=J.em(this.parseInline(fe.tokens,J));break}case"codespan":{te+=J.codespan(fe.text);break}case"br":{te+=J.br();break}case"del":{te+=J.del(this.parseInline(fe.tokens,J));break}case"text":{te+=J.text(fe.text);break}default:{var Me='Token with "'+fe.type+'" type was not found.';if(this.options.silent){console.error(Me);return}else throw new Error(Me)}}}return te},me}(),et=W.merge,Je=W.checkSanitizeDeprecation,ze=W.escape,Ce=B.getDefaults,qe=B.changeDefaults,$e=B.defaults;function Re(me,ue,de){if(typeof me=="undefined"||me===null)throw new Error("marked(): input parameter is undefined or null");if(typeof me!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(me)+", string expected");if(typeof ue=="function"&&(de=ue,ue=null),ue=et({},Re.defaults,ue||{}),Je(ue),de){var Q=ue.highlight,J;try{J=Se.lex(me,ue)}catch(Ae){return de(Ae)}var te=function(Me){var Xe;if(!Me)try{Xe=Ge.parse(J,ue)}catch(it){Me=it}return ue.highlight=Q,Me?de(Me):de(null,Xe)};if(!Q||Q.length<3)return te();if(delete ue.highlight,!J.length)return te();var se=0;Re.walkTokens(J,function(Ae){Ae.type==="code"&&(se++,setTimeout(function(){Q(Ae.text,Ae.lang,function(Me,Xe){if(Me)return te(Me);Xe!=null&&Xe!==Ae.text&&(Ae.text=Xe,Ae.escaped=!0),se--,se===0&&te()})},0))}),se===0&&te();return}try{var fe=Se.lex(me,ue);return ue.walkTokens&&Re.walkTokens(fe,ue.walkTokens),Ge.parse(fe,ue)}catch(Ae){if(Ae.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ue.silent)return"<p>An error occurred:</p><pre>"+ze(Ae.message+"",!0)+"</pre>";throw Ae}}Re.options=Re.setOptions=function(me){return et(Re.defaults,me),qe(Re.defaults),Re},Re.getDefaults=Ce,Re.defaults=$e,Re.use=function(me){var ue=et({},me);if(me.renderer&&function(){var Q=Re.defaults.renderer||new De,J=function(fe){var Ae=Q[fe];Q[fe]=function(){for(var Me=arguments.length,Xe=new Array(Me),it=0;it<Me;it++)Xe[it]=arguments[it];var tt=me.renderer[fe].apply(Q,Xe);return tt===!1&&(tt=Ae.apply(Q,Xe)),tt}};for(var te in me.renderer)J(te);ue.renderer=Q}(),me.tokenizer&&function(){var Q=Re.defaults.tokenizer||new ve,J=function(fe){var Ae=Q[fe];Q[fe]=function(){for(var Me=arguments.length,Xe=new Array(Me),it=0;it<Me;it++)Xe[it]=arguments[it];var tt=me.tokenizer[fe].apply(Q,Xe);return tt===!1&&(tt=Ae.apply(Q,Xe)),tt}};for(var te in me.tokenizer)J(te);ue.tokenizer=Q}(),me.walkTokens){var de=Re.defaults.walkTokens;ue.walkTokens=function(Q){me.walkTokens(Q),de&&de(Q)}}Re.setOptions(ue)},Re.walkTokens=function(me,ue){for(var de=I(me),Q;!(Q=de()).done;){var J=Q.value;ue(J);switch(J.type){case"table":{for(var te=I(J.tokens.header),se;!(se=te()).done;){var fe=se.value;Re.walkTokens(fe,ue)}for(var Ae=I(J.tokens.cells),Me;!(Me=Ae()).done;)for(var Xe=Me.value,it=I(Xe),tt;!(tt=it()).done;){var xt=tt.value;Re.walkTokens(xt,ue)}break}case"list":{Re.walkTokens(J.items,ue);break}default:J.tokens&&Re.walkTokens(J.tokens,ue)}}},Re.Parser=Ge,Re.parser=Ge.parse,Re.Renderer=De,Re.TextRenderer=Le,Re.Lexer=Se,Re.lexer=Se.lex,Re.Tokenizer=ve,Re.Slugger=Ue,Re.parse=Re;var Fe=Re;return Fe})},ELLl:function(ut,Ye,ie){(function(ee){ee(ie("VrN/"))})(function(ee){var z={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},L=ee.Pos;ee.defineOption("autoCloseBrackets",!1,function(T,E,u){u&&u!=ee.Init&&(T.removeKeyMap(I),T.state.closeBrackets=null),E&&(P(G(E,"pairs")),T.state.closeBrackets=E,T.addKeyMap(I))});function G(T,E){return E=="pairs"&&typeof T=="string"?T:typeof T=="object"&&T[E]!=null?T[E]:z[E]}var I={Backspace:k,Enter:D};function P(T){for(var E=0;E<T.length;E++){var u=T.charAt(E),o="'"+u+"'";I[o]||(I[o]=B(u))}}P(z.pairs+"`");function B(T){return function(E){return w(E,T)}}function N(T){var E=T.state.closeBrackets;if(!E||E.override)return E;var u=T.getModeAt(T.getCursor());return u.closeBrackets||E}function k(T){var E=N(T);if(!E||T.getOption("disableInput"))return ee.Pass;for(var u=G(E,"pairs"),o=T.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return ee.Pass;var d=R(T,o[s].head);if(!d||u.indexOf(d)%2!=0)return ee.Pass}for(var s=o.length-1;s>=0;s--){var S=o[s].head;T.replaceRange("",L(S.line,S.ch-1),L(S.line,S.ch+1),"+delete")}}function D(T){var E=N(T),u=E&&G(E,"explode");if(!u||T.getOption("disableInput"))return ee.Pass;for(var o=T.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return ee.Pass;var d=R(T,o[s].head);if(!d||u.indexOf(d)%2!=0)return ee.Pass}T.operation(function(){var S=T.lineSeparator()||`
|
|
`;T.replaceSelection(S+S,null),T.execCommand("goCharLeft"),o=T.listSelections();for(var p=0;p<o.length;p++){var h=o[p].head.line;T.indentLine(h,null,!0),T.indentLine(h+1,null,!0)}})}function v(T){var E=ee.cmpPos(T.anchor,T.head)>0;return{anchor:new L(T.anchor.line,T.anchor.ch+(E?-1:1)),head:new L(T.head.line,T.head.ch+(E?1:-1))}}function w(T,E){var u=N(T);if(!u||T.getOption("disableInput"))return ee.Pass;var o=G(u,"pairs"),s=o.indexOf(E);if(s==-1)return ee.Pass;for(var d=G(u,"closeBefore"),S=G(u,"triples"),p=o.charAt(s+1)==E,h=T.listSelections(),A=s%2==0,b,f=0;f<h.length;f++){var c=h[f],l=c.head,a,g=T.getRange(l,L(l.line,l.ch+1));if(A&&!c.empty())a="surround";else if((p||!A)&&g==E)p&&C(T,l)?a="both":S.indexOf(E)>=0&&T.getRange(l,L(l.line,l.ch+3))==E+E+E?a="skipThree":a="skip";else if(p&&l.ch>1&&S.indexOf(E)>=0&&T.getRange(L(l.line,l.ch-2),l)==E+E){if(l.ch>2&&/\bstring/.test(T.getTokenTypeAt(L(l.line,l.ch-2))))return ee.Pass;a="addFour"}else if(p){var m=l.ch==0?" ":T.getRange(L(l.line,l.ch-1),l);if(!ee.isWordChar(g)&&m!=E&&!ee.isWordChar(m))a="both";else return ee.Pass}else if(A&&(g.length===0||/\s/.test(g)||d.indexOf(g)>-1))a="both";else return ee.Pass;if(!b)b=a;else if(b!=a)return ee.Pass}var y=s%2?o.charAt(s-1):E,M=s%2?E:o.charAt(s+1);T.operation(function(){if(b=="skip")T.execCommand("goCharRight");else if(b=="skipThree")for(var F=0;F<3;F++)T.execCommand("goCharRight");else if(b=="surround"){for(var j=T.getSelections(),F=0;F<j.length;F++)j[F]=y+j[F]+M;T.replaceSelections(j,"around"),j=T.listSelections().slice();for(var F=0;F<j.length;F++)j[F]=v(j[F]);T.setSelections(j)}else b=="both"?(T.replaceSelection(y+M,null),T.triggerElectric(y+M),T.execCommand("goCharLeft")):b=="addFour"&&(T.replaceSelection(y+y+y+y,"before"),T.execCommand("goCharRight"))})}function R(T,E){var u=T.getRange(L(E.line,E.ch-1),L(E.line,E.ch+1));return u.length==2?u:null}function C(T,E){var u=T.getTokenAt(L(E.line,E.ch+1));return/\bstring/.test(u.type)&&u.start==E.ch&&(E.ch==0||!/\bstring/.test(T.getTokenTypeAt(E)))}})},GfqC:function(ut,Ye,ie){"use strict";var ee=ie("cDcd"),z=ie.n(ee),L=ie("TSYQ"),G=ie.n(L);function I(W,O){var _="cannot "+W.method+" "+W.action+" "+O.status+"'",K=new Error(_);return K.status=O.status,K.method=W.method,K.url=W.action,K}function P(W){var O=W.responseText||W.response;if(!O)return O;try{return JSON.parse(O)}catch(_){return O}}function B(W){var O=new XMLHttpRequest;W.onProgress&&O.upload&&(O.upload.onprogress=function(q){q.total>0&&(q.percent=q.loaded/q.total*100),W.onProgress(q)});var _=new FormData;W.data&&Object.keys(W.data).forEach(function($){var q=W.data[$];if(Array.isArray(q)){q.forEach(function(ne){_.append($+"[]",ne)});return}_.append($,W.data[$])}),W.file instanceof Blob?_.append(W.filename,W.file,W.file.name):_.append(W.filename,W.file),O.onerror=function(q){W.onError(q)},O.onload=function(){return O.status<200||O.status>=300?W.onError(I(W,O),P(O)):W.onSuccess(P(O),O)},O.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in O&&(O.withCredentials=!0);var K=W.headers||{};return K["X-Requested-With"]!==null&&O.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(K).forEach(function($){K[$]!==null&&O.setRequestHeader($,K[$])}),O.send(_),{abort:function(){O.abort()}}}var N=+new Date,k=0;function D(){return"rc-upload-"+N+"-"+ ++k}function v(W,O){return W.indexOf(O,W.length-O.length)!==-1}var w=function(W,O){if(W&&O){var _=Array.isArray(O)?O:O.split(","),K=W.name||"",$=W.type||"",q=$.replace(/\/.*$/,"");return _.some(function(ne){var Te=ne.trim();return Te.charAt(0)==="."?v(K.toLowerCase(),Te.toLowerCase()):/\/\*$/.test(Te)?q===Te.replace(/\/.*$/,""):$===Te})}return!0};function R(W,O){var _=W.createReader(),K=[];function $(){_.readEntries(function(q){var ne=Array.prototype.slice.apply(q);K=K.concat(ne);var Te=!ne.length;Te?O(K):$()})}$()}var C=function(O,_,K){var $=function q(ne,Te){Te=Te||"",ne.isFile?ne.file(function(ve){K(ve)&&(ne.fullPath&&!ve.webkitRelativePath&&(Object.defineProperties(ve,{webkitRelativePath:{writable:!0}}),ve.webkitRelativePath=ne.fullPath.replace(/^\//,""),Object.defineProperties(ve,{webkitRelativePath:{writable:!1}})),_([ve]))}):ne.isDirectory&&R(ne,function(ve){ve.forEach(function(ge){q(ge,""+Te+ne.name+"/")})})};O.forEach(function(q){$(q.webkitGetAsEntry())})},T=C,E=Object.assign||function(W){for(var O=1;O<arguments.length;O++){var _=arguments[O];for(var K in _)Object.prototype.hasOwnProperty.call(_,K)&&(W[K]=_[K])}return W},u=function(){function W(O,_){var K=[],$=!0,q=!1,ne=void 0;try{for(var Te=O[Symbol.iterator](),ve;!($=(ve=Te.next()).done)&&!(K.push(ve.value),_&&K.length===_);$=!0);}catch(ge){q=!0,ne=ge}finally{try{!$&&Te.return&&Te.return()}finally{if(q)throw ne}}return K}return function(O,_){if(Array.isArray(O))return O;if(Symbol.iterator in Object(O))return W(O,_);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function W(O,_){for(var K=0;K<_.length;K++){var $=_[K];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(O,$.key,$)}}return function(O,_,K){return _&&W(O.prototype,_),K&&W(O,K),O}}();function s(W,O,_){return O in W?Object.defineProperty(W,O,{value:_,enumerable:!0,configurable:!0,writable:!0}):W[O]=_,W}function d(W,O){var _={};for(var K in W){if(O.indexOf(K)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,K))continue;_[K]=W[K]}return _}function S(W,O){if(!(W instanceof O))throw new TypeError("Cannot call a class as a function")}function p(W,O){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return O&&(typeof O=="object"||typeof O=="function")?O:W}function h(W,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof O);W.prototype=Object.create(O&&O.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),O&&(Object.setPrototypeOf?Object.setPrototypeOf(W,O):W.__proto__=O)}var A=function(O){return Object.keys(O).reduce(function(_,K){return(K.substr(0,5)==="data-"||K.substr(0,5)==="aria-"||K==="role")&&(_[K]=O[K]),_},{})},b=function(W){h(O,W);function O(){var _,K,$,q;S(this,O);for(var ne=arguments.length,Te=Array(ne),ve=0;ve<ne;ve++)Te[ve]=arguments[ve];return q=(K=($=p(this,(_=O.__proto__||Object.getPrototypeOf(O)).call.apply(_,[this].concat(Te))),$),$.state={uid:D()},$.reqs={},$.onChange=function(ge){var ce=ge.target.files;$.uploadFiles(ce),$.reset()},$.onClick=function(ge){var ce=$.fileInput;if(!ce)return;var he=$.props,oe=he.children,pe=he.onClick;oe&&oe.type==="button"&&(ce.parentNode.focus(),ce.parentNode.querySelector("button").blur()),ce.click(),pe&&pe(ge)},$.onKeyDown=function(ge){ge.key==="Enter"&&$.onClick()},$.onFileDrop=function(ge){var ce=$.props.multiple;if(ge.preventDefault(),ge.type==="dragover")return;if($.props.directory)T(Array.prototype.slice.call(ge.dataTransfer.items),$.uploadFiles,function(oe){return w(oe,$.props.accept)});else{var he=Array.prototype.slice.call(ge.dataTransfer.files).filter(function(oe){return w(oe,$.props.accept)});ce===!1&&(he=he.slice(0,1)),$.uploadFiles(he)}},$.uploadFiles=function(ge){var ce=Array.prototype.slice.call(ge);ce.map(function(he){return he.uid=D(),he}).forEach(function(he){$.upload(he,ce)})},$.saveFileInput=function(ge){$.fileInput=ge},K),p($,q)}return o(O,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(K,$){var q=this,ne=this.props;if(!ne.beforeUpload)return setTimeout(function(){return q.post(K)},0);var Te=ne.beforeUpload(K,$);Te&&Te.then?Te.then(function(ve){var ge=Object.prototype.toString.call(ve);return ge==="[object File]"||ge==="[object Blob]"?q.post(ve):q.post(K)}).catch(function(ve){console.log(ve)}):Te!==!1&&setTimeout(function(){return q.post(K)},0);return}},{key:"post",value:function(K){var $=this;if(!this._isMounted)return;var q=this.props,ne=q.onStart,Te=q.onProgress,ve=q.transformFile,ge=ve===void 0?function(ce){return ce}:ve;new Promise(function(ce){var he=q.action;return typeof he=="function"&&(he=he(K)),ce(he)}).then(function(ce){var he=K.uid,oe=q.customRequest||B,pe=Promise.resolve(ge(K)).then(function(Y){var ae=q.data;return typeof ae=="function"&&(ae=ae(Y)),Promise.all([Y,ae])}).catch(function(Y){console.error(Y)});pe.then(function(Y){var ae=u(Y,2),Z=ae[0],xe=ae[1],we={action:ce,filename:q.name,data:xe,file:Z,headers:q.headers,withCredentials:q.withCredentials,method:q.method||"post",onProgress:Te?function(ye){Te(ye,K)}:null,onSuccess:function(Se,Oe){delete $.reqs[he],q.onSuccess(Se,K,Oe)},onError:function(Se,Oe){delete $.reqs[he],q.onError(Se,Oe,K)}};ne(K),$.reqs[he]=oe(we)})})}},{key:"reset",value:function(){this.setState({uid:D()})}},{key:"abort",value:function(K){var $=this.reqs;if(K){var q=K;K&&K.uid&&(q=K.uid),$[q]&&$[q].abort&&$[q].abort(),delete $[q]}else Object.keys($).forEach(function(ne){$[ne]&&$[ne].abort&&$[ne].abort(),delete $[ne]})}},{key:"render",value:function(){var K,$=this.props,q=$.component,ne=$.prefixCls,Te=$.className,ve=$.disabled,ge=$.id,ce=$.style,he=$.multiple,oe=$.accept,pe=$.children,Y=$.directory,ae=$.openFileDialogOnClick,Z=$.onMouseEnter,xe=$.onMouseLeave,we=d($,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ye=G()((K={},s(K,ne,!0),s(K,ne+"-disabled",ve),s(K,Te,Te),K)),Se=ve?{}:{onClick:ae?this.onClick:function(){},onKeyDown:ae?this.onKeyDown:function(){},onMouseEnter:Z,onMouseLeave:xe,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return z.a.createElement(q,E({},Se,{className:ye,role:"button",style:ce}),z.a.createElement("input",E({},A(we),{id:ge,type:"file",ref:this.saveFileInput,onClick:function(Pe){return Pe.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:oe,directory:Y?"directory":null,webkitdirectory:Y?"webkitdirectory":null,multiple:he,onChange:this.onChange})),pe)}}]),O}(ee.Component),f=b,c=Object.assign||function(W){for(var O=1;O<arguments.length;O++){var _=arguments[O];for(var K in _)Object.prototype.hasOwnProperty.call(_,K)&&(W[K]=_[K])}return W},l=function(){function W(O,_){for(var K=0;K<_.length;K++){var $=_[K];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(O,$.key,$)}}return function(O,_,K){return _&&W(O.prototype,_),K&&W(O,K),O}}();function a(W,O){if(!(W instanceof O))throw new TypeError("Cannot call a class as a function")}function g(W,O){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return O&&(typeof O=="object"||typeof O=="function")?O:W}function m(W,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof O);W.prototype=Object.create(O&&O.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),O&&(Object.setPrototypeOf?Object.setPrototypeOf(W,O):W.__proto__=O)}function y(){}var M=function(W){m(O,W);function O(){var _,K,$,q;a(this,O);for(var ne=arguments.length,Te=Array(ne),ve=0;ve<ne;ve++)Te[ve]=arguments[ve];return q=(K=($=g(this,(_=O.__proto__||Object.getPrototypeOf(O)).call.apply(_,[this].concat(Te))),$),$.saveUploader=function(ge){$.uploader=ge},K),g($,q)}return l(O,[{key:"abort",value:function(K){this.uploader.abort(K)}},{key:"render",value:function(){return z.a.createElement(f,c({},this.props,{ref:this.saveUploader}))}}]),O}(ee.Component);M.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:y,onError:y,onSuccess:y,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var F=M,j=Ye.a=F},Gytx:function(ut,Ye){ut.exports=function(ee,z,L,G){var I=L?L.call(G,ee,z):void 0;if(I!==void 0)return!!I;if(ee===z)return!0;if(typeof ee!="object"||!ee||typeof z!="object"||!z)return!1;var P=Object.keys(ee),B=Object.keys(z);if(P.length!==B.length)return!1;for(var N=Object.prototype.hasOwnProperty.bind(z),k=0;k<P.length;k++){var D=P[k];if(!N(D))return!1;var v=ee[D],w=z[D];if(I=L?L.call(G,v,w,D):void 0,I===!1||I===void 0&&v!==w)return!1}return!0}},HmJG:function(ut,Ye,ie){},LdHM:function(ut,Ye,ie){"use strict";ie.d(Ye,"b",function(){return d}),ie.d(Ye,"a",function(){return p});var ee=ie("1OyB"),z=ie("vuIU"),L=ie("Ji7U"),G=ie("LK+K"),I=ie("cDcd"),P=ie("rePB"),B=ie("Ff2n"),N=ie("ODXe"),k=ie("4IlW"),D=ie("bX4T"),v=ie("YrtM"),w=ie("TSYQ"),R=ie.n(w),C=ie("+nKL"),T=ie("8OUc"),E=function(K,$){var q=K.prefixCls,ne=K.id,Te=K.flattenOptions,ve=K.childrenAsData,ge=K.values,ce=K.searchValue,he=K.multiple,oe=K.defaultActiveFirstOption,pe=K.height,Y=K.itemHeight,ae=K.notFoundContent,Z=K.open,xe=K.menuItemSelectedIcon,we=K.virtual,ye=K.onSelect,Se=K.onToggleOpen,Oe=K.onActiveValue,Pe=K.onScroll,_e=K.onMouseEnter,De="".concat(q,"-item"),Le=Object(v.a)(function(){return Te},[Z,Te],function(Fe,me){return me[0]&&Fe[1]!==me[1]}),Ue=I.useRef(null),Ve=function(me){me.preventDefault()},We=function(me){Ue.current&&Ue.current.scrollTo({index:me})},Ge=function(me){for(var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,de=Le.length,Q=0;Q<de;Q+=1){var J=(me+Q*ue+de)%de,te=Le[J],se=te.group,fe=te.data;if(!se&&!fe.disabled)return J}return-1},et=I.useState(function(){return Ge(0)}),Je=Object(N.a)(et,2),ze=Je[0],Ce=Je[1],qe=function(me){Ce(me);var ue=Le[me];if(!ue){Oe(null,-1);return}Oe(ue.data.value,me)};I.useEffect(function(){qe(oe!==!1?Ge(0):-1)},[Le.length,ce]),I.useEffect(function(){var Fe=setTimeout(function(){if(!he&&Z&&ge.size===1){var me=Array.from(ge)[0],ue=Le.findIndex(function(de){var Q=de.data;return Q.value===me});qe(ue),We(ue)}});return function(){return clearTimeout(Fe)}},[Z]);var $e=function(me){me!==void 0&&ye(me,{selected:!ge.has(me)}),he||Se(!1)};if(I.useImperativeHandle($,function(){return{onKeyDown:function(me){var ue=me.which;switch(ue){case k.a.UP:case k.a.DOWN:{var de=0;if(ue===k.a.UP?de=-1:ue===k.a.DOWN&&(de=1),de!==0){var Q=Ge(ze+de,de);We(Q),qe(Q)}break}case k.a.ENTER:{var J=Le[ze];J&&!J.data.disabled?$e(J.data.value):$e(void 0),Z&&me.preventDefault();break}case k.a.ESC:Se(!1)}},onKeyUp:function(){},scrollTo:function(me){We(me)}}}),Le.length===0)return I.createElement("div",{role:"listbox",id:"".concat(ne,"_list"),className:"".concat(De,"-empty"),onMouseDown:Ve},ae);function Re(Fe){var me=Le[Fe];if(!me)return null;var ue=me.data||{},de=ue.value,Q=ue.label,J=ue.children,te=Object(D.a)(ue,!0),se=ve?J:Q;return me?I.createElement("div",Object.assign({"aria-label":typeof se=="string"?se:null},te,{key:Fe,role:"option",id:"".concat(ne,"_list_").concat(Fe),"aria-selected":ge.has(de)}),de):null}return I.createElement(I.Fragment,null,I.createElement("div",{role:"listbox",id:"".concat(ne,"_list"),style:{height:0,width:0,overflow:"hidden"}},Re(ze-1),Re(ze),Re(ze+1)),I.createElement(C.a,{itemKey:"key",ref:Ue,data:Le,height:pe,itemHeight:Y,fullHeight:!1,onMouseDown:Ve,onScroll:Pe,virtual:we,onMouseEnter:_e},function(Fe,me){var ue,de=Fe.group,Q=Fe.groupOption,J=Fe.data,te=J.label,se=J.key;if(de)return I.createElement("div",{className:R()(De,"".concat(De,"-group"))},te!==void 0?te:se);var fe=J.disabled,Ae=J.value,Me=J.title,Xe=J.children,it=J.style,tt=J.className,xt=Object(B.a)(J,["disabled","value","title","children","style","className"]),ht=ge.has(Ae),ot="".concat(De,"-option"),Ct=R()(De,ot,tt,(ue={},Object(P.a)(ue,"".concat(ot,"-grouped"),Q),Object(P.a)(ue,"".concat(ot,"-active"),ze===me&&!fe),Object(P.a)(ue,"".concat(ot,"-disabled"),fe),Object(P.a)(ue,"".concat(ot,"-selected"),ht),ue)),yt=ve?Xe:te,Bt=!xe||typeof xe=="function"||ht;return I.createElement("div",Object.assign({},xt,{"aria-selected":ht,className:Ct,title:Me,onMouseMove:function(){if(ze===me||fe)return;qe(me)},onClick:function(){fe||$e(Ae)},style:it}),I.createElement("div",{className:"".concat(ot,"-content")},yt||Ae),I.isValidElement(xe)||ht,Bt&&I.createElement(T.a,{className:"".concat(De,"-option-state"),customizeIcon:xe,customizeIconProps:{isSelected:ht}},ht?"\u2713":null))}))},u=I.forwardRef(E);u.displayName="OptionList";var o=u,s=function(){return null};s.isSelectOption=!0;var d=s,S=function(){return null};S.isSelectOptGroup=!0;var p=S,h=ie("VTBJ"),A=ie("Zm9Q");function b(_){var K=_.key,$=_.props,q=$.children,ne=$.value,Te=Object(B.a)($,["children","value"]);return Object(h.a)({key:K,value:ne!==void 0?ne:K,children:q},Te)}function f(_){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(A.a)(_).map(function($,q){if(!I.isValidElement($)||!$.type)return null;var ne=$.type.isSelectOptGroup,Te=$.key,ve=$.props,ge=ve.children,ce=Object(B.a)(ve,["children"]);return K||!ne?b($):Object(h.a)(Object(h.a)({key:"__RC_SELECT_GRP__".concat(Te===null?q:Te,"__"),label:Te},ce),{},{options:f(ge)})}).filter(function($){return $})}var c=ie("2Qr1"),l=ie("qNPg"),a=ie("U8pU"),g=ie("Kwbf"),m=ie("WKfj");function y(_){var K=_.mode,$=_.options,q=_.children,ne=_.backfill,Te=_.allowClear,ve=_.placeholder,ge=_.getInputElement,ce=_.showSearch,he=_.onSearch,oe=_.defaultOpen,pe=_.autoFocus,Y=_.labelInValue,ae=_.value,Z=_.inputValue,xe=_.optionLabelProp,we=K==="multiple"||K==="tags",ye=ce!==void 0?ce:we||K==="combobox",Se=$||f(q);if(Object(g.a)(K!=="tags"||Se.every(function(De){return!De.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),K==="tags"||K==="combobox"){var Oe=Se.some(function(De){return De.options?De.options.some(function(Le){return typeof("value"in Le?Le.value:Le.key)=="number"}):typeof("value"in De?De.value:De.key)=="number"});Object(g.a)(!Oe,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(g.a)(K!=="combobox"||!xe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(g.a)(K==="combobox"||!ne,"`backfill` only works with `combobox` mode."),Object(g.a)(K==="combobox"||!ge,"`getInputElement` only work with `combobox` mode."),Object(g.b)(K!=="combobox"||!ge||!Te||!ve,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),he&&!ye&&K!=="combobox"&&K!=="tags"&&Object(g.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(g.b)(!oe||pe,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ae!=null){var Pe=Object(m.d)(ae);Object(g.a)(!Y||Pe.every(function(De){return Object(a.a)(De)==="object"&&("key"in De||"value"in De)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(g.a)(!we||Array.isArray(ae),"`value` should be array when `mode` is `multiple` or `tags`")}if(q){var _e=null;Object(A.a)(q).some(function(De){if(!I.isValidElement(De)||!De.type)return!1;var Le=De.type;if(Le.isSelectOption)return!1;if(Le.isSelectOptGroup){var Ue=Object(A.a)(De.props.children).every(function(Ve){return!I.isValidElement(Ve)||!De.type||Ve.type.isSelectOption?!0:(_e=Ve.type,!1)});return!Ue}return _e=Le,!0}),_e&&Object(g.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(_e.displayName||_e.name||_e,"`.")),Object(g.a)(Z===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=y,F=Object(l.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:f,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:M,fillOptionsWithMissingValue:c.a}),j=function(_){Object(L.a)($,_);var K=Object(G.a)($);function $(){var q;return Object(ee.a)(this,$),q=K.apply(this,arguments),q.selectRef=I.createRef(),q.focus=function(){q.selectRef.current.focus()},q.blur=function(){q.selectRef.current.blur()},q}return Object(z.a)($,[{key:"render",value:function(){return I.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),$}(I.Component);j.Option=d,j.OptGroup=p;var W=j,O=Ye.c=W},M8RZ:function(ut,Ye,ie){"use strict";ie.d(Ye,"a",function(){return k});var ee=ie("fWQN"),z=ie("mtLc"),L=ie("yKVA"),G=ie("879j"),I=ie("cDcd"),P=ie.n(I),B=ie("faye"),N=ie.n(B),k=function(D){Object(L.a)(w,D);var v=Object(G.a)(w);function w(R){var C;Object(ee.a)(this,w),C=v.call(this,R);var T=window.document;return C.node=T.createElement("div"),T.body.appendChild(C.node),C}return Object(z.a)(w,[{key:"render",value:function(){var C=this.props.children;return Object(B.createPortal)(C,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),w}(P.a.Component)},OLES:function(ut,Ye,ie){"use strict";var ee=ie("U8pU"),z=ie("VTBJ"),L=ie("Ff2n"),G=ie("cDcd"),I=ie("uciX"),P=ie("7ixt"),B=function(R){var C=R.overlay,T=R.prefixCls,E=R.id,u=R.overlayInnerStyle;return G.createElement("div",{className:"".concat(T,"-inner"),id:E,role:"tooltip",style:u},typeof C=="function"?C():C)},N=B,k=function(R,C){var T=R.overlayClassName,E=R.trigger,u=E===void 0?["hover"]:E,o=R.mouseEnterDelay,s=o===void 0?0:o,d=R.mouseLeaveDelay,S=d===void 0?.1:d,p=R.overlayStyle,h=R.prefixCls,A=h===void 0?"rc-tooltip":h,b=R.children,f=R.onVisibleChange,c=R.afterVisibleChange,l=R.transitionName,a=R.animation,g=R.placement,m=g===void 0?"right":g,y=R.align,M=y===void 0?{}:y,F=R.destroyTooltipOnHide,j=F===void 0?!1:F,W=R.defaultVisible,O=R.getTooltipContainer,_=R.overlayInnerStyle,K=Object(L.a)(R,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),$=Object(G.useRef)(null);Object(G.useImperativeHandle)(C,function(){return $.current});var q=Object(z.a)({},K);"visible"in R&&(q.popupVisible=R.visible);var ne=function(){var he=R.arrowContent,oe=he===void 0?null:he,pe=R.overlay,Y=R.id;return[G.createElement("div",{className:"".concat(A,"-arrow"),key:"arrow"},oe),G.createElement(N,{key:"content",prefixCls:A,id:Y,overlay:pe,overlayInnerStyle:_})]},Te=!1,ve=!1;if(typeof j=="boolean")Te=j;else if(j&&Object(ee.a)(j)==="object"){var ge=j.keepParent;Te=ge===!0,ve=ge===!1}return G.createElement(I.a,Object.assign({popupClassName:T,prefixCls:A,popup:ne,action:u,builtinPlacements:P.a,popupPlacement:m,ref:$,popupAlign:M,getPopupContainer:O,onPopupVisibleChange:f,afterPopupVisibleChange:c,popupTransitionName:l,popupAnimation:a,defaultPopupVisible:W,destroyPopupOnHide:Te,autoDestroy:ve,mouseLeaveDelay:S,popupStyle:p,mouseEnterDelay:s},q),b)},D=Object(G.forwardRef)(k),v=Ye.a=D},Ot1p:function(ut,Ye,ie){"use strict";var ee=ie("2qtc"),z=ie("kLXV"),L=ie("rAM+"),G=ie("miYZ"),I=ie("tsqr"),P=ie("9og8"),B=ie("tJVT"),N=ie("jrin"),k=ie("WmNS"),D=ie.n(k),v=ie("cDcd"),w=ie.n(v),R=ie("VrN/"),C=ie.n(R),T=ie("bdgK"),E=ie("p77/"),u=ie("Bd2K"),o=ie("ELLl"),s=ie("19Vz"),d=ie("lZu9"),S=ie("+NIl"),p=ie("kSUc"),h=ie("9Bee"),A=function(fe){var Ae=fe.value,Me=Ae===void 0?"":Ae,Xe=fe.className,it=fe.showTextOnly,tt=fe.showLines,xt=fe.style,ht=xt===void 0?{}:xt,ot=Object(v.useMemo)(function(){return""},[Me]);return w.a.createElement(w.a.Fragment,null,w.a.createElement("div",{dangerouslySetInnerHTML:{__html:ot}}))},b=ie("0Owb"),f=ie("dejd"),c=ie("C+DQ"),l=ie("1vsH"),a=ie("m3rI"),g=[{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 m(fe){var Ae=fe.onActionCallback,Me=fe.title,Xe=fe.icon,it=fe.actionName,tt=fe.className,xt=tt===void 0?"":tt,ht=fe.children;function ot(){Ae(it)}return w.a.createElement("a",{title:Me,className:xt,onClick:ot},w.a.createElement("i",{className:"md-iconfont ".concat(Xe)}),ht)}var y=function(fe){var Ae=fe.watch,Me=fe.showNullButton,Xe=fe.onActionCallback,it=fe.fullScreen,tt=fe.insertTemp,xt=fe.hidetoolBar,ht=fe.uuid,ot=fe.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(l.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(l.G)("_educoder_session"),"&key=").concat(ht,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Ct=[].concat(g,[{title:"".concat(Ae?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ae?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return w.a.createElement("ul",{className:"markdown-toolbar-container"},!xt&&Ct.map(function(yt,Bt){return w.a.createElement("li",{key:Bt},yt.actionName?w.a.createElement(m,Object(b.a)({},yt,{onActionCallback:Xe})):w.a.createElement("span",{className:"v-line"}))}),Me?w.a.createElement("li",null,w.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Xe},w.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,tt&&w.a.createElement("li",null,w.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(tt),onActionCallback:Xe},w.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),w.a.createElement("li",{className:"btn-full-screen"},w.a.createElement(m,{icon:"".concat(it?"icon-shrink":"icon-enlarge"),title:it?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Xe})))},M=ie("M8RZ"),F=ie("+L6B"),j=ie("2/Rp"),W=ie("y8nQ"),O=ie("Vl3Y"),_=ie("5NDa"),K=ie("5rEg"),$={labelCol:{span:4},wrapperCol:{span:20}},q=function(fe){var Ae=fe.callback,Me=fe.onCancel;function Xe(it){Ae(it)}return w.a.createElement(O.a,Object(b.a)({},$,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Xe}),w.a.createElement(O.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},w.a.createElement(K.a,null)),w.a.createElement(O.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},w.a.createElement(K.a,null)),w.a.createElement("div",{className:"flex-container flex-end"},w.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),w.a.createElement(j.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))},ne=ie("7ahc"),Te=ie("HmJG"),ve=ie("BjJ7"),ge=O.a.useForm,ce={width:280,marginRight:10},he={labelCol:{span:5},wrapperCol:{span:19}},oe=function(fe){var Ae=fe.callback,Me=fe.onCancel,Xe=ge(),it=Object(B.a)(Xe,1),tt=it[0];function xt(Ct){Ae(Ct)}function ht(Ct,yt){if(Ct.status===-1){I.b.error(Ct.message);return}tt.setFieldsValue({src:"/api/attachments/".concat(Ct.id),type:yt.type})}function ot(Ct){var yt=Ct.target.files[0];Y(yt,ht)}return w.a.createElement(O.a,Object(b.a)({form:tt},he,{className:"upload-image-panel",onFinish:xt}),w.a.createElement(O.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},w.a.createElement("div",{className:"flex-container"},w.a.createElement(O.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},w.a.createElement(K.a,{style:ce})),w.a.createElement(pe,{onFileChange:ot}))),w.a.createElement(O.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},w.a.createElement(K.a,{style:{width:264}})),w.a.createElement(O.a.Item,{style:{textAlign:"right"}},w.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),w.a.createElement(j.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))};function pe(fe){var Ae=fe.onFileChange;return w.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",w.a.createElement("input",{type:"file",onChange:Ae}))}function Y(fe,Ae){if(!fe)throw new String("\u6CA1\u6709\u6587\u4EF6");var Me=new FormData;Me.append("editormd-image-file",fe),Me.append("file_param_name","editormd-image-file"),Me.append("byxhr","true");var Xe=new window.XMLHttpRequest;Xe.withCredentials=!0,Xe.addEventListener("load",function(it){Ae(JSON.parse(it.target.responseText),fe)},!1),Xe.addEventListener("error",function(it){console.error(it)},!1),Xe.open("POST","".concat(ve.a,"/api/attachments.json")),Xe.send(Me)}var ae=ie("giR+"),Z=ie("fyUT"),xe=ie("7Kak"),we=ie("9yH6"),ye=we.a.Group,Se={margin:"0 8px"},Oe=function(fe){var Ae=fe.callback,Me=fe.onCancel;function Xe(it){Ae(it)}return w.a.createElement(O.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Xe},w.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},w.a.createElement("span",{style:Se},"\u5355\u5143\u683C\u6570\uFF1A"),w.a.createElement("span",{style:Se},"\u884C\u6570"),w.a.createElement(O.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},w.a.createElement(Z.a,null)),w.a.createElement("span",{style:Se},"\u5217\u6570"),w.a.createElement(O.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},w.a.createElement(Z.a,null))),w.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},w.a.createElement("span",{style:Se},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),w.a.createElement(O.a.Item,{name:"align"},w.a.createElement(ye,null,w.a.createElement(we.a,{value:"default"},w.a.createElement("i",{className:"fa fa-align-justify"})),w.a.createElement(we.a,{value:"left"},w.a.createElement("i",{className:"fa fa-align-left"})),w.a.createElement(we.a,{value:"center"},w.a.createElement("i",{className:"fa fa-align-center"})),w.a.createElement(we.a,{value:"right"},w.a.createElement("i",{className:"fa fa-align-right"}))))),w.a.createElement("div",{className:"flex-container flex-end"},w.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),w.a.createElement(j.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))},Pe=ie("ErOA"),_e=ie("7Cbv"),De="link",Le="upload-image",Ue="code-block",Ve="add-table",We="------------",Ge={default:We,left:":".concat(We),center:":".concat(We,":"),right:"".concat(We,":")},et=ie("9VGf"),Je,ze;function Ce(){}var qe=0,$e=1e4,Re="\u2581",Fe=`
|
|
**\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 me(fe){return/^\d+$/.test(fe)?"".concat(fe,"px"):fe}var ue=navigator.platform.toUpperCase().indexOf("MAC")>=0,de=ue?"Cmd":"Ctrl",Q=["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"],J=(Je={},Object(N.a)(Je,de+"-B","bold"),Object(N.a)(Je,de+"-I","italic"),Je),te=(ze={},Object(N.a)(ze,De,"\u6DFB\u52A0\u94FE\u63A5"),Object(N.a)(ze,Ue,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(N.a)(ze,Le,"\u6DFB\u52A0\u6587\u4EF6"),Object(N.a)(ze,Ve,"\u6DFB\u52A0\u8868\u683C"),ze),se=Ye.a=function(fe){var Ae=fe.defaultValue,Me=Ae===void 0?"":Ae,Xe=fe.onChange,it=fe.width,tt=it===void 0?"100%":it,xt=fe.height,ht=xt===void 0?400:xt,ot=fe.miniToolbar,Ct=ot===void 0?!1:ot,yt=fe.isFocus,Bt=yt===void 0?!1:yt,Ft=fe.watch,bt=fe.insertTemp,Cr=fe.mode,kr=Cr===void 0?"markdown":Cr,lr=fe.id,mr=lr===void 0?"markdown-editor-id":lr,fr=fe.showResizeBar,ia=fr===void 0?!1:fr,Ar=fe.noStorage,Hn=Ar===void 0?!1:Ar,Kn=fe.showNullButton,kt=Kn===void 0?!1:Kn,rt=fe.hidetoolBar,Pr=rt===void 0?!1:rt,pn=fe.fullScreen,Zt=pn===void 0?!1:pn,Tt=fe.onBlur,gr=fe.onCMBeforeChange,_r=fe.onFullScreen,mn=fe.className,Ne=mn===void 0?"":mn,dt=fe.disablePaste,Gn=dt===void 0?!1:dt,gn=fe.placeholder,vn=gn===void 0?"":gn,Jr=fe.values,yn=Jr===void 0?"":Jr,ft=Object(v.useState)(null),Ai=Object(B.a)(ft,2),Be=Ai[0],bn=Ai[1],hr=Object(v.useState)(Me),zn=Object(B.a)(hr,2),Zr=zn[0],vr=zn[1],Vn=Object(v.useState)(Ft),Xn=Object(B.a)(Vn,2),yr=Xn[0],Yn=Xn[1],Li=Object(v.useState)(Zt),$n=Object(B.a)(Li,2),br=$n[0],Di=$n[1],aa=Object(v.useState)(""),Qn=Object(B.a)(aa,2),$t=Qn[0],Wr=Qn[1],oa=Object(v.useState)(0),qr=Object(B.a)(oa,2),Er=qr[0],Jn=qr[1],sa=Object(v.useState)(ht),Ri=Object(B.a)(sa,2),Oi=Ri[0],En=Ri[1],ki=Object(v.useState)(!1),Pi=Object(B.a)(ki,2),la=Pi[0],xn=Pi[1],en=Object(v.useRef)(Object(_e.a)()),tn=Object(v.useRef)(!1),Tn=Object(v.useRef)(),Mr=Object(v.useRef)(),Ir=Object(v.useRef)(),Fr=Object(v.useRef)(),Sn=Object(v.useRef)(),_i=function(){var nt=Object(P.a)(D.a.mark(function ct(){var st,mt;return D.a.wrap(function(Lt){for(;;)switch(Lt.prev=Lt.next){case 0:return Lt.next=2,Object(Pe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:en.current}});case 2:mt=Lt.sent,mt!=null&&(st=mt.attachments)!==null&&st!==void 0&&st.length&&(console.log("cm:",Be,Mr),mt.attachments.map(function(vt){vt.content_type.indexOf("image")>-1?Be.replaceSelection(".concat(vt.content_type,")")):vt.content_type.indexOf("video")>-1?Be.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):vt.content_type.indexOf("pdf")>-1?Be.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(vt.id,"?type=").concat(vt.content_type,'&disposition=inline" target="_blank">').concat(vt.name,"</a>")):Be.replaceSelection("[".concat(vt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(vt.id,"?type=").concat(vt.content_type,")"))}));case 4:case"end":return Lt.stop()}},ct)}));return function(){return nt.apply(this,arguments)}}();Object(v.useEffect)(function(){vr(yn),Be==null||Be.setValue(yn)},[yn]),Object(v.useEffect)(function(){_r==null||_r(br)},[br]),Object(v.useEffect)(function(){if(Mr.current){var nt=C.a.fromTextArea(Mr.current,{mode:kr,lineNumbers:!Ct,lineWrapping:!0,value:Me,autoCloseTags:!0,autoCloseBrackets:!0});Bt&&nt.focus();function ct(st,mt){if(Gn){mt.preventDefault();return}var Et=mt.clipboardData;if(Et){var Lt=Et.types.toString(),vt=Et.items;if(Lt==="Files"||Et.types.indexOf("Files")>-1){if(mt.preventDefault(),kr=="stex")return;try{var Ut,qt=vt[1];((Ut=vt[0])===null||Ut===void 0?void 0:Ut.kind)==="file"&&(qt=vt[0]);var gt=qt.getAsFile(),Ur=gt.name.split(".").pop();Y(gt,function(St){if(St.id){var er,Vt,pr;(gt==null||((er=gt.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?nt.replaceSelection(".concat(St.content_type,")")):(gt==null||((Vt=gt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?nt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,'"></video>')):(gt==null||((pr=gt.type)===null||pr===void 0)?void 0:pr.indexOf("pdf"))>-1?nt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(gt.type,'&disposition=inline" target="_blank">').concat(gt.name,"</a>")):Q.includes(Ur)?nt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,'?type=office&disposition=inline" target="_blank">').concat(gt.name,"</a>")):nt.replaceSelection("[".concat(gt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(St.content_type,")"))}else(St==null?void 0:St.status)===401&&(document.location.href="/user/login")})}catch(St){I.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return nt.on("paste",ct),nt.on("dragleave",function(st,mt){Ir.current.classList.remove("mouse-hover-md")}),nt.on("dragover",function(st,mt){Ir.current.classList.add("mouse-hover-md")}),nt.on("drop",function(st,mt){Ir.current.classList.add("mouse-hover-md");var Et;if(Et=mt.dataTransfer.files,Et.length>0){mt.preventDefault(),mt.stopPropagation();for(var Lt=function(qt){var gt=Et[qt],Ur=gt.name.split(".").pop();Y(gt,function(St){if(St.id){var er,Vt,pr;(gt==null||((er=gt.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?nt.replaceSelection(".concat(St.content_type,")")):(gt==null||((Vt=gt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?nt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,'"></video>')):(gt==null||((pr=gt.type)===null||pr===void 0)?void 0:pr.indexOf("pdf"))>-1?nt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(gt.type,'&disposition=inline" target="_blank">').concat(gt.name,"</a>")):Q.includes(Ur)?nt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,'?type=office&disposition=inline" target="_blank">').concat(gt.name,"</a>")):nt.replaceSelection("[".concat(gt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(St.content_type,")"))}else(St==null?void 0:St.status)===401&&(document.location.href="/user/login")})},vt=0;vt<Et.length;vt++)Lt(vt)}}),bn(nt),function(){nt.off("paste",ct)}}},[]);var ur=Object(v.useCallback)(function(){if(Ir.current)try{}catch(nt){console.log(nt,"---- to set md editor body height")}},[Oi,Ir,br]);Object(v.useEffect)(function(){function nt(){var st=new T.default(function(mt){var Et=Object(L.a)(mt),Lt;try{for(Et.s();!(Lt=Et.n()).done;){var vt=Lt.value;(vt.target.offsetHeight>0||vt.target.offsetWidth>0)&&(ur(),Be.setSize("100%","100%"),Be.refresh())}}catch(Ut){Et.e(Ut)}finally{Et.f()}});return st.observe(Mr.current.parentElement),st}if(Be){var ct=nt();return function(){ct.unobserve(Mr.current.parentElement)}}},[Be,ur]),Object(v.useEffect)(function(){if(Be){for(var nt=[],ct=function(){var vt=mt[st];Et=Object(B.a)(vt,2);var Ut=Et[0],qt=Et[1],gt=Object(N.a)({},Ut,function(){Mi(qt)});nt.push(gt),Be.addKeyMap(gt)},st=0,mt=Object.entries(J);st<mt.length;st++){var Et;ct()}return Tn.current=setInterval(function(){tn.current&&_i()},4e3),function(){clearInterval(Tn.current);var Lt=Object(L.a)(nt),vt;try{for(Lt.s();!(vt=Lt.n()).done;){var Ut=vt.value;Be.removeKeyMap(Ut)}}catch(qt){Lt.e(qt)}finally{Lt.f()}}}},[Be]),Object(v.useEffect)(function(){Zt!==br&&Di(Zt)},[Zt]),Object(et.a)(function(){if(!Hn&&Er>0){var nt=new Date().getTime(),ct=window.sessionStorage.getItem(mr);nt>=Er+$e&&(!ct||ct!==Zr)&&(window.sessionStorage.setItem(mr,Zr),xn(!0))}},$e),Object(v.useEffect)(function(){Yn(Ft)},[Be,Ft]),Object(v.useEffect)(function(){Be&&(Bt&&Be.focus())},[Be,Bt]),Object(v.useEffect)(function(){if(yr&&Be){var nt=Be.getScrollerElement();function ct(st){var mt=st.target;if(Sn.current){var Et=mt.scrollTop/mt.scrollHeight;Sn.current.scrollTop=Sn.current.scrollHeight*Et}}return nt.addEventListener("scroll",ct),function(){nt.removeEventListener("scroll",ct)}}},[Be,yr]),Object(v.useEffect)(function(){if(Be&&gr){function nt(ct,st){gr(ct,st)}return Be.on("beforeChange",nt),function(){Be.off("beforeChange",nt)}}},[Be,gr]),Object(v.useEffect)(function(){if(Be&&Tt){function nt(){Tt(Be.getValue())}return Be.on("blur",nt),function(){Be.off("blur",nt)}}},[Be,Tt]),Object(v.useEffect)(function(){if(Be){function nt(ct){var st=ct.getValue();vr(st),Jn(new Date().getTime()),ct.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Xe&&Xe(st)}return Be.on("change",nt),function(){Be.off("change",nt)}}},[Be,Xe]),Object(v.useEffect)(function(){Be&&(Me==null?(Be.setValue(""),vr("")):Me!==Be.getValue()&&(Be.setValue(Me),vr(Me),Be.setCursor(Be.lineCount(),0)))},[Be,Me]);var Mi=Object(v.useCallback)(function(nt){var ct=Be.getCursor(),st=Be.getSelection(),mt=st.split(`
|
|
`);switch(nt){case"bold":return Be.replaceSelection("**"+st+"**"),st===""&&Be.setCursor(ct.line,ct.ch+2),Be.focus();case"italic":return Be.replaceSelection("*"+st+"*"),st===""&&Be.setCursor(ct.line,ct.ch+1),Be.focus();case"code":return Be.replaceSelection("`"+st+"`"),st===""&&Be.setCursor(ct.line,ct.ch+1),Be.focus();case"inline-latex":return Be.replaceSelection("`$$"+st+"$$`"),st===""&&Be.setCursor(ct.line,ct.ch+3),Be.focus();case"latex":return Be.replaceSelection("```latex\n"+st+"\n```"),Be.setCursor(ct.line+1,st.length+1),Be.focus();case"line-break":return Be.replaceSelection(`<br/>
|
|
`),Be.focus();case"list-ul":return st===""?Be.replaceSelection("- "+st):Be.replaceSelection(mt.map(function(Et){return Et===""?"":"- ".concat(Et)}).join(`
|
|
`)),Be.focus();case"list-ol":return st===""?Be.replaceSelection("1. "+st):Be.replaceSelection(mt.map(function(Et,Lt){return Et===""?"":"".concat(Lt+1,". ").concat(Et)}).join(`
|
|
`)),Be.focus();case"add-null-ch":return st===""&&Be.setCursor(ct.line,ct.ch+1),Be.replaceSelection(Re),Be.focus();case"inster-template-1":return st===""&&Be.setCursor(ct.line,ct.ch),Be.replaceSelection(Fe),Be.focus();case"eraser":return Be.setValue(""),Be.focus();case"trigger-watch":return Yn(!yr),Be.focus();case"trigger-full-screen":return Di(!br),Be.focus();case De:Wr(De);return;case Ue:Wr(Ue);return;case Le:Wr(Le);return;case Ve:Wr(Ve);return;default:throw new Error}},[Be,yr,br]),wn=Object(v.useCallback)(function(nt){Wr("");switch($t){case De:var ct=nt.title,st=nt.link;return Be.replaceSelection("[".concat(ct,"](").concat(st,")")),Be.focus();case Ue:var mt=nt.language,Et=nt.content;return Be.replaceSelection(["```"+mt,Et,"```"].join(`
|
|
`)),Be.focus();case Le:var Lt=nt.src,vt=nt.alt;return vt?Be.replaceSelection(".concat(Lt,' "').concat(vt,'" )')):Be.replaceSelection("")),Be.focus();case Ve:for(var Ut=nt.row,qt=nt.col,gt=nt.align,Ur=`
|
|
`,St=0;St<Ut;St++){for(var er=[],Vt=[],pr=0;pr<qt;pr++)St===1&&Vt.push(Ge[gt]),er.push(" ");St===1&&(Ur+="| ".concat(Vt.join(" | "),` |
|
|
`)),Ur+="| ".concat(er.join(qt===1?"":" | "),` |
|
|
`)}return Be.replaceSelection(Ur+`
|
|
`),Be.focus();default:throw new Error}},[Be,$t]),Zn=Object(v.useMemo)(function(){switch($t){case De:return w.a.createElement(q,{callback:wn,onCancel:Hr});case Ue:return w.a.createElement(ne.b,{callback:wn,onCancel:Hr});case Le:return w.a.createElement(oe,{callback:wn,onCancel:Hr});case Ve:return w.a.createElement(Oe,{callback:wn,onCancel:Hr});default:return null}},[$t]);function Hr(){Wr("")}Object(v.useEffect)(function(){if(Fr.current){var nt=Fr.current,ct=!1,st=0;function mt(vt){ct=!0,st=vt.pageY}function Et(){ct=!1}function Lt(vt){if(ct){var Ut=vt.pageY-st;Ut<0&&(Ut=0),Ut>300&&(Ut=300);var qt=ht+Ut+"px";En(qt)}}return nt.addEventListener("mousedown",mt),document.addEventListener("mousemove",Lt),document.addEventListener("mouseup",Et),function(){nt.removeEventListener("mousedown",mt),document.removeEventListener("mousemove",Lt),document.removeEventListener("mouseup",Et)}}},[Be,Fr]),Object(v.useEffect)(function(){En(ht)},[ht]);var Lr=me(tt),qn=me(Oi),xr={width:Lr,height:qn},ei=Object(v.useMemo)(function(){if(Er){var nt=new Date(Er),ct=nt.getHours(),st=nt.getMinutes(),mt=nt.getSeconds();return ct=ct<10?"0"+ct:ct,st=st<10?"0"+st:st,mt=mt<10?"0"+mt:mt,"".concat(ct,":").concat(st,":").concat(mt)}return 0},[Er]);function Ii(){window.sessionStorage.removeItem(mr),xn(!1),Jn(0)}function rn(){xn(!1),Jn(0),Be.setValue(window.sessionStorage.getItem(mr))}function ua(nt,ct){var st=Be.getValue();st=st.replace(nt,ct),vr(st),Be==null||Be.setValue(st)}return w.a.createElement(v.Fragment,null,w.a.createElement("div",{className:"markdown-editor-wrapper",ref:Ir},w.a.createElement("div",{className:"markdown-editor-container ".concat(Ne," ").concat(yr?"on-preview":""," ").concat(Ct?"mini":""," ").concat(br?"full-screen":""),style:xr},w.a.createElement(y,{insertTemp:bt,watch:yr,fullScreen:br,showNullButton:kt,onActionCallback:Mi,hidetoolBar:Pr,uuid:en.current,setOpenPhones:function(){tn.current=!0}}),w.a.createElement("div",{className:"markdown-editor-body"},w.a.createElement("div",{className:"codemirror-container"},w.a.createElement("textarea",{ref:Mr,placeholder:vn})),yr?w.a.createElement("div",{ref:Sn,className:"preview-container"},kr==="stex"&&w.a.createElement(A,{value:Zr}),kr!=="stex"&&w.a.createElement(h.a,{edit:!0,value:Zr,replaces:ua})):null))),ia?w.a.createElement("a",{ref:Fr,className:"editor-resize"}):null,w.a.createElement(M.a,null,te[$t]?w.a.createElement(z.a,{centered:!0,title:te[$t],visible:!0,onCancel:Hr,footer:null,className:"markdown-popup-form"},Zn):null))}},SJMd:function(ut,Ye){/**
|
|
* @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 ie,ee,z,L=!1,G,I;window.PR_SHOULD_USE_CONTINUATION=!0;var P,B;(function(){var N=window,k=["break,continue,do,else,for,if,return,while"],D=[k,"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"],v=[D,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],w=[v,"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"],R=[v,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],C=[v,"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"],T="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",E=[v,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],u="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=[k,"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"],s=[k,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],d=[k,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],S=[w,C,R,E,u,o,s,d],p=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,h="str",A="kwd",b="com",f="typ",c="lit",l="pun",a="pln",g="tag",m="dec",y="src",M="atn",F="atv",j="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function O(ye){for(var Se=0,Oe=!1,Pe=!1,_e=0,De=ye.length;_e<De;++_e){var Le=ye[_e];if(Le.ignoreCase)Pe=!0;else if(/[a-z]/i.test(Le.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Oe=!0,Pe=!1;break}}var Ue={b:8,t:9,n:10,v:11,f:12,r:13};function Ve(ze){var Ce=ze.charCodeAt(0);if(Ce!==92)return Ce;var qe=ze.charAt(1);return Ce=Ue[qe],Ce||("0"<=qe&&qe<="7"?parseInt(ze.substring(1),8):qe==="u"||qe==="x"?parseInt(ze.substring(2),16):ze.charCodeAt(1))}function We(ze){if(ze<32)return(ze<16?"\\x0":"\\x")+ze.toString(16);var Ce=String.fromCharCode(ze);return Ce==="\\"||Ce==="-"||Ce==="]"||Ce==="^"?"\\"+Ce:Ce}function Ge(ze){var Ce=ze.substring(1,ze.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),qe=[],$e=Ce[0]==="^",Re=["["];$e&&Re.push("^");for(var Fe=$e?1:0,me=Ce.length;Fe<me;++Fe){var ue=Ce[Fe];if(/\\[bdsw]/i.test(ue))Re.push(ue);else{var de=Ve(ue),Q;Fe+2<me&&Ce[Fe+1]==="-"?(Q=Ve(Ce[Fe+2]),Fe+=2):Q=de,qe.push([de,Q]),Q<65||de>122||(Q<65||de>90||qe.push([Math.max(65,de)|32,Math.min(Q,90)|32]),Q<97||de>122||qe.push([Math.max(97,de)&~32,Math.min(Q,122)&~32]))}}qe.sort(function(fe,Ae){return fe[0]-Ae[0]||Ae[1]-fe[1]});for(var J=[],te=[],Fe=0;Fe<qe.length;++Fe){var se=qe[Fe];se[0]<=te[1]+1?te[1]=Math.max(te[1],se[1]):J.push(te=se)}for(var Fe=0;Fe<J.length;++Fe){var se=J[Fe];Re.push(We(se[0])),se[1]>se[0]&&(se[1]+1>se[0]&&Re.push("-"),Re.push(We(se[1])))}return Re.push("]"),Re.join("")}function et(ze){for(var Ce=ze.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),qe=Ce.length,$e=[],Re=0,Fe=0;Re<qe;++Re){var me=Ce[Re];if(me==="(")++Fe;else if(me.charAt(0)==="\\"){var ue=+me.substring(1);ue&&(ue<=Fe?$e[ue]=-1:Ce[Re]=We(ue))}}for(var Re=1;Re<$e.length;++Re)$e[Re]===-1&&($e[Re]=++Se);for(var Re=0,Fe=0;Re<qe;++Re){var me=Ce[Re];if(me==="(")++Fe,$e[Fe]||(Ce[Re]="(?:");else if(me.charAt(0)==="\\"){var ue=+me.substring(1);ue&&ue<=Fe&&(Ce[Re]="\\"+$e[ue])}}for(var Re=0;Re<qe;++Re)Ce[Re]==="^"&&Ce[Re+1]!=="^"&&(Ce[Re]="");if(ze.ignoreCase&&Oe)for(var Re=0;Re<qe;++Re){var me=Ce[Re],de=me.charAt(0);me.length>=2&&de==="["?Ce[Re]=Ge(me):de!=="\\"&&(Ce[Re]=me.replace(/[a-zA-Z]/g,function(te){var se=te.charCodeAt(0);return"["+String.fromCharCode(se&~32,se|32)+"]"}))}return Ce.join("")}for(var Je=[],_e=0,De=ye.length;_e<De;++_e){var Le=ye[_e];if(Le.global||Le.multiline)throw new Error(""+Le);Je.push("(?:"+et(Le)+")")}return new RegExp(Je.join("|"),Pe?"gi":"g")}function _(ye,Se){var Oe=/(?:^|\s)nocode(?:\s|$)/,Pe=[],_e=0,De=[],Le=0;function Ue(Ve){var We=Ve.nodeType;if(We==1){if(Oe.test(Ve.className))return;for(var Ge=Ve.firstChild;Ge;Ge=Ge.nextSibling)Ue(Ge);var et=Ve.nodeName.toLowerCase();(et==="br"||et==="li")&&(Pe[Le]=`
|
|
`,De[Le<<1]=_e++,De[Le++<<1|1]=Ve)}else if(We==3||We==4){var Je=Ve.nodeValue;Je.length&&(Se?Je=Je.replace(/\r\n?/g,`
|
|
`):Je=Je.replace(/[ \t\r\n]+/g," "),Pe[Le]=Je,De[Le<<1]=_e,_e+=Je.length,De[Le++<<1|1]=Ve)}}return Ue(ye),{sourceCode:Pe.join("").replace(/\n$/,""),spans:De}}function K(ye,Se,Oe,Pe,_e){if(!Oe)return;var De={sourceNode:ye,pre:1,langExtension:null,numberLines:null,sourceCode:Oe,spans:null,basePos:Se,decorations:null};Pe(De),_e.push.apply(_e,De.decorations)}var $=/\S/;function q(ye){for(var Se=void 0,Oe=ye.firstChild;Oe;Oe=Oe.nextSibling){var Pe=Oe.nodeType;Se=Pe===1?Se?ye:Oe:Pe===3&&$.test(Oe.nodeValue)?ye:Se}return Se===ye?void 0:Se}function ne(ye,Se){var Oe={},Pe;(function(){for(var Le=ye.concat(Se),Ue=[],Ve={},We=0,Ge=Le.length;We<Ge;++We){var et=Le[We],Je=et[3];if(Je)for(var ze=Je.length;--ze>=0;)Oe[Je.charAt(ze)]=et;var Ce=et[1],qe=""+Ce;Ve.hasOwnProperty(qe)||(Ue.push(Ce),Ve[qe]=null)}Ue.push(/[\0-\uffff]/),Pe=O(Ue)})();var _e=Se.length,De=function(Le){for(var Ue=Le.sourceCode,Ve=Le.basePos,We=Le.sourceNode,Ge=[Ve,a],et=0,Je=Ue.match(Pe)||[],ze={},Ce=0,qe=Je.length;Ce<qe;++Ce){var $e=Je[Ce],Re=ze[$e],Fe=void 0,me;if(typeof Re=="string")me=!1;else{var ue=Oe[$e.charAt(0)];if(ue)Fe=$e.match(ue[1]),Re=ue[0];else{for(var de=0;de<_e;++de)if(ue=Se[de],Fe=$e.match(ue[1]),Fe){Re=ue[0];break}Fe||(Re=a)}me=Re.length>=5&&Re.substring(0,5)==="lang-",me&&!(Fe&&typeof Fe[1]=="string")&&(me=!1,Re=y),me||(ze[$e]=Re)}var Q=et;if(et+=$e.length,!me)Ge.push(Ve+Q,Re);else{var J=Fe[1],te=$e.indexOf(J),se=te+J.length;Fe[2]&&(se=$e.length-Fe[2].length,te=se-J.length);var fe=Re.substring(5);K(We,Ve+Q,$e.substring(0,te),De,Ge),K(We,Ve+Q+te,J,pe(fe,J),Ge),K(We,Ve+Q+se,$e.substring(se),De,Ge)}}Le.decorations=Ge};return De}function Te(ye){var Se=[],Oe=[];ye.tripleQuotedStrings?Se.push([h,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ye.multiLineStrings?Se.push([h,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Se.push([h,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ye.verbatimStrings&&Oe.push([h,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Pe=ye.hashComments;Pe&&(ye.cStyleComments?(Pe>1?Se.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Se.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Oe.push([h,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Se.push([b,/^#[^\r\n]*/,null,"#"])),ye.cStyleComments&&(Oe.push([b,/^\/\/[^\r\n]*/,null]),Oe.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var _e=ye.regexLiterals;if(_e){var De=_e>1?"":`
|
|
\r`,Le=De?".":"[\\S\\s]",Ue="/(?=[^/*"+De+"])(?:[^/\\x5B\\x5C"+De+"]|\\x5C"+Le+"|\\x5B(?:[^\\x5C\\x5D"+De+"]|\\x5C"+Le+")*(?:\\x5D|$))+/";Oe.push(["lang-regex",RegExp("^"+W+"("+Ue+")")])}var Ve=ye.types;Ve&&Oe.push([f,Ve]);var We=(""+ye.keywords).replace(/^ | $/g,"");We.length&&Oe.push([A,new RegExp("^(?:"+We.replace(/[\s,]+/g,"|")+")\\b"),null]),Se.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var Ge="^.[^\\s\\w.$@'\"`/\\\\]*";return ye.regexLiterals&&(Ge+="(?!s*/)"),Oe.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[f,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[l,new RegExp(Ge),null]),ne(Se,Oe)}var ve=Te({keywords:S,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ge(ye,Se,Oe){for(var Pe=/(?:^|\s)nocode(?:\s|$)/,_e=/\r\n?|\n/,De=ye.ownerDocument,Le=De.createElement("li");ye.firstChild;)Le.appendChild(ye.firstChild);var Ue=[Le];function Ve(Ce){var qe=Ce.nodeType;if(qe==1&&!Pe.test(Ce.className))if(Ce.nodeName==="br")We(Ce),Ce.parentNode&&Ce.parentNode.removeChild(Ce);else for(var $e=Ce.firstChild;$e;$e=$e.nextSibling)Ve($e);else if((qe==3||qe==4)&&Oe){var Re=Ce.nodeValue,Fe=Re.match(_e);if(Fe){var me=Re.substring(0,Fe.index);Ce.nodeValue=me;var ue=Re.substring(Fe.index+Fe[0].length);if(ue){var de=Ce.parentNode;de.insertBefore(De.createTextNode(ue),Ce.nextSibling)}We(Ce),me||Ce.parentNode.removeChild(Ce)}}}function We(Ce){for(;!Ce.nextSibling;)if(Ce=Ce.parentNode,!Ce)return;function qe(Fe,me){var ue=me?Fe.cloneNode(!1):Fe,de=Fe.parentNode;if(de){var Q=qe(de,1),J=Fe.nextSibling;Q.appendChild(ue);for(var te=J;te;te=J)J=te.nextSibling,Q.appendChild(te)}return ue}for(var $e=qe(Ce.nextSibling,0),Re;(Re=$e.parentNode)&&Re.nodeType===1;)$e=Re;Ue.push($e)}for(var Ge=0;Ge<Ue.length;++Ge)Ve(Ue[Ge]);Se===(Se|0)&&Ue[0].setAttribute("value",Se);var et=De.createElement("ol");et.className="linenums";for(var Je=Math.max(0,Se-1|0)||0,Ge=0,ze=Ue.length;Ge<ze;++Ge)Le=Ue[Ge],Le.className="L"+(Ge+Je)%10,Le.firstChild||Le.appendChild(De.createTextNode("\xA0")),et.appendChild(Le);ye.appendChild(et)}function ce(ye){var Se=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Se=Se&&+Se[1]<=8;var Oe=/\n/g,Pe=ye.sourceCode,_e=Pe.length,De=0,Le=ye.spans,Ue=Le.length,Ve=0,We=ye.decorations,Ge=We.length,et=0;We[Ge]=_e;var Je,ze;for(ze=Je=0;ze<Ge;)We[ze]!==We[ze+2]?(We[Je++]=We[ze++],We[Je++]=We[ze++]):ze+=2;for(Ge=Je,ze=Je=0;ze<Ge;){for(var Ce=We[ze],qe=We[ze+1],$e=ze+2;$e+2<=Ge&&We[$e+1]===qe;)$e+=2;We[Je++]=Ce,We[Je++]=qe,ze=$e}Ge=We.length=Je;var Re=ye.sourceNode,Fe="";Re&&(Fe=Re.style.display,Re.style.display="none");try{for(var me=null;Ve<Ue;){var ue=Le[Ve],de=Le[Ve+2]||_e,Q=We[et+2]||_e,$e=Math.min(de,Q),J=Le[Ve+1],te;if(J.nodeType!==1&&(te=Pe.substring(De,$e))){Se&&(te=te.replace(Oe,"\r")),J.nodeValue=te;var se=J.ownerDocument,fe=se.createElement("span");fe.className=We[et+1];var Ae=J.parentNode;Ae.replaceChild(fe,J),fe.appendChild(J),De<de&&(Le[Ve+1]=J=se.createTextNode(Pe.substring($e,de)),Ae.insertBefore(J,fe.nextSibling))}De=$e,De>=de&&(Ve+=2),De>=Q&&(et+=2)}}finally{Re&&(Re.style.display=Fe)}}var he={};function oe(ye,Se){for(var Oe=Se.length;--Oe>=0;){var Pe=Se[Oe];he.hasOwnProperty(Pe)?N.console&&console.warn("cannot override language handler %s",Pe):he[Pe]=ye}}function pe(ye,Se){return ye&&he.hasOwnProperty(ye)||(ye=/^\s*</.test(Se)?"default-markup":"default-code"),he[ye]}oe(ve,["default-code"]),oe(ne([],[[a,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[l,/^(?:<[%?]|[%?]>)/],["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"]),oe(ne([[a,/^[\s]+/,null,` \r
|
|
`],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[g,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[l,/^[=<>\/]+/],["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"]),oe(ne([],[[F,/^[\s\S]+/]]),["uq.val"]),oe(Te({keywords:w,hashComments:!0,cStyleComments:!0,types:p}),["c","cc","cpp","cxx","cyc","m"]),oe(Te({keywords:"null,true,false"}),["json"]),oe(Te({keywords:C,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:p}),["cs"]),oe(Te({keywords:R,cStyleComments:!0}),["java"]),oe(Te({keywords:d,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),oe(Te({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),oe(Te({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),oe(Te({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),oe(Te({keywords:E,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),oe(Te({keywords:T,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),oe(ne([],[[h,/^[\s\S]+/]]),["regex"]);function Y(ye){var Se=ye.langExtension;try{var Oe=_(ye.sourceNode,ye.pre),Pe=Oe.sourceCode;ye.sourceCode=Pe,ye.spans=Oe.spans,ye.basePos=0,pe(Se,Pe)(ye),ce(ye)}catch(_e){N.console&&console.log(_e&&_e.stack||_e)}}function ae(ye,Se,Oe){var Pe=Oe||!1,_e=Se||null,De=document.createElement("div");De.innerHTML="<pre>"+ye+"</pre>",De=De.firstChild,Pe&&ge(De,Pe,!0);var Le={langExtension:_e,numberLines:Pe,sourceNode:De,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Y(Le),De.innerHTML}function Z(ye,Se){var Oe=Se||document.body,Pe=Oe.ownerDocument||document;function _e(ue){return Oe.getElementsByTagName(ue)}for(var De=[_e("pre"),_e("code"),_e("xmp")],Le=[],Ue=0;Ue<De.length;++Ue)for(var Ve=0,We=De[Ue].length;Ve<We;++Ve)Le.push(De[Ue][Ve]);De=null;var Ge=Date;Ge.now||(Ge={now:function(){return+new Date}});var et=0,Je=/\blang(?:uage)?-([\w.]+)(?!\S)/,ze=/\bprettyprint\b/,Ce=/\bprettyprinted\b/,qe=/pre|xmp/i,$e=/^code$/i,Re=/^(?:pre|code|xmp)$/i,Fe={};function me(){for(var ue=N.PR_SHOULD_USE_CONTINUATION?Ge.now()+250:Infinity;et<Le.length&&Ge.now()<ue;et++){for(var de=Le[et],Q=Fe,J=de;J=J.previousSibling;){var te=J.nodeType,se=(te===7||te===8)&&J.nodeValue;if(se?!/^\??prettify\b/.test(se):te!==3||/\S/.test(J.nodeValue))break;if(se){Q={},se.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ft,bt,Cr){Q[bt]=Cr});break}}var fe=de.className;if((Q!==Fe||ze.test(fe))&&!Ce.test(fe)){for(var Ae=!1,Me=de.parentNode;Me;Me=Me.parentNode){var Xe=Me.tagName;if(Re.test(Xe)&&Me.className&&ze.test(Me.className)){Ae=!0;break}}if(!Ae){de.className+=" prettyprinted";var it=Q.lang;if(!it){it=fe.match(Je);var tt;!it&&(tt=q(de))&&$e.test(tt.tagName)&&(it=tt.className.match(Je)),it&&(it=it[1])}var xt;if(qe.test(de.tagName))xt=1;else{var ht=de.currentStyle,ot=Pe.defaultView,Ct=ht?ht.whiteSpace:ot&&ot.getComputedStyle?ot.getComputedStyle(de,null).getPropertyValue("white-space"):0;xt=Ct&&Ct.substring(0,3)==="pre"}var yt=Q.linenums;(yt=yt==="true"||+yt)||(yt=fe.match(/\blinenums\b(?::(\d+))?/),yt=yt?yt[1]&&yt[1].length?+yt[1]:!0:!1),yt&&ge(de,yt,xt);var Bt={langExtension:it,sourceNode:de,numberLines:yt,pre:xt,sourceCode:null,basePos:null,spans:null,decorations:null};Y(Bt)}}}et<Le.length?N.setTimeout(me,250):typeof ye=="function"&&ye()}me()}var xe=N.PR={createSimpleLexer:ne,registerLangHandler:oe,sourceDecorator:Te,PR_ATTRIB_NAME:M,PR_ATTRIB_VALUE:F,PR_COMMENT:b,PR_DECLARATION:m,PR_KEYWORD:A,PR_LITERAL:c,PR_NOCODE:j,PR_PLAIN:a,PR_PUNCTUATION:l,PR_SOURCE:y,PR_STRING:h,PR_TAG:g,PR_TYPE:f,prettyPrintOne:L?N.prettyPrintOne=ae:P=ae,prettyPrint:B=L?N.prettyPrint=Z:B=Z},we=N.define;typeof we=="function"&&we.amd&&we("google-code-prettify",[],function(){return xe})})()},"VrN/":function(ut,Ye,ie){(function(ee,z){ut.exports=z()})(this,function(){"use strict";var ee=navigator.userAgent,z=navigator.platform,L=/gecko\/\d/i.test(ee),G=/MSIE \d/.test(ee),I=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ee),P=/Edge\/(\d+)/.exec(ee),B=G||I||P,N=B&&(G?document.documentMode||6:+(P||I)[1]),k=!P&&/WebKit\//.test(ee),D=k&&/Qt\/\d+\.\d+/.test(ee),v=!P&&/Chrome\//.test(ee),w=/Opera\//.test(ee),R=/Apple Computer/.test(navigator.vendor),C=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ee),T=/PhantomJS/.test(ee),E=!P&&/AppleWebKit/.test(ee)&&/Mobile\/\w+/.test(ee),u=/Android/.test(ee),o=E||u||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ee),s=E||/Mac/.test(z),d=/\bCrOS\b/.test(ee),S=/win/i.test(z),p=w&&ee.match(/Version\/(\d*\.\d*)/);p&&(p=Number(p[1])),p&&p>=15&&(w=!1,k=!0);var h=s&&(D||w&&(p==null||p<12.11)),A=L||B&&N>=9;function b(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var f=function(e,t){var n=e.className,r=b(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 c(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function l(e,t){return c(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 x=0;x<t.length;++x)i.appendChild(t[x]);return i}function g(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var m;document.createRange?m=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:m=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 y(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function M(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function F(e,t){var n=e.className;b(t).test(n)||(e.className+=(n?" ":"")+t)}function j(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!b(n[r]).test(t)&&(t+=" "+n[r]);return t}var W=function(e){e.select()};E?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:B&&(W=function(e){try{e.select()}catch(t){}});function O(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function _(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 K(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var x=r||0,U=i||0;;){var H=e.indexOf(" ",x);if(H<0||H>=t)return U+(t-x);U+=H-x,U+=n-U%n,x=H+1}}var $=function(){this.id=null,this.f=null,this.time=0,this.handler=O(this.onTimeout,this)};$.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},$.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 q(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var ne=50,Te={toString:function(){return"CodeMirror.Pass"}},ve={scroll:!1},ge={origin:"*mouse"},ce={origin:"+move"};function he(e,t,n){for(var r=0,i=0;;){var x=e.indexOf(" ",r);x==-1&&(x=e.length);var U=x-r;if(x==e.length||i+U>=t)return r+Math.min(U,t-i);if(i+=x-r,i+=n-i%n,r=x+1,i>=t)return r}}var oe=[""];function pe(e){for(;oe.length<=e;)oe.push(Y(oe)+" ");return oe[e]}function Y(e){return e[e.length-1]}function ae(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Z(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function xe(){}function we(e,t){var n;return Object.create?n=Object.create(e):(xe.prototype=e,n=new xe),t&&_(t,n),n}var ye=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Se(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ye.test(e))}function Oe(e,t){return t?t.source.indexOf("\\w")>-1&&Se(e)?!0:t.test(e):Se(e)}function Pe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var _e=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function De(e){return e.charCodeAt(0)>=768&&_e.test(e)}function Le(e,t,n){for(;(n<0?t>0:t<e.length)&&De(e.charAt(t));)t+=n;return t}function Ue(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,x=r<0?Math.ceil(i):Math.floor(i);if(x==t)return e(x)?t:n;e(x)?n=x:t=x+r}}function Ve(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,x=0;x<e.length;++x){var U=e[x];(U.from<n&&U.to>t||t==n&&U.to==t)&&(r(Math.max(U.from,t),Math.min(U.to,n),U.level==1?"rtl":"ltr",x),i=!0)}i||r(t,n,"ltr")}var We=null;function Ge(e,t,n){var r;We=null;for(var i=0;i<e.length;++i){var x=e[i];if(x.from<t&&x.to>t)return i;x.to==t&&(x.from!=x.to&&n=="before"?r=i:We=i),x.from==t&&(x.from!=x.to&&n!="before"?r=i:We=i)}return r!=null?r:We}var et=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(X){return X<=247?e.charAt(X):1424<=X&&X<=1524?"R":1536<=X&&X<=1785?t.charAt(X-1536):1774<=X&&X<=2220?"r":8192<=X&&X<=8203?"w":X==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,x=/[LRr]/,U=/[Lb1n]/,H=/[1n]/;function V(X,re,le){this.level=X,this.from=re,this.to=le}return function(X,re){var le=re=="ltr"?"L":"R";if(X.length==0||re=="ltr"&&!r.test(X))return!1;for(var Ee=X.length,be=[],ke=0;ke<Ee;++ke)be.push(n(X.charCodeAt(ke)));for(var Ie=0,je=le;Ie<Ee;++Ie){var He=be[Ie];He=="m"?be[Ie]=je:je=He}for(var Qe=0,Ke=le;Qe<Ee;++Qe){var Ze=be[Qe];Ze=="1"&&Ke=="r"?be[Qe]="n":x.test(Ze)&&(Ke=Ze,Ze=="r"&&(be[Qe]="R"))}for(var lt=1,at=be[0];lt<Ee-1;++lt){var pt=be[lt];pt=="+"&&at=="1"&&be[lt+1]=="1"?be[lt]="1":pt==","&&at==be[lt+1]&&(at=="1"||at=="n")&&(be[lt]=at),at=pt}for(var Dt=0;Dt<Ee;++Dt){var Ht=be[Dt];if(Ht==",")be[Dt]="N";else if(Ht=="%"){var Ot=void 0;for(Ot=Dt+1;Ot<Ee&&be[Ot]=="%";++Ot);for(var sr=Dt&&be[Dt-1]=="!"||Ot<Ee&&be[Ot]=="1"?"1":"N",nr=Dt;nr<Ot;++nr)be[nr]=sr;Dt=Ot-1}}for(var Mt=0,ir=le;Mt<Ee;++Mt){var zt=be[Mt];ir=="L"&&zt=="1"?be[Mt]="L":x.test(zt)&&(ir=zt)}for(var Nt=0;Nt<Ee;++Nt)if(i.test(be[Nt])){var It=void 0;for(It=Nt+1;It<Ee&&i.test(be[It]);++It);for(var Pt=(Nt?be[Nt-1]:le)=="L",ar=(It<Ee?be[It]:le)=="L",jn=Pt==ar?Pt?"L":"R":le,Qr=Nt;Qr<It;++Qr)be[Qr]=jn;Nt=It-1}for(var Yt=[],Or,Kt=0;Kt<Ee;)if(U.test(be[Kt])){var Va=Kt;for(++Kt;Kt<Ee&&U.test(be[Kt]);++Kt);Yt.push(new V(0,Va,Kt))}else{var jr=Kt,fn=Yt.length,hn=re=="rtl"?1:0;for(++Kt;Kt<Ee&&be[Kt]!="L";++Kt);for(var Jt=jr;Jt<Kt;)if(H.test(be[Jt])){jr<Jt&&(Yt.splice(fn,0,new V(1,jr,Jt)),fn+=hn);var Wn=Jt;for(++Jt;Jt<Kt&&H.test(be[Jt]);++Jt);Yt.splice(fn,0,new V(2,Wn,Jt)),fn+=hn,jr=Jt}else++Jt;jr<Kt&&Yt.splice(fn,0,new V(1,jr,Kt))}return re=="ltr"&&(Yt[0].level==1&&(Or=X.match(/^\s+/))&&(Yt[0].from=Or[0].length,Yt.unshift(new V(0,0,Or[0].length))),Y(Yt).level==1&&(Or=X.match(/\s+$/))&&(Y(Yt).to-=Or[0].length,Yt.push(new V(0,Ee-Or[0].length,Ee)))),re=="rtl"?Yt.reverse():Yt}}();function Je(e,t){var n=e.order;return n==null&&(n=e.order=et(e.text,t)),n}var ze=[],Ce=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]||ze).concat(n)}};function qe(e,t){return e._handlers&&e._handlers[t]||ze}function $e(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 x=q(i,n);x>-1&&(r[t]=i.slice(0,x).concat(i.slice(x+1)))}}}function Re(e,t){var n=qe(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 Fe(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Re(e,n||t.type,e,t),te(t)||t.codemirrorIgnore}function me(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)q(n,t[r])==-1&&n.push(t[r])}function ue(e,t){return qe(e,t).length>0}function de(e){e.prototype.on=function(t,n){Ce(this,t,n)},e.prototype.off=function(t,n){$e(this,t,n)}}function Q(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function J(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function te(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function se(e){Q(e),J(e)}function fe(e){return e.target||e.srcElement}function Ae(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var Me=function(){if(B&&N<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),Xe;function it(e){if(Xe==null){var t=a("span","\u200B");l(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Xe=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&N<8))}var n=Xe?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var tt;function xt(e){if(tt!=null)return tt;var t=l(e,document.createTextNode("A\u062EA")),n=m(t,0,1).getBoundingClientRect(),r=m(t,1,2).getBoundingClientRect();return c(e),!n||n.left==n.right?!1:tt=r.right-n.right<3}var ht=`
|
|
|
|
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 x=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),U=x.indexOf("\r");U!=-1?(n.push(x.slice(0,U)),t+=U+1):(n.push(x),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},ot=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},Ct=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),yt=null;function Bt(e){if(yt!=null)return yt;var t=l(e,a("span","x")),n=t.getBoundingClientRect(),r=m(t,0,1).getBoundingClientRect();return yt=Math.abs(n.left-r.left)>1}var Ft={},bt={};function Cr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ft[e]=t}function kr(e,t){bt[e]=t}function lr(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=we(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return lr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return lr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function mr(e,t){t=lr(t);var n=Ft[t.name];if(!n)return mr(e,"text/plain");var r=n(e,t);if(fr.hasOwnProperty(t.name)){var i=fr[t.name];for(var x in i){if(!i.hasOwnProperty(x))continue;r.hasOwnProperty(x)&&(r["_"+x]=r[x]),r[x]=i[x]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var U in t.modeProps)r[U]=t.modeProps[U];return r}var fr={};function ia(e,t){var n=fr.hasOwnProperty(e)?fr[e]:fr[e]={};_(t,n)}function Ar(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 Hn(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 Kn(e,t,n){return e.startState?e.startState(t,n):!0}var kt=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};kt.prototype.eol=function(){return this.pos>=this.string.length},kt.prototype.sol=function(){return this.pos==this.lineStart},kt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},kt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},kt.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},kt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},kt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},kt.prototype.skipToEnd=function(){this.pos=this.string.length},kt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},kt.prototype.backUp=function(e){this.pos-=e},kt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=K(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?K(this.string,this.lineStart,this.tabSize):0)},kt.prototype.indentation=function(){return K(this.string,null,this.tabSize)-(this.lineStart?K(this.string,this.lineStart,this.tabSize):0)},kt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(U){return n?U.toLowerCase():U},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var x=this.string.slice(this.pos).match(e);return x&&x.index>0?null:(x&&t!==!1&&(this.pos+=x[0].length),x)}},kt.prototype.current=function(){return this.string.slice(this.start,this.pos)},kt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},kt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},kt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function rt(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],x=i.chunkSize();if(t<x){n=i;break}t-=x}return n.lines[t]}function Pr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(x){var U=x.text;i==n.line&&(U=U.slice(0,n.ch)),i==t.line&&(U=U.slice(t.ch)),r.push(U),++i}),r}function pn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function Zt(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Tt(e){if(e.parent==null)return null;for(var t=e.parent,n=q(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 gr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],x=i.height;if(t<x){e=i;continue e}t-=x,n+=i.chunkSize()}return n}while(!e.lines);for(var U=0;U<e.lines.length;++U){var H=e.lines[U],V=H.height;if(t<V)break;t-=V}return n+U}function _r(e,t){return t>=e.first&&t<e.first+e.size}function mn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ne(e,t,n){if(n===void 0&&(n=null),!(this instanceof Ne))return new Ne(e,t,n);this.line=e,this.ch=t,this.sticky=n}function dt(e,t){return e.line-t.line||e.ch-t.ch}function Gn(e,t){return e.sticky==t.sticky&&dt(e,t)==0}function gn(e){return Ne(e.line,e.ch)}function vn(e,t){return dt(e,t)<0?t:e}function Jr(e,t){return dt(e,t)<0?e:t}function yn(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ft(e,t){if(t.line<e.first)return Ne(e.first,0);var n=e.first+e.size-1;return t.line>n?Ne(n,rt(e,n).text.length):Ai(t,rt(e,t.line).text.length)}function Ai(e,t){var n=e.ch;return n==null||n>t?Ne(e.line,t):n<0?Ne(e.line,0):e}function Be(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ft(e,t[r]);return n}var bn=function(e,t){this.state=e,this.lookAhead=t},hr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};hr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},hr.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}},hr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},hr.fromSaved=function(e,t,n){return t instanceof bn?new hr(e,Ar(e.mode,t.state),n,t.lookAhead):new hr(e,Ar(e.mode,t),n)},hr.prototype.save=function(e){var t=e!==!1?Ar(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new bn(t,this.maxLookAhead):t};function zn(e,t,n,r){var i=[e.state.modeGen],x={};br(e,t.text,e.doc.mode,n,function(X,re){return i.push(X,re)},x,r);for(var U=n.state,H=function(X){n.baseTokens=i;var re=e.state.overlays[X],le=1,Ee=0;n.state=!0,br(e,t.text,re.mode,n,function(be,ke){for(var Ie=le;Ee<be;){var je=i[le];je>be&&i.splice(le,1,be,i[le+1],je),le+=2,Ee=Math.min(be,je)}if(!ke)return;if(re.opaque)i.splice(Ie,le-Ie,be,"overlay "+ke),le=Ie+2;else for(;Ie<le;Ie+=2){var He=i[Ie+1];i[Ie+1]=(He?He+" ":"")+"overlay "+ke}},x),n.state=U,n.baseTokens=null,n.baseTokenPos=1},V=0;V<e.state.overlays.length;++V)H(V);return{styles:i,classes:x.bgClass||x.textClass?x:null}}function Zr(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=vr(e,Tt(t)),i=t.text.length>e.options.maxHighlightLength&&Ar(e.doc.mode,r.state),x=zn(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=x.styles,x.classes?t.styleClasses=x.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 vr(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new hr(r,!0,t);var x=Di(e,t,n),U=x>r.first&&rt(r,x-1).stateAfter,H=U?hr.fromSaved(r,U,x):new hr(r,Kn(r.mode),x);return r.iter(x,t,function(V){Vn(e,V.text,H);var X=H.line;V.stateAfter=X==t-1||X%5==0||X>=i.viewFrom&&X<i.viewTo?H.save():null,H.nextLine()}),n&&(r.modeFrontier=H.line),H}function Vn(e,t,n,r){var i=e.doc.mode,x=new kt(t,e.options.tabSize,n);for(x.start=x.pos=r||0,t==""&&Xn(i,n.state);!x.eol();)yr(i,x,n.state),x.start=x.pos}function Xn(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Hn(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function yr(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Hn(e,n).mode);var x=e.token(t,n);if(t.pos>t.start)return x}throw new Error("Mode "+e.name+" failed to advance stream.")}var Yn=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Li(e,t,n,r){var i=e.doc,x=i.mode,U;t=ft(i,t);var H=rt(i,t.line),V=vr(e,t.line,n),X=new kt(H.text,e.options.tabSize,V),re;for(r&&(re=[]);(r||X.pos<t.ch)&&!X.eol();)X.start=X.pos,U=yr(x,X,V.state),r&&re.push(new Yn(X,U,Ar(i.mode,V.state)));return r?re:new Yn(X,U,V.state)}function $n(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 br(e,t,n,r,i,x,U){var H=n.flattenSpans;H==null&&(H=e.options.flattenSpans);var V=0,X=null,re=new kt(t,e.options.tabSize,r),le,Ee=e.options.addModeClass&&[null];for(t==""&&$n(Xn(n,r.state),x);!re.eol();){if(re.pos>e.options.maxHighlightLength?(H=!1,U&&Vn(e,t,r,re.pos),re.pos=t.length,le=null):le=$n(yr(n,re,r.state,Ee),x),Ee){var be=Ee[0].name;be&&(le="m-"+(le?be+" "+le:be))}if(!H||X!=le){for(;V<re.start;)V=Math.min(re.start,V+5e3),i(V,X);X=le}re.start=re.pos}for(;V<re.pos;){var ke=Math.min(re.pos,V+5e3);i(ke,X),V=ke}}function Di(e,t,n){for(var r,i,x=e.doc,U=n?-1:t-(e.doc.mode.innerMode?1e3:100),H=t;H>U;--H){if(H<=x.first)return x.first;var V=rt(x,H-1),X=V.stateAfter;if(X&&(!n||H+(X instanceof bn?X.lookAhead:0)<=x.modeFrontier))return H;var re=K(V.text,null,e.options.tabSize);(i==null||r>re)&&(i=H-1,r=re)}return i}function aa(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=rt(e,r).stateAfter;if(i&&(!(i instanceof bn)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Qn=!1,$t=!1;function Wr(){Qn=!0}function oa(){$t=!0}function qr(e,t,n){this.marker=e,this.from=t,this.to=n}function Er(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 sa(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Ri(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var x=e[i],U=x.marker,H=x.from==null||(U.inclusiveLeft?x.from<=t:x.from<t);if(H||x.from==t&&U.type=="bookmark"&&(!n||!x.marker.insertLeft)){var V=x.to==null||(U.inclusiveRight?x.to>=t:x.to>t);(r||(r=[])).push(new qr(U,x.from,V?null:x.to))}}return r}function Oi(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var x=e[i],U=x.marker,H=x.to==null||(U.inclusiveRight?x.to>=t:x.to>t);if(H||x.from==t&&U.type=="bookmark"&&(!n||x.marker.insertLeft)){var V=x.from==null||(U.inclusiveLeft?x.from<=t:x.from<t);(r||(r=[])).push(new qr(U,V?null:x.from-t,x.to==null?null:x.to-t))}}return r}function En(e,t){if(t.full)return null;var n=_r(e,t.from.line)&&rt(e,t.from.line).markedSpans,r=_r(e,t.to.line)&&rt(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,x=t.to.ch,U=dt(t.from,t.to)==0,H=Ri(n,i,U),V=Oi(r,x,U),X=t.text.length==1,re=Y(t.text).length+(X?i:0);if(H)for(var le=0;le<H.length;++le){var Ee=H[le];if(Ee.to==null){var be=Er(V,Ee.marker);be?X&&(Ee.to=be.to==null?null:be.to+re):Ee.to=i}}if(V)for(var ke=0;ke<V.length;++ke){var Ie=V[ke];if(Ie.to!=null&&(Ie.to+=re),Ie.from==null){var je=Er(H,Ie.marker);je||(Ie.from=re,X&&(H||(H=[])).push(Ie))}else Ie.from+=re,X&&(H||(H=[])).push(Ie)}H&&(H=ki(H)),V&&V!=H&&(V=ki(V));var He=[H];if(!X){var Qe=t.text.length-2,Ke;if(Qe>0&&H)for(var Ze=0;Ze<H.length;++Ze)H[Ze].to==null&&(Ke||(Ke=[])).push(new qr(H[Ze].marker,null,null));for(var lt=0;lt<Qe;++lt)He.push(Ke);He.push(V)}return He}function ki(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 Pi(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(be){if(be.markedSpans)for(var ke=0;ke<be.markedSpans.length;++ke){var Ie=be.markedSpans[ke].marker;Ie.readOnly&&(!r||q(r,Ie)==-1)&&(r||(r=[])).push(Ie)}}),!r)return null;for(var i=[{from:t,to:n}],x=0;x<r.length;++x)for(var U=r[x],H=U.find(0),V=0;V<i.length;++V){var X=i[V];if(dt(X.to,H.from)<0||dt(X.from,H.to)>0)continue;var re=[V,1],le=dt(X.from,H.from),Ee=dt(X.to,H.to);(le<0||!U.inclusiveLeft&&!le)&&re.push({from:X.from,to:H.from}),(Ee>0||!U.inclusiveRight&&!Ee)&&re.push({from:H.to,to:X.to}),i.splice.apply(i,re),V+=re.length-3}return i}function la(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 xn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function en(e){return e.inclusiveLeft?-1:0}function tn(e){return e.inclusiveRight?1:0}function Tn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),x=dt(r.from,i.from)||en(e)-en(t);if(x)return-x;var U=dt(r.to,i.to)||tn(e)-tn(t);return U||t.id-e.id}function Mr(e,t){var n=$t&&e.markedSpans,r;if(n)for(var i=void 0,x=0;x<n.length;++x)i=n[x],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Tn(r,i.marker)<0)&&(r=i.marker);return r}function Ir(e){return Mr(e,!0)}function Fr(e){return Mr(e,!1)}function Sn(e,t){var n=$t&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var x=n[i];x.marker.collapsed&&(x.from==null||x.from<t)&&(x.to==null||x.to>t)&&(!r||Tn(r,x.marker)<0)&&(r=x.marker)}return r}function _i(e,t,n,r,i){var x=rt(e,t),U=$t&&x.markedSpans;if(U)for(var H=0;H<U.length;++H){var V=U[H];if(!V.marker.collapsed)continue;var X=V.marker.find(0),re=dt(X.from,n)||en(V.marker)-en(i),le=dt(X.to,r)||tn(V.marker)-tn(i);if(re>=0&&le<=0||re<=0&&le>=0)continue;if(re<=0&&(V.marker.inclusiveRight&&i.inclusiveLeft?dt(X.to,n)>=0:dt(X.to,n)>0)||re>=0&&(V.marker.inclusiveRight&&i.inclusiveLeft?dt(X.from,r)<=0:dt(X.from,r)<0))return!0}}function ur(e){for(var t;t=Ir(e);)e=t.find(-1,!0).line;return e}function Mi(e){for(var t;t=Fr(e);)e=t.find(1,!0).line;return e}function wn(e){for(var t,n;t=Fr(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Zn(e,t){var n=rt(e,t),r=ur(n);return n==r?t:Tt(r)}function Hr(e,t){if(t>e.lastLine())return t;var n=rt(e,t),r;if(!Lr(e,n))return t;for(;r=Fr(n);)n=r.find(1,!0).line;return Tt(n)+1}function Lr(e,t){var n=$t&&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&&qn(e,t,r))return!0}}function qn(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return qn(e,r.line,Er(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,x=0;x<t.markedSpans.length;++x)if(i=t.markedSpans[x],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&qn(e,t,i))return!0}function xr(e){e=ur(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 x=n.parent;x;n=x,x=n.parent)for(var U=0;U<x.children.length;++U){var H=x.children[U];if(H==n)break;t+=H.height}return t}function ei(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Ir(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Fr(r);){var x=n.find(0,!0);t-=r.text.length-x.from.ch,r=x.to.line,t+=r.text.length-x.to.ch}return t}function Ii(e){var t=e.display,n=e.doc;t.maxLine=rt(n,n.first),t.maxLineLength=ei(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=ei(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var rn=function(e,t,n){this.text=e,xn(this,t),this.height=n?n(this):1};rn.prototype.lineNo=function(){return Tt(this)},de(rn);function ua(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),la(e),xn(e,n);var i=r?r(e):1;i!=e.height&&Zt(e,i)}function nt(e){e.parent=null,la(e)}var ct={},st={};function mt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?st:ct;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Et(e,t){var n=g("span",null,null,k?"padding-right: .1px":null),r={pre:g("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 x=i?t.rest[i-1]:t.line,U=void 0;r.pos=0,r.addToken=vt,xt(e.display.measure)&&(U=Je(x,e.doc.direction))&&(r.addToken=qt(r.addToken,U)),r.map=[];var H=t!=e.display.externalMeasured&&Tt(x);Ur(x,r,Zr(e,x,H)),x.styleClasses&&(x.styleClasses.bgClass&&(r.bgClass=j(x.styleClasses.bgClass,r.bgClass||"")),x.styleClasses.textClass&&(r.textClass=j(x.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(it(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(k){var V=r.content.lastChild;(/\bcm-tab\b/.test(V.className)||V.querySelector&&V.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Re(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function Lt(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 vt(e,t,n,r,i,x,U){if(!t)return;var H=e.splitSpaces?Ut(t,e.trailingSpace):t,V=e.cm.state.specialChars,X=!1,re;if(!V.test(t))e.col+=t.length,re=document.createTextNode(H),e.map.push(e.pos,e.pos+t.length,re),B&&N<9&&(X=!0),e.pos+=t.length;else{re=document.createDocumentFragment();for(var le=0;;){V.lastIndex=le;var Ee=V.exec(t),be=Ee?Ee.index-le:t.length-le;if(be){var ke=document.createTextNode(H.slice(le,le+be));B&&N<9?re.appendChild(a("span",[ke])):re.appendChild(ke),e.map.push(e.pos,e.pos+be,ke),e.col+=be,e.pos+=be}if(!Ee)break;le+=be+1;var Ie=void 0;if(Ee[0]==" "){var je=e.cm.options.tabSize,He=je-e.col%je;Ie=re.appendChild(a("span",pe(He),"cm-tab")),Ie.setAttribute("role","presentation"),Ie.setAttribute("cm-text"," "),e.col+=He}else Ee[0]=="\r"||Ee[0]==`
|
|
`?(Ie=re.appendChild(a("span",Ee[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ie.setAttribute("cm-text",Ee[0]),e.col+=1):(Ie=e.cm.options.specialCharPlaceholder(Ee[0]),Ie.setAttribute("cm-text",Ee[0]),B&&N<9?re.appendChild(a("span",[Ie])):re.appendChild(Ie),e.col+=1);e.map.push(e.pos,e.pos+1,Ie),e.pos++}}if(e.trailingSpace=H.charCodeAt(t.length-1)==32,n||r||i||X||x||U){var Qe=n||"";r&&(Qe+=r),i&&(Qe+=i);var Ke=a("span",[re],Qe,x);if(U)for(var Ze in U)U.hasOwnProperty(Ze)&&Ze!="style"&&Ze!="class"&&Ke.setAttribute(Ze,U[Ze]);return e.content.appendChild(Ke)}e.content.appendChild(re)}function Ut(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var x=e.charAt(i);x==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(x="\xA0"),r+=x,n=x==" "}return r}function qt(e,t){return function(n,r,i,x,U,H,V){i=i?i+" cm-force-border":"cm-force-border";for(var X=n.pos,re=X+r.length;;){for(var le=void 0,Ee=0;Ee<t.length&&!(le=t[Ee],le.to>X&&le.from<=X);Ee++);if(le.to>=re)return e(n,r,i,x,U,H,V);e(n,r.slice(0,le.to-X),i,x,null,H,V),x=null,r=r.slice(le.to-X),X=le.to}}}function gt(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 Ur(e,t,n){var r=e.markedSpans,i=e.text,x=0;if(!r){for(var U=1;U<n.length;U+=2)t.addToken(t,i.slice(x,x=n[U]),mt(n[U+1],t.cm.options));return}for(var H=i.length,V=0,X=1,re="",le,Ee,be=0,ke,Ie,je,He,Qe;;){if(be==V){ke=Ie=je=Ee="",Qe=null,He=null,be=Infinity;for(var Ke=[],Ze=void 0,lt=0;lt<r.length;++lt){var at=r[lt],pt=at.marker;if(pt.type=="bookmark"&&at.from==V&&pt.widgetNode)Ke.push(pt);else if(at.from<=V&&(at.to==null||at.to>V||pt.collapsed&&at.to==V&&at.from==V)){if(at.to!=null&&at.to!=V&&be>at.to&&(be=at.to,Ie=""),pt.className&&(ke+=" "+pt.className),pt.css&&(Ee=(Ee?Ee+";":"")+pt.css),pt.startStyle&&at.from==V&&(je+=" "+pt.startStyle),pt.endStyle&&at.to==be&&(Ze||(Ze=[])).push(pt.endStyle,at.to),pt.title&&((Qe||(Qe={})).title=pt.title),pt.attributes)for(var Dt in pt.attributes)(Qe||(Qe={}))[Dt]=pt.attributes[Dt];pt.collapsed&&(!He||Tn(He.marker,pt)<0)&&(He=at)}else at.from>V&&be>at.from&&(be=at.from)}if(Ze)for(var Ht=0;Ht<Ze.length;Ht+=2)Ze[Ht+1]==be&&(Ie+=" "+Ze[Ht]);if(!He||He.from==V)for(var Ot=0;Ot<Ke.length;++Ot)gt(t,0,Ke[Ot]);if(He&&(He.from||0)==V){if(gt(t,(He.to==null?H+1:He.to)-V,He.marker,He.from==null),He.to==null)return;He.to==V&&(He=!1)}}if(V>=H)break;for(var sr=Math.min(H,be);;){if(re){var nr=V+re.length;if(!He){var Mt=nr>sr?re.slice(0,sr-V):re;t.addToken(t,Mt,le?le+ke:ke,je,V+Mt.length==be?Ie:"",Ee,Qe)}if(nr>=sr){re=re.slice(sr-V),V=sr;break}V=nr,je=""}re=i.slice(x,x=n[X++]),le=mt(n[X++],t.cm.options)}}}function St(e,t,n){this.line=t,this.rest=wn(t),this.size=this.rest?Tt(Y(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Lr(e,t)}function er(e,t,n){for(var r=[],i,x=t;x<n;x=i){var U=new St(e.doc,rt(e.doc,x),x);i=x+U.size,r.push(U)}return r}var Vt=null;function pr(e){Vt?Vt.ops.push(e):e.ownsGroup=Vt={ops:[e],delayedCallbacks:[]}}function Os(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 ks(e,t){var n=e.ownsGroup;if(!n)return;try{Os(n)}finally{Vt=null,t(n)}}var ti=null;function Gt(e,t){var n=qe(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Vt?i=Vt.delayedCallbacks:ti?i=ti:(i=ti=[],setTimeout(Ps,0));for(var x=function(H){i.push(function(){return n[H].apply(null,r)})},U=0;U<n.length;++U)x(U)}function Ps(){var e=ti;ti=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,n,r){for(var i=0;i<t.changes.length;i++){var x=t.changes[i];x=="text"?Ms(e,t):x=="gutter"?Qa(e,t,n,r):x=="class"?da(e,t):x=="widget"&&Is(e,t,r)}t.changes=null}function ri(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),B&&N<8&&(e.node.style.zIndex=2)),e.node}function _s(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=ri(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Et(e,t)}function Ms(e,t){var n=t.text.className,r=$a(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,da(e,t)):n&&(t.text.className=n)}function da(e,t){_s(e,t),t.line.wrapClass?ri(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 Qa(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=ri(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 x=t.line.gutterMarkers;if(e.options.lineNumbers||x){var U=ri(t),H=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(H),U.insertBefore(H,t.text),t.line.gutterClass&&(H.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!x||!x["CodeMirror-linenumbers"])&&(t.lineNumber=H.appendChild(a("div",mn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),x)for(var V=0;V<e.display.gutterSpecs.length;++V){var X=e.display.gutterSpecs[V].className,re=x.hasOwnProperty(X)&&x[X];re&&H.appendChild(a("div",[re],"CodeMirror-gutter-elt","left: "+r.gutterLeft[X]+"px; width: "+r.gutterWidth[X]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=b("CodeMirror-linewidget"),i=t.node.firstChild,x=void 0;i;i=x)x=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Ja(e,t,n)}function Fs(e,t,n,r){var i=$a(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),da(e,t),Qa(e,t,n,r),Ja(e,t,r),t.node}function Ja(e,t,n){if(Za(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Za(e,t.rest[r],t,n,!1)}function Za(e,t,n,r,i){if(!t.widgets)return;for(var x=ri(n),U=0,H=t.widgets;U<H.length;++U){var V=H[U],X=a("div",[V.node],"CodeMirror-linewidget"+(V.className?" "+V.className:""));V.handleMouseEvents||X.setAttribute("cm-ignore-events","true"),Us(V,X,n,r),e.display.input.setUneditable(X),i&&V.above?x.insertBefore(X,n.gutter||n.text):x.appendChild(X),Gt(V,"redraw")}}function Us(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 ni(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!y(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;"),l(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Nr(e,t){for(var n=fe(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 Fi(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=l(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 Dr(e){return ne-e.display.nativeBarWidth}function nn(e){return e.display.scroller.clientWidth-Dr(e)-e.display.barWidth}function fa(e){return e.display.scroller.clientHeight-Dr(e)-e.display.barHeight}function Ns(e,t,n){var r=e.options.lineWrapping,i=r&&nn(e);if(!t.measure.heights||r&&t.measure.width!=i){var x=t.measure.heights=[];if(r){t.measure.width=i;for(var U=t.text.firstChild.getClientRects(),H=0;H<U.length-1;H++){var V=U[H],X=U[H+1];Math.abs(V.bottom-X.bottom)>2&&x.push((V.bottom+X.top)/2-n.top)}}x.push(n.bottom-n.top)}}function eo(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(Tt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=ur(t);var n=Tt(t),r=e.display.externalMeasured=new St(e.doc,t,n);r.lineN=n;var i=r.built=Et(e,r);return r.text=i.pre,l(e.display.lineMeasure,i.pre),r}function to(e,t,n,r){return Rr(e,Cn(e,t),n,r)}function ha(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[sn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Cn(e,t){var n=Tt(t),r=ha(e,n);r&&!r.text?r=null:r&&r.changes&&(Ya(e,r,n,ba(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=eo(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Rr(e,t,n,r,i){t.before&&(n=-1);var x=n+(r||""),U;return t.cache.hasOwnProperty(x)?U=t.cache[x]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ns(e,t.view,t.rect),t.hasHeights=!0),U=Ws(e,t,n,r),U.bogus||(t.cache[x]=U)),{left:U.left,right:U.right,top:i?U.rtop:U.top,bottom:i?U.rbottom:U.bottom}}var ro={left:0,right:0,top:0,bottom:0};function no(e,t,n){for(var r,i,x,U,H,V,X=0;X<e.length;X+=3)if(H=e[X],V=e[X+1],t<H?(i=0,x=1,U="left"):t<V?(i=t-H,x=i+1):(X==e.length-3||t==V&&e[X+3]>t)&&(x=V-H,i=x-1,t>=V&&(U="right")),i!=null){if(r=e[X+2],H==V&&n==(r.insertLeft?"left":"right")&&(U=n),n=="left"&&i==0)for(;X&&e[X-2]==e[X-3]&&e[X-1].insertLeft;)r=e[(X-=3)+2],U="left";if(n=="right"&&i==V-H)for(;X<e.length-3&&e[X+3]==e[X+4]&&!e[X+5].insertLeft;)r=e[(X+=3)+2],U="right";break}return{node:r,start:i,end:x,collapse:U,coverStart:H,coverEnd:V}}function js(e,t){var n=ro;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 Ws(e,t,n,r){var i=no(t.map,n,r),x=i.node,U=i.start,H=i.end,V=i.collapse,X;if(x.nodeType==3){for(var re=0;re<4;re++){for(;U&&De(t.line.text.charAt(i.coverStart+U));)--U;for(;i.coverStart+H<i.coverEnd&&De(t.line.text.charAt(i.coverStart+H));)++H;if(B&&N<9&&U==0&&H==i.coverEnd-i.coverStart?X=x.parentNode.getBoundingClientRect():X=js(m(x,U,H).getClientRects(),r),X.left||X.right||U==0)break;H=U,U=U-1,V="right"}B&&N<11&&(X=Hs(e.display.measure,X))}else{U>0&&(V=r="right");var le;e.options.lineWrapping&&(le=x.getClientRects()).length>1?X=le[r=="right"?le.length-1:0]:X=x.getBoundingClientRect()}if(B&&N<9&&!U&&(!X||!X.left&&!X.right)){var Ee=x.parentNode.getClientRects()[0];Ee?X={left:Ee.left,right:Ee.left+Ln(e.display),top:Ee.top,bottom:Ee.bottom}:X=ro}for(var be=X.top-t.rect.top,ke=X.bottom-t.rect.top,Ie=(be+ke)/2,je=t.view.measure.heights,He=0;He<je.length-1&&!(Ie<je[He]);He++);var Qe=He?je[He-1]:0,Ke=je[He],Ze={left:(V=="right"?X.right:X.left)-t.rect.left,right:(V=="left"?X.left:X.right)-t.rect.left,top:Qe,bottom:Ke};return!X.left&&!X.right&&(Ze.bogus=!0),e.options.singleCursorHeightPerLine||(Ze.rtop=be,Ze.rbottom=ke),Ze}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Bt(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 io(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function ao(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)io(e.display.view[t])}function ii(e){ao(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function oo(){return v&&u?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return v&&u?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=ni(e.widgets[n]));return t}function Ui(e,t,n,r,i){if(!i){var x=pa(t);n.top+=x,n.bottom+=x}if(r=="line")return n;r||(r="local");var U=xr(t);if(r=="local"?U+=Fi(e.display):U-=e.display.viewOffset,r=="page"||r=="window"){var H=e.display.lineSpace.getBoundingClientRect();U+=H.top+(r=="window"?0:so());var V=H.left+(r=="window"?0:oo());n.left+=V,n.right+=V}return n.top+=U,n.bottom+=U,n}function lo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=oo(),i-=so();else if(n=="local"||!n){var x=e.display.sizer.getBoundingClientRect();r+=x.left,i+=x.top}var U=e.display.lineSpace.getBoundingClientRect();return{left:r-U.left,top:i-U.top}}function ma(e,t,n,r,i){return r||(r=rt(e.doc,t.line)),Ui(e,r,to(e,r,t.ch,i),n)}function Tr(e,t,n,r,i,x){r=r||rt(e.doc,t.line),i||(i=Cn(e,r));function U(ke,Ie){var je=Rr(e,i,ke,Ie?"right":"left",x);return Ie?je.left=je.right:je.right=je.left,Ui(e,r,je,n)}var H=Je(r,e.doc.direction),V=t.ch,X=t.sticky;if(V>=r.text.length?(V=r.text.length,X="before"):V<=0&&(V=0,X="after"),!H)return U(X=="before"?V-1:V,X=="before");function re(ke,Ie,je){var He=H[Ie],Qe=He.level==1;return U(je?ke-1:ke,Qe!=je)}var le=Ge(H,V,X),Ee=We,be=re(V,le,X=="before");return Ee!=null&&(be.other=re(V,Ee,X!="before")),be}function uo(e,t){var n=0;t=ft(e.doc,t),e.options.lineWrapping||(n=Ln(e.display)*t.ch);var r=rt(e.doc,t.line),i=xr(r)+Fi(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function ga(e,t,n,r,i){var x=Ne(e,t,n);return x.xRel=i,r&&(x.outside=r),x}function va(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return ga(r.first,0,null,-1,-1);var i=gr(r,n),x=r.first+r.size-1;if(i>x)return ga(r.first+r.size-1,rt(r,x).text.length,null,1,1);t<0&&(t=0);for(var U=rt(r,i);;){var H=Ks(e,U,i,t,n),V=Sn(U,H.ch+(H.xRel>0||H.outside>0?1:0));if(!V)return H;var X=V.find(1);if(X.line==i)return X;U=rt(r,i=X.line)}}function co(e,t,n,r){r-=pa(t);var i=t.text.length,x=Ue(function(U){return Rr(e,n,U-1).bottom<=r},i,0);return i=Ue(function(U){return Rr(e,n,U).top>r},x,i),{begin:x,end:i}}function fo(e,t,n,r){n||(n=Cn(e,t));var i=Ui(e,t,Rr(e,n,r),"line").top;return co(e,t,n,i)}function ya(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,i){i-=xr(t);var x=Cn(e,t),U=pa(t),H=0,V=t.text.length,X=!0,re=Je(t,e.doc.direction);if(re){var le=(e.options.lineWrapping?zs:Gs)(e,t,n,x,re,r,i);X=le.level!=1,H=X?le.from:le.to-1,V=X?le.to:le.from-1}var Ee=null,be=null,ke=Ue(function(lt){var at=Rr(e,x,lt);return at.top+=U,at.bottom+=U,ya(at,r,i,!1)?(at.top<=i&&at.left<=r&&(Ee=lt,be=at),!0):!1},H,V),Ie,je,He=!1;if(be){var Qe=r-be.left<be.right-r,Ke=Qe==X;ke=Ee+(Ke?0:1),je=Ke?"after":"before",Ie=Qe?be.left:be.right}else{!X&&(ke==V||ke==H)&&ke++,je=ke==0?"after":ke==t.text.length?"before":Rr(e,x,ke-(X?1:0)).bottom+U<=i==X?"after":"before";var Ze=Tr(e,Ne(n,ke,je),"line",t,x);Ie=Ze.left,He=i<Ze.top?-1:i>=Ze.bottom?1:0}return ke=Le(t.text,ke,1),ga(n,ke,je,He,r-Ie)}function Gs(e,t,n,r,i,x,U){var H=Ue(function(le){var Ee=i[le],be=Ee.level!=1;return ya(Tr(e,Ne(n,be?Ee.to:Ee.from,be?"before":"after"),"line",t,r),x,U,!0)},0,i.length-1),V=i[H];if(H>0){var X=V.level!=1,re=Tr(e,Ne(n,X?V.from:V.to,X?"after":"before"),"line",t,r);ya(re,x,U,!0)&&re.top>U&&(V=i[H-1])}return V}function zs(e,t,n,r,i,x,U){var H=co(e,t,r,U),V=H.begin,X=H.end;/\s/.test(t.text.charAt(X-1))&&X--;for(var re=null,le=null,Ee=0;Ee<i.length;Ee++){var be=i[Ee];if(be.from>=X||be.to<=V)continue;var ke=be.level!=1,Ie=Rr(e,r,ke?Math.min(X,be.to)-1:Math.max(V,be.from)).right,je=Ie<x?x-Ie+1e9:Ie-x;(!re||le>je)&&(re=be,le=je)}return re||(re=i[i.length-1]),re.from<V&&(re={from:V,to:re.to,level:re.level}),re.to>X&&(re={from:re.from,to:X,level:re.level}),re}var an;function An(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(an==null){an=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)an.appendChild(document.createTextNode("x")),an.appendChild(a("br"));an.appendChild(document.createTextNode("x"))}l(e.measure,an);var n=an.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function Ln(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");l(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function ba(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,x=t.gutters.firstChild,U=0;x;x=x.nextSibling,++U){var H=e.display.gutterSpecs[U].className;n[H]=x.offsetLeft+x.clientLeft+i,r[H]=x.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ho(e){var t=An(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Ln(e.display)-3);return function(i){if(Lr(e.doc,i))return 0;var x=0;if(i.widgets)for(var U=0;U<i.widgets.length;U++)i.widgets[U].height&&(x+=i.widgets[U].height);return n?x+(Math.ceil(i.text.length/r)||1)*t:x+t}}function xa(e){var t=e.doc,n=ho(e);t.iter(function(r){var i=n(r);i!=r.height&&Zt(r,i)})}function on(e,t,n,r){var i=e.display;if(!n&&fe(t).getAttribute("cm-not-content")=="true")return null;var x,U,H=i.lineSpace.getBoundingClientRect();try{x=t.clientX-H.left,U=t.clientY-H.top}catch(le){return null}var V=va(e,x,U),X;if(r&&V.xRel>0&&(X=rt(e.doc,V.line).text).length==V.ch){var re=K(X,X.length,e.options.tabSize)-X.length;V=Ne(V.line,Math.max(0,Math.round((x-qa(e.display).left)/Ln(e.display))-re))}return V}function sn(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 tr(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)$t&&Zn(e.doc,t)<i.viewTo&&Gr(e);else if(n<=i.viewFrom)$t&&Hr(e.doc,n+r)>i.viewFrom?Gr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Gr(e);else if(t<=i.viewFrom){var x=Ni(e,n,n+r,1);x?(i.view=i.view.slice(x.index),i.viewFrom=x.lineN,i.viewTo+=r):Gr(e)}else if(n>=i.viewTo){var U=Ni(e,t,t,-1);U?(i.view=i.view.slice(0,U.index),i.viewTo=U.lineN):Gr(e)}else{var H=Ni(e,t,t,-1),V=Ni(e,n,n+r,1);H&&V?(i.view=i.view.slice(0,H.index).concat(er(e,H.lineN,V.lineN)).concat(i.view.slice(V.index)),i.viewTo+=r):Gr(e)}var X=i.externalMeasured;X&&(n<X.lineN?X.lineN+=r:t<X.lineN+X.size&&(i.externalMeasured=null))}function Kr(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 x=r.view[sn(e,t)];if(x.node==null)return;var U=x.changes||(x.changes=[]);q(U,n)==-1&&U.push(n)}function Gr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ni(e,t,n,r){var i=sn(e,t),x,U=e.display.view;if(!$t||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var H=e.display.viewFrom,V=0;V<i;V++)H+=U[V].size;if(H!=t){if(r>0){if(i==U.length-1)return null;x=H+U[i].size-t,i++}else x=H-t;t+=x,n+=x}for(;Zn(e.doc,n)!=n;){if(i==(r<0?0:U.length-1))return null;n+=r*U[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=er(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=er(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(sn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(er(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,sn(e,n)))),r.viewTo=n}function po(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 ai(e){e.display.input.showSelection(e.display.input.prepareSelection())}function mo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),x=r.selection=document.createDocumentFragment(),U=0;U<n.sel.ranges.length;U++){if(!t&&U==n.sel.primIndex)continue;var H=n.sel.ranges[U];if(H.from().line>=e.display.viewTo||H.to().line<e.display.viewFrom)continue;var V=H.empty();(V||e.options.showCursorWhenSelecting)&&go(e,H.head,i),V||Xs(e,H,x)}return r}function go(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 x=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));x.style.display="",x.style.left=r.other.left+"px",x.style.top=r.other.top+"px",x.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Bi(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,x=document.createDocumentFragment(),U=qa(e.display),H=U.left,V=Math.max(r.sizerWidth,nn(e)-r.sizer.offsetLeft)-U.right,X=i.direction=="ltr";function re(Ke,Ze,lt,at){Ze<0&&(Ze=0),Ze=Math.round(Ze),at=Math.round(at),x.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Ke+`px;
|
|
top: `+Ze+"px; width: "+(lt==null?V-Ke:lt)+`px;
|
|
height: `+(at-Ze)+"px"))}function le(Ke,Ze,lt){var at=rt(i,Ke),pt=at.text.length,Dt,Ht;function Ot(Mt,ir){return ma(e,Ne(Ke,Mt),"div",at,ir)}function sr(Mt,ir,zt){var Nt=fo(e,at,null,Mt),It=ir=="ltr"==(zt=="after")?"left":"right",Pt=zt=="after"?Nt.begin:Nt.end-(/\s/.test(at.text.charAt(Nt.end-1))?2:1);return Ot(Pt,It)[It]}var nr=Je(at,i.direction);return Ve(nr,Ze||0,lt==null?pt:lt,function(Mt,ir,zt,Nt){var It=zt=="ltr",Pt=Ot(Mt,It?"left":"right"),ar=Ot(ir-1,It?"right":"left"),jn=Ze==null&&Mt==0,Qr=lt==null&&ir==pt,Yt=Nt==0,Or=!nr||Nt==nr.length-1;if(ar.top-Pt.top<=3){var Kt=(X?jn:Qr)&&Yt,Va=(X?Qr:jn)&&Or,jr=Kt?H:(It?Pt:ar).left,fn=Va?V:(It?ar:Pt).right;re(jr,Pt.top,fn-jr,Pt.bottom)}else{var hn,Jt,Wn,Xa;It?(hn=X&&jn&&Yt?H:Pt.left,Jt=X?V:sr(Mt,zt,"before"),Wn=X?H:sr(ir,zt,"after"),Xa=X&&Qr&&Or?V:ar.right):(hn=X?sr(Mt,zt,"before"):H,Jt=!X&&jn&&Yt?V:Pt.right,Wn=!X&&Qr&&Or?H:ar.left,Xa=X?sr(ir,zt,"after"):V),re(hn,Pt.top,Jt-hn,Pt.bottom),Pt.bottom<ar.top&&re(H,Pt.bottom,null,ar.top),re(Wn,ar.top,Xa-Wn,ar.bottom)}(!Dt||Bi(Pt,Dt)<0)&&(Dt=Pt),Bi(ar,Dt)<0&&(Dt=ar),(!Ht||Bi(Pt,Ht)<0)&&(Ht=Pt),Bi(ar,Ht)<0&&(Ht=ar)}),{start:Dt,end:Ht}}var Ee=t.from(),be=t.to();if(Ee.line==be.line)le(Ee.line,Ee.ch,be.ch);else{var ke=rt(i,Ee.line),Ie=rt(i,be.line),je=ur(ke)==ur(Ie),He=le(Ee.line,Ee.ch,je?ke.text.length+1:null).end,Qe=le(be.line,je?0:null,be.ch).start;je&&(He.top<Qe.top-2?(re(He.right,He.top,null,He.bottom),re(H,Qe.top,Qe.left,Qe.bottom)):re(He.right,He.top,Qe.left-He.right,He.bottom)),He.bottom<Qe.top&&re(H,He.bottom,null,Qe.top)}n.appendChild(x)}function Ta(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()||Dn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function vo(e){e.state.focused||(e.display.input.focus(),Sa(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Dn(e))},100)}function Sa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Re(e,"focus",e,t),e.state.focused=!0,F(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),k&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ta(e)}function Dn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Re(e,"blur",e,t),e.state.focused=!1,f(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function ji(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],x=e.options.lineWrapping,U=void 0,H=0;if(i.hidden)continue;if(B&&N<8){var V=i.node.offsetTop+i.node.offsetHeight;U=V-n,n=V}else{var X=i.node.getBoundingClientRect();U=X.bottom-X.top,!x&&i.text.firstChild&&(H=i.text.firstChild.getBoundingClientRect().right-X.left-1)}var re=i.line.height-U;if((re>.005||re<-.005)&&(Zt(i.line,U),bo(i.line),i.rest))for(var le=0;le<i.rest.length;le++)bo(i.rest[le]);if(H>e.display.sizerWidth){var Ee=Math.ceil(H/Ln(e.display));Ee>e.display.maxLineLength&&(e.display.maxLineLength=Ee,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function bo(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 Wi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Fi(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,x=gr(t,r),U=gr(t,i);if(n&&n.ensure){var H=n.ensure.from.line,V=n.ensure.to.line;H<x?(x=H,U=gr(t,xr(rt(t,H))+e.wrapper.clientHeight)):Math.min(V,t.lastLine())>=U&&(x=gr(t,xr(rt(t,V))-e.wrapper.clientHeight),U=V)}return{from:x,to:Math.max(U,x+1)}}function Ys(e,t){if(Fe(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&&!T){var x=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Fi(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Dr(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(x),x.scrollIntoView(i),e.display.lineSpace.removeChild(x)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Ne(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Ne(t.line,t.ch+1,"before"):t);for(var x=0;x<5;x++){var U=!1,H=Tr(e,t),V=!n||n==t?H:Tr(e,n);i={left:Math.min(H.left,V.left),top:Math.min(H.top,V.top)-r,right:Math.max(H.left,V.left),bottom:Math.max(H.bottom,V.bottom)+r};var X=wa(e,i),re=e.doc.scrollTop,le=e.doc.scrollLeft;if(X.scrollTop!=null&&(si(e,X.scrollTop),Math.abs(e.doc.scrollTop-re)>1&&(U=!0)),X.scrollLeft!=null&&(ln(e,X.scrollLeft),Math.abs(e.doc.scrollLeft-le)>1&&(U=!0)),!U)break}return i}function Qs(e,t){var n=wa(e,t);n.scrollTop!=null&&si(e,n.scrollTop),n.scrollLeft!=null&&ln(e,n.scrollLeft)}function wa(e,t){var n=e.display,r=An(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,x=fa(e),U={};t.bottom-t.top>x&&(t.bottom=t.top+x);var H=e.doc.height+ca(n),V=t.top<r,X=t.bottom>H-r;if(t.top<i)U.scrollTop=V?0:t.top;else if(t.bottom>i+x){var re=Math.min(t.top,(X?H:t.bottom)-x);re!=i&&(U.scrollTop=re)}var le=e.options.fixedGutter?0:n.gutters.offsetWidth,Ee=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-le,be=nn(e)-n.gutters.offsetWidth,ke=t.right-t.left>be;return ke&&(t.right=t.left+be),t.left<10?U.scrollLeft=0:t.left<Ee?U.scrollLeft=Math.max(0,t.left+le-(ke?0:10)):t.right>be+Ee-3&&(U.scrollLeft=t.right+(ke?0:10)-be),U}function Ca(e,t){if(t==null)return;Hi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Rn(e){Hi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function oi(e,t,n){(t!=null||n!=null)&&Hi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Js(e,t){Hi(e),e.curOp.scrollToPos=t}function Hi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=uo(e,t.from),r=uo(e,t.to);Eo(e,n,r,t.margin)}}function Eo(e,t,n,r){var i=wa(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});oi(e,i.scrollLeft,i.scrollTop)}function si(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;L||La(e,{top:t}),xo(e,t,!0),L&&La(e),di(e,100)}function xo(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 ln(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,Ao(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function li(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ca(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+Dr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var un=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),Ce(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ce(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,B&&N<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};un.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 x=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+x)+"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}},un.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},un.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},un.prototype.zeroWidthHack=function(){var e=s&&!C?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new $,this.disableVert=new $},un.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),x=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);x!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},un.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ui=function(){};ui.prototype.update=function(){return{bottom:0,right:0}},ui.prototype.setScrollLeft=function(){},ui.prototype.setScrollTop=function(){},ui.prototype.clear=function(){};function On(e,t){t||(t=li(e));var n=e.display.barWidth,r=e.display.barHeight;To(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&ji(e),To(e,li(e)),n=e.display.barWidth,r=e.display.barHeight}function To(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 So={native:un,null:ui};function wo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&f(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new So[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ce(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"?ln(e,t):si(e,t)},e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function dn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs},pr(e.curOp)}function cn(e){var t=e.curOp;t&&ks(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var i=0;i<t.length;i++)rl(t[i]);for(var x=0;x<t.length;x++)nl(t[x]);for(var U=0;U<t.length;U++)il(t[U])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&Ii(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 Ki(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Aa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&ji(t),e.barMeasure=li(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=to(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+Dr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-nn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&ln(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==M();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&On(t,e.barMeasure),e.updatedDisplay&&Ra(t,e.barMeasure),e.selectionChanged&&Ta(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&vo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Co(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&xo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&ln(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,ft(r,e.scrollToPos.from),ft(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var x=e.maybeHiddenMarkers,U=e.maybeUnhiddenMarkers;if(x)for(var H=0;H<x.length;++H)x[H].lines.length||Re(x[H],"hide");if(U)for(var V=0;V<U.length;++V)U[V].lines.length&&Re(U[V],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Re(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function or(e,t){if(e.curOp)return t();dn(e);try{return t()}finally{cn(e)}}function jt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);dn(e);try{return t.apply(e,arguments)}finally{cn(e)}}}function Qt(e){return function(){if(this.curOp)return e.apply(this,arguments);dn(this);try{return e.apply(this,arguments)}finally{cn(this)}}}function Wt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);dn(t);try{return e.apply(this,arguments)}finally{cn(t)}}}function di(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,O(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=vr(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(x){if(r.line>=e.display.viewFrom){var U=x.styles,H=x.text.length>e.options.maxHighlightLength?Ar(t.mode,r.state):null,V=zn(e,x,r,!0);H&&(r.state=H),x.styles=V.styles;var X=x.styleClasses,re=V.classes;re?x.styleClasses=re:X&&(x.styleClasses=null);for(var le=!U||U.length!=x.styles.length||X!=re&&(!X||!re||X.bgClass!=re.bgClass||X.textClass!=re.textClass),Ee=0;!le&&Ee<U.length;++Ee)le=U[Ee]!=x.styles[Ee];le&&i.push(r.line),x.stateAfter=r.save(),r.nextLine()}else x.text.length<=e.options.maxHighlightLength&&Vn(e,x.text,r),x.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return di(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&or(e,function(){for(var x=0;x<i.length;x++)Kr(e,i[x],"text")})}var Ki=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Wi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=nn(e),this.force=n,this.dims=ba(e),this.events=[]};Ki.prototype.signal=function(e,t){ue(e,t)&&this.events.push(arguments)},Ki.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Re.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Dr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Dr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=M();if(!t||!y(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&y(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==M())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&y(document.body,e.anchorNode)&&y(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 Aa(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Gr(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&&po(e)==0)return!1;Lo(e)&&(Gr(e),t.dims=ba(e));var i=r.first+r.size,x=Math.max(t.visible.from-e.options.viewportMargin,r.first),U=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<x&&x-n.viewFrom<20&&(x=Math.max(r.first,n.viewFrom)),n.viewTo>U&&n.viewTo-U<20&&(U=Math.min(i,n.viewTo)),$t&&(x=Zn(e.doc,x),U=Hr(e.doc,U));var H=x!=n.viewFrom||U!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,x,U),n.viewOffset=xr(rt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var V=po(e);if(!H&&V==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var X=sl(e);return V>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),V>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(X),c(n.cursorDiv),c(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,H&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,di(e,400)),n.updateLineNumbers=null,!0}function Co(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==nn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ca(e.display)-fa(e),n.top)}),t.visible=Wi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Wi(e.display,e.doc,n));if(!Aa(e,t))break;ji(e);var i=li(e);ai(e),On(e,i),Ra(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 La(e,t){var n=new Ki(e,t);if(Aa(e,n)){ji(e),Co(e,n);var r=li(e);ai(e),On(e,r),Ra(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,x=r.lineDiv,U=x.firstChild;function H(ke){var Ie=ke.nextSibling;return k&&s&&e.display.currentWheelTarget==ke?ke.style.display="none":ke.parentNode.removeChild(ke),Ie}for(var V=r.view,X=r.viewFrom,re=0;re<V.length;re++){var le=V[re];if(!le.hidden)if(!le.node||le.node.parentNode!=x){var Ee=Fs(e,le,X,n);x.insertBefore(Ee,U)}else{for(;U!=le.node;)U=H(U);var be=i&&t!=null&&t<=X&&le.lineNumber;le.changes&&(q(le.changes,"gutter")>-1&&(be=!1),Ya(e,le,X,n)),be&&(c(le.lineNumber),le.lineNumber.appendChild(document.createTextNode(mn(e.options,X)))),U=le.node.nextSibling}X+=le.size}for(;U;)U=H(U)}function Da(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ra(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+Dr(e)+"px"}function Ao(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,x=r+"px",U=0;U<n.length;U++)if(!n[U].hidden){e.options.fixedGutter&&(n[U].gutter&&(n[U].gutter.style.left=x),n[U].gutterBackground&&(n[U].gutterBackground.style.left=x));var H=n[U].alignable;if(H)for(var V=0;V<H.length;V++)H[V].style.left=x}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Lo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=mn(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")),x=i.firstChild.offsetWidth,U=i.offsetWidth-x;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(x,r.lineGutter.offsetWidth-U)+1,r.lineNumWidth=r.lineNumInnerWidth+U,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Da(e.display),!0}return!1}function Oa(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var x=e[i],U=null;if(typeof x!="string"&&(U=x.style,x=x.className),x=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:x,style:U})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Do(e){var t=e.gutters,n=e.gutterSpecs;c(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],x=i.className,U=i.style,H=t.appendChild(a("div",null,"CodeMirror-gutter "+x));U&&(H.style.cssText=U),x=="CodeMirror-linenumbers"&&(e.lineGutter=H,H.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Da(e)}function ci(e){Do(e.display),tr(e),Ao(e)}function dl(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=g("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=g("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var x=g("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[x],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+ne+"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"),B&&N<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!k&&!(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=Oa(r.gutters,r.lineNumbers),Do(i),n.init(i)}var Gi=0,dr=null;B?dr=-.53:L?dr=15:v?dr=-.7:R&&(dr=-1/3);function Ro(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 cl(e){var t=Ro(e);return t.x*=dr,t.y*=dr,t}function Oo(e,t){var n=Ro(t),r=n.x,i=n.y,x=e.display,U=x.scroller,H=U.scrollWidth>U.clientWidth,V=U.scrollHeight>U.clientHeight;if(!(r&&H||i&&V))return;if(i&&s&&k){e:for(var X=t.target,re=x.view;X!=U;X=X.parentNode)for(var le=0;le<re.length;le++)if(re[le].node==X){e.display.currentWheelTarget=X;break e}}if(r&&!L&&!w&&dr!=null){i&&V&&si(e,Math.max(0,U.scrollTop+i*dr)),ln(e,Math.max(0,U.scrollLeft+r*dr)),(!i||i&&V)&&Q(t),x.wheelStartX=null;return}if(i&&dr!=null){var Ee=i*dr,be=e.doc.scrollTop,ke=be+x.wrapper.clientHeight;Ee<0?be=Math.max(0,be+Ee-50):ke=Math.min(e.doc.height,ke+Ee+50),La(e,{top:be,bottom:ke})}Gi<20&&(x.wheelStartX==null?(x.wheelStartX=U.scrollLeft,x.wheelStartY=U.scrollTop,x.wheelDX=r,x.wheelDY=i,setTimeout(function(){if(x.wheelStartX==null)return;var Ie=U.scrollLeft-x.wheelStartX,je=U.scrollTop-x.wheelStartY,He=je&&x.wheelDY&&je/x.wheelDY||Ie&&x.wheelDX&&Ie/x.wheelDX;if(x.wheelStartX=x.wheelStartY=null,!He)return;dr=(dr*Gi+He)/(Gi+1),++Gi},200)):(x.wheelDX+=r,x.wheelDY+=i))}var cr=function(e,t){this.ranges=e,this.primIndex=t};cr.prototype.primary=function(){return this.ranges[this.primIndex]},cr.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(!Gn(n.anchor,r.anchor)||!Gn(n.head,r.head))return!1}return!0},cr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new wt(gn(this.ranges[t].anchor),gn(this.ranges[t].head));return new cr(e,this.primIndex)},cr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},cr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(dt(t,r.from())>=0&&dt(e,r.to())<=0)return n}return-1};var wt=function(e,t){this.anchor=e,this.head=t};wt.prototype.from=function(){return Jr(this.anchor,this.head)},wt.prototype.to=function(){return vn(this.anchor,this.head)},wt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Sr(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(Ee,be){return dt(Ee.from(),be.from())}),n=q(t,i);for(var x=1;x<t.length;x++){var U=t[x],H=t[x-1],V=dt(H.to(),U.from());if(r&&!U.empty()?V>0:V>=0){var X=Jr(H.from(),U.from()),re=vn(H.to(),U.to()),le=H.empty()?U.from()==U.head:H.from()==H.head;x<=n&&--n,t.splice(--x,2,new wt(le?re:X,le?X:re))}}return new cr(t,n)}function zr(e,t){return new cr([new wt(e,t||e)],0)}function Vr(e){return e.text?Ne(e.from.line+e.text.length-1,Y(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function ko(e,t){if(dt(e,t.from)<0)return e;if(dt(e,t.to)<=0)return Vr(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+=Vr(t).ch-t.to.ch),Ne(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 wt(ko(i.anchor,t),ko(i.head,t)))}return Sr(e.cm,n,e.sel.primIndex)}function Po(e,t,n){return e.line==t.line?Ne(n.line,e.ch-t.ch+n.ch):Ne(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Ne(e.first,0),x=i,U=0;U<t.length;U++){var H=t[U],V=Po(H.from,i,x),X=Po(Vr(H),i,x);if(i=H.to,x=X,n=="around"){var re=e.sel.ranges[U],le=dt(re.head,re.anchor)<0;r[U]=new wt(le?X:V,le?V:X)}else r[U]=new wt(V,V)}return new cr(r,e.sel.primIndex)}function Pa(e){e.doc.mode=mr(e.options,e.doc.modeOption),fi(e)}function fi(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,di(e,100),e.state.modeGen++,e.curOp&&tr(e)}function _o(e,t){return t.from.ch==0&&t.to.ch==0&&Y(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function _a(e,t,n,r){function i(Qe){return n?n[Qe]:null}function x(Qe,Ke,Ze){ua(Qe,Ke,Ze,r),Gt(Qe,"change",Qe,t)}function U(Qe,Ke){for(var Ze=[],lt=Qe;lt<Ke;++lt)Ze.push(new rn(X[lt],i(lt),r));return Ze}var H=t.from,V=t.to,X=t.text,re=rt(e,H.line),le=rt(e,V.line),Ee=Y(X),be=i(X.length-1),ke=V.line-H.line;if(t.full)e.insert(0,U(0,X.length)),e.remove(X.length,e.size-X.length);else if(_o(e,t)){var Ie=U(0,X.length-1);x(le,le.text,be),ke&&e.remove(H.line,ke),Ie.length&&e.insert(H.line,Ie)}else if(re==le)if(X.length==1)x(re,re.text.slice(0,H.ch)+Ee+re.text.slice(V.ch),be);else{var je=U(1,X.length-1);je.push(new rn(Ee+re.text.slice(V.ch),be,r)),x(re,re.text.slice(0,H.ch)+X[0],i(0)),e.insert(H.line+1,je)}else if(X.length==1)x(re,re.text.slice(0,H.ch)+X[0]+le.text.slice(V.ch),i(0)),e.remove(H.line+1,ke);else{x(re,re.text.slice(0,H.ch)+X[0],i(0)),x(le,Ee+le.text.slice(V.ch),be);var He=U(1,X.length-1);ke>1&&e.remove(H.line+1,ke-1),e.insert(H.line+1,He)}Gt(e,"change",e,t)}function Xr(e,t,n){function r(i,x,U){if(i.linked)for(var H=0;H<i.linked.length;++H){var V=i.linked[H];if(V.doc==x)continue;var X=U&&V.sharedHist;if(n&&!X)continue;t(V.doc,X),r(V.doc,i,X)}}r(e,null,!0)}function Mo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,xa(e),Pa(e),Io(e),e.options.lineWrapping||Ii(e),e.options.mode=t.modeOption,tr(e)}function Io(e){(e.doc.direction=="rtl"?F:f)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){or(e,function(){Io(e),tr(e)})}function zi(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ma(e,t){var n={from:gn(t.from),to:Vr(t),text:Pr(e,t.from,t.to)};return No(e,n,t.from.line,t.to.line+1),Xr(e,function(r){return No(r,n,t.from.line,t.to.line+1)},!0),n}function Fo(e){for(;e.length;){var t=Y(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Fo(e.done),Y(e.done);if(e.done.length&&!Y(e.done).ranges)return Y(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Y(e.done)}function Uo(e,t,n,r){var i=e.history;i.undone.length=0;var x=+new Date,U,H;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>x-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(U=pl(i,i.lastOp==r)))H=Y(U.changes),dt(t.from,t.to)==0&&dt(t.from,H.to)==0?H.to=Vr(t):U.changes.push(Ma(e,t));else{var V=Y(i.done);for((!V||!V.ranges)&&Vi(e.sel,i.done),U={changes:[Ma(e,t)],generation:i.generation},i.done.push(U);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=x,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,H||Re(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,x=r&&r.origin;n==i.lastSelOp||x&&i.lastSelOrigin==x&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==x||ml(e,x,Y(i.done),t))?i.done[i.done.length-1]=t:Vi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=x,i.lastSelOp=n,r&&r.clearRedo!==!1&&Fo(i.undone)}function Vi(e,t){var n=Y(t);n&&n.ranges&&n.equals(e)||t.push(e)}function No(e,t,n,r){var i=t["spans_"+e.id],x=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(U){U.markedSpans&&((i||(i=t["spans_"+e.id]={}))[x]=U.markedSpans),++x})}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 Bo(e,t){var n=yl(e,t),r=En(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var x=n[i],U=r[i];if(x&&U){e:for(var H=0;H<U.length;++H){for(var V=U[H],X=0;X<x.length;++X)if(x[X].marker==V.marker)continue e;x.push(V)}}else U&&(n[i]=U)}return n}function kn(e,t,n){for(var r=[],i=0;i<e.length;++i){var x=e[i];if(x.ranges){r.push(n?cr.prototype.deepCopy.call(x):x);continue}var U=x.changes,H=[];r.push({changes:H});for(var V=0;V<U.length;++V){var X=U[V],re=void 0;if(H.push({from:X.from,to:X.to,text:X.text}),t)for(var le in X)(re=le.match(/^spans_(\d+)$/))&&(q(t,Number(re[1]))>-1&&(Y(H)[le]=X[le],delete X[le]))}}return r}function Ia(e,t,n,r){if(r){var i=e.anchor;if(n){var x=dt(t,i)<0;x!=dt(n,i)<0?(i=t,t=n):x!=dt(t,n)<0&&(t=n)}return new wt(i,t)}else return new wt(n||t,t)}function Xi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Xt(e,new cr([Ia(e.sel.primary(),t,n,i)],0),r)}function jo(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),x=0;x<e.sel.ranges.length;x++)r[x]=Ia(e.sel.ranges[x],t[x],null,i);var U=Sr(e.cm,r,e.sel.primIndex);Xt(e,U,n)}function Fa(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Xt(e,Sr(e.cm,i,e.sel.primIndex),r)}function Wo(e,t,n,r){Xt(e,zr(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var x=0;x<i.length;x++)this.ranges[x]=new wt(ft(e,i[x].anchor),ft(e,i[x].head))},origin:n&&n.origin};return Re(e,"beforeSelectionChange",e,r),e.cm&&Re(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Sr(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,n){var r=e.history.done,i=Y(r);i&&i.ranges?(r[r.length-1]=t,Yi(e,t,n)):Xt(e,t,n)}function Xt(e,t,n){Yi(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Yi(e,t,n){(ue(e,"beforeSelectionChange")||e.cm&&ue(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(dt(t.primary().head,e.sel.primary().head)<0?-1:1);Ko(e,zo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Rn(e.cm)}function Ko(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,me(e.cm)),Gt(e,"cursorActivity",e)}function Go(e){Ko(e,zo(e,e.sel,null,!1))}function zo(e,t,n,r){for(var i,x=0;x<t.ranges.length;x++){var U=t.ranges[x],H=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[x],V=$i(e,U.anchor,H&&H.anchor,n,r),X=$i(e,U.head,H&&H.head,n,r);(i||V!=U.anchor||X!=U.head)&&(i||(i=t.ranges.slice(0,x)),i[x]=new wt(V,X))}return i?Sr(e.cm,i,t.primIndex):t}function Pn(e,t,n,r,i){var x=rt(e,t.line);if(x.markedSpans)for(var U=0;U<x.markedSpans.length;++U){var H=x.markedSpans[U],V=H.marker,X="selectLeft"in V?!V.selectLeft:V.inclusiveLeft,re="selectRight"in V?!V.selectRight:V.inclusiveRight;if((H.from==null||(X?H.from<=t.ch:H.from<t.ch))&&(H.to==null||(re?H.to>=t.ch:H.to>t.ch))){if(i&&(Re(V,"beforeCursorEnter"),V.explicitlyCleared))if(x.markedSpans){--U;continue}else break;if(!V.atomic)continue;if(n){var le=V.find(r<0?1:-1),Ee=void 0;if((r<0?re:X)&&(le=Vo(e,le,-r,le&&le.line==t.line?x:null)),le&&le.line==t.line&&(Ee=dt(le,n))&&(r<0?Ee<0:Ee>0))return Pn(e,le,t,r,i)}var be=V.find(r<0?-1:1);return(r<0?X:re)&&(be=Vo(e,be,r,be.line==t.line?x:null)),be?Pn(e,be,t,r,i):null}}return t}function $i(e,t,n,r,i){var x=r||1,U=Pn(e,t,n,x,i)||!i&&Pn(e,t,n,x,!0)||Pn(e,t,n,-x,i)||!i&&Pn(e,t,n,-x,!0);return U||(e.cantEdit=!0,Ne(e.first,0))}function Vo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ft(e,Ne(t.line-1)):null:n>0&&t.ch==(r||rt(e,t.line)).text.length?t.line<e.first+e.size-1?Ne(t.line+1,0):null:new Ne(t.line,t.ch+n)}function Xo(e){e.setSelection(Ne(e.firstLine(),0),Ne(e.lastLine()),ve)}function Yo(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,x,U,H){i&&(r.from=ft(e,i)),x&&(r.to=ft(e,x)),U&&(r.text=U),H!==void 0&&(r.origin=H)}),Re(e,"beforeChange",e,r),e.cm&&Re(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 _n(e,t,n){if(e.cm){if(!e.cm.curOp)return jt(e.cm,_n)(e,t,n);if(e.cm.state.suppressEdits)return}if((ue(e,"beforeChange")||e.cm&&ue(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=Qn&&!n&&Pi(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)$o(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else $o(e,t)}function $o(e,t){if(t.text.length==1&&t.text[0]==""&&dt(t.from,t.to)==0)return;var n=ka(e,t);Uo(e,t,n,e.cm?e.cm.curOp.id:NaN),hi(e,t,n,En(e,t));var r=[];Xr(e,function(i,x){!x&&q(r,i.history)==-1&&(qo(i.history,t),r.push(i.history)),hi(i,t,null,En(i,t))})}function Qi(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,x,U=e.sel,H=t=="undo"?i.done:i.undone,V=t=="undo"?i.undone:i.done,X=0;X<H.length&&!(x=H[X],n?x.ranges&&!x.equals(e.sel):!x.ranges);X++);if(X==H.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(x=H.pop(),x.ranges){if(Vi(x,V),n&&!x.equals(e.sel)){Xt(e,x,{clearRedo:!1});return}U=x}else if(r){H.push(x);return}else break;var re=[];Vi(U,V),V.push({changes:re,generation:i.generation}),i.generation=x.generation||++i.maxGeneration;for(var le=ue(e,"beforeChange")||e.cm&&ue(e.cm,"beforeChange"),Ee=function(Ie){var je=x.changes[Ie];if(je.origin=t,le&&!Yo(e,je,!1))return H.length=0,{};re.push(Ma(e,je));var He=Ie?ka(e,je):Y(H);hi(e,je,He,Bo(e,je)),!Ie&&e.cm&&e.cm.scrollIntoView({from:je.from,to:Vr(je)});var Qe=[];Xr(e,function(Ke,Ze){!Ze&&q(Qe,Ke.history)==-1&&(qo(Ke.history,je),Qe.push(Ke.history)),hi(Ke,je,null,Bo(Ke,je))})},be=x.changes.length-1;be>=0;--be){var ke=Ee(be);if(ke)return ke.v}}function Qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new cr(ae(e.sel.ranges,function(i){return new wt(Ne(i.anchor.line+t,i.anchor.ch),Ne(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){tr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Kr(e.cm,r,"gutter")}}function hi(e,t,n,r){if(e.cm&&!e.cm.curOp)return jt(e.cm,hi)(e,t,n,r);if(t.to.line<e.first){Qo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Qo(e,i),t={from:Ne(e.first,0),to:Ne(t.to.line+i,t.to.ch),text:[Y(t.text)],origin:t.origin}}var x=e.lastLine();t.to.line>x&&(t={from:t.from,to:Ne(x,rt(e,x).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Pr(e,t.from,t.to),n||(n=ka(e,t)),e.cm?El(e.cm,t,r):_a(e,t,r),Yi(e,n,ve),e.cantEdit&&$i(e,Ne(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,x=t.from,U=t.to,H=!1,V=x.line;e.options.lineWrapping||(V=Tt(ur(rt(r,x.line))),r.iter(V,U.line+1,function(be){if(be==i.maxLine)return H=!0,!0})),r.sel.contains(t.from,t.to)>-1&&me(e),_a(r,t,n,ho(e)),e.options.lineWrapping||(r.iter(V,x.line+t.text.length,function(be){var ke=ei(be);ke>i.maxLineLength&&(i.maxLine=be,i.maxLineLength=ke,i.maxLineChanged=!0,H=!1)}),H&&(e.curOp.updateMaxLine=!0)),aa(r,x.line),di(e,400);var X=t.text.length-(U.line-x.line)-1;t.full?tr(e):x.line==U.line&&t.text.length==1&&!_o(e.doc,t)?Kr(e,x.line,"text"):tr(e,x.line,U.line+1,X);var re=ue(e,"changes"),le=ue(e,"change");if(le||re){var Ee={from:x,to:U,text:t.text,removed:t.removed,origin:t.origin};le&&Gt(e,"change",e,Ee),re&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Ee)}e.display.selForContextMenu=null}function Mn(e,t,n,r,i){var x;r||(r=n),dt(r,n)<0&&(x=[r,n],n=x[0],r=x[1]),typeof t=="string"&&(t=e.splitLines(t)),_n(e,{from:n,to:r,text:t,origin:i})}function Jo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Zo(e,t,n,r){for(var i=0;i<e.length;++i){var x=e[i],U=!0;if(x.ranges){x.copied||(x=e[i]=x.deepCopy(),x.copied=!0);for(var H=0;H<x.ranges.length;H++)Jo(x.ranges[H].anchor,t,n,r),Jo(x.ranges[H].head,t,n,r);continue}for(var V=0;V<x.changes.length;++V){var X=x.changes[V];if(n<X.from.line)X.from=Ne(X.from.line+r,X.from.ch),X.to=Ne(X.to.line+r,X.to.ch);else if(t<=X.to.line){U=!1;break}}U||(e.splice(0,i+1),i=0)}}function qo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Zo(e.done,n,r,i),Zo(e.undone,n,r,i)}function pi(e,t,n,r){var i=t,x=t;return typeof t=="number"?x=rt(e,yn(e,t)):i=Tt(t),i==null?null:(r(x,i)&&e.cm&&Kr(e.cm,i,n),x)}function mi(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}mi.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,nt(i),Gt(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 gi(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}gi.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 x=Math.min(t,i-e),U=r.height;if(r.removeInner(e,x),this.height-=U-r.height,i==x&&(this.children.splice(n--,1),r.parent=null),(t-=x)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof mi))){var H=[];this.collapse(H),this.children=[new mi(H)],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],x=i.chunkSize();if(e<=x){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var U=i.lines.length%25+25,H=U;H<i.lines.length;){var V=new mi(i.lines.slice(H,H+=25));i.height-=V.height,this.children.splice(++r,0,V),V.parent=this}i.lines=i.lines.slice(0,U),this.maybeSpill()}break}e-=x}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new gi(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=q(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new gi(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],x=i.chunkSize();if(e<x){var U=Math.min(t,x-e);if(i.iterN(e,U,n))return!0;if((t-=U)==0)break;e=0}else e-=x}}};var vi=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};vi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Tt(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 x=ni(this);Zt(n,Math.max(0,n.height-x)),e&&(or(e,function(){es(e,n,-x),Kr(e,r,"widget")}),Gt(e,"lineWidgetCleared",e,this,r))},vi.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ni(this)-t;if(!i)return;Lr(this.doc,r)||Zt(r,r.height+i),n&&or(n,function(){n.curOp.forceUpdate=!0,es(n,r,i),Gt(n,"lineWidgetChanged",n,e,Tt(r))})},de(vi);function es(e,t,n){xr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ca(e,n)}function xl(e,t,n,r){var i=new vi(e,n,r),x=e.cm;return x&&i.noHScroll&&(x.display.alignWidgets=!0),pi(e,t,"widget",function(U){var H=U.widgets||(U.widgets=[]);if(i.insertAt==null?H.push(i):H.splice(Math.min(H.length-1,Math.max(0,i.insertAt)),0,i),i.line=U,x&&!Lr(e,U)){var V=xr(U)<e.scrollTop;Zt(U,U.height+ni(i)),V&&Ca(x,i.height),x.curOp.forceUpdate=!0}return!0}),x&&Gt(x,"lineWidgetAdded",x,i,typeof t=="number"?t:Tt(t)),i}var ts=0,Yr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};Yr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&dn(e),ue(this,"clear")){var n=this.find();n&&Gt(this,"clear",n.from,n.to)}for(var r=null,i=null,x=0;x<this.lines.length;++x){var U=this.lines[x],H=Er(U.markedSpans,this);e&&!this.collapsed?Kr(e,Tt(U),"text"):e&&(H.to!=null&&(i=Tt(U)),H.from!=null&&(r=Tt(U))),U.markedSpans=Jn(U.markedSpans,H),H.from==null&&this.collapsed&&!Lr(this.doc,U)&&e&&Zt(U,An(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var V=0;V<this.lines.length;++V){var X=ur(this.lines[V]),re=ei(X);re>e.display.maxLineLength&&(e.display.maxLine=X,e.display.maxLineLength=re,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&tr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Go(e.doc)),e&&Gt(e,"markerCleared",e,this,r,i),t&&cn(e),this.parent&&this.parent.clear()},Yr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var x=this.lines[i],U=Er(x.markedSpans,this);if(U.from!=null&&(n=Ne(t?x:Tt(x),U.from),e==-1))return n;if(U.to!=null&&(r=Ne(t?x:Tt(x),U.to),e==1))return r}return n&&{from:n,to:r}},Yr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;or(r,function(){var i=t.line,x=Tt(t.line),U=ha(r,x);if(U&&(io(U),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Lr(n.doc,i)&&n.height!=null){var H=n.height;n.height=null;var V=ni(n)-H;V&&Zt(i,i.height+V)}Gt(r,"markerChanged",r,e)})},Yr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||q(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Yr.prototype.detachLine=function(e){if(this.lines.splice(q(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},de(Yr);function In(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return jt(e.cm,In)(e,t,n,r,i);var x=new Yr(e,i),U=dt(t,n);if(r&&_(r,x,!1),U>0||U==0&&x.clearWhenEmpty!==!1)return x;if(x.replacedWith&&(x.collapsed=!0,x.widgetNode=g("span",[x.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||x.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(x.widgetNode.insertLeft=!0)),x.collapsed){if(_i(e,t.line,t,n,x)||t.line!=n.line&&_i(e,n.line,t,n,x))throw new Error("Inserting collapsed marker partially overlapping an existing one");oa()}x.addToHistory&&Uo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var H=t.line,V=e.cm,X;if(e.iter(H,n.line+1,function(le){V&&x.collapsed&&!V.options.lineWrapping&&ur(le)==V.display.maxLine&&(X=!0),x.collapsed&&H!=t.line&&Zt(le,0),sa(le,new qr(x,H==t.line?t.ch:null,H==n.line?n.ch:null)),++H}),x.collapsed&&e.iter(t.line,n.line+1,function(le){Lr(e,le)&&Zt(le,0)}),x.clearOnEnter&&Ce(x,"beforeCursorEnter",function(){return x.clear()}),x.readOnly&&(Wr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),x.collapsed&&(x.id=++ts,x.atomic=!0),V){if(X&&(V.curOp.updateMaxLine=!0),x.collapsed)tr(V,t.line,n.line+1);else if(x.className||x.startStyle||x.endStyle||x.css||x.attributes||x.title)for(var re=t.line;re<=n.line;re++)Kr(V,re,"text");x.atomic&&Go(V.doc),Gt(V,"markerAdded",V,x)}return x}var yi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};yi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Gt(this,"clear")},yi.prototype.find=function(e,t){return this.primary.find(e,t)},de(yi);function Tl(e,t,n,r,i){r=_(r),r.shared=!1;var x=[In(e,t,n,r,i)],U=x[0],H=r.widgetNode;return Xr(e,function(V){H&&(r.widgetNode=H.cloneNode(!0)),x.push(In(V,ft(V,t),ft(V,n),r,i));for(var X=0;X<V.linked.length;++X)if(V.linked[X].isParent)return;U=Y(x)}),new yi(x,U)}function rs(e){return e.findMarks(Ne(e.first,0),e.clipPos(Ne(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(),x=e.clipPos(i.from),U=e.clipPos(i.to);if(dt(x,U)){var H=In(e,x,U,r.primary,r.primary.type);r.markers.push(H),H.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],x=[i.primary.doc];Xr(i.primary.doc,function(V){return x.push(V)});for(var U=0;U<i.markers.length;U++){var H=i.markers[U];q(x,H.doc)==-1&&(H.parent=null,i.markers.splice(U--,1))}},n=0;n<e.length;n++)t(n)}var Cl=0,rr=function(e,t,n,r,i){if(!(this instanceof rr))return new rr(e,t,n,r,i);n==null&&(n=0),gi.call(this,[new mi([new rn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var x=Ne(n,0);this.sel=zr(x),this.history=new zi(null),this.id=++Cl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),_a(this,{from:x,to:x,text:e}),Xt(this,zr(x),ve)};rr.prototype=we(gi.prototype,{constructor:rr,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=pn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Wt(function(e){var t=Ne(this.first,0),n=this.first+this.size-1;_n(this,{from:t,to:Ne(n,rt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&oi(this.cm,0,0),Xt(this,zr(t),ve)}),replaceRange:function(e,t,n,r){t=ft(this,t),n=n?ft(this,n):t,Mn(this,e,t,n,r)},getRange:function(e,t,n){var r=Pr(this,ft(this,e),ft(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(_r(this,e))return rt(this,e)},getLineNumber:function(e){return Tt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=rt(this,e)),ur(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ft(this,e)},getCursor:function(e){var t=this.sel.primary(),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:Wt(function(e,t,n){Wo(this,ft(this,typeof e=="number"?Ne(e,t||0):e),null,n)}),setSelection:Wt(function(e,t,n){Wo(this,ft(this,e),ft(this,t||e),n)}),extendSelection:Wt(function(e,t,n){Xi(this,ft(this,e),t&&ft(this,t),n)}),extendSelections:Wt(function(e,t){jo(this,Be(this,e),t)}),extendSelectionsBy:Wt(function(e,t){var n=ae(this.sel.ranges,e);jo(this,Be(this,n),t)}),setSelections:Wt(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new wt(ft(this,e[i].anchor),ft(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Xt(this,Sr(this.cm,r,t),n)}),addSelection:Wt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new wt(ft(this,e),ft(this,t||e))),Xt(this,Sr(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=Pr(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=Pr(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:Wt(function(e,t,n){for(var r=[],i=this.sel,x=0;x<i.ranges.length;x++){var U=i.ranges[x];r[x]={from:U.from(),to:U.to(),text:this.splitLines(e[x]),origin:n}}for(var H=t&&t!="end"&&fl(this,r,t),V=r.length-1;V>=0;V--)_n(this,r[V]);H?Ho(this,H):this.cm&&Rn(this.cm)}),undo:Wt(function(){Qi(this,"undo")}),redo:Wt(function(){Qi(this,"redo")}),undoSelection:Wt(function(){Qi(this,"undo",!0)}),redoSelection:Wt(function(){Qi(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 zi(this.history.maxGeneration),Xr(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:kn(this.history.done),undone:kn(this.history.undone)}},setHistory:function(e){var t=this.history=new zi(this.history.maxGeneration);t.done=kn(e.done.slice(0),null,!0),t.undone=kn(e.undone.slice(0),null,!0)},setGutterMarker:Wt(function(e,t,n){return pi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Pe(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Wt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&pi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Pe(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!_r(this,e))return null;if(t=e,e=rt(this,e),!e)return null}else if(t=Tt(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:Wt(function(e,t,n){return pi(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(b(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Wt(function(e,t,n){return pi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",x=r[i];if(x)if(n==null)r[i]=null;else{var U=x.match(b(n));if(!U)return!1;var H=U.index+U[0].length;r[i]=x.slice(0,U.index)+(!U.index||H==x.length?"":" ")+x.slice(H)||null}else return!1;return!0})}),addLineWidget:Wt(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return In(this,ft(this,e),ft(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=ft(this,e),In(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ft(this,e);var t=[],n=rt(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=ft(this,e),t=ft(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(x){var U=x.markedSpans;if(U)for(var H=0;H<U.length;H++){var V=U[H];!(V.to!=null&&i==e.line&&e.ch>=V.to||V.from==null&&i!=e.line||V.from!=null&&i==t.line&&V.from>=t.ch)&&(!n||n(V.marker))&&r.push(V.marker.parent||V.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 x=i.text.length+r;if(x>e)return t=e,!0;e-=x,++n}),ft(this,Ne(n,t))},indexFromPos:function(e){e=ft(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 rr(pn(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 rr(pn(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,rs(this)),r},unlinkDoc:function(e){if(e instanceof Rt&&(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),wl(rs(this));break}if(e.history==this.history){var r=[e.id];Xr(e,function(i){return r.push(i.id)},!0),e.history=new zi(null),e.history.done=kn(this.history.done,r),e.history.undone=kn(this.history.undone,r)}},iterLinkedDocs:function(e){Xr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):ht(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Wt(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&hl(this.cm)})}),rr.prototype.eachLine=rr.prototype.iter;var ns=0;function Al(e){var t=this;if(is(t),Fe(t,e)||Nr(t.display,e))return;Q(e),B&&(ns=+new Date);var n=on(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,x=Array(i),U=0,H=function(){++U==i&&jt(t,function(){n=ft(t.doc,n);var be={from:n,to:n,text:t.doc.splitLines(x.filter(function(ke){return ke!=null}).join(t.doc.lineSeparator())),origin:"paste"};_n(t.doc,be),Ho(t.doc,zr(ft(t.doc,n),ft(t.doc,Vr(be))))})()},V=function(be,ke){if(t.options.allowDropFileTypes&&q(t.options.allowDropFileTypes,be.type)==-1){H();return}var Ie=new FileReader;Ie.onerror=function(){return H()},Ie.onload=function(){var je=Ie.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(je)){H();return}x[ke]=je,H()},Ie.readAsText(be)},X=0;X<r.length;X++)V(r[X],X);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 re=e.dataTransfer.getData("Text");if(re){var le;if(t.state.draggingText&&!t.state.draggingText.copy&&(le=t.listSelections()),Yi(t.doc,zr(n,n)),le)for(var Ee=0;Ee<le.length;++Ee)Mn(t.doc,"",le[Ee].anchor,le[Ee].head,"drag");t.replaceSelection(re,"around","paste"),t.display.input.focus()}}catch(be){}}}function Ll(e,t){if(B&&(!e.state.draggingText||+new Date-ns<100)){se(t);return}if(Fe(e,t)||Nr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!R){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",w&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),w&&n.parentNode.removeChild(n)}}function Dl(e,t){var n=on(e,t);if(!n)return;var r=document.createDocumentFragment();go(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)),l(e.display.dragCursor,r)}function is(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function as(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var x=0;x<n.length;x++)e(n[x])})}var os=!1;function Rl(){if(os)return;Ol(),os=!0}function Ol(){var e;Ce(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(kl)},100))}),Ce(window,"blur",function(){return as(Dn)})}function kl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var $r={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"},bi=0;bi<10;bi++)$r[bi+48]=$r[bi+96]=String(bi);for(var Ji=65;Ji<=90;Ji++)$r[Ji]=String.fromCharCode(Ji);for(var Ei=1;Ei<=12;Ei++)$r[Ei+111]=$r[Ei+63235]="F"+Ei;var Br={};Br.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"},Br.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"},Br.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"},Br.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"]},Br.default=s?Br.macDefault:Br.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,x,U=0;U<t.length-1;U++){var H=t[U];if(/^(cmd|meta|m)$/i.test(H))x=!0;else if(/^a(lt)?$/i.test(H))n=!0;else if(/^(c|ctrl|control)$/i.test(H))r=!0;else if(/^s(hift)?$/i.test(H))i=!0;else throw new Error("Unrecognized modifier name: "+H)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),x&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function _l(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=ae(n.split(" "),Pl),x=0;x<i.length;x++){var U=void 0,H=void 0;x==i.length-1?(H=i.join(" "),U=r):(H=i.slice(0,x+1).join(" "),U="...");var V=t[H];if(!V)t[H]=U;else if(V!=U)throw new Error("Inconsistent bindings for "+H)}delete e[n]}for(var X in t)e[X]=t[X];return e}function Fn(e,t,n,r){t=Zi(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 Fn(e,t.fallthrough,n,r);for(var x=0;x<t.fallthrough.length;x++){var U=Fn(e,t.fallthrough[x],n,r);if(U)return U}}}function ss(e){var t=typeof e=="string"?e:$r[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ls(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(h?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(h?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function us(e,t){if(w&&e.keyCode==34&&e.char)return!1;var n=$r[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),ls(n,e,t))}function Zi(e){return typeof e=="string"?Br[e]:e}function Un(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var x=t(n[i]);r.length&&dt(x.from,Y(r).to)<=0;){var U=r.pop();if(dt(U.from,x.from)<0){x.from=U.from;break}}r.push(x)}or(e,function(){for(var H=r.length-1;H>=0;H--)Mn(e.doc,"",r[H].from,r[H].to,"+delete");Rn(e)})}function Ua(e,t,n){var r=Le(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Na(e,t,n){var r=Ua(e,t.ch,n);return r==null?null:new Ne(t.line,r,n<0?"after":"before")}function Ba(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var x=Je(n,t.doc.direction);if(x){var U=i<0?Y(x):x[0],H=i<0==(U.level==1),V=H?"after":"before",X;if(U.level>0||t.doc.direction=="rtl"){var re=Cn(t,n);X=i<0?n.text.length-1:0;var le=Rr(t,re,X).top;X=Ue(function(Ee){return Rr(t,re,Ee).top==le},i<0==(U.level==1)?U.from:U.to-1,X),V=="before"&&(X=Ua(n,X,1))}else X=i<0?U.to:U.from;return new Ne(r,X,V)}}return new Ne(r,i<0?n.text.length:0,i<0?"before":"after")}function Ml(e,t,n,r){var i=Je(t,e.doc.direction);if(!i)return Na(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 x=Ge(i,n.ch,n.sticky),U=i[x];if(e.doc.direction=="ltr"&&U.level%2==0&&(r>0?U.to>n.ch:U.from<n.ch))return Na(t,n,r);var H=function(He,Qe){return Ua(t,He instanceof Ne?He.ch:He,Qe)},V,X=function(He){return e.options.lineWrapping?(V=V||Cn(e,t),fo(e,t,V,He)):{begin:0,end:t.text.length}},re=X(n.sticky=="before"?H(n,-1):n.ch);if(e.doc.direction=="rtl"||U.level==1){var le=U.level==1==r<0,Ee=H(n,le?1:-1);if(Ee!=null&&(le?Ee<=U.to&&Ee<=re.end:Ee>=U.from&&Ee>=re.begin)){var be=le?"before":"after";return new Ne(n.line,Ee,be)}}var ke=function(He,Qe,Ke){for(var Ze=function(Dt,Ht){return Ht?new Ne(n.line,H(Dt,1),"before"):new Ne(n.line,Dt,"after")};He>=0&&He<i.length;He+=Qe){var lt=i[He],at=Qe>0==(lt.level!=1),pt=at?Ke.begin:H(Ke.end,-1);if(lt.from<=pt&&pt<lt.to)return Ze(pt,at);if(pt=at?lt.from:H(lt.to,-1),Ke.begin<=pt&&pt<Ke.end)return Ze(pt,at)}},Ie=ke(x+r,r,re);if(Ie)return Ie;var je=r>0?re.end:H(re.begin,-1);return je!=null&&!(r>0&&je==t.text.length)&&(Ie=ke(r>0?0:i.length-1,r,X(je)),Ie)?Ie:null}var xi={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ve)},killLine:function(e){return Un(e,function(t){if(t.empty()){var n=rt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Ne(t.head.line+1,0)}:{from:t.head,to:Ne(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Un(e,function(t){return{from:Ne(t.from().line,0),to:ft(e.doc,Ne(t.to().line+1,0))}})},delLineLeft:function(e){return Un(e,function(t){return{from:Ne(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Un(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 Un(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(Ne(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ne(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ds(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return cs(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")},ce)},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")},ce)},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/)?cs(e,t.head):r},ce)},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 x=n[i].from(),U=K(e.getLine(x.line),x.ch,r);t.push(pe(r-U%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return or(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,x=rt(e.doc,i.line).text;if(x){if(i.ch==x.length&&(i=new Ne(i.line,i.ch-1)),i.ch>0)i=new Ne(i.line,i.ch+1),e.replaceRange(x.charAt(i.ch-1)+x.charAt(i.ch-2),Ne(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var U=rt(e.doc,i.line-1).text;U&&(i=new Ne(i.line,1),e.replaceRange(x.charAt(0)+e.doc.lineSeparator()+U.charAt(U.length-1),Ne(i.line-1,U.length-1),i,"+transpose"))}}n.push(new wt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return or(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);Rn(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ds(e,t){var n=rt(e.doc,t),r=ur(n);return r!=n&&(t=Tt(r)),Ba(!0,e,r,t,1)}function Il(e,t){var n=rt(e.doc,t),r=Mi(n);return r!=n&&(t=Tt(r)),Ba(!0,e,n,t,-1)}function cs(e,t){var n=ds(e,t.line),r=rt(e.doc,n.line),i=Je(r,e.doc.direction);if(!i||i[0].level==0){var x=Math.max(n.ch,r.text.search(/\S/)),U=t.line==n.line&&t.ch<=x&&t.ch;return Ne(n.line,U?0:x,n.sticky)}return n}function qi(e,t,n){if(typeof t=="string"&&(t=xi[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)!=Te}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Fl(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Fn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Fn(t,e.options.extraKeys,n,e)||Fn(t,e.options.keyMap,n,e)}var Ul=new $;function Ti(e,t,n,r){var i=e.state.keySeq;if(i){if(ss(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())}),fs(e,i+" "+t,n,r))return!0}return fs(e,t,n,r)}function fs(e,t,n,r){var i=Fl(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Gt(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(Q(n),Ta(e)),!!i}function hs(e,t){var n=us(t,!0);return n?t.shiftKey&&!e.state.keySeq?Ti(e,"Shift-"+n,t,function(r){return qi(e,r,!0)})||Ti(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return qi(e,r)}):Ti(e,n,t,function(r){return qi(e,r)}):!1}function Nl(e,t,n){return Ti(e,"'"+n+"'",t,function(r){return qi(e,r,!0)})}var ja=null;function ps(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=M(),Fe(t,e))return;B&&N<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=hs(t,e);w&&(ja=r?n:null,!r&&n==88&&!Ct&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),L&&!s&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;F(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(f(t,"CodeMirror-crosshair"),$e(document,"keyup",n),$e(document,"mouseover",n))}Ce(document,"keyup",n),Ce(document,"mouseover",n)}function ms(e){e.keyCode==16&&(this.doc.sel.shift=!1),Fe(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Nr(t.display,e)||Fe(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(w&&n==ja){ja=null,Q(e);return}if(w&&(!e.which||e.which<10)&&hs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Nl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Wa=function(e,t,n){this.time=e,this.pos=t,this.button=n};Wa.prototype.compare=function(e,t,n){return this.time+jl>e&&dt(t,this.pos)==0&&n==this.button};var Si,wi;function Wl(e,t){var n=+new Date;return wi&&wi.compare(n,e,t)?(Si=wi=null,"triple"):Si&&Si.compare(n,e,t)?(wi=new Wa(n,e,t),Si=null,"double"):(Si=new Wa(n,e,t),wi=null,"single")}function vs(e){var t=this,n=t.display;if(Fe(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Nr(n,e)){k||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=on(t,e),i=Ae(e),x=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,x,e))return;i==1?r?Gl(t,r,x,e):fe(e)==n.scroller&&Q(e):i==2?(r&&Xi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(A?t.display.input.onContextMenu(e):yo(t))}function Hl(e,t,n,r,i){var x="Click";return r=="double"?x="Double"+x:r=="triple"&&(x="Triple"+x),x=(t==1?"Left":t==2?"Middle":"Right")+x,Ti(e,ls(x,i),i,function(U){if(typeof U=="string"&&(U=xi[U]),!U)return!1;var H=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),H=U(e,n)!=Te}finally{e.state.suppressEdits=!1}return H})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var x=d?n.shiftKey&&n.metaKey:n.altKey;i.unit=x?"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=s?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(s?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){B?setTimeout(O(vo,e),0):e.curOp.focus=M();var i=Kl(e,n,r),x=e.doc.sel,U;e.options.dragDrop&&Me&&!e.isReadOnly()&&n=="single"&&(U=x.contains(t))>-1&&(dt((U=x.ranges[U]).from(),t)<0||t.xRel>0)&&(dt(U.to(),t)>0||t.xRel<0)?zl(e,r,t,i):Vl(e,r,t,i)}function zl(e,t,n,r){var i=e.display,x=!1,U=jt(e,function(X){k&&(i.scroller.draggable=!1),e.state.draggingText=!1,$e(i.wrapper.ownerDocument,"mouseup",U),$e(i.wrapper.ownerDocument,"mousemove",H),$e(i.scroller,"dragstart",V),$e(i.scroller,"drop",U),x||(Q(X),r.addNew||Xi(e.doc,n,null,null,r.extend),k&&!R||B&&N==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),H=function(X){x=x||Math.abs(t.clientX-X.clientX)+Math.abs(t.clientY-X.clientY)>=10},V=function(){return x=!0};k&&(i.scroller.draggable=!0),e.state.draggingText=U,U.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Ce(i.wrapper.ownerDocument,"mouseup",U),Ce(i.wrapper.ownerDocument,"mousemove",H),Ce(i.scroller,"dragstart",V),Ce(i.scroller,"drop",U),yo(e),setTimeout(function(){return i.input.focus()},20)}function ys(e,t,n){if(n=="char")return new wt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new wt(Ne(t.line,0),ft(e.doc,Ne(t.line+1,0)));var r=n(e,t);return new wt(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,x=e.doc;Q(t);var U,H,V=x.sel,X=V.ranges;if(r.addNew&&!r.extend?(H=x.sel.contains(n),H>-1?U=X[H]:U=new wt(n,n)):(U=x.sel.primary(),H=x.sel.primIndex),r.unit=="rectangle")r.addNew||(U=new wt(n,n)),n=on(e,t,!0,!0),H=-1;else{var re=ys(e,n,r.unit);r.extend?U=Ia(U,re.anchor,re.head,r.extend):U=re}r.addNew?H==-1?(H=X.length,Xt(x,Sr(e,X.concat([U]),H),{scroll:!1,origin:"*mouse"})):X.length>1&&X[H].empty()&&r.unit=="char"&&!r.extend?(Xt(x,Sr(e,X.slice(0,H).concat(X.slice(H+1)),0),{scroll:!1,origin:"*mouse"}),V=x.sel):Fa(x,H,U,ge):(H=0,Xt(x,new cr([U],0),ge),V=x.sel);var le=n;function Ee(Ke){if(dt(le,Ke)==0)return;if(le=Ke,r.unit=="rectangle"){for(var Ze=[],lt=e.options.tabSize,at=K(rt(x,n.line).text,n.ch,lt),pt=K(rt(x,Ke.line).text,Ke.ch,lt),Dt=Math.min(at,pt),Ht=Math.max(at,pt),Ot=Math.min(n.line,Ke.line),sr=Math.min(e.lastLine(),Math.max(n.line,Ke.line));Ot<=sr;Ot++){var nr=rt(x,Ot).text,Mt=he(nr,Dt,lt);Dt==Ht?Ze.push(new wt(Ne(Ot,Mt),Ne(Ot,Mt))):nr.length>Mt&&Ze.push(new wt(Ne(Ot,Mt),Ne(Ot,he(nr,Ht,lt))))}Ze.length||Ze.push(new wt(n,n)),Xt(x,Sr(e,V.ranges.slice(0,H).concat(Ze),H),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ke)}else{var ir=U,zt=ys(e,Ke,r.unit),Nt=ir.anchor,It;dt(zt.anchor,Nt)>0?(It=zt.head,Nt=Jr(ir.from(),zt.anchor)):(It=zt.anchor,Nt=vn(ir.to(),zt.head));var Pt=V.ranges.slice(0);Pt[H]=Xl(e,new wt(ft(x,Nt),It)),Xt(x,Sr(e,Pt,H),ge)}}var be=i.wrapper.getBoundingClientRect(),ke=0;function Ie(Ke){var Ze=++ke,lt=on(e,Ke,!0,r.unit=="rectangle");if(!lt)return;if(dt(lt,le)!=0){e.curOp.focus=M(),Ee(lt);var at=Wi(i,x);(lt.line>=at.to||lt.line<at.from)&&setTimeout(jt(e,function(){ke==Ze&&Ie(Ke)}),150)}else{var pt=Ke.clientY<be.top?-20:Ke.clientY>be.bottom?20:0;pt&&setTimeout(jt(e,function(){if(ke!=Ze)return;i.scroller.scrollTop+=pt,Ie(Ke)}),50)}}function je(Ke){e.state.selectingText=!1,ke=Infinity,Ke&&(Q(Ke),i.input.focus()),$e(i.wrapper.ownerDocument,"mousemove",He),$e(i.wrapper.ownerDocument,"mouseup",Qe),x.history.lastSelOrigin=null}var He=jt(e,function(Ke){Ke.buttons===0||!Ae(Ke)?je(Ke):Ie(Ke)}),Qe=jt(e,je);e.state.selectingText=Qe,Ce(i.wrapper.ownerDocument,"mousemove",He),Ce(i.wrapper.ownerDocument,"mouseup",Qe)}function Xl(e,t){var n=t.anchor,r=t.head,i=rt(e.doc,n.line);if(dt(n,r)==0&&n.sticky==r.sticky)return t;var x=Je(i);if(!x)return t;var U=Ge(x,n.ch,n.sticky),H=x[U];if(H.from!=n.ch&&H.to!=n.ch)return t;var V=U+(H.from==n.ch==(H.level!=1)?0:1);if(V==0||V==x.length)return t;var X;if(r.line!=n.line)X=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var re=Ge(x,r.ch,r.sticky),le=re-U||(r.ch-n.ch)*(H.level==1?-1:1);re==V-1||re==V?X=le<0:X=le>0}var Ee=x[V+(X?-1:0)],be=X==(Ee.level==1),ke=be?Ee.from:Ee.to,Ie=be?"after":"before";return n.ch==ke&&n.sticky==Ie?t:new wt(new Ne(n.line,ke,Ie),r)}function bs(e,t,n,r){var i,x;if(t.touches)i=t.touches[0].clientX,x=t.touches[0].clientY;else try{i=t.clientX,x=t.clientY}catch(Ee){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Q(t);var U=e.display,H=U.lineDiv.getBoundingClientRect();if(x>H.bottom||!ue(e,n))return te(t);x-=H.top-U.viewOffset;for(var V=0;V<e.display.gutterSpecs.length;++V){var X=U.gutters.childNodes[V];if(X&&X.getBoundingClientRect().right>=i){var re=gr(e.doc,x),le=e.display.gutterSpecs[V];return Re(e,n,e,re,le.className,t),te(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function Es(e,t){if(Nr(e.display,t)||Yl(e,t))return;if(Fe(e,t,"contextmenu"))return;A||e.display.input.onContextMenu(t)}function Yl(e,t){return ue(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function xs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ii(e)}var Nn={toString:function(){return"CodeMirror.Init"}},Ts={},ea={};function $l(e){var t=e.optionHandlers;function n(r,i,x,U){e.defaults[r]=i,x&&(t[r]=U?function(H,V,X){X!=Nn&&x(H,V,X)}:x)}e.defineOption=n,e.Init=Nn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Pa(r)},!0),n("indentUnit",2,Pa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){fi(r),ii(r),tr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var x=[],U=r.doc.first;r.doc.iter(function(V){for(var X=0;;){var re=V.text.indexOf(i,X);if(re==-1)break;X=re+i.length,x.push(Ne(U,re))}U++});for(var H=x.length-1;H>=0;H--)Mn(r.doc,i,x[H],Ne(x[H].line,x[H].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,x){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),x!=Nn&&r.refresh()}),n("specialCharPlaceholder",Lt,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",!S),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){xs(r),ci(r)},!0),n("keyMap","default",function(r,i,x){var U=Zi(i),H=x!=Nn&&Zi(x);H&&H.detach&&H.detach(r,U),U.attach&&U.attach(r,H||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Oa(i,r.options.lineNumbers),ci(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Ea(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return On(r)},!0),n("scrollbarStyle","native",function(r){wo(r),On(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=Oa(r.options.gutters,i),ci(r)},!0),n("firstLineNumber",1,ci,!0),n("lineNumberFormatter",function(r){return r},ci,!0),n("showCursorWhenSelecting",!1,ai,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Dn(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,ai,!0),n("singleCursorHeightPerLine",!0,ai,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,fi,!0),n("addModeClass",!1,fi,!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,fi,!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!=Nn;if(!t!=!r){var i=e.display.dragFunctions,x=t?Ce:$e;x(e.display.scroller,"dragstart",i.start),x(e.display.scroller,"dragenter",i.enter),x(e.display.scroller,"dragover",i.over),x(e.display.scroller,"dragleave",i.leave),x(e.display.scroller,"drop",i.drop)}}function Jl(e){e.options.lineWrapping?(F(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(f(e.display.wrapper,"CodeMirror-wrap"),Ii(e)),xa(e),tr(e),ii(e),setTimeout(function(){return On(e)},100)}function Rt(e,t){var n=this;if(!(this instanceof Rt))return new Rt(e,t);this.options=t=t?_(t):{},_(Ts,t,!1);var r=t.value;typeof r=="string"?r=new rr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Rt.inputStyles[t.inputStyle](this),x=this.display=new dl(e,r,i,t);x.wrapper.CodeMirror=this,xs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),wo(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 $,keySeq:null,specialChars:null},t.autofocus&&!o&&x.input.focus(),B&&N<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Rl(),dn(this),this.curOp.forceUpdate=!0,Mo(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Sa(n)},20):Dn(this);for(var U in ea)ea.hasOwnProperty(U)&&ea[U](this,t[U],Nn);Lo(this),t.finishInit&&t.finishInit(this);for(var H=0;H<Ka.length;++H)Ka[H](this);cn(this),k&&t.lineWrapping&&getComputedStyle(x.lineDiv).textRendering=="optimizelegibility"&&(x.lineDiv.style.textRendering="auto")}Rt.defaults=Ts,Rt.optionHandlers=ea;function Zl(e){var t=e.display;Ce(t.scroller,"mousedown",jt(e,vs)),B&&N<11?Ce(t.scroller,"dblclick",jt(e,function(V){if(Fe(e,V))return;var X=on(e,V);if(!X||Ha(e,V)||Nr(e.display,V))return;Q(V);var re=e.findWordAt(X);Xi(e.doc,re.anchor,re.head)})):Ce(t.scroller,"dblclick",function(V){return Fe(e,V)||Q(V)}),Ce(t.scroller,"contextmenu",function(V){return Es(e,V)}),Ce(t.input.getField(),"contextmenu",function(V){t.scroller.contains(V.target)||Es(e,V)});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 x(V){if(V.touches.length!=1)return!1;var X=V.touches[0];return X.radiusX<=1&&X.radiusY<=1}function U(V,X){if(X.left==null)return!0;var re=X.left-V.left,le=X.top-V.top;return re*re+le*le>20*20}Ce(t.scroller,"touchstart",function(V){if(!Fe(e,V)&&!x(V)&&!Ha(e,V)){t.input.ensurePolled(),clearTimeout(n);var X=+new Date;t.activeTouch={start:X,moved:!1,prev:X-r.end<=300?r:null},V.touches.length==1&&(t.activeTouch.left=V.touches[0].pageX,t.activeTouch.top=V.touches[0].pageY)}}),Ce(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ce(t.scroller,"touchend",function(V){var X=t.activeTouch;if(X&&!Nr(t,V)&&X.left!=null&&!X.moved&&new Date-X.start<300){var re=e.coordsChar(t.activeTouch,"page"),le;!X.prev||U(X,X.prev)?le=new wt(re,re):!X.prev.prev||U(X,X.prev.prev)?le=e.findWordAt(re):le=new wt(Ne(re.line,0),ft(e.doc,Ne(re.line+1,0))),e.setSelection(le.anchor,le.head),e.focus(),Q(V)}i()}),Ce(t.scroller,"touchcancel",i),Ce(t.scroller,"scroll",function(){t.scroller.clientHeight&&(si(e,t.scroller.scrollTop),ln(e,t.scroller.scrollLeft,!0),Re(e,"scroll",e))}),Ce(t.scroller,"mousewheel",function(V){return Oo(e,V)}),Ce(t.scroller,"DOMMouseScroll",function(V){return Oo(e,V)}),Ce(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(V){Fe(e,V)||se(V)},over:function(V){Fe(e,V)||(Dl(e,V),se(V))},start:function(V){return Ll(e,V)},drop:jt(e,Al),leave:function(V){Fe(e,V)||is(e)}};var H=t.input.getField();Ce(H,"keyup",function(V){return ms.call(e,V)}),Ce(H,"keydown",jt(e,ps)),Ce(H,"keypress",jt(e,gs)),Ce(H,"focus",function(V){return Sa(e,V)}),Ce(H,"blur",function(V){return Dn(e,V)})}var Ka=[];Rt.defineInitHook=function(e){return Ka.push(e)};function Ci(e,t,n,r){var i=e.doc,x;n==null&&(n="add"),n=="smart"&&(i.mode.indent?x=vr(e,t).state:n="prev");var U=e.options.tabSize,H=rt(i,t),V=K(H.text,null,U);H.stateAfter&&(H.stateAfter=null);var X=H.text.match(/^\s*/)[0],re;if(!r&&!/\S/.test(H.text))re=0,n="not";else if(n=="smart"&&(re=i.mode.indent(x,H.text.slice(X.length),H.text),re==Te||re>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?re=K(rt(i,t-1).text,null,U):re=0:n=="add"?re=V+e.options.indentUnit:n=="subtract"?re=V-e.options.indentUnit:typeof n=="number"&&(re=V+n),re=Math.max(0,re);var le="",Ee=0;if(e.options.indentWithTabs)for(var be=Math.floor(re/U);be;--be)Ee+=U,le+=" ";if(Ee<re&&(le+=pe(re-Ee)),le!=X)return Mn(i,le,Ne(t,0),Ne(t,X.length),"+input"),H.stateAfter=null,!0;for(var ke=0;ke<i.sel.ranges.length;ke++){var Ie=i.sel.ranges[ke];if(Ie.head.line==t&&Ie.head.ch<X.length){var je=Ne(t,X.length);Fa(i,ke,new wt(je,je));break}}}var wr=null;function ta(e){wr=e}function Ga(e,t,n,r,i){var x=e.doc;e.display.shift=!1,r||(r=x.sel);var U=+new Date-200,H=i=="paste"||e.state.pasteIncoming>U,V=ht(t),X=null;if(H&&r.ranges.length>1)if(wr&&wr.text.join(`
|
|
`)==t){if(r.ranges.length%wr.text.length==0){X=[];for(var re=0;re<wr.text.length;re++)X.push(x.splitLines(wr.text[re]))}}else V.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(X=ae(V,function(He){return[He]}));for(var le=e.curOp.updateInput,Ee=r.ranges.length-1;Ee>=0;Ee--){var be=r.ranges[Ee],ke=be.from(),Ie=be.to();be.empty()&&(n&&n>0?ke=Ne(ke.line,ke.ch-n):e.state.overwrite&&!H?Ie=Ne(Ie.line,Math.min(rt(x,Ie.line).text.length,Ie.ch+Y(V).length)):H&&wr&&wr.lineWise&&wr.text.join(`
|
|
`)==V.join(`
|
|
`)&&(ke=Ie=Ne(ke.line,0)));var je={from:ke,to:Ie,text:X?X[Ee%X.length]:V,origin:i||(H?"paste":e.state.cutIncoming>U?"cut":"+input")};_n(e.doc,je),Gt(e,"inputRead",e,je)}t&&!H&&ws(e,t),Rn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=le),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ss(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&or(t,function(){return Ga(t,n,0,null,"paste")}),!0}function ws(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 x=e.getModeAt(i.head),U=!1;if(x.electricChars){for(var H=0;H<x.electricChars.length;H++)if(t.indexOf(x.electricChars.charAt(H))>-1){U=Ci(e,i.head.line,"smart");break}}else x.electricInput&&(x.electricInput.test(rt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(U=Ci(e,i.head.line,"smart")));U&&Gt(e,"electricInput",e,i.head.line)}}function Cs(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,x={anchor:Ne(i,0),head:Ne(i+1,0)};n.push(x),t.push(e.getRange(x.anchor,x.head))}return{text:t,ranges:n}}function As(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Ls(){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 k?e.style.width="1000px":e.setAttribute("wrap","off"),E&&(e.style.border="1px solid black"),As(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 x=this.options,U=x[r];if(x[r]==i&&r!="mode")return;x[r]=i,t.hasOwnProperty(r)&&jt(this,t[r])(this,i,U),Re(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"](Zi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,x=0;x<i.length;++x)if(i[x]==r||i[x].name==r)return i.splice(x,1),!0},addOverlay:Qt(function(r,i){var x=r.token?r:e.getMode(this.options,r);if(x.startState)throw new Error("Overlays may not be stateful.");Z(this.state.overlays,{mode:x,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(U){return U.priority}),this.state.modeGen++,tr(this)}),removeOverlay:Qt(function(r){for(var i=this.state.overlays,x=0;x<i.length;++x){var U=i[x].modeSpec;if(U==r||typeof r=="string"&&U.name==r){i.splice(x,1),this.state.modeGen++,tr(this);return}}}),indentLine:Qt(function(r,i,x){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),_r(this.doc,r)&&Ci(this,r,i,x)}),indentSelection:Qt(function(r){for(var i=this.doc.sel.ranges,x=-1,U=0;U<i.length;U++){var H=i[U];if(H.empty())H.head.line>x&&(Ci(this,H.head.line,r,!0),x=H.head.line,U==this.doc.sel.primIndex&&Rn(this));else{var V=H.from(),X=H.to(),re=Math.max(x,V.line);x=Math.min(this.lastLine(),X.line-(X.ch?0:1))+1;for(var le=re;le<x;++le)Ci(this,le,r);var Ee=this.doc.sel.ranges;V.ch==0&&i.length==Ee.length&&Ee[U].from().ch>0&&Fa(this.doc,U,new wt(V,Ee[U].to()),ve)}}}),getTokenAt:function(r,i){return Li(this,r,i)},getLineTokens:function(r,i){return Li(this,Ne(r),i,!0)},getTokenTypeAt:function(r){r=ft(this.doc,r);var i=Zr(this,rt(this.doc,r.line)),x=0,U=(i.length-1)/2,H=r.ch,V;if(H==0)V=i[2];else for(;;){var X=x+U>>1;if((X?i[X*2-1]:0)>=H)U=X;else if(i[X*2+1]<H)x=X+1;else{V=i[X*2+2];break}}var re=V?V.indexOf("overlay "):-1;return re<0?V:re==0?null:V.slice(0,re-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 x=[];if(!n.hasOwnProperty(i))return x;var U=n[i],H=this.getModeAt(r);if(typeof H[i]=="string")U[H[i]]&&x.push(U[H[i]]);else if(H[i])for(var V=0;V<H[i].length;V++){var X=U[H[i][V]];X&&x.push(X)}else H.helperType&&U[H.helperType]?x.push(U[H.helperType]):U[H.name]&&x.push(U[H.name]);for(var re=0;re<U._global.length;re++){var le=U._global[re];le.pred(H,this)&&q(x,le.val)==-1&&x.push(le.val)}return x},getStateAfter:function(r,i){var x=this.doc;return r=yn(x,r==null?x.first+x.size-1:r),vr(this,r+1,i).state},cursorCoords:function(r,i){var x,U=this.doc.sel.primary();return r==null?x=U.head:typeof r=="object"?x=ft(this.doc,r):x=r?U.from():U.to(),Tr(this,x,i||"page")},charCoords:function(r,i){return ma(this,ft(this.doc,r),i||"page")},coordsChar:function(r,i){return r=lo(this,r,i||"page"),va(this,r.left,r.top)},lineAtHeight:function(r,i){return r=lo(this,{top:r,left:0},i||"page").top,gr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,x){var U=!1,H;if(typeof r=="number"){var V=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>V&&(r=V,U=!0),H=rt(this.doc,r)}else H=r;return Ui(this,H,{top:0,left:0},i||"page",x||U).top+(U?this.doc.height-xr(H):0)},defaultTextHeight:function(){return An(this.display)},defaultCharWidth:function(){return Ln(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,x,U,H){var V=this.display;r=Tr(this,ft(this.doc,r));var X=r.bottom,re=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),V.sizer.appendChild(i),U=="over")X=r.top;else if(U=="above"||U=="near"){var le=Math.max(V.wrapper.clientHeight,this.doc.height),Ee=Math.max(V.sizer.clientWidth,V.lineSpace.clientWidth);(U=="above"||r.bottom+i.offsetHeight>le)&&r.top>i.offsetHeight?X=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=le&&(X=r.bottom),re+i.offsetWidth>Ee&&(re=Ee-i.offsetWidth)}i.style.top=X+"px",i.style.left=i.style.right="",H=="right"?(re=V.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(H=="left"?re=0:H=="middle"&&(re=(V.sizer.clientWidth-i.offsetWidth)/2),i.style.left=re+"px"),x&&Qs(this,{left:re,top:X,right:re+i.offsetWidth,bottom:X+i.offsetHeight})},triggerOnKeyDown:Qt(ps),triggerOnKeyPress:Qt(gs),triggerOnKeyUp:ms,triggerOnMouseDown:Qt(vs),execCommand:function(r){if(xi.hasOwnProperty(r))return xi[r].call(null,this)},triggerElectric:Qt(function(r){ws(this,r)}),findPosH:function(r,i,x,U){var H=1;i<0&&(H=-1,i=-i);for(var V=ft(this.doc,r),X=0;X<i&&!(V=za(this.doc,V,H,x,U),V.hitSide);++X);return V},moveH:Qt(function(r,i){var x=this;this.extendSelectionsBy(function(U){return x.display.shift||x.doc.extend||U.empty()?za(x.doc,U.head,r,i,x.options.rtlMoveVisually):r<0?U.from():U.to()},ce)}),deleteH:Qt(function(r,i){var x=this.doc.sel,U=this.doc;x.somethingSelected()?U.replaceSelection("",null,"+delete"):Un(this,function(H){var V=za(U,H.head,r,i,!1);return r<0?{from:V,to:H.head}:{from:H.head,to:V}})}),findPosV:function(r,i,x,U){var H=1,V=U;i<0&&(H=-1,i=-i);for(var X=ft(this.doc,r),re=0;re<i;++re){var le=Tr(this,X,"div");if(V==null?V=le.left:le.left=V,X=Ds(this,le,H,x),X.hitSide)break}return X},moveV:Qt(function(r,i){var x=this,U=this.doc,H=[],V=!this.display.shift&&!U.extend&&U.sel.somethingSelected();if(U.extendSelectionsBy(function(re){if(V)return r<0?re.from():re.to();var le=Tr(x,re.head,"div");re.goalColumn!=null&&(le.left=re.goalColumn),H.push(le.left);var Ee=Ds(x,le,r,i);return i=="page"&&re==U.sel.primary()&&Ca(x,ma(x,Ee,"div").top-le.top),Ee},ce),H.length)for(var X=0;X<U.sel.ranges.length;X++)U.sel.ranges[X].goalColumn=H[X]}),findWordAt:function(r){var i=this.doc,x=rt(i,r.line).text,U=r.ch,H=r.ch;if(x){var V=this.getHelper(r,"wordChars");(r.sticky=="before"||H==x.length)&&U?--U:++H;for(var X=x.charAt(U),re=Oe(X,V)?function(le){return Oe(le,V)}:/\s/.test(X)?function(le){return/\s/.test(le)}:function(le){return!/\s/.test(le)&&!Oe(le)};U>0&&re(x.charAt(U-1));)--U;for(;H<x.length&&re(x.charAt(H));)++H}return new wt(Ne(r.line,U),Ne(r.line,H))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?F(this.display.cursorDiv,"CodeMirror-overwrite"):f(this.display.cursorDiv,"CodeMirror-overwrite"),Re(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==M()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Qt(function(r,i){oi(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Dr(this)-this.display.barHeight,width:r.scrollWidth-Dr(this)-this.display.barWidth,clientHeight:fa(this),clientWidth:nn(this)}},scrollIntoView:Qt(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:Ne(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?Js(this,r):Eo(this,r.from,r.to,r.margin)}),setSize:Qt(function(r,i){var x=this,U=function(V){return typeof V=="number"||/^\d+$/.test(String(V))?V+"px":V};r!=null&&(this.display.wrapper.style.width=U(r)),i!=null&&(this.display.wrapper.style.height=U(i)),this.options.lineWrapping&&ao(this);var H=this.display.viewFrom;this.doc.iter(H,this.display.viewTo,function(V){if(V.widgets){for(var X=0;X<V.widgets.length;X++)if(V.widgets[X].noHScroll){Kr(x,H,"widget");break}}++H}),this.curOp.forceUpdate=!0,Re(this,"refresh",this)}),operation:function(r){return or(this,r)},startOperation:function(){return dn(this)},endOperation:function(){return cn(this)},refresh:Qt(function(){var r=this.display.cachedTextHeight;tr(this),this.curOp.forceUpdate=!0,ii(this),oi(this,this.doc.scrollLeft,this.doc.scrollTop),Da(this.display),(r==null||Math.abs(r-An(this.display))>.5||this.options.lineWrapping)&&xa(this),Re(this,"refresh",this)}),swapDoc:Qt(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Mo(this,r),ii(this),this.display.input.reset(),oi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Gt(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}},de(e),e.registerHelper=function(r,i,x){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=x},e.registerGlobalHelper=function(r,i,x,U){e.registerHelper(r,i,U),n[r]._global.push({pred:x,val:U})}}function za(e,t,n,r,i){var x=t,U=n,H=rt(e,t.line),V=i&&e.direction=="rtl"?-n:n;function X(){var Qe=t.line+V;return Qe<e.first||Qe>=e.first+e.size?!1:(t=new Ne(Qe,t.ch,t.sticky),H=rt(e,Qe))}function re(Qe){var Ke;if(r=="codepoint"){var Ze=H.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(Ze)?Ke=null:Ke=new Ne(t.line,Math.max(0,Math.min(H.text.length,t.ch+n*(Ze>=55296&&Ze<56320?2:1))),-n)}else i?Ke=Ml(e.cm,H,t,n):Ke=Na(H,t,n);if(Ke==null)if(!Qe&&X())t=Ba(i,e.cm,H,t.line,V);else return!1;else t=Ke;return!0}if(r=="char"||r=="codepoint")re();else if(r=="column")re(!0);else if(r=="word"||r=="group")for(var le=null,Ee=r=="group",be=e.cm&&e.cm.getHelper(t,"wordChars"),ke=!0;!(n<0&&!re(!ke));ke=!1){var Ie=H.text.charAt(t.ch)||`
|
|
`,je=Oe(Ie,be)?"w":Ee&&Ie==`
|
|
`?"n":!Ee||/\s/.test(Ie)?null:"p";if(Ee&&!ke&&!je&&(je="s"),le&&le!=je){n<0&&(n=1,re(),t.sticky="after");break}if(je&&(le=je),n>0&&!re(!ke))break}var He=$i(e,t,x,U,!0);return Gn(x,He)&&(He.hitSide=!0),He}function Ds(e,t,n,r){var i=e.doc,x=t.left,U;if(r=="page"){var H=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),V=Math.max(H-.5*An(e.display),3);U=(n>0?t.bottom:t.top)+n*V}else r=="line"&&(U=n>0?t.bottom+3:t.top-3);for(var X;!(X=va(e,x,U),!X.outside);){if(n<0?U<=0:U>=i.height){X.hitSide=!0;break}U+=n*5}return X}var At=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new $,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};At.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;As(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function x(H){for(var V=H.target;V;V=V.parentNode){if(V==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(V.className))break}return!1}Ce(i,"paste",function(H){if(!x(H)||Fe(r,H)||Ss(H,r))return;N<=11&&setTimeout(jt(r,function(){return t.updateFromDOM()}),20)}),Ce(i,"compositionstart",function(H){t.composing={data:H.data,done:!1}}),Ce(i,"compositionupdate",function(H){t.composing||(t.composing={data:H.data,done:!1})}),Ce(i,"compositionend",function(H){t.composing&&(H.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ce(i,"touchstart",function(){return n.forceCompositionEnd()}),Ce(i,"input",function(){t.composing||t.readFromDOMSoon()});function U(H){if(!x(H)||Fe(r,H))return;if(r.somethingSelected())ta({lineWise:!1,text:r.getSelections()}),H.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var V=Cs(r);ta({lineWise:!0,text:V.text}),H.type=="cut"&&r.operation(function(){r.setSelections(V.ranges,0,ve),r.replaceSelection("",null,"cut")})}else return;if(H.clipboardData){H.clipboardData.clearData();var X=wr.text.join(`
|
|
`);if(H.clipboardData.setData("Text",X),H.clipboardData.getData("Text")==X){H.preventDefault();return}}var re=Ls(),le=re.firstChild;r.display.lineSpace.insertBefore(re,r.display.lineSpace.firstChild),le.value=wr.text.join(`
|
|
`);var Ee=document.activeElement;W(le),setTimeout(function(){r.display.lineSpace.removeChild(re),Ee.focus(),Ee==i&&n.showPrimarySelection()},50)}Ce(i,"copy",U),Ce(i,"cut",U)},At.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},At.prototype.prepareSelection=function(){var e=mo(this.cm,!1);return e.focus=document.activeElement==this.div,e},At.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},At.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},At.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 x=ra(t,e.anchorNode,e.anchorOffset),U=ra(t,e.focusNode,e.focusOffset);if(x&&!x.bad&&U&&!U.bad&&dt(Jr(x,U),r)==0&&dt(vn(x,U),i)==0)return;var H=t.display.view,V=r.line>=t.display.viewFrom&&Rs(t,r)||{node:H[0].measure.map[2],offset:0},X=i.line<t.display.viewTo&&Rs(t,i);if(!X){var re=H[H.length-1].measure,le=re.maps?re.maps[re.maps.length-1]:re.map;X={node:le[le.length-1],offset:le[le.length-2]-le[le.length-3]}}if(!V||!X){e.removeAllRanges();return}var Ee=e.rangeCount&&e.getRangeAt(0),be;try{be=m(V.node,V.offset,X.offset,X.node)}catch(ke){}be&&(!L&&t.state.focused?(e.collapse(V.node,V.offset),be.collapsed||(e.removeAllRanges(),e.addRange(be))):(e.removeAllRanges(),e.addRange(be)),Ee&&e.anchorNode==null?e.addRange(Ee):L&&this.startGracePeriod()),this.rememberSelection()},At.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)},At.prototype.showMultipleSelections=function(e){l(this.cm.display.cursorDiv,e.cursors),l(this.cm.display.selectionDiv,e.selection)},At.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},At.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return y(this.div,t)},At.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},At.prototype.blur=function(){this.div.blur()},At.prototype.getField=function(){return this.div},At.prototype.supportsTouch=function(){return!0},At.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():or(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)},At.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},At.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(u&&v&&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=ra(t,e.anchorNode,e.anchorOffset),r=ra(t,e.focusNode,e.focusOffset);n&&r&&or(t,function(){Xt(t.doc,zr(n,r),ve),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},At.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=Ne(r.line-1,rt(e.doc,r.line-1).length)),i.ch==rt(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Ne(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var x,U,H;r.line==t.viewFrom||(x=sn(e,r.line))==0?(U=Tt(t.view[0].line),H=t.view[0].node):(U=Tt(t.view[x].line),H=t.view[x-1].node.nextSibling);var V=sn(e,i.line),X,re;if(V==t.view.length-1?(X=t.viewTo-1,re=t.lineDiv.lastChild):(X=Tt(t.view[V+1].line)-1,re=t.view[V+1].node.previousSibling),!H)return!1;for(var le=e.doc.splitLines(tu(e,H,re,U,X)),Ee=Pr(e.doc,Ne(U,0),Ne(X,rt(e.doc,X).text.length));le.length>1&&Ee.length>1;)if(Y(le)==Y(Ee))le.pop(),Ee.pop(),X--;else if(le[0]==Ee[0])le.shift(),Ee.shift(),U++;else break;for(var be=0,ke=0,Ie=le[0],je=Ee[0],He=Math.min(Ie.length,je.length);be<He&&Ie.charCodeAt(be)==je.charCodeAt(be);)++be;for(var Qe=Y(le),Ke=Y(Ee),Ze=Math.min(Qe.length-(le.length==1?be:0),Ke.length-(Ee.length==1?be:0));ke<Ze&&Qe.charCodeAt(Qe.length-ke-1)==Ke.charCodeAt(Ke.length-ke-1);)++ke;if(le.length==1&&Ee.length==1&&U==r.line)for(;be&&be>r.ch&&Qe.charCodeAt(Qe.length-ke-1)==Ke.charCodeAt(Ke.length-ke-1);)be--,ke++;le[le.length-1]=Qe.slice(0,Qe.length-ke).replace(/^\u200b+/,""),le[0]=le[0].slice(be).replace(/\u200b+$/,"");var lt=Ne(U,be),at=Ne(X,Ee.length?Y(Ee).length-ke:0);if(le.length>1||le[0]||dt(lt,at))return Mn(e.doc,le,lt,at,"+input"),!0},At.prototype.ensurePolled=function(){this.forceCompositionEnd()},At.prototype.reset=function(){this.forceCompositionEnd()},At.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},At.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)},At.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&or(this.cm,function(){return tr(e.cm)})},At.prototype.setUneditable=function(e){e.contentEditable="false"},At.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||jt(this.cm,Ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},At.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},At.prototype.onContextMenu=function(){},At.prototype.resetPosition=function(){},At.prototype.needsContentAttribute=!0;function Rs(e,t){var n=ha(e,t.line);if(!n||n.hidden)return null;var r=rt(e.doc,t.line),i=eo(n,r,t.line),x=Je(r,e.doc.direction),U="left";if(x){var H=Ge(x,t.ch);U=H%2?"right":"left"}var V=no(i.map,t.ch,U);return V.offset=V.collapse=="right"?V.end:V.start,V}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Bn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var x="",U=!1,H=e.doc.lineSeparator(),V=!1;function X(be){return function(ke){return ke.id==be}}function re(){U&&(x+=H,V&&(x+=H),U=V=!1)}function le(be){be&&(re(),x+=be)}function Ee(be){if(be.nodeType==1){var ke=be.getAttribute("cm-text");if(ke){le(ke);return}var Ie=be.getAttribute("cm-marker"),je;if(Ie){var He=e.findMarks(Ne(r,0),Ne(i+1,0),X(+Ie));He.length&&(je=He[0].find(0))&&le(Pr(e.doc,je.from,je.to).join(H));return}if(be.getAttribute("contenteditable")=="false")return;var Qe=/^(pre|div|p|li|table|br)$/i.test(be.nodeName);if(!/^br$/i.test(be.nodeName)&&be.textContent.length==0)return;Qe&&re();for(var Ke=0;Ke<be.childNodes.length;Ke++)Ee(be.childNodes[Ke]);/^(pre|p)$/i.test(be.nodeName)&&(V=!0),Qe&&(U=!0)}else be.nodeType==3&&le(be.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Ee(t),t==n);)t=t.nextSibling,V=!1;return x}function ra(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Bn(e.clipPos(Ne(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 x=e.display.view[i];if(x.node==r)return ru(x,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!y(r,t))return Bn(Ne(Tt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var x=e.rest?Y(e.rest):e.line;return Bn(Ne(Tt(x),x.text.length),i)}var U=t.nodeType==3?t:null,H=t;for(!U&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(U=t.firstChild,n&&(n=U.nodeValue.length));H.parentNode!=r;)H=H.parentNode;var V=e.measure,X=V.maps;function re(je,He,Qe){for(var Ke=-1;Ke<(X?X.length:0);Ke++)for(var Ze=Ke<0?V.map:X[Ke],lt=0;lt<Ze.length;lt+=3){var at=Ze[lt+2];if(at==je||at==He){var pt=Tt(Ke<0?e.line:e.rest[Ke]),Dt=Ze[lt]+Qe;return(Qe<0||at!=je)&&(Dt=Ze[lt+(Qe?1:0)]),Ne(pt,Dt)}}}var le=re(U,H,n);if(le)return Bn(le,i);for(var Ee=H.nextSibling,be=U?U.nodeValue.length-n:0;Ee;Ee=Ee.nextSibling){if(le=re(Ee,Ee.firstChild,0),le)return Bn(Ne(le.line,le.ch-be),i);be+=Ee.textContent.length}for(var ke=H.previousSibling,Ie=n;ke;ke=ke.previousSibling){if(le=re(ke,ke.firstChild,-1),le)return Bn(Ne(le.line,le.ch+Ie),i);Ie+=ke.textContent.length}}var _t=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new $,this.hasSelection=!1,this.composing=null};_t.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),E&&(i.style.width="0px"),Ce(i,"input",function(){B&&N>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ce(i,"paste",function(U){if(Fe(r,U)||Ss(U,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function x(U){if(Fe(r,U))return;if(r.somethingSelected())ta({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var H=Cs(r);ta({lineWise:!0,text:H.text}),U.type=="cut"?r.setSelections(H.ranges,null,ve):(n.prevInput="",i.value=H.text.join(`
|
|
`),W(i))}else return;U.type=="cut"&&(r.state.cutIncoming=+new Date)}Ce(i,"cut",x),Ce(i,"copy",x),Ce(e.scroller,"paste",function(U){if(Nr(e,U)||Fe(r,U))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var H=new Event("paste");H.clipboardData=U.clipboardData,i.dispatchEvent(H)}),Ce(e.lineSpace,"selectstart",function(U){Nr(e,U)||Q(U)}),Ce(i,"compositionstart",function(){var U=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:U,range:r.markText(U,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ce(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},_t.prototype.createField=function(e){this.wrapper=Ls(),this.textarea=this.wrapper.firstChild},_t.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},_t.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=mo(e);if(e.options.moveInputWithCursor){var i=Tr(e,n.sel.primary().head,"div"),x=t.wrapper.getBoundingClientRect(),U=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+U.top-x.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+U.left-x.left))}return r},_t.prototype.showSelection=function(e){var t=this.cm,n=t.display;l(n.cursorDiv,e.cursors),l(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},_t.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&&W(this.textarea),B&&N>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",B&&N>=9&&(this.hasSelection=null))},_t.prototype.getField=function(){return this.textarea},_t.prototype.supportsTouch=function(){return!1},_t.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||M()!=this.textarea))try{this.textarea.focus()}catch(e){}},_t.prototype.blur=function(){this.textarea.blur()},_t.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},_t.prototype.receivedFocus=function(){this.slowPoll()},_t.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()})},_t.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)},_t.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||ot(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(B&&N>=9&&this.hasSelection===i||s&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var x=i.charCodeAt(0);if(x==8203&&!r&&(r="\u200B"),x==8666)return this.reset(),this.cm.execCommand("undo")}for(var U=0,H=Math.min(r.length,i.length);U<H&&r.charCodeAt(U)==i.charCodeAt(U);)++U;return or(t,function(){Ga(t,i.slice(U),r.length-U,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},_t.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},_t.prototype.onKeyPress=function(){B&&N>=9&&(this.hasSelection=null),this.fastPoll()},_t.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var x=on(n,e),U=r.scroller.scrollTop;if(!x||w)return;var H=n.options.resetSelectionOnContextMenu;H&&n.doc.sel.contains(x)==-1&&jt(n,Xt)(n.doc,zr(x),ve);var V=i.style.cssText,X=t.wrapper.style.cssText,re=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-re.top-5)+"px; left: "+(e.clientX-re.left-5)+`px;
|
|
z-index: 1000; background: `+(B?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var le;k&&(le=window.scrollY),r.input.focus(),k&&window.scrollTo(null,le),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=be,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function Ee(){if(i.selectionStart!=null){var Ie=n.somethingSelected(),je="\u200B"+(Ie?i.value:"");i.value="\u21DA",i.value=je,t.prevInput=Ie?"":"\u200B",i.selectionStart=1,i.selectionEnd=je.length,r.selForContextMenu=n.doc.sel}}function be(){if(t.contextMenuPending!=be)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=X,i.style.cssText=V,B&&N<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=U),i.selectionStart!=null){(!B||B&&N<9)&&Ee();var Ie=0,je=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?jt(n,Xo)(n):Ie++<10?r.detectingSelectAll=setTimeout(je,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(je,200)}}if(B&&N>=9&&Ee(),A){se(e);var ke=function(){$e(window,"mouseup",ke),setTimeout(be,20)};Ce(window,"mouseup",ke)}else setTimeout(be,50)},_t.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},_t.prototype.setUneditable=function(){},_t.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?_(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=M();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=H.getValue()}var i;if(e.form&&(Ce(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var x=e.form;i=x.submit;try{var U=x.submit=function(){r(),x.submit=i,x.submit(),x.submit=U}}catch(V){}}t.finishInit=function(V){V.save=r,V.getTextArea=function(){return e},V.toTextArea=function(){V.toTextArea=isNaN,r(),e.parentNode.removeChild(V.getWrapperElement()),e.style.display="",e.form&&($e(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var H=Rt(function(V){return e.parentNode.insertBefore(V,e.nextSibling)},t);return H}function iu(e){e.off=$e,e.on=Ce,e.wheelEventPixels=cl,e.Doc=rr,e.splitLines=ht,e.countColumn=K,e.findColumn=he,e.isWordChar=Se,e.Pass=Te,e.signal=Re,e.Line=rn,e.changeEnd=Vr,e.scrollbarModel=So,e.Pos=Ne,e.cmpPos=dt,e.modes=Ft,e.mimeModes=bt,e.resolveMode=lr,e.getMode=mr,e.modeExtensions=fr,e.extendMode=ia,e.copyState=Ar,e.startState=Kn,e.innerMode=Hn,e.commands=xi,e.keyMap=Br,e.keyName=us,e.isModifierKey=ss,e.lookupKey=Fn,e.normalizeKeyMap=_l,e.StringStream=kt,e.SharedTextMarker=yi,e.TextMarker=Yr,e.LineWidget=vi,e.e_preventDefault=Q,e.e_stopPropagation=J,e.e_stop=se,e.addClass=F,e.contains=y,e.rmClass=f,e.keyNames=$r}$l(Rt),ql(Rt);var au="iter insert remove copy getEditor constructor".split(" ");for(var na in rr.prototype)rr.prototype.hasOwnProperty(na)&&q(au,na)<0&&(Rt.prototype[na]=function(e){return function(){return e.apply(this.doc,arguments)}}(rr.prototype[na]));return de(rr),Rt.inputStyles={textarea:_t,contenteditable:At},Rt.defineMode=function(e){!Rt.defaults.mode&&e!="null"&&(Rt.defaults.mode=e),Cr.apply(this,arguments)},Rt.defineMIME=kr,Rt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Rt.defineMIME("text/plain","null"),Rt.defineExtension=function(e,t){Rt.prototype[e]=t},Rt.defineDocExtension=function(e,t){rr.prototype[e]=t},Rt.fromTextArea=nu,iu(Rt),Rt.version="5.58.2",Rt})},X0ci:function(ut,Ye,ie){},Y1PL:function(ut,Ye,ie){"use strict";ie.r(Ye),ie.d(Ye,"ResizableTextArea",function(){return q});var ee=ie("wx14"),z=ie("1OyB"),L=ie("vuIU"),G=ie("Ji7U"),I=ie("LK+K"),P=ie("cDcd"),B=ie("VTBJ"),N=ie("rePB"),k=ie("Zm9Q"),D=ie("Kwbf"),v=ie("c+Xe"),w=ie("m+aA"),R=ie("bdgK"),C=new Map;function T(ve){ve.forEach(function(ge){var ce,he=ge.target;(ce=C.get(he))===null||ce===void 0||ce.forEach(function(oe){return oe(he)})})}var E=new R.default(T),u=null,o=null;function s(ve,ge){C.has(ve)||(C.set(ve,new Set),E.observe(ve)),C.get(ve).add(ge)}function d(ve,ge){C.has(ve)&&(C.get(ve).delete(ge),C.get(ve).size||(E.unobserve(ve),C.delete(ve)))}var S=function(ve){Object(G.a)(ce,ve);var ge=Object(I.a)(ce);function ce(){return Object(z.a)(this,ce),ge.apply(this,arguments)}return Object(L.a)(ce,[{key:"render",value:function(){return this.props.children}}]),ce}(P.Component),p=P.createContext(null);function h(ve){var ge=ve.children,ce=ve.onBatchResize,he=P.useRef(0),oe=P.useRef([]),pe=P.useContext(p),Y=P.useCallback(function(ae,Z,xe){he.current+=1;var we=he.current;oe.current.push({size:ae,element:Z,data:xe}),Promise.resolve().then(function(){we===he.current&&(ce==null||ce(oe.current),oe.current=[])}),pe==null||pe(ae,Z,xe)},[ce,pe]);return P.createElement(p.Provider,{value:Y},ge)}function A(ve){var ge=ve.children,ce=ve.disabled,he=P.useRef(null),oe=P.useRef(null),pe=P.useContext(p),Y=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ae=P.isValidElement(ge)&&Object(v.c)(ge),Z=ae?ge.ref:null,xe=P.useMemo(function(){return Object(v.a)(Z,he)},[Z,he]),we=P.useRef(ve);we.current=ve;var ye=P.useCallback(function(Se){var Oe=we.current,Pe=Oe.onResize,_e=Oe.data,De=Se.getBoundingClientRect(),Le=De.width,Ue=De.height,Ve=Se.offsetWidth,We=Se.offsetHeight,Ge=Math.floor(Le),et=Math.floor(Ue);if(Y.current.width!==Ge||Y.current.height!==et||Y.current.offsetWidth!==Ve||Y.current.offsetHeight!==We){var Je={width:Ge,height:et,offsetWidth:Ve,offsetHeight:We};Y.current=Je;var ze=Ve===Math.round(Le)?Le:Ve,Ce=We===Math.round(Ue)?Ue:We,qe=Object(B.a)(Object(B.a)({},Je),{},{offsetWidth:ze,offsetHeight:Ce});pe==null||pe(qe,Se,_e),Pe&&Promise.resolve().then(function(){Pe(qe,Se)})}},[]);return P.useEffect(function(){var Se=Object(w.a)(he.current)||Object(w.a)(oe.current);return Se&&!ce&&s(Se,ye),function(){return d(Se,ye)}},[he.current,ce]),P.createElement(S,{ref:oe},ae?P.cloneElement(ge,{ref:xe}):ge)}var b="rc-observer-key";function f(ve){var ge=ve.children,ce=Object(k.a)(ge);return ce.map(function(he,oe){var pe=(he==null?void 0:he.key)||"".concat(b,"-").concat(oe);return P.createElement(A,Object(ee.a)({},ve,{key:pe}),he)})}f.Collection=h;var c=f,l=ie("bT9E"),a=ie("TSYQ"),g=ie.n(a),m=`
|
|
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
|
|
`,y=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],M={},F;function j(ve){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ce=ve.getAttribute("id")||ve.getAttribute("data-reactid")||ve.getAttribute("name");if(ge&&M[ce])return M[ce];var he=window.getComputedStyle(ve),oe=he.getPropertyValue("box-sizing")||he.getPropertyValue("-moz-box-sizing")||he.getPropertyValue("-webkit-box-sizing"),pe=parseFloat(he.getPropertyValue("padding-bottom"))+parseFloat(he.getPropertyValue("padding-top")),Y=parseFloat(he.getPropertyValue("border-bottom-width"))+parseFloat(he.getPropertyValue("border-top-width")),ae=y.map(function(xe){return"".concat(xe,":").concat(he.getPropertyValue(xe))}).join(";"),Z={sizingStyle:ae,paddingSize:pe,borderSize:Y,boxSizing:oe};return ge&&ce&&(M[ce]=Z),Z}function W(ve){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ce=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,he=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;F||(F=document.createElement("textarea"),F.setAttribute("tab-index","-1"),F.setAttribute("aria-hidden","true"),document.body.appendChild(F)),ve.getAttribute("wrap")?F.setAttribute("wrap",ve.getAttribute("wrap")):F.removeAttribute("wrap");var oe=j(ve,ge),pe=oe.paddingSize,Y=oe.borderSize,ae=oe.boxSizing,Z=oe.sizingStyle;F.setAttribute("style","".concat(Z,";").concat(m)),F.value=ve.value||ve.placeholder||"";var xe=Number.MIN_SAFE_INTEGER,we=Number.MAX_SAFE_INTEGER,ye=F.scrollHeight,Se;if(ae==="border-box"?ye+=Y:ae==="content-box"&&(ye-=pe),ce!==null||he!==null){F.value=" ";var Oe=F.scrollHeight-pe;ce!==null&&(xe=Oe*ce,ae==="border-box"&&(xe=xe+pe+Y),ye=Math.max(xe,ye)),he!==null&&(we=Oe*he,ae==="border-box"&&(we=we+pe+Y),Se=ye>we?"":"hidden",ye=Math.min(we,ye))}return{height:ye,minHeight:xe,maxHeight:we,overflowY:Se,resize:"none"}}var O=ie("Gytx"),_=ie.n(O),K;(function(ve){ve[ve.NONE=0]="NONE",ve[ve.RESIZING=1]="RESIZING",ve[ve.RESIZED=2]="RESIZED"})(K||(K={}));var $=function(ve){Object(G.a)(ce,ve);var ge=Object(I.a)(ce);function ce(he){var oe;return Object(z.a)(this,ce),oe=ge.call(this,he),oe.nextFrameActionId=void 0,oe.resizeFrameId=void 0,oe.textArea=void 0,oe.saveTextArea=function(pe){oe.textArea=pe},oe.handleResize=function(pe){var Y=oe.state.resizeStatus,ae=oe.props,Z=ae.autoSize,xe=ae.onResize;if(Y!==K.NONE)return;typeof xe=="function"&&xe(pe),Z&&oe.resizeOnNextFrame()},oe.resizeOnNextFrame=function(){cancelAnimationFrame(oe.nextFrameActionId),oe.nextFrameActionId=requestAnimationFrame(oe.resizeTextarea)},oe.resizeTextarea=function(){var pe=oe.props.autoSize;if(!pe||!oe.textArea)return;var Y=pe.minRows,ae=pe.maxRows,Z=W(oe.textArea,!1,Y,ae);oe.setState({textareaStyles:Z,resizeStatus:K.RESIZING},function(){cancelAnimationFrame(oe.resizeFrameId),oe.resizeFrameId=requestAnimationFrame(function(){oe.setState({resizeStatus:K.RESIZED},function(){oe.resizeFrameId=requestAnimationFrame(function(){oe.setState({resizeStatus:K.NONE}),oe.fixFirefoxAutoScroll()})})})})},oe.renderTextArea=function(){var pe=oe.props,Y=pe.prefixCls,ae=Y===void 0?"rc-textarea":Y,Z=pe.autoSize,xe=pe.onResize,we=pe.className,ye=pe.disabled,Se=oe.state,Oe=Se.textareaStyles,Pe=Se.resizeStatus,_e=Object(l.a)(oe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),De=g()(ae,we,Object(N.a)({},"".concat(ae,"-disabled"),ye));"value"in _e&&(_e.value=_e.value||"");var Le=Object(B.a)(Object(B.a)(Object(B.a)({},oe.props.style),Oe),Pe===K.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(c,{onResize:oe.handleResize,disabled:!(Z||xe)},P.createElement("textarea",Object(ee.a)({},_e,{className:De,style:Le,ref:oe.saveTextArea})))},oe.state={textareaStyles:{},resizeStatus:K.NONE},oe}return Object(L.a)(ce,[{key:"componentDidUpdate",value:function(oe){(oe.value!==this.props.value||!_()(oe.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 oe=this.textArea.selectionStart,pe=this.textArea.selectionEnd;this.textArea.setSelectionRange(oe,pe)}}catch(Y){}}},{key:"render",value:function(){return this.renderTextArea()}}]),ce}(P.Component),q=$,ne=function(ve){Object(G.a)(ce,ve);var ge=Object(I.a)(ce);function ce(he){var oe;Object(z.a)(this,ce),oe=ge.call(this,he),oe.resizableTextArea=void 0,oe.focus=function(){oe.resizableTextArea.textArea.focus()},oe.saveTextArea=function(Y){oe.resizableTextArea=Y},oe.handleChange=function(Y){var ae=oe.props.onChange;oe.setValue(Y.target.value,function(){oe.resizableTextArea.resizeTextarea()}),ae&&ae(Y)},oe.handleKeyDown=function(Y){var ae=oe.props,Z=ae.onPressEnter,xe=ae.onKeyDown;Y.keyCode===13&&Z&&Z(Y),xe&&xe(Y)};var pe=typeof he.value=="undefined"||he.value===null?he.defaultValue:he.value;return oe.state={value:pe},oe}return Object(L.a)(ce,[{key:"setValue",value:function(oe,pe){"value"in this.props||this.setState({value:oe},pe)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(q,Object(ee.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(oe){return"value"in oe?{value:oe.value}:null}}]),ce}(P.Component),Te=Ye.default=ne},ZpRC:function(ut,Ye,ie){"use strict";function ee(v){return typeof v=="object"&&v!=null&&v.nodeType===1}function z(v,w){return(!w||v!=="hidden")&&v!=="visible"&&v!=="clip"}function L(v,w){if(v.clientHeight<v.scrollHeight||v.clientWidth<v.scrollWidth){var R=getComputedStyle(v,null);return z(R.overflowY,w)||z(R.overflowX,w)||function(C){var T=function(E){if(!E.ownerDocument||!E.ownerDocument.defaultView)return null;try{return E.ownerDocument.defaultView.frameElement}catch(u){return null}}(C);return!!T&&(T.clientHeight<C.scrollHeight||T.clientWidth<C.scrollWidth)}(v)}return!1}function G(v,w,R,C,T,E,u,o){return E<v&&u>w||E>v&&u<w?0:E<=v&&o<=R||u>=w&&o>=R?E-v-C:u>w&&o<R||E<v&&o>R?u-w+T:0}var I=function(v,w){var R=window,C=w.scrollMode,T=w.block,E=w.inline,u=w.boundary,o=w.skipOverflowHiddenElements,s=typeof u=="function"?u:function(Oe){return Oe!==u};if(!ee(v))throw new TypeError("Invalid target");for(var d=document.scrollingElement||document.documentElement,S=[],p=v;ee(p)&&s(p);){if((p=p.parentElement)===d){S.push(p);break}p!=null&&p===document.body&&L(p)&&!L(document.documentElement)||p!=null&&L(p,o)&&S.push(p)}for(var h=R.visualViewport?R.visualViewport.width:innerWidth,A=R.visualViewport?R.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,f=window.scrollY||pageYOffset,c=v.getBoundingClientRect(),l=c.height,a=c.width,g=c.top,m=c.right,y=c.bottom,M=c.left,F=T==="start"||T==="nearest"?g:T==="end"?y:g+l/2,j=E==="center"?M+a/2:E==="end"?m:M,W=[],O=0;O<S.length;O++){var _=S[O],K=_.getBoundingClientRect(),$=K.height,q=K.width,ne=K.top,Te=K.right,ve=K.bottom,ge=K.left;if(C==="if-needed"&&g>=0&&M>=0&&y<=A&&m<=h&&g>=ne&&y<=ve&&M>=ge&&m<=Te)return W;var ce=getComputedStyle(_),he=parseInt(ce.borderLeftWidth,10),oe=parseInt(ce.borderTopWidth,10),pe=parseInt(ce.borderRightWidth,10),Y=parseInt(ce.borderBottomWidth,10),ae=0,Z=0,xe="offsetWidth"in _?_.offsetWidth-_.clientWidth-he-pe:0,we="offsetHeight"in _?_.offsetHeight-_.clientHeight-oe-Y:0;if(d===_)ae=T==="start"?F:T==="end"?F-A:T==="nearest"?G(f,f+A,A,oe,Y,f+F,f+F+l,l):F-A/2,Z=E==="start"?j:E==="center"?j-h/2:E==="end"?j-h:G(b,b+h,h,he,pe,b+j,b+j+a,a),ae=Math.max(0,ae+f),Z=Math.max(0,Z+b);else{ae=T==="start"?F-ne-oe:T==="end"?F-ve+Y+we:T==="nearest"?G(ne,ve,$,oe,Y+we,F,F+l,l):F-(ne+$/2)+we/2,Z=E==="start"?j-ge-he:E==="center"?j-(ge+q/2)+xe/2:E==="end"?j-Te+pe+xe:G(ge,Te,q,he,pe+xe,j,j+a,a);var ye=_.scrollLeft,Se=_.scrollTop;F+=Se-(ae=Math.max(0,Math.min(Se+ae,_.scrollHeight-$+we))),j+=ye-(Z=Math.max(0,Math.min(ye+Z,_.scrollWidth-q+xe)))}W.push({el:_,top:ae,left:Z})}return W};function P(v){return v===Object(v)&&Object.keys(v).length!==0}function B(v,w){w===void 0&&(w="auto");var R="scrollBehavior"in document.body.style;v.forEach(function(C){var T=C.el,E=C.top,u=C.left;T.scroll&&R?T.scroll({top:E,left:u,behavior:w}):(T.scrollTop=E,T.scrollLeft=u)})}function N(v){return v===!1?{block:"end",inline:"nearest"}:P(v)?v:{block:"start",inline:"nearest"}}function k(v,w){var R=!v.ownerDocument.documentElement.contains(v);if(P(w)&&typeof w.behavior=="function")return w.behavior(R?[]:I(v,w));if(R)return;var C=N(w);return B(I(v,C),C.behavior)}var D=Ye.a=k},Zss7:function(ut,Ye,ie){var ee;(function(z){var L=/^\s+/,G=/\s+$/,I=0,P=z.round,B=z.min,N=z.max,k=z.random;function D(Y,ae){if(Y=Y||"",ae=ae||{},Y instanceof D)return Y;if(!(this instanceof D))return new D(Y,ae);var Z=v(Y);this._originalInput=Y,this._r=Z.r,this._g=Z.g,this._b=Z.b,this._a=Z.a,this._roundA=P(100*this._a)/100,this._format=ae.format||Z.format,this._gradientType=ae.gradientType,this._r<1&&(this._r=P(this._r)),this._g<1&&(this._g=P(this._g)),this._b<1&&(this._b=P(this._b)),this._ok=Z.ok,this._tc_id=I++}D.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var Y=this.toRgb();return(Y.r*299+Y.g*587+Y.b*114)/1e3},getLuminance:function(){var Y=this.toRgb(),ae,Z,xe,we,ye,Se;return ae=Y.r/255,Z=Y.g/255,xe=Y.b/255,ae<=.03928?we=ae/12.92:we=z.pow((ae+.055)/1.055,2.4),Z<=.03928?ye=Z/12.92:ye=z.pow((Z+.055)/1.055,2.4),xe<=.03928?Se=xe/12.92:Se=z.pow((xe+.055)/1.055,2.4),.2126*we+.7152*ye+.0722*Se},setAlpha:function(Y){return this._a=W(Y),this._roundA=P(100*this._a)/100,this},toHsv:function(){var Y=T(this._r,this._g,this._b);return{h:Y.h*360,s:Y.s,v:Y.v,a:this._a}},toHsvString:function(){var Y=T(this._r,this._g,this._b),ae=P(Y.h*360),Z=P(Y.s*100),xe=P(Y.v*100);return this._a==1?"hsv("+ae+", "+Z+"%, "+xe+"%)":"hsva("+ae+", "+Z+"%, "+xe+"%, "+this._roundA+")"},toHsl:function(){var Y=R(this._r,this._g,this._b);return{h:Y.h*360,s:Y.s,l:Y.l,a:this._a}},toHslString:function(){var Y=R(this._r,this._g,this._b),ae=P(Y.h*360),Z=P(Y.s*100),xe=P(Y.l*100);return this._a==1?"hsl("+ae+", "+Z+"%, "+xe+"%)":"hsla("+ae+", "+Z+"%, "+xe+"%, "+this._roundA+")"},toHex:function(Y){return u(this._r,this._g,this._b,Y)},toHexString:function(Y){return"#"+this.toHex(Y)},toHex8:function(Y){return o(this._r,this._g,this._b,this._a,Y)},toHex8String:function(Y){return"#"+this.toHex8(Y)},toRgb:function(){return{r:P(this._r),g:P(this._g),b:P(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+P(this._r)+", "+P(this._g)+", "+P(this._b)+")":"rgba("+P(this._r)+", "+P(this._g)+", "+P(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:P(O(this._r,255)*100)+"%",g:P(O(this._g,255)*100)+"%",b:P(O(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+P(O(this._r,255)*100)+"%, "+P(O(this._g,255)*100)+"%, "+P(O(this._b,255)*100)+"%)":"rgba("+P(O(this._r,255)*100)+"%, "+P(O(this._g,255)*100)+"%, "+P(O(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:F[u(this._r,this._g,this._b,!0)]||!1},toFilter:function(Y){var ae="#"+s(this._r,this._g,this._b,this._a),Z=ae,xe=this._gradientType?"GradientType = 1, ":"";if(Y){var we=D(Y);Z="#"+s(we._r,we._g,we._b,we._a)}return"progid:DXImageTransform.Microsoft.gradient("+xe+"startColorstr="+ae+",endColorstr="+Z+")"},toString:function(Y){var ae=!!Y;Y=Y||this._format;var Z=!1,xe=this._a<1&&this._a>=0,we=!ae&&xe&&(Y==="hex"||Y==="hex6"||Y==="hex3"||Y==="hex4"||Y==="hex8"||Y==="name");return we?Y==="name"&&this._a===0?this.toName():this.toRgbString():(Y==="rgb"&&(Z=this.toRgbString()),Y==="prgb"&&(Z=this.toPercentageRgbString()),(Y==="hex"||Y==="hex6")&&(Z=this.toHexString()),Y==="hex3"&&(Z=this.toHexString(!0)),Y==="hex4"&&(Z=this.toHex8String(!0)),Y==="hex8"&&(Z=this.toHex8String()),Y==="name"&&(Z=this.toName()),Y==="hsl"&&(Z=this.toHslString()),Y==="hsv"&&(Z=this.toHsvString()),Z||this.toHexString())},clone:function(){return D(this.toString())},_applyModification:function(Y,ae){var Z=Y.apply(null,[this].concat([].slice.call(ae)));return this._r=Z._r,this._g=Z._g,this._b=Z._b,this.setAlpha(Z._a),this},lighten:function(){return this._applyModification(h,arguments)},brighten:function(){return this._applyModification(A,arguments)},darken:function(){return this._applyModification(b,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(S,arguments)},greyscale:function(){return this._applyModification(p,arguments)},spin:function(){return this._applyModification(f,arguments)},_applyCombination:function(Y,ae){return Y.apply(null,[this].concat([].slice.call(ae)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(y,arguments)},splitcomplement:function(){return this._applyCombination(g,arguments)},triad:function(){return this._applyCombination(l,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},D.fromRatio=function(Y,ae){if(typeof Y=="object"){var Z={};for(var xe in Y)Y.hasOwnProperty(xe)&&(xe==="a"?Z[xe]=Y[xe]:Z[xe]=Te(Y[xe]));Y=Z}return D(Y,ae)};function v(Y){var ae={r:0,g:0,b:0},Z=1,xe=null,we=null,ye=null,Se=!1,Oe=!1;return typeof Y=="string"&&(Y=oe(Y)),typeof Y=="object"&&(he(Y.r)&&he(Y.g)&&he(Y.b)?(ae=w(Y.r,Y.g,Y.b),Se=!0,Oe=String(Y.r).substr(-1)==="%"?"prgb":"rgb"):he(Y.h)&&he(Y.s)&&he(Y.v)?(xe=Te(Y.s),we=Te(Y.v),ae=E(Y.h,xe,we),Se=!0,Oe="hsv"):he(Y.h)&&he(Y.s)&&he(Y.l)&&(xe=Te(Y.s),ye=Te(Y.l),ae=C(Y.h,xe,ye),Se=!0,Oe="hsl"),Y.hasOwnProperty("a")&&(Z=Y.a)),Z=W(Z),{ok:Se,format:Y.format||Oe,r:B(255,N(ae.r,0)),g:B(255,N(ae.g,0)),b:B(255,N(ae.b,0)),a:Z}}function w(Y,ae,Z){return{r:O(Y,255)*255,g:O(ae,255)*255,b:O(Z,255)*255}}function R(Y,ae,Z){Y=O(Y,255),ae=O(ae,255),Z=O(Z,255);var xe=N(Y,ae,Z),we=B(Y,ae,Z),ye,Se,Oe=(xe+we)/2;if(xe==we)ye=Se=0;else{var Pe=xe-we;Se=Oe>.5?Pe/(2-xe-we):Pe/(xe+we);switch(xe){case Y:ye=(ae-Z)/Pe+(ae<Z?6:0);break;case ae:ye=(Z-Y)/Pe+2;break;case Z:ye=(Y-ae)/Pe+4;break}ye/=6}return{h:ye,s:Se,l:Oe}}function C(Y,ae,Z){var xe,we,ye;Y=O(Y,360),ae=O(ae,100),Z=O(Z,100);function Se(_e,De,Le){return Le<0&&(Le+=1),Le>1&&(Le-=1),Le<1/6?_e+(De-_e)*6*Le:Le<1/2?De:Le<2/3?_e+(De-_e)*(2/3-Le)*6:_e}if(ae===0)xe=we=ye=Z;else{var Oe=Z<.5?Z*(1+ae):Z+ae-Z*ae,Pe=2*Z-Oe;xe=Se(Pe,Oe,Y+1/3),we=Se(Pe,Oe,Y),ye=Se(Pe,Oe,Y-1/3)}return{r:xe*255,g:we*255,b:ye*255}}function T(Y,ae,Z){Y=O(Y,255),ae=O(ae,255),Z=O(Z,255);var xe=N(Y,ae,Z),we=B(Y,ae,Z),ye,Se,Oe=xe,Pe=xe-we;if(Se=xe===0?0:Pe/xe,xe==we)ye=0;else{switch(xe){case Y:ye=(ae-Z)/Pe+(ae<Z?6:0);break;case ae:ye=(Z-Y)/Pe+2;break;case Z:ye=(Y-ae)/Pe+4;break}ye/=6}return{h:ye,s:Se,v:Oe}}function E(Y,ae,Z){Y=O(Y,360)*6,ae=O(ae,100),Z=O(Z,100);var xe=z.floor(Y),we=Y-xe,ye=Z*(1-ae),Se=Z*(1-we*ae),Oe=Z*(1-(1-we)*ae),Pe=xe%6,_e=[Z,Se,ye,ye,Oe,Z][Pe],De=[Oe,Z,Z,Se,ye,ye][Pe],Le=[ye,ye,Oe,Z,Z,Se][Pe];return{r:_e*255,g:De*255,b:Le*255}}function u(Y,ae,Z,xe){var we=[ne(P(Y).toString(16)),ne(P(ae).toString(16)),ne(P(Z).toString(16))];return xe&&we[0].charAt(0)==we[0].charAt(1)&&we[1].charAt(0)==we[1].charAt(1)&&we[2].charAt(0)==we[2].charAt(1)?we[0].charAt(0)+we[1].charAt(0)+we[2].charAt(0):we.join("")}function o(Y,ae,Z,xe,we){var ye=[ne(P(Y).toString(16)),ne(P(ae).toString(16)),ne(P(Z).toString(16)),ne(ve(xe))];return we&&ye[0].charAt(0)==ye[0].charAt(1)&&ye[1].charAt(0)==ye[1].charAt(1)&&ye[2].charAt(0)==ye[2].charAt(1)&&ye[3].charAt(0)==ye[3].charAt(1)?ye[0].charAt(0)+ye[1].charAt(0)+ye[2].charAt(0)+ye[3].charAt(0):ye.join("")}function s(Y,ae,Z,xe){var we=[ne(ve(xe)),ne(P(Y).toString(16)),ne(P(ae).toString(16)),ne(P(Z).toString(16))];return we.join("")}D.equals=function(Y,ae){return!Y||!ae?!1:D(Y).toRgbString()==D(ae).toRgbString()},D.random=function(){return D.fromRatio({r:k(),g:k(),b:k()})};function d(Y,ae){ae=ae===0?0:ae||10;var Z=D(Y).toHsl();return Z.s-=ae/100,Z.s=_(Z.s),D(Z)}function S(Y,ae){ae=ae===0?0:ae||10;var Z=D(Y).toHsl();return Z.s+=ae/100,Z.s=_(Z.s),D(Z)}function p(Y){return D(Y).desaturate(100)}function h(Y,ae){ae=ae===0?0:ae||10;var Z=D(Y).toHsl();return Z.l+=ae/100,Z.l=_(Z.l),D(Z)}function A(Y,ae){ae=ae===0?0:ae||10;var Z=D(Y).toRgb();return Z.r=N(0,B(255,Z.r-P(255*-(ae/100)))),Z.g=N(0,B(255,Z.g-P(255*-(ae/100)))),Z.b=N(0,B(255,Z.b-P(255*-(ae/100)))),D(Z)}function b(Y,ae){ae=ae===0?0:ae||10;var Z=D(Y).toHsl();return Z.l-=ae/100,Z.l=_(Z.l),D(Z)}function f(Y,ae){var Z=D(Y).toHsl(),xe=(Z.h+ae)%360;return Z.h=xe<0?360+xe:xe,D(Z)}function c(Y){var ae=D(Y).toHsl();return ae.h=(ae.h+180)%360,D(ae)}function l(Y){var ae=D(Y).toHsl(),Z=ae.h;return[D(Y),D({h:(Z+120)%360,s:ae.s,l:ae.l}),D({h:(Z+240)%360,s:ae.s,l:ae.l})]}function a(Y){var ae=D(Y).toHsl(),Z=ae.h;return[D(Y),D({h:(Z+90)%360,s:ae.s,l:ae.l}),D({h:(Z+180)%360,s:ae.s,l:ae.l}),D({h:(Z+270)%360,s:ae.s,l:ae.l})]}function g(Y){var ae=D(Y).toHsl(),Z=ae.h;return[D(Y),D({h:(Z+72)%360,s:ae.s,l:ae.l}),D({h:(Z+216)%360,s:ae.s,l:ae.l})]}function m(Y,ae,Z){ae=ae||6,Z=Z||30;var xe=D(Y).toHsl(),we=360/Z,ye=[D(Y)];for(xe.h=(xe.h-(we*ae>>1)+720)%360;--ae;)xe.h=(xe.h+we)%360,ye.push(D(xe));return ye}function y(Y,ae){ae=ae||6;for(var Z=D(Y).toHsv(),xe=Z.h,we=Z.s,ye=Z.v,Se=[],Oe=1/ae;ae--;)Se.push(D({h:xe,s:we,v:ye})),ye=(ye+Oe)%1;return Se}D.mix=function(Y,ae,Z){Z=Z===0?0:Z||50;var xe=D(Y).toRgb(),we=D(ae).toRgb(),ye=Z/100,Se={r:(we.r-xe.r)*ye+xe.r,g:(we.g-xe.g)*ye+xe.g,b:(we.b-xe.b)*ye+xe.b,a:(we.a-xe.a)*ye+xe.a};return D(Se)},D.readability=function(Y,ae){var Z=D(Y),xe=D(ae);return(z.max(Z.getLuminance(),xe.getLuminance())+.05)/(z.min(Z.getLuminance(),xe.getLuminance())+.05)},D.isReadable=function(Y,ae,Z){var xe=D.readability(Y,ae),we,ye;ye=!1,we=pe(Z);switch(we.level+we.size){case"AAsmall":case"AAAlarge":ye=xe>=4.5;break;case"AAlarge":ye=xe>=3;break;case"AAAsmall":ye=xe>=7;break}return ye},D.mostReadable=function(Y,ae,Z){var xe=null,we=0,ye,Se,Oe,Pe;Z=Z||{},Se=Z.includeFallbackColors,Oe=Z.level,Pe=Z.size;for(var _e=0;_e<ae.length;_e++)ye=D.readability(Y,ae[_e]),ye>we&&(we=ye,xe=D(ae[_e]));return D.isReadable(Y,xe,{level:Oe,size:Pe})||!Se?xe:(Z.includeFallbackColors=!1,D.mostReadable(Y,["#fff","#000"],Z))};var M=D.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},F=D.hexNames=j(M);function j(Y){var ae={};for(var Z in Y)Y.hasOwnProperty(Z)&&(ae[Y[Z]]=Z);return ae}function W(Y){return Y=parseFloat(Y),(isNaN(Y)||Y<0||Y>1)&&(Y=1),Y}function O(Y,ae){$(Y)&&(Y="100%");var Z=q(Y);return Y=B(ae,N(0,parseFloat(Y))),Z&&(Y=parseInt(Y*ae,10)/100),z.abs(Y-ae)<1e-6?1:Y%ae/parseFloat(ae)}function _(Y){return B(1,N(0,Y))}function K(Y){return parseInt(Y,16)}function $(Y){return typeof Y=="string"&&Y.indexOf(".")!=-1&&parseFloat(Y)===1}function q(Y){return typeof Y=="string"&&Y.indexOf("%")!=-1}function ne(Y){return Y.length==1?"0"+Y:""+Y}function Te(Y){return Y<=1&&(Y=Y*100+"%"),Y}function ve(Y){return z.round(parseFloat(Y)*255).toString(16)}function ge(Y){return K(Y)/255}var ce=function(){var Y="[-\\+]?\\d+%?",ae="[-\\+]?\\d*\\.\\d+%?",Z="(?:"+ae+")|(?:"+Y+")",xe="[\\s|\\(]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")\\s*\\)?",we="[\\s|\\(]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")\\s*\\)?";return{CSS_UNIT:new RegExp(Z),rgb:new RegExp("rgb"+xe),rgba:new RegExp("rgba"+we),hsl:new RegExp("hsl"+xe),hsla:new RegExp("hsla"+we),hsv:new RegExp("hsv"+xe),hsva:new RegExp("hsva"+we),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function he(Y){return!!ce.CSS_UNIT.exec(Y)}function oe(Y){Y=Y.replace(L,"").replace(G,"").toLowerCase();var ae=!1;if(M[Y])Y=M[Y],ae=!0;else if(Y=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var Z;return(Z=ce.rgb.exec(Y))?{r:Z[1],g:Z[2],b:Z[3]}:(Z=ce.rgba.exec(Y))?{r:Z[1],g:Z[2],b:Z[3],a:Z[4]}:(Z=ce.hsl.exec(Y))?{h:Z[1],s:Z[2],l:Z[3]}:(Z=ce.hsla.exec(Y))?{h:Z[1],s:Z[2],l:Z[3],a:Z[4]}:(Z=ce.hsv.exec(Y))?{h:Z[1],s:Z[2],v:Z[3]}:(Z=ce.hsva.exec(Y))?{h:Z[1],s:Z[2],v:Z[3],a:Z[4]}:(Z=ce.hex8.exec(Y))?{r:K(Z[1]),g:K(Z[2]),b:K(Z[3]),a:ge(Z[4]),format:ae?"name":"hex8"}:(Z=ce.hex6.exec(Y))?{r:K(Z[1]),g:K(Z[2]),b:K(Z[3]),format:ae?"name":"hex"}:(Z=ce.hex4.exec(Y))?{r:K(Z[1]+""+Z[1]),g:K(Z[2]+""+Z[2]),b:K(Z[3]+""+Z[3]),a:ge(Z[4]+""+Z[4]),format:ae?"name":"hex8"}:(Z=ce.hex3.exec(Y))?{r:K(Z[1]+""+Z[1]),g:K(Z[2]+""+Z[2]),b:K(Z[3]+""+Z[3]),format:ae?"name":"hex"}:!1}function pe(Y){var ae,Z;return Y=Y||{level:"AA",size:"small"},ae=(Y.level||"AA").toUpperCase(),Z=(Y.size||"small").toLowerCase(),ae!=="AA"&&ae!=="AAA"&&(ae="AA"),Z!=="small"&&Z!=="large"&&(Z="small"),{level:ae,size:Z}}ut.exports?ut.exports=D:!(ee=function(){return D}.call(Ye,ie,Ye,ut),ee!==void 0&&(ut.exports=ee))})(Math)},bT9E:function(ut,Ye,ie){"use strict";ie.d(Ye,"a",function(){return z});var ee=ie("VTBJ");function z(L,G){var I=Object(ee.a)({},L);return Array.isArray(G)&&G.forEach(function(P){delete I[P]}),I}},c5Ni:function(ut,Ye,ie){},dejd:function(ut,Ye,ie){},dmUQ:function(ut,Ye,ie){"use strict";var ee=ie("Ff2n"),z=ie("rePB"),L=ie("1OyB"),G=ie("vuIU"),I=ie("Ji7U"),P=ie("md7G"),B=ie("foSv"),N=ie("cDcd"),k=ie.n(N),D=ie("TSYQ"),v=ie.n(D),w=ie("4IlW");function R(l,a){var g=Object.keys(l);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(l);a&&(m=m.filter(function(y){return Object.getOwnPropertyDescriptor(l,y).enumerable})),g.push.apply(g,m)}return g}function C(l){for(var a=1;a<arguments.length;a++){var g=arguments[a]!=null?arguments[a]:{};a%2?R(Object(g),!0).forEach(function(m){Object(z.a)(l,m,g[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(g)):R(Object(g)).forEach(function(m){Object.defineProperty(l,m,Object.getOwnPropertyDescriptor(g,m))})}return l}function T(l){var a=E();return function(){var m=Object(B.a)(l),y;if(a){var M=Object(B.a)(this).constructor;y=Reflect.construct(m,arguments,M)}else y=m.apply(this,arguments);return Object(P.a)(this,y)}}function E(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(l){return!1}}function u(){}function o(l){l.preventDefault()}var s=function(a){return a.replace(/[^\w.-]+/g,"")},d=200,S=600,p=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,h=function(a){return a!=null},A=function(a,g){return g===a||typeof g=="number"&&typeof a=="number"&&isNaN(g)&&isNaN(a)},b=function(l){Object(I.a)(g,l);var a=T(g);function g(m){var y;Object(L.a)(this,g),y=a.call(this,m),y.onKeyDown=function(j){var W=y.props,O=W.onKeyDown,_=W.onPressEnter;if(j.keyCode===w.a.UP){var K=y.getRatio(j);y.up(j,K,null),y.stop()}else if(j.keyCode===w.a.DOWN){var $=y.getRatio(j);y.down(j,$,null),y.stop()}else j.keyCode===w.a.ENTER&&_&&_(j);if(y.recordCursorPosition(),y.lastKeyCode=j.keyCode,O){for(var q=arguments.length,ne=new Array(q>1?q-1:0),Te=1;Te<q;Te++)ne[Te-1]=arguments[Te];O.apply(void 0,[j].concat(ne))}},y.onKeyUp=function(j){var W=y.props.onKeyUp;if(y.stop(),y.recordCursorPosition(),W){for(var O=arguments.length,_=new Array(O>1?O-1:0),K=1;K<O;K++)_[K-1]=arguments[K];W.apply(void 0,[j].concat(_))}},y.onChange=function(j){var W=y.props.onChange;y.state.focused&&(y.inputting=!0),y.rawInput=y.props.parser(y.getValueFromEvent(j)),y.setState({inputValue:y.rawInput}),W(y.toNumber(y.rawInput))},y.onMouseUp=function(){var j=y.props.onMouseUp;y.recordCursorPosition(),j&&j.apply(void 0,arguments)},y.onFocus=function(){var j;y.setState({focused:!0}),(j=y.props).onFocus.apply(j,arguments)},y.onBlur=function(){var j=y.props.onBlur;y.inputting=!1,y.setState({focused:!1});var W=y.getCurrentValidValue(y.state.inputValue),O=y.setValue(W,u);if(j){var _=y.input.value,K=y.getInputDisplayValue({focus:!1,value:O});y.input.value=K&&Number(K),j.apply(void 0,arguments),y.input.value=_}},y.getRatio=function(j){var W=1;return j.metaKey||j.ctrlKey?W=.1:j.shiftKey&&(W=10),W},y.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},y.getPrecision=function(j){if(h(y.props.precision))return y.props.precision;var W=String(j);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var O=0;return W.indexOf(".")>=0&&(O=W.length-W.indexOf(".")-1),O},y.getInputDisplayValue=function(j){var W=j||y.state,O=W.focused,_=W.inputValue,K=W.value,$;O?$=_:$=y.toPrecisionAsStep(K),$==null&&($="");var q=y.formatWrapper($);return h(y.props.decimalSeparator)&&(q=q.toString().replace(".",y.props.decimalSeparator)),q},y.recordCursorPosition=function(){try{y.cursorStart=y.input.selectionStart,y.cursorEnd=y.input.selectionEnd,y.currentValue=y.input.value,y.cursorBefore=y.input.value.substring(0,y.cursorStart),y.cursorAfter=y.input.value.substring(y.cursorEnd)}catch(j){}},y.restoreByAfter=function(j){if(j===void 0)return!1;var W=y.input.value,O=W.lastIndexOf(j);if(O===-1)return!1;var _=y.cursorBefore.length;return y.lastKeyCode===w.a.DELETE&&y.cursorBefore.charAt(_-1)===j[0]?(y.fixCaret(_,_),!0):O+j.length===W.length?(y.fixCaret(O,O),!0):!1},y.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(W,O){var _=j.substring(O);return y.restoreByAfter(_)})},y.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},y.stop=function(){y.autoStepTimer&&clearTimeout(y.autoStepTimer)},y.down=function(j,W,O){y.pressingUpOrDown=!0,y.step("down",j,W,O)},y.up=function(j,W,O){y.pressingUpOrDown=!0,y.step("up",j,W,O)},y.saveInput=function(j){y.input=j};var M=m.value;M===void 0&&(M=m.defaultValue),y.state={focused:m.autoFocus};var F=y.getValidValue(y.toNumber(M));return y.state=C(C({},y.state),{},{inputValue:y.toPrecisionAsStep(F),value:F}),y}return Object(G.a)(g,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(y){var M=this.props,F=M.value,j=M.onChange,W=M.max,O=M.min,_=this.state.focused;if(y){if(!A(y.value,F)||!A(y.max,W)||!A(y.min,O)){var K=_?F:this.getValidValue(F),$;this.pressingUpOrDown?$=K:this.inputting?$=this.rawInput:$=this.toPrecisionAsStep(K),this.setState({value:K,inputValue:$})}var q="value"in this.props?F:this.state.value;"max"in this.props&&y.max!==W&&typeof q=="number"&&q>W&&j&&j(W),"min"in this.props&&y.min!==O&&typeof q=="number"&&q<O&&j&&j(O)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ne=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===w.a.BACKSPACE?ne=this.cursorStart-1:this.lastKeyCode===w.a.DELETE&&(ne=this.cursorStart):ne=this.input.value.length,this.fixCaret(ne,ne)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case w.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case w.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Te){}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(y){var M=y;return M===""?M="":this.isNotCompleteNumber(parseFloat(M))?M=this.state.value:M=this.getValidValue(M),this.toNumber(M)}},{key:"getValueFromEvent",value:function(y){var M=y.target.value.trim().replace(/。/g,".");return h(this.props.decimalSeparator)&&(M=M.replace(this.props.decimalSeparator,".")),M}},{key:"getValidValue",value:function(y){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,j=parseFloat(y);return isNaN(j)?y:(j<M&&(j=M),j>F&&(j=F),j)}},{key:"setValue",value:function(y,M){var F=this.props.precision,j=this.isNotCompleteNumber(parseFloat(y))?null:parseFloat(y),W=this.state.value,O=W===void 0?null:W,_=this.state.inputValue,K=_===void 0?null:_,$=typeof j=="number"?j.toFixed(F):"".concat(j),q=j!==O||$!=="".concat(K);return"value"in this.props?(K=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:K},M)):this.setState({value:j,inputValue:this.toPrecisionAsStep(y)},M),q&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(y){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.props,j=F.precision,W=F.step;if(h(j))return j;var O=this.getPrecision(M),_=this.getPrecision(W),K=this.getPrecision(y);return y?Math.max(K,O+_):O+_}},{key:"getPrecisionFactor",value:function(y){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.getMaxPrecision(y,M);return Math.pow(10,F)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(y){return this.props.formatter?this.props.formatter(y):y}},{key:"toPrecisionAsStep",value:function(y){if(this.isNotCompleteNumber(y)||y==="")return y;var M=Math.abs(this.getMaxPrecision(y));return isNaN(M)?y.toString():Number(y).toFixed(M)}},{key:"toNumber",value:function(y){var M=this.props.precision,F=this.state.focused,j=y&&y.length>16&&F;return this.isNotCompleteNumber(y)||j?y:h(M)?Math.round(y*Math.pow(10,M))/Math.pow(10,M):Number(y)}},{key:"upStep",value:function(y,M){var F=this.props.step,j=this.getPrecisionFactor(y,M),W=Math.abs(this.getMaxPrecision(y,M)),O=((j*y+j*F*M)/j).toFixed(W);return this.toNumber(O)}},{key:"downStep",value:function(y,M){var F=this.props.step,j=this.getPrecisionFactor(y,M),W=Math.abs(this.getMaxPrecision(y,M)),O=((j*y-j*F*M)/j).toFixed(W);return this.toNumber(O)}},{key:"step",value:function(y,M){var F=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),M&&(M.persist(),M.preventDefault());var O=this.props;if(O.disabled)return;var _=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(_))return;var K=this["".concat(y,"Step")](_,j),$=K>O.max||K<O.min;if(K>O.max?K=O.max:K<O.min&&(K=O.min),this.setValue(K,null),this.setState({focused:!0},function(){F.pressingUpOrDown=!1}),$)return;this.autoStepTimer=setTimeout(function(){F[y](M,j,!0)},W?d:S)}},{key:"fixCaret",value:function(y,M){if(y===void 0||M===void 0||!this.input||!this.input.value)return;try{var F=this.input.selectionStart,j=this.input.selectionEnd;(y!==F||M!==j)&&this.input.setSelectionRange(y,M)}catch(W){}}},{key:"render",value:function(){var y,M=this.props,F=M.prefixCls,j=M.disabled,W=M.readOnly,O=M.useTouch,_=M.autoComplete,K=M.upHandler,$=M.downHandler,q=M.className,ne=M.max,Te=M.min,ve=M.style,ge=M.title,ce=M.onMouseEnter,he=M.onMouseLeave,oe=M.onMouseOver,pe=M.onMouseOut,Y=M.required,ae=M.onClick,Z=M.tabIndex,xe=M.type,we=M.placeholder,ye=M.id,Se=M.inputMode,Oe=M.pattern,Pe=M.step,_e=M.maxLength,De=M.autoFocus,Le=M.name,Ue=M.onPaste,Ve=M.onInput,We=Object(ee.a)(M,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Ge=this.state,et=Ge.value,Je=Ge.focused,ze=v()(F,(y={},Object(z.a)(y,q,!!q),Object(z.a)(y,"".concat(F,"-disabled"),j),Object(z.a)(y,"".concat(F,"-focused"),Je),y)),Ce={};Object.keys(We).forEach(function(se){(se.substr(0,5)==="data-"||se.substr(0,5)==="aria-"||se==="role")&&(Ce[se]=We[se])});var qe=!W&&!j,$e=this.getInputDisplayValue(null),Re=(et||et===0)&&(isNaN(et)||Number(et)>=ne),Fe=(et||et===0)&&(isNaN(et)||Number(et)<=Te),me=Re||j||W,ue=Fe||j||W,de=v()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(z.a)({},"".concat(F,"-handler-up-disabled"),me)),Q=v()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(z.a)({},"".concat(F,"-handler-down-disabled"),ue)),J=O?{onTouchStart:me?u:this.up,onTouchEnd:this.stop}:{onMouseDown:me?u:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},te=O?{onTouchStart:ue?u:this.down,onTouchEnd:this.stop}:{onMouseDown:ue?u:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return k.a.createElement("div",{className:ze,style:ve,title:ge,onMouseEnter:ce,onMouseLeave:he,onMouseOver:oe,onMouseOut:pe,onFocus:function(){return null},onBlur:function(){return null}},k.a.createElement("div",{className:"".concat(F,"-handler-wrap")},k.a.createElement("span",Object.assign({unselectable:"on"},J,{role:"button","aria-label":"Increase Value","aria-disabled":me,className:de}),K||k.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-up-inner"),onClick:o})),k.a.createElement("span",Object.assign({unselectable:"on"},te,{role:"button","aria-label":"Decrease Value","aria-disabled":ue,className:Q}),$||k.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-down-inner"),onClick:o}))),k.a.createElement("div",{className:"".concat(F,"-input-wrap")},k.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Te,"aria-valuemax":ne,"aria-valuenow":et,required:Y,type:xe,placeholder:we,onPaste:Ue,onClick:ae,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:Z,autoComplete:_,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:qe?this.onKeyDown:u,onKeyUp:qe?this.onKeyUp:u,autoFocus:De,maxLength:_e,readOnly:W,disabled:j,max:ne,min:Te,step:Pe,name:Le,title:ge,id:ye,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum($e),pattern:Oe,inputMode:Se,onInput:Ve},Ce))))}}]),g}(k.a.Component);b.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:p,min:-p,step:1,style:{},onChange:u,onKeyDown:u,onPressEnter:u,onFocus:u,onBlur:u,parser:s,required:!1,autoComplete:"off"};var f=b,c=Ye.a=f},h78n:function(ut,Ye,ie){"use strict";ie.d(Ye,"a",function(){return y});var ee=ie("cDcd"),z=ie.n(ee),L=ie("TSYQ"),G=ie.n(L),I={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},P=function(j){var W=j.map(function(){return Object(ee.useRef)()}),O=Object(ee.useRef)();return Object(ee.useEffect)(function(){var _=Date.now(),K=!1;Object.keys(W).forEach(function($){var q=W[$].current;if(!q)return;K=!0;var ne=q.style;ne.transitionDuration=".3s, .3s, .3s, .06s",O.current&&_-O.current<100&&(ne.transitionDuration="0s, 0s")}),K&&(O.current=Date.now())}),[W]};function B(){return B=Object.assign||function(F){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var O in W)Object.prototype.hasOwnProperty.call(W,O)&&(F[O]=W[O])}return F},B.apply(this,arguments)}function N(F,j){return R(F)||w(F,j)||D(F,j)||k()}function k(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function D(F,j){if(!F)return;if(typeof F=="string")return v(F,j);var W=Object.prototype.toString.call(F).slice(8,-1);if(W==="Object"&&F.constructor&&(W=F.constructor.name),W==="Map"||W==="Set")return Array.from(F);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return v(F,j)}function v(F,j){(j==null||j>F.length)&&(j=F.length);for(var W=0,O=new Array(j);W<j;W++)O[W]=F[W];return O}function w(F,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var W=[],O=!0,_=!1,K=void 0;try{for(var $=F[Symbol.iterator](),q;!(O=(q=$.next()).done)&&!(W.push(q.value),j&&W.length===j);O=!0);}catch(ne){_=!0,K=ne}finally{try{!O&&$.return!=null&&$.return()}finally{if(_)throw K}}return W}function R(F){if(Array.isArray(F))return F}function C(F,j){if(F==null)return{};var W=T(F,j),O,_;if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(F);for(_=0;_<K.length;_++){if(O=K[_],j.indexOf(O)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,O))continue;W[O]=F[O]}}return W}function T(F,j){if(F==null)return{};var W={},O=Object.keys(F),_,K;for(K=0;K<O.length;K++){if(_=O[K],j.indexOf(_)>=0)continue;W[_]=F[_]}return W}var E=function(j){var W=j.className,O=j.percent,_=j.prefixCls,K=j.strokeColor,$=j.strokeLinecap,q=j.strokeWidth,ne=j.style,Te=j.trailColor,ve=j.trailWidth,ge=j.transition,ce=C(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete ce.gapPosition;var he=Array.isArray(O)?O:[O],oe=Array.isArray(K)?K:[K],pe=P(he),Y=N(pe,1),ae=Y[0],Z=q/2,xe=100-q/2,we="M ".concat($==="round"?Z:0,",").concat(Z,`
|
|
L `).concat($==="round"?xe:100,",").concat(Z),ye="0 0 100 ".concat(q),Se=0;return z.a.createElement("svg",B({className:G()("".concat(_,"-line"),W),viewBox:ye,preserveAspectRatio:"none",style:ne},ce),z.a.createElement("path",{className:"".concat(_,"-line-trail"),d:we,strokeLinecap:$,stroke:Te,strokeWidth:ve||q,fillOpacity:"0"}),he.map(function(Oe,Pe){var _e={strokeDasharray:"".concat(Oe,"px, 100px"),strokeDashoffset:"-".concat(Se,"px"),transition:ge||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},De=oe[Pe]||oe[oe.length-1];return Se+=Oe,z.a.createElement("path",{key:Pe,className:"".concat(_,"-line-path"),d:we,strokeLinecap:$,stroke:De,strokeWidth:q,fillOpacity:"0",ref:ae[Pe],style:_e})}))};E.defaultProps=I;var u=E;function o(){return o=Object.assign||function(F){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var O in W)Object.prototype.hasOwnProperty.call(W,O)&&(F[O]=W[O])}return F},o.apply(this,arguments)}function s(F,j){return A(F)||h(F,j)||S(F,j)||d()}function d(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function S(F,j){if(!F)return;if(typeof F=="string")return p(F,j);var W=Object.prototype.toString.call(F).slice(8,-1);if(W==="Object"&&F.constructor&&(W=F.constructor.name),W==="Map"||W==="Set")return Array.from(F);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return p(F,j)}function p(F,j){(j==null||j>F.length)&&(j=F.length);for(var W=0,O=new Array(j);W<j;W++)O[W]=F[W];return O}function h(F,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var W=[],O=!0,_=!1,K=void 0;try{for(var $=F[Symbol.iterator](),q;!(O=(q=$.next()).done)&&!(W.push(q.value),j&&W.length===j);O=!0);}catch(ne){_=!0,K=ne}finally{try{!O&&$.return!=null&&$.return()}finally{if(_)throw K}}return W}function A(F){if(Array.isArray(F))return F}function b(F,j){if(F==null)return{};var W=f(F,j),O,_;if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(F);for(_=0;_<K.length;_++){if(O=K[_],j.indexOf(O)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,O))continue;W[O]=F[O]}}return W}function f(F,j){if(F==null)return{};var W={},O=Object.keys(F),_,K;for(K=0;K<O.length;K++){if(_=O[K],j.indexOf(_)>=0)continue;W[_]=F[_]}return W}var c=0;function l(F){return+F.replace("%","")}function a(F){return Array.isArray(F)?F:[F]}function g(F,j,W,O){var _=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,K=arguments.length>5?arguments[5]:void 0,$=50-O/2,q=0,ne=-$,Te=0,ve=-2*$;switch(K){case"left":q=-$,ne=0,Te=2*$,ve=0;break;case"right":q=$,ne=0,Te=-2*$,ve=0;break;case"bottom":ne=$,ve=2*$;break;default:}var ge="M 50,50 m ".concat(q,",").concat(ne,`
|
|
a `).concat($,",").concat($," 0 1 1 ").concat(Te,",").concat(-ve,`
|
|
a `).concat($,",").concat($," 0 1 1 ").concat(-Te,",").concat(ve),ce=Math.PI*2*$,he={stroke:W,strokeDasharray:"".concat(j/100*(ce-_),"px ").concat(ce,"px"),strokeDashoffset:"-".concat(_/2+F/100*(ce-_),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:ge,pathStyle:he}}var m=function(j){var W=j.prefixCls,O=j.strokeWidth,_=j.trailWidth,K=j.gapDegree,$=j.gapPosition,q=j.trailColor,ne=j.strokeLinecap,Te=j.style,ve=j.className,ge=j.strokeColor,ce=j.percent,he=b(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),oe=Object(ee.useMemo)(function(){return c+=1,c},[]),pe=g(0,100,q,O,K,$),Y=pe.pathString,ae=pe.pathStyle,Z=a(ce),xe=a(ge),we=xe.find(function(_e){return Object.prototype.toString.call(_e)==="[object Object]"}),ye=P(Z),Se=s(ye,1),Oe=Se[0],Pe=function(){var De=0;return Z.map(function(Le,Ue){var Ve=xe[Ue]||xe[xe.length-1],We=Object.prototype.toString.call(Ve)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(oe,")"):"",Ge=g(De,Le,Ve,O,K,$);return De+=Le,z.a.createElement("path",{key:Ue,className:"".concat(W,"-circle-path"),d:Ge.pathString,stroke:We,strokeLinecap:ne,strokeWidth:O,opacity:Le===0?0:1,fillOpacity:"0",style:Ge.pathStyle,ref:Oe[Ue]})})};return z.a.createElement("svg",o({className:G()("".concat(W,"-circle"),ve),viewBox:"0 0 100 100",style:Te},he),we&&z.a.createElement("defs",null,z.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(oe),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(we).sort(function(_e,De){return l(_e)-l(De)}).map(function(_e,De){return z.a.createElement("stop",{key:De,offset:_e,stopColor:we[_e]})}))),z.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:Y,stroke:q,strokeLinecap:ne,strokeWidth:_||O,fillOpacity:"0",style:ae}),Pe().reverse())};m.defaultProps=I;var y=m,M={Line:u,Circle:y}},iIVh:function(ut,Ye,ie){},kSUc:function(ut,Ye,ie){},lZu9:function(ut,Ye,ie){(function(ee){ee(ie("VrN/"),ie("1eCo"),ie("8EBN"))})(function(ee){"use strict";ee.defineMode("markdown",function(z,L){var G=ee.getMode(z,"text/html"),I=G.name=="null";function P(O){if(ee.findModeByName){var _=ee.findModeByName(O);_&&(O=_.mime||_.mimes[0])}var K=ee.getMode(z,O);return K.name=="null"?null:K}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 B={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 N in B)B.hasOwnProperty(N)&&L.tokenTypeOverrides[N]&&(B[N]=L.tokenTypeOverrides[N]);var k=/^([*\-_])(?:\s*\1){2,}\s*$/,D=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,v=/^\[(x| )\](?=\s)/i,w=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,R=/^ {0,3}(?:\={1,}|-{2,})\s*$/,C=/^[^#!\[\]*_\\<>` "'(~:]+/,T=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,E=/^\s*\[[^\]]+?\]:.*$/,u=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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 s(O,_,K){return _.f=_.inline=K,K(O,_)}function d(O,_,K){return _.f=_.block=K,K(O,_)}function S(O){return!O||!/\S/.test(O.string)}function p(O){if(O.linkTitle=!1,O.linkHref=!1,O.linkText=!1,O.em=!1,O.strong=!1,O.strikethrough=!1,O.quote=0,O.indentedCode=!1,O.f==A){var _=I;if(!_){var K=ee.innerMode(G,O.htmlState);_=K.mode.name=="xml"&&K.state.tagStart===null&&!K.state.context&&K.state.tokenize.isInText}_&&(O.f=l,O.block=h,O.htmlState=null)}return O.trailingSpace=0,O.trailingSpaceNewLine=!1,O.prevLine=O.thisLine,O.thisLine={stream:null},null}function h(O,_){var K=O.column()===_.indentation,$=S(_.prevLine.stream),q=_.indentedCode,ne=_.prevLine.hr,Te=_.list!==!1,ve=(_.listStack[_.listStack.length-1]||0)+3;_.indentedCode=!1;var ge=_.indentation;if(_.indentationDiff===null&&(_.indentationDiff=_.indentation,Te)){for(_.list=null;ge<_.listStack[_.listStack.length-1];)_.listStack.pop(),_.listStack.length?_.indentation=_.listStack[_.listStack.length-1]:_.list=!1;_.list!==!1&&(_.indentationDiff=ge-_.listStack[_.listStack.length-1])}var ce=!$&&!ne&&!_.prevLine.header&&(!Te||!q)&&!_.prevLine.fencedCodeEnd,he=(_.list===!1||ne||$)&&_.indentation<=ve&&O.match(k),oe=null;if(_.indentationDiff>=4&&(q||_.prevLine.fencedCodeEnd||_.prevLine.header||$))return O.skipToEnd(),_.indentedCode=!0,B.code;if(O.eatSpace())return null;if(K&&_.indentation<=ve&&(oe=O.match(w))&&oe[1].length<=6)return _.quote=0,_.header=oe[1].length,_.thisLine.header=!0,L.highlightFormatting&&(_.formatting="header"),_.f=_.inline,f(_);if(_.indentation<=ve&&O.eat(">"))return _.quote=K?1:_.quote+1,L.highlightFormatting&&(_.formatting="quote"),O.eatSpace(),f(_);if(!he&&!_.setext&&K&&_.indentation<=ve&&(oe=O.match(D))){var pe=oe[1]?"ol":"ul";return _.indentation=ge+O.current().length,_.list=!0,_.quote=0,_.listStack.push(_.indentation),_.em=!1,_.strong=!1,_.code=!1,_.strikethrough=!1,L.taskLists&&O.match(v,!1)&&(_.taskList=!0),_.f=_.inline,L.highlightFormatting&&(_.formatting=["list","list-"+pe]),f(_)}else{if(K&&_.indentation<=ve&&(oe=O.match(T,!0)))return _.quote=0,_.fencedEndRE=new RegExp(oe[1]+"+ *$"),_.localMode=L.fencedCodeBlockHighlighting&&P(oe[2]||L.fencedCodeBlockDefaultMode),_.localMode&&(_.localState=ee.startState(_.localMode)),_.f=_.block=b,L.highlightFormatting&&(_.formatting="code-block"),_.code=-1,f(_);if(_.setext||(!ce||!Te)&&!_.quote&&_.list===!1&&!_.code&&!he&&!E.test(O.string)&&(oe=O.lookAhead(1))&&(oe=oe.match(R)))return _.setext?(_.header=_.setext,_.setext=0,O.skipToEnd(),L.highlightFormatting&&(_.formatting="header")):(_.header=oe[0].charAt(0)=="="?1:2,_.setext=_.header),_.thisLine.header=!0,_.f=_.inline,f(_);if(he)return O.skipToEnd(),_.hr=!0,_.thisLine.hr=!0,B.hr;if(O.peek()==="[")return s(O,_,M)}return s(O,_,_.inline)}function A(O,_){var K=G.token(O,_.htmlState);if(!I){var $=ee.innerMode(G,_.htmlState);($.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText||_.md_inside&&O.current().indexOf(">")>-1)&&(_.f=l,_.block=h,_.htmlState=null)}return K}function b(O,_){var K=_.listStack[_.listStack.length-1]||0,$=_.indentation<K,q=K+3;if(_.fencedEndRE&&_.indentation<=q&&($||O.match(_.fencedEndRE))){L.highlightFormatting&&(_.formatting="code-block");var ne;return $||(ne=f(_)),_.localMode=_.localState=null,_.block=h,_.f=l,_.fencedEndRE=null,_.code=0,_.thisLine.fencedCodeEnd=!0,$?d(O,_,_.block):ne}else return _.localMode?_.localMode.token(O,_.localState):(O.skipToEnd(),B.code)}function f(O){var _=[];if(O.formatting){_.push(B.formatting),typeof O.formatting=="string"&&(O.formatting=[O.formatting]);for(var K=0;K<O.formatting.length;K++)_.push(B.formatting+"-"+O.formatting[K]),O.formatting[K]==="header"&&_.push(B.formatting+"-"+O.formatting[K]+"-"+O.header),O.formatting[K]==="quote"&&(!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=O.quote?_.push(B.formatting+"-"+O.formatting[K]+"-"+O.quote):_.push("error"))}if(O.taskOpen)return _.push("meta"),_.length?_.join(" "):null;if(O.taskClosed)return _.push("property"),_.length?_.join(" "):null;if(O.linkHref?_.push(B.linkHref,"url"):(O.strong&&_.push(B.strong),O.em&&_.push(B.em),O.strikethrough&&_.push(B.strikethrough),O.emoji&&_.push(B.emoji),O.linkText&&_.push(B.linkText),O.code&&_.push(B.code),O.image&&_.push(B.image),O.imageAltText&&_.push(B.imageAltText,"link"),O.imageMarker&&_.push(B.imageMarker)),O.header&&_.push(B.header,B.header+"-"+O.header),O.quote&&(_.push(B.quote),!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=O.quote?_.push(B.quote+"-"+O.quote):_.push(B.quote+"-"+L.maxBlockquoteDepth)),O.list!==!1){var $=(O.listStack.length-1)%3;$?$===1?_.push(B.list2):_.push(B.list3):_.push(B.list1)}return O.trailingSpaceNewLine?_.push("trailing-space-new-line"):O.trailingSpace&&_.push("trailing-space-"+(O.trailingSpace%2?"a":"b")),_.length?_.join(" "):null}function c(O,_){return O.match(C,!0)?f(_):void 0}function l(O,_){var K=_.text(O,_);if(typeof K!="undefined")return K;if(_.list)return _.list=null,f(_);if(_.taskList){var $=O.match(v,!0)[1]===" ";return $?_.taskOpen=!0:_.taskClosed=!0,L.highlightFormatting&&(_.formatting="task"),_.taskList=!1,f(_)}if(_.taskOpen=!1,_.taskClosed=!1,_.header&&O.match(/^#+$/,!0))return L.highlightFormatting&&(_.formatting="header"),f(_);var q=O.next();if(_.linkTitle){_.linkTitle=!1;var ne=q;q==="("&&(ne=")"),ne=(ne+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Te="^\\s*(?:[^"+ne+"\\\\]+|\\\\\\\\|\\\\.)"+ne;if(O.match(new RegExp(Te),!0))return B.linkHref}if(q==="`"){var ve=_.formatting;L.highlightFormatting&&(_.formatting="code"),O.eatWhile("`");var ge=O.current().length;if(_.code==0&&(!_.quote||ge==1))return _.code=ge,f(_);if(ge==_.code){var ce=f(_);return _.code=0,ce}else return _.formatting=ve,f(_)}else if(_.code)return f(_);if(q==="\\"&&(O.next(),L.highlightFormatting)){var he=f(_),oe=B.formatting+"-escape";return he?he+" "+oe:oe}if(q==="!"&&O.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return _.imageMarker=!0,_.image=!0,L.highlightFormatting&&(_.formatting="image"),f(_);if(q==="["&&_.imageMarker&&O.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return _.imageMarker=!1,_.imageAltText=!0,L.highlightFormatting&&(_.formatting="image"),f(_);if(q==="]"&&_.imageAltText){L.highlightFormatting&&(_.formatting="image");var he=f(_);return _.imageAltText=!1,_.image=!1,_.inline=_.f=g,he}if(q==="["&&!_.image)return _.linkText&&O.match(/^.*?\]/)||(_.linkText=!0,L.highlightFormatting&&(_.formatting="link")),f(_);if(q==="]"&&_.linkText){L.highlightFormatting&&(_.formatting="link");var he=f(_);return _.linkText=!1,_.inline=_.f=O.match(/\(.*?\)| ?\[.*?\]/,!1)?g:l,he}if(q==="<"&&O.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){_.f=_.inline=a,L.highlightFormatting&&(_.formatting="link");var he=f(_);return he?he+=" ":he="",he+B.linkInline}if(q==="<"&&O.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){_.f=_.inline=a,L.highlightFormatting&&(_.formatting="link");var he=f(_);return he?he+=" ":he="",he+B.linkEmail}if(L.xml&&q==="<"&&O.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var pe=O.string.indexOf(">",O.pos);if(pe!=-1){var Y=O.string.substring(O.start,pe);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Y)&&(_.md_inside=!0)}return O.backUp(1),_.htmlState=ee.startState(G),d(O,_,A)}if(L.xml&&q==="<"&&O.match(/^\/\w*?>/))return _.md_inside=!1,"tag";if(q==="*"||q==="_"){for(var ae=1,Z=O.pos==1?" ":O.string.charAt(O.pos-2);ae<3&&O.eat(q);)ae++;var xe=O.peek()||" ",we=!/\s/.test(xe)&&(!u.test(xe)||/\s/.test(Z)||u.test(Z)),ye=!/\s/.test(Z)&&(!u.test(Z)||/\s/.test(xe)||u.test(xe)),Se=null,Oe=null;if(ae%2&&(!_.em&&we&&(q==="*"||!ye||u.test(Z))?Se=!0:_.em==q&&ye&&(q==="*"||!we||u.test(xe))&&(Se=!1)),ae>1&&(!_.strong&&we&&(q==="*"||!ye||u.test(Z))?Oe=!0:_.strong==q&&ye&&(q==="*"||!we||u.test(xe))&&(Oe=!1)),Oe!=null||Se!=null){L.highlightFormatting&&(_.formatting=Se==null?"strong":Oe==null?"em":"strong em"),Se===!0&&(_.em=q),Oe===!0&&(_.strong=q);var ce=f(_);return Se===!1&&(_.em=!1),Oe===!1&&(_.strong=!1),ce}}else if(q===" "&&(O.eat("*")||O.eat("_"))){if(O.peek()===" ")return f(_);O.backUp(1)}if(L.strikethrough){if(q==="~"&&O.eatWhile(q)){if(_.strikethrough){L.highlightFormatting&&(_.formatting="strikethrough");var ce=f(_);return _.strikethrough=!1,ce}else if(O.match(/^[^\s]/,!1))return _.strikethrough=!0,L.highlightFormatting&&(_.formatting="strikethrough"),f(_)}else if(q===" "&&O.match(/^~~/,!0)){if(O.peek()===" ")return f(_);O.backUp(2)}}if(L.emoji&&q===":"&&O.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){_.emoji=!0,L.highlightFormatting&&(_.formatting="emoji");var Pe=f(_);return _.emoji=!1,Pe}return q===" "&&(O.match(/^ +$/,!1)?_.trailingSpace++:_.trailingSpace&&(_.trailingSpaceNewLine=!0)),f(_)}function a(O,_){var K=O.next();if(K===">"){_.f=_.inline=l,L.highlightFormatting&&(_.formatting="link");var $=f(_);return $?$+=" ":$="",$+B.linkInline}return O.match(/^[^>]+/,!0),B.linkInline}function g(O,_){if(O.eatSpace())return null;var K=O.next();return K==="("||K==="["?(_.f=_.inline=y(K==="("?")":"]"),L.highlightFormatting&&(_.formatting="link-string"),_.linkHref=!0,f(_)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function y(O){return function(_,K){var $=_.next();if($===O){K.f=K.inline=l,L.highlightFormatting&&(K.formatting="link-string");var q=f(K);return K.linkHref=!1,q}return _.match(m[O]),K.linkHref=!0,f(K)}}function M(O,_){return O.match(/^([^\]\\]|\\.)*\]:/,!1)?(_.f=F,O.next(),L.highlightFormatting&&(_.formatting="link"),_.linkText=!0,f(_)):s(O,_,l)}function F(O,_){if(O.match(/^\]:/,!0)){_.f=_.inline=j,L.highlightFormatting&&(_.formatting="link");var K=f(_);return _.linkText=!1,K}return O.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function j(O,_){return O.eatSpace()?null:(O.match(/^[^\s]+/,!0),O.peek()===void 0?_.linkTitle=!0:O.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),_.f=_.inline=l,B.linkHref+" url")}var W={startState:function(){return{f:h,prevLine:{stream:null},thisLine:{stream:null},block:h,htmlState:null,indentation:0,inline:l,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(O){return{f:O.f,prevLine:O.prevLine,thisLine:O.thisLine,block:O.block,htmlState:O.htmlState&&ee.copyState(G,O.htmlState),indentation:O.indentation,localMode:O.localMode,localState:O.localMode?ee.copyState(O.localMode,O.localState):null,inline:O.inline,text:O.text,formatting:!1,linkText:O.linkText,linkTitle:O.linkTitle,linkHref:O.linkHref,code:O.code,em:O.em,strong:O.strong,strikethrough:O.strikethrough,emoji:O.emoji,header:O.header,setext:O.setext,hr:O.hr,taskList:O.taskList,list:O.list,listStack:O.listStack.slice(0),quote:O.quote,indentedCode:O.indentedCode,trailingSpace:O.trailingSpace,trailingSpaceNewLine:O.trailingSpaceNewLine,md_inside:O.md_inside,fencedEndRE:O.fencedEndRE}},token:function(O,_){if(_.formatting=!1,O!=_.thisLine.stream){if(_.header=0,_.hr=!1,O.match(/^\s*$/,!0))return p(_),null;if(_.prevLine=_.thisLine,_.thisLine={stream:O},_.taskList=!1,_.trailingSpace=0,_.trailingSpaceNewLine=!1,!_.localState&&(_.f=_.block,_.f!=A)){var K=O.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(_.indentation=K,_.indentationDiff=null,K>0)return null}}return _.f(O,_)},innerMode:function(O){return O.block==A?{state:O.htmlState,mode:G}:O.localState?{state:O.localState,mode:O.localMode}:{state:O,mode:W}},indent:function(O,_,K){return O.block==A&&G.indent?G.indent(O.htmlState,_,K):O.localState&&O.localMode.indent?O.localMode.indent(O.localState,_,K):ee.Pass},blankLine:p,getType:f,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),ee.defineMIME("text/markdown","markdown"),ee.defineMIME("text/x-markdown","markdown")})},nojB:function(ut,Ye,ie){"use strict";ie.r(Ye);var ee=ie("T2oS"),z=ie("W9HT"),L=ie("9og8"),G=ie("tJVT"),I=ie("k1fw"),P=ie("WmNS"),B=ie.n(P),N=ie("cDcd"),k=ie.n(N),D=ie("X0ci"),v=ie("iIVh"),w=ie("Ty5D"),R=ie("55Ip"),C=ie("+L6B"),T=ie("2/Rp"),E=ie("5NDa"),u=ie("5rEg"),o=ie("2qtc"),s=ie("kLXV"),d=ie("miYZ"),S=ie("tsqr"),p=ie("PpiC"),h=ie("y8nQ"),A=ie("Vl3Y"),b=ie("DZo9"),f=ie("8z0m"),c=ie("sRBo"),l=ie("kaz8"),a=ie("LtfV"),g=ie("m3rI"),m=ie("Ot1p"),y=l.a.Group,M=f.a.Dragger;function F(q,ne){var Te=new FileReader;Te.addEventListener("load",function(){return ne(Te.result)}),Te.readAsDataURL(q)}var j=function(q){var ne=q.callback,Te=q.tags,ve=Te===void 0?[]:Te,ge=q.initialValues,ce=ge===void 0?{}:ge,he=q.removeAttachment,oe=Object(N.useState)(""),pe=Object(G.a)(oe,2),Y=pe[0],ae=pe[1],Z=A.a.useForm(),xe=Object(G.a)(Z,1),we=xe[0];function ye(De){var Le=De.cover_id,Ue=De.attachment_ids,Ve=Object(p.a)(De,["cover_id","attachment_ids"]);ne(Object(I.a)(Object(I.a)({},Ve),{},{cover_id:Le==null?void 0:Le.map(function(We){return We.response?We.response.id:We.uid})[(Le==null?void 0:Le.length)-1],attachment_ids:Ue?Ue==null?void 0:Ue.map(function(We){return We.response?We.response.id:We.uid}):[]}))}function Se(De){return Array.isArray(De)?De:De&&De.fileList}var Oe={multiple:!0,beforeUpload:function(Le){var Ue=Le.size/1024/1024<100;if(!Ue)return S.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(100MB),\u5EFA\u8BAE\u4E0A\u4F20\u5230\u767E\u5EA6\u4E91\u7B49\u5176\u5B83\u5171\u4EAB\u5DE5\u5177\u91CC\uFF0C\u7136\u540E\u518Dtxt\u6587\u6863\u91CC\u7ED9\u51FA\u94FE\u63A5\u4EE5\u53CA\u5171\u4EAB\u5BC6\u7801\u5E76\u4E0A\u4F20"),Ue},action:"".concat(g.a.API_SERVER,"/api/attachments.json"),onRemove:function(Le){s.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:"\u662F\u5426\u786E\u8BA4\u5220\u9664?",onOk:function(){return he(Le.response?Le.response.id:Le.uid)},onCancel:function(){return!1}})}};function Pe(De){De.file.status==="done"&&F(De.file.originFileObj,function(Le){return ae(Le)})}var _e={showUploadList:!1,withCredentials:!0,action:"".concat(g.a.API_SERVER,"/api/attachments.json"),onChange:Pe};return Object(N.useEffect)(function(){ce.title&&(we.setFieldsValue(ce),ce.cover_id.length>0&&ae(g.a.IMG_SERVER+ce.cover_id[0].url))},[ce]),k.a.createElement(A.a,{form:we,initialValues:ce,className:"moop-panel",onFinish:ye},k.a.createElement(A.a.Item,{label:"\u6807\u9898",name:"title",extra:k.a.createElement("p",{className:"tip"},"\u7B80\u660E\u627C\u8981\u4ECB\u7ECD\u6587\u6863/\u89C6\u9891\u6240\u5305\u542B\u7684\u4E3B\u8981\u7684\u5185\u5BB9"),rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},k.a.createElement(u.a,{placeholder:"\u4F8B\u5982\uFF1A\u8F6F\u4EF6\u5DE5\u7A0B\u6559\u5B66\u6848\u4F8B"})),k.a.createElement("div",{className:"flex-container"},k.a.createElement(A.a.Item,{label:"\u4F5C\u8005",name:"author_name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u8005\u540D\u79F0"}]},k.a.createElement(u.a,{placeholder:"\u8BF7\u8F93\u5165\u59D3\u540D",style:{marginRight:20,width:200}})),k.a.createElement(A.a.Item,{name:"author_school_name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u8005\u5355\u4F4D\u540D\u79F0"}]},k.a.createElement(u.a,{placeholder:"\u8BF7\u8F93\u5165\u4F5C\u8005\u5355\u4F4D\u540D\u79F0",style:{width:200}}))),k.a.createElement(A.a.Item,{name:"tag_ids",label:"\u6807\u7B7E",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u4E00\u4E2A\u6807\u7B7E"}]},k.a.createElement(y,null,ve.map(function(De){return k.a.createElement(l.a,{key:De.id,value:De.id}," ",De.name," ")}))),k.a.createElement(A.a.Item,{name:"publish",valuePropName:"checked"},k.a.createElement(l.a,null,"\u662F\u5426\u7533\u8BF7\u53D1\u5E03")),k.a.createElement(A.a.Item,{name:"content",label:"\u63CF\u8FF0",valuePropName:"defaultValue",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u63CF\u8FF0\u5185\u5BB9"}]},k.a.createElement(m.a,{id:"moop_cases_content",height:400})),k.a.createElement(A.a.Item,{name:"attachment_ids",valuePropName:"fileList",getValueFromEvent:Se},k.a.createElement(M,Oe,k.a.createElement("p",{className:"c-blue",style:{marginBottom:10,fontSize:18}},"\u4E0A\u4F20\u9644\u4EF6"),k.a.createElement("p",{className:"c-grey-c"},"\u4ECE\u6211\u7684\u7535\u8111\u9009\u62E9\u8981\u4E0A\u4F20\u7684\u6587\u6863\uFF1A\u6309\u4F4FCTRL\u53EF\u4EE5\u4E0A\u4F20\u591A\u4EFD\u6587\u6863\u3002\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\uFF1A100MB"))),k.a.createElement(A.a.Item,{name:"cover_id",label:"\u5C01\u9762\u56FE",extra:"\u4E0A\u4F20\u5C3A\u5BF8\uFF1A120*90 px",getValueFromEvent:Se,valuePropName:"fileList",rules:[{required:!0,message:"\u8BF7\u4E0A\u4F20\u5C01\u9762\u56FE"}]},k.a.createElement(f.a,_e,Y?k.a.createElement("img",{src:Y,width:120}):k.a.createElement("a",{title:"\u4E0A\u4F20\u5C01\u9762\u56FE",className:"upload-cover"}," ",k.a.createElement(a.a,null)," "))),k.a.createElement("div",{className:"desc"},k.a.createElement("h3",null,"\u5BA1\u6838\u8BF4\u660E"),k.a.createElement("p",null," \u5E73\u53F0\u7BA1\u7406\u5458\u5C06\u5BF9\u6BCF\u5929\u65B0\u4E0A\u4F20\u7684\u6587\u6863\u8FDB\u884C\u5BA1\u6838\uFF0C\u5BA1\u6838\u901A\u8FC7\u7684\u6587\u6863\u5C06\u516C\u5F00\u663E\u793A\uFF0C\u5426\u5219\u5C06\u79C1\u6709\u5316\u6216\u79FB\u9664 ")),k.a.createElement("div",{className:"desc"},k.a.createElement("h3",null,"\u6E29\u99A8\u63D0\u793A"),k.a.createElement("ul",{style:{padding:0}},k.a.createElement("li",null,"1.\u8BF7\u52FF\u4E0A\u4F20\u5DF2\u8BBE\u7F6E\u52A0\u5BC6\u53E3\u4EE4\u7684\u6587\u6863\u8D44\u6E90\uFF1B"),k.a.createElement("li",null,"2.\u53EF\u4EE5\u4E0A\u4F20\u7B26\u5408\u6559\u5B66\u6848\u4F8B\u6807\u51C6\u7684\u6587\u6863\u8D44\u6599\uFF0C\u5982",k.a.createElement("a",{href:"https://www.educoder.net/courses/1309/boards/5909/messages/34799",target:"_blank"}," \u6848\u4F8B\u5165\u5E93\u6807\u51C6 ")," \u3001",k.a.createElement("a",{href:"https://www.educoder.net/courses/1309/boards/5909/messages/34798",target:"_blank"},"\u6848\u4F8B\u4F7F\u7528\u8BF4\u660E\u4E66"),"\u4EE5\u53CA\u5176\u4ED6\u8D44\u6599\u7B49\uFF0C\u4E0A\u4F20\u652F\u6301\u7684\u6587\u4EF6\u6700\u5927\u5BB9\u91CF\uFF1A100MB\uFF1B"),k.a.createElement("li",null,"3.\u8BF7\u786E\u4FDD\u4E0A\u4F20\u5185\u5BB9\u65E0\u4FB5\u6743\u6216\u8FDD\u53CD\u56FD\u5BB6\u5173\u4E8E\u4E92\u8054\u7F51\u653F\u7B56\u7684\u4E0D\u826F\u884C\u4E3A\uFF1B"),k.a.createElement("li",null,"4.\u8BF7\u4F7F\u7528Chrome\uFF0CFirefox\uFF0CSafari\uFF0CIE11\uFF08\u53CA\u4EE5\u4E0A\u7248\u672C\uFF09\u6D4F\u89C8\u5668\uFF1B"))),k.a.createElement(A.a.Item,{style:{marginTop:10}},k.a.createElement(T.a,{type:"primary",htmlType:"submit"},"\u63D0\u4EA4")))},W=ie("wzkS"),O={loading:!1,data:{},tags:[]},_;(function(q){q[q.GET_DATA=0]="GET_DATA",q[q.SET_LOADING=1]="SET_LOADING",q[q.GET_TAGS=2]="GET_TAGS"})(_||(_={}));function K(q,ne){switch(ne.type){case _.GET_DATA:return Object(I.a)(Object(I.a)({},q),ne.payload);case _.GET_TAGS:return Object(I.a)(Object(I.a)({},q),{},{tags:ne.payload});case _.SET_LOADING:return Object(I.a)(Object(I.a)({},q),{},{loading:ne.payload});default:throw new Error}}var $=Ye.default=function(){var q=Object(w.i)(),ne=q.caseId,Te=Object(w.g)(),ve=Object(N.useReducer)(K,O),ge=Object(G.a)(ve,2),ce=ge[0],he=ge[1],oe=ce.loading,pe=ce.tags,Y=ce.data;Object(N.useEffect)(function(){function we(){return ye.apply(this,arguments)}function ye(){return ye=Object(L.a)(B.a.mark(function Se(){var Oe;return B.a.wrap(function(_e){for(;;)switch(_e.prev=_e.next){case 0:return _e.next=2,Object(W.b)();case 2:Oe=_e.sent,he({type:_.GET_TAGS,payload:Oe.library_tags});case 4:case"end":return _e.stop()}},Se)})),ye.apply(this,arguments)}we()},[]),Object(N.useEffect)(function(){var we=!1;function ye(){return Se.apply(this,arguments)}function Se(){return Se=Object(L.a)(B.a.mark(function Oe(){var Pe,_e,De,Le,Ue,Ve,We,Ge,et;return B.a.wrap(function(ze){for(;;)switch(ze.prev=ze.next){case 0:return he({type:_.SET_LOADING,payload:!1}),ze.next=3,Object(W.c)(ne);case 3:Pe=ze.sent,_e=Pe.author_name,De=Pe.author_school_name,Le=Pe.content,Ue=Pe.cover,Ve=Pe.attachments,We=Pe.status,Ge=Pe.title,et=Pe.tags,we||(Pe.status===404?Te.push("/moop_cases"):he({type:_.GET_DATA,payload:{data:{title:Ge,author_name:_e,author_school_name:De,content:Le,tag_ids:et.map(function(Ce){return Ce.id}),publish:We==="published",attachment_ids:Ve.map(function(Ce){return{uid:Ce.id,id:Ce.id,name:Ce.title,url:Ce.url,filesize:Ce.filesize,status:"done"}}),cover_id:Ue!=null&&Ue.id?[{uid:Ue==null?void 0:Ue.id,id:Ue==null?void 0:Ue.id,name:Ue==null?void 0:Ue.title,url:Ue==null?void 0:Ue.url,filesize:Ue==null?void 0:Ue.filesize,status:"done"}]:[]},loading:!1}}));case 6:case"end":return ze.stop()}},Oe)})),Se.apply(this,arguments)}return!we&&ne&&ye(),function(){we=!0}},[ne]);function ae(we){return Z.apply(this,arguments)}function Z(){return Z=Object(L.a)(B.a.mark(function we(ye){var Se,Oe;return B.a.wrap(function(_e){for(;;)switch(_e.prev=_e.next){case 0:if(!ne){_e.next=6;break}return _e.next=3,Object(W.e)(ne,ye);case 3:Te.push("/moop_cases/".concat(ne,"/publish-success")),_e.next=11;break;case 6:return _e.next=8,Object(W.a)(ye);case 8:Se=_e.sent,Oe=Se.id,Oe&&Te.push("/moop_cases/".concat(Oe,"/publish-success"));case 11:case"end":return _e.stop()}},we)})),Z.apply(this,arguments)}var xe={initialValues:Y,tags:pe,removeAttachment:W.d,callback:ae};return k.a.createElement(z.a,{spinning:oe,delay:500},k.a.createElement("div",{className:"moop-info"},k.a.createElement("div",{className:"crumb"},k.a.createElement(R.a,{to:"/moop_cases"},"\u6559\u5B66\u6848\u4F8B > "),k.a.createElement("span",null,"\u65B0\u5EFA")),k.a.createElement("div",{className:"title"},k.a.createElement("h2",null,"\u4E0A\u4F20\u6559\u5B66\u6848\u4F8B"),k.a.createElement(R.a,{to:"/moop_cases"},"\u8FD4\u56DE")),k.a.createElement(j,xe)))}},osHv:function(ut,Ye,ie){(function(ee){ee(ie("VrN/"))})(function(ee){"use strict";var z=ee.Pos;function L(u,o){return u.line-o.line||u.ch-o.ch}var G="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",I=G+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+G+"]["+I+"]*)","g");function B(u,o,s,d){this.line=o,this.ch=s,this.cm=u,this.text=u.getLine(o),this.min=d?Math.max(d.from,u.firstLine()):u.firstLine(),this.max=d?Math.min(d.to-1,u.lastLine()):u.lastLine()}function N(u,o){var s=u.cm.getTokenTypeAt(z(u.line,o));return s&&/\btag\b/.test(s)}function k(u){return u.line>=u.max?void 0:(u.ch=0,u.text=u.cm.getLine(++u.line),!0)}function D(u){return u.line<=u.min?void 0:(u.text=u.cm.getLine(--u.line),u.ch=u.text.length,!0)}function v(u){for(;;){var o=u.text.indexOf(">",u.ch);if(o==-1){if(k(u))continue;return}if(!N(u,o+1)){u.ch=o+1;continue}var s=u.text.lastIndexOf("/",o),d=s>-1&&!/\S/.test(u.text.slice(s+1,o));return u.ch=o+1,d?"selfClose":"regular"}}function w(u){for(;;){var o=u.ch?u.text.lastIndexOf("<",u.ch-1):-1;if(o==-1){if(D(u))continue;return}if(!N(u,o+1)){u.ch=o;continue}P.lastIndex=o,u.ch=o;var s=P.exec(u.text);if(s&&s.index==o)return s}}function R(u){for(;;){P.lastIndex=u.ch;var o=P.exec(u.text);if(!o){if(k(u))continue;return}if(!N(u,o.index+1)){u.ch=o.index+1;continue}return u.ch=o.index+o[0].length,o}}function C(u){for(;;){var o=u.ch?u.text.lastIndexOf(">",u.ch-1):-1;if(o==-1){if(D(u))continue;return}if(!N(u,o+1)){u.ch=o;continue}var s=u.text.lastIndexOf("/",o),d=s>-1&&!/\S/.test(u.text.slice(s+1,o));return u.ch=o+1,d?"selfClose":"regular"}}function T(u,o){for(var s=[];;){var d=R(u),S,p=u.line,h=u.ch-(d?d[0].length:0);if(!d||!(S=v(u)))return;if(S=="selfClose")continue;if(d[1]){for(var A=s.length-1;A>=0;--A)if(s[A]==d[2]){s.length=A;break}if(A<0&&(!o||o==d[2]))return{tag:d[2],from:z(p,h),to:z(u.line,u.ch)}}else s.push(d[2])}}function E(u,o){for(var s=[];;){var d=C(u);if(!d)return;if(d=="selfClose"){w(u);continue}var S=u.line,p=u.ch,h=w(u);if(!h)return;if(h[1])s.push(h[2]);else{for(var A=s.length-1;A>=0;--A)if(s[A]==h[2]){s.length=A;break}if(A<0&&(!o||o==h[2]))return{tag:h[2],from:z(u.line,u.ch),to:z(S,p)}}}}ee.registerHelper("fold","xml",function(u,o){for(var s=new B(u,o.line,0);;){var d=R(s);if(!d||s.line!=o.line)return;var S=v(s);if(!S)return;if(!d[1]&&S!="selfClose"){var p=z(s.line,s.ch),h=T(s,d[2]);return h&&L(h.from,p)>0?{from:p,to:h.from}:null}}}),ee.findMatchingTag=function(u,o,s){var d=new B(u,o.line,o.ch,s);if(d.text.indexOf(">")==-1&&d.text.indexOf("<")==-1)return;var S=v(d),p=S&&z(d.line,d.ch),h=S&&w(d);if(!S||!h||L(d,o)>0)return;var A={from:z(d.line,d.ch),to:p,tag:h[2]};return S=="selfClose"?{open:A,close:null,at:"open"}:h[1]?{open:E(d,h[2]),close:A,at:"close"}:(d=new B(u,p.line,p.ch,s),{open:A,close:T(d,h[2]),at:"open"})},ee.findEnclosingTag=function(u,o,s,d){for(var S=new B(u,o.line,o.ch,s);;){var p=E(S,d);if(!p)break;var h=new B(u,o.line,o.ch,s),A=T(h,p.tag);if(A)return{open:p,close:A}}},ee.scanForClosingTag=function(u,o,s,d){var S=new B(u,o.line,o.ch,d?{from:0,to:d}:null);return T(S,s)}})},"p77/":function(ut,Ye,ie){},rUJ1:function(ut,Ye){const ie=/[&<>"']/,ee=/[&<>"']/g,z=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,G={"&":"&","<":"<",">":">",'"':""","'":"'"},I=b=>G[b];function P(b,f){if(f){if(ie.test(b))return b.replace(ee,I)}else if(z.test(b))return b.replace(L,I);return b}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function N(b){return b.replace(B,(f,c)=>(c=c.toLowerCase(),c==="colon"?":":c.charAt(0)==="#"?c.charAt(1)==="x"?String.fromCharCode(parseInt(c.substring(2),16)):String.fromCharCode(+c.substring(1)):""))}const k=/(^|[^\[])\^/g;function D(b,f){b=b.source||b,f=f||"";const c={replace:(l,a)=>(a=a.source||a,a=a.replace(k,"$1"),b=b.replace(l,a),c),getRegex:()=>new RegExp(b,f)};return c}const v=/[^\w:]/g,w=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function R(b,f,c){if(b){let l;try{l=decodeURIComponent(N(c)).replace(v,"").toLowerCase()}catch(a){return null}if(l.indexOf("javascript:")===0||l.indexOf("vbscript:")===0||l.indexOf("data:")===0)return null}f&&!w.test(c)&&(c=o(f,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(l){return null}return c}const C={},T=/^[^:]+:\/*[^/]*$/,E=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(b,f){C[" "+b]||(T.test(b)?C[" "+b]=b+"/":C[" "+b]=p(b,"/",!0)),b=C[" "+b];const c=b.indexOf(":")===-1;return f.substring(0,2)==="//"?c?f:b.replace(E,"$1")+f:f.charAt(0)==="/"?c?f:b.replace(u,"$1")+f:b+f}const s={exec:function(){}};function d(b){let f=1,c,l;for(;f<arguments.length;f++){c=arguments[f];for(l in c)Object.prototype.hasOwnProperty.call(c,l)&&(b[l]=c[l])}return b}function S(b,f){const c=b.replace(/\|/g,(g,m,y)=>{let M=!1,F=m;for(;--F>=0&&y[F]==="\\";)M=!M;return M?"|":" |"}),l=c.split(/ \|/);let a=0;if(l.length>f)l.splice(f);else for(;l.length<f;)l.push("");for(;a<l.length;a++)l[a]=l[a].trim().replace(/\\\|/g,"|");return l}function p(b,f,c){const l=b.length;if(l===0)return"";let a=0;for(;a<l;){const g=b.charAt(l-a-1);if(g===f&&!c)a++;else if(g!==f&&c)a++;else break}return b.substr(0,l-a)}function h(b,f){if(b.indexOf(f[1])===-1)return-1;const c=b.length;let l=0,a=0;for(;a<c;a++)if(b[a]==="\\")a++;else if(b[a]===f[0])l++;else if(b[a]===f[1]&&(l--,l<0))return a;return-1}function A(b){b&&b.sanitize&&!b.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")}ut.exports={escape:P,unescape:N,edit:D,cleanUrl:R,resolveUrl:o,noopTest:s,merge:d,splitCells:S,rtrim:p,findClosingBracket:h,checkSanitizeDeprecation:A}},ulZh:function(ut,Ye,ie){typeof window!="undefined"&&function(z,L){ut.exports=L()}(this,function(){return function(ee){var z={};function L(G){if(z[G])return z[G].exports;var I=z[G]={i:G,l:!1,exports:{}};return ee[G].call(I.exports,I,I.exports,L),I.l=!0,I.exports}return L.m=ee,L.c=z,L.d=function(G,I,P){L.o(G,I)||Object.defineProperty(G,I,{enumerable:!0,get:P})},L.r=function(G){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(G,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(G,"__esModule",{value:!0})},L.t=function(G,I){if(I&1&&(G=L(G)),I&8)return G;if(I&4&&typeof G=="object"&&G&&G.__esModule)return G;var P=Object.create(null);if(L.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:G}),I&2&&typeof G!="string")for(var B in G)L.d(P,B,function(N){return G[N]}.bind(null,B));return P},L.n=function(G){var I=G&&G.__esModule?function(){return G.default}:function(){return G};return L.d(I,"a",I),I},L.o=function(G,I){return Object.prototype.hasOwnProperty.call(G,I)},L.p="/dist/",L(L.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ee,z,L){"use strict";var G=Object.prototype.hasOwnProperty,I="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(I=!1));function B(v,w,R){this.fn=v,this.context=w,this.once=R||!1}function N(v,w,R,C,T){if(typeof R!="function")throw new TypeError("The listener must be a function");var E=new B(R,C||v,T),u=I?I+w:w;return v._events[u]?v._events[u].fn?v._events[u]=[v._events[u],E]:v._events[u].push(E):(v._events[u]=E,v._eventsCount++),v}function k(v,w){--v._eventsCount===0?v._events=new P:delete v._events[w]}function D(){this._events=new P,this._eventsCount=0}D.prototype.eventNames=function(){var w=[],R,C;if(this._eventsCount===0)return w;for(C in R=this._events)G.call(R,C)&&w.push(I?C.slice(1):C);return Object.getOwnPropertySymbols?w.concat(Object.getOwnPropertySymbols(R)):w},D.prototype.listeners=function(w){var R=I?I+w:w,C=this._events[R];if(!C)return[];if(C.fn)return[C.fn];for(var T=0,E=C.length,u=new Array(E);T<E;T++)u[T]=C[T].fn;return u},D.prototype.listenerCount=function(w){var R=I?I+w:w,C=this._events[R];return C?C.fn?1:C.length:0},D.prototype.emit=function(w,R,C,T,E,u){var o=I?I+w:w;if(!this._events[o])return!1;var s=this._events[o],d=arguments.length,S,p;if(s.fn){s.once&&this.removeListener(w,s.fn,void 0,!0);switch(d){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,R),!0;case 3:return s.fn.call(s.context,R,C),!0;case 4:return s.fn.call(s.context,R,C,T),!0;case 5:return s.fn.call(s.context,R,C,T,E),!0;case 6:return s.fn.call(s.context,R,C,T,E,u),!0}for(p=1,S=new Array(d-1);p<d;p++)S[p-1]=arguments[p];s.fn.apply(s.context,S)}else{var h=s.length,A;for(p=0;p<h;p++){s[p].once&&this.removeListener(w,s[p].fn,void 0,!0);switch(d){case 1:s[p].fn.call(s[p].context);break;case 2:s[p].fn.call(s[p].context,R);break;case 3:s[p].fn.call(s[p].context,R,C);break;case 4:s[p].fn.call(s[p].context,R,C,T);break;default:if(!S)for(A=1,S=new Array(d-1);A<d;A++)S[A-1]=arguments[A];s[p].fn.apply(s[p].context,S)}}}return!0},D.prototype.on=function(w,R,C){return N(this,w,R,C,!1)},D.prototype.once=function(w,R,C){return N(this,w,R,C,!0)},D.prototype.removeListener=function(w,R,C,T){var E=I?I+w:w;if(!this._events[E])return this;if(!R)return k(this,E),this;var u=this._events[E];if(u.fn)u.fn===R&&(!T||u.once)&&(!C||u.context===C)&&k(this,E);else{for(var o=0,s=[],d=u.length;o<d;o++)(u[o].fn!==R||T&&!u[o].once||C&&u[o].context!==C)&&s.push(u[o]);s.length?this._events[E]=s.length===1?s[0]:s:k(this,E)}return this},D.prototype.removeAllListeners=function(w){var R;return w?(R=I?I+w:w,this._events[R]&&k(this,R)):(this._events=new P,this._eventsCount=0),this},D.prototype.off=D.prototype.removeListener,D.prototype.addListener=D.prototype.on,D.prefixed=I,D.EventEmitter=D,ee.exports=D},"./node_modules/url-toolkit/src/url-toolkit.js":function(ee,z,L){(function(G){var I=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,N=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,k={buildAbsoluteURL:function(D,v,w){if(w=w||{},D=D.trim(),v=v.trim(),!v){if(!w.alwaysNormalize)return D;var R=k.parseURL(D);if(!R)throw new Error("Error trying to parse base URL.");return R.path=k.normalizePath(R.path),k.buildURLFromParts(R)}var C=k.parseURL(v);if(!C)throw new Error("Error trying to parse relative URL.");if(C.scheme)return w.alwaysNormalize?(C.path=k.normalizePath(C.path),k.buildURLFromParts(C)):v;var T=k.parseURL(D);if(!T)throw new Error("Error trying to parse base URL.");if(!T.netLoc&&T.path&&T.path[0]!=="/"){var E=P.exec(T.path);T.netLoc=E[1],T.path=E[2]}T.netLoc&&!T.path&&(T.path="/");var u={scheme:T.scheme,netLoc:C.netLoc,path:null,params:C.params,query:C.query,fragment:C.fragment};if(!C.netLoc&&(u.netLoc=T.netLoc,C.path[0]!=="/"))if(!C.path)u.path=T.path,C.params||(u.params=T.params,C.query||(u.query=T.query));else{var o=T.path,s=o.substring(0,o.lastIndexOf("/")+1)+C.path;u.path=k.normalizePath(s)}return u.path===null&&(u.path=w.alwaysNormalize?k.normalizePath(C.path):C.path),k.buildURLFromParts(u)},parseURL:function(D){var v=I.exec(D);return v?{scheme:v[1]||"",netLoc:v[2]||"",path:v[3]||"",params:v[4]||"",query:v[5]||"",fragment:v[6]||""}:null},normalizePath:function(D){for(D=D.split("").reverse().join("").replace(B,"");D.length!==(D=D.replace(N,"")).length;);return D.split("").reverse().join("")},buildURLFromParts:function(D){return D.scheme+D.netLoc+D.path+D.params+D.query+D.fragment}};ee.exports=k})(this)},"./node_modules/webworkify-webpack/index.js":function(ee,z,L){function G(w){var R={};function C(E){if(R[E])return R[E].exports;var u=R[E]={i:E,l:!1,exports:{}};return w[E].call(u.exports,u,u.exports,C),u.l=!0,u.exports}C.m=w,C.c=R,C.i=function(E){return E},C.d=function(E,u,o){C.o(E,u)||Object.defineProperty(E,u,{configurable:!1,enumerable:!0,get:o})},C.r=function(E){Object.defineProperty(E,"__esModule",{value:!0})},C.n=function(E){var u=E&&E.__esModule?function(){return E.default}:function(){return E};return C.d(u,"a",u),u},C.o=function(E,u){return Object.prototype.hasOwnProperty.call(E,u)},C.p="/",C.oe=function(E){throw console.error(E),E};var T=C(C.s=ENTRY_MODULE);return T.default||T}var I="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+I+").*?\\)";function B(w){return(w+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function N(w){return!isNaN(1*w)}function k(w,R,C){var T={};T[C]=[];var E=R.toString(),u=E.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return T;for(var o=u[1],s=new RegExp("(\\\\n|\\W)"+B(o)+P,"g"),d;d=s.exec(E);){if(d[3]==="dll-reference")continue;T[C].push(d[3])}for(s=new RegExp("\\("+B(o)+'\\("(dll-reference\\s('+I+'))"\\)\\)'+P,"g");d=s.exec(E);)w[d[2]]||(T[C].push(d[1]),w[d[2]]=L(d[1]).m),T[d[2]]=T[d[2]]||[],T[d[2]].push(d[4]);for(var S=Object.keys(T),p=0;p<S.length;p++)for(var h=0;h<T[S[p]].length;h++)N(T[S[p]][h])&&(T[S[p]][h]=1*T[S[p]][h]);return T}function D(w){var R=Object.keys(w);return R.reduce(function(C,T){return C||w[T].length>0},!1)}function v(w,R){for(var C={main:[R]},T={main:[]},E={main:{}};D(C);)for(var u=Object.keys(C),o=0;o<u.length;o++){var s=u[o],d=C[s],S=d.pop();if(E[s]=E[s]||{},E[s][S]||!w[s][S])continue;E[s][S]=!0,T[s]=T[s]||[],T[s].push(S);for(var p=k(w,w[s][S],s),h=Object.keys(p),A=0;A<h.length;A++)C[h[A]]=C[h[A]]||[],C[h[A]]=C[h[A]].concat(p[h[A]])}return T}ee.exports=function(w,R){R=R||{};var C={main:L.m},T=R.all?{main:Object.keys(C.main)}:v(C,w),E="";Object.keys(T).filter(function(S){return S!=="main"}).forEach(function(S){for(var p=0;T[S][p];)p++;T[S].push(p),C[S][p]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",E=E+"var "+S+" = ("+G.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+T[S].map(function(h){return""+JSON.stringify(h)+": "+C[S][h].toString()}).join(",")+`});
|
|
`}),E=E+"new (("+G.toString().replace("ENTRY_MODULE",JSON.stringify(w))+")({"+T.main.map(function(S){return""+JSON.stringify(S)+": "+C.main[S].toString()}).join(",")+"}))(self);";var u=new window.Blob([E],{type:"text/javascript"});if(R.bare)return u;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,s=o.createObjectURL(u),d=new window.Worker(s);return d.objectURL=s,d}},"./src/config.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"hlsDefaultConfig",function(){return A}),L.d(z,"mergeConfig",function(){return f}),L.d(z,"enableStreamingMode",function(){return c});var G=L("./src/controller/abr-controller.ts"),I=L("./src/controller/audio-stream-controller.ts"),P=L("./src/controller/audio-track-controller.ts"),B=L("./src/controller/subtitle-stream-controller.ts"),N=L("./src/controller/subtitle-track-controller.ts"),k=L("./src/controller/buffer-controller.ts"),D=L("./src/controller/timeline-controller.ts"),v=L("./src/controller/cap-level-controller.ts"),w=L("./src/controller/fps-controller.ts"),R=L("./src/controller/eme-controller.ts"),C=L("./src/controller/cmcd-controller.ts"),T=L("./src/utils/xhr-loader.ts"),E=L("./src/utils/fetch-loader.ts"),u=L("./src/utils/cues.ts"),o=L("./src/utils/mediakeys-helper.ts"),s=L("./src/utils/logger.ts");function d(){return d=Object.assign||function(l){for(var a=1;a<arguments.length;a++){var g=arguments[a];for(var m in g)Object.prototype.hasOwnProperty.call(g,m)&&(l[m]=g[m])}return l},d.apply(this,arguments)}function S(l,a){var g=Object.keys(l);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(l);a&&(m=m.filter(function(y){return Object.getOwnPropertyDescriptor(l,y).enumerable})),g.push.apply(g,m)}return g}function p(l){for(var a=1;a<arguments.length;a++){var g=arguments[a]!=null?arguments[a]:{};a%2?S(Object(g),!0).forEach(function(m){h(l,m,g[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(g)):S(Object(g)).forEach(function(m){Object.defineProperty(l,m,Object.getOwnPropertyDescriptor(g,m))})}return l}function h(l,a,g){return a in l?Object.defineProperty(l,a,{value:g,enumerable:!0,configurable:!0,writable:!0}):l[a]=g,l}var A=p(p({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:T.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:G.default,bufferController:k.default,capLevelController:v.default,fpsController:w.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},b()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:N.default,timelineController:D.TimelineController,audioStreamController:I.default,audioTrackController:P.default,emeController:R.default,cmcdController:C.default});function b(){return{cueHandler:u.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function f(l,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return d({},l,a)}function c(l){var a=l.loader;if(a!==E.default&&a!==T.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),l.progressive=!1;else{var g=Object(E.fetchSupported)();g&&(l.loader=E.default,l.progressive=!0,l.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ee,z,L){"use strict";L.r(z);var G=L("./src/polyfills/number.ts"),I=L("./src/utils/ewma-bandwidth-estimator.ts"),P=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),N=L("./src/errors.ts"),k=L("./src/types/loader.ts"),D=L("./src/utils/logger.ts");function v(C,T){for(var E=0;E<T.length;E++){var u=T[E];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(C,u.key,u)}}function w(C,T,E){return T&&v(C.prototype,T),E&&v(C,E),C}var R=function(){function C(E){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=E;var u=E.config;this.bwEstimator=new I.default(u.abrEwmaSlowVoD,u.abrEwmaFastVoD,u.abrEwmaDefaultEstimate),this.registerListeners()}var T=C.prototype;return T.registerListeners=function(){var u=this.hls;u.on(P.Events.FRAG_LOADING,this.onFragLoading,this),u.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(P.Events.ERROR,this.onError,this)},T.unregisterListeners=function(){var u=this.hls;u.off(P.Events.FRAG_LOADING,this.onFragLoading,this),u.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(P.Events.ERROR,this.onError,this)},T.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},T.onFragLoading=function(u,o){var s=o.frag;if(s.type===k.PlaylistLevelType.MAIN&&!this.timer){var d;this.fragCurrent=s,this.partCurrent=(d=o.part)!=null?d:null,this.timer=self.setInterval(this.onCheck,100)}},T.onLevelLoaded=function(u,o){var s=this.hls.config;o.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},T._abandonRulesCheck=function(){var u=this.fragCurrent,o=this.partCurrent,s=this.hls,d=s.autoLevelEnabled,S=s.config,p=s.media;if(!u||!p)return;var h=o?o.stats:u.stats,A=o?o.duration:u.duration;if(h.aborted){D.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!d||p.paused||!p.playbackRate||!p.readyState)return;var b=performance.now()-h.loading.start,f=Math.abs(p.playbackRate);if(b<=500*A/f)return;var c=s.levels,l=s.minAutoLevel,a=c[u.level],g=h.total||Math.max(h.loaded,Math.round(A*a.maxBitrate/8)),m=Math.max(1,h.bwEstimate?h.bwEstimate/8:h.loaded*1e3/b),y=(g-h.loaded)/m,M=p.currentTime,F=(B.BufferHelper.bufferInfo(p,M,S.maxBufferHole).end-M)/f;if(F>=2*A/f||y<=F)return;var j=Number.POSITIVE_INFINITY,W;for(W=u.level-1;W>l;W--){var O=c[W].maxBitrate;if(j=A*O/(8*.8*m),j<F)break}if(j>=y)return;var _=this.bwEstimator.getEstimate();D.logger.warn("Fragment "+u.sn+(o?" part "+o.index:"")+" of level "+u.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+`
|
|
Current BW estimate: `+(Object(G.isFiniteNumber)(_)?(_/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+y.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+j.toFixed(3)+` s
|
|
Time to underbuffer: `+F.toFixed(3)+" s"),s.nextLoadLevel=W,this.bwEstimator.sample(b,h.loaded),this.clearTimer(),u.loader&&(this.fragCurrent=this.partCurrent=null,u.loader.abort()),s.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:u,part:o,stats:h})},T.onFragLoaded=function(u,o){var s=o.frag,d=o.part;if(s.type===k.PlaylistLevelType.MAIN&&Object(G.isFiniteNumber)(s.sn)){var S=d?d.stats:s.stats,p=d?d.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var h=this.hls.levels[s.level],A=(h.loaded?h.loaded.bytes:0)+S.loaded,b=(h.loaded?h.loaded.duration:0)+p;h.loaded={bytes:A,duration:b},h.realBitrate=Math.round(8*A/b)}if(s.bitrateTest){var f={stats:S,frag:s,part:d,id:s.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,f),s.bitrateTest=!1}}},T.onFragBuffered=function(u,o){var s=o.frag,d=o.part,S=d?d.stats:s.stats;if(S.aborted)return;if(s.type!==k.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var p=S.parsing.end-S.loading.start;this.bwEstimator.sample(p,S.loaded),S.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=p/1e3:this.bitrateTestDelay=0},T.onError=function(u,o){switch(o.details){case N.ErrorDetails.FRAG_LOAD_ERROR:case N.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},T.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},T.getNextABRAutoLevel=function(){var u=this.fragCurrent,o=this.partCurrent,s=this.hls,d=s.maxAutoLevel,S=s.config,p=s.minAutoLevel,h=s.media,A=o?o.duration:u?u.duration:0,b=h?h.currentTime:0,f=h&&h.playbackRate!==0?Math.abs(h.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():S.abrEwmaDefaultEstimate,l=(B.BufferHelper.bufferInfo(h,b,S.maxBufferHole).end-b)/f,a=this.findBestLevel(c,p,d,l,S.abrBandWidthFactor,S.abrBandWidthUpFactor);if(a>=0)return a;D.logger.trace((l?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var g=A?Math.min(A,S.maxStarvationDelay):S.maxStarvationDelay,m=S.abrBandWidthFactor,y=S.abrBandWidthUpFactor;if(!l){var M=this.bitrateTestDelay;if(M){var F=A?Math.min(A,S.maxLoadingDelay):S.maxLoadingDelay;g=F-M,D.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*g)+" ms"),m=y=1}}return a=this.findBestLevel(c,p,d,l+g,m,y),Math.max(a,0)},T.findBestLevel=function(u,o,s,d,S,p){for(var h,A=this.fragCurrent,b=this.partCurrent,f=this.lastLoadedFragLevel,c=this.hls.levels,l=c[f],a=!!(l!=null&&(h=l.details)!==null&&h!==void 0&&h.live),g=l==null?void 0:l.codecSet,m=b?b.duration:A?A.duration:0,y=s;y>=o;y--){var M=c[y];if(!M||g&&M.codecSet!==g)continue;var F=M.details,j=(b?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||m,W=void 0;y<=f?W=S*u:W=p*u;var O=c[y].maxBitrate,_=O*j/W;if(D.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+y+"/"+Math.round(W)+"/"+O+"/"+j+"/"+d+"/"+_),W>O&&(!_||a&&!this.bitrateTestDelay||_<d))return y}return-1},w(C,[{key:"nextAutoLevel",get:function(){var u=this._nextAutoLevel,o=this.bwEstimator;if(u!==-1&&(!o||!o.canEstimate()))return u;var s=this.getNextABRAutoLevel();return u!==-1&&(s=Math.min(u,s)),s},set:function(u){this._nextAutoLevel=u}}]),C}();z.default=R},"./src/controller/audio-stream-controller.ts":function(ee,z,L){"use strict";L.r(z);var G=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),P=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),N=L("./src/controller/fragment-tracker.ts"),k=L("./src/types/level.ts"),D=L("./src/types/loader.ts"),v=L("./src/loader/fragment.ts"),w=L("./src/demux/chunk-cache.ts"),R=L("./src/demux/transmuxer-interface.ts"),C=L("./src/types/transmuxer.ts"),T=L("./src/controller/fragment-finders.ts"),E=L("./src/utils/discontinuities.ts"),u=L("./src/errors.ts"),o=L("./src/utils/logger.ts");function s(){return s=Object.assign||function(A){for(var b=1;b<arguments.length;b++){var f=arguments[b];for(var c in f)Object.prototype.hasOwnProperty.call(f,c)&&(A[c]=f[c])}return A},s.apply(this,arguments)}function d(A,b){A.prototype=Object.create(b.prototype),A.prototype.constructor=A,S(A,b)}function S(A,b){return S=Object.setPrototypeOf||function(c,l){return c.__proto__=l,c},S(A,b)}var p=100,h=function(A){d(b,A);function b(c,l){var a;return a=A.call(this,c,l,"[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 f=b.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var l=this.hls;l.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(P.Events.ERROR,this.onError,this),l.on(P.Events.BUFFER_RESET,this.onBufferReset,this),l.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),l.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f._unregisterListeners=function(){var l=this.hls;l.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(P.Events.ERROR,this.onError,this),l.off(P.Events.BUFFER_RESET,this.onBufferReset,this),l.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),l.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f.onInitPtsFound=function(l,a){var g=a.frag,m=a.id,y=a.initPTS;if(m==="main"){var M=g.cc;this.initPTS[g.cc]=y,this.log("InitPTS for cc: "+M+" found from main: "+y),this.videoTrackCC=M,this.state===I.State.WAITING_INIT_PTS&&this.tick()}},f.startLoad=function(l){if(!this.levels){this.startPosition=l,this.state=I.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(p),this.fragLoadError=0,a>0&&l===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=I.State.IDLE):(this.loadedmetadata=!1,this.state=I.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=l,this.tick()},f.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_TRACK:{var l,a=this.levels,g=this.trackId,m=a==null||((l=a[g])===null||l===void 0)?void 0:l.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=I.State.WAITING_INIT_PTS}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var y,M=performance.now(),F=this.retryDate;(!F||M>=F||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=I.State.IDLE);break}case I.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var W=j.frag,O=j.part,_=j.cache,K=j.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.FRAG_LOADING;var $=_.flush(),q={frag:W,part:O,payload:$,networkDetails:null};this._handleFragmentLoadProgress(q),K&&A.prototype._handleFragmentLoadComplete.call(this,q)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+W.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ne=this.getLoadPosition(),Te=B.BufferHelper.bufferInfo(this.mediaBuffer,ne,this.config.maxBufferHole),ve=Object(T.fragmentWithinToleranceTest)(Te.end,this.config.maxFragLookUpTolerance,W);ve<0&&(o.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+Te.end+" is needed"),this.clearWaitingFragment())}}else this.state=I.State.IDLE}}this.onTickEnd()},f.clearWaitingFragment=function(){var l=this.waitingData;l&&(this.fragmentTracker.removeFragment(l.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.IDLE)},f.onTickEnd=function(){var l=this.media;if(!l||!l.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:l,g=a.buffered;!this.loadedmetadata&&g.length&&(this.loadedmetadata=!0),this.lastCurrentTime=l.currentTime},f.doTickIdle=function(){var l,a,g=this.hls,m=this.levels,y=this.media,M=this.trackId,F=g.config;if(!m||!m[M])return;if(!y&&(this.startFragRequested||!F.startFragPrefetch))return;var j=m[M],W=j.details;if(!W||W.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(W)){this.state=I.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,v.ElementaryStreamTypes.AUDIO,D.PlaylistLevelType.AUDIO));var O=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,D.PlaylistLevelType.AUDIO);if(O===null)return;var _=O.len,K=this.getMaxBufferLength(),$=this.audioSwitch;if(_>=K&&!$)return;if(!$&&this._streamEnded(O,W)){g.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=I.State.ENDED;return}var q=W.fragments,ne=q[0].start,Te=O.end;if($){var ve=this.getLoadPosition();Te=ve,W.PTSKnown&&ve<ne&&((O.end>ne||O.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),y.currentTime=ne+.05))}var ge=this.getNextFragment(Te,W);if(!ge){this.bufferFlushed=!0;return}((l=ge.decryptdata)===null||l===void 0?void 0:l.keyFormat)==="identity"&&!((a=ge.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(ge,W):this.loadFragment(ge,W,Te)},f.getMaxBufferLength=function(){var l=A.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,D.PlaylistLevelType.MAIN);return a===null?l:Math.max(l,a.len)},f.onMediaDetaching=function(){this.videoBuffer=null,A.prototype.onMediaDetaching.call(this)},f.onAudioTracksUpdated=function(l,a){var g=a.audioTracks;this.resetTransmuxer(),this.levels=g.map(function(m){return new k.Level(m)})},f.onAudioTrackSwitching=function(l,a){var g=!!a.url;this.trackId=a.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),g?this.setInterval(p):this.resetTransmuxer(),g?(this.audioSwitch=!0,this.state=I.State.IDLE):this.state=I.State.STOPPED,this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},f.onLevelLoaded=function(l,a){this.mainDetails=a.details},f.onAudioTrackLoaded=function(l,a){var g,m=this.levels,y=a.details,M=a.id;if(!m){this.warn("Audio tracks were reset while loading level "+M);return}this.log("Track "+M+" loaded ["+y.startSN+","+y.endSN+"],duration:"+y.totalduration);var F=m[M],j=0;if(y.live||(g=F.details)!==null&&g!==void 0&&g.live){var W=this.mainDetails;if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed||!W)return;!F.details&&y.hasProgramDateTime&&W.hasProgramDateTime?(Object(E.alignMediaPlaylistByPDT)(y,W),j=y.fragments[0].start):j=this.alignPlaylists(y,F.details)}F.details=y,this.levelLastLoaded=M,!this.startFragRequested&&(this.mainDetails||!y.live)&&this.setStartPosition(F.details,j),this.state===I.State.WAITING_TRACK&&!this.waitForCdnTuneIn(y)&&(this.state=I.State.IDLE),this.tick()},f._handleFragmentLoadProgress=function(l){var a,g=l.frag,m=l.part,y=l.payload,M=this.config,F=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+g.sn+" of level "+g.level+" will not be buffered");return}var W=j[F];console.assert(W,"Audio track is defined on fragment load progress");var O=W.details;console.assert(O,"Audio track details are defined on fragment load progress");var _=M.defaultAudioCodec||W.audioCodec||"mp4a.40.2",K=this.transmuxer;K||(K=this.transmuxer=new R.default(this.hls,D.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var $=this.initPTS[g.cc],q=(a=g.initSegment)===null||a===void 0?void 0:a.data;if($!==void 0){var ne=!1,Te=m?m.index:-1,ve=Te!==-1,ge=new C.ChunkMetadata(g.level,g.sn,g.stats.chunkCount,y.byteLength,Te,ve);K.push(y,q,_,"",g,m,O.totalduration,ne,ge,$)}else{o.logger.log("Unknown video PTS for cc "+g.cc+", waiting for video PTS before demuxing audio frag "+g.sn+" of ["+O.startSN+" ,"+O.endSN+"],track "+F);var ce=this.waitingData=this.waitingData||{frag:g,part:m,cache:new w.default,complete:!1},he=ce.cache;he.push(new Uint8Array(y)),this.waitingVideoCC=this.videoTrackCC,this.state=I.State.WAITING_INIT_PTS}},f._handleFragmentLoadComplete=function(l){if(this.waitingData){this.waitingData.complete=!0;return}A.prototype._handleFragmentLoadComplete.call(this,l)},f.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},f.onBufferCreated=function(l,a){var g=a.tracks.audio;g&&(this.mediaBuffer=g.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},f.onFragBuffered=function(l,a){var g=a.frag,m=a.part;if(g.type!==D.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(g)){this.warn("Fragment "+g.sn+(m?" p: "+m.index:"")+" of level "+g.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}g.sn!=="initSegment"&&(this.fragPrevious=g,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(g,m)},f.onError=function(l,a){switch(a.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.AUDIO,a);break;case u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case u.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==I.State.ERROR&&this.state!==I.State.STOPPED&&(this.state=a.fatal?I.State.ERROR:I.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case u.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var g=!0,m=this.getFwdBufferInfo(this.mediaBuffer,D.PlaylistLevelType.AUDIO);m&&m.len>.5&&(g=!this.reduceMaxBufferLength(m.len)),g&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},f.onBufferFlushed=function(l,a){var g=a.type;g===v.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},f._handleTransmuxComplete=function(l){var a,g="audio",m=this.hls,y=l.remuxResult,M=l.chunkMeta,F=this.getCurrentContext(M);if(!F){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var j=F.frag,W=F.part,O=y.audio,_=y.text,K=y.id3,$=y.initSegment;if(this.fragContextChanged(j))return;if(this.state=I.State.PARSING,this.audioSwitch&&O&&this.completeAudioSwitch(),$!=null&&$.tracks&&(this._bufferInitSegment($.tracks,j,M),m.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:g,tracks:$.tracks})),O){var q=O.startPTS,ne=O.endPTS,Te=O.startDTS,ve=O.endDTS;W&&(W.elementaryStreams[v.ElementaryStreamTypes.AUDIO]={startPTS:q,endPTS:ne,startDTS:Te,endDTS:ve}),j.setElementaryStreamInfo(v.ElementaryStreamTypes.AUDIO,q,ne,Te,ve),this.bufferFragmentData(O,j,W,M)}if(K!=null&&(a=K.samples)!==null&&a!==void 0&&a.length){var ge=s({frag:j,id:g},K);m.trigger(P.Events.FRAG_PARSING_METADATA,ge)}if(_){var ce=s({frag:j,id:g},_);m.trigger(P.Events.FRAG_PARSING_USERDATA,ce)}},f._bufferInitSegment=function(l,a,g){if(this.state!==I.State.PARSING)return;l.video&&delete l.video;var m=l.audio;if(!m)return;m.levelCodec=m.codec,m.id="audio",this.log("Init audio buffer, container:"+m.container+", codecs[parsed]=["+m.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,l);var y=m.initSegment;if(y!=null&&y.byteLength){var M={type:"audio",frag:a,part:null,chunkMeta:g,parent:a.type,data:y};this.hls.trigger(P.Events.BUFFER_APPENDING,M)}this.tick()},f.loadFragment=function(l,a,g){var m=this.fragmentTracker.getState(l);this.fragCurrent=l,(this.audioSwitch||m===N.FragmentState.NOT_LOADED||m===N.FragmentState.PARTIAL)&&(l.sn==="initSegment"?this._loadInitSegment(l):a.live&&!Object(G.isFiniteNumber)(this.initPTS[l.cc])?(this.log("Waiting for video PTS in continuity counter "+l.cc+" of live stream before loading audio fragment "+l.sn+" of level "+this.trackId),this.state=I.State.WAITING_INIT_PTS):(this.startFragRequested=!0,A.prototype.loadFragment.call(this,l,a,g)))},f.completeAudioSwitch=function(){var l=this.hls,a=this.media,g=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,l.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:g})},b}(I.default);z.default=h},"./src/controller/audio-track-controller.ts":function(ee,z,L){"use strict";L.r(z);var G=L("./src/events.ts"),I=L("./src/errors.ts"),P=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function N(R,C){for(var T=0;T<C.length;T++){var E=C[T];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(R,E.key,E)}}function k(R,C,T){return C&&N(R.prototype,C),T&&N(R,T),R}function D(R,C){R.prototype=Object.create(C.prototype),R.prototype.constructor=R,v(R,C)}function v(R,C){return v=Object.setPrototypeOf||function(E,u){return E.__proto__=u,E},v(R,C)}var w=function(R){D(C,R);function C(E){var u;return u=R.call(this,E,"[audio-track-controller]")||this,u.tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.trackName="",u.selectDefaultTrack=!0,u.registerListeners(),u}var T=C.prototype;return T.registerListeners=function(){var u=this.hls;u.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),u.on(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.on(G.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(G.Events.ERROR,this.onError,this)},T.unregisterListeners=function(){var u=this.hls;u.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.off(G.Events.LEVEL_LOADING,this.onLevelLoading,this),u.off(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.off(G.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(G.Events.ERROR,this.onError,this)},T.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,R.prototype.destroy.call(this)},T.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},T.onManifestParsed=function(u,o){this.tracks=o.audioTracks||[]},T.onAudioTrackLoaded=function(u,o){var s=o.id,d=o.details,S=this.tracksInGroup[s];if(!S){this.warn("Invalid audio track id "+s);return}var p=S.details;S.details=o.details,this.log("audioTrack "+s+" loaded ["+d.startSN+"-"+d.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,o,p))},T.onLevelLoading=function(u,o){this.switchLevel(o.level)},T.onLevelSwitching=function(u,o){this.switchLevel(o.level)},T.switchLevel=function(u){var o=this.hls.levels[u];if(!(o!=null&&o.audioGroupIds))return;var s=o.audioGroupIds[o.urlId];if(this.groupId!==s){this.groupId=s;var d=this.tracks.filter(function(p){return!s||p.groupId===s});this.selectDefaultTrack&&!d.some(function(p){return p.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=d;var S={audioTracks:d};this.log("Updating audio tracks, "+d.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(G.Events.AUDIO_TRACKS_UPDATED,S),this.selectInitialTrack()}},T.onError=function(u,o){if(R.prototype.onError.call(this,u,o),o.fatal||!o.context)return;o.context.type===B.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},T.setAudioTrack=function(u){var o=this.tracksInGroup;if(u<0||u>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=o[this.trackId];this.log("Now switching to audio-track index "+u);var d=o[u],S=d.id,p=d.groupId,h=p===void 0?"":p,A=d.name,b=d.type,f=d.url;if(this.trackId=u,this.trackName=A,this.selectDefaultTrack=!1,this.hls.trigger(G.Events.AUDIO_TRACK_SWITCHING,{id:S,groupId:h,name:A,type:b,url:f}),d.details&&!d.details.live)return;var c=this.switchParams(d.url,s==null?void 0:s.details);this.loadPlaylist(c)},T.selectInitialTrack=function(){var u=this.tracksInGroup;console.assert(u.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,s=this.findTrackId(o)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},T.findTrackId=function(u){for(var o=this.tracksInGroup,s=0;s<o.length;s++){var d=o[s];if((!this.selectDefaultTrack||d.default)&&(!u||u===d.name))return d.id}return-1},T.loadPlaylist=function(u){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var s=o.id,d=o.groupId,S=o.url;if(u)try{S=u.addDirectives(S)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(G.Events.AUDIO_TRACK_LOADING,{url:S,id:s,groupId:d,deliveryDirectives:u||null})}},k(C,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(u){this.selectDefaultTrack=!1,this.setAudioTrack(u)}}]),C}(P.default);z.default=w},"./src/controller/base-playlist-controller.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"default",function(){return k});var G=L("./src/polyfills/number.ts"),I=L("./src/types/level.ts"),P=L("./src/controller/level-helper.ts"),B=L("./src/utils/logger.ts"),N=L("./src/errors.ts"),k=function(){function D(w,R){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=B.logger.log.bind(B.logger,R+":"),this.warn=B.logger.warn.bind(B.logger,R+":"),this.hls=w}var v=D.prototype;return v.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},v.onError=function(R,C){C.fatal&&C.type===N.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},v.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},v.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},v.stopLoad=function(){this.canLoad=!1,this.clearTimer()},v.switchParams=function(R,C){var T=C==null?void 0:C.renditionReports;if(T)for(var E=0;E<T.length;E++){var u=T[E],o=""+u.URI;if(o===R.substr(-o.length)){var s=parseInt(u["LAST-MSN"]),d=parseInt(u["LAST-PART"]);if(C&&this.hls.config.lowLatencyMode){var S=Math.min(C.age-C.partTarget,C.targetduration);d!==void 0&&S>C.partTarget&&(d+=1)}if(Object(G.isFiniteNumber)(s))return new I.HlsUrlParameters(s,Object(G.isFiniteNumber)(d)?d:void 0,I.HlsSkip.No)}}},v.loadPlaylist=function(R){},v.shouldLoadTrack=function(R){return this.canLoad&&R&&!!R.url&&(!R.details||R.details.live)},v.playlistLoaded=function(R,C,T){var E=this,u=C.details,o=C.stats,s=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(u.advancedDateTime=Date.now()-s,u.live||T!=null&&T.live){if(u.reloaded(T),T&&this.log("live playlist "+R+" "+(u.advanced?"REFRESHED "+u.lastPartSn+"-"+u.lastPartIndex:"MISSED")),T&&u.fragments.length>0&&Object(P.mergeDetails)(T,u),!this.canLoad||!u.live)return;var d,S=void 0,p=void 0;if(u.canBlockReload&&u.endSN&&u.advanced){var h=this.hls.config.lowLatencyMode,A=u.lastPartSn,b=u.endSN,f=u.lastPartIndex,c=f!==-1,l=A===b,a=h?0:f;c?(S=l?b+1:A,p=l?a:f+1):S=b+1;var g=u.age,m=g+u.ageHeader,y=Math.min(m-u.partTarget,u.targetduration*1.5);if(y>0){if(T&&y>T.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+T.tuneInGoal+" to: "+y+" with playlist age: "+u.age),y=0;else{var M=Math.floor(y/u.targetduration);if(S+=M,p!==void 0){var F=Math.round(y%u.targetduration/u.partTarget);p+=F}this.log("CDN Tune-in age: "+u.ageHeader+"s last advanced "+g.toFixed(2)+"s goal: "+y+" skip sn "+M+" to part "+p)}u.tuneInGoal=y}if(d=this.getDeliveryDirectives(u,C.deliveryDirectives,S,p),h||!l){this.loadPlaylist(d);return}}else d=this.getDeliveryDirectives(u,C.deliveryDirectives,S,p);var j=Object(P.computeReloadInterval)(u,o);S!==void 0&&u.canBlockReload&&(j-=u.partTarget||1),this.log("reload live playlist "+R+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return E.loadPlaylist(d)},j)}else this.clearTimer()},v.getDeliveryDirectives=function(R,C,T,E){var u=Object(I.getSkipValue)(R,T);return C!=null&&C.skip&&R.deltaUpdateFailed&&(T=C.msn,E=C.part,u=I.HlsSkip.No),new I.HlsUrlParameters(T,E,u)},v.retryLoadingOrFail=function(R){var C=this,T=this.hls.config,E=this.retryCount<T.levelLoadingMaxRetry;if(E){var u;if(this.retryCount++,R.details.indexOf("LoadTimeOut")>-1&&(u=R.context)!==null&&u!==void 0&&u.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+R.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*T.levelLoadingRetryDelay,T.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return C.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+R.details+'"')}}else this.warn('cannot recover from error "'+R.details+'"'),this.clearTimer(),R.fatal=!0;return E},D}()},"./src/controller/base-stream-controller.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"State",function(){return b}),L.d(z,"default",function(){return f});var G=L("./src/polyfills/number.ts"),I=L("./src/task-loop.ts"),P=L("./src/controller/fragment-tracker.ts"),B=L("./src/utils/buffer-helper.ts"),N=L("./src/utils/logger.ts"),k=L("./src/events.ts"),D=L("./src/errors.ts"),v=L("./src/types/transmuxer.ts"),w=L("./src/utils/mp4-tools.ts"),R=L("./src/utils/discontinuities.ts"),C=L("./src/controller/fragment-finders.ts"),T=L("./src/controller/level-helper.ts"),E=L("./src/loader/fragment-loader.ts"),u=L("./src/crypt/decrypter.ts"),o=L("./src/utils/time-ranges.ts"),s=L("./src/types/loader.ts");function d(c,l){for(var a=0;a<l.length;a++){var g=l[a];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(c,g.key,g)}}function S(c,l,a){return l&&d(c.prototype,l),a&&d(c,a),c}function p(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function h(c,l){c.prototype=Object.create(l.prototype),c.prototype.constructor=c,A(c,l)}function A(c,l){return A=Object.setPrototypeOf||function(g,m){return g.__proto__=m,g},A(c,l)}var b={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},f=function(c){h(l,c);function l(g,m,y){var M;return M=c.call(this)||this,M.hls=void 0,M.fragPrevious=null,M.fragCurrent=null,M.fragmentTracker=void 0,M.transmuxer=null,M._state=b.STOPPED,M.media=void 0,M.mediaBuffer=void 0,M.config=void 0,M.bitrateTest=!1,M.lastCurrentTime=0,M.nextLoadPosition=0,M.startPosition=0,M.loadedmetadata=!1,M.fragLoadError=0,M.retryDate=0,M.levels=null,M.fragmentLoader=void 0,M.levelLastLoaded=null,M.startFragRequested=!1,M.decrypter=void 0,M.initPTS=[],M.onvseeking=null,M.onvended=null,M.logPrefix="",M.log=void 0,M.warn=void 0,M.logPrefix=y,M.log=N.logger.log.bind(N.logger,y+":"),M.warn=N.logger.warn.bind(N.logger,y+":"),M.hls=g,M.fragmentLoader=new E.default(g.config),M.fragmentTracker=m,M.config=g.config,M.decrypter=new u.default(g,g.config),g.on(k.Events.KEY_LOADED,M.onKeyLoaded,p(M)),M}var a=l.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(m){},a.stopLoad=function(){this.fragmentLoader.abort();var m=this.fragCurrent;m&&this.fragmentTracker.removeFragment(m),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=b.STOPPED},a._streamEnded=function(m,y){var M=this.fragCurrent,F=this.fragmentTracker;if(!y.live&&M&&M.sn===y.endSN&&!m.nextStart){var j=F.getState(M);return j===P.FragmentState.PARTIAL||j===P.FragmentState.OK}return!1},a.onMediaAttached=function(m,y){var M=this.media=this.mediaBuffer=y.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),M.addEventListener("seeking",this.onvseeking),M.addEventListener("ended",this.onvended);var F=this.config;this.levels&&F.autoStartLoad&&this.state===b.STOPPED&&this.startLoad(F.startPosition)},a.onMediaDetaching=function(){var m=this.media;m!=null&&m.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),m&&(m.removeEventListener("seeking",this.onvseeking),m.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 m=this.config,y=this.fragCurrent,M=this.media,F=this.mediaBuffer,j=this.state,W=M?M.currentTime:0,O=B.BufferHelper.bufferInfo(F||M,W,m.maxBufferHole);if(this.log("media seeking to "+(Object(G.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+j),j===b.ENDED)this.resetLoadingState();else if(y&&!O.len){var _=m.maxFragLookUpTolerance,K=y.start-_,$=y.start+y.duration+_,q=W>$;(W<K||q)&&(q&&y.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),y.loader.abort()),this.resetLoadingState())}M&&(this.lastCurrentTime=W),!this.loadedmetadata&&!O.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(m,y){if(this.state!==b.KEY_LOADING||y.frag!==this.fragCurrent||!this.levels)return;this.state=b.IDLE;var M=this.levels[y.frag.level].details;M&&this.loadFragment(y.frag,M,y.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=b.STOPPED,this.hls.off(k.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,c.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(m,y){this.log("Loading key for "+m.sn+" of ["+y.startSN+"-"+y.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=b.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(k.Events.KEY_LOADING,{frag:m})},a.loadFragment=function(m,y,M){this._loadFragForPlayback(m,y,M)},a._loadFragForPlayback=function(m,y,M){var F=this,j=function(O){if(F.fragContextChanged(m)){F.warn("Fragment "+m.sn+(O.part?" p: "+O.part.index:"")+" of level "+m.level+" was dropped during download."),F.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,F._handleFragmentLoadProgress(O)};this._doFragLoad(m,y,M,j).then(function(W){if(!W)return;F.fragLoadError=0;var O=F.state;if(F.fragContextChanged(m)){(O===b.FRAG_LOADING||O===b.BACKTRACKING||!F.fragCurrent&&O===b.PARSING)&&(F.fragmentTracker.removeFragment(m),F.state=b.IDLE);return}if("payload"in W&&(F.log("Loaded fragment "+m.sn+" of level "+m.level),F.hls.trigger(k.Events.FRAG_LOADED,W),F.state===b.BACKTRACKING)){F.fragmentTracker.backtrack(m,W),F.resetFragmentLoading(m);return}F._handleFragmentLoadComplete(W)}).catch(function(W){F.warn(W),F.resetFragmentLoading(m)})},a.flushMainBuffer=function(m,y,M){if(M===void 0&&(M=null),!(m-y))return;var F={startOffset:m,endOffset:y,type:M};this.fragLoadError=0,this.hls.trigger(k.Events.BUFFER_FLUSHING,F)},a._loadInitSegment=function(m){var y=this;this._doFragLoad(m).then(function(M){if(!M||y.fragContextChanged(m)||!y.levels)throw new Error("init load aborted");return M}).then(function(M){var F=y.hls,j=M.payload,W=m.decryptdata;if(j&&j.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var O=self.performance.now();return y.decrypter.webCryptoDecrypt(new Uint8Array(j),W.key.buffer,W.iv.buffer).then(function(_){var K=self.performance.now();return F.trigger(k.Events.FRAG_DECRYPTED,{frag:m,payload:_,stats:{tstart:O,tdecrypt:K}}),M.payload=_,M})}return M}).then(function(M){var F=y.fragCurrent,j=y.hls,W=y.levels;if(!W)throw new Error("init load aborted, missing levels");var O=W[m.level].details;console.assert(O,"Level details are defined when init segment is loaded");var _=m.stats;y.state=b.IDLE,y.fragLoadError=0,m.data=new Uint8Array(M.payload),_.parsing.start=_.buffering.start=self.performance.now(),_.parsing.end=_.buffering.end=self.performance.now(),M.frag===F&&j.trigger(k.Events.FRAG_BUFFERED,{stats:_,frag:F,part:null,id:m.type}),y.tick()}).catch(function(M){y.warn(M),y.resetFragmentLoading(m)})},a.fragContextChanged=function(m){var y=this.fragCurrent;return!m||!y||m.level!==y.level||m.sn!==y.sn||m.urlId!==y.urlId},a.fragBufferedComplete=function(m,y){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(y?" part: "+y.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+o.default.toString(B.BufferHelper.getBuffered(M))),this.state=b.IDLE,this.tick()},a._handleFragmentLoadComplete=function(m){var y=this.transmuxer;if(!y)return;var M=m.frag,F=m.part,j=m.partsLoaded,W=!j||j.length===0||j.some(function(_){return!_}),O=new v.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,F?F.index:-1,!W);y.flush(O)},a._handleFragmentLoadProgress=function(m){},a._doFragLoad=function(m,y,M,F){var j=this;if(M===void 0&&(M=null),!this.levels)throw new Error("frag load aborted, missing levels");if(M=Math.max(m.start,M||0),this.config.lowLatencyMode&&y){var W=y.partList;if(W&&F){M>m.end&&y.fragmentHint&&(m=y.fragmentHint);var O=this.getNextPart(W,m,M);if(O>-1){var _=W[O];return this.log("Loading part sn: "+m.sn+" p: "+_.index+" cc: "+m.cc+" of playlist ["+y.startSN+"-"+y.endSN+"] parts [0-"+O+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=_.start+_.duration,this.state=b.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:m,part:W[O],targetBufferTime:M}),this.doFragPartsLoad(m,W,O,F).catch(function(K){return j.handleFragLoadError(K)})}else if(!m.url||this.loadedEndOfParts(W,M))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(y?"of ["+y.startSN+"-"+y.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(M.toFixed(3))),Object(G.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=b.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:m,targetBufferTime:M}),this.fragmentLoader.load(m,F).catch(function(K){return j.handleFragLoadError(K)})},a.doFragPartsLoad=function(m,y,M,F){var j=this;return new Promise(function(W,O){var _=[],K=function $(q){var ne=y[q];j.fragmentLoader.loadPart(m,ne,F).then(function(Te){_[ne.index]=Te;var ve=Te.part;j.hls.trigger(k.Events.FRAG_LOADED,Te);var ge=y[q+1];if(ge&&ge.fragment===m)$(q+1);else return W({frag:m,part:ve,partsLoaded:_})}).catch(O)};K(M)})},a.handleFragLoadError=function(m){var y=m.data;return y&&y.details===D.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(y.frag,y.part):this.hls.trigger(k.Events.ERROR,y),null},a._handleTransmuxerFlush=function(m){var y=this.getCurrentContext(m);if(!y||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var M=y.frag,F=y.part,j=y.level,W=self.performance.now();M.stats.parsing.end=W,F&&(F.stats.parsing.end=W),this.updateLevelTiming(M,F,j,m.partial)},a.getCurrentContext=function(m){var y=this.levels,M=m.level,F=m.sn,j=m.part;if(!y||!y[M])return this.warn("Levels object was unset while buffering fragment "+F+" of level "+M+". The current chunk will not be buffered."),null;var W=y[M],O=j>-1?Object(T.getPartWith)(W,F,j):null,_=O?O.fragment:Object(T.getFragmentWithSN)(W,F,this.fragCurrent);return _?{frag:_,part:O,level:W}:null},a.bufferFragmentData=function(m,y,M,F){if(!m||this.state!==b.PARSING)return;var j=m.data1,W=m.data2,O=j;if(j&&W&&(O=Object(w.appendUint8Array)(j,W)),!O||!O.length)return;var _={type:m.type,frag:y,part:M,chunkMeta:F,parent:y.type,data:O};this.hls.trigger(k.Events.BUFFER_APPENDING,_),m.dropped&&m.independent&&!M&&this.flushBufferGap(y)},a.flushBufferGap=function(m){var y=this.media;if(!y)return;if(!B.BufferHelper.isBuffered(y,y.currentTime)){this.flushMainBuffer(0,m.start);return}var M=y.currentTime,F=B.BufferHelper.bufferInfo(y,M,0),j=m.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),O=Math.max(Math.min(m.start-W,F.end-W),M+W);m.start-O>W&&this.flushMainBuffer(O,m.start)},a.getFwdBufferInfo=function(m,y){var M=this.config,F=this.getLoadPosition();if(!Object(G.isFiniteNumber)(F))return null;var j=B.BufferHelper.bufferInfo(m,F,M.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(F,y);if(W&&j.nextStart<W.end)return B.BufferHelper.bufferInfo(m,F,Math.max(j.nextStart,M.maxBufferHole))}return j},a.getMaxBufferLength=function(m){var y=this.config,M;return m?M=Math.max(8*y.maxBufferSize/m,y.maxBufferLength):M=y.maxBufferLength,Math.min(M,y.maxMaxBufferLength)},a.reduceMaxBufferLength=function(m){var y=this.config,M=m||y.maxBufferLength;return y.maxMaxBufferLength>=M?(y.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+y.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(m,y){var M,F,j=y.fragments,W=j.length;if(!W)return null;var O=this.config,_=j[0].start,K;if(y.live){var $=O.initialLiveManifestSize;if(W<$)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+$+")"),null;!y.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(K=this.getInitialLiveFragment(y,j),this.startPosition=K?this.hls.liveSyncPosition||K.start:m)}else m<=_&&(K=j[0]);if(!K){var q=O.lowLatencyMode?y.partEnd:y.fragmentEnd;K=this.getFragmentAtPosition(m,q,y)}return(M=K)!==null&&M!==void 0&&M.initSegment&&!((F=K)!==null&&F!==void 0&&F.initSegment.data)&&!this.bitrateTest&&(K=K.initSegment),K},a.getNextPart=function(m,y,M){for(var F=-1,j=!1,W=!0,O=0,_=m.length;O<_;O++){var K=m[O];if(W=W&&!K.independent,F>-1&&M<K.start)break;var $=K.loaded;!$&&(j||K.independent||W)&&K.fragment===y&&(F=O),j=$}return F},a.loadedEndOfParts=function(m,y){var M=m[m.length-1];return M&&y>M.start&&M.loaded},a.getInitialLiveFragment=function(m,y){var M=this.fragPrevious,F=null;if(M){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+M.programDateTime),F=Object(C.findFragmentByPDT)(y,M.endProgramDateTime,this.config.maxFragLookUpTolerance)),!F){var j=M.sn+1;if(j>=m.startSN&&j<=m.endSN){var W=y[j-m.startSN];M.cc===W.cc&&(F=W,this.log("Live playlist, switching playlist, load frag with next SN: "+F.sn))}F||(F=Object(C.findFragWithCC)(y,M.cc),F&&this.log("Live playlist, switching playlist, load frag with same CC: "+F.sn))}}else{var O=this.hls.liveSyncPosition;O!==null&&(F=this.getFragmentAtPosition(O,this.bitrateTest?m.fragmentEnd:m.edge,m))}return F},a.getFragmentAtPosition=function(m,y,M){var F=this.config,j=this.fragPrevious,W=M.fragments,O=M.endSN,_=M.fragmentHint,K=F.maxFragLookUpTolerance,$=!!(F.lowLatencyMode&&M.partList&&_);$&&_&&!this.bitrateTest&&(W=W.concat(_),O=_.sn);var q;if(m<y){var ne=m>y-K?0:K;q=Object(C.findFragmentByPTS)(j,W,m,ne)}else q=W[W.length-1];if(q){var Te=q.sn-M.startSN,ve=j&&q.level===j.level,ge=W[Te+1],ce=this.fragmentTracker.getState(q);if(ce===P.FragmentState.BACKTRACKED){q=null;for(var he=Te;W[he]&&this.fragmentTracker.getState(W[he])===P.FragmentState.BACKTRACKED;)j?q=W[he--]:q=W[--he];q||(q=ge)}else j&&q.sn===j.sn&&!$&&(ve&&(q.sn<O&&this.fragmentTracker.getState(ge)!==P.FragmentState.OK?(this.log("SN "+q.sn+" just loaded, load next one: "+ge.sn),q=ge):q=null))}return q},a.synchronizeToLiveEdge=function(m){var y=this.config,M=this.media;if(!M)return;var F=this.hls.liveSyncPosition,j=M.currentTime,W=m.fragments[0].start,O=m.edge,_=j>=W-y.maxFragLookUpTolerance&&j<=O;if(F!==null&&M.duration>F&&(j<F||!_)){var K=y.liveMaxLatencyDuration!==void 0?y.liveMaxLatencyDuration:y.liveMaxLatencyDurationCount*m.targetduration;(!_&&M.readyState<4||j<O-K)&&(this.loadedmetadata||(this.nextLoadPosition=F),M.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+O+", reset currentTime to : "+F.toFixed(3)),M.currentTime=F))}},a.alignPlaylists=function(m,y){var M=this.levels,F=this.levelLastLoaded,j=this.fragPrevious,W=F!==null?M[F]:null,O=m.fragments.length;if(!O)return this.warn("No fragments in live playlist"),0;var _=m.fragments[0].start,K=!y,$=m.alignedSliding&&Object(G.isFiniteNumber)(_);if(K||!$&&!_){Object(R.alignStream)(j,W,m);var q=m.fragments[0].start;return this.log("Live playlist sliding: "+q.toFixed(2)+" start-sn: "+(y?y.startSN:"na")+"->"+m.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+O),q}return _},a.waitForCdnTuneIn=function(m){var y=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*y)},a.setStartPosition=function(m,y){var M=this.startPosition;if(M<y&&(M=-1),M===-1||this.lastCurrentTime===-1){var F=m.startTimeOffset;Object(G.isFiniteNumber)(F)?(M=y+F,F<0&&(M+=m.totalduration),M=Math.min(Math.max(y,M),y+m.totalduration),this.log("Start time offset "+F+" found in playlist, adjust startPosition to "+M),this.startPosition=M):m.live?M=this.hls.liveSyncPosition||y:this.startPosition=M=0,this.lastCurrentTime=M}this.nextLoadPosition=M},a.getLoadPosition=function(){var m=this.media,y=0;return this.loadedmetadata&&m?y=m.currentTime:this.nextLoadPosition&&(y=this.nextLoadPosition),y},a.handleFragLoadAborted=function(m,y){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(y?" part"+y.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},a.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=b.IDLE)},a.onFragmentOrKeyLoadError=function(m,y){if(y.fatal)return;var M=y.frag;if(!M||M.type!==m)return;var F=this.fragCurrent;console.assert(F&&M.sn===F.sn&&M.level===F.level&&M.urlId===F.urlId,"Frag load error must match current frag to retry");var j=this.config;if(this.fragLoadError+1<=j.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(M.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+M.sn+" of "+m+" "+M.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=b.FRAG_LOADING_WAITING_RETRY}else y.levelRetry?(m===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=b.IDLE):(N.logger.error(y.details+" reaches max retry, redispatch as fatal ..."),y.fatal=!0,this.hls.stopLoad(),this.state=b.ERROR)},a.afterBufferFlushed=function(m,y,M){if(!m)return;var F=B.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(y,F,M),this.state===b.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=b.IDLE},a.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var y=this.levels?this.levels[m].details:null;if(y!=null&&y.live)return this.startPosition=-1,this.setStartPosition(y,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(m,y,M,F){var j=this,W=M.details;console.assert(!!W,"level.details must be defined");var O=Object.keys(m.elementaryStreams).reduce(function(_,K){var $=m.elementaryStreams[K];if($){var q=$.endPTS-$.startPTS;if(q<=0)return j.warn("Could not parse fragment "+m.sn+" "+K+" duration reliably ("+q+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),_||!1;var ne=F?0:Object(T.updateFragPTSDTS)(W,m,$.startPTS,$.endPTS,$.startDTS,$.endDTS);return j.hls.trigger(k.Events.LEVEL_PTS_UPDATED,{details:W,level:M,drift:ne,type:K,frag:m,start:$.startPTS,end:$.endPTS}),!0}return _},!1);O?(this.state=b.PARSED,this.hls.trigger(k.Events.FRAG_PARSED,{frag:m,part:y})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},S(l,[{key:"state",get:function(){return this._state},set:function(m){var y=this._state;y!==m&&(this._state=m,this.log(y+"->"+m))}}]),l}(I.default)},"./src/controller/buffer-controller.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"default",function(){return C});var G=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),P=L("./src/utils/logger.ts"),B=L("./src/errors.ts"),N=L("./src/utils/buffer-helper.ts"),k=L("./src/utils/mediasource-helper.ts"),D=L("./src/loader/fragment.ts"),v=L("./src/controller/buffer-operation-queue.ts"),w=Object(k.getMediaSource)(),R=/([ha]vc.)(?:\.[^.,]+)+/,C=function(){function T(u){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 s=o.hls,d=o.media,S=o.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),d&&(o.updateMediaElementDuration(),s.trigger(I.Events.MEDIA_ATTACHED,{media:d})),S&&S.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=u,this._initSourceBuffer(),this.registerListeners()}var E=T.prototype;return E.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},E.destroy=function(){this.unregisterListeners(),this.details=null},E.registerListeners=function(){var o=this.hls;o.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(I.Events.BUFFER_RESET,this.onBufferReset,this),o.on(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(I.Events.BUFFER_EOS,this.onBufferEos,this),o.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(I.Events.FRAG_PARSED,this.onFragParsed,this),o.on(I.Events.FRAG_CHANGED,this.onFragChanged,this)},E.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(I.Events.BUFFER_RESET,this.onBufferReset,this),o.off(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(I.Events.BUFFER_EOS,this.onBufferEos,this),o.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(I.Events.FRAG_PARSED,this.onFragParsed,this),o.off(I.Events.FRAG_CHANGED,this.onFragChanged,this)},E._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new v.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},E.onManifestParsed=function(o,s){var d=2;(s.audio&&!s.video||!s.altAudio)&&(d=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=d,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},E.onMediaAttaching=function(o,s){var d=this.media=s.media;if(d&&w){var S=this.mediaSource=new w;S.addEventListener("sourceopen",this._onMediaSourceOpen),S.addEventListener("sourceended",this._onMediaSourceEnded),S.addEventListener("sourceclose",this._onMediaSourceClose),d.src=self.URL.createObjectURL(S),this._objectUrl=d.src}},E.onMediaDetaching=function(){var o=this.media,s=this.mediaSource,d=this._objectUrl;if(s){if(P.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(S){P.logger.warn("[buffer-controller]: onMediaDetaching: "+S.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(d&&self.URL.revokeObjectURL(d),o.src===d?(o.removeAttribute("src"),o.load()):P.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(I.Events.MEDIA_DETACHED,void 0)},E.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(s){var d=o.sourceBuffer[s];try{d&&(o.removeBufferListeners(s),o.mediaSource&&o.mediaSource.removeSourceBuffer(d),o.sourceBuffer[s]=void 0)}catch(S){P.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",S)}}),this._initSourceBuffer()},E.onBufferCodecs=function(o,s){var d=this,S=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(p){if(S){var h=d.tracks[p];if(h&&typeof h.buffer.changeType=="function"){var A=s[p],b=A.codec,f=A.levelCodec,c=A.container,l=(h.levelCodec||h.codec).replace(R,"$1"),a=(f||b).replace(R,"$1");if(l!==a){var g=c+";codecs="+(f||b);d.appendChangeType(p,g)}}}else d.pendingTracks[p]=s[p]}),S)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},E.appendChangeType=function(o,s){var d=this,S=this.operationQueue,p={execute:function(){var A=d.sourceBuffer[o];A&&(P.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+s),A.changeType(s)),S.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(A){P.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",A)}};S.append(p,o)},E.onBufferAppending=function(o,s){var d=this,S=this.hls,p=this.operationQueue,h=this.tracks,A=s.data,b=s.type,f=s.frag,c=s.part,l=s.chunkMeta,a=l.buffering[b],g=self.performance.now();a.start=g;var m=f.stats.buffering,y=c?c.stats.buffering:null;m.start===0&&(m.start=g),y&&y.start===0&&(y.start=g);var M=h.audio,F=b==="audio"&&l.id===1&&(M==null?void 0:M.container)==="audio/mpeg",j={execute:function(){if(a.executeStart=self.performance.now(),F){var O=d.sourceBuffer[b];if(O){var _=f.start-O.timestampOffset;Math.abs(_)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+f.start+" (delta: "+_+") sn: "+f.sn+")"),O.timestampOffset=f.start)}}d.appendExecutor(A,b)},onStart:function(){},onComplete:function(){var O=self.performance.now();a.executeEnd=a.end=O,m.first===0&&(m.first=O),y&&y.first===0&&(y.first=O);var _=d.sourceBuffer,K={};for(var $ in _)K[$]=N.BufferHelper.getBuffered(_[$]);d.appendError=0,d.hls.trigger(I.Events.BUFFER_APPENDED,{type:b,frag:f,part:c,chunkMeta:l,parent:f.type,timeRanges:K})},onError:function(O){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",O);var _={type:B.ErrorTypes.MEDIA_ERROR,parent:f.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:O,fatal:!1};O.code===DOMException.QUOTA_EXCEEDED_ERR?_.details=B.ErrorDetails.BUFFER_FULL_ERROR:(d.appendError++,_.details=B.ErrorDetails.BUFFER_APPEND_ERROR,d.appendError>S.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+S.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),_.fatal=!0)),S.trigger(I.Events.ERROR,_)}};p.append(j,b)},E.onBufferFlushing=function(o,s){var d=this,S=this.operationQueue,p=function(A){return{execute:d.removeExecutor.bind(d,A,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){d.hls.trigger(I.Events.BUFFER_FLUSHED,{type:A})},onError:function(f){P.logger.warn("[buffer-controller]: Failed to remove from "+A+" SourceBuffer",f)}}};s.type?S.append(p(s.type),s.type):this.getSourceBufferTypes().forEach(function(h){S.append(p(h),h)})},E.onFragParsed=function(o,s){var d=this,S=s.frag,p=s.part,h=[],A=p?p.elementaryStreams:S.elementaryStreams;A[D.ElementaryStreamTypes.AUDIOVIDEO]?h.push("audiovideo"):(A[D.ElementaryStreamTypes.AUDIO]&&h.push("audio"),A[D.ElementaryStreamTypes.VIDEO]&&h.push("video"));var b=function(){var c=self.performance.now();S.stats.buffering.end=c,p&&(p.stats.buffering.end=c);var l=p?p.stats:S.stats;d.hls.trigger(I.Events.FRAG_BUFFERED,{frag:S,part:p,stats:l,id:S.type})};h.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+S.type+" level: "+S.level+" sn: "+S.sn),this.blockBuffers(b,h)},E.onFragChanged=function(o,s){this.flushBackBuffer()},E.onBufferEos=function(o,s){var d=this,S=this.getSourceBufferTypes().reduce(function(p,h){var A=d.sourceBuffer[h];return(!s.type||s.type===h)&&(A&&!A.ended&&(A.ended=!0,P.logger.log("[buffer-controller]: "+h+" sourceBuffer now EOS"))),p&&!!(!A||A.ended)},!0);S&&this.blockBuffers(function(){var p=d.mediaSource;if(!p||p.readyState!=="open")return;p.endOfStream()})},E.onLevelUpdated=function(o,s){var d=s.details;if(!d.fragments.length)return;this.details=d,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},E.flushBackBuffer=function(){var o=this.hls,s=this.details,d=this.media,S=this.sourceBuffer;if(!d||s===null)return;var p=this.getSourceBufferTypes();if(!p.length)return;var h=s.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(G.isFiniteNumber)(h)||h<0)return;var A=d.currentTime,b=s.levelTargetDuration,f=Math.max(h,b),c=Math.floor(A/b)*b-f;p.forEach(function(l){var a=S[l];if(a){var g=N.BufferHelper.getBuffered(a);g.length>0&&c>g.start(0)&&(o.trigger(I.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),s.live&&o.trigger(I.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(I.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:l}))}})},E.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,s=this.hls,d=this.media,S=this.mediaSource,p=o.fragments[0].start+o.totalduration,h=d.duration,A=Object(G.isFiniteNumber)(S.duration)?S.duration:0;o.live&&s.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),S.duration=Infinity,this.updateSeekableRange(o)):(p>A&&p>h||!Object(G.isFiniteNumber)(h))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+p.toFixed(3)),S.duration=p)},E.updateSeekableRange=function(o){var s=this.mediaSource,d=o.fragments,S=d.length;if(S&&o.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var p=Math.max(0,d[0].start),h=Math.max(p,p+o.totalduration);s.setLiveSeekableRange(p,h)}},E.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,s=this.operationQueue,d=this.pendingTracks,S=Object.keys(d).length;if(S&&!o||S===2){this.createSourceBuffers(d),this.pendingTracks={};var p=this.getSourceBufferTypes();if(p.length===0){this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}p.forEach(function(h){s.executeNext(h)})}},E.createSourceBuffers=function(o){var s=this.sourceBuffer,d=this.mediaSource;if(!d)throw Error("createSourceBuffers called when mediaSource was null");var S=0;for(var p in o)if(!s[p]){var h=o[p];if(!h)throw Error("source buffer exists for track "+p+", however track does not");var A=h.levelCodec||h.codec,b=h.container+";codecs="+A;P.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var f=s[p]=d.addSourceBuffer(b),c=p;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[p]={buffer:f,codec:A,container:h.container,levelCodec:h.levelCodec,id:h.id},S++}catch(l){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+l.message),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:l,mimeType:b})}}S&&this.hls.trigger(I.Events.BUFFER_CREATED,{tracks:this.tracks})},E._onSBUpdateStart=function(o){var s=this.operationQueue,d=s.current(o);d.onStart()},E._onSBUpdateEnd=function(o){var s=this.operationQueue,d=s.current(o);d.onComplete(),s.shiftAndExecuteNext(o)},E._onSBUpdateError=function(o,s){P.logger.error("[buffer-controller]: "+o+" SourceBuffer error",s),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var d=this.operationQueue.current(o);d&&d.onError(s)},E.removeExecutor=function(o,s,d){var S=this.media,p=this.mediaSource,h=this.operationQueue,A=this.sourceBuffer,b=A[o];if(!S||!p||!b){P.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(o);return}var f=Object(G.isFiniteNumber)(S.duration)?S.duration:Infinity,c=Object(G.isFiniteNumber)(p.duration)?p.duration:Infinity,l=Math.max(0,s),a=Math.min(d,f,c);a>l?(P.logger.log("[buffer-controller]: Removing ["+l+","+a+"] from the "+o+" SourceBuffer"),console.assert(!b.updating,o+" sourceBuffer must not be updating"),b.remove(l,a)):h.shiftAndExecuteNext(o)},E.appendExecutor=function(o,s){var d=this.operationQueue,S=this.sourceBuffer,p=S[s];if(!p){P.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),d.shiftAndExecuteNext(s);return}p.ended=!1,console.assert(!p.updating,s+" sourceBuffer must not be updating"),p.appendBuffer(o)},E.blockBuffers=function(o,s){var d=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var S=this.operationQueue,p=s.map(function(h){return S.appendBlocker(h)});Promise.all(p).then(function(){o(),s.forEach(function(h){var A=d.sourceBuffer[h];(!A||!A.updating)&&S.shiftAndExecuteNext(h)})})},E.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},E.addBufferListener=function(o,s,d){var S=this.sourceBuffer[o];if(!S)return;var p=d.bind(this,o);this.listeners[o].push({event:s,listener:p}),S.addEventListener(s,p)},E.removeBufferListeners=function(o){var s=this.sourceBuffer[o];if(!s)return;this.listeners[o].forEach(function(d){s.removeEventListener(d.event,d.listener)})},T}()},"./src/controller/buffer-operation-queue.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"default",function(){return I});var G=L("./src/utils/logger.ts"),I=function(){function P(N){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=N}var B=P.prototype;return B.append=function(k,D){var v=this.queues[D];v.push(k),v.length===1&&this.buffers[D]&&this.executeNext(D)},B.insertAbort=function(k,D){var v=this.queues[D];v.unshift(k),this.executeNext(D)},B.appendBlocker=function(k){var D,v=new Promise(function(R){D=R}),w={execute:D,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(w,k),v},B.executeNext=function(k){var D=this.buffers,v=this.queues,w=D[k],R=v[k];if(R.length){var C=R[0];try{C.execute()}catch(T){G.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),C.onError(T),(!w||!w.updating)&&(R.shift(),this.executeNext(k))}}},B.shiftAndExecuteNext=function(k){this.queues[k].shift(),this.executeNext(k)},B.current=function(k){return this.queues[k][0]},P}()},"./src/controller/cap-level-controller.ts":function(ee,z,L){"use strict";L.r(z);var G=L("./src/events.ts");function I(N,k){for(var D=0;D<k.length;D++){var v=k[D];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(N,v.key,v)}}function P(N,k,D){return k&&I(N.prototype,k),D&&I(N,D),N}var B=function(){function N(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 k=N.prototype;return k.setStreamController=function(v){this.streamController=v},k.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},k.registerListeners=function(){var v=this.hls;v.on(G.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),v.on(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),v.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.on(G.Events.BUFFER_CODECS,this.onBufferCodecs,this),v.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.unregisterListener=function(){var v=this.hls;v.off(G.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),v.off(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),v.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.off(G.Events.BUFFER_CODECS,this.onBufferCodecs,this),v.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.onFpsDropLevelCapping=function(v,w){N.isLevelAllowed(w.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(w.droppedLevel)},k.onMediaAttaching=function(v,w){this.media=w.media instanceof HTMLVideoElement?w.media:null},k.onManifestParsed=function(v,w){var R=this.hls;this.restrictedLevels=[],this.firstLevel=w.firstLevel,R.config.capLevelToPlayerSize&&w.video&&this.startCapping()},k.onBufferCodecs=function(v,w){var R=this.hls;R.config.capLevelToPlayerSize&&w.video&&this.startCapping()},k.onMediaDetaching=function(){this.stopCapping()},k.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var v=this.hls.levels;if(v.length){var w=this.hls;w.autoLevelCapping=this.getMaxLevel(v.length-1),w.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=w.autoLevelCapping}}},k.getMaxLevel=function(v){var w=this,R=this.hls.levels;if(!R.length)return-1;var C=R.filter(function(T,E){return N.isLevelAllowed(E,w.restrictedLevels)&&E<=v});return this.clientRect=null,N.getMaxLevelByMediaSize(C,this.mediaWidth,this.mediaHeight)},k.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()},k.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},k.getDimensions=function(){if(this.clientRect)return this.clientRect;var v=this.media,w={width:0,height:0};if(v){var R=v.getBoundingClientRect();w.width=R.width,w.height=R.height,!w.width&&!w.height&&(w.width=R.right-R.left||v.width||0,w.height=R.bottom-R.top||v.height||0)}return this.clientRect=w,w},N.isLevelAllowed=function(v,w){return w===void 0&&(w=[]),w.indexOf(v)===-1},N.getMaxLevelByMediaSize=function(v,w,R){if(!v||!v.length)return-1;for(var C=function(s,d){return d?s.width!==d.width||s.height!==d.height:!0},T=v.length-1,E=0;E<v.length;E+=1){var u=v[E];if((u.width>=w||u.height>=R)&&C(u,v[E+1])){T=E;break}}return T},P(N,[{key:"mediaWidth",get:function(){return this.getDimensions().width*N.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*N.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var v=1;try{v=self.devicePixelRatio}catch(w){}return v}}]),N}();z.default=B},"./src/controller/cmcd-controller.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"default",function(){return C});var G=L("./src/events.ts"),I=L("./src/types/cmcd.ts"),P=L("./src/utils/buffer-helper.ts"),B=L("./src/utils/logger.ts");function N(T,E){for(var u=0;u<E.length;u++){var o=E[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(T,o.key,o)}}function k(T,E,u){return E&&N(T.prototype,E),u&&N(T,u),T}function D(T,E){var u=typeof Symbol!="undefined"&&T[Symbol.iterator]||T["@@iterator"];if(u)return(u=u.call(T)).next.bind(u);if(Array.isArray(T)||(u=v(T))||E&&T&&typeof T.length=="number"){u&&(T=u);var o=0;return function(){return o>=T.length?{done:!0}:{done:!1,value:T[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 v(T,E){if(!T)return;if(typeof T=="string")return w(T,E);var u=Object.prototype.toString.call(T).slice(8,-1);if(u==="Object"&&T.constructor&&(u=T.constructor.name),u==="Map"||u==="Set")return Array.from(T);if(u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return w(T,E)}function w(T,E){(E==null||E>T.length)&&(E=T.length);for(var u=0,o=new Array(E);u<E;u++)o[u]=T[u];return o}function R(){return R=Object.assign||function(T){for(var E=1;E<arguments.length;E++){var u=arguments[E];for(var o in u)Object.prototype.hasOwnProperty.call(u,o)&&(T[o]=u[o])}return T},R.apply(this,arguments)}var C=function(){function T(u){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(S){try{o.apply(S,{ot:I.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(p){B.logger.warn("Could not generate manifest CMCD data.",p)}},this.applyFragmentData=function(S){try{var p=S.frag,h=o.hls.levels[p.level],A=o.getObjectType(p),b={d:p.duration*1e3,ot:A};(A===I.CMCDObjectType.VIDEO||A===I.CMCDObjectType.AUDIO||A==I.CMCDObjectType.MUXED)&&(b.br=h.bitrate/1e3,b.tb=o.getTopBandwidth(A),b.bl=o.getBufferLength(A)),o.apply(S,b)}catch(f){B.logger.warn("Could not generate segment CMCD data.",f)}},this.hls=u;var s=this.config=u.config,d=s.cmcd;d!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=d.sessionId||T.uuid(),this.cid=d.contentId,this.useHeaders=d.useHeaders===!0,this.registerListeners())}var E=T.prototype;return E.registerListeners=function(){var o=this.hls;o.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(G.Events.BUFFER_CREATED,this.onBufferCreated,this)},E.unregisterListeners=function(){var o=this.hls;o.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(G.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},E.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},E.onMediaAttached=function(o,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},E.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},E.onBufferCreated=function(o,s){var d,S;this.audioBuffer=(d=s.tracks.audio)===null||d===void 0?void 0:d.buffer,this.videoBuffer=(S=s.tracks.video)===null||S===void 0?void 0:S.buffer},E.createData=function(){var o;return{v:I.CMCDVersion,sf:I.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},E.apply=function(o,s){s===void 0&&(s={}),R(s,this.createData());var d=s.ot===I.CMCDObjectType.INIT||s.ot===I.CMCDObjectType.VIDEO||s.ot===I.CMCDObjectType.MUXED;if(this.starved&&d&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var S=T.toHeaders(s);if(!Object.keys(S).length)return;o.headers||(o.headers={}),R(o.headers,S)}else{var p=T.toQuery(s);if(!p)return;o.url=T.appendQueryToUri(o.url,p)}},E.getObjectType=function(o){var s=o.type;return s==="subtitle"?I.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?I.CMCDObjectType.INIT:s==="audio"?I.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?I.CMCDObjectType.VIDEO:I.CMCDObjectType.MUXED:void 0},E.getTopBandwidth=function(o){for(var s=0,d=o===I.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,S=D(d),p;!(p=S()).done;){var h=p.value;h.bitrate>s&&(s=h.bitrate)}return s>0?s:NaN},E.getBufferLength=function(o){var s=this.hls.media,d=o===I.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!d||!s)return NaN;var S=P.BufferHelper.bufferInfo(d,s.currentTime,this.config.maxBufferHole);return S.len*1e3},E.createPlaylistLoader=function(){var o=this.config.pLoader,s=this.applyPlaylistData,d=o||this.config.loader;return function(){function S(h){this.loader=void 0,this.loader=new d(h)}var p=S.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(A,b,f){s(A),this.loader.load(A,b,f)},k(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},E.createFragmentLoader=function(){var o=this.config.fLoader,s=this.applyFragmentData,d=o||this.config.loader;return function(){function S(h){this.loader=void 0,this.loader=new d(h)}var p=S.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(A,b,f){s(A),this.loader.load(A,b,f)},k(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},T.uuid=function(){var o=URL.createObjectURL(new Blob),s=o.toString();return URL.revokeObjectURL(o),s.substr(s.lastIndexOf("/")+1)},T.serialize=function(o){for(var s=[],d=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},S=function(F){return Math.round(F)},p=function(F){return S(F/100)*100},h=function(F){return encodeURIComponent(F)},A={br:S,d:S,bl:p,dl:p,mtp:p,nor:h,rtp:p,tb:S},b=Object.keys(o||{}).sort(),f=D(b),c;!(c=f()).done;){var l=c.value,a=o[l];if(!d(a))continue;if(l==="v"&&a===1)continue;if(l=="pr"&&a===1)continue;var g=A[l];g&&(a=g(a));var m=typeof a,y=void 0;l==="ot"||l==="sf"||l==="st"?y=l+"="+a:m==="boolean"?y=l:m==="number"?y=l+"="+a:y=l+"="+JSON.stringify(a),s.push(y)}return s.join(",")},T.toHeaders=function(o){for(var s=Object.keys(o),d={},S=["Object","Request","Session","Status"],p=[{},{},{},{}],h={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},A=0,b=s;A<b.length;A++){var f=b[A],c=h[f]!=null?h[f]:1;p[c][f]=o[f]}for(var l=0;l<p.length;l++){var a=T.serialize(p[l]);a&&(d["CMCD-"+S[l]]=a)}return d},T.toQuery=function(o){return"CMCD="+encodeURIComponent(T.serialize(o))},T.appendQueryToUri=function(o,s){if(!s)return o;var d=o.includes("?")?"&":"?";return""+o+d+s},T}()},"./src/controller/eme-controller.ts":function(ee,z,L){"use strict";L.r(z);var G=L("./src/events.ts"),I=L("./src/errors.ts"),P=L("./src/utils/logger.ts"),B=L("./src/utils/mediakeys-helper.ts");function N(C,T){for(var E=0;E<T.length;E++){var u=T[E];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(C,u.key,u)}}function k(C,T,E){return T&&N(C.prototype,T),E&&N(C,E),C}var D=3,v=function(T,E,u){var o={audioCapabilities:[],videoCapabilities:[]};return T.forEach(function(s){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:u.audioRobustness||""})}),E.forEach(function(s){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:u.videoRobustness||""})}),[o]},w=function(T,E,u,o){switch(T){case B.KeySystems.WIDEVINE:return v(E,u,o);default:throw new Error("Unknown key-system: "+T)}},R=function(){function C(E){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=E,this._config=E.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var T=C.prototype;return T.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},T._registerListeners=function(){this.hls.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this)},T._unregisterListeners=function(){this.hls.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this)},T.getLicenseServerUrl=function(u){switch(u){case B.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+u+'"')},T._attemptKeySystemAccess=function(u,o,s){var d=this,S=w(u,o,s,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var p=this.requestMediaKeySystemAccess(u,S);this.mediaKeysPromise=p.then(function(h){return d._onMediaKeySystemAccessObtained(u,h)}),p.catch(function(h){P.logger.error('Failed to obtain key-system "'+u+'" access:',h)})},T._onMediaKeySystemAccessObtained=function(u,o){var s=this;P.logger.log('Access for key-system "'+u+'" obtained');var d={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:u};this._mediaKeysList.push(d);var S=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(p){return d.mediaKeys=p,P.logger.log('Media-keys created for key-system "'+u+'"'),s._onMediaKeysCreated(),p});return S.catch(function(p){P.logger.error("Failed to create media-keys:",p)}),S},T._onMediaKeysCreated=function(){var u=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),u._onNewMediaKeySession(o.mediaKeysSession))})},T._onNewMediaKeySession=function(u){var o=this;P.logger.log("New key-system session "+u.sessionId),u.addEventListener("message",function(s){o._onKeySessionMessage(u,s.message)},!1)},T._onKeySessionMessage=function(u,o){P.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(s){P.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),u.update(s)})},T.onMediaEncrypted=function(u){var o=this;if(P.logger.log('Media is encrypted using "'+u.initDataType+'" init data type'),!this.mediaKeysPromise){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(S){if(!o._media)return;o._attemptSetMediaKeys(S),o._generateRequestWithPreferredKeySession(u.initDataType,u.initData)};this.mediaKeysPromise.then(s).catch(s)},T._attemptSetMediaKeys=function(u){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){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}P.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},T._generateRequestWithPreferredKeySession=function(u,o){var s=this,d=this._mediaKeysList[0];if(!d){P.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(d.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var S=d.mediaKeysSession;if(!S){P.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){P.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}P.logger.log('Generating key-session request for "'+u+'" init data type'),d.mediaKeysSessionInitialized=!0,S.generateRequest(u,o).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(p){P.logger.error("Error generating key-session request:",p),s.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},T._createLicenseXhr=function(u,o,s){var d=new XMLHttpRequest;d.responseType="arraybuffer",d.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,d,u,o,s);var S=this._licenseXhrSetup;if(S)try{S.call(this.hls,d,u),S=void 0}catch(p){P.logger.error(p)}try{d.readyState||d.open("POST",u,!0),S&&S.call(this.hls,d,u)}catch(p){throw new Error("issue setting up KeySystem license XHR "+p)}return d},T._onLicenseRequestReadyStageChange=function(u,o,s,d){switch(u.readyState){case 4:if(u.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var S=u.response,p=this._licenseResponseCallback;if(p)try{S=p.call(this.hls,u,o)}catch(A){P.logger.error(A)}d(S)}else{if(P.logger.error("License Request XHR failed ("+o+"). Status: "+u.status+" ("+u.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>D){this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var h=D-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+h+" attempts left"),this._requestLicense(s,d)}break}},T._generateLicenseRequestChallenge=function(u,o){switch(u.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+u.mediaKeySystemDomain)},T._requestLicense=function(u,o){P.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var d=this.getLicenseServerUrl(s.mediaKeySystemDomain),S=this._createLicenseXhr(d,u,o);P.logger.log("Sending license request to URL: "+d);var p=this._generateLicenseRequestChallenge(s,u);S.send(p)}catch(h){P.logger.error("Failure requesting DRM license: "+h),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},T.onMediaAttached=function(u,o){if(!this._emeEnabled)return;var s=o.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},T.onMediaDetached=function(){var u=this._media,o=this._mediaKeysList;if(!u)return;u.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return u.setMediaKeys(null)}).catch(function(){})},T.onManifestParsed=function(u,o){if(!this._emeEnabled)return;var s=o.levels.map(function(S){return S.audioCodec}).filter(function(S){return!!S}),d=o.levels.map(function(S){return S.videoCodec}).filter(function(S){return!!S});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,s,d)},k(C,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),C}();z.default=R},"./src/controller/fps-controller.ts":function(ee,z,L){"use strict";L.r(z);var G=L("./src/events.ts"),I=L("./src/utils/logger.ts"),P=function(){function B(k){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=k,this.registerListeners()}var N=B.prototype;return N.setStreamController=function(D){this.streamController=D},N.registerListeners=function(){this.hls.on(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},N.unregisterListeners=function(){this.hls.off(G.Events.MEDIA_ATTACHING,this.onMediaAttaching)},N.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},N.onMediaAttaching=function(D,v){var w=this.hls.config;if(w.capLevelOnFPSDrop){var R=v.media instanceof self.HTMLVideoElement?v.media:null;this.media=R,R&&typeof R.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),w.fpsDroppedMonitoringPeriod)}},N.checkFPS=function(D,v,w){var R=performance.now();if(v){if(this.lastTime){var C=R-this.lastTime,T=w-this.lastDroppedFrames,E=v-this.lastDecodedFrames,u=1e3*T/C,o=this.hls;if(o.trigger(G.Events.FPS_DROP,{currentDropped:T,currentDecoded:E,totalDroppedFrames:w}),u>0&&T>o.config.fpsDroppedMonitoringThreshold*E){var s=o.currentLevel;I.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=s)&&(s=s-1,o.trigger(G.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:o.currentLevel}),o.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=R,this.lastDroppedFrames=w,this.lastDecodedFrames=v}},N.checkFPSInterval=function(){var D=this.media;if(D)if(this.isVideoPlaybackQualityAvailable){var v=D.getVideoPlaybackQuality();this.checkFPS(D,v.totalVideoFrames,v.droppedVideoFrames)}else this.checkFPS(D,D.webkitDecodedFrameCount,D.webkitDroppedFrameCount)},B}();z.default=P},"./src/controller/fragment-finders.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"findFragmentByPDT",function(){return P}),L.d(z,"findFragmentByPTS",function(){return B}),L.d(z,"fragmentWithinToleranceTest",function(){return N}),L.d(z,"pdtWithinToleranceTest",function(){return k}),L.d(z,"findFragWithCC",function(){return D});var G=L("./src/polyfills/number.ts"),I=L("./src/utils/binary-search.ts");function P(v,w,R){if(w===null||!Array.isArray(v)||!v.length||!Object(G.isFiniteNumber)(w))return null;var C=v[0].programDateTime;if(w<(C||0))return null;var T=v[v.length-1].endProgramDateTime;if(w>=(T||0))return null;R=R||0;for(var E=0;E<v.length;++E){var u=v[E];if(k(w,R,u))return u}return null}function B(v,w,R,C){R===void 0&&(R=0),C===void 0&&(C=0);var T=null;if(v?T=w[v.sn-w[0].sn+1]||null:R===0&&w[0].start===0&&(T=w[0]),T&&N(R,C,T)===0)return T;var E=I.default.search(w,N.bind(null,R,C));return E||T}function N(v,w,R){v===void 0&&(v=0),w===void 0&&(w=0);var C=Math.min(w,R.duration+(R.deltaPTS?R.deltaPTS:0));return R.start+R.duration-C<=v?1:R.start-C>v&&R.start?-1:0}function k(v,w,R){var C=Math.min(w,R.duration+(R.deltaPTS?R.deltaPTS:0))*1e3,T=R.endProgramDateTime||0;return T-C>v}function D(v,w){return I.default.search(v,function(R){return R.cc<w?1:R.cc>w?-1:0})}},"./src/controller/fragment-tracker.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"FragmentState",function(){return P}),L.d(z,"FragmentTracker",function(){return B});var G=L("./src/events.ts"),I=L("./src/types/loader.ts"),P;(function(D){D.NOT_LOADED="NOT_LOADED",D.BACKTRACKED="BACKTRACKED",D.APPENDING="APPENDING",D.PARTIAL="PARTIAL",D.OK="OK"})(P||(P={}));var B=function(){function D(w){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=w,this._registerListeners()}var v=D.prototype;return v._registerListeners=function(){var R=this.hls;R.on(G.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.on(G.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.on(G.Events.FRAG_LOADED,this.onFragLoaded,this)},v._unregisterListeners=function(){var R=this.hls;R.off(G.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.off(G.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.off(G.Events.FRAG_LOADED,this.onFragLoaded,this)},v.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},v.getAppendedFrag=function(R,C){if(C===I.PlaylistLevelType.MAIN){var T=this.activeFragment,E=this.activeParts;if(!T)return null;if(E)for(var u=E.length;u--;){var o=E[u],s=o?o.end:T.appendedPTS;if(o.start<=R&&s!==void 0&&R<=s)return u>9&&(this.activeParts=E.slice(u-9)),o}else if(T.start<=R&&T.appendedPTS!==void 0&&R<=T.appendedPTS)return T}return this.getBufferedFrag(R,C)},v.getBufferedFrag=function(R,C){for(var T=this.fragments,E=Object.keys(T),u=E.length;u--;){var o=T[E[u]];if((o==null?void 0:o.body.type)===C&&o.buffered){var s=o.body;if(s.start<=R&&R<=s.end)return s}}return null},v.detectEvictedFragments=function(R,C,T){var E=this;Object.keys(this.fragments).forEach(function(u){var o=E.fragments[u];if(!o)return;if(!o.buffered){o.body.type===T&&E.removeFragment(o.body);return}var s=o.range[R];if(!s)return;s.time.some(function(d){var S=!E.isTimeBuffered(d.startPTS,d.endPTS,C);return S&&E.removeFragment(o.body),S})})},v.detectPartialFragments=function(R){var C=this,T=this.timeRanges,E=R.frag,u=R.part;if(!T||E.sn==="initSegment")return;var o=k(E),s=this.fragments[o];if(!s)return;Object.keys(T).forEach(function(d){var S=E.elementaryStreams[d];if(!S)return;var p=T[d],h=u!==null||S.partial===!0;s.range[d]=C.getBufferedTimes(E,u,h,p)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},v.fragBuffered=function(R){var C=k(R),T=this.fragments[C];T&&(T.backtrack=T.loaded=null,T.buffered=!0)},v.getBufferedTimes=function(R,C,T,E){for(var u={time:[],partial:T},o=C?C.start:R.start,s=C?C.end:R.end,d=R.minEndPTS||s,S=R.maxStartPTS||o,p=0;p<E.length;p++){var h=E.start(p)-this.bufferPadding,A=E.end(p)+this.bufferPadding;if(S>=h&&d<=A){u.time.push({startPTS:Math.max(o,E.start(p)),endPTS:Math.min(s,E.end(p))});break}else if(o<A&&s>h)u.partial=!0,u.time.push({startPTS:Math.max(o,E.start(p)),endPTS:Math.min(s,E.end(p))});else if(s<=h)break}return u},v.getPartialFragment=function(R){var C=null,T,E,u,o=0,s=this.bufferPadding,d=this.fragments;return Object.keys(d).forEach(function(S){var p=d[S];if(!p)return;N(p)&&(E=p.body.start-s,u=p.body.end+s,R>=E&&R<=u&&(T=Math.min(R-E,u-R),o<=T&&(C=p.body,o=T)))}),C},v.getState=function(R){var C=k(R),T=this.fragments[C];return T?T.buffered?N(T)?P.PARTIAL:P.OK:T.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},v.backtrack=function(R,C){var T=k(R),E=this.fragments[T];if(!E||E.backtrack)return null;var u=E.backtrack=C||E.loaded;return E.loaded=null,u},v.getBacktrackData=function(R){var C=k(R),T=this.fragments[C];if(T){var E,u=T.backtrack;if(u!=null&&(E=u.payload)!==null&&E!==void 0&&E.byteLength)return u;this.removeFragment(R)}return null},v.isTimeBuffered=function(R,C,T){for(var E,u,o=0;o<T.length;o++){if(E=T.start(o)-this.bufferPadding,u=T.end(o)+this.bufferPadding,R>=E&&C<=u)return!0;if(C<=E)return!1}return!1},v.onFragLoaded=function(R,C){var T=C.frag,E=C.part;if(T.sn==="initSegment"||T.bitrateTest||E)return;var u=k(T);this.fragments[u]={body:T,loaded:C,backtrack:null,buffered:!1,range:Object.create(null)}},v.onBufferAppended=function(R,C){var T=this,E=C.frag,u=C.part,o=C.timeRanges;if(E.type===I.PlaylistLevelType.MAIN)if(this.activeFragment=E,u){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(u)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(d){var S=o[d];if(T.detectEvictedFragments(d,S),!u)for(var p=0;p<S.length;p++)E.appendedPTS=Math.max(S.end(p),E.appendedPTS||0)})},v.onFragBuffered=function(R,C){this.detectPartialFragments(C)},v.hasFragment=function(R){var C=k(R);return!!this.fragments[C]},v.removeFragmentsInRange=function(R,C,T){var E=this;Object.keys(this.fragments).forEach(function(u){var o=E.fragments[u];if(!o)return;if(o.buffered){var s=o.body;s.type===T&&s.start<C&&s.end>R&&E.removeFragment(s)}})},v.removeFragment=function(R){var C=k(R);R.stats.loaded=0,R.clearElementaryStreamInfo(),delete this.fragments[C]},v.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},D}();function N(D){var v,w;return D.buffered&&(((v=D.range.video)===null||v===void 0?void 0:v.partial)||((w=D.range.audio)===null||w===void 0?void 0:w.partial))}function k(D){return D.type+"_"+D.level+"_"+D.urlId+"_"+D.sn}},"./src/controller/gap-controller.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"STALL_MINIMUM_DURATION_MS",function(){return N}),L.d(z,"MAX_START_GAP_JUMP",function(){return k}),L.d(z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return D}),L.d(z,"SKIP_BUFFER_RANGE_START",function(){return v}),L.d(z,"default",function(){return w});var G=L("./src/utils/buffer-helper.ts"),I=L("./src/errors.ts"),P=L("./src/events.ts"),B=L("./src/utils/logger.ts"),N=250,k=2,D=.1,v=.05,w=function(){function R(T,E,u,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=T,this.media=E,this.fragmentTracker=u,this.hls=o}var C=R.prototype;return C.destroy=function(){this.hls=this.fragmentTracker=this.media=null},C.poll=function(E){var u=this.config,o=this.media,s=this.stalled,d=o.currentTime,S=o.seeking,p=this.seeking&&!S,h=!this.seeking&&S;if(this.seeking=S,d!==E){if(this.moved=!0,s!==null){if(this.stallReported){var A=self.performance.now()-s;B.logger.warn("playback not stuck anymore @"+d+", after "+Math.round(A)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((h||p)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!G.BufferHelper.getBuffered(o).length)return;var b=G.BufferHelper.bufferInfo(o,d,0),f=b.len>0,c=b.nextStart||0;if(!f&&!c)return;if(S){var l=b.len>k,a=!c||c-d>k&&!this.fragmentTracker.getPartialFragment(d);if(l||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var g,m=Math.max(c,b.start||0)-d,y=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=y==null||((g=y.details)===null||g===void 0)?void 0:g.live,F=M?y.details.targetduration*2:k;if(m>0&&m<=F){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(s===null){this.stalled=j;return}var W=j-s;!S&&W>=N&&this._reportStall(b.len);var O=G.BufferHelper.bufferInfo(o,d,u.maxBufferHole);this._tryFixBufferStall(O,W)},C._tryFixBufferStall=function(E,u){var o=this.config,s=this.fragmentTracker,d=this.media,S=d.currentTime,p=s.getPartialFragment(S);if(p){var h=this._trySkipBufferHole(p);if(h)return}E.len>o.maxBufferHole&&u>o.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},C._reportStall=function(E){var u=this.hls,o=this.media,s=this.stallReported;s||(this.stallReported=!0,B.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+E+")"),u.trigger(P.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:E}))},C._trySkipBufferHole=function(E){for(var u=this.config,o=this.hls,s=this.media,d=s.currentTime,S=0,p=G.BufferHelper.getBuffered(s),h=0;h<p.length;h++){var A=p.start(h);if(d+u.maxBufferHole>=S&&d<A){var b=Math.max(A+v,s.currentTime+D);return B.logger.warn("skipping hole, adjusting currentTime from "+d+" to "+b),this.moved=!0,this.stalled=null,s.currentTime=b,E&&o.trigger(P.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+d+" to "+b,frag:E}),b}S=p.end(h)}return 0},C._tryNudgeBuffer=function(){var E=this.config,u=this.hls,o=this.media,s=o.currentTime,d=(this.nudgeRetry||0)+1;if(this.nudgeRetry=d,d<E.nudgeMaxRetry){var S=s+d*E.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+s+" to "+S),o.currentTime=S,u.trigger(P.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else B.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+E.nudgeMaxRetry+" nudges"),u.trigger(P.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},R}()},"./src/controller/id3-track-controller.ts":function(ee,z,L){"use strict";L.r(z);var G=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),P=L("./src/demux/id3.ts"),B=.25,N=function(){function k(v){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=v,this._registerListeners()}var D=k.prototype;return D.destroy=function(){this._unregisterListeners()},D._registerListeners=function(){var w=this.hls;w.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.on(G.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),w.on(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D._unregisterListeners=function(){var w=this.hls;w.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.off(G.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),w.off(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D.onMediaAttached=function(w,R){this.media=R.media},D.onMediaDetaching=function(){if(!this.id3Track)return;Object(I.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},D.getID3Track=function(w){if(!this.media)return;for(var R=0;R<w.length;R++){var C=w[R];if(C.kind==="metadata"&&C.label==="id3")return Object(I.sendAddTrackEvent)(C,this.media),C}return this.media.addTextTrack("metadata","id3")},D.onFragParsingMetadata=function(w,R){if(!this.media)return;var C=R.frag,T=R.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var E=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,u=0;u<T.length;u++){var o=P.getID3Frames(T[u].data);if(o){var s=T[u].pts,d=u<T.length-1?T[u+1].pts:C.end,S=d-s;S<=0&&(d=s+B);for(var p=0;p<o.length;p++){var h=o[p];if(!P.isTimeStampFrame(h)){var A=new E(s,d,"");A.value=h,this.id3Track.addCue(A)}}}}},D.onBufferFlushing=function(w,R){var C=R.startOffset,T=R.endOffset,E=R.type;if(!E||E==="audio"){var u=this.id3Track;u&&Object(I.removeCuesInRange)(u,C,T)}},k}();z.default=N},"./src/controller/latency-controller.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"default",function(){return k});var G=L("./src/errors.ts"),I=L("./src/events.ts"),P=L("./src/utils/logger.ts");function B(D,v){for(var w=0;w<v.length;w++){var R=v[w];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(D,R.key,R)}}function N(D,v,w){return v&&B(D.prototype,v),w&&B(D,w),D}var k=function(){function D(w){var R=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 R.timeupdate()},this.hls=w,this.config=w.config,this.registerListeners()}var v=D.prototype;return v.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},v.registerListeners=function(){this.hls.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(I.Events.ERROR,this.onError,this)},v.unregisterListeners=function(){this.hls.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(I.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(I.Events.ERROR,this.onError)},v.onMediaAttached=function(R,C){this.media=C.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},v.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},v.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},v.onLevelUpdated=function(R,C){var T=C.details;this.levelDetails=T,T.advanced&&this.timeupdate(),!T.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},v.onError=function(R,C){if(C.details!==G.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},v.timeupdate=function(){var R=this.media,C=this.levelDetails;if(!R||!C)return;this.currentTime=R.currentTime;var T=this.computeLatency();if(T===null)return;this._latency=T;var E=this.config,u=E.lowLatencyMode,o=E.maxLiveSyncPlaybackRate;if(!u||o===1)return;var s=this.targetLatency;if(s===null)return;var d=T-s,S=Math.min(this.maxLatency,s+C.targetduration),p=d<S;if(C.live&&p&&d>.05&&this.forwardBufferLength>1){var h=Math.min(2,Math.max(1,o)),A=Math.round(2/(1+Math.exp(-.75*d-this.edgeStalled))*20)/20;R.playbackRate=Math.min(h,Math.max(1,A))}else R.playbackRate!==1&&R.playbackRate!==0&&(R.playbackRate=1)},v.estimateLiveEdge=function(){var R=this.levelDetails;return R===null?null:R.edge+R.age},v.computeLatency=function(){var R=this.estimateLiveEdge();return R===null?null:R-this.currentTime},N(D,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var R=this.config,C=this.levelDetails;return R.liveMaxLatencyDuration!==void 0?R.liveMaxLatencyDuration:C?R.liveMaxLatencyDurationCount*C.targetduration:0}},{key:"targetLatency",get:function(){var R=this.levelDetails;if(R===null)return null;var C=R.holdBack,T=R.partHoldBack,E=R.targetduration,u=this.config,o=u.liveSyncDuration,s=u.liveSyncDurationCount,d=u.lowLatencyMode,S=this.hls.userConfig,p=d&&T||C;(S.liveSyncDuration||S.liveSyncDurationCount||p===0)&&(p=o!==void 0?o:s*E);var h=E,A=1;return p+Math.min(this.stallCount*A,h)}},{key:"liveSyncPosition",get:function(){var R=this.estimateLiveEdge(),C=this.targetLatency,T=this.levelDetails;if(R===null||C===null||T===null)return null;var E=T.edge,u=R-C-this.edgeStalled,o=E-T.totalduration,s=E-(this.config.lowLatencyMode&&T.partTarget||T.targetduration);return Math.min(Math.max(o,u),s)}},{key:"drift",get:function(){var R=this.levelDetails;return R===null?1:R.drift}},{key:"edgeStalled",get:function(){var R=this.levelDetails;if(R===null)return 0;var C=(this.config.lowLatencyMode&&R.partTarget||R.targetduration)*3;return Math.max(R.age-C,0)}},{key:"forwardBufferLength",get:function(){var R=this.media,C=this.levelDetails;if(!R||!C)return 0;var T=R.buffered.length;return T?R.buffered.end(T-1):C.edge-this.currentTime}}]),D}()},"./src/controller/level-controller.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"default",function(){return u});var G=L("./src/types/level.ts"),I=L("./src/events.ts"),P=L("./src/errors.ts"),B=L("./src/utils/codecs.ts"),N=L("./src/controller/level-helper.ts"),k=L("./src/controller/base-playlist-controller.ts"),D=L("./src/types/loader.ts");function v(){return v=Object.assign||function(o){for(var s=1;s<arguments.length;s++){var d=arguments[s];for(var S in d)Object.prototype.hasOwnProperty.call(d,S)&&(o[S]=d[S])}return o},v.apply(this,arguments)}function w(o,s){for(var d=0;d<s.length;d++){var S=s[d];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function R(o,s,d){return s&&w(o.prototype,s),d&&w(o,d),o}function C(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,T(o,s)}function T(o,s){return T=Object.setPrototypeOf||function(S,p){return S.__proto__=p,S},T(o,s)}var E=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),u=function(o){C(s,o);function s(S){var p;return p=o.call(this,S,"[level-controller]")||this,p._levels=[],p._firstLevel=-1,p._startLevel=void 0,p.currentLevelIndex=-1,p.manualLevelIndex=-1,p.onParsedComplete=void 0,p._registerListeners(),p}var d=s.prototype;return d._registerListeners=function(){var p=this.hls;p.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),p.on(I.Events.ERROR,this.onError,this)},d._unregisterListeners=function(){var p=this.hls;p.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),p.off(I.Events.ERROR,this.onError,this)},d.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},d.startLoad=function(){var p=this._levels;p.forEach(function(h){h.loadError=0}),o.prototype.startLoad.call(this)},d.onManifestLoaded=function(p,h){var A=[],b=[],f=[],c,l={},a,g=!1,m=!1,y=!1;if(h.levels.forEach(function(W){var O=W.attrs;g=g||!!(W.width&&W.height),m=m||!!W.videoCodec,y=y||!!W.audioCodec,E&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var _=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;a=l[_],a?a.url.push(W.url):(a=new G.Level(W),l[_]=a,A.push(a)),O&&(O.AUDIO&&Object(N.addGroupId)(a,"audio",O.AUDIO),O.SUBTITLES&&Object(N.addGroupId)(a,"text",O.SUBTITLES))}),(g||m)&&y&&(A=A.filter(function(W){var O=W.videoCodec,_=W.width,K=W.height;return!!O||!!(_&&K)})),A=A.filter(function(W){var O=W.audioCodec,_=W.videoCodec;return(!O||Object(B.isCodecSupportedInMp4)(O,"audio"))&&(!_||Object(B.isCodecSupportedInMp4)(_,"video"))}),h.audioTracks&&(b=h.audioTracks.filter(function(W){return!W.audioCodec||Object(B.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(N.assignTrackIdsByGroup)(b)),h.subtitles&&(f=h.subtitles,Object(N.assignTrackIdsByGroup)(f)),A.length>0){c=A[0].bitrate,A.sort(function(W,O){return W.bitrate-O.bitrate}),this._levels=A;for(var M=0;M<A.length;M++)if(A[M].bitrate===c){this._firstLevel=M,this.log("manifest loaded, "+A.length+" level(s) found, first bitrate: "+c);break}var F=y&&!m,j={levels:A,audioTracks:b,subtitleTracks:f,firstLevel:this._firstLevel,stats:h.stats,audio:y,video:m,altAudio:!F&&b.some(function(W){return!!W.url})};this.hls.trigger(I.Events.MANIFEST_PARSED,j),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(I.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:h.url,reason:"no level with compatible codecs found in manifest"})},d.onError=function(p,h){if(o.prototype.onError.call(this,p,h),h.fatal)return;var A=h.context,b=this._levels[this.currentLevelIndex];if(A&&(A.type===D.PlaylistContextType.AUDIO_TRACK&&b.audioGroupIds&&A.groupId===b.audioGroupIds[b.urlId]||A.type===D.PlaylistContextType.SUBTITLE_TRACK&&b.textGroupIds&&A.groupId===b.textGroupIds[b.urlId])){this.redundantFailover(this.currentLevelIndex);return}var f=!1,c=!0,l;switch(h.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(h.frag){var a=this._levels[h.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(l=h.frag.level)):l=h.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:A&&(A.deliveryDirectives&&(c=!1),l=A.level),f=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:l=h.level,f=!0;break}l!==void 0&&this.recoverLevel(h,l,f,c)},d.recoverLevel=function(p,h,A,b){var f=p.details,c=this._levels[h];if(c.loadError++,A){var l=this.retryLoadingOrFail(p);if(l)p.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var a=c.url.length;if(a>1&&c.loadError<a)p.levelRetry=!0,this.redundantFailover(h);else if(this.manualLevelIndex===-1){var g=h===0?this._levels.length-1:h-1;this.currentLevelIndex!==g&&this._levels[g].loadError===0&&(this.warn(f+": switch to "+g),p.levelRetry=!0,this.hls.nextAutoLevel=g)}}},d.redundantFailover=function(p){var h=this._levels[p],A=h.url.length;if(A>1){var b=(h.urlId+1)%A;this.warn("Switching to redundant URL-id "+b),this._levels.forEach(function(f){f.urlId=b}),this.level=p}},d.onFragLoaded=function(p,h){var A=h.frag;if(A!==void 0&&A.type===D.PlaylistLevelType.MAIN){var b=this._levels[A.level];b!==void 0&&(b.fragmentError=0,b.loadError=0)}},d.onLevelLoaded=function(p,h){var A,b=h.level,f=h.details,c=this._levels[b];if(!c){var l;this.warn("Invalid level index "+b),(l=h.deliveryDirectives)!==null&&l!==void 0&&l.skip&&(f.deltaUpdateFailed=!0);return}b===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(b,h,c.details)):(A=h.deliveryDirectives)!==null&&A!==void 0&&A.skip&&(f.deltaUpdateFailed=!0)},d.onAudioTrackSwitched=function(p,h){var A=this.hls.levels[this.currentLevelIndex];if(!A)return;if(A.audioGroupIds){for(var b=-1,f=this.hls.audioTracks[h.id].groupId,c=0;c<A.audioGroupIds.length;c++)if(A.audioGroupIds[c]===f){b=c;break}b!==A.urlId&&(A.urlId=b,this.startLoad())}},d.loadPlaylist=function(p){var h=this.currentLevelIndex,A=this._levels[h];if(this.canLoad&&A&&A.url.length>0){var b=A.urlId,f=A.url[b];if(p)try{f=p.addDirectives(f)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+h+(p?" at sn "+p.msn+" part "+p.part:"")+" with URL-id "+b+" "+f),this.clearTimer(),this.hls.trigger(I.Events.LEVEL_LOADING,{url:f,level:h,id:b,deliveryDirectives:p||null})}},d.removeLevel=function(p,h){var A=function(c,l){return l!==h},b=this._levels.filter(function(f,c){return c!==p?!0:f.url.length>1&&h!==void 0?(f.url=f.url.filter(A),f.audioGroupIds&&(f.audioGroupIds=f.audioGroupIds.filter(A)),f.textGroupIds&&(f.textGroupIds=f.textGroupIds.filter(A)),f.urlId=0,!0):!1}).map(function(f,c){var l=f.details;return l!=null&&l.fragments&&l.fragments.forEach(function(a){a.level=c}),f});this._levels=b,this.hls.trigger(I.Events.LEVELS_UPDATED,{levels:b})},R(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(p){var h,A=this._levels;if(A.length===0)return;if(this.currentLevelIndex===p&&(h=A[p])!==null&&h!==void 0&&h.details)return;if(p<0||p>=A.length){var b=p<0;if(this.hls.trigger(I.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:p,fatal:b,reason:"invalid level idx"}),b)return;p=Math.min(p,A.length-1)}this.clearTimer();var f=this.currentLevelIndex,c=A[f],l=A[p];this.log("switching to level "+p+" from "+f),this.currentLevelIndex=p;var a=v({},l,{level:p,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete a._urlId,this.hls.trigger(I.Events.LEVEL_SWITCHING,a);var g=l.details;if(!g||g.live){var m=this.switchParams(l.uri,c==null?void 0:c.details);this.loadPlaylist(m)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(p){this.manualLevelIndex=p,this._startLevel===void 0&&(this._startLevel=p),p!==-1&&(this.level=p)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(p){this._firstLevel=p}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var p=this.hls.config.startLevel;return p!==void 0?p:this._firstLevel}else return this._startLevel},set:function(p){this._startLevel=p}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(p){this.level=p,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=p)}}]),s}(k.default)},"./src/controller/level-helper.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"addGroupId",function(){return P}),L.d(z,"assignTrackIdsByGroup",function(){return B}),L.d(z,"updatePTS",function(){return N}),L.d(z,"updateFragPTSDTS",function(){return D}),L.d(z,"mergeDetails",function(){return v}),L.d(z,"mapPartIntersection",function(){return w}),L.d(z,"mapFragmentIntersection",function(){return R}),L.d(z,"adjustSliding",function(){return C}),L.d(z,"addSliding",function(){return T}),L.d(z,"computeReloadInterval",function(){return E}),L.d(z,"getFragmentWithSN",function(){return u}),L.d(z,"getPartWith",function(){return o});var G=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts");function P(s,d,S){switch(d){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(S);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(S);break}}function B(s){var d={};s.forEach(function(S){var p=S.groupId||"";S.id=d[p]=d[p]||0,d[p]++})}function N(s,d,S){var p=s[d],h=s[S];k(p,h)}function k(s,d){var S=d.startPTS;if(Object(G.isFiniteNumber)(S)){var p=0,h;d.sn>s.sn?(p=S-s.start,h=s):(p=s.start-S,h=d),h.duration!==p&&(h.duration=p)}else if(d.sn>s.sn){var A=s.cc===d.cc;A&&s.minEndPTS?d.start=s.start+(s.minEndPTS-s.start):d.start=s.start+s.duration}else d.start=Math.max(s.start-d.duration,0)}function D(s,d,S,p,h,A){var b=p-S;b<=0&&(I.logger.warn("Fragment should have a positive duration",d),p=S+d.duration,A=h+d.duration);var f=S,c=p,l=d.startPTS,a=d.endPTS;if(Object(G.isFiniteNumber)(l)){var g=Math.abs(l-S);Object(G.isFiniteNumber)(d.deltaPTS)?d.deltaPTS=Math.max(g,d.deltaPTS):d.deltaPTS=g,f=Math.max(S,l),S=Math.min(S,l),h=Math.min(h,d.startDTS),c=Math.min(p,a),p=Math.max(p,a),A=Math.max(A,d.endDTS)}d.duration=p-S;var m=S-d.start;d.appendedPTS=p,d.start=d.startPTS=S,d.maxStartPTS=f,d.startDTS=h,d.endPTS=p,d.minEndPTS=c,d.endDTS=A;var y=d.sn;if(!s||y<s.startSN||y>s.endSN)return 0;var M,F=y-s.startSN,j=s.fragments;for(j[F]=d,M=F;M>0;M--)k(j[M],j[M-1]);for(M=F;M<j.length-1;M++)k(j[M],j[M+1]);return s.fragmentHint&&k(j[j.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,m}function v(s,d){for(var S=null,p=s.fragments,h=p.length-1;h>=0;h--){var A=p[h].initSegment;if(A){S=A;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var b=0,f;if(R(s,d,function(M,F){M.relurl&&(b=M.cc-F.cc),Object(G.isFiniteNumber)(M.startPTS)&&Object(G.isFiniteNumber)(M.endPTS)&&(F.start=F.startPTS=M.startPTS,F.startDTS=M.startDTS,F.appendedPTS=M.appendedPTS,F.maxStartPTS=M.maxStartPTS,F.endPTS=M.endPTS,F.endDTS=M.endDTS,F.minEndPTS=M.minEndPTS,F.duration=M.endPTS-M.startPTS,F.duration&&(f=F),d.PTSKnown=d.alignedSliding=!0),F.elementaryStreams=M.elementaryStreams,F.loader=M.loader,F.stats=M.stats,F.urlId=M.urlId,M.initSegment&&(F.initSegment=M.initSegment,S=M.initSegment)}),S){var c=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments;c.forEach(function(M){var F;(!M.initSegment||M.initSegment.relurl===((F=S)===null||F===void 0?void 0:F.relurl))&&(M.initSegment=S)})}if(d.skippedSegments&&(d.deltaUpdateFailed=d.fragments.some(function(M){return!M}),d.deltaUpdateFailed)){I.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var l=d.skippedSegments;l--;)d.fragments.shift();d.startSN=d.fragments[0].sn,d.startCC=d.fragments[0].cc}var a=d.fragments;if(b){I.logger.warn("discontinuity sliding from playlist, take drift into account");for(var g=0;g<a.length;g++)a[g].cc+=b}d.skippedSegments&&(d.startCC=d.fragments[0].cc),w(s.partList,d.partList,function(M,F){F.elementaryStreams=M.elementaryStreams,F.stats=M.stats}),f?D(d,f,f.startPTS,f.endPTS,f.startDTS,f.endDTS):C(s,d),a.length&&(d.totalduration=d.edge-a[0].start),d.driftStartTime=s.driftStartTime,d.driftStart=s.driftStart;var m=d.advancedDateTime;if(d.advanced&&m){var y=d.edge;d.driftStart||(d.driftStartTime=m,d.driftStart=y),d.driftEndTime=m,d.driftEnd=y}else d.driftEndTime=s.driftEndTime,d.driftEnd=s.driftEnd,d.advancedDateTime=s.advancedDateTime}function w(s,d,S){if(s&&d)for(var p=0,h=0,A=s.length;h<=A;h++){var b=s[h],f=d[h+p];b&&f&&b.index===f.index&&b.fragment.sn===f.fragment.sn?S(b,f):p--}}function R(s,d,S){for(var p=d.skippedSegments,h=Math.max(s.startSN,d.startSN)-d.startSN,A=(s.fragmentHint?1:0)+(p?d.endSN:Math.min(s.endSN,d.endSN))-d.startSN,b=d.startSN-s.startSN,f=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments,c=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,l=h;l<=A;l++){var a=c[b+l],g=f[l];p&&!g&&l<p&&(g=d.fragments[l]=a),a&&g&&S(a,g)}}function C(s,d){var S=d.startSN+d.skippedSegments-s.startSN,p=s.fragments;if(S<0||S>=p.length)return;T(d,p[S].start)}function T(s,d){if(d){for(var S=s.fragments,p=s.skippedSegments;p<S.length;p++)S[p].start+=d;s.fragmentHint&&(s.fragmentHint.start+=d)}}function E(s,d){var S=1e3*s.levelTargetDuration,p=S/2,h=s.age,A=h>0&&h<S*3,b=d.loading.end-d.loading.start,f,c=s.availabilityDelay;if(s.updated===!1)if(A){var l=333*s.misses;f=Math.max(Math.min(p,b*2),l),s.availabilityDelay=(s.availabilityDelay||0)+f}else f=p;else A?(c=Math.min(c||S/2,h),s.availabilityDelay=c,f=c+S-h):f=S-b;return Math.round(f)}function u(s,d,S){if(!s||!s.details)return null;var p=s.details,h=p.fragments[d-p.startSN];return h||(h=p.fragmentHint,h&&h.sn===d?h:d<p.startSN&&S&&S.sn===d?S:null)}function o(s,d,S){if(!s||!s.details)return null;var p=s.details.partList;if(p)for(var h=p.length;h--;){var A=p[h];if(A.index===S&&A.fragment.sn===d)return A}return null}},"./src/controller/stream-controller.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"default",function(){return p});var G=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),P=L("./src/is-supported.ts"),B=L("./src/events.ts"),N=L("./src/utils/buffer-helper.ts"),k=L("./src/controller/fragment-tracker.ts"),D=L("./src/types/loader.ts"),v=L("./src/loader/fragment.ts"),w=L("./src/demux/transmuxer-interface.ts"),R=L("./src/types/transmuxer.ts"),C=L("./src/controller/gap-controller.ts"),T=L("./src/errors.ts"),E=L("./src/utils/logger.ts");function u(h,A){for(var b=0;b<A.length;b++){var f=A[b];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(h,f.key,f)}}function o(h,A,b){return A&&u(h.prototype,A),b&&u(h,b),h}function s(h,A){h.prototype=Object.create(A.prototype),h.prototype.constructor=h,d(h,A)}function d(h,A){return d=Object.setPrototypeOf||function(f,c){return f.__proto__=c,f},d(h,A)}var S=100,p=function(h){s(A,h);function A(f,c){var l;return l=h.call(this,f,c,"[stream-controller]")||this,l.audioCodecSwap=!1,l.gapController=null,l.level=-1,l._forceStartLoad=!1,l.altAudio=!1,l.audioOnly=!1,l.fragPlaying=null,l.onvplaying=null,l.onvseeked=null,l.fragLastKbps=0,l.stalled=!1,l.couldBacktrack=!1,l.audioCodecSwitch=!1,l.videoBuffer=null,l._registerListeners(),l}var b=A.prototype;return b._registerListeners=function(){var c=this.hls;c.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(B.Events.ERROR,this.onError,this),c.on(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(B.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var c=this.hls;c.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(B.Events.ERROR,this.onError,this),c.off(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(B.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(c){if(this.levels){var l=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(S),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var g=a.startLevel;g===-1&&(a.config.testBandwidth?(g=0,this.bitrateTest=!0):g=a.nextAutoLevel),this.level=a.nextLoadLevel=g,this.loadedmetadata=!1}l>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+l.toFixed(3)),c=l),this.state=I.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=I.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,h.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_LEVEL:{var c,l=this.levels,a=this.level,g=l==null||((c=l[a])===null||c===void 0)?void 0:c.details;if(g&&(!g.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(g))break;this.state=I.State.IDLE;break}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var m,y=self.performance.now(),M=this.retryDate;(!M||y>=M||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=I.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){h.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var c,l,a=this.hls,g=this.levelLastLoaded,m=this.levels,y=this.media,M=a.config,F=a.nextLoadLevel;if(g===null||!y&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[F])return;var j=m[F];this.level=a.nextLoadLevel=F;var W=j.details;if(!W||this.state===I.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==F){this.state=I.State.WAITING_LEVEL;return}var O=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:y,D.PlaylistLevelType.MAIN);if(O===null)return;var _=O.len,K=this.getMaxBufferLength(j.maxBitrate);if(_>=K)return;if(this._streamEnded(O,W)){var $={};this.altAudio&&($.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,$),this.state=I.State.ENDED;return}var q=O.end,ne=this.getNextFragment(q,W);if(this.couldBacktrack&&!this.fragPrevious&&ne&&ne.sn!=="initSegment"){var Te=ne.sn-W.startSN;Te>1&&(ne=W.fragments[Te-1],this.fragmentTracker.removeFragment(ne))}if(ne&&this.fragmentTracker.getState(ne)===k.FragmentState.OK&&this.nextLoadPosition>q){var ve=this.audioOnly&&!this.altAudio?v.ElementaryStreamTypes.AUDIO:v.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(y,ve,D.PlaylistLevelType.MAIN),ne=this.getNextFragment(this.nextLoadPosition,W)}if(!ne)return;ne.initSegment&&!ne.initSegment.data&&!this.bitrateTest&&(ne=ne.initSegment),((c=ne.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((l=ne.decryptdata)!==null&&l!==void 0&&l.key)?this.loadKey(ne,W):this.loadFragment(ne,W,q)},b.loadFragment=function(c,l,a){var g,m=this.fragmentTracker.getState(c);if(this.fragCurrent=c,m===k.FragmentState.BACKTRACKED){var y=this.fragmentTracker.getBacktrackData(c);if(y){this._handleFragmentLoadProgress(y),this._handleFragmentLoadComplete(y);return}else m=k.FragmentState.NOT_LOADED}m===k.FragmentState.NOT_LOADED||m===k.FragmentState.PARTIAL?c.sn==="initSegment"?this._loadInitSegment(c):this.bitrateTest?(c.bitrateTest=!0,this.log("Fragment "+c.sn+" of level "+c.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(c)):(this.startFragRequested=!0,h.prototype.loadFragment.call(this,c,l,a)):m===k.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((g=this.media)===null||g===void 0?void 0:g.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(c){var l=this.fragmentTracker.getAppendedFrag(c,D.PlaylistLevelType.MAIN);return l&&"fragment"in l?l.fragment:l},b.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,D.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var c=this.levels,l=this.media;if(l!=null&&l.readyState){var a,g=this.getAppendedFrag(l.currentTime);if(g&&g.start>1&&this.flushMainBuffer(0,g.start-1),!l.paused&&c){var m=this.hls.nextLoadLevel,y=c[m],M=this.fragLastKbps;M&&this.fragCurrent?a=this.fragCurrent.duration*y.maxBitrate/(1e3*M)+1:a=0}else a=0;var F=this.getBufferedFrag(l.currentTime+a);if(F){var j=this.followingBufferedFrag(F);if(j){this.abortCurrentFrag();var W=j.maxStartPTS?j.maxStartPTS:j.start,O=j.duration,_=Math.max(F.end,W+Math.min(Math.max(O-this.config.maxFragLookUpTolerance,O*.5),O*.75));this.flushMainBuffer(_,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===I.State.KEY_LOADING&&(this.state=I.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(c,l){h.prototype.flushMainBuffer.call(this,c,l,this.altAudio?"video":null)},b.onMediaAttached=function(c,l){h.prototype.onMediaAttached.call(this,c,l);var a=l.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 C.default(this.config,a,this.fragmentTracker,this.hls)},b.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),h.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var c=this.media,l=c?c.currentTime:null;Object(G.isFiniteNumber)(l)&&this.log("Media seeked to "+l.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(B.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(c,l){var a=!1,g=!1,m;l.levels.forEach(function(y){m=y.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(a=!0),m.indexOf("mp4a.40.5")!==-1&&(g=!0))}),this.audioCodecSwitch=a&&g&&!Object(P.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=l.levels,this.startFragRequested=!1},b.onLevelLoading=function(c,l){var a=this.levels;if(!a||this.state!==I.State.IDLE)return;var g=a[l.level];(!g.details||g.details.live&&this.levelLastLoaded!==l.level||this.waitForCdnTuneIn(g.details))&&(this.state=I.State.WAITING_LEVEL)},b.onLevelLoaded=function(c,l){var a,g=this.levels,m=l.level,y=l.details,M=y.totalduration;if(!g){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+y.startSN+","+y.endSN+"], cc ["+y.startCC+", "+y.endCC+"] duration:"+M);var F=this.fragCurrent;F&&(this.state===I.State.FRAG_LOADING||this.state===I.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==l.level&&F.loader&&(this.state=I.State.IDLE,F.loader.abort()));var j=g[m],W=0;if(y.live||(a=j.details)!==null&&a!==void 0&&a.live){if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed)return;W=this.alignPlaylists(y,j.details)}if(j.details=y,this.levelLastLoaded=m,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:y,level:m}),this.state===I.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(y))return;this.state=I.State.IDLE}this.startFragRequested?y.live&&this.synchronizeToLiveEdge(y):this.setStartPosition(y,W),this.tick()},b._handleFragmentLoadProgress=function(c){var l,a=c.frag,g=c.part,m=c.payload,y=this.levels;if(!y){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var M=y[a.level],F=M.details;if(!F){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var j=M.videoCodec,W=F.PTSKnown||!F.live,O=(l=a.initSegment)===null||l===void 0?void 0:l.data,_=this._getAudioCodec(M),K=this.transmuxer=this.transmuxer||new w.default(this.hls,D.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),$=g?g.index:-1,q=$!==-1,ne=new R.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,m.byteLength,$,q),Te=this.initPTS[a.cc];K.push(m,O,_,j,a,g,F.totalduration,W,ne,Te)},b.onAudioTrackSwitching=function(c,l){var a=this.altAudio,g=!!l.url,m=l.id;if(!g){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var y=this.fragCurrent;y!=null&&y.loader&&(this.log("Switching to main audio track, cancel main fragment load"),y.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var M=this.hls;a&&M.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),M.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:m})}},b.onAudioTrackSwitched=function(c,l){var a=l.id,g=!!this.hls.audioTracks[a].url;if(g){var m=this.videoBuffer;m&&this.mediaBuffer!==m&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=m)}this.altAudio=g,this.tick()},b.onBufferCreated=function(c,l){var a=l.tracks,g,m,y=!1;for(var M in a){var F=a[M];if(F.id==="main"){if(m=M,g=F,M==="video"){var j=a[M];j&&(this.videoBuffer=j.buffer)}}else y=!0}y&&g?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=g.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(c,l){var a=l.frag,g=l.part;if(a&&a.type!==D.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(g?" p: "+g.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===I.State.PARSED&&(this.state=I.State.IDLE);return}var m=g?g.stats:a.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,g)},b.onError=function(c,l){switch(l.details){case T.ErrorDetails.FRAG_LOAD_ERROR:case T.ErrorDetails.FRAG_LOAD_TIMEOUT:case T.ErrorDetails.KEY_LOAD_ERROR:case T.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.MAIN,l);break;case T.ErrorDetails.LEVEL_LOAD_ERROR:case T.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==I.State.ERROR&&(l.fatal?(this.warn(""+l.details),this.state=I.State.ERROR):!l.levelRetry&&this.state===I.State.WAITING_LEVEL&&(this.state=I.State.IDLE));break;case T.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="main"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var a=!0,g=this.getFwdBufferInfo(this.media,D.PlaylistLevelType.MAIN);g&&g.len>.5&&(a=!this.reduceMaxBufferLength(g.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},b.checkBuffer=function(){var c=this.media,l=this.gapController;if(!c||!l||!c.readyState)return;var a=N.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):l.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=I.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(c,l){var a=l.type;if(a!==v.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var g=(a===v.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(g,a,D.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(c,l){this.levels=l.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var c=this.media,l=c.currentTime,a=this.startPosition;if(a>=0&&l<a){if(c.seeking){E.logger.log("could not seek to "+a+", already seeking at "+l);return}var g=N.BufferHelper.getBuffered(c),m=g.length?g.start(0):0,y=m-a;y>0&&(y<this.config.maxBufferHole||y<this.config.maxFragLookUpTolerance)&&(E.logger.log("adjusting start position by "+y+" to match buffer start"),a+=y,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+l),c.currentTime=a}},b._getAudioCodec=function(c){var l=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&l&&(this.log("Swapping audio codec"),l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5"),l},b._loadBitrateTestFrag=function(c){var l=this;this._doFragLoad(c).then(function(a){var g=l.hls;if(!a||g.nextLoadLevel||l.fragContextChanged(c))return;l.fragLoadError=0,l.state=I.State.IDLE,l.startFragRequested=!1,l.bitrateTest=!1;var m=c.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),g.trigger(B.Events.FRAG_LOADED,a)})},b._handleTransmuxComplete=function(c){var l,a="main",g=this.hls,m=c.remuxResult,y=c.chunkMeta,M=this.getCurrentContext(y);if(!M){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 F=M.frag,j=M.part,W=M.level,O=m.video,_=m.text,K=m.id3,$=m.initSegment,q=this.altAudio?void 0:m.audio;if(this.fragContextChanged(F))return;if(this.state=I.State.PARSING,$){$.tracks&&(this._bufferInitSegment(W,$.tracks,F,y),g.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:a,tracks:$.tracks}));var ne=$.initPTS,Te=$.timescale;Object(G.isFiniteNumber)(ne)&&(this.initPTS[F.cc]=ne,g.trigger(B.Events.INIT_PTS_FOUND,{frag:F,id:a,initPTS:ne,timescale:Te}))}if(O&&m.independent!==!1){if(W.details){var ve=O.startPTS,ge=O.endPTS,ce=O.startDTS,he=O.endDTS;if(j)j.elementaryStreams[O.type]={startPTS:ve,endPTS:ge,startDTS:ce,endDTS:he};else if(O.firstKeyFrame&&O.independent&&(this.couldBacktrack=!0),O.dropped&&O.independent){var oe=this.getLoadPosition()+this.config.maxBufferHole;if(oe<ve){this.backtrack(F);return}F.setElementaryStreamInfo(O.type,F.start,ge,F.start,he,!0)}F.setElementaryStreamInfo(O.type,ve,ge,ce,he),this.bufferFragmentData(O,F,j,y)}}else if(m.independent===!1){this.backtrack(F);return}if(q){var pe=q.startPTS,Y=q.endPTS,ae=q.startDTS,Z=q.endDTS;j&&(j.elementaryStreams[v.ElementaryStreamTypes.AUDIO]={startPTS:pe,endPTS:Y,startDTS:ae,endDTS:Z}),F.setElementaryStreamInfo(v.ElementaryStreamTypes.AUDIO,pe,Y,ae,Z),this.bufferFragmentData(q,F,j,y)}if(K!=null&&(l=K.samples)!==null&&l!==void 0&&l.length){var xe={frag:F,id:a,samples:K.samples};g.trigger(B.Events.FRAG_PARSING_METADATA,xe)}if(_){var we={frag:F,id:a,samples:_.samples};g.trigger(B.Events.FRAG_PARSING_USERDATA,we)}},b._bufferInitSegment=function(c,l,a,g){var m=this;if(this.state!==I.State.PARSING)return;this.audioOnly=!!l.audio&&!l.video,this.altAudio&&!this.audioOnly&&delete l.audio;var y=l.audio,M=l.video,F=l.audiovideo;if(y){var j=c.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),y.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(j="mp4a.40.5")),W.indexOf("android")!==-1&&y.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),c.audioCodec&&c.audioCodec!==j&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+j+'"'),y.levelCodec=j,y.id="main",this.log("Init audio buffer, container:"+y.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(c.audioCodec||"")+"/"+y.codec+"]")}M&&(M.levelCodec=c.videoCodec,M.id="main",this.log("Init video buffer, container:"+M.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+M.codec+"]")),F&&this.log("Init audiovideo buffer, container:"+F.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+F.codec+"]"),this.hls.trigger(B.Events.BUFFER_CODECS,l),Object.keys(l).forEach(function(O){var _=l[O],K=_.initSegment;K!=null&&K.byteLength&&m.hls.trigger(B.Events.BUFFER_APPENDING,{type:O,data:K,frag:a,part:null,chunkMeta:g,parent:a.type})}),this.tick()},b.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var l=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,l?this.resetFragmentLoading(c):this.state=I.State.BACKTRACKING},b.checkFragmentChanged=function(){var c=this.media,l=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(N.BufferHelper.isBuffered(c,a)?l=this.getAppendedFrag(a):N.BufferHelper.isBuffered(c,a+.1)&&(l=this.getAppendedFrag(a+.1)),l){var g=this.fragPlaying,m=l.level;(!g||l.sn!==g.sn||g.level!==m||l.urlId!==g.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:l}),(!g||g.level!==m)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=l)}}},o(A,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);if(l)return l.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(l)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),A}(I.default)},"./src/controller/subtitle-stream-controller.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"SubtitleStreamController",function(){return s});var G=L("./src/events.ts"),I=L("./src/utils/logger.ts"),P=L("./src/utils/buffer-helper.ts"),B=L("./src/controller/fragment-finders.ts"),N=L("./src/utils/discontinuities.ts"),k=L("./src/controller/level-helper.ts"),D=L("./src/controller/fragment-tracker.ts"),v=L("./src/controller/base-stream-controller.ts"),w=L("./src/types/loader.ts"),R=L("./src/types/level.ts");function C(d,S){for(var p=0;p<S.length;p++){var h=S[p];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(d,h.key,h)}}function T(d,S,p){return S&&C(d.prototype,S),p&&C(d,p),d}function E(d,S){d.prototype=Object.create(S.prototype),d.prototype.constructor=d,u(d,S)}function u(d,S){return u=Object.setPrototypeOf||function(h,A){return h.__proto__=A,h},u(d,S)}var o=500,s=function(d){E(S,d);function S(h,A){var b;return b=d.call(this,h,A,"[subtitle-stream-controller]")||this,b.levels=[],b.currentTrackId=-1,b.tracksBuffered=[],b.mainDetails=null,b._registerListeners(),b}var p=S.prototype;return p.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},p._registerListeners=function(){var A=this.hls;A.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.on(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.on(G.Events.ERROR,this.onError,this),A.on(G.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.on(G.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.on(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.on(G.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.on(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p._unregisterListeners=function(){var A=this.hls;A.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.off(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.off(G.Events.ERROR,this.onError,this),A.off(G.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.off(G.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.off(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.off(G.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.off(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p.startLoad=function(){this.stopLoad(),this.state=v.State.IDLE,this.setInterval(o),this.tick()},p.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},p.onLevelLoaded=function(A,b){this.mainDetails=b.details},p.onSubtitleFragProcessed=function(A,b){var f=b.frag,c=b.success;if(this.fragPrevious=f,this.state=v.State.IDLE,!c)return;var l=this.tracksBuffered[this.currentTrackId];if(!l)return;for(var a,g=f.start,m=0;m<l.length;m++)if(g>=l[m].start&&g<=l[m].end){a=l[m];break}var y=f.start+f.duration;a?a.end=y:(a={start:g,end:y},l.push(a)),this.fragmentTracker.fragBuffered(f)},p.onBufferFlushing=function(A,b){var f=b.startOffset,c=b.endOffset;if(f===0&&c!==Number.POSITIVE_INFINITY){var l=this.currentTrackId,a=this.levels;if(!a.length||!a[l]||!a[l].details)return;var g=a[l].details,m=g.targetduration,y=c-m;if(y<=0)return;b.endOffsetSubtitles=Math.max(0,y),this.tracksBuffered.forEach(function(M){for(var F=0;F<M.length;){if(M[F].end<=y){M.shift();continue}else if(M[F].start<y)M[F].start=y;else break;F++}}),this.fragmentTracker.removeFragmentsInRange(f,y,w.PlaylistLevelType.SUBTITLE)}},p.onError=function(A,b){var f,c=b.frag;if(!c||c.type!==w.PlaylistLevelType.SUBTITLE)return;(f=this.fragCurrent)!==null&&f!==void 0&&f.loader&&this.fragCurrent.loader.abort(),this.state=v.State.IDLE},p.onSubtitleTracksUpdated=function(A,b){var f=this,c=b.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(l){return new R.Level(l)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(l){f.tracksBuffered[l.id]=[]}),this.mediaBuffer=null},p.onSubtitleTrackSwitch=function(A,b){if(this.currentTrackId=b.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var f=this.levels[this.currentTrackId];f!=null&&f.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,f&&this.setInterval(o)},p.onSubtitleTrackLoaded=function(A,b){var f,c=b.details,l=b.id,a=this.currentTrackId,g=this.levels;if(!g.length)return;var m=g[a];if(l>=g.length||l!==a||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(f=m.details)!==null&&f!==void 0&&f.live){var y=this.mainDetails;if(c.deltaUpdateFailed||!y)return;var M=y.fragments[0];if(!m.details)c.hasProgramDateTime&&y.hasProgramDateTime?Object(N.alignMediaPlaylistByPDT)(c,y):M&&Object(k.addSliding)(c,M.start);else{var F=this.alignPlaylists(c,m.details);F===0&&M&&Object(k.addSliding)(c,M.start)}}if(m.details=c,this.levelLastLoaded=l,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===v.State.IDLE){var j=Object(B.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},p._handleFragmentLoadComplete=function(A){var b=A.frag,f=A.payload,c=b.decryptdata,l=this.hls;if(this.fragContextChanged(b))return;if(f&&f.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(f),c.key.buffer,c.iv.buffer).then(function(g){var m=performance.now();l.trigger(G.Events.FRAG_DECRYPTED,{frag:b,payload:g,stats:{tstart:a,tdecrypt:m}})})}},p.doTick=function(){if(!this.media){this.state=v.State.IDLE;return}if(this.state===v.State.IDLE){var A,b=this.currentTrackId,f=this.levels;if(!f.length||!f[b]||!f[b].details)return;var c=f[b].details,l=c.targetduration,a=this.config,g=this.media,m=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,g.currentTime-l,a.maxBufferHole),y=m.end,M=m.len,F=this.getMaxBufferLength()+l;if(M>F)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var j=c.fragments,W=j.length,O=c.edge,_,K=this.fragPrevious;if(y<O){var $=a.maxFragLookUpTolerance;K&&c.hasProgramDateTime&&(_=Object(B.findFragmentByPDT)(j,K.endProgramDateTime,$)),_||(_=Object(B.findFragmentByPTS)(K,j,y,$),!_&&K&&K.start<j[0].start&&(_=j[0]))}else _=j[W-1];(A=_)!==null&&A!==void 0&&A.encrypted?(I.logger.log("Loading key for "+_.sn),this.state=v.State.KEY_LOADING,this.hls.trigger(G.Events.KEY_LOADING,{frag:_})):_&&this.fragmentTracker.getState(_)===D.FragmentState.NOT_LOADED&&this.loadFragment(_,c,y)}},p.loadFragment=function(A,b,f){this.fragCurrent=A,d.prototype.loadFragment.call(this,A,b,f)},T(S,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),S}(v.default)},"./src/controller/subtitle-track-controller.ts":function(ee,z,L){"use strict";L.r(z);var G=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),P=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function N(C,T){for(var E=0;E<T.length;E++){var u=T[E];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(C,u.key,u)}}function k(C,T,E){return T&&N(C.prototype,T),E&&N(C,E),C}function D(C,T){C.prototype=Object.create(T.prototype),C.prototype.constructor=C,v(C,T)}function v(C,T){return v=Object.setPrototypeOf||function(u,o){return u.__proto__=o,u},v(C,T)}var w=function(C){D(T,C);function T(u){var o;return o=C.call(this,u,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var E=T.prototype;return E.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,C.prototype.destroy.call(this)},E.registerListeners=function(){var o=this.hls;o.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(G.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var o=this.hls;o.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(G.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(G.Events.ERROR,this.onError,this)},E.onMediaAttached=function(o,s){if(this.media=s.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},E.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},E.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=R(this.media.textTracks);o.forEach(function(s){Object(I.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},E.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},E.onManifestParsed=function(o,s){this.tracks=s.subtitleTracks},E.onSubtitleTrackLoaded=function(o,s){var d=s.id,S=s.details,p=this.trackId,h=this.tracksInGroup[p];if(!h){this.warn("Invalid subtitle track id "+d);return}var A=h.details;h.details=s.details,this.log("subtitle track "+d+" loaded ["+S.startSN+"-"+S.endSN+"]"),d===this.trackId&&(this.retryCount=0,this.playlistLoaded(d,s,A))},E.onLevelLoading=function(o,s){this.switchLevel(s.level)},E.onLevelSwitching=function(o,s){this.switchLevel(s.level)},E.switchLevel=function(o){var s=this.hls.levels[o];if(!(s!=null&&s.textGroupIds))return;var d=s.textGroupIds[s.urlId];if(this.groupId!==d){var S=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,p=this.tracks.filter(function(b){return!d||b.groupId===d});this.tracksInGroup=p;var h=this.findTrackId(S==null?void 0:S.name)||this.findTrackId();this.groupId=d;var A={subtitleTracks:p};this.log("Updating subtitle tracks, "+p.length+' track(s) found in "'+d+'" group-id'),this.hls.trigger(G.Events.SUBTITLE_TRACKS_UPDATED,A),h!==-1&&this.setSubtitleTrack(h,S)}},E.findTrackId=function(o){for(var s=this.tracksInGroup,d=0;d<s.length;d++){var S=s[d];if((!this.selectDefaultTrack||S.default)&&(!o||o===S.name))return S.id}return-1},E.onError=function(o,s){if(C.prototype.onError.call(this,o,s),s.fatal||!s.context)return;s.context.type===B.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},E.loadPlaylist=function(o){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var d=s.id,S=s.groupId,p=s.url;if(o)try{p=o.addDirectives(p)}catch(h){this.warn("Could not construct new URL with HLS Delivery Directives: "+h)}this.log("Loading subtitle playlist for id "+d),this.hls.trigger(G.Events.SUBTITLE_TRACK_LOADING,{url:p,id:d,groupId:S,deliveryDirectives:o||null})}},E.toggleTrackModes=function(o){var s=this,d=this.media,S=this.subtitleDisplay,p=this.trackId;if(!d)return;var h=R(d.textTracks),A=h.filter(function(c){return c.groupId===s.groupId});if(o===-1)[].slice.call(h).forEach(function(c){c.mode="disabled"});else{var b=A[p];b&&(b.mode="disabled")}var f=A[o];f&&(f.mode=S?"showing":"hidden")},E.setSubtitleTrack=function(o,s){var d,S=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(d=S[o])!==null&&d!==void 0&&d.details)||o<-1||o>=S.length)return;this.clearTimer();var p=S[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,p){var h=p.id,A=p.groupId,b=A===void 0?"":A,f=p.name,c=p.type,l=p.url;this.hls.trigger(G.Events.SUBTITLE_TRACK_SWITCH,{id:h,groupId:b,name:f,type:c,url:l});var a=this.switchParams(p.url,s==null?void 0:s.details);this.loadPlaylist(a)}else this.hls.trigger(G.Events.SUBTITLE_TRACK_SWITCH,{id:o})},E.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,s=R(this.media.textTracks),d=0;d<s.length;d++)if(s[d].mode==="hidden")o=d;else if(s[d].mode==="showing"){o=d;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},k(T,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,s)}}]),T}(P.default);function R(C){for(var T=[],E=0;E<C.length;E++){var u=C[E];u.kind==="subtitles"&&u.label&&T.push(C[E])}return T}z.default=w},"./src/controller/timeline-controller.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"TimelineController",function(){return R});var G=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),P=L("./src/utils/cea-608-parser.ts"),B=L("./src/utils/output-filter.ts"),N=L("./src/utils/webvtt-parser.ts"),k=L("./src/utils/texttrack-utils.ts"),D=L("./src/utils/imsc1-ttml-parser.ts"),v=L("./src/types/loader.ts"),w=L("./src/utils/logger.ts"),R=function(){function u(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=E(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var d=new B.default(this,"textTrack1"),S=new B.default(this,"textTrack2"),p=new B.default(this,"textTrack3"),h=new B.default(this,"textTrack4");this.cea608Parser1=new P.default(1,d,S),this.cea608Parser2=new P.default(3,p,h)}s.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(I.Events.FRAG_LOADING,this.onFragLoading,this),s.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=u.prototype;return o.destroy=function(){var d=this.hls;d.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),d.off(I.Events.FRAG_LOADING,this.onFragLoading,this),d.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),d.off(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),d.off(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),d.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(d,S,p,h,A){for(var b=!1,f=A.length;f--;){var c=A[f],l=T(c[0],c[1],S,p);if(l>=0&&(c[0]=Math.min(c[0],S),c[1]=Math.max(c[1],p),b=!0,l/(p-S)>.5))return}if(b||A.push([S,p]),this.config.renderTextTracksNatively){var a=this.captionsTracks[d];this.Cues.newCue(a,S,p,h)}else{var g=this.Cues.newCue(null,S,p,h);this.hls.trigger(I.Events.CUES_PARSED,{type:"captions",cues:g,track:d})}},o.onInitPtsFound=function(d,S){var p=this,h=S.frag,A=S.id,b=S.initPTS,f=S.timescale,c=this.unparsedVttFrags;A==="main"&&(this.initPTS[h.cc]=b,this.timescale[h.cc]=f),c.length&&(this.unparsedVttFrags=[],c.forEach(function(l){p.onFragLoaded(I.Events.FRAG_LOADED,l)}))},o.getExistingTrack=function(d){var S=this.media;if(S)for(var p=0;p<S.textTracks.length;p++){var h=S.textTracks[p];if(h[d])return h}return null},o.createCaptionsTrack=function(d){this.config.renderTextTracksNatively?this.createNativeTrack(d):this.createNonNativeTrack(d)},o.createNativeTrack=function(d){if(this.captionsTracks[d])return;var S=this.captionsProperties,p=this.captionsTracks,h=this.media,A=S[d],b=A.label,f=A.languageCode,c=this.getExistingTrack(d);if(c)p[d]=c,Object(k.clearCurrentCues)(p[d]),Object(k.sendAddTrackEvent)(p[d],h);else{var l=this.createTextTrack("captions",b,f);l&&(l[d]=!0,p[d]=l)}},o.createNonNativeTrack=function(d){if(this.nonNativeCaptionsTracks[d])return;var S=this.captionsProperties[d];if(!S)return;var p=S.label,h={_id:d,label:p,kind:"captions",default:S.media?!!S.media.default:!1,closedCaptions:S.media};this.nonNativeCaptionsTracks[d]=h,this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[h]})},o.createTextTrack=function(d,S,p){var h=this.media;return h?h.addTextTrack(d,S,p):void 0},o.onMediaAttaching=function(d,S){this.media=S.media,this._cleanTracks()},o.onMediaDetaching=function(){var d=this.captionsTracks;Object.keys(d).forEach(function(S){Object(k.clearCurrentCues)(d[S]),delete d[S]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=E(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var d=this.media;if(!d)return;var S=d.textTracks;if(S)for(var p=0;p<S.length;p++)Object(k.clearCurrentCues)(S[p])},o.onSubtitleTracksUpdated=function(d,S){var p=this;this.textTracks=[];var h=S.subtitleTracks||[],A=h.some(function(l){return l.textCodec===D.IMSC1_CODEC});if(this.config.enableWebVTT||A&&this.config.enableIMSC1){var b=this.tracks&&h&&this.tracks.length===h.length;if(this.tracks=h||[],this.config.renderTextTracksNatively){var f=this.media?this.media.textTracks:[];this.tracks.forEach(function(l,a){var g;if(a<f.length){for(var m=null,y=0;y<f.length;y++)if(C(f[y],l)){m=f[y];break}m&&(g=m)}g?Object(k.clearCurrentCues)(g):(g=p.createTextTrack("subtitles",l.name,l.lang),g&&(g.mode="disabled")),g&&(g.groupId=l.groupId,p.textTracks.push(g))})}else if(!b&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(l){return{label:l.name,kind:l.type.toLowerCase(),default:l.default,subtitleTrack:l}});this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(d,S){var p=this;this.config.enableCEA708Captions&&S.captions&&S.captions.forEach(function(h){var A=/(?:CC|SERVICE)([1-4])/.exec(h.instreamId);if(!A)return;var b="textTrack"+A[1],f=p.captionsProperties[b];if(!f)return;f.label=h.name,h.lang&&(f.languageCode=h.lang),f.media=h})},o.onFragLoading=function(d,S){var p=this.cea608Parser1,h=this.cea608Parser2,A=this.lastSn,b=this.lastPartIndex;if(!this.enabled||!(p&&h))return;if(S.frag.type===v.PlaylistLevelType.MAIN){var f,c,l=S.frag.sn,a=(f=S==null||((c=S.part)===null||c===void 0)?void 0:c.index)!=null?f:-1;l===A+1||l===A&&a===b+1||(p.reset(),h.reset()),this.lastSn=l,this.lastPartIndex=a}},o.onFragLoaded=function(d,S){var p=S.frag,h=S.payload,A=this.initPTS,b=this.unparsedVttFrags;if(p.type===v.PlaylistLevelType.SUBTITLE)if(h.byteLength){if(!Object(G.isFiniteNumber)(A[p.cc])){b.push(S),A.length&&this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Missing initial subtitle PTS")});return}var f=p.decryptdata;if(f==null||f.key==null||f.method!=="AES-128"){var c=this.tracks[p.level],l=this.vttCCs;l[p.cc]||(l[p.cc]={start:p.start,prevCC:this.prevCC,new:!0},this.prevCC=p.cc),c&&c.textCodec===D.IMSC1_CODEC?this._parseIMSC1(p,h):this._parseVTTs(p,h,l)}}else this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(d,S){var p=this,h=this.hls;Object(D.parseIMSC1)(S,this.initPTS[d.cc],this.timescale[d.cc],function(A){p._appendCues(A,d.level),h.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(A){w.logger.log("Failed to parse IMSC1: "+A),h.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:A})})},o._parseVTTs=function(d,S,p){var h=this,A=this.hls;Object(N.parseWebVTT)(S,this.initPTS[d.cc],this.timescale[d.cc],p,d.cc,d.start,function(b){h._appendCues(b,d.level),A.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(b){h._fallbackToIMSC1(d,S),w.logger.log("Failed to parse VTT cue: "+b),A.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:b})})},o._fallbackToIMSC1=function(d,S){var p=this,h=this.tracks[d.level];h.textCodec||Object(D.parseIMSC1)(S,this.initPTS[d.cc],this.timescale[d.cc],function(){h.textCodec=D.IMSC1_CODEC,p._parseIMSC1(d,S)},function(){h.textCodec="wvtt"})},o._appendCues=function(d,S){var p=this.hls;if(this.config.renderTextTracksNatively){var h=this.textTracks[S];if(h.mode==="disabled")return;d.forEach(function(f){return Object(k.addCueToTrack)(h,f)})}else{var A=this.tracks[S],b=A.default?"default":"subtitles"+S;p.trigger(I.Events.CUES_PARSED,{type:"subtitles",cues:d,track:b})}},o.onFragDecrypted=function(d,S){var p=S.frag;if(p.type===v.PlaylistLevelType.SUBTITLE){if(!Object(G.isFiniteNumber)(this.initPTS[p.cc])){this.unparsedVttFrags.push(S);return}this.onFragLoaded(I.Events.FRAG_LOADED,S)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(d,S){var p=this.cea608Parser1,h=this.cea608Parser2;if(!this.enabled||!(p&&h))return;for(var A=0;A<S.samples.length;A++){var b=S.samples[A].bytes;if(b){var f=this.extractCea608Data(b);p.addData(S.samples[A].pts,f[0]),h.addData(S.samples[A].pts,f[1])}}},o.onBufferFlushing=function(d,S){var p=S.startOffset,h=S.endOffset,A=S.endOffsetSubtitles,b=S.type,f=this.media;if(!f||f.currentTime<h)return;if(!b||b==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(k.removeCuesInRange)(c[a],p,h)})}if(this.config.renderTextTracksNatively&&(p===0&&A!==void 0)){var l=this.textTracks;Object.keys(l).forEach(function(a){return Object(k.removeCuesInRange)(l[a],p,A)})}},o.extractCea608Data=function(d){for(var S=d[0]&31,p=2,h=[[],[]],A=0;A<S;A++){var b=d[p++],f=127&d[p++],c=127&d[p++],l=(4&b)!==0,a=3&b;if(f===0&&c===0)continue;l&&((a===0||a===1)&&(h[a].push(f),h[a].push(c)))}return h},u}();function C(u,o){return u&&u.label===o.name&&!(u.textTrack1||u.textTrack2)}function T(u,o,s,d){return Math.min(o,d)-Math.max(u,s)}function E(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"default",function(){return G});var G=function(){function I(B,N){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=N}var P=I.prototype;return P.decrypt=function(N,k){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},k,N)},I}()},"./src/crypt/aes-decryptor.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"removePadding",function(){return I}),L.d(z,"default",function(){return P});var G=L("./src/utils/typed-array.ts");function I(B){var N=B.byteLength,k=N&&new DataView(B.buffer).getUint8(N-1);return k?Object(G.sliceUint8)(B,0,N-k):B}var P=function(){function B(){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 N=B.prototype;return N.uint8ArrayToUint32Array_=function(D){for(var v=new DataView(D),w=new Uint32Array(4),R=0;R<4;R++)w[R]=v.getUint32(R*4);return w},N.initTable=function(){var D=this.sBox,v=this.invSBox,w=this.subMix,R=w[0],C=w[1],T=w[2],E=w[3],u=this.invSubMix,o=u[0],s=u[1],d=u[2],S=u[3],p=new Uint32Array(256),h=0,A=0,b=0;for(b=0;b<256;b++)b<128?p[b]=b<<1:p[b]=b<<1^283;for(b=0;b<256;b++){var f=A^A<<1^A<<2^A<<3^A<<4;f=f>>>8^f&255^99,D[h]=f,v[f]=h;var c=p[h],l=p[c],a=p[l],g=p[f]*257^f*16843008;R[h]=g<<24|g>>>8,C[h]=g<<16|g>>>16,T[h]=g<<8|g>>>24,E[h]=g,g=a*16843009^l*65537^c*257^h*16843008,o[f]=g<<24|g>>>8,s[f]=g<<16|g>>>16,d[f]=g<<8|g>>>24,S[f]=g,h?(h=c^p[p[p[a^c]]],A^=p[p[A]]):h=A=1}},N.expandKey=function(D){for(var v=this.uint8ArrayToUint32Array_(D),w=!0,R=0;R<v.length&&w;)w=v[R]===this.key[R],R++;if(w)return;this.key=v;var C=this.keySize=v.length;if(C!==4&&C!==6&&C!==8)throw new Error("Invalid aes key size="+C);var T=this.ksRows=(C+6+1)*4,E,u,o=this.keySchedule=new Uint32Array(T),s=this.invKeySchedule=new Uint32Array(T),d=this.sBox,S=this.rcon,p=this.invSubMix,h=p[0],A=p[1],b=p[2],f=p[3],c,l;for(E=0;E<T;E++){if(E<C){c=o[E]=v[E];continue}l=c,E%C===0?(l=l<<8|l>>>24,l=d[l>>>24]<<24|d[l>>>16&255]<<16|d[l>>>8&255]<<8|d[l&255],l^=S[E/C|0]<<24):C>6&&E%C===4&&(l=d[l>>>24]<<24|d[l>>>16&255]<<16|d[l>>>8&255]<<8|d[l&255]),o[E]=c=(o[E-C]^l)>>>0}for(u=0;u<T;u++)E=T-u,u&3?l=o[E]:l=o[E-4],u<4||E<=4?s[u]=l:s[u]=h[d[l>>>24]]^A[d[l>>>16&255]]^b[d[l>>>8&255]]^f[d[l&255]],s[u]=s[u]>>>0},N.networkToHostOrderSwap=function(D){return D<<24|(D&65280)<<8|(D&16711680)>>8|D>>>24},N.decrypt=function(D,v,w){for(var R=this.keySize+6,C=this.invKeySchedule,T=this.invSBox,E=this.invSubMix,u=E[0],o=E[1],s=E[2],d=E[3],S=this.uint8ArrayToUint32Array_(w),p=S[0],h=S[1],A=S[2],b=S[3],f=new Int32Array(D),c=new Int32Array(f.length),l,a,g,m,y,M,F,j,W,O,_,K,$,q,ne=this.networkToHostOrderSwap;v<f.length;){for(W=ne(f[v]),O=ne(f[v+1]),_=ne(f[v+2]),K=ne(f[v+3]),y=W^C[0],M=K^C[1],F=_^C[2],j=O^C[3],$=4,q=1;q<R;q++)l=u[y>>>24]^o[M>>16&255]^s[F>>8&255]^d[j&255]^C[$],a=u[M>>>24]^o[F>>16&255]^s[j>>8&255]^d[y&255]^C[$+1],g=u[F>>>24]^o[j>>16&255]^s[y>>8&255]^d[M&255]^C[$+2],m=u[j>>>24]^o[y>>16&255]^s[M>>8&255]^d[F&255]^C[$+3],y=l,M=a,F=g,j=m,$=$+4;l=T[y>>>24]<<24^T[M>>16&255]<<16^T[F>>8&255]<<8^T[j&255]^C[$],a=T[M>>>24]<<24^T[F>>16&255]<<16^T[j>>8&255]<<8^T[y&255]^C[$+1],g=T[F>>>24]<<24^T[j>>16&255]<<16^T[y>>8&255]<<8^T[M&255]^C[$+2],m=T[j>>>24]<<24^T[y>>16&255]<<16^T[M>>8&255]<<8^T[F&255]^C[$+3],c[v]=ne(l^p),c[v+1]=ne(m^h),c[v+2]=ne(g^A),c[v+3]=ne(a^b),p=W,h=O,A=_,b=K,v=v+4}return c.buffer},B}()},"./src/crypt/decrypter.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"default",function(){return v});var G=L("./src/crypt/aes-crypto.ts"),I=L("./src/crypt/fast-aes-key.ts"),P=L("./src/crypt/aes-decryptor.ts"),B=L("./src/utils/logger.ts"),N=L("./src/utils/mp4-tools.ts"),k=L("./src/utils/typed-array.ts"),D=16,v=function(){function w(C,T,E){var u=E===void 0?{}:E,o=u.removePKCS7Padding,s=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=C,this.config=T,this.removePKCS7Padding=s,s)try{var d=self.crypto;d&&(this.subtle=d.subtle||d.webkitSubtle)}catch(S){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var R=w.prototype;return R.destroy=function(){this.observer=null},R.isSync=function(){return this.config.enableSoftwareAES},R.flush=function(){var T=this.currentResult;if(!T){this.reset();return}var E=new Uint8Array(T);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(E):E},R.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},R.decrypt=function(T,E,u,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(T),E,u);var s=this.flush();s&&o(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(T),E,u).then(o)},R.softwareDecrypt=function(T,E,u){var o=this.currentIV,s=this.currentResult,d=this.remainderData;this.logOnce("JS AES decrypt"),d&&(T=Object(N.appendUint8Array)(d,T),this.remainderData=null);var S=this.getValidChunk(T);if(!S.length)return null;o&&(u=o);var p=this.softwareDecrypter;p||(p=this.softwareDecrypter=new P.default),p.expandKey(E);var h=s;return this.currentResult=p.decrypt(S.buffer,0,u),this.currentIV=Object(k.sliceUint8)(S,-16).buffer,h||null},R.webCryptoDecrypt=function(T,E,u){var o=this,s=this.subtle;return(this.key!==E||!this.fastAesKey)&&(this.key=E,this.fastAesKey=new I.default(s,E)),this.fastAesKey.expandKey().then(function(d){if(!s)return Promise.reject(new Error("web crypto not initialized"));var S=new G.default(s,u);return S.decrypt(T.buffer,d)}).catch(function(d){return o.onWebCryptoError(d,T,E,u)})},R.onWebCryptoError=function(T,E,u,o){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",T),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(E,u,o)},R.getValidChunk=function(T){var E=T,u=T.length-T.length%D;return u!==T.length&&(E=Object(k.sliceUint8)(T,0,u),this.remainderData=Object(k.sliceUint8)(T,u)),E},R.logOnce=function(T){if(!this.logEnabled)return;B.logger.log("[decrypter.ts]: "+T),this.logEnabled=!1},w}()},"./src/crypt/fast-aes-key.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"default",function(){return G});var G=function(){function I(B,N){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=N}var P=I.prototype;return P.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},I}()},"./src/demux/aacdemuxer.ts":function(ee,z,L){"use strict";L.r(z);var G=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/adts.ts"),P=L("./src/utils/logger.ts"),B=L("./src/demux/id3.ts");function N(v,w){v.prototype=Object.create(w.prototype),v.prototype.constructor=v,k(v,w)}function k(v,w){return k=Object.setPrototypeOf||function(C,T){return C.__proto__=T,C},k(v,w)}var D=function(v){N(w,v);function w(C,T){var E;return E=v.call(this)||this,E.observer=void 0,E.config=void 0,E.observer=C,E.config=T,E}var R=w.prototype;return R.resetInitSegment=function(T,E,u){v.prototype.resetInitSegment.call(this,T,E,u),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:T,duration:u,inputTimeScale:9e4,dropped:0}},w.probe=function(T){if(!T)return!1;for(var E=B.getID3Data(T,0)||[],u=E.length,o=T.length;u<o;u++)if(I.probe(T,u))return P.logger.log("ADTS sync word found !"),!0;return!1},R.canParse=function(T,E){return I.canParse(T,E)},R.appendFrame=function(T,E,u){I.initTrackConfig(T,this.observer,E,u,T.manifestCodec);var o=I.appendFrame(T,E,u,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},w}(G.default);D.minProbeByteLength=9,z.default=D},"./src/demux/adts.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"getAudioConfig",function(){return B}),L.d(z,"isHeaderPattern",function(){return N}),L.d(z,"getHeaderLength",function(){return k}),L.d(z,"getFullFrameLength",function(){return D}),L.d(z,"canGetFrameLength",function(){return v}),L.d(z,"isHeader",function(){return w}),L.d(z,"canParse",function(){return R}),L.d(z,"probe",function(){return C}),L.d(z,"initTrackConfig",function(){return T}),L.d(z,"getFrameDuration",function(){return E}),L.d(z,"parseFrameHeader",function(){return u}),L.d(z,"appendFrame",function(){return o});var G=L("./src/utils/logger.ts"),I=L("./src/errors.ts"),P=L("./src/events.ts");function B(s,d,S,p){var h,A,b,f,c=navigator.userAgent.toLowerCase(),l=p,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];h=((d[S+2]&192)>>>6)+1;var g=(d[S+2]&60)>>>2;if(g>a.length-1){s.trigger(P.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+g});return}return b=(d[S+2]&1)<<2,b|=(d[S+3]&192)>>>6,G.logger.log("manifest codec:"+p+", ADTS type:"+h+", samplingIndex:"+g),/firefox/i.test(c)?g>=6?(h=5,f=new Array(4),A=g-3):(h=2,f=new Array(2),A=g):c.indexOf("android")!==-1?(h=2,f=new Array(2),A=g):(h=5,f=new Array(4),p&&(p.indexOf("mp4a.40.29")!==-1||p.indexOf("mp4a.40.5")!==-1)||!p&&g>=6?A=g-3:((p&&p.indexOf("mp4a.40.2")!==-1&&(g>=6&&b===1||/vivaldi/i.test(c))||!p&&b===1)&&(h=2,f=new Array(2)),A=g)),f[0]=h<<3,f[0]|=(g&14)>>1,f[1]|=(g&1)<<7,f[1]|=b<<3,h===5&&(f[1]|=(A&14)>>1,f[2]=(A&1)<<7,f[2]|=2<<2,f[3]=0),{config:f,samplerate:a[g],channelCount:b,codec:"mp4a.40."+h,manifestCodec:l}}function N(s,d){return s[d]===255&&(s[d+1]&246)===240}function k(s,d){return s[d+1]&1?7:9}function D(s,d){return(s[d+3]&3)<<11|s[d+4]<<3|(s[d+5]&224)>>>5}function v(s,d){return d+5<s.length}function w(s,d){return d+1<s.length&&N(s,d)}function R(s,d){return v(s,d)&&N(s,d)&&D(s,d)<=s.length-d}function C(s,d){if(w(s,d)){var S=k(s,d);if(d+S>=s.length)return!1;var p=D(s,d);if(p<=S)return!1;var h=d+p;return h===s.length||w(s,h)}return!1}function T(s,d,S,p,h){if(!s.samplerate){var A=B(d,S,p,h);if(!A)return;s.config=A.config,s.samplerate=A.samplerate,s.channelCount=A.channelCount,s.codec=A.codec,s.manifestCodec=A.manifestCodec,G.logger.log("parsed codec:"+s.codec+", rate:"+A.samplerate+", channels:"+A.channelCount)}}function E(s){return 1024*9e4/s}function u(s,d,S,p,h){var A=k(s,d),b=D(s,d);if(b-=A,b>0){var f=S+p*h;return{headerLength:A,frameLength:b,stamp:f}}}function o(s,d,S,p,h){var A=E(s.samplerate),b=u(d,S,p,h,A);if(b){var f=b.frameLength,c=b.headerLength,l=b.stamp,a=c+f,g=Math.max(0,S+a-d.length),m;g?(m=new Uint8Array(a-c),m.set(d.subarray(S+c,d.length),0)):m=d.subarray(S+c,S+a);var y={unit:m,pts:l};return g||s.samples.push(y),{sample:y,length:a,missing:g}}}},"./src/demux/base-audio-demuxer.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"initPTSFn",function(){return D});var G=L("./src/polyfills/number.ts"),I=L("./src/demux/id3.ts"),P=L("./src/demux/dummy-demuxed-track.ts"),B=L("./src/utils/mp4-tools.ts"),N=L("./src/utils/typed-array.ts"),k=function(){function v(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var w=v.prototype;return w.resetInitSegment=function(C,T,E){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},w.resetTimeStamp=function(){},w.resetContiguity=function(){},w.canParse=function(C,T){return!1},w.appendFrame=function(C,T,E){},w.demux=function(C,T){this.cachedData&&(C=Object(B.appendUint8Array)(this.cachedData,C),this.cachedData=null);var E=I.getID3Data(C,0),u=E?E.length:0,o,s,d=this._audioTrack,S=this._id3Track,p=E?I.getTimeStamp(E):void 0,h=C.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=D(p,T)),E&&E.length>0&&S.samples.push({pts:this.initPTS,dts:this.initPTS,data:E}),s=this.initPTS;u<h;){if(this.canParse(C,u)){var A=this.appendFrame(d,C,u);A?(this.frameIndex++,s=A.sample.pts,u+=A.length,o=u):u=h}else I.canParse(C,u)?(E=I.getID3Data(C,u),S.samples.push({pts:s,dts:s,data:E}),u+=E.length,o=u):u++;if(u===h&&o!==h){var b=Object(N.sliceUint8)(C,o);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,b):this.cachedData=b}}return{audioTrack:d,avcTrack:Object(P.dummyTrack)(),id3Track:S,textTrack:Object(P.dummyTrack)()}},w.demuxSampleAes=function(C,T,E){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},w.flush=function(C){var T=this.cachedData;return T&&(this.cachedData=null,this.demux(T,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},w.destroy=function(){},v}(),D=function(w,R){return Object(G.isFiniteNumber)(w)?w*90:R*9e4};z.default=k},"./src/demux/chunk-cache.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"default",function(){return G});var G=function(){function P(){this.chunks=[],this.dataLength=0}var B=P.prototype;return B.push=function(k){this.chunks.push(k),this.dataLength+=k.length},B.flush=function(){var k=this.chunks,D=this.dataLength,v;if(k.length)k.length===1?v=k[0]:v=I(k,D);else return new Uint8Array(0);return this.reset(),v},B.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function I(P,B){for(var N=new Uint8Array(B),k=0,D=0;D<P.length;D++){var v=P[D];N.set(v,k),k+=v.length}return N}},"./src/demux/dummy-demuxed-track.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"dummyTrack",function(){return G});function G(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ee,z,L){"use strict";L.r(z);var G=L("./src/utils/logger.ts"),I=function(){function P(N){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=N,this.bytesAvailable=N.byteLength,this.word=0,this.bitsAvailable=0}var B=P.prototype;return B.loadWord=function(){var k=this.data,D=this.bytesAvailable,v=k.byteLength-D,w=new Uint8Array(4),R=Math.min(4,D);if(R===0)throw new Error("no bytes available");w.set(k.subarray(v,v+R)),this.word=new DataView(w.buffer).getUint32(0),this.bitsAvailable=R*8,this.bytesAvailable-=R},B.skipBits=function(k){var D;this.bitsAvailable>k?(this.word<<=k,this.bitsAvailable-=k):(k-=this.bitsAvailable,D=k>>3,k-=D>>3,this.bytesAvailable-=D,this.loadWord(),this.word<<=k,this.bitsAvailable-=k)},B.readBits=function(k){var D=Math.min(this.bitsAvailable,k),v=this.word>>>32-D;return k>32&&G.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=k-D,D>0&&this.bitsAvailable?v<<D|this.readBits(D):v},B.skipLZ=function(){var k;for(k=0;k<this.bitsAvailable;++k)if((this.word&2147483648>>>k)!==0)return this.word<<=k,this.bitsAvailable-=k,k;return this.loadWord(),k+this.skipLZ()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var k=this.skipLZ();return this.readBits(k+1)-1},B.readEG=function(){var k=this.readUEG();return 1&k?1+k>>>1:-1*(k>>>1)},B.readBoolean=function(){return this.readBits(1)===1},B.readUByte=function(){return this.readBits(8)},B.readUShort=function(){return this.readBits(16)},B.readUInt=function(){return this.readBits(32)},B.skipScalingList=function(k){for(var D=8,v=8,w,R=0;R<k;R++)v!==0&&(w=this.readEG(),v=(D+w+256)%256),D=v===0?D:v},B.readSPS=function(){var k=0,D=0,v=0,w=0,R,C,T,E=this.readUByte.bind(this),u=this.readBits.bind(this),o=this.readUEG.bind(this),s=this.readBoolean.bind(this),d=this.skipBits.bind(this),S=this.skipEG.bind(this),p=this.skipUEG.bind(this),h=this.skipScalingList.bind(this);E();var A=E();if(u(5),d(3),E(),p(),A===100||A===110||A===122||A===244||A===44||A===83||A===86||A===118||A===128){var b=o();if(b===3&&d(1),p(),p(),d(1),s())for(C=b!==3?8:12,T=0;T<C;T++)s()&&(T<6?h(16):h(64))}p();var f=o();if(f===0)o();else if(f===1)for(d(1),S(),S(),R=o(),T=0;T<R;T++)S();p(),d(1);var c=o(),l=o(),a=u(1);a===0&&d(1),d(1),s()&&(k=o(),D=o(),v=o(),w=o());var g=[1,1];if(s()&&s()){var m=E();switch(m){case 1:g=[1,1];break;case 2:g=[12,11];break;case 3:g=[10,11];break;case 4:g=[16,11];break;case 5:g=[40,33];break;case 6:g=[24,11];break;case 7:g=[20,11];break;case 8:g=[32,11];break;case 9:g=[80,33];break;case 10:g=[18,11];break;case 11:g=[15,11];break;case 12:g=[64,33];break;case 13:g=[160,99];break;case 14:g=[4,3];break;case 15:g=[3,2];break;case 16:g=[2,1];break;case 255:{g=[E()<<8|E(),E()<<8|E()];break}}}return{width:Math.ceil((c+1)*16-k*2-D*2),height:(2-a)*(l+1)*16-(a?2:4)*(v+w),pixelRatio:g}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();z.default=I},"./src/demux/id3.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"isHeader",function(){return G}),L.d(z,"isFooter",function(){return I}),L.d(z,"getID3Data",function(){return P}),L.d(z,"canParse",function(){return N}),L.d(z,"getTimeStamp",function(){return k}),L.d(z,"isTimeStampFrame",function(){return D}),L.d(z,"getID3Frames",function(){return w}),L.d(z,"decodeFrame",function(){return R}),L.d(z,"utf8ArrayToStr",function(){return o}),L.d(z,"testables",function(){return s});var G=function(h,A){return A+10<=h.length&&(h[A]===73&&h[A+1]===68&&h[A+2]===51&&(h[A+3]<255&&h[A+4]<255&&(h[A+6]<128&&h[A+7]<128&&h[A+8]<128&&h[A+9]<128)))},I=function(h,A){return A+10<=h.length&&(h[A]===51&&h[A+1]===68&&h[A+2]===73&&(h[A+3]<255&&h[A+4]<255&&(h[A+6]<128&&h[A+7]<128&&h[A+8]<128&&h[A+9]<128)))},P=function(h,A){for(var b=A,f=0;G(h,A);){f+=10;var c=B(h,A+6);f+=c,I(h,A+10)&&(f+=10),A+=f}return f>0?h.subarray(b,b+f):void 0},B=function(h,A){var b=0;return b=(h[A]&127)<<21,b|=(h[A+1]&127)<<14,b|=(h[A+2]&127)<<7,b|=h[A+3]&127,b},N=function(h,A){return G(h,A)&&B(h,A+6)+10<=h.length-A},k=function(h){for(var A=w(h),b=0;b<A.length;b++){var f=A[b];if(D(f))return u(f)}return},D=function(h){return h&&h.key==="PRIV"&&h.info==="com.apple.streaming.transportStreamTimestamp"},v=function(h){var A=String.fromCharCode(h[0],h[1],h[2],h[3]),b=B(h,4),f=10;return{type:A,size:b,data:h.subarray(f,f+b)}},w=function(h){for(var A=0,b=[];G(h,A);){var f=B(h,A+6);A+=10;for(var c=A+f;A+8<c;){var l=v(h.subarray(A)),a=R(l);a&&b.push(a),A+=l.size+10}I(h,A)&&(A+=10)}return b},R=function(h){return h.type==="PRIV"?C(h):h.type[0]==="W"?E(h):T(h)},C=function(h){if(h.size<2)return;var A=o(h.data,!0),b=new Uint8Array(h.data.subarray(A.length+1));return{key:h.type,info:A,data:b.buffer}},T=function(h){if(h.size<2)return;if(h.type==="TXXX"){var A=1,b=o(h.data.subarray(A),!0);A+=b.length+1;var f=o(h.data.subarray(A));return{key:h.type,info:b,data:f}}var c=o(h.data.subarray(1));return{key:h.type,data:c}},E=function(h){if(h.type==="WXXX"){if(h.size<2)return;var A=1,b=o(h.data.subarray(A),!0);A+=b.length+1;var f=o(h.data.subarray(A));return{key:h.type,info:b,data:f}}var c=o(h.data);return{key:h.type,data:c}},u=function(h){if(h.data.byteLength===8){var A=new Uint8Array(h.data),b=A[3]&1,f=(A[4]<<23)+(A[5]<<15)+(A[6]<<7)+A[7];return f/=45,b&&(f+=4772185884e-2),Math.round(f)}return},o=function(h,A){A===void 0&&(A=!1);var b=S();if(b){var f=b.decode(h);if(A){var c=f.indexOf("\0");return c!==-1?f.substring(0,c):f}return f.replace(/\0/g,"")}for(var l=h.length,a,g,m,y="",M=0;M<l;){if(a=h[M++],a===0&&A)return y;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:y+=String.fromCharCode(a);break;case 12:case 13:g=h[M++],y+=String.fromCharCode((a&31)<<6|g&63);break;case 14:g=h[M++],m=h[M++],y+=String.fromCharCode((a&15)<<12|(g&63)<<6|(m&63)<<0);break;default:}}return y},s={decodeTextFrame:T},d;function S(){return!d&&typeof self.TextDecoder!="undefined"&&(d=new self.TextDecoder("utf-8")),d}},"./src/demux/mp3demuxer.ts":function(ee,z,L){"use strict";L.r(z);var G=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/id3.ts"),P=L("./src/utils/logger.ts"),B=L("./src/demux/mpegaudio.ts");function N(v,w){v.prototype=Object.create(w.prototype),v.prototype.constructor=v,k(v,w)}function k(v,w){return k=Object.setPrototypeOf||function(C,T){return C.__proto__=T,C},k(v,w)}var D=function(v){N(w,v);function w(){return v.apply(this,arguments)||this}var R=w.prototype;return R.resetInitSegment=function(T,E,u){v.prototype.resetInitSegment.call(this,T,E,u),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:T,duration:u,inputTimeScale:9e4,dropped:0}},w.probe=function(T){if(!T)return!1;for(var E=I.getID3Data(T,0)||[],u=E.length,o=T.length;u<o;u++)if(B.probe(T,u))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},R.canParse=function(T,E){return B.canParse(T,E)},R.appendFrame=function(T,E,u){return this.initPTS===null?void 0:B.appendFrame(T,E,u,this.initPTS,this.frameIndex)},w}(G.default);D.minProbeByteLength=4,z.default=D},"./src/demux/mp4demuxer.ts":function(ee,z,L){"use strict";L.r(z);var G=L("./src/utils/mp4-tools.ts"),I=L("./src/demux/dummy-demuxed-track.ts"),P=function(){function B(k,D){this.remainderData=null,this.config=void 0,this.config=D}var N=B.prototype;return N.resetTimeStamp=function(){},N.resetInitSegment=function(){},N.resetContiguity=function(){},B.probe=function(D){return Object(G.findBox)({data:D,start:0,end:Math.min(D.length,16384)},["moof"]).length>0},N.demux=function(D){var v=D,w=Object(I.dummyTrack)();if(this.config.progressive){this.remainderData&&(v=Object(G.appendUint8Array)(this.remainderData,D));var R=Object(G.segmentValidRange)(v);this.remainderData=R.remainder,w.samples=R.valid||new Uint8Array}else w.samples=v;return{audioTrack:Object(I.dummyTrack)(),avcTrack:w,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},N.flush=function(){var D=Object(I.dummyTrack)();return D.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(I.dummyTrack)(),avcTrack:D,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},N.demuxSampleAes=function(D,v,w){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},N.destroy=function(){},B}();P.minProbeByteLength=1024,z.default=P},"./src/demux/mpegaudio.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"appendFrame",function(){return k}),L.d(z,"parseHeader",function(){return D}),L.d(z,"isHeaderPattern",function(){return v}),L.d(z,"isHeader",function(){return w}),L.d(z,"canParse",function(){return R}),L.d(z,"probe",function(){return C});var G=null,I=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],P=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],B=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],N=[0,1,1,4];function k(T,E,u,o,s){if(u+24>E.length)return;var d=D(E,u);if(d&&u+d.frameLength<=E.length){var S=d.samplesPerFrame*9e4/d.sampleRate,p=o+s*S,h={unit:E.subarray(u,u+d.frameLength),pts:p,dts:p};return T.config=[],T.channelCount=d.channelCount,T.samplerate=d.sampleRate,T.samples.push(h),{sample:h,length:d.frameLength,missing:0}}}function D(T,E){var u=T[E+1]>>3&3,o=T[E+1]>>1&3,s=T[E+2]>>4&15,d=T[E+2]>>2&3;if(u!==1&&s!==0&&s!==15&&d!==3){var S=T[E+2]>>1&1,p=T[E+3]>>6,h=u===3?3-o:o===3?3:4,A=I[h*14+s-1]*1e3,b=u===3?0:u===2?1:2,f=P[b*3+d],c=p===3?1:2,l=B[u][o],a=N[o],g=l*8*a,m=Math.floor(l*A/f+S)*a;if(G===null){var y=navigator.userAgent||"",M=y.match(/Chrome\/(\d+)/i);G=M?parseInt(M[1]):0}var F=!!G&&G<=87;return F&&o===2&&A>=224e3&&p===0&&(T[E+3]=T[E+3]|128),{sampleRate:f,channelCount:c,frameLength:m,samplesPerFrame:g}}}function v(T,E){return T[E]===255&&(T[E+1]&224)===224&&(T[E+1]&6)!==0}function w(T,E){return E+1<T.length&&v(T,E)}function R(T,E){var u=4;return v(T,E)&&u<=T.length-E}function C(T,E){if(E+1<T.length&&v(T,E)){var u=4,o=D(T,E),s=u;o!=null&&o.frameLength&&(s=o.frameLength);var d=E+s;return d===T.length||w(T,d)}return!1}},"./src/demux/sample-aes.ts":function(ee,z,L){"use strict";L.r(z);var G=L("./src/crypt/decrypter.ts"),I=L("./src/demux/tsdemuxer.ts"),P=function(){function B(k,D,v){this.keyData=void 0,this.decrypter=void 0,this.keyData=v,this.decrypter=new G.default(k,D,{removePKCS7Padding:!1})}var N=B.prototype;return N.decryptBuffer=function(D,v){this.decrypter.decrypt(D,this.keyData.key.buffer,this.keyData.iv.buffer,v)},N.decryptAacSample=function(D,v,w,R){var C=D[v].unit,T=C.subarray(16,C.length-C.length%16),E=T.buffer.slice(T.byteOffset,T.byteOffset+T.length),u=this;this.decryptBuffer(E,function(o){var s=new Uint8Array(o);C.set(s,16),R||u.decryptAacSamples(D,v+1,w)})},N.decryptAacSamples=function(D,v,w){for(;;v++){if(v>=D.length){w();return}if(D[v].unit.length<32)continue;var R=this.decrypter.isSync();if(this.decryptAacSample(D,v,w,R),!R)return}},N.getAvcEncryptedData=function(D){for(var v=Math.floor((D.length-48)/160)*16+16,w=new Int8Array(v),R=0,C=32;C<=D.length-16;C+=160,R+=16)w.set(D.subarray(C,C+16),R);return w},N.getAvcDecryptedUnit=function(D,v){for(var w=new Uint8Array(v),R=0,C=32;C<=D.length-16;C+=160,R+=16)D.set(w.subarray(R,R+16),C);return D},N.decryptAvcSample=function(D,v,w,R,C,T){var E=Object(I.discardEPB)(C.data),u=this.getAvcEncryptedData(E),o=this;this.decryptBuffer(u.buffer,function(s){C.data=o.getAvcDecryptedUnit(E,s),T||o.decryptAvcSamples(D,v,w+1,R)})},N.decryptAvcSamples=function(D,v,w,R){if(D instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;v++,w=0){if(v>=D.length){R();return}for(var C=D[v].units;!(w>=C.length);w++){var T=C[w];if(T.data.length<=48||T.type!==1&&T.type!==5)continue;var E=this.decrypter.isSync();if(this.decryptAvcSample(D,v,w,R,T,E),!E)return}}},B}();z.default=P},"./src/demux/transmuxer-interface.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"default",function(){return C});var G=L("./node_modules/webworkify-webpack/index.js"),I=L.n(G),P=L("./src/events.ts"),B=L("./src/demux/transmuxer.ts"),N=L("./src/utils/logger.ts"),k=L("./src/errors.ts"),D=L("./src/utils/mediasource-helper.ts"),v=L("./node_modules/eventemitter3/index.js"),w=L.n(v),R=Object(D.getMediaSource)()||{isTypeSupported:function(){return!1}},C=function(){function T(u,o,s,d){var S=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=u,this.id=o,this.onTransmuxComplete=s,this.onFlush=d;var p=u.config,h=function(l,a){a=a||{},a.frag=S.frag,a.id=S.id,u.trigger(l,a)};this.observer=new v.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,h),this.observer.on(P.Events.ERROR,h);var A={mp4:R.isTypeSupported("video/mp4"),mpeg:R.isTypeSupported("audio/mpeg"),mp3:R.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(p.enableWorker&&typeof Worker!="undefined"){N.logger.log("demuxing in webworker");var f;try{f=this.worker=G("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),f.addEventListener("message",this.onwmsg),f.onerror=function(c){u.trigger(P.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},f.postMessage({cmd:"init",typeSupported:A,vendor:b,id:o,config:JSON.stringify(p)})}catch(c){N.logger.warn("Error in worker:",c),N.logger.error("Error while initializing DemuxerWorker, fallback to inline"),f&&self.URL.revokeObjectURL(f.objectURL),this.transmuxer=new B.default(this.observer,A,p,b,o),this.worker=null}}else this.transmuxer=new B.default(this.observer,A,p,b,o)}var E=T.prototype;return E.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var d=this.observer;d&&d.removeAllListeners(),this.observer=null},E.push=function(o,s,d,S,p,h,A,b,f,c){var l=this;f.transmuxing.start=self.performance.now();var a=this.transmuxer,g=this.worker,m=h?h.start:p.start,y=p.decryptdata,M=this.frag,F=!(M&&p.cc===M.cc),j=!(M&&f.level===M.level),W=M?f.sn-M.sn:-1,O=this.part?f.part-this.part.index:1,_=!j&&(W===1||W===0&&O===1),K=self.performance.now();(j||W||p.stats.parsing.start===0)&&(p.stats.parsing.start=K),h&&(O||!_)&&(h.stats.parsing.start=K);var $=new B.TransmuxState(F,_,b,j,m);if(!_||F){N.logger.log("[transmuxer-interface, "+p.type+"]: Starting new transmux session for sn: "+f.sn+" p: "+f.part+" level: "+f.level+" id: "+f.id+`
|
|
discontinuity: `+F+`
|
|
trackSwitch: `+j+`
|
|
contiguous: `+_+`
|
|
accurateTimeOffset: `+b+`
|
|
timeOffset: `+m);var q=new B.TransmuxConfig(d,S,s,A,c);this.configureTransmuxer(q)}if(this.frag=p,this.part=h,g)g.postMessage({cmd:"demux",data:o,decryptdata:y,chunkMeta:f,state:$},o instanceof ArrayBuffer?[o]:[]);else if(a){var ne=a.push(o,y,f,$);Object(B.isPromise)(ne)?ne.then(function(Te){l.handleTransmuxComplete(Te)}):this.handleTransmuxComplete(ne)}},E.flush=function(o){var s=this;o.transmuxing.start=self.performance.now();var d=this.transmuxer,S=this.worker;if(S)S.postMessage({cmd:"flush",chunkMeta:o});else if(d){var p=d.flush(o);Object(B.isPromise)(p)?p.then(function(h){s.handleFlushResult(h,o)}):this.handleFlushResult(p,o)}},E.handleFlushResult=function(o,s){var d=this;o.forEach(function(S){d.handleTransmuxComplete(S)}),this.onFlush(s)},E.onWorkerMessage=function(o){var s=o.data,d=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,d.trigger(s.event,s.data);break}}},E.configureTransmuxer=function(o){var s=this.worker,d=this.transmuxer;s?s.postMessage({cmd:"configure",config:o}):d&&d.configure(o)},E.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},T}()},"./src/demux/transmuxer-worker.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"default",function(){return k});var G=L("./src/demux/transmuxer.ts"),I=L("./src/events.ts"),P=L("./src/utils/logger.ts"),B=L("./node_modules/eventemitter3/index.js"),N=L.n(B);function k(C){var T=new B.EventEmitter,E=function(o,s){C.postMessage({event:o,data:s})};T.on(I.Events.FRAG_DECRYPTED,E),T.on(I.Events.ERROR,E),C.addEventListener("message",function(u){var o=u.data;switch(o.cmd){case"init":{var s=JSON.parse(o.config);C.transmuxer=new G.default(T,o.typeSupported,s,o.vendor,o.id),Object(P.enableLogs)(s.debug),E("init",null);break}case"configure":{C.transmuxer.configure(o.config);break}case"demux":{var d=C.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(G.isPromise)(d)?d.then(function(h){D(C,h)}):D(C,d);break}case"flush":{var S=o.chunkMeta,p=C.transmuxer.flush(S);Object(G.isPromise)(p)?p.then(function(h){w(C,h,S)}):w(C,p,S);break}default:break}})}function D(C,T){if(R(T.remuxResult))return;var E=[],u=T.remuxResult,o=u.audio,s=u.video;o&&v(E,o),s&&v(E,s),C.postMessage({event:"transmuxComplete",data:T},E)}function v(C,T){T.data1&&C.push(T.data1.buffer),T.data2&&C.push(T.data2.buffer)}function w(C,T,E){T.forEach(function(u){D(C,u)}),C.postMessage({event:"flush",data:E})}function R(C){return!C.audio&&!C.video&&!C.text&&!C.id3&&!C.initSegment}},"./src/demux/transmuxer.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"default",function(){return s}),L.d(z,"isPromise",function(){return p}),L.d(z,"TransmuxConfig",function(){return h}),L.d(z,"TransmuxState",function(){return A});var G=L("./src/events.ts"),I=L("./src/errors.ts"),P=L("./src/crypt/decrypter.ts"),B=L("./src/demux/aacdemuxer.ts"),N=L("./src/demux/mp4demuxer.ts"),k=L("./src/demux/tsdemuxer.ts"),D=L("./src/demux/mp3demuxer.ts"),v=L("./src/remux/mp4-remuxer.ts"),w=L("./src/remux/passthrough-remuxer.ts"),R=L("./src/demux/chunk-cache.ts"),C=L("./src/utils/mp4-tools.ts"),T=L("./src/utils/logger.ts"),E;try{E=self.performance.now.bind(self.performance)}catch(b){T.logger.debug("Unable to use Performance API on this environment"),E=self.Date.now}var u=[{demux:k.default,remux:v.default},{demux:N.default,remux:w.default},{demux:B.default,remux:v.default},{demux:D.default,remux:v.default}],o=1024;u.forEach(function(b){var f=b.demux;o=Math.max(o,f.minProbeByteLength)});var s=function(){function b(c,l,a,g,m){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 R.default,this.observer=c,this.typeSupported=l,this.config=a,this.vendor=g,this.id=m}var f=b.prototype;return f.configure=function(l){this.transmuxConfig=l,this.decrypter&&this.decrypter.reset()},f.push=function(l,a,g,m){var y=this,M=g.transmuxing;M.executeStart=E();var F=new Uint8Array(l),j=this.cache,W=this.config,O=this.currentTransmuxState,_=this.transmuxConfig;m&&(this.currentTransmuxState=m);var K=d(F,a);if(K&&K.method==="AES-128"){var $=this.getDecrypter();if(W.enableSoftwareAES){var q=$.softwareDecrypt(F,K.key.buffer,K.iv.buffer);if(!q)return M.executeEnd=E(),S(g);F=new Uint8Array(q)}else return this.decryptionPromise=$.webCryptoDecrypt(F,K.key.buffer,K.iv.buffer).then(function(Se){var Oe=y.push(Se,null,g);return y.decryptionPromise=null,Oe}),this.decryptionPromise}var ne=m||O,Te=ne.contiguous,ve=ne.discontinuity,ge=ne.trackSwitch,ce=ne.accurateTimeOffset,he=ne.timeOffset,oe=_.audioCodec,pe=_.videoCodec,Y=_.defaultInitPts,ae=_.duration,Z=_.initSegmentData;if((ve||ge)&&this.resetInitSegment(Z,oe,pe,ae),ve&&this.resetInitialTimestamp(Y),Te||this.resetContiguity(),this.needsProbing(F,ve,ge)){if(j.dataLength){var xe=j.flush();F=Object(C.appendUint8Array)(xe,F)}this.configureTransmuxer(F,_)}var we=this.transmux(F,K,he,ce,g),ye=this.currentTransmuxState;return ye.contiguous=!0,ye.discontinuity=!1,ye.trackSwitch=!1,M.executeEnd=E(),we},f.flush=function(l){var a=this,g=l.transmuxing;g.executeStart=E();var m=this.decrypter,y=this.cache,M=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return a.flush(l)});var j=[],W=M.timeOffset;if(m){var O=m.flush();O&&j.push(this.push(O,null,l))}var _=y.dataLength;y.reset();var K=this.demuxer,$=this.remuxer;if(!K||!$)return _>=o&&this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),g.executeEnd=E(),[S(l)];var q=K.flush(W);return p(q)?q.then(function(ne){return a.flushRemux(j,ne,l),j}):(this.flushRemux(j,q,l),j)},f.flushRemux=function(l,a,g){var m=a.audioTrack,y=a.avcTrack,M=a.id3Track,F=a.textTrack,j=this.currentTransmuxState,W=j.accurateTimeOffset,O=j.timeOffset;T.logger.log("[transmuxer.ts]: Flushed fragment "+g.sn+(g.part>-1?" p: "+g.part:"")+" of level "+g.level);var _=this.remuxer.remux(m,y,M,F,O,W,!0,this.id);l.push({remuxResult:_,chunkMeta:g}),g.transmuxing.executeEnd=E()},f.resetInitialTimestamp=function(l){var a=this.demuxer,g=this.remuxer;if(!a||!g)return;a.resetTimeStamp(l),g.resetTimeStamp(l)},f.resetContiguity=function(){var l=this.demuxer,a=this.remuxer;if(!l||!a)return;l.resetContiguity(),a.resetNextTimestamp()},f.resetInitSegment=function(l,a,g,m){var y=this.demuxer,M=this.remuxer;if(!y||!M)return;y.resetInitSegment(a,g,m),M.resetInitSegment(l,a,g)},f.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},f.transmux=function(l,a,g,m,y){var M;return a&&a.method==="SAMPLE-AES"?M=this.transmuxSampleAes(l,a,g,m,y):M=this.transmuxUnencrypted(l,g,m,y),M},f.transmuxUnencrypted=function(l,a,g,m){var y=this.demuxer.demux(l,a,!1,!this.config.progressive),M=y.audioTrack,F=y.avcTrack,j=y.id3Track,W=y.textTrack,O=this.remuxer.remux(M,F,j,W,a,g,!1,this.id);return{remuxResult:O,chunkMeta:m}},f.transmuxSampleAes=function(l,a,g,m,y){var M=this;return this.demuxer.demuxSampleAes(l,a,g).then(function(F){var j=M.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,g,m,!1,M.id);return{remuxResult:j,chunkMeta:y}})},f.configureTransmuxer=function(l,a){for(var g=this.config,m=this.observer,y=this.typeSupported,M=this.vendor,F=a.audioCodec,j=a.defaultInitPts,W=a.duration,O=a.initSegmentData,_=a.videoCodec,K,$=0,q=u.length;$<q;$++)if(u[$].demux.probe(l)){K=u[$];break}K||(T.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),K={demux:N.default,remux:w.default});var ne=this.demuxer,Te=this.remuxer,ve=K.remux,ge=K.demux;(!Te||!(Te instanceof ve))&&(this.remuxer=new ve(m,g,y,M)),(!ne||!(ne instanceof ge))&&(this.demuxer=new ge(m,g,y),this.probe=ge.probe),this.resetInitSegment(O,F,_,W),this.resetInitialTimestamp(j)},f.needsProbing=function(l,a,g){return!this.demuxer||!this.remuxer||a||g},f.getDecrypter=function(){var l=this.decrypter;return l||(l=this.decrypter=new P.default(this.observer,this.config)),l},b}();function d(b,f){var c=null;return b.byteLength>0&&f!=null&&f.key!=null&&f.iv!==null&&f.method!=null&&(c=f),c}var S=function(f){return{remuxResult:{},chunkMeta:f}};function p(b){return"then"in b&&b.then instanceof Function}var h=function(f,c,l,a,g){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=f,this.videoCodec=c,this.initSegmentData=l,this.duration=a,this.defaultInitPts=g},A=function(f,c,l,a,g){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=f,this.contiguous=c,this.accurateTimeOffset=l,this.trackSwitch=a,this.timeOffset=g}},"./src/demux/tsdemuxer.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"discardEPB",function(){return S});var G=L("./src/demux/adts.ts"),I=L("./src/demux/mpegaudio.ts"),P=L("./src/demux/exp-golomb.ts"),B=L("./src/demux/id3.ts"),N=L("./src/demux/sample-aes.ts"),k=L("./src/events.ts"),D=L("./src/utils/mp4-tools.ts"),v=L("./src/utils/logger.ts"),w=L("./src/errors.ts"),R={video:1,audio:2,id3:3,text:4},C=function(){function p(A,b,f){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=A,this.config=b,this.typeSupported=f}p.probe=function(b){var f=p.syncOffset(b);return f<0?!1:(f&&v.logger.warn("MPEG2-TS detected but first sync word found @ offset "+f+", junk ahead ?"),!0)},p.syncOffset=function(b){for(var f=Math.min(1e3,b.length-3*188),c=0;c<f;){if(b[c]===71&&b[c+188]===71&&b[c+2*188]===71)return c;c++}return-1},p.createTrack=function(b,f){return{container:b==="video"||b==="audio"?"video/mp2t":void 0,type:b,id:R[b],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:b==="audio"?f:void 0}};var h=p.prototype;return h.resetInitSegment=function(b,f,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=p.createTrack("video",c),this._audioTrack=p.createTrack("audio",c),this._id3Track=p.createTrack("id3",c),this._txtTrack=p.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=b,this.videoCodec=f,this._duration=c},h.resetTimeStamp=function(){},h.resetContiguity=function(){var b=this._audioTrack,f=this._avcTrack,c=this._id3Track;b&&(b.pesData=null),f&&(f.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},h.demux=function(b,f,c,l){c===void 0&&(c=!1),l===void 0&&(l=!1),c||(this.sampleAes=null);var a,g=this._avcTrack,m=this._audioTrack,y=this._id3Track,M=g.pid,F=g.pesData,j=m.pid,W=y.pid,O=m.pesData,_=y.pesData,K=!1,$=this.pmtParsed,q=this._pmtId,ne=b.length;if(this.remainderData&&(b=Object(D.appendUint8Array)(this.remainderData,b),ne=b.length,this.remainderData=null),ne<188&&!l)return this.remainderData=b,{audioTrack:m,avcTrack:g,id3Track:y,textTrack:this._txtTrack};var Te=Math.max(0,p.syncOffset(b));ne-=(ne+Te)%188,ne<b.byteLength&&!l&&(this.remainderData=new Uint8Array(b.buffer,ne,b.buffer.byteLength-ne));for(var ve=Te;ve<ne;ve+=188)if(b[ve]===71){var ge=!!(b[ve+1]&64),ce=((b[ve+1]&31)<<8)+b[ve+2],he=(b[ve+3]&48)>>4,oe=void 0;if(he>1){if(oe=ve+5+b[ve+4],oe===ve+188)continue}else oe=ve+4;switch(ce){case M:ge&&(F&&(a=o(F))&&this.parseAVCPES(a,!1),F={data:[],size:0}),F&&(F.data.push(b.subarray(oe,ve+188)),F.size+=ve+188-oe);break;case j:ge&&(O&&(a=o(O))&&(m.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),O={data:[],size:0}),O&&(O.data.push(b.subarray(oe,ve+188)),O.size+=ve+188-oe);break;case W:ge&&(_&&(a=o(_))&&this.parseID3PES(a),_={data:[],size:0}),_&&(_.data.push(b.subarray(oe,ve+188)),_.size+=ve+188-oe);break;case 0:ge&&(oe+=b[oe]+1),q=this._pmtId=E(b,oe);break;case q:{ge&&(oe+=b[oe]+1);var pe=u(b,oe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);M=pe.avc,M>0&&(g.pid=M),j=pe.audio,j>0&&(m.pid=j,m.isAAC=pe.isAAC),W=pe.id3,W>0&&(y.pid=W),K&&!$&&(v.logger.log("reparse from beginning"),K=!1,ve=Te-188),$=this.pmtParsed=!0;break}case 17:case 8191:break;default:K=!0;break}}else this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});g.pesData=F,m.pesData=O,y.pesData=_;var Y={audioTrack:m,avcTrack:g,id3Track:y,textTrack:this._txtTrack};return l&&this.extractRemainingSamples(Y),Y},h.flush=function(){var b=this.remainderData;this.remainderData=null;var f;return b?f=this.demux(b,-1,!1,!0):f={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(f),this.sampleAes?this.decrypt(f,this.sampleAes):f},h.extractRemainingSamples=function(b){var f=b.audioTrack,c=b.avcTrack,l=b.id3Track,a=c.pesData,g=f.pesData,m=l.pesData,y;a&&(y=o(a))?(this.parseAVCPES(y,!0),c.pesData=null):c.pesData=a,g&&(y=o(g))?(f.isAAC?this.parseAACPES(y):this.parseMPEGPES(y),f.pesData=null):(g!=null&&g.size&&v.logger.log("last AAC PES packet truncated,might overlap between fragments"),f.pesData=g),m&&(y=o(m))?(this.parseID3PES(y),l.pesData=null):l.pesData=m},h.demuxSampleAes=function(b,f,c){var l=this.demux(b,c,!0,!this.config.progressive),a=this.sampleAes=new N.default(this.observer,this.config,f);return this.decrypt(l,a)},h.decrypt=function(b,f){return new Promise(function(c){var l=b.audioTrack,a=b.avcTrack;l.samples&&l.isAAC?f.decryptAacSamples(l.samples,0,function(){a.samples?f.decryptAvcSamples(a.samples,0,0,function(){c(b)}):c(b)}):a.samples&&f.decryptAvcSamples(a.samples,0,0,function(){c(b)})})},h.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},h.parseAVCPES=function(b,f){var c=this,l=this._avcTrack,a=this.parseAVCNALu(b.data),g=!1,m=this.avcSample,y,M=!1;b.data=null,m&&a.length&&!l.audFound&&(s(m,l),m=this.avcSample=T(!1,b.pts,b.dts,"")),a.forEach(function(F){switch(F.type){case 1:{y=!0,m||(m=c.avcSample=T(!0,b.pts,b.dts,"")),g&&(m.debug+="NDR "),m.frame=!0;var j=F.data;if(M&&j.length>4){var W=new P.default(j).readSliceType();(W===2||W===4||W===7||W===9)&&(m.key=!0)}break}case 5:y=!0,m||(m=c.avcSample=T(!0,b.pts,b.dts,"")),g&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{y=!0,g&&m&&(m.debug+="SEI ");var O=new P.default(S(F.data));O.readUByte();for(var _=0,K=0,$=!1,q=0;!$&&O.bytesAvailable>1;){_=0;do q=O.readUByte(),_+=q;while(q===255);K=0;do q=O.readUByte(),K+=q;while(q===255);if(_===4&&O.bytesAvailable!==0){$=!0;var ne=O.readUByte();if(ne===181){var Te=O.readUShort();if(Te===49){var ve=O.readUInt();if(ve===1195456820){var ge=O.readUByte();if(ge===3){for(var ce=O.readUByte(),he=O.readUByte(),oe=31&ce,pe=[ce,he],Y=0;Y<oe;Y++)pe.push(O.readUByte()),pe.push(O.readUByte()),pe.push(O.readUByte());d(c._txtTrack.samples,{type:3,pts:b.pts,bytes:pe})}}}}}else if(_===5&&O.bytesAvailable!==0){if($=!0,K>16){for(var ae=[],Z=0;Z<16;Z++)ae.push(O.readUByte().toString(16)),(Z===3||Z===5||Z===7||Z===9)&&ae.push("-");for(var xe=K-16,we=new Uint8Array(xe),ye=0;ye<xe;ye++)we[ye]=O.readUByte();d(c._txtTrack.samples,{pts:b.pts,payloadType:_,uuid:ae.join(""),userData:Object(B.utf8ArrayToStr)(we),userDataBytes:we})}}else if(K<O.bytesAvailable)for(var Se=0;Se<K;Se++)O.readUByte()}break}case 7:if(y=!0,M=!0,g&&m&&(m.debug+="SPS "),!l.sps){var Oe=new P.default(F.data),Pe=Oe.readSPS();l.width=Pe.width,l.height=Pe.height,l.pixelRatio=Pe.pixelRatio,l.sps=[F.data],l.duration=c._duration;for(var _e=F.data.subarray(1,4),De="avc1.",Le=0;Le<3;Le++){var Ue=_e[Le].toString(16);Ue.length<2&&(Ue="0"+Ue),De+=Ue}l.codec=De}break;case 8:y=!0,g&&m&&(m.debug+="PPS "),l.pps||(l.pps=[F.data]);break;case 9:y=!1,l.audFound=!0,m&&s(m,l),m=c.avcSample=T(!1,b.pts,b.dts,g?"AUD ":"");break;case 12:y=!1;break;default:y=!1,m&&(m.debug+="unknown NAL "+F.type+" ");break}if(m&&y){var Ve=m.units;Ve.push(F)}}),f&&m&&(s(m,l),this.avcSample=null)},h.getLastNalUnit=function(){var b,f=this.avcSample,c;if(!f||f.units.length===0){var l=this._avcTrack.samples;f=l[l.length-1]}if((b=f)!==null&&b!==void 0&&b.units){var a=f.units;c=a[a.length-1]}return c},h.parseAVCNALu=function(b){var f=b.byteLength,c=this._avcTrack,l=c.naluState||0,a=l,g=[],m=0,y,M,F,j=-1,W=0;for(l===-1&&(j=0,W=b[0]&31,l=0,m=1);m<f;){if(y=b[m++],!l){l=y?0:1;continue}if(l===1){l=y?0:2;continue}if(!y)l=3;else if(y===1){if(j>=0){var O={data:b.subarray(j,m-l-1),type:W};g.push(O)}else{var _=this.getLastNalUnit();if(_&&(a&&m<=4-a&&(_.state&&(_.data=_.data.subarray(0,_.data.byteLength-a))),M=m-l-1,M>0)){var K=new Uint8Array(_.data.byteLength+M);K.set(_.data,0),K.set(b.subarray(0,M),_.data.byteLength),_.data=K,_.state=0}}m<f?(F=b[m]&31,j=m,W=F,l=0):l=-1}else l=0}if(j>=0&&l>=0){var $={data:b.subarray(j,f),type:W,state:l};g.push($)}if(g.length===0){var q=this.getLastNalUnit();if(q){var ne=new Uint8Array(q.data.byteLength+b.byteLength);ne.set(q.data,0),ne.set(b,q.data.byteLength),q.data=ne}}return c.naluState=l,g},h.parseAACPES=function(b){var f=0,c=this._audioTrack,l=this.aacOverFlow,a=b.data;if(l){this.aacOverFlow=null;var g=l.sample.unit.byteLength,m=Math.min(l.missing,g),y=g-m;l.sample.unit.set(a.subarray(0,m),y),c.samples.push(l.sample),f=l.missing}var M,F;for(M=f,F=a.length;M<F-1&&!G.isHeader(a,M);M++);if(M!==f){var j,W;if(M<F-1?(j="AAC PES did not start with ADTS header,offset:"+M,W=!1):(j="no ADTS header found in AAC PES",W=!0),v.logger.warn("parsing error:"+j),this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:j}),W)return}G.initTrackConfig(c,this.observer,a,M,this.audioCodec);var O;if(b.pts!==void 0)O=b.pts;else if(l){var _=G.getFrameDuration(c.samplerate);O=l.sample.pts+_}else{v.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var K=0;M<F;)if(G.isHeader(a,M)){if(M+5<F){var $=G.appendFrame(c,a,M,O,K);if($)if($.missing)this.aacOverFlow=$;else{M+=$.length,K++;continue}}break}else M++},h.parseMPEGPES=function(b){var f=b.data,c=f.length,l=0,a=0,g=b.pts;if(g===void 0){v.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(I.isHeader(f,a)){var m=I.appendFrame(this._audioTrack,f,a,g,l);if(m)a+=m.length,l++;else break}else a++},h.parseID3PES=function(b){if(b.pts===void 0){v.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(b)},p}();C.minProbeByteLength=188;function T(p,h,A,b){return{key:p,frame:!1,pts:h,dts:A,units:[],debug:b,length:0}}function E(p,h){return(p[h+10]&31)<<8|p[h+11]}function u(p,h,A,b){var f={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(p[h+1]&15)<<8|p[h+2],l=h+3+c-4,a=(p[h+10]&15)<<8|p[h+11];for(h+=12+a;h<l;){var g=(p[h+1]&31)<<8|p[h+2];switch(p[h]){case 207:if(!b){v.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:f.audio===-1&&(f.audio=g);break;case 21:f.id3===-1&&(f.id3=g);break;case 219:if(!b){v.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:f.avc===-1&&(f.avc=g);break;case 3:case 4:A?f.audio===-1&&(f.audio=g,f.isAAC=!1):v.logger.log("MPEG audio found, not supported in this browser");break;case 36:v.logger.warn("Unsupported HEVC stream type found");break;default:break}h+=((p[h+3]&15)<<8|p[h+4])+5}return f}function o(p){var h=0,A,b,f,c,l,a=p.data;if(!p||p.size===0)return null;for(;a[0].length<19&&a.length>1;){var g=new Uint8Array(a[0].length+a[1].length);g.set(a[0]),g.set(a[1],a[0].length),a[0]=g,a.splice(1,1)}A=a[0];var m=(A[0]<<16)+(A[1]<<8)+A[2];if(m===1){if(b=(A[4]<<8)+A[5],b&&b>p.size-6)return null;var y=A[7];y&192&&(c=(A[9]&14)*536870912+(A[10]&255)*4194304+(A[11]&254)*16384+(A[12]&255)*128+(A[13]&254)/2,y&64?(l=(A[14]&14)*536870912+(A[15]&255)*4194304+(A[16]&254)*16384+(A[17]&255)*128+(A[18]&254)/2,c-l>60*9e4&&(v.logger.warn(Math.round((c-l)/9e4)+"s delta between PTS and DTS, align them"),c=l)):l=c),f=A[8];var M=f+9;if(p.size<=M)return null;p.size-=M;for(var F=new Uint8Array(p.size),j=0,W=a.length;j<W;j++){A=a[j];var O=A.byteLength;if(M)if(M>O){M-=O;continue}else A=A.subarray(M),O-=M,M=0;F.set(A,h),h+=O}return b&&(b-=f+3),{data:F,pts:c,dts:l,len:b}}return null}function s(p,h){if(p.units.length&&p.frame){if(p.pts===void 0){var A=h.samples,b=A.length;if(b){var f=A[b-1];p.pts=f.pts,p.dts=f.dts}else{h.dropped++;return}}h.samples.push(p)}p.debug.length&&v.logger.log(p.pts+"/"+p.dts+":"+p.debug)}function d(p,h){var A=p.length;if(A>0){if(h.pts>=p[A-1].pts)p.push(h);else for(var b=A-1;b>=0;b--)if(h.pts<p[b].pts){p.splice(b,0,h);break}}else p.push(h)}function S(p){for(var h=p.byteLength,A=[],b=1;b<h-2;)p[b]===0&&p[b+1]===0&&p[b+2]===3?(A.push(b+2),b+=2):b++;if(A.length===0)return p;var f=h-A.length,c=new Uint8Array(f),l=0;for(b=0;b<f;l++,b++)l===A[0]&&(l++,A.shift()),c[b]=p[l];return c}z.default=C},"./src/errors.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"ErrorTypes",function(){return G}),L.d(z,"ErrorDetails",function(){return I});var G;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(G||(G={}));var I;(function(P){P.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",P.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",P.KEY_SYSTEM_NO_SESSION="keySystemNoSession",P.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",P.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",P.MANIFEST_LOAD_ERROR="manifestLoadError",P.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",P.MANIFEST_PARSING_ERROR="manifestParsingError",P.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",P.LEVEL_EMPTY_ERROR="levelEmptyError",P.LEVEL_LOAD_ERROR="levelLoadError",P.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",P.LEVEL_SWITCH_ERROR="levelSwitchError",P.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",P.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",P.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",P.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",P.FRAG_LOAD_ERROR="fragLoadError",P.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",P.FRAG_DECRYPT_ERROR="fragDecryptError",P.FRAG_PARSING_ERROR="fragParsingError",P.REMUX_ALLOC_ERROR="remuxAllocError",P.KEY_LOAD_ERROR="keyLoadError",P.KEY_LOAD_TIMEOUT="keyLoadTimeOut",P.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",P.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",P.BUFFER_APPEND_ERROR="bufferAppendError",P.BUFFER_APPENDING_ERROR="bufferAppendingError",P.BUFFER_STALLED_ERROR="bufferStalledError",P.BUFFER_FULL_ERROR="bufferFullError",P.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",P.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",P.INTERNAL_EXCEPTION="internalException",P.INTERNAL_ABORTED="aborted",P.UNKNOWN="unknown"})(I||(I={}))},"./src/events.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"Events",function(){return G});var G;(function(I){I.MEDIA_ATTACHING="hlsMediaAttaching",I.MEDIA_ATTACHED="hlsMediaAttached",I.MEDIA_DETACHING="hlsMediaDetaching",I.MEDIA_DETACHED="hlsMediaDetached",I.BUFFER_RESET="hlsBufferReset",I.BUFFER_CODECS="hlsBufferCodecs",I.BUFFER_CREATED="hlsBufferCreated",I.BUFFER_APPENDING="hlsBufferAppending",I.BUFFER_APPENDED="hlsBufferAppended",I.BUFFER_EOS="hlsBufferEos",I.BUFFER_FLUSHING="hlsBufferFlushing",I.BUFFER_FLUSHED="hlsBufferFlushed",I.MANIFEST_LOADING="hlsManifestLoading",I.MANIFEST_LOADED="hlsManifestLoaded",I.MANIFEST_PARSED="hlsManifestParsed",I.LEVEL_SWITCHING="hlsLevelSwitching",I.LEVEL_SWITCHED="hlsLevelSwitched",I.LEVEL_LOADING="hlsLevelLoading",I.LEVEL_LOADED="hlsLevelLoaded",I.LEVEL_UPDATED="hlsLevelUpdated",I.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",I.LEVELS_UPDATED="hlsLevelsUpdated",I.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",I.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",I.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",I.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",I.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",I.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",I.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",I.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",I.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",I.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",I.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",I.CUES_PARSED="hlsCuesParsed",I.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",I.INIT_PTS_FOUND="hlsInitPtsFound",I.FRAG_LOADING="hlsFragLoading",I.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",I.FRAG_LOADED="hlsFragLoaded",I.FRAG_DECRYPTED="hlsFragDecrypted",I.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",I.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",I.FRAG_PARSING_METADATA="hlsFragParsingMetadata",I.FRAG_PARSED="hlsFragParsed",I.FRAG_BUFFERED="hlsFragBuffered",I.FRAG_CHANGED="hlsFragChanged",I.FPS_DROP="hlsFpsDrop",I.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",I.ERROR="hlsError",I.DESTROYING="hlsDestroying",I.KEY_LOADING="hlsKeyLoading",I.KEY_LOADED="hlsKeyLoaded",I.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",I.BACK_BUFFER_REACHED="hlsBackBufferReached"})(G||(G={}))},"./src/hls.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"default",function(){return p});var G=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(G),P=L("./src/loader/playlist-loader.ts"),B=L("./src/loader/key-loader.ts"),N=L("./src/controller/id3-track-controller.ts"),k=L("./src/controller/latency-controller.ts"),D=L("./src/controller/level-controller.ts"),v=L("./src/controller/fragment-tracker.ts"),w=L("./src/controller/stream-controller.ts"),R=L("./src/is-supported.ts"),C=L("./src/utils/logger.ts"),T=L("./src/config.ts"),E=L("./node_modules/eventemitter3/index.js"),u=L.n(E),o=L("./src/events.ts"),s=L("./src/errors.ts");function d(h,A){for(var b=0;b<A.length;b++){var f=A[b];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(h,f.key,f)}}function S(h,A,b){return A&&d(h.prototype,A),b&&d(h,b),h}var p=function(){h.isSupported=function(){return Object(R.isSupported)()};function h(b){b===void 0&&(b={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new E.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var f=this.config=Object(T.mergeConfig)(h.DefaultConfig,b);this.userConfig=b,Object(C.enableLogs)(f.debug),this._autoLevelCapping=-1,f.progressive&&Object(T.enableStreamingMode)(f);var c=f.abrController,l=f.bufferController,a=f.capLevelController,g=f.fpsController,m=this.abrController=new c(this),y=this.bufferController=new l(this),M=this.capLevelController=new a(this),F=new g(this),j=new P.default(this),W=new B.default(this),O=new N.default(this),_=this.levelController=new D.default(this),K=new v.FragmentTracker(this),$=this.streamController=new w.default(this,K);M.setStreamController($),F.setStreamController($);var q=[_,$];this.networkControllers=q;var ne=[j,W,m,y,M,F,O,K];this.audioTrackController=this.createController(f.audioTrackController,null,q),this.createController(f.audioStreamController,K,q),this.subtitleTrackController=this.createController(f.subtitleTrackController,null,q),this.createController(f.subtitleStreamController,K,q),this.createController(f.timelineController,null,ne),this.emeController=this.createController(f.emeController,null,ne),this.cmcdController=this.createController(f.cmcdController,null,ne),this.latencyController=this.createController(k.default,null,ne),this.coreComponents=ne}var A=h.prototype;return A.createController=function(f,c,l){if(f){var a=c?new f(this,c):new f(this);return l&&l.push(a),a}return null},A.on=function(f,c,l){l===void 0&&(l=this),this._emitter.on(f,c,l)},A.once=function(f,c,l){l===void 0&&(l=this),this._emitter.once(f,c,l)},A.removeAllListeners=function(f){this._emitter.removeAllListeners(f)},A.off=function(f,c,l,a){l===void 0&&(l=this),this._emitter.off(f,c,l,a)},A.listeners=function(f){return this._emitter.listeners(f)},A.emit=function(f,c,l){return this._emitter.emit(f,c,l)},A.trigger=function(f,c){if(this.config.debug)return this.emit(f,f,c);try{return this.emit(f,f,c)}catch(l){C.logger.error("An internal error happened while handling event "+f+'. Error message: "'+l.message+'". Here is a stacktrace:',l),this.trigger(o.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:f,error:l})}return!1},A.listenerCount=function(f){return this._emitter.listenerCount(f)},A.destroy=function(){C.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(f){return f.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(f){return f.destroy()}),this.coreComponents.length=0},A.attachMedia=function(f){C.logger.log("attachMedia"),this._media=f,this.trigger(o.Events.MEDIA_ATTACHING,{media:f})},A.detachMedia=function(){C.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},A.loadSource=function(f){this.stopLoad();var c=this.media,l=this.url,a=this.url=G.buildAbsoluteURL(self.location.href,f,{alwaysNormalize:!0});C.logger.log("loadSource:"+a),c&&l&&l!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:f})},A.startLoad=function(f){f===void 0&&(f=-1),C.logger.log("startLoad("+f+")"),this.networkControllers.forEach(function(c){c.startLoad(f)})},A.stopLoad=function(){C.logger.log("stopLoad"),this.networkControllers.forEach(function(f){f.stopLoad()})},A.swapAudioCodec=function(){C.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},A.recoverMediaError=function(){C.logger.log("recoverMediaError");var f=this._media;this.detachMedia(),f&&this.attachMedia(f)},A.removeLevel=function(f,c){c===void 0&&(c=0),this.levelController.removeLevel(f,c)},S(h,[{key:"levels",get:function(){var f=this.levelController.levels;return f||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(f){C.logger.log("set currentLevel:"+f),this.loadLevel=f,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(f){C.logger.log("set nextLevel:"+f),this.levelController.manualLevel=f,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(f){C.logger.log("set loadLevel:"+f),this.levelController.manualLevel=f}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(f){this.levelController.nextLoadLevel=f}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(f){C.logger.log("set firstLevel:"+f),this.levelController.firstLevel=f}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(f){C.logger.log("set startLevel:"+f),f!==-1&&(f=Math.max(f,this.minAutoLevel)),this.levelController.startLevel=f}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(f){var c=!!f;c!==this.config.capLevelToPlayerSize&&(c?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=c)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(f){this._autoLevelCapping!==f&&(C.logger.log("set autoLevelCapping:"+f),this._autoLevelCapping=f)}},{key:"bandwidthEstimate",get:function(){var f=this.abrController.bwEstimator;return f?f.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var f=this.levels,c=this.config.minAutoBitrate;if(!f)return 0;for(var l=f.length,a=0;a<l;a++)if(f[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var f=this.levels,c=this.autoLevelCapping,l;return c===-1&&f&&f.length?l=f.length-1:l=c,l}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(f){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,f)}},{key:"audioTracks",get:function(){var f=this.audioTrackController;return f?f.audioTracks:[]}},{key:"audioTrack",get:function(){var f=this.audioTrackController;return f?f.audioTrack:-1},set:function(f){var c=this.audioTrackController;c&&(c.audioTrack=f)}},{key:"subtitleTracks",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTrack:-1},set:function(f){var c=this.subtitleTrackController;c&&(c.subtitleTrack=f)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var f=this.subtitleTrackController;return f?f.subtitleDisplay:!1},set:function(f){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=f)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(f){this.config.lowLatencyMode=f}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return h.defaultConfig?h.defaultConfig:T.hlsDefaultConfig},set:function(f){h.defaultConfig=f}}]),h}();p.defaultConfig=void 0},"./src/is-supported.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"isSupported",function(){return P}),L.d(z,"changeTypeSupported",function(){return B});var G=L("./src/utils/mediasource-helper.ts");function I(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var N=Object(G.getMediaSource)();if(!N)return!1;var k=I(),D=N&&typeof N.isTypeSupported=="function"&&N.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),v=!k||k.prototype&&typeof k.prototype.appendBuffer=="function"&&typeof k.prototype.remove=="function";return!!D&&!!v}function B(){var N,k=I();return typeof(k==null||((N=k.prototype)===null||N===void 0)?void 0:N.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"default",function(){return C}),L.d(z,"LoadError",function(){return E});var G=L("./src/polyfills/number.ts"),I=L("./src/errors.ts");function P(u,o){u.prototype=Object.create(o.prototype),u.prototype.constructor=u,v(u,o)}function B(u){var o=typeof Map=="function"?new Map:void 0;return B=function(d){if(d===null||!D(d))return d;if(typeof d!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(d))return o.get(d);o.set(d,S)}function S(){return N(d,arguments,w(this).constructor)}return S.prototype=Object.create(d.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),v(S,d)},B(u)}function N(u,o,s){return k()?N=Reflect.construct:N=function(S,p,h){var A=[null];A.push.apply(A,p);var b=Function.bind.apply(S,A),f=new b;return h&&v(f,h.prototype),f},N.apply(null,arguments)}function k(){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 D(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function v(u,o){return v=Object.setPrototypeOf||function(d,S){return d.__proto__=S,d},v(u,o)}function w(u){return w=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},w(u)}var R=Math.pow(2,17),C=function(){function u(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var o=u.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(d,S){var p=this,h=d.url;if(!h)return Promise.reject(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,networkDetails:null},"Fragment does not have a "+(h?"part list":"url")));this.abort();var A=this.config,b=A.fLoader,f=A.loader;return new Promise(function(c,l){p.loader&&p.loader.destroy();var a=p.loader=d.loader=b?new b(A):new f(A),g=T(d),m={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:R};d.stats=a.stats,a.load(g,m,{onSuccess:function(M,F,j,W){p.resetLoader(d,a),c({frag:d,part:null,payload:M.data,networkDetails:W})},onError:function(M,F,j){p.resetLoader(d,a),l(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,response:M,networkDetails:j}))},onAbort:function(M,F,j){p.resetLoader(d,a),l(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,networkDetails:j}))},onTimeout:function(M,F,j){p.resetLoader(d,a),l(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,networkDetails:j}))},onProgress:function(M,F,j,W){S&&S({frag:d,part:null,payload:j,networkDetails:W})}})})},o.loadPart=function(d,S,p){var h=this;this.abort();var A=this.config,b=A.fLoader,f=A.loader;return new Promise(function(c,l){h.loader&&h.loader.destroy();var a=h.loader=d.loader=b?new b(A):new f(A),g=T(d,S),m={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:R};S.stats=a.stats,a.load(g,m,{onSuccess:function(M,F,j,W){h.resetLoader(d,a),h.updateStatsFromPart(d,S);var O={frag:d,part:S,payload:M.data,networkDetails:W};p(O),c(O)},onError:function(M,F,j){h.resetLoader(d,a),l(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,part:S,response:M,networkDetails:j}))},onAbort:function(M,F,j){d.stats.aborted=S.stats.aborted,h.resetLoader(d,a),l(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,part:S,networkDetails:j}))},onTimeout:function(M,F,j){h.resetLoader(d,a),l(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,part:S,networkDetails:j}))}})})},o.updateStatsFromPart=function(d,S){var p=d.stats,h=S.stats,A=h.total;if(p.loaded+=h.loaded,A){var b=Math.round(d.duration/S.duration),f=Math.min(Math.round(p.loaded/A),b),c=b-f,l=c*Math.round(p.loaded/f);p.total=p.loaded+l}else p.total=Math.max(p.loaded,p.total);var a=p.loading,g=h.loading;a.start?a.first+=g.first-g.start:(a.start=g.start,a.first=g.first),a.end=g.end},o.resetLoader=function(d,S){d.loader=null,this.loader===S&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),S.destroy()},u}();function T(u,o){o===void 0&&(o=null);var s=o||u,d={frag:u,part:o,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},S=s.byteRangeStartOffset,p=s.byteRangeEndOffset;return Object(G.isFiniteNumber)(S)&&Object(G.isFiniteNumber)(p)&&(d.rangeStart=S,d.rangeEnd=p),d}var E=function(u){P(o,u);function o(s){for(var d,S=arguments.length,p=new Array(S>1?S-1:0),h=1;h<S;h++)p[h-1]=arguments[h];return d=u.call.apply(u,[this].concat(p))||this,d.data=void 0,d.data=s,d}return o}(B(Error))},"./src/loader/fragment.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"ElementaryStreamTypes",function(){return C}),L.d(z,"BaseSegment",function(){return T}),L.d(z,"Fragment",function(){return E}),L.d(z,"Part",function(){return u});var G=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),P=L.n(I),B=L("./src/utils/logger.ts"),N=L("./src/loader/level-key.ts"),k=L("./src/loader/load-stats.ts");function D(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,v(o,s)}function v(o,s){return v=Object.setPrototypeOf||function(S,p){return S.__proto__=p,S},v(o,s)}function w(o,s){for(var d=0;d<s.length;d++){var S=s[d];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function R(o,s,d){return s&&w(o.prototype,s),d&&w(o,d),o}var C;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(C||(C={}));var T=function(){function o(d){var S;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(S={},S[C.AUDIO]=null,S[C.VIDEO]=null,S[C.AUDIOVIDEO]=null,S),this.baseurl=d}var s=o.prototype;return s.setByteRange=function(S,p){var h=S.split("@",2),A=[];h.length===1?A[0]=p?p.byteRangeEndOffset:0:A[0]=parseInt(h[1]),A[1]=parseInt(h[0])+A[0],this._byteRange=A},R(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(I.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(S){this._url=S}}]),o}(),E=function(o){D(s,o);function s(S,p){var h;return h=o.call(this,p)||this,h._decryptdata=null,h.rawProgramDateTime=null,h.programDateTime=null,h.tagList=[],h.duration=0,h.sn=0,h.levelkey=void 0,h.type=void 0,h.loader=null,h.level=-1,h.cc=0,h.startPTS=void 0,h.endPTS=void 0,h.appendedPTS=void 0,h.startDTS=void 0,h.endDTS=void 0,h.start=0,h.deltaPTS=void 0,h.maxStartPTS=void 0,h.minEndPTS=void 0,h.stats=new k.LoadStats,h.urlId=0,h.data=void 0,h.bitrateTest=!1,h.title=null,h.initSegment=null,h.type=S,h}var d=s.prototype;return d.createInitializationVector=function(p){for(var h=new Uint8Array(16),A=12;A<16;A++)h[A]=p>>8*(15-A)&255;return h},d.setDecryptDataFromLevelKey=function(p,h){var A=p;return(p==null?void 0:p.method)==="AES-128"&&p.uri&&!p.iv&&(A=N.LevelKey.fromURI(p.uri),A.method=p.method,A.iv=this.createInitializationVector(h),A.keyFormat="identity"),A},d.setElementaryStreamInfo=function(p,h,A,b,f,c){c===void 0&&(c=!1);var l=this.elementaryStreams,a=l[p];if(!a){l[p]={startPTS:h,endPTS:A,startDTS:b,endDTS:f,partial:c};return}a.startPTS=Math.min(a.startPTS,h),a.endPTS=Math.max(a.endPTS,A),a.startDTS=Math.min(a.startDTS,b),a.endDTS=Math.max(a.endDTS,f)},d.clearElementaryStreamInfo=function(){var p=this.elementaryStreams;p[C.AUDIO]=null,p[C.VIDEO]=null,p[C.AUDIOVIDEO]=null},R(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var p=this.sn;typeof p!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&B.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),p=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,p)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(G.isFiniteNumber)(this.programDateTime))return null;var p=Object(G.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+p*1e3}},{key:"encrypted",get:function(){var p;return!!((p=this.decryptdata)!==null&&p!==void 0&&p.keyFormat&&this.decryptdata.uri)}}]),s}(T),u=function(o){D(s,o);function s(d,S,p,h,A){var b;b=o.call(this,p)||this,b.fragOffset=0,b.duration=0,b.gap=!1,b.independent=!1,b.relurl=void 0,b.fragment=void 0,b.index=void 0,b.stats=new k.LoadStats,b.duration=d.decimalFloatingPoint("DURATION"),b.gap=d.bool("GAP"),b.independent=d.bool("INDEPENDENT"),b.relurl=d.enumeratedString("URI"),b.fragment=S,b.index=h;var f=d.enumeratedString("BYTERANGE");return f&&b.setByteRange(f,A),A&&(b.fragOffset=A.fragOffset+A.duration),b}return R(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var S=this.elementaryStreams;return!!(S.audio||S.video||S.audiovideo)}}]),s}(T)},"./src/loader/key-loader.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"default",function(){return B});var G=L("./src/events.ts"),I=L("./src/errors.ts"),P=L("./src/utils/logger.ts"),B=function(){function N(D){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=D,this._registerListeners()}var k=N.prototype;return k._registerListeners=function(){this.hls.on(G.Events.KEY_LOADING,this.onKeyLoading,this)},k._unregisterListeners=function(){this.hls.off(G.Events.KEY_LOADING,this.onKeyLoading)},k.destroy=function(){this._unregisterListeners();for(var v in this.loaders){var w=this.loaders[v];w&&w.destroy()}this.loaders={}},k.onKeyLoading=function(v,w){var R=w.frag,C=R.type,T=this.loaders[C];if(!R.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var E=R.decryptdata.uri;if(E!==this.decrypturl||this.decryptkey===null){var u=this.hls.config;if(T&&(P.logger.warn("abort previous key loader for type:"+C),T.abort()),!E){P.logger.warn("key uri is falsy");return}var o=u.loader,s=R.loader=this.loaders[C]=new o(u);this.decrypturl=E,this.decryptkey=null;var d={url:E,frag:R,responseType:"arraybuffer"},S={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(d,S,p)}else this.decryptkey&&(R.decryptdata.key=this.decryptkey,this.hls.trigger(G.Events.KEY_LOADED,{frag:R}))},k.loadsuccess=function(v,w,R){var C=R.frag;if(!C.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=C.decryptdata.key=new Uint8Array(v.data),C.loader=null,delete this.loaders[C.type],this.hls.trigger(G.Events.KEY_LOADED,{frag:C})},k.loaderror=function(v,w){var R=w.frag,C=R.loader;C&&C.abort(),delete this.loaders[R.type],this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:R,response:v})},k.loadtimeout=function(v,w){var R=w.frag,C=R.loader;C&&C.abort(),delete this.loaders[R.type],this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:R})},N}()},"./src/loader/level-details.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"LevelDetails",function(){return N});var G=L("./src/polyfills/number.ts");function I(k,D){for(var v=0;v<D.length;v++){var w=D[v];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(k,w.key,w)}}function P(k,D,v){return D&&I(k.prototype,D),v&&I(k,v),k}var B=10,N=function(){function k(v){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=v}var D=k.prototype;return D.reloaded=function(w){if(!w){this.advanced=!0,this.updated=!0;return}var R=this.lastPartSn-w.lastPartSn,C=this.lastPartIndex-w.lastPartIndex;this.updated=this.endSN!==w.endSN||!!C||!!R,this.advanced=this.endSN>w.endSN||R>0||R===0&&C>0,this.updated||this.advanced?this.misses=Math.floor(w.misses*.6):this.misses=w.misses+1,this.availabilityDelay=w.availabilityDelay},P(k,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(G.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var w=this.driftEndTime-this.driftStartTime;if(w>0){var R=this.driftEnd-this.driftStart;return R*1e3/w}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var w;return(w=this.fragments)!==null&&w!==void 0&&w.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),k}()},"./src/loader/level-key.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"LevelKey",function(){return N});var G=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(G);function P(k,D){for(var v=0;v<D.length;v++){var w=D[v];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(k,w.key,w)}}function B(k,D,v){return D&&P(k.prototype,D),v&&P(k,v),k}var N=function(){k.fromURL=function(v,w){return new k(v,w)},k.fromURI=function(v){return new k(v)};function k(D,v){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,v?this._uri=Object(G.buildAbsoluteURL)(D,v,{alwaysNormalize:!0}):this._uri=D}return B(k,[{key:"uri",get:function(){return this._uri}}]),k}()},"./src/loader/load-stats.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"LoadStats",function(){return G});var G=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(ee,z,L){"use strict";L.r(z),L.d(z,"default",function(){return s});var G=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),P=L.n(I),B=L("./src/loader/fragment.ts"),N=L("./src/loader/level-details.ts"),k=L("./src/loader/level-key.ts"),D=L("./src/utils/attr-list.ts"),v=L("./src/utils/logger.ts"),w=L("./src/utils/codecs.ts"),R=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,C=/#EXT-X-MEDIA:(.*)/g,T=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),E=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),u=/\.(mp4|m4s|m4v|m4a)$/i;function o(A){var b,f;return u.test((b=(f=I.parseURL(A))===null||f===void 0?void 0:f.path)!=null?b:"")}var s=function(){function A(){}return A.findGroup=function(f,c){for(var l=0;l<f.length;l++){var a=f[l];if(a.id===c)return a}},A.convertAVC1ToAVCOTI=function(f){var c=f.split(".");if(c.length>2){var l=c.shift()+".";return l+=parseInt(c.shift()).toString(16),l+=("000"+parseInt(c.shift()).toString(16)).substr(-4),l}return f},A.resolve=function(f,c){return I.buildAbsoluteURL(c,f,{alwaysNormalize:!0})},A.parseMasterPlaylist=function(f,c){var l=[],a={},g=!1;R.lastIndex=0;for(var m;(m=R.exec(f))!=null;)if(m[1]){var y=new D.AttrList(m[1]),M={attrs:y,bitrate:y.decimalInteger("AVERAGE-BANDWIDTH")||y.decimalInteger("BANDWIDTH"),name:y.NAME,url:A.resolve(m[2],c)},F=y.decimalResolution("RESOLUTION");F&&(M.width=F.width,M.height=F.height),d((y.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=A.convertAVC1ToAVCOTI(M.videoCodec)),l.push(M)}else if(m[3]){var j=new D.AttrList(m[3]);j["DATA-ID"]&&(g=!0,a[j["DATA-ID"]]=j)}return{levels:l,sessionData:g?a:null}},A.parseMasterPlaylistMedia=function(f,c,l,a){a===void 0&&(a=[]);var g,m=[],y=0;for(C.lastIndex=0;(g=C.exec(f))!==null;){var M=new D.AttrList(g[1]);if(M.TYPE===l){var F={attrs:M,bitrate:0,id:y++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:l,default:M.bool("DEFAULT"),autoselect:M.bool("AUTOSELECT"),forced:M.bool("FORCED"),lang:M.LANGUAGE,url:M.URI?A.resolve(M.URI,c):""};if(a.length){var j=A.findGroup(a,F.groupId)||a[0];S(F,j,"audioCodec"),S(F,j,"textCodec")}m.push(F)}}return m},A.parseLevelPlaylist=function(f,c,l,a,g){var m=new N.LevelDetails(c),y=m.fragments,M=null,F=0,j=0,W=0,O=0,_=null,K=new B.Fragment(a,c),$,q,ne,Te=-1,ve=!1;for(T.lastIndex=0,m.m3u8=f;($=T.exec(f))!==null;){ve&&(ve=!1,K=new B.Fragment(a,c),K.start=W,K.sn=F,K.cc=O,K.level=l,M&&(K.initSegment=M,K.rawProgramDateTime=M.rawProgramDateTime));var ge=$[1];if(ge){K.duration=parseFloat(ge);var ce=(" "+$[2]).slice(1);K.title=ce||null,K.tagList.push(ce?["INF",ge,ce]:["INF",ge])}else if($[3])Object(G.isFiniteNumber)(K.duration)&&(K.start=W,ne&&(K.levelkey=ne),K.sn=F,K.level=l,K.cc=O,K.urlId=g,y.push(K),K.relurl=(" "+$[3]).slice(1),h(K,_),_=K,W+=K.duration,F++,j=0,ve=!0);else if($[4]){var he=(" "+$[4]).slice(1);_?K.setByteRange(he,_):K.setByteRange(he)}else if($[5])K.rawProgramDateTime=(" "+$[5]).slice(1),K.tagList.push(["PROGRAM-DATE-TIME",K.rawProgramDateTime]),Te===-1&&(Te=y.length);else{if($=$[0].match(E),!$){v.logger.warn("No matches on slow regex match for level playlist!");continue}for(q=1;q<$.length&&!(typeof $[q]!="undefined");q++);var oe=(" "+$[q]).slice(1),pe=(" "+$[q+1]).slice(1),Y=$[q+2]?(" "+$[q+2]).slice(1):"";switch(oe){case"PLAYLIST-TYPE":m.type=pe.toUpperCase();break;case"MEDIA-SEQUENCE":F=m.startSN=parseInt(pe);break;case"SKIP":{var ae=new D.AttrList(pe),Z=ae.decimalInteger("SKIPPED-SEGMENTS");if(Object(G.isFiniteNumber)(Z)){m.skippedSegments=Z;for(var xe=Z;xe--;)y.unshift(null);F+=Z}var we=ae.enumeratedString("RECENTLY-REMOVED-DATERANGES");we&&(m.recentlyRemovedDateranges=we.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(pe);break;case"VERSION":m.version=parseInt(pe);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(pe||Y)&&K.tagList.push(Y?[pe,Y]:[pe]);break;case"DIS":O++;case"GAP":K.tagList.push([oe]);break;case"BITRATE":K.tagList.push([oe,pe]);break;case"DISCONTINUITY-SEQ":O=parseInt(pe);break;case"KEY":{var ye,Se=new D.AttrList(pe),Oe=Se.enumeratedString("METHOD"),Pe=Se.URI,_e=Se.hexadecimalInteger("IV"),De=Se.enumeratedString("KEYFORMATVERSIONS"),Le=Se.enumeratedString("KEYID"),Ue=(ye=Se.enumeratedString("KEYFORMAT"))!=null?ye:"identity",Ve=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ve.indexOf(Ue)>-1){v.logger.warn("Keyformat "+Ue+" is not supported from the manifest");continue}else if(Ue!=="identity")continue;Oe&&(ne=k.LevelKey.fromURL(c,Pe),Pe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Oe)>=0&&(ne.method=Oe,ne.keyFormat=Ue,Le&&(ne.keyID=Le),De&&(ne.keyFormatVersions=De),ne.iv=_e));break}case"START":{var We=new D.AttrList(pe),Ge=We.decimalFloatingPoint("TIME-OFFSET");Object(G.isFiniteNumber)(Ge)&&(m.startTimeOffset=Ge);break}case"MAP":{var et=new D.AttrList(pe);K.relurl=et.URI,et.BYTERANGE&&K.setByteRange(et.BYTERANGE),K.level=l,K.sn="initSegment",ne&&(K.levelkey=ne),K.initSegment=null,M=K,ve=!0;break}case"SERVER-CONTROL":{var Je=new D.AttrList(pe);m.canBlockReload=Je.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=Je.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&Je.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=Je.optionalFloat("PART-HOLD-BACK",0),m.holdBack=Je.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var ze=new D.AttrList(pe);m.partTarget=ze.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ce=m.partList;Ce||(Ce=m.partList=[]);var qe=j>0?Ce[Ce.length-1]:void 0,$e=j++,Re=new B.Part(new D.AttrList(pe),K,c,$e,qe);Ce.push(Re),K.duration+=Re.duration;break}case"PRELOAD-HINT":{var Fe=new D.AttrList(pe);m.preloadHint=Fe;break}case"RENDITION-REPORT":{var me=new D.AttrList(pe);m.renditionReports=m.renditionReports||[],m.renditionReports.push(me);break}default:v.logger.warn("line parsed but not handled: "+$);break}}}_&&!_.relurl?(y.pop(),W-=_.duration,m.partList&&(m.fragmentHint=_)):m.partList&&(h(K,_),K.cc=O,m.fragmentHint=K);var ue=y.length,de=y[0],Q=y[ue-1];if(W+=m.skippedSegments*m.targetduration,W>0&&ue&&Q){m.averagetargetduration=W/ue;var J=Q.sn;m.endSN=J!=="initSegment"?J:0,de&&(m.startCC=de.cc,de.initSegment||m.fragments.every(function(te){return te.relurl&&o(te.relurl)})&&(v.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),K=new B.Fragment(a,c),K.relurl=Q.relurl,K.level=l,K.sn="initSegment",de.initSegment=K,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(W+=m.fragmentHint.duration),m.totalduration=W,m.endCC=O,Te>0&&p(y,Te),m},A}();function d(A,b){["video","audio","text"].forEach(function(f){var c=A.filter(function(a){return Object(w.isCodecType)(a,f)});if(c.length){var l=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});b[f+"Codec"]=l.length>0?l[0]:c[0],A=A.filter(function(a){return c.indexOf(a)===-1})}}),b.unknownCodecs=A}function S(A,b,f){var c=b[f];c&&(A[f]=c)}function p(A,b){for(var f=A[b],c=b;c--;){var l=A[c];if(!l)return;l.programDateTime=f.programDateTime-l.duration*1e3,f=l}}function h(A,b){A.rawProgramDateTime?A.programDateTime=Date.parse(A.rawProgramDateTime):b!=null&&b.programDateTime&&(A.programDateTime=b.endProgramDateTime),Object(G.isFiniteNumber)(A.programDateTime)||(A.programDateTime=null,A.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ee,z,L){"use strict";L.r(z);var G=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),P=L("./src/errors.ts"),B=L("./src/utils/logger.ts"),N=L("./src/utils/mp4-tools.ts"),k=L("./src/loader/m3u8-parser.ts"),D=L("./src/types/loader.ts"),v=L("./src/utils/attr-list.ts");function w(T){var E=T.type;switch(E){case D.PlaylistContextType.AUDIO_TRACK:return D.PlaylistLevelType.AUDIO;case D.PlaylistContextType.SUBTITLE_TRACK:return D.PlaylistLevelType.SUBTITLE;default:return D.PlaylistLevelType.MAIN}}function R(T,E){var u=T.url;return(u===void 0||u.indexOf("data:")===0)&&(u=E.url),u}var C=function(){function T(u){this.hls=void 0,this.loaders=Object.create(null),this.hls=u,this.registerListeners()}var E=T.prototype;return E.registerListeners=function(){var o=this.hls;o.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},E.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},E.createInternalLoader=function(o){var s=this.hls.config,d=s.pLoader,S=s.loader,p=d||S,h=new p(s);return o.loader=h,this.loaders[o.type]=h,h},E.getInternalLoader=function(o){return this.loaders[o.type]},E.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},E.destroyInternalLoaders=function(){for(var o in this.loaders){var s=this.loaders[o];s&&s.destroy(),this.resetInternalLoader(o)}},E.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},E.onManifestLoading=function(o,s){var d=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:D.PlaylistContextType.MANIFEST,url:d,deliveryDirectives:null})},E.onLevelLoading=function(o,s){var d=s.id,S=s.level,p=s.url,h=s.deliveryDirectives;this.load({id:d,groupId:null,level:S,responseType:"text",type:D.PlaylistContextType.LEVEL,url:p,deliveryDirectives:h})},E.onAudioTrackLoading=function(o,s){var d=s.id,S=s.groupId,p=s.url,h=s.deliveryDirectives;this.load({id:d,groupId:S,level:null,responseType:"text",type:D.PlaylistContextType.AUDIO_TRACK,url:p,deliveryDirectives:h})},E.onSubtitleTrackLoading=function(o,s){var d=s.id,S=s.groupId,p=s.url,h=s.deliveryDirectives;this.load({id:d,groupId:S,level:null,responseType:"text",type:D.PlaylistContextType.SUBTITLE_TRACK,url:p,deliveryDirectives:h})},E.load=function(o){var s,d=this.hls.config,S=this.getInternalLoader(o);if(S){var p=S.context;if(p&&p.url===o.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),S.abort()}var h,A,b,f;switch(o.type){case D.PlaylistContextType.MANIFEST:h=d.manifestLoadingMaxRetry,A=d.manifestLoadingTimeOut,b=d.manifestLoadingRetryDelay,f=d.manifestLoadingMaxRetryTimeout;break;case D.PlaylistContextType.LEVEL:case D.PlaylistContextType.AUDIO_TRACK:case D.PlaylistContextType.SUBTITLE_TRACK:h=0,A=d.levelLoadingTimeOut;break;default:h=d.levelLoadingMaxRetry,A=d.levelLoadingTimeOut,b=d.levelLoadingRetryDelay,f=d.levelLoadingMaxRetryTimeout;break}if(S=this.createInternalLoader(o),(s=o.deliveryDirectives)!==null&&s!==void 0&&s.part){var c;if(o.type===D.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===D.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===D.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var l=c.partTarget,a=c.targetduration;l&&a&&(A=Math.min(Math.max(l*3,a*.8)*1e3,A))}}var g={timeout:A,maxRetry:h,retryDelay:b,maxRetryDelay:f,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};S.load(o,g,m)},E.loadsuccess=function(o,s,d,S){if(S===void 0&&(S=null),d.isSidxRequest){this.handleSidxRequest(o,d),this.handlePlaylistLoaded(o,s,d,S);return}this.resetInternalLoader(d.type);var p=o.data;if(p.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,d,"no EXTM3U delimiter",S);return}s.parsing.start=performance.now(),p.indexOf("#EXTINF:")>0||p.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,s,d,S):this.handleMasterPlaylist(o,s,d,S)},E.loaderror=function(o,s,d){d===void 0&&(d=null),this.handleNetworkError(s,d,!1,o)},E.loadtimeout=function(o,s,d){d===void 0&&(d=null),this.handleNetworkError(s,d,!0)},E.handleMasterPlaylist=function(o,s,d,S){var p=this.hls,h=o.data,A=R(o,d),b=k.default.parseMasterPlaylist(h,A),f=b.levels,c=b.sessionData;if(!f.length){this.handleManifestParsingError(o,d,"no level found in manifest",S);return}var l=f.map(function(F){return{id:F.attrs.AUDIO,audioCodec:F.audioCodec}}),a=f.map(function(F){return{id:F.attrs.SUBTITLES,textCodec:F.textCodec}}),g=k.default.parseMasterPlaylistMedia(h,A,"AUDIO",l),m=k.default.parseMasterPlaylistMedia(h,A,"SUBTITLES",a),y=k.default.parseMasterPlaylistMedia(h,A,"CLOSED-CAPTIONS");if(g.length){var M=g.some(function(F){return!F.url});!M&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(B.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new v.AttrList({}),bitrate:0,url:""}))}p.trigger(I.Events.MANIFEST_LOADED,{levels:f,audioTracks:g,subtitles:m,captions:y,url:A,stats:s,networkDetails:S,sessionData:c})},E.handleTrackOrLevelPlaylist=function(o,s,d,S){var p=this.hls,h=d.id,A=d.level,b=d.type,f=R(o,d),c=Object(G.isFiniteNumber)(h)?h:0,l=Object(G.isFiniteNumber)(A)?A:c,a=w(d),g=k.default.parseLevelPlaylist(o.data,f,l,a,c);if(!g.fragments.length){p.trigger(I.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:f,reason:"no fragments found in level",level:typeof d.level=="number"?d.level:void 0});return}if(b===D.PlaylistContextType.MANIFEST){var m={attrs:new v.AttrList({}),bitrate:0,details:g,name:"",url:f};p.trigger(I.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:f,stats:s,networkDetails:S,sessionData:null})}if(s.parsing.end=performance.now(),g.needSidxRanges){var y,M=(y=g.fragments[0].initSegment)===null||y===void 0?void 0:y.url;this.load({url:M,isSidxRequest:!0,type:b,level:A,levelDetails:g,id:h,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}d.levelDetails=g,this.handlePlaylistLoaded(o,s,d,S)},E.handleSidxRequest=function(o,s){var d=Object(N.parseSegmentIndex)(new Uint8Array(o.data));if(!d)return;var S=d.references,p=s.levelDetails;S.forEach(function(h,A){var b=h.info,f=p.fragments[A];f.byteRange.length===0&&f.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),f.initSegment&&f.initSegment.setByteRange(String(d.moovEndOffset)+"@0")})},E.handleManifestParsingError=function(o,s,d,S){this.hls.trigger(I.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===D.PlaylistContextType.MANIFEST,url:o.url,reason:d,response:o,context:s,networkDetails:S})},E.handleNetworkError=function(o,s,d,S){d===void 0&&(d=!1),B.logger.warn("[playlist-loader]: A network "+(d?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var p=P.ErrorDetails.UNKNOWN,h=!1,A=this.getInternalLoader(o);switch(o.type){case D.PlaylistContextType.MANIFEST:p=d?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,h=!0;break;case D.PlaylistContextType.LEVEL:p=d?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,h=!1;break;case D.PlaylistContextType.AUDIO_TRACK:p=d?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,h=!1;break;case D.PlaylistContextType.SUBTITLE_TRACK:p=d?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,h=!1;break}A&&this.resetInternalLoader(o.type);var b={type:P.ErrorTypes.NETWORK_ERROR,details:p,fatal:h,url:o.url,loader:A,context:o,networkDetails:s};S&&(b.response=S),this.hls.trigger(I.Events.ERROR,b)},E.handlePlaylistLoaded=function(o,s,d,S){var p=d.type,h=d.level,A=d.id,b=d.groupId,f=d.loader,c=d.levelDetails,l=d.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,d,"invalid target duration",S);return}if(!f)return;c.live&&(f.getCacheAge&&(c.ageHeader=f.getCacheAge()||0),(!f.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(p){case D.PlaylistContextType.MANIFEST:case D.PlaylistContextType.LEVEL:this.hls.trigger(I.Events.LEVEL_LOADED,{details:c,level:h||0,id:A||0,stats:s,networkDetails:S,deliveryDirectives:l});break;case D.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(I.Events.AUDIO_TRACK_LOADED,{details:c,id:A||0,groupId:b||"",stats:s,networkDetails:S,deliveryDirectives:l});break;case D.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADED,{details:c,id:A||0,groupId:b||"",stats:s,networkDetails:S,deliveryDirectives:l});break}},T}();z.default=C},"./src/polyfills/number.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"isFiniteNumber",function(){return G}),L.d(z,"MAX_SAFE_INTEGER",function(){return I});var G=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},I=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ee,z,L){"use strict";L.r(z);var G=function(){function I(){}return I.getSilentFrame=function(B,N){switch(B){case"mp4a.40.2":if(N===1)return new Uint8Array([0,200,0,128,35,128]);if(N===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(N===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(N===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(N===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(N===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(N===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(N===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(N===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},I}();z.default=G},"./src/remux/mp4-generator.ts":function(ee,z,L){"use strict";L.r(z);var G=Math.pow(2,32)-1,I=function(){function P(){}return P.init=function(){P.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var N;for(N in P.types)P.types.hasOwnProperty(N)&&(P.types[N]=[N.charCodeAt(0),N.charCodeAt(1),N.charCodeAt(2),N.charCodeAt(3)]);var k=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),D=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);P.HDLR_TYPES={video:k,audio:D};var v=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),w=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=w,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var R=new Uint8Array([105,115,111,109]),C=new Uint8Array([97,118,99,49]),T=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,R,T,R,C),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,v))},P.box=function(N){for(var k=8,D=arguments.length,v=new Array(D>1?D-1:0),w=1;w<D;w++)v[w-1]=arguments[w];for(var R=v.length,C=R;R--;)k+=v[R].byteLength;var T=new Uint8Array(k);for(T[0]=k>>24&255,T[1]=k>>16&255,T[2]=k>>8&255,T[3]=k&255,T.set(N,4),R=0,k=8;R<C;R++)T.set(v[R],k),k+=v[R].byteLength;return T},P.hdlr=function(N){return P.box(P.types.hdlr,P.HDLR_TYPES[N])},P.mdat=function(N){return P.box(P.types.mdat,N)},P.mdhd=function(N,k){k*=N;var D=Math.floor(k/(G+1)),v=Math.floor(k%(G+1));return P.box(P.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,D>>24,D>>16&255,D>>8&255,D&255,v>>24,v>>16&255,v>>8&255,v&255,85,196,0,0]))},P.mdia=function(N){return P.box(P.types.mdia,P.mdhd(N.timescale,N.duration),P.hdlr(N.type),P.minf(N))},P.mfhd=function(N){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,N>>24,N>>16&255,N>>8&255,N&255]))},P.minf=function(N){return N.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(N)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(N))},P.moof=function(N,k,D){return P.box(P.types.moof,P.mfhd(N),P.traf(D,k))},P.moov=function(N){for(var k=N.length,D=[];k--;)D[k]=P.trak(N[k]);return P.box.apply(null,[P.types.moov,P.mvhd(N[0].timescale,N[0].duration)].concat(D).concat(P.mvex(N)))},P.mvex=function(N){for(var k=N.length,D=[];k--;)D[k]=P.trex(N[k]);return P.box.apply(null,[P.types.mvex].concat(D))},P.mvhd=function(N,k){k*=N;var D=Math.floor(k/(G+1)),v=Math.floor(k%(G+1)),w=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,D>>24,D>>16&255,D>>8&255,D&255,v>>24,v>>16&255,v>>8&255,v&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return P.box(P.types.mvhd,w)},P.sdtp=function(N){var k=N.samples||[],D=new Uint8Array(4+k.length),v,w;for(v=0;v<k.length;v++)w=k[v].flags,D[v+4]=w.dependsOn<<4|w.isDependedOn<<2|w.hasRedundancy;return P.box(P.types.sdtp,D)},P.stbl=function(N){return P.box(P.types.stbl,P.stsd(N),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))},P.avc1=function(N){var k=[],D=[],v,w,R;for(v=0;v<N.sps.length;v++)w=N.sps[v],R=w.byteLength,k.push(R>>>8&255),k.push(R&255),k=k.concat(Array.prototype.slice.call(w));for(v=0;v<N.pps.length;v++)w=N.pps[v],R=w.byteLength,D.push(R>>>8&255),D.push(R&255),D=D.concat(Array.prototype.slice.call(w));var C=P.box(P.types.avcC,new Uint8Array([1,k[3],k[4],k[5],252|3,224|N.sps.length].concat(k).concat([N.pps.length]).concat(D))),T=N.width,E=N.height,u=N.pixelRatio[0],o=N.pixelRatio[1];return P.box(P.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,T>>8&255,T&255,E>>8&255,E&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),C,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,o>>24,o>>16&255,o>>8&255,o&255])))},P.esds=function(N){var k=N.config.length;return new Uint8Array([0,0,0,0,3,23+k,0,1,0,4,15+k,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([k]).concat(N.config).concat([6,1,2]))},P.mp4a=function(N){var k=N.samplerate;return P.box(P.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]),P.box(P.types.esds,P.esds(N)))},P.mp3=function(N){var k=N.samplerate;return P.box(P.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]))},P.stsd=function(N){return N.type==="audio"?!N.isAAC&&N.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(N)):P.box(P.types.stsd,P.STSD,P.mp4a(N)):P.box(P.types.stsd,P.STSD,P.avc1(N))},P.tkhd=function(N){var k=N.id,D=N.duration*N.timescale,v=N.width,w=N.height,R=Math.floor(D/(G+1)),C=Math.floor(D%(G+1));return P.box(P.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,C>>24,C>>16&255,C>>8&255,C&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,v>>8&255,v&255,0,0,w>>8&255,w&255,0,0]))},P.traf=function(N,k){var D=P.sdtp(N),v=N.id,w=Math.floor(k/(G+1)),R=Math.floor(k%(G+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,v>>24,v>>16&255,v>>8&255,v&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,w>>24,w>>16&255,w>>8&255,w&255,R>>24,R>>16&255,R>>8&255,R&255])),P.trun(N,D.length+16+20+8+16+8+8),D)},P.trak=function(N){return N.duration=N.duration||4294967295,P.box(P.types.trak,P.tkhd(N),P.mdia(N))},P.trex=function(N){var k=N.id;return P.box(P.types.trex,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},P.trun=function(N,k){var D=N.samples||[],v=D.length,w=12+16*v,R=new Uint8Array(w),C,T,E,u,o,s;for(k+=8+w,R.set([0,0,15,1,v>>>24&255,v>>>16&255,v>>>8&255,v&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255],0),C=0;C<v;C++)T=D[C],E=T.duration,u=T.size,o=T.flags,s=T.cts,R.set([E>>>24&255,E>>>16&255,E>>>8&255,E&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*C);return P.box(P.types.trun,R)},P.initSegment=function(N){P.types||P.init();var k=P.moov(N),D=new Uint8Array(P.FTYP.byteLength+k.byteLength);return D.set(P.FTYP),D.set(k,P.FTYP.byteLength),D},P}();I.types=void 0,I.HDLR_TYPES=void 0,I.STTS=void 0,I.STSC=void 0,I.STCO=void 0,I.STSZ=void 0,I.VMHD=void 0,I.SMHD=void 0,I.STSD=void 0,I.FTYP=void 0,I.DINF=void 0,z.default=I},"./src/remux/mp4-remuxer.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"default",function(){return s}),L.d(z,"normalizePts",function(){return d});var G=L("./src/polyfills/number.ts"),I=L("./src/remux/aac-helper.ts"),P=L("./src/remux/mp4-generator.ts"),B=L("./src/events.ts"),N=L("./src/errors.ts"),k=L("./src/utils/logger.ts"),D=L("./src/types/loader.ts"),v=L("./src/utils/timescale-conversion.ts");function w(){return w=Object.assign||function(A){for(var b=1;b<arguments.length;b++){var f=arguments[b];for(var c in f)Object.prototype.hasOwnProperty.call(f,c)&&(A[c]=f[c])}return A},w.apply(this,arguments)}var R=10*1e3,C=1024,T=1152,E=null,u=null,o=!1,s=function(){function A(f,c,l,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=f,this.config=c,this.typeSupported=l,this.ISGenerated=!1,E===null){var g=navigator.userAgent||"",m=g.match(/Chrome\/(\d+)/i);E=m?parseInt(m[1]):0}if(u===null){var y=navigator.userAgent.match(/Safari\/(\d+)/i);u=y?parseInt(y[1]):0}o=!!E&&E<75||!!u&&u<600}var b=A.prototype;return b.destroy=function(){},b.resetTimeStamp=function(c){k.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},b.resetNextTimestamp=function(){k.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},b.resetInitSegment=function(){k.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},b.getVideoStartPts=function(c){var l=!1,a=c.reduce(function(g,m){var y=m.pts-g;return y<-4294967296?(l=!0,d(g,m.pts)):y>0?g:m.pts},c[0].pts);return l&&k.logger.debug("PTS rollover detected"),a},b.remux=function(c,l,a,g,m,y,M,F){var j,W,O,_,K,$,q=m,ne=m,Te=c.pid>-1,ve=l.pid>-1,ge=l.samples.length,ce=c.samples.length>0,he=ge>1,oe=(!Te||ce)&&(!ve||he)||this.ISGenerated||M;if(oe){this.ISGenerated||(O=this.generateIS(c,l,m));var pe=this.isVideoContiguous,Y=-1;if(he&&(Y=S(l.samples),!pe&&this.config.forceKeyFrameOnDiscontinuity))if($=!0,Y>0){k.logger.warn("[mp4-remuxer]: Dropped "+Y+" out of "+ge+" video samples due to a missing keyframe");var ae=this.getVideoStartPts(l.samples);l.samples=l.samples.slice(Y),l.dropped+=Y,ne+=(l.samples[0].pts-ae)/(l.timescale||9e4)}else Y===-1&&(k.logger.warn("[mp4-remuxer]: No keyframe found out of "+ge+" video samples"),$=!1);if(this.ISGenerated){if(ce&&he){var Z=this.getVideoStartPts(l.samples),xe=d(c.samples[0].pts,Z)-Z,we=xe/l.inputTimeScale;q+=Math.max(0,we),ne+=Math.max(0,-we)}if(ce){if(c.samplerate||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),O=this.generateIS(c,l,m)),W=this.remuxAudio(c,q,this.isAudioContiguous,y,ve||he||F===D.PlaylistLevelType.AUDIO?ne:void 0),he){var ye=W?W.endPTS-W.startPTS:0;l.inputTimeScale||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),O=this.generateIS(c,l,m)),j=this.remuxVideo(l,ne,pe,ye)}}else he&&(j=this.remuxVideo(l,ne,pe,0));j&&(j.firstKeyFrame=Y,j.independent=Y!==-1)}}return this.ISGenerated&&(a.samples.length&&(K=this.remuxID3(a,m)),g.samples.length&&(_=this.remuxText(g,m))),{audio:W,video:j,initSegment:O,independent:$,text:_,id3:K}},b.generateIS=function(c,l,a){var g=c.samples,m=l.samples,y=this.typeSupported,M={},F=!Object(G.isFiniteNumber)(this._initPTS),j="audio/mp4",W,O,_;if(F&&(W=O=Infinity),c.config&&g.length&&(c.timescale=c.samplerate,c.isAAC||(y.mpeg?(j="audio/mpeg",c.codec=""):y.mp3&&(c.codec="mp3")),M.audio={id:"audio",container:j,codec:c.codec,initSegment:!c.isAAC&&y.mpeg?new Uint8Array(0):P.default.initSegment([c]),metadata:{channelCount:c.channelCount}},F&&(_=c.inputTimeScale,W=O=g[0].pts-Math.round(_*a))),l.sps&&l.pps&&m.length&&(l.timescale=l.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:l.codec,initSegment:P.default.initSegment([l]),metadata:{width:l.width,height:l.height}},F)){_=l.inputTimeScale;var K=this.getVideoStartPts(m),$=Math.round(_*a);O=Math.min(O,d(m[0].dts,K)-$),W=Math.min(W,K-$)}if(Object.keys(M).length)return this.ISGenerated=!0,F&&(this._initPTS=W,this._initDTS=O),{tracks:M,initPTS:W,timescale:_}},b.remuxVideo=function(c,l,a,g){var m=c.inputTimeScale,y=c.samples,M=[],F=y.length,j=this._initPTS,W=this.nextAvcDts,O=8,_,K,$,q=Number.POSITIVE_INFINITY,ne=Number.NEGATIVE_INFINITY,Te=0,ve=!1;if(!a||W===null){var ge=l*m,ce=y[0].pts-d(y[0].dts,y[0].pts);W=ge-ce}for(var he=0;he<F;he++){var oe=y[he];if(oe.pts=d(oe.pts-j,W),oe.dts=d(oe.dts-j,W),oe.dts>oe.pts){var pe=9e4*.2;Te=Math.max(Math.min(Te,oe.pts-oe.dts),-1*pe)}oe.dts<y[he>0?he-1:he].dts&&(ve=!0)}ve&&y.sort(function(xt,ht){var ot=xt.dts-ht.dts,Ct=xt.pts-ht.pts;return ot||Ct}),K=y[0].dts,$=y[y.length-1].dts;var Y=Math.round(($-K)/(F-1));if(Te<0){if(Te<Y*-2){k.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(v.toMsFromMpegTsClock)(-Y,!0)+" ms");for(var ae=Te,Z=0;Z<F;Z++)y[Z].dts=ae=Math.max(ae,y[Z].pts-Y),y[Z].pts=Math.max(ae,y[Z].pts)}else{k.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(v.toMsFromMpegTsClock)(Te,!0)+" ms to overcome this issue");for(var xe=0;xe<F;xe++)y[xe].dts=y[xe].dts+Te}K=y[0].dts}if(a){var we=K-W,ye=we>Y,Se=we<-1;if(ye||Se){ye?k.logger.warn("AVC: "+Object(v.toMsFromMpegTsClock)(we,!0)+" ms ("+we+"dts) hole between fragments detected, filling it"):k.logger.warn("AVC: "+Object(v.toMsFromMpegTsClock)(-we,!0)+" ms ("+we+"dts) overlapping between fragments detected"),K=W;var Oe=y[0].pts-we;y[0].dts=K,y[0].pts=Oe,k.logger.log("Video: First PTS/DTS adjusted: "+Object(v.toMsFromMpegTsClock)(Oe,!0)+"/"+Object(v.toMsFromMpegTsClock)(K,!0)+", delta: "+Object(v.toMsFromMpegTsClock)(we,!0)+" ms")}}o&&(K=Math.max(0,K));for(var Pe=0,_e=0,De=0;De<F;De++){for(var Le=y[De],Ue=Le.units,Ve=Ue.length,We=0,Ge=0;Ge<Ve;Ge++)We+=Ue[Ge].data.length;_e+=We,Pe+=Ve,Le.length=We,Le.dts=Math.max(Le.dts,K),Le.pts=Math.max(Le.pts,Le.dts,0),q=Math.min(Le.pts,q),ne=Math.max(Le.pts,ne)}$=y[F-1].dts;var et=_e+4*Pe+8,Je;try{Je=new Uint8Array(et)}catch(xt){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:et,reason:"fail allocating video mdat "+et});return}var ze=new DataView(Je.buffer);ze.setUint32(0,et),Je.set(P.default.types.mdat,4);for(var Ce=0;Ce<F;Ce++){for(var qe=y[Ce],$e=qe.units,Re=0,Fe=0,me=$e.length;Fe<me;Fe++){var ue=$e[Fe],de=ue.data,Q=ue.data.byteLength;ze.setUint32(O,Q),O+=4,Je.set(de,O),O+=Q,Re+=4+Q}if(Ce<F-1)_=y[Ce+1].dts-qe.dts;else{var J=this.config,te=qe.dts-y[Ce>0?Ce-1:Ce].dts;if(J.stretchShortVideoTrack&&this.nextAudioPts!==null){var se=Math.floor(J.maxBufferHole*m),fe=(g?q+g*m:this.nextAudioPts)-qe.pts;fe>se?(_=fe-te,_<0&&(_=te),k.logger.log("[mp4-remuxer]: It is approximately "+fe/90+" ms to the next segment; using duration "+_/90+" ms for the last video frame.")):_=te}else _=te}var Ae=Math.round(qe.pts-qe.dts);M.push(new p(qe.key,_,Re,Ae))}if(M.length&&E&&E<70){var Me=M[0].flags;Me.dependsOn=2,Me.isNonSync=0}console.assert(_!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=$+_,this.isVideoContiguous=!0;var Xe=P.default.moof(c.sequenceNumber++,K,w({},c,{samples:M})),it="video",tt={data1:Xe,data2:Je,startPTS:q/m,endPTS:(ne+_)/m,startDTS:K/m,endDTS:W/m,type:it,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Je.length,"MDAT length must not be zero"),tt},b.remuxAudio=function(c,l,a,g,m){var y=c.inputTimeScale,M=c.samplerate?c.samplerate:y,F=y/M,j=c.isAAC?C:T,W=j*F,O=this._initPTS,_=!c.isAAC&&this.typeSupported.mpeg,K=[],$=c.samples,q=_?0:8,ne=this.nextAudioPts||-1,Te=l*y;if(this.isAudioContiguous=a=a||$.length&&ne>0&&(g&&Math.abs(Te-ne)<9e3||Math.abs(d($[0].pts-O,Te)-ne)<20*W),$.forEach(function(de){de.pts=d(de.pts-O,Te)}),!a||ne<0){if($=$.filter(function(de){return de.pts>=0}),!$.length)return;m===0?ne=0:g?ne=Math.max(0,Te):ne=$[0].pts}if(c.isAAC)for(var ve=m!==void 0,ge=this.config.maxAudioFramesDrift,ce=0,he=ne;ce<$.length;ce++){var oe=$[ce],pe=oe.pts,Y=pe-he,ae=Math.abs(1e3*Y/y);if(Y<=-ge*W&&ve)ce===0&&(k.logger.warn("Audio frame @ "+(pe/y).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Y/y)+" ms."),this.nextAudioPts=ne=he=pe);else if(Y>=ge*W&&ae<R&&ve){var Z=Math.round(Y/W);he=pe-Z*W,he<0&&(Z--,he+=W),ce===0&&(this.nextAudioPts=ne=he),k.logger.warn("[mp4-remuxer]: Injecting "+Z+" audio frame @ "+(he/y).toFixed(3)+"s due to "+Math.round(1e3*Y/y)+" ms gap.");for(var xe=0;xe<Z;xe++){var we=Math.max(he,0),ye=I.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);ye||(k.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ye=oe.unit.subarray()),$.splice(ce,0,{unit:ye,pts:we}),he+=W,ce++}}oe.pts=he,he+=W}for(var Se=null,Oe=null,Pe,_e=0,De=$.length;De--;)_e+=$[De].unit.byteLength;for(var Le=0,Ue=$.length;Le<Ue;Le++){var Ve=$[Le],We=Ve.unit,Ge=Ve.pts;if(Oe!==null){var et=K[Le-1];et.duration=Math.round((Ge-Oe)/F)}else if(a&&c.isAAC&&(Ge=ne),Se=Ge,_e>0){_e+=q;try{Pe=new Uint8Array(_e)}catch(de){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:_e,reason:"fail allocating audio mdat "+_e});return}if(!_){var Je=new DataView(Pe.buffer);Je.setUint32(0,_e),Pe.set(P.default.types.mdat,4)}}else return;Pe.set(We,q);var ze=We.byteLength;q+=ze,K.push(new p(!0,j,ze,0)),Oe=Ge}var Ce=K.length;if(!Ce)return;var qe=K[K.length-1];this.nextAudioPts=ne=Oe+F*qe.duration;var $e=_?new Uint8Array(0):P.default.moof(c.sequenceNumber++,Se/F,w({},c,{samples:K}));c.samples=[];var Re=Se/y,Fe=ne/y,me="audio",ue={data1:$e,data2:Pe,startPTS:Re,endPTS:Fe,startDTS:Re,endDTS:Fe,type:me,hasAudio:!0,hasVideo:!1,nb:Ce};return this.isAudioContiguous=!0,console.assert(Pe.length,"MDAT length must not be zero"),ue},b.remuxEmptyAudio=function(c,l,a,g){var m=c.inputTimeScale,y=c.samplerate?c.samplerate:m,M=m/y,F=this.nextAudioPts,j=(F!==null?F:g.startDTS*m)+this._initDTS,W=g.endDTS*m+this._initDTS,O=M*C,_=Math.ceil((W-j)/O),K=I.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(k.logger.warn("[mp4-remuxer]: remux empty Audio"),!K){k.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var $=[],q=0;q<_;q++){var ne=j+q*O;$.push({unit:K,pts:ne,dts:ne})}return c.samples=$,this.remuxAudio(c,l,a,!1)},b.remuxID3=function(c,l){var a=c.samples.length;if(!a)return;for(var g=c.inputTimeScale,m=this._initPTS,y=this._initDTS,M=0;M<a;M++){var F=c.samples[M];F.pts=d(F.pts-m,l*g)/g,F.dts=d(F.dts-y,l*g)/g}var j=c.samples;return c.samples=[],{samples:j}},b.remuxText=function(c,l){var a=c.samples.length;if(!a)return;for(var g=c.inputTimeScale,m=this._initPTS,y=0;y<a;y++){var M=c.samples[y];M.pts=d(M.pts-m,l*g)/g}c.samples.sort(function(j,W){return j.pts-W.pts});var F=c.samples;return c.samples=[],{samples:F}},A}();function d(A,b){var f;if(b===null)return A;for(b<A?f=-8589934592:f=8589934592;Math.abs(A-b)>4294967296;)A+=f;return A}function S(A){for(var b=0;b<A.length;b++)if(A[b].key)return b;return-1}var p=function(b,f,c,l){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=f,this.size=c,this.cts=l,this.flags=new h(b)},h=function(b){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=b?2:1,this.isNonSync=b?0:1}},"./src/remux/passthrough-remuxer.ts":function(ee,z,L){"use strict";L.r(z);var G=L("./src/polyfills/number.ts"),I=L("./src/utils/mp4-tools.ts"),P=L("./src/loader/fragment.ts"),B=L("./src/utils/logger.ts"),N=function(){function v(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var w=v.prototype;return w.destroy=function(){},w.resetTimeStamp=function(C){this.initPTS=C,this.lastEndDTS=null},w.resetNextTimestamp=function(){this.lastEndDTS=null},w.resetInitSegment=function(C,T,E){this.audioCodec=T,this.videoCodec=E,this.generateInitSegment(C),this.emitInitSegment=!0},w.generateInitSegment=function(C){var T=this.audioCodec,E=this.videoCodec;if(!C||!C.byteLength){this.initTracks=void 0,this.initData=void 0;return}var u=this.initData=Object(I.parseInitSegment)(C);T||(T=D(u.audio,P.ElementaryStreamTypes.AUDIO)),E||(E=D(u.video,P.ElementaryStreamTypes.VIDEO));var o={};u.audio&&u.video?o.audiovideo={container:"video/mp4",codec:T+","+E,initSegment:C,id:"main"}:u.audio?o.audio={container:"audio/mp4",codec:T,initSegment:C,id:"audio"}:u.video?o.video={container:"video/mp4",codec:E,initSegment:C,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},w.remux=function(C,T,E,u,o){var s=this.initPTS,d=this.lastEndDTS,S={audio:void 0,video:void 0,text:u,id3:E,initSegment:void 0};Object(G.isFiniteNumber)(d)||(d=this.lastEndDTS=o||0);var p=T.samples;if(!p||!p.length)return S;var h={initPTS:void 0,timescale:1},A=this.initData;if((!A||!A.length)&&(this.generateInitSegment(p),A=this.initData),!A||!A.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),S;this.emitInitSegment&&(h.tracks=this.initTracks,this.emitInitSegment=!1),Object(G.isFiniteNumber)(s)||(this.initPTS=h.initPTS=s=k(A,p,d));var b=Object(I.getDuration)(p,A),f=d,c=b+f;Object(I.offsetStartDTS)(A,p,s),b>0?this.lastEndDTS=c:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var l=!!A.audio,a=!!A.video,g="";l&&(g+="audio"),a&&(g+="video");var m={data1:p,startPTS:f,startDTS:f,endPTS:c,endDTS:c,type:g,hasAudio:l,hasVideo:a,nb:1,dropped:0};return S.audio=m.type==="audio"?m:void 0,S.video=m.type!=="audio"?m:void 0,S.text=u,S.id3=E,S.initSegment=h,S},v}(),k=function(w,R,C){return Object(I.getStartDTS)(w,R)-C};function D(v,w){var R=v==null?void 0:v.codec;return R&&R.length>4?R:R==="hvc1"?"hvc1.1.c.L120.90":R==="av01"?"av01.0.04M.08":R==="avc1"||w===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}z.default=N},"./src/task-loop.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"default",function(){return G});var G=function(){function I(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var P=I.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(N){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,N),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},I}()},"./src/types/cmcd.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"CMCDVersion",function(){return G}),L.d(z,"CMCDObjectType",function(){return I}),L.d(z,"CMCDStreamingFormat",function(){return P}),L.d(z,"CMCDStreamType",function(){return B});var G=1,I;(function(N){N.MANIFEST="m",N.AUDIO="a",N.VIDEO="v",N.MUXED="av",N.INIT="i",N.CAPTION="c",N.TIMED_TEXT="tt",N.KEY="k",N.OTHER="o"})(I||(I={}));var P;(function(N){N.DASH="d",N.HLS="h",N.SMOOTH="s",N.OTHER="o"})(P||(P={}));var B;(function(N){N.VOD="v",N.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"HlsSkip",function(){return P}),L.d(z,"getSkipValue",function(){return B}),L.d(z,"HlsUrlParameters",function(){return N}),L.d(z,"Level",function(){return k});function G(D,v){for(var w=0;w<v.length;w++){var R=v[w];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(D,R.key,R)}}function I(D,v,w){return v&&G(D.prototype,v),w&&G(D,w),D}var P;(function(D){D.No="",D.Yes="YES",D.v2="v2"})(P||(P={}));function B(D,v){var w=D.canSkipUntil,R=D.canSkipDateRanges,C=D.endSN,T=v!==void 0?v-C:0;return w&&T<w?R?P.v2:P.Yes:P.No}var N=function(){function D(w,R,C){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=w,this.part=R,this.skip=C}var v=D.prototype;return v.addDirectives=function(R){var C=new self.URL(R);return this.msn!==void 0&&C.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&C.searchParams.set("_HLS_part",this.part.toString()),this.skip&&C.searchParams.set("_HLS_skip",this.skip),C.toString()},D}(),k=function(){function D(v){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=[v.url],this.attrs=v.attrs,this.bitrate=v.bitrate,v.details&&(this.details=v.details),this.id=v.id||0,this.name=v.name,this.width=v.width||0,this.height=v.height||0,this.audioCodec=v.audioCodec,this.videoCodec=v.videoCodec,this.unknownCodecs=v.unknownCodecs,this.codecSet=[v.videoCodec,v.audioCodec].filter(function(w){return w}).join(",").replace(/\.[^.,]+/g,"")}return I(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(w){var R=w%this.url.length;this._urlId!==R&&(this.details=void 0,this._urlId=R)}}]),D}()},"./src/types/loader.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"PlaylistContextType",function(){return G}),L.d(z,"PlaylistLevelType",function(){return I});var G;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(G||(G={}));var I;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(I||(I={}))},"./src/types/transmuxer.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"ChunkMetadata",function(){return G});var G=function(B,N,k,D,v,w){D===void 0&&(D=0),v===void 0&&(v=-1),w===void 0&&(w=!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=I(),this.buffering={audio:I(),video:I(),audiovideo:I()},this.level=B,this.sn=N,this.id=k,this.size=D,this.part=v,this.partial=w};function I(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"AttrList",function(){return P});var G=/^(\d+)x(\d+)$/,I=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=function(){function B(k){typeof k=="string"&&(k=B.parseAttrList(k));for(var D in k)k.hasOwnProperty(D)&&(this[D]=k[D])}var N=B.prototype;return N.decimalInteger=function(D){var v=parseInt(this[D],10);return v>Number.MAX_SAFE_INTEGER?Infinity:v},N.hexadecimalInteger=function(D){if(this[D]){var v=(this[D]||"0x").slice(2);v=(v.length&1?"0":"")+v;for(var w=new Uint8Array(v.length/2),R=0;R<v.length/2;R++)w[R]=parseInt(v.slice(R*2,R*2+2),16);return w}else return null},N.hexadecimalIntegerAsNumber=function(D){var v=parseInt(this[D],16);return v>Number.MAX_SAFE_INTEGER?Infinity:v},N.decimalFloatingPoint=function(D){return parseFloat(this[D])},N.optionalFloat=function(D,v){var w=this[D];return w?parseFloat(w):v},N.enumeratedString=function(D){return this[D]},N.bool=function(D){return this[D]==="YES"},N.decimalResolution=function(D){var v=G.exec(this[D]);return v===null?void 0:{width:parseInt(v[1],10),height:parseInt(v[2],10)}},B.parseAttrList=function(D){var v,w={},R='"';for(I.lastIndex=0;(v=I.exec(D))!==null;){var C=v[2];C.indexOf(R)===0&&C.lastIndexOf(R)===C.length-1&&(C=C.slice(1,-1)),w[v[1]]=C}return w},B}()},"./src/utils/binary-search.ts":function(ee,z,L){"use strict";L.r(z);var G={search:function(P,B){for(var N=0,k=P.length-1,D=null,v=null;N<=k;){D=(N+k)/2|0,v=P[D];var w=B(v);if(w>0)N=D+1;else if(w<0)k=D-1;else return v}return null}};z.default=G},"./src/utils/buffer-helper.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"BufferHelper",function(){return P});var G=L("./src/utils/logger.ts"),I={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function B(){}return B.isBuffered=function(k,D){try{if(k){for(var v=B.getBuffered(k),w=0;w<v.length;w++)if(D>=v.start(w)&&D<=v.end(w))return!0}}catch(R){}return!1},B.bufferInfo=function(k,D,v){try{if(k){var w=B.getBuffered(k),R=[],C;for(C=0;C<w.length;C++)R.push({start:w.start(C),end:w.end(C)});return this.bufferedInfo(R,D,v)}}catch(T){}return{len:0,start:D,end:D,nextStart:void 0}},B.bufferedInfo=function(k,D,v){D=Math.max(0,D),k.sort(function(h,A){var b=h.start-A.start;return b||A.end-h.end});var w=[];if(v)for(var R=0;R<k.length;R++){var C=w.length;if(C){var T=w[C-1].end;k[R].start-T<v?k[R].end>T&&(w[C-1].end=k[R].end):w.push(k[R])}else w.push(k[R])}else w=k;for(var E=0,u,o=D,s=D,d=0;d<w.length;d++){var S=w[d].start,p=w[d].end;if(D+v>=S&&D<p)o=S,s=p,E=s-D;else if(D+v<S){u=S;break}}return{len:E,start:o||0,end:s||0,nextStart:u}},B.getBuffered=function(k){try{return k.buffered}catch(D){return G.logger.log("failed to get media.buffered",D),I}},B}()},"./src/utils/cea-608-parser.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"Row",function(){return s}),L.d(z,"CaptionScreen",function(){return d});var G=L("./src/utils/logger.ts"),I={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},P=function(c){var l=c;return I.hasOwnProperty(c)&&(l=I[c]),String.fromCharCode(l)},B=15,N=100,k={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},v={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},w={25:2,26:4,29:6,30:8,31:10,27:13,28:15},R=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],C;(function(f){f[f.ERROR=0]="ERROR",f[f.TEXT=1]="TEXT",f[f.WARNING=2]="WARNING",f[f.INFO=2]="INFO",f[f.DEBUG=3]="DEBUG",f[f.DATA=3]="DATA"})(C||(C={}));var T=function(){function f(){this.time=null,this.verboseLevel=C.ERROR}var c=f.prototype;return c.log=function(a,g){this.verboseLevel>=a&&G.logger.log(this.time+" ["+a+"] "+g)},f}(),E=function(c){for(var l=[],a=0;a<c.length;a++)l.push(c[a].toString(16));return l},u=function(){function f(l,a,g,m,y){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=l||"white",this.underline=a||!1,this.italics=g||!1,this.background=m||"black",this.flash=y||!1}var c=f.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(a){for(var g=["foreground","underline","italics","background","flash"],m=0;m<g.length;m++){var y=g[m];a.hasOwnProperty(y)&&(this[y]=a[y])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},c.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},f}(),o=function(){function f(l,a,g,m,y,M){this.uchar=void 0,this.penState=void 0,this.uchar=l||" ",this.penState=new u(a,g,m,y,M)}var c=f.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,g){this.uchar=a,this.penState.copy(g)},c.setPenState=function(a){this.penState.copy(a)},c.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},c.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},f}(),s=function(){function f(l){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<N;a++)this.chars.push(new o);this.logger=l,this.pos=0,this.currPenState=new u}var c=f.prototype;return c.equals=function(a){for(var g=!0,m=0;m<N;m++)if(!this.chars[m].equals(a.chars[m])){g=!1;break}return g},c.copy=function(a){for(var g=0;g<N;g++)this.chars[g].copy(a.chars[g])},c.isEmpty=function(){for(var a=!0,g=0;g<N;g++)if(!this.chars[g].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(C.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>N&&(this.logger.log(C.DEBUG,"Too large cursor position "+this.pos),this.pos=N)},c.moveCursor=function(a){var g=this.pos+a;if(a>1)for(var m=this.pos+1;m<g+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(g)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var g=P(a);if(this.pos>=N){this.logger.log(C.ERROR,"Cannot insert "+a.toString(16)+" ("+g+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(g,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var g;for(g=a;g<N;g++)this.chars[g].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var a=[],g=!0,m=0;m<N;m++){var y=this.chars[m].uchar;y!==" "&&(g=!1),a.push(y)}return g?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var g=this.chars[this.pos];g.setPenState(this.currPenState)},f}(),d=function(){function f(l){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<B;a++)this.rows.push(new s(l));this.logger=l,this.currRow=B-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=f.prototype;return c.reset=function(){for(var a=0;a<B;a++)this.rows[a].clear();this.currRow=B-1},c.equals=function(a){for(var g=!0,m=0;m<B;m++)if(!this.rows[m].equals(a.rows[m])){g=!1;break}return g},c.copy=function(a){for(var g=0;g<B;g++)this.rows[g].copy(a.rows[g])},c.isEmpty=function(){for(var a=!0,g=0;g<B;g++)if(!this.rows[g].isEmpty()){a=!1;break}return a},c.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},c.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},c.insertChar=function(a){var g=this.rows[this.currRow];g.insertChar(a)},c.setPen=function(a){var g=this.rows[this.currRow];g.setPenStyles(a)},c.moveCursor=function(a){var g=this.rows[this.currRow];g.moveCursor(a)},c.setCursor=function(a){this.logger.log(C.INFO,"setCursor: "+a);var g=this.rows[this.currRow];g.setCursor(a)},c.setPAC=function(a){this.logger.log(C.INFO,"pacData = "+JSON.stringify(a));var g=a.row-1;if(this.nrRollUpRows&&g<this.nrRollUpRows-1&&(g=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==g){for(var m=0;m<B;m++)this.rows[m].clear();var y=this.currRow+1-this.nrRollUpRows,M=this.lastOutputScreen;if(M){var F=M.rows[y].cueStartTime,j=this.logger.time;if(F&&j!==null&&F<j)for(var W=0;W<this.nrRollUpRows;W++)this.rows[g-this.nrRollUpRows+W+1].copy(M.rows[y+W])}}this.currRow=g;var O=this.rows[this.currRow];if(a.indent!==null){var _=a.indent,K=Math.max(_-1,0);O.setCursor(a.indent),a.color=O.chars[K].penState.foreground}var $={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen($)},c.setBkgData=function(a){this.logger.log(C.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},c.setRollUpRows=function(a){this.nrRollUpRows=a},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(C.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(C.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,g=this.rows.splice(a,1)[0];g.clear(),this.rows.splice(this.currRow,0,g),this.logger.log(C.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var g=[],m="",y=-1,M=0;M<B;M++){var F=this.rows[M].getTextString();F&&(y=M+1,a?g.push("Row "+y+": '"+F+"'"):g.push(F.trim()))}return g.length>0&&(a?m="["+g.join(" | ")+"]":m=g.join(`
|
|
`)),m},c.getTextAndFormat=function(){return this.rows},f}(),S=function(){function f(l,a,g){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=l,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new d(g),this.nonDisplayedMemory=new d(g),this.lastOutputScreen=new d(g),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=g}var c=f.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(a){this.outputFilter=a},c.setPAC=function(a){this.writeScreen.setPAC(a)},c.setBkgData=function(a){this.writeScreen.setBkgData(a)},c.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(C.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},c.insertChars=function(a){for(var g=0;g<a.length;g++)this.writeScreen.insertChar(a[g]);var m=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(C.INFO,m+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(C.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(C.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(C.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},c.ccAOF=function(){},c.ccAON=function(){},c.ccDER=function(){this.logger.log(C.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(C.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(C.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(C.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(C.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(C.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(C.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(C.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(C.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(C.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(C.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(C.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var g={flash:!1};if(g.underline=a%2===1,g.italics=a>=46,g.italics)g.foreground="white";else{var m=Math.floor(a/2)-16,y=["white","green","blue","cyan","red","yellow","magenta"];g.foreground=y[m]}this.logger.log(C.INFO,"MIDROW: "+JSON.stringify(g)),this.writeScreen.setPen(g)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var g=this.logger.time;if(g===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=g:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,g,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:g),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},f}(),p=function(){function f(l,a,g){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new T;this.channels=[null,new S(l,a,m),new S(l+1,g,m)],this.cmdHistory=b(),this.logger=m}var c=f.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,g){this.channels[a].setHandler(g)},c.addData=function(a,g){var m,y,M,F=!1;this.logger.time=a;for(var j=0;j<g.length;j+=2){if(y=g[j]&127,M=g[j+1]&127,y===0&&M===0)continue;if(this.logger.log(C.DATA,"["+E([g[j],g[j+1]])+"] -> ("+E([y,M])+")"),m=this.parseCmd(y,M),m||(m=this.parseMidrow(y,M)),m||(m=this.parsePAC(y,M)),m||(m=this.parseBackgroundAttributes(y,M)),!m&&(F=this.parseChars(y,M),F)){var W=this.currentChannel;if(W&&W>0){var O=this.channels[W];O.insertChars(F)}else this.logger.log(C.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!F&&this.logger.log(C.WARNING,"Couldn't parse cleaned data "+E([y,M])+" orig: "+E([g[j],g[j+1]]))}},c.parseCmd=function(a,g){var m=this.cmdHistory,y=(a===20||a===28||a===21||a===29)&&g>=32&&g<=47,M=(a===23||a===31)&&g>=33&&g<=35;if(!(y||M))return!1;if(A(a,g,m))return h(null,null,m),this.logger.log(C.DEBUG,"Repeated command ("+E([a,g])+") is dropped"),!0;var F=a===20||a===21||a===23?1:2,j=this.channels[F];return a===20||a===21||a===28||a===29?g===32?j.ccRCL():g===33?j.ccBS():g===34?j.ccAOF():g===35?j.ccAON():g===36?j.ccDER():g===37?j.ccRU(2):g===38?j.ccRU(3):g===39?j.ccRU(4):g===40?j.ccFON():g===41?j.ccRDC():g===42?j.ccTR():g===43?j.ccRTD():g===44?j.ccEDM():g===45?j.ccCR():g===46?j.ccENM():g===47&&j.ccEOC():j.ccTO(g-32),h(a,g,m),this.currentChannel=F,!0},c.parseMidrow=function(a,g){var m=0;if((a===17||a===25)&&g>=32&&g<=47){if(a===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(C.ERROR,"Mismatch channel in midrow parsing"),!1;var y=this.channels[m];return y?(y.ccMIDROW(g),this.logger.log(C.DEBUG,"MIDROW ("+E([a,g])+")"),!0):!1}return!1},c.parsePAC=function(a,g){var m,y=this.cmdHistory,M=(a>=17&&a<=23||a>=25&&a<=31)&&g>=64&&g<=127,F=(a===16||a===24)&&g>=64&&g<=95;if(!(M||F))return!1;if(A(a,g,y))return h(null,null,y),!0;var j=a<=23?1:2;g>=64&&g<=95?m=j===1?k[a]:v[a]:m=j===1?D[a]:w[a];var W=this.channels[j];return W?(W.setPAC(this.interpretPAC(m,g)),h(a,g,y),this.currentChannel=j,!0):!1},c.interpretPAC=function(a,g){var m,y={color:null,italics:!1,indent:null,underline:!1,row:a};return g>95?m=g-96:m=g-64,y.underline=(m&1)===1,m<=13?y.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(y.italics=!0,y.color="white"):y.indent=Math.floor((m-16)/2)*4,y},c.parseChars=function(a,g){var m,y=null,M=null;if(a>=25?(m=2,M=a-8):(m=1,M=a),M>=17&&M<=19){var F;M===17?F=g+80:M===18?F=g+112:F=g+144,this.logger.log(C.INFO,"Special char '"+P(F)+"' in channel "+m),y=[F]}else a>=32&&a<=127&&(y=g===0?[a]:[a,g]);if(y){var j=E(y);this.logger.log(C.DEBUG,"Char codes = "+j.join(",")),h(a,g,this.cmdHistory)}return y},c.parseBackgroundAttributes=function(a,g){var m=(a===16||a===24)&&g>=32&&g<=47,y=(a===23||a===31)&&g>=45&&g<=47;if(!(m||y))return!1;var M,F={};a===16||a===24?(M=Math.floor((g-32)/2),F.background=R[M],g%2===1&&(F.background=F.background+"_semi")):g===45?F.background="transparent":(F.foreground="black",g===47&&(F.underline=!0));var j=a<=23?1:2,W=this.channels[j];return W.setBkgData(F),h(a,g,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var g=this.channels[a];g&&g.reset()}this.cmdHistory=b()},c.cueSplitAtTime=function(a){for(var g=0;g<this.channels.length;g++){var m=this.channels[g];m&&m.cueSplitAtTime(a)}},f}();function h(f,c,l){l.a=f,l.b=c}function A(f,c,l){return l.a===f&&l.b===c}function b(){return{a:null,b:null}}z.default=p},"./src/utils/codecs.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"isCodecType",function(){return I}),L.d(z,"isCodecSupportedInMp4",function(){return P});var G={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 I(B,N){var k=G[N];return!!k&&k[B.slice(0,4)]===!0}function P(B,N){return MediaSource.isTypeSupported((N||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(ee,z,L){"use strict";L.r(z);var G=L("./src/utils/vttparser.ts"),I=L("./src/utils/webvtt-parser.ts"),P=L("./src/utils/texttrack-utils.ts"),B=/\s/,N={newCue:function(D,v,w,R){for(var C=[],T,E,u,o,s,d=self.VTTCue||self.TextTrackCue,S=0;S<R.rows.length;S++)if(T=R.rows[S],u=!0,o=0,s="",!T.isEmpty()){for(var p=0;p<T.chars.length;p++)B.test(T.chars[p].uchar)&&u?o++:(s+=T.chars[p].uchar,u=!1);T.cueStartTime=v,v===w&&(w+=1e-4),o>=16?o--:o++;var h=Object(G.fixLineBreaks)(s.trim()),A=Object(I.generateCueId)(v,w,h);(!D||!D.cues||!D.cues.getCueById(A))&&(E=new d(v,w,h),E.id=A,E.line=S+1,E.align="left",E.position=10+Math.min(80,Math.floor(o*8/32)*10),C.push(E))}return D&&C.length&&(C.sort(function(b,f){return b.line==="auto"||f.line==="auto"?0:b.line>8&&f.line>8?f.line-b.line:b.line-f.line}),C.forEach(function(b){return Object(P.addCueToTrack)(D,b)})),C}};z.default=N},"./src/utils/discontinuities.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"findFirstFragWithCC",function(){return B}),L.d(z,"shouldAlignOnDiscontinuities",function(){return N}),L.d(z,"findDiscontinuousReferenceFrag",function(){return k}),L.d(z,"adjustSlidingStart",function(){return v}),L.d(z,"alignStream",function(){return w}),L.d(z,"alignPDT",function(){return C}),L.d(z,"alignFragmentByPDTDelta",function(){return T}),L.d(z,"alignMediaPlaylistByPDT",function(){return E});var G=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts"),P=L("./src/controller/level-helper.ts");function B(u,o){for(var s=null,d=0,S=u.length;d<S;d++){var p=u[d];if(p&&p.cc===o){s=p;break}}return s}function N(u,o,s){return!!(o.details&&(s.endCC>s.startCC||u&&u.cc<s.startCC))}function k(u,o){var s=u.fragments,d=o.fragments;if(!d.length||!s.length){I.logger.log("No fragments to align");return}var S=B(s,d[0].cc);if(!S||S&&!S.startPTS){I.logger.log("No frag in previous level to align on");return}return S}function D(u,o){if(u){var s=u.start+o;u.start=u.startPTS=s,u.endPTS=s+u.duration}}function v(u,o){for(var s=o.fragments,d=0,S=s.length;d<S;d++)D(s[d],u);o.fragmentHint&&D(o.fragmentHint,u),o.alignedSliding=!0}function w(u,o,s){if(!o)return;R(u,s,o),!s.alignedSliding&&o.details&&C(s,o.details),!s.alignedSliding&&o.details&&!s.skippedSegments&&Object(P.adjustSliding)(o.details,s)}function R(u,o,s){if(N(u,s,o)){var d=k(s.details,o);d&&Object(G.isFiniteNumber)(d.start)&&(I.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),v(d.start,o))}}function C(u,o){if(!o.fragments.length||!u.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,d=u.fragments[0].programDateTime,S=(d-s)/1e3+o.fragments[0].start;S&&Object(G.isFiniteNumber)(S)&&(I.logger.log("Adjusting PTS using programDateTime delta "+(d-s)+"ms, sliding:"+S.toFixed(3)+" "+u.url+" "),v(S,u))}function T(u,o){var s=u.programDateTime;if(!s)return;var d=(s-o)/1e3;u.start=u.startPTS=d,u.endPTS=d+u.duration}function E(u,o){if(!o.fragments.length||!u.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,d=o.fragments[0].start,S=s-d*1e3;u.fragments.forEach(function(p){T(p,S)}),u.fragmentHint&&T(u.fragmentHint,S),u.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ee,z,L){"use strict";L.r(z);var G=L("./src/utils/ewma.ts"),I=function(){function P(N,k,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 G.default(N),this.fast_=new G.default(k)}var B=P.prototype;return B.update=function(k,D){var v=this.slow_,w=this.fast_;this.slow_.halfLife!==k&&(this.slow_=new G.default(k,v.getEstimate(),v.getTotalWeight())),this.fast_.halfLife!==D&&(this.fast_=new G.default(D,w.getEstimate(),w.getTotalWeight()))},B.sample=function(k,D){k=Math.max(k,this.minDelayMs_);var v=8*D,w=k/1e3,R=v/w;this.fast_.sample(w,R),this.slow_.sample(w,R)},B.canEstimate=function(){var k=this.fast_;return k&&k.getTotalWeight()>=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},P}();z.default=I},"./src/utils/ewma.ts":function(ee,z,L){"use strict";L.r(z);var G=function(){function I(B,N,k){N===void 0&&(N=0),k===void 0&&(k=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=B,this.alpha_=B?Math.exp(Math.log(.5)/B):0,this.estimate_=N,this.totalWeight_=k}var P=I.prototype;return P.sample=function(N,k){var D=Math.pow(this.alpha_,N);this.estimate_=k*(1-D)+D*this.estimate_,this.totalWeight_+=N},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var N=1-Math.pow(this.alpha_,this.totalWeight_);if(N)return this.estimate_/N}return this.estimate_},I}();z.default=G},"./src/utils/fetch-loader.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"fetchSupported",function(){return T});var G=L("./src/polyfills/number.ts"),I=L("./src/loader/load-stats.ts"),P=L("./src/demux/chunk-cache.ts");function B(d,S){d.prototype=Object.create(S.prototype),d.prototype.constructor=d,w(d,S)}function N(d){var S=typeof Map=="function"?new Map:void 0;return N=function(h){if(h===null||!v(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof S!="undefined"){if(S.has(h))return S.get(h);S.set(h,A)}function A(){return k(h,arguments,R(this).constructor)}return A.prototype=Object.create(h.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),w(A,h)},N(d)}function k(d,S,p){return D()?k=Reflect.construct:k=function(A,b,f){var c=[null];c.push.apply(c,b);var l=Function.bind.apply(A,c),a=new l;return f&&w(a,f.prototype),a},k.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(d){return!1}}function v(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function w(d,S){return w=Object.setPrototypeOf||function(h,A){return h.__proto__=A,h},w(d,S)}function R(d){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(p){return p.__proto__||Object.getPrototypeOf(p)},R(d)}function C(){return C=Object.assign||function(d){for(var S=1;S<arguments.length;S++){var p=arguments[S];for(var h in p)Object.prototype.hasOwnProperty.call(p,h)&&(d[h]=p[h])}return d},C.apply(this,arguments)}function T(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(d){}return!1}var E=function(){function d(p){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=p.fetchSetup||o,this.controller=new self.AbortController,this.stats=new I.LoadStats}var S=d.prototype;return S.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},S.abortInternal=function(){var h=this.response;(!h||!h.ok)&&(this.stats.aborted=!0,this.controller.abort())},S.abort=function(){var h;this.abortInternal(),(h=this.callbacks)!==null&&h!==void 0&&h.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},S.load=function(h,A,b){var f=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var l=u(h,this.controller.signal),a=b.onProgress,g=h.responseType==="arraybuffer",m=g?"byteLength":"length";this.context=h,this.config=A,this.callbacks=b,this.request=this.fetchSetup(h,l),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){f.abortInternal(),b.onTimeout(c,h,f.response)},A.timeout),self.fetch(this.request).then(function(y){if(f.response=f.loader=y,!y.ok){var M=y.status,F=y.statusText;throw new s(F||"fetch, bad network response",M,y)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(y.headers.get("Content-Length")||"0"),a&&Object(G.isFiniteNumber)(A.highWaterMark)?f.loadProgressively(y,c,h,A.highWaterMark,a):g?y.arrayBuffer():y.text()}).then(function(y){var M=f.response;self.clearTimeout(f.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=y[m];var F={url:M.url,data:y};a&&!Object(G.isFiniteNumber)(A.highWaterMark)&&a(c,h,y,M),b.onSuccess(F,c,h,M)}).catch(function(y){if(self.clearTimeout(f.requestTimeout),c.aborted)return;var M=y.code||0;b.onError({code:M,text:y.message},h,y.details)})},S.getCacheAge=function(){var h=null;if(this.response){var A=this.response.headers.get("age");h=A?parseFloat(A):null}return h},S.loadProgressively=function(h,A,b,f,c){f===void 0&&(f=0);var l=new P.default,a=h.body.getReader(),g=function m(){return a.read().then(function(y){if(y.done)return l.dataLength&&c(A,b,l.flush(),h),Promise.resolve(new ArrayBuffer(0));var M=y.value,F=M.length;return A.loaded+=F,F<f||l.dataLength?(l.push(M),l.dataLength>=f&&c(A,b,l.flush(),h)):c(A,b,M,h),m()}).catch(function(){return Promise.reject()})};return g()},d}();function u(d,S){var p={method:"GET",mode:"cors",credentials:"same-origin",signal:S,headers:new self.Headers(C({},d.headers))};return d.rangeEnd&&p.headers.set("Range","bytes="+d.rangeStart+"-"+String(d.rangeEnd-1)),p}function o(d,S){return new self.Request(d.url,S)}var s=function(d){B(S,d);function S(p,h,A){var b;return b=d.call(this,p)||this,b.code=void 0,b.details=void 0,b.code=h,b.details=A,b}return S}(N(Error));z.default=E},"./src/utils/imsc1-ttml-parser.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"IMSC1_CODEC",function(){return v}),L.d(z,"parseIMSC1",function(){return T});var G=L("./src/utils/mp4-tools.ts"),I=L("./src/utils/vttparser.ts"),P=L("./src/utils/vttcue.ts"),B=L("./src/demux/id3.ts"),N=L("./src/utils/timescale-conversion.ts"),k=L("./src/utils/webvtt-parser.ts");function D(){return D=Object.assign||function(f){for(var c=1;c<arguments.length;c++){var l=arguments[c];for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&(f[a]=l[a])}return f},D.apply(this,arguments)}var v="stpp.ttml.im1t",w=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,R=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,C={left:"start",center:"center",right:"end",start:"start",end:"end"};function T(f,c,l,a,g){var m=Object(G.findBox)(new Uint8Array(f),["mdat"]);if(m.length===0){g(new Error("Could not parse IMSC1 mdat"));return}var y=m[0],M=Object(B.utf8ArrayToStr)(new Uint8Array(f,y.start,y.end-y.start)),F=Object(N.toTimescaleFromScale)(c,1,l);try{a(E(M,F))}catch(j){g(j)}}function E(f,c){var l=new DOMParser,a=l.parseFromString(f,"text/xml"),g=a.getElementsByTagName("tt")[0];if(!g)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},y=Object.keys(m).reduce(function(O,_){return O[_]=g.getAttribute("ttp:"+_)||m[_],O},{}),M=g.getAttribute("xml:space")!=="preserve",F=o(u(g,"styling","style")),j=o(u(g,"layout","region")),W=u(g,"body","[begin]");return[].map.call(W,function(O){var _=s(O,M);if(!_||!O.hasAttribute("begin"))return null;var K=h(O.getAttribute("begin"),y),$=h(O.getAttribute("dur"),y),q=h(O.getAttribute("end"),y);if(K===null)throw p(O);if(q===null){if($===null)throw p(O);q=K+$}var ne=new P.default(K-c,q-c,_);ne.id=Object(k.generateCueId)(ne.startTime,ne.endTime,ne.text);var Te=j[O.getAttribute("region")],ve=F[O.getAttribute("style")];ne.position=10,ne.size=80;var ge=d(Te,ve),ce=ge.textAlign;if(ce){var he=C[ce];he&&(ne.lineAlign=he),ne.align=ce}return D(ne,ge),ne}).filter(function(O){return O!==null})}function u(f,c,l){var a=f.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(l)):[]}function o(f){return f.reduce(function(c,l){var a=l.getAttribute("xml:id");return a&&(c[a]=l),c},{})}function s(f,c){return[].slice.call(f.childNodes).reduce(function(l,a,g){var m;return a.nodeName==="br"&&g?l+`
|
|
`:(m=a.childNodes)!==null&&m!==void 0&&m.length?s(a,c):c?l+a.textContent.trim().replace(/\s+/g," "):l+a.textContent},"")}function d(f,c){var l="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(g,m){var y=S(c,l,m)||S(f,l,m);return y&&(g[m]=y),g},{})}function S(f,c,l){return f.hasAttributeNS(c,l)?f.getAttributeNS(c,l):null}function p(f){return new Error("Could not parse ttml timestamp "+f)}function h(f,c){if(!f)return null;var l=Object(I.parseTimeStamp)(f);return l===null&&(w.test(f)?l=A(f,c):R.test(f)&&(l=b(f,c))),l}function A(f,c){var l=w.exec(f),a=(l[4]|0)+(l[5]|0)/c.subFrameRate;return(l[1]|0)*3600+(l[2]|0)*60+(l[3]|0)+a/c.frameRate}function b(f,c){var l=R.exec(f),a=Number(l[1]),g=l[2];switch(g){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/c.frameRate;case"t":return a/c.tickRate}return a}},"./src/utils/logger.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"enableLogs",function(){return k}),L.d(z,"logger",function(){return D});var G=function(){},I={trace:G,debug:G,log:G,warn:G,info:G,error:G},P=I;function B(v){var w=self.console[v];return w?w.bind(self.console,"["+v+"] >"):G}function N(v){for(var w=arguments.length,R=new Array(w>1?w-1:0),C=1;C<w;C++)R[C-1]=arguments[C];R.forEach(function(T){P[T]=v[T]?v[T].bind(v):B(T)})}function k(v){if(self.console&&v===!0||typeof v=="object"){N(v,"debug","log","info","warn","error");try{P.log()}catch(w){P=I}}else P=I}var D=P},"./src/utils/mediakeys-helper.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"KeySystems",function(){return G}),L.d(z,"requestMediaKeySystemAccess",function(){return I});var G;(function(P){P.WIDEVINE="com.widevine.alpha",P.PLAYREADY="com.microsoft.playready"})(G||(G={}));var I=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"getMediaSource",function(){return G});function G(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"bin2str",function(){return N}),L.d(z,"readUint16",function(){return k}),L.d(z,"readUint32",function(){return D}),L.d(z,"writeUint32",function(){return v}),L.d(z,"findBox",function(){return w}),L.d(z,"parseSegmentIndex",function(){return R}),L.d(z,"parseInitSegment",function(){return C}),L.d(z,"getStartDTS",function(){return T}),L.d(z,"getDuration",function(){return E}),L.d(z,"computeRawDurationFromSamples",function(){return u}),L.d(z,"offsetStartDTS",function(){return o}),L.d(z,"segmentValidRange",function(){return s}),L.d(z,"appendUint8Array",function(){return d});var G=L("./src/utils/typed-array.ts"),I=L("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,B=[].push;function N(S){return String.fromCharCode.apply(null,S)}function k(S,p){"data"in S&&(p+=S.start,S=S.data);var h=S[p]<<8|S[p+1];return h<0?65536+h:h}function D(S,p){"data"in S&&(p+=S.start,S=S.data);var h=S[p]<<24|S[p+1]<<16|S[p+2]<<8|S[p+3];return h<0?4294967296+h:h}function v(S,p,h){"data"in S&&(p+=S.start,S=S.data),S[p]=h>>24,S[p+1]=h>>16&255,S[p+2]=h>>8&255,S[p+3]=h&255}function w(S,p){var h=[];if(!p.length)return h;var A,b,f;"data"in S?(A=S.data,b=S.start,f=S.end):(A=S,b=0,f=A.byteLength);for(var c=b;c<f;){var l=D(A,c),a=N(A.subarray(c+4,c+8)),g=l>1?c+l:f;if(a===p[0])if(p.length===1)h.push({data:A,start:c+8,end:g});else{var m=w({data:A,start:c+8,end:g},p.slice(1));m.length&&B.apply(h,m)}c=g}return h}function R(S){var p=w(S,["moov"]),h=p[0],A=h?h.end:null,b=w(S,["sidx"]);if(!b||!b[0])return null;var f=[],c=b[0],l=c.data[0],a=l===0?8:16,g=D(c,a);a+=4;var m=0,y=0;l===0?a+=8:a+=16,a+=2;var M=c.end+y,F=k(c,a);a+=2;for(var j=0;j<F;j++){var W=a,O=D(c,W);W+=4;var _=O&2147483647,K=(O&2147483648)>>>31;if(K===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var $=D(c,W);W+=4,f.push({referenceSize:_,subsegmentDuration:$,info:{duration:$/g,start:M,end:M+_-1}}),M+=_,W+=4,a=W}return{earliestPresentationTime:m,timescale:g,version:l,referencesCount:F,references:f,moovEndOffset:A}}function C(S){for(var p=[],h=w(S,["moov","trak"]),A=0;A<h.length;A++){var b=h[A],f=w(b,["tkhd"])[0];if(f){var c=f.data[f.start],l=c===0?12:20,a=D(f,l),g=w(b,["mdia","mdhd"])[0];if(g){c=g.data[g.start],l=c===0?12:20;var m=D(g,l),y=w(b,["mdia","hdlr"])[0];if(y){var M=N(y.data.subarray(y.start+8,y.start+12)),F={soun:I.ElementaryStreamTypes.AUDIO,vide:I.ElementaryStreamTypes.VIDEO}[M];if(F){var j=w(b,["mdia","minf","stbl","stsd"])[0],W=void 0;j&&(W=N(j.data.subarray(j.start+12,j.start+16))),p[a]={timescale:m,type:F},p[F]={timescale:m,id:a,codec:W}}}}}}var O=w(S,["moov","mvex","trex"]);return O.forEach(function(_){var K=D(_,4),$=p[K];$&&($.default={duration:D(_,12),flags:D(_,20)})}),p}function T(S,p){return w(p,["moof","traf"]).reduce(function(h,A){var b=w(A,["tfdt"])[0],f=b.data[b.start],c=w(A,["tfhd"]).reduce(function(l,a){var g=D(a,4),m=S[g];if(m){var y=D(b,4);f===1&&(y*=Math.pow(2,32),y+=D(b,8));var M=m.timescale||9e4,F=y/M;if(isFinite(F)&&(l===null||F<l))return F}return l},null);return c!==null&&isFinite(c)&&(h===null||c<h)?c:h},null)||0}function E(S,p){for(var h=0,A=0,b=0,f=w(S,["moof","traf"]),c=0;c<f.length;c++){var l=f[c],a=w(l,["tfhd"])[0],g=D(a,4),m=p[g];if(!m)continue;var y=m.default,M=D(a,0)|(y==null?void 0:y.flags),F=y==null?void 0:y.duration;M&8&&(M&2?F=D(a,12):F=D(a,8));for(var j=m.timescale||9e4,W=w(l,["trun"]),O=0;O<W.length;O++){if(F){var _=D(W[O],4);h=F*_}else h=u(W[O]);m.type===I.ElementaryStreamTypes.VIDEO?A+=h/j:m.type===I.ElementaryStreamTypes.AUDIO&&(b+=h/j)}}if(A===0&&b===0){var K=R(S);if(K!=null&&K.references)return K.references.reduce(function($,q){return $+q.info.duration||0},0)}return A||b}function u(S){var p=D(S,0),h=8;p&1&&(h+=4),p&4&&(h+=4);for(var A=0,b=D(S,4),f=0;f<b;f++){if(p&256){var c=D(S,h);A+=c,h+=4}p&512&&(h+=4),p&1024&&(h+=4),p&2048&&(h+=4)}return A}function o(S,p,h){w(p,["moof","traf"]).forEach(function(A){w(A,["tfhd"]).forEach(function(b){var f=D(b,4),c=S[f];if(!c)return;var l=c.timescale||9e4;w(A,["tfdt"]).forEach(function(a){var g=a.data[a.start],m=D(a,4);if(g===0)v(a,4,m-h*l);else{m*=Math.pow(2,32),m+=D(a,8),m-=h*l,m=Math.max(m,0);var y=Math.floor(m/(P+1)),M=Math.floor(m%(P+1));v(a,4,y),v(a,8,M)}})})})}function s(S){var p={valid:null,remainder:null},h=w(S,["moof"]);if(h){if(h.length<2)return p.remainder=S,p}else return p;var A=h[h.length-1];return p.valid=Object(G.sliceUint8)(S,0,A.start-8),p.remainder=Object(G.sliceUint8)(S,A.start-8),p}function d(S,p){var h=new Uint8Array(S.length+p.length);return h.set(S),h.set(p,S.length),h}},"./src/utils/output-filter.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"default",function(){return G});var G=function(){function I(B,N){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=B,this.trackName=N}var P=I.prototype;return P.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},P.newCue=function(N,k,D){(this.startTime===null||this.startTime>N)&&(this.startTime=N),this.endTime=k,this.screen=D,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},I}()},"./src/utils/texttrack-utils.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"sendAddTrackEvent",function(){return I}),L.d(z,"addCueToTrack",function(){return P}),L.d(z,"clearCurrentCues",function(){return B}),L.d(z,"removeCuesInRange",function(){return N}),L.d(z,"getCuesInRange",function(){return D});var G=L("./src/utils/logger.ts");function I(v,w){var R;try{R=new Event("addtrack")}catch(C){R=document.createEvent("Event"),R.initEvent("addtrack",!1,!1)}R.track=v,w.dispatchEvent(R)}function P(v,w){var R=v.mode;if(R==="disabled"&&(v.mode="hidden"),v.cues&&!v.cues.getCueById(w.id))try{if(v.addCue(w),!v.cues.getCueById(w.id))throw new Error("addCue is failed for: "+w)}catch(T){G.logger.debug("[texttrack-utils]: "+T);var C=new self.TextTrackCue(w.startTime,w.endTime,w.text);C.id=w.id,v.addCue(C)}R==="disabled"&&(v.mode=R)}function B(v){var w=v.mode;if(w==="disabled"&&(v.mode="hidden"),v.cues)for(var R=v.cues.length;R--;)v.removeCue(v.cues[R]);w==="disabled"&&(v.mode=w)}function N(v,w,R){var C=v.mode;if(C==="disabled"&&(v.mode="hidden"),v.cues&&v.cues.length>0)for(var T=D(v.cues,w,R),E=0;E<T.length;E++)v.removeCue(T[E]);C==="disabled"&&(v.mode=C)}function k(v,w){if(w<v[0].startTime)return 0;var R=v.length-1;if(w>v[R].endTime)return-1;for(var C=0,T=R;C<=T;){var E=Math.floor((T+C)/2);if(w<v[E].startTime)T=E-1;else if(w>v[E].startTime&&C<R)C=E+1;else return E}return v[C].startTime-w<w-v[T].startTime?C:T}function D(v,w,R){var C=[],T=k(v,w);if(T>-1)for(var E=T,u=v.length;E<u;E++){var o=v[E];if(o.startTime>=w&&o.endTime<=R)C.push(o);else if(o.startTime>R)return C}return C}},"./src/utils/time-ranges.ts":function(ee,z,L){"use strict";L.r(z);var G={toString:function(P){for(var B="",N=P.length,k=0;k<N;k++)B+="["+P.start(k).toFixed(3)+","+P.end(k).toFixed(3)+"]";return B}};z.default=G},"./src/utils/timescale-conversion.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"toTimescaleFromBase",function(){return I}),L.d(z,"toTimescaleFromScale",function(){return P}),L.d(z,"toMsFromMpegTsClock",function(){return B}),L.d(z,"toMpegTsClockFromTimescale",function(){return N});var G=9e4;function I(k,D,v,w){v===void 0&&(v=1),w===void 0&&(w=!1);var R=k*D*v;return w?Math.round(R):R}function P(k,D,v,w){return v===void 0&&(v=1),w===void 0&&(w=!1),I(k,D,1/v,w)}function B(k,D){return D===void 0&&(D=!1),I(k,1e3,1/G,D)}function N(k,D){return D===void 0&&(D=1),I(k,G,1/D)}},"./src/utils/typed-array.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"sliceUint8",function(){return G});function G(I,P,B){return Uint8Array.prototype.slice?I.slice(P,B):new Uint8Array(Array.prototype.slice.call(I,P,B))}},"./src/utils/vttcue.ts":function(ee,z,L){"use strict";L.r(z),z.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var G=["","lr","rl"],I=["start","middle","end","left","right"];function P(v,w){if(typeof w!="string")return!1;if(!Array.isArray(v))return!1;var R=w.toLowerCase();return~v.indexOf(R)?R:!1}function B(v){return P(G,v)}function N(v){return P(I,v)}function k(v){for(var w=arguments.length,R=new Array(w>1?w-1:0),C=1;C<w;C++)R[C-1]=arguments[C];for(var T=1;T<arguments.length;T++){var E=arguments[T];for(var u in E)v[u]=E[u]}return v}function D(v,w,R){var C=this,T={enumerable:!0};C.hasBeenReset=!1;var E="",u=!1,o=v,s=w,d=R,S=null,p="",h=!0,A="auto",b="start",f=50,c="middle",l=50,a="middle";Object.defineProperty(C,"id",k({},T,{get:function(){return E},set:function(m){E=""+m}})),Object.defineProperty(C,"pauseOnExit",k({},T,{get:function(){return u},set:function(m){u=!!m}})),Object.defineProperty(C,"startTime",k({},T,{get:function(){return o},set:function(m){if(typeof m!="number")throw new TypeError("Start time must be set to a number.");o=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"endTime",k({},T,{get:function(){return s},set:function(m){if(typeof m!="number")throw new TypeError("End time must be set to a number.");s=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"text",k({},T,{get:function(){return d},set:function(m){d=""+m,this.hasBeenReset=!0}})),Object.defineProperty(C,"region",k({},T,{get:function(){return S},set:function(m){S=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"vertical",k({},T,{get:function(){return p},set:function(m){var y=B(m);if(y===!1)throw new SyntaxError("An invalid or illegal string was specified.");p=y,this.hasBeenReset=!0}})),Object.defineProperty(C,"snapToLines",k({},T,{get:function(){return h},set:function(m){h=!!m,this.hasBeenReset=!0}})),Object.defineProperty(C,"line",k({},T,{get:function(){return A},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");A=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"lineAlign",k({},T,{get:function(){return b},set:function(m){var y=N(m);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");b=y,this.hasBeenReset=!0}})),Object.defineProperty(C,"position",k({},T,{get:function(){return f},set:function(m){if(m<0||m>100)throw new Error("Position must be between 0 and 100.");f=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"positionAlign",k({},T,{get:function(){return c},set:function(m){var y=N(m);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");c=y,this.hasBeenReset=!0}})),Object.defineProperty(C,"size",k({},T,{get:function(){return l},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");l=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"align",k({},T,{get:function(){return a},set:function(m){var y=N(m);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");a=y,this.hasBeenReset=!0}})),C.displayState=void 0}return D.prototype.getCueAsHTML=function(){var v=self.WebVTT;return v.convertCueToDOMTree(self,this.text)},D}()},"./src/utils/vttparser.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"parseTimeStamp",function(){return P}),L.d(z,"fixLineBreaks",function(){return w}),L.d(z,"VTTParser",function(){return R});var G=L("./src/utils/vttcue.ts"),I=function(){function C(){}var T=C.prototype;return T.decode=function(u,o){if(!u)return"";if(typeof u!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(u))},C}();function P(C){function T(u,o,s,d){return(u|0)*3600+(o|0)*60+(s|0)+parseFloat(d||0)}var E=C.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return E?parseFloat(E[2])>59?T(E[2],E[3],0,E[4]):T(E[1],E[2],E[3],E[4]):null}var B=function(){function C(){this.values=Object.create(null)}var T=C.prototype;return T.set=function(u,o){!this.get(u)&&o!==""&&(this.values[u]=o)},T.get=function(u,o,s){return s?this.has(u)?this.values[u]:o[s]:this.has(u)?this.values[u]:o},T.has=function(u){return u in this.values},T.alt=function(u,o,s){for(var d=0;d<s.length;++d)if(o===s[d]){this.set(u,o);break}},T.integer=function(u,o){/^-?\d+$/.test(o)&&this.set(u,parseInt(o,10))},T.percent=function(u,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var s=parseFloat(o);if(s>=0&&s<=100)return this.set(u,s),!0}return!1},C}();function N(C,T,E,u){var o=u?C.split(u):[C];for(var s in o){if(typeof o[s]!="string")continue;var d=o[s].split(E);if(d.length!==2)continue;var S=d[0],p=d[1];T(S,p)}}var k=new G.default(0,0,""),D=k.align==="middle"?"middle":"center";function v(C,T,E){var u=C;function o(){var S=P(C);if(S===null)throw new Error("Malformed timestamp: "+u);return C=C.replace(/^[^\sa-zA-Z-]+/,""),S}function s(S,p){var h=new B;N(S,function(f,c){var l;switch(f){case"region":for(var a=E.length-1;a>=0;a--)if(E[a].id===c){h.set(f,E[a].region);break}break;case"vertical":h.alt(f,c,["rl","lr"]);break;case"line":l=c.split(","),h.integer(f,l[0]),h.percent(f,l[0])&&h.set("snapToLines",!1),h.alt(f,l[0],["auto"]),l.length===2&&h.alt("lineAlign",l[1],["start",D,"end"]);break;case"position":l=c.split(","),h.percent(f,l[0]),l.length===2&&h.alt("positionAlign",l[1],["start",D,"end","line-left","line-right","auto"]);break;case"size":h.percent(f,c);break;case"align":h.alt(f,c,["start",D,"end","left","right"]);break}},/:/,/\s/),p.region=h.get("region",null),p.vertical=h.get("vertical","");var A=h.get("line","auto");A==="auto"&&k.line===-1&&(A=-1),p.line=A,p.lineAlign=h.get("lineAlign","start"),p.snapToLines=h.get("snapToLines",!0),p.size=h.get("size",100),p.align=h.get("align",D);var b=h.get("position","auto");b==="auto"&&k.position===50&&(b=p.align==="start"||p.align==="left"?0:p.align==="end"||p.align==="right"?100:50),p.position=b}function d(){C=C.replace(/^\s+/,"")}if(d(),T.startTime=o(),d(),C.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+u);C=C.substr(3),d(),T.endTime=o(),d(),s(C,T)}function w(C){return C.replace(/<br(?: \/)?>/gi,`
|
|
`)}var R=function(){function C(){this.state="INITIAL",this.buffer="",this.decoder=new I,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var T=C.prototype;return T.parse=function(u){var o=this;u&&(o.buffer+=o.decoder.decode(u,{stream:!0}));function s(){var b=o.buffer,f=0;for(b=w(b);f<b.length&&b[f]!=="\r"&&b[f]!==`
|
|
`;)++f;var c=b.substr(0,f);return b[f]==="\r"&&++f,b[f]===`
|
|
`&&++f,o.buffer=b.substr(f),c}function d(b){N(b,function(f,c){},/:/)}try{var S="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;S=s();var p=S.match(/^()?WEBVTT([ \t].*)?$/);if(!p||!p[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var h=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;h?h=!1:S=s();switch(o.state){case"HEADER":/:/.test(S)?d(S):S||(o.state="ID");continue;case"NOTE":S||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(S)){o.state="NOTE";break}if(!S)continue;if(o.cue=new G.default(0,0,""),o.state="CUE",S.indexOf("-->")===-1){o.cue.id=S;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{v(S,o.cue,o.regionList)}catch(b){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var A=S.indexOf("-->")!==-1;if(!S||A&&(h=!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+=S}continue;case"BADCUE":S||(o.state="ID")}}}catch(b){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},T.flush=function(){var u=this;try{if((u.cue||u.state==="HEADER")&&(u.buffer+=`
|
|
|
|
`,u.parse()),u.state==="INITIAL"||u.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){u.onparsingerror&&u.onparsingerror(o)}return u.onflush&&u.onflush(),this},C}()},"./src/utils/webvtt-parser.ts":function(ee,z,L){"use strict";L.r(z),L.d(z,"generateCueId",function(){return R}),L.d(z,"parseWebVTT",function(){return T});var G=L("./src/polyfills/number.ts"),I=L("./src/utils/vttparser.ts"),P=L("./src/demux/id3.ts"),B=L("./src/utils/timescale-conversion.ts"),N=L("./src/remux/mp4-remuxer.ts"),k=/\r\n|\n\r|\n|\r/g,D=function(u,o,s){return s===void 0&&(s=0),u.substr(s,o.length)===o},v=function(u){var o=parseInt(u.substr(-3)),s=parseInt(u.substr(-6,2)),d=parseInt(u.substr(-9,2)),S=u.length>9?parseInt(u.substr(0,u.indexOf(":"))):0;if(!Object(G.isFiniteNumber)(o)||!Object(G.isFiniteNumber)(s)||!Object(G.isFiniteNumber)(d)||!Object(G.isFiniteNumber)(S))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+u);return o+=1e3*s,o+=60*1e3*d,o+=60*60*1e3*S,o},w=function(u){for(var o=5381,s=u.length;s;)o=o*33^u.charCodeAt(--s);return(o>>>0).toString()};function R(E,u,o){return w(E.toString())+w(u.toString())+w(o)}var C=function(u,o,s){var d=u[o],S=u[d.prevCC];if(!S||!S.new&&d.new){u.ccOffset=u.presentationOffset=d.start,d.new=!1;return}for(;(p=S)!==null&&p!==void 0&&p.new;){var p;u.ccOffset+=d.start-S.start,d.new=!1,d=S,S=u[d.prevCC]}u.presentationOffset=s};function T(E,u,o,s,d,S,p,h){var A=new I.VTTParser,b=Object(P.utf8ArrayToStr)(new Uint8Array(E)).trim().replace(k,`
|
|
`).split(`
|
|
`),f=[],c=Object(B.toMpegTsClockFromTimescale)(u,o),l="00:00.000",a=0,g=0,m,y=!0,M=!1;A.oncue=function(F){var j=s[d],W=s.ccOffset,O=(a-c)/9e4;if(j!=null&&j.new&&(g!==void 0?W=s.ccOffset=j.start:C(s,d,O)),O&&(W=O-s.presentationOffset),M){var _=F.endTime-F.startTime,K=Object(N.normalizePts)((F.startTime+W-g)*9e4,S*9e4)/9e4;F.startTime=K,F.endTime=K+_}var $=F.text.trim();F.text=decodeURIComponent(encodeURIComponent($)),F.id||(F.id=R(F.startTime,F.endTime,$)),F.endTime>0&&f.push(F)},A.onparsingerror=function(F){m=F},A.onflush=function(){if(m){h(m);return}p(f)},b.forEach(function(F){if(y)if(D(F,"X-TIMESTAMP-MAP=")){y=!1,M=!0,F.substr(16).split(",").forEach(function(j){D(j,"LOCAL:")?l=j.substr(6):D(j,"MPEGTS:")&&(a=parseInt(j.substr(7)))});try{g=v(l)/1e3}catch(j){M=!1,m=j}return}else F===""&&(y=!1);A.parse(F+`
|
|
`)}),A.flush()}},"./src/utils/xhr-loader.ts":function(ee,z,L){"use strict";L.r(z);var G=L("./src/utils/logger.ts"),I=L("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,B=function(){function N(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 I.LoadStats,this.retryDelay=0}var k=N.prototype;return k.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},k.abortInternal=function(){var v=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),v&&(v.onreadystatechange=null,v.onprogress=null,v.readyState!==4&&(this.stats.aborted=!0,v.abort()))},k.abort=function(){var v;this.abortInternal(),(v=this.callbacks)!==null&&v!==void 0&&v.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},k.load=function(v,w,R){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=v,this.config=w,this.callbacks=R,this.retryDelay=w.retryDelay,this.loadInternal()},k.loadInternal=function(){var v=this.config,w=this.context;if(!v)return;var R=this.loader=new self.XMLHttpRequest,C=this.stats;C.loading.first=0,C.loaded=0;var T=this.xhrSetup;try{if(T)try{T(R,w.url)}catch(o){R.open("GET",w.url,!0),T(R,w.url)}R.readyState||R.open("GET",w.url,!0);var E=this.context.headers;if(E)for(var u in E)R.setRequestHeader(u,E[u])}catch(o){this.callbacks.onError({code:R.status,text:o.message},w,R);return}w.rangeEnd&&R.setRequestHeader("Range","bytes="+w.rangeStart+"-"+(w.rangeEnd-1)),R.onreadystatechange=this.readystatechange.bind(this),R.onprogress=this.loadprogress.bind(this),R.responseType=w.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),v.timeout),R.send()},k.readystatechange=function(){var v=this.context,w=this.loader,R=this.stats;if(!v||!w)return;var C=w.readyState,T=this.config;if(R.aborted)return;if(C>=2)if(self.clearTimeout(this.requestTimeout),R.loading.first===0&&(R.loading.first=Math.max(self.performance.now(),R.loading.start)),C===4){w.onreadystatechange=null,w.onprogress=null;var E=w.status;if(E>=200&&E<300){R.loading.end=Math.max(self.performance.now(),R.loading.first);var u,o;if(v.responseType==="arraybuffer"?(u=w.response,o=u.byteLength):(u=w.responseText,o=u.length),R.loaded=R.total=o,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(R,v,u,w),!this.callbacks)return;var d={url:w.responseURL,data:u};this.callbacks.onSuccess(d,R,v,w)}else R.retry>=T.maxRetry||E>=400&&E<499?(G.logger.error(E+" while loading "+v.url),this.callbacks.onError({code:E,text:w.statusText},v,w)):(G.logger.warn(E+" while loading "+v.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,T.maxRetryDelay),R.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),T.timeout)},k.loadtimeout=function(){G.logger.warn("timeout while loading "+this.context.url);var v=this.callbacks;v&&(this.abortInternal(),v.onTimeout(this.stats,this.context,this.loader))},k.loadprogress=function(v){var w=this.stats;w.loaded=v.loaded,v.lengthComputable&&(w.total=v.total)},k.getCacheAge=function(){var v=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var w=this.loader.getResponseHeader("age");v=w?parseFloat(w):null}return v},N}();z.default=B}}).default})},wzkS:function(ut,Ye,ie){"use strict";ie.d(Ye,"c",function(){return I}),ie.d(Ye,"b",function(){return P}),ie.d(Ye,"d",function(){return B}),ie.d(Ye,"a",function(){return k}),ie.d(Ye,"e",function(){return D});var ee=ie("9og8"),z=ie("WmNS"),L=ie.n(z),G=ie("ErOA");function I(v){return Object(G.c)("libraries/".concat(v,".json"))}function P(){return Object(G.c)("library_tags.json")}function B(v){return N.apply(this,arguments)}function N(){return N=Object(ee.a)(L.a.mark(function v(w){var R;return L.a.wrap(function(T){for(;;)switch(T.prev=T.next){case 0:return T.next=2,Object(G.b)("attachments/".concat(w,".json"));case 2:return R=T.sent,T.abrupt("return",R.status===0);case 4:case"end":return T.stop()}},v)})),N.apply(this,arguments)}function k(v){return Object(G.f)("libraries.json",v)}function D(v,w){return Object(G.g)("libraries/".concat(v,".json"),w)}}}]);
|