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
760 KiB
138 lines
760 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[186,6,7,16],{"+NIl":function(Ze,Ke,te){(function(J){J(te("VrN/"))})(function(J){"use strict";J.defineMode("stex",function(K,L){"use strict";function H(w,b){w.cmdState.push(b)}function I(w){return w.cmdState.length>0?w.cmdState[w.cmdState.length-1]:null}function O(w){var b=w.cmdState.pop();b&&b.closeBracket()}function B(w){for(var b=w.cmdState,E=b.length-1;E>=0;E--){var l=b[E];if(l.name=="DEFAULT")continue;return l}return{styleIdentifier:function(){return null}}}function N(w,b,E){return function(){this.name=w,this.bracketNo=0,this.style=b,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 R={};R.importmodule=N("importmodule","tag",["string","builtin"]),R.documentclass=N("documentclass","tag",["","atom"]),R.usepackage=N("usepackage","tag",["atom"]),R.begin=N("begin","tag",["atom"]),R.end=N("end","tag",["atom"]),R.label=N("label","tag",["atom"]),R.ref=N("ref","tag",["atom"]),R.eqref=N("eqref","tag",["atom"]),R.cite=N("cite","tag",["atom"]),R.bibitem=N("bibitem","tag",["atom"]),R.Bibitem=N("Bibitem","tag",["atom"]),R.RBibitem=N("RBibitem","tag",["atom"]),R.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function A(w,b){w.f=b}function f(w,b){var E;if(w.match(/^\\[a-zA-Z@]+/)){var l=w.current().slice(1);return E=R.hasOwnProperty(l)?R[l]:R.DEFAULT,E=new E,H(b,E),A(b,P),E.style}if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/\\]/))return"tag";if(w.match("\\["))return A(b,function(s,d){return v(s,d,"\\]")}),"keyword";if(w.match("\\("))return A(b,function(s,d){return v(s,d,"\\)")}),"keyword";if(w.match("$$"))return A(b,function(s,d){return v(s,d,"$$")}),"keyword";if(w.match("$"))return A(b,function(s,d){return v(s,d,"$")}),"keyword";var o=w.next();if(o=="%")return w.skipToEnd(),"comment";if(o=="}"||o=="]"){if(E=I(b),E)E.closeBracket(o),A(b,P);else return"error";return"bracket"}else return o=="{"||o=="["?(E=R.DEFAULT,E=new E,H(b,E),"bracket"):/\d/.test(o)?(w.eatWhile(/[\w.%]/),"atom"):(w.eatWhile(/[\w\-_]/),E=B(b),E.name=="begin"&&(E.argument=w.current()),E.styleIdentifier())}function v(w,b,E){if(w.eatSpace())return null;if(E&&w.match(E))return A(b,f),"keyword";if(w.match(/^\\[a-zA-Z@]+/))return"tag";if(w.match(/^[a-zA-Z]+/))return"variable-2";if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/]/))return"tag";if(w.match(/^[\^_&]/))return"tag";if(w.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(w.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var l=w.next();return l=="{"||l=="}"||l=="["||l=="]"||l=="("||l==")"?"bracket":l=="%"?(w.skipToEnd(),"comment"):"error"}function P(w,b){var E=w.peek(),l;return E=="{"||E=="["?(l=I(b),l.openBracket(E),w.eat(E),A(b,f),"bracket"):/[ \t\r]/.test(E)?(w.eat(E),null):(A(b,f),O(b),f(w,b))}return{startState:function(){var w=L.inMathMode?function(b,E){return v(b,E)}:f;return{cmdState:[],f:w}},copyState:function(w){return{cmdState:w.cmdState.slice(),f:w.f}},token:function(w,b){return b.f(w,b)},blankLine:function(w){w.f=f,w.cmdState.length=0},lineComment:"%"}}),J.defineMIME("text/x-stex","stex"),J.defineMIME("text/x-latex","stex")})},"19Vz":function(Ze,Ke,te){(function(J){J(te("VrN/"))})(function(J){J.defineOption("placeholder","",function(N,R,A){var f=A&&A!=J.Init;if(R&&!f)N.on("blur",I),N.on("change",O),N.on("swapDoc",O),J.on(N.getInputField(),"compositionupdate",N.state.placeholderCompose=function(){H(N)}),O(N);else if(!R&&f){N.off("blur",I),N.off("change",O),N.off("swapDoc",O),J.off(N.getInputField(),"compositionupdate",N.state.placeholderCompose),K(N);var v=N.getWrapperElement();v.className=v.className.replace(" CodeMirror-empty","")}R&&!N.hasFocus()&&I(N)});function K(N){N.state.placeholder&&(N.state.placeholder.parentNode.removeChild(N.state.placeholder),N.state.placeholder=null)}function L(N){K(N);var R=N.state.placeholder=document.createElement("pre");R.style.cssText="height: 0; overflow: visible",R.style.direction=N.getOption("direction"),R.className="CodeMirror-placeholder CodeMirror-line-like";var A=N.getOption("placeholder");typeof A=="string"&&(A=document.createTextNode(A)),R.appendChild(A),N.display.lineSpace.insertBefore(R,N.display.lineSpace.firstChild)}function H(N){setTimeout(function(){var R=!1,A=N.getInputField();A.nodeName=="TEXTAREA"?R=!A.value:N.lineCount()==1&&(R=!/[^\u200b]/.test(A.querySelector(".CodeMirror-line").textContent)),R?L(N):K(N)},20)}function I(N){B(N)&&L(N)}function O(N){var R=N.getWrapperElement(),A=B(N);R.className=R.className.replace(" CodeMirror-empty","")+(A?" CodeMirror-empty":""),A?L(N):K(N)}function B(N){return N.lineCount()===1&&N.getLine(0)===""}})},"1eCo":function(Ze,Ke,te){(function(J){J(te("VrN/"))})(function(J){"use strict";var K={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};J.defineMode("xml",function(H,I){var O=H.indentUnit,B={},N=I.htmlMode?K:L;for(var R in N)B[R]=N[R];for(var R in I)B[R]=I[R];var A,f;function v(a,x){function y(F){return x.tokenize=F,F(a,x)}var p=a.next();if(p=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?y(b("atom","]]>")):null:a.match("--")?y(b("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),y(E(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),x.tokenize=b("meta","?>"),"meta"):(A=a.eat("/")?"closeTag":"openTag",x.tokenize=P,"tag bracket");if(p=="&"){var k;return a.eat("#")?a.eat("x")?k=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):k=a.eatWhile(/[\d]/)&&a.eat(";"):k=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),k?"atom":"error"}else return a.eatWhile(/[^&<]/),null}v.isInText=!0;function P(a,x){var y=a.next();if(y==">"||y=="/"&&a.eat(">"))return x.tokenize=v,A=y==">"?"endTag":"selfcloseTag","tag bracket";if(y=="=")return A="equals",null;if(y=="<"){x.tokenize=v,x.state=d,x.tagName=x.tagStart=null;var p=x.tokenize(a,x);return p?p+" tag error":"tag error"}else return/[\'\"]/.test(y)?(x.tokenize=w(y),x.stringStartCol=a.column(),x.tokenize(a,x)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function w(a){var x=function(y,p){for(;!y.eol();)if(y.next()==a){p.tokenize=P;break}return"string"};return x.isInAttribute=!0,x}function b(a,x){return function(y,p){for(;!y.eol();){if(y.match(x)){p.tokenize=v;break}y.next()}return a}}function E(a){return function(x,y){for(var p;(p=x.next())!=null;){if(p=="<")return y.tokenize=E(a+1),y.tokenize(x,y);if(p==">")if(a==1){y.tokenize=v;break}else return y.tokenize=E(a-1),y.tokenize(x,y)}return"meta"}}function l(a,x,y){this.prev=a.context,this.tagName=x,this.indent=a.indented,this.startOfLine=y,(B.doNotIndent.hasOwnProperty(x)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function s(a,x){for(var y;;){if(!a.context)return;if(y=a.context.tagName,!B.contextGrabbers.hasOwnProperty(y)||!B.contextGrabbers[y].hasOwnProperty(x))return;o(a)}}function d(a,x,y){return a=="openTag"?(y.tagStart=x.column(),C):a=="closeTag"?g:d}function C(a,x,y){return a=="word"?(y.tagName=x.current(),f="tag",T):B.allowMissingTagName&&a=="endTag"?(f="tag bracket",T(a,x,y)):(f="error",C)}function g(a,x,y){if(a=="word"){var p=x.current();return y.context&&y.context.tagName!=p&&B.implicitlyClosed.hasOwnProperty(y.context.tagName)&&o(y),y.context&&y.context.tagName==p||B.matchClosing===!1?(f="tag",m):(f="tag error",D)}else return B.allowMissingTagName&&a=="endTag"?(f="tag bracket",m(a,x,y)):(f="error",D)}function m(a,x,y){return a!="endTag"?(f="error",m):(o(y),d)}function D(a,x,y){return f="error",m(a,x,y)}function T(a,x,y){if(a=="word")return f="attribute",h;if(a=="endTag"||a=="selfcloseTag"){var p=y.tagName,k=y.tagStart;return y.tagName=y.tagStart=null,a=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(p)?s(y,p):(s(y,p),y.context=new l(y,p,k==y.indented)),d}return f="error",T}function h(a,x,y){return a=="equals"?c:(B.allowMissing||(f="error"),T(a,x,y))}function c(a,x,y){return a=="string"?u:a=="word"&&B.allowUnquoted?(f="string",T):(f="error",T(a,x,y))}function u(a,x,y){return a=="string"?u:T(a,x,y)}return{startState:function(a){var x={tokenize:v,state:d,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(x.baseIndent=a),x},token:function(a,x){if(!x.tagName&&a.sol()&&(x.indented=a.indentation()),a.eatSpace())return null;A=null;var y=x.tokenize(a,x);return(y||A)&&y!="comment"&&(f=null,x.state=x.state(A||y,a,x),f&&(y=f=="error"?y+" error":f)),y},indent:function(a,x,y){var p=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+O;if(p&&p.noIndent)return J.Pass;if(a.tokenize!=P&&a.tokenize!=v)return y?y.match(/^(\s*)/)[0].length:0;if(a.tagName)return B.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+O*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/<!\[CDATA\[/.test(x))return 0;var k=x&&/^<(\/)?([\w_:\.-]*)/.exec(x);if(k&&k[1])for(;p;)if(p.tagName==k[2]){p=p.prev;break}else if(B.implicitlyClosed.hasOwnProperty(p.tagName))p=p.prev;else break;else if(k)for(;p;){var F=B.contextGrabbers[p.tagName];if(F&&F.hasOwnProperty(k[2]))p=p.prev;else break}for(;p&&p.prev&&!p.startOfLine;)p=p.prev;return p?p.indent+O: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=T)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var x=[],y=a.context;y;y=y.prev)y.tagName&&x.push(y.tagName);return x.reverse()}}}),J.defineMIME("text/xml","xml"),J.defineMIME("application/xml","xml"),J.mimeModes.hasOwnProperty("text/html")||J.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"55Ip":function(Ze,Ke,te){"use strict";te.d(Ke,"a",function(){return s});var J=te("Ty5D"),K=te("dI71"),L=te("cDcd"),H=te.n(L),I=te("YS25"),O=te("17x9"),B=te.n(O),N=te("wx14"),R=te("zLVn"),A=te("9R94"),f=function(c){Object(K.a)(u,c);function u(){for(var x,y=arguments.length,p=new Array(y),k=0;k<y;k++)p[k]=arguments[k];return x=c.call.apply(c,[this].concat(p))||this,x.history=Object(I.a)(x.props),x}var a=u.prototype;return a.render=function(){return H.a.createElement(J.c,{history:this.history,children:this.props.children})},u}(H.a.Component),v=function(c){Object(K.a)(u,c);function u(){for(var x,y=arguments.length,p=new Array(y),k=0;k<y;k++)p[k]=arguments[k];return x=c.call.apply(c,[this].concat(p))||this,x.history=Object(I.b)(x.props),x}var a=u.prototype;return a.render=function(){return H.a.createElement(J.c,{history:this.history,children:this.props.children})},u}(H.a.Component),P=function(u,a){return typeof u=="function"?u(a):u},w=function(u,a){return typeof u=="string"?Object(I.c)(u,null,null,a):u},b=function(u){return u},E=H.a.forwardRef;typeof E=="undefined"&&(E=b);function l(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=E(function(c,u){var a=c.innerRef,x=c.navigate,y=c.onClick,p=Object(R.a)(c,["innerRef","navigate","onClick"]),k=p.target,F=Object(N.a)({},p,{onClick:function(W){try{y&&y(W)}catch(_){throw W.preventDefault(),_}!W.defaultPrevented&&W.button===0&&(!k||k==="_self")&&!l(W)&&(W.preventDefault(),x())}});return b!==E?F.ref=u||a:F.ref=a,H.a.createElement("a",F)}),s=E(function(c,u){var a=c.component,x=a===void 0?o:a,y=c.replace,p=c.to,k=c.innerRef,F=Object(R.a)(c,["component","replace","to","innerRef"]);return H.a.createElement(J.e.Consumer,null,function(U){U||Object(A.a)(!1);var W=U.history,_=w(P(p,U.location),U.location),M=_?W.createHref(_):"",G=Object(N.a)({},F,{href:M,navigate:function(){var Z=P(p,U.location),ne=y?W.replace:W.push;ne(Z)}});return b!==E?G.ref=u||k:G.innerRef=k,H.a.createElement(x,G)})});if(!1)var d,C;var g=function(u){return u},m=H.a.forwardRef;typeof m=="undefined"&&(m=g);function D(){for(var c=arguments.length,u=new Array(c),a=0;a<c;a++)u[a]=arguments[a];return u.filter(function(x){return x}).join(" ")}var T=m(function(c,u){var a=c["aria-current"],x=a===void 0?"page":a,y=c.activeClassName,p=y===void 0?"active":y,k=c.activeStyle,F=c.className,U=c.exact,W=c.isActive,_=c.location,M=c.sensitive,G=c.strict,Y=c.style,Z=c.to,ne=c.innerRef,be=Object(R.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return H.a.createElement(J.e.Consumer,null,function(me){me||Object(A.a)(!1);var pe=_||me.location,ue=w(P(Z,pe),pe),fe=ue.pathname,ie=fe&&fe.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),he=ie?Object(J.f)(pe.pathname,{path:ie,exact:U,sensitive:M,strict:G}):null,$=!!(W?W(he,pe):he),ae=$?D(F,p):F,ee=$?Object(N.a)({},Y,{},k):Y,Ee=Object(N.a)({"aria-current":$&&x||null,className:ae,style:ee,to:ue},be);return g!==m?Ee.ref=u||ne:Ee.innerRef=ne,H.a.createElement(s,Ee)})});if(!1)var h},"7Cbv":function(Ze,Ke,te){"use strict";var J=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),K=new Uint8Array(16);function L(){if(!J)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return J(K)}var H=/^(?:[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(P){return typeof P=="string"&&H.test(P)}for(var O=I,B=[],N=0;N<256;++N)B.push((N+256).toString(16).substr(1));function R(P){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,b=(B[P[w+0]]+B[P[w+1]]+B[P[w+2]]+B[P[w+3]]+"-"+B[P[w+4]]+B[P[w+5]]+"-"+B[P[w+6]]+B[P[w+7]]+"-"+B[P[w+8]]+B[P[w+9]]+"-"+B[P[w+10]]+B[P[w+11]]+B[P[w+12]]+B[P[w+13]]+B[P[w+14]]+B[P[w+15]]).toLowerCase();if(!O(b))throw TypeError("Stringified UUID is invalid");return b}var A=R;function f(P,w,b){P=P||{};var E=P.random||(P.rng||L)();if(E[6]=E[6]&15|64,E[8]=E[8]&63|128,w){b=b||0;for(var l=0;l<16;++l)w[b+l]=E[l];return w}return A(E)}var v=Ke.a=f},"7ahc":function(Ze,Ke,te){"use strict";te.d(Ke,"a",function(){return C});var J=te("k1fw"),K=te("0Owb"),L=te("+L6B"),H=te("2/Rp"),I=te("y8nQ"),O=te("Vl3Y"),B=te("tJVT"),N=te("OaEy"),R=te("2fM7"),A=te("cDcd"),f=te.n(A),v=te("VrN/"),P=te.n(v),w=te("p77/"),b=te.n(w),E=te("c5Ni"),l=te.n(E),o=R.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"]};Ke.b=function(g){var m=g.callback,D=g.onCancel,T=Object(A.useState)("python"),h=Object(B.a)(T,2),c=h[0],u=h[1];function a(y){u(d[y][1])}function x(y){m(y)}return f.a.createElement(O.a,Object(K.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:x}),f.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},f.a.createElement(R.a,{onChange:a},Object.keys(d).map(function(y){return f.a.createElement(o,{key:y,value:y},d[y][0])}))),f.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},f.a.createElement(C,{mode:c})),f.a.createElement("div",{className:"flex-container flex-end"},f.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(H.a,{type:"ghost",onClick:D},"\u53D6\u6D88")))};function C(g){var m=g.value,D=g.onChange,T=g.mode,h=g.options,c=h===void 0?{}:h,u=Object(A.useRef)(),a=Object(A.useState)(),x=Object(B.a)(a,2),y=x[0],p=x[1];return Object(A.useEffect)(function(){if(y){function k(F){var U=F.getValue();D&&D(U)}return y.on("change",k),function(){y.off("change",k)}}},[y,D]),Object(A.useEffect)(function(){y&&y.setOption("mode",T)},[y,T]),Object(A.useEffect)(function(){y&&((m!==y.getValue()||m==="")&&setTimeout(function(){y.setValue(m||" ")},300))},[y,m]),Object(A.useEffect)(function(){if(u.current&&!y){var k=P.a.fromTextArea(u.current,Object(J.a)({mode:T,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));p(k)}},[u.current,y]),f.a.createElement("div",{className:"my-codemirror-container"},f.a.createElement("textarea",{ref:u}))}},"7ixt":function(Ze,Ke,te){"use strict";te.d(Ke,"a",function(){return L});var J={adjustX:1,adjustY:1},K=[0,0],L={left:{points:["cr","cl"],overflow:J,offset:[-4,0],targetOffset:K},right:{points:["cl","cr"],overflow:J,offset:[4,0],targetOffset:K},top:{points:["bc","tc"],overflow:J,offset:[0,-4],targetOffset:K},bottom:{points:["tc","bc"],overflow:J,offset:[0,4],targetOffset:K},topLeft:{points:["bl","tl"],overflow:J,offset:[0,-4],targetOffset:K},leftTop:{points:["tr","tl"],overflow:J,offset:[-4,0],targetOffset:K},topRight:{points:["br","tr"],overflow:J,offset:[0,-4],targetOffset:K},rightTop:{points:["tl","tr"],overflow:J,offset:[4,0],targetOffset:K},bottomRight:{points:["tr","br"],overflow:J,offset:[0,4],targetOffset:K},rightBottom:{points:["bl","br"],overflow:J,offset:[4,0],targetOffset:K},bottomLeft:{points:["tl","bl"],overflow:J,offset:[0,4],targetOffset:K},leftBottom:{points:["br","bl"],overflow:J,offset:[-4,0],targetOffset:K}},H=L},"8EBN":function(Ze,Ke,te){(function(J){J(te("VrN/"))})(function(J){"use strict";J.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 K=0;K<J.modeInfo.length;K++){var L=J.modeInfo[K];L.mimes&&(L.mime=L.mimes[0])}J.findModeByMIME=function(H){H=H.toLowerCase();for(var I=0;I<J.modeInfo.length;I++){var O=J.modeInfo[I];if(O.mime==H)return O;if(O.mimes){for(var B=0;B<O.mimes.length;B++)if(O.mimes[B]==H)return O}}if(/\+xml$/.test(H))return J.findModeByMIME("application/xml");if(/\+json$/.test(H))return J.findModeByMIME("application/json")},J.findModeByExtension=function(H){H=H.toLowerCase();for(var I=0;I<J.modeInfo.length;I++){var O=J.modeInfo[I];if(O.ext){for(var B=0;B<O.ext.length;B++)if(O.ext[B]==H)return O}}},J.findModeByFileName=function(H){for(var I=0;I<J.modeInfo.length;I++){var O=J.modeInfo[I];if(O.file&&O.file.test(H))return O}var B=H.lastIndexOf("."),N=B>-1&&H.substring(B+1,H.length);if(N)return J.findModeByExtension(N)},J.findModeByName=function(H){H=H.toLowerCase();for(var I=0;I<J.modeInfo.length;I++){var O=J.modeInfo[I];if(O.name.toLowerCase()==H)return O;if(O.alias){for(var B=0;B<O.alias.length;B++)if(O.alias[B].toLowerCase()==H)return O}}}})},"8hTe":function(Ze,Ke,te){Ze.exports={button:"button___1wy9m"}},"9Bee":function(Ze,Ke,te){"use strict";var J=te("DYRE"),K=te("zeV3"),L=te("+L6B"),H=te("2/Rp"),I=te("k1fw"),O=te("tJVT"),B=te("cDcd"),N=te.n(B),R=te("vg9a"),A=te("DlQD"),f=te.n(A),v=te("rUJ1");function P(pe,ue){var fe=pe.match(/^(\s+)(?:```)/);if(fe===null)return ue;var ie=fe[1];return ue.split(`
|
|
`).map(function(he){var $=he.match(/^\s+/);if($===null)return he;var ae=Object(O.a)($,1),ee=ae[0];return ee.length>=ie.length?he.slice(ie.length):he}).join(`
|
|
`)}var w=[],b=["<ul>"],E=new f.a.Renderer,l=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function o(){w.length=0,b=["<ul>"]}var s={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function d(pe,ue,fe,ie){if(ue>=pe.length||pe[ue].level<=fe)return ue;var he=pe[ue];ie.push("<li><a href='#"+he.anchor+"'>"+he.text+"</a>"),ue++;var $=[];return ue=d(pe,ue,he.level,$),$.length>0&&(ie.push("<ul>"),$.forEach(function(ae){ie.push(ae)}),ie.push("</ul>")),ie.push("</li>"),ue=d(pe,ue,fe,ie),ue}function C(){return d(w,0,0,b),b.push("</ul>"),b.join("")}var g={heading:function(ue){var fe=l.exec(ue);if(fe)return{type:"heading",raw:fe[0],depth:fe[1].length,text:fe[2]}},fences:function(ue){var fe=this.rules.block.fences.exec(ue);if(fe){var ie=fe[0],he=P(ie,fe[3]||""),$=fe[2]?fe[2].trim():fe[2];if(["latex","katex","math"].indexOf($)>=0){var ae=T(),ee=he;he=ae,h[ae]={type:"block",expression:ee}}return{type:"code",raw:ie,lang:$,text:he}}}},m=/(?:\${2})([^\n`]+?)(?:\${2})/gi,D=0,T=function(){return"__special_katext_id_".concat(D++,"__")},h={};function c(){return h}function u(){D=0,h={}}function a(pe){return pe=pe.replace(m,function(ue,fe){var ie=T();return h[ie]={type:"inline",expression:fe},ie}),pe}var x=E.listitem;E.listitem=function(pe){return x(a(pe))};var y=E.paragraph;E.paragraph=function(pe){return y(a(pe))};var p=E.tablecell;E.tablecell=function(pe,ue){return p(a(pe),ue)},E.code=function(pe,ue,fe){var ie=(ue||"").match(/\S*/)[0];return ie?["latex","katex","math"].indexOf(ie)>=0?"<p class='editormd-tex'>".concat(pe,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(ue,'">').concat(fe?pe:Object(v.escape)(pe,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(fe?pe:Object(v.escape)(pe,!0))+"</code></pre>"},E.heading=function(pe,ue,fe){var ie=this.options.headerPrefix+fe.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return w.push({anchor:ie,level:ue,text:pe}),"<h"+ue+' id="'+ie+'">'+pe+"</h"+ue+">"},f.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),f.a.use({tokenizer:g,renderer:E});var k=f.a,F=te("SJMd"),U=te("ulZh"),W=te.n(U),_=te("m3rI"),M=te("Oy/b"),G=te("p5ED"),Y=te("8hTe"),Z=te.n(Y),ne=/<pre[^>]*>/g;function be(pe){var ue=document.createElement("div");return ue.innerHTML=pe,ue.childNodes.length===0?"":ue.childNodes[0].nodeValue}var me=Ke.a=function(pe){var ue=pe.value,fe=ue===void 0?"":ue,ie=pe.edit,he=ie===void 0?!1:ie,$=pe.className,ae=pe.showTextOnly,ee=pe.showLines,Ee=pe.replaces,Ce=pe.zoomImg,ve=pe.hasMask,Se=pe.style,De=Se===void 0?{}:Se,_e=pe.stylesPrev,ke=_e===void 0?{}:_e,Re=String(fe),Ae=Object(B.useRef)(),Ue=Object(B.useRef)(),Ye=Object(B.useState)(""),Ge=Object(O.a)(Ye,2),He=Ge[0],et=Ge[1],Je=Object(B.useState)("office"),Xe=Object(O.a)(Je,2),we=Xe[0],rt=Xe[1],$e=Object(B.useMemo)(function(){try{var ce=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Q=/\"\/api\/attachments\/|\"\/attachments\/download\//g,q=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Re=Re.replace(ce,"("+_.a.API_SERVER+"/api/attachments/").replace(Q,'"'+_.a.API_SERVER+"/api/attachments/").replace(q,'"'+_.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`)}catch(Oe){}var re=k(Re),se=c();if(Re.match(/\[TOC\]/)&&(re=re.replace("<p>[TOC]</p>",C()),o()),re=re.replace(/(__special_katext_id_\d+__)/g,function(Oe,je){var st=se[je],ht=st.type,Me=st.expression;return Object(M.renderToString)(be(Me)||"",{displayMode:ht==="block",throwOnError:!1,output:"html"})}),re=re.replace(/▁/g,"\u2581\u2581\u2581"),u(),ae){var Te=document.createElement("div");return Te.innerHTML=re,Te.innerText}return setTimeout(function(){return ge()},500),re},[Re]),Le=Object(B.useRef)();s.WebkitLineClamp=ee,ee&&(De=Object(I.a)(Object(I.a)({},De),s));function Fe(ce){var Q=ce.target;if(Q.tagName.toUpperCase()==="IMG"){if(Ce){var q=Q.getAttribute("src");et(q),rt("image")}}else if(Q.tagName.toUpperCase()==="A"){var re=Q.getAttribute("href");if(re.indexOf("office")>-1)ce.preventDefault(),et(re),rt("office");else if(re.indexOf("application/pdf")>-1)ce.preventDefault(),et(re),rt("pdf");else if(re.indexOf("text/html")>-1)ce.preventDefault(),et(re),rt("html");else if(re.startsWith("#")){ce.preventDefault();var se=document.getElementById(re.replace("#",""));se&&se.scrollIntoView(!0)}}}var ge=function(){var Q,q=(Q=Le.current)===null||Q===void 0?void 0:Q.querySelectorAll("video");q==null||q.forEach(function(re){if(re.oncontextmenu=function(){return!1},re.src.indexOf(".m3u8")>-1&&!re.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var se=new W.a;se.loadSource(re.src),se.attachMedia(re)}}})};Object(B.useEffect)(function(){if(Le.current&&$e&&($e.match(ne)&&window.PR.prettyPrint()),Le.current)return Le.current.addEventListener("click",Fe),function(){Le.current.removeEventListener("click",Fe),u(),o()}},[$e,Le.current,Fe]);var de=function(Q){if(!he)return;Q.target.nodeName==="IMG"?(Ae.current.style.display="flex",Ae.current.style.width=Q.target.clientWidth+"px",Ae.current.style.height=Q.target.clientHeight+"px",Ae.current.style.top=Q.target.offsetTop+"px",Ae.current.style.left=Q.target.offsetLeft+"px",Ue.current.src=Q.target.getAttribute("src")):Ae.current.style.display="none"};return N.a.createElement("div",{style:{position:"relative"}},N.a.createElement("div",{ref:Le,style:Object(I.a)({},De),className:"".concat($||""," markdown-body ").concat(Z.a.mdBody),onMouseOver:de,dangerouslySetInnerHTML:{__html:$e}}),N.a.createElement("div",{ref:Ae,className:Z.a.button},N.a.createElement(K.a,null,N.a.createElement(H.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),N.a.createElement(H.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(G.a,{close:!0,data:He,type:He!=null&&He.length?we:"",style:Object(I.a)({},ke),onClose:function(){return et("")}}))}},"9VGf":function(Ze,Ke,te){"use strict";te.d(Ke,"a",function(){return L});var J=te("cDcd"),K=te.n(J);function L(H,I){var O=Object(J.useRef)();Object(J.useEffect)(function(){O.current=H}),Object(J.useEffect)(function(){function B(){O.current()}if(I!==null){var N=setInterval(B,I);return function(){return clearInterval(N)}}},[I])}},Bd2K:function(Ze,Ke,te){(function(J){J(te("VrN/"),te("osHv"))})(function(J){J.defineOption("autoCloseTags",!1,function(R,A,f){if(f!=J.Init&&f&&R.removeKeyMap("autoCloseTags"),!A)return;var v={name:"autoCloseTags"};(typeof A!="object"||A.whenClosing!==!1)&&(v["'/'"]=function(P){return O(P)}),(typeof A!="object"||A.whenOpening!==!1)&&(v["'>'"]=function(P){return H(P)}),R.addKeyMap(v)});var K=["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 H(R){if(R.getOption("disableInput"))return J.Pass;for(var A=R.listSelections(),f=[],v=R.getOption("autoCloseTags"),P=0;P<A.length;P++){if(!A[P].empty())return J.Pass;var w=A[P].head,b=R.getTokenAt(w),E=J.innerMode(R.getMode(),b.state),l=E.state,o=E.mode.xmlCurrentTag&&E.mode.xmlCurrentTag(l),s=o&&o.name;if(!s)return J.Pass;var d=E.mode.configuration=="html",C=typeof v=="object"&&v.dontCloseTags||d&&K,g=typeof v=="object"&&v.indentTags||d&&L;b.end>w.ch&&(s=s.slice(0,s.length-b.end+w.ch));var m=s.toLowerCase();if(!s||b.type=="string"&&(b.end!=w.ch||!/[\"\']/.test(b.string.charAt(b.string.length-1))||b.string.length==1)||b.type=="tag"&&o.close||b.string.indexOf("/")==w.ch-b.start-1||C&&B(C,m)>-1||N(R,E.mode.xmlCurrentContext&&E.mode.xmlCurrentContext(l)||[],s,w,!0))return J.Pass;var D=typeof v=="object"&&v.emptyTags;if(D&&B(D,s)>-1){f[P]={text:"/>",newPos:J.Pos(w.line,w.ch+2)};continue}var T=g&&B(g,m)>-1;f[P]={indent:T,text:">"+(T?`
|
|
|
|
`:"")+"</"+s+">",newPos:T?J.Pos(w.line+1,0):J.Pos(w.line,w.ch+1)}}for(var h=typeof v=="object"&&v.dontIndentOnAutoClose,P=A.length-1;P>=0;P--){var c=f[P];R.replaceRange(c.text,A[P].head,A[P].anchor,"+insert");var u=R.listSelections().slice(0);u[P]={head:c.newPos,anchor:c.newPos},R.setSelections(u),!h&&c.indent&&(R.indentLine(c.newPos.line,null,!0),R.indentLine(c.newPos.line+1,null,!0))}}function I(R,A){for(var f=R.listSelections(),v=[],P=A?"/":"</",w=R.getOption("autoCloseTags"),b=typeof w=="object"&&w.dontIndentOnSlash,E=0;E<f.length;E++){if(!f[E].empty())return J.Pass;var l=f[E].head,o=R.getTokenAt(l),s=J.innerMode(R.getMode(),o.state),d=s.state;if(A&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=l.ch-1))return J.Pass;var C,g=s.mode.name!="xml"&&R.getMode().name=="htmlmixed";if(g&&s.mode.name=="javascript")C=P+"script";else if(g&&s.mode.name=="css")C=P+"style";else{var m=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(d);if(!m||m.length&&N(R,m,m[m.length-1],l))return J.Pass;C=P+m[m.length-1]}R.getLine(l.line).charAt(o.end)!=">"&&(C+=">"),v[E]=C}if(R.replaceSelections(v),f=R.listSelections(),!b)for(var E=0;E<f.length;E++)(E==f.length-1||f[E].head.line<f[E+1].head.line)&&R.indentLine(f[E].head.line)}function O(R){return R.getOption("disableInput")?J.Pass:I(R,!0)}J.commands.closeTag=function(R){return I(R)};function B(R,A){if(R.indexOf)return R.indexOf(A);for(var f=0,v=R.length;f<v;++f)if(R[f]==A)return f;return-1}function N(R,A,f,v,P){if(!J.scanForClosingTag)return!1;var w=Math.min(R.lastLine()+1,v.line+500),b=J.scanForClosingTag(R,v,null,w);if(!b||b.tag!=f)return!1;for(var E=P?1:0,l=A.length-1;l>=0&&A[l]==f;l--)++E;v=b.to;for(var l=1;l<E;l++){var o=J.scanForClosingTag(R,v,null,w);if(!o||o.tag!=f)return!1;v=o.to}return!0}})},BjJ7:function(Ze,Ke,te){"use strict";te.d(Ke,"d",function(){return K}),te.d(Ke,"c",function(){return L}),te.d(Ke,"e",function(){return H}),te.d(Ke,"b",function(){return I}),te.d(Ke,"a",function(){return B});var J=te("m3rI");function K(N){var R=!0;if(N.length>0){for(var A=0;A<N.length;A++)if(N[A].compile_success==0||!N[A].compile_success){R=!1;break}}else R=!1;return R}function L(N){for(var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",A=[],f=0;f<N.length;f++){var v=N[f],P=R?"".concat(R,"/").concat(v.name):"".concat(v.name);A.push({title:v.name,isLeaf:!(v.type==="tree"),key:P})}return A}function H(N,R,A){for(var f=0;f<N.length;f++){var v=N[f];if(v.key===R){v.children=A;break}v.children&&H(v.children,R,A)}return N}function I(N,R,A){var f;return function(){var v=this,P=arguments,w=function(){f=null,A||N.apply(v,P)},b=A&&!f;clearTimeout(f),f=setTimeout(w,R),b&&N.apply(v,P)}}var O=!0,B=J.a.API_SERVER},"C+DQ":function(Ze,Ke,te){},D1Df:function(Ze,Ke,te){"use strict";function J(p){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?J=function(F){return typeof F}:J=function(F){return F&&typeof Symbol=="function"&&F.constructor===Symbol&&F!==Symbol.prototype?"symbol":typeof F},J(p)}function K(){return K=Object.assign||function(p){for(var k=1;k<arguments.length;k++){var F=arguments[k];for(var U in F)Object.prototype.hasOwnProperty.call(F,U)&&(p[U]=F[U])}return p},K.apply(this,arguments)}function L(p,k){var F=Object.keys(p);if(Object.getOwnPropertySymbols){var U=Object.getOwnPropertySymbols(p);k&&(U=U.filter(function(W){return Object.getOwnPropertyDescriptor(p,W).enumerable})),F.push.apply(F,U)}return F}function H(p){for(var k=1;k<arguments.length;k++){var F=arguments[k]!=null?arguments[k]:{};k%2?L(F,!0).forEach(function(U){b(p,U,F[U])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(F)):L(F).forEach(function(U){Object.defineProperty(p,U,Object.getOwnPropertyDescriptor(F,U))})}return p}function I(p,k){if(p==null)return{};var F=O(p,k),U,W;if(Object.getOwnPropertySymbols){var _=Object.getOwnPropertySymbols(p);for(W=0;W<_.length;W++){if(U=_[W],k.indexOf(U)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(p,U))continue;F[U]=p[U]}}return F}function O(p,k){if(p==null)return{};var F={},U=Object.keys(p),W,_;for(_=0;_<U.length;_++){if(W=U[_],k.indexOf(W)>=0)continue;F[W]=p[W]}return F}function B(p,k){if(!(p instanceof k))throw new TypeError("Cannot call a class as a function")}function N(p,k){for(var F=0;F<k.length;F++){var U=k[F];U.enumerable=U.enumerable||!1,U.configurable=!0,"value"in U&&(U.writable=!0),Object.defineProperty(p,U.key,U)}}function R(p,k,F){return k&&N(p.prototype,k),F&&N(p,F),p}function A(p,k){return k&&(J(k)==="object"||typeof k=="function")?k:v(p)}function f(p){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(F){return F.__proto__||Object.getPrototypeOf(F)},f(p)}function v(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function P(p,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function");p.prototype=Object.create(k&&k.prototype,{constructor:{value:p,writable:!0,configurable:!0}}),k&&w(p,k)}function w(p,k){return w=Object.setPrototypeOf||function(U,W){return U.__proto__=W,U},w(p,k)}function b(p,k,F){return k in p?Object.defineProperty(p,k,{value:F,enumerable:!0,configurable:!0,writable:!0}):p[k]=F,p}var E=te("cDcd"),l=te("17x9"),o=te("H38U"),s=te("aRTE");function d(p){for(var k="",F=0;F<p.length;F++){var U=p.charCodeAt(F);U<128?k+=String.fromCharCode(U):U<2048?(k+=String.fromCharCode(192|U>>6),k+=String.fromCharCode(128|U&63)):U<55296||U>=57344?(k+=String.fromCharCode(224|U>>12),k+=String.fromCharCode(128|U>>6&63),k+=String.fromCharCode(128|U&63)):(F++,U=65536+((U&1023)<<10|p.charCodeAt(F)&1023),k+=String.fromCharCode(240|U>>18),k+=String.fromCharCode(128|U>>12&63),k+=String.fromCharCode(128|U>>6&63),k+=String.fromCharCode(128|U&63))}return k}var C={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},g={},m=4,D=.1;function T(p){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,F=[];return p.forEach(function(U,W){var _=null;U.forEach(function(M,G){if(!M&&_!==null){F.push("M".concat(_+k," ").concat(W+k,"h").concat(G-_,"v1H").concat(_+k,"z")),_=null;return}if(G===U.length-1){if(!M)return;_===null?F.push("M".concat(G+k,",").concat(W+k," h1v1H").concat(G+k,"z")):F.push("M".concat(_+k,",").concat(W+k," h").concat(G+1-_,"v1H").concat(_+k,"z"));return}M&&_===null&&(_=G)})}),F.join("")}function h(p,k){return p.slice().map(function(F,U){return U<k.y||U>=k.y+k.h?F:F.map(function(W,_){return _<k.x||_>=k.x+k.w?W:!1})})}function c(p,k){var F=p.imageSettings,U=p.size,W=p.includeMargin;if(F==null)return null;var _=W?m:0,M=k.length+_*2,G=Math.floor(U*D),Y=M/U,Z=(F.width||G)*Y,ne=(F.height||G)*Y,be=F.x==null?k.length/2-Z/2:F.x*Y,me=F.y==null?k.length/2-ne/2:F.y*Y,pe=null;if(F.excavate){var ue=Math.floor(be),fe=Math.floor(me),ie=Math.ceil(Z+be-ue),he=Math.ceil(ne+me-fe);pe={x:ue,y:fe,w:ie,h:he}}return{x:be,y:me,h:ne,w:Z,excavation:pe}}var u=function(){try{new Path2D().addPath(new Path2D)}catch(p){return!1}return!0}(),a=function(p){P(k,p);function k(){var F,U;B(this,k);for(var W=arguments.length,_=new Array(W),M=0;M<W;M++)_[M]=arguments[M];return U=A(this,(F=f(k)).call.apply(F,[this].concat(_))),b(v(U),"_canvas",void 0),b(v(U),"_image",void 0),b(v(U),"state",{imgLoaded:!1}),b(v(U),"handleImageLoad",function(){U.setState({imgLoaded:!0})}),U}return R(k,[{key:"componentDidMount",value:function(){this.update()}},{key:"componentDidUpdate",value:function(){this.update()}},{key:"update",value:function(){var U=this.props,W=U.value,_=U.size,M=U.level,G=U.bgColor,Y=U.fgColor,Z=U.includeMargin,ne=U.imageSettings,be=new o(-1,s[M]);if(be.addData(d(W)),be.make(),this._canvas!=null){var me=this._canvas,pe=me.getContext("2d");if(!pe)return;var ue=be.modules;if(ue===null)return;var fe=Z?m:0,ie=ue.length+fe*2,he=c(this.props,ue);ne!=null&&he!=null&&(he.excavation!=null&&(ue=h(ue,he.excavation)));var $=window.devicePixelRatio||1;me.height=me.width=_*$;var ae=_/ie*$;pe.scale(ae,ae),pe.fillStyle=G,pe.fillRect(0,0,ie,ie),pe.fillStyle=Y,u?pe.fill(new Path2D(T(ue,fe))):ue.forEach(function(ee,Ee){ee.forEach(function(Ce,ve){Ce&&pe.fillRect(ve+fe,Ee+fe,1,1)})}),this.state.imgLoaded&&this._image&&he!=null&&pe.drawImage(this._image,he.x+fe,he.y+fe,he.w,he.h)}}},{key:"render",value:function(){var U=this,W=this.props,_=W.value,M=W.size,G=W.level,Y=W.bgColor,Z=W.fgColor,ne=W.style,be=W.includeMargin,me=W.imageSettings,pe=I(W,["value","size","level","bgColor","fgColor","style","includeMargin","imageSettings"]),ue=H({height:M,width:M},ne),fe=null,ie=me&&me.src;return me!=null&&ie!=null&&(fe=E.createElement("img",{src:ie,style:{display:"none"},onLoad:this.handleImageLoad,ref:function($){return U._image=$}})),E.createElement(E.Fragment,null,E.createElement("canvas",K({style:ue,height:M,width:M,ref:function($){return U._canvas=$}},pe)),fe)}}]),k}(E.PureComponent);b(a,"defaultProps",C);var x=function(p){P(k,p);function k(){return B(this,k),A(this,f(k).apply(this,arguments))}return R(k,[{key:"render",value:function(){var U=this.props,W=U.value,_=U.size,M=U.level,G=U.bgColor,Y=U.fgColor,Z=U.includeMargin,ne=U.imageSettings,be=I(U,["value","size","level","bgColor","fgColor","includeMargin","imageSettings"]),me=new o(-1,s[M]);me.addData(d(W)),me.make();var pe=me.modules;if(pe===null)return null;var ue=Z?m:0,fe=pe.length+ue*2,ie=c(this.props,pe),he=null;ne!=null&&ie!=null&&(ie.excavation!=null&&(pe=h(pe,ie.excavation)),he=E.createElement("image",{xlinkHref:ne.src,height:ie.h,width:ie.w,x:ie.x+ue,y:ie.y+ue,preserveAspectRatio:"none"}));var $=T(pe,ue);return E.createElement("svg",K({shapeRendering:"crispEdges",height:_,width:_,viewBox:"0 0 ".concat(fe," ").concat(fe)},be),E.createElement("path",{fill:G,d:"M0,0 h".concat(fe,"v").concat(fe,"H0z")}),E.createElement("path",{fill:Y,d:$}),he)}}]),k}(E.PureComponent);b(x,"defaultProps",C);var y=function(k){var F=k.renderAs,U=I(k,["renderAs"]),W=F==="svg"?x:a;return E.createElement(W,U)};y.defaultProps=H({renderAs:"canvas"},C),Ze.exports=y},DlQD:function(Ze,Ke,te){(function(J,K){Ze.exports=K()})(this,function(){"use strict";function J(ge,de){for(var ce=0;ce<de.length;ce++){var Q=de[ce];Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q&&(Q.writable=!0),Object.defineProperty(ge,Q.key,Q)}}function K(ge,de,ce){return de&&J(ge.prototype,de),ce&&J(ge,ce),ge}function L(ge,de){if(!ge)return;if(typeof ge=="string")return H(ge,de);var ce=Object.prototype.toString.call(ge).slice(8,-1);if(ce==="Object"&&ge.constructor&&(ce=ge.constructor.name),ce==="Map"||ce==="Set")return Array.from(ge);if(ce==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ce))return H(ge,de)}function H(ge,de){(de==null||de>ge.length)&&(de=ge.length);for(var ce=0,Q=new Array(de);ce<de;ce++)Q[ce]=ge[ce];return Q}function I(ge,de){var ce;if(typeof Symbol=="undefined"||ge[Symbol.iterator]==null){if(Array.isArray(ge)||(ce=L(ge))||de&&ge&&typeof ge.length=="number"){ce&&(ge=ce);var Q=0;return function(){return Q>=ge.length?{done:!0}:{done:!1,value:ge[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 ce=ge[Symbol.iterator](),ce.next.bind(ce)}function O(ge,de){return de={exports:{}},ge(de,de.exports),de.exports}var B=O(function(ge){function de(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function ce(Q){ge.exports.defaults=Q}ge.exports={defaults:de(),getDefaults:de,changeDefaults:ce}}),N=B.defaults,R=B.getDefaults,A=B.changeDefaults,f=/[&<>"']/,v=/[&<>"']/g,P=/[<>"']|&(?!#?\w+;)/,w=/[<>"']|&(?!#?\w+;)/g,b={"&":"&","<":"<",">":">",'"':""","'":"'"},E=function(de){return b[de]};function l(ge,de){if(de){if(f.test(ge))return ge.replace(v,E)}else if(P.test(ge))return ge.replace(w,E);return ge}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(ge){return ge.replace(o,function(de,ce){return ce=ce.toLowerCase(),ce==="colon"?":":ce.charAt(0)==="#"?ce.charAt(1)==="x"?String.fromCharCode(parseInt(ce.substring(2),16)):String.fromCharCode(+ce.substring(1)):""})}var d=/(^|[^\[])\^/g;function C(ge,de){ge=ge.source||ge,de=de||"";var ce={replace:function(q,re){return re=re.source||re,re=re.replace(d,"$1"),ge=ge.replace(q,re),ce},getRegex:function(){return new RegExp(ge,de)}};return ce}var g=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function D(ge,de,ce){if(ge){var Q;try{Q=decodeURIComponent(s(ce)).replace(g,"").toLowerCase()}catch(q){return null}if(Q.indexOf("javascript:")===0||Q.indexOf("vbscript:")===0||Q.indexOf("data:")===0)return null}de&&!m.test(ce)&&(ce=a(de,ce));try{ce=encodeURI(ce).replace(/%25/g,"%")}catch(q){return null}return ce}var T={},h=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ge,de){T[" "+ge]||(h.test(ge)?T[" "+ge]=ge+"/":T[" "+ge]=k(ge,"/",!0)),ge=T[" "+ge];var ce=ge.indexOf(":")===-1;return de.substring(0,2)==="//"?ce?de:ge.replace(c,"$1")+de:de.charAt(0)==="/"?ce?de:ge.replace(u,"$1")+de:ge+de}var x={exec:function(){}};function y(ge){for(var de=1,ce,Q;de<arguments.length;de++){ce=arguments[de];for(Q in ce)Object.prototype.hasOwnProperty.call(ce,Q)&&(ge[Q]=ce[Q])}return ge}function p(ge,de){var ce=ge.replace(/\|/g,function(re,se,Te){for(var Oe=!1,je=se;--je>=0&&Te[je]==="\\";)Oe=!Oe;return Oe?"|":" |"}),Q=ce.split(/ \|/),q=0;if(Q.length>de)Q.splice(de);else for(;Q.length<de;)Q.push("");for(;q<Q.length;q++)Q[q]=Q[q].trim().replace(/\\\|/g,"|");return Q}function k(ge,de,ce){var Q=ge.length;if(Q===0)return"";for(var q=0;q<Q;){var re=ge.charAt(Q-q-1);if(re===de&&!ce)q++;else if(re!==de&&ce)q++;else break}return ge.substr(0,Q-q)}function F(ge,de){if(ge.indexOf(de[1])===-1)return-1;for(var ce=ge.length,Q=0,q=0;q<ce;q++)if(ge[q]==="\\")q++;else if(ge[q]===de[0])Q++;else if(ge[q]===de[1]&&(Q--,Q<0))return q;return-1}function U(ge){ge&&ge.sanitize&&!ge.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:l,unescape:s,edit:C,cleanUrl:D,resolveUrl:a,noopTest:x,merge:y,splitCells:p,rtrim:k,findClosingBracket:F,checkSanitizeDeprecation:U},_=B.defaults,M=W.rtrim,G=W.splitCells,Y=W.escape,Z=W.findClosingBracket;function ne(ge,de,ce){var Q=de.href,q=de.title?Y(de.title):null,re=ge[1].replace(/\\([\[\]])/g,"$1");return ge[0].charAt(0)!=="!"?{type:"link",raw:ce,href:Q,title:q,text:re}:{type:"image",raw:ce,href:Q,title:q,text:Y(re)}}function be(ge,de){var ce=ge.match(/^(\s+)(?:```)/);if(ce===null)return de;var Q=ce[1];return de.split(`
|
|
`).map(function(q){var re=q.match(/^\s+/);if(re===null)return q;var se=re[0];return se.length>=Q.length?q.slice(Q.length):q}).join(`
|
|
`)}var me=function(){function ge(ce){this.options=ce||_}var de=ge.prototype;return de.space=function(Q){var q=this.rules.block.newline.exec(Q);if(q)return q[0].length>1?{type:"space",raw:q[0]}:{raw:`
|
|
`}},de.code=function(Q,q){var re=this.rules.block.code.exec(Q);if(re){var se=q[q.length-1];if(se&&se.type==="paragraph")return{raw:re[0],text:re[0].trimRight()};var Te=re[0].replace(/^ {4}/gm,"");return{type:"code",raw:re[0],codeBlockStyle:"indented",text:this.options.pedantic?Te:M(Te,`
|
|
`)}}},de.fences=function(Q){var q=this.rules.block.fences.exec(Q);if(q){var re=q[0],se=be(re,q[3]||"");return{type:"code",raw:re,lang:q[2]?q[2].trim():q[2],text:se}}},de.heading=function(Q){var q=this.rules.block.heading.exec(Q);if(q)return{type:"heading",raw:q[0],depth:q[1].length,text:q[2]}},de.nptable=function(Q){var q=this.rules.block.nptable.exec(Q);if(q){var re={type:"table",header:G(q[1].replace(/^ *| *\| *$/g,"")),align:q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:q[3]?q[3].replace(/\n$/,"").split(`
|
|
`):[],raw:q[0]};if(re.header.length===re.align.length){var se=re.align.length,Te;for(Te=0;Te<se;Te++)/^ *-+: *$/.test(re.align[Te])?re.align[Te]="right":/^ *:-+: *$/.test(re.align[Te])?re.align[Te]="center":/^ *:-+ *$/.test(re.align[Te])?re.align[Te]="left":re.align[Te]=null;for(se=re.cells.length,Te=0;Te<se;Te++)re.cells[Te]=G(re.cells[Te],re.header.length);return re}}},de.hr=function(Q){var q=this.rules.block.hr.exec(Q);if(q)return{type:"hr",raw:q[0]}},de.blockquote=function(Q){var q=this.rules.block.blockquote.exec(Q);if(q){var re=q[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:q[0],text:re}}},de.list=function(Q){var q=this.rules.block.list.exec(Q);if(q){for(var re=q[0],se=q[2],Te=se.length>1,Oe=se[se.length-1]===")",je={type:"list",raw:re,ordered:Te,start:Te?+se.slice(0,-1):"",loose:!1,items:[]},st=q[0].match(this.rules.block.item),ht=!1,Me,mt,at,qe,xt,Et,Pt,Lt=st.length,pt=0;pt<Lt;pt++)Me=st[pt],re=Me,mt=Me.length,Me=Me.replace(/^ *([*+-]|\d+[.)]) */,""),~Me.indexOf(`
|
|
`)&&(mt-=Me.length,Me=this.options.pedantic?Me.replace(/^ {1,4}/gm,""):Me.replace(new RegExp("^ {1,"+mt+"}","gm"),"")),pt!==Lt-1&&(at=this.rules.block.bullet.exec(st[pt+1])[0],(Te?at.length===1||!Oe&&at[at.length-1]===")":at.length>1||this.options.smartLists&&at!==se)&&(qe=st.slice(pt+1).join(`
|
|
`),je.raw=je.raw.substring(0,je.raw.length-qe.length),pt=Lt-1)),xt=ht||/\n\n(?!\s*$)/.test(Me),pt!==Lt-1&&(ht=Me.charAt(Me.length-1)===`
|
|
`,xt||(xt=ht)),xt&&(je.loose=!0),Et=/^\[[ xX]\] /.test(Me),Pt=void 0,Et&&(Pt=Me[1]!==" ",Me=Me.replace(/^\[[ xX]\] +/,"")),je.items.push({type:"list_item",raw:re,task:Et,checked:Pt,loose:xt,text:Me});return je}},de.html=function(Q){var q=this.rules.block.html.exec(Q);if(q)return{type:this.options.sanitize?"paragraph":"html",raw:q[0],pre:!this.options.sanitizer&&(q[1]==="pre"||q[1]==="script"||q[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(q[0]):Y(q[0]):q[0]}},de.def=function(Q){var q=this.rules.block.def.exec(Q);if(q){q[3]&&(q[3]=q[3].substring(1,q[3].length-1));var re=q[1].toLowerCase().replace(/\s+/g," ");return{tag:re,raw:q[0],href:q[2],title:q[3]}}},de.table=function(Q){var q=this.rules.block.table.exec(Q);if(q){var re={type:"table",header:G(q[1].replace(/^ *| *\| *$/g,"")),align:q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:q[3]?q[3].replace(/\n$/,"").split(`
|
|
`):[]};if(re.header.length===re.align.length){re.raw=q[0];var se=re.align.length,Te;for(Te=0;Te<se;Te++)/^ *-+: *$/.test(re.align[Te])?re.align[Te]="right":/^ *:-+: *$/.test(re.align[Te])?re.align[Te]="center":/^ *:-+ *$/.test(re.align[Te])?re.align[Te]="left":re.align[Te]=null;for(se=re.cells.length,Te=0;Te<se;Te++)re.cells[Te]=G(re.cells[Te].replace(/^ *\| *| *\| *$/g,""),re.header.length);return re}}},de.lheading=function(Q){var q=this.rules.block.lheading.exec(Q);if(q)return{type:"heading",raw:q[0],depth:q[2].charAt(0)==="="?1:2,text:q[1]}},de.paragraph=function(Q){var q=this.rules.block.paragraph.exec(Q);if(q)return{type:"paragraph",raw:q[0],text:q[1].charAt(q[1].length-1)===`
|
|
`?q[1].slice(0,-1):q[1]}},de.text=function(Q,q){var re=this.rules.block.text.exec(Q);if(re){var se=q[q.length-1];return se&&se.type==="text"?{raw:re[0],text:re[0]}:{type:"text",raw:re[0],text:re[0]}}},de.escape=function(Q){var q=this.rules.inline.escape.exec(Q);if(q)return{type:"escape",raw:q[0],text:Y(q[1])}},de.tag=function(Q,q,re){var se=this.rules.inline.tag.exec(Q);if(se)return!q&&/^<a /i.test(se[0])?q=!0:q&&/^<\/a>/i.test(se[0])&&(q=!1),!re&&/^<(pre|code|kbd|script)(\s|>)/i.test(se[0])?re=!0:re&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(se[0])&&(re=!1),{type:this.options.sanitize?"text":"html",raw:se[0],inLink:q,inRawBlock:re,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):Y(se[0]):se[0]}},de.link=function(Q){var q=this.rules.inline.link.exec(Q);if(q){var re=Z(q[2],"()");if(re>-1){var se=q[0].indexOf("!")===0?5:4,Te=se+q[1].length+re;q[2]=q[2].substring(0,re),q[0]=q[0].substring(0,Te).trim(),q[3]=""}var Oe=q[2],je="";if(this.options.pedantic){var st=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Oe);st?(Oe=st[1],je=st[3]):je=""}else je=q[3]?q[3].slice(1,-1):"";Oe=Oe.trim().replace(/^<([\s\S]*)>$/,"$1");var ht=ne(q,{href:Oe&&Oe.replace(this.rules.inline._escapes,"$1"),title:je&&je.replace(this.rules.inline._escapes,"$1")},q[0]);return ht}},de.reflink=function(Q,q){var re;if((re=this.rules.inline.reflink.exec(Q))||(re=this.rules.inline.nolink.exec(Q))){var se=(re[2]||re[1]).replace(/\s+/g," ");if(se=q[se.toLowerCase()],!se||!se.href){var Te=re[0].charAt(0);return{type:"text",raw:Te,text:Te}}var Oe=ne(re,se,re[0]);return Oe}},de.strong=function(Q,q,re){re===void 0&&(re="");var se=this.rules.inline.strong.start.exec(Q);if(se&&(!se[1]||se[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){q=q.slice(-1*Q.length);var Te=se[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Te.lastIndex=0;for(var Oe;(se=Te.exec(q))!=null;)if(Oe=this.rules.inline.strong.middle.exec(q.slice(0,se.index+3)),Oe)return{type:"strong",raw:Q.slice(0,Oe[0].length),text:Q.slice(2,Oe[0].length-2)}}},de.em=function(Q,q,re){re===void 0&&(re="");var se=this.rules.inline.em.start.exec(Q);if(se&&(!se[1]||se[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){q=q.slice(-1*Q.length);var Te=se[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Te.lastIndex=0;for(var Oe;(se=Te.exec(q))!=null;)if(Oe=this.rules.inline.em.middle.exec(q.slice(0,se.index+2)),Oe)return{type:"em",raw:Q.slice(0,Oe[0].length),text:Q.slice(1,Oe[0].length-1)}}},de.codespan=function(Q){var q=this.rules.inline.code.exec(Q);if(q){var re=q[2].replace(/\n/g," "),se=/[^ ]/.test(re),Te=re.startsWith(" ")&&re.endsWith(" ");return se&&Te&&(re=re.substring(1,re.length-1)),re=Y(re,!0),{type:"codespan",raw:q[0],text:re}}},de.br=function(Q){var q=this.rules.inline.br.exec(Q);if(q)return{type:"br",raw:q[0]}},de.del=function(Q){var q=this.rules.inline.del.exec(Q);if(q)return{type:"del",raw:q[0],text:q[1]}},de.autolink=function(Q,q){var re=this.rules.inline.autolink.exec(Q);if(re){var se,Te;return re[2]==="@"?(se=Y(this.options.mangle?q(re[1]):re[1]),Te="mailto:"+se):(se=Y(re[1]),Te=se),{type:"link",raw:re[0],text:se,href:Te,tokens:[{type:"text",raw:se,text:se}]}}},de.url=function(Q,q){var re;if(re=this.rules.inline.url.exec(Q)){var se,Te;if(re[2]==="@")se=Y(this.options.mangle?q(re[0]):re[0]),Te="mailto:"+se;else{var Oe;do Oe=re[0],re[0]=this.rules.inline._backpedal.exec(re[0])[0];while(Oe!==re[0]);se=Y(re[0]),re[1]==="www."?Te="http://"+se:Te=se}return{type:"link",raw:re[0],text:se,href:Te,tokens:[{type:"text",raw:se,text:se}]}}},de.inlineText=function(Q,q,re){var se=this.rules.inline.text.exec(Q);if(se){var Te;return q?Te=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):Y(se[0]):se[0]:Te=Y(this.options.smartypants?re(se[0]):se[0]),{type:"text",raw:se[0],text:Te}}},ge}(),pe=W.noopTest,ue=W.edit,fe=W.merge,ie={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:pe,table:pe,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ie._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ie._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ie.def=ue(ie.def).replace("label",ie._label).replace("title",ie._title).getRegex(),ie.bullet=/(?:[*+-]|\d{1,9}[.)])/,ie.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ie.item=ue(ie.item,"gm").replace(/bull/g,ie.bullet).getRegex(),ie.list=ue(ie.list).replace(/bull/g,ie.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ie.def.source+")").getRegex(),ie._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",ie._comment=/<!--(?!-?>)[\s\S]*?-->/,ie.html=ue(ie.html,"i").replace("comment",ie._comment).replace("tag",ie._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ie.paragraph=ue(ie._paragraph).replace("hr",ie.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",ie._tag).getRegex(),ie.blockquote=ue(ie.blockquote).replace("paragraph",ie.paragraph).getRegex(),ie.normal=fe({},ie),ie.gfm=fe({},ie.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*|$)"}),ie.gfm.nptable=ue(ie.gfm.nptable).replace("hr",ie.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",ie._tag).getRegex(),ie.gfm.table=ue(ie.gfm.table).replace("hr",ie.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",ie._tag).getRegex(),ie.pedantic=fe({},ie.normal,{html:ue(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ie._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:pe,paragraph:ue(ie.normal._paragraph).replace("hr",ie.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ie.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var he={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:pe,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:pe,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};he._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",he.punctuation=ue(he.punctuation).replace(/punctuation/g,he._punctuation).getRegex(),he._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",he._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",he.em.start=ue(he.em.start).replace(/punctuation/g,he._punctuation).getRegex(),he.em.middle=ue(he.em.middle).replace(/punctuation/g,he._punctuation).replace(/overlapSkip/g,he._overlapSkip).getRegex(),he.em.endAst=ue(he.em.endAst,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.em.endUnd=ue(he.em.endUnd,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.strong.start=ue(he.strong.start).replace(/punctuation/g,he._punctuation).getRegex(),he.strong.middle=ue(he.strong.middle).replace(/punctuation/g,he._punctuation).replace(/blockSkip/g,he._blockSkip).getRegex(),he.strong.endAst=ue(he.strong.endAst,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.strong.endUnd=ue(he.strong.endUnd,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.blockSkip=ue(he._blockSkip,"g").getRegex(),he.overlapSkip=ue(he._overlapSkip,"g").getRegex(),he._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,he._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,he._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])?)+(?![-_])/,he.autolink=ue(he.autolink).replace("scheme",he._scheme).replace("email",he._email).getRegex(),he._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,he.tag=ue(he.tag).replace("comment",ie._comment).replace("attribute",he._attribute).getRegex(),he._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,he._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,he._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,he.link=ue(he.link).replace("label",he._label).replace("href",he._href).replace("title",he._title).getRegex(),he.reflink=ue(he.reflink).replace("label",he._label).getRegex(),he.reflinkSearch=ue(he.reflinkSearch,"g").replace("reflink",he.reflink).replace("nolink",he.nolink).getRegex(),he.normal=fe({},he),he.pedantic=fe({},he.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:ue(/^!?\[(label)\]\((.*?)\)/).replace("label",he._label).getRegex(),reflink:ue(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",he._label).getRegex()}),he.gfm=fe({},he.normal,{escape:ue(he.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),he.gfm.url=ue(he.gfm.url,"i").replace("email",he.gfm._extended_email).getRegex(),he.breaks=fe({},he.gfm,{br:ue(he.br).replace("{2,}","*").getRegex(),text:ue(he.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var $={block:ie,inline:he},ae=B.defaults,ee=$.block,Ee=$.inline;function Ce(ge){return ge.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 ve(ge){var de="",ce,Q,q=ge.length;for(ce=0;ce<q;ce++)Q=ge.charCodeAt(ce),Math.random()>.5&&(Q="x"+Q.toString(16)),de+="&#"+Q+";";return de}var Se=function(){function ge(ce){this.tokens=[],this.tokens.links=Object.create(null),this.options=ce||ae,this.options.tokenizer=this.options.tokenizer||new me,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Q={block:ee.normal,inline:Ee.normal};this.options.pedantic?(Q.block=ee.pedantic,Q.inline=Ee.pedantic):this.options.gfm&&(Q.block=ee.gfm,this.options.breaks?Q.inline=Ee.breaks:Q.inline=Ee.gfm),this.tokenizer.rules=Q}ge.lex=function(Q,q){var re=new ge(q);return re.lex(Q)};var de=ge.prototype;return de.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},de.blockTokens=function(Q,q,re){q===void 0&&(q=[]),re===void 0&&(re=!0),Q=Q.replace(/^ +$/gm,"");for(var se,Te,Oe,je;Q;){if(se=this.tokenizer.space(Q)){Q=Q.substring(se.raw.length),se.type&&q.push(se);continue}if(se=this.tokenizer.code(Q,q)){Q=Q.substring(se.raw.length),se.type?q.push(se):(je=q[q.length-1],je.raw+=`
|
|
`+se.raw,je.text+=`
|
|
`+se.text);continue}if(se=this.tokenizer.fences(Q)){Q=Q.substring(se.raw.length),q.push(se);continue}if(se=this.tokenizer.heading(Q)){Q=Q.substring(se.raw.length),q.push(se);continue}if(se=this.tokenizer.nptable(Q)){Q=Q.substring(se.raw.length),q.push(se);continue}if(se=this.tokenizer.hr(Q)){Q=Q.substring(se.raw.length),q.push(se);continue}if(se=this.tokenizer.blockquote(Q)){Q=Q.substring(se.raw.length),se.tokens=this.blockTokens(se.text,[],re),q.push(se);continue}if(se=this.tokenizer.list(Q)){for(Q=Q.substring(se.raw.length),Oe=se.items.length,Te=0;Te<Oe;Te++)se.items[Te].tokens=this.blockTokens(se.items[Te].text,[],!1);q.push(se);continue}if(se=this.tokenizer.html(Q)){Q=Q.substring(se.raw.length),q.push(se);continue}if(re&&(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),q.push(se);continue}if(se=this.tokenizer.lheading(Q)){Q=Q.substring(se.raw.length),q.push(se);continue}if(re&&(se=this.tokenizer.paragraph(Q))){Q=Q.substring(se.raw.length),q.push(se);continue}if(se=this.tokenizer.text(Q,q)){Q=Q.substring(se.raw.length),se.type?q.push(se):(je=q[q.length-1],je.raw+=`
|
|
`+se.raw,je.text+=`
|
|
`+se.text);continue}if(Q){var st="Infinite loop on byte: "+Q.charCodeAt(0);if(this.options.silent){console.error(st);break}else throw new Error(st)}}return q},de.inline=function(Q){var q,re,se,Te,Oe,je,st=Q.length;for(q=0;q<st;q++){je=Q[q];switch(je.type){case"paragraph":case"text":case"heading":{je.tokens=[],this.inlineTokens(je.text,je.tokens);break}case"table":{for(je.tokens={header:[],cells:[]},Te=je.header.length,re=0;re<Te;re++)je.tokens.header[re]=[],this.inlineTokens(je.header[re],je.tokens.header[re]);for(Te=je.cells.length,re=0;re<Te;re++)for(Oe=je.cells[re],je.tokens.cells[re]=[],se=0;se<Oe.length;se++)je.tokens.cells[re][se]=[],this.inlineTokens(Oe[se],je.tokens.cells[re][se]);break}case"blockquote":{this.inline(je.tokens);break}case"list":{for(Te=je.items.length,re=0;re<Te;re++)this.inline(je.items[re].tokens);break}}}return Q},de.inlineTokens=function(Q,q,re,se,Te){q===void 0&&(q=[]),re===void 0&&(re=!1),se===void 0&&(se=!1),Te===void 0&&(Te="");var Oe,je=Q,st;if(this.tokens.links){var ht=Object.keys(this.tokens.links);if(ht.length>0)for(;(st=this.tokenizer.rules.inline.reflinkSearch.exec(je))!=null;)ht.includes(st[0].slice(st[0].lastIndexOf("[")+1,-1))&&(je=je.slice(0,st.index)+"["+"a".repeat(st[0].length-2)+"]"+je.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(st=this.tokenizer.rules.inline.blockSkip.exec(je))!=null;)je=je.slice(0,st.index)+"["+"a".repeat(st[0].length-2)+"]"+je.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Q;){if(Oe=this.tokenizer.escape(Q)){Q=Q.substring(Oe.raw.length),q.push(Oe);continue}if(Oe=this.tokenizer.tag(Q,re,se)){Q=Q.substring(Oe.raw.length),re=Oe.inLink,se=Oe.inRawBlock,q.push(Oe);continue}if(Oe=this.tokenizer.link(Q)){Q=Q.substring(Oe.raw.length),Oe.type==="link"&&(Oe.tokens=this.inlineTokens(Oe.text,[],!0,se)),q.push(Oe);continue}if(Oe=this.tokenizer.reflink(Q,this.tokens.links)){Q=Q.substring(Oe.raw.length),Oe.type==="link"&&(Oe.tokens=this.inlineTokens(Oe.text,[],!0,se)),q.push(Oe);continue}if(Oe=this.tokenizer.strong(Q,je,Te)){Q=Q.substring(Oe.raw.length),Oe.tokens=this.inlineTokens(Oe.text,[],re,se),q.push(Oe);continue}if(Oe=this.tokenizer.em(Q,je,Te)){Q=Q.substring(Oe.raw.length),Oe.tokens=this.inlineTokens(Oe.text,[],re,se),q.push(Oe);continue}if(Oe=this.tokenizer.codespan(Q)){Q=Q.substring(Oe.raw.length),q.push(Oe);continue}if(Oe=this.tokenizer.br(Q)){Q=Q.substring(Oe.raw.length),q.push(Oe);continue}if(Oe=this.tokenizer.del(Q)){Q=Q.substring(Oe.raw.length),Oe.tokens=this.inlineTokens(Oe.text,[],re,se),q.push(Oe);continue}if(Oe=this.tokenizer.autolink(Q,ve)){Q=Q.substring(Oe.raw.length),q.push(Oe);continue}if(!re&&(Oe=this.tokenizer.url(Q,ve))){Q=Q.substring(Oe.raw.length),q.push(Oe);continue}if(Oe=this.tokenizer.inlineText(Q,se,Ce)){Q=Q.substring(Oe.raw.length),Te=Oe.raw.slice(-1),q.push(Oe);continue}if(Q){var Me="Infinite loop on byte: "+Q.charCodeAt(0);if(this.options.silent){console.error(Me);break}else throw new Error(Me)}}return q},K(ge,null,[{key:"rules",get:function(){return{block:ee,inline:Ee}}}]),ge}(),De=B.defaults,_e=W.cleanUrl,ke=W.escape,Re=function(){function ge(ce){this.options=ce||De}var de=ge.prototype;return de.code=function(Q,q,re){var se=(q||"").match(/\S*/)[0];if(this.options.highlight){var Te=this.options.highlight(Q,se);Te!=null&&Te!==Q&&(re=!0,Q=Te)}return se?'<pre><code class="'+this.options.langPrefix+ke(se,!0)+'">'+(re?Q:ke(Q,!0))+`</code></pre>
|
|
`:"<pre><code>"+(re?Q:ke(Q,!0))+`</code></pre>
|
|
`},de.blockquote=function(Q){return`<blockquote>
|
|
`+Q+`</blockquote>
|
|
`},de.html=function(Q){return Q},de.heading=function(Q,q,re,se){return this.options.headerIds?"<h"+q+' id="'+this.options.headerPrefix+se.slug(re)+'">'+Q+"</h"+q+`>
|
|
`:"<h"+q+">"+Q+"</h"+q+`>
|
|
`},de.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},de.list=function(Q,q,re){var se=q?"ol":"ul",Te=q&&re!==1?' start="'+re+'"':"";return"<"+se+Te+`>
|
|
`+Q+"</"+se+`>
|
|
`},de.listitem=function(Q){return"<li>"+Q+`</li>
|
|
`},de.checkbox=function(Q){return"<input "+(Q?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},de.paragraph=function(Q){return"<p>"+Q+`</p>
|
|
`},de.table=function(Q,q){return q&&(q="<tbody>"+q+"</tbody>"),`<table>
|
|
<thead>
|
|
`+Q+`</thead>
|
|
`+q+`</table>
|
|
`},de.tablerow=function(Q){return`<tr>
|
|
`+Q+`</tr>
|
|
`},de.tablecell=function(Q,q){var re=q.header?"th":"td",se=q.align?"<"+re+' align="'+q.align+'">':"<"+re+">";return se+Q+"</"+re+`>
|
|
`},de.strong=function(Q){return"<strong>"+Q+"</strong>"},de.em=function(Q){return"<em>"+Q+"</em>"},de.codespan=function(Q){return"<code>"+Q+"</code>"},de.br=function(){return this.options.xhtml?"<br/>":"<br>"},de.del=function(Q){return"<del>"+Q+"</del>"},de.link=function(Q,q,re){if(Q=_e(this.options.sanitize,this.options.baseUrl,Q),Q===null)return re;var se='<a href="'+ke(Q)+'"';return q&&(se+=' title="'+q+'"'),se+=">"+re+"</a>",se},de.image=function(Q,q,re){if(Q=_e(this.options.sanitize,this.options.baseUrl,Q),Q===null)return re;var se='<img src="'+Q+'" alt="'+re+'"';return q&&(se+=' title="'+q+'"'),se+=this.options.xhtml?"/>":">",se},de.text=function(Q){return Q},ge}(),Ae=function(){function ge(){}var de=ge.prototype;return de.strong=function(Q){return Q},de.em=function(Q){return Q},de.codespan=function(Q){return Q},de.del=function(Q){return Q},de.html=function(Q){return Q},de.text=function(Q){return Q},de.link=function(Q,q,re){return""+re},de.image=function(Q,q,re){return""+re},de.br=function(){return""},ge}(),Ue=function(){function ge(){this.seen={}}var de=ge.prototype;return de.slug=function(Q){var q=Q.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(q)){var re=q;do this.seen[re]++,q=re+"-"+this.seen[re];while(this.seen.hasOwnProperty(q))}return this.seen[q]=0,q},ge}(),Ye=B.defaults,Ge=W.unescape,He=function(){function ge(ce){this.options=ce||Ye,this.options.renderer=this.options.renderer||new Re,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ae,this.slugger=new Ue}ge.parse=function(Q,q){var re=new ge(q);return re.parse(Q)};var de=ge.prototype;return de.parse=function(Q,q){q===void 0&&(q=!0);var re="",se,Te,Oe,je,st,ht,Me,mt,at,qe,xt,Et,Pt,Lt,pt,or,Kt,Ut,Tr=Q.length;for(se=0;se<Tr;se++){qe=Q[se];switch(qe.type){case"space":continue;case"hr":{re+=this.renderer.hr();continue}case"heading":{re+=this.renderer.heading(this.parseInline(qe.tokens),qe.depth,Ge(this.parseInline(qe.tokens,this.textRenderer)),this.slugger);continue}case"code":{re+=this.renderer.code(qe.text,qe.lang,qe.escaped);continue}case"table":{for(mt="",Me="",je=qe.header.length,Te=0;Te<je;Te++)Me+=this.renderer.tablecell(this.parseInline(qe.tokens.header[Te]),{header:!0,align:qe.align[Te]});for(mt+=this.renderer.tablerow(Me),at="",je=qe.cells.length,Te=0;Te<je;Te++){for(ht=qe.tokens.cells[Te],Me="",st=ht.length,Oe=0;Oe<st;Oe++)Me+=this.renderer.tablecell(this.parseInline(ht[Oe]),{header:!1,align:qe.align[Oe]});at+=this.renderer.tablerow(Me)}re+=this.renderer.table(mt,at);continue}case"blockquote":{at=this.parse(qe.tokens),re+=this.renderer.blockquote(at);continue}case"list":{for(xt=qe.ordered,Et=qe.start,Pt=qe.loose,je=qe.items.length,at="",Te=0;Te<je;Te++)pt=qe.items[Te],or=pt.checked,Kt=pt.task,Lt="",pt.task&&(Ut=this.renderer.checkbox(or),Pt?pt.tokens.length>0&&pt.tokens[0].type==="text"?(pt.tokens[0].text=Ut+" "+pt.tokens[0].text,pt.tokens[0].tokens&&pt.tokens[0].tokens.length>0&&pt.tokens[0].tokens[0].type==="text"&&(pt.tokens[0].tokens[0].text=Ut+" "+pt.tokens[0].tokens[0].text)):pt.tokens.unshift({type:"text",text:Ut}):Lt+=Ut),Lt+=this.parse(pt.tokens,Pt),at+=this.renderer.listitem(Lt,Kt,or);re+=this.renderer.list(at,xt,Et);continue}case"html":{re+=this.renderer.html(qe.text);continue}case"paragraph":{re+=this.renderer.paragraph(this.parseInline(qe.tokens));continue}case"text":{for(at=qe.tokens?this.parseInline(qe.tokens):qe.text;se+1<Tr&&Q[se+1].type==="text";)qe=Q[++se],at+=`
|
|
`+(qe.tokens?this.parseInline(qe.tokens):qe.text);re+=q?this.renderer.paragraph(at):at;continue}default:{var vr='Token with "'+qe.type+'" type was not found.';if(this.options.silent){console.error(vr);return}else throw new Error(vr)}}}return re},de.parseInline=function(Q,q){q=q||this.renderer;var re="",se,Te,Oe=Q.length;for(se=0;se<Oe;se++){Te=Q[se];switch(Te.type){case"escape":{re+=q.text(Te.text);break}case"html":{re+=q.html(Te.text);break}case"link":{re+=q.link(Te.href,Te.title,this.parseInline(Te.tokens,q));break}case"image":{re+=q.image(Te.href,Te.title,Te.text);break}case"strong":{re+=q.strong(this.parseInline(Te.tokens,q));break}case"em":{re+=q.em(this.parseInline(Te.tokens,q));break}case"codespan":{re+=q.codespan(Te.text);break}case"br":{re+=q.br();break}case"del":{re+=q.del(this.parseInline(Te.tokens,q));break}case"text":{re+=q.text(Te.text);break}default:{var je='Token with "'+Te.type+'" type was not found.';if(this.options.silent){console.error(je);return}else throw new Error(je)}}}return re},ge}(),et=W.merge,Je=W.checkSanitizeDeprecation,Xe=W.escape,we=B.getDefaults,rt=B.changeDefaults,$e=B.defaults;function Le(ge,de,ce){if(typeof ge=="undefined"||ge===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ge!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ge)+", string expected");if(typeof de=="function"&&(ce=de,de=null),de=et({},Le.defaults,de||{}),Je(de),ce){var Q=de.highlight,q;try{q=Se.lex(ge,de)}catch(Oe){return ce(Oe)}var re=function(je){var st;if(!je)try{st=He.parse(q,de)}catch(ht){je=ht}return de.highlight=Q,je?ce(je):ce(null,st)};if(!Q||Q.length<3)return re();if(delete de.highlight,!q.length)return re();var se=0;Le.walkTokens(q,function(Oe){Oe.type==="code"&&(se++,setTimeout(function(){Q(Oe.text,Oe.lang,function(je,st){if(je)return re(je);st!=null&&st!==Oe.text&&(Oe.text=st,Oe.escaped=!0),se--,se===0&&re()})},0))}),se===0&&re();return}try{var Te=Se.lex(ge,de);return de.walkTokens&&Le.walkTokens(Te,de.walkTokens),He.parse(Te,de)}catch(Oe){if(Oe.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,de.silent)return"<p>An error occurred:</p><pre>"+Xe(Oe.message+"",!0)+"</pre>";throw Oe}}Le.options=Le.setOptions=function(ge){return et(Le.defaults,ge),rt(Le.defaults),Le},Le.getDefaults=we,Le.defaults=$e,Le.use=function(ge){var de=et({},ge);if(ge.renderer&&function(){var Q=Le.defaults.renderer||new Re,q=function(Te){var Oe=Q[Te];Q[Te]=function(){for(var je=arguments.length,st=new Array(je),ht=0;ht<je;ht++)st[ht]=arguments[ht];var Me=ge.renderer[Te].apply(Q,st);return Me===!1&&(Me=Oe.apply(Q,st)),Me}};for(var re in ge.renderer)q(re);de.renderer=Q}(),ge.tokenizer&&function(){var Q=Le.defaults.tokenizer||new me,q=function(Te){var Oe=Q[Te];Q[Te]=function(){for(var je=arguments.length,st=new Array(je),ht=0;ht<je;ht++)st[ht]=arguments[ht];var Me=ge.tokenizer[Te].apply(Q,st);return Me===!1&&(Me=Oe.apply(Q,st)),Me}};for(var re in ge.tokenizer)q(re);de.tokenizer=Q}(),ge.walkTokens){var ce=Le.defaults.walkTokens;de.walkTokens=function(Q){ge.walkTokens(Q),ce&&ce(Q)}}Le.setOptions(de)},Le.walkTokens=function(ge,de){for(var ce=I(ge),Q;!(Q=ce()).done;){var q=Q.value;de(q);switch(q.type){case"table":{for(var re=I(q.tokens.header),se;!(se=re()).done;){var Te=se.value;Le.walkTokens(Te,de)}for(var Oe=I(q.tokens.cells),je;!(je=Oe()).done;)for(var st=je.value,ht=I(st),Me;!(Me=ht()).done;){var mt=Me.value;Le.walkTokens(mt,de)}break}case"list":{Le.walkTokens(q.items,de);break}default:q.tokens&&Le.walkTokens(q.tokens,de)}}},Le.Parser=He,Le.parser=He.parse,Le.Renderer=Re,Le.TextRenderer=Ae,Le.Lexer=Se,Le.lexer=Se.lex,Le.Tokenizer=me,Le.Slugger=Ue,Le.parse=Le;var Fe=Le;return Fe})},ELLl:function(Ze,Ke,te){(function(J){J(te("VrN/"))})(function(J){var K={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},L=J.Pos;J.defineOption("autoCloseBrackets",!1,function(b,E,l){l&&l!=J.Init&&(b.removeKeyMap(I),b.state.closeBrackets=null),E&&(O(H(E,"pairs")),b.state.closeBrackets=E,b.addKeyMap(I))});function H(b,E){return E=="pairs"&&typeof b=="string"?b:typeof b=="object"&&b[E]!=null?b[E]:K[E]}var I={Backspace:R,Enter:A};function O(b){for(var E=0;E<b.length;E++){var l=b.charAt(E),o="'"+l+"'";I[o]||(I[o]=B(l))}}O(K.pairs+"`");function B(b){return function(E){return v(E,b)}}function N(b){var E=b.state.closeBrackets;if(!E||E.override)return E;var l=b.getModeAt(b.getCursor());return l.closeBrackets||E}function R(b){var E=N(b);if(!E||b.getOption("disableInput"))return J.Pass;for(var l=H(E,"pairs"),o=b.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return J.Pass;var d=P(b,o[s].head);if(!d||l.indexOf(d)%2!=0)return J.Pass}for(var s=o.length-1;s>=0;s--){var C=o[s].head;b.replaceRange("",L(C.line,C.ch-1),L(C.line,C.ch+1),"+delete")}}function A(b){var E=N(b),l=E&&H(E,"explode");if(!l||b.getOption("disableInput"))return J.Pass;for(var o=b.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return J.Pass;var d=P(b,o[s].head);if(!d||l.indexOf(d)%2!=0)return J.Pass}b.operation(function(){var C=b.lineSeparator()||`
|
|
`;b.replaceSelection(C+C,null),b.execCommand("goCharLeft"),o=b.listSelections();for(var g=0;g<o.length;g++){var m=o[g].head.line;b.indentLine(m,null,!0),b.indentLine(m+1,null,!0)}})}function f(b){var E=J.cmpPos(b.anchor,b.head)>0;return{anchor:new L(b.anchor.line,b.anchor.ch+(E?-1:1)),head:new L(b.head.line,b.head.ch+(E?1:-1))}}function v(b,E){var l=N(b);if(!l||b.getOption("disableInput"))return J.Pass;var o=H(l,"pairs"),s=o.indexOf(E);if(s==-1)return J.Pass;for(var d=H(l,"closeBefore"),C=H(l,"triples"),g=o.charAt(s+1)==E,m=b.listSelections(),D=s%2==0,T,h=0;h<m.length;h++){var c=m[h],u=c.head,a,x=b.getRange(u,L(u.line,u.ch+1));if(D&&!c.empty())a="surround";else if((g||!D)&&x==E)g&&w(b,u)?a="both":C.indexOf(E)>=0&&b.getRange(u,L(u.line,u.ch+3))==E+E+E?a="skipThree":a="skip";else if(g&&u.ch>1&&C.indexOf(E)>=0&&b.getRange(L(u.line,u.ch-2),u)==E+E){if(u.ch>2&&/\bstring/.test(b.getTokenTypeAt(L(u.line,u.ch-2))))return J.Pass;a="addFour"}else if(g){var y=u.ch==0?" ":b.getRange(L(u.line,u.ch-1),u);if(!J.isWordChar(x)&&y!=E&&!J.isWordChar(y))a="both";else return J.Pass}else if(D&&(x.length===0||/\s/.test(x)||d.indexOf(x)>-1))a="both";else return J.Pass;if(!T)T=a;else if(T!=a)return J.Pass}var p=s%2?o.charAt(s-1):E,k=s%2?E:o.charAt(s+1);b.operation(function(){if(T=="skip")b.execCommand("goCharRight");else if(T=="skipThree")for(var F=0;F<3;F++)b.execCommand("goCharRight");else if(T=="surround"){for(var U=b.getSelections(),F=0;F<U.length;F++)U[F]=p+U[F]+k;b.replaceSelections(U,"around"),U=b.listSelections().slice();for(var F=0;F<U.length;F++)U[F]=f(U[F]);b.setSelections(U)}else T=="both"?(b.replaceSelection(p+k,null),b.triggerElectric(p+k),b.execCommand("goCharLeft")):T=="addFour"&&(b.replaceSelection(p+p+p+p,"before"),b.execCommand("goCharRight"))})}function P(b,E){var l=b.getRange(L(E.line,E.ch-1),L(E.line,E.ch+1));return l.length==2?l:null}function w(b,E){var l=b.getTokenAt(L(E.line,E.ch+1));return/\bstring/.test(l.type)&&l.start==E.ch&&(E.ch==0||!/\bstring/.test(b.getTokenTypeAt(E)))}})},GfqC:function(Ze,Ke,te){"use strict";var J=te("cDcd"),K=te.n(J),L=te("TSYQ"),H=te.n(L);function I(W,_){var M="cannot "+W.method+" "+W.action+" "+_.status+"'",G=new Error(M);return G.status=_.status,G.method=W.method,G.url=W.action,G}function O(W){var _=W.responseText||W.response;if(!_)return _;try{return JSON.parse(_)}catch(M){return _}}function B(W){var _=new XMLHttpRequest;W.onProgress&&_.upload&&(_.upload.onprogress=function(Z){Z.total>0&&(Z.percent=Z.loaded/Z.total*100),W.onProgress(Z)});var M=new FormData;W.data&&Object.keys(W.data).forEach(function(Y){var Z=W.data[Y];if(Array.isArray(Z)){Z.forEach(function(ne){M.append(Y+"[]",ne)});return}M.append(Y,W.data[Y])}),W.file instanceof Blob?M.append(W.filename,W.file,W.file.name):M.append(W.filename,W.file),_.onerror=function(Z){W.onError(Z)},_.onload=function(){return _.status<200||_.status>=300?W.onError(I(W,_),O(_)):W.onSuccess(O(_),_)},_.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in _&&(_.withCredentials=!0);var G=W.headers||{};return G["X-Requested-With"]!==null&&_.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(G).forEach(function(Y){G[Y]!==null&&_.setRequestHeader(Y,G[Y])}),_.send(M),{abort:function(){_.abort()}}}var N=+new Date,R=0;function A(){return"rc-upload-"+N+"-"+ ++R}function f(W,_){return W.indexOf(_,W.length-_.length)!==-1}var v=function(W,_){if(W&&_){var M=Array.isArray(_)?_:_.split(","),G=W.name||"",Y=W.type||"",Z=Y.replace(/\/.*$/,"");return M.some(function(ne){var be=ne.trim();return be.charAt(0)==="."?f(G.toLowerCase(),be.toLowerCase()):/\/\*$/.test(be)?Z===be.replace(/\/.*$/,""):Y===be})}return!0};function P(W,_){var M=W.createReader(),G=[];function Y(){M.readEntries(function(Z){var ne=Array.prototype.slice.apply(Z);G=G.concat(ne);var be=!ne.length;be?_(G):Y()})}Y()}var w=function(_,M,G){var Y=function Z(ne,be){be=be||"",ne.isFile?ne.file(function(me){G(me)&&(ne.fullPath&&!me.webkitRelativePath&&(Object.defineProperties(me,{webkitRelativePath:{writable:!0}}),me.webkitRelativePath=ne.fullPath.replace(/^\//,""),Object.defineProperties(me,{webkitRelativePath:{writable:!1}})),M([me]))}):ne.isDirectory&&P(ne,function(me){me.forEach(function(pe){Z(pe,""+be+ne.name+"/")})})};_.forEach(function(Z){Y(Z.webkitGetAsEntry())})},b=w,E=Object.assign||function(W){for(var _=1;_<arguments.length;_++){var M=arguments[_];for(var G in M)Object.prototype.hasOwnProperty.call(M,G)&&(W[G]=M[G])}return W},l=function(){function W(_,M){var G=[],Y=!0,Z=!1,ne=void 0;try{for(var be=_[Symbol.iterator](),me;!(Y=(me=be.next()).done)&&!(G.push(me.value),M&&G.length===M);Y=!0);}catch(pe){Z=!0,ne=pe}finally{try{!Y&&be.return&&be.return()}finally{if(Z)throw ne}}return G}return function(_,M){if(Array.isArray(_))return _;if(Symbol.iterator in Object(_))return W(_,M);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function W(_,M){for(var G=0;G<M.length;G++){var Y=M[G];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(_,Y.key,Y)}}return function(_,M,G){return M&&W(_.prototype,M),G&&W(_,G),_}}();function s(W,_,M){return _ in W?Object.defineProperty(W,_,{value:M,enumerable:!0,configurable:!0,writable:!0}):W[_]=M,W}function d(W,_){var M={};for(var G in W){if(_.indexOf(G)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,G))continue;M[G]=W[G]}return M}function C(W,_){if(!(W instanceof _))throw new TypeError("Cannot call a class as a function")}function g(W,_){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:W}function m(W,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);W.prototype=Object.create(_&&_.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(W,_):W.__proto__=_)}var D=function(_){return Object.keys(_).reduce(function(M,G){return(G.substr(0,5)==="data-"||G.substr(0,5)==="aria-"||G==="role")&&(M[G]=_[G]),M},{})},T=function(W){m(_,W);function _(){var M,G,Y,Z;C(this,_);for(var ne=arguments.length,be=Array(ne),me=0;me<ne;me++)be[me]=arguments[me];return Z=(G=(Y=g(this,(M=_.__proto__||Object.getPrototypeOf(_)).call.apply(M,[this].concat(be))),Y),Y.state={uid:A()},Y.reqs={},Y.onChange=function(pe){var ue=pe.target.files;Y.uploadFiles(ue),Y.reset()},Y.onClick=function(pe){var ue=Y.fileInput;if(!ue)return;var fe=Y.props,ie=fe.children,he=fe.onClick;ie&&ie.type==="button"&&(ue.parentNode.focus(),ue.parentNode.querySelector("button").blur()),ue.click(),he&&he(pe)},Y.onKeyDown=function(pe){pe.key==="Enter"&&Y.onClick()},Y.onFileDrop=function(pe){var ue=Y.props.multiple;if(pe.preventDefault(),pe.type==="dragover")return;if(Y.props.directory)b(Array.prototype.slice.call(pe.dataTransfer.items),Y.uploadFiles,function(ie){return v(ie,Y.props.accept)});else{var fe=Array.prototype.slice.call(pe.dataTransfer.files).filter(function(ie){return v(ie,Y.props.accept)});ue===!1&&(fe=fe.slice(0,1)),Y.uploadFiles(fe)}},Y.uploadFiles=function(pe){var ue=Array.prototype.slice.call(pe);ue.map(function(fe){return fe.uid=A(),fe}).forEach(function(fe){Y.upload(fe,ue)})},Y.saveFileInput=function(pe){Y.fileInput=pe},G),g(Y,Z)}return o(_,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(G,Y){var Z=this,ne=this.props;if(!ne.beforeUpload)return setTimeout(function(){return Z.post(G)},0);var be=ne.beforeUpload(G,Y);be&&be.then?be.then(function(me){var pe=Object.prototype.toString.call(me);return pe==="[object File]"||pe==="[object Blob]"?Z.post(me):Z.post(G)}).catch(function(me){console.log(me)}):be!==!1&&setTimeout(function(){return Z.post(G)},0);return}},{key:"post",value:function(G){var Y=this;if(!this._isMounted)return;var Z=this.props,ne=Z.onStart,be=Z.onProgress,me=Z.transformFile,pe=me===void 0?function(ue){return ue}:me;new Promise(function(ue){var fe=Z.action;return typeof fe=="function"&&(fe=fe(G)),ue(fe)}).then(function(ue){var fe=G.uid,ie=Z.customRequest||B,he=Promise.resolve(pe(G)).then(function($){var ae=Z.data;return typeof ae=="function"&&(ae=ae($)),Promise.all([$,ae])}).catch(function($){console.error($)});he.then(function($){var ae=l($,2),ee=ae[0],Ee=ae[1],Ce={action:ue,filename:Z.name,data:Ee,file:ee,headers:Z.headers,withCredentials:Z.withCredentials,method:Z.method||"post",onProgress:be?function(ve){be(ve,G)}:null,onSuccess:function(Se,De){delete Y.reqs[fe],Z.onSuccess(Se,G,De)},onError:function(Se,De){delete Y.reqs[fe],Z.onError(Se,De,G)}};ne(G),Y.reqs[fe]=ie(Ce)})})}},{key:"reset",value:function(){this.setState({uid:A()})}},{key:"abort",value:function(G){var Y=this.reqs;if(G){var Z=G;G&&G.uid&&(Z=G.uid),Y[Z]&&Y[Z].abort&&Y[Z].abort(),delete Y[Z]}else Object.keys(Y).forEach(function(ne){Y[ne]&&Y[ne].abort&&Y[ne].abort(),delete Y[ne]})}},{key:"render",value:function(){var G,Y=this.props,Z=Y.component,ne=Y.prefixCls,be=Y.className,me=Y.disabled,pe=Y.id,ue=Y.style,fe=Y.multiple,ie=Y.accept,he=Y.children,$=Y.directory,ae=Y.openFileDialogOnClick,ee=Y.onMouseEnter,Ee=Y.onMouseLeave,Ce=d(Y,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ve=H()((G={},s(G,ne,!0),s(G,ne+"-disabled",me),s(G,be,be),G)),Se=me?{}:{onClick:ae?this.onClick:function(){},onKeyDown:ae?this.onKeyDown:function(){},onMouseEnter:ee,onMouseLeave:Ee,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return K.a.createElement(Z,E({},Se,{className:ve,role:"button",style:ue}),K.a.createElement("input",E({},D(Ce),{id:pe,type:"file",ref:this.saveFileInput,onClick:function(_e){return _e.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ie,directory:$?"directory":null,webkitdirectory:$?"webkitdirectory":null,multiple:fe,onChange:this.onChange})),he)}}]),_}(J.Component),h=T,c=Object.assign||function(W){for(var _=1;_<arguments.length;_++){var M=arguments[_];for(var G in M)Object.prototype.hasOwnProperty.call(M,G)&&(W[G]=M[G])}return W},u=function(){function W(_,M){for(var G=0;G<M.length;G++){var Y=M[G];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(_,Y.key,Y)}}return function(_,M,G){return M&&W(_.prototype,M),G&&W(_,G),_}}();function a(W,_){if(!(W instanceof _))throw new TypeError("Cannot call a class as a function")}function x(W,_){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:W}function y(W,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);W.prototype=Object.create(_&&_.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(W,_):W.__proto__=_)}function p(){}var k=function(W){y(_,W);function _(){var M,G,Y,Z;a(this,_);for(var ne=arguments.length,be=Array(ne),me=0;me<ne;me++)be[me]=arguments[me];return Z=(G=(Y=x(this,(M=_.__proto__||Object.getPrototypeOf(_)).call.apply(M,[this].concat(be))),Y),Y.saveUploader=function(pe){Y.uploader=pe},G),x(Y,Z)}return u(_,[{key:"abort",value:function(G){this.uploader.abort(G)}},{key:"render",value:function(){return K.a.createElement(h,c({},this.props,{ref:this.saveUploader}))}}]),_}(J.Component);k.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:p,onError:p,onSuccess:p,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var F=k,U=Ke.a=F},Gytx:function(Ze,Ke){Ze.exports=function(J,K,L,H){var I=L?L.call(H,J,K):void 0;if(I!==void 0)return!!I;if(J===K)return!0;if(typeof J!="object"||!J||typeof K!="object"||!K)return!1;var O=Object.keys(J),B=Object.keys(K);if(O.length!==B.length)return!1;for(var N=Object.prototype.hasOwnProperty.bind(K),R=0;R<O.length;R++){var A=O[R];if(!N(A))return!1;var f=J[A],v=K[A];if(I=L?L.call(H,f,v,A):void 0,I===!1||I===void 0&&f!==v)return!1}return!0}},H38U:function(Ze,Ke,te){var J=te("f4xo"),K=te("rcnY"),L=te("wU8J"),H=te("Iq15"),I=te("dWSS");function O(N,R){this.typeNumber=N,this.errorCorrectLevel=R,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var B=O.prototype;B.addData=function(N){var R=new J(N);this.dataList.push(R),this.dataCache=null},B.isDark=function(N,R){if(N<0||this.moduleCount<=N||R<0||this.moduleCount<=R)throw new Error(N+","+R);return this.modules[N][R]},B.getModuleCount=function(){return this.moduleCount},B.make=function(){if(this.typeNumber<1){var N=1;for(N=1;N<40;N++){for(var R=K.getRSBlocks(N,this.errorCorrectLevel),A=new L,f=0,v=0;v<R.length;v++)f+=R[v].dataCount;for(var v=0;v<this.dataList.length;v++){var P=this.dataList[v];A.put(P.mode,4),A.put(P.getLength(),H.getLengthInBits(P.mode,N)),P.write(A)}if(A.getLengthInBits()<=f*8)break}this.typeNumber=N}this.makeImpl(!1,this.getBestMaskPattern())},B.makeImpl=function(N,R){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var A=0;A<this.moduleCount;A++){this.modules[A]=new Array(this.moduleCount);for(var f=0;f<this.moduleCount;f++)this.modules[A][f]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(N,R),this.typeNumber>=7&&this.setupTypeNumber(N),this.dataCache==null&&(this.dataCache=O.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,R)},B.setupPositionProbePattern=function(N,R){for(var A=-1;A<=7;A++){if(N+A<=-1||this.moduleCount<=N+A)continue;for(var f=-1;f<=7;f++){if(R+f<=-1||this.moduleCount<=R+f)continue;0<=A&&A<=6&&(f==0||f==6)||0<=f&&f<=6&&(A==0||A==6)||2<=A&&A<=4&&2<=f&&f<=4?this.modules[N+A][R+f]=!0:this.modules[N+A][R+f]=!1}}},B.getBestMaskPattern=function(){for(var N=0,R=0,A=0;A<8;A++){this.makeImpl(!0,A);var f=H.getLostPoint(this);(A==0||N>f)&&(N=f,R=A)}return R},B.createMovieClip=function(N,R,A){var f=N.createEmptyMovieClip(R,A),v=1;this.make();for(var P=0;P<this.modules.length;P++)for(var w=P*v,b=0;b<this.modules[P].length;b++){var E=b*v,l=this.modules[P][b];l&&(f.beginFill(0,100),f.moveTo(E,w),f.lineTo(E+v,w),f.lineTo(E+v,w+v),f.lineTo(E,w+v),f.endFill())}return f},B.setupTimingPattern=function(){for(var N=8;N<this.moduleCount-8;N++){if(this.modules[N][6]!=null)continue;this.modules[N][6]=N%2==0}for(var R=8;R<this.moduleCount-8;R++){if(this.modules[6][R]!=null)continue;this.modules[6][R]=R%2==0}},B.setupPositionAdjustPattern=function(){for(var N=H.getPatternPosition(this.typeNumber),R=0;R<N.length;R++)for(var A=0;A<N.length;A++){var f=N[R],v=N[A];if(this.modules[f][v]!=null)continue;for(var P=-2;P<=2;P++)for(var w=-2;w<=2;w++)P==-2||P==2||w==-2||w==2||P==0&&w==0?this.modules[f+P][v+w]=!0:this.modules[f+P][v+w]=!1}},B.setupTypeNumber=function(N){for(var R=H.getBCHTypeNumber(this.typeNumber),A=0;A<18;A++){var f=!N&&(R>>A&1)==1;this.modules[Math.floor(A/3)][A%3+this.moduleCount-8-3]=f}for(var A=0;A<18;A++){var f=!N&&(R>>A&1)==1;this.modules[A%3+this.moduleCount-8-3][Math.floor(A/3)]=f}},B.setupTypeInfo=function(N,R){for(var A=this.errorCorrectLevel<<3|R,f=H.getBCHTypeInfo(A),v=0;v<15;v++){var P=!N&&(f>>v&1)==1;v<6?this.modules[v][8]=P:v<8?this.modules[v+1][8]=P:this.modules[this.moduleCount-15+v][8]=P}for(var v=0;v<15;v++){var P=!N&&(f>>v&1)==1;v<8?this.modules[8][this.moduleCount-v-1]=P:v<9?this.modules[8][15-v-1+1]=P:this.modules[8][15-v-1]=P}this.modules[this.moduleCount-8][8]=!N},B.mapData=function(N,R){for(var A=-1,f=this.moduleCount-1,v=7,P=0,w=this.moduleCount-1;w>0;w-=2)for(w==6&&w--;;){for(var b=0;b<2;b++)if(this.modules[f][w-b]==null){var E=!1;P<N.length&&(E=(N[P]>>>v&1)==1);var l=H.getMask(R,f,w-b);l&&(E=!E),this.modules[f][w-b]=E,v--,v==-1&&(P++,v=7)}if(f+=A,f<0||this.moduleCount<=f){f-=A,A=-A;break}}},O.PAD0=236,O.PAD1=17,O.createData=function(N,R,A){for(var f=K.getRSBlocks(N,R),v=new L,P=0;P<A.length;P++){var w=A[P];v.put(w.mode,4),v.put(w.getLength(),H.getLengthInBits(w.mode,N)),w.write(v)}for(var b=0,P=0;P<f.length;P++)b+=f[P].dataCount;if(v.getLengthInBits()>b*8)throw new Error("code length overflow. ("+v.getLengthInBits()+">"+b*8+")");for(v.getLengthInBits()+4<=b*8&&v.put(0,4);v.getLengthInBits()%8!=0;)v.putBit(!1);for(;!(v.getLengthInBits()>=b*8);){if(v.put(O.PAD0,8),v.getLengthInBits()>=b*8)break;v.put(O.PAD1,8)}return O.createBytes(v,f)},O.createBytes=function(N,R){for(var A=0,f=0,v=0,P=new Array(R.length),w=new Array(R.length),b=0;b<R.length;b++){var E=R[b].dataCount,l=R[b].totalCount-E;f=Math.max(f,E),v=Math.max(v,l),P[b]=new Array(E);for(var o=0;o<P[b].length;o++)P[b][o]=255&N.buffer[o+A];A+=E;var s=H.getErrorCorrectPolynomial(l),d=new I(P[b],s.getLength()-1),C=d.mod(s);w[b]=new Array(s.getLength()-1);for(var o=0;o<w[b].length;o++){var g=o+C.getLength()-w[b].length;w[b][o]=g>=0?C.get(g):0}}for(var m=0,o=0;o<R.length;o++)m+=R[o].totalCount;for(var D=new Array(m),T=0,o=0;o<f;o++)for(var b=0;b<R.length;b++)o<P[b].length&&(D[T++]=P[b][o]);for(var o=0;o<v;o++)for(var b=0;b<R.length;b++)o<w[b].length&&(D[T++]=w[b][o]);return D},Ze.exports=O},HmJG:function(Ze,Ke,te){},Iq15:function(Ze,Ke,te){var J=te("nVVt"),K=te("dWSS"),L=te("dQei"),H={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},I={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,G18:1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,G15_MASK:1<<14|1<<12|1<<10|1<<4|1<<1,getBCHTypeInfo:function(O){for(var B=O<<10;I.getBCHDigit(B)-I.getBCHDigit(I.G15)>=0;)B^=I.G15<<I.getBCHDigit(B)-I.getBCHDigit(I.G15);return(O<<10|B)^I.G15_MASK},getBCHTypeNumber:function(O){for(var B=O<<12;I.getBCHDigit(B)-I.getBCHDigit(I.G18)>=0;)B^=I.G18<<I.getBCHDigit(B)-I.getBCHDigit(I.G18);return O<<12|B},getBCHDigit:function(O){for(var B=0;O!=0;)B++,O>>>=1;return B},getPatternPosition:function(O){return I.PATTERN_POSITION_TABLE[O-1]},getMask:function(O,B,N){switch(O){case H.PATTERN000:return(B+N)%2==0;case H.PATTERN001:return B%2==0;case H.PATTERN010:return N%3==0;case H.PATTERN011:return(B+N)%3==0;case H.PATTERN100:return(Math.floor(B/2)+Math.floor(N/3))%2==0;case H.PATTERN101:return B*N%2+B*N%3==0;case H.PATTERN110:return(B*N%2+B*N%3)%2==0;case H.PATTERN111:return(B*N%3+(B+N)%2)%2==0;default:throw new Error("bad maskPattern:"+O)}},getErrorCorrectPolynomial:function(O){for(var B=new K([1],0),N=0;N<O;N++)B=B.multiply(new K([1,L.gexp(N)],0));return B},getLengthInBits:function(O,B){if(1<=B&&B<10)switch(O){case J.MODE_NUMBER:return 10;case J.MODE_ALPHA_NUM:return 9;case J.MODE_8BIT_BYTE:return 8;case J.MODE_KANJI:return 8;default:throw new Error("mode:"+O)}else if(B<27)switch(O){case J.MODE_NUMBER:return 12;case J.MODE_ALPHA_NUM:return 11;case J.MODE_8BIT_BYTE:return 16;case J.MODE_KANJI:return 10;default:throw new Error("mode:"+O)}else if(B<41)switch(O){case J.MODE_NUMBER:return 14;case J.MODE_ALPHA_NUM:return 13;case J.MODE_8BIT_BYTE:return 16;case J.MODE_KANJI:return 12;default:throw new Error("mode:"+O)}else throw new Error("type:"+B)},getLostPoint:function(O){for(var B=O.getModuleCount(),N=0,R=0;R<B;R++)for(var A=0;A<B;A++){for(var f=0,v=O.isDark(R,A),P=-1;P<=1;P++){if(R+P<0||B<=R+P)continue;for(var w=-1;w<=1;w++){if(A+w<0||B<=A+w)continue;if(P==0&&w==0)continue;v==O.isDark(R+P,A+w)&&f++}}f>5&&(N+=3+f-5)}for(var R=0;R<B-1;R++)for(var A=0;A<B-1;A++){var b=0;O.isDark(R,A)&&b++,O.isDark(R+1,A)&&b++,O.isDark(R,A+1)&&b++,O.isDark(R+1,A+1)&&b++,(b==0||b==4)&&(N+=3)}for(var R=0;R<B;R++)for(var A=0;A<B-6;A++)O.isDark(R,A)&&!O.isDark(R,A+1)&&O.isDark(R,A+2)&&O.isDark(R,A+3)&&O.isDark(R,A+4)&&!O.isDark(R,A+5)&&O.isDark(R,A+6)&&(N+=40);for(var A=0;A<B;A++)for(var R=0;R<B-6;R++)O.isDark(R,A)&&!O.isDark(R+1,A)&&O.isDark(R+2,A)&&O.isDark(R+3,A)&&O.isDark(R+4,A)&&!O.isDark(R+5,A)&&O.isDark(R+6,A)&&(N+=40);for(var E=0,A=0;A<B;A++)for(var R=0;R<B;R++)O.isDark(R,A)&&E++;var l=Math.abs(100*E/B/B-50)/5;return N+=l*10,N}};Ze.exports=I},LdHM:function(Ze,Ke,te){"use strict";te.d(Ke,"b",function(){return d}),te.d(Ke,"a",function(){return g});var J=te("1OyB"),K=te("vuIU"),L=te("Ji7U"),H=te("LK+K"),I=te("cDcd"),O=te("rePB"),B=te("Ff2n"),N=te("ODXe"),R=te("4IlW"),A=te("bX4T"),f=te("YrtM"),v=te("TSYQ"),P=te.n(v),w=te("+nKL"),b=te("8OUc"),E=function(G,Y){var Z=G.prefixCls,ne=G.id,be=G.flattenOptions,me=G.childrenAsData,pe=G.values,ue=G.searchValue,fe=G.multiple,ie=G.defaultActiveFirstOption,he=G.height,$=G.itemHeight,ae=G.notFoundContent,ee=G.open,Ee=G.menuItemSelectedIcon,Ce=G.virtual,ve=G.onSelect,Se=G.onToggleOpen,De=G.onActiveValue,_e=G.onScroll,ke=G.onMouseEnter,Re="".concat(Z,"-item"),Ae=Object(f.a)(function(){return be},[ee,be],function(Fe,ge){return ge[0]&&Fe[1]!==ge[1]}),Ue=I.useRef(null),Ye=function(ge){ge.preventDefault()},Ge=function(ge){Ue.current&&Ue.current.scrollTo({index:ge})},He=function(ge){for(var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ce=Ae.length,Q=0;Q<ce;Q+=1){var q=(ge+Q*de+ce)%ce,re=Ae[q],se=re.group,Te=re.data;if(!se&&!Te.disabled)return q}return-1},et=I.useState(function(){return He(0)}),Je=Object(N.a)(et,2),Xe=Je[0],we=Je[1],rt=function(ge){we(ge);var de=Ae[ge];if(!de){De(null,-1);return}De(de.data.value,ge)};I.useEffect(function(){rt(ie!==!1?He(0):-1)},[Ae.length,ue]),I.useEffect(function(){var Fe=setTimeout(function(){if(!fe&&ee&&pe.size===1){var ge=Array.from(pe)[0],de=Ae.findIndex(function(ce){var Q=ce.data;return Q.value===ge});rt(de),Ge(de)}});return function(){return clearTimeout(Fe)}},[ee]);var $e=function(ge){ge!==void 0&&ve(ge,{selected:!pe.has(ge)}),fe||Se(!1)};if(I.useImperativeHandle(Y,function(){return{onKeyDown:function(ge){var de=ge.which;switch(de){case R.a.UP:case R.a.DOWN:{var ce=0;if(de===R.a.UP?ce=-1:de===R.a.DOWN&&(ce=1),ce!==0){var Q=He(Xe+ce,ce);Ge(Q),rt(Q)}break}case R.a.ENTER:{var q=Ae[Xe];q&&!q.data.disabled?$e(q.data.value):$e(void 0),ee&&ge.preventDefault();break}case R.a.ESC:Se(!1)}},onKeyUp:function(){},scrollTo:function(ge){Ge(ge)}}}),Ae.length===0)return I.createElement("div",{role:"listbox",id:"".concat(ne,"_list"),className:"".concat(Re,"-empty"),onMouseDown:Ye},ae);function Le(Fe){var ge=Ae[Fe];if(!ge)return null;var de=ge.data||{},ce=de.value,Q=de.label,q=de.children,re=Object(A.a)(de,!0),se=me?q:Q;return ge?I.createElement("div",Object.assign({"aria-label":typeof se=="string"?se:null},re,{key:Fe,role:"option",id:"".concat(ne,"_list_").concat(Fe),"aria-selected":pe.has(ce)}),ce):null}return I.createElement(I.Fragment,null,I.createElement("div",{role:"listbox",id:"".concat(ne,"_list"),style:{height:0,width:0,overflow:"hidden"}},Le(Xe-1),Le(Xe),Le(Xe+1)),I.createElement(w.a,{itemKey:"key",ref:Ue,data:Ae,height:he,itemHeight:$,fullHeight:!1,onMouseDown:Ye,onScroll:_e,virtual:Ce,onMouseEnter:ke},function(Fe,ge){var de,ce=Fe.group,Q=Fe.groupOption,q=Fe.data,re=q.label,se=q.key;if(ce)return I.createElement("div",{className:P()(Re,"".concat(Re,"-group"))},re!==void 0?re:se);var Te=q.disabled,Oe=q.value,je=q.title,st=q.children,ht=q.style,Me=q.className,mt=Object(B.a)(q,["disabled","value","title","children","style","className"]),at=pe.has(Oe),qe="".concat(Re,"-option"),xt=P()(Re,qe,Me,(de={},Object(O.a)(de,"".concat(qe,"-grouped"),Q),Object(O.a)(de,"".concat(qe,"-active"),Xe===ge&&!Te),Object(O.a)(de,"".concat(qe,"-disabled"),Te),Object(O.a)(de,"".concat(qe,"-selected"),at),de)),Et=me?st:re,Pt=!Ee||typeof Ee=="function"||at;return I.createElement("div",Object.assign({},mt,{"aria-selected":at,className:xt,title:je,onMouseMove:function(){if(Xe===ge||Te)return;rt(ge)},onClick:function(){Te||$e(Oe)},style:ht}),I.createElement("div",{className:"".concat(qe,"-content")},Et||Oe),I.isValidElement(Ee)||at,Pt&&I.createElement(b.a,{className:"".concat(Re,"-option-state"),customizeIcon:Ee,customizeIconProps:{isSelected:at}},at?"\u2713":null))}))},l=I.forwardRef(E);l.displayName="OptionList";var o=l,s=function(){return null};s.isSelectOption=!0;var d=s,C=function(){return null};C.isSelectOptGroup=!0;var g=C,m=te("VTBJ"),D=te("Zm9Q");function T(M){var G=M.key,Y=M.props,Z=Y.children,ne=Y.value,be=Object(B.a)(Y,["children","value"]);return Object(m.a)({key:G,value:ne!==void 0?ne:G,children:Z},be)}function h(M){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(D.a)(M).map(function(Y,Z){if(!I.isValidElement(Y)||!Y.type)return null;var ne=Y.type.isSelectOptGroup,be=Y.key,me=Y.props,pe=me.children,ue=Object(B.a)(me,["children"]);return G||!ne?T(Y):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(be===null?Z:be,"__"),label:be},ue),{},{options:h(pe)})}).filter(function(Y){return Y})}var c=te("2Qr1"),u=te("qNPg"),a=te("U8pU"),x=te("Kwbf"),y=te("WKfj");function p(M){var G=M.mode,Y=M.options,Z=M.children,ne=M.backfill,be=M.allowClear,me=M.placeholder,pe=M.getInputElement,ue=M.showSearch,fe=M.onSearch,ie=M.defaultOpen,he=M.autoFocus,$=M.labelInValue,ae=M.value,ee=M.inputValue,Ee=M.optionLabelProp,Ce=G==="multiple"||G==="tags",ve=ue!==void 0?ue:Ce||G==="combobox",Se=Y||h(Z);if(Object(x.a)(G!=="tags"||Se.every(function(Re){return!Re.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),G==="tags"||G==="combobox"){var De=Se.some(function(Re){return Re.options?Re.options.some(function(Ae){return typeof("value"in Ae?Ae.value:Ae.key)=="number"}):typeof("value"in Re?Re.value:Re.key)=="number"});Object(x.a)(!De,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(x.a)(G!=="combobox"||!Ee,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(x.a)(G==="combobox"||!ne,"`backfill` only works with `combobox` mode."),Object(x.a)(G==="combobox"||!pe,"`getInputElement` only work with `combobox` mode."),Object(x.b)(G!=="combobox"||!pe||!be||!me,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),fe&&!ve&&G!=="combobox"&&G!=="tags"&&Object(x.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(x.b)(!ie||he,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ae!=null){var _e=Object(y.d)(ae);Object(x.a)(!$||_e.every(function(Re){return Object(a.a)(Re)==="object"&&("key"in Re||"value"in Re)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(x.a)(!Ce||Array.isArray(ae),"`value` should be array when `mode` is `multiple` or `tags`")}if(Z){var ke=null;Object(D.a)(Z).some(function(Re){if(!I.isValidElement(Re)||!Re.type)return!1;var Ae=Re.type;if(Ae.isSelectOption)return!1;if(Ae.isSelectOptGroup){var Ue=Object(D.a)(Re.props.children).every(function(Ye){return!I.isValidElement(Ye)||!Re.type||Ye.type.isSelectOption?!0:(ke=Ye.type,!1)});return!Ue}return ke=Ae,!0}),ke&&Object(x.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(ke.displayName||ke.name||ke,"`.")),Object(x.a)(ee===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var k=p,F=Object(u.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:h,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:k,fillOptionsWithMissingValue:c.a}),U=function(M){Object(L.a)(Y,M);var G=Object(H.a)(Y);function Y(){var Z;return Object(J.a)(this,Y),Z=G.apply(this,arguments),Z.selectRef=I.createRef(),Z.focus=function(){Z.selectRef.current.focus()},Z.blur=function(){Z.selectRef.current.blur()},Z}return Object(K.a)(Y,[{key:"render",value:function(){return I.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),Y}(I.Component);U.Option=d,U.OptGroup=g;var W=U,_=Ke.c=W},M8RZ:function(Ze,Ke,te){"use strict";te.d(Ke,"a",function(){return R});var J=te("fWQN"),K=te("mtLc"),L=te("yKVA"),H=te("879j"),I=te("cDcd"),O=te.n(I),B=te("faye"),N=te.n(B),R=function(A){Object(L.a)(v,A);var f=Object(H.a)(v);function v(P){var w;Object(J.a)(this,v),w=f.call(this,P);var b=window.document;return w.node=b.createElement("div"),b.body.appendChild(w.node),w}return Object(K.a)(v,[{key:"render",value:function(){var w=this.props.children;return Object(B.createPortal)(w,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),v}(O.a.Component)},OLES:function(Ze,Ke,te){"use strict";var J=te("U8pU"),K=te("VTBJ"),L=te("Ff2n"),H=te("cDcd"),I=te("uciX"),O=te("7ixt"),B=function(P){var w=P.overlay,b=P.prefixCls,E=P.id,l=P.overlayInnerStyle;return H.createElement("div",{className:"".concat(b,"-inner"),id:E,role:"tooltip",style:l},typeof w=="function"?w():w)},N=B,R=function(P,w){var b=P.overlayClassName,E=P.trigger,l=E===void 0?["hover"]:E,o=P.mouseEnterDelay,s=o===void 0?0:o,d=P.mouseLeaveDelay,C=d===void 0?.1:d,g=P.overlayStyle,m=P.prefixCls,D=m===void 0?"rc-tooltip":m,T=P.children,h=P.onVisibleChange,c=P.afterVisibleChange,u=P.transitionName,a=P.animation,x=P.placement,y=x===void 0?"right":x,p=P.align,k=p===void 0?{}:p,F=P.destroyTooltipOnHide,U=F===void 0?!1:F,W=P.defaultVisible,_=P.getTooltipContainer,M=P.overlayInnerStyle,G=Object(L.a)(P,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),Y=Object(H.useRef)(null);Object(H.useImperativeHandle)(w,function(){return Y.current});var Z=Object(K.a)({},G);"visible"in P&&(Z.popupVisible=P.visible);var ne=function(){var fe=P.arrowContent,ie=fe===void 0?null:fe,he=P.overlay,$=P.id;return[H.createElement("div",{className:"".concat(D,"-arrow"),key:"arrow"},ie),H.createElement(N,{key:"content",prefixCls:D,id:$,overlay:he,overlayInnerStyle:M})]},be=!1,me=!1;if(typeof U=="boolean")be=U;else if(U&&Object(J.a)(U)==="object"){var pe=U.keepParent;be=pe===!0,me=pe===!1}return H.createElement(I.a,Object.assign({popupClassName:b,prefixCls:D,popup:ne,action:l,builtinPlacements:O.a,popupPlacement:y,ref:Y,popupAlign:k,getPopupContainer:_,onPopupVisibleChange:h,afterPopupVisibleChange:c,popupTransitionName:u,popupAnimation:a,defaultPopupVisible:W,destroyPopupOnHide:be,autoDestroy:me,mouseLeaveDelay:C,popupStyle:g,mouseEnterDelay:s},Z),T)},A=Object(H.forwardRef)(R),f=Ke.a=A},Ot1p:function(Ze,Ke,te){"use strict";var J=te("2qtc"),K=te("kLXV"),L=te("rAM+"),H=te("miYZ"),I=te("tsqr"),O=te("9og8"),B=te("tJVT"),N=te("jrin"),R=te("WmNS"),A=te.n(R),f=te("cDcd"),v=te.n(f),P=te("VrN/"),w=te.n(P),b=te("bdgK"),E=te("p77/"),l=te("Bd2K"),o=te("ELLl"),s=te("19Vz"),d=te("lZu9"),C=te("+NIl"),g=te("kSUc"),m=te("9Bee"),D=function(Me){var mt=Me.value,at=mt===void 0?"":mt,qe=Me.className,xt=Me.showTextOnly,Et=Me.showLines,Pt=Me.style,Lt=Pt===void 0?{}:Pt,pt=Object(f.useMemo)(function(){return""},[at]);return v.a.createElement(v.a.Fragment,null,v.a.createElement("div",{dangerouslySetInnerHTML:{__html:pt}}))},T=te("Q9mQ"),h=te("diRs"),c=te("0Owb"),u=te("dejd"),a=te("C+DQ"),x=te("D1Df"),y=te.n(x),p=te("1vsH"),k=te("m3rI"),F=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function U(Me){var mt=Me.onActionCallback,at=Me.title,qe=Me.icon,xt=Me.actionName,Et=Me.className,Pt=Et===void 0?"":Et,Lt=Me.children;function pt(){mt(xt)}return v.a.createElement("a",{title:at,className:Pt,onClick:pt},v.a.createElement("i",{className:"md-iconfont ".concat(qe)}),Lt)}var W=function(Me){var mt=Me.watch,at=Me.showNullButton,qe=Me.onActionCallback,xt=Me.fullScreen,Et=Me.insertTemp,Pt=Me.hidetoolBar,Lt=Me.uuid,pt=Me.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(p.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(p.G)("_educoder_session"),"&key=").concat(Lt,"&api=").concat(encodeURIComponent(k.a.PROXY_SERVER)));var or=[].concat(F,[{title:"".concat(mt?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(mt?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return v.a.createElement("ul",{className:"markdown-toolbar-container"},!Pt&&or.map(function(Kt,Ut){return v.a.createElement("li",{key:Ut},Kt.actionName?v.a.createElement(U,Object(c.a)({},Kt,{onActionCallback:qe})):v.a.createElement("span",{className:"v-line"}))}),at?v.a.createElement("li",null,v.a.createElement(U,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:qe},v.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Et&&v.a.createElement("li",null,v.a.createElement(U,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Et),onActionCallback:qe},v.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),v.a.createElement("li",null,v.a.createElement(h.a,{title:"\u6253\u5F00\u624B\u673A\u626B\u4E00\u626B",content:v.a.createElement("div",null,v.a.createElement(y.a,{size:150,fgColor:"#000",value:"https://test2.educoder.net/upload.html?_educoder_session_login=".concat(Object(p.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(p.G)("_educoder_session"),"&key=").concat(Lt,"&api=").concat(encodeURIComponent(k.a.PROXY_SERVER))}))},v.a.createElement("span",{className:"fill-tip",onMouseOver:function(){return pt(!0)}},"\u624B\u673A\u4E0A\u4F20\u6587\u4EF6"))),v.a.createElement("li",{className:"btn-full-screen"},v.a.createElement(U,{icon:"".concat(xt?"icon-shrink":"icon-enlarge"),title:xt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:qe})))},_=te("M8RZ"),M=te("+L6B"),G=te("2/Rp"),Y=te("y8nQ"),Z=te("Vl3Y"),ne=te("5NDa"),be=te("5rEg"),me={labelCol:{span:4},wrapperCol:{span:20}},pe=function(Me){var mt=Me.callback,at=Me.onCancel;function qe(xt){mt(xt)}return v.a.createElement(Z.a,Object(c.a)({},me,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:qe}),v.a.createElement(Z.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},v.a.createElement(be.a,null)),v.a.createElement(Z.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},v.a.createElement(be.a,null)),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:at},"\u53D6\u6D88")))},ue=te("7ahc"),fe=te("k1fw"),ie=te("HmJG"),he=te("BjJ7"),$=Z.a.useForm,ae={width:280,marginRight:10},ee={labelCol:{span:5},wrapperCol:{span:19}},Ee=function(Me){var mt=Me.callback,at=Me.onCancel,qe=$(),xt=Object(B.a)(qe,1),Et=xt[0],Pt=useRef();function Lt(Kt){mt(Object(fe.a)(Object(fe.a)({},Kt),{},{name:Pt.current}))}function pt(Kt,Ut){if(Kt.status===-1){I.b.error(Kt.message);return}Et.setFieldsValue({src:"/api/attachments/".concat(Kt.id),type:Ut.type})}function or(Kt){var Ut=Kt.target.files[0];Pt.current=Ut.name,ve(Ut,pt)}return v.a.createElement(Z.a,Object(c.a)({form:Et},ee,{className:"upload-image-panel",onFinish:Lt}),v.a.createElement(Z.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},v.a.createElement("div",{className:"flex-container"},v.a.createElement(Z.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},v.a.createElement(be.a,{style:ae})),v.a.createElement(Ce,{onFileChange:or}))),v.a.createElement(Z.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},v.a.createElement(be.a,{style:{width:264}})),v.a.createElement(Z.a.Item,{style:{textAlign:"right"}},v.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(G.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))};function Ce(Me){var mt=Me.onFileChange;return v.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",v.a.createElement("input",{type:"file",onChange:mt}))}function ve(Me,mt){if(!Me)throw new String("\u6CA1\u6709\u6587\u4EF6");var at=new FormData;at.append("editormd-image-file",Me),at.append("file_param_name","editormd-image-file"),at.append("byxhr","true");var qe=new window.XMLHttpRequest;qe.withCredentials=!0,qe.addEventListener("load",function(xt){mt(JSON.parse(xt.target.responseText),Me)},!1),qe.addEventListener("error",function(xt){console.error(xt)},!1),qe.open("POST","".concat(he.a,"/api/attachments.json")),qe.send(at)}var Se=te("giR+"),De=te("fyUT"),_e=te("7Kak"),ke=te("9yH6"),Re=ke.a.Group,Ae={margin:"0 8px"},Ue=function(Me){var mt=Me.callback,at=Me.onCancel;function qe(xt){mt(xt)}return v.a.createElement(Z.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:qe},v.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},v.a.createElement("span",{style:Ae},"\u5355\u5143\u683C\u6570\uFF1A"),v.a.createElement("span",{style:Ae},"\u884C\u6570"),v.a.createElement(Z.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},v.a.createElement(De.a,null)),v.a.createElement("span",{style:Ae},"\u5217\u6570"),v.a.createElement(Z.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},v.a.createElement(De.a,null))),v.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},v.a.createElement("span",{style:Ae},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),v.a.createElement(Z.a.Item,{name:"align"},v.a.createElement(Re,null,v.a.createElement(ke.a,{value:"default"},v.a.createElement("i",{className:"fa fa-align-justify"})),v.a.createElement(ke.a,{value:"left"},v.a.createElement("i",{className:"fa fa-align-left"})),v.a.createElement(ke.a,{value:"center"},v.a.createElement("i",{className:"fa fa-align-center"})),v.a.createElement(ke.a,{value:"right"},v.a.createElement("i",{className:"fa fa-align-right"}))))),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:at},"\u53D6\u6D88")))},Ye=te("ErOA"),Ge=te("7Cbv"),He="link",et="upload-image",Je="code-block",Xe="add-table",we="------------",rt={default:we,left:":".concat(we),center:":".concat(we,":"),right:"".concat(we,":")},$e=te("9VGf"),Le,Fe;function ge(){}var de=0,ce=1e4,Q="\u2581",q=`
|
|
**\u6A21\u677F\u6807\u9898**
|
|
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function re(Me){return/^\d+$/.test(Me)?"".concat(Me,"px"):Me}var se=navigator.platform.toUpperCase().indexOf("MAC")>=0,Te=se?"Cmd":"Ctrl",Oe=["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"],je=(Le={},Object(N.a)(Le,Te+"-B","bold"),Object(N.a)(Le,Te+"-I","italic"),Le),st=(Fe={},Object(N.a)(Fe,He,"\u6DFB\u52A0\u94FE\u63A5"),Object(N.a)(Fe,Je,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(N.a)(Fe,et,"\u6DFB\u52A0\u6587\u4EF6"),Object(N.a)(Fe,Xe,"\u6DFB\u52A0\u8868\u683C"),Fe),ht=Ke.a=function(Me){var mt=Me.defaultValue,at=mt===void 0?"":mt,qe=Me.onChange,xt=Me.width,Et=xt===void 0?"100%":xt,Pt=Me.height,Lt=Pt===void 0?400:Pt,pt=Me.miniToolbar,or=pt===void 0?!1:pt,Kt=Me.isFocus,Ut=Kt===void 0?!1:Kt,Tr=Me.watch,vr=Me.insertTemp,wi=Me.mode,pr=wi===void 0?"markdown":wi,vn=Me.id,Jr=vn===void 0?"markdown-editor-id":vn,_t=Me.showResizeBar,it=_t===void 0?!1:_t,Sr=Me.noStorage,Vn=Sr===void 0?!1:Sr,cr=Me.showNullButton,St=cr===void 0?!1:cr,wr=Me.hidetoolBar,Zr=wr===void 0?!1:wr,yn=Me.fullScreen,Ne=yn===void 0?!1:yn,dt=Me.onBlur,qr=Me.onCMBeforeChange,en=Me.onFullScreen,tn=Me.className,bn=tn===void 0?"":tn,Xn=Me.disablePaste,ft=Xn===void 0?!1:Xn,Ci=Me.placeholder,Ai=Ci===void 0?"":Ci,rn=Me.values,sr=rn===void 0?"":rn,Li=Object(f.useState)(null),Yn=Object(B.a)(Li,2),Be=Yn[0],$n=Yn[1],Di=Object(f.useState)(at),En=Object(B.a)(Di,2),nn=En[0],Fr=En[1],Ri=Object(f.useState)(Tr),Qn=Object(B.a)(Ri,2),Rr=Qn[0],Oi=Qn[1],Pi=Object(f.useState)(Ne),mr=Object(B.a)(Pi,2),Cr=mr[0],ki=mr[1],xn=Object(f.useState)(""),Nr=Object(B.a)(xn,2),Ur=Nr[0],Br=Nr[1],aa=Object(f.useState)(0),_i=Object(B.a)(aa,2),Or=_i[0],Tn=_i[1],oa=Object(f.useState)(Lt),Jn=Object(B.a)(oa,2),Zn=Jn[0],an=Jn[1],Sn=Object(f.useState)(!1),wn=Object(B.a)(Sn,2),sa=wn[0],Cn=wn[1],on=Object(f.useRef)(Object(Ge.a)()),Mi=Object(f.useRef)(!1),qn=Object(f.useRef)(),$t=Object(f.useRef)(),jr=Object(f.useRef)(),An=Object(f.useRef)(),Wr=Object(f.useRef)(),Ii=function(){var nt=Object(O.a)(A.a.mark(function ct(){var lt,vt;return A.a.wrap(function(Rt){for(;;)switch(Rt.prev=Rt.next){case 0:return Rt.next=2,Object(Ye.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:on.current}});case 2:vt=Rt.sent,vt!=null&&(lt=vt.attachments)!==null&<!==void 0&<.length&&(console.log("cm:",Be,$t),vt.attachments.map(function(yt){yt.content_type.indexOf("image")>-1?Be.replaceSelection(".concat(yt.content_type,")")):yt.content_type.indexOf("video")>-1?Be.replaceSelection('<video width="100%" controls src="'.concat(k.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):yt.content_type.indexOf("pdf")>-1?Be.replaceSelection('<a href="'.concat(k.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,'&disposition=inline" target="_blank">').concat(yt.name,"</a>")):Be.replaceSelection("[".concat(yt.name,"](").concat(k.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,")"))}));case 4:case"end":return Rt.stop()}},ct)}));return function(){return nt.apply(this,arguments)}}();Object(f.useEffect)(function(){Fr(sr),Be==null||Be.setValue(sr)},[sr]),Object(f.useEffect)(function(){en==null||en(Cr)},[Cr]),Object(f.useEffect)(function(){if($t.current){var nt=w.a.fromTextArea($t.current,{mode:pr,lineNumbers:!or,lineWrapping:!0,value:at,autoCloseTags:!0,autoCloseBrackets:!0});Ut&&nt.focus();function ct(lt,vt){if(ft){vt.preventDefault();return}var Tt=vt.clipboardData;if(Tt){var Rt=Tt.types.toString(),yt=Tt.items;if(Rt==="Files"||Tt.types.indexOf("Files")>-1){if(vt.preventDefault(),pr=="stex")return;try{var It,Wt=yt[1];((It=yt[0])===null||It===void 0?void 0:It.kind)==="file"&&(Wt=yt[0]);var bt=Wt.getAsFile(),kr=bt.name.split(".").pop();ve(bt,function(Ct){if(Ct.id){var Zt,Dt,gr;(bt==null||((Zt=bt.type)===null||Zt===void 0)?void 0:Zt.indexOf("image"))>-1?nt.replaceSelection(".concat(Ct.content_type,")")):(bt==null||((Dt=bt.type)===null||Dt===void 0)?void 0:Dt.indexOf("video"))>-1?nt.replaceSelection('<video width="100%" controls src="'.concat(k.a.API_SERVER,"/api/attachments/").concat(Ct.id,'"></video>')):(bt==null||((gr=bt.type)===null||gr===void 0)?void 0:gr.indexOf("pdf"))>-1?nt.replaceSelection('<a href="'.concat(k.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(bt.type,'&disposition=inline" target="_blank">').concat(bt.name,"</a>")):Oe.includes(kr)?nt.replaceSelection('<a href="'.concat(k.a.API_SERVER,"/api/attachments/").concat(Ct.id,'?type=office&disposition=inline" target="_blank">').concat(bt.name,"</a>")):nt.replaceSelection("[".concat(bt.name,"](").concat(k.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Ct.content_type,")"))}else(Ct==null?void 0:Ct.status)===401&&(document.location.href="/user/login")})}catch(Ct){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(lt,vt){jr.current.classList.remove("mouse-hover-md")}),nt.on("dragover",function(lt,vt){jr.current.classList.add("mouse-hover-md")}),nt.on("drop",function(lt,vt){jr.current.classList.add("mouse-hover-md");var Tt;if(Tt=vt.dataTransfer.files,Tt.length>0){vt.preventDefault(),vt.stopPropagation();for(var Rt=function(Wt){var bt=Tt[Wt],kr=bt.name.split(".").pop();ve(bt,function(Ct){if(Ct.id){var Zt,Dt,gr;(bt==null||((Zt=bt.type)===null||Zt===void 0)?void 0:Zt.indexOf("image"))>-1?nt.replaceSelection(".concat(Ct.content_type,")")):(bt==null||((Dt=bt.type)===null||Dt===void 0)?void 0:Dt.indexOf("video"))>-1?nt.replaceSelection('<video width="100%" controls src="'.concat(k.a.API_SERVER,"/api/attachments/").concat(Ct.id,'"></video>')):(bt==null||((gr=bt.type)===null||gr===void 0)?void 0:gr.indexOf("pdf"))>-1?nt.replaceSelection('<a href="'.concat(k.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(bt.type,'&disposition=inline" target="_blank">').concat(bt.name,"</a>")):Oe.includes(kr)?nt.replaceSelection('<a href="'.concat(k.a.API_SERVER,"/api/attachments/").concat(Ct.id,'?type=office&disposition=inline" target="_blank">').concat(bt.name,"</a>")):nt.replaceSelection("[".concat(bt.name,"](").concat(k.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Ct.content_type,")"))}else(Ct==null?void 0:Ct.status)===401&&(document.location.href="/user/login")})},yt=0;yt<Tt.length;yt++)Rt(yt)}}),$n(nt),function(){nt.off("paste",ct)}}},[]);var yr=Object(f.useCallback)(function(){if(jr.current)try{}catch(nt){console.log(nt,"---- to set md editor body height")}},[Zn,jr,Cr]);Object(f.useEffect)(function(){function nt(){var lt=new b.default(function(vt){var Tt=Object(L.a)(vt),Rt;try{for(Tt.s();!(Rt=Tt.n()).done;){var yt=Rt.value;(yt.target.offsetHeight>0||yt.target.offsetWidth>0)&&(yr(),Be.setSize("100%","100%"),Be.refresh())}}catch(It){Tt.e(It)}finally{Tt.f()}});return lt.observe($t.current.parentElement),lt}if(Be){var ct=nt();return function(){ct.unobserve($t.current.parentElement)}}},[Be,yr]),Object(f.useEffect)(function(){if(Be){for(var nt=[],ct=function(){var yt=vt[lt];Tt=Object(B.a)(yt,2);var It=Tt[0],Wt=Tt[1],bt=Object(N.a)({},It,function(){Ln(Wt)});nt.push(bt),Be.addKeyMap(bt)},lt=0,vt=Object.entries(je);lt<vt.length;lt++){var Tt;ct()}return qn.current=setInterval(function(){Mi.current&&Ii()},4e3),function(){clearInterval(qn.current);var Rt=Object(L.a)(nt),yt;try{for(Rt.s();!(yt=Rt.n()).done;){var It=yt.value;Be.removeKeyMap(It)}}catch(Wt){Rt.e(Wt)}finally{Rt.f()}}}},[Be]),Object(f.useEffect)(function(){Ne!==Cr&&ki(Ne)},[Ne]),Object($e.a)(function(){if(!Vn&&Or>0){var nt=new Date().getTime(),ct=window.sessionStorage.getItem(Jr);nt>=Or+ce&&(!ct||ct!==nn)&&(window.sessionStorage.setItem(Jr,nn),Cn(!0))}},ce),Object(f.useEffect)(function(){Oi(Tr)},[Be,Tr]),Object(f.useEffect)(function(){Be&&(Ut&&Be.focus())},[Be,Ut]),Object(f.useEffect)(function(){if(Rr&&Be){var nt=Be.getScrollerElement();function ct(lt){var vt=lt.target;if(Wr.current){var Tt=vt.scrollTop/vt.scrollHeight;Wr.current.scrollTop=Wr.current.scrollHeight*Tt}}return nt.addEventListener("scroll",ct),function(){nt.removeEventListener("scroll",ct)}}},[Be,Rr]),Object(f.useEffect)(function(){if(Be&&qr){function nt(ct,lt){qr(ct,lt)}return Be.on("beforeChange",nt),function(){Be.off("beforeChange",nt)}}},[Be,qr]),Object(f.useEffect)(function(){if(Be&&dt){function nt(){dt(Be.getValue())}return Be.on("blur",nt),function(){Be.off("blur",nt)}}},[Be,dt]),Object(f.useEffect)(function(){if(Be){function nt(ct){var lt=ct.getValue();Fr(lt),Tn(new Date().getTime()),ct.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),qe&&qe(lt)}return Be.on("change",nt),function(){Be.off("change",nt)}}},[Be,qe]),Object(f.useEffect)(function(){Be&&(at==null?(Be.setValue(""),Fr("")):at!==Be.getValue()&&(Be.setValue(at),Fr(at),Be.setCursor(Be.lineCount(),0)))},[Be,at]);var Ln=Object(f.useCallback)(function(nt){var ct=Be.getCursor(),lt=Be.getSelection(),vt=lt.split(`
|
|
`);switch(nt){case"bold":return Be.replaceSelection("**"+lt+"**"),lt===""&&Be.setCursor(ct.line,ct.ch+2),Be.focus();case"italic":return Be.replaceSelection("*"+lt+"*"),lt===""&&Be.setCursor(ct.line,ct.ch+1),Be.focus();case"code":return Be.replaceSelection("`"+lt+"`"),lt===""&&Be.setCursor(ct.line,ct.ch+1),Be.focus();case"inline-latex":return Be.replaceSelection("`$$"+lt+"$$`"),lt===""&&Be.setCursor(ct.line,ct.ch+3),Be.focus();case"latex":return Be.replaceSelection("```latex\n"+lt+"\n```"),Be.setCursor(ct.line+1,lt.length+1),Be.focus();case"line-break":return Be.replaceSelection(`<br/>
|
|
`),Be.focus();case"list-ul":return lt===""?Be.replaceSelection("- "+lt):Be.replaceSelection(vt.map(function(Tt){return Tt===""?"":"- ".concat(Tt)}).join(`
|
|
`)),Be.focus();case"list-ol":return lt===""?Be.replaceSelection("1. "+lt):Be.replaceSelection(vt.map(function(Tt,Rt){return Tt===""?"":"".concat(Rt+1,". ").concat(Tt)}).join(`
|
|
`)),Be.focus();case"add-null-ch":return lt===""&&Be.setCursor(ct.line,ct.ch+1),Be.replaceSelection(Q),Be.focus();case"inster-template-1":return lt===""&&Be.setCursor(ct.line,ct.ch),Be.replaceSelection(q),Be.focus();case"eraser":return Be.setValue(""),Be.focus();case"trigger-watch":return Oi(!Rr),Be.focus();case"trigger-full-screen":return ki(!Cr),Be.focus();case He:Br(He);return;case Je:Br(Je);return;case et:Br(et);return;case Xe:Br(Xe);return;default:throw new Error}},[Be,Rr,Cr]),lr=Object(f.useCallback)(function(nt){Br("");switch(Ur){case He:var ct=nt.title,lt=nt.link;return Be.replaceSelection("[".concat(ct,"](").concat(lt,")")),Be.focus();case Je:var vt=nt.language,Tt=nt.content;return Be.replaceSelection(["```"+vt,Tt,"```"].join(`
|
|
`)),Be.focus();case et:var Rt=nt.src,yt=nt.alt;return yt?Be.replaceSelection(".concat(Rt,' "').concat(yt,'" )')):Be.replaceSelection("")),Be.focus();case Xe:for(var It=nt.row,Wt=nt.col,bt=nt.align,kr=`
|
|
`,Ct=0;Ct<It;Ct++){for(var Zt=[],Dt=[],gr=0;gr<Wt;gr++)Ct===1&&Dt.push(rt[bt]),Zt.push(" ");Ct===1&&(kr+="| ".concat(Dt.join(" | "),` |
|
|
`)),kr+="| ".concat(Zt.join(Wt===1?"":" | "),` |
|
|
`)}return Be.replaceSelection(kr+`
|
|
`),Be.focus();default:throw new Error}},[Be,Ur]),Dn=Object(f.useMemo)(function(){switch(Ur){case He:return v.a.createElement(pe,{callback:lr,onCancel:Pr});case Je:return v.a.createElement(ue.b,{callback:lr,onCancel:Pr});case et:return v.a.createElement(Ee,{callback:lr,onCancel:Pr});case Xe:return v.a.createElement(Ue,{callback:lr,onCancel:Pr});default:return null}},[Ur]);function Pr(){Br("")}Object(f.useEffect)(function(){if(An.current){var nt=An.current,ct=!1,lt=0;function vt(yt){ct=!0,lt=yt.pageY}function Tt(){ct=!1}function Rt(yt){if(ct){var It=yt.pageY-lt;It<0&&(It=0),It>300&&(It=300);var Wt=Lt+It+"px";an(Wt)}}return nt.addEventListener("mousedown",vt),document.addEventListener("mousemove",Rt),document.addEventListener("mouseup",Tt),function(){nt.removeEventListener("mousedown",vt),document.removeEventListener("mousemove",Rt),document.removeEventListener("mouseup",Tt)}}},[Be,An]),Object(f.useEffect)(function(){an(Lt)},[Lt]);var Hr=re(Et),la=re(Zn),ua={width:Hr,height:la},$a=Object(f.useMemo)(function(){if(Or){var nt=new Date(Or),ct=nt.getHours(),lt=nt.getMinutes(),vt=nt.getSeconds();return ct=ct<10?"0"+ct:ct,lt=lt<10?"0"+lt:lt,vt=vt<10?"0"+vt:vt,"".concat(ct,":").concat(lt,":").concat(vt)}return 0},[Or]);function Qa(){window.sessionStorage.removeItem(Jr),Cn(!1),Tn(0)}function da(){Cn(!1),Tn(0),Be.setValue(window.sessionStorage.getItem(Jr))}function Fi(nt,ct){var lt=Be.getValue();lt=lt.replace(nt,ct),Fr(lt),Be==null||Be.setValue(lt)}return v.a.createElement(f.Fragment,null,v.a.createElement("div",{className:"markdown-editor-wrapper",ref:jr},v.a.createElement("div",{className:"markdown-editor-container ".concat(bn," ").concat(Rr?"on-preview":""," ").concat(or?"mini":""," ").concat(Cr?"full-screen":""),style:ua},v.a.createElement(W,{insertTemp:vr,watch:Rr,fullScreen:Cr,showNullButton:St,onActionCallback:Ln,hidetoolBar:Zr,uuid:on.current,setOpenPhones:function(){Mi.current=!0}}),v.a.createElement("div",{className:"markdown-editor-body"},v.a.createElement("div",{className:"codemirror-container"},v.a.createElement("textarea",{ref:$t,placeholder:Ai})),Rr?v.a.createElement("div",{ref:Wr,className:"preview-container"},pr==="stex"&&v.a.createElement(D,{value:nn}),pr!=="stex"&&v.a.createElement(m.a,{edit:!0,value:nn,replaces:Fi})):null))),it?v.a.createElement("a",{ref:An,className:"editor-resize"}):null,v.a.createElement(_.a,null,st[Ur]?v.a.createElement(K.a,{centered:!0,title:st[Ur],visible:!0,onCancel:Pr,footer:null,className:"markdown-popup-form"},Dn):null))}},SJMd:function(Ze,Ke){/**
|
|
* @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 te,J,K,L=!1,H,I;window.PR_SHOULD_USE_CONTINUATION=!0;var O,B;(function(){var N=window,R=["break,continue,do,else,for,if,return,while"],A=[R,"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"],f=[A,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],v=[f,"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"],P=[f,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],w=[f,"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"],b="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=[f,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],l="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=[R,"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=[R,"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=[R,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],C=[v,w,P,E,l,o,s,d],g=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,m="str",D="kwd",T="com",h="typ",c="lit",u="pun",a="pln",x="tag",y="dec",p="src",k="atn",F="atv",U="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function _(ve){for(var Se=0,De=!1,_e=!1,ke=0,Re=ve.length;ke<Re;++ke){var Ae=ve[ke];if(Ae.ignoreCase)_e=!0;else if(/[a-z]/i.test(Ae.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){De=!0,_e=!1;break}}var Ue={b:8,t:9,n:10,v:11,f:12,r:13};function Ye(Xe){var we=Xe.charCodeAt(0);if(we!==92)return we;var rt=Xe.charAt(1);return we=Ue[rt],we||("0"<=rt&&rt<="7"?parseInt(Xe.substring(1),8):rt==="u"||rt==="x"?parseInt(Xe.substring(2),16):Xe.charCodeAt(1))}function Ge(Xe){if(Xe<32)return(Xe<16?"\\x0":"\\x")+Xe.toString(16);var we=String.fromCharCode(Xe);return we==="\\"||we==="-"||we==="]"||we==="^"?"\\"+we:we}function He(Xe){var we=Xe.substring(1,Xe.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")),rt=[],$e=we[0]==="^",Le=["["];$e&&Le.push("^");for(var Fe=$e?1:0,ge=we.length;Fe<ge;++Fe){var de=we[Fe];if(/\\[bdsw]/i.test(de))Le.push(de);else{var ce=Ye(de),Q;Fe+2<ge&&we[Fe+1]==="-"?(Q=Ye(we[Fe+2]),Fe+=2):Q=ce,rt.push([ce,Q]),Q<65||ce>122||(Q<65||ce>90||rt.push([Math.max(65,ce)|32,Math.min(Q,90)|32]),Q<97||ce>122||rt.push([Math.max(97,ce)&~32,Math.min(Q,122)&~32]))}}rt.sort(function(Te,Oe){return Te[0]-Oe[0]||Oe[1]-Te[1]});for(var q=[],re=[],Fe=0;Fe<rt.length;++Fe){var se=rt[Fe];se[0]<=re[1]+1?re[1]=Math.max(re[1],se[1]):q.push(re=se)}for(var Fe=0;Fe<q.length;++Fe){var se=q[Fe];Le.push(Ge(se[0])),se[1]>se[0]&&(se[1]+1>se[0]&&Le.push("-"),Le.push(Ge(se[1])))}return Le.push("]"),Le.join("")}function et(Xe){for(var we=Xe.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")),rt=we.length,$e=[],Le=0,Fe=0;Le<rt;++Le){var ge=we[Le];if(ge==="(")++Fe;else if(ge.charAt(0)==="\\"){var de=+ge.substring(1);de&&(de<=Fe?$e[de]=-1:we[Le]=Ge(de))}}for(var Le=1;Le<$e.length;++Le)$e[Le]===-1&&($e[Le]=++Se);for(var Le=0,Fe=0;Le<rt;++Le){var ge=we[Le];if(ge==="(")++Fe,$e[Fe]||(we[Le]="(?:");else if(ge.charAt(0)==="\\"){var de=+ge.substring(1);de&&de<=Fe&&(we[Le]="\\"+$e[de])}}for(var Le=0;Le<rt;++Le)we[Le]==="^"&&we[Le+1]!=="^"&&(we[Le]="");if(Xe.ignoreCase&&De)for(var Le=0;Le<rt;++Le){var ge=we[Le],ce=ge.charAt(0);ge.length>=2&&ce==="["?we[Le]=He(ge):ce!=="\\"&&(we[Le]=ge.replace(/[a-zA-Z]/g,function(re){var se=re.charCodeAt(0);return"["+String.fromCharCode(se&~32,se|32)+"]"}))}return we.join("")}for(var Je=[],ke=0,Re=ve.length;ke<Re;++ke){var Ae=ve[ke];if(Ae.global||Ae.multiline)throw new Error(""+Ae);Je.push("(?:"+et(Ae)+")")}return new RegExp(Je.join("|"),_e?"gi":"g")}function M(ve,Se){var De=/(?:^|\s)nocode(?:\s|$)/,_e=[],ke=0,Re=[],Ae=0;function Ue(Ye){var Ge=Ye.nodeType;if(Ge==1){if(De.test(Ye.className))return;for(var He=Ye.firstChild;He;He=He.nextSibling)Ue(He);var et=Ye.nodeName.toLowerCase();(et==="br"||et==="li")&&(_e[Ae]=`
|
|
`,Re[Ae<<1]=ke++,Re[Ae++<<1|1]=Ye)}else if(Ge==3||Ge==4){var Je=Ye.nodeValue;Je.length&&(Se?Je=Je.replace(/\r\n?/g,`
|
|
`):Je=Je.replace(/[ \t\r\n]+/g," "),_e[Ae]=Je,Re[Ae<<1]=ke,ke+=Je.length,Re[Ae++<<1|1]=Ye)}}return Ue(ve),{sourceCode:_e.join("").replace(/\n$/,""),spans:Re}}function G(ve,Se,De,_e,ke){if(!De)return;var Re={sourceNode:ve,pre:1,langExtension:null,numberLines:null,sourceCode:De,spans:null,basePos:Se,decorations:null};_e(Re),ke.push.apply(ke,Re.decorations)}var Y=/\S/;function Z(ve){for(var Se=void 0,De=ve.firstChild;De;De=De.nextSibling){var _e=De.nodeType;Se=_e===1?Se?ve:De:_e===3&&Y.test(De.nodeValue)?ve:Se}return Se===ve?void 0:Se}function ne(ve,Se){var De={},_e;(function(){for(var Ae=ve.concat(Se),Ue=[],Ye={},Ge=0,He=Ae.length;Ge<He;++Ge){var et=Ae[Ge],Je=et[3];if(Je)for(var Xe=Je.length;--Xe>=0;)De[Je.charAt(Xe)]=et;var we=et[1],rt=""+we;Ye.hasOwnProperty(rt)||(Ue.push(we),Ye[rt]=null)}Ue.push(/[\0-\uffff]/),_e=_(Ue)})();var ke=Se.length,Re=function(Ae){for(var Ue=Ae.sourceCode,Ye=Ae.basePos,Ge=Ae.sourceNode,He=[Ye,a],et=0,Je=Ue.match(_e)||[],Xe={},we=0,rt=Je.length;we<rt;++we){var $e=Je[we],Le=Xe[$e],Fe=void 0,ge;if(typeof Le=="string")ge=!1;else{var de=De[$e.charAt(0)];if(de)Fe=$e.match(de[1]),Le=de[0];else{for(var ce=0;ce<ke;++ce)if(de=Se[ce],Fe=$e.match(de[1]),Fe){Le=de[0];break}Fe||(Le=a)}ge=Le.length>=5&&Le.substring(0,5)==="lang-",ge&&!(Fe&&typeof Fe[1]=="string")&&(ge=!1,Le=p),ge||(Xe[$e]=Le)}var Q=et;if(et+=$e.length,!ge)He.push(Ye+Q,Le);else{var q=Fe[1],re=$e.indexOf(q),se=re+q.length;Fe[2]&&(se=$e.length-Fe[2].length,re=se-q.length);var Te=Le.substring(5);G(Ge,Ye+Q,$e.substring(0,re),Re,He),G(Ge,Ye+Q+re,q,he(Te,q),He),G(Ge,Ye+Q+se,$e.substring(se),Re,He)}}Ae.decorations=He};return Re}function be(ve){var Se=[],De=[];ve.tripleQuotedStrings?Se.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ve.multiLineStrings?Se.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Se.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ve.verbatimStrings&&De.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var _e=ve.hashComments;_e&&(ve.cStyleComments?(_e>1?Se.push([T,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Se.push([T,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),De.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Se.push([T,/^#[^\r\n]*/,null,"#"])),ve.cStyleComments&&(De.push([T,/^\/\/[^\r\n]*/,null]),De.push([T,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ke=ve.regexLiterals;if(ke){var Re=ke>1?"":`
|
|
\r`,Ae=Re?".":"[\\S\\s]",Ue="/(?=[^/*"+Re+"])(?:[^/\\x5B\\x5C"+Re+"]|\\x5C"+Ae+"|\\x5B(?:[^\\x5C\\x5D"+Re+"]|\\x5C"+Ae+")*(?:\\x5D|$))+/";De.push(["lang-regex",RegExp("^"+W+"("+Ue+")")])}var Ye=ve.types;Ye&&De.push([h,Ye]);var Ge=(""+ve.keywords).replace(/^ | $/g,"");Ge.length&&De.push([D,new RegExp("^(?:"+Ge.replace(/[\s,]+/g,"|")+")\\b"),null]),Se.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var He="^.[^\\s\\w.$@'\"`/\\\\]*";return ve.regexLiterals&&(He+="(?!s*/)"),De.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[h,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[u,new RegExp(He),null]),ne(Se,De)}var me=be({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function pe(ve,Se,De){for(var _e=/(?:^|\s)nocode(?:\s|$)/,ke=/\r\n?|\n/,Re=ve.ownerDocument,Ae=Re.createElement("li");ve.firstChild;)Ae.appendChild(ve.firstChild);var Ue=[Ae];function Ye(we){var rt=we.nodeType;if(rt==1&&!_e.test(we.className))if(we.nodeName==="br")Ge(we),we.parentNode&&we.parentNode.removeChild(we);else for(var $e=we.firstChild;$e;$e=$e.nextSibling)Ye($e);else if((rt==3||rt==4)&&De){var Le=we.nodeValue,Fe=Le.match(ke);if(Fe){var ge=Le.substring(0,Fe.index);we.nodeValue=ge;var de=Le.substring(Fe.index+Fe[0].length);if(de){var ce=we.parentNode;ce.insertBefore(Re.createTextNode(de),we.nextSibling)}Ge(we),ge||we.parentNode.removeChild(we)}}}function Ge(we){for(;!we.nextSibling;)if(we=we.parentNode,!we)return;function rt(Fe,ge){var de=ge?Fe.cloneNode(!1):Fe,ce=Fe.parentNode;if(ce){var Q=rt(ce,1),q=Fe.nextSibling;Q.appendChild(de);for(var re=q;re;re=q)q=re.nextSibling,Q.appendChild(re)}return de}for(var $e=rt(we.nextSibling,0),Le;(Le=$e.parentNode)&&Le.nodeType===1;)$e=Le;Ue.push($e)}for(var He=0;He<Ue.length;++He)Ye(Ue[He]);Se===(Se|0)&&Ue[0].setAttribute("value",Se);var et=Re.createElement("ol");et.className="linenums";for(var Je=Math.max(0,Se-1|0)||0,He=0,Xe=Ue.length;He<Xe;++He)Ae=Ue[He],Ae.className="L"+(He+Je)%10,Ae.firstChild||Ae.appendChild(Re.createTextNode("\xA0")),et.appendChild(Ae);ve.appendChild(et)}function ue(ve){var Se=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Se=Se&&+Se[1]<=8;var De=/\n/g,_e=ve.sourceCode,ke=_e.length,Re=0,Ae=ve.spans,Ue=Ae.length,Ye=0,Ge=ve.decorations,He=Ge.length,et=0;Ge[He]=ke;var Je,Xe;for(Xe=Je=0;Xe<He;)Ge[Xe]!==Ge[Xe+2]?(Ge[Je++]=Ge[Xe++],Ge[Je++]=Ge[Xe++]):Xe+=2;for(He=Je,Xe=Je=0;Xe<He;){for(var we=Ge[Xe],rt=Ge[Xe+1],$e=Xe+2;$e+2<=He&&Ge[$e+1]===rt;)$e+=2;Ge[Je++]=we,Ge[Je++]=rt,Xe=$e}He=Ge.length=Je;var Le=ve.sourceNode,Fe="";Le&&(Fe=Le.style.display,Le.style.display="none");try{for(var ge=null;Ye<Ue;){var de=Ae[Ye],ce=Ae[Ye+2]||ke,Q=Ge[et+2]||ke,$e=Math.min(ce,Q),q=Ae[Ye+1],re;if(q.nodeType!==1&&(re=_e.substring(Re,$e))){Se&&(re=re.replace(De,"\r")),q.nodeValue=re;var se=q.ownerDocument,Te=se.createElement("span");Te.className=Ge[et+1];var Oe=q.parentNode;Oe.replaceChild(Te,q),Te.appendChild(q),Re<ce&&(Ae[Ye+1]=q=se.createTextNode(_e.substring($e,ce)),Oe.insertBefore(q,Te.nextSibling))}Re=$e,Re>=ce&&(Ye+=2),Re>=Q&&(et+=2)}}finally{Le&&(Le.style.display=Fe)}}var fe={};function ie(ve,Se){for(var De=Se.length;--De>=0;){var _e=Se[De];fe.hasOwnProperty(_e)?N.console&&console.warn("cannot override language handler %s",_e):fe[_e]=ve}}function he(ve,Se){return ve&&fe.hasOwnProperty(ve)||(ve=/^\s*</.test(Se)?"default-markup":"default-code"),fe[ve]}ie(me,["default-code"]),ie(ne([],[[a,/^[^<?]+/],[y,/^<!\w[^>]*(?:>|$)/],[T,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[u,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ie(ne([[a,/^[\s]+/,null,` \r
|
|
`],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[x,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[k,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[u,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ie(ne([],[[F,/^[\s\S]+/]]),["uq.val"]),ie(be({keywords:v,hashComments:!0,cStyleComments:!0,types:g}),["c","cc","cpp","cxx","cyc","m"]),ie(be({keywords:"null,true,false"}),["json"]),ie(be({keywords:w,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:g}),["cs"]),ie(be({keywords:P,cStyleComments:!0}),["java"]),ie(be({keywords:d,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ie(be({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ie(be({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ie(be({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ie(be({keywords:E,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ie(be({keywords:b,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ie(ne([],[[m,/^[\s\S]+/]]),["regex"]);function $(ve){var Se=ve.langExtension;try{var De=M(ve.sourceNode,ve.pre),_e=De.sourceCode;ve.sourceCode=_e,ve.spans=De.spans,ve.basePos=0,he(Se,_e)(ve),ue(ve)}catch(ke){N.console&&console.log(ke&&ke.stack||ke)}}function ae(ve,Se,De){var _e=De||!1,ke=Se||null,Re=document.createElement("div");Re.innerHTML="<pre>"+ve+"</pre>",Re=Re.firstChild,_e&&pe(Re,_e,!0);var Ae={langExtension:ke,numberLines:_e,sourceNode:Re,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return $(Ae),Re.innerHTML}function ee(ve,Se){var De=Se||document.body,_e=De.ownerDocument||document;function ke(de){return De.getElementsByTagName(de)}for(var Re=[ke("pre"),ke("code"),ke("xmp")],Ae=[],Ue=0;Ue<Re.length;++Ue)for(var Ye=0,Ge=Re[Ue].length;Ye<Ge;++Ye)Ae.push(Re[Ue][Ye]);Re=null;var He=Date;He.now||(He={now:function(){return+new Date}});var et=0,Je=/\blang(?:uage)?-([\w.]+)(?!\S)/,Xe=/\bprettyprint\b/,we=/\bprettyprinted\b/,rt=/pre|xmp/i,$e=/^code$/i,Le=/^(?:pre|code|xmp)$/i,Fe={};function ge(){for(var de=N.PR_SHOULD_USE_CONTINUATION?He.now()+250:Infinity;et<Ae.length&&He.now()<de;et++){for(var ce=Ae[et],Q=Fe,q=ce;q=q.previousSibling;){var re=q.nodeType,se=(re===7||re===8)&&q.nodeValue;if(se?!/^\??prettify\b/.test(se):re!==3||/\S/.test(q.nodeValue))break;if(se){Q={},se.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Lt,pt,or){Q[pt]=or});break}}var Te=ce.className;if((Q!==Fe||Xe.test(Te))&&!we.test(Te)){for(var Oe=!1,je=ce.parentNode;je;je=je.parentNode){var st=je.tagName;if(Le.test(st)&&je.className&&Xe.test(je.className)){Oe=!0;break}}if(!Oe){ce.className+=" prettyprinted";var ht=Q.lang;if(!ht){ht=Te.match(Je);var Me;!ht&&(Me=Z(ce))&&$e.test(Me.tagName)&&(ht=Me.className.match(Je)),ht&&(ht=ht[1])}var mt;if(rt.test(ce.tagName))mt=1;else{var at=ce.currentStyle,qe=_e.defaultView,xt=at?at.whiteSpace:qe&&qe.getComputedStyle?qe.getComputedStyle(ce,null).getPropertyValue("white-space"):0;mt=xt&&xt.substring(0,3)==="pre"}var Et=Q.linenums;(Et=Et==="true"||+Et)||(Et=Te.match(/\blinenums\b(?::(\d+))?/),Et=Et?Et[1]&&Et[1].length?+Et[1]:!0:!1),Et&&pe(ce,Et,mt);var Pt={langExtension:ht,sourceNode:ce,numberLines:Et,pre:mt,sourceCode:null,basePos:null,spans:null,decorations:null};$(Pt)}}}et<Ae.length?N.setTimeout(ge,250):typeof ve=="function"&&ve()}ge()}var Ee=N.PR={createSimpleLexer:ne,registerLangHandler:ie,sourceDecorator:be,PR_ATTRIB_NAME:k,PR_ATTRIB_VALUE:F,PR_COMMENT:T,PR_DECLARATION:y,PR_KEYWORD:D,PR_LITERAL:c,PR_NOCODE:U,PR_PLAIN:a,PR_PUNCTUATION:u,PR_SOURCE:p,PR_STRING:m,PR_TAG:x,PR_TYPE:h,prettyPrintOne:L?N.prettyPrintOne=ae:O=ae,prettyPrint:B=L?N.prettyPrint=ee:B=ee},Ce=N.define;typeof Ce=="function"&&Ce.amd&&Ce("google-code-prettify",[],function(){return Ee})})()},"VrN/":function(Ze,Ke,te){(function(J,K){Ze.exports=K()})(this,function(){"use strict";var J=navigator.userAgent,K=navigator.platform,L=/gecko\/\d/i.test(J),H=/MSIE \d/.test(J),I=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(J),O=/Edge\/(\d+)/.exec(J),B=H||I||O,N=B&&(H?document.documentMode||6:+(O||I)[1]),R=!O&&/WebKit\//.test(J),A=R&&/Qt\/\d+\.\d+/.test(J),f=!O&&/Chrome\//.test(J),v=/Opera\//.test(J),P=/Apple Computer/.test(navigator.vendor),w=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(J),b=/PhantomJS/.test(J),E=!O&&/AppleWebKit/.test(J)&&/Mobile\/\w+/.test(J),l=/Android/.test(J),o=E||l||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(J),s=E||/Mac/.test(K),d=/\bCrOS\b/.test(J),C=/win/i.test(K),g=v&&J.match(/Version\/(\d*\.\d*)/);g&&(g=Number(g[1])),g&&g>=15&&(v=!1,R=!0);var m=s&&(A||v&&(g==null||g<12.11)),D=L||B&&N>=9;function T(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var n=e.className,r=T(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 u(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 S=0;S<t.length;++S)i.appendChild(t[S]);return i}function x(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var y;document.createRange?y=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:y=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 p(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 k(){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;T(t).test(n)||(e.className+=(n?" ":"")+t)}function U(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!T(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 _(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function M(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 G(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var S=r||0,j=i||0;;){var z=e.indexOf(" ",S);if(z<0||z>=t)return j+(t-S);j+=z-S,j+=n-j%n,S=z+1}}var Y=function(){this.id=null,this.f=null,this.time=0,this.handler=_(this.onTimeout,this)};Y.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Y.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 Z(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var ne=50,be={toString:function(){return"CodeMirror.Pass"}},me={scroll:!1},pe={origin:"*mouse"},ue={origin:"+move"};function fe(e,t,n){for(var r=0,i=0;;){var S=e.indexOf(" ",r);S==-1&&(S=e.length);var j=S-r;if(S==e.length||i+j>=t)return r+Math.min(j,t-i);if(i+=S-r,i+=n-i%n,r=S+1,i>=t)return r}}var ie=[""];function he(e){for(;ie.length<=e;)ie.push($(ie)+" ");return ie[e]}function $(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 ee(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function Ee(){}function Ce(e,t){var n;return Object.create?n=Object.create(e):(Ee.prototype=e,n=new Ee),t&&M(t,n),n}var ve=/[\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()||ve.test(e))}function De(e,t){return t?t.source.indexOf("\\w")>-1&&Se(e)?!0:t.test(e):Se(e)}function _e(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ke=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Re(e){return e.charCodeAt(0)>=768&&ke.test(e)}function Ae(e,t,n){for(;(n<0?t>0:t<e.length)&&Re(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,S=r<0?Math.ceil(i):Math.floor(i);if(S==t)return e(S)?t:n;e(S)?n=S:t=S+r}}function Ye(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,S=0;S<e.length;++S){var j=e[S];(j.from<n&&j.to>t||t==n&&j.to==t)&&(r(Math.max(j.from,t),Math.min(j.to,n),j.level==1?"rtl":"ltr",S),i=!0)}i||r(t,n,"ltr")}var Ge=null;function He(e,t,n){var r;Ge=null;for(var i=0;i<e.length;++i){var S=e[i];if(S.from<t&&S.to>t)return i;S.to==t&&(S.from!=S.to&&n=="before"?r=i:Ge=i),S.from==t&&(S.from!=S.to&&n!="before"?r=i:Ge=i)}return r!=null?r:Ge}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]/,S=/[LRr]/,j=/[Lb1n]/,z=/[1n]/;function V(X,oe,le){this.level=X,this.from=oe,this.to=le}return function(X,oe){var le=oe=="ltr"?"L":"R";if(X.length==0||oe=="ltr"&&!r.test(X))return!1;for(var xe=X.length,ye=[],Pe=0;Pe<xe;++Pe)ye.push(n(X.charCodeAt(Pe)));for(var Ie=0,We=le;Ie<xe;++Ie){var ze=ye[Ie];ze=="m"?ye[Ie]=We:We=ze}for(var Qe=0,Ve=le;Qe<xe;++Qe){var tt=ye[Qe];tt=="1"&&Ve=="r"?ye[Qe]="n":S.test(tt)&&(Ve=tt,tt=="r"&&(ye[Qe]="R"))}for(var ut=1,ot=ye[0];ut<xe-1;++ut){var gt=ye[ut];gt=="+"&&ot=="1"&&ye[ut+1]=="1"?ye[ut]="1":gt==","&&ot==ye[ut+1]&&(ot=="1"||ot=="n")&&(ye[ut]=ot),ot=gt}for(var Ot=0;Ot<xe;++Ot){var Vt=ye[Ot];if(Vt==",")ye[Ot]="N";else if(Vt=="%"){var Mt=void 0;for(Mt=Ot+1;Mt<xe&&ye[Mt]=="%";++Mt);for(var dr=Ot&&ye[Ot-1]=="!"||Mt<xe&&ye[Mt]=="1"?"1":"N",nr=Ot;nr<Mt;++nr)ye[nr]=dr;Ot=Mt-1}}for(var Bt=0,ir=le;Bt<xe;++Bt){var Yt=ye[Bt];ir=="L"&&Yt=="1"?ye[Bt]="L":S.test(Yt)&&(ir=Yt)}for(var Ht=0;Ht<xe;++Ht)if(i.test(ye[Ht])){var jt=void 0;for(jt=Ht+1;jt<xe&&i.test(ye[jt]);++jt);for(var Ft=(Ht?ye[Ht-1]:le)=="L",ar=(jt<xe?ye[jt]:le)=="L",Gn=Ft==ar?Ft?"L":"R":le,Qr=Ht;Qr<jt;++Qr)ye[Qr]=Gn;Ht=jt-1}for(var Jt=[],Dr,Xt=0;Xt<xe;)if(j.test(ye[Xt])){var Xa=Xt;for(++Xt;Xt<xe&&j.test(ye[Xt]);++Xt);Jt.push(new V(0,Xa,Xt))}else{var Ir=Xt,mn=Jt.length,gn=oe=="rtl"?1:0;for(++Xt;Xt<xe&&ye[Xt]!="L";++Xt);for(var er=Ir;er<Xt;)if(z.test(ye[er])){Ir<er&&(Jt.splice(mn,0,new V(1,Ir,er)),mn+=gn);var zn=er;for(++er;er<Xt&&z.test(ye[er]);++er);Jt.splice(mn,0,new V(2,zn,er)),mn+=gn,Ir=er}else++er;Ir<Xt&&Jt.splice(mn,0,new V(1,Ir,Xt))}return oe=="ltr"&&(Jt[0].level==1&&(Dr=X.match(/^\s+/))&&(Jt[0].from=Dr[0].length,Jt.unshift(new V(0,0,Dr[0].length))),$(Jt).level==1&&(Dr=X.match(/\s+$/))&&($(Jt).to-=Dr[0].length,Jt.push(new V(0,xe-Dr[0].length,xe)))),oe=="rtl"?Jt.reverse():Jt}}();function Je(e,t){var n=e.order;return n==null&&(n=e.order=et(e.text,t)),n}var Xe=[],we=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]||Xe).concat(n)}};function rt(e,t){return e._handlers&&e._handlers[t]||Xe}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 S=Z(i,n);S>-1&&(r[t]=i.slice(0,S).concat(i.slice(S+1)))}}}function Le(e,t){var n=rt(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}}),Le(e,n||t.type,e,t),re(t)||t.codemirrorIgnore}function ge(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)Z(n,t[r])==-1&&n.push(t[r])}function de(e,t){return rt(e,t).length>0}function ce(e){e.prototype.on=function(t,n){we(this,t,n)},e.prototype.off=function(t,n){$e(this,t,n)}}function Q(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function q(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function re(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function se(e){Q(e),q(e)}function Te(e){return e.target||e.srcElement}function Oe(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 je=function(){if(B&&N<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),st;function ht(e){if(st==null){var t=a("span","\u200B");u(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(st=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&N<8))}var n=st?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var Me;function mt(e){if(Me!=null)return Me;var t=u(e,document.createTextNode("A\u062EA")),n=y(t,0,1).getBoundingClientRect(),r=y(t,1,2).getBoundingClientRect();return c(e),!n||n.left==n.right?!1:Me=r.right-n.right<3}var at=`
|
|
|
|
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 S=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),j=S.indexOf("\r");j!=-1?(n.push(S.slice(0,j)),t+=j+1):(n.push(S),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},qe=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},xt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Et=null;function Pt(e){if(Et!=null)return Et;var t=u(e,a("span","x")),n=t.getBoundingClientRect(),r=y(t,0,1).getBoundingClientRect();return Et=Math.abs(n.left-r.left)>1}var Lt={},pt={};function or(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Lt[e]=t}function Kt(e,t){pt[e]=t}function Ut(e){if(typeof e=="string"&&pt.hasOwnProperty(e))e=pt[e];else if(e&&typeof e.name=="string"&&pt.hasOwnProperty(e.name)){var t=pt[e.name];typeof t=="string"&&(t={name:t}),e=Ce(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ut("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ut("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Tr(e,t){t=Ut(t);var n=Lt[t.name];if(!n)return Tr(e,"text/plain");var r=n(e,t);if(vr.hasOwnProperty(t.name)){var i=vr[t.name];for(var S in i){if(!i.hasOwnProperty(S))continue;r.hasOwnProperty(S)&&(r["_"+S]=r[S]),r[S]=i[S]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var j in t.modeProps)r[j]=t.modeProps[j];return r}var vr={};function wi(e,t){var n=vr.hasOwnProperty(e)?vr[e]:vr[e]={};M(t,n)}function pr(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 vn(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 Jr(e,t,n){return e.startState?e.startState(t,n):!0}var _t=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};_t.prototype.eol=function(){return this.pos>=this.string.length},_t.prototype.sol=function(){return this.pos==this.lineStart},_t.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},_t.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},_t.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},_t.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},_t.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},_t.prototype.skipToEnd=function(){this.pos=this.string.length},_t.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},_t.prototype.backUp=function(e){this.pos-=e},_t.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=G(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?G(this.string,this.lineStart,this.tabSize):0)},_t.prototype.indentation=function(){return G(this.string,null,this.tabSize)-(this.lineStart?G(this.string,this.lineStart,this.tabSize):0)},_t.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(j){return n?j.toLowerCase():j},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var S=this.string.slice(this.pos).match(e);return S&&S.index>0?null:(S&&t!==!1&&(this.pos+=S[0].length),S)}},_t.prototype.current=function(){return this.string.slice(this.start,this.pos)},_t.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},_t.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},_t.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function it(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],S=i.chunkSize();if(t<S){n=i;break}t-=S}return n.lines[t]}function Sr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(S){var j=S.text;i==n.line&&(j=j.slice(0,n.ch)),i==t.line&&(j=j.slice(t.ch)),r.push(j),++i}),r}function Vn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function cr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function St(e){if(e.parent==null)return null;for(var t=e.parent,n=Z(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 wr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],S=i.height;if(t<S){e=i;continue e}t-=S,n+=i.chunkSize()}return n}while(!e.lines);for(var j=0;j<e.lines.length;++j){var z=e.lines[j],V=z.height;if(t<V)break;t-=V}return n+j}function Zr(e,t){return t>=e.first&&t<e.first+e.size}function yn(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 qr(e,t){return e.sticky==t.sticky&&dt(e,t)==0}function en(e){return Ne(e.line,e.ch)}function tn(e,t){return dt(e,t)<0?t:e}function bn(e,t){return dt(e,t)<0?e:t}function Xn(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,it(e,n).text.length):Ci(t,it(e,t.line).text.length)}function Ci(e,t){var n=e.ch;return n==null||n>t?Ne(e.line,t):n<0?Ne(e.line,0):e}function Ai(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ft(e,t[r]);return n}var rn=function(e,t){this.state=e,this.lookAhead=t},sr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};sr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},sr.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}},sr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},sr.fromSaved=function(e,t,n){return t instanceof rn?new sr(e,pr(e.mode,t.state),n,t.lookAhead):new sr(e,pr(e.mode,t),n)},sr.prototype.save=function(e){var t=e!==!1?pr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new rn(t,this.maxLookAhead):t};function Li(e,t,n,r){var i=[e.state.modeGen],S={};Qn(e,t.text,e.doc.mode,n,function(X,oe){return i.push(X,oe)},S,r);for(var j=n.state,z=function(X){n.baseTokens=i;var oe=e.state.overlays[X],le=1,xe=0;n.state=!0,Qn(e,t.text,oe.mode,n,function(ye,Pe){for(var Ie=le;xe<ye;){var We=i[le];We>ye&&i.splice(le,1,ye,i[le+1],We),le+=2,xe=Math.min(ye,We)}if(!Pe)return;if(oe.opaque)i.splice(Ie,le-Ie,ye,"overlay "+Pe),le=Ie+2;else for(;Ie<le;Ie+=2){var ze=i[Ie+1];i[Ie+1]=(ze?ze+" ":"")+"overlay "+Pe}},S),n.state=j,n.baseTokens=null,n.baseTokenPos=1},V=0;V<e.state.overlays.length;++V)z(V);return{styles:i,classes:S.bgClass||S.textClass?S:null}}function Yn(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Be(e,St(t)),i=t.text.length>e.options.maxHighlightLength&&pr(e.doc.mode,r.state),S=Li(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=S.styles,S.classes?t.styleClasses=S.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 Be(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new sr(r,!0,t);var S=Rr(e,t,n),j=S>r.first&&it(r,S-1).stateAfter,z=j?sr.fromSaved(r,j,S):new sr(r,Jr(r.mode),S);return r.iter(S,t,function(V){$n(e,V.text,z);var X=z.line;V.stateAfter=X==t-1||X%5==0||X>=i.viewFrom&&X<i.viewTo?z.save():null,z.nextLine()}),n&&(r.modeFrontier=z.line),z}function $n(e,t,n,r){var i=e.doc.mode,S=new _t(t,e.options.tabSize,n);for(S.start=S.pos=r||0,t==""&&Di(i,n.state);!S.eol();)En(i,S,n.state),S.start=S.pos}function Di(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=vn(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function En(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=vn(e,n).mode);var S=e.token(t,n);if(t.pos>t.start)return S}throw new Error("Mode "+e.name+" failed to advance stream.")}var nn=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Fr(e,t,n,r){var i=e.doc,S=i.mode,j;t=ft(i,t);var z=it(i,t.line),V=Be(e,t.line,n),X=new _t(z.text,e.options.tabSize,V),oe;for(r&&(oe=[]);(r||X.pos<t.ch)&&!X.eol();)X.start=X.pos,j=En(S,X,V.state),r&&oe.push(new nn(X,j,pr(i.mode,V.state)));return r?oe:new nn(X,j,V.state)}function Ri(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 Qn(e,t,n,r,i,S,j){var z=n.flattenSpans;z==null&&(z=e.options.flattenSpans);var V=0,X=null,oe=new _t(t,e.options.tabSize,r),le,xe=e.options.addModeClass&&[null];for(t==""&&Ri(Di(n,r.state),S);!oe.eol();){if(oe.pos>e.options.maxHighlightLength?(z=!1,j&&$n(e,t,r,oe.pos),oe.pos=t.length,le=null):le=Ri(En(n,oe,r.state,xe),S),xe){var ye=xe[0].name;ye&&(le="m-"+(le?ye+" "+le:ye))}if(!z||X!=le){for(;V<oe.start;)V=Math.min(oe.start,V+5e3),i(V,X);X=le}oe.start=oe.pos}for(;V<oe.pos;){var Pe=Math.min(oe.pos,V+5e3);i(Pe,X),V=Pe}}function Rr(e,t,n){for(var r,i,S=e.doc,j=n?-1:t-(e.doc.mode.innerMode?1e3:100),z=t;z>j;--z){if(z<=S.first)return S.first;var V=it(S,z-1),X=V.stateAfter;if(X&&(!n||z+(X instanceof rn?X.lookAhead:0)<=S.modeFrontier))return z;var oe=G(V.text,null,e.options.tabSize);(i==null||r>oe)&&(i=z-1,r=oe)}return i}function Oi(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=it(e,r).stateAfter;if(i&&(!(i instanceof rn)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Pi=!1,mr=!1;function Cr(){Pi=!0}function ki(){mr=!0}function xn(e,t,n){this.marker=e,this.from=t,this.to=n}function Nr(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Ur(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Br(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function aa(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var S=e[i],j=S.marker,z=S.from==null||(j.inclusiveLeft?S.from<=t:S.from<t);if(z||S.from==t&&j.type=="bookmark"&&(!n||!S.marker.insertLeft)){var V=S.to==null||(j.inclusiveRight?S.to>=t:S.to>t);(r||(r=[])).push(new xn(j,S.from,V?null:S.to))}}return r}function _i(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var S=e[i],j=S.marker,z=S.to==null||(j.inclusiveRight?S.to>=t:S.to>t);if(z||S.from==t&&j.type=="bookmark"&&(!n||S.marker.insertLeft)){var V=S.from==null||(j.inclusiveLeft?S.from<=t:S.from<t);(r||(r=[])).push(new xn(j,V?null:S.from-t,S.to==null?null:S.to-t))}}return r}function Or(e,t){if(t.full)return null;var n=Zr(e,t.from.line)&&it(e,t.from.line).markedSpans,r=Zr(e,t.to.line)&&it(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,S=t.to.ch,j=dt(t.from,t.to)==0,z=aa(n,i,j),V=_i(r,S,j),X=t.text.length==1,oe=$(t.text).length+(X?i:0);if(z)for(var le=0;le<z.length;++le){var xe=z[le];if(xe.to==null){var ye=Nr(V,xe.marker);ye?X&&(xe.to=ye.to==null?null:ye.to+oe):xe.to=i}}if(V)for(var Pe=0;Pe<V.length;++Pe){var Ie=V[Pe];if(Ie.to!=null&&(Ie.to+=oe),Ie.from==null){var We=Nr(z,Ie.marker);We||(Ie.from=oe,X&&(z||(z=[])).push(Ie))}else Ie.from+=oe,X&&(z||(z=[])).push(Ie)}z&&(z=Tn(z)),V&&V!=z&&(V=Tn(V));var ze=[z];if(!X){var Qe=t.text.length-2,Ve;if(Qe>0&&z)for(var tt=0;tt<z.length;++tt)z[tt].to==null&&(Ve||(Ve=[])).push(new xn(z[tt].marker,null,null));for(var ut=0;ut<Qe;++ut)ze.push(Ve);ze.push(V)}return ze}function Tn(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 oa(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(ye){if(ye.markedSpans)for(var Pe=0;Pe<ye.markedSpans.length;++Pe){var Ie=ye.markedSpans[Pe].marker;Ie.readOnly&&(!r||Z(r,Ie)==-1)&&(r||(r=[])).push(Ie)}}),!r)return null;for(var i=[{from:t,to:n}],S=0;S<r.length;++S)for(var j=r[S],z=j.find(0),V=0;V<i.length;++V){var X=i[V];if(dt(X.to,z.from)<0||dt(X.from,z.to)>0)continue;var oe=[V,1],le=dt(X.from,z.from),xe=dt(X.to,z.to);(le<0||!j.inclusiveLeft&&!le)&&oe.push({from:X.from,to:z.from}),(xe>0||!j.inclusiveRight&&!xe)&&oe.push({from:z.to,to:X.to}),i.splice.apply(i,oe),V+=oe.length-3}return i}function Jn(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 Zn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function an(e){return e.inclusiveLeft?-1:0}function Sn(e){return e.inclusiveRight?1:0}function wn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),S=dt(r.from,i.from)||an(e)-an(t);if(S)return-S;var j=dt(r.to,i.to)||Sn(e)-Sn(t);return j||t.id-e.id}function sa(e,t){var n=mr&&e.markedSpans,r;if(n)for(var i=void 0,S=0;S<n.length;++S)i=n[S],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||wn(r,i.marker)<0)&&(r=i.marker);return r}function Cn(e){return sa(e,!0)}function on(e){return sa(e,!1)}function Mi(e,t){var n=mr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var S=n[i];S.marker.collapsed&&(S.from==null||S.from<t)&&(S.to==null||S.to>t)&&(!r||wn(r,S.marker)<0)&&(r=S.marker)}return r}function qn(e,t,n,r,i){var S=it(e,t),j=mr&&S.markedSpans;if(j)for(var z=0;z<j.length;++z){var V=j[z];if(!V.marker.collapsed)continue;var X=V.marker.find(0),oe=dt(X.from,n)||an(V.marker)-an(i),le=dt(X.to,r)||Sn(V.marker)-Sn(i);if(oe>=0&&le<=0||oe<=0&&le>=0)continue;if(oe<=0&&(V.marker.inclusiveRight&&i.inclusiveLeft?dt(X.to,n)>=0:dt(X.to,n)>0)||oe>=0&&(V.marker.inclusiveRight&&i.inclusiveLeft?dt(X.from,r)<=0:dt(X.from,r)<0))return!0}}function $t(e){for(var t;t=Cn(e);)e=t.find(-1,!0).line;return e}function jr(e){for(var t;t=on(e);)e=t.find(1,!0).line;return e}function An(e){for(var t,n;t=on(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Wr(e,t){var n=it(e,t),r=$t(n);return n==r?t:St(r)}function Ii(e,t){if(t>e.lastLine())return t;var n=it(e,t),r;if(!yr(e,n))return t;for(;r=on(n);)n=r.find(1,!0).line;return St(n)+1}function yr(e,t){var n=mr&&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&&Ln(e,t,r))return!0}}function Ln(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Ln(e,r.line,Nr(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,S=0;S<t.markedSpans.length;++S)if(i=t.markedSpans[S],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Ln(e,t,i))return!0}function lr(e){e=$t(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 S=n.parent;S;n=S,S=n.parent)for(var j=0;j<S.children.length;++j){var z=S.children[j];if(z==n)break;t+=z.height}return t}function Dn(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Cn(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=on(r);){var S=n.find(0,!0);t-=r.text.length-S.from.ch,r=S.to.line,t+=r.text.length-S.to.ch}return t}function Pr(e){var t=e.display,n=e.doc;t.maxLine=it(n,n.first),t.maxLineLength=Dn(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Dn(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Hr=function(e,t,n){this.text=e,Zn(this,t),this.height=n?n(this):1};Hr.prototype.lineNo=function(){return St(this)},ce(Hr);function la(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Jn(e),Zn(e,n);var i=r?r(e):1;i!=e.height&&cr(e,i)}function ua(e){e.parent=null,Jn(e)}var $a={},Qa={};function da(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Qa:$a;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Fi(e,t){var n=x("span",null,null,R?"padding-right: .1px":null),r={pre:x("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 S=i?t.rest[i-1]:t.line,j=void 0;r.pos=0,r.addToken=ct,mt(e.display.measure)&&(j=Je(S,e.doc.direction))&&(r.addToken=vt(r.addToken,j)),r.map=[];var z=t!=e.display.externalMeasured&&St(S);Rt(S,r,Yn(e,S,z)),S.styleClasses&&(S.styleClasses.bgClass&&(r.bgClass=U(S.styleClasses.bgClass,r.bgClass||"")),S.styleClasses.textClass&&(r.textClass=U(S.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ht(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(R){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 Le(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=U(r.pre.className,r.textClass||"")),r}function nt(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 ct(e,t,n,r,i,S,j){if(!t)return;var z=e.splitSpaces?lt(t,e.trailingSpace):t,V=e.cm.state.specialChars,X=!1,oe;if(!V.test(t))e.col+=t.length,oe=document.createTextNode(z),e.map.push(e.pos,e.pos+t.length,oe),B&&N<9&&(X=!0),e.pos+=t.length;else{oe=document.createDocumentFragment();for(var le=0;;){V.lastIndex=le;var xe=V.exec(t),ye=xe?xe.index-le:t.length-le;if(ye){var Pe=document.createTextNode(z.slice(le,le+ye));B&&N<9?oe.appendChild(a("span",[Pe])):oe.appendChild(Pe),e.map.push(e.pos,e.pos+ye,Pe),e.col+=ye,e.pos+=ye}if(!xe)break;le+=ye+1;var Ie=void 0;if(xe[0]==" "){var We=e.cm.options.tabSize,ze=We-e.col%We;Ie=oe.appendChild(a("span",he(ze),"cm-tab")),Ie.setAttribute("role","presentation"),Ie.setAttribute("cm-text"," "),e.col+=ze}else xe[0]=="\r"||xe[0]==`
|
|
`?(Ie=oe.appendChild(a("span",xe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ie.setAttribute("cm-text",xe[0]),e.col+=1):(Ie=e.cm.options.specialCharPlaceholder(xe[0]),Ie.setAttribute("cm-text",xe[0]),B&&N<9?oe.appendChild(a("span",[Ie])):oe.appendChild(Ie),e.col+=1);e.map.push(e.pos,e.pos+1,Ie),e.pos++}}if(e.trailingSpace=z.charCodeAt(t.length-1)==32,n||r||i||X||S||j){var Qe=n||"";r&&(Qe+=r),i&&(Qe+=i);var Ve=a("span",[oe],Qe,S);if(j)for(var tt in j)j.hasOwnProperty(tt)&&tt!="style"&&tt!="class"&&Ve.setAttribute(tt,j[tt]);return e.content.appendChild(Ve)}e.content.appendChild(oe)}function lt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var S=e.charAt(i);S==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(S="\xA0"),r+=S,n=S==" "}return r}function vt(e,t){return function(n,r,i,S,j,z,V){i=i?i+" cm-force-border":"cm-force-border";for(var X=n.pos,oe=X+r.length;;){for(var le=void 0,xe=0;xe<t.length&&!(le=t[xe],le.to>X&&le.from<=X);xe++);if(le.to>=oe)return e(n,r,i,S,j,z,V);e(n,r.slice(0,le.to-X),i,S,null,z,V),S=null,r=r.slice(le.to-X),X=le.to}}}function Tt(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 Rt(e,t,n){var r=e.markedSpans,i=e.text,S=0;if(!r){for(var j=1;j<n.length;j+=2)t.addToken(t,i.slice(S,S=n[j]),da(n[j+1],t.cm.options));return}for(var z=i.length,V=0,X=1,oe="",le,xe,ye=0,Pe,Ie,We,ze,Qe;;){if(ye==V){Pe=Ie=We=xe="",Qe=null,ze=null,ye=Infinity;for(var Ve=[],tt=void 0,ut=0;ut<r.length;++ut){var ot=r[ut],gt=ot.marker;if(gt.type=="bookmark"&&ot.from==V&>.widgetNode)Ve.push(gt);else if(ot.from<=V&&(ot.to==null||ot.to>V||gt.collapsed&&ot.to==V&&ot.from==V)){if(ot.to!=null&&ot.to!=V&&ye>ot.to&&(ye=ot.to,Ie=""),gt.className&&(Pe+=" "+gt.className),gt.css&&(xe=(xe?xe+";":"")+gt.css),gt.startStyle&&ot.from==V&&(We+=" "+gt.startStyle),gt.endStyle&&ot.to==ye&&(tt||(tt=[])).push(gt.endStyle,ot.to),gt.title&&((Qe||(Qe={})).title=gt.title),gt.attributes)for(var Ot in gt.attributes)(Qe||(Qe={}))[Ot]=gt.attributes[Ot];gt.collapsed&&(!ze||wn(ze.marker,gt)<0)&&(ze=ot)}else ot.from>V&&ye>ot.from&&(ye=ot.from)}if(tt)for(var Vt=0;Vt<tt.length;Vt+=2)tt[Vt+1]==ye&&(Ie+=" "+tt[Vt]);if(!ze||ze.from==V)for(var Mt=0;Mt<Ve.length;++Mt)Tt(t,0,Ve[Mt]);if(ze&&(ze.from||0)==V){if(Tt(t,(ze.to==null?z+1:ze.to)-V,ze.marker,ze.from==null),ze.to==null)return;ze.to==V&&(ze=!1)}}if(V>=z)break;for(var dr=Math.min(z,ye);;){if(oe){var nr=V+oe.length;if(!ze){var Bt=nr>dr?oe.slice(0,dr-V):oe;t.addToken(t,Bt,le?le+Pe:Pe,We,V+Bt.length==ye?Ie:"",xe,Qe)}if(nr>=dr){oe=oe.slice(dr-V),V=dr;break}V=nr,We=""}oe=i.slice(S,S=n[X++]),le=da(n[X++],t.cm.options)}}}function yt(e,t,n){this.line=t,this.rest=An(t),this.size=this.rest?St($(this.rest))-n+1:1,this.node=this.text=null,this.hidden=yr(e,t)}function It(e,t,n){for(var r=[],i,S=t;S<n;S=i){var j=new yt(e.doc,it(e.doc,S),S);i=S+j.size,r.push(j)}return r}var Wt=null;function bt(e){Wt?Wt.ops.push(e):e.ownsGroup=Wt={ops:[e],delayedCallbacks:[]}}function kr(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 Ct(e,t){var n=e.ownsGroup;if(!n)return;try{kr(n)}finally{Wt=null,t(n)}}var Zt=null;function Dt(e,t){var n=rt(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Wt?i=Wt.delayedCallbacks:Zt?i=Zt:(i=Zt=[],setTimeout(gr,0));for(var S=function(z){i.push(function(){return n[z].apply(null,r)})},j=0;j<n.length;++j)S(j)}function gr(){var e=Zt;Zt=null;for(var t=0;t<e.length;++t)e[t]()}function Ja(e,t,n,r){for(var i=0;i<t.changes.length;i++){var S=t.changes[i];S=="text"?Ms(e,t):S=="gutter"?qa(e,t,n,r):S=="class"?ca(e,t):S=="widget"&&Is(e,t,r)}t.changes=null}function ei(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=ei(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Za(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Fi(e,t)}function Ms(e,t){var n=t.text.className,r=Za(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,ca(e,t)):n&&(t.text.className=n)}function ca(e,t){_s(e,t),t.line.wrapClass?ei(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=ei(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 S=t.line.gutterMarkers;if(e.options.lineNumbers||S){var j=ei(t),z=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(z),j.insertBefore(z,t.text),t.line.gutterClass&&(z.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!S||!S["CodeMirror-linenumbers"])&&(t.lineNumber=z.appendChild(a("div",yn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),S)for(var V=0;V<e.display.gutterSpecs.length;++V){var X=e.display.gutterSpecs[V].className,oe=S.hasOwnProperty(X)&&S[X];oe&&z.appendChild(a("div",[oe],"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=T("CodeMirror-linewidget"),i=t.node.firstChild,S=void 0;i;i=S)S=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);eo(e,t,n)}function Fs(e,t,n,r){var i=Za(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),ca(e,t),qa(e,t,n,r),eo(e,t,r),t.node}function eo(e,t,n){if(to(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)to(e,t.rest[r],t,n,!1)}function to(e,t,n,r,i){if(!t.widgets)return;for(var S=ei(n),j=0,z=t.widgets;j<z.length;++j){var V=z[j],X=a("div",[V.node],"CodeMirror-linewidget"+(V.className?" "+V.className:""));V.handleMouseEvents||X.setAttribute("cm-ignore-events","true"),Ns(V,X,n,r),e.display.input.setUneditable(X),i&&V.above?S.insertBefore(X,n.gutter||n.text):S.appendChild(X),Dt(V,"redraw")}}function Ns(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 ti(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!p(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;"),u(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function _r(e,t){for(var n=Te(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 Ni(e){return e.lineSpace.offsetTop}function fa(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ro(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=u(e.measure,a("pre","x","CodeMirror-line-like")),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 Ar(e){return ne-e.display.nativeBarWidth}function sn(e){return e.display.scroller.clientWidth-Ar(e)-e.display.barWidth}function ha(e){return e.display.scroller.clientHeight-Ar(e)-e.display.barHeight}function Us(e,t,n){var r=e.options.lineWrapping,i=r&&sn(e);if(!t.measure.heights||r&&t.measure.width!=i){var S=t.measure.heights=[];if(r){t.measure.width=i;for(var j=t.text.firstChild.getClientRects(),z=0;z<j.length-1;z++){var V=j[z],X=j[z+1];Math.abs(V.bottom-X.bottom)>2&&S.push((V.bottom+X.top)/2-n.top)}}S.push(n.bottom-n.top)}}function no(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(St(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=$t(t);var n=St(t),r=e.display.externalMeasured=new yt(e.doc,t,n);r.lineN=n;var i=r.built=Fi(e,r);return r.text=i.pre,u(e.display.lineMeasure,i.pre),r}function io(e,t,n,r){return Lr(e,Rn(e,t),n,r)}function pa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[dn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Rn(e,t){var n=St(t),r=pa(e,n);r&&!r.text?r=null:r&&r.changes&&(Ja(e,r,n,Ea(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=no(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Lr(e,t,n,r,i){t.before&&(n=-1);var S=n+(r||""),j;return t.cache.hasOwnProperty(S)?j=t.cache[S]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Us(e,t.view,t.rect),t.hasHeights=!0),j=Ws(e,t,n,r),j.bogus||(t.cache[S]=j)),{left:j.left,right:j.right,top:i?j.rtop:j.top,bottom:i?j.rbottom:j.bottom}}var ao={left:0,right:0,top:0,bottom:0};function oo(e,t,n){for(var r,i,S,j,z,V,X=0;X<e.length;X+=3)if(z=e[X],V=e[X+1],t<z?(i=0,S=1,j="left"):t<V?(i=t-z,S=i+1):(X==e.length-3||t==V&&e[X+3]>t)&&(S=V-z,i=S-1,t>=V&&(j="right")),i!=null){if(r=e[X+2],z==V&&n==(r.insertLeft?"left":"right")&&(j=n),n=="left"&&i==0)for(;X&&e[X-2]==e[X-3]&&e[X-1].insertLeft;)r=e[(X-=3)+2],j="left";if(n=="right"&&i==V-z)for(;X<e.length-3&&e[X+3]==e[X+4]&&!e[X+5].insertLeft;)r=e[(X+=3)+2],j="right";break}return{node:r,start:i,end:S,collapse:j,coverStart:z,coverEnd:V}}function js(e,t){var n=ao;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=oo(t.map,n,r),S=i.node,j=i.start,z=i.end,V=i.collapse,X;if(S.nodeType==3){for(var oe=0;oe<4;oe++){for(;j&&Re(t.line.text.charAt(i.coverStart+j));)--j;for(;i.coverStart+z<i.coverEnd&&Re(t.line.text.charAt(i.coverStart+z));)++z;if(B&&N<9&&j==0&&z==i.coverEnd-i.coverStart?X=S.parentNode.getBoundingClientRect():X=js(y(S,j,z).getClientRects(),r),X.left||X.right||j==0)break;z=j,j=j-1,V="right"}B&&N<11&&(X=Hs(e.display.measure,X))}else{j>0&&(V=r="right");var le;e.options.lineWrapping&&(le=S.getClientRects()).length>1?X=le[r=="right"?le.length-1:0]:X=S.getBoundingClientRect()}if(B&&N<9&&!j&&(!X||!X.left&&!X.right)){var xe=S.parentNode.getClientRects()[0];xe?X={left:xe.left,right:xe.left+Pn(e.display),top:xe.top,bottom:xe.bottom}:X=ao}for(var ye=X.top-t.rect.top,Pe=X.bottom-t.rect.top,Ie=(ye+Pe)/2,We=t.view.measure.heights,ze=0;ze<We.length-1&&!(Ie<We[ze]);ze++);var Qe=ze?We[ze-1]:0,Ve=We[ze],tt={left:(V=="right"?X.right:X.left)-t.rect.left,right:(V=="left"?X.left:X.right)-t.rect.left,top:Qe,bottom:Ve};return!X.left&&!X.right&&(tt.bogus=!0),e.options.singleCursorHeightPerLine||(tt.rtop=ye,tt.rbottom=Pe),tt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Pt(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 so(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function lo(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)so(e.display.view[t])}function ri(e){lo(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function uo(){return f&&l?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function co(){return f&&l?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ma(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=ti(e.widgets[n]));return t}function Ui(e,t,n,r,i){if(!i){var S=ma(t);n.top+=S,n.bottom+=S}if(r=="line")return n;r||(r="local");var j=lr(t);if(r=="local"?j+=Ni(e.display):j-=e.display.viewOffset,r=="page"||r=="window"){var z=e.display.lineSpace.getBoundingClientRect();j+=z.top+(r=="window"?0:co());var V=z.left+(r=="window"?0:uo());n.left+=V,n.right+=V}return n.top+=j,n.bottom+=j,n}function fo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=uo(),i-=co();else if(n=="local"||!n){var S=e.display.sizer.getBoundingClientRect();r+=S.left,i+=S.top}var j=e.display.lineSpace.getBoundingClientRect();return{left:r-j.left,top:i-j.top}}function ga(e,t,n,r,i){return r||(r=it(e.doc,t.line)),Ui(e,r,io(e,r,t.ch,i),n)}function br(e,t,n,r,i,S){r=r||it(e.doc,t.line),i||(i=Rn(e,r));function j(Pe,Ie){var We=Lr(e,i,Pe,Ie?"right":"left",S);return Ie?We.left=We.right:We.right=We.left,Ui(e,r,We,n)}var z=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"),!z)return j(X=="before"?V-1:V,X=="before");function oe(Pe,Ie,We){var ze=z[Ie],Qe=ze.level==1;return j(We?Pe-1:Pe,Qe!=We)}var le=He(z,V,X),xe=Ge,ye=oe(V,le,X=="before");return xe!=null&&(ye.other=oe(V,xe,X!="before")),ye}function ho(e,t){var n=0;t=ft(e.doc,t),e.options.lineWrapping||(n=Pn(e.display)*t.ch);var r=it(e.doc,t.line),i=lr(r)+Ni(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function va(e,t,n,r,i){var S=Ne(e,t,n);return S.xRel=i,r&&(S.outside=r),S}function ya(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return va(r.first,0,null,-1,-1);var i=wr(r,n),S=r.first+r.size-1;if(i>S)return va(r.first+r.size-1,it(r,S).text.length,null,1,1);t<0&&(t=0);for(var j=it(r,i);;){var z=Ks(e,j,i,t,n),V=Mi(j,z.ch+(z.xRel>0||z.outside>0?1:0));if(!V)return z;var X=V.find(1);if(X.line==i)return X;j=it(r,i=X.line)}}function po(e,t,n,r){r-=ma(t);var i=t.text.length,S=Ue(function(j){return Lr(e,n,j-1).bottom<=r},i,0);return i=Ue(function(j){return Lr(e,n,j).top>r},S,i),{begin:S,end:i}}function mo(e,t,n,r){n||(n=Rn(e,t));var i=Ui(e,t,Lr(e,n,r),"line").top;return po(e,t,n,i)}function ba(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-=lr(t);var S=Rn(e,t),j=ma(t),z=0,V=t.text.length,X=!0,oe=Je(t,e.doc.direction);if(oe){var le=(e.options.lineWrapping?zs:Gs)(e,t,n,S,oe,r,i);X=le.level!=1,z=X?le.from:le.to-1,V=X?le.to:le.from-1}var xe=null,ye=null,Pe=Ue(function(ut){var ot=Lr(e,S,ut);return ot.top+=j,ot.bottom+=j,ba(ot,r,i,!1)?(ot.top<=i&&ot.left<=r&&(xe=ut,ye=ot),!0):!1},z,V),Ie,We,ze=!1;if(ye){var Qe=r-ye.left<ye.right-r,Ve=Qe==X;Pe=xe+(Ve?0:1),We=Ve?"after":"before",Ie=Qe?ye.left:ye.right}else{!X&&(Pe==V||Pe==z)&&Pe++,We=Pe==0?"after":Pe==t.text.length?"before":Lr(e,S,Pe-(X?1:0)).bottom+j<=i==X?"after":"before";var tt=br(e,Ne(n,Pe,We),"line",t,S);Ie=tt.left,ze=i<tt.top?-1:i>=tt.bottom?1:0}return Pe=Ae(t.text,Pe,1),va(n,Pe,We,ze,r-Ie)}function Gs(e,t,n,r,i,S,j){var z=Ue(function(le){var xe=i[le],ye=xe.level!=1;return ba(br(e,Ne(n,ye?xe.to:xe.from,ye?"before":"after"),"line",t,r),S,j,!0)},0,i.length-1),V=i[z];if(z>0){var X=V.level!=1,oe=br(e,Ne(n,X?V.from:V.to,X?"after":"before"),"line",t,r);ba(oe,S,j,!0)&&oe.top>j&&(V=i[z-1])}return V}function zs(e,t,n,r,i,S,j){var z=po(e,t,r,j),V=z.begin,X=z.end;/\s/.test(t.text.charAt(X-1))&&X--;for(var oe=null,le=null,xe=0;xe<i.length;xe++){var ye=i[xe];if(ye.from>=X||ye.to<=V)continue;var Pe=ye.level!=1,Ie=Lr(e,r,Pe?Math.min(X,ye.to)-1:Math.max(V,ye.from)).right,We=Ie<S?S-Ie+1e9:Ie-S;(!oe||le>We)&&(oe=ye,le=We)}return oe||(oe=i[i.length-1]),oe.from<V&&(oe={from:V,to:oe.to,level:oe.level}),oe.to>X&&(oe={from:oe.from,to:X,level:oe.level}),oe}var ln;function On(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(ln==null){ln=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)ln.appendChild(document.createTextNode("x")),ln.appendChild(a("br"));ln.appendChild(document.createTextNode("x"))}u(e.measure,ln);var n=ln.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function Pn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");u(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Ea(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,S=t.gutters.firstChild,j=0;S;S=S.nextSibling,++j){var z=e.display.gutterSpecs[j].className;n[z]=S.offsetLeft+S.clientLeft+i,r[z]=S.clientWidth}return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function xa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function go(e){var t=On(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Pn(e.display)-3);return function(i){if(yr(e.doc,i))return 0;var S=0;if(i.widgets)for(var j=0;j<i.widgets.length;j++)i.widgets[j].height&&(S+=i.widgets[j].height);return n?S+(Math.ceil(i.text.length/r)||1)*t:S+t}}function Ta(e){var t=e.doc,n=go(e);t.iter(function(r){var i=n(r);i!=r.height&&cr(r,i)})}function un(e,t,n,r){var i=e.display;if(!n&&Te(t).getAttribute("cm-not-content")=="true")return null;var S,j,z=i.lineSpace.getBoundingClientRect();try{S=t.clientX-z.left,j=t.clientY-z.top}catch(le){return null}var V=ya(e,S,j),X;if(r&&V.xRel>0&&(X=it(e.doc,V.line).text).length==V.ch){var oe=G(X,X.length,e.options.tabSize)-X.length;V=Ne(V.line,Math.max(0,Math.round((S-ro(e.display).left)/Pn(e.display))-oe))}return V}function dn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function 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)mr&&Wr(e.doc,t)<i.viewTo&&Gr(e);else if(n<=i.viewFrom)mr&&Ii(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 S=Bi(e,n,n+r,1);S?(i.view=i.view.slice(S.index),i.viewFrom=S.lineN,i.viewTo+=r):Gr(e)}else if(n>=i.viewTo){var j=Bi(e,t,t,-1);j?(i.view=i.view.slice(0,j.index),i.viewTo=j.lineN):Gr(e)}else{var z=Bi(e,t,t,-1),V=Bi(e,n,n+r,1);z&&V?(i.view=i.view.slice(0,z.index).concat(It(e,z.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 S=r.view[dn(e,t)];if(S.node==null)return;var j=S.changes||(S.changes=[]);Z(j,n)==-1&&j.push(n)}function Gr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Bi(e,t,n,r){var i=dn(e,t),S,j=e.display.view;if(!mr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var z=e.display.viewFrom,V=0;V<i;V++)z+=j[V].size;if(z!=t){if(r>0){if(i==j.length-1)return null;S=z+j[i].size-t,i++}else S=z-t;t+=S,n+=S}for(;Wr(e.doc,n)!=n;){if(i==(r<0?0:j.length-1))return null;n+=r*j[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=It(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=It(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(dn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(It(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,dn(e,n)))),r.viewTo=n}function vo(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 ni(e){e.display.input.showSelection(e.display.input.prepareSelection())}function yo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),S=r.selection=document.createDocumentFragment(),j=0;j<n.sel.ranges.length;j++){if(!t&&j==n.sel.primIndex)continue;var z=n.sel.ranges[j];if(z.from().line>=e.display.viewTo||z.to().line<e.display.viewFrom)continue;var V=z.empty();(V||e.options.showCursorWhenSelecting)&&bo(e,z.head,i),V||Xs(e,z,S)}return r}function bo(e,t,n){var r=br(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 S=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));S.style.display="",S.style.left=r.other.left+"px",S.style.top=r.other.top+"px",S.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function ji(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,S=document.createDocumentFragment(),j=ro(e.display),z=j.left,V=Math.max(r.sizerWidth,sn(e)-r.sizer.offsetLeft)-j.right,X=i.direction=="ltr";function oe(Ve,tt,ut,ot){tt<0&&(tt=0),tt=Math.round(tt),ot=Math.round(ot),S.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Ve+`px;
|
|
top: `+tt+"px; width: "+(ut==null?V-Ve:ut)+`px;
|
|
height: `+(ot-tt)+"px"))}function le(Ve,tt,ut){var ot=it(i,Ve),gt=ot.text.length,Ot,Vt;function Mt(Bt,ir){return ga(e,Ne(Ve,Bt),"div",ot,ir)}function dr(Bt,ir,Yt){var Ht=mo(e,ot,null,Bt),jt=ir=="ltr"==(Yt=="after")?"left":"right",Ft=Yt=="after"?Ht.begin:Ht.end-(/\s/.test(ot.text.charAt(Ht.end-1))?2:1);return Mt(Ft,jt)[jt]}var nr=Je(ot,i.direction);return Ye(nr,tt||0,ut==null?gt:ut,function(Bt,ir,Yt,Ht){var jt=Yt=="ltr",Ft=Mt(Bt,jt?"left":"right"),ar=Mt(ir-1,jt?"right":"left"),Gn=tt==null&&Bt==0,Qr=ut==null&&ir==gt,Jt=Ht==0,Dr=!nr||Ht==nr.length-1;if(ar.top-Ft.top<=3){var Xt=(X?Gn:Qr)&&Jt,Xa=(X?Qr:Gn)&&Dr,Ir=Xt?z:(jt?Ft:ar).left,mn=Xa?V:(jt?ar:Ft).right;oe(Ir,Ft.top,mn-Ir,Ft.bottom)}else{var gn,er,zn,Ya;jt?(gn=X&&Gn&&Jt?z:Ft.left,er=X?V:dr(Bt,Yt,"before"),zn=X?z:dr(ir,Yt,"after"),Ya=X&&Qr&&Dr?V:ar.right):(gn=X?dr(Bt,Yt,"before"):z,er=!X&&Gn&&Jt?V:Ft.right,zn=!X&&Qr&&Dr?z:ar.left,Ya=X?dr(ir,Yt,"after"):V),oe(gn,Ft.top,er-gn,Ft.bottom),Ft.bottom<ar.top&&oe(z,Ft.bottom,null,ar.top),oe(zn,ar.top,Ya-zn,ar.bottom)}(!Ot||ji(Ft,Ot)<0)&&(Ot=Ft),ji(ar,Ot)<0&&(Ot=ar),(!Vt||ji(Ft,Vt)<0)&&(Vt=Ft),ji(ar,Vt)<0&&(Vt=ar)}),{start:Ot,end:Vt}}var xe=t.from(),ye=t.to();if(xe.line==ye.line)le(xe.line,xe.ch,ye.ch);else{var Pe=it(i,xe.line),Ie=it(i,ye.line),We=$t(Pe)==$t(Ie),ze=le(xe.line,xe.ch,We?Pe.text.length+1:null).end,Qe=le(ye.line,We?0:null,ye.ch).start;We&&(ze.top<Qe.top-2?(oe(ze.right,ze.top,null,ze.bottom),oe(z,Qe.top,Qe.left,Qe.bottom)):oe(ze.right,ze.top,Qe.left-ze.right,ze.bottom)),ze.bottom<Qe.top&&oe(z,ze.bottom,null,Qe.top)}n.appendChild(S)}function Sa(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()||kn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Eo(e){e.state.focused||(e.display.input.focus(),wa(e))}function xo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,kn(e))},100)}function wa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Le(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(),R&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function kn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Le(e,"blur",e,t),e.state.focused=!1,h(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Wi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],S=e.options.lineWrapping,j=void 0,z=0;if(i.hidden)continue;if(B&&N<8){var V=i.node.offsetTop+i.node.offsetHeight;j=V-n,n=V}else{var X=i.node.getBoundingClientRect();j=X.bottom-X.top,!S&&i.text.firstChild&&(z=i.text.firstChild.getBoundingClientRect().right-X.left-1)}var oe=i.line.height-j;if((oe>.005||oe<-.005)&&(cr(i.line,j),To(i.line),i.rest))for(var le=0;le<i.rest.length;le++)To(i.rest[le]);if(z>e.display.sizerWidth){var xe=Math.ceil(z/Pn(e.display));xe>e.display.maxLineLength&&(e.display.maxLineLength=xe,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function To(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 Hi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Ni(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,S=wr(t,r),j=wr(t,i);if(n&&n.ensure){var z=n.ensure.from.line,V=n.ensure.to.line;z<S?(S=z,j=wr(t,lr(it(t,z))+e.wrapper.clientHeight)):Math.min(V,t.lastLine())>=j&&(S=wr(t,lr(it(t,V))-e.wrapper.clientHeight),j=V)}return{from:S,to:Math.max(j,S+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&&!b){var S=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Ni(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Ar(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(S),S.scrollIntoView(i),e.display.lineSpace.removeChild(S)}}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 S=0;S<5;S++){var j=!1,z=br(e,t),V=!n||n==t?z:br(e,n);i={left:Math.min(z.left,V.left),top:Math.min(z.top,V.top)-r,right:Math.max(z.left,V.left),bottom:Math.max(z.bottom,V.bottom)+r};var X=Ca(e,i),oe=e.doc.scrollTop,le=e.doc.scrollLeft;if(X.scrollTop!=null&&(ai(e,X.scrollTop),Math.abs(e.doc.scrollTop-oe)>1&&(j=!0)),X.scrollLeft!=null&&(cn(e,X.scrollLeft),Math.abs(e.doc.scrollLeft-le)>1&&(j=!0)),!j)break}return i}function Qs(e,t){var n=Ca(e,t);n.scrollTop!=null&&ai(e,n.scrollTop),n.scrollLeft!=null&&cn(e,n.scrollLeft)}function Ca(e,t){var n=e.display,r=On(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,S=ha(e),j={};t.bottom-t.top>S&&(t.bottom=t.top+S);var z=e.doc.height+fa(n),V=t.top<r,X=t.bottom>z-r;if(t.top<i)j.scrollTop=V?0:t.top;else if(t.bottom>i+S){var oe=Math.min(t.top,(X?z:t.bottom)-S);oe!=i&&(j.scrollTop=oe)}var le=e.options.fixedGutter?0:n.gutters.offsetWidth,xe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-le,ye=sn(e)-n.gutters.offsetWidth,Pe=t.right-t.left>ye;return Pe&&(t.right=t.left+ye),t.left<10?j.scrollLeft=0:t.left<xe?j.scrollLeft=Math.max(0,t.left+le-(Pe?0:10)):t.right>ye+xe-3&&(j.scrollLeft=t.right+(Pe?0:10)-ye),j}function Aa(e,t){if(t==null)return;Ki(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function _n(e){Ki(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function ii(e,t,n){(t!=null||n!=null)&&Ki(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Js(e,t){Ki(e),e.curOp.scrollToPos=t}function Ki(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=ho(e,t.from),r=ho(e,t.to);So(e,n,r,t.margin)}}function So(e,t,n,r){var i=Ca(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});ii(e,i.scrollLeft,i.scrollTop)}function ai(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;L||Da(e,{top:t}),wo(e,t,!0),L&&Da(e),li(e,100)}function wo(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 cn(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,Ro(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function oi(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+fa(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Ar(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var fn=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),we(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),we(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,B&&N<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};fn.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 S=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+S)+"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}},fn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},fn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},fn.prototype.zeroWidthHack=function(){var e=s&&!w?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Y,this.disableVert=new Y},fn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),S=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);S!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},fn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var si=function(){};si.prototype.update=function(){return{bottom:0,right:0}},si.prototype.setScrollLeft=function(){},si.prototype.setScrollTop=function(){},si.prototype.clear=function(){};function Mn(e,t){t||(t=oi(e));var n=e.display.barWidth,r=e.display.barHeight;Co(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Wi(e),Co(e,oi(e)),n=e.display.barWidth,r=e.display.barHeight}function Co(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 Ao={native:fn,null:si};function Lo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&h(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ao[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),we(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"?cn(e,t):ai(e,t)},e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function hn(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},bt(e.curOp)}function pn(e){var t=e.curOp;t&&Ct(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 S=0;S<t.length;S++)nl(t[S]);for(var j=0;j<t.length;j++)il(t[j])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&Pr(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 Gi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&La(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Wi(t),e.barMeasure=oi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=io(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+Ar(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-sn(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&&cn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==k();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Mn(t,e.barMeasure),e.updatedDisplay&&Oa(t,e.barMeasure),e.selectionChanged&&Sa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Eo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Do(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&wo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&cn(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 S=e.maybeHiddenMarkers,j=e.maybeUnhiddenMarkers;if(S)for(var z=0;z<S.length;++z)S[z].lines.length||Le(S[z],"hide");if(j)for(var V=0;V<j.length;++V)j[V].lines.length&&Le(j[V],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Le(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function ur(e,t){if(e.curOp)return t();hn(e);try{return t()}finally{pn(e)}}function Gt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);hn(e);try{return t.apply(e,arguments)}finally{pn(e)}}}function qt(e){return function(){if(this.curOp)return e.apply(this,arguments);hn(this);try{return e.apply(this,arguments)}finally{pn(this)}}}function zt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);hn(t);try{return e.apply(this,arguments)}finally{pn(t)}}}function li(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,_(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=Be(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(S){if(r.line>=e.display.viewFrom){var j=S.styles,z=S.text.length>e.options.maxHighlightLength?pr(t.mode,r.state):null,V=Li(e,S,r,!0);z&&(r.state=z),S.styles=V.styles;var X=S.styleClasses,oe=V.classes;oe?S.styleClasses=oe:X&&(S.styleClasses=null);for(var le=!j||j.length!=S.styles.length||X!=oe&&(!X||!oe||X.bgClass!=oe.bgClass||X.textClass!=oe.textClass),xe=0;!le&&xe<j.length;++xe)le=j[xe]!=S.styles[xe];le&&i.push(r.line),S.stateAfter=r.save(),r.nextLine()}else S.text.length<=e.options.maxHighlightLength&&$n(e,S.text,r),S.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return li(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&ur(e,function(){for(var S=0;S<i.length;S++)Kr(e,i[S],"text")})}var Gi=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Hi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=sn(e),this.force=n,this.dims=Ea(e),this.events=[]};Gi.prototype.signal=function(e,t){de(e,t)&&this.events.push(arguments)},Gi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Le.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=Ar(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ar(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=k();if(!t||!p(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&p(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==k())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&p(document.body,e.anchorNode)&&p(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 La(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&&vo(e)==0)return!1;Oo(e)&&(Gr(e),t.dims=Ea(e));var i=r.first+r.size,S=Math.max(t.visible.from-e.options.viewportMargin,r.first),j=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<S&&S-n.viewFrom<20&&(S=Math.max(r.first,n.viewFrom)),n.viewTo>j&&n.viewTo-j<20&&(j=Math.min(i,n.viewTo)),mr&&(S=Wr(e.doc,S),j=Ii(e.doc,j));var z=S!=n.viewFrom||j!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,S,j),n.viewOffset=lr(it(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var V=vo(e);if(!z&&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,z&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,li(e,400)),n.updateLineNumbers=null,!0}function Do(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==sn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+fa(e.display)-ha(e),n.top)}),t.visible=Hi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Hi(e.display,e.doc,n));if(!La(e,t))break;Wi(e);var i=oi(e);ni(e),Mn(e,i),Oa(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 Da(e,t){var n=new Gi(e,t);if(La(e,n)){Wi(e),Do(e,n);var r=oi(e);ni(e),Mn(e,r),Oa(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,S=r.lineDiv,j=S.firstChild;function z(Pe){var Ie=Pe.nextSibling;return R&&s&&e.display.currentWheelTarget==Pe?Pe.style.display="none":Pe.parentNode.removeChild(Pe),Ie}for(var V=r.view,X=r.viewFrom,oe=0;oe<V.length;oe++){var le=V[oe];if(!le.hidden)if(!le.node||le.node.parentNode!=S){var xe=Fs(e,le,X,n);S.insertBefore(xe,j)}else{for(;j!=le.node;)j=z(j);var ye=i&&t!=null&&t<=X&&le.lineNumber;le.changes&&(Z(le.changes,"gutter")>-1&&(ye=!1),Ja(e,le,X,n)),ye&&(c(le.lineNumber),le.lineNumber.appendChild(document.createTextNode(yn(e.options,X)))),j=le.node.nextSibling}X+=le.size}for(;j;)j=z(j)}function Ra(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Oa(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+Ar(e)+"px"}function Ro(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=xa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,S=r+"px",j=0;j<n.length;j++)if(!n[j].hidden){e.options.fixedGutter&&(n[j].gutter&&(n[j].gutter.style.left=S),n[j].gutterBackground&&(n[j].gutterBackground.style.left=S));var z=n[j].alignable;if(z)for(var V=0;V<z.length;V++)z[V].style.left=S}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Oo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=yn(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")),S=i.firstChild.offsetWidth,j=i.offsetWidth-S;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(S,r.lineGutter.offsetWidth-j)+1,r.lineNumWidth=r.lineNumInnerWidth+j,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Ra(e.display),!0}return!1}function Pa(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var S=e[i],j=null;if(typeof S!="string"&&(j=S.style,S=S.className),S=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:S,style:j})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Po(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],S=i.className,j=i.style,z=t.appendChild(a("div",null,"CodeMirror-gutter "+S));j&&(z.style.cssText=j),S=="CodeMirror-linenumbers"&&(e.lineGutter=z,z.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Ra(e)}function ui(e){Po(e.display),tr(e),Ro(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=x("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=x("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var S=x("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[S],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),!R&&!(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=Pa(r.gutters,r.lineNumbers),Po(i),n.init(i)}var zi=0,fr=null;B?fr=-.53:L?fr=15:f?fr=-.7:P&&(fr=-1/3);function ko(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=ko(e);return t.x*=fr,t.y*=fr,t}function _o(e,t){var n=ko(t),r=n.x,i=n.y,S=e.display,j=S.scroller,z=j.scrollWidth>j.clientWidth,V=j.scrollHeight>j.clientHeight;if(!(r&&z||i&&V))return;if(i&&s&&R){e:for(var X=t.target,oe=S.view;X!=j;X=X.parentNode)for(var le=0;le<oe.length;le++)if(oe[le].node==X){e.display.currentWheelTarget=X;break e}}if(r&&!L&&!v&&fr!=null){i&&V&&ai(e,Math.max(0,j.scrollTop+i*fr)),cn(e,Math.max(0,j.scrollLeft+r*fr)),(!i||i&&V)&&Q(t),S.wheelStartX=null;return}if(i&&fr!=null){var xe=i*fr,ye=e.doc.scrollTop,Pe=ye+S.wrapper.clientHeight;xe<0?ye=Math.max(0,ye+xe-50):Pe=Math.min(e.doc.height,Pe+xe+50),Da(e,{top:ye,bottom:Pe})}zi<20&&(S.wheelStartX==null?(S.wheelStartX=j.scrollLeft,S.wheelStartY=j.scrollTop,S.wheelDX=r,S.wheelDY=i,setTimeout(function(){if(S.wheelStartX==null)return;var Ie=j.scrollLeft-S.wheelStartX,We=j.scrollTop-S.wheelStartY,ze=We&&S.wheelDY&&We/S.wheelDY||Ie&&S.wheelDX&&Ie/S.wheelDX;if(S.wheelStartX=S.wheelStartY=null,!ze)return;fr=(fr*zi+ze)/(zi+1),++zi},200)):(S.wheelDX+=r,S.wheelDY+=i))}var hr=function(e,t){this.ranges=e,this.primIndex=t};hr.prototype.primary=function(){return this.ranges[this.primIndex]},hr.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(!qr(n.anchor,r.anchor)||!qr(n.head,r.head))return!1}return!0},hr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new wt(en(this.ranges[t].anchor),en(this.ranges[t].head));return new hr(e,this.primIndex)},hr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},hr.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 bn(this.anchor,this.head)},wt.prototype.to=function(){return tn(this.anchor,this.head)},wt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Er(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(xe,ye){return dt(xe.from(),ye.from())}),n=Z(t,i);for(var S=1;S<t.length;S++){var j=t[S],z=t[S-1],V=dt(z.to(),j.from());if(r&&!j.empty()?V>0:V>=0){var X=bn(z.from(),j.from()),oe=tn(z.to(),j.to()),le=z.empty()?j.from()==j.head:z.from()==z.head;S<=n&&--n,t.splice(--S,2,new wt(le?oe:X,le?X:oe))}}return new hr(t,n)}function zr(e,t){return new hr([new wt(e,t||e)],0)}function Vr(e){return e.text?Ne(e.from.line+e.text.length-1,$(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Mo(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(Mo(i.anchor,t),Mo(i.head,t)))}return Er(e.cm,n,e.sel.primIndex)}function Io(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),S=i,j=0;j<t.length;j++){var z=t[j],V=Io(z.from,i,S),X=Io(Vr(z),i,S);if(i=z.to,S=X,n=="around"){var oe=e.sel.ranges[j],le=dt(oe.head,oe.anchor)<0;r[j]=new wt(le?X:V,le?V:X)}else r[j]=new wt(V,V)}return new hr(r,e.sel.primIndex)}function _a(e){e.doc.mode=Tr(e.options,e.doc.modeOption),di(e)}function di(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,li(e,100),e.state.modeGen++,e.curOp&&tr(e)}function Fo(e,t){return t.from.ch==0&&t.to.ch==0&&$(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ma(e,t,n,r){function i(Qe){return n?n[Qe]:null}function S(Qe,Ve,tt){la(Qe,Ve,tt,r),Dt(Qe,"change",Qe,t)}function j(Qe,Ve){for(var tt=[],ut=Qe;ut<Ve;++ut)tt.push(new Hr(X[ut],i(ut),r));return tt}var z=t.from,V=t.to,X=t.text,oe=it(e,z.line),le=it(e,V.line),xe=$(X),ye=i(X.length-1),Pe=V.line-z.line;if(t.full)e.insert(0,j(0,X.length)),e.remove(X.length,e.size-X.length);else if(Fo(e,t)){var Ie=j(0,X.length-1);S(le,le.text,ye),Pe&&e.remove(z.line,Pe),Ie.length&&e.insert(z.line,Ie)}else if(oe==le)if(X.length==1)S(oe,oe.text.slice(0,z.ch)+xe+oe.text.slice(V.ch),ye);else{var We=j(1,X.length-1);We.push(new Hr(xe+oe.text.slice(V.ch),ye,r)),S(oe,oe.text.slice(0,z.ch)+X[0],i(0)),e.insert(z.line+1,We)}else if(X.length==1)S(oe,oe.text.slice(0,z.ch)+X[0]+le.text.slice(V.ch),i(0)),e.remove(z.line+1,Pe);else{S(oe,oe.text.slice(0,z.ch)+X[0],i(0)),S(le,xe+le.text.slice(V.ch),ye);var ze=j(1,X.length-1);Pe>1&&e.remove(z.line+1,Pe-1),e.insert(z.line+1,ze)}Dt(e,"change",e,t)}function Xr(e,t,n){function r(i,S,j){if(i.linked)for(var z=0;z<i.linked.length;++z){var V=i.linked[z];if(V.doc==S)continue;var X=j&&V.sharedHist;if(n&&!X)continue;t(V.doc,X),r(V.doc,i,X)}}r(e,null,!0)}function No(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ta(e),_a(e),Uo(e),e.options.lineWrapping||Pr(e),e.options.mode=t.modeOption,tr(e)}function Uo(e){(e.doc.direction=="rtl"?F:h)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){ur(e,function(){Uo(e),tr(e)})}function Vi(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 Ia(e,t){var n={from:en(t.from),to:Vr(t),text:Sr(e,t.from,t.to)};return Wo(e,n,t.from.line,t.to.line+1),Xr(e,function(r){return Wo(r,n,t.from.line,t.to.line+1)},!0),n}function Bo(e){for(;e.length;){var t=$(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Bo(e.done),$(e.done);if(e.done.length&&!$(e.done).ranges)return $(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),$(e.done)}function jo(e,t,n,r){var i=e.history;i.undone.length=0;var S=+new Date,j,z;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>S-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(j=pl(i,i.lastOp==r)))z=$(j.changes),dt(t.from,t.to)==0&&dt(t.from,z.to)==0?z.to=Vr(t):j.changes.push(Ia(e,t));else{var V=$(i.done);for((!V||!V.ranges)&&Xi(e.sel,i.done),j={changes:[Ia(e,t)],generation:i.generation},i.done.push(j);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=S,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,z||Le(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,S=r&&r.origin;n==i.lastSelOp||S&&i.lastSelOrigin==S&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==S||ml(e,S,$(i.done),t))?i.done[i.done.length-1]=t:Xi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=S,i.lastSelOp=n,r&&r.clearRedo!==!1&&Bo(i.undone)}function Xi(e,t){var n=$(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Wo(e,t,n,r){var i=t["spans_"+e.id],S=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(j){j.markedSpans&&((i||(i=t["spans_"+e.id]={}))[S]=j.markedSpans),++S})}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 Ho(e,t){var n=yl(e,t),r=Or(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var S=n[i],j=r[i];if(S&&j){e:for(var z=0;z<j.length;++z){for(var V=j[z],X=0;X<S.length;++X)if(S[X].marker==V.marker)continue e;S.push(V)}}else j&&(n[i]=j)}return n}function In(e,t,n){for(var r=[],i=0;i<e.length;++i){var S=e[i];if(S.ranges){r.push(n?hr.prototype.deepCopy.call(S):S);continue}var j=S.changes,z=[];r.push({changes:z});for(var V=0;V<j.length;++V){var X=j[V],oe=void 0;if(z.push({from:X.from,to:X.to,text:X.text}),t)for(var le in X)(oe=le.match(/^spans_(\d+)$/))&&(Z(t,Number(oe[1]))>-1&&($(z)[le]=X[le],delete X[le]))}}return r}function Fa(e,t,n,r){if(r){var i=e.anchor;if(n){var S=dt(t,i)<0;S!=dt(n,i)<0?(i=t,t=n):S!=dt(t,n)<0&&(t=n)}return new wt(i,t)}else return new wt(n||t,t)}function Yi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Qt(e,new hr([Fa(e.sel.primary(),t,n,i)],0),r)}function Ko(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),S=0;S<e.sel.ranges.length;S++)r[S]=Fa(e.sel.ranges[S],t[S],null,i);var j=Er(e.cm,r,e.sel.primIndex);Qt(e,j,n)}function Na(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Qt(e,Er(e.cm,i,e.sel.primIndex),r)}function Go(e,t,n,r){Qt(e,zr(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var S=0;S<i.length;S++)this.ranges[S]=new wt(ft(e,i[S].anchor),ft(e,i[S].head))},origin:n&&n.origin};return Le(e,"beforeSelectionChange",e,r),e.cm&&Le(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Er(e.cm,r.ranges,r.ranges.length-1):t}function zo(e,t,n){var r=e.history.done,i=$(r);i&&i.ranges?(r[r.length-1]=t,$i(e,t,n)):Qt(e,t,n)}function Qt(e,t,n){$i(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function $i(e,t,n){(de(e,"beforeSelectionChange")||e.cm&&de(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(dt(t.primary().head,e.sel.primary().head)<0?-1:1);Vo(e,Yo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&_n(e.cm)}function Vo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ge(e.cm)),Dt(e,"cursorActivity",e)}function Xo(e){Vo(e,Yo(e,e.sel,null,!1))}function Yo(e,t,n,r){for(var i,S=0;S<t.ranges.length;S++){var j=t.ranges[S],z=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[S],V=Qi(e,j.anchor,z&&z.anchor,n,r),X=Qi(e,j.head,z&&z.head,n,r);(i||V!=j.anchor||X!=j.head)&&(i||(i=t.ranges.slice(0,S)),i[S]=new wt(V,X))}return i?Er(e.cm,i,t.primIndex):t}function Fn(e,t,n,r,i){var S=it(e,t.line);if(S.markedSpans)for(var j=0;j<S.markedSpans.length;++j){var z=S.markedSpans[j],V=z.marker,X="selectLeft"in V?!V.selectLeft:V.inclusiveLeft,oe="selectRight"in V?!V.selectRight:V.inclusiveRight;if((z.from==null||(X?z.from<=t.ch:z.from<t.ch))&&(z.to==null||(oe?z.to>=t.ch:z.to>t.ch))){if(i&&(Le(V,"beforeCursorEnter"),V.explicitlyCleared))if(S.markedSpans){--j;continue}else break;if(!V.atomic)continue;if(n){var le=V.find(r<0?1:-1),xe=void 0;if((r<0?oe:X)&&(le=$o(e,le,-r,le&&le.line==t.line?S:null)),le&&le.line==t.line&&(xe=dt(le,n))&&(r<0?xe<0:xe>0))return Fn(e,le,t,r,i)}var ye=V.find(r<0?-1:1);return(r<0?X:oe)&&(ye=$o(e,ye,r,ye.line==t.line?S:null)),ye?Fn(e,ye,t,r,i):null}}return t}function Qi(e,t,n,r,i){var S=r||1,j=Fn(e,t,n,S,i)||!i&&Fn(e,t,n,S,!0)||Fn(e,t,n,-S,i)||!i&&Fn(e,t,n,-S,!0);return j||(e.cantEdit=!0,Ne(e.first,0))}function $o(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||it(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 Qo(e){e.setSelection(Ne(e.firstLine(),0),Ne(e.lastLine()),me)}function Jo(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,S,j,z){i&&(r.from=ft(e,i)),S&&(r.to=ft(e,S)),j&&(r.text=j),z!==void 0&&(r.origin=z)}),Le(e,"beforeChange",e,r),e.cm&&Le(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Nn(e,t,n){if(e.cm){if(!e.cm.curOp)return Gt(e.cm,Nn)(e,t,n);if(e.cm.state.suppressEdits)return}if((de(e,"beforeChange")||e.cm&&de(e.cm,"beforeChange"))&&(t=Jo(e,t,!0),!t))return;var r=Pi&&!n&&oa(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Zo(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Zo(e,t)}function Zo(e,t){if(t.text.length==1&&t.text[0]==""&&dt(t.from,t.to)==0)return;var n=ka(e,t);jo(e,t,n,e.cm?e.cm.curOp.id:NaN),ci(e,t,n,Or(e,t));var r=[];Xr(e,function(i,S){!S&&Z(r,i.history)==-1&&(rs(i.history,t),r.push(i.history)),ci(i,t,null,Or(i,t))})}function Ji(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,S,j=e.sel,z=t=="undo"?i.done:i.undone,V=t=="undo"?i.undone:i.done,X=0;X<z.length&&!(S=z[X],n?S.ranges&&!S.equals(e.sel):!S.ranges);X++);if(X==z.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(S=z.pop(),S.ranges){if(Xi(S,V),n&&!S.equals(e.sel)){Qt(e,S,{clearRedo:!1});return}j=S}else if(r){z.push(S);return}else break;var oe=[];Xi(j,V),V.push({changes:oe,generation:i.generation}),i.generation=S.generation||++i.maxGeneration;for(var le=de(e,"beforeChange")||e.cm&&de(e.cm,"beforeChange"),xe=function(Ie){var We=S.changes[Ie];if(We.origin=t,le&&!Jo(e,We,!1))return z.length=0,{};oe.push(Ia(e,We));var ze=Ie?ka(e,We):$(z);ci(e,We,ze,Ho(e,We)),!Ie&&e.cm&&e.cm.scrollIntoView({from:We.from,to:Vr(We)});var Qe=[];Xr(e,function(Ve,tt){!tt&&Z(Qe,Ve.history)==-1&&(rs(Ve.history,We),Qe.push(Ve.history)),ci(Ve,We,null,Ho(Ve,We))})},ye=S.changes.length-1;ye>=0;--ye){var Pe=xe(ye);if(Pe)return Pe.v}}function qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new hr(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 ci(e,t,n,r){if(e.cm&&!e.cm.curOp)return Gt(e.cm,ci)(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:[$(t.text)],origin:t.origin}}var S=e.lastLine();t.to.line>S&&(t={from:t.from,to:Ne(S,it(e,S).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Sr(e,t.from,t.to),n||(n=ka(e,t)),e.cm?El(e.cm,t,r):Ma(e,t,r),$i(e,n,me),e.cantEdit&&Qi(e,Ne(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,S=t.from,j=t.to,z=!1,V=S.line;e.options.lineWrapping||(V=St($t(it(r,S.line))),r.iter(V,j.line+1,function(ye){if(ye==i.maxLine)return z=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ge(e),Ma(r,t,n,go(e)),e.options.lineWrapping||(r.iter(V,S.line+t.text.length,function(ye){var Pe=Dn(ye);Pe>i.maxLineLength&&(i.maxLine=ye,i.maxLineLength=Pe,i.maxLineChanged=!0,z=!1)}),z&&(e.curOp.updateMaxLine=!0)),Oi(r,S.line),li(e,400);var X=t.text.length-(j.line-S.line)-1;t.full?tr(e):S.line==j.line&&t.text.length==1&&!Fo(e.doc,t)?Kr(e,S.line,"text"):tr(e,S.line,j.line+1,X);var oe=de(e,"changes"),le=de(e,"change");if(le||oe){var xe={from:S,to:j,text:t.text,removed:t.removed,origin:t.origin};le&&Dt(e,"change",e,xe),oe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(xe)}e.display.selForContextMenu=null}function Un(e,t,n,r,i){var S;r||(r=n),dt(r,n)<0&&(S=[r,n],n=S[0],r=S[1]),typeof t=="string"&&(t=e.splitLines(t)),Nn(e,{from:n,to:r,text:t,origin:i})}function es(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function ts(e,t,n,r){for(var i=0;i<e.length;++i){var S=e[i],j=!0;if(S.ranges){S.copied||(S=e[i]=S.deepCopy(),S.copied=!0);for(var z=0;z<S.ranges.length;z++)es(S.ranges[z].anchor,t,n,r),es(S.ranges[z].head,t,n,r);continue}for(var V=0;V<S.changes.length;++V){var X=S.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){j=!1;break}}j||(e.splice(0,i+1),i=0)}}function rs(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;ts(e.done,n,r,i),ts(e.undone,n,r,i)}function fi(e,t,n,r){var i=t,S=t;return typeof t=="number"?S=it(e,Xn(e,t)):i=St(t),i==null?null:(r(S,i)&&e.cm&&Kr(e.cm,i,n),S)}function hi(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}hi.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,ua(i),Dt(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 pi(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}pi.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 S=Math.min(t,i-e),j=r.height;if(r.removeInner(e,S),this.height-=j-r.height,i==S&&(this.children.splice(n--,1),r.parent=null),(t-=S)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof hi))){var z=[];this.collapse(z),this.children=[new hi(z)],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],S=i.chunkSize();if(e<=S){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var j=i.lines.length%25+25,z=j;z<i.lines.length;){var V=new hi(i.lines.slice(z,z+=25));i.height-=V.height,this.children.splice(++r,0,V),V.parent=this}i.lines=i.lines.slice(0,j),this.maybeSpill()}break}e-=S}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new pi(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=Z(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new pi(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],S=i.chunkSize();if(e<S){var j=Math.min(t,S-e);if(i.iterN(e,j,n))return!0;if((t-=j)==0)break;e=0}else e-=S}}};var mi=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};mi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=St(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 S=ti(this);cr(n,Math.max(0,n.height-S)),e&&(ur(e,function(){ns(e,n,-S),Kr(e,r,"widget")}),Dt(e,"lineWidgetCleared",e,this,r))},mi.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ti(this)-t;if(!i)return;yr(this.doc,r)||cr(r,r.height+i),n&&ur(n,function(){n.curOp.forceUpdate=!0,ns(n,r,i),Dt(n,"lineWidgetChanged",n,e,St(r))})},ce(mi);function ns(e,t,n){lr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Aa(e,n)}function xl(e,t,n,r){var i=new mi(e,n,r),S=e.cm;return S&&i.noHScroll&&(S.display.alignWidgets=!0),fi(e,t,"widget",function(j){var z=j.widgets||(j.widgets=[]);if(i.insertAt==null?z.push(i):z.splice(Math.min(z.length-1,Math.max(0,i.insertAt)),0,i),i.line=j,S&&!yr(e,j)){var V=lr(j)<e.scrollTop;cr(j,j.height+ti(i)),V&&Aa(S,i.height),S.curOp.forceUpdate=!0}return!0}),S&&Dt(S,"lineWidgetAdded",S,i,typeof t=="number"?t:St(t)),i}var is=0,Yr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++is};Yr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&hn(e),de(this,"clear")){var n=this.find();n&&Dt(this,"clear",n.from,n.to)}for(var r=null,i=null,S=0;S<this.lines.length;++S){var j=this.lines[S],z=Nr(j.markedSpans,this);e&&!this.collapsed?Kr(e,St(j),"text"):e&&(z.to!=null&&(i=St(j)),z.from!=null&&(r=St(j))),j.markedSpans=Ur(j.markedSpans,z),z.from==null&&this.collapsed&&!yr(this.doc,j)&&e&&cr(j,On(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var V=0;V<this.lines.length;++V){var X=$t(this.lines[V]),oe=Dn(X);oe>e.display.maxLineLength&&(e.display.maxLine=X,e.display.maxLineLength=oe,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&&Xo(e.doc)),e&&Dt(e,"markerCleared",e,this,r,i),t&&pn(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 S=this.lines[i],j=Nr(S.markedSpans,this);if(j.from!=null&&(n=Ne(t?S:St(S),j.from),e==-1))return n;if(j.to!=null&&(r=Ne(t?S:St(S),j.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;ur(r,function(){var i=t.line,S=St(t.line),j=pa(r,S);if(j&&(so(j),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!yr(n.doc,i)&&n.height!=null){var z=n.height;n.height=null;var V=ti(n)-z;V&&cr(i,i.height+V)}Dt(r,"markerChanged",r,e)})},Yr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||Z(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Yr.prototype.detachLine=function(e){if(this.lines.splice(Z(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ce(Yr);function Bn(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Gt(e.cm,Bn)(e,t,n,r,i);var S=new Yr(e,i),j=dt(t,n);if(r&&M(r,S,!1),j>0||j==0&&S.clearWhenEmpty!==!1)return S;if(S.replacedWith&&(S.collapsed=!0,S.widgetNode=x("span",[S.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||S.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(S.widgetNode.insertLeft=!0)),S.collapsed){if(qn(e,t.line,t,n,S)||t.line!=n.line&&qn(e,n.line,t,n,S))throw new Error("Inserting collapsed marker partially overlapping an existing one");ki()}S.addToHistory&&jo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var z=t.line,V=e.cm,X;if(e.iter(z,n.line+1,function(le){V&&S.collapsed&&!V.options.lineWrapping&&$t(le)==V.display.maxLine&&(X=!0),S.collapsed&&z!=t.line&&cr(le,0),Br(le,new xn(S,z==t.line?t.ch:null,z==n.line?n.ch:null)),++z}),S.collapsed&&e.iter(t.line,n.line+1,function(le){yr(e,le)&&cr(le,0)}),S.clearOnEnter&&we(S,"beforeCursorEnter",function(){return S.clear()}),S.readOnly&&(Cr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),S.collapsed&&(S.id=++is,S.atomic=!0),V){if(X&&(V.curOp.updateMaxLine=!0),S.collapsed)tr(V,t.line,n.line+1);else if(S.className||S.startStyle||S.endStyle||S.css||S.attributes||S.title)for(var oe=t.line;oe<=n.line;oe++)Kr(V,oe,"text");S.atomic&&Xo(V.doc),Dt(V,"markerAdded",V,S)}return S}var gi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};gi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Dt(this,"clear")},gi.prototype.find=function(e,t){return this.primary.find(e,t)},ce(gi);function Tl(e,t,n,r,i){r=M(r),r.shared=!1;var S=[Bn(e,t,n,r,i)],j=S[0],z=r.widgetNode;return Xr(e,function(V){z&&(r.widgetNode=z.cloneNode(!0)),S.push(Bn(V,ft(V,t),ft(V,n),r,i));for(var X=0;X<V.linked.length;++X)if(V.linked[X].isParent)return;j=$(S)}),new gi(S,j)}function as(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(),S=e.clipPos(i.from),j=e.clipPos(i.to);if(dt(S,j)){var z=Bn(e,S,j,r.primary,r.primary.type);r.markers.push(z),z.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],S=[i.primary.doc];Xr(i.primary.doc,function(V){return S.push(V)});for(var j=0;j<i.markers.length;j++){var z=i.markers[j];Z(S,z.doc)==-1&&(z.parent=null,i.markers.splice(j--,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),pi.call(this,[new hi([new Hr("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var S=Ne(n,0);this.sel=zr(S),this.history=new Vi(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)),Ma(this,{from:S,to:S,text:e}),Qt(this,zr(S),me)};rr.prototype=Ce(pi.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=Vn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:zt(function(e){var t=Ne(this.first,0),n=this.first+this.size-1;Nn(this,{from:t,to:Ne(n,it(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&ii(this.cm,0,0),Qt(this,zr(t),me)}),replaceRange:function(e,t,n,r){t=ft(this,t),n=n?ft(this,n):t,Un(this,e,t,n,r)},getRange:function(e,t,n){var r=Sr(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(Zr(this,e))return it(this,e)},getLineNumber:function(e){return St(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=it(this,e)),$t(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:zt(function(e,t,n){Go(this,ft(this,typeof e=="number"?Ne(e,t||0):e),null,n)}),setSelection:zt(function(e,t,n){Go(this,ft(this,e),ft(this,t||e),n)}),extendSelection:zt(function(e,t,n){Yi(this,ft(this,e),t&&ft(this,t),n)}),extendSelections:zt(function(e,t){Ko(this,Ai(this,e),t)}),extendSelectionsBy:zt(function(e,t){var n=ae(this.sel.ranges,e);Ko(this,Ai(this,n),t)}),setSelections:zt(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)),Qt(this,Er(this.cm,r,t),n)}),addSelection:zt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new wt(ft(this,e),ft(this,t||e))),Qt(this,Er(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=Sr(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=Sr(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:zt(function(e,t,n){for(var r=[],i=this.sel,S=0;S<i.ranges.length;S++){var j=i.ranges[S];r[S]={from:j.from(),to:j.to(),text:this.splitLines(e[S]),origin:n}}for(var z=t&&t!="end"&&fl(this,r,t),V=r.length-1;V>=0;V--)Nn(this,r[V]);z?zo(this,z):this.cm&&_n(this.cm)}),undo:zt(function(){Ji(this,"undo")}),redo:zt(function(){Ji(this,"redo")}),undoSelection:zt(function(){Ji(this,"undo",!0)}),redoSelection:zt(function(){Ji(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 Vi(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:In(this.history.done),undone:In(this.history.undone)}},setHistory:function(e){var t=this.history=new Vi(this.history.maxGeneration);t.done=In(e.done.slice(0),null,!0),t.undone=In(e.undone.slice(0),null,!0)},setGutterMarker:zt(function(e,t,n){return fi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&_e(i)&&(r.gutterMarkers=null),!0})}),clearGutter:zt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&fi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,_e(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Zr(this,e))return null;if(t=e,e=it(this,e),!e)return null}else if(t=St(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:zt(function(e,t,n){return fi(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(T(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:zt(function(e,t,n){return fi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",S=r[i];if(S)if(n==null)r[i]=null;else{var j=S.match(T(n));if(!j)return!1;var z=j.index+j[0].length;r[i]=S.slice(0,j.index)+(!j.index||z==S.length?"":" ")+S.slice(z)||null}else return!1;return!0})}),addLineWidget:zt(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Bn(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),Bn(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ft(this,e);var t=[],n=it(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(S){var j=S.markedSpans;if(j)for(var z=0;z<j.length;z++){var V=j[z];!(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 S=i.text.length+r;if(S>e)return t=e,!0;e-=S,++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(Vn(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(Vn(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,as(this)),r},unlinkDoc:function(e){if(e instanceof kt&&(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(as(this));break}if(e.history==this.history){var r=[e.id];Xr(e,function(i){return r.push(i.id)},!0),e.history=new Vi(null),e.history.done=In(this.history.done,r),e.history.undone=In(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):at(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:zt(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 os=0;function Al(e){var t=this;if(ss(t),Fe(t,e)||_r(t.display,e))return;Q(e),B&&(os=+new Date);var n=un(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,S=Array(i),j=0,z=function(){++j==i&&Gt(t,function(){n=ft(t.doc,n);var ye={from:n,to:n,text:t.doc.splitLines(S.filter(function(Pe){return Pe!=null}).join(t.doc.lineSeparator())),origin:"paste"};Nn(t.doc,ye),zo(t.doc,zr(ft(t.doc,n),ft(t.doc,Vr(ye))))})()},V=function(ye,Pe){if(t.options.allowDropFileTypes&&Z(t.options.allowDropFileTypes,ye.type)==-1){z();return}var Ie=new FileReader;Ie.onerror=function(){return z()},Ie.onload=function(){var We=Ie.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(We)){z();return}S[Pe]=We,z()},Ie.readAsText(ye)},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 oe=e.dataTransfer.getData("Text");if(oe){var le;if(t.state.draggingText&&!t.state.draggingText.copy&&(le=t.listSelections()),$i(t.doc,zr(n,n)),le)for(var xe=0;xe<le.length;++xe)Un(t.doc,"",le[xe].anchor,le[xe].head,"drag");t.replaceSelection(oe,"around","paste"),t.display.input.focus()}}catch(ye){}}}function Ll(e,t){if(B&&(!e.state.draggingText||+new Date-os<100)){se(t);return}if(Fe(e,t)||_r(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!P){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",v&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),v&&n.parentNode.removeChild(n)}}function Dl(e,t){var n=un(e,t);if(!n)return;var r=document.createDocumentFragment();bo(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)),u(e.display.dragCursor,r)}function ss(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ls(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var S=0;S<n.length;S++)e(n[S])})}var us=!1;function Rl(){if(us)return;Ol(),us=!0}function Ol(){var e;we(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ls(Pl)},100))}),we(window,"blur",function(){return ls(kn)})}function Pl(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"},vi=0;vi<10;vi++)$r[vi+48]=$r[vi+96]=String(vi);for(var Zi=65;Zi<=90;Zi++)$r[Zi]=String.fromCharCode(Zi);for(var yi=1;yi<=12;yi++)$r[yi+111]=$r[yi+63235]="F"+yi;var Mr={};Mr.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"},Mr.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"},Mr.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"},Mr.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"]},Mr.default=s?Mr.macDefault:Mr.pcDefault;function kl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,S,j=0;j<t.length-1;j++){var z=t[j];if(/^(cmd|meta|m)$/i.test(z))S=!0;else if(/^a(lt)?$/i.test(z))n=!0;else if(/^(c|ctrl|control)$/i.test(z))r=!0;else if(/^s(hift)?$/i.test(z))i=!0;else throw new Error("Unrecognized modifier name: "+z)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),S&&(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(" "),kl),S=0;S<i.length;S++){var j=void 0,z=void 0;S==i.length-1?(z=i.join(" "),j=r):(z=i.slice(0,S+1).join(" "),j="...");var V=t[z];if(!V)t[z]=j;else if(V!=j)throw new Error("Inconsistent bindings for "+z)}delete e[n]}for(var X in t)e[X]=t[X];return e}function jn(e,t,n,r){t=qi(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 jn(e,t.fallthrough,n,r);for(var S=0;S<t.fallthrough.length;S++){var j=jn(e,t.fallthrough[S],n,r);if(j)return j}}}function ds(e){var t=typeof e=="string"?e:$r[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function cs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(m?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(m?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function fs(e,t){if(v&&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),cs(n,e,t))}function qi(e){return typeof e=="string"?Mr[e]:e}function Wn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var S=t(n[i]);r.length&&dt(S.from,$(r).to)<=0;){var j=r.pop();if(dt(j.from,S.from)<0){S.from=j.from;break}}r.push(S)}ur(e,function(){for(var z=r.length-1;z>=0;z--)Un(e.doc,"",r[z].from,r[z].to,"+delete");_n(e)})}function Ua(e,t,n){var r=Ae(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ba(e,t,n){var r=Ua(e,t.ch,n);return r==null?null:new Ne(t.line,r,n<0?"after":"before")}function ja(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var S=Je(n,t.doc.direction);if(S){var j=i<0?$(S):S[0],z=i<0==(j.level==1),V=z?"after":"before",X;if(j.level>0||t.doc.direction=="rtl"){var oe=Rn(t,n);X=i<0?n.text.length-1:0;var le=Lr(t,oe,X).top;X=Ue(function(xe){return Lr(t,oe,xe).top==le},i<0==(j.level==1)?j.from:j.to-1,X),V=="before"&&(X=Ua(n,X,1))}else X=i<0?j.to:j.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 Ba(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 S=He(i,n.ch,n.sticky),j=i[S];if(e.doc.direction=="ltr"&&j.level%2==0&&(r>0?j.to>n.ch:j.from<n.ch))return Ba(t,n,r);var z=function(ze,Qe){return Ua(t,ze instanceof Ne?ze.ch:ze,Qe)},V,X=function(ze){return e.options.lineWrapping?(V=V||Rn(e,t),mo(e,t,V,ze)):{begin:0,end:t.text.length}},oe=X(n.sticky=="before"?z(n,-1):n.ch);if(e.doc.direction=="rtl"||j.level==1){var le=j.level==1==r<0,xe=z(n,le?1:-1);if(xe!=null&&(le?xe<=j.to&&xe<=oe.end:xe>=j.from&&xe>=oe.begin)){var ye=le?"before":"after";return new Ne(n.line,xe,ye)}}var Pe=function(ze,Qe,Ve){for(var tt=function(Ot,Vt){return Vt?new Ne(n.line,z(Ot,1),"before"):new Ne(n.line,Ot,"after")};ze>=0&&ze<i.length;ze+=Qe){var ut=i[ze],ot=Qe>0==(ut.level!=1),gt=ot?Ve.begin:z(Ve.end,-1);if(ut.from<=gt&><ut.to)return tt(gt,ot);if(gt=ot?ut.from:z(ut.to,-1),Ve.begin<=gt&><Ve.end)return tt(gt,ot)}},Ie=Pe(S+r,r,oe);if(Ie)return Ie;var We=r>0?oe.end:z(oe.begin,-1);return We!=null&&!(r>0&&We==t.text.length)&&(Ie=Pe(r>0?0:i.length-1,r,X(We)),Ie)?Ie:null}var bi={selectAll:Qo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),me)},killLine:function(e){return Wn(e,function(t){if(t.empty()){var n=it(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 Wn(e,function(t){return{from:Ne(t.from().line,0),to:ft(e.doc,Ne(t.to().line+1,0))}})},delLineLeft:function(e){return Wn(e,function(t){return{from:Ne(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Wn(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 Wn(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 hs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ps(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},ue)},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")},ue)},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/)?ps(e,t.head):r},ue)},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 S=n[i].from(),j=G(e.getLine(S.line),S.ch,r);t.push(he(r-j%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return ur(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,S=it(e.doc,i.line).text;if(S){if(i.ch==S.length&&(i=new Ne(i.line,i.ch-1)),i.ch>0)i=new Ne(i.line,i.ch+1),e.replaceRange(S.charAt(i.ch-1)+S.charAt(i.ch-2),Ne(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var j=it(e.doc,i.line-1).text;j&&(i=new Ne(i.line,1),e.replaceRange(S.charAt(0)+e.doc.lineSeparator()+j.charAt(j.length-1),Ne(i.line-1,j.length-1),i,"+transpose"))}}n.push(new wt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return ur(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);_n(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function hs(e,t){var n=it(e.doc,t),r=$t(n);return r!=n&&(t=St(r)),ja(!0,e,r,t,1)}function Il(e,t){var n=it(e.doc,t),r=jr(n);return r!=n&&(t=St(r)),ja(!0,e,n,t,-1)}function ps(e,t){var n=hs(e,t.line),r=it(e.doc,n.line),i=Je(r,e.doc.direction);if(!i||i[0].level==0){var S=Math.max(n.ch,r.text.search(/\S/)),j=t.line==n.line&&t.ch<=S&&t.ch;return Ne(n.line,j?0:S,n.sticky)}return n}function ea(e,t,n){if(typeof t=="string"&&(t=bi[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)!=be}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=jn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&jn(t,e.options.extraKeys,n,e)||jn(t,e.options.keyMap,n,e)}var Nl=new Y;function Ei(e,t,n,r){var i=e.state.keySeq;if(i){if(ds(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Nl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),ms(e,i+" "+t,n,r))return!0}return ms(e,t,n,r)}function ms(e,t,n,r){var i=Fl(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Dt(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(Q(n),Sa(e)),!!i}function gs(e,t){var n=fs(t,!0);return n?t.shiftKey&&!e.state.keySeq?Ei(e,"Shift-"+n,t,function(r){return ea(e,r,!0)})||Ei(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return ea(e,r)}):Ei(e,n,t,function(r){return ea(e,r)}):!1}function Ul(e,t,n){return Ei(e,"'"+n+"'",t,function(r){return ea(e,r,!0)})}var Wa=null;function vs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=k(),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=gs(t,e);v&&(Wa=r?n:null,!r&&n==88&&!xt&&(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)&&(h(t,"CodeMirror-crosshair"),$e(document,"keyup",n),$e(document,"mouseover",n))}we(document,"keyup",n),we(document,"mouseover",n)}function ys(e){e.keyCode==16&&(this.doc.sel.shift=!1),Fe(this,e)}function bs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(_r(t.display,e)||Fe(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(v&&n==Wa){Wa=null,Q(e);return}if(v&&(!e.which||e.which<10)&&gs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Ul(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Ha=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ha.prototype.compare=function(e,t,n){return this.time+jl>e&&dt(t,this.pos)==0&&n==this.button};var xi,Ti;function Wl(e,t){var n=+new Date;return Ti&&Ti.compare(n,e,t)?(xi=Ti=null,"triple"):xi&&xi.compare(n,e,t)?(Ti=new Ha(n,e,t),xi=null,"double"):(xi=new Ha(n,e,t),Ti=null,"single")}function Es(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,_r(n,e)){R||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ka(t,e))return;var r=un(t,e),i=Oe(e),S=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,S,e))return;i==1?r?Gl(t,r,S,e):Te(e)==n.scroller&&Q(e):i==2?(r&&Yi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(D?t.display.input.onContextMenu(e):xo(t))}function Hl(e,t,n,r,i){var S="Click";return r=="double"?S="Double"+S:r=="triple"&&(S="Triple"+S),S=(t==1?"Left":t==2?"Middle":"Right")+S,Ei(e,cs(S,i),i,function(j){if(typeof j=="string"&&(j=bi[j]),!j)return!1;var z=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),z=j(e,n)!=be}finally{e.state.suppressEdits=!1}return z})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var S=d?n.shiftKey&&n.metaKey:n.altKey;i.unit=S?"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(_(Eo,e),0):e.curOp.focus=k();var i=Kl(e,n,r),S=e.doc.sel,j;e.options.dragDrop&&je&&!e.isReadOnly()&&n=="single"&&(j=S.contains(t))>-1&&(dt((j=S.ranges[j]).from(),t)<0||t.xRel>0)&&(dt(j.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,S=!1,j=Gt(e,function(X){R&&(i.scroller.draggable=!1),e.state.draggingText=!1,$e(i.wrapper.ownerDocument,"mouseup",j),$e(i.wrapper.ownerDocument,"mousemove",z),$e(i.scroller,"dragstart",V),$e(i.scroller,"drop",j),S||(Q(X),r.addNew||Yi(e.doc,n,null,null,r.extend),R&&!P||B&&N==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),z=function(X){S=S||Math.abs(t.clientX-X.clientX)+Math.abs(t.clientY-X.clientY)>=10},V=function(){return S=!0};R&&(i.scroller.draggable=!0),e.state.draggingText=j,j.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),we(i.wrapper.ownerDocument,"mouseup",j),we(i.wrapper.ownerDocument,"mousemove",z),we(i.scroller,"dragstart",V),we(i.scroller,"drop",j),xo(e),setTimeout(function(){return i.input.focus()},20)}function xs(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,S=e.doc;Q(t);var j,z,V=S.sel,X=V.ranges;if(r.addNew&&!r.extend?(z=S.sel.contains(n),z>-1?j=X[z]:j=new wt(n,n)):(j=S.sel.primary(),z=S.sel.primIndex),r.unit=="rectangle")r.addNew||(j=new wt(n,n)),n=un(e,t,!0,!0),z=-1;else{var oe=xs(e,n,r.unit);r.extend?j=Fa(j,oe.anchor,oe.head,r.extend):j=oe}r.addNew?z==-1?(z=X.length,Qt(S,Er(e,X.concat([j]),z),{scroll:!1,origin:"*mouse"})):X.length>1&&X[z].empty()&&r.unit=="char"&&!r.extend?(Qt(S,Er(e,X.slice(0,z).concat(X.slice(z+1)),0),{scroll:!1,origin:"*mouse"}),V=S.sel):Na(S,z,j,pe):(z=0,Qt(S,new hr([j],0),pe),V=S.sel);var le=n;function xe(Ve){if(dt(le,Ve)==0)return;if(le=Ve,r.unit=="rectangle"){for(var tt=[],ut=e.options.tabSize,ot=G(it(S,n.line).text,n.ch,ut),gt=G(it(S,Ve.line).text,Ve.ch,ut),Ot=Math.min(ot,gt),Vt=Math.max(ot,gt),Mt=Math.min(n.line,Ve.line),dr=Math.min(e.lastLine(),Math.max(n.line,Ve.line));Mt<=dr;Mt++){var nr=it(S,Mt).text,Bt=fe(nr,Ot,ut);Ot==Vt?tt.push(new wt(Ne(Mt,Bt),Ne(Mt,Bt))):nr.length>Bt&&tt.push(new wt(Ne(Mt,Bt),Ne(Mt,fe(nr,Vt,ut))))}tt.length||tt.push(new wt(n,n)),Qt(S,Er(e,V.ranges.slice(0,z).concat(tt),z),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ve)}else{var ir=j,Yt=xs(e,Ve,r.unit),Ht=ir.anchor,jt;dt(Yt.anchor,Ht)>0?(jt=Yt.head,Ht=bn(ir.from(),Yt.anchor)):(jt=Yt.anchor,Ht=tn(ir.to(),Yt.head));var Ft=V.ranges.slice(0);Ft[z]=Xl(e,new wt(ft(S,Ht),jt)),Qt(S,Er(e,Ft,z),pe)}}var ye=i.wrapper.getBoundingClientRect(),Pe=0;function Ie(Ve){var tt=++Pe,ut=un(e,Ve,!0,r.unit=="rectangle");if(!ut)return;if(dt(ut,le)!=0){e.curOp.focus=k(),xe(ut);var ot=Hi(i,S);(ut.line>=ot.to||ut.line<ot.from)&&setTimeout(Gt(e,function(){Pe==tt&&Ie(Ve)}),150)}else{var gt=Ve.clientY<ye.top?-20:Ve.clientY>ye.bottom?20:0;gt&&setTimeout(Gt(e,function(){if(Pe!=tt)return;i.scroller.scrollTop+=gt,Ie(Ve)}),50)}}function We(Ve){e.state.selectingText=!1,Pe=Infinity,Ve&&(Q(Ve),i.input.focus()),$e(i.wrapper.ownerDocument,"mousemove",ze),$e(i.wrapper.ownerDocument,"mouseup",Qe),S.history.lastSelOrigin=null}var ze=Gt(e,function(Ve){Ve.buttons===0||!Oe(Ve)?We(Ve):Ie(Ve)}),Qe=Gt(e,We);e.state.selectingText=Qe,we(i.wrapper.ownerDocument,"mousemove",ze),we(i.wrapper.ownerDocument,"mouseup",Qe)}function Xl(e,t){var n=t.anchor,r=t.head,i=it(e.doc,n.line);if(dt(n,r)==0&&n.sticky==r.sticky)return t;var S=Je(i);if(!S)return t;var j=He(S,n.ch,n.sticky),z=S[j];if(z.from!=n.ch&&z.to!=n.ch)return t;var V=j+(z.from==n.ch==(z.level!=1)?0:1);if(V==0||V==S.length)return t;var X;if(r.line!=n.line)X=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var oe=He(S,r.ch,r.sticky),le=oe-j||(r.ch-n.ch)*(z.level==1?-1:1);oe==V-1||oe==V?X=le<0:X=le>0}var xe=S[V+(X?-1:0)],ye=X==(xe.level==1),Pe=ye?xe.from:xe.to,Ie=ye?"after":"before";return n.ch==Pe&&n.sticky==Ie?t:new wt(new Ne(n.line,Pe,Ie),r)}function Ts(e,t,n,r){var i,S;if(t.touches)i=t.touches[0].clientX,S=t.touches[0].clientY;else try{i=t.clientX,S=t.clientY}catch(xe){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Q(t);var j=e.display,z=j.lineDiv.getBoundingClientRect();if(S>z.bottom||!de(e,n))return re(t);S-=z.top-j.viewOffset;for(var V=0;V<e.display.gutterSpecs.length;++V){var X=j.gutters.childNodes[V];if(X&&X.getBoundingClientRect().right>=i){var oe=wr(e.doc,S),le=e.display.gutterSpecs[V];return Le(e,n,e,oe,le.className,t),re(t)}}}function Ka(e,t){return Ts(e,t,"gutterClick",!0)}function Ss(e,t){if(_r(e.display,t)||Yl(e,t))return;if(Fe(e,t,"contextmenu"))return;D||e.display.input.onContextMenu(t)}function Yl(e,t){return de(e,"gutterContextMenu")?Ts(e,t,"gutterContextMenu",!1):!1}function ws(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ri(e)}var Hn={toString:function(){return"CodeMirror.Init"}},Cs={},ta={};function $l(e){var t=e.optionHandlers;function n(r,i,S,j){e.defaults[r]=i,S&&(t[r]=j?function(z,V,X){X!=Hn&&S(z,V,X)}:S)}e.defineOption=n,e.Init=Hn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,_a(r)},!0),n("indentUnit",2,_a,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){di(r),ri(r),tr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var S=[],j=r.doc.first;r.doc.iter(function(V){for(var X=0;;){var oe=V.text.indexOf(i,X);if(oe==-1)break;X=oe+i.length,S.push(Ne(j,oe))}j++});for(var z=S.length-1;z>=0;z--)Un(r.doc,i,S[z],Ne(S[z].line,S[z].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,S){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),S!=Hn&&r.refresh()}),n("specialCharPlaceholder",nt,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",!C),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){ws(r),ui(r)},!0),n("keyMap","default",function(r,i,S){var j=qi(i),z=S!=Hn&&qi(S);z&&z.detach&&z.detach(r,j),j.attach&&j.attach(r,z||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Pa(i,r.options.lineNumbers),ui(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?xa(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Mn(r)},!0),n("scrollbarStyle","native",function(r){Lo(r),Mn(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=Pa(r.options.gutters,i),ui(r)},!0),n("firstLineNumber",1,ui,!0),n("lineNumberFormatter",function(r){return r},ui,!0),n("showCursorWhenSelecting",!1,ni,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(kn(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,ni,!0),n("singleCursorHeightPerLine",!0,ni,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,di,!0),n("addModeClass",!1,di,!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,di,!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!=Hn;if(!t!=!r){var i=e.display.dragFunctions,S=t?we:$e;S(e.display.scroller,"dragstart",i.start),S(e.display.scroller,"dragenter",i.enter),S(e.display.scroller,"dragover",i.over),S(e.display.scroller,"dragleave",i.leave),S(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):(h(e.display.wrapper,"CodeMirror-wrap"),Pr(e)),Ta(e),tr(e),ri(e),setTimeout(function(){return Mn(e)},100)}function kt(e,t){var n=this;if(!(this instanceof kt))return new kt(e,t);this.options=t=t?M(t):{},M(Cs,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 kt.inputStyles[t.inputStyle](this),S=this.display=new dl(e,r,i,t);S.wrapper.CodeMirror=this,ws(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Lo(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new Y,keySeq:null,specialChars:null},t.autofocus&&!o&&S.input.focus(),B&&N<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Rl(),hn(this),this.curOp.forceUpdate=!0,No(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&wa(n)},20):kn(this);for(var j in ta)ta.hasOwnProperty(j)&&ta[j](this,t[j],Hn);Oo(this),t.finishInit&&t.finishInit(this);for(var z=0;z<Ga.length;++z)Ga[z](this);pn(this),R&&t.lineWrapping&&getComputedStyle(S.lineDiv).textRendering=="optimizelegibility"&&(S.lineDiv.style.textRendering="auto")}kt.defaults=Cs,kt.optionHandlers=ta;function Zl(e){var t=e.display;we(t.scroller,"mousedown",Gt(e,Es)),B&&N<11?we(t.scroller,"dblclick",Gt(e,function(V){if(Fe(e,V))return;var X=un(e,V);if(!X||Ka(e,V)||_r(e.display,V))return;Q(V);var oe=e.findWordAt(X);Yi(e.doc,oe.anchor,oe.head)})):we(t.scroller,"dblclick",function(V){return Fe(e,V)||Q(V)}),we(t.scroller,"contextmenu",function(V){return Ss(e,V)}),we(t.input.getField(),"contextmenu",function(V){t.scroller.contains(V.target)||Ss(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 S(V){if(V.touches.length!=1)return!1;var X=V.touches[0];return X.radiusX<=1&&X.radiusY<=1}function j(V,X){if(X.left==null)return!0;var oe=X.left-V.left,le=X.top-V.top;return oe*oe+le*le>20*20}we(t.scroller,"touchstart",function(V){if(!Fe(e,V)&&!S(V)&&!Ka(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)}}),we(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),we(t.scroller,"touchend",function(V){var X=t.activeTouch;if(X&&!_r(t,V)&&X.left!=null&&!X.moved&&new Date-X.start<300){var oe=e.coordsChar(t.activeTouch,"page"),le;!X.prev||j(X,X.prev)?le=new wt(oe,oe):!X.prev.prev||j(X,X.prev.prev)?le=e.findWordAt(oe):le=new wt(Ne(oe.line,0),ft(e.doc,Ne(oe.line+1,0))),e.setSelection(le.anchor,le.head),e.focus(),Q(V)}i()}),we(t.scroller,"touchcancel",i),we(t.scroller,"scroll",function(){t.scroller.clientHeight&&(ai(e,t.scroller.scrollTop),cn(e,t.scroller.scrollLeft,!0),Le(e,"scroll",e))}),we(t.scroller,"mousewheel",function(V){return _o(e,V)}),we(t.scroller,"DOMMouseScroll",function(V){return _o(e,V)}),we(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:Gt(e,Al),leave:function(V){Fe(e,V)||ss(e)}};var z=t.input.getField();we(z,"keyup",function(V){return ys.call(e,V)}),we(z,"keydown",Gt(e,vs)),we(z,"keypress",Gt(e,bs)),we(z,"focus",function(V){return wa(e,V)}),we(z,"blur",function(V){return kn(e,V)})}var Ga=[];kt.defineInitHook=function(e){return Ga.push(e)};function Si(e,t,n,r){var i=e.doc,S;n==null&&(n="add"),n=="smart"&&(i.mode.indent?S=Be(e,t).state:n="prev");var j=e.options.tabSize,z=it(i,t),V=G(z.text,null,j);z.stateAfter&&(z.stateAfter=null);var X=z.text.match(/^\s*/)[0],oe;if(!r&&!/\S/.test(z.text))oe=0,n="not";else if(n=="smart"&&(oe=i.mode.indent(S,z.text.slice(X.length),z.text),oe==be||oe>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?oe=G(it(i,t-1).text,null,j):oe=0:n=="add"?oe=V+e.options.indentUnit:n=="subtract"?oe=V-e.options.indentUnit:typeof n=="number"&&(oe=V+n),oe=Math.max(0,oe);var le="",xe=0;if(e.options.indentWithTabs)for(var ye=Math.floor(oe/j);ye;--ye)xe+=j,le+=" ";if(xe<oe&&(le+=he(oe-xe)),le!=X)return Un(i,le,Ne(t,0),Ne(t,X.length),"+input"),z.stateAfter=null,!0;for(var Pe=0;Pe<i.sel.ranges.length;Pe++){var Ie=i.sel.ranges[Pe];if(Ie.head.line==t&&Ie.head.ch<X.length){var We=Ne(t,X.length);Na(i,Pe,new wt(We,We));break}}}var xr=null;function ra(e){xr=e}function za(e,t,n,r,i){var S=e.doc;e.display.shift=!1,r||(r=S.sel);var j=+new Date-200,z=i=="paste"||e.state.pasteIncoming>j,V=at(t),X=null;if(z&&r.ranges.length>1)if(xr&&xr.text.join(`
|
|
`)==t){if(r.ranges.length%xr.text.length==0){X=[];for(var oe=0;oe<xr.text.length;oe++)X.push(S.splitLines(xr.text[oe]))}}else V.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(X=ae(V,function(ze){return[ze]}));for(var le=e.curOp.updateInput,xe=r.ranges.length-1;xe>=0;xe--){var ye=r.ranges[xe],Pe=ye.from(),Ie=ye.to();ye.empty()&&(n&&n>0?Pe=Ne(Pe.line,Pe.ch-n):e.state.overwrite&&!z?Ie=Ne(Ie.line,Math.min(it(S,Ie.line).text.length,Ie.ch+$(V).length)):z&&xr&&xr.lineWise&&xr.text.join(`
|
|
`)==V.join(`
|
|
`)&&(Pe=Ie=Ne(Pe.line,0)));var We={from:Pe,to:Ie,text:X?X[xe%X.length]:V,origin:i||(z?"paste":e.state.cutIncoming>j?"cut":"+input")};Nn(e.doc,We),Dt(e,"inputRead",e,We)}t&&!z&&Ls(e,t),_n(e),e.curOp.updateInput<2&&(e.curOp.updateInput=le),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function As(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&ur(t,function(){return za(t,n,0,null,"paste")}),!0}function Ls(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 S=e.getModeAt(i.head),j=!1;if(S.electricChars){for(var z=0;z<S.electricChars.length;z++)if(t.indexOf(S.electricChars.charAt(z))>-1){j=Si(e,i.head.line,"smart");break}}else S.electricInput&&(S.electricInput.test(it(e.doc,i.head.line).text.slice(0,i.head.ch))&&(j=Si(e,i.head.line,"smart")));j&&Dt(e,"electricInput",e,i.head.line)}}function Ds(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,S={anchor:Ne(i,0),head:Ne(i+1,0)};n.push(S),t.push(e.getRange(S.anchor,S.head))}return{text:t,ranges:n}}function Rs(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Os(){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 R?e.style.width="1000px":e.setAttribute("wrap","off"),E&&(e.style.border="1px solid black"),Rs(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 S=this.options,j=S[r];if(S[r]==i&&r!="mode")return;S[r]=i,t.hasOwnProperty(r)&&Gt(this,t[r])(this,i,j),Le(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"](qi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,S=0;S<i.length;++S)if(i[S]==r||i[S].name==r)return i.splice(S,1),!0},addOverlay:qt(function(r,i){var S=r.token?r:e.getMode(this.options,r);if(S.startState)throw new Error("Overlays may not be stateful.");ee(this.state.overlays,{mode:S,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(j){return j.priority}),this.state.modeGen++,tr(this)}),removeOverlay:qt(function(r){for(var i=this.state.overlays,S=0;S<i.length;++S){var j=i[S].modeSpec;if(j==r||typeof r=="string"&&j.name==r){i.splice(S,1),this.state.modeGen++,tr(this);return}}}),indentLine:qt(function(r,i,S){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Zr(this.doc,r)&&Si(this,r,i,S)}),indentSelection:qt(function(r){for(var i=this.doc.sel.ranges,S=-1,j=0;j<i.length;j++){var z=i[j];if(z.empty())z.head.line>S&&(Si(this,z.head.line,r,!0),S=z.head.line,j==this.doc.sel.primIndex&&_n(this));else{var V=z.from(),X=z.to(),oe=Math.max(S,V.line);S=Math.min(this.lastLine(),X.line-(X.ch?0:1))+1;for(var le=oe;le<S;++le)Si(this,le,r);var xe=this.doc.sel.ranges;V.ch==0&&i.length==xe.length&&xe[j].from().ch>0&&Na(this.doc,j,new wt(V,xe[j].to()),me)}}}),getTokenAt:function(r,i){return Fr(this,r,i)},getLineTokens:function(r,i){return Fr(this,Ne(r),i,!0)},getTokenTypeAt:function(r){r=ft(this.doc,r);var i=Yn(this,it(this.doc,r.line)),S=0,j=(i.length-1)/2,z=r.ch,V;if(z==0)V=i[2];else for(;;){var X=S+j>>1;if((X?i[X*2-1]:0)>=z)j=X;else if(i[X*2+1]<z)S=X+1;else{V=i[X*2+2];break}}var oe=V?V.indexOf("overlay "):-1;return oe<0?V:oe==0?null:V.slice(0,oe-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 S=[];if(!n.hasOwnProperty(i))return S;var j=n[i],z=this.getModeAt(r);if(typeof z[i]=="string")j[z[i]]&&S.push(j[z[i]]);else if(z[i])for(var V=0;V<z[i].length;V++){var X=j[z[i][V]];X&&S.push(X)}else z.helperType&&j[z.helperType]?S.push(j[z.helperType]):j[z.name]&&S.push(j[z.name]);for(var oe=0;oe<j._global.length;oe++){var le=j._global[oe];le.pred(z,this)&&Z(S,le.val)==-1&&S.push(le.val)}return S},getStateAfter:function(r,i){var S=this.doc;return r=Xn(S,r==null?S.first+S.size-1:r),Be(this,r+1,i).state},cursorCoords:function(r,i){var S,j=this.doc.sel.primary();return r==null?S=j.head:typeof r=="object"?S=ft(this.doc,r):S=r?j.from():j.to(),br(this,S,i||"page")},charCoords:function(r,i){return ga(this,ft(this.doc,r),i||"page")},coordsChar:function(r,i){return r=fo(this,r,i||"page"),ya(this,r.left,r.top)},lineAtHeight:function(r,i){return r=fo(this,{top:r,left:0},i||"page").top,wr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,S){var j=!1,z;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,j=!0),z=it(this.doc,r)}else z=r;return Ui(this,z,{top:0,left:0},i||"page",S||j).top+(j?this.doc.height-lr(z):0)},defaultTextHeight:function(){return On(this.display)},defaultCharWidth:function(){return Pn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,S,j,z){var V=this.display;r=br(this,ft(this.doc,r));var X=r.bottom,oe=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),V.sizer.appendChild(i),j=="over")X=r.top;else if(j=="above"||j=="near"){var le=Math.max(V.wrapper.clientHeight,this.doc.height),xe=Math.max(V.sizer.clientWidth,V.lineSpace.clientWidth);(j=="above"||r.bottom+i.offsetHeight>le)&&r.top>i.offsetHeight?X=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=le&&(X=r.bottom),oe+i.offsetWidth>xe&&(oe=xe-i.offsetWidth)}i.style.top=X+"px",i.style.left=i.style.right="",z=="right"?(oe=V.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(z=="left"?oe=0:z=="middle"&&(oe=(V.sizer.clientWidth-i.offsetWidth)/2),i.style.left=oe+"px"),S&&Qs(this,{left:oe,top:X,right:oe+i.offsetWidth,bottom:X+i.offsetHeight})},triggerOnKeyDown:qt(vs),triggerOnKeyPress:qt(bs),triggerOnKeyUp:ys,triggerOnMouseDown:qt(Es),execCommand:function(r){if(bi.hasOwnProperty(r))return bi[r].call(null,this)},triggerElectric:qt(function(r){Ls(this,r)}),findPosH:function(r,i,S,j){var z=1;i<0&&(z=-1,i=-i);for(var V=ft(this.doc,r),X=0;X<i&&!(V=Va(this.doc,V,z,S,j),V.hitSide);++X);return V},moveH:qt(function(r,i){var S=this;this.extendSelectionsBy(function(j){return S.display.shift||S.doc.extend||j.empty()?Va(S.doc,j.head,r,i,S.options.rtlMoveVisually):r<0?j.from():j.to()},ue)}),deleteH:qt(function(r,i){var S=this.doc.sel,j=this.doc;S.somethingSelected()?j.replaceSelection("",null,"+delete"):Wn(this,function(z){var V=Va(j,z.head,r,i,!1);return r<0?{from:V,to:z.head}:{from:z.head,to:V}})}),findPosV:function(r,i,S,j){var z=1,V=j;i<0&&(z=-1,i=-i);for(var X=ft(this.doc,r),oe=0;oe<i;++oe){var le=br(this,X,"div");if(V==null?V=le.left:le.left=V,X=Ps(this,le,z,S),X.hitSide)break}return X},moveV:qt(function(r,i){var S=this,j=this.doc,z=[],V=!this.display.shift&&!j.extend&&j.sel.somethingSelected();if(j.extendSelectionsBy(function(oe){if(V)return r<0?oe.from():oe.to();var le=br(S,oe.head,"div");oe.goalColumn!=null&&(le.left=oe.goalColumn),z.push(le.left);var xe=Ps(S,le,r,i);return i=="page"&&oe==j.sel.primary()&&Aa(S,ga(S,xe,"div").top-le.top),xe},ue),z.length)for(var X=0;X<j.sel.ranges.length;X++)j.sel.ranges[X].goalColumn=z[X]}),findWordAt:function(r){var i=this.doc,S=it(i,r.line).text,j=r.ch,z=r.ch;if(S){var V=this.getHelper(r,"wordChars");(r.sticky=="before"||z==S.length)&&j?--j:++z;for(var X=S.charAt(j),oe=De(X,V)?function(le){return De(le,V)}:/\s/.test(X)?function(le){return/\s/.test(le)}:function(le){return!/\s/.test(le)&&!De(le)};j>0&&oe(S.charAt(j-1));)--j;for(;z<S.length&&oe(S.charAt(z));)++z}return new wt(Ne(r.line,j),Ne(r.line,z))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?F(this.display.cursorDiv,"CodeMirror-overwrite"):h(this.display.cursorDiv,"CodeMirror-overwrite"),Le(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==k()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:qt(function(r,i){ii(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Ar(this)-this.display.barHeight,width:r.scrollWidth-Ar(this)-this.display.barWidth,clientHeight:ha(this),clientWidth:sn(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):So(this,r.from,r.to,r.margin)}),setSize:qt(function(r,i){var S=this,j=function(V){return typeof V=="number"||/^\d+$/.test(String(V))?V+"px":V};r!=null&&(this.display.wrapper.style.width=j(r)),i!=null&&(this.display.wrapper.style.height=j(i)),this.options.lineWrapping&&lo(this);var z=this.display.viewFrom;this.doc.iter(z,this.display.viewTo,function(V){if(V.widgets){for(var X=0;X<V.widgets.length;X++)if(V.widgets[X].noHScroll){Kr(S,z,"widget");break}}++z}),this.curOp.forceUpdate=!0,Le(this,"refresh",this)}),operation:function(r){return ur(this,r)},startOperation:function(){return hn(this)},endOperation:function(){return pn(this)},refresh:qt(function(){var r=this.display.cachedTextHeight;tr(this),this.curOp.forceUpdate=!0,ri(this),ii(this,this.doc.scrollLeft,this.doc.scrollTop),Ra(this.display),(r==null||Math.abs(r-On(this.display))>.5||this.options.lineWrapping)&&Ta(this),Le(this,"refresh",this)}),swapDoc:qt(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),No(this,r),ri(this),this.display.input.reset(),ii(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Dt(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ce(e),e.registerHelper=function(r,i,S){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=S},e.registerGlobalHelper=function(r,i,S,j){e.registerHelper(r,i,j),n[r]._global.push({pred:S,val:j})}}function Va(e,t,n,r,i){var S=t,j=n,z=it(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),z=it(e,Qe))}function oe(Qe){var Ve;if(r=="codepoint"){var tt=z.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(tt)?Ve=null:Ve=new Ne(t.line,Math.max(0,Math.min(z.text.length,t.ch+n*(tt>=55296&&tt<56320?2:1))),-n)}else i?Ve=Ml(e.cm,z,t,n):Ve=Ba(z,t,n);if(Ve==null)if(!Qe&&X())t=ja(i,e.cm,z,t.line,V);else return!1;else t=Ve;return!0}if(r=="char"||r=="codepoint")oe();else if(r=="column")oe(!0);else if(r=="word"||r=="group")for(var le=null,xe=r=="group",ye=e.cm&&e.cm.getHelper(t,"wordChars"),Pe=!0;!(n<0&&!oe(!Pe));Pe=!1){var Ie=z.text.charAt(t.ch)||`
|
|
`,We=De(Ie,ye)?"w":xe&&Ie==`
|
|
`?"n":!xe||/\s/.test(Ie)?null:"p";if(xe&&!Pe&&!We&&(We="s"),le&&le!=We){n<0&&(n=1,oe(),t.sticky="after");break}if(We&&(le=We),n>0&&!oe(!Pe))break}var ze=Qi(e,t,S,j,!0);return qr(S,ze)&&(ze.hitSide=!0),ze}function Ps(e,t,n,r){var i=e.doc,S=t.left,j;if(r=="page"){var z=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),V=Math.max(z-.5*On(e.display),3);j=(n>0?t.bottom:t.top)+n*V}else r=="line"&&(j=n>0?t.bottom+3:t.top-3);for(var X;!(X=ya(e,S,j),!X.outside);){if(n<0?j<=0:j>=i.height){X.hitSide=!0;break}j+=n*5}return X}var At=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Y,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;Rs(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function S(z){for(var V=z.target;V;V=V.parentNode){if(V==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(V.className))break}return!1}we(i,"paste",function(z){if(!S(z)||Fe(r,z)||As(z,r))return;N<=11&&setTimeout(Gt(r,function(){return t.updateFromDOM()}),20)}),we(i,"compositionstart",function(z){t.composing={data:z.data,done:!1}}),we(i,"compositionupdate",function(z){t.composing||(t.composing={data:z.data,done:!1})}),we(i,"compositionend",function(z){t.composing&&(z.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),we(i,"touchstart",function(){return n.forceCompositionEnd()}),we(i,"input",function(){t.composing||t.readFromDOMSoon()});function j(z){if(!S(z)||Fe(r,z))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()}),z.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var V=Ds(r);ra({lineWise:!0,text:V.text}),z.type=="cut"&&r.operation(function(){r.setSelections(V.ranges,0,me),r.replaceSelection("",null,"cut")})}else return;if(z.clipboardData){z.clipboardData.clearData();var X=xr.text.join(`
|
|
`);if(z.clipboardData.setData("Text",X),z.clipboardData.getData("Text")==X){z.preventDefault();return}}var oe=Os(),le=oe.firstChild;r.display.lineSpace.insertBefore(oe,r.display.lineSpace.firstChild),le.value=xr.text.join(`
|
|
`);var xe=document.activeElement;W(le),setTimeout(function(){r.display.lineSpace.removeChild(oe),xe.focus(),xe==i&&n.showPrimarySelection()},50)}we(i,"copy",j),we(i,"cut",j)},At.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},At.prototype.prepareSelection=function(){var e=yo(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 S=na(t,e.anchorNode,e.anchorOffset),j=na(t,e.focusNode,e.focusOffset);if(S&&!S.bad&&j&&!j.bad&&dt(bn(S,j),r)==0&&dt(tn(S,j),i)==0)return;var z=t.display.view,V=r.line>=t.display.viewFrom&&ks(t,r)||{node:z[0].measure.map[2],offset:0},X=i.line<t.display.viewTo&&ks(t,i);if(!X){var oe=z[z.length-1].measure,le=oe.maps?oe.maps[oe.maps.length-1]:oe.map;X={node:le[le.length-1],offset:le[le.length-2]-le[le.length-3]}}if(!V||!X){e.removeAllRanges();return}var xe=e.rangeCount&&e.getRangeAt(0),ye;try{ye=y(V.node,V.offset,X.offset,X.node)}catch(Pe){}ye&&(!L&&t.state.focused?(e.collapse(V.node,V.offset),ye.collapsed||(e.removeAllRanges(),e.addRange(ye))):(e.removeAllRanges(),e.addRange(ye)),xe&&e.anchorNode==null?e.addRange(xe):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){u(this.cm.display.cursorDiv,e.cursors),u(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 p(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():ur(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(l&&f&&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=na(t,e.anchorNode,e.anchorOffset),r=na(t,e.focusNode,e.focusOffset);n&&r&&ur(t,function(){Qt(t.doc,zr(n,r),me),(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,it(e.doc,r.line-1).length)),i.ch==it(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 S,j,z;r.line==t.viewFrom||(S=dn(e,r.line))==0?(j=St(t.view[0].line),z=t.view[0].node):(j=St(t.view[S].line),z=t.view[S-1].node.nextSibling);var V=dn(e,i.line),X,oe;if(V==t.view.length-1?(X=t.viewTo-1,oe=t.lineDiv.lastChild):(X=St(t.view[V+1].line)-1,oe=t.view[V+1].node.previousSibling),!z)return!1;for(var le=e.doc.splitLines(tu(e,z,oe,j,X)),xe=Sr(e.doc,Ne(j,0),Ne(X,it(e.doc,X).text.length));le.length>1&&xe.length>1;)if($(le)==$(xe))le.pop(),xe.pop(),X--;else if(le[0]==xe[0])le.shift(),xe.shift(),j++;else break;for(var ye=0,Pe=0,Ie=le[0],We=xe[0],ze=Math.min(Ie.length,We.length);ye<ze&&Ie.charCodeAt(ye)==We.charCodeAt(ye);)++ye;for(var Qe=$(le),Ve=$(xe),tt=Math.min(Qe.length-(le.length==1?ye:0),Ve.length-(xe.length==1?ye:0));Pe<tt&&Qe.charCodeAt(Qe.length-Pe-1)==Ve.charCodeAt(Ve.length-Pe-1);)++Pe;if(le.length==1&&xe.length==1&&j==r.line)for(;ye&&ye>r.ch&&Qe.charCodeAt(Qe.length-Pe-1)==Ve.charCodeAt(Ve.length-Pe-1);)ye--,Pe++;le[le.length-1]=Qe.slice(0,Qe.length-Pe).replace(/^\u200b+/,""),le[0]=le[0].slice(ye).replace(/\u200b+$/,"");var ut=Ne(j,ye),ot=Ne(X,xe.length?$(xe).length-Pe:0);if(le.length>1||le[0]||dt(ut,ot))return Un(e.doc,le,ut,ot,"+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())&&ur(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()||Gt(this.cm,za)(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 ks(e,t){var n=pa(e,t.line);if(!n||n.hidden)return null;var r=it(e.doc,t.line),i=no(n,r,t.line),S=Je(r,e.doc.direction),j="left";if(S){var z=He(S,t.ch);j=z%2?"right":"left"}var V=oo(i.map,t.ch,j);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 Kn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var S="",j=!1,z=e.doc.lineSeparator(),V=!1;function X(ye){return function(Pe){return Pe.id==ye}}function oe(){j&&(S+=z,V&&(S+=z),j=V=!1)}function le(ye){ye&&(oe(),S+=ye)}function xe(ye){if(ye.nodeType==1){var Pe=ye.getAttribute("cm-text");if(Pe){le(Pe);return}var Ie=ye.getAttribute("cm-marker"),We;if(Ie){var ze=e.findMarks(Ne(r,0),Ne(i+1,0),X(+Ie));ze.length&&(We=ze[0].find(0))&&le(Sr(e.doc,We.from,We.to).join(z));return}if(ye.getAttribute("contenteditable")=="false")return;var Qe=/^(pre|div|p|li|table|br)$/i.test(ye.nodeName);if(!/^br$/i.test(ye.nodeName)&&ye.textContent.length==0)return;Qe&&oe();for(var Ve=0;Ve<ye.childNodes.length;Ve++)xe(ye.childNodes[Ve]);/^(pre|p)$/i.test(ye.nodeName)&&(V=!0),Qe&&(j=!0)}else ye.nodeType==3&&le(ye.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(xe(t),t==n);)t=t.nextSibling,V=!1;return S}function na(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Kn(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 S=e.display.view[i];if(S.node==r)return ru(S,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!p(r,t))return Kn(Ne(St(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var S=e.rest?$(e.rest):e.line;return Kn(Ne(St(S),S.text.length),i)}var j=t.nodeType==3?t:null,z=t;for(!j&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(j=t.firstChild,n&&(n=j.nodeValue.length));z.parentNode!=r;)z=z.parentNode;var V=e.measure,X=V.maps;function oe(We,ze,Qe){for(var Ve=-1;Ve<(X?X.length:0);Ve++)for(var tt=Ve<0?V.map:X[Ve],ut=0;ut<tt.length;ut+=3){var ot=tt[ut+2];if(ot==We||ot==ze){var gt=St(Ve<0?e.line:e.rest[Ve]),Ot=tt[ut]+Qe;return(Qe<0||ot!=We)&&(Ot=tt[ut+(Qe?1:0)]),Ne(gt,Ot)}}}var le=oe(j,z,n);if(le)return Kn(le,i);for(var xe=z.nextSibling,ye=j?j.nodeValue.length-n:0;xe;xe=xe.nextSibling){if(le=oe(xe,xe.firstChild,0),le)return Kn(Ne(le.line,le.ch-ye),i);ye+=xe.textContent.length}for(var Pe=z.previousSibling,Ie=n;Pe;Pe=Pe.previousSibling){if(le=oe(Pe,Pe.firstChild,-1),le)return Kn(Ne(le.line,le.ch+Ie),i);Ie+=Pe.textContent.length}}var Nt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Y,this.hasSelection=!1,this.composing=null};Nt.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"),we(i,"input",function(){B&&N>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),we(i,"paste",function(j){if(Fe(r,j)||As(j,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function S(j){if(Fe(r,j))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var z=Ds(r);ra({lineWise:!0,text:z.text}),j.type=="cut"?r.setSelections(z.ranges,null,me):(n.prevInput="",i.value=z.text.join(`
|
|
`),W(i))}else return;j.type=="cut"&&(r.state.cutIncoming=+new Date)}we(i,"cut",S),we(i,"copy",S),we(e.scroller,"paste",function(j){if(_r(e,j)||Fe(r,j))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var z=new Event("paste");z.clipboardData=j.clipboardData,i.dispatchEvent(z)}),we(e.lineSpace,"selectstart",function(j){_r(e,j)||Q(j)}),we(i,"compositionstart",function(){var j=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:j,range:r.markText(j,r.getCursor("to"),{className:"CodeMirror-composing"})}}),we(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Nt.prototype.createField=function(e){this.wrapper=Os(),this.textarea=this.wrapper.firstChild},Nt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Nt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=yo(e);if(e.options.moveInputWithCursor){var i=br(e,n.sel.primary().head,"div"),S=t.wrapper.getBoundingClientRect(),j=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+j.top-S.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+j.left-S.left))}return r},Nt.prototype.showSelection=function(e){var t=this.cm,n=t.display;u(n.cursorDiv,e.cursors),u(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Nt.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))},Nt.prototype.getField=function(){return this.textarea},Nt.prototype.supportsTouch=function(){return!1},Nt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||k()!=this.textarea))try{this.textarea.focus()}catch(e){}},Nt.prototype.blur=function(){this.textarea.blur()},Nt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Nt.prototype.receivedFocus=function(){this.slowPoll()},Nt.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()})},Nt.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)},Nt.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||qe(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 S=i.charCodeAt(0);if(S==8203&&!r&&(r="\u200B"),S==8666)return this.reset(),this.cm.execCommand("undo")}for(var j=0,z=Math.min(r.length,i.length);j<z&&r.charCodeAt(j)==i.charCodeAt(j);)++j;return ur(t,function(){za(t,i.slice(j),r.length-j,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},Nt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Nt.prototype.onKeyPress=function(){B&&N>=9&&(this.hasSelection=null),this.fastPoll()},Nt.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var S=un(n,e),j=r.scroller.scrollTop;if(!S||v)return;var z=n.options.resetSelectionOnContextMenu;z&&n.doc.sel.contains(S)==-1&&Gt(n,Qt)(n.doc,zr(S),me);var V=i.style.cssText,X=t.wrapper.style.cssText,oe=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-oe.top-5)+"px; left: "+(e.clientX-oe.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;R&&(le=window.scrollY),r.input.focus(),R&&window.scrollTo(null,le),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=ye,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function xe(){if(i.selectionStart!=null){var Ie=n.somethingSelected(),We="\u200B"+(Ie?i.value:"");i.value="\u21DA",i.value=We,t.prevInput=Ie?"":"\u200B",i.selectionStart=1,i.selectionEnd=We.length,r.selForContextMenu=n.doc.sel}}function ye(){if(t.contextMenuPending!=ye)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=X,i.style.cssText=V,B&&N<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=j),i.selectionStart!=null){(!B||B&&N<9)&&xe();var Ie=0,We=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Gt(n,Qo)(n):Ie++<10?r.detectingSelectAll=setTimeout(We,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(We,200)}}if(B&&N>=9&&xe(),D){se(e);var Pe=function(){$e(window,"mouseup",Pe),setTimeout(ye,20)};we(window,"mouseup",Pe)}else setTimeout(ye,50)},Nt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Nt.prototype.setUneditable=function(){},Nt.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?M(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=k();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=z.getValue()}var i;if(e.form&&(we(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var S=e.form;i=S.submit;try{var j=S.submit=function(){r(),S.submit=i,S.submit(),S.submit=j}}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 z=kt(function(V){return e.parentNode.insertBefore(V,e.nextSibling)},t);return z}function iu(e){e.off=$e,e.on=we,e.wheelEventPixels=cl,e.Doc=rr,e.splitLines=at,e.countColumn=G,e.findColumn=fe,e.isWordChar=Se,e.Pass=be,e.signal=Le,e.Line=Hr,e.changeEnd=Vr,e.scrollbarModel=Ao,e.Pos=Ne,e.cmpPos=dt,e.modes=Lt,e.mimeModes=pt,e.resolveMode=Ut,e.getMode=Tr,e.modeExtensions=vr,e.extendMode=wi,e.copyState=pr,e.startState=Jr,e.innerMode=vn,e.commands=bi,e.keyMap=Mr,e.keyName=fs,e.isModifierKey=ds,e.lookupKey=jn,e.normalizeKeyMap=_l,e.StringStream=_t,e.SharedTextMarker=gi,e.TextMarker=Yr,e.LineWidget=mi,e.e_preventDefault=Q,e.e_stopPropagation=q,e.e_stop=se,e.addClass=F,e.contains=p,e.rmClass=h,e.keyNames=$r}$l(kt),ql(kt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ia in rr.prototype)rr.prototype.hasOwnProperty(ia)&&Z(au,ia)<0&&(kt.prototype[ia]=function(e){return function(){return e.apply(this.doc,arguments)}}(rr.prototype[ia]));return ce(rr),kt.inputStyles={textarea:Nt,contenteditable:At},kt.defineMode=function(e){!kt.defaults.mode&&e!="null"&&(kt.defaults.mode=e),or.apply(this,arguments)},kt.defineMIME=Kt,kt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),kt.defineMIME("text/plain","null"),kt.defineExtension=function(e,t){kt.prototype[e]=t},kt.defineDocExtension=function(e,t){rr.prototype[e]=t},kt.fromTextArea=nu,iu(kt),kt.version="5.58.2",kt})},X0ci:function(Ze,Ke,te){},Y1PL:function(Ze,Ke,te){"use strict";te.r(Ke),te.d(Ke,"ResizableTextArea",function(){return Z});var J=te("wx14"),K=te("1OyB"),L=te("vuIU"),H=te("Ji7U"),I=te("LK+K"),O=te("cDcd"),B=te("VTBJ"),N=te("rePB"),R=te("Zm9Q"),A=te("Kwbf"),f=te("c+Xe"),v=te("m+aA"),P=te("bdgK"),w=new Map;function b(me){me.forEach(function(pe){var ue,fe=pe.target;(ue=w.get(fe))===null||ue===void 0||ue.forEach(function(ie){return ie(fe)})})}var E=new P.default(b),l=null,o=null;function s(me,pe){w.has(me)||(w.set(me,new Set),E.observe(me)),w.get(me).add(pe)}function d(me,pe){w.has(me)&&(w.get(me).delete(pe),w.get(me).size||(E.unobserve(me),w.delete(me)))}var C=function(me){Object(H.a)(ue,me);var pe=Object(I.a)(ue);function ue(){return Object(K.a)(this,ue),pe.apply(this,arguments)}return Object(L.a)(ue,[{key:"render",value:function(){return this.props.children}}]),ue}(O.Component),g=O.createContext(null);function m(me){var pe=me.children,ue=me.onBatchResize,fe=O.useRef(0),ie=O.useRef([]),he=O.useContext(g),$=O.useCallback(function(ae,ee,Ee){fe.current+=1;var Ce=fe.current;ie.current.push({size:ae,element:ee,data:Ee}),Promise.resolve().then(function(){Ce===fe.current&&(ue==null||ue(ie.current),ie.current=[])}),he==null||he(ae,ee,Ee)},[ue,he]);return O.createElement(g.Provider,{value:$},pe)}function D(me){var pe=me.children,ue=me.disabled,fe=O.useRef(null),ie=O.useRef(null),he=O.useContext(g),$=O.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ae=O.isValidElement(pe)&&Object(f.c)(pe),ee=ae?pe.ref:null,Ee=O.useMemo(function(){return Object(f.a)(ee,fe)},[ee,fe]),Ce=O.useRef(me);Ce.current=me;var ve=O.useCallback(function(Se){var De=Ce.current,_e=De.onResize,ke=De.data,Re=Se.getBoundingClientRect(),Ae=Re.width,Ue=Re.height,Ye=Se.offsetWidth,Ge=Se.offsetHeight,He=Math.floor(Ae),et=Math.floor(Ue);if($.current.width!==He||$.current.height!==et||$.current.offsetWidth!==Ye||$.current.offsetHeight!==Ge){var Je={width:He,height:et,offsetWidth:Ye,offsetHeight:Ge};$.current=Je;var Xe=Ye===Math.round(Ae)?Ae:Ye,we=Ge===Math.round(Ue)?Ue:Ge,rt=Object(B.a)(Object(B.a)({},Je),{},{offsetWidth:Xe,offsetHeight:we});he==null||he(rt,Se,ke),_e&&Promise.resolve().then(function(){_e(rt,Se)})}},[]);return O.useEffect(function(){var Se=Object(v.a)(fe.current)||Object(v.a)(ie.current);return Se&&!ue&&s(Se,ve),function(){return d(Se,ve)}},[fe.current,ue]),O.createElement(C,{ref:ie},ae?O.cloneElement(pe,{ref:Ee}):pe)}var T="rc-observer-key";function h(me){var pe=me.children,ue=Object(R.a)(pe);return ue.map(function(fe,ie){var he=(fe==null?void 0:fe.key)||"".concat(T,"-").concat(ie);return O.createElement(D,Object(J.a)({},me,{key:he}),fe)})}h.Collection=m;var c=h,u=te("bT9E"),a=te("TSYQ"),x=te.n(a),y=`
|
|
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
|
|
`,p=["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"],k={},F;function U(me){var pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ue=me.getAttribute("id")||me.getAttribute("data-reactid")||me.getAttribute("name");if(pe&&k[ue])return k[ue];var fe=window.getComputedStyle(me),ie=fe.getPropertyValue("box-sizing")||fe.getPropertyValue("-moz-box-sizing")||fe.getPropertyValue("-webkit-box-sizing"),he=parseFloat(fe.getPropertyValue("padding-bottom"))+parseFloat(fe.getPropertyValue("padding-top")),$=parseFloat(fe.getPropertyValue("border-bottom-width"))+parseFloat(fe.getPropertyValue("border-top-width")),ae=p.map(function(Ee){return"".concat(Ee,":").concat(fe.getPropertyValue(Ee))}).join(";"),ee={sizingStyle:ae,paddingSize:he,borderSize:$,boxSizing:ie};return pe&&ue&&(k[ue]=ee),ee}function W(me){var pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ue=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,fe=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)),me.getAttribute("wrap")?F.setAttribute("wrap",me.getAttribute("wrap")):F.removeAttribute("wrap");var ie=U(me,pe),he=ie.paddingSize,$=ie.borderSize,ae=ie.boxSizing,ee=ie.sizingStyle;F.setAttribute("style","".concat(ee,";").concat(y)),F.value=me.value||me.placeholder||"";var Ee=Number.MIN_SAFE_INTEGER,Ce=Number.MAX_SAFE_INTEGER,ve=F.scrollHeight,Se;if(ae==="border-box"?ve+=$:ae==="content-box"&&(ve-=he),ue!==null||fe!==null){F.value=" ";var De=F.scrollHeight-he;ue!==null&&(Ee=De*ue,ae==="border-box"&&(Ee=Ee+he+$),ve=Math.max(Ee,ve)),fe!==null&&(Ce=De*fe,ae==="border-box"&&(Ce=Ce+he+$),Se=ve>Ce?"":"hidden",ve=Math.min(Ce,ve))}return{height:ve,minHeight:Ee,maxHeight:Ce,overflowY:Se,resize:"none"}}var _=te("Gytx"),M=te.n(_),G;(function(me){me[me.NONE=0]="NONE",me[me.RESIZING=1]="RESIZING",me[me.RESIZED=2]="RESIZED"})(G||(G={}));var Y=function(me){Object(H.a)(ue,me);var pe=Object(I.a)(ue);function ue(fe){var ie;return Object(K.a)(this,ue),ie=pe.call(this,fe),ie.nextFrameActionId=void 0,ie.resizeFrameId=void 0,ie.textArea=void 0,ie.saveTextArea=function(he){ie.textArea=he},ie.handleResize=function(he){var $=ie.state.resizeStatus,ae=ie.props,ee=ae.autoSize,Ee=ae.onResize;if($!==G.NONE)return;typeof Ee=="function"&&Ee(he),ee&&ie.resizeOnNextFrame()},ie.resizeOnNextFrame=function(){cancelAnimationFrame(ie.nextFrameActionId),ie.nextFrameActionId=requestAnimationFrame(ie.resizeTextarea)},ie.resizeTextarea=function(){var he=ie.props.autoSize;if(!he||!ie.textArea)return;var $=he.minRows,ae=he.maxRows,ee=W(ie.textArea,!1,$,ae);ie.setState({textareaStyles:ee,resizeStatus:G.RESIZING},function(){cancelAnimationFrame(ie.resizeFrameId),ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:G.RESIZED},function(){ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:G.NONE}),ie.fixFirefoxAutoScroll()})})})})},ie.renderTextArea=function(){var he=ie.props,$=he.prefixCls,ae=$===void 0?"rc-textarea":$,ee=he.autoSize,Ee=he.onResize,Ce=he.className,ve=he.disabled,Se=ie.state,De=Se.textareaStyles,_e=Se.resizeStatus,ke=Object(u.a)(ie.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Re=x()(ae,Ce,Object(N.a)({},"".concat(ae,"-disabled"),ve));"value"in ke&&(ke.value=ke.value||"");var Ae=Object(B.a)(Object(B.a)(Object(B.a)({},ie.props.style),De),_e===G.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return O.createElement(c,{onResize:ie.handleResize,disabled:!(ee||Ee)},O.createElement("textarea",Object(J.a)({},ke,{className:Re,style:Ae,ref:ie.saveTextArea})))},ie.state={textareaStyles:{},resizeStatus:G.NONE},ie}return Object(L.a)(ue,[{key:"componentDidUpdate",value:function(ie){(ie.value!==this.props.value||!M()(ie.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 ie=this.textArea.selectionStart,he=this.textArea.selectionEnd;this.textArea.setSelectionRange(ie,he)}}catch($){}}},{key:"render",value:function(){return this.renderTextArea()}}]),ue}(O.Component),Z=Y,ne=function(me){Object(H.a)(ue,me);var pe=Object(I.a)(ue);function ue(fe){var ie;Object(K.a)(this,ue),ie=pe.call(this,fe),ie.resizableTextArea=void 0,ie.focus=function(){ie.resizableTextArea.textArea.focus()},ie.saveTextArea=function($){ie.resizableTextArea=$},ie.handleChange=function($){var ae=ie.props.onChange;ie.setValue($.target.value,function(){ie.resizableTextArea.resizeTextarea()}),ae&&ae($)},ie.handleKeyDown=function($){var ae=ie.props,ee=ae.onPressEnter,Ee=ae.onKeyDown;$.keyCode===13&&ee&&ee($),Ee&&Ee($)};var he=typeof fe.value=="undefined"||fe.value===null?fe.defaultValue:fe.value;return ie.state={value:he},ie}return Object(L.a)(ue,[{key:"setValue",value:function(ie,he){"value"in this.props||this.setState({value:ie},he)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return O.createElement(Z,Object(J.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ie){return"value"in ie?{value:ie.value}:null}}]),ue}(O.Component),be=Ke.default=ne},ZpRC:function(Ze,Ke,te){"use strict";function J(f){return typeof f=="object"&&f!=null&&f.nodeType===1}function K(f,v){return(!v||f!=="hidden")&&f!=="visible"&&f!=="clip"}function L(f,v){if(f.clientHeight<f.scrollHeight||f.clientWidth<f.scrollWidth){var P=getComputedStyle(f,null);return K(P.overflowY,v)||K(P.overflowX,v)||function(w){var b=function(E){if(!E.ownerDocument||!E.ownerDocument.defaultView)return null;try{return E.ownerDocument.defaultView.frameElement}catch(l){return null}}(w);return!!b&&(b.clientHeight<w.scrollHeight||b.clientWidth<w.scrollWidth)}(f)}return!1}function H(f,v,P,w,b,E,l,o){return E<f&&l>v||E>f&&l<v?0:E<=f&&o<=P||l>=v&&o>=P?E-f-w:l>v&&o<P||E<f&&o>P?l-v+b:0}var I=function(f,v){var P=window,w=v.scrollMode,b=v.block,E=v.inline,l=v.boundary,o=v.skipOverflowHiddenElements,s=typeof l=="function"?l:function(De){return De!==l};if(!J(f))throw new TypeError("Invalid target");for(var d=document.scrollingElement||document.documentElement,C=[],g=f;J(g)&&s(g);){if((g=g.parentElement)===d){C.push(g);break}g!=null&&g===document.body&&L(g)&&!L(document.documentElement)||g!=null&&L(g,o)&&C.push(g)}for(var m=P.visualViewport?P.visualViewport.width:innerWidth,D=P.visualViewport?P.visualViewport.height:innerHeight,T=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,c=f.getBoundingClientRect(),u=c.height,a=c.width,x=c.top,y=c.right,p=c.bottom,k=c.left,F=b==="start"||b==="nearest"?x:b==="end"?p:x+u/2,U=E==="center"?k+a/2:E==="end"?y:k,W=[],_=0;_<C.length;_++){var M=C[_],G=M.getBoundingClientRect(),Y=G.height,Z=G.width,ne=G.top,be=G.right,me=G.bottom,pe=G.left;if(w==="if-needed"&&x>=0&&k>=0&&p<=D&&y<=m&&x>=ne&&p<=me&&k>=pe&&y<=be)return W;var ue=getComputedStyle(M),fe=parseInt(ue.borderLeftWidth,10),ie=parseInt(ue.borderTopWidth,10),he=parseInt(ue.borderRightWidth,10),$=parseInt(ue.borderBottomWidth,10),ae=0,ee=0,Ee="offsetWidth"in M?M.offsetWidth-M.clientWidth-fe-he:0,Ce="offsetHeight"in M?M.offsetHeight-M.clientHeight-ie-$:0;if(d===M)ae=b==="start"?F:b==="end"?F-D:b==="nearest"?H(h,h+D,D,ie,$,h+F,h+F+u,u):F-D/2,ee=E==="start"?U:E==="center"?U-m/2:E==="end"?U-m:H(T,T+m,m,fe,he,T+U,T+U+a,a),ae=Math.max(0,ae+h),ee=Math.max(0,ee+T);else{ae=b==="start"?F-ne-ie:b==="end"?F-me+$+Ce:b==="nearest"?H(ne,me,Y,ie,$+Ce,F,F+u,u):F-(ne+Y/2)+Ce/2,ee=E==="start"?U-pe-fe:E==="center"?U-(pe+Z/2)+Ee/2:E==="end"?U-be+he+Ee:H(pe,be,Z,fe,he+Ee,U,U+a,a);var ve=M.scrollLeft,Se=M.scrollTop;F+=Se-(ae=Math.max(0,Math.min(Se+ae,M.scrollHeight-Y+Ce))),U+=ve-(ee=Math.max(0,Math.min(ve+ee,M.scrollWidth-Z+Ee)))}W.push({el:M,top:ae,left:ee})}return W};function O(f){return f===Object(f)&&Object.keys(f).length!==0}function B(f,v){v===void 0&&(v="auto");var P="scrollBehavior"in document.body.style;f.forEach(function(w){var b=w.el,E=w.top,l=w.left;b.scroll&&P?b.scroll({top:E,left:l,behavior:v}):(b.scrollTop=E,b.scrollLeft=l)})}function N(f){return f===!1?{block:"end",inline:"nearest"}:O(f)?f:{block:"start",inline:"nearest"}}function R(f,v){var P=!f.ownerDocument.documentElement.contains(f);if(O(v)&&typeof v.behavior=="function")return v.behavior(P?[]:I(f,v));if(P)return;var w=N(v);return B(I(f,w),w.behavior)}var A=Ke.a=R},Zss7:function(Ze,Ke,te){var J;(function(K){var L=/^\s+/,H=/\s+$/,I=0,O=K.round,B=K.min,N=K.max,R=K.random;function A($,ae){if($=$||"",ae=ae||{},$ instanceof A)return $;if(!(this instanceof A))return new A($,ae);var ee=f($);this._originalInput=$,this._r=ee.r,this._g=ee.g,this._b=ee.b,this._a=ee.a,this._roundA=O(100*this._a)/100,this._format=ae.format||ee.format,this._gradientType=ae.gradientType,this._r<1&&(this._r=O(this._r)),this._g<1&&(this._g=O(this._g)),this._b<1&&(this._b=O(this._b)),this._ok=ee.ok,this._tc_id=I++}A.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var $=this.toRgb();return($.r*299+$.g*587+$.b*114)/1e3},getLuminance:function(){var $=this.toRgb(),ae,ee,Ee,Ce,ve,Se;return ae=$.r/255,ee=$.g/255,Ee=$.b/255,ae<=.03928?Ce=ae/12.92:Ce=K.pow((ae+.055)/1.055,2.4),ee<=.03928?ve=ee/12.92:ve=K.pow((ee+.055)/1.055,2.4),Ee<=.03928?Se=Ee/12.92:Se=K.pow((Ee+.055)/1.055,2.4),.2126*Ce+.7152*ve+.0722*Se},setAlpha:function($){return this._a=W($),this._roundA=O(100*this._a)/100,this},toHsv:function(){var $=b(this._r,this._g,this._b);return{h:$.h*360,s:$.s,v:$.v,a:this._a}},toHsvString:function(){var $=b(this._r,this._g,this._b),ae=O($.h*360),ee=O($.s*100),Ee=O($.v*100);return this._a==1?"hsv("+ae+", "+ee+"%, "+Ee+"%)":"hsva("+ae+", "+ee+"%, "+Ee+"%, "+this._roundA+")"},toHsl:function(){var $=P(this._r,this._g,this._b);return{h:$.h*360,s:$.s,l:$.l,a:this._a}},toHslString:function(){var $=P(this._r,this._g,this._b),ae=O($.h*360),ee=O($.s*100),Ee=O($.l*100);return this._a==1?"hsl("+ae+", "+ee+"%, "+Ee+"%)":"hsla("+ae+", "+ee+"%, "+Ee+"%, "+this._roundA+")"},toHex:function($){return l(this._r,this._g,this._b,$)},toHexString:function($){return"#"+this.toHex($)},toHex8:function($){return o(this._r,this._g,this._b,this._a,$)},toHex8String:function($){return"#"+this.toHex8($)},toRgb:function(){return{r:O(this._r),g:O(this._g),b:O(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+O(this._r)+", "+O(this._g)+", "+O(this._b)+")":"rgba("+O(this._r)+", "+O(this._g)+", "+O(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:O(_(this._r,255)*100)+"%",g:O(_(this._g,255)*100)+"%",b:O(_(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+O(_(this._r,255)*100)+"%, "+O(_(this._g,255)*100)+"%, "+O(_(this._b,255)*100)+"%)":"rgba("+O(_(this._r,255)*100)+"%, "+O(_(this._g,255)*100)+"%, "+O(_(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:F[l(this._r,this._g,this._b,!0)]||!1},toFilter:function($){var ae="#"+s(this._r,this._g,this._b,this._a),ee=ae,Ee=this._gradientType?"GradientType = 1, ":"";if($){var Ce=A($);ee="#"+s(Ce._r,Ce._g,Ce._b,Ce._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ee+"startColorstr="+ae+",endColorstr="+ee+")"},toString:function($){var ae=!!$;$=$||this._format;var ee=!1,Ee=this._a<1&&this._a>=0,Ce=!ae&&Ee&&($==="hex"||$==="hex6"||$==="hex3"||$==="hex4"||$==="hex8"||$==="name");return Ce?$==="name"&&this._a===0?this.toName():this.toRgbString():($==="rgb"&&(ee=this.toRgbString()),$==="prgb"&&(ee=this.toPercentageRgbString()),($==="hex"||$==="hex6")&&(ee=this.toHexString()),$==="hex3"&&(ee=this.toHexString(!0)),$==="hex4"&&(ee=this.toHex8String(!0)),$==="hex8"&&(ee=this.toHex8String()),$==="name"&&(ee=this.toName()),$==="hsl"&&(ee=this.toHslString()),$==="hsv"&&(ee=this.toHsvString()),ee||this.toHexString())},clone:function(){return A(this.toString())},_applyModification:function($,ae){var ee=$.apply(null,[this].concat([].slice.call(ae)));return this._r=ee._r,this._g=ee._g,this._b=ee._b,this.setAlpha(ee._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(D,arguments)},darken:function(){return this._applyModification(T,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(C,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(h,arguments)},_applyCombination:function($,ae){return $.apply(null,[this].concat([].slice.call(ae)))},analogous:function(){return this._applyCombination(y,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(p,arguments)},splitcomplement:function(){return this._applyCombination(x,arguments)},triad:function(){return this._applyCombination(u,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},A.fromRatio=function($,ae){if(typeof $=="object"){var ee={};for(var Ee in $)$.hasOwnProperty(Ee)&&(Ee==="a"?ee[Ee]=$[Ee]:ee[Ee]=be($[Ee]));$=ee}return A($,ae)};function f($){var ae={r:0,g:0,b:0},ee=1,Ee=null,Ce=null,ve=null,Se=!1,De=!1;return typeof $=="string"&&($=ie($)),typeof $=="object"&&(fe($.r)&&fe($.g)&&fe($.b)?(ae=v($.r,$.g,$.b),Se=!0,De=String($.r).substr(-1)==="%"?"prgb":"rgb"):fe($.h)&&fe($.s)&&fe($.v)?(Ee=be($.s),Ce=be($.v),ae=E($.h,Ee,Ce),Se=!0,De="hsv"):fe($.h)&&fe($.s)&&fe($.l)&&(Ee=be($.s),ve=be($.l),ae=w($.h,Ee,ve),Se=!0,De="hsl"),$.hasOwnProperty("a")&&(ee=$.a)),ee=W(ee),{ok:Se,format:$.format||De,r:B(255,N(ae.r,0)),g:B(255,N(ae.g,0)),b:B(255,N(ae.b,0)),a:ee}}function v($,ae,ee){return{r:_($,255)*255,g:_(ae,255)*255,b:_(ee,255)*255}}function P($,ae,ee){$=_($,255),ae=_(ae,255),ee=_(ee,255);var Ee=N($,ae,ee),Ce=B($,ae,ee),ve,Se,De=(Ee+Ce)/2;if(Ee==Ce)ve=Se=0;else{var _e=Ee-Ce;Se=De>.5?_e/(2-Ee-Ce):_e/(Ee+Ce);switch(Ee){case $:ve=(ae-ee)/_e+(ae<ee?6:0);break;case ae:ve=(ee-$)/_e+2;break;case ee:ve=($-ae)/_e+4;break}ve/=6}return{h:ve,s:Se,l:De}}function w($,ae,ee){var Ee,Ce,ve;$=_($,360),ae=_(ae,100),ee=_(ee,100);function Se(ke,Re,Ae){return Ae<0&&(Ae+=1),Ae>1&&(Ae-=1),Ae<1/6?ke+(Re-ke)*6*Ae:Ae<1/2?Re:Ae<2/3?ke+(Re-ke)*(2/3-Ae)*6:ke}if(ae===0)Ee=Ce=ve=ee;else{var De=ee<.5?ee*(1+ae):ee+ae-ee*ae,_e=2*ee-De;Ee=Se(_e,De,$+1/3),Ce=Se(_e,De,$),ve=Se(_e,De,$-1/3)}return{r:Ee*255,g:Ce*255,b:ve*255}}function b($,ae,ee){$=_($,255),ae=_(ae,255),ee=_(ee,255);var Ee=N($,ae,ee),Ce=B($,ae,ee),ve,Se,De=Ee,_e=Ee-Ce;if(Se=Ee===0?0:_e/Ee,Ee==Ce)ve=0;else{switch(Ee){case $:ve=(ae-ee)/_e+(ae<ee?6:0);break;case ae:ve=(ee-$)/_e+2;break;case ee:ve=($-ae)/_e+4;break}ve/=6}return{h:ve,s:Se,v:De}}function E($,ae,ee){$=_($,360)*6,ae=_(ae,100),ee=_(ee,100);var Ee=K.floor($),Ce=$-Ee,ve=ee*(1-ae),Se=ee*(1-Ce*ae),De=ee*(1-(1-Ce)*ae),_e=Ee%6,ke=[ee,Se,ve,ve,De,ee][_e],Re=[De,ee,ee,Se,ve,ve][_e],Ae=[ve,ve,De,ee,ee,Se][_e];return{r:ke*255,g:Re*255,b:Ae*255}}function l($,ae,ee,Ee){var Ce=[ne(O($).toString(16)),ne(O(ae).toString(16)),ne(O(ee).toString(16))];return Ee&&Ce[0].charAt(0)==Ce[0].charAt(1)&&Ce[1].charAt(0)==Ce[1].charAt(1)&&Ce[2].charAt(0)==Ce[2].charAt(1)?Ce[0].charAt(0)+Ce[1].charAt(0)+Ce[2].charAt(0):Ce.join("")}function o($,ae,ee,Ee,Ce){var ve=[ne(O($).toString(16)),ne(O(ae).toString(16)),ne(O(ee).toString(16)),ne(me(Ee))];return Ce&&ve[0].charAt(0)==ve[0].charAt(1)&&ve[1].charAt(0)==ve[1].charAt(1)&&ve[2].charAt(0)==ve[2].charAt(1)&&ve[3].charAt(0)==ve[3].charAt(1)?ve[0].charAt(0)+ve[1].charAt(0)+ve[2].charAt(0)+ve[3].charAt(0):ve.join("")}function s($,ae,ee,Ee){var Ce=[ne(me(Ee)),ne(O($).toString(16)),ne(O(ae).toString(16)),ne(O(ee).toString(16))];return Ce.join("")}A.equals=function($,ae){return!$||!ae?!1:A($).toRgbString()==A(ae).toRgbString()},A.random=function(){return A.fromRatio({r:R(),g:R(),b:R()})};function d($,ae){ae=ae===0?0:ae||10;var ee=A($).toHsl();return ee.s-=ae/100,ee.s=M(ee.s),A(ee)}function C($,ae){ae=ae===0?0:ae||10;var ee=A($).toHsl();return ee.s+=ae/100,ee.s=M(ee.s),A(ee)}function g($){return A($).desaturate(100)}function m($,ae){ae=ae===0?0:ae||10;var ee=A($).toHsl();return ee.l+=ae/100,ee.l=M(ee.l),A(ee)}function D($,ae){ae=ae===0?0:ae||10;var ee=A($).toRgb();return ee.r=N(0,B(255,ee.r-O(255*-(ae/100)))),ee.g=N(0,B(255,ee.g-O(255*-(ae/100)))),ee.b=N(0,B(255,ee.b-O(255*-(ae/100)))),A(ee)}function T($,ae){ae=ae===0?0:ae||10;var ee=A($).toHsl();return ee.l-=ae/100,ee.l=M(ee.l),A(ee)}function h($,ae){var ee=A($).toHsl(),Ee=(ee.h+ae)%360;return ee.h=Ee<0?360+Ee:Ee,A(ee)}function c($){var ae=A($).toHsl();return ae.h=(ae.h+180)%360,A(ae)}function u($){var ae=A($).toHsl(),ee=ae.h;return[A($),A({h:(ee+120)%360,s:ae.s,l:ae.l}),A({h:(ee+240)%360,s:ae.s,l:ae.l})]}function a($){var ae=A($).toHsl(),ee=ae.h;return[A($),A({h:(ee+90)%360,s:ae.s,l:ae.l}),A({h:(ee+180)%360,s:ae.s,l:ae.l}),A({h:(ee+270)%360,s:ae.s,l:ae.l})]}function x($){var ae=A($).toHsl(),ee=ae.h;return[A($),A({h:(ee+72)%360,s:ae.s,l:ae.l}),A({h:(ee+216)%360,s:ae.s,l:ae.l})]}function y($,ae,ee){ae=ae||6,ee=ee||30;var Ee=A($).toHsl(),Ce=360/ee,ve=[A($)];for(Ee.h=(Ee.h-(Ce*ae>>1)+720)%360;--ae;)Ee.h=(Ee.h+Ce)%360,ve.push(A(Ee));return ve}function p($,ae){ae=ae||6;for(var ee=A($).toHsv(),Ee=ee.h,Ce=ee.s,ve=ee.v,Se=[],De=1/ae;ae--;)Se.push(A({h:Ee,s:Ce,v:ve})),ve=(ve+De)%1;return Se}A.mix=function($,ae,ee){ee=ee===0?0:ee||50;var Ee=A($).toRgb(),Ce=A(ae).toRgb(),ve=ee/100,Se={r:(Ce.r-Ee.r)*ve+Ee.r,g:(Ce.g-Ee.g)*ve+Ee.g,b:(Ce.b-Ee.b)*ve+Ee.b,a:(Ce.a-Ee.a)*ve+Ee.a};return A(Se)},A.readability=function($,ae){var ee=A($),Ee=A(ae);return(K.max(ee.getLuminance(),Ee.getLuminance())+.05)/(K.min(ee.getLuminance(),Ee.getLuminance())+.05)},A.isReadable=function($,ae,ee){var Ee=A.readability($,ae),Ce,ve;ve=!1,Ce=he(ee);switch(Ce.level+Ce.size){case"AAsmall":case"AAAlarge":ve=Ee>=4.5;break;case"AAlarge":ve=Ee>=3;break;case"AAAsmall":ve=Ee>=7;break}return ve},A.mostReadable=function($,ae,ee){var Ee=null,Ce=0,ve,Se,De,_e;ee=ee||{},Se=ee.includeFallbackColors,De=ee.level,_e=ee.size;for(var ke=0;ke<ae.length;ke++)ve=A.readability($,ae[ke]),ve>Ce&&(Ce=ve,Ee=A(ae[ke]));return A.isReadable($,Ee,{level:De,size:_e})||!Se?Ee:(ee.includeFallbackColors=!1,A.mostReadable($,["#fff","#000"],ee))};var k=A.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},F=A.hexNames=U(k);function U($){var ae={};for(var ee in $)$.hasOwnProperty(ee)&&(ae[$[ee]]=ee);return ae}function W($){return $=parseFloat($),(isNaN($)||$<0||$>1)&&($=1),$}function _($,ae){Y($)&&($="100%");var ee=Z($);return $=B(ae,N(0,parseFloat($))),ee&&($=parseInt($*ae,10)/100),K.abs($-ae)<1e-6?1:$%ae/parseFloat(ae)}function M($){return B(1,N(0,$))}function G($){return parseInt($,16)}function Y($){return typeof $=="string"&&$.indexOf(".")!=-1&&parseFloat($)===1}function Z($){return typeof $=="string"&&$.indexOf("%")!=-1}function ne($){return $.length==1?"0"+$:""+$}function be($){return $<=1&&($=$*100+"%"),$}function me($){return K.round(parseFloat($)*255).toString(16)}function pe($){return G($)/255}var ue=function(){var $="[-\\+]?\\d+%?",ae="[-\\+]?\\d*\\.\\d+%?",ee="(?:"+ae+")|(?:"+$+")",Ee="[\\s|\\(]+("+ee+")[,|\\s]+("+ee+")[,|\\s]+("+ee+")\\s*\\)?",Ce="[\\s|\\(]+("+ee+")[,|\\s]+("+ee+")[,|\\s]+("+ee+")[,|\\s]+("+ee+")\\s*\\)?";return{CSS_UNIT:new RegExp(ee),rgb:new RegExp("rgb"+Ee),rgba:new RegExp("rgba"+Ce),hsl:new RegExp("hsl"+Ee),hsla:new RegExp("hsla"+Ce),hsv:new RegExp("hsv"+Ee),hsva:new RegExp("hsva"+Ce),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 fe($){return!!ue.CSS_UNIT.exec($)}function ie($){$=$.replace(L,"").replace(H,"").toLowerCase();var ae=!1;if(k[$])$=k[$],ae=!0;else if($=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ee;return(ee=ue.rgb.exec($))?{r:ee[1],g:ee[2],b:ee[3]}:(ee=ue.rgba.exec($))?{r:ee[1],g:ee[2],b:ee[3],a:ee[4]}:(ee=ue.hsl.exec($))?{h:ee[1],s:ee[2],l:ee[3]}:(ee=ue.hsla.exec($))?{h:ee[1],s:ee[2],l:ee[3],a:ee[4]}:(ee=ue.hsv.exec($))?{h:ee[1],s:ee[2],v:ee[3]}:(ee=ue.hsva.exec($))?{h:ee[1],s:ee[2],v:ee[3],a:ee[4]}:(ee=ue.hex8.exec($))?{r:G(ee[1]),g:G(ee[2]),b:G(ee[3]),a:pe(ee[4]),format:ae?"name":"hex8"}:(ee=ue.hex6.exec($))?{r:G(ee[1]),g:G(ee[2]),b:G(ee[3]),format:ae?"name":"hex"}:(ee=ue.hex4.exec($))?{r:G(ee[1]+""+ee[1]),g:G(ee[2]+""+ee[2]),b:G(ee[3]+""+ee[3]),a:pe(ee[4]+""+ee[4]),format:ae?"name":"hex8"}:(ee=ue.hex3.exec($))?{r:G(ee[1]+""+ee[1]),g:G(ee[2]+""+ee[2]),b:G(ee[3]+""+ee[3]),format:ae?"name":"hex"}:!1}function he($){var ae,ee;return $=$||{level:"AA",size:"small"},ae=($.level||"AA").toUpperCase(),ee=($.size||"small").toLowerCase(),ae!=="AA"&&ae!=="AAA"&&(ae="AA"),ee!=="small"&&ee!=="large"&&(ee="small"),{level:ae,size:ee}}Ze.exports?Ze.exports=A:!(J=function(){return A}.call(Ke,te,Ke,Ze),J!==void 0&&(Ze.exports=J))})(Math)},aRTE:function(Ze,Ke){Ze.exports={L:1,M:0,Q:3,H:2}},bT9E:function(Ze,Ke,te){"use strict";te.d(Ke,"a",function(){return K});var J=te("VTBJ");function K(L,H){var I=Object(J.a)({},L);return Array.isArray(H)&&H.forEach(function(O){delete I[O]}),I}},c5Ni:function(Ze,Ke,te){},dQei:function(Ze,Ke){for(var te={glog:function(K){if(K<1)throw new Error("glog("+K+")");return te.LOG_TABLE[K]},gexp:function(K){for(;K<0;)K+=255;for(;K>=256;)K-=255;return te.EXP_TABLE[K]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},J=0;J<8;J++)te.EXP_TABLE[J]=1<<J;for(var J=8;J<256;J++)te.EXP_TABLE[J]=te.EXP_TABLE[J-4]^te.EXP_TABLE[J-5]^te.EXP_TABLE[J-6]^te.EXP_TABLE[J-8];for(var J=0;J<255;J++)te.LOG_TABLE[te.EXP_TABLE[J]]=J;Ze.exports=te},dWSS:function(Ze,Ke,te){var J=te("dQei");function K(L,H){if(L.length==null)throw new Error(L.length+"/"+H);for(var I=0;I<L.length&&L[I]==0;)I++;this.num=new Array(L.length-I+H);for(var O=0;O<L.length-I;O++)this.num[O]=L[O+I]}K.prototype={get:function(L){return this.num[L]},getLength:function(){return this.num.length},multiply:function(L){for(var H=new Array(this.getLength()+L.getLength()-1),I=0;I<this.getLength();I++)for(var O=0;O<L.getLength();O++)H[I+O]^=J.gexp(J.glog(this.get(I))+J.glog(L.get(O)));return new K(H,0)},mod:function(L){if(this.getLength()-L.getLength()<0)return this;for(var H=J.glog(this.get(0))-J.glog(L.get(0)),I=new Array(this.getLength()),O=0;O<this.getLength();O++)I[O]=this.get(O);for(var O=0;O<L.getLength();O++)I[O]^=J.gexp(J.glog(L.get(O))+H);return new K(I,0).mod(L)}},Ze.exports=K},dejd:function(Ze,Ke,te){},dmUQ:function(Ze,Ke,te){"use strict";var J=te("Ff2n"),K=te("rePB"),L=te("1OyB"),H=te("vuIU"),I=te("Ji7U"),O=te("md7G"),B=te("foSv"),N=te("cDcd"),R=te.n(N),A=te("TSYQ"),f=te.n(A),v=te("4IlW");function P(u,a){var x=Object.keys(u);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(u);a&&(y=y.filter(function(p){return Object.getOwnPropertyDescriptor(u,p).enumerable})),x.push.apply(x,y)}return x}function w(u){for(var a=1;a<arguments.length;a++){var x=arguments[a]!=null?arguments[a]:{};a%2?P(Object(x),!0).forEach(function(y){Object(K.a)(u,y,x[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(x)):P(Object(x)).forEach(function(y){Object.defineProperty(u,y,Object.getOwnPropertyDescriptor(x,y))})}return u}function b(u){var a=E();return function(){var y=Object(B.a)(u),p;if(a){var k=Object(B.a)(this).constructor;p=Reflect.construct(y,arguments,k)}else p=y.apply(this,arguments);return Object(O.a)(this,p)}}function E(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(u){return!1}}function l(){}function o(u){u.preventDefault()}var s=function(a){return a.replace(/[^\w.-]+/g,"")},d=200,C=600,g=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,m=function(a){return a!=null},D=function(a,x){return x===a||typeof x=="number"&&typeof a=="number"&&isNaN(x)&&isNaN(a)},T=function(u){Object(I.a)(x,u);var a=b(x);function x(y){var p;Object(L.a)(this,x),p=a.call(this,y),p.onKeyDown=function(U){var W=p.props,_=W.onKeyDown,M=W.onPressEnter;if(U.keyCode===v.a.UP){var G=p.getRatio(U);p.up(U,G,null),p.stop()}else if(U.keyCode===v.a.DOWN){var Y=p.getRatio(U);p.down(U,Y,null),p.stop()}else U.keyCode===v.a.ENTER&&M&&M(U);if(p.recordCursorPosition(),p.lastKeyCode=U.keyCode,_){for(var Z=arguments.length,ne=new Array(Z>1?Z-1:0),be=1;be<Z;be++)ne[be-1]=arguments[be];_.apply(void 0,[U].concat(ne))}},p.onKeyUp=function(U){var W=p.props.onKeyUp;if(p.stop(),p.recordCursorPosition(),W){for(var _=arguments.length,M=new Array(_>1?_-1:0),G=1;G<_;G++)M[G-1]=arguments[G];W.apply(void 0,[U].concat(M))}},p.onChange=function(U){var W=p.props.onChange;p.state.focused&&(p.inputting=!0),p.rawInput=p.props.parser(p.getValueFromEvent(U)),p.setState({inputValue:p.rawInput}),W(p.toNumber(p.rawInput))},p.onMouseUp=function(){var U=p.props.onMouseUp;p.recordCursorPosition(),U&&U.apply(void 0,arguments)},p.onFocus=function(){var U;p.setState({focused:!0}),(U=p.props).onFocus.apply(U,arguments)},p.onBlur=function(){var U=p.props.onBlur;p.inputting=!1,p.setState({focused:!1});var W=p.getCurrentValidValue(p.state.inputValue),_=p.setValue(W,l);if(U){var M=p.input.value,G=p.getInputDisplayValue({focus:!1,value:_});p.input.value=G&&Number(G),U.apply(void 0,arguments),p.input.value=M}},p.getRatio=function(U){var W=1;return U.metaKey||U.ctrlKey?W=.1:U.shiftKey&&(W=10),W},p.getFullNum=function(U){return isNaN(U)?U:/e/i.test(String(U))?Number(U).toFixed(18).replace(/\.?0+$/,""):U},p.getPrecision=function(U){if(m(p.props.precision))return p.props.precision;var W=String(U);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var _=0;return W.indexOf(".")>=0&&(_=W.length-W.indexOf(".")-1),_},p.getInputDisplayValue=function(U){var W=U||p.state,_=W.focused,M=W.inputValue,G=W.value,Y;_?Y=M:Y=p.toPrecisionAsStep(G),Y==null&&(Y="");var Z=p.formatWrapper(Y);return m(p.props.decimalSeparator)&&(Z=Z.toString().replace(".",p.props.decimalSeparator)),Z},p.recordCursorPosition=function(){try{p.cursorStart=p.input.selectionStart,p.cursorEnd=p.input.selectionEnd,p.currentValue=p.input.value,p.cursorBefore=p.input.value.substring(0,p.cursorStart),p.cursorAfter=p.input.value.substring(p.cursorEnd)}catch(U){}},p.restoreByAfter=function(U){if(U===void 0)return!1;var W=p.input.value,_=W.lastIndexOf(U);if(_===-1)return!1;var M=p.cursorBefore.length;return p.lastKeyCode===v.a.DELETE&&p.cursorBefore.charAt(M-1)===U[0]?(p.fixCaret(M,M),!0):_+U.length===W.length?(p.fixCaret(_,_),!0):!1},p.partRestoreByAfter=function(U){return U===void 0?!1:Array.prototype.some.call(U,function(W,_){var M=U.substring(_);return p.restoreByAfter(M)})},p.isNotCompleteNumber=function(U){return isNaN(U)||U===""||U===null||U&&U.toString().indexOf(".")===U.toString().length-1},p.stop=function(){p.autoStepTimer&&clearTimeout(p.autoStepTimer)},p.down=function(U,W,_){p.pressingUpOrDown=!0,p.step("down",U,W,_)},p.up=function(U,W,_){p.pressingUpOrDown=!0,p.step("up",U,W,_)},p.saveInput=function(U){p.input=U};var k=y.value;k===void 0&&(k=y.defaultValue),p.state={focused:y.autoFocus};var F=p.getValidValue(p.toNumber(k));return p.state=w(w({},p.state),{},{inputValue:p.toPrecisionAsStep(F),value:F}),p}return Object(H.a)(x,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(p){var k=this.props,F=k.value,U=k.onChange,W=k.max,_=k.min,M=this.state.focused;if(p){if(!D(p.value,F)||!D(p.max,W)||!D(p.min,_)){var G=M?F:this.getValidValue(F),Y;this.pressingUpOrDown?Y=G:this.inputting?Y=this.rawInput:Y=this.toPrecisionAsStep(G),this.setState({value:G,inputValue:Y})}var Z="value"in this.props?F:this.state.value;"max"in this.props&&p.max!==W&&typeof Z=="number"&&Z>W&&U&&U(W),"min"in this.props&&p.min!==_&&typeof Z=="number"&&Z<_&&U&&U(_)}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===v.a.BACKSPACE?ne=this.cursorStart-1:this.lastKeyCode===v.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 v.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case v.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(be){}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(p){var k=p;return k===""?k="":this.isNotCompleteNumber(parseFloat(k))?k=this.state.value:k=this.getValidValue(k),this.toNumber(k)}},{key:"getValueFromEvent",value:function(p){var k=p.target.value.trim().replace(/。/g,".");return m(this.props.decimalSeparator)&&(k=k.replace(this.props.decimalSeparator,".")),k}},{key:"getValidValue",value:function(p){var k=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,U=parseFloat(p);return isNaN(U)?p:(U<k&&(U=k),U>F&&(U=F),U)}},{key:"setValue",value:function(p,k){var F=this.props.precision,U=this.isNotCompleteNumber(parseFloat(p))?null:parseFloat(p),W=this.state.value,_=W===void 0?null:W,M=this.state.inputValue,G=M===void 0?null:M,Y=typeof U=="number"?U.toFixed(F):"".concat(U),Z=U!==_||Y!=="".concat(G);return"value"in this.props?(G=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:G},k)):this.setState({value:U,inputValue:this.toPrecisionAsStep(p)},k),Z&&this.props.onChange(U),U}},{key:"getMaxPrecision",value:function(p){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.props,U=F.precision,W=F.step;if(m(U))return U;var _=this.getPrecision(k),M=this.getPrecision(W),G=this.getPrecision(p);return p?Math.max(G,_+M):_+M}},{key:"getPrecisionFactor",value:function(p){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.getMaxPrecision(p,k);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(p){return this.props.formatter?this.props.formatter(p):p}},{key:"toPrecisionAsStep",value:function(p){if(this.isNotCompleteNumber(p)||p==="")return p;var k=Math.abs(this.getMaxPrecision(p));return isNaN(k)?p.toString():Number(p).toFixed(k)}},{key:"toNumber",value:function(p){var k=this.props.precision,F=this.state.focused,U=p&&p.length>16&&F;return this.isNotCompleteNumber(p)||U?p:m(k)?Math.round(p*Math.pow(10,k))/Math.pow(10,k):Number(p)}},{key:"upStep",value:function(p,k){var F=this.props.step,U=this.getPrecisionFactor(p,k),W=Math.abs(this.getMaxPrecision(p,k)),_=((U*p+U*F*k)/U).toFixed(W);return this.toNumber(_)}},{key:"downStep",value:function(p,k){var F=this.props.step,U=this.getPrecisionFactor(p,k),W=Math.abs(this.getMaxPrecision(p,k)),_=((U*p-U*F*k)/U).toFixed(W);return this.toNumber(_)}},{key:"step",value:function(p,k){var F=this,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),k&&(k.persist(),k.preventDefault());var _=this.props;if(_.disabled)return;var M=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(M))return;var G=this["".concat(p,"Step")](M,U),Y=G>_.max||G<_.min;if(G>_.max?G=_.max:G<_.min&&(G=_.min),this.setValue(G,null),this.setState({focused:!0},function(){F.pressingUpOrDown=!1}),Y)return;this.autoStepTimer=setTimeout(function(){F[p](k,U,!0)},W?d:C)}},{key:"fixCaret",value:function(p,k){if(p===void 0||k===void 0||!this.input||!this.input.value)return;try{var F=this.input.selectionStart,U=this.input.selectionEnd;(p!==F||k!==U)&&this.input.setSelectionRange(p,k)}catch(W){}}},{key:"render",value:function(){var p,k=this.props,F=k.prefixCls,U=k.disabled,W=k.readOnly,_=k.useTouch,M=k.autoComplete,G=k.upHandler,Y=k.downHandler,Z=k.className,ne=k.max,be=k.min,me=k.style,pe=k.title,ue=k.onMouseEnter,fe=k.onMouseLeave,ie=k.onMouseOver,he=k.onMouseOut,$=k.required,ae=k.onClick,ee=k.tabIndex,Ee=k.type,Ce=k.placeholder,ve=k.id,Se=k.inputMode,De=k.pattern,_e=k.step,ke=k.maxLength,Re=k.autoFocus,Ae=k.name,Ue=k.onPaste,Ye=k.onInput,Ge=Object(J.a)(k,["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"]),He=this.state,et=He.value,Je=He.focused,Xe=f()(F,(p={},Object(K.a)(p,Z,!!Z),Object(K.a)(p,"".concat(F,"-disabled"),U),Object(K.a)(p,"".concat(F,"-focused"),Je),p)),we={};Object.keys(Ge).forEach(function(se){(se.substr(0,5)==="data-"||se.substr(0,5)==="aria-"||se==="role")&&(we[se]=Ge[se])});var rt=!W&&!U,$e=this.getInputDisplayValue(null),Le=(et||et===0)&&(isNaN(et)||Number(et)>=ne),Fe=(et||et===0)&&(isNaN(et)||Number(et)<=be),ge=Le||U||W,de=Fe||U||W,ce=f()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(K.a)({},"".concat(F,"-handler-up-disabled"),ge)),Q=f()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(K.a)({},"".concat(F,"-handler-down-disabled"),de)),q=_?{onTouchStart:ge?l:this.up,onTouchEnd:this.stop}:{onMouseDown:ge?l:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},re=_?{onTouchStart:de?l:this.down,onTouchEnd:this.stop}:{onMouseDown:de?l:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return R.a.createElement("div",{className:Xe,style:me,title:pe,onMouseEnter:ue,onMouseLeave:fe,onMouseOver:ie,onMouseOut:he,onFocus:function(){return null},onBlur:function(){return null}},R.a.createElement("div",{className:"".concat(F,"-handler-wrap")},R.a.createElement("span",Object.assign({unselectable:"on"},q,{role:"button","aria-label":"Increase Value","aria-disabled":ge,className:ce}),G||R.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-up-inner"),onClick:o})),R.a.createElement("span",Object.assign({unselectable:"on"},re,{role:"button","aria-label":"Decrease Value","aria-disabled":de,className:Q}),Y||R.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-down-inner"),onClick:o}))),R.a.createElement("div",{className:"".concat(F,"-input-wrap")},R.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":be,"aria-valuemax":ne,"aria-valuenow":et,required:$,type:Ee,placeholder:Ce,onPaste:Ue,onClick:ae,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:ee,autoComplete:M,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:rt?this.onKeyDown:l,onKeyUp:rt?this.onKeyUp:l,autoFocus:Re,maxLength:ke,readOnly:W,disabled:U,max:ne,min:be,step:_e,name:Ae,title:pe,id:ve,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum($e),pattern:De,inputMode:Se,onInput:Ye},we))))}}]),x}(R.a.Component);T.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:g,min:-g,step:1,style:{},onChange:l,onKeyDown:l,onPressEnter:l,onFocus:l,onBlur:l,parser:s,required:!1,autoComplete:"off"};var h=T,c=Ke.a=h},f4xo:function(Ze,Ke,te){var J=te("nVVt");function K(L){this.mode=J.MODE_8BIT_BYTE,this.data=L}K.prototype={getLength:function(L){return this.data.length},write:function(L){for(var H=0;H<this.data.length;H++)L.put(this.data.charCodeAt(H),8)}},Ze.exports=K},h78n:function(Ze,Ke,te){"use strict";te.d(Ke,"a",function(){return p});var J=te("cDcd"),K=te.n(J),L=te("TSYQ"),H=te.n(L),I={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},O=function(U){var W=U.map(function(){return Object(J.useRef)()}),_=Object(J.useRef)();return Object(J.useEffect)(function(){var M=Date.now(),G=!1;Object.keys(W).forEach(function(Y){var Z=W[Y].current;if(!Z)return;G=!0;var ne=Z.style;ne.transitionDuration=".3s, .3s, .3s, .06s",_.current&&M-_.current<100&&(ne.transitionDuration="0s, 0s")}),G&&(_.current=Date.now())}),[W]};function B(){return B=Object.assign||function(F){for(var U=1;U<arguments.length;U++){var W=arguments[U];for(var _ in W)Object.prototype.hasOwnProperty.call(W,_)&&(F[_]=W[_])}return F},B.apply(this,arguments)}function N(F,U){return P(F)||v(F,U)||A(F,U)||R()}function R(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function A(F,U){if(!F)return;if(typeof F=="string")return f(F,U);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 f(F,U)}function f(F,U){(U==null||U>F.length)&&(U=F.length);for(var W=0,_=new Array(U);W<U;W++)_[W]=F[W];return _}function v(F,U){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var W=[],_=!0,M=!1,G=void 0;try{for(var Y=F[Symbol.iterator](),Z;!(_=(Z=Y.next()).done)&&!(W.push(Z.value),U&&W.length===U);_=!0);}catch(ne){M=!0,G=ne}finally{try{!_&&Y.return!=null&&Y.return()}finally{if(M)throw G}}return W}function P(F){if(Array.isArray(F))return F}function w(F,U){if(F==null)return{};var W=b(F,U),_,M;if(Object.getOwnPropertySymbols){var G=Object.getOwnPropertySymbols(F);for(M=0;M<G.length;M++){if(_=G[M],U.indexOf(_)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,_))continue;W[_]=F[_]}}return W}function b(F,U){if(F==null)return{};var W={},_=Object.keys(F),M,G;for(G=0;G<_.length;G++){if(M=_[G],U.indexOf(M)>=0)continue;W[M]=F[M]}return W}var E=function(U){var W=U.className,_=U.percent,M=U.prefixCls,G=U.strokeColor,Y=U.strokeLinecap,Z=U.strokeWidth,ne=U.style,be=U.trailColor,me=U.trailWidth,pe=U.transition,ue=w(U,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete ue.gapPosition;var fe=Array.isArray(_)?_:[_],ie=Array.isArray(G)?G:[G],he=O(fe),$=N(he,1),ae=$[0],ee=Z/2,Ee=100-Z/2,Ce="M ".concat(Y==="round"?ee:0,",").concat(ee,`
|
|
L `).concat(Y==="round"?Ee:100,",").concat(ee),ve="0 0 100 ".concat(Z),Se=0;return K.a.createElement("svg",B({className:H()("".concat(M,"-line"),W),viewBox:ve,preserveAspectRatio:"none",style:ne},ue),K.a.createElement("path",{className:"".concat(M,"-line-trail"),d:Ce,strokeLinecap:Y,stroke:be,strokeWidth:me||Z,fillOpacity:"0"}),fe.map(function(De,_e){var ke={strokeDasharray:"".concat(De,"px, 100px"),strokeDashoffset:"-".concat(Se,"px"),transition:pe||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Re=ie[_e]||ie[ie.length-1];return Se+=De,K.a.createElement("path",{key:_e,className:"".concat(M,"-line-path"),d:Ce,strokeLinecap:Y,stroke:Re,strokeWidth:Z,fillOpacity:"0",ref:ae[_e],style:ke})}))};E.defaultProps=I;var l=E;function o(){return o=Object.assign||function(F){for(var U=1;U<arguments.length;U++){var W=arguments[U];for(var _ in W)Object.prototype.hasOwnProperty.call(W,_)&&(F[_]=W[_])}return F},o.apply(this,arguments)}function s(F,U){return D(F)||m(F,U)||C(F,U)||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 C(F,U){if(!F)return;if(typeof F=="string")return g(F,U);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 g(F,U)}function g(F,U){(U==null||U>F.length)&&(U=F.length);for(var W=0,_=new Array(U);W<U;W++)_[W]=F[W];return _}function m(F,U){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var W=[],_=!0,M=!1,G=void 0;try{for(var Y=F[Symbol.iterator](),Z;!(_=(Z=Y.next()).done)&&!(W.push(Z.value),U&&W.length===U);_=!0);}catch(ne){M=!0,G=ne}finally{try{!_&&Y.return!=null&&Y.return()}finally{if(M)throw G}}return W}function D(F){if(Array.isArray(F))return F}function T(F,U){if(F==null)return{};var W=h(F,U),_,M;if(Object.getOwnPropertySymbols){var G=Object.getOwnPropertySymbols(F);for(M=0;M<G.length;M++){if(_=G[M],U.indexOf(_)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,_))continue;W[_]=F[_]}}return W}function h(F,U){if(F==null)return{};var W={},_=Object.keys(F),M,G;for(G=0;G<_.length;G++){if(M=_[G],U.indexOf(M)>=0)continue;W[M]=F[M]}return W}var c=0;function u(F){return+F.replace("%","")}function a(F){return Array.isArray(F)?F:[F]}function x(F,U,W,_){var M=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,G=arguments.length>5?arguments[5]:void 0,Y=50-_/2,Z=0,ne=-Y,be=0,me=-2*Y;switch(G){case"left":Z=-Y,ne=0,be=2*Y,me=0;break;case"right":Z=Y,ne=0,be=-2*Y,me=0;break;case"bottom":ne=Y,me=2*Y;break;default:}var pe="M 50,50 m ".concat(Z,",").concat(ne,`
|
|
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(be,",").concat(-me,`
|
|
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(-be,",").concat(me),ue=Math.PI*2*Y,fe={stroke:W,strokeDasharray:"".concat(U/100*(ue-M),"px ").concat(ue,"px"),strokeDashoffset:"-".concat(M/2+F/100*(ue-M),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:pe,pathStyle:fe}}var y=function(U){var W=U.prefixCls,_=U.strokeWidth,M=U.trailWidth,G=U.gapDegree,Y=U.gapPosition,Z=U.trailColor,ne=U.strokeLinecap,be=U.style,me=U.className,pe=U.strokeColor,ue=U.percent,fe=T(U,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ie=Object(J.useMemo)(function(){return c+=1,c},[]),he=x(0,100,Z,_,G,Y),$=he.pathString,ae=he.pathStyle,ee=a(ue),Ee=a(pe),Ce=Ee.find(function(ke){return Object.prototype.toString.call(ke)==="[object Object]"}),ve=O(ee),Se=s(ve,1),De=Se[0],_e=function(){var Re=0;return ee.map(function(Ae,Ue){var Ye=Ee[Ue]||Ee[Ee.length-1],Ge=Object.prototype.toString.call(Ye)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ie,")"):"",He=x(Re,Ae,Ye,_,G,Y);return Re+=Ae,K.a.createElement("path",{key:Ue,className:"".concat(W,"-circle-path"),d:He.pathString,stroke:Ge,strokeLinecap:ne,strokeWidth:_,opacity:Ae===0?0:1,fillOpacity:"0",style:He.pathStyle,ref:De[Ue]})})};return K.a.createElement("svg",o({className:H()("".concat(W,"-circle"),me),viewBox:"0 0 100 100",style:be},fe),Ce&&K.a.createElement("defs",null,K.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ie),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Ce).sort(function(ke,Re){return u(ke)-u(Re)}).map(function(ke,Re){return K.a.createElement("stop",{key:Re,offset:ke,stopColor:Ce[ke]})}))),K.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:$,stroke:Z,strokeLinecap:ne,strokeWidth:M||_,fillOpacity:"0",style:ae}),_e().reverse())};y.defaultProps=I;var p=y,k={Line:l,Circle:p}},iIVh:function(Ze,Ke,te){},kSUc:function(Ze,Ke,te){},lZu9:function(Ze,Ke,te){(function(J){J(te("VrN/"),te("1eCo"),te("8EBN"))})(function(J){"use strict";J.defineMode("markdown",function(K,L){var H=J.getMode(K,"text/html"),I=H.name=="null";function O(_){if(J.findModeByName){var M=J.findModeByName(_);M&&(_=M.mime||M.mimes[0])}var G=J.getMode(K,_);return G.name=="null"?null:G}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 R=/^([*\-_])(?:\s*\1){2,}\s*$/,A=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,f=/^\[(x| )\](?=\s)/i,v=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,P=/^ {0,3}(?:\={1,}|-{2,})\s*$/,w=/^[^#!\[\]*_\\<>` "'(~:]+/,b=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,E=/^\s*\[[^\]]+?\]:.*$/,l=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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(_,M,G){return M.f=M.inline=G,G(_,M)}function d(_,M,G){return M.f=M.block=G,G(_,M)}function C(_){return!_||!/\S/.test(_.string)}function g(_){if(_.linkTitle=!1,_.linkHref=!1,_.linkText=!1,_.em=!1,_.strong=!1,_.strikethrough=!1,_.quote=0,_.indentedCode=!1,_.f==D){var M=I;if(!M){var G=J.innerMode(H,_.htmlState);M=G.mode.name=="xml"&&G.state.tagStart===null&&!G.state.context&&G.state.tokenize.isInText}M&&(_.f=u,_.block=m,_.htmlState=null)}return _.trailingSpace=0,_.trailingSpaceNewLine=!1,_.prevLine=_.thisLine,_.thisLine={stream:null},null}function m(_,M){var G=_.column()===M.indentation,Y=C(M.prevLine.stream),Z=M.indentedCode,ne=M.prevLine.hr,be=M.list!==!1,me=(M.listStack[M.listStack.length-1]||0)+3;M.indentedCode=!1;var pe=M.indentation;if(M.indentationDiff===null&&(M.indentationDiff=M.indentation,be)){for(M.list=null;pe<M.listStack[M.listStack.length-1];)M.listStack.pop(),M.listStack.length?M.indentation=M.listStack[M.listStack.length-1]:M.list=!1;M.list!==!1&&(M.indentationDiff=pe-M.listStack[M.listStack.length-1])}var ue=!Y&&!ne&&!M.prevLine.header&&(!be||!Z)&&!M.prevLine.fencedCodeEnd,fe=(M.list===!1||ne||Y)&&M.indentation<=me&&_.match(R),ie=null;if(M.indentationDiff>=4&&(Z||M.prevLine.fencedCodeEnd||M.prevLine.header||Y))return _.skipToEnd(),M.indentedCode=!0,B.code;if(_.eatSpace())return null;if(G&&M.indentation<=me&&(ie=_.match(v))&&ie[1].length<=6)return M.quote=0,M.header=ie[1].length,M.thisLine.header=!0,L.highlightFormatting&&(M.formatting="header"),M.f=M.inline,h(M);if(M.indentation<=me&&_.eat(">"))return M.quote=G?1:M.quote+1,L.highlightFormatting&&(M.formatting="quote"),_.eatSpace(),h(M);if(!fe&&!M.setext&&G&&M.indentation<=me&&(ie=_.match(A))){var he=ie[1]?"ol":"ul";return M.indentation=pe+_.current().length,M.list=!0,M.quote=0,M.listStack.push(M.indentation),M.em=!1,M.strong=!1,M.code=!1,M.strikethrough=!1,L.taskLists&&_.match(f,!1)&&(M.taskList=!0),M.f=M.inline,L.highlightFormatting&&(M.formatting=["list","list-"+he]),h(M)}else{if(G&&M.indentation<=me&&(ie=_.match(b,!0)))return M.quote=0,M.fencedEndRE=new RegExp(ie[1]+"+ *$"),M.localMode=L.fencedCodeBlockHighlighting&&O(ie[2]||L.fencedCodeBlockDefaultMode),M.localMode&&(M.localState=J.startState(M.localMode)),M.f=M.block=T,L.highlightFormatting&&(M.formatting="code-block"),M.code=-1,h(M);if(M.setext||(!ue||!be)&&!M.quote&&M.list===!1&&!M.code&&!fe&&!E.test(_.string)&&(ie=_.lookAhead(1))&&(ie=ie.match(P)))return M.setext?(M.header=M.setext,M.setext=0,_.skipToEnd(),L.highlightFormatting&&(M.formatting="header")):(M.header=ie[0].charAt(0)=="="?1:2,M.setext=M.header),M.thisLine.header=!0,M.f=M.inline,h(M);if(fe)return _.skipToEnd(),M.hr=!0,M.thisLine.hr=!0,B.hr;if(_.peek()==="[")return s(_,M,k)}return s(_,M,M.inline)}function D(_,M){var G=H.token(_,M.htmlState);if(!I){var Y=J.innerMode(H,M.htmlState);(Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText||M.md_inside&&_.current().indexOf(">")>-1)&&(M.f=u,M.block=m,M.htmlState=null)}return G}function T(_,M){var G=M.listStack[M.listStack.length-1]||0,Y=M.indentation<G,Z=G+3;if(M.fencedEndRE&&M.indentation<=Z&&(Y||_.match(M.fencedEndRE))){L.highlightFormatting&&(M.formatting="code-block");var ne;return Y||(ne=h(M)),M.localMode=M.localState=null,M.block=m,M.f=u,M.fencedEndRE=null,M.code=0,M.thisLine.fencedCodeEnd=!0,Y?d(_,M,M.block):ne}else return M.localMode?M.localMode.token(_,M.localState):(_.skipToEnd(),B.code)}function h(_){var M=[];if(_.formatting){M.push(B.formatting),typeof _.formatting=="string"&&(_.formatting=[_.formatting]);for(var G=0;G<_.formatting.length;G++)M.push(B.formatting+"-"+_.formatting[G]),_.formatting[G]==="header"&&M.push(B.formatting+"-"+_.formatting[G]+"-"+_.header),_.formatting[G]==="quote"&&(!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=_.quote?M.push(B.formatting+"-"+_.formatting[G]+"-"+_.quote):M.push("error"))}if(_.taskOpen)return M.push("meta"),M.length?M.join(" "):null;if(_.taskClosed)return M.push("property"),M.length?M.join(" "):null;if(_.linkHref?M.push(B.linkHref,"url"):(_.strong&&M.push(B.strong),_.em&&M.push(B.em),_.strikethrough&&M.push(B.strikethrough),_.emoji&&M.push(B.emoji),_.linkText&&M.push(B.linkText),_.code&&M.push(B.code),_.image&&M.push(B.image),_.imageAltText&&M.push(B.imageAltText,"link"),_.imageMarker&&M.push(B.imageMarker)),_.header&&M.push(B.header,B.header+"-"+_.header),_.quote&&(M.push(B.quote),!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=_.quote?M.push(B.quote+"-"+_.quote):M.push(B.quote+"-"+L.maxBlockquoteDepth)),_.list!==!1){var Y=(_.listStack.length-1)%3;Y?Y===1?M.push(B.list2):M.push(B.list3):M.push(B.list1)}return _.trailingSpaceNewLine?M.push("trailing-space-new-line"):_.trailingSpace&&M.push("trailing-space-"+(_.trailingSpace%2?"a":"b")),M.length?M.join(" "):null}function c(_,M){return _.match(w,!0)?h(M):void 0}function u(_,M){var G=M.text(_,M);if(typeof G!="undefined")return G;if(M.list)return M.list=null,h(M);if(M.taskList){var Y=_.match(f,!0)[1]===" ";return Y?M.taskOpen=!0:M.taskClosed=!0,L.highlightFormatting&&(M.formatting="task"),M.taskList=!1,h(M)}if(M.taskOpen=!1,M.taskClosed=!1,M.header&&_.match(/^#+$/,!0))return L.highlightFormatting&&(M.formatting="header"),h(M);var Z=_.next();if(M.linkTitle){M.linkTitle=!1;var ne=Z;Z==="("&&(ne=")"),ne=(ne+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var be="^\\s*(?:[^"+ne+"\\\\]+|\\\\\\\\|\\\\.)"+ne;if(_.match(new RegExp(be),!0))return B.linkHref}if(Z==="`"){var me=M.formatting;L.highlightFormatting&&(M.formatting="code"),_.eatWhile("`");var pe=_.current().length;if(M.code==0&&(!M.quote||pe==1))return M.code=pe,h(M);if(pe==M.code){var ue=h(M);return M.code=0,ue}else return M.formatting=me,h(M)}else if(M.code)return h(M);if(Z==="\\"&&(_.next(),L.highlightFormatting)){var fe=h(M),ie=B.formatting+"-escape";return fe?fe+" "+ie:ie}if(Z==="!"&&_.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return M.imageMarker=!0,M.image=!0,L.highlightFormatting&&(M.formatting="image"),h(M);if(Z==="["&&M.imageMarker&&_.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return M.imageMarker=!1,M.imageAltText=!0,L.highlightFormatting&&(M.formatting="image"),h(M);if(Z==="]"&&M.imageAltText){L.highlightFormatting&&(M.formatting="image");var fe=h(M);return M.imageAltText=!1,M.image=!1,M.inline=M.f=x,fe}if(Z==="["&&!M.image)return M.linkText&&_.match(/^.*?\]/)||(M.linkText=!0,L.highlightFormatting&&(M.formatting="link")),h(M);if(Z==="]"&&M.linkText){L.highlightFormatting&&(M.formatting="link");var fe=h(M);return M.linkText=!1,M.inline=M.f=_.match(/\(.*?\)| ?\[.*?\]/,!1)?x:u,fe}if(Z==="<"&&_.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){M.f=M.inline=a,L.highlightFormatting&&(M.formatting="link");var fe=h(M);return fe?fe+=" ":fe="",fe+B.linkInline}if(Z==="<"&&_.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){M.f=M.inline=a,L.highlightFormatting&&(M.formatting="link");var fe=h(M);return fe?fe+=" ":fe="",fe+B.linkEmail}if(L.xml&&Z==="<"&&_.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var he=_.string.indexOf(">",_.pos);if(he!=-1){var $=_.string.substring(_.start,he);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test($)&&(M.md_inside=!0)}return _.backUp(1),M.htmlState=J.startState(H),d(_,M,D)}if(L.xml&&Z==="<"&&_.match(/^\/\w*?>/))return M.md_inside=!1,"tag";if(Z==="*"||Z==="_"){for(var ae=1,ee=_.pos==1?" ":_.string.charAt(_.pos-2);ae<3&&_.eat(Z);)ae++;var Ee=_.peek()||" ",Ce=!/\s/.test(Ee)&&(!l.test(Ee)||/\s/.test(ee)||l.test(ee)),ve=!/\s/.test(ee)&&(!l.test(ee)||/\s/.test(Ee)||l.test(Ee)),Se=null,De=null;if(ae%2&&(!M.em&&Ce&&(Z==="*"||!ve||l.test(ee))?Se=!0:M.em==Z&&ve&&(Z==="*"||!Ce||l.test(Ee))&&(Se=!1)),ae>1&&(!M.strong&&Ce&&(Z==="*"||!ve||l.test(ee))?De=!0:M.strong==Z&&ve&&(Z==="*"||!Ce||l.test(Ee))&&(De=!1)),De!=null||Se!=null){L.highlightFormatting&&(M.formatting=Se==null?"strong":De==null?"em":"strong em"),Se===!0&&(M.em=Z),De===!0&&(M.strong=Z);var ue=h(M);return Se===!1&&(M.em=!1),De===!1&&(M.strong=!1),ue}}else if(Z===" "&&(_.eat("*")||_.eat("_"))){if(_.peek()===" ")return h(M);_.backUp(1)}if(L.strikethrough){if(Z==="~"&&_.eatWhile(Z)){if(M.strikethrough){L.highlightFormatting&&(M.formatting="strikethrough");var ue=h(M);return M.strikethrough=!1,ue}else if(_.match(/^[^\s]/,!1))return M.strikethrough=!0,L.highlightFormatting&&(M.formatting="strikethrough"),h(M)}else if(Z===" "&&_.match(/^~~/,!0)){if(_.peek()===" ")return h(M);_.backUp(2)}}if(L.emoji&&Z===":"&&_.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){M.emoji=!0,L.highlightFormatting&&(M.formatting="emoji");var _e=h(M);return M.emoji=!1,_e}return Z===" "&&(_.match(/^ +$/,!1)?M.trailingSpace++:M.trailingSpace&&(M.trailingSpaceNewLine=!0)),h(M)}function a(_,M){var G=_.next();if(G===">"){M.f=M.inline=u,L.highlightFormatting&&(M.formatting="link");var Y=h(M);return Y?Y+=" ":Y="",Y+B.linkInline}return _.match(/^[^>]+/,!0),B.linkInline}function x(_,M){if(_.eatSpace())return null;var G=_.next();return G==="("||G==="["?(M.f=M.inline=p(G==="("?")":"]"),L.highlightFormatting&&(M.formatting="link-string"),M.linkHref=!0,h(M)):"error"}var y={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function p(_){return function(M,G){var Y=M.next();if(Y===_){G.f=G.inline=u,L.highlightFormatting&&(G.formatting="link-string");var Z=h(G);return G.linkHref=!1,Z}return M.match(y[_]),G.linkHref=!0,h(G)}}function k(_,M){return _.match(/^([^\]\\]|\\.)*\]:/,!1)?(M.f=F,_.next(),L.highlightFormatting&&(M.formatting="link"),M.linkText=!0,h(M)):s(_,M,u)}function F(_,M){if(_.match(/^\]:/,!0)){M.f=M.inline=U,L.highlightFormatting&&(M.formatting="link");var G=h(M);return M.linkText=!1,G}return _.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function U(_,M){return _.eatSpace()?null:(_.match(/^[^\s]+/,!0),_.peek()===void 0?M.linkTitle=!0:_.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),M.f=M.inline=u,B.linkHref+" url")}var W={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:u,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(_){return{f:_.f,prevLine:_.prevLine,thisLine:_.thisLine,block:_.block,htmlState:_.htmlState&&J.copyState(H,_.htmlState),indentation:_.indentation,localMode:_.localMode,localState:_.localMode?J.copyState(_.localMode,_.localState):null,inline:_.inline,text:_.text,formatting:!1,linkText:_.linkText,linkTitle:_.linkTitle,linkHref:_.linkHref,code:_.code,em:_.em,strong:_.strong,strikethrough:_.strikethrough,emoji:_.emoji,header:_.header,setext:_.setext,hr:_.hr,taskList:_.taskList,list:_.list,listStack:_.listStack.slice(0),quote:_.quote,indentedCode:_.indentedCode,trailingSpace:_.trailingSpace,trailingSpaceNewLine:_.trailingSpaceNewLine,md_inside:_.md_inside,fencedEndRE:_.fencedEndRE}},token:function(_,M){if(M.formatting=!1,_!=M.thisLine.stream){if(M.header=0,M.hr=!1,_.match(/^\s*$/,!0))return g(M),null;if(M.prevLine=M.thisLine,M.thisLine={stream:_},M.taskList=!1,M.trailingSpace=0,M.trailingSpaceNewLine=!1,!M.localState&&(M.f=M.block,M.f!=D)){var G=_.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(M.indentation=G,M.indentationDiff=null,G>0)return null}}return M.f(_,M)},innerMode:function(_){return _.block==D?{state:_.htmlState,mode:H}:_.localState?{state:_.localState,mode:_.localMode}:{state:_,mode:W}},indent:function(_,M,G){return _.block==D&&H.indent?H.indent(_.htmlState,M,G):_.localState&&_.localMode.indent?_.localMode.indent(_.localState,M,G):J.Pass},blankLine:g,getType:h,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),J.defineMIME("text/markdown","markdown"),J.defineMIME("text/x-markdown","markdown")})},nVVt:function(Ze,Ke){Ze.exports={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3}},nojB:function(Ze,Ke,te){"use strict";te.r(Ke);var J=te("T2oS"),K=te("W9HT"),L=te("9og8"),H=te("tJVT"),I=te("k1fw"),O=te("WmNS"),B=te.n(O),N=te("cDcd"),R=te.n(N),A=te("X0ci"),f=te("iIVh"),v=te("Ty5D"),P=te("55Ip"),w=te("+L6B"),b=te("2/Rp"),E=te("5NDa"),l=te("5rEg"),o=te("2qtc"),s=te("kLXV"),d=te("miYZ"),C=te("tsqr"),g=te("PpiC"),m=te("y8nQ"),D=te("Vl3Y"),T=te("DZo9"),h=te("8z0m"),c=te("sRBo"),u=te("kaz8"),a=te("LtfV"),x=te("m3rI"),y=te("Ot1p"),p=u.a.Group,k=h.a.Dragger;function F(Z,ne){var be=new FileReader;be.addEventListener("load",function(){return ne(be.result)}),be.readAsDataURL(Z)}var U=function(Z){var ne=Z.callback,be=Z.tags,me=be===void 0?[]:be,pe=Z.initialValues,ue=pe===void 0?{}:pe,fe=Z.removeAttachment,ie=Object(N.useState)(""),he=Object(H.a)(ie,2),$=he[0],ae=he[1],ee=D.a.useForm(),Ee=Object(H.a)(ee,1),Ce=Ee[0];function ve(Re){var Ae=Re.cover_id,Ue=Re.attachment_ids,Ye=Object(g.a)(Re,["cover_id","attachment_ids"]);ne(Object(I.a)(Object(I.a)({},Ye),{},{cover_id:Ae==null?void 0:Ae.map(function(Ge){return Ge.response?Ge.response.id:Ge.uid})[(Ae==null?void 0:Ae.length)-1],attachment_ids:Ue?Ue==null?void 0:Ue.map(function(Ge){return Ge.response?Ge.response.id:Ge.uid}):[]}))}function Se(Re){return Array.isArray(Re)?Re:Re&&Re.fileList}var De={multiple:!0,beforeUpload:function(Ae){var Ue=Ae.size/1024/1024<100;if(!Ue)return C.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(x.a.API_SERVER,"/api/attachments.json"),onRemove:function(Ae){s.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:"\u662F\u5426\u786E\u8BA4\u5220\u9664?",onOk:function(){return fe(Ae.response?Ae.response.id:Ae.uid)},onCancel:function(){return!1}})}};function _e(Re){Re.file.status==="done"&&F(Re.file.originFileObj,function(Ae){return ae(Ae)})}var ke={showUploadList:!1,withCredentials:!0,action:"".concat(x.a.API_SERVER,"/api/attachments.json"),onChange:_e};return Object(N.useEffect)(function(){ue.title&&(Ce.setFieldsValue(ue),ue.cover_id.length>0&&ae(x.a.IMG_SERVER+ue.cover_id[0].url))},[ue]),R.a.createElement(D.a,{form:Ce,initialValues:ue,className:"moop-panel",onFinish:ve},R.a.createElement(D.a.Item,{label:"\u6807\u9898",name:"title",extra:R.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"}]},R.a.createElement(l.a,{placeholder:"\u4F8B\u5982\uFF1A\u8F6F\u4EF6\u5DE5\u7A0B\u6559\u5B66\u6848\u4F8B"})),R.a.createElement("div",{className:"flex-container"},R.a.createElement(D.a.Item,{label:"\u4F5C\u8005",name:"author_name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u8005\u540D\u79F0"}]},R.a.createElement(l.a,{placeholder:"\u8BF7\u8F93\u5165\u59D3\u540D",style:{marginRight:20,width:200}})),R.a.createElement(D.a.Item,{name:"author_school_name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u8005\u5355\u4F4D\u540D\u79F0"}]},R.a.createElement(l.a,{placeholder:"\u8BF7\u8F93\u5165\u4F5C\u8005\u5355\u4F4D\u540D\u79F0",style:{width:200}}))),R.a.createElement(D.a.Item,{name:"tag_ids",label:"\u6807\u7B7E",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u4E00\u4E2A\u6807\u7B7E"}]},R.a.createElement(p,null,me.map(function(Re){return R.a.createElement(u.a,{key:Re.id,value:Re.id}," ",Re.name," ")}))),R.a.createElement(D.a.Item,{name:"publish",valuePropName:"checked"},R.a.createElement(u.a,null,"\u662F\u5426\u7533\u8BF7\u53D1\u5E03")),R.a.createElement(D.a.Item,{name:"content",label:"\u63CF\u8FF0",valuePropName:"defaultValue",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u63CF\u8FF0\u5185\u5BB9"}]},R.a.createElement(y.a,{id:"moop_cases_content",height:400})),R.a.createElement(D.a.Item,{name:"attachment_ids",valuePropName:"fileList",getValueFromEvent:Se},R.a.createElement(k,De,R.a.createElement("p",{className:"c-blue",style:{marginBottom:10,fontSize:18}},"\u4E0A\u4F20\u9644\u4EF6"),R.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"))),R.a.createElement(D.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"}]},R.a.createElement(h.a,ke,$?R.a.createElement("img",{src:$,width:120}):R.a.createElement("a",{title:"\u4E0A\u4F20\u5C01\u9762\u56FE",className:"upload-cover"}," ",R.a.createElement(a.a,null)," "))),R.a.createElement("div",{className:"desc"},R.a.createElement("h3",null,"\u5BA1\u6838\u8BF4\u660E"),R.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 ")),R.a.createElement("div",{className:"desc"},R.a.createElement("h3",null,"\u6E29\u99A8\u63D0\u793A"),R.a.createElement("ul",{style:{padding:0}},R.a.createElement("li",null,"1.\u8BF7\u52FF\u4E0A\u4F20\u5DF2\u8BBE\u7F6E\u52A0\u5BC6\u53E3\u4EE4\u7684\u6587\u6863\u8D44\u6E90\uFF1B"),R.a.createElement("li",null,"2.\u53EF\u4EE5\u4E0A\u4F20\u7B26\u5408\u6559\u5B66\u6848\u4F8B\u6807\u51C6\u7684\u6587\u6863\u8D44\u6599\uFF0C\u5982",R.a.createElement("a",{href:"https://www.educoder.net/courses/1309/boards/5909/messages/34799",target:"_blank"}," \u6848\u4F8B\u5165\u5E93\u6807\u51C6 ")," \u3001",R.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"),R.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"),R.a.createElement("li",null,"4.\u8BF7\u4F7F\u7528Chrome\uFF0CFirefox\uFF0CSafari\uFF0CIE11\uFF08\u53CA\u4EE5\u4E0A\u7248\u672C\uFF09\u6D4F\u89C8\u5668\uFF1B"))),R.a.createElement(D.a.Item,{style:{marginTop:10}},R.a.createElement(b.a,{type:"primary",htmlType:"submit"},"\u63D0\u4EA4")))},W=te("wzkS"),_={loading:!1,data:{},tags:[]},M;(function(Z){Z[Z.GET_DATA=0]="GET_DATA",Z[Z.SET_LOADING=1]="SET_LOADING",Z[Z.GET_TAGS=2]="GET_TAGS"})(M||(M={}));function G(Z,ne){switch(ne.type){case M.GET_DATA:return Object(I.a)(Object(I.a)({},Z),ne.payload);case M.GET_TAGS:return Object(I.a)(Object(I.a)({},Z),{},{tags:ne.payload});case M.SET_LOADING:return Object(I.a)(Object(I.a)({},Z),{},{loading:ne.payload});default:throw new Error}}var Y=Ke.default=function(){var Z=Object(v.i)(),ne=Z.caseId,be=Object(v.g)(),me=Object(N.useReducer)(G,_),pe=Object(H.a)(me,2),ue=pe[0],fe=pe[1],ie=ue.loading,he=ue.tags,$=ue.data;Object(N.useEffect)(function(){function Ce(){return ve.apply(this,arguments)}function ve(){return ve=Object(L.a)(B.a.mark(function Se(){var De;return B.a.wrap(function(ke){for(;;)switch(ke.prev=ke.next){case 0:return ke.next=2,Object(W.b)();case 2:De=ke.sent,fe({type:M.GET_TAGS,payload:De.library_tags});case 4:case"end":return ke.stop()}},Se)})),ve.apply(this,arguments)}Ce()},[]),Object(N.useEffect)(function(){var Ce=!1;function ve(){return Se.apply(this,arguments)}function Se(){return Se=Object(L.a)(B.a.mark(function De(){var _e,ke,Re,Ae,Ue,Ye,Ge,He,et;return B.a.wrap(function(Xe){for(;;)switch(Xe.prev=Xe.next){case 0:return fe({type:M.SET_LOADING,payload:!1}),Xe.next=3,Object(W.c)(ne);case 3:_e=Xe.sent,ke=_e.author_name,Re=_e.author_school_name,Ae=_e.content,Ue=_e.cover,Ye=_e.attachments,Ge=_e.status,He=_e.title,et=_e.tags,Ce||(_e.status===404?be.push("/moop_cases"):fe({type:M.GET_DATA,payload:{data:{title:He,author_name:ke,author_school_name:Re,content:Ae,tag_ids:et.map(function(we){return we.id}),publish:Ge==="published",attachment_ids:Ye.map(function(we){return{uid:we.id,id:we.id,name:we.title,url:we.url,filesize:we.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 Xe.stop()}},De)})),Se.apply(this,arguments)}return!Ce&&ne&&ve(),function(){Ce=!0}},[ne]);function ae(Ce){return ee.apply(this,arguments)}function ee(){return ee=Object(L.a)(B.a.mark(function Ce(ve){var Se,De;return B.a.wrap(function(ke){for(;;)switch(ke.prev=ke.next){case 0:if(!ne){ke.next=6;break}return ke.next=3,Object(W.e)(ne,ve);case 3:be.push("/moop_cases/".concat(ne,"/publish-success")),ke.next=11;break;case 6:return ke.next=8,Object(W.a)(ve);case 8:Se=ke.sent,De=Se.id,De&&be.push("/moop_cases/".concat(De,"/publish-success"));case 11:case"end":return ke.stop()}},Ce)})),ee.apply(this,arguments)}var Ee={initialValues:$,tags:he,removeAttachment:W.d,callback:ae};return R.a.createElement(K.a,{spinning:ie,delay:500},R.a.createElement("div",{className:"moop-info"},R.a.createElement("div",{className:"crumb"},R.a.createElement(P.a,{to:"/moop_cases"},"\u6559\u5B66\u6848\u4F8B > "),R.a.createElement("span",null,"\u65B0\u5EFA")),R.a.createElement("div",{className:"title"},R.a.createElement("h2",null,"\u4E0A\u4F20\u6559\u5B66\u6848\u4F8B"),R.a.createElement(P.a,{to:"/moop_cases"},"\u8FD4\u56DE")),R.a.createElement(U,Ee)))}},osHv:function(Ze,Ke,te){(function(J){J(te("VrN/"))})(function(J){"use strict";var K=J.Pos;function L(l,o){return l.line-o.line||l.ch-o.ch}var H="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=H+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",O=new RegExp("<(/?)(["+H+"]["+I+"]*)","g");function B(l,o,s,d){this.line=o,this.ch=s,this.cm=l,this.text=l.getLine(o),this.min=d?Math.max(d.from,l.firstLine()):l.firstLine(),this.max=d?Math.min(d.to-1,l.lastLine()):l.lastLine()}function N(l,o){var s=l.cm.getTokenTypeAt(K(l.line,o));return s&&/\btag\b/.test(s)}function R(l){return l.line>=l.max?void 0:(l.ch=0,l.text=l.cm.getLine(++l.line),!0)}function A(l){return l.line<=l.min?void 0:(l.text=l.cm.getLine(--l.line),l.ch=l.text.length,!0)}function f(l){for(;;){var o=l.text.indexOf(">",l.ch);if(o==-1){if(R(l))continue;return}if(!N(l,o+1)){l.ch=o+1;continue}var s=l.text.lastIndexOf("/",o),d=s>-1&&!/\S/.test(l.text.slice(s+1,o));return l.ch=o+1,d?"selfClose":"regular"}}function v(l){for(;;){var o=l.ch?l.text.lastIndexOf("<",l.ch-1):-1;if(o==-1){if(A(l))continue;return}if(!N(l,o+1)){l.ch=o;continue}O.lastIndex=o,l.ch=o;var s=O.exec(l.text);if(s&&s.index==o)return s}}function P(l){for(;;){O.lastIndex=l.ch;var o=O.exec(l.text);if(!o){if(R(l))continue;return}if(!N(l,o.index+1)){l.ch=o.index+1;continue}return l.ch=o.index+o[0].length,o}}function w(l){for(;;){var o=l.ch?l.text.lastIndexOf(">",l.ch-1):-1;if(o==-1){if(A(l))continue;return}if(!N(l,o+1)){l.ch=o;continue}var s=l.text.lastIndexOf("/",o),d=s>-1&&!/\S/.test(l.text.slice(s+1,o));return l.ch=o+1,d?"selfClose":"regular"}}function b(l,o){for(var s=[];;){var d=P(l),C,g=l.line,m=l.ch-(d?d[0].length:0);if(!d||!(C=f(l)))return;if(C=="selfClose")continue;if(d[1]){for(var D=s.length-1;D>=0;--D)if(s[D]==d[2]){s.length=D;break}if(D<0&&(!o||o==d[2]))return{tag:d[2],from:K(g,m),to:K(l.line,l.ch)}}else s.push(d[2])}}function E(l,o){for(var s=[];;){var d=w(l);if(!d)return;if(d=="selfClose"){v(l);continue}var C=l.line,g=l.ch,m=v(l);if(!m)return;if(m[1])s.push(m[2]);else{for(var D=s.length-1;D>=0;--D)if(s[D]==m[2]){s.length=D;break}if(D<0&&(!o||o==m[2]))return{tag:m[2],from:K(l.line,l.ch),to:K(C,g)}}}}J.registerHelper("fold","xml",function(l,o){for(var s=new B(l,o.line,0);;){var d=P(s);if(!d||s.line!=o.line)return;var C=f(s);if(!C)return;if(!d[1]&&C!="selfClose"){var g=K(s.line,s.ch),m=b(s,d[2]);return m&&L(m.from,g)>0?{from:g,to:m.from}:null}}}),J.findMatchingTag=function(l,o,s){var d=new B(l,o.line,o.ch,s);if(d.text.indexOf(">")==-1&&d.text.indexOf("<")==-1)return;var C=f(d),g=C&&K(d.line,d.ch),m=C&&v(d);if(!C||!m||L(d,o)>0)return;var D={from:K(d.line,d.ch),to:g,tag:m[2]};return C=="selfClose"?{open:D,close:null,at:"open"}:m[1]?{open:E(d,m[2]),close:D,at:"close"}:(d=new B(l,g.line,g.ch,s),{open:D,close:b(d,m[2]),at:"open"})},J.findEnclosingTag=function(l,o,s,d){for(var C=new B(l,o.line,o.ch,s);;){var g=E(C,d);if(!g)break;var m=new B(l,o.line,o.ch,s),D=b(m,g.tag);if(D)return{open:g,close:D}}},J.scanForClosingTag=function(l,o,s,d){var C=new B(l,o.line,o.ch,d?{from:0,to:d}:null);return b(C,s)}})},"p77/":function(Ze,Ke,te){},rUJ1:function(Ze,Ke){const te=/[&<>"']/,J=/[&<>"']/g,K=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,H={"&":"&","<":"<",">":">",'"':""","'":"'"},I=T=>H[T];function O(T,h){if(h){if(te.test(T))return T.replace(J,I)}else if(K.test(T))return T.replace(L,I);return T}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function N(T){return T.replace(B,(h,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 R=/(^|[^\[])\^/g;function A(T,h){T=T.source||T,h=h||"";const c={replace:(u,a)=>(a=a.source||a,a=a.replace(R,"$1"),T=T.replace(u,a),c),getRegex:()=>new RegExp(T,h)};return c}const f=/[^\w:]/g,v=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function P(T,h,c){if(T){let u;try{u=decodeURIComponent(N(c)).replace(f,"").toLowerCase()}catch(a){return null}if(u.indexOf("javascript:")===0||u.indexOf("vbscript:")===0||u.indexOf("data:")===0)return null}h&&!v.test(c)&&(c=o(h,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(u){return null}return c}const w={},b=/^[^:]+:\/*[^/]*$/,E=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(T,h){w[" "+T]||(b.test(T)?w[" "+T]=T+"/":w[" "+T]=g(T,"/",!0)),T=w[" "+T];const c=T.indexOf(":")===-1;return h.substring(0,2)==="//"?c?h:T.replace(E,"$1")+h:h.charAt(0)==="/"?c?h:T.replace(l,"$1")+h:T+h}const s={exec:function(){}};function d(T){let h=1,c,u;for(;h<arguments.length;h++){c=arguments[h];for(u in c)Object.prototype.hasOwnProperty.call(c,u)&&(T[u]=c[u])}return T}function C(T,h){const c=T.replace(/\|/g,(x,y,p)=>{let k=!1,F=y;for(;--F>=0&&p[F]==="\\";)k=!k;return k?"|":" |"}),u=c.split(/ \|/);let a=0;if(u.length>h)u.splice(h);else for(;u.length<h;)u.push("");for(;a<u.length;a++)u[a]=u[a].trim().replace(/\\\|/g,"|");return u}function g(T,h,c){const u=T.length;if(u===0)return"";let a=0;for(;a<u;){const x=T.charAt(u-a-1);if(x===h&&!c)a++;else if(x!==h&&c)a++;else break}return T.substr(0,u-a)}function m(T,h){if(T.indexOf(h[1])===-1)return-1;const c=T.length;let u=0,a=0;for(;a<c;a++)if(T[a]==="\\")a++;else if(T[a]===h[0])u++;else if(T[a]===h[1]&&(u--,u<0))return a;return-1}function D(T){T&&T.sanitize&&!T.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}Ze.exports={escape:O,unescape:N,edit:A,cleanUrl:P,resolveUrl:o,noopTest:s,merge:d,splitCells:C,rtrim:g,findClosingBracket:m,checkSanitizeDeprecation:D}},rcnY:function(Ze,Ke,te){var J=te("aRTE");function K(L,H){this.totalCount=L,this.dataCount=H}K.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],K.getRSBlocks=function(L,H){var I=K.getRsBlockTable(L,H);if(I==null)throw new Error("bad rs block @ typeNumber:"+L+"/errorCorrectLevel:"+H);for(var O=I.length/3,B=new Array,N=0;N<O;N++)for(var R=I[N*3+0],A=I[N*3+1],f=I[N*3+2],v=0;v<R;v++)B.push(new K(A,f));return B},K.getRsBlockTable=function(L,H){switch(H){case J.L:return K.RS_BLOCK_TABLE[(L-1)*4+0];case J.M:return K.RS_BLOCK_TABLE[(L-1)*4+1];case J.Q:return K.RS_BLOCK_TABLE[(L-1)*4+2];case J.H:return K.RS_BLOCK_TABLE[(L-1)*4+3];default:return}},Ze.exports=K},ulZh:function(Ze,Ke,te){typeof window!="undefined"&&function(K,L){Ze.exports=L()}(this,function(){return function(J){var K={};function L(H){if(K[H])return K[H].exports;var I=K[H]={i:H,l:!1,exports:{}};return J[H].call(I.exports,I,I.exports,L),I.l=!0,I.exports}return L.m=J,L.c=K,L.d=function(H,I,O){L.o(H,I)||Object.defineProperty(H,I,{enumerable:!0,get:O})},L.r=function(H){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(H,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(H,"__esModule",{value:!0})},L.t=function(H,I){if(I&1&&(H=L(H)),I&8)return H;if(I&4&&typeof H=="object"&&H&&H.__esModule)return H;var O=Object.create(null);if(L.r(O),Object.defineProperty(O,"default",{enumerable:!0,value:H}),I&2&&typeof H!="string")for(var B in H)L.d(O,B,function(N){return H[N]}.bind(null,B));return O},L.n=function(H){var I=H&&H.__esModule?function(){return H.default}:function(){return H};return L.d(I,"a",I),I},L.o=function(H,I){return Object.prototype.hasOwnProperty.call(H,I)},L.p="/dist/",L(L.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(J,K,L){"use strict";var H=Object.prototype.hasOwnProperty,I="~";function O(){}Object.create&&(O.prototype=Object.create(null),new O().__proto__||(I=!1));function B(f,v,P){this.fn=f,this.context=v,this.once=P||!1}function N(f,v,P,w,b){if(typeof P!="function")throw new TypeError("The listener must be a function");var E=new B(P,w||f,b),l=I?I+v:v;return f._events[l]?f._events[l].fn?f._events[l]=[f._events[l],E]:f._events[l].push(E):(f._events[l]=E,f._eventsCount++),f}function R(f,v){--f._eventsCount===0?f._events=new O:delete f._events[v]}function A(){this._events=new O,this._eventsCount=0}A.prototype.eventNames=function(){var v=[],P,w;if(this._eventsCount===0)return v;for(w in P=this._events)H.call(P,w)&&v.push(I?w.slice(1):w);return Object.getOwnPropertySymbols?v.concat(Object.getOwnPropertySymbols(P)):v},A.prototype.listeners=function(v){var P=I?I+v:v,w=this._events[P];if(!w)return[];if(w.fn)return[w.fn];for(var b=0,E=w.length,l=new Array(E);b<E;b++)l[b]=w[b].fn;return l},A.prototype.listenerCount=function(v){var P=I?I+v:v,w=this._events[P];return w?w.fn?1:w.length:0},A.prototype.emit=function(v,P,w,b,E,l){var o=I?I+v:v;if(!this._events[o])return!1;var s=this._events[o],d=arguments.length,C,g;if(s.fn){s.once&&this.removeListener(v,s.fn,void 0,!0);switch(d){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,P),!0;case 3:return s.fn.call(s.context,P,w),!0;case 4:return s.fn.call(s.context,P,w,b),!0;case 5:return s.fn.call(s.context,P,w,b,E),!0;case 6:return s.fn.call(s.context,P,w,b,E,l),!0}for(g=1,C=new Array(d-1);g<d;g++)C[g-1]=arguments[g];s.fn.apply(s.context,C)}else{var m=s.length,D;for(g=0;g<m;g++){s[g].once&&this.removeListener(v,s[g].fn,void 0,!0);switch(d){case 1:s[g].fn.call(s[g].context);break;case 2:s[g].fn.call(s[g].context,P);break;case 3:s[g].fn.call(s[g].context,P,w);break;case 4:s[g].fn.call(s[g].context,P,w,b);break;default:if(!C)for(D=1,C=new Array(d-1);D<d;D++)C[D-1]=arguments[D];s[g].fn.apply(s[g].context,C)}}}return!0},A.prototype.on=function(v,P,w){return N(this,v,P,w,!1)},A.prototype.once=function(v,P,w){return N(this,v,P,w,!0)},A.prototype.removeListener=function(v,P,w,b){var E=I?I+v:v;if(!this._events[E])return this;if(!P)return R(this,E),this;var l=this._events[E];if(l.fn)l.fn===P&&(!b||l.once)&&(!w||l.context===w)&&R(this,E);else{for(var o=0,s=[],d=l.length;o<d;o++)(l[o].fn!==P||b&&!l[o].once||w&&l[o].context!==w)&&s.push(l[o]);s.length?this._events[E]=s.length===1?s[0]:s:R(this,E)}return this},A.prototype.removeAllListeners=function(v){var P;return v?(P=I?I+v:v,this._events[P]&&R(this,P)):(this._events=new O,this._eventsCount=0),this},A.prototype.off=A.prototype.removeListener,A.prototype.addListener=A.prototype.on,A.prefixed=I,A.EventEmitter=A,J.exports=A},"./node_modules/url-toolkit/src/url-toolkit.js":function(J,K,L){(function(H){var I=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,O=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,N=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,R={buildAbsoluteURL:function(A,f,v){if(v=v||{},A=A.trim(),f=f.trim(),!f){if(!v.alwaysNormalize)return A;var P=R.parseURL(A);if(!P)throw new Error("Error trying to parse base URL.");return P.path=R.normalizePath(P.path),R.buildURLFromParts(P)}var w=R.parseURL(f);if(!w)throw new Error("Error trying to parse relative URL.");if(w.scheme)return v.alwaysNormalize?(w.path=R.normalizePath(w.path),R.buildURLFromParts(w)):f;var b=R.parseURL(A);if(!b)throw new Error("Error trying to parse base URL.");if(!b.netLoc&&b.path&&b.path[0]!=="/"){var E=O.exec(b.path);b.netLoc=E[1],b.path=E[2]}b.netLoc&&!b.path&&(b.path="/");var l={scheme:b.scheme,netLoc:w.netLoc,path:null,params:w.params,query:w.query,fragment:w.fragment};if(!w.netLoc&&(l.netLoc=b.netLoc,w.path[0]!=="/"))if(!w.path)l.path=b.path,w.params||(l.params=b.params,w.query||(l.query=b.query));else{var o=b.path,s=o.substring(0,o.lastIndexOf("/")+1)+w.path;l.path=R.normalizePath(s)}return l.path===null&&(l.path=v.alwaysNormalize?R.normalizePath(w.path):w.path),R.buildURLFromParts(l)},parseURL:function(A){var f=I.exec(A);return f?{scheme:f[1]||"",netLoc:f[2]||"",path:f[3]||"",params:f[4]||"",query:f[5]||"",fragment:f[6]||""}:null},normalizePath:function(A){for(A=A.split("").reverse().join("").replace(B,"");A.length!==(A=A.replace(N,"")).length;);return A.split("").reverse().join("")},buildURLFromParts:function(A){return A.scheme+A.netLoc+A.path+A.params+A.query+A.fragment}};J.exports=R})(this)},"./node_modules/webworkify-webpack/index.js":function(J,K,L){function H(v){var P={};function w(E){if(P[E])return P[E].exports;var l=P[E]={i:E,l:!1,exports:{}};return v[E].call(l.exports,l,l.exports,w),l.l=!0,l.exports}w.m=v,w.c=P,w.i=function(E){return E},w.d=function(E,l,o){w.o(E,l)||Object.defineProperty(E,l,{configurable:!1,enumerable:!0,get:o})},w.r=function(E){Object.defineProperty(E,"__esModule",{value:!0})},w.n=function(E){var l=E&&E.__esModule?function(){return E.default}:function(){return E};return w.d(l,"a",l),l},w.o=function(E,l){return Object.prototype.hasOwnProperty.call(E,l)},w.p="/",w.oe=function(E){throw console.error(E),E};var b=w(w.s=ENTRY_MODULE);return b.default||b}var I="[\\.|\\-|\\+|\\w|/|@]+",O="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+I+").*?\\)";function B(v){return(v+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function N(v){return!isNaN(1*v)}function R(v,P,w){var b={};b[w]=[];var E=P.toString(),l=E.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!l)return b;for(var o=l[1],s=new RegExp("(\\\\n|\\W)"+B(o)+O,"g"),d;d=s.exec(E);){if(d[3]==="dll-reference")continue;b[w].push(d[3])}for(s=new RegExp("\\("+B(o)+'\\("(dll-reference\\s('+I+'))"\\)\\)'+O,"g");d=s.exec(E);)v[d[2]]||(b[w].push(d[1]),v[d[2]]=L(d[1]).m),b[d[2]]=b[d[2]]||[],b[d[2]].push(d[4]);for(var C=Object.keys(b),g=0;g<C.length;g++)for(var m=0;m<b[C[g]].length;m++)N(b[C[g]][m])&&(b[C[g]][m]=1*b[C[g]][m]);return b}function A(v){var P=Object.keys(v);return P.reduce(function(w,b){return w||v[b].length>0},!1)}function f(v,P){for(var w={main:[P]},b={main:[]},E={main:{}};A(w);)for(var l=Object.keys(w),o=0;o<l.length;o++){var s=l[o],d=w[s],C=d.pop();if(E[s]=E[s]||{},E[s][C]||!v[s][C])continue;E[s][C]=!0,b[s]=b[s]||[],b[s].push(C);for(var g=R(v,v[s][C],s),m=Object.keys(g),D=0;D<m.length;D++)w[m[D]]=w[m[D]]||[],w[m[D]]=w[m[D]].concat(g[m[D]])}return b}J.exports=function(v,P){P=P||{};var w={main:L.m},b=P.all?{main:Object.keys(w.main)}:f(w,v),E="";Object.keys(b).filter(function(C){return C!=="main"}).forEach(function(C){for(var g=0;b[C][g];)g++;b[C].push(g),w[C][g]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",E=E+"var "+C+" = ("+H.toString().replace("ENTRY_MODULE",JSON.stringify(g))+")({"+b[C].map(function(m){return""+JSON.stringify(m)+": "+w[C][m].toString()}).join(",")+`});
|
|
`}),E=E+"new (("+H.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+b.main.map(function(C){return""+JSON.stringify(C)+": "+w.main[C].toString()}).join(",")+"}))(self);";var l=new window.Blob([E],{type:"text/javascript"});if(P.bare)return l;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,s=o.createObjectURL(l),d=new window.Worker(s);return d.objectURL=s,d}},"./src/config.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"hlsDefaultConfig",function(){return D}),L.d(K,"mergeConfig",function(){return h}),L.d(K,"enableStreamingMode",function(){return c});var H=L("./src/controller/abr-controller.ts"),I=L("./src/controller/audio-stream-controller.ts"),O=L("./src/controller/audio-track-controller.ts"),B=L("./src/controller/subtitle-stream-controller.ts"),N=L("./src/controller/subtitle-track-controller.ts"),R=L("./src/controller/buffer-controller.ts"),A=L("./src/controller/timeline-controller.ts"),f=L("./src/controller/cap-level-controller.ts"),v=L("./src/controller/fps-controller.ts"),P=L("./src/controller/eme-controller.ts"),w=L("./src/controller/cmcd-controller.ts"),b=L("./src/utils/xhr-loader.ts"),E=L("./src/utils/fetch-loader.ts"),l=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(u){for(var a=1;a<arguments.length;a++){var x=arguments[a];for(var y in x)Object.prototype.hasOwnProperty.call(x,y)&&(u[y]=x[y])}return u},d.apply(this,arguments)}function C(u,a){var x=Object.keys(u);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(u);a&&(y=y.filter(function(p){return Object.getOwnPropertyDescriptor(u,p).enumerable})),x.push.apply(x,y)}return x}function g(u){for(var a=1;a<arguments.length;a++){var x=arguments[a]!=null?arguments[a]:{};a%2?C(Object(x),!0).forEach(function(y){m(u,y,x[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(x)):C(Object(x)).forEach(function(y){Object.defineProperty(u,y,Object.getOwnPropertyDescriptor(x,y))})}return u}function m(u,a,x){return a in u?Object.defineProperty(u,a,{value:x,enumerable:!0,configurable:!0,writable:!0}):u[a]=x,u}var D=g(g({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:b.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:H.default,bufferController:R.default,capLevelController:f.default,fpsController:v.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},T()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:N.default,timelineController:A.TimelineController,audioStreamController:I.default,audioTrackController:O.default,emeController:P.default,cmcdController:w.default});function T(){return{cueHandler:l.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 h(u,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return d({},u,a)}function c(u){var a=u.loader;if(a!==E.default&&a!==b.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),u.progressive=!1;else{var x=Object(E.fetchSupported)();x&&(u.loader=E.default,u.progressive=!0,u.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/polyfills/number.ts"),I=L("./src/utils/ewma-bandwidth-estimator.ts"),O=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),N=L("./src/errors.ts"),R=L("./src/types/loader.ts"),A=L("./src/utils/logger.ts");function f(w,b){for(var E=0;E<b.length;E++){var l=b[E];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(w,l.key,l)}}function v(w,b,E){return b&&f(w.prototype,b),E&&f(w,E),w}var P=function(){function w(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 l=E.config;this.bwEstimator=new I.default(l.abrEwmaSlowVoD,l.abrEwmaFastVoD,l.abrEwmaDefaultEstimate),this.registerListeners()}var b=w.prototype;return b.registerListeners=function(){var l=this.hls;l.on(O.Events.FRAG_LOADING,this.onFragLoading,this),l.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(O.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var l=this.hls;l.off(O.Events.FRAG_LOADING,this.onFragLoading,this),l.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(O.Events.ERROR,this.onError,this)},b.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},b.onFragLoading=function(l,o){var s=o.frag;if(s.type===R.PlaylistLevelType.MAIN&&!this.timer){var d;this.fragCurrent=s,this.partCurrent=(d=o.part)!=null?d:null,this.timer=self.setInterval(this.onCheck,100)}},b.onLevelLoaded=function(l,o){var s=this.hls.config;o.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},b._abandonRulesCheck=function(){var l=this.fragCurrent,o=this.partCurrent,s=this.hls,d=s.autoLevelEnabled,C=s.config,g=s.media;if(!l||!g)return;var m=o?o.stats:l.stats,D=o?o.duration:l.duration;if(m.aborted){A.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!d||g.paused||!g.playbackRate||!g.readyState)return;var T=performance.now()-m.loading.start,h=Math.abs(g.playbackRate);if(T<=500*D/h)return;var c=s.levels,u=s.minAutoLevel,a=c[l.level],x=m.total||Math.max(m.loaded,Math.round(D*a.maxBitrate/8)),y=Math.max(1,m.bwEstimate?m.bwEstimate/8:m.loaded*1e3/T),p=(x-m.loaded)/y,k=g.currentTime,F=(B.BufferHelper.bufferInfo(g,k,C.maxBufferHole).end-k)/h;if(F>=2*D/h||p<=F)return;var U=Number.POSITIVE_INFINITY,W;for(W=l.level-1;W>u;W--){var _=c[W].maxBitrate;if(U=D*_/(8*.8*y),U<F)break}if(U>=p)return;var M=this.bwEstimator.getEstimate();A.logger.warn("Fragment "+l.sn+(o?" part "+o.index:"")+" of level "+l.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+`
|
|
Current BW estimate: `+(Object(H.isFiniteNumber)(M)?(M/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+p.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+U.toFixed(3)+` s
|
|
Time to underbuffer: `+F.toFixed(3)+" s"),s.nextLoadLevel=W,this.bwEstimator.sample(T,m.loaded),this.clearTimer(),l.loader&&(this.fragCurrent=this.partCurrent=null,l.loader.abort()),s.trigger(O.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:l,part:o,stats:m})},b.onFragLoaded=function(l,o){var s=o.frag,d=o.part;if(s.type===R.PlaylistLevelType.MAIN&&Object(H.isFiniteNumber)(s.sn)){var C=d?d.stats:s.stats,g=d?d.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var m=this.hls.levels[s.level],D=(m.loaded?m.loaded.bytes:0)+C.loaded,T=(m.loaded?m.loaded.duration:0)+g;m.loaded={bytes:D,duration:T},m.realBitrate=Math.round(8*D/T)}if(s.bitrateTest){var h={stats:C,frag:s,part:d,id:s.type};this.onFragBuffered(O.Events.FRAG_BUFFERED,h),s.bitrateTest=!1}}},b.onFragBuffered=function(l,o){var s=o.frag,d=o.part,C=d?d.stats:s.stats;if(C.aborted)return;if(s.type!==R.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var g=C.parsing.end-C.loading.start;this.bwEstimator.sample(g,C.loaded),C.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=g/1e3:this.bitrateTestDelay=0},b.onError=function(l,o){switch(o.details){case N.ErrorDetails.FRAG_LOAD_ERROR:case N.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},b.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},b.getNextABRAutoLevel=function(){var l=this.fragCurrent,o=this.partCurrent,s=this.hls,d=s.maxAutoLevel,C=s.config,g=s.minAutoLevel,m=s.media,D=o?o.duration:l?l.duration:0,T=m?m.currentTime:0,h=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():C.abrEwmaDefaultEstimate,u=(B.BufferHelper.bufferInfo(m,T,C.maxBufferHole).end-T)/h,a=this.findBestLevel(c,g,d,u,C.abrBandWidthFactor,C.abrBandWidthUpFactor);if(a>=0)return a;A.logger.trace((u?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var x=D?Math.min(D,C.maxStarvationDelay):C.maxStarvationDelay,y=C.abrBandWidthFactor,p=C.abrBandWidthUpFactor;if(!u){var k=this.bitrateTestDelay;if(k){var F=D?Math.min(D,C.maxLoadingDelay):C.maxLoadingDelay;x=F-k,A.logger.trace("bitrate test took "+Math.round(1e3*k)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*x)+" ms"),y=p=1}}return a=this.findBestLevel(c,g,d,u+x,y,p),Math.max(a,0)},b.findBestLevel=function(l,o,s,d,C,g){for(var m,D=this.fragCurrent,T=this.partCurrent,h=this.lastLoadedFragLevel,c=this.hls.levels,u=c[h],a=!!(u!=null&&(m=u.details)!==null&&m!==void 0&&m.live),x=u==null?void 0:u.codecSet,y=T?T.duration:D?D.duration:0,p=s;p>=o;p--){var k=c[p];if(!k||x&&k.codecSet!==x)continue;var F=k.details,U=(T?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||y,W=void 0;p<=h?W=C*l:W=g*l;var _=c[p].maxBitrate,M=_*U/W;if(A.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+p+"/"+Math.round(W)+"/"+_+"/"+U+"/"+d+"/"+M),W>_&&(!M||a&&!this.bitrateTestDelay||M<d))return p}return-1},v(w,[{key:"nextAutoLevel",get:function(){var l=this._nextAutoLevel,o=this.bwEstimator;if(l!==-1&&(!o||!o.canEstimate()))return l;var s=this.getNextABRAutoLevel();return l!==-1&&(s=Math.min(l,s)),s},set:function(l){this._nextAutoLevel=l}}]),w}();K.default=P},"./src/controller/audio-stream-controller.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),O=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),N=L("./src/controller/fragment-tracker.ts"),R=L("./src/types/level.ts"),A=L("./src/types/loader.ts"),f=L("./src/loader/fragment.ts"),v=L("./src/demux/chunk-cache.ts"),P=L("./src/demux/transmuxer-interface.ts"),w=L("./src/types/transmuxer.ts"),b=L("./src/controller/fragment-finders.ts"),E=L("./src/utils/discontinuities.ts"),l=L("./src/errors.ts"),o=L("./src/utils/logger.ts");function s(){return s=Object.assign||function(D){for(var T=1;T<arguments.length;T++){var h=arguments[T];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(D[c]=h[c])}return D},s.apply(this,arguments)}function d(D,T){D.prototype=Object.create(T.prototype),D.prototype.constructor=D,C(D,T)}function C(D,T){return C=Object.setPrototypeOf||function(c,u){return c.__proto__=u,c},C(D,T)}var g=100,m=function(D){d(T,D);function T(c,u){var a;return a=D.call(this,c,u,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var h=T.prototype;return h.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},h._registerListeners=function(){var u=this.hls;u.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.on(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.on(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(O.Events.ERROR,this.onError,this),u.on(O.Events.BUFFER_RESET,this.onBufferReset,this),u.on(O.Events.BUFFER_CREATED,this.onBufferCreated,this),u.on(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.on(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var u=this.hls;u.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.off(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.off(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(O.Events.ERROR,this.onError,this),u.off(O.Events.BUFFER_RESET,this.onBufferReset,this),u.off(O.Events.BUFFER_CREATED,this.onBufferCreated,this),u.off(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.off(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onInitPtsFound=function(u,a){var x=a.frag,y=a.id,p=a.initPTS;if(y==="main"){var k=x.cc;this.initPTS[x.cc]=p,this.log("InitPTS for cc: "+k+" found from main: "+p),this.videoTrackCC=k,this.state===I.State.WAITING_INIT_PTS&&this.tick()}},h.startLoad=function(u){if(!this.levels){this.startPosition=u,this.state=I.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(g),this.fragLoadError=0,a>0&&u===-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=u,this.tick()},h.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_TRACK:{var u,a=this.levels,x=this.trackId,y=a==null||((u=a[x])===null||u===void 0)?void 0:u.details;if(y){if(this.waitForCdnTuneIn(y))break;this.state=I.State.WAITING_INIT_PTS}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var p,k=performance.now(),F=this.retryDate;(!F||k>=F||(p=this.media)!==null&&p!==void 0&&p.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=I.State.IDLE);break}case I.State.WAITING_INIT_PTS:{var U=this.waitingData;if(U){var W=U.frag,_=U.part,M=U.cache,G=U.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.FRAG_LOADING;var Y=M.flush(),Z={frag:W,part:_,payload:Y,networkDetails:null};this._handleFragmentLoadProgress(Z),G&&D.prototype._handleFragmentLoadComplete.call(this,Z)}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(),be=B.BufferHelper.bufferInfo(this.mediaBuffer,ne,this.config.maxBufferHole),me=Object(b.fragmentWithinToleranceTest)(be.end,this.config.maxFragLookUpTolerance,W);me<0&&(o.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+be.end+" is needed"),this.clearWaitingFragment())}}else this.state=I.State.IDLE}}this.onTickEnd()},h.clearWaitingFragment=function(){var u=this.waitingData;u&&(this.fragmentTracker.removeFragment(u.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.IDLE)},h.onTickEnd=function(){var u=this.media;if(!u||!u.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:u,x=a.buffered;!this.loadedmetadata&&x.length&&(this.loadedmetadata=!0),this.lastCurrentTime=u.currentTime},h.doTickIdle=function(){var u,a,x=this.hls,y=this.levels,p=this.media,k=this.trackId,F=x.config;if(!y||!y[k])return;if(!p&&(this.startFragRequested||!F.startFragPrefetch))return;var U=y[k],W=U.details;if(!W||W.live&&this.levelLastLoaded!==k||this.waitForCdnTuneIn(W)){this.state=I.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,f.ElementaryStreamTypes.AUDIO,A.PlaylistLevelType.AUDIO));var _=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,A.PlaylistLevelType.AUDIO);if(_===null)return;var M=_.len,G=this.getMaxBufferLength(),Y=this.audioSwitch;if(M>=G&&!Y)return;if(!Y&&this._streamEnded(_,W)){x.trigger(O.Events.BUFFER_EOS,{type:"audio"}),this.state=I.State.ENDED;return}var Z=W.fragments,ne=Z[0].start,be=_.end;if(Y){var me=this.getLoadPosition();be=me,W.PTSKnown&&me<ne&&((_.end>ne||_.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),p.currentTime=ne+.05))}var pe=this.getNextFragment(be,W);if(!pe){this.bufferFlushed=!0;return}((u=pe.decryptdata)===null||u===void 0?void 0:u.keyFormat)==="identity"&&!((a=pe.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(pe,W):this.loadFragment(pe,W,be)},h.getMaxBufferLength=function(){var u=D.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,A.PlaylistLevelType.MAIN);return a===null?u:Math.max(u,a.len)},h.onMediaDetaching=function(){this.videoBuffer=null,D.prototype.onMediaDetaching.call(this)},h.onAudioTracksUpdated=function(u,a){var x=a.audioTracks;this.resetTransmuxer(),this.levels=x.map(function(y){return new R.Level(y)})},h.onAudioTrackSwitching=function(u,a){var x=!!a.url;this.trackId=a.id;var y=this.fragCurrent;y!=null&&y.loader&&y.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),x?this.setInterval(g):this.resetTransmuxer(),x?(this.audioSwitch=!0,this.state=I.State.IDLE):this.state=I.State.STOPPED,this.tick()},h.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},h.onLevelLoaded=function(u,a){this.mainDetails=a.details},h.onAudioTrackLoaded=function(u,a){var x,y=this.levels,p=a.details,k=a.id;if(!y){this.warn("Audio tracks were reset while loading level "+k);return}this.log("Track "+k+" loaded ["+p.startSN+","+p.endSN+"],duration:"+p.totalduration);var F=y[k],U=0;if(p.live||(x=F.details)!==null&&x!==void 0&&x.live){var W=this.mainDetails;if(p.fragments[0]||(p.deltaUpdateFailed=!0),p.deltaUpdateFailed||!W)return;!F.details&&p.hasProgramDateTime&&W.hasProgramDateTime?(Object(E.alignMediaPlaylistByPDT)(p,W),U=p.fragments[0].start):U=this.alignPlaylists(p,F.details)}F.details=p,this.levelLastLoaded=k,!this.startFragRequested&&(this.mainDetails||!p.live)&&this.setStartPosition(F.details,U),this.state===I.State.WAITING_TRACK&&!this.waitForCdnTuneIn(p)&&(this.state=I.State.IDLE),this.tick()},h._handleFragmentLoadProgress=function(u){var a,x=u.frag,y=u.part,p=u.payload,k=this.config,F=this.trackId,U=this.levels;if(!U){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+x.sn+" of level "+x.level+" will not be buffered");return}var W=U[F];console.assert(W,"Audio track is defined on fragment load progress");var _=W.details;console.assert(_,"Audio track details are defined on fragment load progress");var M=k.defaultAudioCodec||W.audioCodec||"mp4a.40.2",G=this.transmuxer;G||(G=this.transmuxer=new P.default(this.hls,A.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Y=this.initPTS[x.cc],Z=(a=x.initSegment)===null||a===void 0?void 0:a.data;if(Y!==void 0){var ne=!1,be=y?y.index:-1,me=be!==-1,pe=new w.ChunkMetadata(x.level,x.sn,x.stats.chunkCount,p.byteLength,be,me);G.push(p,Z,M,"",x,y,_.totalduration,ne,pe,Y)}else{o.logger.log("Unknown video PTS for cc "+x.cc+", waiting for video PTS before demuxing audio frag "+x.sn+" of ["+_.startSN+" ,"+_.endSN+"],track "+F);var ue=this.waitingData=this.waitingData||{frag:x,part:y,cache:new v.default,complete:!1},fe=ue.cache;fe.push(new Uint8Array(p)),this.waitingVideoCC=this.videoTrackCC,this.state=I.State.WAITING_INIT_PTS}},h._handleFragmentLoadComplete=function(u){if(this.waitingData){this.waitingData.complete=!0;return}D.prototype._handleFragmentLoadComplete.call(this,u)},h.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},h.onBufferCreated=function(u,a){var x=a.tracks.audio;x&&(this.mediaBuffer=x.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},h.onFragBuffered=function(u,a){var x=a.frag,y=a.part;if(x.type!==A.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(x)){this.warn("Fragment "+x.sn+(y?" p: "+y.index:"")+" of level "+x.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}x.sn!=="initSegment"&&(this.fragPrevious=x,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(x,y)},h.onError=function(u,a){switch(a.details){case l.ErrorDetails.FRAG_LOAD_ERROR:case l.ErrorDetails.FRAG_LOAD_TIMEOUT:case l.ErrorDetails.KEY_LOAD_ERROR:case l.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.AUDIO,a);break;case l.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case l.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 l.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var x=!0,y=this.getFwdBufferInfo(this.mediaBuffer,A.PlaylistLevelType.AUDIO);y&&y.len>.5&&(x=!this.reduceMaxBufferLength(y.len)),x&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},h.onBufferFlushed=function(u,a){var x=a.type;x===f.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(u){var a,x="audio",y=this.hls,p=u.remuxResult,k=u.chunkMeta,F=this.getCurrentContext(k);if(!F){this.warn("The loading context changed while buffering fragment "+k.sn+" of level "+k.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(k.level);return}var U=F.frag,W=F.part,_=p.audio,M=p.text,G=p.id3,Y=p.initSegment;if(this.fragContextChanged(U))return;if(this.state=I.State.PARSING,this.audioSwitch&&_&&this.completeAudioSwitch(),Y!=null&&Y.tracks&&(this._bufferInitSegment(Y.tracks,U,k),y.trigger(O.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:x,tracks:Y.tracks})),_){var Z=_.startPTS,ne=_.endPTS,be=_.startDTS,me=_.endDTS;W&&(W.elementaryStreams[f.ElementaryStreamTypes.AUDIO]={startPTS:Z,endPTS:ne,startDTS:be,endDTS:me}),U.setElementaryStreamInfo(f.ElementaryStreamTypes.AUDIO,Z,ne,be,me),this.bufferFragmentData(_,U,W,k)}if(G!=null&&(a=G.samples)!==null&&a!==void 0&&a.length){var pe=s({frag:U,id:x},G);y.trigger(O.Events.FRAG_PARSING_METADATA,pe)}if(M){var ue=s({frag:U,id:x},M);y.trigger(O.Events.FRAG_PARSING_USERDATA,ue)}},h._bufferInitSegment=function(u,a,x){if(this.state!==I.State.PARSING)return;u.video&&delete u.video;var y=u.audio;if(!y)return;y.levelCodec=y.codec,y.id="audio",this.log("Init audio buffer, container:"+y.container+", codecs[parsed]=["+y.codec+"]"),this.hls.trigger(O.Events.BUFFER_CODECS,u);var p=y.initSegment;if(p!=null&&p.byteLength){var k={type:"audio",frag:a,part:null,chunkMeta:x,parent:a.type,data:p};this.hls.trigger(O.Events.BUFFER_APPENDING,k)}this.tick()},h.loadFragment=function(u,a,x){var y=this.fragmentTracker.getState(u);this.fragCurrent=u,(this.audioSwitch||y===N.FragmentState.NOT_LOADED||y===N.FragmentState.PARTIAL)&&(u.sn==="initSegment"?this._loadInitSegment(u):a.live&&!Object(H.isFiniteNumber)(this.initPTS[u.cc])?(this.log("Waiting for video PTS in continuity counter "+u.cc+" of live stream before loading audio fragment "+u.sn+" of level "+this.trackId),this.state=I.State.WAITING_INIT_PTS):(this.startFragRequested=!0,D.prototype.loadFragment.call(this,u,a,x)))},h.completeAudioSwitch=function(){var u=this.hls,a=this.media,x=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,u.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:x})},T}(I.default);K.default=m},"./src/controller/audio-track-controller.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/events.ts"),I=L("./src/errors.ts"),O=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function N(P,w){for(var b=0;b<w.length;b++){var E=w[b];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(P,E.key,E)}}function R(P,w,b){return w&&N(P.prototype,w),b&&N(P,b),P}function A(P,w){P.prototype=Object.create(w.prototype),P.prototype.constructor=P,f(P,w)}function f(P,w){return f=Object.setPrototypeOf||function(E,l){return E.__proto__=l,E},f(P,w)}var v=function(P){A(w,P);function w(E){var l;return l=P.call(this,E,"[audio-track-controller]")||this,l.tracks=[],l.groupId=null,l.tracksInGroup=[],l.trackId=-1,l.trackName="",l.selectDefaultTrack=!0,l.registerListeners(),l}var b=w.prototype;return b.registerListeners=function(){var l=this.hls;l.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.on(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(H.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var l=this.hls;l.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.off(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(H.Events.ERROR,this.onError,this)},b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,P.prototype.destroy.call(this)},b.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},b.onManifestParsed=function(l,o){this.tracks=o.audioTracks||[]},b.onAudioTrackLoaded=function(l,o){var s=o.id,d=o.details,C=this.tracksInGroup[s];if(!C){this.warn("Invalid audio track id "+s);return}var g=C.details;C.details=o.details,this.log("audioTrack "+s+" loaded ["+d.startSN+"-"+d.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,o,g))},b.onLevelLoading=function(l,o){this.switchLevel(o.level)},b.onLevelSwitching=function(l,o){this.switchLevel(o.level)},b.switchLevel=function(l){var o=this.hls.levels[l];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(g){return!s||g.groupId===s});this.selectDefaultTrack&&!d.some(function(g){return g.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=d;var C={audioTracks:d};this.log("Updating audio tracks, "+d.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(H.Events.AUDIO_TRACKS_UPDATED,C),this.selectInitialTrack()}},b.onError=function(l,o){if(P.prototype.onError.call(this,l,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)},b.setAudioTrack=function(l){var o=this.tracksInGroup;if(l<0||l>=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 "+l);var d=o[l],C=d.id,g=d.groupId,m=g===void 0?"":g,D=d.name,T=d.type,h=d.url;if(this.trackId=l,this.trackName=D,this.selectDefaultTrack=!1,this.hls.trigger(H.Events.AUDIO_TRACK_SWITCHING,{id:C,groupId:m,name:D,type:T,url:h}),d.details&&!d.details.live)return;var c=this.switchParams(d.url,s==null?void 0:s.details);this.loadPlaylist(c)},b.selectInitialTrack=function(){var l=this.tracksInGroup;console.assert(l.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(H.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},b.findTrackId=function(l){for(var o=this.tracksInGroup,s=0;s<o.length;s++){var d=o[s];if((!this.selectDefaultTrack||d.default)&&(!l||l===d.name))return d.id}return-1},b.loadPlaylist=function(l){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var s=o.id,d=o.groupId,C=o.url;if(l)try{C=l.addDirectives(C)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(H.Events.AUDIO_TRACK_LOADING,{url:C,id:s,groupId:d,deliveryDirectives:l||null})}},R(w,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(l){this.selectDefaultTrack=!1,this.setAudioTrack(l)}}]),w}(O.default);K.default=v},"./src/controller/base-playlist-controller.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return R});var H=L("./src/polyfills/number.ts"),I=L("./src/types/level.ts"),O=L("./src/controller/level-helper.ts"),B=L("./src/utils/logger.ts"),N=L("./src/errors.ts"),R=function(){function A(v,P){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,P+":"),this.warn=B.logger.warn.bind(B.logger,P+":"),this.hls=v}var f=A.prototype;return f.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},f.onError=function(P,w){w.fatal&&w.type===N.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},f.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},f.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},f.stopLoad=function(){this.canLoad=!1,this.clearTimer()},f.switchParams=function(P,w){var b=w==null?void 0:w.renditionReports;if(b)for(var E=0;E<b.length;E++){var l=b[E],o=""+l.URI;if(o===P.substr(-o.length)){var s=parseInt(l["LAST-MSN"]),d=parseInt(l["LAST-PART"]);if(w&&this.hls.config.lowLatencyMode){var C=Math.min(w.age-w.partTarget,w.targetduration);d!==void 0&&C>w.partTarget&&(d+=1)}if(Object(H.isFiniteNumber)(s))return new I.HlsUrlParameters(s,Object(H.isFiniteNumber)(d)?d:void 0,I.HlsSkip.No)}}},f.loadPlaylist=function(P){},f.shouldLoadTrack=function(P){return this.canLoad&&P&&!!P.url&&(!P.details||P.details.live)},f.playlistLoaded=function(P,w,b){var E=this,l=w.details,o=w.stats,s=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(l.advancedDateTime=Date.now()-s,l.live||b!=null&&b.live){if(l.reloaded(b),b&&this.log("live playlist "+P+" "+(l.advanced?"REFRESHED "+l.lastPartSn+"-"+l.lastPartIndex:"MISSED")),b&&l.fragments.length>0&&Object(O.mergeDetails)(b,l),!this.canLoad||!l.live)return;var d,C=void 0,g=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var m=this.hls.config.lowLatencyMode,D=l.lastPartSn,T=l.endSN,h=l.lastPartIndex,c=h!==-1,u=D===T,a=m?0:h;c?(C=u?T+1:D,g=u?a:h+1):C=T+1;var x=l.age,y=x+l.ageHeader,p=Math.min(y-l.partTarget,l.targetduration*1.5);if(p>0){if(b&&p>b.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+b.tuneInGoal+" to: "+p+" with playlist age: "+l.age),p=0;else{var k=Math.floor(p/l.targetduration);if(C+=k,g!==void 0){var F=Math.round(p%l.targetduration/l.partTarget);g+=F}this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+x.toFixed(2)+"s goal: "+p+" skip sn "+k+" to part "+g)}l.tuneInGoal=p}if(d=this.getDeliveryDirectives(l,w.deliveryDirectives,C,g),m||!u){this.loadPlaylist(d);return}}else d=this.getDeliveryDirectives(l,w.deliveryDirectives,C,g);var U=Object(O.computeReloadInterval)(l,o);C!==void 0&&l.canBlockReload&&(U-=l.partTarget||1),this.log("reload live playlist "+P+" in "+Math.round(U)+" ms"),this.timer=self.setTimeout(function(){return E.loadPlaylist(d)},U)}else this.clearTimer()},f.getDeliveryDirectives=function(P,w,b,E){var l=Object(I.getSkipValue)(P,b);return w!=null&&w.skip&&P.deltaUpdateFailed&&(b=w.msn,E=w.part,l=I.HlsSkip.No),new I.HlsUrlParameters(b,E,l)},f.retryLoadingOrFail=function(P){var w=this,b=this.hls.config,E=this.retryCount<b.levelLoadingMaxRetry;if(E){var l;if(this.retryCount++,P.details.indexOf("LoadTimeOut")>-1&&(l=P.context)!==null&&l!==void 0&&l.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+P.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*b.levelLoadingRetryDelay,b.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return w.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+P.details+'"')}}else this.warn('cannot recover from error "'+P.details+'"'),this.clearTimer(),P.fatal=!0;return E},A}()},"./src/controller/base-stream-controller.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"State",function(){return T}),L.d(K,"default",function(){return h});var H=L("./src/polyfills/number.ts"),I=L("./src/task-loop.ts"),O=L("./src/controller/fragment-tracker.ts"),B=L("./src/utils/buffer-helper.ts"),N=L("./src/utils/logger.ts"),R=L("./src/events.ts"),A=L("./src/errors.ts"),f=L("./src/types/transmuxer.ts"),v=L("./src/utils/mp4-tools.ts"),P=L("./src/utils/discontinuities.ts"),w=L("./src/controller/fragment-finders.ts"),b=L("./src/controller/level-helper.ts"),E=L("./src/loader/fragment-loader.ts"),l=L("./src/crypt/decrypter.ts"),o=L("./src/utils/time-ranges.ts"),s=L("./src/types/loader.ts");function d(c,u){for(var a=0;a<u.length;a++){var x=u[a];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(c,x.key,x)}}function C(c,u,a){return u&&d(c.prototype,u),a&&d(c,a),c}function g(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function m(c,u){c.prototype=Object.create(u.prototype),c.prototype.constructor=c,D(c,u)}function D(c,u){return D=Object.setPrototypeOf||function(x,y){return x.__proto__=y,x},D(c,u)}var T={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},h=function(c){m(u,c);function u(x,y,p){var k;return k=c.call(this)||this,k.hls=void 0,k.fragPrevious=null,k.fragCurrent=null,k.fragmentTracker=void 0,k.transmuxer=null,k._state=T.STOPPED,k.media=void 0,k.mediaBuffer=void 0,k.config=void 0,k.bitrateTest=!1,k.lastCurrentTime=0,k.nextLoadPosition=0,k.startPosition=0,k.loadedmetadata=!1,k.fragLoadError=0,k.retryDate=0,k.levels=null,k.fragmentLoader=void 0,k.levelLastLoaded=null,k.startFragRequested=!1,k.decrypter=void 0,k.initPTS=[],k.onvseeking=null,k.onvended=null,k.logPrefix="",k.log=void 0,k.warn=void 0,k.logPrefix=p,k.log=N.logger.log.bind(N.logger,p+":"),k.warn=N.logger.warn.bind(N.logger,p+":"),k.hls=x,k.fragmentLoader=new E.default(x.config),k.fragmentTracker=y,k.config=x.config,k.decrypter=new l.default(x,x.config),x.on(R.Events.KEY_LOADED,k.onKeyLoaded,g(k)),k}var a=u.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(y){},a.stopLoad=function(){this.fragmentLoader.abort();var y=this.fragCurrent;y&&this.fragmentTracker.removeFragment(y),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=T.STOPPED},a._streamEnded=function(y,p){var k=this.fragCurrent,F=this.fragmentTracker;if(!p.live&&k&&k.sn===p.endSN&&!y.nextStart){var U=F.getState(k);return U===O.FragmentState.PARTIAL||U===O.FragmentState.OK}return!1},a.onMediaAttached=function(y,p){var k=this.media=this.mediaBuffer=p.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),k.addEventListener("seeking",this.onvseeking),k.addEventListener("ended",this.onvended);var F=this.config;this.levels&&F.autoStartLoad&&this.state===T.STOPPED&&this.startLoad(F.startPosition)},a.onMediaDetaching=function(){var y=this.media;y!=null&&y.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),y&&(y.removeEventListener("seeking",this.onvseeking),y.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 y=this.config,p=this.fragCurrent,k=this.media,F=this.mediaBuffer,U=this.state,W=k?k.currentTime:0,_=B.BufferHelper.bufferInfo(F||k,W,y.maxBufferHole);if(this.log("media seeking to "+(Object(H.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+U),U===T.ENDED)this.resetLoadingState();else if(p&&!_.len){var M=y.maxFragLookUpTolerance,G=p.start-M,Y=p.start+p.duration+M,Z=W>Y;(W<G||Z)&&(Z&&p.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),p.loader.abort()),this.resetLoadingState())}k&&(this.lastCurrentTime=W),!this.loadedmetadata&&!_.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(y,p){if(this.state!==T.KEY_LOADING||p.frag!==this.fragCurrent||!this.levels)return;this.state=T.IDLE;var k=this.levels[p.frag.level].details;k&&this.loadFragment(p.frag,k,p.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=T.STOPPED,this.hls.off(R.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(y,p){this.log("Loading key for "+y.sn+" of ["+p.startSN+"-"+p.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level),this.state=T.KEY_LOADING,this.fragCurrent=y,this.hls.trigger(R.Events.KEY_LOADING,{frag:y})},a.loadFragment=function(y,p,k){this._loadFragForPlayback(y,p,k)},a._loadFragForPlayback=function(y,p,k){var F=this,U=function(_){if(F.fragContextChanged(y)){F.warn("Fragment "+y.sn+(_.part?" p: "+_.part.index:"")+" of level "+y.level+" was dropped during download."),F.fragmentTracker.removeFragment(y);return}y.stats.chunkCount++,F._handleFragmentLoadProgress(_)};this._doFragLoad(y,p,k,U).then(function(W){if(!W)return;F.fragLoadError=0;var _=F.state;if(F.fragContextChanged(y)){(_===T.FRAG_LOADING||_===T.BACKTRACKING||!F.fragCurrent&&_===T.PARSING)&&(F.fragmentTracker.removeFragment(y),F.state=T.IDLE);return}if("payload"in W&&(F.log("Loaded fragment "+y.sn+" of level "+y.level),F.hls.trigger(R.Events.FRAG_LOADED,W),F.state===T.BACKTRACKING)){F.fragmentTracker.backtrack(y,W),F.resetFragmentLoading(y);return}F._handleFragmentLoadComplete(W)}).catch(function(W){F.warn(W),F.resetFragmentLoading(y)})},a.flushMainBuffer=function(y,p,k){if(k===void 0&&(k=null),!(y-p))return;var F={startOffset:y,endOffset:p,type:k};this.fragLoadError=0,this.hls.trigger(R.Events.BUFFER_FLUSHING,F)},a._loadInitSegment=function(y){var p=this;this._doFragLoad(y).then(function(k){if(!k||p.fragContextChanged(y)||!p.levels)throw new Error("init load aborted");return k}).then(function(k){var F=p.hls,U=k.payload,W=y.decryptdata;if(U&&U.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var _=self.performance.now();return p.decrypter.webCryptoDecrypt(new Uint8Array(U),W.key.buffer,W.iv.buffer).then(function(M){var G=self.performance.now();return F.trigger(R.Events.FRAG_DECRYPTED,{frag:y,payload:M,stats:{tstart:_,tdecrypt:G}}),k.payload=M,k})}return k}).then(function(k){var F=p.fragCurrent,U=p.hls,W=p.levels;if(!W)throw new Error("init load aborted, missing levels");var _=W[y.level].details;console.assert(_,"Level details are defined when init segment is loaded");var M=y.stats;p.state=T.IDLE,p.fragLoadError=0,y.data=new Uint8Array(k.payload),M.parsing.start=M.buffering.start=self.performance.now(),M.parsing.end=M.buffering.end=self.performance.now(),k.frag===F&&U.trigger(R.Events.FRAG_BUFFERED,{stats:M,frag:F,part:null,id:y.type}),p.tick()}).catch(function(k){p.warn(k),p.resetFragmentLoading(y)})},a.fragContextChanged=function(y){var p=this.fragCurrent;return!y||!p||y.level!==p.level||y.sn!==p.sn||y.urlId!==p.urlId},a.fragBufferedComplete=function(y,p){var k=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+y.type+" sn: "+y.sn+(p?" part: "+p.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level+" "+o.default.toString(B.BufferHelper.getBuffered(k))),this.state=T.IDLE,this.tick()},a._handleFragmentLoadComplete=function(y){var p=this.transmuxer;if(!p)return;var k=y.frag,F=y.part,U=y.partsLoaded,W=!U||U.length===0||U.some(function(M){return!M}),_=new f.ChunkMetadata(k.level,k.sn,k.stats.chunkCount+1,0,F?F.index:-1,!W);p.flush(_)},a._handleFragmentLoadProgress=function(y){},a._doFragLoad=function(y,p,k,F){var U=this;if(k===void 0&&(k=null),!this.levels)throw new Error("frag load aborted, missing levels");if(k=Math.max(y.start,k||0),this.config.lowLatencyMode&&p){var W=p.partList;if(W&&F){k>y.end&&p.fragmentHint&&(y=p.fragmentHint);var _=this.getNextPart(W,y,k);if(_>-1){var M=W[_];return this.log("Loading part sn: "+y.sn+" p: "+M.index+" cc: "+y.cc+" of playlist ["+p.startSN+"-"+p.endSN+"] parts [0-"+_+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(k.toFixed(3))),this.nextLoadPosition=M.start+M.duration,this.state=T.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:y,part:W[_],targetBufferTime:k}),this.doFragPartsLoad(y,W,_,F).catch(function(G){return U.handleFragLoadError(G)})}else if(!y.url||this.loadedEndOfParts(W,k))return Promise.resolve(null)}}return this.log("Loading fragment "+y.sn+" cc: "+y.cc+" "+(p?"of ["+p.startSN+"-"+p.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(k.toFixed(3))),Object(H.isFiniteNumber)(y.sn)&&!this.bitrateTest&&(this.nextLoadPosition=y.start+y.duration),this.state=T.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:y,targetBufferTime:k}),this.fragmentLoader.load(y,F).catch(function(G){return U.handleFragLoadError(G)})},a.doFragPartsLoad=function(y,p,k,F){var U=this;return new Promise(function(W,_){var M=[],G=function Y(Z){var ne=p[Z];U.fragmentLoader.loadPart(y,ne,F).then(function(be){M[ne.index]=be;var me=be.part;U.hls.trigger(R.Events.FRAG_LOADED,be);var pe=p[Z+1];if(pe&&pe.fragment===y)Y(Z+1);else return W({frag:y,part:me,partsLoaded:M})}).catch(_)};G(k)})},a.handleFragLoadError=function(y){var p=y.data;return p&&p.details===A.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(p.frag,p.part):this.hls.trigger(R.Events.ERROR,p),null},a._handleTransmuxerFlush=function(y){var p=this.getCurrentContext(y);if(!p||this.state!==T.PARSING){this.fragCurrent||(this.state=T.IDLE);return}var k=p.frag,F=p.part,U=p.level,W=self.performance.now();k.stats.parsing.end=W,F&&(F.stats.parsing.end=W),this.updateLevelTiming(k,F,U,y.partial)},a.getCurrentContext=function(y){var p=this.levels,k=y.level,F=y.sn,U=y.part;if(!p||!p[k])return this.warn("Levels object was unset while buffering fragment "+F+" of level "+k+". The current chunk will not be buffered."),null;var W=p[k],_=U>-1?Object(b.getPartWith)(W,F,U):null,M=_?_.fragment:Object(b.getFragmentWithSN)(W,F,this.fragCurrent);return M?{frag:M,part:_,level:W}:null},a.bufferFragmentData=function(y,p,k,F){if(!y||this.state!==T.PARSING)return;var U=y.data1,W=y.data2,_=U;if(U&&W&&(_=Object(v.appendUint8Array)(U,W)),!_||!_.length)return;var M={type:y.type,frag:p,part:k,chunkMeta:F,parent:p.type,data:_};this.hls.trigger(R.Events.BUFFER_APPENDING,M),y.dropped&&y.independent&&!k&&this.flushBufferGap(p)},a.flushBufferGap=function(y){var p=this.media;if(!p)return;if(!B.BufferHelper.isBuffered(p,p.currentTime)){this.flushMainBuffer(0,y.start);return}var k=p.currentTime,F=B.BufferHelper.bufferInfo(p,k,0),U=y.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,U*.25),_=Math.max(Math.min(y.start-W,F.end-W),k+W);y.start-_>W&&this.flushMainBuffer(_,y.start)},a.getFwdBufferInfo=function(y,p){var k=this.config,F=this.getLoadPosition();if(!Object(H.isFiniteNumber)(F))return null;var U=B.BufferHelper.bufferInfo(y,F,k.maxBufferHole);if(U.len===0&&U.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(F,p);if(W&&U.nextStart<W.end)return B.BufferHelper.bufferInfo(y,F,Math.max(U.nextStart,k.maxBufferHole))}return U},a.getMaxBufferLength=function(y){var p=this.config,k;return y?k=Math.max(8*p.maxBufferSize/y,p.maxBufferLength):k=p.maxBufferLength,Math.min(k,p.maxMaxBufferLength)},a.reduceMaxBufferLength=function(y){var p=this.config,k=y||p.maxBufferLength;return p.maxMaxBufferLength>=k?(p.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+p.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(y,p){var k,F,U=p.fragments,W=U.length;if(!W)return null;var _=this.config,M=U[0].start,G;if(p.live){var Y=_.initialLiveManifestSize;if(W<Y)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+Y+")"),null;!p.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(G=this.getInitialLiveFragment(p,U),this.startPosition=G?this.hls.liveSyncPosition||G.start:y)}else y<=M&&(G=U[0]);if(!G){var Z=_.lowLatencyMode?p.partEnd:p.fragmentEnd;G=this.getFragmentAtPosition(y,Z,p)}return(k=G)!==null&&k!==void 0&&k.initSegment&&!((F=G)!==null&&F!==void 0&&F.initSegment.data)&&!this.bitrateTest&&(G=G.initSegment),G},a.getNextPart=function(y,p,k){for(var F=-1,U=!1,W=!0,_=0,M=y.length;_<M;_++){var G=y[_];if(W=W&&!G.independent,F>-1&&k<G.start)break;var Y=G.loaded;!Y&&(U||G.independent||W)&&G.fragment===p&&(F=_),U=Y}return F},a.loadedEndOfParts=function(y,p){var k=y[y.length-1];return k&&p>k.start&&k.loaded},a.getInitialLiveFragment=function(y,p){var k=this.fragPrevious,F=null;if(k){if(y.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+k.programDateTime),F=Object(w.findFragmentByPDT)(p,k.endProgramDateTime,this.config.maxFragLookUpTolerance)),!F){var U=k.sn+1;if(U>=y.startSN&&U<=y.endSN){var W=p[U-y.startSN];k.cc===W.cc&&(F=W,this.log("Live playlist, switching playlist, load frag with next SN: "+F.sn))}F||(F=Object(w.findFragWithCC)(p,k.cc),F&&this.log("Live playlist, switching playlist, load frag with same CC: "+F.sn))}}else{var _=this.hls.liveSyncPosition;_!==null&&(F=this.getFragmentAtPosition(_,this.bitrateTest?y.fragmentEnd:y.edge,y))}return F},a.getFragmentAtPosition=function(y,p,k){var F=this.config,U=this.fragPrevious,W=k.fragments,_=k.endSN,M=k.fragmentHint,G=F.maxFragLookUpTolerance,Y=!!(F.lowLatencyMode&&k.partList&&M);Y&&M&&!this.bitrateTest&&(W=W.concat(M),_=M.sn);var Z;if(y<p){var ne=y>p-G?0:G;Z=Object(w.findFragmentByPTS)(U,W,y,ne)}else Z=W[W.length-1];if(Z){var be=Z.sn-k.startSN,me=U&&Z.level===U.level,pe=W[be+1],ue=this.fragmentTracker.getState(Z);if(ue===O.FragmentState.BACKTRACKED){Z=null;for(var fe=be;W[fe]&&this.fragmentTracker.getState(W[fe])===O.FragmentState.BACKTRACKED;)U?Z=W[fe--]:Z=W[--fe];Z||(Z=pe)}else U&&Z.sn===U.sn&&!Y&&(me&&(Z.sn<_&&this.fragmentTracker.getState(pe)!==O.FragmentState.OK?(this.log("SN "+Z.sn+" just loaded, load next one: "+pe.sn),Z=pe):Z=null))}return Z},a.synchronizeToLiveEdge=function(y){var p=this.config,k=this.media;if(!k)return;var F=this.hls.liveSyncPosition,U=k.currentTime,W=y.fragments[0].start,_=y.edge,M=U>=W-p.maxFragLookUpTolerance&&U<=_;if(F!==null&&k.duration>F&&(U<F||!M)){var G=p.liveMaxLatencyDuration!==void 0?p.liveMaxLatencyDuration:p.liveMaxLatencyDurationCount*y.targetduration;(!M&&k.readyState<4||U<_-G)&&(this.loadedmetadata||(this.nextLoadPosition=F),k.readyState&&(this.warn("Playback: "+U.toFixed(3)+" is located too far from the end of live sliding playlist: "+_+", reset currentTime to : "+F.toFixed(3)),k.currentTime=F))}},a.alignPlaylists=function(y,p){var k=this.levels,F=this.levelLastLoaded,U=this.fragPrevious,W=F!==null?k[F]:null,_=y.fragments.length;if(!_)return this.warn("No fragments in live playlist"),0;var M=y.fragments[0].start,G=!p,Y=y.alignedSliding&&Object(H.isFiniteNumber)(M);if(G||!Y&&!M){Object(P.alignStream)(U,W,y);var Z=y.fragments[0].start;return this.log("Live playlist sliding: "+Z.toFixed(2)+" start-sn: "+(p?p.startSN:"na")+"->"+y.startSN+" prev-sn: "+(U?U.sn:"na")+" fragments: "+_),Z}return M},a.waitForCdnTuneIn=function(y){var p=3;return y.live&&y.canBlockReload&&y.tuneInGoal>Math.max(y.partHoldBack,y.partTarget*p)},a.setStartPosition=function(y,p){var k=this.startPosition;if(k<p&&(k=-1),k===-1||this.lastCurrentTime===-1){var F=y.startTimeOffset;Object(H.isFiniteNumber)(F)?(k=p+F,F<0&&(k+=y.totalduration),k=Math.min(Math.max(p,k),p+y.totalduration),this.log("Start time offset "+F+" found in playlist, adjust startPosition to "+k),this.startPosition=k):y.live?k=this.hls.liveSyncPosition||p:this.startPosition=k=0,this.lastCurrentTime=k}this.nextLoadPosition=k},a.getLoadPosition=function(){var y=this.media,p=0;return this.loadedmetadata&&y?p=y.currentTime:this.nextLoadPosition&&(p=this.nextLoadPosition),p},a.handleFragLoadAborted=function(y,p){this.transmuxer&&y.sn!=="initSegment"&&y.stats.aborted&&(this.warn("Fragment "+y.sn+(p?" part"+p.index:"")+" of level "+y.level+" was aborted"),this.resetFragmentLoading(y))},a.resetFragmentLoading=function(y){(!this.fragCurrent||!this.fragContextChanged(y))&&(this.state=T.IDLE)},a.onFragmentOrKeyLoadError=function(y,p){if(p.fatal)return;var k=p.frag;if(!k||k.type!==y)return;var F=this.fragCurrent;console.assert(F&&k.sn===F.sn&&k.level===F.level&&k.urlId===F.urlId,"Frag load error must match current frag to retry");var U=this.config;if(this.fragLoadError+1<=U.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(k.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*U.fragLoadingRetryDelay,U.fragLoadingMaxRetryTimeout);this.warn("Fragment "+k.sn+" of "+y+" "+k.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=T.FRAG_LOADING_WAITING_RETRY}else p.levelRetry?(y===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=T.IDLE):(N.logger.error(p.details+" reaches max retry, redispatch as fatal ..."),p.fatal=!0,this.hls.stopLoad(),this.state=T.ERROR)},a.afterBufferFlushed=function(y,p,k){if(!y)return;var F=B.BufferHelper.getBuffered(y);this.fragmentTracker.detectEvictedFragments(p,F,k),this.state===T.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=T.IDLE},a.resetLiveStartWhenNotLoaded=function(y){if(!this.loadedmetadata){this.startFragRequested=!1;var p=this.levels?this.levels[y].details:null;if(p!=null&&p.live)return this.startPosition=-1,this.setStartPosition(p,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(y,p,k,F){var U=this,W=k.details;console.assert(!!W,"level.details must be defined");var _=Object.keys(y.elementaryStreams).reduce(function(M,G){var Y=y.elementaryStreams[G];if(Y){var Z=Y.endPTS-Y.startPTS;if(Z<=0)return U.warn("Could not parse fragment "+y.sn+" "+G+" duration reliably ("+Z+") resetting transmuxer to fallback to playlist timing"),U.resetTransmuxer(),M||!1;var ne=F?0:Object(b.updateFragPTSDTS)(W,y,Y.startPTS,Y.endPTS,Y.startDTS,Y.endDTS);return U.hls.trigger(R.Events.LEVEL_PTS_UPDATED,{details:W,level:k,drift:ne,type:G,frag:y,start:Y.startPTS,end:Y.endPTS}),!0}return M},!1);_?(this.state=T.PARSED,this.hls.trigger(R.Events.FRAG_PARSED,{frag:y,part:p})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},C(u,[{key:"state",get:function(){return this._state},set:function(y){var p=this._state;p!==y&&(this._state=y,this.log(p+"->"+y))}}]),u}(I.default)},"./src/controller/buffer-controller.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return w});var H=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),O=L("./src/utils/logger.ts"),B=L("./src/errors.ts"),N=L("./src/utils/buffer-helper.ts"),R=L("./src/utils/mediasource-helper.ts"),A=L("./src/loader/fragment.ts"),f=L("./src/controller/buffer-operation-queue.ts"),v=Object(R.getMediaSource)(),P=/([ha]vc.)(?:\.[^.,]+)+/,w=function(){function b(l){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,C=o.mediaSource;O.logger.log("[buffer-controller]: Media source opened"),d&&(o.updateMediaElementDuration(),s.trigger(I.Events.MEDIA_ATTACHED,{media:d})),C&&C.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){O.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){O.logger.log("[buffer-controller]: Media source ended")},this.hls=l,this._initSourceBuffer(),this.registerListeners()}var E=b.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 f.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,O.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},E.onMediaAttaching=function(o,s){var d=this.media=s.media;if(d&&v){var C=this.mediaSource=new v;C.addEventListener("sourceopen",this._onMediaSourceOpen),C.addEventListener("sourceended",this._onMediaSourceEnded),C.addEventListener("sourceclose",this._onMediaSourceClose),d.src=self.URL.createObjectURL(C),this._objectUrl=d.src}},E.onMediaDetaching=function(){var o=this.media,s=this.mediaSource,d=this._objectUrl;if(s){if(O.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(C){O.logger.warn("[buffer-controller]: onMediaDetaching: "+C.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()):O.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(C){O.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",C)}}),this._initSourceBuffer()},E.onBufferCodecs=function(o,s){var d=this,C=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(g){if(C){var m=d.tracks[g];if(m&&typeof m.buffer.changeType=="function"){var D=s[g],T=D.codec,h=D.levelCodec,c=D.container,u=(m.levelCodec||m.codec).replace(P,"$1"),a=(h||T).replace(P,"$1");if(u!==a){var x=c+";codecs="+(h||T);d.appendChangeType(g,x)}}}else d.pendingTracks[g]=s[g]}),C)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,C=this.operationQueue,g={execute:function(){var D=d.sourceBuffer[o];D&&(O.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+s),D.changeType(s)),C.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(D){O.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",D)}};C.append(g,o)},E.onBufferAppending=function(o,s){var d=this,C=this.hls,g=this.operationQueue,m=this.tracks,D=s.data,T=s.type,h=s.frag,c=s.part,u=s.chunkMeta,a=u.buffering[T],x=self.performance.now();a.start=x;var y=h.stats.buffering,p=c?c.stats.buffering:null;y.start===0&&(y.start=x),p&&p.start===0&&(p.start=x);var k=m.audio,F=T==="audio"&&u.id===1&&(k==null?void 0:k.container)==="audio/mpeg",U={execute:function(){if(a.executeStart=self.performance.now(),F){var _=d.sourceBuffer[T];if(_){var M=h.start-_.timestampOffset;Math.abs(M)>=.1&&(O.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+M+") sn: "+h.sn+")"),_.timestampOffset=h.start)}}d.appendExecutor(D,T)},onStart:function(){},onComplete:function(){var _=self.performance.now();a.executeEnd=a.end=_,y.first===0&&(y.first=_),p&&p.first===0&&(p.first=_);var M=d.sourceBuffer,G={};for(var Y in M)G[Y]=N.BufferHelper.getBuffered(M[Y]);d.appendError=0,d.hls.trigger(I.Events.BUFFER_APPENDED,{type:T,frag:h,part:c,chunkMeta:u,parent:h.type,timeRanges:G})},onError:function(_){O.logger.error("[buffer-controller]: Error encountered while trying to append to the "+T+" SourceBuffer",_);var M={type:B.ErrorTypes.MEDIA_ERROR,parent:h.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:_,fatal:!1};_.code===DOMException.QUOTA_EXCEEDED_ERR?M.details=B.ErrorDetails.BUFFER_FULL_ERROR:(d.appendError++,M.details=B.ErrorDetails.BUFFER_APPEND_ERROR,d.appendError>C.config.appendErrorMaxRetry&&(O.logger.error("[buffer-controller]: Failed "+C.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),M.fatal=!0)),C.trigger(I.Events.ERROR,M)}};g.append(U,T)},E.onBufferFlushing=function(o,s){var d=this,C=this.operationQueue,g=function(D){return{execute:d.removeExecutor.bind(d,D,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){d.hls.trigger(I.Events.BUFFER_FLUSHED,{type:D})},onError:function(h){O.logger.warn("[buffer-controller]: Failed to remove from "+D+" SourceBuffer",h)}}};s.type?C.append(g(s.type),s.type):this.getSourceBufferTypes().forEach(function(m){C.append(g(m),m)})},E.onFragParsed=function(o,s){var d=this,C=s.frag,g=s.part,m=[],D=g?g.elementaryStreams:C.elementaryStreams;D[A.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(D[A.ElementaryStreamTypes.AUDIO]&&m.push("audio"),D[A.ElementaryStreamTypes.VIDEO]&&m.push("video"));var T=function(){var c=self.performance.now();C.stats.buffering.end=c,g&&(g.stats.buffering.end=c);var u=g?g.stats:C.stats;d.hls.trigger(I.Events.FRAG_BUFFERED,{frag:C,part:g,stats:u,id:C.type})};m.length===0&&O.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+C.type+" level: "+C.level+" sn: "+C.sn),this.blockBuffers(T,m)},E.onFragChanged=function(o,s){this.flushBackBuffer()},E.onBufferEos=function(o,s){var d=this,C=this.getSourceBufferTypes().reduce(function(g,m){var D=d.sourceBuffer[m];return(!s.type||s.type===m)&&(D&&!D.ended&&(D.ended=!0,O.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),g&&!!(!D||D.ended)},!0);C&&this.blockBuffers(function(){var g=d.mediaSource;if(!g||g.readyState!=="open")return;g.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,C=this.sourceBuffer;if(!d||s===null)return;var g=this.getSourceBufferTypes();if(!g.length)return;var m=s.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(H.isFiniteNumber)(m)||m<0)return;var D=d.currentTime,T=s.levelTargetDuration,h=Math.max(m,T),c=Math.floor(D/T)*T-h;g.forEach(function(u){var a=C[u];if(a){var x=N.BufferHelper.getBuffered(a);x.length>0&&c>x.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:u}))}})},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,C=this.mediaSource,g=o.fragments[0].start+o.totalduration,m=d.duration,D=Object(H.isFiniteNumber)(C.duration)?C.duration:0;o.live&&s.config.liveDurationInfinity?(O.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),C.duration=Infinity,this.updateSeekableRange(o)):(g>D&&g>m||!Object(H.isFiniteNumber)(m))&&(O.logger.log("[buffer-controller]: Updating Media Source duration to "+g.toFixed(3)),C.duration=g)},E.updateSeekableRange=function(o){var s=this.mediaSource,d=o.fragments,C=d.length;if(C&&o.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var g=Math.max(0,d[0].start),m=Math.max(g,g+o.totalduration);s.setLiveSeekableRange(g,m)}},E.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,s=this.operationQueue,d=this.pendingTracks,C=Object.keys(d).length;if(C&&!o||C===2){this.createSourceBuffers(d),this.pendingTracks={};var g=this.getSourceBufferTypes();if(g.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}g.forEach(function(m){s.executeNext(m)})}},E.createSourceBuffers=function(o){var s=this.sourceBuffer,d=this.mediaSource;if(!d)throw Error("createSourceBuffers called when mediaSource was null");var C=0;for(var g in o)if(!s[g]){var m=o[g];if(!m)throw Error("source buffer exists for track "+g+", however track does not");var D=m.levelCodec||m.codec,T=m.container+";codecs="+D;O.logger.log("[buffer-controller]: creating sourceBuffer("+T+")");try{var h=s[g]=d.addSourceBuffer(T),c=g;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[g]={buffer:h,codec:D,container:m.container,levelCodec:m.levelCodec,id:m.id},C++}catch(u){O.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+u.message),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,mimeType:T})}}C&&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){O.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 C=this.media,g=this.mediaSource,m=this.operationQueue,D=this.sourceBuffer,T=D[o];if(!C||!g||!T){O.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(o);return}var h=Object(H.isFiniteNumber)(C.duration)?C.duration:Infinity,c=Object(H.isFiniteNumber)(g.duration)?g.duration:Infinity,u=Math.max(0,s),a=Math.min(d,h,c);a>u?(O.logger.log("[buffer-controller]: Removing ["+u+","+a+"] from the "+o+" SourceBuffer"),console.assert(!T.updating,o+" sourceBuffer must not be updating"),T.remove(u,a)):m.shiftAndExecuteNext(o)},E.appendExecutor=function(o,s){var d=this.operationQueue,C=this.sourceBuffer,g=C[s];if(!g){O.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),d.shiftAndExecuteNext(s);return}g.ended=!1,console.assert(!g.updating,s+" sourceBuffer must not be updating"),g.appendBuffer(o)},E.blockBuffers=function(o,s){var d=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){O.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var C=this.operationQueue,g=s.map(function(m){return C.appendBlocker(m)});Promise.all(g).then(function(){o(),s.forEach(function(m){var D=d.sourceBuffer[m];(!D||!D.updating)&&C.shiftAndExecuteNext(m)})})},E.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},E.addBufferListener=function(o,s,d){var C=this.sourceBuffer[o];if(!C)return;var g=d.bind(this,o);this.listeners[o].push({event:s,listener:g}),C.addEventListener(s,g)},E.removeBufferListeners=function(o){var s=this.sourceBuffer[o];if(!s)return;this.listeners[o].forEach(function(d){s.removeEventListener(d.event,d.listener)})},b}()},"./src/controller/buffer-operation-queue.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return I});var H=L("./src/utils/logger.ts"),I=function(){function O(N){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=N}var B=O.prototype;return B.append=function(R,A){var f=this.queues[A];f.push(R),f.length===1&&this.buffers[A]&&this.executeNext(A)},B.insertAbort=function(R,A){var f=this.queues[A];f.unshift(R),this.executeNext(A)},B.appendBlocker=function(R){var A,f=new Promise(function(P){A=P}),v={execute:A,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(v,R),f},B.executeNext=function(R){var A=this.buffers,f=this.queues,v=A[R],P=f[R];if(P.length){var w=P[0];try{w.execute()}catch(b){H.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),w.onError(b),(!v||!v.updating)&&(P.shift(),this.executeNext(R))}}},B.shiftAndExecuteNext=function(R){this.queues[R].shift(),this.executeNext(R)},B.current=function(R){return this.queues[R][0]},O}()},"./src/controller/cap-level-controller.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/events.ts");function I(N,R){for(var A=0;A<R.length;A++){var f=R[A];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(N,f.key,f)}}function O(N,R,A){return R&&I(N.prototype,R),A&&I(N,A),N}var B=function(){function N(A){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=A,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var R=N.prototype;return R.setStreamController=function(f){this.streamController=f},R.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},R.registerListeners=function(){var f=this.hls;f.on(H.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),f.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),f.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.on(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),f.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.unregisterListener=function(){var f=this.hls;f.off(H.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),f.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),f.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.off(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),f.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.onFpsDropLevelCapping=function(f,v){N.isLevelAllowed(v.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(v.droppedLevel)},R.onMediaAttaching=function(f,v){this.media=v.media instanceof HTMLVideoElement?v.media:null},R.onManifestParsed=function(f,v){var P=this.hls;this.restrictedLevels=[],this.firstLevel=v.firstLevel,P.config.capLevelToPlayerSize&&v.video&&this.startCapping()},R.onBufferCodecs=function(f,v){var P=this.hls;P.config.capLevelToPlayerSize&&v.video&&this.startCapping()},R.onMediaDetaching=function(){this.stopCapping()},R.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var f=this.hls.levels;if(f.length){var v=this.hls;v.autoLevelCapping=this.getMaxLevel(f.length-1),v.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=v.autoLevelCapping}}},R.getMaxLevel=function(f){var v=this,P=this.hls.levels;if(!P.length)return-1;var w=P.filter(function(b,E){return N.isLevelAllowed(E,v.restrictedLevels)&&E<=f});return this.clientRect=null,N.getMaxLevelByMediaSize(w,this.mediaWidth,this.mediaHeight)},R.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()},R.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},R.getDimensions=function(){if(this.clientRect)return this.clientRect;var f=this.media,v={width:0,height:0};if(f){var P=f.getBoundingClientRect();v.width=P.width,v.height=P.height,!v.width&&!v.height&&(v.width=P.right-P.left||f.width||0,v.height=P.bottom-P.top||f.height||0)}return this.clientRect=v,v},N.isLevelAllowed=function(f,v){return v===void 0&&(v=[]),v.indexOf(f)===-1},N.getMaxLevelByMediaSize=function(f,v,P){if(!f||!f.length)return-1;for(var w=function(s,d){return d?s.width!==d.width||s.height!==d.height:!0},b=f.length-1,E=0;E<f.length;E+=1){var l=f[E];if((l.width>=v||l.height>=P)&&w(l,f[E+1])){b=E;break}}return b},O(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 f=1;try{f=self.devicePixelRatio}catch(v){}return f}}]),N}();K.default=B},"./src/controller/cmcd-controller.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return w});var H=L("./src/events.ts"),I=L("./src/types/cmcd.ts"),O=L("./src/utils/buffer-helper.ts"),B=L("./src/utils/logger.ts");function N(b,E){for(var l=0;l<E.length;l++){var o=E[l];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(b,o.key,o)}}function R(b,E,l){return E&&N(b.prototype,E),l&&N(b,l),b}function A(b,E){var l=typeof Symbol!="undefined"&&b[Symbol.iterator]||b["@@iterator"];if(l)return(l=l.call(b)).next.bind(l);if(Array.isArray(b)||(l=f(b))||E&&b&&typeof b.length=="number"){l&&(b=l);var o=0;return function(){return o>=b.length?{done:!0}:{done:!1,value:b[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 f(b,E){if(!b)return;if(typeof b=="string")return v(b,E);var l=Object.prototype.toString.call(b).slice(8,-1);if(l==="Object"&&b.constructor&&(l=b.constructor.name),l==="Map"||l==="Set")return Array.from(b);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return v(b,E)}function v(b,E){(E==null||E>b.length)&&(E=b.length);for(var l=0,o=new Array(E);l<E;l++)o[l]=b[l];return o}function P(){return P=Object.assign||function(b){for(var E=1;E<arguments.length;E++){var l=arguments[E];for(var o in l)Object.prototype.hasOwnProperty.call(l,o)&&(b[o]=l[o])}return b},P.apply(this,arguments)}var w=function(){function b(l){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(C){try{o.apply(C,{ot:I.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(g){B.logger.warn("Could not generate manifest CMCD data.",g)}},this.applyFragmentData=function(C){try{var g=C.frag,m=o.hls.levels[g.level],D=o.getObjectType(g),T={d:g.duration*1e3,ot:D};(D===I.CMCDObjectType.VIDEO||D===I.CMCDObjectType.AUDIO||D==I.CMCDObjectType.MUXED)&&(T.br=m.bitrate/1e3,T.tb=o.getTopBandwidth(D),T.bl=o.getBufferLength(D)),o.apply(C,T)}catch(h){B.logger.warn("Could not generate segment CMCD data.",h)}},this.hls=l;var s=this.config=l.config,d=s.cmcd;d!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=d.sessionId||b.uuid(),this.cid=d.contentId,this.useHeaders=d.useHeaders===!0,this.registerListeners())}var E=b.prototype;return E.registerListeners=function(){var o=this.hls;o.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(H.Events.BUFFER_CREATED,this.onBufferCreated,this)},E.unregisterListeners=function(){var o=this.hls;o.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(H.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,C;this.audioBuffer=(d=s.tracks.audio)===null||d===void 0?void 0:d.buffer,this.videoBuffer=(C=s.tracks.video)===null||C===void 0?void 0:C.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={}),P(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 C=b.toHeaders(s);if(!Object.keys(C).length)return;o.headers||(o.headers={}),P(o.headers,C)}else{var g=b.toQuery(s);if(!g)return;o.url=b.appendQueryToUri(o.url,g)}},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,C=A(d),g;!(g=C()).done;){var m=g.value;m.bitrate>s&&(s=m.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 C=O.BufferHelper.bufferInfo(d,s.currentTime,this.config.maxBufferHole);return C.len*1e3},E.createPlaylistLoader=function(){var o=this.config.pLoader,s=this.applyPlaylistData,d=o||this.config.loader;return function(){function C(m){this.loader=void 0,this.loader=new d(m)}var g=C.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(D,T,h){s(D),this.loader.load(D,T,h)},R(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},E.createFragmentLoader=function(){var o=this.config.fLoader,s=this.applyFragmentData,d=o||this.config.loader;return function(){function C(m){this.loader=void 0,this.loader=new d(m)}var g=C.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(D,T,h){s(D),this.loader.load(D,T,h)},R(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},b.uuid=function(){var o=URL.createObjectURL(new Blob),s=o.toString();return URL.revokeObjectURL(o),s.substr(s.lastIndexOf("/")+1)},b.serialize=function(o){for(var s=[],d=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},C=function(F){return Math.round(F)},g=function(F){return C(F/100)*100},m=function(F){return encodeURIComponent(F)},D={br:C,d:C,bl:g,dl:g,mtp:g,nor:m,rtp:g,tb:C},T=Object.keys(o||{}).sort(),h=A(T),c;!(c=h()).done;){var u=c.value,a=o[u];if(!d(a))continue;if(u==="v"&&a===1)continue;if(u=="pr"&&a===1)continue;var x=D[u];x&&(a=x(a));var y=typeof a,p=void 0;u==="ot"||u==="sf"||u==="st"?p=u+"="+a:y==="boolean"?p=u:y==="number"?p=u+"="+a:p=u+"="+JSON.stringify(a),s.push(p)}return s.join(",")},b.toHeaders=function(o){for(var s=Object.keys(o),d={},C=["Object","Request","Session","Status"],g=[{},{},{},{}],m={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},D=0,T=s;D<T.length;D++){var h=T[D],c=m[h]!=null?m[h]:1;g[c][h]=o[h]}for(var u=0;u<g.length;u++){var a=b.serialize(g[u]);a&&(d["CMCD-"+C[u]]=a)}return d},b.toQuery=function(o){return"CMCD="+encodeURIComponent(b.serialize(o))},b.appendQueryToUri=function(o,s){if(!s)return o;var d=o.includes("?")?"&":"?";return""+o+d+s},b}()},"./src/controller/eme-controller.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/events.ts"),I=L("./src/errors.ts"),O=L("./src/utils/logger.ts"),B=L("./src/utils/mediakeys-helper.ts");function N(w,b){for(var E=0;E<b.length;E++){var l=b[E];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(w,l.key,l)}}function R(w,b,E){return b&&N(w.prototype,b),E&&N(w,E),w}var A=3,f=function(b,E,l){var o={audioCapabilities:[],videoCapabilities:[]};return b.forEach(function(s){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:l.audioRobustness||""})}),E.forEach(function(s){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:l.videoRobustness||""})}),[o]},v=function(b,E,l,o){switch(b){case B.KeySystems.WIDEVINE:return f(E,l,o);default:throw new Error("Unknown key-system: "+b)}},P=function(){function w(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 b=w.prototype;return b.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},b._registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this)},b._unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this)},b.getLicenseServerUrl=function(l){switch(l){case B.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+l+'"')},b._attemptKeySystemAccess=function(l,o,s){var d=this,C=v(l,o,s,this._drmSystemOptions);O.logger.log("Requesting encrypted media key-system access");var g=this.requestMediaKeySystemAccess(l,C);this.mediaKeysPromise=g.then(function(m){return d._onMediaKeySystemAccessObtained(l,m)}),g.catch(function(m){O.logger.error('Failed to obtain key-system "'+l+'" access:',m)})},b._onMediaKeySystemAccessObtained=function(l,o){var s=this;O.logger.log('Access for key-system "'+l+'" obtained');var d={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:l};this._mediaKeysList.push(d);var C=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(g){return d.mediaKeys=g,O.logger.log('Media-keys created for key-system "'+l+'"'),s._onMediaKeysCreated(),g});return C.catch(function(g){O.logger.error("Failed to create media-keys:",g)}),C},b._onMediaKeysCreated=function(){var l=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),l._onNewMediaKeySession(o.mediaKeysSession))})},b._onNewMediaKeySession=function(l){var o=this;O.logger.log("New key-system session "+l.sessionId),l.addEventListener("message",function(s){o._onKeySessionMessage(l,s.message)},!1)},b._onKeySessionMessage=function(l,o){O.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(s){O.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),l.update(s)})},b.onMediaEncrypted=function(l){var o=this;if(O.logger.log('Media is encrypted using "'+l.initDataType+'" init data type'),!this.mediaKeysPromise){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(C){if(!o._media)return;o._attemptSetMediaKeys(C),o._generateRequestWithPreferredKeySession(l.initDataType,l.initData)};this.mediaKeysPromise.then(s).catch(s)},b._attemptSetMediaKeys=function(l){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){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}O.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},b._generateRequestWithPreferredKeySession=function(l,o){var s=this,d=this._mediaKeysList[0];if(!d){O.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(d.mediaKeysSessionInitialized){O.logger.warn("Key-Session already initialized but requested again");return}var C=d.mediaKeysSession;if(!C){O.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){O.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}O.logger.log('Generating key-session request for "'+l+'" init data type'),d.mediaKeysSessionInitialized=!0,C.generateRequest(l,o).then(function(){O.logger.debug("Key-session generation succeeded")}).catch(function(g){O.logger.error("Error generating key-session request:",g),s.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},b._createLicenseXhr=function(l,o,s){var d=new XMLHttpRequest;d.responseType="arraybuffer",d.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,d,l,o,s);var C=this._licenseXhrSetup;if(C)try{C.call(this.hls,d,l),C=void 0}catch(g){O.logger.error(g)}try{d.readyState||d.open("POST",l,!0),C&&C.call(this.hls,d,l)}catch(g){throw new Error("issue setting up KeySystem license XHR "+g)}return d},b._onLicenseRequestReadyStageChange=function(l,o,s,d){switch(l.readyState){case 4:if(l.status===200){this._requestLicenseFailureCount=0,O.logger.log("License request succeeded");var C=l.response,g=this._licenseResponseCallback;if(g)try{C=g.call(this.hls,l,o)}catch(D){O.logger.error(D)}d(C)}else{if(O.logger.error("License Request XHR failed ("+o+"). Status: "+l.status+" ("+l.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>A){this.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=A-this._requestLicenseFailureCount+1;O.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(s,d)}break}},b._generateLicenseRequestChallenge=function(l,o){switch(l.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+l.mediaKeySystemDomain)},b._requestLicense=function(l,o){O.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){O.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(H.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),C=this._createLicenseXhr(d,l,o);O.logger.log("Sending license request to URL: "+d);var g=this._generateLicenseRequestChallenge(s,l);C.send(g)}catch(m){O.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},b.onMediaAttached=function(l,o){if(!this._emeEnabled)return;var s=o.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},b.onMediaDetached=function(){var l=this._media,o=this._mediaKeysList;if(!l)return;l.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 l.setMediaKeys(null)}).catch(function(){})},b.onManifestParsed=function(l,o){if(!this._emeEnabled)return;var s=o.levels.map(function(C){return C.audioCodec}).filter(function(C){return!!C}),d=o.levels.map(function(C){return C.videoCodec}).filter(function(C){return!!C});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,s,d)},R(w,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),w}();K.default=P},"./src/controller/fps-controller.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/events.ts"),I=L("./src/utils/logger.ts"),O=function(){function B(R){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=R,this.registerListeners()}var N=B.prototype;return N.setStreamController=function(A){this.streamController=A},N.registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},N.unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching)},N.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},N.onMediaAttaching=function(A,f){var v=this.hls.config;if(v.capLevelOnFPSDrop){var P=f.media instanceof self.HTMLVideoElement?f.media:null;this.media=P,P&&typeof P.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),v.fpsDroppedMonitoringPeriod)}},N.checkFPS=function(A,f,v){var P=performance.now();if(f){if(this.lastTime){var w=P-this.lastTime,b=v-this.lastDroppedFrames,E=f-this.lastDecodedFrames,l=1e3*b/w,o=this.hls;if(o.trigger(H.Events.FPS_DROP,{currentDropped:b,currentDecoded:E,totalDroppedFrames:v}),l>0&&b>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(H.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:o.currentLevel}),o.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=P,this.lastDroppedFrames=v,this.lastDecodedFrames=f}},N.checkFPSInterval=function(){var A=this.media;if(A)if(this.isVideoPlaybackQualityAvailable){var f=A.getVideoPlaybackQuality();this.checkFPS(A,f.totalVideoFrames,f.droppedVideoFrames)}else this.checkFPS(A,A.webkitDecodedFrameCount,A.webkitDroppedFrameCount)},B}();K.default=O},"./src/controller/fragment-finders.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"findFragmentByPDT",function(){return O}),L.d(K,"findFragmentByPTS",function(){return B}),L.d(K,"fragmentWithinToleranceTest",function(){return N}),L.d(K,"pdtWithinToleranceTest",function(){return R}),L.d(K,"findFragWithCC",function(){return A});var H=L("./src/polyfills/number.ts"),I=L("./src/utils/binary-search.ts");function O(f,v,P){if(v===null||!Array.isArray(f)||!f.length||!Object(H.isFiniteNumber)(v))return null;var w=f[0].programDateTime;if(v<(w||0))return null;var b=f[f.length-1].endProgramDateTime;if(v>=(b||0))return null;P=P||0;for(var E=0;E<f.length;++E){var l=f[E];if(R(v,P,l))return l}return null}function B(f,v,P,w){P===void 0&&(P=0),w===void 0&&(w=0);var b=null;if(f?b=v[f.sn-v[0].sn+1]||null:P===0&&v[0].start===0&&(b=v[0]),b&&N(P,w,b)===0)return b;var E=I.default.search(v,N.bind(null,P,w));return E||b}function N(f,v,P){f===void 0&&(f=0),v===void 0&&(v=0);var w=Math.min(v,P.duration+(P.deltaPTS?P.deltaPTS:0));return P.start+P.duration-w<=f?1:P.start-w>f&&P.start?-1:0}function R(f,v,P){var w=Math.min(v,P.duration+(P.deltaPTS?P.deltaPTS:0))*1e3,b=P.endProgramDateTime||0;return b-w>f}function A(f,v){return I.default.search(f,function(P){return P.cc<v?1:P.cc>v?-1:0})}},"./src/controller/fragment-tracker.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"FragmentState",function(){return O}),L.d(K,"FragmentTracker",function(){return B});var H=L("./src/events.ts"),I=L("./src/types/loader.ts"),O;(function(A){A.NOT_LOADED="NOT_LOADED",A.BACKTRACKED="BACKTRACKED",A.APPENDING="APPENDING",A.PARTIAL="PARTIAL",A.OK="OK"})(O||(O={}));var B=function(){function A(v){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=v,this._registerListeners()}var f=A.prototype;return f._registerListeners=function(){var P=this.hls;P.on(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.on(H.Events.FRAG_LOADED,this.onFragLoaded,this)},f._unregisterListeners=function(){var P=this.hls;P.off(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.off(H.Events.FRAG_LOADED,this.onFragLoaded,this)},f.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},f.getAppendedFrag=function(P,w){if(w===I.PlaylistLevelType.MAIN){var b=this.activeFragment,E=this.activeParts;if(!b)return null;if(E)for(var l=E.length;l--;){var o=E[l],s=o?o.end:b.appendedPTS;if(o.start<=P&&s!==void 0&&P<=s)return l>9&&(this.activeParts=E.slice(l-9)),o}else if(b.start<=P&&b.appendedPTS!==void 0&&P<=b.appendedPTS)return b}return this.getBufferedFrag(P,w)},f.getBufferedFrag=function(P,w){for(var b=this.fragments,E=Object.keys(b),l=E.length;l--;){var o=b[E[l]];if((o==null?void 0:o.body.type)===w&&o.buffered){var s=o.body;if(s.start<=P&&P<=s.end)return s}}return null},f.detectEvictedFragments=function(P,w,b){var E=this;Object.keys(this.fragments).forEach(function(l){var o=E.fragments[l];if(!o)return;if(!o.buffered){o.body.type===b&&E.removeFragment(o.body);return}var s=o.range[P];if(!s)return;s.time.some(function(d){var C=!E.isTimeBuffered(d.startPTS,d.endPTS,w);return C&&E.removeFragment(o.body),C})})},f.detectPartialFragments=function(P){var w=this,b=this.timeRanges,E=P.frag,l=P.part;if(!b||E.sn==="initSegment")return;var o=R(E),s=this.fragments[o];if(!s)return;Object.keys(b).forEach(function(d){var C=E.elementaryStreams[d];if(!C)return;var g=b[d],m=l!==null||C.partial===!0;s.range[d]=w.getBufferedTimes(E,l,m,g)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},f.fragBuffered=function(P){var w=R(P),b=this.fragments[w];b&&(b.backtrack=b.loaded=null,b.buffered=!0)},f.getBufferedTimes=function(P,w,b,E){for(var l={time:[],partial:b},o=w?w.start:P.start,s=w?w.end:P.end,d=P.minEndPTS||s,C=P.maxStartPTS||o,g=0;g<E.length;g++){var m=E.start(g)-this.bufferPadding,D=E.end(g)+this.bufferPadding;if(C>=m&&d<=D){l.time.push({startPTS:Math.max(o,E.start(g)),endPTS:Math.min(s,E.end(g))});break}else if(o<D&&s>m)l.partial=!0,l.time.push({startPTS:Math.max(o,E.start(g)),endPTS:Math.min(s,E.end(g))});else if(s<=m)break}return l},f.getPartialFragment=function(P){var w=null,b,E,l,o=0,s=this.bufferPadding,d=this.fragments;return Object.keys(d).forEach(function(C){var g=d[C];if(!g)return;N(g)&&(E=g.body.start-s,l=g.body.end+s,P>=E&&P<=l&&(b=Math.min(P-E,l-P),o<=b&&(w=g.body,o=b)))}),w},f.getState=function(P){var w=R(P),b=this.fragments[w];return b?b.buffered?N(b)?O.PARTIAL:O.OK:b.backtrack?O.BACKTRACKED:O.APPENDING:O.NOT_LOADED},f.backtrack=function(P,w){var b=R(P),E=this.fragments[b];if(!E||E.backtrack)return null;var l=E.backtrack=w||E.loaded;return E.loaded=null,l},f.getBacktrackData=function(P){var w=R(P),b=this.fragments[w];if(b){var E,l=b.backtrack;if(l!=null&&(E=l.payload)!==null&&E!==void 0&&E.byteLength)return l;this.removeFragment(P)}return null},f.isTimeBuffered=function(P,w,b){for(var E,l,o=0;o<b.length;o++){if(E=b.start(o)-this.bufferPadding,l=b.end(o)+this.bufferPadding,P>=E&&w<=l)return!0;if(w<=E)return!1}return!1},f.onFragLoaded=function(P,w){var b=w.frag,E=w.part;if(b.sn==="initSegment"||b.bitrateTest||E)return;var l=R(b);this.fragments[l]={body:b,loaded:w,backtrack:null,buffered:!1,range:Object.create(null)}},f.onBufferAppended=function(P,w){var b=this,E=w.frag,l=w.part,o=w.timeRanges;if(E.type===I.PlaylistLevelType.MAIN)if(this.activeFragment=E,l){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(l)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(d){var C=o[d];if(b.detectEvictedFragments(d,C),!l)for(var g=0;g<C.length;g++)E.appendedPTS=Math.max(C.end(g),E.appendedPTS||0)})},f.onFragBuffered=function(P,w){this.detectPartialFragments(w)},f.hasFragment=function(P){var w=R(P);return!!this.fragments[w]},f.removeFragmentsInRange=function(P,w,b){var E=this;Object.keys(this.fragments).forEach(function(l){var o=E.fragments[l];if(!o)return;if(o.buffered){var s=o.body;s.type===b&&s.start<w&&s.end>P&&E.removeFragment(s)}})},f.removeFragment=function(P){var w=R(P);P.stats.loaded=0,P.clearElementaryStreamInfo(),delete this.fragments[w]},f.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},A}();function N(A){var f,v;return A.buffered&&(((f=A.range.video)===null||f===void 0?void 0:f.partial)||((v=A.range.audio)===null||v===void 0?void 0:v.partial))}function R(A){return A.type+"_"+A.level+"_"+A.urlId+"_"+A.sn}},"./src/controller/gap-controller.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"STALL_MINIMUM_DURATION_MS",function(){return N}),L.d(K,"MAX_START_GAP_JUMP",function(){return R}),L.d(K,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return A}),L.d(K,"SKIP_BUFFER_RANGE_START",function(){return f}),L.d(K,"default",function(){return v});var H=L("./src/utils/buffer-helper.ts"),I=L("./src/errors.ts"),O=L("./src/events.ts"),B=L("./src/utils/logger.ts"),N=250,R=2,A=.1,f=.05,v=function(){function P(b,E,l,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=b,this.media=E,this.fragmentTracker=l,this.hls=o}var w=P.prototype;return w.destroy=function(){this.hls=this.fragmentTracker=this.media=null},w.poll=function(E){var l=this.config,o=this.media,s=this.stalled,d=o.currentTime,C=o.seeking,g=this.seeking&&!C,m=!this.seeking&&C;if(this.seeking=C,d!==E){if(this.moved=!0,s!==null){if(this.stallReported){var D=self.performance.now()-s;B.logger.warn("playback not stuck anymore @"+d+", after "+Math.round(D)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||g)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!H.BufferHelper.getBuffered(o).length)return;var T=H.BufferHelper.bufferInfo(o,d,0),h=T.len>0,c=T.nextStart||0;if(!h&&!c)return;if(C){var u=T.len>R,a=!c||c-d>R&&!this.fragmentTracker.getPartialFragment(d);if(u||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var x,y=Math.max(c,T.start||0)-d,p=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,k=p==null||((x=p.details)===null||x===void 0)?void 0:x.live,F=k?p.details.targetduration*2:R;if(y>0&&y<=F){this._trySkipBufferHole(null);return}}var U=self.performance.now();if(s===null){this.stalled=U;return}var W=U-s;!C&&W>=N&&this._reportStall(T.len);var _=H.BufferHelper.bufferInfo(o,d,l.maxBufferHole);this._tryFixBufferStall(_,W)},w._tryFixBufferStall=function(E,l){var o=this.config,s=this.fragmentTracker,d=this.media,C=d.currentTime,g=s.getPartialFragment(C);if(g){var m=this._trySkipBufferHole(g);if(m)return}E.len>o.maxBufferHole&&l>o.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},w._reportStall=function(E){var l=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+")"),l.trigger(O.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:E}))},w._trySkipBufferHole=function(E){for(var l=this.config,o=this.hls,s=this.media,d=s.currentTime,C=0,g=H.BufferHelper.getBuffered(s),m=0;m<g.length;m++){var D=g.start(m);if(d+l.maxBufferHole>=C&&d<D){var T=Math.max(D+f,s.currentTime+A);return B.logger.warn("skipping hole, adjusting currentTime from "+d+" to "+T),this.moved=!0,this.stalled=null,s.currentTime=T,E&&o.trigger(O.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 "+T,frag:E}),T}C=g.end(m)}return 0},w._tryNudgeBuffer=function(){var E=this.config,l=this.hls,o=this.media,s=o.currentTime,d=(this.nudgeRetry||0)+1;if(this.nudgeRetry=d,d<E.nudgeMaxRetry){var C=s+d*E.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+s+" to "+C),o.currentTime=C,l.trigger(O.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"),l.trigger(O.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},P}()},"./src/controller/id3-track-controller.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),O=L("./src/demux/id3.ts"),B=.25,N=function(){function R(f){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=f,this._registerListeners()}var A=R.prototype;return A.destroy=function(){this._unregisterListeners()},A._registerListeners=function(){var v=this.hls;v.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),v.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),v.on(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),v.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},A._unregisterListeners=function(){var v=this.hls;v.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),v.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),v.off(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),v.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},A.onMediaAttached=function(v,P){this.media=P.media},A.onMediaDetaching=function(){if(!this.id3Track)return;Object(I.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},A.getID3Track=function(v){if(!this.media)return;for(var P=0;P<v.length;P++){var w=v[P];if(w.kind==="metadata"&&w.label==="id3")return Object(I.sendAddTrackEvent)(w,this.media),w}return this.media.addTextTrack("metadata","id3")},A.onFragParsingMetadata=function(v,P){if(!this.media)return;var w=P.frag,b=P.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var E=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,l=0;l<b.length;l++){var o=O.getID3Frames(b[l].data);if(o){var s=b[l].pts,d=l<b.length-1?b[l+1].pts:w.end,C=d-s;C<=0&&(d=s+B);for(var g=0;g<o.length;g++){var m=o[g];if(!O.isTimeStampFrame(m)){var D=new E(s,d,"");D.value=m,this.id3Track.addCue(D)}}}}},A.onBufferFlushing=function(v,P){var w=P.startOffset,b=P.endOffset,E=P.type;if(!E||E==="audio"){var l=this.id3Track;l&&Object(I.removeCuesInRange)(l,w,b)}},R}();K.default=N},"./src/controller/latency-controller.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return R});var H=L("./src/errors.ts"),I=L("./src/events.ts"),O=L("./src/utils/logger.ts");function B(A,f){for(var v=0;v<f.length;v++){var P=f[v];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(A,P.key,P)}}function N(A,f,v){return f&&B(A.prototype,f),v&&B(A,v),A}var R=function(){function A(v){var P=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 P.timeupdate()},this.hls=v,this.config=v.config,this.registerListeners()}var f=A.prototype;return f.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},f.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)},f.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)},f.onMediaAttached=function(P,w){this.media=w.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},f.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},f.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},f.onLevelUpdated=function(P,w){var b=w.details;this.levelDetails=b,b.advanced&&this.timeupdate(),!b.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},f.onError=function(P,w){if(w.details!==H.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,O.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},f.timeupdate=function(){var P=this.media,w=this.levelDetails;if(!P||!w)return;this.currentTime=P.currentTime;var b=this.computeLatency();if(b===null)return;this._latency=b;var E=this.config,l=E.lowLatencyMode,o=E.maxLiveSyncPlaybackRate;if(!l||o===1)return;var s=this.targetLatency;if(s===null)return;var d=b-s,C=Math.min(this.maxLatency,s+w.targetduration),g=d<C;if(w.live&&g&&d>.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,o)),D=Math.round(2/(1+Math.exp(-.75*d-this.edgeStalled))*20)/20;P.playbackRate=Math.min(m,Math.max(1,D))}else P.playbackRate!==1&&P.playbackRate!==0&&(P.playbackRate=1)},f.estimateLiveEdge=function(){var P=this.levelDetails;return P===null?null:P.edge+P.age},f.computeLatency=function(){var P=this.estimateLiveEdge();return P===null?null:P-this.currentTime},N(A,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var P=this.config,w=this.levelDetails;return P.liveMaxLatencyDuration!==void 0?P.liveMaxLatencyDuration:w?P.liveMaxLatencyDurationCount*w.targetduration:0}},{key:"targetLatency",get:function(){var P=this.levelDetails;if(P===null)return null;var w=P.holdBack,b=P.partHoldBack,E=P.targetduration,l=this.config,o=l.liveSyncDuration,s=l.liveSyncDurationCount,d=l.lowLatencyMode,C=this.hls.userConfig,g=d&&b||w;(C.liveSyncDuration||C.liveSyncDurationCount||g===0)&&(g=o!==void 0?o:s*E);var m=E,D=1;return g+Math.min(this.stallCount*D,m)}},{key:"liveSyncPosition",get:function(){var P=this.estimateLiveEdge(),w=this.targetLatency,b=this.levelDetails;if(P===null||w===null||b===null)return null;var E=b.edge,l=P-w-this.edgeStalled,o=E-b.totalduration,s=E-(this.config.lowLatencyMode&&b.partTarget||b.targetduration);return Math.min(Math.max(o,l),s)}},{key:"drift",get:function(){var P=this.levelDetails;return P===null?1:P.drift}},{key:"edgeStalled",get:function(){var P=this.levelDetails;if(P===null)return 0;var w=(this.config.lowLatencyMode&&P.partTarget||P.targetduration)*3;return Math.max(P.age-w,0)}},{key:"forwardBufferLength",get:function(){var P=this.media,w=this.levelDetails;if(!P||!w)return 0;var b=P.buffered.length;return b?P.buffered.end(b-1):w.edge-this.currentTime}}]),A}()},"./src/controller/level-controller.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return l});var H=L("./src/types/level.ts"),I=L("./src/events.ts"),O=L("./src/errors.ts"),B=L("./src/utils/codecs.ts"),N=L("./src/controller/level-helper.ts"),R=L("./src/controller/base-playlist-controller.ts"),A=L("./src/types/loader.ts");function f(){return f=Object.assign||function(o){for(var s=1;s<arguments.length;s++){var d=arguments[s];for(var C in d)Object.prototype.hasOwnProperty.call(d,C)&&(o[C]=d[C])}return o},f.apply(this,arguments)}function v(o,s){for(var d=0;d<s.length;d++){var C=s[d];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(o,C.key,C)}}function P(o,s,d){return s&&v(o.prototype,s),d&&v(o,d),o}function w(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,b(o,s)}function b(o,s){return b=Object.setPrototypeOf||function(C,g){return C.__proto__=g,C},b(o,s)}var E=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),l=function(o){w(s,o);function s(C){var g;return g=o.call(this,C,"[level-controller]")||this,g._levels=[],g._firstLevel=-1,g._startLevel=void 0,g.currentLevelIndex=-1,g.manualLevelIndex=-1,g.onParsedComplete=void 0,g._registerListeners(),g}var d=s.prototype;return d._registerListeners=function(){var g=this.hls;g.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.on(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),g.on(I.Events.ERROR,this.onError,this)},d._unregisterListeners=function(){var g=this.hls;g.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.off(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),g.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 g=this._levels;g.forEach(function(m){m.loadError=0}),o.prototype.startLoad.call(this)},d.onManifestLoaded=function(g,m){var D=[],T=[],h=[],c,u={},a,x=!1,y=!1,p=!1;if(m.levels.forEach(function(W){var _=W.attrs;x=x||!!(W.width&&W.height),y=y||!!W.videoCodec,p=p||!!W.audioCodec,E&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var M=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;a=u[M],a?a.url.push(W.url):(a=new H.Level(W),u[M]=a,D.push(a)),_&&(_.AUDIO&&Object(N.addGroupId)(a,"audio",_.AUDIO),_.SUBTITLES&&Object(N.addGroupId)(a,"text",_.SUBTITLES))}),(x||y)&&p&&(D=D.filter(function(W){var _=W.videoCodec,M=W.width,G=W.height;return!!_||!!(M&&G)})),D=D.filter(function(W){var _=W.audioCodec,M=W.videoCodec;return(!_||Object(B.isCodecSupportedInMp4)(_,"audio"))&&(!M||Object(B.isCodecSupportedInMp4)(M,"video"))}),m.audioTracks&&(T=m.audioTracks.filter(function(W){return!W.audioCodec||Object(B.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(N.assignTrackIdsByGroup)(T)),m.subtitles&&(h=m.subtitles,Object(N.assignTrackIdsByGroup)(h)),D.length>0){c=D[0].bitrate,D.sort(function(W,_){return W.bitrate-_.bitrate}),this._levels=D;for(var k=0;k<D.length;k++)if(D[k].bitrate===c){this._firstLevel=k,this.log("manifest loaded, "+D.length+" level(s) found, first bitrate: "+c);break}var F=p&&!y,U={levels:D,audioTracks:T,subtitleTracks:h,firstLevel:this._firstLevel,stats:m.stats,audio:p,video:y,altAudio:!F&&T.some(function(W){return!!W.url})};this.hls.trigger(I.Events.MANIFEST_PARSED,U),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(I.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:m.url,reason:"no level with compatible codecs found in manifest"})},d.onError=function(g,m){if(o.prototype.onError.call(this,g,m),m.fatal)return;var D=m.context,T=this._levels[this.currentLevelIndex];if(D&&(D.type===A.PlaylistContextType.AUDIO_TRACK&&T.audioGroupIds&&D.groupId===T.audioGroupIds[T.urlId]||D.type===A.PlaylistContextType.SUBTITLE_TRACK&&T.textGroupIds&&D.groupId===T.textGroupIds[T.urlId])){this.redundantFailover(this.currentLevelIndex);return}var h=!1,c=!0,u;switch(m.details){case O.ErrorDetails.FRAG_LOAD_ERROR:case O.ErrorDetails.FRAG_LOAD_TIMEOUT:case O.ErrorDetails.KEY_LOAD_ERROR:case O.ErrorDetails.KEY_LOAD_TIMEOUT:if(m.frag){var a=this._levels[m.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(u=m.frag.level)):u=m.frag.level}break;case O.ErrorDetails.LEVEL_LOAD_ERROR:case O.ErrorDetails.LEVEL_LOAD_TIMEOUT:D&&(D.deliveryDirectives&&(c=!1),u=D.level),h=!0;break;case O.ErrorDetails.REMUX_ALLOC_ERROR:u=m.level,h=!0;break}u!==void 0&&this.recoverLevel(m,u,h,c)},d.recoverLevel=function(g,m,D,T){var h=g.details,c=this._levels[m];if(c.loadError++,D){var u=this.retryLoadingOrFail(g);if(u)g.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(T){var a=c.url.length;if(a>1&&c.loadError<a)g.levelRetry=!0,this.redundantFailover(m);else if(this.manualLevelIndex===-1){var x=m===0?this._levels.length-1:m-1;this.currentLevelIndex!==x&&this._levels[x].loadError===0&&(this.warn(h+": switch to "+x),g.levelRetry=!0,this.hls.nextAutoLevel=x)}}},d.redundantFailover=function(g){var m=this._levels[g],D=m.url.length;if(D>1){var T=(m.urlId+1)%D;this.warn("Switching to redundant URL-id "+T),this._levels.forEach(function(h){h.urlId=T}),this.level=g}},d.onFragLoaded=function(g,m){var D=m.frag;if(D!==void 0&&D.type===A.PlaylistLevelType.MAIN){var T=this._levels[D.level];T!==void 0&&(T.fragmentError=0,T.loadError=0)}},d.onLevelLoaded=function(g,m){var D,T=m.level,h=m.details,c=this._levels[T];if(!c){var u;this.warn("Invalid level index "+T),(u=m.deliveryDirectives)!==null&&u!==void 0&&u.skip&&(h.deltaUpdateFailed=!0);return}T===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(T,m,c.details)):(D=m.deliveryDirectives)!==null&&D!==void 0&&D.skip&&(h.deltaUpdateFailed=!0)},d.onAudioTrackSwitched=function(g,m){var D=this.hls.levels[this.currentLevelIndex];if(!D)return;if(D.audioGroupIds){for(var T=-1,h=this.hls.audioTracks[m.id].groupId,c=0;c<D.audioGroupIds.length;c++)if(D.audioGroupIds[c]===h){T=c;break}T!==D.urlId&&(D.urlId=T,this.startLoad())}},d.loadPlaylist=function(g){var m=this.currentLevelIndex,D=this._levels[m];if(this.canLoad&&D&&D.url.length>0){var T=D.urlId,h=D.url[T];if(g)try{h=g.addDirectives(h)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+m+(g?" at sn "+g.msn+" part "+g.part:"")+" with URL-id "+T+" "+h),this.clearTimer(),this.hls.trigger(I.Events.LEVEL_LOADING,{url:h,level:m,id:T,deliveryDirectives:g||null})}},d.removeLevel=function(g,m){var D=function(c,u){return u!==m},T=this._levels.filter(function(h,c){return c!==g?!0:h.url.length>1&&m!==void 0?(h.url=h.url.filter(D),h.audioGroupIds&&(h.audioGroupIds=h.audioGroupIds.filter(D)),h.textGroupIds&&(h.textGroupIds=h.textGroupIds.filter(D)),h.urlId=0,!0):!1}).map(function(h,c){var u=h.details;return u!=null&&u.fragments&&u.fragments.forEach(function(a){a.level=c}),h});this._levels=T,this.hls.trigger(I.Events.LEVELS_UPDATED,{levels:T})},P(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(g){var m,D=this._levels;if(D.length===0)return;if(this.currentLevelIndex===g&&(m=D[g])!==null&&m!==void 0&&m.details)return;if(g<0||g>=D.length){var T=g<0;if(this.hls.trigger(I.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.LEVEL_SWITCH_ERROR,level:g,fatal:T,reason:"invalid level idx"}),T)return;g=Math.min(g,D.length-1)}this.clearTimer();var h=this.currentLevelIndex,c=D[h],u=D[g];this.log("switching to level "+g+" from "+h),this.currentLevelIndex=g;var a=f({},u,{level:g,maxBitrate:u.maxBitrate,uri:u.uri,urlId:u.urlId});delete a._urlId,this.hls.trigger(I.Events.LEVEL_SWITCHING,a);var x=u.details;if(!x||x.live){var y=this.switchParams(u.uri,c==null?void 0:c.details);this.loadPlaylist(y)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(g){this.manualLevelIndex=g,this._startLevel===void 0&&(this._startLevel=g),g!==-1&&(this.level=g)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(g){this._firstLevel=g}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var g=this.hls.config.startLevel;return g!==void 0?g:this._firstLevel}else return this._startLevel},set:function(g){this._startLevel=g}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(g){this.level=g,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=g)}}]),s}(R.default)},"./src/controller/level-helper.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"addGroupId",function(){return O}),L.d(K,"assignTrackIdsByGroup",function(){return B}),L.d(K,"updatePTS",function(){return N}),L.d(K,"updateFragPTSDTS",function(){return A}),L.d(K,"mergeDetails",function(){return f}),L.d(K,"mapPartIntersection",function(){return v}),L.d(K,"mapFragmentIntersection",function(){return P}),L.d(K,"adjustSliding",function(){return w}),L.d(K,"addSliding",function(){return b}),L.d(K,"computeReloadInterval",function(){return E}),L.d(K,"getFragmentWithSN",function(){return l}),L.d(K,"getPartWith",function(){return o});var H=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts");function O(s,d,C){switch(d){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(C);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(C);break}}function B(s){var d={};s.forEach(function(C){var g=C.groupId||"";C.id=d[g]=d[g]||0,d[g]++})}function N(s,d,C){var g=s[d],m=s[C];R(g,m)}function R(s,d){var C=d.startPTS;if(Object(H.isFiniteNumber)(C)){var g=0,m;d.sn>s.sn?(g=C-s.start,m=s):(g=s.start-C,m=d),m.duration!==g&&(m.duration=g)}else if(d.sn>s.sn){var D=s.cc===d.cc;D&&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 A(s,d,C,g,m,D){var T=g-C;T<=0&&(I.logger.warn("Fragment should have a positive duration",d),g=C+d.duration,D=m+d.duration);var h=C,c=g,u=d.startPTS,a=d.endPTS;if(Object(H.isFiniteNumber)(u)){var x=Math.abs(u-C);Object(H.isFiniteNumber)(d.deltaPTS)?d.deltaPTS=Math.max(x,d.deltaPTS):d.deltaPTS=x,h=Math.max(C,u),C=Math.min(C,u),m=Math.min(m,d.startDTS),c=Math.min(g,a),g=Math.max(g,a),D=Math.max(D,d.endDTS)}d.duration=g-C;var y=C-d.start;d.appendedPTS=g,d.start=d.startPTS=C,d.maxStartPTS=h,d.startDTS=m,d.endPTS=g,d.minEndPTS=c,d.endDTS=D;var p=d.sn;if(!s||p<s.startSN||p>s.endSN)return 0;var k,F=p-s.startSN,U=s.fragments;for(U[F]=d,k=F;k>0;k--)R(U[k],U[k-1]);for(k=F;k<U.length-1;k++)R(U[k],U[k+1]);return s.fragmentHint&&R(U[U.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,y}function f(s,d){for(var C=null,g=s.fragments,m=g.length-1;m>=0;m--){var D=g[m].initSegment;if(D){C=D;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var T=0,h;if(P(s,d,function(k,F){k.relurl&&(T=k.cc-F.cc),Object(H.isFiniteNumber)(k.startPTS)&&Object(H.isFiniteNumber)(k.endPTS)&&(F.start=F.startPTS=k.startPTS,F.startDTS=k.startDTS,F.appendedPTS=k.appendedPTS,F.maxStartPTS=k.maxStartPTS,F.endPTS=k.endPTS,F.endDTS=k.endDTS,F.minEndPTS=k.minEndPTS,F.duration=k.endPTS-k.startPTS,F.duration&&(h=F),d.PTSKnown=d.alignedSliding=!0),F.elementaryStreams=k.elementaryStreams,F.loader=k.loader,F.stats=k.stats,F.urlId=k.urlId,k.initSegment&&(F.initSegment=k.initSegment,C=k.initSegment)}),C){var c=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments;c.forEach(function(k){var F;(!k.initSegment||k.initSegment.relurl===((F=C)===null||F===void 0?void 0:F.relurl))&&(k.initSegment=C)})}if(d.skippedSegments&&(d.deltaUpdateFailed=d.fragments.some(function(k){return!k}),d.deltaUpdateFailed)){I.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var u=d.skippedSegments;u--;)d.fragments.shift();d.startSN=d.fragments[0].sn,d.startCC=d.fragments[0].cc}var a=d.fragments;if(T){I.logger.warn("discontinuity sliding from playlist, take drift into account");for(var x=0;x<a.length;x++)a[x].cc+=T}d.skippedSegments&&(d.startCC=d.fragments[0].cc),v(s.partList,d.partList,function(k,F){F.elementaryStreams=k.elementaryStreams,F.stats=k.stats}),h?A(d,h,h.startPTS,h.endPTS,h.startDTS,h.endDTS):w(s,d),a.length&&(d.totalduration=d.edge-a[0].start),d.driftStartTime=s.driftStartTime,d.driftStart=s.driftStart;var y=d.advancedDateTime;if(d.advanced&&y){var p=d.edge;d.driftStart||(d.driftStartTime=y,d.driftStart=p),d.driftEndTime=y,d.driftEnd=p}else d.driftEndTime=s.driftEndTime,d.driftEnd=s.driftEnd,d.advancedDateTime=s.advancedDateTime}function v(s,d,C){if(s&&d)for(var g=0,m=0,D=s.length;m<=D;m++){var T=s[m],h=d[m+g];T&&h&&T.index===h.index&&T.fragment.sn===h.fragment.sn?C(T,h):g--}}function P(s,d,C){for(var g=d.skippedSegments,m=Math.max(s.startSN,d.startSN)-d.startSN,D=(s.fragmentHint?1:0)+(g?d.endSN:Math.min(s.endSN,d.endSN))-d.startSN,T=d.startSN-s.startSN,h=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments,c=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,u=m;u<=D;u++){var a=c[T+u],x=h[u];g&&!x&&u<g&&(x=d.fragments[u]=a),a&&x&&C(a,x)}}function w(s,d){var C=d.startSN+d.skippedSegments-s.startSN,g=s.fragments;if(C<0||C>=g.length)return;b(d,g[C].start)}function b(s,d){if(d){for(var C=s.fragments,g=s.skippedSegments;g<C.length;g++)C[g].start+=d;s.fragmentHint&&(s.fragmentHint.start+=d)}}function E(s,d){var C=1e3*s.levelTargetDuration,g=C/2,m=s.age,D=m>0&&m<C*3,T=d.loading.end-d.loading.start,h,c=s.availabilityDelay;if(s.updated===!1)if(D){var u=333*s.misses;h=Math.max(Math.min(g,T*2),u),s.availabilityDelay=(s.availabilityDelay||0)+h}else h=g;else D?(c=Math.min(c||C/2,m),s.availabilityDelay=c,h=c+C-m):h=C-T;return Math.round(h)}function l(s,d,C){if(!s||!s.details)return null;var g=s.details,m=g.fragments[d-g.startSN];return m||(m=g.fragmentHint,m&&m.sn===d?m:d<g.startSN&&C&&C.sn===d?C:null)}function o(s,d,C){if(!s||!s.details)return null;var g=s.details.partList;if(g)for(var m=g.length;m--;){var D=g[m];if(D.index===C&&D.fragment.sn===d)return D}return null}},"./src/controller/stream-controller.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return g});var H=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),O=L("./src/is-supported.ts"),B=L("./src/events.ts"),N=L("./src/utils/buffer-helper.ts"),R=L("./src/controller/fragment-tracker.ts"),A=L("./src/types/loader.ts"),f=L("./src/loader/fragment.ts"),v=L("./src/demux/transmuxer-interface.ts"),P=L("./src/types/transmuxer.ts"),w=L("./src/controller/gap-controller.ts"),b=L("./src/errors.ts"),E=L("./src/utils/logger.ts");function l(m,D){for(var T=0;T<D.length;T++){var h=D[T];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(m,h.key,h)}}function o(m,D,T){return D&&l(m.prototype,D),T&&l(m,T),m}function s(m,D){m.prototype=Object.create(D.prototype),m.prototype.constructor=m,d(m,D)}function d(m,D){return d=Object.setPrototypeOf||function(h,c){return h.__proto__=c,h},d(m,D)}var C=100,g=function(m){s(D,m);function D(h,c){var u;return u=m.call(this,h,c,"[stream-controller]")||this,u.audioCodecSwap=!1,u.gapController=null,u.level=-1,u._forceStartLoad=!1,u.altAudio=!1,u.audioOnly=!1,u.fragPlaying=null,u.onvplaying=null,u.onvseeked=null,u.fragLastKbps=0,u.stalled=!1,u.couldBacktrack=!1,u.audioCodecSwitch=!1,u.videoBuffer=null,u._registerListeners(),u}var T=D.prototype;return T._registerListeners=function(){var c=this.hls;c.on(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)},T._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)},T.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},T.startLoad=function(c){if(this.levels){var u=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(C),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var x=a.startLevel;x===-1&&(a.config.testBandwidth?(x=0,this.bitrateTest=!0):x=a.nextAutoLevel),this.level=a.nextLoadLevel=x,this.loadedmetadata=!1}u>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),c=u),this.state=I.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=I.State.STOPPED},T.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},T.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_LEVEL:{var c,u=this.levels,a=this.level,x=u==null||((c=u[a])===null||c===void 0)?void 0:c.details;if(x&&(!x.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(x))break;this.state=I.State.IDLE;break}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var y,p=self.performance.now(),k=this.retryDate;(!k||p>=k||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=I.State.IDLE)}break;default:break}this.onTickEnd()},T.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},T.doTickIdle=function(){var c,u,a=this.hls,x=this.levelLastLoaded,y=this.levels,p=this.media,k=a.config,F=a.nextLoadLevel;if(x===null||!p&&(this.startFragRequested||!k.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!y||!y[F])return;var U=y[F];this.level=a.nextLoadLevel=F;var W=U.details;if(!W||this.state===I.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==F){this.state=I.State.WAITING_LEVEL;return}var _=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:p,A.PlaylistLevelType.MAIN);if(_===null)return;var M=_.len,G=this.getMaxBufferLength(U.maxBitrate);if(M>=G)return;if(this._streamEnded(_,W)){var Y={};this.altAudio&&(Y.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,Y),this.state=I.State.ENDED;return}var Z=_.end,ne=this.getNextFragment(Z,W);if(this.couldBacktrack&&!this.fragPrevious&&ne&&ne.sn!=="initSegment"){var be=ne.sn-W.startSN;be>1&&(ne=W.fragments[be-1],this.fragmentTracker.removeFragment(ne))}if(ne&&this.fragmentTracker.getState(ne)===R.FragmentState.OK&&this.nextLoadPosition>Z){var me=this.audioOnly&&!this.altAudio?f.ElementaryStreamTypes.AUDIO:f.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(p,me,A.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"&&!((u=ne.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(ne,W):this.loadFragment(ne,W,Z)},T.loadFragment=function(c,u,a){var x,y=this.fragmentTracker.getState(c);if(this.fragCurrent=c,y===R.FragmentState.BACKTRACKED){var p=this.fragmentTracker.getBacktrackData(c);if(p){this._handleFragmentLoadProgress(p),this._handleFragmentLoadComplete(p);return}else y=R.FragmentState.NOT_LOADED}y===R.FragmentState.NOT_LOADED||y===R.FragmentState.PARTIAL?c.sn==="initSegment"?this._loadInitSegment(c):this.bitrateTest?(c.bitrateTest=!0,this.log("Fragment "+c.sn+" of level "+c.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(c)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,c,u,a)):y===R.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((x=this.media)===null||x===void 0?void 0:x.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},T.getAppendedFrag=function(c){var u=this.fragmentTracker.getAppendedFrag(c,A.PlaylistLevelType.MAIN);return u&&"fragment"in u?u.fragment:u},T.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,A.PlaylistLevelType.MAIN)},T.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},T.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},T.nextLevelSwitch=function(){var c=this.levels,u=this.media;if(u!=null&&u.readyState){var a,x=this.getAppendedFrag(u.currentTime);if(x&&x.start>1&&this.flushMainBuffer(0,x.start-1),!u.paused&&c){var y=this.hls.nextLoadLevel,p=c[y],k=this.fragLastKbps;k&&this.fragCurrent?a=this.fragCurrent.duration*p.maxBitrate/(1e3*k)+1:a=0}else a=0;var F=this.getBufferedFrag(u.currentTime+a);if(F){var U=this.followingBufferedFrag(F);if(U){this.abortCurrentFrag();var W=U.maxStartPTS?U.maxStartPTS:U.start,_=U.duration,M=Math.max(F.end,W+Math.min(Math.max(_-this.config.maxFragLookUpTolerance,_*.5),_*.75));this.flushMainBuffer(M,Number.POSITIVE_INFINITY)}}}},T.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()},T.flushMainBuffer=function(c,u){m.prototype.flushMainBuffer.call(this,c,u,this.altAudio?"video":null)},T.onMediaAttached=function(c,u){m.prototype.onMediaAttached.call(this,c,u);var a=u.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new w.default(this.config,a,this.fragmentTracker,this.hls)},T.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),m.prototype.onMediaDetaching.call(this)},T.onMediaPlaying=function(){this.tick()},T.onMediaSeeked=function(){var c=this.media,u=c?c.currentTime:null;Object(H.isFiniteNumber)(u)&&this.log("Media seeked to "+u.toFixed(3)),this.tick()},T.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},T.onManifestParsed=function(c,u){var a=!1,x=!1,y;u.levels.forEach(function(p){y=p.audioCodec,y&&(y.indexOf("mp4a.40.2")!==-1&&(a=!0),y.indexOf("mp4a.40.5")!==-1&&(x=!0))}),this.audioCodecSwitch=a&&x&&!Object(O.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=u.levels,this.startFragRequested=!1},T.onLevelLoading=function(c,u){var a=this.levels;if(!a||this.state!==I.State.IDLE)return;var x=a[u.level];(!x.details||x.details.live&&this.levelLastLoaded!==u.level||this.waitForCdnTuneIn(x.details))&&(this.state=I.State.WAITING_LEVEL)},T.onLevelLoaded=function(c,u){var a,x=this.levels,y=u.level,p=u.details,k=p.totalduration;if(!x){this.warn("Levels were reset while loading level "+y);return}this.log("Level "+y+" loaded ["+p.startSN+","+p.endSN+"], cc ["+p.startCC+", "+p.endCC+"] duration:"+k);var F=this.fragCurrent;F&&(this.state===I.State.FRAG_LOADING||this.state===I.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==u.level&&F.loader&&(this.state=I.State.IDLE,F.loader.abort()));var U=x[y],W=0;if(p.live||(a=U.details)!==null&&a!==void 0&&a.live){if(p.fragments[0]||(p.deltaUpdateFailed=!0),p.deltaUpdateFailed)return;W=this.alignPlaylists(p,U.details)}if(U.details=p,this.levelLastLoaded=y,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:p,level:y}),this.state===I.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(p))return;this.state=I.State.IDLE}this.startFragRequested?p.live&&this.synchronizeToLiveEdge(p):this.setStartPosition(p,W),this.tick()},T._handleFragmentLoadProgress=function(c){var u,a=c.frag,x=c.part,y=c.payload,p=this.levels;if(!p){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var k=p[a.level],F=k.details;if(!F){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var U=k.videoCodec,W=F.PTSKnown||!F.live,_=(u=a.initSegment)===null||u===void 0?void 0:u.data,M=this._getAudioCodec(k),G=this.transmuxer=this.transmuxer||new v.default(this.hls,A.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Y=x?x.index:-1,Z=Y!==-1,ne=new P.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,y.byteLength,Y,Z),be=this.initPTS[a.cc];G.push(y,_,M,U,a,x,F.totalduration,W,ne,be)},T.onAudioTrackSwitching=function(c,u){var a=this.altAudio,x=!!u.url,y=u.id;if(!x){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var p=this.fragCurrent;p!=null&&p.loader&&(this.log("Switching to main audio track, cancel main fragment load"),p.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var k=this.hls;a&&k.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),k.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:y})}},T.onAudioTrackSwitched=function(c,u){var a=u.id,x=!!this.hls.audioTracks[a].url;if(x){var y=this.videoBuffer;y&&this.mediaBuffer!==y&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=y)}this.altAudio=x,this.tick()},T.onBufferCreated=function(c,u){var a=u.tracks,x,y,p=!1;for(var k in a){var F=a[k];if(F.id==="main"){if(y=k,x=F,k==="video"){var U=a[k];U&&(this.videoBuffer=U.buffer)}}else p=!0}p&&x?(this.log("Alternate track found, use "+y+".buffered to schedule main fragment loading"),this.mediaBuffer=x.buffer):this.mediaBuffer=this.media},T.onFragBuffered=function(c,u){var a=u.frag,x=u.part;if(a&&a.type!==A.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(x?" p: "+x.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 y=x?x.stats:a.stats;this.fragLastKbps=Math.round(8*y.total/(y.buffering.end-y.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,x)},T.onError=function(c,u){switch(u.details){case b.ErrorDetails.FRAG_LOAD_ERROR:case b.ErrorDetails.FRAG_LOAD_TIMEOUT:case b.ErrorDetails.KEY_LOAD_ERROR:case b.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.MAIN,u);break;case b.ErrorDetails.LEVEL_LOAD_ERROR:case b.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==I.State.ERROR&&(u.fatal?(this.warn(""+u.details),this.state=I.State.ERROR):!u.levelRetry&&this.state===I.State.WAITING_LEVEL&&(this.state=I.State.IDLE));break;case b.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="main"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var a=!0,x=this.getFwdBufferInfo(this.media,A.PlaylistLevelType.MAIN);x&&x.len>.5&&(a=!this.reduceMaxBufferLength(x.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},T.checkBuffer=function(){var c=this.media,u=this.gapController;if(!c||!u||!c.readyState)return;var a=N.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):u.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},T.onFragLoadEmergencyAborted=function(){this.state=I.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},T.onBufferFlushed=function(c,u){var a=u.type;if(a!==f.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var x=(a===f.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(x,a,A.PlaylistLevelType.MAIN)}},T.onLevelsUpdated=function(c,u){this.levels=u.levels},T.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},T.seekToStartPos=function(){var c=this.media,u=c.currentTime,a=this.startPosition;if(a>=0&&u<a){if(c.seeking){E.logger.log("could not seek to "+a+", already seeking at "+u);return}var x=N.BufferHelper.getBuffered(c),y=x.length?x.start(0):0,p=y-a;p>0&&(p<this.config.maxBufferHole||p<this.config.maxFragLookUpTolerance)&&(E.logger.log("adjusting start position by "+p+" to match buffer start"),a+=p,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+u),c.currentTime=a}},T._getAudioCodec=function(c){var u=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&u&&(this.log("Swapping audio codec"),u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5"),u},T._loadBitrateTestFrag=function(c){var u=this;this._doFragLoad(c).then(function(a){var x=u.hls;if(!a||x.nextLoadLevel||u.fragContextChanged(c))return;u.fragLoadError=0,u.state=I.State.IDLE,u.startFragRequested=!1,u.bitrateTest=!1;var y=c.stats;y.parsing.start=y.parsing.end=y.buffering.start=y.buffering.end=self.performance.now(),x.trigger(B.Events.FRAG_LOADED,a)})},T._handleTransmuxComplete=function(c){var u,a="main",x=this.hls,y=c.remuxResult,p=c.chunkMeta,k=this.getCurrentContext(p);if(!k){this.warn("The loading context changed while buffering fragment "+p.sn+" of level "+p.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(p.level);return}var F=k.frag,U=k.part,W=k.level,_=y.video,M=y.text,G=y.id3,Y=y.initSegment,Z=this.altAudio?void 0:y.audio;if(this.fragContextChanged(F))return;if(this.state=I.State.PARSING,Y){Y.tracks&&(this._bufferInitSegment(W,Y.tracks,F,p),x.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:a,tracks:Y.tracks}));var ne=Y.initPTS,be=Y.timescale;Object(H.isFiniteNumber)(ne)&&(this.initPTS[F.cc]=ne,x.trigger(B.Events.INIT_PTS_FOUND,{frag:F,id:a,initPTS:ne,timescale:be}))}if(_&&y.independent!==!1){if(W.details){var me=_.startPTS,pe=_.endPTS,ue=_.startDTS,fe=_.endDTS;if(U)U.elementaryStreams[_.type]={startPTS:me,endPTS:pe,startDTS:ue,endDTS:fe};else if(_.firstKeyFrame&&_.independent&&(this.couldBacktrack=!0),_.dropped&&_.independent){var ie=this.getLoadPosition()+this.config.maxBufferHole;if(ie<me){this.backtrack(F);return}F.setElementaryStreamInfo(_.type,F.start,pe,F.start,fe,!0)}F.setElementaryStreamInfo(_.type,me,pe,ue,fe),this.bufferFragmentData(_,F,U,p)}}else if(y.independent===!1){this.backtrack(F);return}if(Z){var he=Z.startPTS,$=Z.endPTS,ae=Z.startDTS,ee=Z.endDTS;U&&(U.elementaryStreams[f.ElementaryStreamTypes.AUDIO]={startPTS:he,endPTS:$,startDTS:ae,endDTS:ee}),F.setElementaryStreamInfo(f.ElementaryStreamTypes.AUDIO,he,$,ae,ee),this.bufferFragmentData(Z,F,U,p)}if(G!=null&&(u=G.samples)!==null&&u!==void 0&&u.length){var Ee={frag:F,id:a,samples:G.samples};x.trigger(B.Events.FRAG_PARSING_METADATA,Ee)}if(M){var Ce={frag:F,id:a,samples:M.samples};x.trigger(B.Events.FRAG_PARSING_USERDATA,Ce)}},T._bufferInitSegment=function(c,u,a,x){var y=this;if(this.state!==I.State.PARSING)return;this.audioOnly=!!u.audio&&!u.video,this.altAudio&&!this.audioOnly&&delete u.audio;var p=u.audio,k=u.video,F=u.audiovideo;if(p){var U=c.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(U&&(U.indexOf("mp4a.40.5")!==-1?U="mp4a.40.2":U="mp4a.40.5"),p.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(U="mp4a.40.5")),W.indexOf("android")!==-1&&p.container!=="audio/mpeg"&&(U="mp4a.40.2",this.log("Android: force audio codec to "+U)),c.audioCodec&&c.audioCodec!==U&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+U+'"'),p.levelCodec=U,p.id="main",this.log("Init audio buffer, container:"+p.container+", codecs[selected/level/parsed]=["+(U||"")+"/"+(c.audioCodec||"")+"/"+p.codec+"]")}k&&(k.levelCodec=c.videoCodec,k.id="main",this.log("Init video buffer, container:"+k.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+k.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,u),Object.keys(u).forEach(function(_){var M=u[_],G=M.initSegment;G!=null&&G.byteLength&&y.hls.trigger(B.Events.BUFFER_APPENDING,{type:_,data:G,frag:a,part:null,chunkMeta:x,parent:a.type})}),this.tick()},T.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var u=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,u?this.resetFragmentLoading(c):this.state=I.State.BACKTRACKING},T.checkFragmentChanged=function(){var c=this.media,u=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(N.BufferHelper.isBuffered(c,a)?u=this.getAppendedFrag(a):N.BufferHelper.isBuffered(c,a+.1)&&(u=this.getAppendedFrag(a+.1)),u){var x=this.fragPlaying,y=u.level;(!x||u.sn!==x.sn||x.level!==y||u.urlId!==x.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:u}),(!x||x.level!==y)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:y}),this.fragPlaying=u)}}},o(D,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var u=this.getAppendedFrag(c.currentTime);if(u)return u.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var u=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(u)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),D}(I.default)},"./src/controller/subtitle-stream-controller.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"SubtitleStreamController",function(){return s});var H=L("./src/events.ts"),I=L("./src/utils/logger.ts"),O=L("./src/utils/buffer-helper.ts"),B=L("./src/controller/fragment-finders.ts"),N=L("./src/utils/discontinuities.ts"),R=L("./src/controller/level-helper.ts"),A=L("./src/controller/fragment-tracker.ts"),f=L("./src/controller/base-stream-controller.ts"),v=L("./src/types/loader.ts"),P=L("./src/types/level.ts");function w(d,C){for(var g=0;g<C.length;g++){var m=C[g];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(d,m.key,m)}}function b(d,C,g){return C&&w(d.prototype,C),g&&w(d,g),d}function E(d,C){d.prototype=Object.create(C.prototype),d.prototype.constructor=d,l(d,C)}function l(d,C){return l=Object.setPrototypeOf||function(m,D){return m.__proto__=D,m},l(d,C)}var o=500,s=function(d){E(C,d);function C(m,D){var T;return T=d.call(this,m,D,"[subtitle-stream-controller]")||this,T.levels=[],T.currentTrackId=-1,T.tracksBuffered=[],T.mainDetails=null,T._registerListeners(),T}var g=C.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var D=this.hls;D.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.on(H.Events.ERROR,this.onError,this),D.on(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.on(H.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.on(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.on(H.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g._unregisterListeners=function(){var D=this.hls;D.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.off(H.Events.ERROR,this.onError,this),D.off(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.off(H.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.off(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.off(H.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g.startLoad=function(){this.stopLoad(),this.state=f.State.IDLE,this.setInterval(o),this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},g.onLevelLoaded=function(D,T){this.mainDetails=T.details},g.onSubtitleFragProcessed=function(D,T){var h=T.frag,c=T.success;if(this.fragPrevious=h,this.state=f.State.IDLE,!c)return;var u=this.tracksBuffered[this.currentTrackId];if(!u)return;for(var a,x=h.start,y=0;y<u.length;y++)if(x>=u[y].start&&x<=u[y].end){a=u[y];break}var p=h.start+h.duration;a?a.end=p:(a={start:x,end:p},u.push(a)),this.fragmentTracker.fragBuffered(h)},g.onBufferFlushing=function(D,T){var h=T.startOffset,c=T.endOffset;if(h===0&&c!==Number.POSITIVE_INFINITY){var u=this.currentTrackId,a=this.levels;if(!a.length||!a[u]||!a[u].details)return;var x=a[u].details,y=x.targetduration,p=c-y;if(p<=0)return;T.endOffsetSubtitles=Math.max(0,p),this.tracksBuffered.forEach(function(k){for(var F=0;F<k.length;){if(k[F].end<=p){k.shift();continue}else if(k[F].start<p)k[F].start=p;else break;F++}}),this.fragmentTracker.removeFragmentsInRange(h,p,v.PlaylistLevelType.SUBTITLE)}},g.onError=function(D,T){var h,c=T.frag;if(!c||c.type!==v.PlaylistLevelType.SUBTITLE)return;(h=this.fragCurrent)!==null&&h!==void 0&&h.loader&&this.fragCurrent.loader.abort(),this.state=f.State.IDLE},g.onSubtitleTracksUpdated=function(D,T){var h=this,c=T.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(u){return new P.Level(u)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(u){h.tracksBuffered[u.id]=[]}),this.mediaBuffer=null},g.onSubtitleTrackSwitch=function(D,T){if(this.currentTrackId=T.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var h=this.levels[this.currentTrackId];h!=null&&h.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,h&&this.setInterval(o)},g.onSubtitleTrackLoaded=function(D,T){var h,c=T.details,u=T.id,a=this.currentTrackId,x=this.levels;if(!x.length)return;var y=x[a];if(u>=x.length||u!==a||!y)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(h=y.details)!==null&&h!==void 0&&h.live){var p=this.mainDetails;if(c.deltaUpdateFailed||!p)return;var k=p.fragments[0];if(!y.details)c.hasProgramDateTime&&p.hasProgramDateTime?Object(N.alignMediaPlaylistByPDT)(c,p):k&&Object(R.addSliding)(c,k.start);else{var F=this.alignPlaylists(c,y.details);F===0&&k&&Object(R.addSliding)(c,k.start)}}if(y.details=c,this.levelLastLoaded=u,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===f.State.IDLE){var U=Object(B.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);U||(this.warn("Subtitle playlist not aligned with playback"),y.details=void 0)}},g._handleFragmentLoadComplete=function(D){var T=D.frag,h=D.payload,c=T.decryptdata,u=this.hls;if(this.fragContextChanged(T))return;if(h&&h.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(h),c.key.buffer,c.iv.buffer).then(function(x){var y=performance.now();u.trigger(H.Events.FRAG_DECRYPTED,{frag:T,payload:x,stats:{tstart:a,tdecrypt:y}})})}},g.doTick=function(){if(!this.media){this.state=f.State.IDLE;return}if(this.state===f.State.IDLE){var D,T=this.currentTrackId,h=this.levels;if(!h.length||!h[T]||!h[T].details)return;var c=h[T].details,u=c.targetduration,a=this.config,x=this.media,y=O.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,x.currentTime-u,a.maxBufferHole),p=y.end,k=y.len,F=this.getMaxBufferLength()+u;if(k>F)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var U=c.fragments,W=U.length,_=c.edge,M,G=this.fragPrevious;if(p<_){var Y=a.maxFragLookUpTolerance;G&&c.hasProgramDateTime&&(M=Object(B.findFragmentByPDT)(U,G.endProgramDateTime,Y)),M||(M=Object(B.findFragmentByPTS)(G,U,p,Y),!M&&G&&G.start<U[0].start&&(M=U[0]))}else M=U[W-1];(D=M)!==null&&D!==void 0&&D.encrypted?(I.logger.log("Loading key for "+M.sn),this.state=f.State.KEY_LOADING,this.hls.trigger(H.Events.KEY_LOADING,{frag:M})):M&&this.fragmentTracker.getState(M)===A.FragmentState.NOT_LOADED&&this.loadFragment(M,c,p)}},g.loadFragment=function(D,T,h){this.fragCurrent=D,d.prototype.loadFragment.call(this,D,T,h)},b(C,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),C}(f.default)},"./src/controller/subtitle-track-controller.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),O=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function N(w,b){for(var E=0;E<b.length;E++){var l=b[E];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(w,l.key,l)}}function R(w,b,E){return b&&N(w.prototype,b),E&&N(w,E),w}function A(w,b){w.prototype=Object.create(b.prototype),w.prototype.constructor=w,f(w,b)}function f(w,b){return f=Object.setPrototypeOf||function(l,o){return l.__proto__=o,l},f(w,b)}var v=function(w){A(b,w);function b(l){var o;return o=w.call(this,l,"[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=b.prototype;return E.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,w.prototype.destroy.call(this)},E.registerListeners=function(){var o=this.hls;o.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(H.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var o=this.hls;o.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(H.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=P(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,C=s.details,g=this.trackId,m=this.tracksInGroup[g];if(!m){this.warn("Invalid subtitle track id "+d);return}var D=m.details;m.details=s.details,this.log("subtitle track "+d+" loaded ["+C.startSN+"-"+C.endSN+"]"),d===this.trackId&&(this.retryCount=0,this.playlistLoaded(d,s,D))},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 C=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,g=this.tracks.filter(function(T){return!d||T.groupId===d});this.tracksInGroup=g;var m=this.findTrackId(C==null?void 0:C.name)||this.findTrackId();this.groupId=d;var D={subtitleTracks:g};this.log("Updating subtitle tracks, "+g.length+' track(s) found in "'+d+'" group-id'),this.hls.trigger(H.Events.SUBTITLE_TRACKS_UPDATED,D),m!==-1&&this.setSubtitleTrack(m,C)}},E.findTrackId=function(o){for(var s=this.tracksInGroup,d=0;d<s.length;d++){var C=s[d];if((!this.selectDefaultTrack||C.default)&&(!o||o===C.name))return C.id}return-1},E.onError=function(o,s){if(w.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,C=s.groupId,g=s.url;if(o)try{g=o.addDirectives(g)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("Loading subtitle playlist for id "+d),this.hls.trigger(H.Events.SUBTITLE_TRACK_LOADING,{url:g,id:d,groupId:C,deliveryDirectives:o||null})}},E.toggleTrackModes=function(o){var s=this,d=this.media,C=this.subtitleDisplay,g=this.trackId;if(!d)return;var m=P(d.textTracks),D=m.filter(function(c){return c.groupId===s.groupId});if(o===-1)[].slice.call(m).forEach(function(c){c.mode="disabled"});else{var T=D[g];T&&(T.mode="disabled")}var h=D[o];h&&(h.mode=C?"showing":"hidden")},E.setSubtitleTrack=function(o,s){var d,C=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(d=C[o])!==null&&d!==void 0&&d.details)||o<-1||o>=C.length)return;this.clearTimer();var g=C[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,g){var m=g.id,D=g.groupId,T=D===void 0?"":D,h=g.name,c=g.type,u=g.url;this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:T,name:h,type:c,url:u});var a=this.switchParams(g.url,s==null?void 0:s.details);this.loadPlaylist(a)}else this.hls.trigger(H.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=P(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)},R(b,[{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)}}]),b}(O.default);function P(w){for(var b=[],E=0;E<w.length;E++){var l=w[E];l.kind==="subtitles"&&l.label&&b.push(w[E])}return b}K.default=v},"./src/controller/timeline-controller.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"TimelineController",function(){return P});var H=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),O=L("./src/utils/cea-608-parser.ts"),B=L("./src/utils/output-filter.ts"),N=L("./src/utils/webvtt-parser.ts"),R=L("./src/utils/texttrack-utils.ts"),A=L("./src/utils/imsc1-ttml-parser.ts"),f=L("./src/types/loader.ts"),v=L("./src/utils/logger.ts"),P=function(){function l(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"),C=new B.default(this,"textTrack2"),g=new B.default(this,"textTrack3"),m=new B.default(this,"textTrack4");this.cea608Parser1=new O.default(1,d,C),this.cea608Parser2=new O.default(3,g,m)}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=l.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,C,g,m,D){for(var T=!1,h=D.length;h--;){var c=D[h],u=b(c[0],c[1],C,g);if(u>=0&&(c[0]=Math.min(c[0],C),c[1]=Math.max(c[1],g),T=!0,u/(g-C)>.5))return}if(T||D.push([C,g]),this.config.renderTextTracksNatively){var a=this.captionsTracks[d];this.Cues.newCue(a,C,g,m)}else{var x=this.Cues.newCue(null,C,g,m);this.hls.trigger(I.Events.CUES_PARSED,{type:"captions",cues:x,track:d})}},o.onInitPtsFound=function(d,C){var g=this,m=C.frag,D=C.id,T=C.initPTS,h=C.timescale,c=this.unparsedVttFrags;D==="main"&&(this.initPTS[m.cc]=T,this.timescale[m.cc]=h),c.length&&(this.unparsedVttFrags=[],c.forEach(function(u){g.onFragLoaded(I.Events.FRAG_LOADED,u)}))},o.getExistingTrack=function(d){var C=this.media;if(C)for(var g=0;g<C.textTracks.length;g++){var m=C.textTracks[g];if(m[d])return m}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 C=this.captionsProperties,g=this.captionsTracks,m=this.media,D=C[d],T=D.label,h=D.languageCode,c=this.getExistingTrack(d);if(c)g[d]=c,Object(R.clearCurrentCues)(g[d]),Object(R.sendAddTrackEvent)(g[d],m);else{var u=this.createTextTrack("captions",T,h);u&&(u[d]=!0,g[d]=u)}},o.createNonNativeTrack=function(d){if(this.nonNativeCaptionsTracks[d])return;var C=this.captionsProperties[d];if(!C)return;var g=C.label,m={_id:d,label:g,kind:"captions",default:C.media?!!C.media.default:!1,closedCaptions:C.media};this.nonNativeCaptionsTracks[d]=m,this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[m]})},o.createTextTrack=function(d,C,g){var m=this.media;return m?m.addTextTrack(d,C,g):void 0},o.onMediaAttaching=function(d,C){this.media=C.media,this._cleanTracks()},o.onMediaDetaching=function(){var d=this.captionsTracks;Object.keys(d).forEach(function(C){Object(R.clearCurrentCues)(d[C]),delete d[C]}),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 C=d.textTracks;if(C)for(var g=0;g<C.length;g++)Object(R.clearCurrentCues)(C[g])},o.onSubtitleTracksUpdated=function(d,C){var g=this;this.textTracks=[];var m=C.subtitleTracks||[],D=m.some(function(u){return u.textCodec===A.IMSC1_CODEC});if(this.config.enableWebVTT||D&&this.config.enableIMSC1){var T=this.tracks&&m&&this.tracks.length===m.length;if(this.tracks=m||[],this.config.renderTextTracksNatively){var h=this.media?this.media.textTracks:[];this.tracks.forEach(function(u,a){var x;if(a<h.length){for(var y=null,p=0;p<h.length;p++)if(w(h[p],u)){y=h[p];break}y&&(x=y)}x?Object(R.clearCurrentCues)(x):(x=g.createTextTrack("subtitles",u.name,u.lang),x&&(x.mode="disabled")),x&&(x.groupId=u.groupId,g.textTracks.push(x))})}else if(!T&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(u){return{label:u.name,kind:u.type.toLowerCase(),default:u.default,subtitleTrack:u}});this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(d,C){var g=this;this.config.enableCEA708Captions&&C.captions&&C.captions.forEach(function(m){var D=/(?:CC|SERVICE)([1-4])/.exec(m.instreamId);if(!D)return;var T="textTrack"+D[1],h=g.captionsProperties[T];if(!h)return;h.label=m.name,m.lang&&(h.languageCode=m.lang),h.media=m})},o.onFragLoading=function(d,C){var g=this.cea608Parser1,m=this.cea608Parser2,D=this.lastSn,T=this.lastPartIndex;if(!this.enabled||!(g&&m))return;if(C.frag.type===f.PlaylistLevelType.MAIN){var h,c,u=C.frag.sn,a=(h=C==null||((c=C.part)===null||c===void 0)?void 0:c.index)!=null?h:-1;u===D+1||u===D&&a===T+1||(g.reset(),m.reset()),this.lastSn=u,this.lastPartIndex=a}},o.onFragLoaded=function(d,C){var g=C.frag,m=C.payload,D=this.initPTS,T=this.unparsedVttFrags;if(g.type===f.PlaylistLevelType.SUBTITLE)if(m.byteLength){if(!Object(H.isFiniteNumber)(D[g.cc])){T.push(C),D.length&&this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Missing initial subtitle PTS")});return}var h=g.decryptdata;if(h==null||h.key==null||h.method!=="AES-128"){var c=this.tracks[g.level],u=this.vttCCs;u[g.cc]||(u[g.cc]={start:g.start,prevCC:this.prevCC,new:!0},this.prevCC=g.cc),c&&c.textCodec===A.IMSC1_CODEC?this._parseIMSC1(g,m):this._parseVTTs(g,m,u)}}else this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(d,C){var g=this,m=this.hls;Object(A.parseIMSC1)(C,this.initPTS[d.cc],this.timescale[d.cc],function(D){g._appendCues(D,d.level),m.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(D){v.logger.log("Failed to parse IMSC1: "+D),m.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:D})})},o._parseVTTs=function(d,C,g){var m=this,D=this.hls;Object(N.parseWebVTT)(C,this.initPTS[d.cc],this.timescale[d.cc],g,d.cc,d.start,function(T){m._appendCues(T,d.level),D.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(T){m._fallbackToIMSC1(d,C),v.logger.log("Failed to parse VTT cue: "+T),D.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:T})})},o._fallbackToIMSC1=function(d,C){var g=this,m=this.tracks[d.level];m.textCodec||Object(A.parseIMSC1)(C,this.initPTS[d.cc],this.timescale[d.cc],function(){m.textCodec=A.IMSC1_CODEC,g._parseIMSC1(d,C)},function(){m.textCodec="wvtt"})},o._appendCues=function(d,C){var g=this.hls;if(this.config.renderTextTracksNatively){var m=this.textTracks[C];if(m.mode==="disabled")return;d.forEach(function(h){return Object(R.addCueToTrack)(m,h)})}else{var D=this.tracks[C],T=D.default?"default":"subtitles"+C;g.trigger(I.Events.CUES_PARSED,{type:"subtitles",cues:d,track:T})}},o.onFragDecrypted=function(d,C){var g=C.frag;if(g.type===f.PlaylistLevelType.SUBTITLE){if(!Object(H.isFiniteNumber)(this.initPTS[g.cc])){this.unparsedVttFrags.push(C);return}this.onFragLoaded(I.Events.FRAG_LOADED,C)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(d,C){var g=this.cea608Parser1,m=this.cea608Parser2;if(!this.enabled||!(g&&m))return;for(var D=0;D<C.samples.length;D++){var T=C.samples[D].bytes;if(T){var h=this.extractCea608Data(T);g.addData(C.samples[D].pts,h[0]),m.addData(C.samples[D].pts,h[1])}}},o.onBufferFlushing=function(d,C){var g=C.startOffset,m=C.endOffset,D=C.endOffsetSubtitles,T=C.type,h=this.media;if(!h||h.currentTime<m)return;if(!T||T==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(R.removeCuesInRange)(c[a],g,m)})}if(this.config.renderTextTracksNatively&&(g===0&&D!==void 0)){var u=this.textTracks;Object.keys(u).forEach(function(a){return Object(R.removeCuesInRange)(u[a],g,D)})}},o.extractCea608Data=function(d){for(var C=d[0]&31,g=2,m=[[],[]],D=0;D<C;D++){var T=d[g++],h=127&d[g++],c=127&d[g++],u=(4&T)!==0,a=3&T;if(h===0&&c===0)continue;u&&((a===0||a===1)&&(m[a].push(h),m[a].push(c)))}return m},l}();function w(l,o){return l&&l.label===o.name&&!(l.textTrack1||l.textTrack2)}function b(l,o,s,d){return Math.min(o,d)-Math.max(l,s)}function E(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return H});var H=function(){function I(B,N){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=N}var O=I.prototype;return O.decrypt=function(N,R){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},R,N)},I}()},"./src/crypt/aes-decryptor.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"removePadding",function(){return I}),L.d(K,"default",function(){return O});var H=L("./src/utils/typed-array.ts");function I(B){var N=B.byteLength,R=N&&new DataView(B.buffer).getUint8(N-1);return R?Object(H.sliceUint8)(B,0,N-R):B}var O=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(A){for(var f=new DataView(A),v=new Uint32Array(4),P=0;P<4;P++)v[P]=f.getUint32(P*4);return v},N.initTable=function(){var A=this.sBox,f=this.invSBox,v=this.subMix,P=v[0],w=v[1],b=v[2],E=v[3],l=this.invSubMix,o=l[0],s=l[1],d=l[2],C=l[3],g=new Uint32Array(256),m=0,D=0,T=0;for(T=0;T<256;T++)T<128?g[T]=T<<1:g[T]=T<<1^283;for(T=0;T<256;T++){var h=D^D<<1^D<<2^D<<3^D<<4;h=h>>>8^h&255^99,A[m]=h,f[h]=m;var c=g[m],u=g[c],a=g[u],x=g[h]*257^h*16843008;P[m]=x<<24|x>>>8,w[m]=x<<16|x>>>16,b[m]=x<<8|x>>>24,E[m]=x,x=a*16843009^u*65537^c*257^m*16843008,o[h]=x<<24|x>>>8,s[h]=x<<16|x>>>16,d[h]=x<<8|x>>>24,C[h]=x,m?(m=c^g[g[g[a^c]]],D^=g[g[D]]):m=D=1}},N.expandKey=function(A){for(var f=this.uint8ArrayToUint32Array_(A),v=!0,P=0;P<f.length&&v;)v=f[P]===this.key[P],P++;if(v)return;this.key=f;var w=this.keySize=f.length;if(w!==4&&w!==6&&w!==8)throw new Error("Invalid aes key size="+w);var b=this.ksRows=(w+6+1)*4,E,l,o=this.keySchedule=new Uint32Array(b),s=this.invKeySchedule=new Uint32Array(b),d=this.sBox,C=this.rcon,g=this.invSubMix,m=g[0],D=g[1],T=g[2],h=g[3],c,u;for(E=0;E<b;E++){if(E<w){c=o[E]=f[E];continue}u=c,E%w===0?(u=u<<8|u>>>24,u=d[u>>>24]<<24|d[u>>>16&255]<<16|d[u>>>8&255]<<8|d[u&255],u^=C[E/w|0]<<24):w>6&&E%w===4&&(u=d[u>>>24]<<24|d[u>>>16&255]<<16|d[u>>>8&255]<<8|d[u&255]),o[E]=c=(o[E-w]^u)>>>0}for(l=0;l<b;l++)E=b-l,l&3?u=o[E]:u=o[E-4],l<4||E<=4?s[l]=u:s[l]=m[d[u>>>24]]^D[d[u>>>16&255]]^T[d[u>>>8&255]]^h[d[u&255]],s[l]=s[l]>>>0},N.networkToHostOrderSwap=function(A){return A<<24|(A&65280)<<8|(A&16711680)>>8|A>>>24},N.decrypt=function(A,f,v){for(var P=this.keySize+6,w=this.invKeySchedule,b=this.invSBox,E=this.invSubMix,l=E[0],o=E[1],s=E[2],d=E[3],C=this.uint8ArrayToUint32Array_(v),g=C[0],m=C[1],D=C[2],T=C[3],h=new Int32Array(A),c=new Int32Array(h.length),u,a,x,y,p,k,F,U,W,_,M,G,Y,Z,ne=this.networkToHostOrderSwap;f<h.length;){for(W=ne(h[f]),_=ne(h[f+1]),M=ne(h[f+2]),G=ne(h[f+3]),p=W^w[0],k=G^w[1],F=M^w[2],U=_^w[3],Y=4,Z=1;Z<P;Z++)u=l[p>>>24]^o[k>>16&255]^s[F>>8&255]^d[U&255]^w[Y],a=l[k>>>24]^o[F>>16&255]^s[U>>8&255]^d[p&255]^w[Y+1],x=l[F>>>24]^o[U>>16&255]^s[p>>8&255]^d[k&255]^w[Y+2],y=l[U>>>24]^o[p>>16&255]^s[k>>8&255]^d[F&255]^w[Y+3],p=u,k=a,F=x,U=y,Y=Y+4;u=b[p>>>24]<<24^b[k>>16&255]<<16^b[F>>8&255]<<8^b[U&255]^w[Y],a=b[k>>>24]<<24^b[F>>16&255]<<16^b[U>>8&255]<<8^b[p&255]^w[Y+1],x=b[F>>>24]<<24^b[U>>16&255]<<16^b[p>>8&255]<<8^b[k&255]^w[Y+2],y=b[U>>>24]<<24^b[p>>16&255]<<16^b[k>>8&255]<<8^b[F&255]^w[Y+3],c[f]=ne(u^g),c[f+1]=ne(y^m),c[f+2]=ne(x^D),c[f+3]=ne(a^T),g=W,m=_,D=M,T=G,f=f+4}return c.buffer},B}()},"./src/crypt/decrypter.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return f});var H=L("./src/crypt/aes-crypto.ts"),I=L("./src/crypt/fast-aes-key.ts"),O=L("./src/crypt/aes-decryptor.ts"),B=L("./src/utils/logger.ts"),N=L("./src/utils/mp4-tools.ts"),R=L("./src/utils/typed-array.ts"),A=16,f=function(){function v(w,b,E){var l=E===void 0?{}:E,o=l.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=w,this.config=b,this.removePKCS7Padding=s,s)try{var d=self.crypto;d&&(this.subtle=d.subtle||d.webkitSubtle)}catch(C){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var P=v.prototype;return P.destroy=function(){this.observer=null},P.isSync=function(){return this.config.enableSoftwareAES},P.flush=function(){var b=this.currentResult;if(!b){this.reset();return}var E=new Uint8Array(b);return this.reset(),this.removePKCS7Padding?Object(O.removePadding)(E):E},P.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},P.decrypt=function(b,E,l,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(b),E,l);var s=this.flush();s&&o(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(b),E,l).then(o)},P.softwareDecrypt=function(b,E,l){var o=this.currentIV,s=this.currentResult,d=this.remainderData;this.logOnce("JS AES decrypt"),d&&(b=Object(N.appendUint8Array)(d,b),this.remainderData=null);var C=this.getValidChunk(b);if(!C.length)return null;o&&(l=o);var g=this.softwareDecrypter;g||(g=this.softwareDecrypter=new O.default),g.expandKey(E);var m=s;return this.currentResult=g.decrypt(C.buffer,0,l),this.currentIV=Object(R.sliceUint8)(C,-16).buffer,m||null},P.webCryptoDecrypt=function(b,E,l){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 C=new H.default(s,l);return C.decrypt(b.buffer,d)}).catch(function(d){return o.onWebCryptoError(d,b,E,l)})},P.onWebCryptoError=function(b,E,l,o){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",b),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(E,l,o)},P.getValidChunk=function(b){var E=b,l=b.length-b.length%A;return l!==b.length&&(E=Object(R.sliceUint8)(b,0,l),this.remainderData=Object(R.sliceUint8)(b,l)),E},P.logOnce=function(b){if(!this.logEnabled)return;B.logger.log("[decrypter.ts]: "+b),this.logEnabled=!1},v}()},"./src/crypt/fast-aes-key.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return H});var H=function(){function I(B,N){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=N}var O=I.prototype;return O.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},I}()},"./src/demux/aacdemuxer.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/adts.ts"),O=L("./src/utils/logger.ts"),B=L("./src/demux/id3.ts");function N(f,v){f.prototype=Object.create(v.prototype),f.prototype.constructor=f,R(f,v)}function R(f,v){return R=Object.setPrototypeOf||function(w,b){return w.__proto__=b,w},R(f,v)}var A=function(f){N(v,f);function v(w,b){var E;return E=f.call(this)||this,E.observer=void 0,E.config=void 0,E.observer=w,E.config=b,E}var P=v.prototype;return P.resetInitSegment=function(b,E,l){f.prototype.resetInitSegment.call(this,b,E,l),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:b,duration:l,inputTimeScale:9e4,dropped:0}},v.probe=function(b){if(!b)return!1;for(var E=B.getID3Data(b,0)||[],l=E.length,o=b.length;l<o;l++)if(I.probe(b,l))return O.logger.log("ADTS sync word found !"),!0;return!1},P.canParse=function(b,E){return I.canParse(b,E)},P.appendFrame=function(b,E,l){I.initTrackConfig(b,this.observer,E,l,b.manifestCodec);var o=I.appendFrame(b,E,l,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},v}(H.default);A.minProbeByteLength=9,K.default=A},"./src/demux/adts.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"getAudioConfig",function(){return B}),L.d(K,"isHeaderPattern",function(){return N}),L.d(K,"getHeaderLength",function(){return R}),L.d(K,"getFullFrameLength",function(){return A}),L.d(K,"canGetFrameLength",function(){return f}),L.d(K,"isHeader",function(){return v}),L.d(K,"canParse",function(){return P}),L.d(K,"probe",function(){return w}),L.d(K,"initTrackConfig",function(){return b}),L.d(K,"getFrameDuration",function(){return E}),L.d(K,"parseFrameHeader",function(){return l}),L.d(K,"appendFrame",function(){return o});var H=L("./src/utils/logger.ts"),I=L("./src/errors.ts"),O=L("./src/events.ts");function B(s,d,C,g){var m,D,T,h,c=navigator.userAgent.toLowerCase(),u=g,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];m=((d[C+2]&192)>>>6)+1;var x=(d[C+2]&60)>>>2;if(x>a.length-1){s.trigger(O.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+x});return}return T=(d[C+2]&1)<<2,T|=(d[C+3]&192)>>>6,H.logger.log("manifest codec:"+g+", ADTS type:"+m+", samplingIndex:"+x),/firefox/i.test(c)?x>=6?(m=5,h=new Array(4),D=x-3):(m=2,h=new Array(2),D=x):c.indexOf("android")!==-1?(m=2,h=new Array(2),D=x):(m=5,h=new Array(4),g&&(g.indexOf("mp4a.40.29")!==-1||g.indexOf("mp4a.40.5")!==-1)||!g&&x>=6?D=x-3:((g&&g.indexOf("mp4a.40.2")!==-1&&(x>=6&&T===1||/vivaldi/i.test(c))||!g&&T===1)&&(m=2,h=new Array(2)),D=x)),h[0]=m<<3,h[0]|=(x&14)>>1,h[1]|=(x&1)<<7,h[1]|=T<<3,m===5&&(h[1]|=(D&14)>>1,h[2]=(D&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:a[x],channelCount:T,codec:"mp4a.40."+m,manifestCodec:u}}function N(s,d){return s[d]===255&&(s[d+1]&246)===240}function R(s,d){return s[d+1]&1?7:9}function A(s,d){return(s[d+3]&3)<<11|s[d+4]<<3|(s[d+5]&224)>>>5}function f(s,d){return d+5<s.length}function v(s,d){return d+1<s.length&&N(s,d)}function P(s,d){return f(s,d)&&N(s,d)&&A(s,d)<=s.length-d}function w(s,d){if(v(s,d)){var C=R(s,d);if(d+C>=s.length)return!1;var g=A(s,d);if(g<=C)return!1;var m=d+g;return m===s.length||v(s,m)}return!1}function b(s,d,C,g,m){if(!s.samplerate){var D=B(d,C,g,m);if(!D)return;s.config=D.config,s.samplerate=D.samplerate,s.channelCount=D.channelCount,s.codec=D.codec,s.manifestCodec=D.manifestCodec,H.logger.log("parsed codec:"+s.codec+", rate:"+D.samplerate+", channels:"+D.channelCount)}}function E(s){return 1024*9e4/s}function l(s,d,C,g,m){var D=R(s,d),T=A(s,d);if(T-=D,T>0){var h=C+g*m;return{headerLength:D,frameLength:T,stamp:h}}}function o(s,d,C,g,m){var D=E(s.samplerate),T=l(d,C,g,m,D);if(T){var h=T.frameLength,c=T.headerLength,u=T.stamp,a=c+h,x=Math.max(0,C+a-d.length),y;x?(y=new Uint8Array(a-c),y.set(d.subarray(C+c,d.length),0)):y=d.subarray(C+c,C+a);var p={unit:y,pts:u};return x||s.samples.push(p),{sample:p,length:a,missing:x}}}},"./src/demux/base-audio-demuxer.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"initPTSFn",function(){return A});var H=L("./src/polyfills/number.ts"),I=L("./src/demux/id3.ts"),O=L("./src/demux/dummy-demuxed-track.ts"),B=L("./src/utils/mp4-tools.ts"),N=L("./src/utils/typed-array.ts"),R=function(){function f(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var v=f.prototype;return v.resetInitSegment=function(w,b,E){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},v.resetTimeStamp=function(){},v.resetContiguity=function(){},v.canParse=function(w,b){return!1},v.appendFrame=function(w,b,E){},v.demux=function(w,b){this.cachedData&&(w=Object(B.appendUint8Array)(this.cachedData,w),this.cachedData=null);var E=I.getID3Data(w,0),l=E?E.length:0,o,s,d=this._audioTrack,C=this._id3Track,g=E?I.getTimeStamp(E):void 0,m=w.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=A(g,b)),E&&E.length>0&&C.samples.push({pts:this.initPTS,dts:this.initPTS,data:E}),s=this.initPTS;l<m;){if(this.canParse(w,l)){var D=this.appendFrame(d,w,l);D?(this.frameIndex++,s=D.sample.pts,l+=D.length,o=l):l=m}else I.canParse(w,l)?(E=I.getID3Data(w,l),C.samples.push({pts:s,dts:s,data:E}),l+=E.length,o=l):l++;if(l===m&&o!==m){var T=Object(N.sliceUint8)(w,o);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,T):this.cachedData=T}}return{audioTrack:d,avcTrack:Object(O.dummyTrack)(),id3Track:C,textTrack:Object(O.dummyTrack)()}},v.demuxSampleAes=function(w,b,E){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},v.flush=function(w){var b=this.cachedData;return b&&(this.cachedData=null,this.demux(b,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(O.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(O.dummyTrack)()}},v.destroy=function(){},f}(),A=function(v,P){return Object(H.isFiniteNumber)(v)?v*90:P*9e4};K.default=R},"./src/demux/chunk-cache.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return H});var H=function(){function O(){this.chunks=[],this.dataLength=0}var B=O.prototype;return B.push=function(R){this.chunks.push(R),this.dataLength+=R.length},B.flush=function(){var R=this.chunks,A=this.dataLength,f;if(R.length)R.length===1?f=R[0]:f=I(R,A);else return new Uint8Array(0);return this.reset(),f},B.reset=function(){this.chunks.length=0,this.dataLength=0},O}();function I(O,B){for(var N=new Uint8Array(B),R=0,A=0;A<O.length;A++){var f=O[A];N.set(f,R),R+=f.length}return N}},"./src/demux/dummy-demuxed-track.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"dummyTrack",function(){return H});function H(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/utils/logger.ts"),I=function(){function O(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=O.prototype;return B.loadWord=function(){var R=this.data,A=this.bytesAvailable,f=R.byteLength-A,v=new Uint8Array(4),P=Math.min(4,A);if(P===0)throw new Error("no bytes available");v.set(R.subarray(f,f+P)),this.word=new DataView(v.buffer).getUint32(0),this.bitsAvailable=P*8,this.bytesAvailable-=P},B.skipBits=function(R){var A;this.bitsAvailable>R?(this.word<<=R,this.bitsAvailable-=R):(R-=this.bitsAvailable,A=R>>3,R-=A>>3,this.bytesAvailable-=A,this.loadWord(),this.word<<=R,this.bitsAvailable-=R)},B.readBits=function(R){var A=Math.min(this.bitsAvailable,R),f=this.word>>>32-A;return R>32&&H.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=A,this.bitsAvailable>0?this.word<<=A:this.bytesAvailable>0&&this.loadWord(),A=R-A,A>0&&this.bitsAvailable?f<<A|this.readBits(A):f},B.skipLZ=function(){var R;for(R=0;R<this.bitsAvailable;++R)if((this.word&2147483648>>>R)!==0)return this.word<<=R,this.bitsAvailable-=R,R;return this.loadWord(),R+this.skipLZ()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var R=this.skipLZ();return this.readBits(R+1)-1},B.readEG=function(){var R=this.readUEG();return 1&R?1+R>>>1:-1*(R>>>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(R){for(var A=8,f=8,v,P=0;P<R;P++)f!==0&&(v=this.readEG(),f=(A+v+256)%256),A=f===0?A:f},B.readSPS=function(){var R=0,A=0,f=0,v=0,P,w,b,E=this.readUByte.bind(this),l=this.readBits.bind(this),o=this.readUEG.bind(this),s=this.readBoolean.bind(this),d=this.skipBits.bind(this),C=this.skipEG.bind(this),g=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);E();var D=E();if(l(5),d(3),E(),g(),D===100||D===110||D===122||D===244||D===44||D===83||D===86||D===118||D===128){var T=o();if(T===3&&d(1),g(),g(),d(1),s())for(w=T!==3?8:12,b=0;b<w;b++)s()&&(b<6?m(16):m(64))}g();var h=o();if(h===0)o();else if(h===1)for(d(1),C(),C(),P=o(),b=0;b<P;b++)C();g(),d(1);var c=o(),u=o(),a=l(1);a===0&&d(1),d(1),s()&&(R=o(),A=o(),f=o(),v=o());var x=[1,1];if(s()&&s()){var y=E();switch(y){case 1:x=[1,1];break;case 2:x=[12,11];break;case 3:x=[10,11];break;case 4:x=[16,11];break;case 5:x=[40,33];break;case 6:x=[24,11];break;case 7:x=[20,11];break;case 8:x=[32,11];break;case 9:x=[80,33];break;case 10:x=[18,11];break;case 11:x=[15,11];break;case 12:x=[64,33];break;case 13:x=[160,99];break;case 14:x=[4,3];break;case 15:x=[3,2];break;case 16:x=[2,1];break;case 255:{x=[E()<<8|E(),E()<<8|E()];break}}}return{width:Math.ceil((c+1)*16-R*2-A*2),height:(2-a)*(u+1)*16-(a?2:4)*(f+v),pixelRatio:x}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},O}();K.default=I},"./src/demux/id3.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"isHeader",function(){return H}),L.d(K,"isFooter",function(){return I}),L.d(K,"getID3Data",function(){return O}),L.d(K,"canParse",function(){return N}),L.d(K,"getTimeStamp",function(){return R}),L.d(K,"isTimeStampFrame",function(){return A}),L.d(K,"getID3Frames",function(){return v}),L.d(K,"decodeFrame",function(){return P}),L.d(K,"utf8ArrayToStr",function(){return o}),L.d(K,"testables",function(){return s});var H=function(m,D){return D+10<=m.length&&(m[D]===73&&m[D+1]===68&&m[D+2]===51&&(m[D+3]<255&&m[D+4]<255&&(m[D+6]<128&&m[D+7]<128&&m[D+8]<128&&m[D+9]<128)))},I=function(m,D){return D+10<=m.length&&(m[D]===51&&m[D+1]===68&&m[D+2]===73&&(m[D+3]<255&&m[D+4]<255&&(m[D+6]<128&&m[D+7]<128&&m[D+8]<128&&m[D+9]<128)))},O=function(m,D){for(var T=D,h=0;H(m,D);){h+=10;var c=B(m,D+6);h+=c,I(m,D+10)&&(h+=10),D+=h}return h>0?m.subarray(T,T+h):void 0},B=function(m,D){var T=0;return T=(m[D]&127)<<21,T|=(m[D+1]&127)<<14,T|=(m[D+2]&127)<<7,T|=m[D+3]&127,T},N=function(m,D){return H(m,D)&&B(m,D+6)+10<=m.length-D},R=function(m){for(var D=v(m),T=0;T<D.length;T++){var h=D[T];if(A(h))return l(h)}return},A=function(m){return m&&m.key==="PRIV"&&m.info==="com.apple.streaming.transportStreamTimestamp"},f=function(m){var D=String.fromCharCode(m[0],m[1],m[2],m[3]),T=B(m,4),h=10;return{type:D,size:T,data:m.subarray(h,h+T)}},v=function(m){for(var D=0,T=[];H(m,D);){var h=B(m,D+6);D+=10;for(var c=D+h;D+8<c;){var u=f(m.subarray(D)),a=P(u);a&&T.push(a),D+=u.size+10}I(m,D)&&(D+=10)}return T},P=function(m){return m.type==="PRIV"?w(m):m.type[0]==="W"?E(m):b(m)},w=function(m){if(m.size<2)return;var D=o(m.data,!0),T=new Uint8Array(m.data.subarray(D.length+1));return{key:m.type,info:D,data:T.buffer}},b=function(m){if(m.size<2)return;if(m.type==="TXXX"){var D=1,T=o(m.data.subarray(D),!0);D+=T.length+1;var h=o(m.data.subarray(D));return{key:m.type,info:T,data:h}}var c=o(m.data.subarray(1));return{key:m.type,data:c}},E=function(m){if(m.type==="WXXX"){if(m.size<2)return;var D=1,T=o(m.data.subarray(D),!0);D+=T.length+1;var h=o(m.data.subarray(D));return{key:m.type,info:T,data:h}}var c=o(m.data);return{key:m.type,data:c}},l=function(m){if(m.data.byteLength===8){var D=new Uint8Array(m.data),T=D[3]&1,h=(D[4]<<23)+(D[5]<<15)+(D[6]<<7)+D[7];return h/=45,T&&(h+=4772185884e-2),Math.round(h)}return},o=function(m,D){D===void 0&&(D=!1);var T=C();if(T){var h=T.decode(m);if(D){var c=h.indexOf("\0");return c!==-1?h.substring(0,c):h}return h.replace(/\0/g,"")}for(var u=m.length,a,x,y,p="",k=0;k<u;){if(a=m[k++],a===0&&D)return p;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:p+=String.fromCharCode(a);break;case 12:case 13:x=m[k++],p+=String.fromCharCode((a&31)<<6|x&63);break;case 14:x=m[k++],y=m[k++],p+=String.fromCharCode((a&15)<<12|(x&63)<<6|(y&63)<<0);break;default:}}return p},s={decodeTextFrame:b},d;function C(){return!d&&typeof self.TextDecoder!="undefined"&&(d=new self.TextDecoder("utf-8")),d}},"./src/demux/mp3demuxer.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/id3.ts"),O=L("./src/utils/logger.ts"),B=L("./src/demux/mpegaudio.ts");function N(f,v){f.prototype=Object.create(v.prototype),f.prototype.constructor=f,R(f,v)}function R(f,v){return R=Object.setPrototypeOf||function(w,b){return w.__proto__=b,w},R(f,v)}var A=function(f){N(v,f);function v(){return f.apply(this,arguments)||this}var P=v.prototype;return P.resetInitSegment=function(b,E,l){f.prototype.resetInitSegment.call(this,b,E,l),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:b,duration:l,inputTimeScale:9e4,dropped:0}},v.probe=function(b){if(!b)return!1;for(var E=I.getID3Data(b,0)||[],l=E.length,o=b.length;l<o;l++)if(B.probe(b,l))return O.logger.log("MPEG Audio sync word found !"),!0;return!1},P.canParse=function(b,E){return B.canParse(b,E)},P.appendFrame=function(b,E,l){return this.initPTS===null?void 0:B.appendFrame(b,E,l,this.initPTS,this.frameIndex)},v}(H.default);A.minProbeByteLength=4,K.default=A},"./src/demux/mp4demuxer.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/utils/mp4-tools.ts"),I=L("./src/demux/dummy-demuxed-track.ts"),O=function(){function B(R,A){this.remainderData=null,this.config=void 0,this.config=A}var N=B.prototype;return N.resetTimeStamp=function(){},N.resetInitSegment=function(){},N.resetContiguity=function(){},B.probe=function(A){return Object(H.findBox)({data:A,start:0,end:Math.min(A.length,16384)},["moof"]).length>0},N.demux=function(A){var f=A,v=Object(I.dummyTrack)();if(this.config.progressive){this.remainderData&&(f=Object(H.appendUint8Array)(this.remainderData,A));var P=Object(H.segmentValidRange)(f);this.remainderData=P.remainder,v.samples=P.valid||new Uint8Array}else v.samples=f;return{audioTrack:Object(I.dummyTrack)(),avcTrack:v,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},N.flush=function(){var A=Object(I.dummyTrack)();return A.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(I.dummyTrack)(),avcTrack:A,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},N.demuxSampleAes=function(A,f,v){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},N.destroy=function(){},B}();O.minProbeByteLength=1024,K.default=O},"./src/demux/mpegaudio.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"appendFrame",function(){return R}),L.d(K,"parseHeader",function(){return A}),L.d(K,"isHeaderPattern",function(){return f}),L.d(K,"isHeader",function(){return v}),L.d(K,"canParse",function(){return P}),L.d(K,"probe",function(){return w});var H=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],O=[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 R(b,E,l,o,s){if(l+24>E.length)return;var d=A(E,l);if(d&&l+d.frameLength<=E.length){var C=d.samplesPerFrame*9e4/d.sampleRate,g=o+s*C,m={unit:E.subarray(l,l+d.frameLength),pts:g,dts:g};return b.config=[],b.channelCount=d.channelCount,b.samplerate=d.sampleRate,b.samples.push(m),{sample:m,length:d.frameLength,missing:0}}}function A(b,E){var l=b[E+1]>>3&3,o=b[E+1]>>1&3,s=b[E+2]>>4&15,d=b[E+2]>>2&3;if(l!==1&&s!==0&&s!==15&&d!==3){var C=b[E+2]>>1&1,g=b[E+3]>>6,m=l===3?3-o:o===3?3:4,D=I[m*14+s-1]*1e3,T=l===3?0:l===2?1:2,h=O[T*3+d],c=g===3?1:2,u=B[l][o],a=N[o],x=u*8*a,y=Math.floor(u*D/h+C)*a;if(H===null){var p=navigator.userAgent||"",k=p.match(/Chrome\/(\d+)/i);H=k?parseInt(k[1]):0}var F=!!H&&H<=87;return F&&o===2&&D>=224e3&&g===0&&(b[E+3]=b[E+3]|128),{sampleRate:h,channelCount:c,frameLength:y,samplesPerFrame:x}}}function f(b,E){return b[E]===255&&(b[E+1]&224)===224&&(b[E+1]&6)!==0}function v(b,E){return E+1<b.length&&f(b,E)}function P(b,E){var l=4;return f(b,E)&&l<=b.length-E}function w(b,E){if(E+1<b.length&&f(b,E)){var l=4,o=A(b,E),s=l;o!=null&&o.frameLength&&(s=o.frameLength);var d=E+s;return d===b.length||v(b,d)}return!1}},"./src/demux/sample-aes.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/crypt/decrypter.ts"),I=L("./src/demux/tsdemuxer.ts"),O=function(){function B(R,A,f){this.keyData=void 0,this.decrypter=void 0,this.keyData=f,this.decrypter=new H.default(R,A,{removePKCS7Padding:!1})}var N=B.prototype;return N.decryptBuffer=function(A,f){this.decrypter.decrypt(A,this.keyData.key.buffer,this.keyData.iv.buffer,f)},N.decryptAacSample=function(A,f,v,P){var w=A[f].unit,b=w.subarray(16,w.length-w.length%16),E=b.buffer.slice(b.byteOffset,b.byteOffset+b.length),l=this;this.decryptBuffer(E,function(o){var s=new Uint8Array(o);w.set(s,16),P||l.decryptAacSamples(A,f+1,v)})},N.decryptAacSamples=function(A,f,v){for(;;f++){if(f>=A.length){v();return}if(A[f].unit.length<32)continue;var P=this.decrypter.isSync();if(this.decryptAacSample(A,f,v,P),!P)return}},N.getAvcEncryptedData=function(A){for(var f=Math.floor((A.length-48)/160)*16+16,v=new Int8Array(f),P=0,w=32;w<=A.length-16;w+=160,P+=16)v.set(A.subarray(w,w+16),P);return v},N.getAvcDecryptedUnit=function(A,f){for(var v=new Uint8Array(f),P=0,w=32;w<=A.length-16;w+=160,P+=16)A.set(v.subarray(P,P+16),w);return A},N.decryptAvcSample=function(A,f,v,P,w,b){var E=Object(I.discardEPB)(w.data),l=this.getAvcEncryptedData(E),o=this;this.decryptBuffer(l.buffer,function(s){w.data=o.getAvcDecryptedUnit(E,s),b||o.decryptAvcSamples(A,f,v+1,P)})},N.decryptAvcSamples=function(A,f,v,P){if(A instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;f++,v=0){if(f>=A.length){P();return}for(var w=A[f].units;!(v>=w.length);v++){var b=w[v];if(b.data.length<=48||b.type!==1&&b.type!==5)continue;var E=this.decrypter.isSync();if(this.decryptAvcSample(A,f,v,P,b,E),!E)return}}},B}();K.default=O},"./src/demux/transmuxer-interface.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return w});var H=L("./node_modules/webworkify-webpack/index.js"),I=L.n(H),O=L("./src/events.ts"),B=L("./src/demux/transmuxer.ts"),N=L("./src/utils/logger.ts"),R=L("./src/errors.ts"),A=L("./src/utils/mediasource-helper.ts"),f=L("./node_modules/eventemitter3/index.js"),v=L.n(f),P=Object(A.getMediaSource)()||{isTypeSupported:function(){return!1}},w=function(){function b(l,o,s,d){var C=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=l,this.id=o,this.onTransmuxComplete=s,this.onFlush=d;var g=l.config,m=function(u,a){a=a||{},a.frag=C.frag,a.id=C.id,l.trigger(u,a)};this.observer=new f.EventEmitter,this.observer.on(O.Events.FRAG_DECRYPTED,m),this.observer.on(O.Events.ERROR,m);var D={mp4:P.isTypeSupported("video/mp4"),mpeg:P.isTypeSupported("audio/mpeg"),mp3:P.isTypeSupported('audio/mp4; codecs="mp3"')},T=navigator.vendor;if(g.enableWorker&&typeof Worker!="undefined"){N.logger.log("demuxing in webworker");var h;try{h=this.worker=H("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(c){l.trigger(O.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},h.postMessage({cmd:"init",typeSupported:D,vendor:T,id:o,config:JSON.stringify(g)})}catch(c){N.logger.warn("Error in worker:",c),N.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new B.default(this.observer,D,g,T,o),this.worker=null}}else this.transmuxer=new B.default(this.observer,D,g,T,o)}var E=b.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,C,g,m,D,T,h,c){var u=this;h.transmuxing.start=self.performance.now();var a=this.transmuxer,x=this.worker,y=m?m.start:g.start,p=g.decryptdata,k=this.frag,F=!(k&&g.cc===k.cc),U=!(k&&h.level===k.level),W=k?h.sn-k.sn:-1,_=this.part?h.part-this.part.index:1,M=!U&&(W===1||W===0&&_===1),G=self.performance.now();(U||W||g.stats.parsing.start===0)&&(g.stats.parsing.start=G),m&&(_||!M)&&(m.stats.parsing.start=G);var Y=new B.TransmuxState(F,M,T,U,y);if(!M||F){N.logger.log("[transmuxer-interface, "+g.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
|
|
discontinuity: `+F+`
|
|
trackSwitch: `+U+`
|
|
contiguous: `+M+`
|
|
accurateTimeOffset: `+T+`
|
|
timeOffset: `+y);var Z=new B.TransmuxConfig(d,C,s,D,c);this.configureTransmuxer(Z)}if(this.frag=g,this.part=m,x)x.postMessage({cmd:"demux",data:o,decryptdata:p,chunkMeta:h,state:Y},o instanceof ArrayBuffer?[o]:[]);else if(a){var ne=a.push(o,p,h,Y);Object(B.isPromise)(ne)?ne.then(function(be){u.handleTransmuxComplete(be)}):this.handleTransmuxComplete(ne)}},E.flush=function(o){var s=this;o.transmuxing.start=self.performance.now();var d=this.transmuxer,C=this.worker;if(C)C.postMessage({cmd:"flush",chunkMeta:o});else if(d){var g=d.flush(o);Object(B.isPromise)(g)?g.then(function(m){s.handleFlushResult(m,o)}):this.handleFlushResult(g,o)}},E.handleFlushResult=function(o,s){var d=this;o.forEach(function(C){d.handleTransmuxComplete(C)}),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)},b}()},"./src/demux/transmuxer-worker.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return R});var H=L("./src/demux/transmuxer.ts"),I=L("./src/events.ts"),O=L("./src/utils/logger.ts"),B=L("./node_modules/eventemitter3/index.js"),N=L.n(B);function R(w){var b=new B.EventEmitter,E=function(o,s){w.postMessage({event:o,data:s})};b.on(I.Events.FRAG_DECRYPTED,E),b.on(I.Events.ERROR,E),w.addEventListener("message",function(l){var o=l.data;switch(o.cmd){case"init":{var s=JSON.parse(o.config);w.transmuxer=new H.default(b,o.typeSupported,s,o.vendor,o.id),Object(O.enableLogs)(s.debug),E("init",null);break}case"configure":{w.transmuxer.configure(o.config);break}case"demux":{var d=w.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(H.isPromise)(d)?d.then(function(m){A(w,m)}):A(w,d);break}case"flush":{var C=o.chunkMeta,g=w.transmuxer.flush(C);Object(H.isPromise)(g)?g.then(function(m){v(w,m,C)}):v(w,g,C);break}default:break}})}function A(w,b){if(P(b.remuxResult))return;var E=[],l=b.remuxResult,o=l.audio,s=l.video;o&&f(E,o),s&&f(E,s),w.postMessage({event:"transmuxComplete",data:b},E)}function f(w,b){b.data1&&w.push(b.data1.buffer),b.data2&&w.push(b.data2.buffer)}function v(w,b,E){b.forEach(function(l){A(w,l)}),w.postMessage({event:"flush",data:E})}function P(w){return!w.audio&&!w.video&&!w.text&&!w.id3&&!w.initSegment}},"./src/demux/transmuxer.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return s}),L.d(K,"isPromise",function(){return g}),L.d(K,"TransmuxConfig",function(){return m}),L.d(K,"TransmuxState",function(){return D});var H=L("./src/events.ts"),I=L("./src/errors.ts"),O=L("./src/crypt/decrypter.ts"),B=L("./src/demux/aacdemuxer.ts"),N=L("./src/demux/mp4demuxer.ts"),R=L("./src/demux/tsdemuxer.ts"),A=L("./src/demux/mp3demuxer.ts"),f=L("./src/remux/mp4-remuxer.ts"),v=L("./src/remux/passthrough-remuxer.ts"),P=L("./src/demux/chunk-cache.ts"),w=L("./src/utils/mp4-tools.ts"),b=L("./src/utils/logger.ts"),E;try{E=self.performance.now.bind(self.performance)}catch(T){b.logger.debug("Unable to use Performance API on this environment"),E=self.Date.now}var l=[{demux:R.default,remux:f.default},{demux:N.default,remux:v.default},{demux:B.default,remux:f.default},{demux:A.default,remux:f.default}],o=1024;l.forEach(function(T){var h=T.demux;o=Math.max(o,h.minProbeByteLength)});var s=function(){function T(c,u,a,x,y){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 P.default,this.observer=c,this.typeSupported=u,this.config=a,this.vendor=x,this.id=y}var h=T.prototype;return h.configure=function(u){this.transmuxConfig=u,this.decrypter&&this.decrypter.reset()},h.push=function(u,a,x,y){var p=this,k=x.transmuxing;k.executeStart=E();var F=new Uint8Array(u),U=this.cache,W=this.config,_=this.currentTransmuxState,M=this.transmuxConfig;y&&(this.currentTransmuxState=y);var G=d(F,a);if(G&&G.method==="AES-128"){var Y=this.getDecrypter();if(W.enableSoftwareAES){var Z=Y.softwareDecrypt(F,G.key.buffer,G.iv.buffer);if(!Z)return k.executeEnd=E(),C(x);F=new Uint8Array(Z)}else return this.decryptionPromise=Y.webCryptoDecrypt(F,G.key.buffer,G.iv.buffer).then(function(Se){var De=p.push(Se,null,x);return p.decryptionPromise=null,De}),this.decryptionPromise}var ne=y||_,be=ne.contiguous,me=ne.discontinuity,pe=ne.trackSwitch,ue=ne.accurateTimeOffset,fe=ne.timeOffset,ie=M.audioCodec,he=M.videoCodec,$=M.defaultInitPts,ae=M.duration,ee=M.initSegmentData;if((me||pe)&&this.resetInitSegment(ee,ie,he,ae),me&&this.resetInitialTimestamp($),be||this.resetContiguity(),this.needsProbing(F,me,pe)){if(U.dataLength){var Ee=U.flush();F=Object(w.appendUint8Array)(Ee,F)}this.configureTransmuxer(F,M)}var Ce=this.transmux(F,G,fe,ue,x),ve=this.currentTransmuxState;return ve.contiguous=!0,ve.discontinuity=!1,ve.trackSwitch=!1,k.executeEnd=E(),Ce},h.flush=function(u){var a=this,x=u.transmuxing;x.executeStart=E();var y=this.decrypter,p=this.cache,k=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return a.flush(u)});var U=[],W=k.timeOffset;if(y){var _=y.flush();_&&U.push(this.push(_,null,u))}var M=p.dataLength;p.reset();var G=this.demuxer,Y=this.remuxer;if(!G||!Y)return M>=o&&this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),x.executeEnd=E(),[C(u)];var Z=G.flush(W);return g(Z)?Z.then(function(ne){return a.flushRemux(U,ne,u),U}):(this.flushRemux(U,Z,u),U)},h.flushRemux=function(u,a,x){var y=a.audioTrack,p=a.avcTrack,k=a.id3Track,F=a.textTrack,U=this.currentTransmuxState,W=U.accurateTimeOffset,_=U.timeOffset;b.logger.log("[transmuxer.ts]: Flushed fragment "+x.sn+(x.part>-1?" p: "+x.part:"")+" of level "+x.level);var M=this.remuxer.remux(y,p,k,F,_,W,!0,this.id);u.push({remuxResult:M,chunkMeta:x}),x.transmuxing.executeEnd=E()},h.resetInitialTimestamp=function(u){var a=this.demuxer,x=this.remuxer;if(!a||!x)return;a.resetTimeStamp(u),x.resetTimeStamp(u)},h.resetContiguity=function(){var u=this.demuxer,a=this.remuxer;if(!u||!a)return;u.resetContiguity(),a.resetNextTimestamp()},h.resetInitSegment=function(u,a,x,y){var p=this.demuxer,k=this.remuxer;if(!p||!k)return;p.resetInitSegment(a,x,y),k.resetInitSegment(u,a,x)},h.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},h.transmux=function(u,a,x,y,p){var k;return a&&a.method==="SAMPLE-AES"?k=this.transmuxSampleAes(u,a,x,y,p):k=this.transmuxUnencrypted(u,x,y,p),k},h.transmuxUnencrypted=function(u,a,x,y){var p=this.demuxer.demux(u,a,!1,!this.config.progressive),k=p.audioTrack,F=p.avcTrack,U=p.id3Track,W=p.textTrack,_=this.remuxer.remux(k,F,U,W,a,x,!1,this.id);return{remuxResult:_,chunkMeta:y}},h.transmuxSampleAes=function(u,a,x,y,p){var k=this;return this.demuxer.demuxSampleAes(u,a,x).then(function(F){var U=k.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,x,y,!1,k.id);return{remuxResult:U,chunkMeta:p}})},h.configureTransmuxer=function(u,a){for(var x=this.config,y=this.observer,p=this.typeSupported,k=this.vendor,F=a.audioCodec,U=a.defaultInitPts,W=a.duration,_=a.initSegmentData,M=a.videoCodec,G,Y=0,Z=l.length;Y<Z;Y++)if(l[Y].demux.probe(u)){G=l[Y];break}G||(b.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),G={demux:N.default,remux:v.default});var ne=this.demuxer,be=this.remuxer,me=G.remux,pe=G.demux;(!be||!(be instanceof me))&&(this.remuxer=new me(y,x,p,k)),(!ne||!(ne instanceof pe))&&(this.demuxer=new pe(y,x,p),this.probe=pe.probe),this.resetInitSegment(_,F,M,W),this.resetInitialTimestamp(U)},h.needsProbing=function(u,a,x){return!this.demuxer||!this.remuxer||a||x},h.getDecrypter=function(){var u=this.decrypter;return u||(u=this.decrypter=new O.default(this.observer,this.config)),u},T}();function d(T,h){var c=null;return T.byteLength>0&&h!=null&&h.key!=null&&h.iv!==null&&h.method!=null&&(c=h),c}var C=function(h){return{remuxResult:{},chunkMeta:h}};function g(T){return"then"in T&&T.then instanceof Function}var m=function(h,c,u,a,x){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=h,this.videoCodec=c,this.initSegmentData=u,this.duration=a,this.defaultInitPts=x},D=function(h,c,u,a,x){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=h,this.contiguous=c,this.accurateTimeOffset=u,this.trackSwitch=a,this.timeOffset=x}},"./src/demux/tsdemuxer.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"discardEPB",function(){return C});var H=L("./src/demux/adts.ts"),I=L("./src/demux/mpegaudio.ts"),O=L("./src/demux/exp-golomb.ts"),B=L("./src/demux/id3.ts"),N=L("./src/demux/sample-aes.ts"),R=L("./src/events.ts"),A=L("./src/utils/mp4-tools.ts"),f=L("./src/utils/logger.ts"),v=L("./src/errors.ts"),P={video:1,audio:2,id3:3,text:4},w=function(){function g(D,T,h){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=D,this.config=T,this.typeSupported=h}g.probe=function(T){var h=g.syncOffset(T);return h<0?!1:(h&&f.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},g.syncOffset=function(T){for(var h=Math.min(1e3,T.length-3*188),c=0;c<h;){if(T[c]===71&&T[c+188]===71&&T[c+2*188]===71)return c;c++}return-1},g.createTrack=function(T,h){return{container:T==="video"||T==="audio"?"video/mp2t":void 0,type:T,id:P[T],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:T==="audio"?h:void 0}};var m=g.prototype;return m.resetInitSegment=function(T,h,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=g.createTrack("video",c),this._audioTrack=g.createTrack("audio",c),this._id3Track=g.createTrack("id3",c),this._txtTrack=g.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=T,this.videoCodec=h,this._duration=c},m.resetTimeStamp=function(){},m.resetContiguity=function(){var T=this._audioTrack,h=this._avcTrack,c=this._id3Track;T&&(T.pesData=null),h&&(h.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},m.demux=function(T,h,c,u){c===void 0&&(c=!1),u===void 0&&(u=!1),c||(this.sampleAes=null);var a,x=this._avcTrack,y=this._audioTrack,p=this._id3Track,k=x.pid,F=x.pesData,U=y.pid,W=p.pid,_=y.pesData,M=p.pesData,G=!1,Y=this.pmtParsed,Z=this._pmtId,ne=T.length;if(this.remainderData&&(T=Object(A.appendUint8Array)(this.remainderData,T),ne=T.length,this.remainderData=null),ne<188&&!u)return this.remainderData=T,{audioTrack:y,avcTrack:x,id3Track:p,textTrack:this._txtTrack};var be=Math.max(0,g.syncOffset(T));ne-=(ne+be)%188,ne<T.byteLength&&!u&&(this.remainderData=new Uint8Array(T.buffer,ne,T.buffer.byteLength-ne));for(var me=be;me<ne;me+=188)if(T[me]===71){var pe=!!(T[me+1]&64),ue=((T[me+1]&31)<<8)+T[me+2],fe=(T[me+3]&48)>>4,ie=void 0;if(fe>1){if(ie=me+5+T[me+4],ie===me+188)continue}else ie=me+4;switch(ue){case k:pe&&(F&&(a=o(F))&&this.parseAVCPES(a,!1),F={data:[],size:0}),F&&(F.data.push(T.subarray(ie,me+188)),F.size+=me+188-ie);break;case U:pe&&(_&&(a=o(_))&&(y.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),_={data:[],size:0}),_&&(_.data.push(T.subarray(ie,me+188)),_.size+=me+188-ie);break;case W:pe&&(M&&(a=o(M))&&this.parseID3PES(a),M={data:[],size:0}),M&&(M.data.push(T.subarray(ie,me+188)),M.size+=me+188-ie);break;case 0:pe&&(ie+=T[ie]+1),Z=this._pmtId=E(T,ie);break;case Z:{pe&&(ie+=T[ie]+1);var he=l(T,ie,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);k=he.avc,k>0&&(x.pid=k),U=he.audio,U>0&&(y.pid=U,y.isAAC=he.isAAC),W=he.id3,W>0&&(p.pid=W),G&&!Y&&(f.logger.log("reparse from beginning"),G=!1,me=be-188),Y=this.pmtParsed=!0;break}case 17:case 8191:break;default:G=!0;break}}else this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});x.pesData=F,y.pesData=_,p.pesData=M;var $={audioTrack:y,avcTrack:x,id3Track:p,textTrack:this._txtTrack};return u&&this.extractRemainingSamples($),$},m.flush=function(){var T=this.remainderData;this.remainderData=null;var h;return T?h=this.demux(T,-1,!1,!0):h={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(h),this.sampleAes?this.decrypt(h,this.sampleAes):h},m.extractRemainingSamples=function(T){var h=T.audioTrack,c=T.avcTrack,u=T.id3Track,a=c.pesData,x=h.pesData,y=u.pesData,p;a&&(p=o(a))?(this.parseAVCPES(p,!0),c.pesData=null):c.pesData=a,x&&(p=o(x))?(h.isAAC?this.parseAACPES(p):this.parseMPEGPES(p),h.pesData=null):(x!=null&&x.size&&f.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=x),y&&(p=o(y))?(this.parseID3PES(p),u.pesData=null):u.pesData=y},m.demuxSampleAes=function(T,h,c){var u=this.demux(T,c,!0,!this.config.progressive),a=this.sampleAes=new N.default(this.observer,this.config,h);return this.decrypt(u,a)},m.decrypt=function(T,h){return new Promise(function(c){var u=T.audioTrack,a=T.avcTrack;u.samples&&u.isAAC?h.decryptAacSamples(u.samples,0,function(){a.samples?h.decryptAvcSamples(a.samples,0,0,function(){c(T)}):c(T)}):a.samples&&h.decryptAvcSamples(a.samples,0,0,function(){c(T)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(T,h){var c=this,u=this._avcTrack,a=this.parseAVCNALu(T.data),x=!1,y=this.avcSample,p,k=!1;T.data=null,y&&a.length&&!u.audFound&&(s(y,u),y=this.avcSample=b(!1,T.pts,T.dts,"")),a.forEach(function(F){switch(F.type){case 1:{p=!0,y||(y=c.avcSample=b(!0,T.pts,T.dts,"")),x&&(y.debug+="NDR "),y.frame=!0;var U=F.data;if(k&&U.length>4){var W=new O.default(U).readSliceType();(W===2||W===4||W===7||W===9)&&(y.key=!0)}break}case 5:p=!0,y||(y=c.avcSample=b(!0,T.pts,T.dts,"")),x&&(y.debug+="IDR "),y.key=!0,y.frame=!0;break;case 6:{p=!0,x&&y&&(y.debug+="SEI ");var _=new O.default(C(F.data));_.readUByte();for(var M=0,G=0,Y=!1,Z=0;!Y&&_.bytesAvailable>1;){M=0;do Z=_.readUByte(),M+=Z;while(Z===255);G=0;do Z=_.readUByte(),G+=Z;while(Z===255);if(M===4&&_.bytesAvailable!==0){Y=!0;var ne=_.readUByte();if(ne===181){var be=_.readUShort();if(be===49){var me=_.readUInt();if(me===1195456820){var pe=_.readUByte();if(pe===3){for(var ue=_.readUByte(),fe=_.readUByte(),ie=31&ue,he=[ue,fe],$=0;$<ie;$++)he.push(_.readUByte()),he.push(_.readUByte()),he.push(_.readUByte());d(c._txtTrack.samples,{type:3,pts:T.pts,bytes:he})}}}}}else if(M===5&&_.bytesAvailable!==0){if(Y=!0,G>16){for(var ae=[],ee=0;ee<16;ee++)ae.push(_.readUByte().toString(16)),(ee===3||ee===5||ee===7||ee===9)&&ae.push("-");for(var Ee=G-16,Ce=new Uint8Array(Ee),ve=0;ve<Ee;ve++)Ce[ve]=_.readUByte();d(c._txtTrack.samples,{pts:T.pts,payloadType:M,uuid:ae.join(""),userData:Object(B.utf8ArrayToStr)(Ce),userDataBytes:Ce})}}else if(G<_.bytesAvailable)for(var Se=0;Se<G;Se++)_.readUByte()}break}case 7:if(p=!0,k=!0,x&&y&&(y.debug+="SPS "),!u.sps){var De=new O.default(F.data),_e=De.readSPS();u.width=_e.width,u.height=_e.height,u.pixelRatio=_e.pixelRatio,u.sps=[F.data],u.duration=c._duration;for(var ke=F.data.subarray(1,4),Re="avc1.",Ae=0;Ae<3;Ae++){var Ue=ke[Ae].toString(16);Ue.length<2&&(Ue="0"+Ue),Re+=Ue}u.codec=Re}break;case 8:p=!0,x&&y&&(y.debug+="PPS "),u.pps||(u.pps=[F.data]);break;case 9:p=!1,u.audFound=!0,y&&s(y,u),y=c.avcSample=b(!1,T.pts,T.dts,x?"AUD ":"");break;case 12:p=!1;break;default:p=!1,y&&(y.debug+="unknown NAL "+F.type+" ");break}if(y&&p){var Ye=y.units;Ye.push(F)}}),h&&y&&(s(y,u),this.avcSample=null)},m.getLastNalUnit=function(){var T,h=this.avcSample,c;if(!h||h.units.length===0){var u=this._avcTrack.samples;h=u[u.length-1]}if((T=h)!==null&&T!==void 0&&T.units){var a=h.units;c=a[a.length-1]}return c},m.parseAVCNALu=function(T){var h=T.byteLength,c=this._avcTrack,u=c.naluState||0,a=u,x=[],y=0,p,k,F,U=-1,W=0;for(u===-1&&(U=0,W=T[0]&31,u=0,y=1);y<h;){if(p=T[y++],!u){u=p?0:1;continue}if(u===1){u=p?0:2;continue}if(!p)u=3;else if(p===1){if(U>=0){var _={data:T.subarray(U,y-u-1),type:W};x.push(_)}else{var M=this.getLastNalUnit();if(M&&(a&&y<=4-a&&(M.state&&(M.data=M.data.subarray(0,M.data.byteLength-a))),k=y-u-1,k>0)){var G=new Uint8Array(M.data.byteLength+k);G.set(M.data,0),G.set(T.subarray(0,k),M.data.byteLength),M.data=G,M.state=0}}y<h?(F=T[y]&31,U=y,W=F,u=0):u=-1}else u=0}if(U>=0&&u>=0){var Y={data:T.subarray(U,h),type:W,state:u};x.push(Y)}if(x.length===0){var Z=this.getLastNalUnit();if(Z){var ne=new Uint8Array(Z.data.byteLength+T.byteLength);ne.set(Z.data,0),ne.set(T,Z.data.byteLength),Z.data=ne}}return c.naluState=u,x},m.parseAACPES=function(T){var h=0,c=this._audioTrack,u=this.aacOverFlow,a=T.data;if(u){this.aacOverFlow=null;var x=u.sample.unit.byteLength,y=Math.min(u.missing,x),p=x-y;u.sample.unit.set(a.subarray(0,y),p),c.samples.push(u.sample),h=u.missing}var k,F;for(k=h,F=a.length;k<F-1&&!H.isHeader(a,k);k++);if(k!==h){var U,W;if(k<F-1?(U="AAC PES did not start with ADTS header,offset:"+k,W=!1):(U="no ADTS header found in AAC PES",W=!0),f.logger.warn("parsing error:"+U),this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:U}),W)return}H.initTrackConfig(c,this.observer,a,k,this.audioCodec);var _;if(T.pts!==void 0)_=T.pts;else if(u){var M=H.getFrameDuration(c.samplerate);_=u.sample.pts+M}else{f.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var G=0;k<F;)if(H.isHeader(a,k)){if(k+5<F){var Y=H.appendFrame(c,a,k,_,G);if(Y)if(Y.missing)this.aacOverFlow=Y;else{k+=Y.length,G++;continue}}break}else k++},m.parseMPEGPES=function(T){var h=T.data,c=h.length,u=0,a=0,x=T.pts;if(x===void 0){f.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(I.isHeader(h,a)){var y=I.appendFrame(this._audioTrack,h,a,x,u);if(y)a+=y.length,u++;else break}else a++},m.parseID3PES=function(T){if(T.pts===void 0){f.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(T)},g}();w.minProbeByteLength=188;function b(g,m,D,T){return{key:g,frame:!1,pts:m,dts:D,units:[],debug:T,length:0}}function E(g,m){return(g[m+10]&31)<<8|g[m+11]}function l(g,m,D,T){var h={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(g[m+1]&15)<<8|g[m+2],u=m+3+c-4,a=(g[m+10]&15)<<8|g[m+11];for(m+=12+a;m<u;){var x=(g[m+1]&31)<<8|g[m+2];switch(g[m]){case 207:if(!T){f.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:h.audio===-1&&(h.audio=x);break;case 21:h.id3===-1&&(h.id3=x);break;case 219:if(!T){f.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:h.avc===-1&&(h.avc=x);break;case 3:case 4:D?h.audio===-1&&(h.audio=x,h.isAAC=!1):f.logger.log("MPEG audio found, not supported in this browser");break;case 36:f.logger.warn("Unsupported HEVC stream type found");break;default:break}m+=((g[m+3]&15)<<8|g[m+4])+5}return h}function o(g){var m=0,D,T,h,c,u,a=g.data;if(!g||g.size===0)return null;for(;a[0].length<19&&a.length>1;){var x=new Uint8Array(a[0].length+a[1].length);x.set(a[0]),x.set(a[1],a[0].length),a[0]=x,a.splice(1,1)}D=a[0];var y=(D[0]<<16)+(D[1]<<8)+D[2];if(y===1){if(T=(D[4]<<8)+D[5],T&&T>g.size-6)return null;var p=D[7];p&192&&(c=(D[9]&14)*536870912+(D[10]&255)*4194304+(D[11]&254)*16384+(D[12]&255)*128+(D[13]&254)/2,p&64?(u=(D[14]&14)*536870912+(D[15]&255)*4194304+(D[16]&254)*16384+(D[17]&255)*128+(D[18]&254)/2,c-u>60*9e4&&(f.logger.warn(Math.round((c-u)/9e4)+"s delta between PTS and DTS, align them"),c=u)):u=c),h=D[8];var k=h+9;if(g.size<=k)return null;g.size-=k;for(var F=new Uint8Array(g.size),U=0,W=a.length;U<W;U++){D=a[U];var _=D.byteLength;if(k)if(k>_){k-=_;continue}else D=D.subarray(k),_-=k,k=0;F.set(D,m),m+=_}return T&&(T-=h+3),{data:F,pts:c,dts:u,len:T}}return null}function s(g,m){if(g.units.length&&g.frame){if(g.pts===void 0){var D=m.samples,T=D.length;if(T){var h=D[T-1];g.pts=h.pts,g.dts=h.dts}else{m.dropped++;return}}m.samples.push(g)}g.debug.length&&f.logger.log(g.pts+"/"+g.dts+":"+g.debug)}function d(g,m){var D=g.length;if(D>0){if(m.pts>=g[D-1].pts)g.push(m);else for(var T=D-1;T>=0;T--)if(m.pts<g[T].pts){g.splice(T,0,m);break}}else g.push(m)}function C(g){for(var m=g.byteLength,D=[],T=1;T<m-2;)g[T]===0&&g[T+1]===0&&g[T+2]===3?(D.push(T+2),T+=2):T++;if(D.length===0)return g;var h=m-D.length,c=new Uint8Array(h),u=0;for(T=0;T<h;u++,T++)u===D[0]&&(u++,D.shift()),c[T]=g[u];return c}K.default=w},"./src/errors.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"ErrorTypes",function(){return H}),L.d(K,"ErrorDetails",function(){return I});var H;(function(O){O.NETWORK_ERROR="networkError",O.MEDIA_ERROR="mediaError",O.KEY_SYSTEM_ERROR="keySystemError",O.MUX_ERROR="muxError",O.OTHER_ERROR="otherError"})(H||(H={}));var I;(function(O){O.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",O.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",O.KEY_SYSTEM_NO_SESSION="keySystemNoSession",O.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",O.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",O.MANIFEST_LOAD_ERROR="manifestLoadError",O.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",O.MANIFEST_PARSING_ERROR="manifestParsingError",O.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",O.LEVEL_EMPTY_ERROR="levelEmptyError",O.LEVEL_LOAD_ERROR="levelLoadError",O.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",O.LEVEL_SWITCH_ERROR="levelSwitchError",O.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",O.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",O.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",O.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",O.FRAG_LOAD_ERROR="fragLoadError",O.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",O.FRAG_DECRYPT_ERROR="fragDecryptError",O.FRAG_PARSING_ERROR="fragParsingError",O.REMUX_ALLOC_ERROR="remuxAllocError",O.KEY_LOAD_ERROR="keyLoadError",O.KEY_LOAD_TIMEOUT="keyLoadTimeOut",O.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",O.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",O.BUFFER_APPEND_ERROR="bufferAppendError",O.BUFFER_APPENDING_ERROR="bufferAppendingError",O.BUFFER_STALLED_ERROR="bufferStalledError",O.BUFFER_FULL_ERROR="bufferFullError",O.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",O.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",O.INTERNAL_EXCEPTION="internalException",O.INTERNAL_ABORTED="aborted",O.UNKNOWN="unknown"})(I||(I={}))},"./src/events.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"Events",function(){return H});var H;(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"})(H||(H={}))},"./src/hls.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return g});var H=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(H),O=L("./src/loader/playlist-loader.ts"),B=L("./src/loader/key-loader.ts"),N=L("./src/controller/id3-track-controller.ts"),R=L("./src/controller/latency-controller.ts"),A=L("./src/controller/level-controller.ts"),f=L("./src/controller/fragment-tracker.ts"),v=L("./src/controller/stream-controller.ts"),P=L("./src/is-supported.ts"),w=L("./src/utils/logger.ts"),b=L("./src/config.ts"),E=L("./node_modules/eventemitter3/index.js"),l=L.n(E),o=L("./src/events.ts"),s=L("./src/errors.ts");function d(m,D){for(var T=0;T<D.length;T++){var h=D[T];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(m,h.key,h)}}function C(m,D,T){return D&&d(m.prototype,D),T&&d(m,T),m}var g=function(){m.isSupported=function(){return Object(P.isSupported)()};function m(T){T===void 0&&(T={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new E.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var h=this.config=Object(b.mergeConfig)(m.DefaultConfig,T);this.userConfig=T,Object(w.enableLogs)(h.debug),this._autoLevelCapping=-1,h.progressive&&Object(b.enableStreamingMode)(h);var c=h.abrController,u=h.bufferController,a=h.capLevelController,x=h.fpsController,y=this.abrController=new c(this),p=this.bufferController=new u(this),k=this.capLevelController=new a(this),F=new x(this),U=new O.default(this),W=new B.default(this),_=new N.default(this),M=this.levelController=new A.default(this),G=new f.FragmentTracker(this),Y=this.streamController=new v.default(this,G);k.setStreamController(Y),F.setStreamController(Y);var Z=[M,Y];this.networkControllers=Z;var ne=[U,W,y,p,k,F,_,G];this.audioTrackController=this.createController(h.audioTrackController,null,Z),this.createController(h.audioStreamController,G,Z),this.subtitleTrackController=this.createController(h.subtitleTrackController,null,Z),this.createController(h.subtitleStreamController,G,Z),this.createController(h.timelineController,null,ne),this.emeController=this.createController(h.emeController,null,ne),this.cmcdController=this.createController(h.cmcdController,null,ne),this.latencyController=this.createController(R.default,null,ne),this.coreComponents=ne}var D=m.prototype;return D.createController=function(h,c,u){if(h){var a=c?new h(this,c):new h(this);return u&&u.push(a),a}return null},D.on=function(h,c,u){u===void 0&&(u=this),this._emitter.on(h,c,u)},D.once=function(h,c,u){u===void 0&&(u=this),this._emitter.once(h,c,u)},D.removeAllListeners=function(h){this._emitter.removeAllListeners(h)},D.off=function(h,c,u,a){u===void 0&&(u=this),this._emitter.off(h,c,u,a)},D.listeners=function(h){return this._emitter.listeners(h)},D.emit=function(h,c,u){return this._emitter.emit(h,c,u)},D.trigger=function(h,c){if(this.config.debug)return this.emit(h,h,c);try{return this.emit(h,h,c)}catch(u){w.logger.error("An internal error happened while handling event "+h+'. Error message: "'+u.message+'". Here is a stacktrace:',u),this.trigger(o.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:h,error:u})}return!1},D.listenerCount=function(h){return this._emitter.listenerCount(h)},D.destroy=function(){w.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(h){return h.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(h){return h.destroy()}),this.coreComponents.length=0},D.attachMedia=function(h){w.logger.log("attachMedia"),this._media=h,this.trigger(o.Events.MEDIA_ATTACHING,{media:h})},D.detachMedia=function(){w.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},D.loadSource=function(h){this.stopLoad();var c=this.media,u=this.url,a=this.url=H.buildAbsoluteURL(self.location.href,h,{alwaysNormalize:!0});w.logger.log("loadSource:"+a),c&&u&&u!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:h})},D.startLoad=function(h){h===void 0&&(h=-1),w.logger.log("startLoad("+h+")"),this.networkControllers.forEach(function(c){c.startLoad(h)})},D.stopLoad=function(){w.logger.log("stopLoad"),this.networkControllers.forEach(function(h){h.stopLoad()})},D.swapAudioCodec=function(){w.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},D.recoverMediaError=function(){w.logger.log("recoverMediaError");var h=this._media;this.detachMedia(),h&&this.attachMedia(h)},D.removeLevel=function(h,c){c===void 0&&(c=0),this.levelController.removeLevel(h,c)},C(m,[{key:"levels",get:function(){var h=this.levelController.levels;return h||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(h){w.logger.log("set currentLevel:"+h),this.loadLevel=h,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(h){w.logger.log("set nextLevel:"+h),this.levelController.manualLevel=h,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(h){w.logger.log("set loadLevel:"+h),this.levelController.manualLevel=h}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(h){this.levelController.nextLoadLevel=h}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(h){w.logger.log("set firstLevel:"+h),this.levelController.firstLevel=h}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(h){w.logger.log("set startLevel:"+h),h!==-1&&(h=Math.max(h,this.minAutoLevel)),this.levelController.startLevel=h}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(h){var c=!!h;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(h){this._autoLevelCapping!==h&&(w.logger.log("set autoLevelCapping:"+h),this._autoLevelCapping=h)}},{key:"bandwidthEstimate",get:function(){var h=this.abrController.bwEstimator;return h?h.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var h=this.levels,c=this.config.minAutoBitrate;if(!h)return 0;for(var u=h.length,a=0;a<u;a++)if(h[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var h=this.levels,c=this.autoLevelCapping,u;return c===-1&&h&&h.length?u=h.length-1:u=c,u}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(h){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,h)}},{key:"audioTracks",get:function(){var h=this.audioTrackController;return h?h.audioTracks:[]}},{key:"audioTrack",get:function(){var h=this.audioTrackController;return h?h.audioTrack:-1},set:function(h){var c=this.audioTrackController;c&&(c.audioTrack=h)}},{key:"subtitleTracks",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTrack:-1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleTrack=h)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var h=this.subtitleTrackController;return h?h.subtitleDisplay:!1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=h)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(h){this.config.lowLatencyMode=h}},{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 m.defaultConfig?m.defaultConfig:b.hlsDefaultConfig},set:function(h){m.defaultConfig=h}}]),m}();g.defaultConfig=void 0},"./src/is-supported.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"isSupported",function(){return O}),L.d(K,"changeTypeSupported",function(){return B});var H=L("./src/utils/mediasource-helper.ts");function I(){return self.SourceBuffer||self.WebKitSourceBuffer}function O(){var N=Object(H.getMediaSource)();if(!N)return!1;var R=I(),A=N&&typeof N.isTypeSupported=="function"&&N.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),f=!R||R.prototype&&typeof R.prototype.appendBuffer=="function"&&typeof R.prototype.remove=="function";return!!A&&!!f}function B(){var N,R=I();return typeof(R==null||((N=R.prototype)===null||N===void 0)?void 0:N.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return w}),L.d(K,"LoadError",function(){return E});var H=L("./src/polyfills/number.ts"),I=L("./src/errors.ts");function O(l,o){l.prototype=Object.create(o.prototype),l.prototype.constructor=l,f(l,o)}function B(l){var o=typeof Map=="function"?new Map:void 0;return B=function(d){if(d===null||!A(d))return d;if(typeof d!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(d))return o.get(d);o.set(d,C)}function C(){return N(d,arguments,v(this).constructor)}return C.prototype=Object.create(d.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),f(C,d)},B(l)}function N(l,o,s){return R()?N=Reflect.construct:N=function(C,g,m){var D=[null];D.push.apply(D,g);var T=Function.bind.apply(C,D),h=new T;return m&&f(h,m.prototype),h},N.apply(null,arguments)}function R(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function A(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function f(l,o){return f=Object.setPrototypeOf||function(d,C){return d.__proto__=C,d},f(l,o)}function v(l){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},v(l)}var P=Math.pow(2,17),w=function(){function l(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var o=l.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,C){var g=this,m=d.url;if(!m)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 "+(m?"part list":"url")));this.abort();var D=this.config,T=D.fLoader,h=D.loader;return new Promise(function(c,u){g.loader&&g.loader.destroy();var a=g.loader=d.loader=T?new T(D):new h(D),x=b(d),y={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:P};d.stats=a.stats,a.load(x,y,{onSuccess:function(k,F,U,W){g.resetLoader(d,a),c({frag:d,part:null,payload:k.data,networkDetails:W})},onError:function(k,F,U){g.resetLoader(d,a),u(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,response:k,networkDetails:U}))},onAbort:function(k,F,U){g.resetLoader(d,a),u(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,networkDetails:U}))},onTimeout:function(k,F,U){g.resetLoader(d,a),u(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,networkDetails:U}))},onProgress:function(k,F,U,W){C&&C({frag:d,part:null,payload:U,networkDetails:W})}})})},o.loadPart=function(d,C,g){var m=this;this.abort();var D=this.config,T=D.fLoader,h=D.loader;return new Promise(function(c,u){m.loader&&m.loader.destroy();var a=m.loader=d.loader=T?new T(D):new h(D),x=b(d,C),y={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:P};C.stats=a.stats,a.load(x,y,{onSuccess:function(k,F,U,W){m.resetLoader(d,a),m.updateStatsFromPart(d,C);var _={frag:d,part:C,payload:k.data,networkDetails:W};g(_),c(_)},onError:function(k,F,U){m.resetLoader(d,a),u(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,part:C,response:k,networkDetails:U}))},onAbort:function(k,F,U){d.stats.aborted=C.stats.aborted,m.resetLoader(d,a),u(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,part:C,networkDetails:U}))},onTimeout:function(k,F,U){m.resetLoader(d,a),u(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,part:C,networkDetails:U}))}})})},o.updateStatsFromPart=function(d,C){var g=d.stats,m=C.stats,D=m.total;if(g.loaded+=m.loaded,D){var T=Math.round(d.duration/C.duration),h=Math.min(Math.round(g.loaded/D),T),c=T-h,u=c*Math.round(g.loaded/h);g.total=g.loaded+u}else g.total=Math.max(g.loaded,g.total);var a=g.loading,x=m.loading;a.start?a.first+=x.first-x.start:(a.start=x.start,a.first=x.first),a.end=x.end},o.resetLoader=function(d,C){d.loader=null,this.loader===C&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),C.destroy()},l}();function b(l,o){o===void 0&&(o=null);var s=o||l,d={frag:l,part:o,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},C=s.byteRangeStartOffset,g=s.byteRangeEndOffset;return Object(H.isFiniteNumber)(C)&&Object(H.isFiniteNumber)(g)&&(d.rangeStart=C,d.rangeEnd=g),d}var E=function(l){O(o,l);function o(s){for(var d,C=arguments.length,g=new Array(C>1?C-1:0),m=1;m<C;m++)g[m-1]=arguments[m];return d=l.call.apply(l,[this].concat(g))||this,d.data=void 0,d.data=s,d}return o}(B(Error))},"./src/loader/fragment.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"ElementaryStreamTypes",function(){return w}),L.d(K,"BaseSegment",function(){return b}),L.d(K,"Fragment",function(){return E}),L.d(K,"Part",function(){return l});var H=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),O=L.n(I),B=L("./src/utils/logger.ts"),N=L("./src/loader/level-key.ts"),R=L("./src/loader/load-stats.ts");function A(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,f(o,s)}function f(o,s){return f=Object.setPrototypeOf||function(C,g){return C.__proto__=g,C},f(o,s)}function v(o,s){for(var d=0;d<s.length;d++){var C=s[d];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(o,C.key,C)}}function P(o,s,d){return s&&v(o.prototype,s),d&&v(o,d),o}var w;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(w||(w={}));var b=function(){function o(d){var C;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(C={},C[w.AUDIO]=null,C[w.VIDEO]=null,C[w.AUDIOVIDEO]=null,C),this.baseurl=d}var s=o.prototype;return s.setByteRange=function(C,g){var m=C.split("@",2),D=[];m.length===1?D[0]=g?g.byteRangeEndOffset:0:D[0]=parseInt(m[1]),D[1]=parseInt(m[0])+D[0],this._byteRange=D},P(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(C){this._url=C}}]),o}(),E=function(o){A(s,o);function s(C,g){var m;return m=o.call(this,g)||this,m._decryptdata=null,m.rawProgramDateTime=null,m.programDateTime=null,m.tagList=[],m.duration=0,m.sn=0,m.levelkey=void 0,m.type=void 0,m.loader=null,m.level=-1,m.cc=0,m.startPTS=void 0,m.endPTS=void 0,m.appendedPTS=void 0,m.startDTS=void 0,m.endDTS=void 0,m.start=0,m.deltaPTS=void 0,m.maxStartPTS=void 0,m.minEndPTS=void 0,m.stats=new R.LoadStats,m.urlId=0,m.data=void 0,m.bitrateTest=!1,m.title=null,m.initSegment=null,m.type=C,m}var d=s.prototype;return d.createInitializationVector=function(g){for(var m=new Uint8Array(16),D=12;D<16;D++)m[D]=g>>8*(15-D)&255;return m},d.setDecryptDataFromLevelKey=function(g,m){var D=g;return(g==null?void 0:g.method)==="AES-128"&&g.uri&&!g.iv&&(D=N.LevelKey.fromURI(g.uri),D.method=g.method,D.iv=this.createInitializationVector(m),D.keyFormat="identity"),D},d.setElementaryStreamInfo=function(g,m,D,T,h,c){c===void 0&&(c=!1);var u=this.elementaryStreams,a=u[g];if(!a){u[g]={startPTS:m,endPTS:D,startDTS:T,endDTS:h,partial:c};return}a.startPTS=Math.min(a.startPTS,m),a.endPTS=Math.max(a.endPTS,D),a.startDTS=Math.min(a.startDTS,T),a.endDTS=Math.max(a.endDTS,h)},d.clearElementaryStreamInfo=function(){var g=this.elementaryStreams;g[w.AUDIO]=null,g[w.VIDEO]=null,g[w.AUDIOVIDEO]=null},P(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var g=this.sn;typeof g!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&B.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),g=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,g)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(H.isFiniteNumber)(this.programDateTime))return null;var g=Object(H.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+g*1e3}},{key:"encrypted",get:function(){var g;return!!((g=this.decryptdata)!==null&&g!==void 0&&g.keyFormat&&this.decryptdata.uri)}}]),s}(b),l=function(o){A(s,o);function s(d,C,g,m,D){var T;T=o.call(this,g)||this,T.fragOffset=0,T.duration=0,T.gap=!1,T.independent=!1,T.relurl=void 0,T.fragment=void 0,T.index=void 0,T.stats=new R.LoadStats,T.duration=d.decimalFloatingPoint("DURATION"),T.gap=d.bool("GAP"),T.independent=d.bool("INDEPENDENT"),T.relurl=d.enumeratedString("URI"),T.fragment=C,T.index=m;var h=d.enumeratedString("BYTERANGE");return h&&T.setByteRange(h,D),D&&(T.fragOffset=D.fragOffset+D.duration),T}return P(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 C=this.elementaryStreams;return!!(C.audio||C.video||C.audiovideo)}}]),s}(b)},"./src/loader/key-loader.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return B});var H=L("./src/events.ts"),I=L("./src/errors.ts"),O=L("./src/utils/logger.ts"),B=function(){function N(A){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=A,this._registerListeners()}var R=N.prototype;return R._registerListeners=function(){this.hls.on(H.Events.KEY_LOADING,this.onKeyLoading,this)},R._unregisterListeners=function(){this.hls.off(H.Events.KEY_LOADING,this.onKeyLoading)},R.destroy=function(){this._unregisterListeners();for(var f in this.loaders){var v=this.loaders[f];v&&v.destroy()}this.loaders={}},R.onKeyLoading=function(f,v){var P=v.frag,w=P.type,b=this.loaders[w];if(!P.decryptdata){O.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var E=P.decryptdata.uri;if(E!==this.decrypturl||this.decryptkey===null){var l=this.hls.config;if(b&&(O.logger.warn("abort previous key loader for type:"+w),b.abort()),!E){O.logger.warn("key uri is falsy");return}var o=l.loader,s=P.loader=this.loaders[w]=new o(l);this.decrypturl=E,this.decryptkey=null;var d={url:E,frag:P,responseType:"arraybuffer"},C={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(d,C,g)}else this.decryptkey&&(P.decryptdata.key=this.decryptkey,this.hls.trigger(H.Events.KEY_LOADED,{frag:P}))},R.loadsuccess=function(f,v,P){var w=P.frag;if(!w.decryptdata){O.logger.error("after key load, decryptdata unset");return}this.decryptkey=w.decryptdata.key=new Uint8Array(f.data),w.loader=null,delete this.loaders[w.type],this.hls.trigger(H.Events.KEY_LOADED,{frag:w})},R.loaderror=function(f,v){var P=v.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:P,response:f})},R.loadtimeout=function(f,v){var P=v.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:P})},N}()},"./src/loader/level-details.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"LevelDetails",function(){return N});var H=L("./src/polyfills/number.ts");function I(R,A){for(var f=0;f<A.length;f++){var v=A[f];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(R,v.key,v)}}function O(R,A,f){return A&&I(R.prototype,A),f&&I(R,f),R}var B=10,N=function(){function R(f){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=f}var A=R.prototype;return A.reloaded=function(v){if(!v){this.advanced=!0,this.updated=!0;return}var P=this.lastPartSn-v.lastPartSn,w=this.lastPartIndex-v.lastPartIndex;this.updated=this.endSN!==v.endSN||!!w||!!P,this.advanced=this.endSN>v.endSN||P>0||P===0&&w>0,this.updated||this.advanced?this.misses=Math.floor(v.misses*.6):this.misses=v.misses+1,this.availabilityDelay=v.availabilityDelay},O(R,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(H.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var v=this.driftEndTime-this.driftStartTime;if(v>0){var P=this.driftEnd-this.driftStart;return P*1e3/v}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var v;return(v=this.partList)!==null&&v!==void 0&&v.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var v;return(v=this.fragments)!==null&&v!==void 0&&v.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 v;return(v=this.partList)!==null&&v!==void 0&&v.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var v;return(v=this.partList)!==null&&v!==void 0&&v.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),R}()},"./src/loader/level-key.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"LevelKey",function(){return N});var H=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(H);function O(R,A){for(var f=0;f<A.length;f++){var v=A[f];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(R,v.key,v)}}function B(R,A,f){return A&&O(R.prototype,A),f&&O(R,f),R}var N=function(){R.fromURL=function(f,v){return new R(f,v)},R.fromURI=function(f){return new R(f)};function R(A,f){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,f?this._uri=Object(H.buildAbsoluteURL)(A,f,{alwaysNormalize:!0}):this._uri=A}return B(R,[{key:"uri",get:function(){return this._uri}}]),R}()},"./src/loader/load-stats.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"LoadStats",function(){return H});var H=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(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return s});var H=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),O=L.n(I),B=L("./src/loader/fragment.ts"),N=L("./src/loader/level-details.ts"),R=L("./src/loader/level-key.ts"),A=L("./src/utils/attr-list.ts"),f=L("./src/utils/logger.ts"),v=L("./src/utils/codecs.ts"),P=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,w=/#EXT-X-MEDIA:(.*)/g,b=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("|")),l=/\.(mp4|m4s|m4v|m4a)$/i;function o(D){var T,h;return l.test((T=(h=I.parseURL(D))===null||h===void 0?void 0:h.path)!=null?T:"")}var s=function(){function D(){}return D.findGroup=function(h,c){for(var u=0;u<h.length;u++){var a=h[u];if(a.id===c)return a}},D.convertAVC1ToAVCOTI=function(h){var c=h.split(".");if(c.length>2){var u=c.shift()+".";return u+=parseInt(c.shift()).toString(16),u+=("000"+parseInt(c.shift()).toString(16)).substr(-4),u}return h},D.resolve=function(h,c){return I.buildAbsoluteURL(c,h,{alwaysNormalize:!0})},D.parseMasterPlaylist=function(h,c){var u=[],a={},x=!1;P.lastIndex=0;for(var y;(y=P.exec(h))!=null;)if(y[1]){var p=new A.AttrList(y[1]),k={attrs:p,bitrate:p.decimalInteger("AVERAGE-BANDWIDTH")||p.decimalInteger("BANDWIDTH"),name:p.NAME,url:D.resolve(y[2],c)},F=p.decimalResolution("RESOLUTION");F&&(k.width=F.width,k.height=F.height),d((p.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),k),k.videoCodec&&k.videoCodec.indexOf("avc1")!==-1&&(k.videoCodec=D.convertAVC1ToAVCOTI(k.videoCodec)),u.push(k)}else if(y[3]){var U=new A.AttrList(y[3]);U["DATA-ID"]&&(x=!0,a[U["DATA-ID"]]=U)}return{levels:u,sessionData:x?a:null}},D.parseMasterPlaylistMedia=function(h,c,u,a){a===void 0&&(a=[]);var x,y=[],p=0;for(w.lastIndex=0;(x=w.exec(h))!==null;){var k=new A.AttrList(x[1]);if(k.TYPE===u){var F={attrs:k,bitrate:0,id:p++,groupId:k["GROUP-ID"],instreamId:k["INSTREAM-ID"],name:k.NAME||k.LANGUAGE||"",type:u,default:k.bool("DEFAULT"),autoselect:k.bool("AUTOSELECT"),forced:k.bool("FORCED"),lang:k.LANGUAGE,url:k.URI?D.resolve(k.URI,c):""};if(a.length){var U=D.findGroup(a,F.groupId)||a[0];C(F,U,"audioCodec"),C(F,U,"textCodec")}y.push(F)}}return y},D.parseLevelPlaylist=function(h,c,u,a,x){var y=new N.LevelDetails(c),p=y.fragments,k=null,F=0,U=0,W=0,_=0,M=null,G=new B.Fragment(a,c),Y,Z,ne,be=-1,me=!1;for(b.lastIndex=0,y.m3u8=h;(Y=b.exec(h))!==null;){me&&(me=!1,G=new B.Fragment(a,c),G.start=W,G.sn=F,G.cc=_,G.level=u,k&&(G.initSegment=k,G.rawProgramDateTime=k.rawProgramDateTime));var pe=Y[1];if(pe){G.duration=parseFloat(pe);var ue=(" "+Y[2]).slice(1);G.title=ue||null,G.tagList.push(ue?["INF",pe,ue]:["INF",pe])}else if(Y[3])Object(H.isFiniteNumber)(G.duration)&&(G.start=W,ne&&(G.levelkey=ne),G.sn=F,G.level=u,G.cc=_,G.urlId=x,p.push(G),G.relurl=(" "+Y[3]).slice(1),m(G,M),M=G,W+=G.duration,F++,U=0,me=!0);else if(Y[4]){var fe=(" "+Y[4]).slice(1);M?G.setByteRange(fe,M):G.setByteRange(fe)}else if(Y[5])G.rawProgramDateTime=(" "+Y[5]).slice(1),G.tagList.push(["PROGRAM-DATE-TIME",G.rawProgramDateTime]),be===-1&&(be=p.length);else{if(Y=Y[0].match(E),!Y){f.logger.warn("No matches on slow regex match for level playlist!");continue}for(Z=1;Z<Y.length&&!(typeof Y[Z]!="undefined");Z++);var ie=(" "+Y[Z]).slice(1),he=(" "+Y[Z+1]).slice(1),$=Y[Z+2]?(" "+Y[Z+2]).slice(1):"";switch(ie){case"PLAYLIST-TYPE":y.type=he.toUpperCase();break;case"MEDIA-SEQUENCE":F=y.startSN=parseInt(he);break;case"SKIP":{var ae=new A.AttrList(he),ee=ae.decimalInteger("SKIPPED-SEGMENTS");if(Object(H.isFiniteNumber)(ee)){y.skippedSegments=ee;for(var Ee=ee;Ee--;)p.unshift(null);F+=ee}var Ce=ae.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ce&&(y.recentlyRemovedDateranges=Ce.split(" "));break}case"TARGETDURATION":y.targetduration=parseFloat(he);break;case"VERSION":y.version=parseInt(he);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(he||$)&&G.tagList.push($?[he,$]:[he]);break;case"DIS":_++;case"GAP":G.tagList.push([ie]);break;case"BITRATE":G.tagList.push([ie,he]);break;case"DISCONTINUITY-SEQ":_=parseInt(he);break;case"KEY":{var ve,Se=new A.AttrList(he),De=Se.enumeratedString("METHOD"),_e=Se.URI,ke=Se.hexadecimalInteger("IV"),Re=Se.enumeratedString("KEYFORMATVERSIONS"),Ae=Se.enumeratedString("KEYID"),Ue=(ve=Se.enumeratedString("KEYFORMAT"))!=null?ve:"identity",Ye=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ye.indexOf(Ue)>-1){f.logger.warn("Keyformat "+Ue+" is not supported from the manifest");continue}else if(Ue!=="identity")continue;De&&(ne=R.LevelKey.fromURL(c,_e),_e&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(De)>=0&&(ne.method=De,ne.keyFormat=Ue,Ae&&(ne.keyID=Ae),Re&&(ne.keyFormatVersions=Re),ne.iv=ke));break}case"START":{var Ge=new A.AttrList(he),He=Ge.decimalFloatingPoint("TIME-OFFSET");Object(H.isFiniteNumber)(He)&&(y.startTimeOffset=He);break}case"MAP":{var et=new A.AttrList(he);G.relurl=et.URI,et.BYTERANGE&&G.setByteRange(et.BYTERANGE),G.level=u,G.sn="initSegment",ne&&(G.levelkey=ne),G.initSegment=null,k=G,me=!0;break}case"SERVER-CONTROL":{var Je=new A.AttrList(he);y.canBlockReload=Je.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=Je.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&Je.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=Je.optionalFloat("PART-HOLD-BACK",0),y.holdBack=Je.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Xe=new A.AttrList(he);y.partTarget=Xe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var we=y.partList;we||(we=y.partList=[]);var rt=U>0?we[we.length-1]:void 0,$e=U++,Le=new B.Part(new A.AttrList(he),G,c,$e,rt);we.push(Le),G.duration+=Le.duration;break}case"PRELOAD-HINT":{var Fe=new A.AttrList(he);y.preloadHint=Fe;break}case"RENDITION-REPORT":{var ge=new A.AttrList(he);y.renditionReports=y.renditionReports||[],y.renditionReports.push(ge);break}default:f.logger.warn("line parsed but not handled: "+Y);break}}}M&&!M.relurl?(p.pop(),W-=M.duration,y.partList&&(y.fragmentHint=M)):y.partList&&(m(G,M),G.cc=_,y.fragmentHint=G);var de=p.length,ce=p[0],Q=p[de-1];if(W+=y.skippedSegments*y.targetduration,W>0&&de&&Q){y.averagetargetduration=W/de;var q=Q.sn;y.endSN=q!=="initSegment"?q:0,ce&&(y.startCC=ce.cc,ce.initSegment||y.fragments.every(function(re){return re.relurl&&o(re.relurl)})&&(f.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),G=new B.Fragment(a,c),G.relurl=Q.relurl,G.level=u,G.sn="initSegment",ce.initSegment=G,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(W+=y.fragmentHint.duration),y.totalduration=W,y.endCC=_,be>0&&g(p,be),y},D}();function d(D,T){["video","audio","text"].forEach(function(h){var c=D.filter(function(a){return Object(v.isCodecType)(a,h)});if(c.length){var u=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});T[h+"Codec"]=u.length>0?u[0]:c[0],D=D.filter(function(a){return c.indexOf(a)===-1})}}),T.unknownCodecs=D}function C(D,T,h){var c=T[h];c&&(D[h]=c)}function g(D,T){for(var h=D[T],c=T;c--;){var u=D[c];if(!u)return;u.programDateTime=h.programDateTime-u.duration*1e3,h=u}}function m(D,T){D.rawProgramDateTime?D.programDateTime=Date.parse(D.rawProgramDateTime):T!=null&&T.programDateTime&&(D.programDateTime=T.endProgramDateTime),Object(H.isFiniteNumber)(D.programDateTime)||(D.programDateTime=null,D.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),O=L("./src/errors.ts"),B=L("./src/utils/logger.ts"),N=L("./src/utils/mp4-tools.ts"),R=L("./src/loader/m3u8-parser.ts"),A=L("./src/types/loader.ts"),f=L("./src/utils/attr-list.ts");function v(b){var E=b.type;switch(E){case A.PlaylistContextType.AUDIO_TRACK:return A.PlaylistLevelType.AUDIO;case A.PlaylistContextType.SUBTITLE_TRACK:return A.PlaylistLevelType.SUBTITLE;default:return A.PlaylistLevelType.MAIN}}function P(b,E){var l=b.url;return(l===void 0||l.indexOf("data:")===0)&&(l=E.url),l}var w=function(){function b(l){this.hls=void 0,this.loaders=Object.create(null),this.hls=l,this.registerListeners()}var E=b.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,C=s.loader,g=d||C,m=new g(s);return o.loader=m,this.loaders[o.type]=m,m},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:A.PlaylistContextType.MANIFEST,url:d,deliveryDirectives:null})},E.onLevelLoading=function(o,s){var d=s.id,C=s.level,g=s.url,m=s.deliveryDirectives;this.load({id:d,groupId:null,level:C,responseType:"text",type:A.PlaylistContextType.LEVEL,url:g,deliveryDirectives:m})},E.onAudioTrackLoading=function(o,s){var d=s.id,C=s.groupId,g=s.url,m=s.deliveryDirectives;this.load({id:d,groupId:C,level:null,responseType:"text",type:A.PlaylistContextType.AUDIO_TRACK,url:g,deliveryDirectives:m})},E.onSubtitleTrackLoading=function(o,s){var d=s.id,C=s.groupId,g=s.url,m=s.deliveryDirectives;this.load({id:d,groupId:C,level:null,responseType:"text",type:A.PlaylistContextType.SUBTITLE_TRACK,url:g,deliveryDirectives:m})},E.load=function(o){var s,d=this.hls.config,C=this.getInternalLoader(o);if(C){var g=C.context;if(g&&g.url===o.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),C.abort()}var m,D,T,h;switch(o.type){case A.PlaylistContextType.MANIFEST:m=d.manifestLoadingMaxRetry,D=d.manifestLoadingTimeOut,T=d.manifestLoadingRetryDelay,h=d.manifestLoadingMaxRetryTimeout;break;case A.PlaylistContextType.LEVEL:case A.PlaylistContextType.AUDIO_TRACK:case A.PlaylistContextType.SUBTITLE_TRACK:m=0,D=d.levelLoadingTimeOut;break;default:m=d.levelLoadingMaxRetry,D=d.levelLoadingTimeOut,T=d.levelLoadingRetryDelay,h=d.levelLoadingMaxRetryTimeout;break}if(C=this.createInternalLoader(o),(s=o.deliveryDirectives)!==null&&s!==void 0&&s.part){var c;if(o.type===A.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===A.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===A.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var u=c.partTarget,a=c.targetduration;u&&a&&(D=Math.min(Math.max(u*3,a*.8)*1e3,D))}}var x={timeout:D,maxRetry:m,retryDelay:T,maxRetryDelay:h,highWaterMark:0},y={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};C.load(o,x,y)},E.loadsuccess=function(o,s,d,C){if(C===void 0&&(C=null),d.isSidxRequest){this.handleSidxRequest(o,d),this.handlePlaylistLoaded(o,s,d,C);return}this.resetInternalLoader(d.type);var g=o.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,d,"no EXTM3U delimiter",C);return}s.parsing.start=performance.now(),g.indexOf("#EXTINF:")>0||g.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,s,d,C):this.handleMasterPlaylist(o,s,d,C)},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,C){var g=this.hls,m=o.data,D=P(o,d),T=R.default.parseMasterPlaylist(m,D),h=T.levels,c=T.sessionData;if(!h.length){this.handleManifestParsingError(o,d,"no level found in manifest",C);return}var u=h.map(function(F){return{id:F.attrs.AUDIO,audioCodec:F.audioCodec}}),a=h.map(function(F){return{id:F.attrs.SUBTITLES,textCodec:F.textCodec}}),x=R.default.parseMasterPlaylistMedia(m,D,"AUDIO",u),y=R.default.parseMasterPlaylistMedia(m,D,"SUBTITLES",a),p=R.default.parseMasterPlaylistMedia(m,D,"CLOSED-CAPTIONS");if(x.length){var k=x.some(function(F){return!F.url});!k&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(B.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),x.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new f.AttrList({}),bitrate:0,url:""}))}g.trigger(I.Events.MANIFEST_LOADED,{levels:h,audioTracks:x,subtitles:y,captions:p,url:D,stats:s,networkDetails:C,sessionData:c})},E.handleTrackOrLevelPlaylist=function(o,s,d,C){var g=this.hls,m=d.id,D=d.level,T=d.type,h=P(o,d),c=Object(H.isFiniteNumber)(m)?m:0,u=Object(H.isFiniteNumber)(D)?D:c,a=v(d),x=R.default.parseLevelPlaylist(o.data,h,u,a,c);if(!x.fragments.length){g.trigger(I.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:h,reason:"no fragments found in level",level:typeof d.level=="number"?d.level:void 0});return}if(T===A.PlaylistContextType.MANIFEST){var y={attrs:new f.AttrList({}),bitrate:0,details:x,name:"",url:h};g.trigger(I.Events.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:h,stats:s,networkDetails:C,sessionData:null})}if(s.parsing.end=performance.now(),x.needSidxRanges){var p,k=(p=x.fragments[0].initSegment)===null||p===void 0?void 0:p.url;this.load({url:k,isSidxRequest:!0,type:T,level:D,levelDetails:x,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}d.levelDetails=x,this.handlePlaylistLoaded(o,s,d,C)},E.handleSidxRequest=function(o,s){var d=Object(N.parseSegmentIndex)(new Uint8Array(o.data));if(!d)return;var C=d.references,g=s.levelDetails;C.forEach(function(m,D){var T=m.info,h=g.fragments[D];h.byteRange.length===0&&h.setByteRange(String(1+T.end-T.start)+"@"+String(T.start)),h.initSegment&&h.initSegment.setByteRange(String(d.moovEndOffset)+"@0")})},E.handleManifestParsingError=function(o,s,d,C){this.hls.trigger(I.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===A.PlaylistContextType.MANIFEST,url:o.url,reason:d,response:o,context:s,networkDetails:C})},E.handleNetworkError=function(o,s,d,C){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 g=O.ErrorDetails.UNKNOWN,m=!1,D=this.getInternalLoader(o);switch(o.type){case A.PlaylistContextType.MANIFEST:g=d?O.ErrorDetails.MANIFEST_LOAD_TIMEOUT:O.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case A.PlaylistContextType.LEVEL:g=d?O.ErrorDetails.LEVEL_LOAD_TIMEOUT:O.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case A.PlaylistContextType.AUDIO_TRACK:g=d?O.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:O.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case A.PlaylistContextType.SUBTITLE_TRACK:g=d?O.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:O.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}D&&this.resetInternalLoader(o.type);var T={type:O.ErrorTypes.NETWORK_ERROR,details:g,fatal:m,url:o.url,loader:D,context:o,networkDetails:s};C&&(T.response=C),this.hls.trigger(I.Events.ERROR,T)},E.handlePlaylistLoaded=function(o,s,d,C){var g=d.type,m=d.level,D=d.id,T=d.groupId,h=d.loader,c=d.levelDetails,u=d.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,d,"invalid target duration",C);return}if(!h)return;c.live&&(h.getCacheAge&&(c.ageHeader=h.getCacheAge()||0),(!h.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(g){case A.PlaylistContextType.MANIFEST:case A.PlaylistContextType.LEVEL:this.hls.trigger(I.Events.LEVEL_LOADED,{details:c,level:m||0,id:D||0,stats:s,networkDetails:C,deliveryDirectives:u});break;case A.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(I.Events.AUDIO_TRACK_LOADED,{details:c,id:D||0,groupId:T||"",stats:s,networkDetails:C,deliveryDirectives:u});break;case A.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADED,{details:c,id:D||0,groupId:T||"",stats:s,networkDetails:C,deliveryDirectives:u});break}},b}();K.default=w},"./src/polyfills/number.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"isFiniteNumber",function(){return H}),L.d(K,"MAX_SAFE_INTEGER",function(){return I});var H=Number.isFinite||function(O){return typeof O=="number"&&isFinite(O)},I=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(J,K,L){"use strict";L.r(K);var H=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}();K.default=H},"./src/remux/mp4-generator.ts":function(J,K,L){"use strict";L.r(K);var H=Math.pow(2,32)-1,I=function(){function O(){}return O.init=function(){O.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 O.types)O.types.hasOwnProperty(N)&&(O.types[N]=[N.charCodeAt(0),N.charCodeAt(1),N.charCodeAt(2),N.charCodeAt(3)]);var R=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),A=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);O.HDLR_TYPES={video:R,audio:A};var f=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),v=new Uint8Array([0,0,0,0,0,0,0,0]);O.STTS=O.STSC=O.STCO=v,O.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),O.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),O.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),O.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var P=new Uint8Array([105,115,111,109]),w=new Uint8Array([97,118,99,49]),b=new Uint8Array([0,0,0,1]);O.FTYP=O.box(O.types.ftyp,P,b,P,w),O.DINF=O.box(O.types.dinf,O.box(O.types.dref,f))},O.box=function(N){for(var R=8,A=arguments.length,f=new Array(A>1?A-1:0),v=1;v<A;v++)f[v-1]=arguments[v];for(var P=f.length,w=P;P--;)R+=f[P].byteLength;var b=new Uint8Array(R);for(b[0]=R>>24&255,b[1]=R>>16&255,b[2]=R>>8&255,b[3]=R&255,b.set(N,4),P=0,R=8;P<w;P++)b.set(f[P],R),R+=f[P].byteLength;return b},O.hdlr=function(N){return O.box(O.types.hdlr,O.HDLR_TYPES[N])},O.mdat=function(N){return O.box(O.types.mdat,N)},O.mdhd=function(N,R){R*=N;var A=Math.floor(R/(H+1)),f=Math.floor(R%(H+1));return O.box(O.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,A>>24,A>>16&255,A>>8&255,A&255,f>>24,f>>16&255,f>>8&255,f&255,85,196,0,0]))},O.mdia=function(N){return O.box(O.types.mdia,O.mdhd(N.timescale,N.duration),O.hdlr(N.type),O.minf(N))},O.mfhd=function(N){return O.box(O.types.mfhd,new Uint8Array([0,0,0,0,N>>24,N>>16&255,N>>8&255,N&255]))},O.minf=function(N){return N.type==="audio"?O.box(O.types.minf,O.box(O.types.smhd,O.SMHD),O.DINF,O.stbl(N)):O.box(O.types.minf,O.box(O.types.vmhd,O.VMHD),O.DINF,O.stbl(N))},O.moof=function(N,R,A){return O.box(O.types.moof,O.mfhd(N),O.traf(A,R))},O.moov=function(N){for(var R=N.length,A=[];R--;)A[R]=O.trak(N[R]);return O.box.apply(null,[O.types.moov,O.mvhd(N[0].timescale,N[0].duration)].concat(A).concat(O.mvex(N)))},O.mvex=function(N){for(var R=N.length,A=[];R--;)A[R]=O.trex(N[R]);return O.box.apply(null,[O.types.mvex].concat(A))},O.mvhd=function(N,R){R*=N;var A=Math.floor(R/(H+1)),f=Math.floor(R%(H+1)),v=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,A>>24,A>>16&255,A>>8&255,A&255,f>>24,f>>16&255,f>>8&255,f&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 O.box(O.types.mvhd,v)},O.sdtp=function(N){var R=N.samples||[],A=new Uint8Array(4+R.length),f,v;for(f=0;f<R.length;f++)v=R[f].flags,A[f+4]=v.dependsOn<<4|v.isDependedOn<<2|v.hasRedundancy;return O.box(O.types.sdtp,A)},O.stbl=function(N){return O.box(O.types.stbl,O.stsd(N),O.box(O.types.stts,O.STTS),O.box(O.types.stsc,O.STSC),O.box(O.types.stsz,O.STSZ),O.box(O.types.stco,O.STCO))},O.avc1=function(N){var R=[],A=[],f,v,P;for(f=0;f<N.sps.length;f++)v=N.sps[f],P=v.byteLength,R.push(P>>>8&255),R.push(P&255),R=R.concat(Array.prototype.slice.call(v));for(f=0;f<N.pps.length;f++)v=N.pps[f],P=v.byteLength,A.push(P>>>8&255),A.push(P&255),A=A.concat(Array.prototype.slice.call(v));var w=O.box(O.types.avcC,new Uint8Array([1,R[3],R[4],R[5],252|3,224|N.sps.length].concat(R).concat([N.pps.length]).concat(A))),b=N.width,E=N.height,l=N.pixelRatio[0],o=N.pixelRatio[1];return O.box(O.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,b>>8&255,b&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]),w,O.box(O.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),O.box(O.types.pasp,new Uint8Array([l>>24,l>>16&255,l>>8&255,l&255,o>>24,o>>16&255,o>>8&255,o&255])))},O.esds=function(N){var R=N.config.length;return new Uint8Array([0,0,0,0,3,23+R,0,1,0,4,15+R,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([R]).concat(N.config).concat([6,1,2]))},O.mp4a=function(N){var R=N.samplerate;return O.box(O.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,R>>8&255,R&255,0,0]),O.box(O.types.esds,O.esds(N)))},O.mp3=function(N){var R=N.samplerate;return O.box(O.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,R>>8&255,R&255,0,0]))},O.stsd=function(N){return N.type==="audio"?!N.isAAC&&N.codec==="mp3"?O.box(O.types.stsd,O.STSD,O.mp3(N)):O.box(O.types.stsd,O.STSD,O.mp4a(N)):O.box(O.types.stsd,O.STSD,O.avc1(N))},O.tkhd=function(N){var R=N.id,A=N.duration*N.timescale,f=N.width,v=N.height,P=Math.floor(A/(H+1)),w=Math.floor(A%(H+1));return O.box(O.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,R>>24&255,R>>16&255,R>>8&255,R&255,0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,w>>24,w>>16&255,w>>8&255,w&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,f>>8&255,f&255,0,0,v>>8&255,v&255,0,0]))},O.traf=function(N,R){var A=O.sdtp(N),f=N.id,v=Math.floor(R/(H+1)),P=Math.floor(R%(H+1));return O.box(O.types.traf,O.box(O.types.tfhd,new Uint8Array([0,0,0,0,f>>24,f>>16&255,f>>8&255,f&255])),O.box(O.types.tfdt,new Uint8Array([1,0,0,0,v>>24,v>>16&255,v>>8&255,v&255,P>>24,P>>16&255,P>>8&255,P&255])),O.trun(N,A.length+16+20+8+16+8+8),A)},O.trak=function(N){return N.duration=N.duration||4294967295,O.box(O.types.trak,O.tkhd(N),O.mdia(N))},O.trex=function(N){var R=N.id;return O.box(O.types.trex,new Uint8Array([0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},O.trun=function(N,R){var A=N.samples||[],f=A.length,v=12+16*f,P=new Uint8Array(v),w,b,E,l,o,s;for(R+=8+v,P.set([0,0,15,1,f>>>24&255,f>>>16&255,f>>>8&255,f&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255],0),w=0;w<f;w++)b=A[w],E=b.duration,l=b.size,o=b.flags,s=b.cts,P.set([E>>>24&255,E>>>16&255,E>>>8&255,E&255,l>>>24&255,l>>>16&255,l>>>8&255,l&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*w);return O.box(O.types.trun,P)},O.initSegment=function(N){O.types||O.init();var R=O.moov(N),A=new Uint8Array(O.FTYP.byteLength+R.byteLength);return A.set(O.FTYP),A.set(R,O.FTYP.byteLength),A},O}();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,K.default=I},"./src/remux/mp4-remuxer.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return s}),L.d(K,"normalizePts",function(){return d});var H=L("./src/polyfills/number.ts"),I=L("./src/remux/aac-helper.ts"),O=L("./src/remux/mp4-generator.ts"),B=L("./src/events.ts"),N=L("./src/errors.ts"),R=L("./src/utils/logger.ts"),A=L("./src/types/loader.ts"),f=L("./src/utils/timescale-conversion.ts");function v(){return v=Object.assign||function(D){for(var T=1;T<arguments.length;T++){var h=arguments[T];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(D[c]=h[c])}return D},v.apply(this,arguments)}var P=10*1e3,w=1024,b=1152,E=null,l=null,o=!1,s=function(){function D(h,c,u,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=h,this.config=c,this.typeSupported=u,this.ISGenerated=!1,E===null){var x=navigator.userAgent||"",y=x.match(/Chrome\/(\d+)/i);E=y?parseInt(y[1]):0}if(l===null){var p=navigator.userAgent.match(/Safari\/(\d+)/i);l=p?parseInt(p[1]):0}o=!!E&&E<75||!!l&&l<600}var T=D.prototype;return T.destroy=function(){},T.resetTimeStamp=function(c){R.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},T.resetNextTimestamp=function(){R.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},T.resetInitSegment=function(){R.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},T.getVideoStartPts=function(c){var u=!1,a=c.reduce(function(x,y){var p=y.pts-x;return p<-4294967296?(u=!0,d(x,y.pts)):p>0?x:y.pts},c[0].pts);return u&&R.logger.debug("PTS rollover detected"),a},T.remux=function(c,u,a,x,y,p,k,F){var U,W,_,M,G,Y,Z=y,ne=y,be=c.pid>-1,me=u.pid>-1,pe=u.samples.length,ue=c.samples.length>0,fe=pe>1,ie=(!be||ue)&&(!me||fe)||this.ISGenerated||k;if(ie){this.ISGenerated||(_=this.generateIS(c,u,y));var he=this.isVideoContiguous,$=-1;if(fe&&($=C(u.samples),!he&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,$>0){R.logger.warn("[mp4-remuxer]: Dropped "+$+" out of "+pe+" video samples due to a missing keyframe");var ae=this.getVideoStartPts(u.samples);u.samples=u.samples.slice($),u.dropped+=$,ne+=(u.samples[0].pts-ae)/(u.timescale||9e4)}else $===-1&&(R.logger.warn("[mp4-remuxer]: No keyframe found out of "+pe+" video samples"),Y=!1);if(this.ISGenerated){if(ue&&fe){var ee=this.getVideoStartPts(u.samples),Ee=d(c.samples[0].pts,ee)-ee,Ce=Ee/u.inputTimeScale;Z+=Math.max(0,Ce),ne+=Math.max(0,-Ce)}if(ue){if(c.samplerate||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),_=this.generateIS(c,u,y)),W=this.remuxAudio(c,Z,this.isAudioContiguous,p,me||fe||F===A.PlaylistLevelType.AUDIO?ne:void 0),fe){var ve=W?W.endPTS-W.startPTS:0;u.inputTimeScale||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),_=this.generateIS(c,u,y)),U=this.remuxVideo(u,ne,he,ve)}}else fe&&(U=this.remuxVideo(u,ne,he,0));U&&(U.firstKeyFrame=$,U.independent=$!==-1)}}return this.ISGenerated&&(a.samples.length&&(G=this.remuxID3(a,y)),x.samples.length&&(M=this.remuxText(x,y))),{audio:W,video:U,initSegment:_,independent:Y,text:M,id3:G}},T.generateIS=function(c,u,a){var x=c.samples,y=u.samples,p=this.typeSupported,k={},F=!Object(H.isFiniteNumber)(this._initPTS),U="audio/mp4",W,_,M;if(F&&(W=_=Infinity),c.config&&x.length&&(c.timescale=c.samplerate,c.isAAC||(p.mpeg?(U="audio/mpeg",c.codec=""):p.mp3&&(c.codec="mp3")),k.audio={id:"audio",container:U,codec:c.codec,initSegment:!c.isAAC&&p.mpeg?new Uint8Array(0):O.default.initSegment([c]),metadata:{channelCount:c.channelCount}},F&&(M=c.inputTimeScale,W=_=x[0].pts-Math.round(M*a))),u.sps&&u.pps&&y.length&&(u.timescale=u.inputTimeScale,k.video={id:"main",container:"video/mp4",codec:u.codec,initSegment:O.default.initSegment([u]),metadata:{width:u.width,height:u.height}},F)){M=u.inputTimeScale;var G=this.getVideoStartPts(y),Y=Math.round(M*a);_=Math.min(_,d(y[0].dts,G)-Y),W=Math.min(W,G-Y)}if(Object.keys(k).length)return this.ISGenerated=!0,F&&(this._initPTS=W,this._initDTS=_),{tracks:k,initPTS:W,timescale:M}},T.remuxVideo=function(c,u,a,x){var y=c.inputTimeScale,p=c.samples,k=[],F=p.length,U=this._initPTS,W=this.nextAvcDts,_=8,M,G,Y,Z=Number.POSITIVE_INFINITY,ne=Number.NEGATIVE_INFINITY,be=0,me=!1;if(!a||W===null){var pe=u*y,ue=p[0].pts-d(p[0].dts,p[0].pts);W=pe-ue}for(var fe=0;fe<F;fe++){var ie=p[fe];if(ie.pts=d(ie.pts-U,W),ie.dts=d(ie.dts-U,W),ie.dts>ie.pts){var he=9e4*.2;be=Math.max(Math.min(be,ie.pts-ie.dts),-1*he)}ie.dts<p[fe>0?fe-1:fe].dts&&(me=!0)}me&&p.sort(function(mt,at){var qe=mt.dts-at.dts,xt=mt.pts-at.pts;return qe||xt}),G=p[0].dts,Y=p[p.length-1].dts;var $=Math.round((Y-G)/(F-1));if(be<0){if(be<$*-2){R.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(f.toMsFromMpegTsClock)(-$,!0)+" ms");for(var ae=be,ee=0;ee<F;ee++)p[ee].dts=ae=Math.max(ae,p[ee].pts-$),p[ee].pts=Math.max(ae,p[ee].pts)}else{R.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(f.toMsFromMpegTsClock)(be,!0)+" ms to overcome this issue");for(var Ee=0;Ee<F;Ee++)p[Ee].dts=p[Ee].dts+be}G=p[0].dts}if(a){var Ce=G-W,ve=Ce>$,Se=Ce<-1;if(ve||Se){ve?R.logger.warn("AVC: "+Object(f.toMsFromMpegTsClock)(Ce,!0)+" ms ("+Ce+"dts) hole between fragments detected, filling it"):R.logger.warn("AVC: "+Object(f.toMsFromMpegTsClock)(-Ce,!0)+" ms ("+Ce+"dts) overlapping between fragments detected"),G=W;var De=p[0].pts-Ce;p[0].dts=G,p[0].pts=De,R.logger.log("Video: First PTS/DTS adjusted: "+Object(f.toMsFromMpegTsClock)(De,!0)+"/"+Object(f.toMsFromMpegTsClock)(G,!0)+", delta: "+Object(f.toMsFromMpegTsClock)(Ce,!0)+" ms")}}o&&(G=Math.max(0,G));for(var _e=0,ke=0,Re=0;Re<F;Re++){for(var Ae=p[Re],Ue=Ae.units,Ye=Ue.length,Ge=0,He=0;He<Ye;He++)Ge+=Ue[He].data.length;ke+=Ge,_e+=Ye,Ae.length=Ge,Ae.dts=Math.max(Ae.dts,G),Ae.pts=Math.max(Ae.pts,Ae.dts,0),Z=Math.min(Ae.pts,Z),ne=Math.max(Ae.pts,ne)}Y=p[F-1].dts;var et=ke+4*_e+8,Je;try{Je=new Uint8Array(et)}catch(mt){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 Xe=new DataView(Je.buffer);Xe.setUint32(0,et),Je.set(O.default.types.mdat,4);for(var we=0;we<F;we++){for(var rt=p[we],$e=rt.units,Le=0,Fe=0,ge=$e.length;Fe<ge;Fe++){var de=$e[Fe],ce=de.data,Q=de.data.byteLength;Xe.setUint32(_,Q),_+=4,Je.set(ce,_),_+=Q,Le+=4+Q}if(we<F-1)M=p[we+1].dts-rt.dts;else{var q=this.config,re=rt.dts-p[we>0?we-1:we].dts;if(q.stretchShortVideoTrack&&this.nextAudioPts!==null){var se=Math.floor(q.maxBufferHole*y),Te=(x?Z+x*y:this.nextAudioPts)-rt.pts;Te>se?(M=Te-re,M<0&&(M=re),R.logger.log("[mp4-remuxer]: It is approximately "+Te/90+" ms to the next segment; using duration "+M/90+" ms for the last video frame.")):M=re}else M=re}var Oe=Math.round(rt.pts-rt.dts);k.push(new g(rt.key,M,Le,Oe))}if(k.length&&E&&E<70){var je=k[0].flags;je.dependsOn=2,je.isNonSync=0}console.assert(M!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=Y+M,this.isVideoContiguous=!0;var st=O.default.moof(c.sequenceNumber++,G,v({},c,{samples:k})),ht="video",Me={data1:st,data2:Je,startPTS:Z/y,endPTS:(ne+M)/y,startDTS:G/y,endDTS:W/y,type:ht,hasAudio:!1,hasVideo:!0,nb:k.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Je.length,"MDAT length must not be zero"),Me},T.remuxAudio=function(c,u,a,x,y){var p=c.inputTimeScale,k=c.samplerate?c.samplerate:p,F=p/k,U=c.isAAC?w:b,W=U*F,_=this._initPTS,M=!c.isAAC&&this.typeSupported.mpeg,G=[],Y=c.samples,Z=M?0:8,ne=this.nextAudioPts||-1,be=u*p;if(this.isAudioContiguous=a=a||Y.length&&ne>0&&(x&&Math.abs(be-ne)<9e3||Math.abs(d(Y[0].pts-_,be)-ne)<20*W),Y.forEach(function(ce){ce.pts=d(ce.pts-_,be)}),!a||ne<0){if(Y=Y.filter(function(ce){return ce.pts>=0}),!Y.length)return;y===0?ne=0:x?ne=Math.max(0,be):ne=Y[0].pts}if(c.isAAC)for(var me=y!==void 0,pe=this.config.maxAudioFramesDrift,ue=0,fe=ne;ue<Y.length;ue++){var ie=Y[ue],he=ie.pts,$=he-fe,ae=Math.abs(1e3*$/p);if($<=-pe*W&&me)ue===0&&(R.logger.warn("Audio frame @ "+(he/p).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*$/p)+" ms."),this.nextAudioPts=ne=fe=he);else if($>=pe*W&&ae<P&&me){var ee=Math.round($/W);fe=he-ee*W,fe<0&&(ee--,fe+=W),ue===0&&(this.nextAudioPts=ne=fe),R.logger.warn("[mp4-remuxer]: Injecting "+ee+" audio frame @ "+(fe/p).toFixed(3)+"s due to "+Math.round(1e3*$/p)+" ms gap.");for(var Ee=0;Ee<ee;Ee++){var Ce=Math.max(fe,0),ve=I.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);ve||(R.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ve=ie.unit.subarray()),Y.splice(ue,0,{unit:ve,pts:Ce}),fe+=W,ue++}}ie.pts=fe,fe+=W}for(var Se=null,De=null,_e,ke=0,Re=Y.length;Re--;)ke+=Y[Re].unit.byteLength;for(var Ae=0,Ue=Y.length;Ae<Ue;Ae++){var Ye=Y[Ae],Ge=Ye.unit,He=Ye.pts;if(De!==null){var et=G[Ae-1];et.duration=Math.round((He-De)/F)}else if(a&&c.isAAC&&(He=ne),Se=He,ke>0){ke+=Z;try{_e=new Uint8Array(ke)}catch(ce){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ke,reason:"fail allocating audio mdat "+ke});return}if(!M){var Je=new DataView(_e.buffer);Je.setUint32(0,ke),_e.set(O.default.types.mdat,4)}}else return;_e.set(Ge,Z);var Xe=Ge.byteLength;Z+=Xe,G.push(new g(!0,U,Xe,0)),De=He}var we=G.length;if(!we)return;var rt=G[G.length-1];this.nextAudioPts=ne=De+F*rt.duration;var $e=M?new Uint8Array(0):O.default.moof(c.sequenceNumber++,Se/F,v({},c,{samples:G}));c.samples=[];var Le=Se/p,Fe=ne/p,ge="audio",de={data1:$e,data2:_e,startPTS:Le,endPTS:Fe,startDTS:Le,endDTS:Fe,type:ge,hasAudio:!0,hasVideo:!1,nb:we};return this.isAudioContiguous=!0,console.assert(_e.length,"MDAT length must not be zero"),de},T.remuxEmptyAudio=function(c,u,a,x){var y=c.inputTimeScale,p=c.samplerate?c.samplerate:y,k=y/p,F=this.nextAudioPts,U=(F!==null?F:x.startDTS*y)+this._initDTS,W=x.endDTS*y+this._initDTS,_=k*w,M=Math.ceil((W-U)/_),G=I.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(R.logger.warn("[mp4-remuxer]: remux empty Audio"),!G){R.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Y=[],Z=0;Z<M;Z++){var ne=U+Z*_;Y.push({unit:G,pts:ne,dts:ne})}return c.samples=Y,this.remuxAudio(c,u,a,!1)},T.remuxID3=function(c,u){var a=c.samples.length;if(!a)return;for(var x=c.inputTimeScale,y=this._initPTS,p=this._initDTS,k=0;k<a;k++){var F=c.samples[k];F.pts=d(F.pts-y,u*x)/x,F.dts=d(F.dts-p,u*x)/x}var U=c.samples;return c.samples=[],{samples:U}},T.remuxText=function(c,u){var a=c.samples.length;if(!a)return;for(var x=c.inputTimeScale,y=this._initPTS,p=0;p<a;p++){var k=c.samples[p];k.pts=d(k.pts-y,u*x)/x}c.samples.sort(function(U,W){return U.pts-W.pts});var F=c.samples;return c.samples=[],{samples:F}},D}();function d(D,T){var h;if(T===null)return D;for(T<D?h=-8589934592:h=8589934592;Math.abs(D-T)>4294967296;)D+=h;return D}function C(D){for(var T=0;T<D.length;T++)if(D[T].key)return T;return-1}var g=function(T,h,c,u){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=h,this.size=c,this.cts=u,this.flags=new m(T)},m=function(T){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=T?2:1,this.isNonSync=T?0:1}},"./src/remux/passthrough-remuxer.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/polyfills/number.ts"),I=L("./src/utils/mp4-tools.ts"),O=L("./src/loader/fragment.ts"),B=L("./src/utils/logger.ts"),N=function(){function f(){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 v=f.prototype;return v.destroy=function(){},v.resetTimeStamp=function(w){this.initPTS=w,this.lastEndDTS=null},v.resetNextTimestamp=function(){this.lastEndDTS=null},v.resetInitSegment=function(w,b,E){this.audioCodec=b,this.videoCodec=E,this.generateInitSegment(w),this.emitInitSegment=!0},v.generateInitSegment=function(w){var b=this.audioCodec,E=this.videoCodec;if(!w||!w.byteLength){this.initTracks=void 0,this.initData=void 0;return}var l=this.initData=Object(I.parseInitSegment)(w);b||(b=A(l.audio,O.ElementaryStreamTypes.AUDIO)),E||(E=A(l.video,O.ElementaryStreamTypes.VIDEO));var o={};l.audio&&l.video?o.audiovideo={container:"video/mp4",codec:b+","+E,initSegment:w,id:"main"}:l.audio?o.audio={container:"audio/mp4",codec:b,initSegment:w,id:"audio"}:l.video?o.video={container:"video/mp4",codec:E,initSegment:w,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},v.remux=function(w,b,E,l,o){var s=this.initPTS,d=this.lastEndDTS,C={audio:void 0,video:void 0,text:l,id3:E,initSegment:void 0};Object(H.isFiniteNumber)(d)||(d=this.lastEndDTS=o||0);var g=b.samples;if(!g||!g.length)return C;var m={initPTS:void 0,timescale:1},D=this.initData;if((!D||!D.length)&&(this.generateInitSegment(g),D=this.initData),!D||!D.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),C;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1),Object(H.isFiniteNumber)(s)||(this.initPTS=m.initPTS=s=R(D,g,d));var T=Object(I.getDuration)(g,D),h=d,c=T+h;Object(I.offsetStartDTS)(D,g,s),T>0?this.lastEndDTS=c:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var u=!!D.audio,a=!!D.video,x="";u&&(x+="audio"),a&&(x+="video");var y={data1:g,startPTS:h,startDTS:h,endPTS:c,endDTS:c,type:x,hasAudio:u,hasVideo:a,nb:1,dropped:0};return C.audio=y.type==="audio"?y:void 0,C.video=y.type!=="audio"?y:void 0,C.text=l,C.id3=E,C.initSegment=m,C},f}(),R=function(v,P,w){return Object(I.getStartDTS)(v,P)-w};function A(f,v){var P=f==null?void 0:f.codec;return P&&P.length>4?P:P==="hvc1"?"hvc1.1.c.L120.90":P==="av01"?"av01.0.04M.08":P==="avc1"||v===O.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}K.default=N},"./src/task-loop.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return H});var H=function(){function I(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var O=I.prototype;return O.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},O.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},O.onHandlerDestroyed=function(){},O.hasInterval=function(){return!!this._tickInterval},O.hasNextTick=function(){return!!this._tickTimer},O.setInterval=function(N){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,N),!0)},O.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},O.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},O.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},O.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},O.doTick=function(){},I}()},"./src/types/cmcd.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"CMCDVersion",function(){return H}),L.d(K,"CMCDObjectType",function(){return I}),L.d(K,"CMCDStreamingFormat",function(){return O}),L.d(K,"CMCDStreamType",function(){return B});var H=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 O;(function(N){N.DASH="d",N.HLS="h",N.SMOOTH="s",N.OTHER="o"})(O||(O={}));var B;(function(N){N.VOD="v",N.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"HlsSkip",function(){return O}),L.d(K,"getSkipValue",function(){return B}),L.d(K,"HlsUrlParameters",function(){return N}),L.d(K,"Level",function(){return R});function H(A,f){for(var v=0;v<f.length;v++){var P=f[v];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(A,P.key,P)}}function I(A,f,v){return f&&H(A.prototype,f),v&&H(A,v),A}var O;(function(A){A.No="",A.Yes="YES",A.v2="v2"})(O||(O={}));function B(A,f){var v=A.canSkipUntil,P=A.canSkipDateRanges,w=A.endSN,b=f!==void 0?f-w:0;return v&&b<v?P?O.v2:O.Yes:O.No}var N=function(){function A(v,P,w){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=v,this.part=P,this.skip=w}var f=A.prototype;return f.addDirectives=function(P){var w=new self.URL(P);return this.msn!==void 0&&w.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&w.searchParams.set("_HLS_part",this.part.toString()),this.skip&&w.searchParams.set("_HLS_skip",this.skip),w.toString()},A}(),R=function(){function A(f){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=[f.url],this.attrs=f.attrs,this.bitrate=f.bitrate,f.details&&(this.details=f.details),this.id=f.id||0,this.name=f.name,this.width=f.width||0,this.height=f.height||0,this.audioCodec=f.audioCodec,this.videoCodec=f.videoCodec,this.unknownCodecs=f.unknownCodecs,this.codecSet=[f.videoCodec,f.audioCodec].filter(function(v){return v}).join(",").replace(/\.[^.,]+/g,"")}return I(A,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(v){var P=v%this.url.length;this._urlId!==P&&(this.details=void 0,this._urlId=P)}}]),A}()},"./src/types/loader.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"PlaylistContextType",function(){return H}),L.d(K,"PlaylistLevelType",function(){return I});var H;(function(O){O.MANIFEST="manifest",O.LEVEL="level",O.AUDIO_TRACK="audioTrack",O.SUBTITLE_TRACK="subtitleTrack"})(H||(H={}));var I;(function(O){O.MAIN="main",O.AUDIO="audio",O.SUBTITLE="subtitle"})(I||(I={}))},"./src/types/transmuxer.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"ChunkMetadata",function(){return H});var H=function(B,N,R,A,f,v){A===void 0&&(A=0),f===void 0&&(f=-1),v===void 0&&(v=!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=R,this.size=A,this.part=f,this.partial=v};function I(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"AttrList",function(){return O});var H=/^(\d+)x(\d+)$/,I=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,O=function(){function B(R){typeof R=="string"&&(R=B.parseAttrList(R));for(var A in R)R.hasOwnProperty(A)&&(this[A]=R[A])}var N=B.prototype;return N.decimalInteger=function(A){var f=parseInt(this[A],10);return f>Number.MAX_SAFE_INTEGER?Infinity:f},N.hexadecimalInteger=function(A){if(this[A]){var f=(this[A]||"0x").slice(2);f=(f.length&1?"0":"")+f;for(var v=new Uint8Array(f.length/2),P=0;P<f.length/2;P++)v[P]=parseInt(f.slice(P*2,P*2+2),16);return v}else return null},N.hexadecimalIntegerAsNumber=function(A){var f=parseInt(this[A],16);return f>Number.MAX_SAFE_INTEGER?Infinity:f},N.decimalFloatingPoint=function(A){return parseFloat(this[A])},N.optionalFloat=function(A,f){var v=this[A];return v?parseFloat(v):f},N.enumeratedString=function(A){return this[A]},N.bool=function(A){return this[A]==="YES"},N.decimalResolution=function(A){var f=H.exec(this[A]);return f===null?void 0:{width:parseInt(f[1],10),height:parseInt(f[2],10)}},B.parseAttrList=function(A){var f,v={},P='"';for(I.lastIndex=0;(f=I.exec(A))!==null;){var w=f[2];w.indexOf(P)===0&&w.lastIndexOf(P)===w.length-1&&(w=w.slice(1,-1)),v[f[1]]=w}return v},B}()},"./src/utils/binary-search.ts":function(J,K,L){"use strict";L.r(K);var H={search:function(O,B){for(var N=0,R=O.length-1,A=null,f=null;N<=R;){A=(N+R)/2|0,f=O[A];var v=B(f);if(v>0)N=A+1;else if(v<0)R=A-1;else return f}return null}};K.default=H},"./src/utils/buffer-helper.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"BufferHelper",function(){return O});var H=L("./src/utils/logger.ts"),I={length:0,start:function(){return 0},end:function(){return 0}},O=function(){function B(){}return B.isBuffered=function(R,A){try{if(R){for(var f=B.getBuffered(R),v=0;v<f.length;v++)if(A>=f.start(v)&&A<=f.end(v))return!0}}catch(P){}return!1},B.bufferInfo=function(R,A,f){try{if(R){var v=B.getBuffered(R),P=[],w;for(w=0;w<v.length;w++)P.push({start:v.start(w),end:v.end(w)});return this.bufferedInfo(P,A,f)}}catch(b){}return{len:0,start:A,end:A,nextStart:void 0}},B.bufferedInfo=function(R,A,f){A=Math.max(0,A),R.sort(function(m,D){var T=m.start-D.start;return T||D.end-m.end});var v=[];if(f)for(var P=0;P<R.length;P++){var w=v.length;if(w){var b=v[w-1].end;R[P].start-b<f?R[P].end>b&&(v[w-1].end=R[P].end):v.push(R[P])}else v.push(R[P])}else v=R;for(var E=0,l,o=A,s=A,d=0;d<v.length;d++){var C=v[d].start,g=v[d].end;if(A+f>=C&&A<g)o=C,s=g,E=s-A;else if(A+f<C){l=C;break}}return{len:E,start:o||0,end:s||0,nextStart:l}},B.getBuffered=function(R){try{return R.buffered}catch(A){return H.logger.log("failed to get media.buffered",A),I}},B}()},"./src/utils/cea-608-parser.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"Row",function(){return s}),L.d(K,"CaptionScreen",function(){return d});var H=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},O=function(c){var u=c;return I.hasOwnProperty(c)&&(u=I[c]),String.fromCharCode(u)},B=15,N=100,R={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},A={17:2,18:4,21:6,22:8,23:10,19:13,20:15},f={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},v={25:2,26:4,29:6,30:8,31:10,27:13,28:15},P=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],w;(function(h){h[h.ERROR=0]="ERROR",h[h.TEXT=1]="TEXT",h[h.WARNING=2]="WARNING",h[h.INFO=2]="INFO",h[h.DEBUG=3]="DEBUG",h[h.DATA=3]="DATA"})(w||(w={}));var b=function(){function h(){this.time=null,this.verboseLevel=w.ERROR}var c=h.prototype;return c.log=function(a,x){this.verboseLevel>=a&&H.logger.log(this.time+" ["+a+"] "+x)},h}(),E=function(c){for(var u=[],a=0;a<c.length;a++)u.push(c[a].toString(16));return u},l=function(){function h(u,a,x,y,p){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=u||"white",this.underline=a||!1,this.italics=x||!1,this.background=y||"black",this.flash=p||!1}var c=h.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 x=["foreground","underline","italics","background","flash"],y=0;y<x.length;y++){var p=x[y];a.hasOwnProperty(p)&&(this[p]=a[p])}},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},h}(),o=function(){function h(u,a,x,y,p,k){this.uchar=void 0,this.penState=void 0,this.uchar=u||" ",this.penState=new l(a,x,y,p,k)}var c=h.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,x){this.uchar=a,this.penState.copy(x)},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()},h}(),s=function(){function h(u){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<N;a++)this.chars.push(new o);this.logger=u,this.pos=0,this.currPenState=new l}var c=h.prototype;return c.equals=function(a){for(var x=!0,y=0;y<N;y++)if(!this.chars[y].equals(a.chars[y])){x=!1;break}return x},c.copy=function(a){for(var x=0;x<N;x++)this.chars[x].copy(a.chars[x])},c.isEmpty=function(){for(var a=!0,x=0;x<N;x++)if(!this.chars[x].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(w.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>N&&(this.logger.log(w.DEBUG,"Too large cursor position "+this.pos),this.pos=N)},c.moveCursor=function(a){var x=this.pos+a;if(a>1)for(var y=this.pos+1;y<x+1;y++)this.chars[y].setPenState(this.currPenState);this.setCursor(x)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var x=O(a);if(this.pos>=N){this.logger.log(w.ERROR,"Cannot insert "+a.toString(16)+" ("+x+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(x,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var x;for(x=a;x<N;x++)this.chars[x].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=[],x=!0,y=0;y<N;y++){var p=this.chars[y].uchar;p!==" "&&(x=!1),a.push(p)}return x?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var x=this.chars[this.pos];x.setPenState(this.currPenState)},h}(),d=function(){function h(u){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<B;a++)this.rows.push(new s(u));this.logger=u,this.currRow=B-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=h.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 x=!0,y=0;y<B;y++)if(!this.rows[y].equals(a.rows[y])){x=!1;break}return x},c.copy=function(a){for(var x=0;x<B;x++)this.rows[x].copy(a.rows[x])},c.isEmpty=function(){for(var a=!0,x=0;x<B;x++)if(!this.rows[x].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 x=this.rows[this.currRow];x.insertChar(a)},c.setPen=function(a){var x=this.rows[this.currRow];x.setPenStyles(a)},c.moveCursor=function(a){var x=this.rows[this.currRow];x.moveCursor(a)},c.setCursor=function(a){this.logger.log(w.INFO,"setCursor: "+a);var x=this.rows[this.currRow];x.setCursor(a)},c.setPAC=function(a){this.logger.log(w.INFO,"pacData = "+JSON.stringify(a));var x=a.row-1;if(this.nrRollUpRows&&x<this.nrRollUpRows-1&&(x=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==x){for(var y=0;y<B;y++)this.rows[y].clear();var p=this.currRow+1-this.nrRollUpRows,k=this.lastOutputScreen;if(k){var F=k.rows[p].cueStartTime,U=this.logger.time;if(F&&U!==null&&F<U)for(var W=0;W<this.nrRollUpRows;W++)this.rows[x-this.nrRollUpRows+W+1].copy(k.rows[p+W])}}this.currRow=x;var _=this.rows[this.currRow];if(a.indent!==null){var M=a.indent,G=Math.max(M-1,0);_.setCursor(a.indent),a.color=_.chars[G].penState.foreground}var Y={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(Y)},c.setBkgData=function(a){this.logger.log(w.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(w.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(w.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,x=this.rows.splice(a,1)[0];x.clear(),this.rows.splice(this.currRow,0,x),this.logger.log(w.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var x=[],y="",p=-1,k=0;k<B;k++){var F=this.rows[k].getTextString();F&&(p=k+1,a?x.push("Row "+p+": '"+F+"'"):x.push(F.trim()))}return x.length>0&&(a?y="["+x.join(" | ")+"]":y=x.join(`
|
|
`)),y},c.getTextAndFormat=function(){return this.rows},h}(),C=function(){function h(u,a,x){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=u,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new d(x),this.nonDisplayedMemory=new d(x),this.lastOutputScreen=new d(x),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=x}var c=h.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(w.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 x=0;x<a.length;x++)this.writeScreen.insertChar(a[x]);var y=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(w.INFO,y+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(w.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(w.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(w.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(w.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(w.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(w.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(w.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(w.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(w.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(w.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(w.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(w.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(w.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(w.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(w.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var x={flash:!1};if(x.underline=a%2===1,x.italics=a>=46,x.italics)x.foreground="white";else{var y=Math.floor(a/2)-16,p=["white","green","blue","cyan","red","yellow","magenta"];x.foreground=p[y]}this.logger.log(w.INFO,"MIDROW: "+JSON.stringify(x)),this.writeScreen.setPen(x)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var x=this.logger.time;if(x===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=x:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,x,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:x),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))},h}(),g=function(){function h(u,a,x){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var y=new b;this.channels=[null,new C(u,a,y),new C(u+1,x,y)],this.cmdHistory=T(),this.logger=y}var c=h.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,x){this.channels[a].setHandler(x)},c.addData=function(a,x){var y,p,k,F=!1;this.logger.time=a;for(var U=0;U<x.length;U+=2){if(p=x[U]&127,k=x[U+1]&127,p===0&&k===0)continue;if(this.logger.log(w.DATA,"["+E([x[U],x[U+1]])+"] -> ("+E([p,k])+")"),y=this.parseCmd(p,k),y||(y=this.parseMidrow(p,k)),y||(y=this.parsePAC(p,k)),y||(y=this.parseBackgroundAttributes(p,k)),!y&&(F=this.parseChars(p,k),F)){var W=this.currentChannel;if(W&&W>0){var _=this.channels[W];_.insertChars(F)}else this.logger.log(w.WARNING,"No channel found yet. TEXT-MODE?")}!y&&!F&&this.logger.log(w.WARNING,"Couldn't parse cleaned data "+E([p,k])+" orig: "+E([x[U],x[U+1]]))}},c.parseCmd=function(a,x){var y=this.cmdHistory,p=(a===20||a===28||a===21||a===29)&&x>=32&&x<=47,k=(a===23||a===31)&&x>=33&&x<=35;if(!(p||k))return!1;if(D(a,x,y))return m(null,null,y),this.logger.log(w.DEBUG,"Repeated command ("+E([a,x])+") is dropped"),!0;var F=a===20||a===21||a===23?1:2,U=this.channels[F];return a===20||a===21||a===28||a===29?x===32?U.ccRCL():x===33?U.ccBS():x===34?U.ccAOF():x===35?U.ccAON():x===36?U.ccDER():x===37?U.ccRU(2):x===38?U.ccRU(3):x===39?U.ccRU(4):x===40?U.ccFON():x===41?U.ccRDC():x===42?U.ccTR():x===43?U.ccRTD():x===44?U.ccEDM():x===45?U.ccCR():x===46?U.ccENM():x===47&&U.ccEOC():U.ccTO(x-32),m(a,x,y),this.currentChannel=F,!0},c.parseMidrow=function(a,x){var y=0;if((a===17||a===25)&&x>=32&&x<=47){if(a===17?y=1:y=2,y!==this.currentChannel)return this.logger.log(w.ERROR,"Mismatch channel in midrow parsing"),!1;var p=this.channels[y];return p?(p.ccMIDROW(x),this.logger.log(w.DEBUG,"MIDROW ("+E([a,x])+")"),!0):!1}return!1},c.parsePAC=function(a,x){var y,p=this.cmdHistory,k=(a>=17&&a<=23||a>=25&&a<=31)&&x>=64&&x<=127,F=(a===16||a===24)&&x>=64&&x<=95;if(!(k||F))return!1;if(D(a,x,p))return m(null,null,p),!0;var U=a<=23?1:2;x>=64&&x<=95?y=U===1?R[a]:f[a]:y=U===1?A[a]:v[a];var W=this.channels[U];return W?(W.setPAC(this.interpretPAC(y,x)),m(a,x,p),this.currentChannel=U,!0):!1},c.interpretPAC=function(a,x){var y,p={color:null,italics:!1,indent:null,underline:!1,row:a};return x>95?y=x-96:y=x-64,p.underline=(y&1)===1,y<=13?p.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(y/2)]:y<=15?(p.italics=!0,p.color="white"):p.indent=Math.floor((y-16)/2)*4,p},c.parseChars=function(a,x){var y,p=null,k=null;if(a>=25?(y=2,k=a-8):(y=1,k=a),k>=17&&k<=19){var F;k===17?F=x+80:k===18?F=x+112:F=x+144,this.logger.log(w.INFO,"Special char '"+O(F)+"' in channel "+y),p=[F]}else a>=32&&a<=127&&(p=x===0?[a]:[a,x]);if(p){var U=E(p);this.logger.log(w.DEBUG,"Char codes = "+U.join(",")),m(a,x,this.cmdHistory)}return p},c.parseBackgroundAttributes=function(a,x){var y=(a===16||a===24)&&x>=32&&x<=47,p=(a===23||a===31)&&x>=45&&x<=47;if(!(y||p))return!1;var k,F={};a===16||a===24?(k=Math.floor((x-32)/2),F.background=P[k],x%2===1&&(F.background=F.background+"_semi")):x===45?F.background="transparent":(F.foreground="black",x===47&&(F.underline=!0));var U=a<=23?1:2,W=this.channels[U];return W.setBkgData(F),m(a,x,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var x=this.channels[a];x&&x.reset()}this.cmdHistory=T()},c.cueSplitAtTime=function(a){for(var x=0;x<this.channels.length;x++){var y=this.channels[x];y&&y.cueSplitAtTime(a)}},h}();function m(h,c,u){u.a=h,u.b=c}function D(h,c,u){return u.a===h&&u.b===c}function T(){return{a:null,b:null}}K.default=g},"./src/utils/codecs.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"isCodecType",function(){return I}),L.d(K,"isCodecSupportedInMp4",function(){return O});var H={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 R=H[N];return!!R&&R[B.slice(0,4)]===!0}function O(B,N){return MediaSource.isTypeSupported((N||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/utils/vttparser.ts"),I=L("./src/utils/webvtt-parser.ts"),O=L("./src/utils/texttrack-utils.ts"),B=/\s/,N={newCue:function(A,f,v,P){for(var w=[],b,E,l,o,s,d=self.VTTCue||self.TextTrackCue,C=0;C<P.rows.length;C++)if(b=P.rows[C],l=!0,o=0,s="",!b.isEmpty()){for(var g=0;g<b.chars.length;g++)B.test(b.chars[g].uchar)&&l?o++:(s+=b.chars[g].uchar,l=!1);b.cueStartTime=f,f===v&&(v+=1e-4),o>=16?o--:o++;var m=Object(H.fixLineBreaks)(s.trim()),D=Object(I.generateCueId)(f,v,m);(!A||!A.cues||!A.cues.getCueById(D))&&(E=new d(f,v,m),E.id=D,E.line=C+1,E.align="left",E.position=10+Math.min(80,Math.floor(o*8/32)*10),w.push(E))}return A&&w.length&&(w.sort(function(T,h){return T.line==="auto"||h.line==="auto"?0:T.line>8&&h.line>8?h.line-T.line:T.line-h.line}),w.forEach(function(T){return Object(O.addCueToTrack)(A,T)})),w}};K.default=N},"./src/utils/discontinuities.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"findFirstFragWithCC",function(){return B}),L.d(K,"shouldAlignOnDiscontinuities",function(){return N}),L.d(K,"findDiscontinuousReferenceFrag",function(){return R}),L.d(K,"adjustSlidingStart",function(){return f}),L.d(K,"alignStream",function(){return v}),L.d(K,"alignPDT",function(){return w}),L.d(K,"alignFragmentByPDTDelta",function(){return b}),L.d(K,"alignMediaPlaylistByPDT",function(){return E});var H=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts"),O=L("./src/controller/level-helper.ts");function B(l,o){for(var s=null,d=0,C=l.length;d<C;d++){var g=l[d];if(g&&g.cc===o){s=g;break}}return s}function N(l,o,s){return!!(o.details&&(s.endCC>s.startCC||l&&l.cc<s.startCC))}function R(l,o){var s=l.fragments,d=o.fragments;if(!d.length||!s.length){I.logger.log("No fragments to align");return}var C=B(s,d[0].cc);if(!C||C&&!C.startPTS){I.logger.log("No frag in previous level to align on");return}return C}function A(l,o){if(l){var s=l.start+o;l.start=l.startPTS=s,l.endPTS=s+l.duration}}function f(l,o){for(var s=o.fragments,d=0,C=s.length;d<C;d++)A(s[d],l);o.fragmentHint&&A(o.fragmentHint,l),o.alignedSliding=!0}function v(l,o,s){if(!o)return;P(l,s,o),!s.alignedSliding&&o.details&&w(s,o.details),!s.alignedSliding&&o.details&&!s.skippedSegments&&Object(O.adjustSliding)(o.details,s)}function P(l,o,s){if(N(l,s,o)){var d=R(s.details,o);d&&Object(H.isFiniteNumber)(d.start)&&(I.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),f(d.start,o))}}function w(l,o){if(!o.fragments.length||!l.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,d=l.fragments[0].programDateTime,C=(d-s)/1e3+o.fragments[0].start;C&&Object(H.isFiniteNumber)(C)&&(I.logger.log("Adjusting PTS using programDateTime delta "+(d-s)+"ms, sliding:"+C.toFixed(3)+" "+l.url+" "),f(C,l))}function b(l,o){var s=l.programDateTime;if(!s)return;var d=(s-o)/1e3;l.start=l.startPTS=d,l.endPTS=d+l.duration}function E(l,o){if(!o.fragments.length||!l.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,d=o.fragments[0].start,C=s-d*1e3;l.fragments.forEach(function(g){b(g,C)}),l.fragmentHint&&b(l.fragmentHint,C),l.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/utils/ewma.ts"),I=function(){function O(N,R,A){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=A,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new H.default(N),this.fast_=new H.default(R)}var B=O.prototype;return B.update=function(R,A){var f=this.slow_,v=this.fast_;this.slow_.halfLife!==R&&(this.slow_=new H.default(R,f.getEstimate(),f.getTotalWeight())),this.fast_.halfLife!==A&&(this.fast_=new H.default(A,v.getEstimate(),v.getTotalWeight()))},B.sample=function(R,A){R=Math.max(R,this.minDelayMs_);var f=8*A,v=R/1e3,P=f/v;this.fast_.sample(v,P),this.slow_.sample(v,P)},B.canEstimate=function(){var R=this.fast_;return R&&R.getTotalWeight()>=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},O}();K.default=I},"./src/utils/ewma.ts":function(J,K,L){"use strict";L.r(K);var H=function(){function I(B,N,R){N===void 0&&(N=0),R===void 0&&(R=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_=R}var O=I.prototype;return O.sample=function(N,R){var A=Math.pow(this.alpha_,N);this.estimate_=R*(1-A)+A*this.estimate_,this.totalWeight_+=N},O.getTotalWeight=function(){return this.totalWeight_},O.getEstimate=function(){if(this.alpha_){var N=1-Math.pow(this.alpha_,this.totalWeight_);if(N)return this.estimate_/N}return this.estimate_},I}();K.default=H},"./src/utils/fetch-loader.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"fetchSupported",function(){return b});var H=L("./src/polyfills/number.ts"),I=L("./src/loader/load-stats.ts"),O=L("./src/demux/chunk-cache.ts");function B(d,C){d.prototype=Object.create(C.prototype),d.prototype.constructor=d,v(d,C)}function N(d){var C=typeof Map=="function"?new Map:void 0;return N=function(m){if(m===null||!f(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(typeof C!="undefined"){if(C.has(m))return C.get(m);C.set(m,D)}function D(){return R(m,arguments,P(this).constructor)}return D.prototype=Object.create(m.prototype,{constructor:{value:D,enumerable:!1,writable:!0,configurable:!0}}),v(D,m)},N(d)}function R(d,C,g){return A()?R=Reflect.construct:R=function(D,T,h){var c=[null];c.push.apply(c,T);var u=Function.bind.apply(D,c),a=new u;return h&&v(a,h.prototype),a},R.apply(null,arguments)}function A(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function f(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function v(d,C){return v=Object.setPrototypeOf||function(m,D){return m.__proto__=D,m},v(d,C)}function P(d){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(g){return g.__proto__||Object.getPrototypeOf(g)},P(d)}function w(){return w=Object.assign||function(d){for(var C=1;C<arguments.length;C++){var g=arguments[C];for(var m in g)Object.prototype.hasOwnProperty.call(g,m)&&(d[m]=g[m])}return d},w.apply(this,arguments)}function b(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(d){}return!1}var E=function(){function d(g){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=g.fetchSetup||o,this.controller=new self.AbortController,this.stats=new I.LoadStats}var C=d.prototype;return C.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},C.abortInternal=function(){var m=this.response;(!m||!m.ok)&&(this.stats.aborted=!0,this.controller.abort())},C.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},C.load=function(m,D,T){var h=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var u=l(m,this.controller.signal),a=T.onProgress,x=m.responseType==="arraybuffer",y=x?"byteLength":"length";this.context=m,this.config=D,this.callbacks=T,this.request=this.fetchSetup(m,u),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){h.abortInternal(),T.onTimeout(c,m,h.response)},D.timeout),self.fetch(this.request).then(function(p){if(h.response=h.loader=p,!p.ok){var k=p.status,F=p.statusText;throw new s(F||"fetch, bad network response",k,p)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(p.headers.get("Content-Length")||"0"),a&&Object(H.isFiniteNumber)(D.highWaterMark)?h.loadProgressively(p,c,m,D.highWaterMark,a):x?p.arrayBuffer():p.text()}).then(function(p){var k=h.response;self.clearTimeout(h.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=p[y];var F={url:k.url,data:p};a&&!Object(H.isFiniteNumber)(D.highWaterMark)&&a(c,m,p,k),T.onSuccess(F,c,m,k)}).catch(function(p){if(self.clearTimeout(h.requestTimeout),c.aborted)return;var k=p.code||0;T.onError({code:k,text:p.message},m,p.details)})},C.getCacheAge=function(){var m=null;if(this.response){var D=this.response.headers.get("age");m=D?parseFloat(D):null}return m},C.loadProgressively=function(m,D,T,h,c){h===void 0&&(h=0);var u=new O.default,a=m.body.getReader(),x=function y(){return a.read().then(function(p){if(p.done)return u.dataLength&&c(D,T,u.flush(),m),Promise.resolve(new ArrayBuffer(0));var k=p.value,F=k.length;return D.loaded+=F,F<h||u.dataLength?(u.push(k),u.dataLength>=h&&c(D,T,u.flush(),m)):c(D,T,k,m),y()}).catch(function(){return Promise.reject()})};return x()},d}();function l(d,C){var g={method:"GET",mode:"cors",credentials:"same-origin",signal:C,headers:new self.Headers(w({},d.headers))};return d.rangeEnd&&g.headers.set("Range","bytes="+d.rangeStart+"-"+String(d.rangeEnd-1)),g}function o(d,C){return new self.Request(d.url,C)}var s=function(d){B(C,d);function C(g,m,D){var T;return T=d.call(this,g)||this,T.code=void 0,T.details=void 0,T.code=m,T.details=D,T}return C}(N(Error));K.default=E},"./src/utils/imsc1-ttml-parser.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"IMSC1_CODEC",function(){return f}),L.d(K,"parseIMSC1",function(){return b});var H=L("./src/utils/mp4-tools.ts"),I=L("./src/utils/vttparser.ts"),O=L("./src/utils/vttcue.ts"),B=L("./src/demux/id3.ts"),N=L("./src/utils/timescale-conversion.ts"),R=L("./src/utils/webvtt-parser.ts");function A(){return A=Object.assign||function(h){for(var c=1;c<arguments.length;c++){var u=arguments[c];for(var a in u)Object.prototype.hasOwnProperty.call(u,a)&&(h[a]=u[a])}return h},A.apply(this,arguments)}var f="stpp.ttml.im1t",v=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,P=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,w={left:"start",center:"center",right:"end",start:"start",end:"end"};function b(h,c,u,a,x){var y=Object(H.findBox)(new Uint8Array(h),["mdat"]);if(y.length===0){x(new Error("Could not parse IMSC1 mdat"));return}var p=y[0],k=Object(B.utf8ArrayToStr)(new Uint8Array(h,p.start,p.end-p.start)),F=Object(N.toTimescaleFromScale)(c,1,u);try{a(E(k,F))}catch(U){x(U)}}function E(h,c){var u=new DOMParser,a=u.parseFromString(h,"text/xml"),x=a.getElementsByTagName("tt")[0];if(!x)throw new Error("Invalid ttml");var y={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},p=Object.keys(y).reduce(function(_,M){return _[M]=x.getAttribute("ttp:"+M)||y[M],_},{}),k=x.getAttribute("xml:space")!=="preserve",F=o(l(x,"styling","style")),U=o(l(x,"layout","region")),W=l(x,"body","[begin]");return[].map.call(W,function(_){var M=s(_,k);if(!M||!_.hasAttribute("begin"))return null;var G=m(_.getAttribute("begin"),p),Y=m(_.getAttribute("dur"),p),Z=m(_.getAttribute("end"),p);if(G===null)throw g(_);if(Z===null){if(Y===null)throw g(_);Z=G+Y}var ne=new O.default(G-c,Z-c,M);ne.id=Object(R.generateCueId)(ne.startTime,ne.endTime,ne.text);var be=U[_.getAttribute("region")],me=F[_.getAttribute("style")];ne.position=10,ne.size=80;var pe=d(be,me),ue=pe.textAlign;if(ue){var fe=w[ue];fe&&(ne.lineAlign=fe),ne.align=ue}return A(ne,pe),ne}).filter(function(_){return _!==null})}function l(h,c,u){var a=h.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(u)):[]}function o(h){return h.reduce(function(c,u){var a=u.getAttribute("xml:id");return a&&(c[a]=u),c},{})}function s(h,c){return[].slice.call(h.childNodes).reduce(function(u,a,x){var y;return a.nodeName==="br"&&x?u+`
|
|
`:(y=a.childNodes)!==null&&y!==void 0&&y.length?s(a,c):c?u+a.textContent.trim().replace(/\s+/g," "):u+a.textContent},"")}function d(h,c){var u="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(x,y){var p=C(c,u,y)||C(h,u,y);return p&&(x[y]=p),x},{})}function C(h,c,u){return h.hasAttributeNS(c,u)?h.getAttributeNS(c,u):null}function g(h){return new Error("Could not parse ttml timestamp "+h)}function m(h,c){if(!h)return null;var u=Object(I.parseTimeStamp)(h);return u===null&&(v.test(h)?u=D(h,c):P.test(h)&&(u=T(h,c))),u}function D(h,c){var u=v.exec(h),a=(u[4]|0)+(u[5]|0)/c.subFrameRate;return(u[1]|0)*3600+(u[2]|0)*60+(u[3]|0)+a/c.frameRate}function T(h,c){var u=P.exec(h),a=Number(u[1]),x=u[2];switch(x){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(J,K,L){"use strict";L.r(K),L.d(K,"enableLogs",function(){return R}),L.d(K,"logger",function(){return A});var H=function(){},I={trace:H,debug:H,log:H,warn:H,info:H,error:H},O=I;function B(f){var v=self.console[f];return v?v.bind(self.console,"["+f+"] >"):H}function N(f){for(var v=arguments.length,P=new Array(v>1?v-1:0),w=1;w<v;w++)P[w-1]=arguments[w];P.forEach(function(b){O[b]=f[b]?f[b].bind(f):B(b)})}function R(f){if(self.console&&f===!0||typeof f=="object"){N(f,"debug","log","info","warn","error");try{O.log()}catch(v){O=I}}else O=I}var A=O},"./src/utils/mediakeys-helper.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"KeySystems",function(){return H}),L.d(K,"requestMediaKeySystemAccess",function(){return I});var H;(function(O){O.WIDEVINE="com.widevine.alpha",O.PLAYREADY="com.microsoft.playready"})(H||(H={}));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(J,K,L){"use strict";L.r(K),L.d(K,"getMediaSource",function(){return H});function H(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"bin2str",function(){return N}),L.d(K,"readUint16",function(){return R}),L.d(K,"readUint32",function(){return A}),L.d(K,"writeUint32",function(){return f}),L.d(K,"findBox",function(){return v}),L.d(K,"parseSegmentIndex",function(){return P}),L.d(K,"parseInitSegment",function(){return w}),L.d(K,"getStartDTS",function(){return b}),L.d(K,"getDuration",function(){return E}),L.d(K,"computeRawDurationFromSamples",function(){return l}),L.d(K,"offsetStartDTS",function(){return o}),L.d(K,"segmentValidRange",function(){return s}),L.d(K,"appendUint8Array",function(){return d});var H=L("./src/utils/typed-array.ts"),I=L("./src/loader/fragment.ts"),O=Math.pow(2,32)-1,B=[].push;function N(C){return String.fromCharCode.apply(null,C)}function R(C,g){"data"in C&&(g+=C.start,C=C.data);var m=C[g]<<8|C[g+1];return m<0?65536+m:m}function A(C,g){"data"in C&&(g+=C.start,C=C.data);var m=C[g]<<24|C[g+1]<<16|C[g+2]<<8|C[g+3];return m<0?4294967296+m:m}function f(C,g,m){"data"in C&&(g+=C.start,C=C.data),C[g]=m>>24,C[g+1]=m>>16&255,C[g+2]=m>>8&255,C[g+3]=m&255}function v(C,g){var m=[];if(!g.length)return m;var D,T,h;"data"in C?(D=C.data,T=C.start,h=C.end):(D=C,T=0,h=D.byteLength);for(var c=T;c<h;){var u=A(D,c),a=N(D.subarray(c+4,c+8)),x=u>1?c+u:h;if(a===g[0])if(g.length===1)m.push({data:D,start:c+8,end:x});else{var y=v({data:D,start:c+8,end:x},g.slice(1));y.length&&B.apply(m,y)}c=x}return m}function P(C){var g=v(C,["moov"]),m=g[0],D=m?m.end:null,T=v(C,["sidx"]);if(!T||!T[0])return null;var h=[],c=T[0],u=c.data[0],a=u===0?8:16,x=A(c,a);a+=4;var y=0,p=0;u===0?a+=8:a+=16,a+=2;var k=c.end+p,F=R(c,a);a+=2;for(var U=0;U<F;U++){var W=a,_=A(c,W);W+=4;var M=_&2147483647,G=(_&2147483648)>>>31;if(G===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Y=A(c,W);W+=4,h.push({referenceSize:M,subsegmentDuration:Y,info:{duration:Y/x,start:k,end:k+M-1}}),k+=M,W+=4,a=W}return{earliestPresentationTime:y,timescale:x,version:u,referencesCount:F,references:h,moovEndOffset:D}}function w(C){for(var g=[],m=v(C,["moov","trak"]),D=0;D<m.length;D++){var T=m[D],h=v(T,["tkhd"])[0];if(h){var c=h.data[h.start],u=c===0?12:20,a=A(h,u),x=v(T,["mdia","mdhd"])[0];if(x){c=x.data[x.start],u=c===0?12:20;var y=A(x,u),p=v(T,["mdia","hdlr"])[0];if(p){var k=N(p.data.subarray(p.start+8,p.start+12)),F={soun:I.ElementaryStreamTypes.AUDIO,vide:I.ElementaryStreamTypes.VIDEO}[k];if(F){var U=v(T,["mdia","minf","stbl","stsd"])[0],W=void 0;U&&(W=N(U.data.subarray(U.start+12,U.start+16))),g[a]={timescale:y,type:F},g[F]={timescale:y,id:a,codec:W}}}}}}var _=v(C,["moov","mvex","trex"]);return _.forEach(function(M){var G=A(M,4),Y=g[G];Y&&(Y.default={duration:A(M,12),flags:A(M,20)})}),g}function b(C,g){return v(g,["moof","traf"]).reduce(function(m,D){var T=v(D,["tfdt"])[0],h=T.data[T.start],c=v(D,["tfhd"]).reduce(function(u,a){var x=A(a,4),y=C[x];if(y){var p=A(T,4);h===1&&(p*=Math.pow(2,32),p+=A(T,8));var k=y.timescale||9e4,F=p/k;if(isFinite(F)&&(u===null||F<u))return F}return u},null);return c!==null&&isFinite(c)&&(m===null||c<m)?c:m},null)||0}function E(C,g){for(var m=0,D=0,T=0,h=v(C,["moof","traf"]),c=0;c<h.length;c++){var u=h[c],a=v(u,["tfhd"])[0],x=A(a,4),y=g[x];if(!y)continue;var p=y.default,k=A(a,0)|(p==null?void 0:p.flags),F=p==null?void 0:p.duration;k&8&&(k&2?F=A(a,12):F=A(a,8));for(var U=y.timescale||9e4,W=v(u,["trun"]),_=0;_<W.length;_++){if(F){var M=A(W[_],4);m=F*M}else m=l(W[_]);y.type===I.ElementaryStreamTypes.VIDEO?D+=m/U:y.type===I.ElementaryStreamTypes.AUDIO&&(T+=m/U)}}if(D===0&&T===0){var G=P(C);if(G!=null&&G.references)return G.references.reduce(function(Y,Z){return Y+Z.info.duration||0},0)}return D||T}function l(C){var g=A(C,0),m=8;g&1&&(m+=4),g&4&&(m+=4);for(var D=0,T=A(C,4),h=0;h<T;h++){if(g&256){var c=A(C,m);D+=c,m+=4}g&512&&(m+=4),g&1024&&(m+=4),g&2048&&(m+=4)}return D}function o(C,g,m){v(g,["moof","traf"]).forEach(function(D){v(D,["tfhd"]).forEach(function(T){var h=A(T,4),c=C[h];if(!c)return;var u=c.timescale||9e4;v(D,["tfdt"]).forEach(function(a){var x=a.data[a.start],y=A(a,4);if(x===0)f(a,4,y-m*u);else{y*=Math.pow(2,32),y+=A(a,8),y-=m*u,y=Math.max(y,0);var p=Math.floor(y/(O+1)),k=Math.floor(y%(O+1));f(a,4,p),f(a,8,k)}})})})}function s(C){var g={valid:null,remainder:null},m=v(C,["moof"]);if(m){if(m.length<2)return g.remainder=C,g}else return g;var D=m[m.length-1];return g.valid=Object(H.sliceUint8)(C,0,D.start-8),g.remainder=Object(H.sliceUint8)(C,D.start-8),g}function d(C,g){var m=new Uint8Array(C.length+g.length);return m.set(C),m.set(g,C.length),m}},"./src/utils/output-filter.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return H});var H=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 O=I.prototype;return O.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},O.newCue=function(N,R,A){(this.startTime===null||this.startTime>N)&&(this.startTime=N),this.endTime=R,this.screen=A,this.timelineController.createCaptionsTrack(this.trackName)},O.reset=function(){this.cueRanges=[]},I}()},"./src/utils/texttrack-utils.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"sendAddTrackEvent",function(){return I}),L.d(K,"addCueToTrack",function(){return O}),L.d(K,"clearCurrentCues",function(){return B}),L.d(K,"removeCuesInRange",function(){return N}),L.d(K,"getCuesInRange",function(){return A});var H=L("./src/utils/logger.ts");function I(f,v){var P;try{P=new Event("addtrack")}catch(w){P=document.createEvent("Event"),P.initEvent("addtrack",!1,!1)}P.track=f,v.dispatchEvent(P)}function O(f,v){var P=f.mode;if(P==="disabled"&&(f.mode="hidden"),f.cues&&!f.cues.getCueById(v.id))try{if(f.addCue(v),!f.cues.getCueById(v.id))throw new Error("addCue is failed for: "+v)}catch(b){H.logger.debug("[texttrack-utils]: "+b);var w=new self.TextTrackCue(v.startTime,v.endTime,v.text);w.id=v.id,f.addCue(w)}P==="disabled"&&(f.mode=P)}function B(f){var v=f.mode;if(v==="disabled"&&(f.mode="hidden"),f.cues)for(var P=f.cues.length;P--;)f.removeCue(f.cues[P]);v==="disabled"&&(f.mode=v)}function N(f,v,P){var w=f.mode;if(w==="disabled"&&(f.mode="hidden"),f.cues&&f.cues.length>0)for(var b=A(f.cues,v,P),E=0;E<b.length;E++)f.removeCue(b[E]);w==="disabled"&&(f.mode=w)}function R(f,v){if(v<f[0].startTime)return 0;var P=f.length-1;if(v>f[P].endTime)return-1;for(var w=0,b=P;w<=b;){var E=Math.floor((b+w)/2);if(v<f[E].startTime)b=E-1;else if(v>f[E].startTime&&w<P)w=E+1;else return E}return f[w].startTime-v<v-f[b].startTime?w:b}function A(f,v,P){var w=[],b=R(f,v);if(b>-1)for(var E=b,l=f.length;E<l;E++){var o=f[E];if(o.startTime>=v&&o.endTime<=P)w.push(o);else if(o.startTime>P)return w}return w}},"./src/utils/time-ranges.ts":function(J,K,L){"use strict";L.r(K);var H={toString:function(O){for(var B="",N=O.length,R=0;R<N;R++)B+="["+O.start(R).toFixed(3)+","+O.end(R).toFixed(3)+"]";return B}};K.default=H},"./src/utils/timescale-conversion.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"toTimescaleFromBase",function(){return I}),L.d(K,"toTimescaleFromScale",function(){return O}),L.d(K,"toMsFromMpegTsClock",function(){return B}),L.d(K,"toMpegTsClockFromTimescale",function(){return N});var H=9e4;function I(R,A,f,v){f===void 0&&(f=1),v===void 0&&(v=!1);var P=R*A*f;return v?Math.round(P):P}function O(R,A,f,v){return f===void 0&&(f=1),v===void 0&&(v=!1),I(R,A,1/f,v)}function B(R,A){return A===void 0&&(A=!1),I(R,1e3,1/H,A)}function N(R,A){return A===void 0&&(A=1),I(R,H,1/A)}},"./src/utils/typed-array.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"sliceUint8",function(){return H});function H(I,O,B){return Uint8Array.prototype.slice?I.slice(O,B):new Uint8Array(Array.prototype.slice.call(I,O,B))}},"./src/utils/vttcue.ts":function(J,K,L){"use strict";L.r(K),K.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var H=["","lr","rl"],I=["start","middle","end","left","right"];function O(f,v){if(typeof v!="string")return!1;if(!Array.isArray(f))return!1;var P=v.toLowerCase();return~f.indexOf(P)?P:!1}function B(f){return O(H,f)}function N(f){return O(I,f)}function R(f){for(var v=arguments.length,P=new Array(v>1?v-1:0),w=1;w<v;w++)P[w-1]=arguments[w];for(var b=1;b<arguments.length;b++){var E=arguments[b];for(var l in E)f[l]=E[l]}return f}function A(f,v,P){var w=this,b={enumerable:!0};w.hasBeenReset=!1;var E="",l=!1,o=f,s=v,d=P,C=null,g="",m=!0,D="auto",T="start",h=50,c="middle",u=50,a="middle";Object.defineProperty(w,"id",R({},b,{get:function(){return E},set:function(y){E=""+y}})),Object.defineProperty(w,"pauseOnExit",R({},b,{get:function(){return l},set:function(y){l=!!y}})),Object.defineProperty(w,"startTime",R({},b,{get:function(){return o},set:function(y){if(typeof y!="number")throw new TypeError("Start time must be set to a number.");o=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"endTime",R({},b,{get:function(){return s},set:function(y){if(typeof y!="number")throw new TypeError("End time must be set to a number.");s=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"text",R({},b,{get:function(){return d},set:function(y){d=""+y,this.hasBeenReset=!0}})),Object.defineProperty(w,"region",R({},b,{get:function(){return C},set:function(y){C=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"vertical",R({},b,{get:function(){return g},set:function(y){var p=B(y);if(p===!1)throw new SyntaxError("An invalid or illegal string was specified.");g=p,this.hasBeenReset=!0}})),Object.defineProperty(w,"snapToLines",R({},b,{get:function(){return m},set:function(y){m=!!y,this.hasBeenReset=!0}})),Object.defineProperty(w,"line",R({},b,{get:function(){return D},set:function(y){if(typeof y!="number"&&y!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");D=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"lineAlign",R({},b,{get:function(){return T},set:function(y){var p=N(y);if(!p)throw new SyntaxError("An invalid or illegal string was specified.");T=p,this.hasBeenReset=!0}})),Object.defineProperty(w,"position",R({},b,{get:function(){return h},set:function(y){if(y<0||y>100)throw new Error("Position must be between 0 and 100.");h=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"positionAlign",R({},b,{get:function(){return c},set:function(y){var p=N(y);if(!p)throw new SyntaxError("An invalid or illegal string was specified.");c=p,this.hasBeenReset=!0}})),Object.defineProperty(w,"size",R({},b,{get:function(){return u},set:function(y){if(y<0||y>100)throw new Error("Size must be between 0 and 100.");u=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"align",R({},b,{get:function(){return a},set:function(y){var p=N(y);if(!p)throw new SyntaxError("An invalid or illegal string was specified.");a=p,this.hasBeenReset=!0}})),w.displayState=void 0}return A.prototype.getCueAsHTML=function(){var f=self.WebVTT;return f.convertCueToDOMTree(self,this.text)},A}()},"./src/utils/vttparser.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"parseTimeStamp",function(){return O}),L.d(K,"fixLineBreaks",function(){return v}),L.d(K,"VTTParser",function(){return P});var H=L("./src/utils/vttcue.ts"),I=function(){function w(){}var b=w.prototype;return b.decode=function(l,o){if(!l)return"";if(typeof l!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(l))},w}();function O(w){function b(l,o,s,d){return(l|0)*3600+(o|0)*60+(s|0)+parseFloat(d||0)}var E=w.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return E?parseFloat(E[2])>59?b(E[2],E[3],0,E[4]):b(E[1],E[2],E[3],E[4]):null}var B=function(){function w(){this.values=Object.create(null)}var b=w.prototype;return b.set=function(l,o){!this.get(l)&&o!==""&&(this.values[l]=o)},b.get=function(l,o,s){return s?this.has(l)?this.values[l]:o[s]:this.has(l)?this.values[l]:o},b.has=function(l){return l in this.values},b.alt=function(l,o,s){for(var d=0;d<s.length;++d)if(o===s[d]){this.set(l,o);break}},b.integer=function(l,o){/^-?\d+$/.test(o)&&this.set(l,parseInt(o,10))},b.percent=function(l,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var s=parseFloat(o);if(s>=0&&s<=100)return this.set(l,s),!0}return!1},w}();function N(w,b,E,l){var o=l?w.split(l):[w];for(var s in o){if(typeof o[s]!="string")continue;var d=o[s].split(E);if(d.length!==2)continue;var C=d[0],g=d[1];b(C,g)}}var R=new H.default(0,0,""),A=R.align==="middle"?"middle":"center";function f(w,b,E){var l=w;function o(){var C=O(w);if(C===null)throw new Error("Malformed timestamp: "+l);return w=w.replace(/^[^\sa-zA-Z-]+/,""),C}function s(C,g){var m=new B;N(C,function(h,c){var u;switch(h){case"region":for(var a=E.length-1;a>=0;a--)if(E[a].id===c){m.set(h,E[a].region);break}break;case"vertical":m.alt(h,c,["rl","lr"]);break;case"line":u=c.split(","),m.integer(h,u[0]),m.percent(h,u[0])&&m.set("snapToLines",!1),m.alt(h,u[0],["auto"]),u.length===2&&m.alt("lineAlign",u[1],["start",A,"end"]);break;case"position":u=c.split(","),m.percent(h,u[0]),u.length===2&&m.alt("positionAlign",u[1],["start",A,"end","line-left","line-right","auto"]);break;case"size":m.percent(h,c);break;case"align":m.alt(h,c,["start",A,"end","left","right"]);break}},/:/,/\s/),g.region=m.get("region",null),g.vertical=m.get("vertical","");var D=m.get("line","auto");D==="auto"&&R.line===-1&&(D=-1),g.line=D,g.lineAlign=m.get("lineAlign","start"),g.snapToLines=m.get("snapToLines",!0),g.size=m.get("size",100),g.align=m.get("align",A);var T=m.get("position","auto");T==="auto"&&R.position===50&&(T=g.align==="start"||g.align==="left"?0:g.align==="end"||g.align==="right"?100:50),g.position=T}function d(){w=w.replace(/^\s+/,"")}if(d(),b.startTime=o(),d(),w.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+l);w=w.substr(3),d(),b.endTime=o(),d(),s(w,b)}function v(w){return w.replace(/<br(?: \/)?>/gi,`
|
|
`)}var P=function(){function w(){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 b=w.prototype;return b.parse=function(l){var o=this;l&&(o.buffer+=o.decoder.decode(l,{stream:!0}));function s(){var T=o.buffer,h=0;for(T=v(T);h<T.length&&T[h]!=="\r"&&T[h]!==`
|
|
`;)++h;var c=T.substr(0,h);return T[h]==="\r"&&++h,T[h]===`
|
|
`&&++h,o.buffer=T.substr(h),c}function d(T){N(T,function(h,c){},/:/)}try{var C="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;C=s();var g=C.match(/^()?WEBVTT([ \t].*)?$/);if(!g||!g[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var m=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;m?m=!1:C=s();switch(o.state){case"HEADER":/:/.test(C)?d(C):C||(o.state="ID");continue;case"NOTE":C||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(C)){o.state="NOTE";break}if(!C)continue;if(o.cue=new H.default(0,0,""),o.state="CUE",C.indexOf("-->")===-1){o.cue.id=C;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{f(C,o.cue,o.regionList)}catch(T){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var D=C.indexOf("-->")!==-1;if(!C||D&&(m=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
|
|
`),o.cue.text+=C}continue;case"BADCUE":C||(o.state="ID")}}}catch(T){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},b.flush=function(){var l=this;try{if((l.cue||l.state==="HEADER")&&(l.buffer+=`
|
|
|
|
`,l.parse()),l.state==="INITIAL"||l.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){l.onparsingerror&&l.onparsingerror(o)}return l.onflush&&l.onflush(),this},w}()},"./src/utils/webvtt-parser.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"generateCueId",function(){return P}),L.d(K,"parseWebVTT",function(){return b});var H=L("./src/polyfills/number.ts"),I=L("./src/utils/vttparser.ts"),O=L("./src/demux/id3.ts"),B=L("./src/utils/timescale-conversion.ts"),N=L("./src/remux/mp4-remuxer.ts"),R=/\r\n|\n\r|\n|\r/g,A=function(l,o,s){return s===void 0&&(s=0),l.substr(s,o.length)===o},f=function(l){var o=parseInt(l.substr(-3)),s=parseInt(l.substr(-6,2)),d=parseInt(l.substr(-9,2)),C=l.length>9?parseInt(l.substr(0,l.indexOf(":"))):0;if(!Object(H.isFiniteNumber)(o)||!Object(H.isFiniteNumber)(s)||!Object(H.isFiniteNumber)(d)||!Object(H.isFiniteNumber)(C))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+l);return o+=1e3*s,o+=60*1e3*d,o+=60*60*1e3*C,o},v=function(l){for(var o=5381,s=l.length;s;)o=o*33^l.charCodeAt(--s);return(o>>>0).toString()};function P(E,l,o){return v(E.toString())+v(l.toString())+v(o)}var w=function(l,o,s){var d=l[o],C=l[d.prevCC];if(!C||!C.new&&d.new){l.ccOffset=l.presentationOffset=d.start,d.new=!1;return}for(;(g=C)!==null&&g!==void 0&&g.new;){var g;l.ccOffset+=d.start-C.start,d.new=!1,d=C,C=l[d.prevCC]}l.presentationOffset=s};function b(E,l,o,s,d,C,g,m){var D=new I.VTTParser,T=Object(O.utf8ArrayToStr)(new Uint8Array(E)).trim().replace(R,`
|
|
`).split(`
|
|
`),h=[],c=Object(B.toMpegTsClockFromTimescale)(l,o),u="00:00.000",a=0,x=0,y,p=!0,k=!1;D.oncue=function(F){var U=s[d],W=s.ccOffset,_=(a-c)/9e4;if(U!=null&&U.new&&(x!==void 0?W=s.ccOffset=U.start:w(s,d,_)),_&&(W=_-s.presentationOffset),k){var M=F.endTime-F.startTime,G=Object(N.normalizePts)((F.startTime+W-x)*9e4,C*9e4)/9e4;F.startTime=G,F.endTime=G+M}var Y=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(Y)),F.id||(F.id=P(F.startTime,F.endTime,Y)),F.endTime>0&&h.push(F)},D.onparsingerror=function(F){y=F},D.onflush=function(){if(y){m(y);return}g(h)},T.forEach(function(F){if(p)if(A(F,"X-TIMESTAMP-MAP=")){p=!1,k=!0,F.substr(16).split(",").forEach(function(U){A(U,"LOCAL:")?u=U.substr(6):A(U,"MPEGTS:")&&(a=parseInt(U.substr(7)))});try{x=f(u)/1e3}catch(U){k=!1,y=U}return}else F===""&&(p=!1);D.parse(F+`
|
|
`)}),D.flush()}},"./src/utils/xhr-loader.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/utils/logger.ts"),I=L("./src/loader/load-stats.ts"),O=/^age:\s*[\d.]+\s*$/m,B=function(){function N(A){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=A?A.xhrSetup:null,this.stats=new I.LoadStats,this.retryDelay=0}var R=N.prototype;return R.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},R.abortInternal=function(){var f=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),f&&(f.onreadystatechange=null,f.onprogress=null,f.readyState!==4&&(this.stats.aborted=!0,f.abort()))},R.abort=function(){var f;this.abortInternal(),(f=this.callbacks)!==null&&f!==void 0&&f.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},R.load=function(f,v,P){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=f,this.config=v,this.callbacks=P,this.retryDelay=v.retryDelay,this.loadInternal()},R.loadInternal=function(){var f=this.config,v=this.context;if(!f)return;var P=this.loader=new self.XMLHttpRequest,w=this.stats;w.loading.first=0,w.loaded=0;var b=this.xhrSetup;try{if(b)try{b(P,v.url)}catch(o){P.open("GET",v.url,!0),b(P,v.url)}P.readyState||P.open("GET",v.url,!0);var E=this.context.headers;if(E)for(var l in E)P.setRequestHeader(l,E[l])}catch(o){this.callbacks.onError({code:P.status,text:o.message},v,P);return}v.rangeEnd&&P.setRequestHeader("Range","bytes="+v.rangeStart+"-"+(v.rangeEnd-1)),P.onreadystatechange=this.readystatechange.bind(this),P.onprogress=this.loadprogress.bind(this),P.responseType=v.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),f.timeout),P.send()},R.readystatechange=function(){var f=this.context,v=this.loader,P=this.stats;if(!f||!v)return;var w=v.readyState,b=this.config;if(P.aborted)return;if(w>=2)if(self.clearTimeout(this.requestTimeout),P.loading.first===0&&(P.loading.first=Math.max(self.performance.now(),P.loading.start)),w===4){v.onreadystatechange=null,v.onprogress=null;var E=v.status;if(E>=200&&E<300){P.loading.end=Math.max(self.performance.now(),P.loading.first);var l,o;if(f.responseType==="arraybuffer"?(l=v.response,o=l.byteLength):(l=v.responseText,o=l.length),P.loaded=P.total=o,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(P,f,l,v),!this.callbacks)return;var d={url:v.responseURL,data:l};this.callbacks.onSuccess(d,P,f,v)}else P.retry>=b.maxRetry||E>=400&&E<499?(H.logger.error(E+" while loading "+f.url),this.callbacks.onError({code:E,text:v.statusText},f,v)):(H.logger.warn(E+" while loading "+f.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,b.maxRetryDelay),P.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),b.timeout)},R.loadtimeout=function(){H.logger.warn("timeout while loading "+this.context.url);var f=this.callbacks;f&&(this.abortInternal(),f.onTimeout(this.stats,this.context,this.loader))},R.loadprogress=function(f){var v=this.stats;v.loaded=f.loaded,f.lengthComputable&&(v.total=f.total)},R.getCacheAge=function(){var f=null;if(this.loader&&O.test(this.loader.getAllResponseHeaders())){var v=this.loader.getResponseHeader("age");f=v?parseFloat(v):null}return f},N}();K.default=B}}).default})},wU8J:function(Ze,Ke){function te(){this.buffer=new Array,this.length=0}te.prototype={get:function(J){var K=Math.floor(J/8);return(this.buffer[K]>>>7-J%8&1)==1},put:function(J,K){for(var L=0;L<K;L++)this.putBit((J>>>K-L-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(J){var K=Math.floor(this.length/8);this.buffer.length<=K&&this.buffer.push(0),J&&(this.buffer[K]|=128>>>this.length%8),this.length++}},Ze.exports=te},wzkS:function(Ze,Ke,te){"use strict";te.d(Ke,"c",function(){return I}),te.d(Ke,"b",function(){return O}),te.d(Ke,"d",function(){return B}),te.d(Ke,"a",function(){return R}),te.d(Ke,"e",function(){return A});var J=te("9og8"),K=te("WmNS"),L=te.n(K),H=te("ErOA");function I(f){return Object(H.c)("libraries/".concat(f,".json"))}function O(){return Object(H.c)("library_tags.json")}function B(f){return N.apply(this,arguments)}function N(){return N=Object(J.a)(L.a.mark(function f(v){var P;return L.a.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return b.next=2,Object(H.b)("attachments/".concat(v,".json"));case 2:return P=b.sent,b.abrupt("return",P.status===0);case 4:case"end":return b.stop()}},f)})),N.apply(this,arguments)}function R(f){return Object(H.f)("libraries.json",f)}function A(f,v){return Object(H.g)("libraries/".concat(f,".json"),v)}}}]);
|