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.
NewEduCoderBuild/p__Messages__Detail.8462410...

139 lines
722 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[155,5,7],{"+NIl":function(lt,Je,Q){(function(ee){ee(Q("VrN/"))})(function(ee){"use strict";ee.defineMode("stex",function(G,D){"use strict";function W(C,y){C.cmdState.push(y)}function R(C){return C.cmdState.length>0?C.cmdState[C.cmdState.length-1]:null}function P(C){var y=C.cmdState.pop();y&&y.closeBracket()}function N(C){for(var y=C.cmdState,g=y.length-1;g>=0;g--){var l=y[g];if(l.name=="DEFAULT")continue;return l}return{styleIdentifier:function(){return null}}}function k(C,y,g){return function(){this.name=C,this.bracketNo=0,this.style=y,this.styles=g,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var A={};A.importmodule=k("importmodule","tag",["string","builtin"]),A.documentclass=k("documentclass","tag",["","atom"]),A.usepackage=k("usepackage","tag",["atom"]),A.begin=k("begin","tag",["atom"]),A.end=k("end","tag",["atom"]),A.label=k("label","tag",["atom"]),A.ref=k("ref","tag",["atom"]),A.eqref=k("eqref","tag",["atom"]),A.cite=k("cite","tag",["atom"]),A.bibitem=k("bibitem","tag",["atom"]),A.Bibitem=k("Bibitem","tag",["atom"]),A.RBibitem=k("RBibitem","tag",["atom"]),A.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function O(C,y){C.f=y}function E(C,y){var g;if(C.match(/^\\[a-zA-Z@]+/)){var l=C.current().slice(1);return g=A.hasOwnProperty(l)?A[l]:A.DEFAULT,g=new g,W(y,g),O(y,_),g.style}if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/\\]/))return"tag";if(C.match("\\["))return O(y,function(s,d){return T(s,d,"\\]")}),"keyword";if(C.match("\\("))return O(y,function(s,d){return T(s,d,"\\)")}),"keyword";if(C.match("$$"))return O(y,function(s,d){return T(s,d,"$$")}),"keyword";if(C.match("$"))return O(y,function(s,d){return T(s,d,"$")}),"keyword";var o=C.next();if(o=="%")return C.skipToEnd(),"comment";if(o=="}"||o=="]"){if(g=R(y),g)g.closeBracket(o),O(y,_);else return"error";return"bracket"}else return o=="{"||o=="["?(g=A.DEFAULT,g=new g,W(y,g),"bracket"):/\d/.test(o)?(C.eatWhile(/[\w.%]/),"atom"):(C.eatWhile(/[\w\-_]/),g=N(y),g.name=="begin"&&(g.argument=C.current()),g.styleIdentifier())}function T(C,y,g){if(C.eatSpace())return null;if(g&&C.match(g))return O(y,E),"keyword";if(C.match(/^\\[a-zA-Z@]+/))return"tag";if(C.match(/^[a-zA-Z]+/))return"variable-2";if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/]/))return"tag";if(C.match(/^[\^_&]/))return"tag";if(C.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(C.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var l=C.next();return l=="{"||l=="}"||l=="["||l=="]"||l=="("||l==")"?"bracket":l=="%"?(C.skipToEnd(),"comment"):"error"}function _(C,y){var g=C.peek(),l;return g=="{"||g=="["?(l=R(y),l.openBracket(g),C.eat(g),O(y,E),"bracket"):/[ \t\r]/.test(g)?(C.eat(g),null):(O(y,E),P(y),E(C,y))}return{startState:function(){var C=D.inMathMode?function(y,g){return T(y,g)}:E;return{cmdState:[],f:C}},copyState:function(C){return{cmdState:C.cmdState.slice(),f:C.f}},token:function(C,y){return y.f(C,y)},blankLine:function(C){C.f=E,C.cmdState.length=0},lineComment:"%"}}),ee.defineMIME("text/x-stex","stex"),ee.defineMIME("text/x-latex","stex")})},"19Vz":function(lt,Je,Q){(function(ee){ee(Q("VrN/"))})(function(ee){ee.defineOption("placeholder","",function(k,A,O){var E=O&&O!=ee.Init;if(A&&!E)k.on("blur",R),k.on("change",P),k.on("swapDoc",P),ee.on(k.getInputField(),"compositionupdate",k.state.placeholderCompose=function(){W(k)}),P(k);else if(!A&&E){k.off("blur",R),k.off("change",P),k.off("swapDoc",P),ee.off(k.getInputField(),"compositionupdate",k.state.placeholderCompose),G(k);var T=k.getWrapperElement();T.className=T.className.replace(" CodeMirror-empty","")}A&&!k.hasFocus()&&R(k)});function G(k){k.state.placeholder&&(k.state.placeholder.parentNode.removeChild(k.state.placeholder),k.state.placeholder=null)}function D(k){G(k);var A=k.state.placeholder=document.createElement("pre");A.style.cssText="height: 0; overflow: visible",A.style.direction=k.getOption("direction"),A.className="CodeMirror-placeholder CodeMirror-line-like";var O=k.getOption("placeholder");typeof O=="string"&&(O=document.createTextNode(O)),A.appendChild(O),k.display.lineSpace.insertBefore(A,k.display.lineSpace.firstChild)}function W(k){setTimeout(function(){var A=!1,O=k.getInputField();O.nodeName=="TEXTAREA"?A=!O.value:k.lineCount()==1&&(A=!/[^\u200b]/.test(O.querySelector(".CodeMirror-line").textContent)),A?D(k):G(k)},20)}function R(k){N(k)&&D(k)}function P(k){var A=k.getWrapperElement(),O=N(k);A.className=A.className.replace(" CodeMirror-empty","")+(O?" CodeMirror-empty":""),O?D(k):G(k)}function N(k){return k.lineCount()===1&&k.getLine(0)===""}})},"1eCo":function(lt,Je,Q){(function(ee){ee(Q("VrN/"))})(function(ee){"use strict";var G={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},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ee.defineMode("xml",function(W,R){var P=W.indentUnit,N={},k=R.htmlMode?G:D;for(var A in k)N[A]=k[A];for(var A in R)N[A]=R[A];var O,E;function T(a,v){function p(F){return v.tokenize=F,F(a,v)}var b=a.next();if(b=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?p(y("atom","]]>")):null:a.match("--")?p(y("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),p(g(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),v.tokenize=y("meta","?>"),"meta"):(O=a.eat("/")?"closeTag":"openTag",v.tokenize=_,"tag bracket");if(b=="&"){var M;return a.eat("#")?a.eat("x")?M=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):M=a.eatWhile(/[\d]/)&&a.eat(";"):M=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),M?"atom":"error"}else return a.eatWhile(/[^&<]/),null}T.isInText=!0;function _(a,v){var p=a.next();if(p==">"||p=="/"&&a.eat(">"))return v.tokenize=T,O=p==">"?"endTag":"selfcloseTag","tag bracket";if(p=="=")return O="equals",null;if(p=="<"){v.tokenize=T,v.state=d,v.tagName=v.tagStart=null;var b=v.tokenize(a,v);return b?b+" tag error":"tag error"}else return/[\'\"]/.test(p)?(v.tokenize=C(p),v.stringStartCol=a.column(),v.tokenize(a,v)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function C(a){var v=function(p,b){for(;!p.eol();)if(p.next()==a){b.tokenize=_;break}return"string"};return v.isInAttribute=!0,v}function y(a,v){return function(p,b){for(;!p.eol();){if(p.match(v)){b.tokenize=T;break}p.next()}return a}}function g(a){return function(v,p){for(var b;(b=v.next())!=null;){if(b=="<")return p.tokenize=g(a+1),p.tokenize(v,p);if(b==">")if(a==1){p.tokenize=T;break}else return p.tokenize=g(a-1),p.tokenize(v,p)}return"meta"}}function l(a,v,p){this.prev=a.context,this.tagName=v,this.indent=a.indented,this.startOfLine=p,(N.doNotIndent.hasOwnProperty(v)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function s(a,v){for(var p;;){if(!a.context)return;if(p=a.context.tagName,!N.contextGrabbers.hasOwnProperty(p)||!N.contextGrabbers[p].hasOwnProperty(v))return;o(a)}}function d(a,v,p){return a=="openTag"?(p.tagStart=v.column(),w):a=="closeTag"?f:d}function w(a,v,p){return a=="word"?(p.tagName=v.current(),E="tag",x):N.allowMissingTagName&&a=="endTag"?(E="tag bracket",x(a,v,p)):(E="error",w)}function f(a,v,p){if(a=="word"){var b=v.current();return p.context&&p.context.tagName!=b&&N.implicitlyClosed.hasOwnProperty(p.context.tagName)&&o(p),p.context&&p.context.tagName==b||N.matchClosing===!1?(E="tag",m):(E="tag error",L)}else return N.allowMissingTagName&&a=="endTag"?(E="tag bracket",m(a,v,p)):(E="error",L)}function m(a,v,p){return a!="endTag"?(E="error",m):(o(p),d)}function L(a,v,p){return E="error",m(a,v,p)}function x(a,v,p){if(a=="word")return E="attribute",h;if(a=="endTag"||a=="selfcloseTag"){var b=p.tagName,M=p.tagStart;return p.tagName=p.tagStart=null,a=="selfcloseTag"||N.autoSelfClosers.hasOwnProperty(b)?s(p,b):(s(p,b),p.context=new l(p,b,M==p.indented)),d}return E="error",x}function h(a,v,p){return a=="equals"?c:(N.allowMissing||(E="error"),x(a,v,p))}function c(a,v,p){return a=="string"?u:a=="word"&&N.allowUnquoted?(E="string",x):(E="error",x(a,v,p))}function u(a,v,p){return a=="string"?u:x(a,v,p)}return{startState:function(a){var v={tokenize:T,state:d,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(v.baseIndent=a),v},token:function(a,v){if(!v.tagName&&a.sol()&&(v.indented=a.indentation()),a.eatSpace())return null;O=null;var p=v.tokenize(a,v);return(p||O)&&p!="comment"&&(E=null,v.state=v.state(O||p,a,v),E&&(p=E=="error"?p+" error":E)),p},indent:function(a,v,p){var b=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+P;if(b&&b.noIndent)return ee.Pass;if(a.tokenize!=_&&a.tokenize!=T)return p?p.match(/^(\s*)/)[0].length:0;if(a.tagName)return N.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+P*(N.multilineTagIndentFactor||1);if(N.alignCDATA&&/<!\[CDATA\[/.test(v))return 0;var M=v&&/^<(\/)?([\w_:\.-]*)/.exec(v);if(M&&M[1])for(;b;)if(b.tagName==M[2]){b=b.prev;break}else if(N.implicitlyClosed.hasOwnProperty(b.tagName))b=b.prev;else break;else if(M)for(;b;){var F=N.contextGrabbers[b.tagName];if(F&&F.hasOwnProperty(M[2]))b=b.prev;else break}for(;b&&b.prev&&!b.startOfLine;)b=b.prev;return b?b.indent+P:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:N.htmlMode?"html":"xml",helperType:N.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=x)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var v=[],p=a.context;p;p=p.prev)p.tagName&&v.push(p.tagName);return v.reverse()}}}),ee.defineMIME("text/xml","xml"),ee.defineMIME("application/xml","xml"),ee.mimeModes.hasOwnProperty("text/html")||ee.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"30zm":function(lt,Je,Q){"use strict";var ee=Q("jCWc"),G=Q("kPKH"),D=Q("k1fw"),W=Q("tJVT"),R=Q("PpiC"),P=Q("B9cy"),N=Q("Ol7k"),k=Q("lUTK"),A=Q("BvKs"),O=Q("cDcd"),E=Q.n(O),T=Q("Ty5D"),_=Q("55Ip"),C=Q("9kvl"),y=Q("m3rI"),g=Q("kzJb"),l=Q.n(g),o=A.a.SubMenu,s=N.a.Sider,d=N.a.Content,w=function(m){var L=m.messages,x=m.globalSetting,h=m.loading,c=m.user,u=m.dispatch,a=Object(R.a)(m,["messages","globalSetting","loading","user","dispatch"]),v=Object(T.i)(),p=c.userInfo,b=Object(T.h)(),M=L.tidingsList,F=L.privateMessage,H=L.unreadInfo,X=Object(O.useState)({per_page:10,page:1}),B=Object(W.a)(X,2),U=B[0],z=B[1];Object(O.useEffect)(function(){Z()},[v.userId]);var Z=function(){u({type:"messages/unreadMessageInfo",payload:Object(D.a)(Object(D.a)({},U),v)})};return E.a.createElement(G.a,{flex:"264px"},E.a.createElement("aside",{className:l.a.userInfo},E.a.createElement("img",{className:"mt40",src:y.a.IMG_SERVER+"/images/"+(p==null?void 0:p.image_url)}),E.a.createElement("p",{className:"font24 mt10"},p==null?void 0:p.username),E.a.createElement("p",{className:"mt20"},p==null?void 0:p.user_identity)),E.a.createElement("ul",{className:l.a.navInfo},E.a.createElement(_.a,{to:"/messages/".concat(p==null?void 0:p.login,"/user_tidings")},E.a.createElement("li",{className:b.pathname.indexOf("user_tidings")>-1&&l.a.actived},"\u6D88\u606F",!!(H!=null&&H.unread_tiding_count)&&E.a.createElement("span",{className:l.a.newTip},H==null?void 0:H.unread_tiding_count))),E.a.createElement(_.a,{to:"/messages/".concat(p==null?void 0:p.login,"/private_messages")},E.a.createElement("li",{className:(b.pathname.indexOf("private_messages")>-1||b.pathname.indexOf("message_detail")>-1)&&l.a.actived},"\u79C1\u4FE1",!!(H!=null&&H.unread_message_count)&&E.a.createElement("span",{className:l.a.newTip},H==null?void 0:H.unread_message_count)))))};Je.a=Object(C.a)(function(f){var m=f.messages,L=f.loading,x=f.user,h=f.globalSetting;return{messages:m,globalSetting:h,user:x,loading:L.effects}})(w)},"55Ip":function(lt,Je,Q){"use strict";Q.d(Je,"a",function(){return s}),Q.d(Je,"b",function(){return x});var ee=Q("Ty5D"),G=Q("dI71"),D=Q("cDcd"),W=Q.n(D),R=Q("YS25"),P=Q("17x9"),N=Q.n(P),k=Q("wx14"),A=Q("zLVn"),O=Q("9R94"),E=function(c){Object(G.a)(u,c);function u(){for(var v,p=arguments.length,b=new Array(p),M=0;M<p;M++)b[M]=arguments[M];return v=c.call.apply(c,[this].concat(b))||this,v.history=Object(R.a)(v.props),v}var a=u.prototype;return a.render=function(){return W.a.createElement(ee.c,{history:this.history,children:this.props.children})},u}(W.a.Component),T=function(c){Object(G.a)(u,c);function u(){for(var v,p=arguments.length,b=new Array(p),M=0;M<p;M++)b[M]=arguments[M];return v=c.call.apply(c,[this].concat(b))||this,v.history=Object(R.b)(v.props),v}var a=u.prototype;return a.render=function(){return W.a.createElement(ee.c,{history:this.history,children:this.props.children})},u}(W.a.Component),_=function(u,a){return typeof u=="function"?u(a):u},C=function(u,a){return typeof u=="string"?Object(R.c)(u,null,null,a):u},y=function(u){return u},g=W.a.forwardRef;typeof g=="undefined"&&(g=y);function l(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=g(function(c,u){var a=c.innerRef,v=c.navigate,p=c.onClick,b=Object(A.a)(c,["innerRef","navigate","onClick"]),M=b.target,F=Object(k.a)({},b,{onClick:function(X){try{p&&p(X)}catch(B){throw X.preventDefault(),B}!X.defaultPrevented&&X.button===0&&(!M||M==="_self")&&!l(X)&&(X.preventDefault(),v())}});return y!==g?F.ref=u||a:F.ref=a,W.a.createElement("a",F)}),s=g(function(c,u){var a=c.component,v=a===void 0?o:a,p=c.replace,b=c.to,M=c.innerRef,F=Object(A.a)(c,["component","replace","to","innerRef"]);return W.a.createElement(ee.e.Consumer,null,function(H){H||Object(O.a)(!1);var X=H.history,B=C(_(b,H.location),H.location),U=B?X.createHref(B):"",z=Object(k.a)({},F,{href:U,navigate:function(){var ie=_(b,H.location),se=p?X.replace:X.push;se(ie)}});return y!==g?z.ref=u||M:z.innerRef=M,W.a.createElement(v,z)})});if(!1)var d,w;var f=function(u){return u},m=W.a.forwardRef;typeof m=="undefined"&&(m=f);function L(){for(var c=arguments.length,u=new Array(c),a=0;a<c;a++)u[a]=arguments[a];return u.filter(function(v){return v}).join(" ")}var x=m(function(c,u){var a=c["aria-current"],v=a===void 0?"page":a,p=c.activeClassName,b=p===void 0?"active":p,M=c.activeStyle,F=c.className,H=c.exact,X=c.isActive,B=c.location,U=c.sensitive,z=c.strict,Z=c.style,ie=c.to,se=c.innerRef,Te=Object(A.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return W.a.createElement(ee.e.Consumer,null,function(he){he||Object(O.a)(!1);var xe=B||he.location,pe=C(_(ie,xe),xe),ge=pe.pathname,le=ge&&ge.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),ue=le?Object(ee.f)(xe.pathname,{path:le,exact:H,sensitive:U,strict:z}):null,Le=!!(X?X(ue,xe):ue),Fe=Le?L(F,b):F,Ie=Le?Object(k.a)({},Z,{},M):Z,Ne=Object(k.a)({"aria-current":Le&&v||null,className:Fe,style:Ie,to:pe},Te);return f!==m?Ne.ref=u||se:Ne.innerRef=se,W.a.createElement(s,Ne)})});if(!1)var h},"7ahc":function(lt,Je,Q){"use strict";Q.d(Je,"a",function(){return w});var ee=Q("k1fw"),G=Q("0Owb"),D=Q("+L6B"),W=Q("2/Rp"),R=Q("y8nQ"),P=Q("Vl3Y"),N=Q("tJVT"),k=Q("OaEy"),A=Q("2fM7"),O=Q("cDcd"),E=Q.n(O),T=Q("VrN/"),_=Q.n(T),C=Q("p77/"),y=Q.n(C),g=Q("c5Ni"),l=Q.n(g),o=A.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"]};Je.b=function(f){var m=f.callback,L=f.onCancel,x=Object(O.useState)("python"),h=Object(N.a)(x,2),c=h[0],u=h[1];function a(p){u(d[p][1])}function v(p){m(p)}return E.a.createElement(P.a,Object(G.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:v}),E.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},E.a.createElement(A.a,{onChange:a},Object.keys(d).map(function(p){return E.a.createElement(o,{key:p,value:p},d[p][0])}))),E.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},E.a.createElement(w,{mode:c})),E.a.createElement("div",{className:"flex-container flex-end"},E.a.createElement(W.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),E.a.createElement(W.a,{type:"ghost",onClick:L},"\u53D6\u6D88")))};function w(f){var m=f.value,L=f.onChange,x=f.mode,h=f.options,c=h===void 0?{}:h,u=Object(O.useRef)(),a=Object(O.useState)(),v=Object(N.a)(a,2),p=v[0],b=v[1];return Object(O.useEffect)(function(){if(p){function M(F){var H=F.getValue();L&&L(H)}return p.on("change",M),function(){p.off("change",M)}}},[p,L]),Object(O.useEffect)(function(){p&&p.setOption("mode",x)},[p,x]),Object(O.useEffect)(function(){p&&((m!==p.getValue()||m==="")&&setTimeout(function(){p.setValue(m||" ")},300))},[p,m]),Object(O.useEffect)(function(){if(u.current&&!p){var M=_.a.fromTextArea(u.current,Object(ee.a)({mode:x,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));b(M)}},[u.current,p]),E.a.createElement("div",{className:"my-codemirror-container"},E.a.createElement("textarea",{ref:u}))}},"8EBN":function(lt,Je,Q){(function(ee){ee(Q("VrN/"))})(function(ee){"use strict";ee.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var G=0;G<ee.modeInfo.length;G++){var D=ee.modeInfo[G];D.mimes&&(D.mime=D.mimes[0])}ee.findModeByMIME=function(W){W=W.toLowerCase();for(var R=0;R<ee.modeInfo.length;R++){var P=ee.modeInfo[R];if(P.mime==W)return P;if(P.mimes){for(var N=0;N<P.mimes.length;N++)if(P.mimes[N]==W)return P}}if(/\+xml$/.test(W))return ee.findModeByMIME("application/xml");if(/\+json$/.test(W))return ee.findModeByMIME("application/json")},ee.findModeByExtension=function(W){W=W.toLowerCase();for(var R=0;R<ee.modeInfo.length;R++){var P=ee.modeInfo[R];if(P.ext){for(var N=0;N<P.ext.length;N++)if(P.ext[N]==W)return P}}},ee.findModeByFileName=function(W){for(var R=0;R<ee.modeInfo.length;R++){var P=ee.modeInfo[R];if(P.file&&P.file.test(W))return P}var N=W.lastIndexOf("."),k=N>-1&&W.substring(N+1,W.length);if(k)return ee.findModeByExtension(k)},ee.findModeByName=function(W){W=W.toLowerCase();for(var R=0;R<ee.modeInfo.length;R++){var P=ee.modeInfo[R];if(P.name.toLowerCase()==W)return P;if(P.alias){for(var N=0;N<P.alias.length;N++)if(P.alias[N].toLowerCase()==W)return P}}}})},"9Bee":function(lt,Je,Q){"use strict";var ee=Q("k1fw"),G=Q("tJVT"),D=Q("cDcd"),W=Q.n(D),R=Q("vg9a"),P=Q("DlQD"),N=Q.n(P),k=Q("rUJ1");function A(z,Z){var ie=z.match(/^(\s+)(?:```)/);if(ie===null)return Z;var se=ie[1];return Z.split(`
`).map(function(Te){var he=Te.match(/^\s+/);if(he===null)return Te;var xe=Object(G.a)(he,1),pe=xe[0];return pe.length>=se.length?Te.slice(se.length):Te}).join(`
`)}var O=[],E=["<ul>"],T=new N.a.Renderer,_=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){O.length=0,E=["<ul>"]}var y={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function g(z,Z,ie,se){if(Z>=z.length||z[Z].level<=ie)return Z;var Te=z[Z];se.push("<li><a href='#"+Te.anchor+"'>"+Te.text+"</a>"),Z++;var he=[];return Z=g(z,Z,Te.level,he),he.length>0&&(se.push("<ul>"),he.forEach(function(xe){se.push(xe)}),se.push("</ul>")),se.push("</li>"),Z=g(z,Z,ie,se),Z}function l(){return g(O,0,0,E),E.push("</ul>"),E.join("")}var o={heading:function(Z){var ie=_.exec(Z);if(ie)return{type:"heading",raw:ie[0],depth:ie[1].length,text:ie[2]}},fences:function(Z){var ie=this.rules.block.fences.exec(Z);if(ie){var se=ie[0],Te=A(se,ie[3]||""),he=ie[2]?ie[2].trim():ie[2];if(["latex","katex","math"].indexOf(he)>=0){var xe=w(),pe=Te;Te=xe,f[xe]={type:"block",expression:pe}}return{type:"code",raw:se,lang:he,text:Te}}}},s=/(?:\${2})([^\n`]+?)(?:\${2})/gi,d=0,w=function(){return"__special_katext_id_".concat(d++,"__")},f={};function m(){return f}function L(){d=0,f={}}function x(z){return z=z.replace(s,function(Z,ie){var se=w();return f[se]={type:"inline",expression:ie},se}),z}var h=T.listitem;T.listitem=function(z){return h(x(z))};var c=T.paragraph;T.paragraph=function(z){return c(x(z))};var u=T.tablecell;T.tablecell=function(z,Z){return u(x(z),Z)},T.code=function(z,Z,ie){var se=(Z||"").match(/\S*/)[0];return se?["latex","katex","math"].indexOf(se)>=0?"<p class='editormd-tex'>".concat(z,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(Z,'">').concat(ie?z:Object(k.escape)(z,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(ie?z:Object(k.escape)(z,!0))+"</code></pre>"},T.heading=function(z,Z,ie){var se=this.options.headerPrefix+ie.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return O.push({anchor:se,level:Z,text:z}),"<h"+Z+' id="'+se+'">'+z+"</h"+Z+">"},N.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),N.a.use({tokenizer:o,renderer:T});var a=N.a,v=Q("SJMd"),p=Q("ulZh"),b=Q.n(p),M=Q("m3rI"),F=Q("Oy/b"),H=Q("p5ED"),X=/<pre[^>]*>/g;function B(z){var Z=document.createElement("div");return Z.innerHTML=z,Z.childNodes.length===0?"":Z.childNodes[0].nodeValue}var U=Je.a=function(z){var Z=z.value,ie=Z===void 0?"":Z,se=z.className,Te=z.showTextOnly,he=z.showLines,xe=z.style,pe=xe===void 0?{}:xe,ge=z.stylesPrev,le=ge===void 0?{}:ge,ue=String(ie),Le=Object(D.useState)(""),Fe=Object(G.a)(Le,2),Ie=Fe[0],Ne=Fe[1],Ue=Object(D.useMemo)(function(){try{var Me=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Pe=/\"\/api\/attachments\/|\"\/attachments\/download\//g,we=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;ue=ue.replace(Me,"("+M.a.API_SERVER+"/api/attachments/").replace(Pe,'"'+M.a.API_SERVER+"/api/attachments/").replace(we,'"'+M.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,`
`),ue=ue.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
`)}catch(ze){}var Ce=a(ue),Ye=m();if(ue.match(/\[TOC\]/)&&(Ce=Ce.replace("<p>[TOC]</p>",l()),C()),Ce=Ce.replace(/(__special_katext_id_\d+__)/g,function(ze,Be){var rt=Ye[Be],Ve=rt.type,We=rt.expression;return Object(F.renderToString)(B(We)||"",{displayMode:Ve==="block",throwOnError:!1,output:"html"})}),Ce=Ce.replace(/▁/g,"\u2581\u2581\u2581"),L(),Te){var Ge=document.createElement("div");return Ge.innerHTML=Ce,Ge.innerText}return setTimeout(function(){return _e()},500),Ce},[ue]),Ee=Object(D.useRef)();y.WebkitLineClamp=he,he&&(pe=Object(ee.a)(Object(ee.a)({},pe),y));function ye(Me){var Pe=Me.target;if(Pe.tagName.toUpperCase()==="A"){var we=Pe.getAttribute("href");if(we.indexOf("office")>-1)Me.preventDefault(),Ne(we);else if(we.startsWith("#")){Me.preventDefault();var Ce=document.getElementById(we.replace("#",""));Ce&&Ce.scrollIntoView(!0)}}}var _e=function(){var Pe,we=(Pe=Ee.current)===null||Pe===void 0?void 0:Pe.querySelectorAll("video");we==null||we.forEach(function(Ce){if(Ce.oncontextmenu=function(){return!1},Ce.src.indexOf(".m3u8")>-1&&!Ce.canPlayType("application/vnd.apple.mpegurl")){if(b.a.isSupported()){var Ye=new b.a;Ye.loadSource(Ce.src),Ye.attachMedia(Ce)}}})};return Object(D.useEffect)(function(){if(Ee.current&&Ue&&(Ue.match(X)&&window.PR.prettyPrint()),Ee.current)return Ee.current.addEventListener("click",ye),function(){Ee.current.removeEventListener("click",ye),L(),C()}},[Ue,Ee.current,ye]),W.a.createElement(W.a.Fragment,null,W.a.createElement("div",{ref:Ee,style:Object(ee.a)({},pe),className:"".concat(se||""," markdown-body "),dangerouslySetInnerHTML:{__html:Ue}}),W.a.createElement(H.a,{close:!0,data:Ie,type:Ie!=null&&Ie.length?"office":"",style:Object(ee.a)({},le),onClose:function(){return Ne("")}}))}},"9VGf":function(lt,Je,Q){"use strict";Q.d(Je,"a",function(){return D});var ee=Q("cDcd"),G=Q.n(ee);function D(W,R){var P=Object(ee.useRef)();Object(ee.useEffect)(function(){P.current=W}),Object(ee.useEffect)(function(){function N(){P.current()}if(R!==null){var k=setInterval(N,R);return function(){return clearInterval(k)}}},[R])}},BU3w:function(lt,Je,Q){"use strict";Q.d(Je,"a",function(){return P});var ee=Q("MNnm"),G="rc-util-key";function D(N){if(N.attachTo)return N.attachTo;var k=document.querySelector("head");return k||document.body}function W(N){var k,A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ee.a)())return null;var O=document.createElement("style");if((k=A.csp)===null||k===void 0?void 0:k.nonce){var E;O.nonce=(E=A.csp)===null||E===void 0?void 0:E.nonce}O.innerHTML=N;var T=D(A),_=T.firstChild;return A.prepend&&T.prepend?T.prepend(O):A.prepend&&_?T.insertBefore(O,_):T.appendChild(O),O}var R=new Map;function P(N,k){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},O=D(A);if(!R.has(O)){var E=W("",A),T=E.parentNode;R.set(O,T),T.removeChild(E)}var _=Array.from(R.get(O).children).find(function(o){return o.tagName==="STYLE"&&o[G]===k});if(_){var C,y;if(((C=A.csp)===null||C===void 0?void 0:C.nonce)&&_.nonce!==((y=A.csp)===null||y===void 0?void 0:y.nonce)){var g;_.nonce=(g=A.csp)===null||g===void 0?void 0:g.nonce}return _.innerHTML!==N&&(_.innerHTML=N),_}var l=W(N,A);return l[G]=k,l}},Bd2K:function(lt,Je,Q){(function(ee){ee(Q("VrN/"),Q("osHv"))})(function(ee){ee.defineOption("autoCloseTags",!1,function(A,O,E){if(E!=ee.Init&&E&&A.removeKeyMap("autoCloseTags"),!O)return;var T={name:"autoCloseTags"};(typeof O!="object"||O.whenClosing!==!1)&&(T["'/'"]=function(_){return P(_)}),(typeof O!="object"||O.whenOpening!==!1)&&(T["'>'"]=function(_){return W(_)}),A.addKeyMap(T)});var G=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["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 W(A){if(A.getOption("disableInput"))return ee.Pass;for(var O=A.listSelections(),E=[],T=A.getOption("autoCloseTags"),_=0;_<O.length;_++){if(!O[_].empty())return ee.Pass;var C=O[_].head,y=A.getTokenAt(C),g=ee.innerMode(A.getMode(),y.state),l=g.state,o=g.mode.xmlCurrentTag&&g.mode.xmlCurrentTag(l),s=o&&o.name;if(!s)return ee.Pass;var d=g.mode.configuration=="html",w=typeof T=="object"&&T.dontCloseTags||d&&G,f=typeof T=="object"&&T.indentTags||d&&D;y.end>C.ch&&(s=s.slice(0,s.length-y.end+C.ch));var m=s.toLowerCase();if(!s||y.type=="string"&&(y.end!=C.ch||!/[\"\']/.test(y.string.charAt(y.string.length-1))||y.string.length==1)||y.type=="tag"&&o.close||y.string.indexOf("/")==C.ch-y.start-1||w&&N(w,m)>-1||k(A,g.mode.xmlCurrentContext&&g.mode.xmlCurrentContext(l)||[],s,C,!0))return ee.Pass;var L=typeof T=="object"&&T.emptyTags;if(L&&N(L,s)>-1){E[_]={text:"/>",newPos:ee.Pos(C.line,C.ch+2)};continue}var x=f&&N(f,m)>-1;E[_]={indent:x,text:">"+(x?`
`:"")+"</"+s+">",newPos:x?ee.Pos(C.line+1,0):ee.Pos(C.line,C.ch+1)}}for(var h=typeof T=="object"&&T.dontIndentOnAutoClose,_=O.length-1;_>=0;_--){var c=E[_];A.replaceRange(c.text,O[_].head,O[_].anchor,"+insert");var u=A.listSelections().slice(0);u[_]={head:c.newPos,anchor:c.newPos},A.setSelections(u),!h&&c.indent&&(A.indentLine(c.newPos.line,null,!0),A.indentLine(c.newPos.line+1,null,!0))}}function R(A,O){for(var E=A.listSelections(),T=[],_=O?"/":"</",C=A.getOption("autoCloseTags"),y=typeof C=="object"&&C.dontIndentOnSlash,g=0;g<E.length;g++){if(!E[g].empty())return ee.Pass;var l=E[g].head,o=A.getTokenAt(l),s=ee.innerMode(A.getMode(),o.state),d=s.state;if(O&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=l.ch-1))return ee.Pass;var w,f=s.mode.name!="xml"&&A.getMode().name=="htmlmixed";if(f&&s.mode.name=="javascript")w=_+"script";else if(f&&s.mode.name=="css")w=_+"style";else{var m=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(d);if(!m||m.length&&k(A,m,m[m.length-1],l))return ee.Pass;w=_+m[m.length-1]}A.getLine(l.line).charAt(o.end)!=">"&&(w+=">"),T[g]=w}if(A.replaceSelections(T),E=A.listSelections(),!y)for(var g=0;g<E.length;g++)(g==E.length-1||E[g].head.line<E[g+1].head.line)&&A.indentLine(E[g].head.line)}function P(A){return A.getOption("disableInput")?ee.Pass:R(A,!0)}ee.commands.closeTag=function(A){return R(A)};function N(A,O){if(A.indexOf)return A.indexOf(O);for(var E=0,T=A.length;E<T;++E)if(A[E]==O)return E;return-1}function k(A,O,E,T,_){if(!ee.scanForClosingTag)return!1;var C=Math.min(A.lastLine()+1,T.line+500),y=ee.scanForClosingTag(A,T,null,C);if(!y||y.tag!=E)return!1;for(var g=_?1:0,l=O.length-1;l>=0&&O[l]==E;l--)++g;T=y.to;for(var l=1;l<g;l++){var o=ee.scanForClosingTag(A,T,null,C);if(!o||o.tag!=E)return!1;T=o.to}return!0}})},BjJ7:function(lt,Je,Q){"use strict";Q.d(Je,"d",function(){return G}),Q.d(Je,"c",function(){return D}),Q.d(Je,"e",function(){return W}),Q.d(Je,"b",function(){return R}),Q.d(Je,"a",function(){return N});var ee=Q("m3rI");function G(k){var A=!0;if(k.length>0){for(var O=0;O<k.length;O++)if(k[O].compile_success==0||!k[O].compile_success){A=!1;break}}else A=!1;return A}function D(k){for(var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",O=[],E=0;E<k.length;E++){var T=k[E],_=A?"".concat(A,"/").concat(T.name):"".concat(T.name);O.push({title:T.name,isLeaf:!(T.type==="tree"),key:_})}return O}function W(k,A,O){for(var E=0;E<k.length;E++){var T=k[E];if(T.key===A){T.children=O;break}T.children&&W(T.children,A,O)}return k}function R(k,A,O){var E;return function(){var T=this,_=arguments,C=function(){E=null,O||k.apply(T,_)},y=O&&!E;clearTimeout(E),E=setTimeout(C,A),y&&k.apply(T,_)}}var P=!0,N=ee.a.API_SERVER},"C+DQ":function(lt,Je,Q){},DlQD:function(lt,Je,Q){(function(ee,G){lt.exports=G()})(this,function(){"use strict";function ee(te,ne){for(var ae=0;ae<ne.length;ae++){var Y=ne[ae];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(te,Y.key,Y)}}function G(te,ne,ae){return ne&&ee(te.prototype,ne),ae&&ee(te,ae),te}function D(te,ne){if(!te)return;if(typeof te=="string")return W(te,ne);var ae=Object.prototype.toString.call(te).slice(8,-1);if(ae==="Object"&&te.constructor&&(ae=te.constructor.name),ae==="Map"||ae==="Set")return Array.from(te);if(ae==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ae))return W(te,ne)}function W(te,ne){(ne==null||ne>te.length)&&(ne=te.length);for(var ae=0,Y=new Array(ne);ae<ne;ae++)Y[ae]=te[ae];return Y}function R(te,ne){var ae;if(typeof Symbol=="undefined"||te[Symbol.iterator]==null){if(Array.isArray(te)||(ae=D(te))||ne&&te&&typeof te.length=="number"){ae&&(te=ae);var Y=0;return function(){return Y>=te.length?{done:!0}:{done:!1,value:te[Y++]}}}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 ae=te[Symbol.iterator](),ae.next.bind(ae)}function P(te,ne){return ne={exports:{}},te(ne,ne.exports),ne.exports}var N=P(function(te){function ne(){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 ae(Y){te.exports.defaults=Y}te.exports={defaults:ne(),getDefaults:ne,changeDefaults:ae}}),k=N.defaults,A=N.getDefaults,O=N.changeDefaults,E=/[&<>"']/,T=/[&<>"']/g,_=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,y={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},g=function(ne){return y[ne]};function l(te,ne){if(ne){if(E.test(te))return te.replace(T,g)}else if(_.test(te))return te.replace(C,g);return te}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(te){return te.replace(o,function(ne,ae){return ae=ae.toLowerCase(),ae==="colon"?":":ae.charAt(0)==="#"?ae.charAt(1)==="x"?String.fromCharCode(parseInt(ae.substring(2),16)):String.fromCharCode(+ae.substring(1)):""})}var d=/(^|[^\[])\^/g;function w(te,ne){te=te.source||te,ne=ne||"";var ae={replace:function($,J){return J=J.source||J,J=J.replace(d,"$1"),te=te.replace($,J),ae},getRegex:function(){return new RegExp(te,ne)}};return ae}var f=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function L(te,ne,ae){if(te){var Y;try{Y=decodeURIComponent(s(ae)).replace(f,"").toLowerCase()}catch($){return null}if(Y.indexOf("javascript:")===0||Y.indexOf("vbscript:")===0||Y.indexOf("data:")===0)return null}ne&&!m.test(ae)&&(ae=a(ne,ae));try{ae=encodeURI(ae).replace(/%25/g,"%")}catch($){return null}return ae}var x={},h=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(te,ne){x[" "+te]||(h.test(te)?x[" "+te]=te+"/":x[" "+te]=M(te,"/",!0)),te=x[" "+te];var ae=te.indexOf(":")===-1;return ne.substring(0,2)==="//"?ae?ne:te.replace(c,"$1")+ne:ne.charAt(0)==="/"?ae?ne:te.replace(u,"$1")+ne:te+ne}var v={exec:function(){}};function p(te){for(var ne=1,ae,Y;ne<arguments.length;ne++){ae=arguments[ne];for(Y in ae)Object.prototype.hasOwnProperty.call(ae,Y)&&(te[Y]=ae[Y])}return te}function b(te,ne){var ae=te.replace(/\|/g,function(J,q,de){for(var me=!1,De=q;--De>=0&&de[De]==="\\";)me=!me;return me?"|":" |"}),Y=ae.split(/ \|/),$=0;if(Y.length>ne)Y.splice(ne);else for(;Y.length<ne;)Y.push("");for(;$<Y.length;$++)Y[$]=Y[$].trim().replace(/\\\|/g,"|");return Y}function M(te,ne,ae){var Y=te.length;if(Y===0)return"";for(var $=0;$<Y;){var J=te.charAt(Y-$-1);if(J===ne&&!ae)$++;else if(J!==ne&&ae)$++;else break}return te.substr(0,Y-$)}function F(te,ne){if(te.indexOf(ne[1])===-1)return-1;for(var ae=te.length,Y=0,$=0;$<ae;$++)if(te[$]==="\\")$++;else if(te[$]===ne[0])Y++;else if(te[$]===ne[1]&&(Y--,Y<0))return $;return-1}function H(te){te&&te.sanitize&&!te.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 X={escape:l,unescape:s,edit:w,cleanUrl:L,resolveUrl:a,noopTest:v,merge:p,splitCells:b,rtrim:M,findClosingBracket:F,checkSanitizeDeprecation:H},B=N.defaults,U=X.rtrim,z=X.splitCells,Z=X.escape,ie=X.findClosingBracket;function se(te,ne,ae){var Y=ne.href,$=ne.title?Z(ne.title):null,J=te[1].replace(/\\([\[\]])/g,"$1");return te[0].charAt(0)!=="!"?{type:"link",raw:ae,href:Y,title:$,text:J}:{type:"image",raw:ae,href:Y,title:$,text:Z(J)}}function Te(te,ne){var ae=te.match(/^(\s+)(?:```)/);if(ae===null)return ne;var Y=ae[1];return ne.split(`
`).map(function($){var J=$.match(/^\s+/);if(J===null)return $;var q=J[0];return q.length>=Y.length?$.slice(Y.length):$}).join(`
`)}var he=function(){function te(ae){this.options=ae||B}var ne=te.prototype;return ne.space=function(Y){var $=this.rules.block.newline.exec(Y);if($)return $[0].length>1?{type:"space",raw:$[0]}:{raw:`
`}},ne.code=function(Y,$){var J=this.rules.block.code.exec(Y);if(J){var q=$[$.length-1];if(q&&q.type==="paragraph")return{raw:J[0],text:J[0].trimRight()};var de=J[0].replace(/^ {4}/gm,"");return{type:"code",raw:J[0],codeBlockStyle:"indented",text:this.options.pedantic?de:U(de,`
`)}}},ne.fences=function(Y){var $=this.rules.block.fences.exec(Y);if($){var J=$[0],q=Te(J,$[3]||"");return{type:"code",raw:J,lang:$[2]?$[2].trim():$[2],text:q}}},ne.heading=function(Y){var $=this.rules.block.heading.exec(Y);if($)return{type:"heading",raw:$[0],depth:$[1].length,text:$[2]}},ne.nptable=function(Y){var $=this.rules.block.nptable.exec(Y);if($){var J={type:"table",header:z($[1].replace(/^ *| *\| *$/g,"")),align:$[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:$[3]?$[3].replace(/\n$/,"").split(`
`):[],raw:$[0]};if(J.header.length===J.align.length){var q=J.align.length,de;for(de=0;de<q;de++)/^ *-+: *$/.test(J.align[de])?J.align[de]="right":/^ *:-+: *$/.test(J.align[de])?J.align[de]="center":/^ *:-+ *$/.test(J.align[de])?J.align[de]="left":J.align[de]=null;for(q=J.cells.length,de=0;de<q;de++)J.cells[de]=z(J.cells[de],J.header.length);return J}}},ne.hr=function(Y){var $=this.rules.block.hr.exec(Y);if($)return{type:"hr",raw:$[0]}},ne.blockquote=function(Y){var $=this.rules.block.blockquote.exec(Y);if($){var J=$[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:$[0],text:J}}},ne.list=function(Y){var $=this.rules.block.list.exec(Y);if($){for(var J=$[0],q=$[2],de=q.length>1,me=q[q.length-1]===")",De={type:"list",raw:J,ordered:de,start:de?+q.slice(0,-1):"",loose:!1,items:[]},$e=$[0].match(this.rules.block.item),ot=!1,Qe,pt,ct,et,Rt,ft,Ut,Wt=$e.length,yt=0;yt<Wt;yt++)Qe=$e[yt],J=Qe,pt=Qe.length,Qe=Qe.replace(/^ *([*+-]|\d+[.)]) */,""),~Qe.indexOf(`
`)&&(pt-=Qe.length,Qe=this.options.pedantic?Qe.replace(/^ {1,4}/gm,""):Qe.replace(new RegExp("^ {1,"+pt+"}","gm"),"")),yt!==Wt-1&&(ct=this.rules.block.bullet.exec($e[yt+1])[0],(de?ct.length===1||!me&&ct[ct.length-1]===")":ct.length>1||this.options.smartLists&&ct!==q)&&(et=$e.slice(yt+1).join(`
`),De.raw=De.raw.substring(0,De.raw.length-et.length),yt=Wt-1)),Rt=ot||/\n\n(?!\s*$)/.test(Qe),yt!==Wt-1&&(ot=Qe.charAt(Qe.length-1)===`
`,Rt||(Rt=ot)),Rt&&(De.loose=!0),ft=/^\[[ xX]\] /.test(Qe),Ut=void 0,ft&&(Ut=Qe[1]!==" ",Qe=Qe.replace(/^\[[ xX]\] +/,"")),De.items.push({type:"list_item",raw:J,task:ft,checked:Ut,loose:Rt,text:Qe});return De}},ne.html=function(Y){var $=this.rules.block.html.exec(Y);if($)return{type:this.options.sanitize?"paragraph":"html",raw:$[0],pre:!this.options.sanitizer&&($[1]==="pre"||$[1]==="script"||$[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer($[0]):Z($[0]):$[0]}},ne.def=function(Y){var $=this.rules.block.def.exec(Y);if($){$[3]&&($[3]=$[3].substring(1,$[3].length-1));var J=$[1].toLowerCase().replace(/\s+/g," ");return{tag:J,raw:$[0],href:$[2],title:$[3]}}},ne.table=function(Y){var $=this.rules.block.table.exec(Y);if($){var J={type:"table",header:z($[1].replace(/^ *| *\| *$/g,"")),align:$[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:$[3]?$[3].replace(/\n$/,"").split(`
`):[]};if(J.header.length===J.align.length){J.raw=$[0];var q=J.align.length,de;for(de=0;de<q;de++)/^ *-+: *$/.test(J.align[de])?J.align[de]="right":/^ *:-+: *$/.test(J.align[de])?J.align[de]="center":/^ *:-+ *$/.test(J.align[de])?J.align[de]="left":J.align[de]=null;for(q=J.cells.length,de=0;de<q;de++)J.cells[de]=z(J.cells[de].replace(/^ *\| *| *\| *$/g,""),J.header.length);return J}}},ne.lheading=function(Y){var $=this.rules.block.lheading.exec(Y);if($)return{type:"heading",raw:$[0],depth:$[2].charAt(0)==="="?1:2,text:$[1]}},ne.paragraph=function(Y){var $=this.rules.block.paragraph.exec(Y);if($)return{type:"paragraph",raw:$[0],text:$[1].charAt($[1].length-1)===`
`?$[1].slice(0,-1):$[1]}},ne.text=function(Y,$){var J=this.rules.block.text.exec(Y);if(J){var q=$[$.length-1];return q&&q.type==="text"?{raw:J[0],text:J[0]}:{type:"text",raw:J[0],text:J[0]}}},ne.escape=function(Y){var $=this.rules.inline.escape.exec(Y);if($)return{type:"escape",raw:$[0],text:Z($[1])}},ne.tag=function(Y,$,J){var q=this.rules.inline.tag.exec(Y);if(q)return!$&&/^<a /i.test(q[0])?$=!0:$&&/^<\/a>/i.test(q[0])&&($=!1),!J&&/^<(pre|code|kbd|script)(\s|>)/i.test(q[0])?J=!0:J&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(q[0])&&(J=!1),{type:this.options.sanitize?"text":"html",raw:q[0],inLink:$,inRawBlock:J,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(q[0]):Z(q[0]):q[0]}},ne.link=function(Y){var $=this.rules.inline.link.exec(Y);if($){var J=ie($[2],"()");if(J>-1){var q=$[0].indexOf("!")===0?5:4,de=q+$[1].length+J;$[2]=$[2].substring(0,J),$[0]=$[0].substring(0,de).trim(),$[3]=""}var me=$[2],De="";if(this.options.pedantic){var $e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(me);$e?(me=$e[1],De=$e[3]):De=""}else De=$[3]?$[3].slice(1,-1):"";me=me.trim().replace(/^<([\s\S]*)>$/,"$1");var ot=se($,{href:me&&me.replace(this.rules.inline._escapes,"$1"),title:De&&De.replace(this.rules.inline._escapes,"$1")},$[0]);return ot}},ne.reflink=function(Y,$){var J;if((J=this.rules.inline.reflink.exec(Y))||(J=this.rules.inline.nolink.exec(Y))){var q=(J[2]||J[1]).replace(/\s+/g," ");if(q=$[q.toLowerCase()],!q||!q.href){var de=J[0].charAt(0);return{type:"text",raw:de,text:de}}var me=se(J,q,J[0]);return me}},ne.strong=function(Y,$,J){J===void 0&&(J="");var q=this.rules.inline.strong.start.exec(Y);if(q&&(!q[1]||q[1]&&(J===""||this.rules.inline.punctuation.exec(J)))){$=$.slice(-1*Y.length);var de=q[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;de.lastIndex=0;for(var me;(q=de.exec($))!=null;)if(me=this.rules.inline.strong.middle.exec($.slice(0,q.index+3)),me)return{type:"strong",raw:Y.slice(0,me[0].length),text:Y.slice(2,me[0].length-2)}}},ne.em=function(Y,$,J){J===void 0&&(J="");var q=this.rules.inline.em.start.exec(Y);if(q&&(!q[1]||q[1]&&(J===""||this.rules.inline.punctuation.exec(J)))){$=$.slice(-1*Y.length);var de=q[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;de.lastIndex=0;for(var me;(q=de.exec($))!=null;)if(me=this.rules.inline.em.middle.exec($.slice(0,q.index+2)),me)return{type:"em",raw:Y.slice(0,me[0].length),text:Y.slice(1,me[0].length-1)}}},ne.codespan=function(Y){var $=this.rules.inline.code.exec(Y);if($){var J=$[2].replace(/\n/g," "),q=/[^ ]/.test(J),de=J.startsWith(" ")&&J.endsWith(" ");return q&&de&&(J=J.substring(1,J.length-1)),J=Z(J,!0),{type:"codespan",raw:$[0],text:J}}},ne.br=function(Y){var $=this.rules.inline.br.exec(Y);if($)return{type:"br",raw:$[0]}},ne.del=function(Y){var $=this.rules.inline.del.exec(Y);if($)return{type:"del",raw:$[0],text:$[1]}},ne.autolink=function(Y,$){var J=this.rules.inline.autolink.exec(Y);if(J){var q,de;return J[2]==="@"?(q=Z(this.options.mangle?$(J[1]):J[1]),de="mailto:"+q):(q=Z(J[1]),de=q),{type:"link",raw:J[0],text:q,href:de,tokens:[{type:"text",raw:q,text:q}]}}},ne.url=function(Y,$){var J;if(J=this.rules.inline.url.exec(Y)){var q,de;if(J[2]==="@")q=Z(this.options.mangle?$(J[0]):J[0]),de="mailto:"+q;else{var me;do me=J[0],J[0]=this.rules.inline._backpedal.exec(J[0])[0];while(me!==J[0]);q=Z(J[0]),J[1]==="www."?de="http://"+q:de=q}return{type:"link",raw:J[0],text:q,href:de,tokens:[{type:"text",raw:q,text:q}]}}},ne.inlineText=function(Y,$,J){var q=this.rules.inline.text.exec(Y);if(q){var de;return $?de=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(q[0]):Z(q[0]):q[0]:de=Z(this.options.smartypants?J(q[0]):q[0]),{type:"text",raw:q[0],text:de}}},te}(),xe=X.noopTest,pe=X.edit,ge=X.merge,le={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:xe,table:xe,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};le._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,le._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,le.def=pe(le.def).replace("label",le._label).replace("title",le._title).getRegex(),le.bullet=/(?:[*+-]|\d{1,9}[.)])/,le.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,le.item=pe(le.item,"gm").replace(/bull/g,le.bullet).getRegex(),le.list=pe(le.list).replace(/bull/g,le.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+le.def.source+")").getRegex(),le._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",le._comment=/<!--(?!-?>)[\s\S]*?-->/,le.html=pe(le.html,"i").replace("comment",le._comment).replace("tag",le._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),le.paragraph=pe(le._paragraph).replace("hr",le.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",le._tag).getRegex(),le.blockquote=pe(le.blockquote).replace("paragraph",le.paragraph).getRegex(),le.normal=ge({},le),le.gfm=ge({},le.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*|$)"}),le.gfm.nptable=pe(le.gfm.nptable).replace("hr",le.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",le._tag).getRegex(),le.gfm.table=pe(le.gfm.table).replace("hr",le.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",le._tag).getRegex(),le.pedantic=ge({},le.normal,{html:pe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",le._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:xe,paragraph:pe(le.normal._paragraph).replace("hr",le.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",le.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ue={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:xe,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:xe,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};ue._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ue.punctuation=pe(ue.punctuation).replace(/punctuation/g,ue._punctuation).getRegex(),ue._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ue._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ue.em.start=pe(ue.em.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.middle=pe(ue.em.middle).replace(/punctuation/g,ue._punctuation).replace(/overlapSkip/g,ue._overlapSkip).getRegex(),ue.em.endAst=pe(ue.em.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.endUnd=pe(ue.em.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.start=pe(ue.strong.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.middle=pe(ue.strong.middle).replace(/punctuation/g,ue._punctuation).replace(/blockSkip/g,ue._blockSkip).getRegex(),ue.strong.endAst=pe(ue.strong.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.endUnd=pe(ue.strong.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.blockSkip=pe(ue._blockSkip,"g").getRegex(),ue.overlapSkip=pe(ue._overlapSkip,"g").getRegex(),ue._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,ue._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,ue._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,ue.autolink=pe(ue.autolink).replace("scheme",ue._scheme).replace("email",ue._email).getRegex(),ue._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,ue.tag=pe(ue.tag).replace("comment",le._comment).replace("attribute",ue._attribute).getRegex(),ue._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ue._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ue._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ue.link=pe(ue.link).replace("label",ue._label).replace("href",ue._href).replace("title",ue._title).getRegex(),ue.reflink=pe(ue.reflink).replace("label",ue._label).getRegex(),ue.reflinkSearch=pe(ue.reflinkSearch,"g").replace("reflink",ue.reflink).replace("nolink",ue.nolink).getRegex(),ue.normal=ge({},ue),ue.pedantic=ge({},ue.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:pe(/^!?\[(label)\]\((.*?)\)/).replace("label",ue._label).getRegex(),reflink:pe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ue._label).getRegex()}),ue.gfm=ge({},ue.normal,{escape:pe(ue.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),ue.gfm.url=pe(ue.gfm.url,"i").replace("email",ue.gfm._extended_email).getRegex(),ue.breaks=ge({},ue.gfm,{br:pe(ue.br).replace("{2,}","*").getRegex(),text:pe(ue.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Le={block:le,inline:ue},Fe=N.defaults,Ie=Le.block,Ne=Le.inline;function Ue(te){return te.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function Ee(te){var ne="",ae,Y,$=te.length;for(ae=0;ae<$;ae++)Y=te.charCodeAt(ae),Math.random()>.5&&(Y="x"+Y.toString(16)),ne+="&#"+Y+";";return ne}var ye=function(){function te(ae){this.tokens=[],this.tokens.links=Object.create(null),this.options=ae||Fe,this.options.tokenizer=this.options.tokenizer||new he,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Y={block:Ie.normal,inline:Ne.normal};this.options.pedantic?(Y.block=Ie.pedantic,Y.inline=Ne.pedantic):this.options.gfm&&(Y.block=Ie.gfm,this.options.breaks?Y.inline=Ne.breaks:Y.inline=Ne.gfm),this.tokenizer.rules=Y}te.lex=function(Y,$){var J=new te($);return J.lex(Y)};var ne=te.prototype;return ne.lex=function(Y){return Y=Y.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(Y,this.tokens,!0),this.inline(this.tokens),this.tokens},ne.blockTokens=function(Y,$,J){$===void 0&&($=[]),J===void 0&&(J=!0),Y=Y.replace(/^ +$/gm,"");for(var q,de,me,De;Y;){if(q=this.tokenizer.space(Y)){Y=Y.substring(q.raw.length),q.type&&$.push(q);continue}if(q=this.tokenizer.code(Y,$)){Y=Y.substring(q.raw.length),q.type?$.push(q):(De=$[$.length-1],De.raw+=`
`+q.raw,De.text+=`
`+q.text);continue}if(q=this.tokenizer.fences(Y)){Y=Y.substring(q.raw.length),$.push(q);continue}if(q=this.tokenizer.heading(Y)){Y=Y.substring(q.raw.length),$.push(q);continue}if(q=this.tokenizer.nptable(Y)){Y=Y.substring(q.raw.length),$.push(q);continue}if(q=this.tokenizer.hr(Y)){Y=Y.substring(q.raw.length),$.push(q);continue}if(q=this.tokenizer.blockquote(Y)){Y=Y.substring(q.raw.length),q.tokens=this.blockTokens(q.text,[],J),$.push(q);continue}if(q=this.tokenizer.list(Y)){for(Y=Y.substring(q.raw.length),me=q.items.length,de=0;de<me;de++)q.items[de].tokens=this.blockTokens(q.items[de].text,[],!1);$.push(q);continue}if(q=this.tokenizer.html(Y)){Y=Y.substring(q.raw.length),$.push(q);continue}if(J&&(q=this.tokenizer.def(Y))){Y=Y.substring(q.raw.length),this.tokens.links[q.tag]||(this.tokens.links[q.tag]={href:q.href,title:q.title});continue}if(q=this.tokenizer.table(Y)){Y=Y.substring(q.raw.length),$.push(q);continue}if(q=this.tokenizer.lheading(Y)){Y=Y.substring(q.raw.length),$.push(q);continue}if(J&&(q=this.tokenizer.paragraph(Y))){Y=Y.substring(q.raw.length),$.push(q);continue}if(q=this.tokenizer.text(Y,$)){Y=Y.substring(q.raw.length),q.type?$.push(q):(De=$[$.length-1],De.raw+=`
`+q.raw,De.text+=`
`+q.text);continue}if(Y){var $e="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error($e);break}else throw new Error($e)}}return $},ne.inline=function(Y){var $,J,q,de,me,De,$e=Y.length;for($=0;$<$e;$++){De=Y[$];switch(De.type){case"paragraph":case"text":case"heading":{De.tokens=[],this.inlineTokens(De.text,De.tokens);break}case"table":{for(De.tokens={header:[],cells:[]},de=De.header.length,J=0;J<de;J++)De.tokens.header[J]=[],this.inlineTokens(De.header[J],De.tokens.header[J]);for(de=De.cells.length,J=0;J<de;J++)for(me=De.cells[J],De.tokens.cells[J]=[],q=0;q<me.length;q++)De.tokens.cells[J][q]=[],this.inlineTokens(me[q],De.tokens.cells[J][q]);break}case"blockquote":{this.inline(De.tokens);break}case"list":{for(de=De.items.length,J=0;J<de;J++)this.inline(De.items[J].tokens);break}}}return Y},ne.inlineTokens=function(Y,$,J,q,de){$===void 0&&($=[]),J===void 0&&(J=!1),q===void 0&&(q=!1),de===void 0&&(de="");var me,De=Y,$e;if(this.tokens.links){var ot=Object.keys(this.tokens.links);if(ot.length>0)for(;($e=this.tokenizer.rules.inline.reflinkSearch.exec(De))!=null;)ot.includes($e[0].slice($e[0].lastIndexOf("[")+1,-1))&&(De=De.slice(0,$e.index)+"["+"a".repeat($e[0].length-2)+"]"+De.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;($e=this.tokenizer.rules.inline.blockSkip.exec(De))!=null;)De=De.slice(0,$e.index)+"["+"a".repeat($e[0].length-2)+"]"+De.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Y;){if(me=this.tokenizer.escape(Y)){Y=Y.substring(me.raw.length),$.push(me);continue}if(me=this.tokenizer.tag(Y,J,q)){Y=Y.substring(me.raw.length),J=me.inLink,q=me.inRawBlock,$.push(me);continue}if(me=this.tokenizer.link(Y)){Y=Y.substring(me.raw.length),me.type==="link"&&(me.tokens=this.inlineTokens(me.text,[],!0,q)),$.push(me);continue}if(me=this.tokenizer.reflink(Y,this.tokens.links)){Y=Y.substring(me.raw.length),me.type==="link"&&(me.tokens=this.inlineTokens(me.text,[],!0,q)),$.push(me);continue}if(me=this.tokenizer.strong(Y,De,de)){Y=Y.substring(me.raw.length),me.tokens=this.inlineTokens(me.text,[],J,q),$.push(me);continue}if(me=this.tokenizer.em(Y,De,de)){Y=Y.substring(me.raw.length),me.tokens=this.inlineTokens(me.text,[],J,q),$.push(me);continue}if(me=this.tokenizer.codespan(Y)){Y=Y.substring(me.raw.length),$.push(me);continue}if(me=this.tokenizer.br(Y)){Y=Y.substring(me.raw.length),$.push(me);continue}if(me=this.tokenizer.del(Y)){Y=Y.substring(me.raw.length),me.tokens=this.inlineTokens(me.text,[],J,q),$.push(me);continue}if(me=this.tokenizer.autolink(Y,Ee)){Y=Y.substring(me.raw.length),$.push(me);continue}if(!J&&(me=this.tokenizer.url(Y,Ee))){Y=Y.substring(me.raw.length),$.push(me);continue}if(me=this.tokenizer.inlineText(Y,q,Ue)){Y=Y.substring(me.raw.length),de=me.raw.slice(-1),$.push(me);continue}if(Y){var Qe="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(Qe);break}else throw new Error(Qe)}}return $},G(te,null,[{key:"rules",get:function(){return{block:Ie,inline:Ne}}}]),te}(),_e=N.defaults,Me=X.cleanUrl,Pe=X.escape,we=function(){function te(ae){this.options=ae||_e}var ne=te.prototype;return ne.code=function(Y,$,J){var q=($||"").match(/\S*/)[0];if(this.options.highlight){var de=this.options.highlight(Y,q);de!=null&&de!==Y&&(J=!0,Y=de)}return q?'<pre><code class="'+this.options.langPrefix+Pe(q,!0)+'">'+(J?Y:Pe(Y,!0))+`</code></pre>
`:"<pre><code>"+(J?Y:Pe(Y,!0))+`</code></pre>
`},ne.blockquote=function(Y){return`<blockquote>
`+Y+`</blockquote>
`},ne.html=function(Y){return Y},ne.heading=function(Y,$,J,q){return this.options.headerIds?"<h"+$+' id="'+this.options.headerPrefix+q.slug(J)+'">'+Y+"</h"+$+`>
`:"<h"+$+">"+Y+"</h"+$+`>
`},ne.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ne.list=function(Y,$,J){var q=$?"ol":"ul",de=$&&J!==1?' start="'+J+'"':"";return"<"+q+de+`>
`+Y+"</"+q+`>
`},ne.listitem=function(Y){return"<li>"+Y+`</li>
`},ne.checkbox=function(Y){return"<input "+(Y?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ne.paragraph=function(Y){return"<p>"+Y+`</p>
`},ne.table=function(Y,$){return $&&($="<tbody>"+$+"</tbody>"),`<table>
<thead>
`+Y+`</thead>
`+$+`</table>
`},ne.tablerow=function(Y){return`<tr>
`+Y+`</tr>
`},ne.tablecell=function(Y,$){var J=$.header?"th":"td",q=$.align?"<"+J+' align="'+$.align+'">':"<"+J+">";return q+Y+"</"+J+`>
`},ne.strong=function(Y){return"<strong>"+Y+"</strong>"},ne.em=function(Y){return"<em>"+Y+"</em>"},ne.codespan=function(Y){return"<code>"+Y+"</code>"},ne.br=function(){return this.options.xhtml?"<br/>":"<br>"},ne.del=function(Y){return"<del>"+Y+"</del>"},ne.link=function(Y,$,J){if(Y=Me(this.options.sanitize,this.options.baseUrl,Y),Y===null)return J;var q='<a href="'+Pe(Y)+'"';return $&&(q+=' title="'+$+'"'),q+=">"+J+"</a>",q},ne.image=function(Y,$,J){if(Y=Me(this.options.sanitize,this.options.baseUrl,Y),Y===null)return J;var q='<img src="'+Y+'" alt="'+J+'"';return $&&(q+=' title="'+$+'"'),q+=this.options.xhtml?"/>":">",q},ne.text=function(Y){return Y},te}(),Ce=function(){function te(){}var ne=te.prototype;return ne.strong=function(Y){return Y},ne.em=function(Y){return Y},ne.codespan=function(Y){return Y},ne.del=function(Y){return Y},ne.html=function(Y){return Y},ne.text=function(Y){return Y},ne.link=function(Y,$,J){return""+J},ne.image=function(Y,$,J){return""+J},ne.br=function(){return""},te}(),Ye=function(){function te(){this.seen={}}var ne=te.prototype;return ne.slug=function(Y){var $=Y.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty($)){var J=$;do this.seen[J]++,$=J+"-"+this.seen[J];while(this.seen.hasOwnProperty($))}return this.seen[$]=0,$},te}(),Ge=N.defaults,ze=X.unescape,Be=function(){function te(ae){this.options=ae||Ge,this.options.renderer=this.options.renderer||new we,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ce,this.slugger=new Ye}te.parse=function(Y,$){var J=new te($);return J.parse(Y)};var ne=te.prototype;return ne.parse=function(Y,$){$===void 0&&($=!0);var J="",q,de,me,De,$e,ot,Qe,pt,ct,et,Rt,ft,Ut,Wt,yt,pr,Ar,or,dr=Y.length;for(q=0;q<dr;q++){et=Y[q];switch(et.type){case"space":continue;case"hr":{J+=this.renderer.hr();continue}case"heading":{J+=this.renderer.heading(this.parseInline(et.tokens),et.depth,ze(this.parseInline(et.tokens,this.textRenderer)),this.slugger);continue}case"code":{J+=this.renderer.code(et.text,et.lang,et.escaped);continue}case"table":{for(pt="",Qe="",De=et.header.length,de=0;de<De;de++)Qe+=this.renderer.tablecell(this.parseInline(et.tokens.header[de]),{header:!0,align:et.align[de]});for(pt+=this.renderer.tablerow(Qe),ct="",De=et.cells.length,de=0;de<De;de++){for(ot=et.tokens.cells[de],Qe="",$e=ot.length,me=0;me<$e;me++)Qe+=this.renderer.tablecell(this.parseInline(ot[me]),{header:!1,align:et.align[me]});ct+=this.renderer.tablerow(Qe)}J+=this.renderer.table(pt,ct);continue}case"blockquote":{ct=this.parse(et.tokens),J+=this.renderer.blockquote(ct);continue}case"list":{for(Rt=et.ordered,ft=et.start,Ut=et.loose,De=et.items.length,ct="",de=0;de<De;de++)yt=et.items[de],pr=yt.checked,Ar=yt.task,Wt="",yt.task&&(or=this.renderer.checkbox(pr),Ut?yt.tokens.length>0&&yt.tokens[0].type==="text"?(yt.tokens[0].text=or+" "+yt.tokens[0].text,yt.tokens[0].tokens&&yt.tokens[0].tokens.length>0&&yt.tokens[0].tokens[0].type==="text"&&(yt.tokens[0].tokens[0].text=or+" "+yt.tokens[0].tokens[0].text)):yt.tokens.unshift({type:"text",text:or}):Wt+=or),Wt+=this.parse(yt.tokens,Ut),ct+=this.renderer.listitem(Wt,Ar,pr);J+=this.renderer.list(ct,Rt,ft);continue}case"html":{J+=this.renderer.html(et.text);continue}case"paragraph":{J+=this.renderer.paragraph(this.parseInline(et.tokens));continue}case"text":{for(ct=et.tokens?this.parseInline(et.tokens):et.text;q+1<dr&&Y[q+1].type==="text";)et=Y[++q],ct+=`
`+(et.tokens?this.parseInline(et.tokens):et.text);J+=$?this.renderer.paragraph(ct):ct;continue}default:{var cr='Token with "'+et.type+'" type was not found.';if(this.options.silent){console.error(cr);return}else throw new Error(cr)}}}return J},ne.parseInline=function(Y,$){$=$||this.renderer;var J="",q,de,me=Y.length;for(q=0;q<me;q++){de=Y[q];switch(de.type){case"escape":{J+=$.text(de.text);break}case"html":{J+=$.html(de.text);break}case"link":{J+=$.link(de.href,de.title,this.parseInline(de.tokens,$));break}case"image":{J+=$.image(de.href,de.title,de.text);break}case"strong":{J+=$.strong(this.parseInline(de.tokens,$));break}case"em":{J+=$.em(this.parseInline(de.tokens,$));break}case"codespan":{J+=$.codespan(de.text);break}case"br":{J+=$.br();break}case"del":{J+=$.del(this.parseInline(de.tokens,$));break}case"text":{J+=$.text(de.text);break}default:{var De='Token with "'+de.type+'" type was not found.';if(this.options.silent){console.error(De);return}else throw new Error(De)}}}return J},te}(),rt=X.merge,Ve=X.checkSanitizeDeprecation,We=X.escape,ve=N.getDefaults,qe=N.changeDefaults,Xe=N.defaults;function be(te,ne,ae){if(typeof te=="undefined"||te===null)throw new Error("marked(): input parameter is undefined or null");if(typeof te!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(te)+", string expected");if(typeof ne=="function"&&(ae=ne,ne=null),ne=rt({},be.defaults,ne||{}),Ve(ne),ae){var Y=ne.highlight,$;try{$=ye.lex(te,ne)}catch(me){return ae(me)}var J=function(De){var $e;if(!De)try{$e=Be.parse($,ne)}catch(ot){De=ot}return ne.highlight=Y,De?ae(De):ae(null,$e)};if(!Y||Y.length<3)return J();if(delete ne.highlight,!$.length)return J();var q=0;be.walkTokens($,function(me){me.type==="code"&&(q++,setTimeout(function(){Y(me.text,me.lang,function(De,$e){if(De)return J(De);$e!=null&&$e!==me.text&&(me.text=$e,me.escaped=!0),q--,q===0&&J()})},0))}),q===0&&J();return}try{var de=ye.lex(te,ne);return ne.walkTokens&&be.walkTokens(de,ne.walkTokens),Be.parse(de,ne)}catch(me){if(me.message+=`
Please report this to https://github.com/markedjs/marked.`,ne.silent)return"<p>An error occurred:</p><pre>"+We(me.message+"",!0)+"</pre>";throw me}}be.options=be.setOptions=function(te){return rt(be.defaults,te),qe(be.defaults),be},be.getDefaults=ve,be.defaults=Xe,be.use=function(te){var ne=rt({},te);if(te.renderer&&function(){var Y=be.defaults.renderer||new we,$=function(de){var me=Y[de];Y[de]=function(){for(var De=arguments.length,$e=new Array(De),ot=0;ot<De;ot++)$e[ot]=arguments[ot];var Qe=te.renderer[de].apply(Y,$e);return Qe===!1&&(Qe=me.apply(Y,$e)),Qe}};for(var J in te.renderer)$(J);ne.renderer=Y}(),te.tokenizer&&function(){var Y=be.defaults.tokenizer||new he,$=function(de){var me=Y[de];Y[de]=function(){for(var De=arguments.length,$e=new Array(De),ot=0;ot<De;ot++)$e[ot]=arguments[ot];var Qe=te.tokenizer[de].apply(Y,$e);return Qe===!1&&(Qe=me.apply(Y,$e)),Qe}};for(var J in te.tokenizer)$(J);ne.tokenizer=Y}(),te.walkTokens){var ae=be.defaults.walkTokens;ne.walkTokens=function(Y){te.walkTokens(Y),ae&&ae(Y)}}be.setOptions(ne)},be.walkTokens=function(te,ne){for(var ae=R(te),Y;!(Y=ae()).done;){var $=Y.value;ne($);switch($.type){case"table":{for(var J=R($.tokens.header),q;!(q=J()).done;){var de=q.value;be.walkTokens(de,ne)}for(var me=R($.tokens.cells),De;!(De=me()).done;)for(var $e=De.value,ot=R($e),Qe;!(Qe=ot()).done;){var pt=Qe.value;be.walkTokens(pt,ne)}break}case"list":{be.walkTokens($.items,ne);break}default:$.tokens&&be.walkTokens($.tokens,ne)}}},be.Parser=Be,be.parser=Be.parse,be.Renderer=we,be.TextRenderer=Ce,be.Lexer=ye,be.lexer=ye.lex,be.Tokenizer=he,be.Slugger=Ye,be.parse=be;var Oe=be;return Oe})},ELLl:function(lt,Je,Q){(function(ee){ee(Q("VrN/"))})(function(ee){var G={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=ee.Pos;ee.defineOption("autoCloseBrackets",!1,function(y,g,l){l&&l!=ee.Init&&(y.removeKeyMap(R),y.state.closeBrackets=null),g&&(P(W(g,"pairs")),y.state.closeBrackets=g,y.addKeyMap(R))});function W(y,g){return g=="pairs"&&typeof y=="string"?y:typeof y=="object"&&y[g]!=null?y[g]:G[g]}var R={Backspace:A,Enter:O};function P(y){for(var g=0;g<y.length;g++){var l=y.charAt(g),o="'"+l+"'";R[o]||(R[o]=N(l))}}P(G.pairs+"`");function N(y){return function(g){return T(g,y)}}function k(y){var g=y.state.closeBrackets;if(!g||g.override)return g;var l=y.getModeAt(y.getCursor());return l.closeBrackets||g}function A(y){var g=k(y);if(!g||y.getOption("disableInput"))return ee.Pass;for(var l=W(g,"pairs"),o=y.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return ee.Pass;var d=_(y,o[s].head);if(!d||l.indexOf(d)%2!=0)return ee.Pass}for(var s=o.length-1;s>=0;s--){var w=o[s].head;y.replaceRange("",D(w.line,w.ch-1),D(w.line,w.ch+1),"+delete")}}function O(y){var g=k(y),l=g&&W(g,"explode");if(!l||y.getOption("disableInput"))return ee.Pass;for(var o=y.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return ee.Pass;var d=_(y,o[s].head);if(!d||l.indexOf(d)%2!=0)return ee.Pass}y.operation(function(){var w=y.lineSeparator()||`
`;y.replaceSelection(w+w,null),y.execCommand("goCharLeft"),o=y.listSelections();for(var f=0;f<o.length;f++){var m=o[f].head.line;y.indentLine(m,null,!0),y.indentLine(m+1,null,!0)}})}function E(y){var g=ee.cmpPos(y.anchor,y.head)>0;return{anchor:new D(y.anchor.line,y.anchor.ch+(g?-1:1)),head:new D(y.head.line,y.head.ch+(g?1:-1))}}function T(y,g){var l=k(y);if(!l||y.getOption("disableInput"))return ee.Pass;var o=W(l,"pairs"),s=o.indexOf(g);if(s==-1)return ee.Pass;for(var d=W(l,"closeBefore"),w=W(l,"triples"),f=o.charAt(s+1)==g,m=y.listSelections(),L=s%2==0,x,h=0;h<m.length;h++){var c=m[h],u=c.head,a,v=y.getRange(u,D(u.line,u.ch+1));if(L&&!c.empty())a="surround";else if((f||!L)&&v==g)f&&C(y,u)?a="both":w.indexOf(g)>=0&&y.getRange(u,D(u.line,u.ch+3))==g+g+g?a="skipThree":a="skip";else if(f&&u.ch>1&&w.indexOf(g)>=0&&y.getRange(D(u.line,u.ch-2),u)==g+g){if(u.ch>2&&/\bstring/.test(y.getTokenTypeAt(D(u.line,u.ch-2))))return ee.Pass;a="addFour"}else if(f){var p=u.ch==0?" ":y.getRange(D(u.line,u.ch-1),u);if(!ee.isWordChar(v)&&p!=g&&!ee.isWordChar(p))a="both";else return ee.Pass}else if(L&&(v.length===0||/\s/.test(v)||d.indexOf(v)>-1))a="both";else return ee.Pass;if(!x)x=a;else if(x!=a)return ee.Pass}var b=s%2?o.charAt(s-1):g,M=s%2?g:o.charAt(s+1);y.operation(function(){if(x=="skip")y.execCommand("goCharRight");else if(x=="skipThree")for(var F=0;F<3;F++)y.execCommand("goCharRight");else if(x=="surround"){for(var H=y.getSelections(),F=0;F<H.length;F++)H[F]=b+H[F]+M;y.replaceSelections(H,"around"),H=y.listSelections().slice();for(var F=0;F<H.length;F++)H[F]=E(H[F]);y.setSelections(H)}else x=="both"?(y.replaceSelection(b+M,null),y.triggerElectric(b+M),y.execCommand("goCharLeft")):x=="addFour"&&(y.replaceSelection(b+b+b+b,"before"),y.execCommand("goCharRight"))})}function _(y,g){var l=y.getRange(D(g.line,g.ch-1),D(g.line,g.ch+1));return l.length==2?l:null}function C(y,g){var l=y.getTokenAt(D(g.line,g.ch+1));return/\bstring/.test(l.type)&&l.start==g.ch&&(g.ch==0||!/\bstring/.test(y.getTokenTypeAt(g)))}})},HmJG:function(lt,Je,Q){},LSTS:function(lt,Je,Q){"use strict";Object.defineProperty(Je,"__esModule",{value:!0});var ee=function(){function T(_,C){for(var y=0;y<C.length;y++){var g=C[y];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(_,g.key,g)}}return function(_,C,y){return C&&T(_.prototype,C),y&&T(_,y),_}}(),G=Q("cDcd"),D=P(G),W=Q("17x9"),R=P(W);function P(T){return T&&T.__esModule?T:{default:T}}function N(T,_){var C={};for(var y in T){if(_.indexOf(y)>=0)continue;if(!Object.prototype.hasOwnProperty.call(T,y))continue;C[y]=T[y]}return C}function k(T,_){if(!(T instanceof _))throw new TypeError("Cannot call a class as a function")}function A(T,_){if(!T)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:T}function O(T,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);T.prototype=Object.create(_&&_.prototype,{constructor:{value:T,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(T,_):T.__proto__=_)}var E=function(T){O(_,T);function _(C){k(this,_);var y=A(this,(_.__proto__||Object.getPrototypeOf(_)).call(this,C));return y.scrollListener=y.scrollListener.bind(y),y.eventListenerOptions=y.eventListenerOptions.bind(y),y.mousewheelListener=y.mousewheelListener.bind(y),y}return ee(_,[{key:"componentDidMount",value:function(){this.pageLoaded=this.props.pageStart,this.options=this.eventListenerOptions(),this.attachScrollListener()}},{key:"componentDidUpdate",value:function(){if(this.props.isReverse&&this.loadMore){var y=this.getParentElement(this.scrollComponent);y.scrollTop=y.scrollHeight-this.beforeScrollHeight+this.beforeScrollTop,this.loadMore=!1}this.attachScrollListener()}},{key:"componentWillUnmount",value:function(){this.detachScrollListener(),this.detachMousewheelListener()}},{key:"isPassiveSupported",value:function(){var y=!1,g={get passive(){y=!0}};try{document.addEventListener("test",null,g),document.removeEventListener("test",null,g)}catch(l){}return y}},{key:"eventListenerOptions",value:function(){var y=this.props.useCapture;return this.isPassiveSupported()&&(y={useCapture:this.props.useCapture,passive:!0}),y}},{key:"setDefaultLoader",value:function(y){this.defaultLoader=y}},{key:"detachMousewheelListener",value:function(){var y=window;this.props.useWindow===!1&&(y=this.scrollComponent.parentNode),y.removeEventListener("mousewheel",this.mousewheelListener,this.options?this.options:this.props.useCapture)}},{key:"detachScrollListener",value:function(){var y=window;this.props.useWindow===!1&&(y=this.getParentElement(this.scrollComponent)),y.removeEventListener("scroll",this.scrollListener,this.options?this.options:this.props.useCapture),y.removeEventListener("resize",this.scrollListener,this.options?this.options:this.props.useCapture)}},{key:"getParentElement",value:function(y){var g=this.props.getScrollParent&&this.props.getScrollParent();return g!=null?g:y&&y.parentNode}},{key:"filterProps",value:function(y){return y}},{key:"attachScrollListener",value:function(){var y=this.getParentElement(this.scrollComponent);if(!this.props.hasMore||!y)return;var g=window;this.props.useWindow===!1&&(g=y),g.addEventListener("mousewheel",this.mousewheelListener,this.options?this.options:this.props.useCapture),g.addEventListener("scroll",this.scrollListener,this.options?this.options:this.props.useCapture),g.addEventListener("resize",this.scrollListener,this.options?this.options:this.props.useCapture),this.props.initialLoad&&this.scrollListener()}},{key:"mousewheelListener",value:function(y){y.deltaY===1&&!this.isPassiveSupported()&&y.preventDefault()}},{key:"scrollListener",value:function(){var y=this.scrollComponent,g=window,l=this.getParentElement(y),o=void 0;if(this.props.useWindow){var s=document.documentElement||document.body.parentNode||document.body,d=g.pageYOffset!==void 0?g.pageYOffset:s.scrollTop;this.props.isReverse?o=d:o=this.calculateOffset(y,d)}else this.props.isReverse?o=l.scrollTop:o=y.scrollHeight-l.scrollTop-l.clientHeight;o<Number(this.props.threshold)&&y&&y.offsetParent!==null&&(this.detachScrollListener(),this.beforeScrollHeight=l.scrollHeight,this.beforeScrollTop=l.scrollTop,typeof this.props.loadMore=="function"&&(this.props.loadMore(this.pageLoaded+=1),this.loadMore=!0))}},{key:"calculateOffset",value:function(y,g){return y?this.calculateTopPosition(y)+(y.offsetHeight-g-window.innerHeight):0}},{key:"calculateTopPosition",value:function(y){return y?y.offsetTop+this.calculateTopPosition(y.offsetParent):0}},{key:"render",value:function(){var y=this,g=this.filterProps(this.props),l=g.children,o=g.element,s=g.hasMore,d=g.initialLoad,w=g.isReverse,f=g.loader,m=g.loadMore,L=g.pageStart,x=g.ref,h=g.threshold,c=g.useCapture,u=g.useWindow,a=g.getScrollParent,v=N(g,["children","element","hasMore","initialLoad","isReverse","loader","loadMore","pageStart","ref","threshold","useCapture","useWindow","getScrollParent"]);v.ref=function(b){y.scrollComponent=b,x&&x(b)};var p=[l];return s&&(f?w?p.unshift(f):p.push(f):this.defaultLoader&&(w?p.unshift(this.defaultLoader):p.push(this.defaultLoader))),D.default.createElement(o,v,p)}}]),_}(G.Component);E.propTypes={children:R.default.node.isRequired,element:R.default.node,hasMore:R.default.bool,initialLoad:R.default.bool,isReverse:R.default.bool,loader:R.default.node,loadMore:R.default.func.isRequired,pageStart:R.default.number,ref:R.default.func,getScrollParent:R.default.func,threshold:R.default.number,useCapture:R.default.bool,useWindow:R.default.bool},E.defaultProps={element:"div",hasMore:!1,initialLoad:!0,pageStart:0,ref:null,threshold:250,useWindow:!0,isReverse:!1,useCapture:!1,loader:null,getScrollParent:null},Je.default=E,lt.exports=Je.default},LdHM:function(lt,Je,Q){"use strict";Q.d(Je,"b",function(){return d}),Q.d(Je,"a",function(){return f});var ee=Q("1OyB"),G=Q("vuIU"),D=Q("Ji7U"),W=Q("LK+K"),R=Q("cDcd"),P=Q("rePB"),N=Q("Ff2n"),k=Q("ODXe"),A=Q("4IlW"),O=Q("bX4T"),E=Q("YrtM"),T=Q("TSYQ"),_=Q.n(T),C=Q("+nKL"),y=Q("8OUc"),g=function(z,Z){var ie=z.prefixCls,se=z.id,Te=z.flattenOptions,he=z.childrenAsData,xe=z.values,pe=z.searchValue,ge=z.multiple,le=z.defaultActiveFirstOption,ue=z.height,Le=z.itemHeight,Fe=z.notFoundContent,Ie=z.open,Ne=z.menuItemSelectedIcon,Ue=z.virtual,Ee=z.onSelect,ye=z.onToggleOpen,_e=z.onActiveValue,Me=z.onScroll,Pe=z.onMouseEnter,we="".concat(ie,"-item"),Ce=Object(E.a)(function(){return Te},[Ie,Te],function(Oe,te){return te[0]&&Oe[1]!==te[1]}),Ye=R.useRef(null),Ge=function(te){te.preventDefault()},ze=function(te){Ye.current&&Ye.current.scrollTo({index:te})},Be=function(te){for(var ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ae=Ce.length,Y=0;Y<ae;Y+=1){var $=(te+Y*ne+ae)%ae,J=Ce[$],q=J.group,de=J.data;if(!q&&!de.disabled)return $}return-1},rt=R.useState(function(){return Be(0)}),Ve=Object(k.a)(rt,2),We=Ve[0],ve=Ve[1],qe=function(te){ve(te);var ne=Ce[te];if(!ne){_e(null,-1);return}_e(ne.data.value,te)};R.useEffect(function(){qe(le!==!1?Be(0):-1)},[Ce.length,pe]),R.useEffect(function(){var Oe=setTimeout(function(){if(!ge&&Ie&&xe.size===1){var te=Array.from(xe)[0],ne=Ce.findIndex(function(ae){var Y=ae.data;return Y.value===te});qe(ne),ze(ne)}});return function(){return clearTimeout(Oe)}},[Ie]);var Xe=function(te){te!==void 0&&Ee(te,{selected:!xe.has(te)}),ge||ye(!1)};if(R.useImperativeHandle(Z,function(){return{onKeyDown:function(te){var ne=te.which;switch(ne){case A.a.UP:case A.a.DOWN:{var ae=0;if(ne===A.a.UP?ae=-1:ne===A.a.DOWN&&(ae=1),ae!==0){var Y=Be(We+ae,ae);ze(Y),qe(Y)}break}case A.a.ENTER:{var $=Ce[We];$&&!$.data.disabled?Xe($.data.value):Xe(void 0),Ie&&te.preventDefault();break}case A.a.ESC:ye(!1)}},onKeyUp:function(){},scrollTo:function(te){ze(te)}}}),Ce.length===0)return R.createElement("div",{role:"listbox",id:"".concat(se,"_list"),className:"".concat(we,"-empty"),onMouseDown:Ge},Fe);function be(Oe){var te=Ce[Oe];if(!te)return null;var ne=te.data||{},ae=ne.value,Y=ne.label,$=ne.children,J=Object(O.a)(ne,!0),q=he?$:Y;return te?R.createElement("div",Object.assign({"aria-label":typeof q=="string"?q:null},J,{key:Oe,role:"option",id:"".concat(se,"_list_").concat(Oe),"aria-selected":xe.has(ae)}),ae):null}return R.createElement(R.Fragment,null,R.createElement("div",{role:"listbox",id:"".concat(se,"_list"),style:{height:0,width:0,overflow:"hidden"}},be(We-1),be(We),be(We+1)),R.createElement(C.a,{itemKey:"key",ref:Ye,data:Ce,height:ue,itemHeight:Le,fullHeight:!1,onMouseDown:Ge,onScroll:Me,virtual:Ue,onMouseEnter:Pe},function(Oe,te){var ne,ae=Oe.group,Y=Oe.groupOption,$=Oe.data,J=$.label,q=$.key;if(ae)return R.createElement("div",{className:_()(we,"".concat(we,"-group"))},J!==void 0?J:q);var de=$.disabled,me=$.value,De=$.title,$e=$.children,ot=$.style,Qe=$.className,pt=Object(N.a)($,["disabled","value","title","children","style","className"]),ct=xe.has(me),et="".concat(we,"-option"),Rt=_()(we,et,Qe,(ne={},Object(P.a)(ne,"".concat(et,"-grouped"),Y),Object(P.a)(ne,"".concat(et,"-active"),We===te&&!de),Object(P.a)(ne,"".concat(et,"-disabled"),de),Object(P.a)(ne,"".concat(et,"-selected"),ct),ne)),ft=he?$e:J,Ut=!Ne||typeof Ne=="function"||ct;return R.createElement("div",Object.assign({},pt,{"aria-selected":ct,className:Rt,title:De,onMouseMove:function(){if(We===te||de)return;qe(te)},onClick:function(){de||Xe(me)},style:ot}),R.createElement("div",{className:"".concat(et,"-content")},ft||me),R.isValidElement(Ne)||ct,Ut&&R.createElement(y.a,{className:"".concat(we,"-option-state"),customizeIcon:Ne,customizeIconProps:{isSelected:ct}},ct?"\u2713":null))}))},l=R.forwardRef(g);l.displayName="OptionList";var o=l,s=function(){return null};s.isSelectOption=!0;var d=s,w=function(){return null};w.isSelectOptGroup=!0;var f=w,m=Q("VTBJ"),L=Q("Zm9Q");function x(U){var z=U.key,Z=U.props,ie=Z.children,se=Z.value,Te=Object(N.a)(Z,["children","value"]);return Object(m.a)({key:z,value:se!==void 0?se:z,children:ie},Te)}function h(U){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(L.a)(U).map(function(Z,ie){if(!R.isValidElement(Z)||!Z.type)return null;var se=Z.type.isSelectOptGroup,Te=Z.key,he=Z.props,xe=he.children,pe=Object(N.a)(he,["children"]);return z||!se?x(Z):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(Te===null?ie:Te,"__"),label:Te},pe),{},{options:h(xe)})}).filter(function(Z){return Z})}var c=Q("2Qr1"),u=Q("qNPg"),a=Q("U8pU"),v=Q("Kwbf"),p=Q("WKfj");function b(U){var z=U.mode,Z=U.options,ie=U.children,se=U.backfill,Te=U.allowClear,he=U.placeholder,xe=U.getInputElement,pe=U.showSearch,ge=U.onSearch,le=U.defaultOpen,ue=U.autoFocus,Le=U.labelInValue,Fe=U.value,Ie=U.inputValue,Ne=U.optionLabelProp,Ue=z==="multiple"||z==="tags",Ee=pe!==void 0?pe:Ue||z==="combobox",ye=Z||h(ie);if(Object(v.a)(z!=="tags"||ye.every(function(we){return!we.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),z==="tags"||z==="combobox"){var _e=ye.some(function(we){return we.options?we.options.some(function(Ce){return typeof("value"in Ce?Ce.value:Ce.key)=="number"}):typeof("value"in we?we.value:we.key)=="number"});Object(v.a)(!_e,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(v.a)(z!=="combobox"||!Ne,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(v.a)(z==="combobox"||!se,"`backfill` only works with `combobox` mode."),Object(v.a)(z==="combobox"||!xe,"`getInputElement` only work with `combobox` mode."),Object(v.b)(z!=="combobox"||!xe||!Te||!he,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),ge&&!Ee&&z!=="combobox"&&z!=="tags"&&Object(v.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(v.b)(!le||ue,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Fe!=null){var Me=Object(p.d)(Fe);Object(v.a)(!Le||Me.every(function(we){return Object(a.a)(we)==="object"&&("key"in we||"value"in we)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(v.a)(!Ue||Array.isArray(Fe),"`value` should be array when `mode` is `multiple` or `tags`")}if(ie){var Pe=null;Object(L.a)(ie).some(function(we){if(!R.isValidElement(we)||!we.type)return!1;var Ce=we.type;if(Ce.isSelectOption)return!1;if(Ce.isSelectOptGroup){var Ye=Object(L.a)(we.props.children).every(function(Ge){return!R.isValidElement(Ge)||!we.type||Ge.type.isSelectOption?!0:(Pe=Ge.type,!1)});return!Ye}return Pe=Ce,!0}),Pe&&Object(v.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Pe.displayName||Pe.name||Pe,"`.")),Object(v.a)(Ie===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=b,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:M,fillOptionsWithMissingValue:c.a}),H=function(U){Object(D.a)(Z,U);var z=Object(W.a)(Z);function Z(){var ie;return Object(ee.a)(this,Z),ie=z.apply(this,arguments),ie.selectRef=R.createRef(),ie.focus=function(){ie.selectRef.current.focus()},ie.blur=function(){ie.selectRef.current.blur()},ie}return Object(G.a)(Z,[{key:"render",value:function(){return R.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),Z}(R.Component);H.Option=d,H.OptGroup=f;var X=H,B=Je.c=X},M8RZ:function(lt,Je,Q){"use strict";Q.d(Je,"a",function(){return A});var ee=Q("fWQN"),G=Q("mtLc"),D=Q("yKVA"),W=Q("879j"),R=Q("cDcd"),P=Q.n(R),N=Q("faye"),k=Q.n(N),A=function(O){Object(D.a)(T,O);var E=Object(W.a)(T);function T(_){var C;Object(ee.a)(this,T),C=E.call(this,_);var y=window.document;return C.node=y.createElement("div"),y.body.appendChild(C.node),C}return Object(G.a)(T,[{key:"render",value:function(){var C=this.props.children;return Object(N.createPortal)(C,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),T}(P.a.Component)},Ot1p:function(lt,Je,Q){"use strict";var ee=Q("2qtc"),G=Q("kLXV"),D=Q("rAM+"),W=Q("miYZ"),R=Q("tsqr"),P=Q("tJVT"),N=Q("jrin"),k=Q("cDcd"),A=Q.n(k),O=Q("VrN/"),E=Q.n(O),T=Q("bdgK"),_=Q("p77/"),C=Q("Bd2K"),y=Q("ELLl"),g=Q("19Vz"),l=Q("lZu9"),o=Q("+NIl"),s=Q("kSUc"),d=Q("9Bee"),w=function(te){var ne=te.value,ae=ne===void 0?"":ne,Y=te.className,$=te.showTextOnly,J=te.showLines,q=te.style,de=q===void 0?{}:q,me=Object(k.useMemo)(function(){return""},[ae]);return A.a.createElement(A.a.Fragment,null,A.a.createElement("div",{dangerouslySetInnerHTML:{__html:me}}))},f=Q("0Owb"),m=Q("dejd"),L=Q("C+DQ"),x=[{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 h(te){var ne=te.onActionCallback,ae=te.title,Y=te.icon,$=te.actionName,J=te.className,q=J===void 0?"":J,de=te.children;function me(){ne($)}return A.a.createElement("a",{title:ae,className:q,onClick:me},A.a.createElement("i",{className:"md-iconfont ".concat(Y)}),de)}var c=function(te){var ne=te.watch,ae=te.showNullButton,Y=te.onActionCallback,$=te.fullScreen,J=te.insertTemp,q=te.hidetoolBar,de=[].concat(x,[{title:"".concat(ne?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ne?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return A.a.createElement("ul",{className:"markdown-toolbar-container"},!q&&de.map(function(me,De){return A.a.createElement("li",{key:De},me.actionName?A.a.createElement(h,Object(f.a)({},me,{onActionCallback:Y})):A.a.createElement("span",{className:"v-line"}))}),ae?A.a.createElement("li",null,A.a.createElement(h,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Y},A.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,J&&A.a.createElement("li",null,A.a.createElement(h,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(J),onActionCallback:Y},A.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),A.a.createElement("li",{className:"btn-full-screen"},A.a.createElement(h,{icon:"".concat($?"icon-shrink":"icon-enlarge"),title:$?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Y})))},u=Q("M8RZ"),a=Q("+L6B"),v=Q("2/Rp"),p=Q("y8nQ"),b=Q("Vl3Y"),M=Q("5NDa"),F=Q("5rEg"),H={labelCol:{span:4},wrapperCol:{span:20}},X=function(te){var ne=te.callback,ae=te.onCancel;function Y($){ne($)}return A.a.createElement(b.a,Object(f.a)({},H,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Y}),A.a.createElement(b.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},A.a.createElement(F.a,null)),A.a.createElement(b.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},A.a.createElement(F.a,null)),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(v.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(v.a,{type:"ghost",onClick:ae},"\u53D6\u6D88")))},B=Q("7ahc"),U=Q("HmJG"),z=Q("BjJ7"),Z=b.a.useForm,ie={width:280,marginRight:10},se={labelCol:{span:5},wrapperCol:{span:19}},Te=function(te){var ne=te.callback,ae=te.onCancel,Y=Z(),$=Object(P.a)(Y,1),J=$[0];function q(De){ne(De)}function de(De,$e){J.setFieldsValue({src:"/api/attachments/".concat(De.id),type:$e.type})}function me(De){var $e=De.target.files[0];xe($e,de)}return A.a.createElement(b.a,Object(f.a)({form:J},se,{className:"upload-image-panel",onFinish:q}),A.a.createElement(b.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},A.a.createElement("div",{className:"flex-container"},A.a.createElement(b.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},A.a.createElement(F.a,{style:ie})),A.a.createElement(he,{onFileChange:me}))),A.a.createElement(b.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u63CF\u8FF0"}]},A.a.createElement(F.a,{style:{width:264}})),A.a.createElement(b.a.Item,{style:{textAlign:"right"}},A.a.createElement(v.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(v.a,{type:"ghost",onClick:ae},"\u53D6\u6D88")))};function he(te){var ne=te.onFileChange;return A.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",A.a.createElement("input",{type:"file",onChange:ne}))}function xe(te,ne){if(!te)throw new String("\u6CA1\u6709\u6587\u4EF6");var ae=new FormData;ae.append("editormd-image-file",te),ae.append("file_param_name","editormd-image-file"),ae.append("byxhr","true");var Y=new window.XMLHttpRequest;Y.withCredentials=!0,Y.addEventListener("load",function($){ne(JSON.parse($.target.responseText),te)},!1),Y.addEventListener("error",function($){console.error($)},!1),Y.open("POST","".concat(z.a,"/api/attachments.json")),Y.send(ae)}var pe=Q("giR+"),ge=Q("fyUT"),le=Q("7Kak"),ue=Q("9yH6"),Le=ue.a.Group,Fe={margin:"0 8px"},Ie=function(te){var ne=te.callback,ae=te.onCancel;function Y($){ne($)}return A.a.createElement(b.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Y},A.a.createElement("div",{className:"flex-container"},A.a.createElement("span",{style:Fe},"\u5355\u5143\u683C\u6570\uFF1A"),A.a.createElement("span",{style:Fe},"\u884C\u6570"),A.a.createElement(b.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},A.a.createElement(ge.a,null)),A.a.createElement("span",{style:Fe},"\u5217\u6570"),A.a.createElement(b.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},A.a.createElement(ge.a,null))),A.a.createElement("div",{className:"flex-container",style:{marginTop:12}},A.a.createElement("span",{style:Fe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),A.a.createElement(b.a.Item,{name:"align"},A.a.createElement(Le,null,A.a.createElement(ue.a,{value:"default"},A.a.createElement("i",{className:"fa fa-align-justify"})),A.a.createElement(ue.a,{value:"left"},A.a.createElement("i",{className:"fa fa-align-left"})),A.a.createElement(ue.a,{value:"center"},A.a.createElement("i",{className:"fa fa-align-center"})),A.a.createElement(ue.a,{value:"right"},A.a.createElement("i",{className:"fa fa-align-right"}))))),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(v.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(v.a,{type:"ghost",onClick:ae},"\u53D6\u6D88")))},Ne=Q("m3rI"),Ue="link",Ee="upload-image",ye="code-block",_e="add-table",Me="------------",Pe={default:Me,left:":".concat(Me),center:":".concat(Me,":"),right:"".concat(Me,":")},we=Q("9VGf"),Ce,Ye;function Ge(){}var ze=0,Be=1e4,rt="\u2581",Ve=`
**\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 We(te){return/^\d+$/.test(te)?"".concat(te,"px"):te}var ve=navigator.platform.toUpperCase().indexOf("MAC")>=0,qe=ve?"Cmd":"Ctrl",Xe=(Ce={},Object(N.a)(Ce,qe+"-B","bold"),Object(N.a)(Ce,qe+"-I","italic"),Ce),be=(Ye={},Object(N.a)(Ye,Ue,"\u6DFB\u52A0\u94FE\u63A5"),Object(N.a)(Ye,ye,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(N.a)(Ye,Ee,"\u6DFB\u52A0\u56FE\u7247"),Object(N.a)(Ye,_e,"\u6DFB\u52A0\u8868\u683C"),Ye),Oe=Je.a=function(te){var ne=te.defaultValue,ae=ne===void 0?"":ne,Y=te.onChange,$=te.width,J=$===void 0?"100%":$,q=te.height,de=q===void 0?400:q,me=te.miniToolbar,De=me===void 0?!1:me,$e=te.isFocus,ot=$e===void 0?!1:$e,Qe=te.watch,pt=te.insertTemp,ct=te.mode,et=ct===void 0?"markdown":ct,Rt=te.id,ft=Rt===void 0?"markdown-editor-id":Rt,Ut=te.showResizeBar,Wt=Ut===void 0?!1:Ut,yt=te.noStorage,pr=yt===void 0?!1:yt,Ar=te.showNullButton,or=Ar===void 0?!1:Ar,dr=te.hidetoolBar,cr=dr===void 0?!1:dr,hn=te.fullScreen,bt=hn===void 0?!1:hn,Nt=te.onBlur,Ct=te.onCMBeforeChange,vt=te.onFullScreen,nt=te.className,Zt=nt===void 0?"":nt,gr=te.disablePaste,vr=gr===void 0?!1:gr,Et=te.placeholder,_r=Et===void 0?"":Et,Ir=te.values,$r=Ir===void 0?"":Ir,Re=Object(k.useState)(null),dt=Object(P.a)(Re,2),je=dt[0],Fn=dt[1],mn=Object(k.useState)(ae),Jr=Object(P.a)(mn,2),Qr=Jr[0],ut=Jr[1],Qi=Object(k.useState)(Qe),Bn=Object(P.a)(Qi,2),yr=Bn[0],fr=Bn[1],bi=Object(k.useState)(bt),jn=Object(P.a)(bi,2),sr=jn[0],pn=jn[1],Ei=Object(k.useState)(""),gn=Object(P.a)(Ei,2),Or=gn[0],Rr=gn[1],xi=Object(k.useState)(0),Wn=Object(P.a)(xi,2),Zr=Wn[0],Hn=Wn[1],Ti=Object(k.useState)(de),br=Object(P.a)(Ti,2),Si=br[0],wi=br[1],vn=Object(k.useState)(!1),Ur=Object(P.a)(vn,2),Na=Ur[0],Kn=Ur[1],qr=Object(k.useRef)(),Gn=Object(k.useRef)(),Nr=Object(k.useRef)(),en=Object(k.useRef)();Object(k.useEffect)(function(){ut($r),je==null||je.setValue($r)},[$r]),Object(k.useEffect)(function(){vt==null||vt(sr)},[sr]),Object(k.useEffect)(function(){if(qr.current){var it=E.a.fromTextArea(qr.current,{mode:et,lineNumbers:!De,lineWrapping:!0,value:ae,autoCloseTags:!0,autoCloseBrackets:!0});ot&&it.focus();function ht(mt,St){if(vr){St.preventDefault();return}var wt=St.clipboardData;if(wt){var Dt=wt.types.toString(),kt=wt.items,_t=["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"];if(Dt==="Files"||wt.types.indexOf("Files")>-1){if(St.preventDefault(),et=="stex")return;try{var Yt,Er=kt[1];((Yt=kt[0])===null||Yt===void 0?void 0:Yt.kind)==="file"&&(Er=kt[0]);var At=Er.getAsFile(),Fr=At.name.split(".").pop();xe(At,function($t){if($t.id){var Br,jr,bn;(At==null||((Br=At.type)===null||Br===void 0)?void 0:Br.indexOf("image"))>-1?it.replaceSelection("![,](/api/attachments/".concat($t.id,"?type=").concat($t.content_type,")")):(At==null||((jr=At.type)===null||jr===void 0)?void 0:jr.indexOf("video"))>-1?it.replaceSelection('<video width="100%" controls src="'.concat(Ne.a.API_SERVER,"/api/attachments/").concat($t.id,'"></video>')):(At==null||((bn=At.type)===null||bn===void 0)?void 0:bn.indexOf("pdf"))>-1?it.replaceSelection('<a href="'.concat(Ne.a.API_SERVER,"/api/attachments/").concat($t.id,"?type=").concat(At.type,'&disposition=inline" target="_blank">').concat(At.name,"</a>")):_t.includes(Fr)?it.replaceSelection('<a href="'.concat(Ne.a.API_SERVER,"/api/attachments/").concat($t.id,'?type=office&disposition=inline" target="_blank">').concat(At.name,"</a>")):it.replaceSelection("[".concat(At.name,"](").concat(Ne.a.API_SERVER,"/api/attachments/").concat($t.id,"?type=").concat($t.content_type,")"))}else($t==null?void 0:$t.status)===401&&(document.location.href="/user/login")})}catch($t){R.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return it.on("paste",ht),Fn(it),function(){it.off("paste",ht)}}},[]);var Ci=Object(k.useCallback)(function(){if(Gn.current)try{}catch(it){console.log(it,"---- to set md editor body height")}},[Si,Gn,sr]);Object(k.useEffect)(function(){function it(){var mt=new T.default(function(St){var wt=Object(D.a)(St),Dt;try{for(wt.s();!(Dt=wt.n()).done;){var kt=Dt.value;(kt.target.offsetHeight>0||kt.target.offsetWidth>0)&&(Ci(),je.setSize("100%","100%"),je.refresh())}}catch(_t){wt.e(_t)}finally{wt.f()}});return mt.observe(qr.current.parentElement),mt}if(je){var ht=it();return function(){ht.unobserve(qr.current.parentElement)}}},[je,Ci]),Object(k.useEffect)(function(){if(je){for(var it=[],ht=function(){var kt=St[mt];wt=Object(P.a)(kt,2);var _t=wt[0],Yt=wt[1],Er=Object(N.a)({},_t,function(){zn(Yt)});it.push(Er),je.addKeyMap(Er)},mt=0,St=Object.entries(Xe);mt<St.length;mt++){var wt;ht()}return function(){var Dt=Object(D.a)(it),kt;try{for(Dt.s();!(kt=Dt.n()).done;){var _t=kt.value;je.removeKeyMap(_t)}}catch(Yt){Dt.e(Yt)}finally{Dt.f()}}}},[je]),Object(k.useEffect)(function(){bt!==sr&&pn(bt)},[bt]),Object(we.a)(function(){if(!pr&&Zr>0){var it=new Date().getTime(),ht=window.sessionStorage.getItem(ft);it>=Zr+Be&&(!ht||ht!==Qr)&&(window.sessionStorage.setItem(ft,Qr),Kn(!0))}},Be),Object(k.useEffect)(function(){fr(Qe)},[je,Qe]),Object(k.useEffect)(function(){je&&(ot&&je.focus())},[je,ot]),Object(k.useEffect)(function(){if(yr&&je){var it=je.getScrollerElement();function ht(mt){var St=mt.target;if(en.current){var wt=St.scrollTop/St.scrollHeight;en.current.scrollTop=en.current.scrollHeight*wt}}return it.addEventListener("scroll",ht),function(){it.removeEventListener("scroll",ht)}}},[je,yr]),Object(k.useEffect)(function(){if(je&&Ct){function it(ht,mt){Ct(ht,mt)}return je.on("beforeChange",it),function(){je.off("beforeChange",it)}}},[je,Ct]),Object(k.useEffect)(function(){if(je&&Nt){function it(){Nt(je.getValue())}return je.on("blur",it),function(){je.off("blur",it)}}},[je,Nt]),Object(k.useEffect)(function(){if(je){function it(ht){var mt=ht.getValue();ut(mt),Hn(new Date().getTime()),ht.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Y&&Y(mt)}return je.on("change",it),function(){je.off("change",it)}}},[je,Y]),Object(k.useEffect)(function(){je&&(ae==null?(je.setValue(""),ut("")):ae!==je.getValue()&&(je.setValue(ae),ut(ae),je.setCursor(je.lineCount(),0)))},[je,ae]);var zn=Object(k.useCallback)(function(it){var ht=je.getCursor(),mt=je.getSelection(),St=mt.split(`
`);switch(it){case"bold":return je.replaceSelection("**"+mt+"**"),mt===""&&je.setCursor(ht.line,ht.ch+2),je.focus();case"italic":return je.replaceSelection("*"+mt+"*"),mt===""&&je.setCursor(ht.line,ht.ch+1),je.focus();case"code":return je.replaceSelection("`"+mt+"`"),mt===""&&je.setCursor(ht.line,ht.ch+1),je.focus();case"inline-latex":return je.replaceSelection("`$$"+mt+"$$`"),mt===""&&je.setCursor(ht.line,ht.ch+3),je.focus();case"latex":return je.replaceSelection("```latex\n"+mt+"\n```"),je.setCursor(ht.line+1,mt.length+1),je.focus();case"line-break":return je.replaceSelection(`<br/>
`),je.focus();case"list-ul":return mt===""?je.replaceSelection("- "+mt):je.replaceSelection(St.map(function(wt){return wt===""?"":"- ".concat(wt)}).join(`
`)),je.focus();case"list-ol":return mt===""?je.replaceSelection("1. "+mt):je.replaceSelection(St.map(function(wt,Dt){return wt===""?"":"".concat(Dt+1,". ").concat(wt)}).join(`
`)),je.focus();case"add-null-ch":return mt===""&&je.setCursor(ht.line,ht.ch+1),je.replaceSelection(rt),je.focus();case"inster-template-1":return mt===""&&je.setCursor(ht.line,ht.ch),je.replaceSelection(Ve),je.focus();case"eraser":return je.setValue(""),je.focus();case"trigger-watch":return fr(!yr),je.focus();case"trigger-full-screen":return pn(!sr),je.focus();case Ue:Rr(Ue);return;case ye:Rr(ye);return;case Ee:Rr(Ee);return;case _e:Rr(_e);return;default:throw new Error}},[je,yr,sr]),tn=Object(k.useCallback)(function(it){Rr("");switch(Or){case Ue:var ht=it.title,mt=it.link;return je.replaceSelection("[".concat(ht,"](").concat(mt,")")),je.focus();case ye:var St=it.language,wt=it.content;return je.replaceSelection(["```"+St,wt,"```"].join(`
`)),je.focus();case Ee:var Dt=it.src,kt=it.alt;return je.replaceSelection("![ ".concat(kt," ]( ").concat(Dt,' "').concat(kt,'" )')),je.focus();case _e:for(var _t=it.row,Yt=it.col,Er=it.align,At=`
`,Fr=0;Fr<_t;Fr++){for(var $t=[],Br=[],jr=0;jr<Yt;jr++)Fr===1&&Br.push(Pe[Er]),$t.push(" ");Fr===1&&(At+="| ".concat(Br.join(" | "),` |
`)),At+="| ".concat($t.join(Yt===1?"":" | "),` |
`)}return je.replaceSelection(At+`
`),je.focus();default:throw new Error}},[je,Or]),yn=Object(k.useMemo)(function(){switch(Or){case Ue:return A.a.createElement(X,{callback:tn,onCancel:wr});case ye:return A.a.createElement(B.b,{callback:tn,onCancel:wr});case Ee:return A.a.createElement(Te,{callback:tn,onCancel:wr});case _e:return A.a.createElement(Ie,{callback:tn,onCancel:wr});default:return null}},[Or]);function wr(){Rr("")}Object(k.useEffect)(function(){if(Nr.current){var it=Nr.current,ht=!1,mt=0;function St(kt){ht=!0,mt=kt.pageY}function wt(){ht=!1}function Dt(kt){if(ht){var _t=kt.pageY-mt;_t<0&&(_t=0),_t>300&&(_t=300);var Yt=de+_t+"px";wi(Yt)}}return it.addEventListener("mousedown",St),document.addEventListener("mousemove",Dt),document.addEventListener("mouseup",wt),function(){it.removeEventListener("mousedown",St),document.removeEventListener("mousemove",Dt),document.removeEventListener("mouseup",wt)}}},[je,Nr]),Object(k.useEffect)(function(){wi(de)},[de]);var Vn=We(J),Li=We(Si),Di={width:Vn,height:Li},Xn=Object(k.useMemo)(function(){if(Zr){var it=new Date(Zr),ht=it.getHours(),mt=it.getMinutes(),St=it.getSeconds();return ht=ht<10?"0"+ht:ht,mt=mt<10?"0"+mt:mt,St=St<10?"0"+St:St,"".concat(ht,":").concat(mt,":").concat(St)}return 0},[Zr]);function Fa(){window.sessionStorage.removeItem(ft),Kn(!1),Hn(0)}function Zi(){Kn(!1),Hn(0),je.setValue(window.sessionStorage.getItem(ft))}return A.a.createElement(k.Fragment,null,A.a.createElement("div",{className:"markdown-editor-wrapper",ref:Gn},A.a.createElement("div",{className:"markdown-editor-container ".concat(Zt," ").concat(yr?"on-preview":""," ").concat(De?"mini":""," ").concat(sr?"full-screen":""),style:Di},A.a.createElement(c,{insertTemp:pt,watch:yr,fullScreen:sr,showNullButton:or,onActionCallback:zn,hidetoolBar:cr}),A.a.createElement("div",{className:"markdown-editor-body"},A.a.createElement("div",{className:"codemirror-container"},A.a.createElement("textarea",{ref:qr,placeholder:_r})),yr?A.a.createElement("div",{ref:en,className:"preview-container"},et==="stex"&&A.a.createElement(w,{value:Qr}),et!=="stex"&&A.a.createElement(d.a,{value:Qr})):null))),Wt?A.a.createElement("a",{ref:Nr,className:"editor-resize"}):null,A.a.createElement(u.a,null,be[Or]?A.a.createElement(G.a,{centered:!0,title:be[Or],visible:!0,onCancel:wr,footer:null},yn):null))}},RotF:function(lt,Je,Q){lt.exports=Q("LSTS")},SJMd:function(lt,Je){/**
* @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 Q,ee,G,D=!1,W,R;window.PR_SHOULD_USE_CONTINUATION=!0;var P,N;(function(){var k=window,A=["break,continue,do,else,for,if,return,while"],O=[A,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],E=[O,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],T=[E,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],_=[E,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],C=[E,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],y="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",g=[E,"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=[A,"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=[A,"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=[A,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[T,C,_,g,l,o,s,d],f=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,m="str",L="kwd",x="com",h="typ",c="lit",u="pun",a="pln",v="tag",p="dec",b="src",M="atn",F="atv",H="nocode",X="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function B(Ee){for(var ye=0,_e=!1,Me=!1,Pe=0,we=Ee.length;Pe<we;++Pe){var Ce=Ee[Pe];if(Ce.ignoreCase)Me=!0;else if(/[a-z]/i.test(Ce.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){_e=!0,Me=!1;break}}var Ye={b:8,t:9,n:10,v:11,f:12,r:13};function Ge(We){var ve=We.charCodeAt(0);if(ve!==92)return ve;var qe=We.charAt(1);return ve=Ye[qe],ve||("0"<=qe&&qe<="7"?parseInt(We.substring(1),8):qe==="u"||qe==="x"?parseInt(We.substring(2),16):We.charCodeAt(1))}function ze(We){if(We<32)return(We<16?"\\x0":"\\x")+We.toString(16);var ve=String.fromCharCode(We);return ve==="\\"||ve==="-"||ve==="]"||ve==="^"?"\\"+ve:ve}function Be(We){var ve=We.substring(1,We.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),qe=[],Xe=ve[0]==="^",be=["["];Xe&&be.push("^");for(var Oe=Xe?1:0,te=ve.length;Oe<te;++Oe){var ne=ve[Oe];if(/\\[bdsw]/i.test(ne))be.push(ne);else{var ae=Ge(ne),Y;Oe+2<te&&ve[Oe+1]==="-"?(Y=Ge(ve[Oe+2]),Oe+=2):Y=ae,qe.push([ae,Y]),Y<65||ae>122||(Y<65||ae>90||qe.push([Math.max(65,ae)|32,Math.min(Y,90)|32]),Y<97||ae>122||qe.push([Math.max(97,ae)&~32,Math.min(Y,122)&~32]))}}qe.sort(function(de,me){return de[0]-me[0]||me[1]-de[1]});for(var $=[],J=[],Oe=0;Oe<qe.length;++Oe){var q=qe[Oe];q[0]<=J[1]+1?J[1]=Math.max(J[1],q[1]):$.push(J=q)}for(var Oe=0;Oe<$.length;++Oe){var q=$[Oe];be.push(ze(q[0])),q[1]>q[0]&&(q[1]+1>q[0]&&be.push("-"),be.push(ze(q[1])))}return be.push("]"),be.join("")}function rt(We){for(var ve=We.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),qe=ve.length,Xe=[],be=0,Oe=0;be<qe;++be){var te=ve[be];if(te==="(")++Oe;else if(te.charAt(0)==="\\"){var ne=+te.substring(1);ne&&(ne<=Oe?Xe[ne]=-1:ve[be]=ze(ne))}}for(var be=1;be<Xe.length;++be)Xe[be]===-1&&(Xe[be]=++ye);for(var be=0,Oe=0;be<qe;++be){var te=ve[be];if(te==="(")++Oe,Xe[Oe]||(ve[be]="(?:");else if(te.charAt(0)==="\\"){var ne=+te.substring(1);ne&&ne<=Oe&&(ve[be]="\\"+Xe[ne])}}for(var be=0;be<qe;++be)ve[be]==="^"&&ve[be+1]!=="^"&&(ve[be]="");if(We.ignoreCase&&_e)for(var be=0;be<qe;++be){var te=ve[be],ae=te.charAt(0);te.length>=2&&ae==="["?ve[be]=Be(te):ae!=="\\"&&(ve[be]=te.replace(/[a-zA-Z]/g,function(J){var q=J.charCodeAt(0);return"["+String.fromCharCode(q&~32,q|32)+"]"}))}return ve.join("")}for(var Ve=[],Pe=0,we=Ee.length;Pe<we;++Pe){var Ce=Ee[Pe];if(Ce.global||Ce.multiline)throw new Error(""+Ce);Ve.push("(?:"+rt(Ce)+")")}return new RegExp(Ve.join("|"),Me?"gi":"g")}function U(Ee,ye){var _e=/(?:^|\s)nocode(?:\s|$)/,Me=[],Pe=0,we=[],Ce=0;function Ye(Ge){var ze=Ge.nodeType;if(ze==1){if(_e.test(Ge.className))return;for(var Be=Ge.firstChild;Be;Be=Be.nextSibling)Ye(Be);var rt=Ge.nodeName.toLowerCase();(rt==="br"||rt==="li")&&(Me[Ce]=`
`,we[Ce<<1]=Pe++,we[Ce++<<1|1]=Ge)}else if(ze==3||ze==4){var Ve=Ge.nodeValue;Ve.length&&(ye?Ve=Ve.replace(/\r\n?/g,`
`):Ve=Ve.replace(/[ \t\r\n]+/g," "),Me[Ce]=Ve,we[Ce<<1]=Pe,Pe+=Ve.length,we[Ce++<<1|1]=Ge)}}return Ye(Ee),{sourceCode:Me.join("").replace(/\n$/,""),spans:we}}function z(Ee,ye,_e,Me,Pe){if(!_e)return;var we={sourceNode:Ee,pre:1,langExtension:null,numberLines:null,sourceCode:_e,spans:null,basePos:ye,decorations:null};Me(we),Pe.push.apply(Pe,we.decorations)}var Z=/\S/;function ie(Ee){for(var ye=void 0,_e=Ee.firstChild;_e;_e=_e.nextSibling){var Me=_e.nodeType;ye=Me===1?ye?Ee:_e:Me===3&&Z.test(_e.nodeValue)?Ee:ye}return ye===Ee?void 0:ye}function se(Ee,ye){var _e={},Me;(function(){for(var Ce=Ee.concat(ye),Ye=[],Ge={},ze=0,Be=Ce.length;ze<Be;++ze){var rt=Ce[ze],Ve=rt[3];if(Ve)for(var We=Ve.length;--We>=0;)_e[Ve.charAt(We)]=rt;var ve=rt[1],qe=""+ve;Ge.hasOwnProperty(qe)||(Ye.push(ve),Ge[qe]=null)}Ye.push(/[\0-\uffff]/),Me=B(Ye)})();var Pe=ye.length,we=function(Ce){for(var Ye=Ce.sourceCode,Ge=Ce.basePos,ze=Ce.sourceNode,Be=[Ge,a],rt=0,Ve=Ye.match(Me)||[],We={},ve=0,qe=Ve.length;ve<qe;++ve){var Xe=Ve[ve],be=We[Xe],Oe=void 0,te;if(typeof be=="string")te=!1;else{var ne=_e[Xe.charAt(0)];if(ne)Oe=Xe.match(ne[1]),be=ne[0];else{for(var ae=0;ae<Pe;++ae)if(ne=ye[ae],Oe=Xe.match(ne[1]),Oe){be=ne[0];break}Oe||(be=a)}te=be.length>=5&&be.substring(0,5)==="lang-",te&&!(Oe&&typeof Oe[1]=="string")&&(te=!1,be=b),te||(We[Xe]=be)}var Y=rt;if(rt+=Xe.length,!te)Be.push(Ge+Y,be);else{var $=Oe[1],J=Xe.indexOf($),q=J+$.length;Oe[2]&&(q=Xe.length-Oe[2].length,J=q-$.length);var de=be.substring(5);z(ze,Ge+Y,Xe.substring(0,J),we,Be),z(ze,Ge+Y+J,$,ue(de,$),Be),z(ze,Ge+Y+q,Xe.substring(q),we,Be)}}Ce.decorations=Be};return we}function Te(Ee){var ye=[],_e=[];Ee.tripleQuotedStrings?ye.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ee.multiLineStrings?ye.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):ye.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ee.verbatimStrings&&_e.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Me=Ee.hashComments;Me&&(Ee.cStyleComments?(Me>1?ye.push([x,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):ye.push([x,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),_e.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):ye.push([x,/^#[^\r\n]*/,null,"#"])),Ee.cStyleComments&&(_e.push([x,/^\/\/[^\r\n]*/,null]),_e.push([x,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Pe=Ee.regexLiterals;if(Pe){var we=Pe>1?"":`
\r`,Ce=we?".":"[\\S\\s]",Ye="/(?=[^/*"+we+"])(?:[^/\\x5B\\x5C"+we+"]|\\x5C"+Ce+"|\\x5B(?:[^\\x5C\\x5D"+we+"]|\\x5C"+Ce+")*(?:\\x5D|$))+/";_e.push(["lang-regex",RegExp("^"+X+"("+Ye+")")])}var Ge=Ee.types;Ge&&_e.push([h,Ge]);var ze=(""+Ee.keywords).replace(/^ | $/g,"");ze.length&&_e.push([L,new RegExp("^(?:"+ze.replace(/[\s,]+/g,"|")+")\\b"),null]),ye.push([a,/^\s+/,null,` \r
\xA0`]);var Be="^.[^\\s\\w.$@'\"`/\\\\]*";return Ee.regexLiterals&&(Be+="(?!s*/)"),_e.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(Be),null]),se(ye,_e)}var he=Te({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function xe(Ee,ye,_e){for(var Me=/(?:^|\s)nocode(?:\s|$)/,Pe=/\r\n?|\n/,we=Ee.ownerDocument,Ce=we.createElement("li");Ee.firstChild;)Ce.appendChild(Ee.firstChild);var Ye=[Ce];function Ge(ve){var qe=ve.nodeType;if(qe==1&&!Me.test(ve.className))if(ve.nodeName==="br")ze(ve),ve.parentNode&&ve.parentNode.removeChild(ve);else for(var Xe=ve.firstChild;Xe;Xe=Xe.nextSibling)Ge(Xe);else if((qe==3||qe==4)&&_e){var be=ve.nodeValue,Oe=be.match(Pe);if(Oe){var te=be.substring(0,Oe.index);ve.nodeValue=te;var ne=be.substring(Oe.index+Oe[0].length);if(ne){var ae=ve.parentNode;ae.insertBefore(we.createTextNode(ne),ve.nextSibling)}ze(ve),te||ve.parentNode.removeChild(ve)}}}function ze(ve){for(;!ve.nextSibling;)if(ve=ve.parentNode,!ve)return;function qe(Oe,te){var ne=te?Oe.cloneNode(!1):Oe,ae=Oe.parentNode;if(ae){var Y=qe(ae,1),$=Oe.nextSibling;Y.appendChild(ne);for(var J=$;J;J=$)$=J.nextSibling,Y.appendChild(J)}return ne}for(var Xe=qe(ve.nextSibling,0),be;(be=Xe.parentNode)&&be.nodeType===1;)Xe=be;Ye.push(Xe)}for(var Be=0;Be<Ye.length;++Be)Ge(Ye[Be]);ye===(ye|0)&&Ye[0].setAttribute("value",ye);var rt=we.createElement("ol");rt.className="linenums";for(var Ve=Math.max(0,ye-1|0)||0,Be=0,We=Ye.length;Be<We;++Be)Ce=Ye[Be],Ce.className="L"+(Be+Ve)%10,Ce.firstChild||Ce.appendChild(we.createTextNode("\xA0")),rt.appendChild(Ce);Ee.appendChild(rt)}function pe(Ee){var ye=/\bMSIE\s(\d+)/.exec(navigator.userAgent);ye=ye&&+ye[1]<=8;var _e=/\n/g,Me=Ee.sourceCode,Pe=Me.length,we=0,Ce=Ee.spans,Ye=Ce.length,Ge=0,ze=Ee.decorations,Be=ze.length,rt=0;ze[Be]=Pe;var Ve,We;for(We=Ve=0;We<Be;)ze[We]!==ze[We+2]?(ze[Ve++]=ze[We++],ze[Ve++]=ze[We++]):We+=2;for(Be=Ve,We=Ve=0;We<Be;){for(var ve=ze[We],qe=ze[We+1],Xe=We+2;Xe+2<=Be&&ze[Xe+1]===qe;)Xe+=2;ze[Ve++]=ve,ze[Ve++]=qe,We=Xe}Be=ze.length=Ve;var be=Ee.sourceNode,Oe="";be&&(Oe=be.style.display,be.style.display="none");try{for(var te=null;Ge<Ye;){var ne=Ce[Ge],ae=Ce[Ge+2]||Pe,Y=ze[rt+2]||Pe,Xe=Math.min(ae,Y),$=Ce[Ge+1],J;if($.nodeType!==1&&(J=Me.substring(we,Xe))){ye&&(J=J.replace(_e,"\r")),$.nodeValue=J;var q=$.ownerDocument,de=q.createElement("span");de.className=ze[rt+1];var me=$.parentNode;me.replaceChild(de,$),de.appendChild($),we<ae&&(Ce[Ge+1]=$=q.createTextNode(Me.substring(Xe,ae)),me.insertBefore($,de.nextSibling))}we=Xe,we>=ae&&(Ge+=2),we>=Y&&(rt+=2)}}finally{be&&(be.style.display=Oe)}}var ge={};function le(Ee,ye){for(var _e=ye.length;--_e>=0;){var Me=ye[_e];ge.hasOwnProperty(Me)?k.console&&console.warn("cannot override language handler %s",Me):ge[Me]=Ee}}function ue(Ee,ye){return Ee&&ge.hasOwnProperty(Ee)||(Ee=/^\s*</.test(ye)?"default-markup":"default-code"),ge[Ee]}le(he,["default-code"]),le(se([],[[a,/^[^<?]+/],[p,/^<!\w[^>]*(?:>|$)/],[x,/^<\!--[\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"]),le(se([[a,/^[\s]+/,null,` \r
`],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[v,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!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"]),le(se([],[[F,/^[\s\S]+/]]),["uq.val"]),le(Te({keywords:T,hashComments:!0,cStyleComments:!0,types:f}),["c","cc","cpp","cxx","cyc","m"]),le(Te({keywords:"null,true,false"}),["json"]),le(Te({keywords:C,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:f}),["cs"]),le(Te({keywords:_,cStyleComments:!0}),["java"]),le(Te({keywords:d,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),le(Te({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),le(Te({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),le(Te({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),le(Te({keywords:g,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),le(Te({keywords:y,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),le(se([],[[m,/^[\s\S]+/]]),["regex"]);function Le(Ee){var ye=Ee.langExtension;try{var _e=U(Ee.sourceNode,Ee.pre),Me=_e.sourceCode;Ee.sourceCode=Me,Ee.spans=_e.spans,Ee.basePos=0,ue(ye,Me)(Ee),pe(Ee)}catch(Pe){k.console&&console.log(Pe&&Pe.stack||Pe)}}function Fe(Ee,ye,_e){var Me=_e||!1,Pe=ye||null,we=document.createElement("div");we.innerHTML="<pre>"+Ee+"</pre>",we=we.firstChild,Me&&xe(we,Me,!0);var Ce={langExtension:Pe,numberLines:Me,sourceNode:we,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Le(Ce),we.innerHTML}function Ie(Ee,ye){var _e=ye||document.body,Me=_e.ownerDocument||document;function Pe(ne){return _e.getElementsByTagName(ne)}for(var we=[Pe("pre"),Pe("code"),Pe("xmp")],Ce=[],Ye=0;Ye<we.length;++Ye)for(var Ge=0,ze=we[Ye].length;Ge<ze;++Ge)Ce.push(we[Ye][Ge]);we=null;var Be=Date;Be.now||(Be={now:function(){return+new Date}});var rt=0,Ve=/\blang(?:uage)?-([\w.]+)(?!\S)/,We=/\bprettyprint\b/,ve=/\bprettyprinted\b/,qe=/pre|xmp/i,Xe=/^code$/i,be=/^(?:pre|code|xmp)$/i,Oe={};function te(){for(var ne=k.PR_SHOULD_USE_CONTINUATION?Be.now()+250:Infinity;rt<Ce.length&&Be.now()<ne;rt++){for(var ae=Ce[rt],Y=Oe,$=ae;$=$.previousSibling;){var J=$.nodeType,q=(J===7||J===8)&&$.nodeValue;if(q?!/^\??prettify\b/.test(q):J!==3||/\S/.test($.nodeValue))break;if(q){Y={},q.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Wt,yt,pr){Y[yt]=pr});break}}var de=ae.className;if((Y!==Oe||We.test(de))&&!ve.test(de)){for(var me=!1,De=ae.parentNode;De;De=De.parentNode){var $e=De.tagName;if(be.test($e)&&De.className&&We.test(De.className)){me=!0;break}}if(!me){ae.className+=" prettyprinted";var ot=Y.lang;if(!ot){ot=de.match(Ve);var Qe;!ot&&(Qe=ie(ae))&&Xe.test(Qe.tagName)&&(ot=Qe.className.match(Ve)),ot&&(ot=ot[1])}var pt;if(qe.test(ae.tagName))pt=1;else{var ct=ae.currentStyle,et=Me.defaultView,Rt=ct?ct.whiteSpace:et&&et.getComputedStyle?et.getComputedStyle(ae,null).getPropertyValue("white-space"):0;pt=Rt&&Rt.substring(0,3)==="pre"}var ft=Y.linenums;(ft=ft==="true"||+ft)||(ft=de.match(/\blinenums\b(?::(\d+))?/),ft=ft?ft[1]&&ft[1].length?+ft[1]:!0:!1),ft&&xe(ae,ft,pt);var Ut={langExtension:ot,sourceNode:ae,numberLines:ft,pre:pt,sourceCode:null,basePos:null,spans:null,decorations:null};Le(Ut)}}}rt<Ce.length?k.setTimeout(te,250):typeof Ee=="function"&&Ee()}te()}var Ne=k.PR={createSimpleLexer:se,registerLangHandler:le,sourceDecorator:Te,PR_ATTRIB_NAME:M,PR_ATTRIB_VALUE:F,PR_COMMENT:x,PR_DECLARATION:p,PR_KEYWORD:L,PR_LITERAL:c,PR_NOCODE:H,PR_PLAIN:a,PR_PUNCTUATION:u,PR_SOURCE:b,PR_STRING:m,PR_TAG:v,PR_TYPE:h,prettyPrintOne:D?k.prettyPrintOne=Fe:P=Fe,prettyPrint:N=D?k.prettyPrint=Ie:N=Ie},Ue=k.define;typeof Ue=="function"&&Ue.amd&&Ue("google-code-prettify",[],function(){return Ne})})()},SbmS:function(lt,Je,Q){lt.exports={flex_box_center:"flex_box_center___HG_ui",flex_space_between:"flex_space_between___i7dgQ",flex_box_vertical_center:"flex_box_vertical_center___25J9O",flex_box_center_end:"flex_box_center_end___Q7-xc",flex_box_column:"flex_box_column___2Q6GJ",userInfo:"userInfo___2ECUY",navInfo:"navInfo___3H3dt",actived:"actived___ilDpa",topBar:"topBar___2O4NK",tabs:"tabs___yp4Rb",active:"active___3Xgtk",list:"list___U4GMG",tags:"tags___2IWIk",searchWrp:"searchWrp___1-W5t",listMessage:"listMessage___1M4jE",deleteMsg:"deleteMsg___1HDtB",listRightMessage:"listRightMessage___1rCRK",content:"content___KsZrb",msg:"msg___35IM3",msgDate:"msgDate___ovoCe"}},UZu5:function(lt,Je,Q){},"VrN/":function(lt,Je,Q){(function(ee,G){lt.exports=G()})(this,function(){"use strict";var ee=navigator.userAgent,G=navigator.platform,D=/gecko\/\d/i.test(ee),W=/MSIE \d/.test(ee),R=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ee),P=/Edge\/(\d+)/.exec(ee),N=W||R||P,k=N&&(W?document.documentMode||6:+(P||R)[1]),A=!P&&/WebKit\//.test(ee),O=A&&/Qt\/\d+\.\d+/.test(ee),E=!P&&/Chrome\//.test(ee),T=/Opera\//.test(ee),_=/Apple Computer/.test(navigator.vendor),C=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ee),y=/PhantomJS/.test(ee),g=!P&&/AppleWebKit/.test(ee)&&/Mobile\/\w+/.test(ee),l=/Android/.test(ee),o=g||l||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ee),s=g||/Mac/.test(G),d=/\bCrOS\b/.test(ee),w=/win/i.test(G),f=T&&ee.match(/Version\/(\d*\.\d*)/);f&&(f=Number(f[1])),f&&f>=15&&(T=!1,A=!0);var m=s&&(O||T&&(f==null||f<12.11)),L=D||N&&k>=9;function x(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var n=e.className,r=x(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function 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 v(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var p;document.createRange?p=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:p=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function b(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function M(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function F(e,t){var n=e.className;x(t).test(n)||(e.className+=(n?" ":"")+t)}function H(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!x(n[r]).test(t)&&(t+=" "+n[r]);return t}var X=function(e){e.select()};g?X=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:N&&(X=function(e){try{e.select()}catch(t){}});function B(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function U(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 z(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var S=r||0,I=i||0;;){var j=e.indexOf(" ",S);if(j<0||j>=t)return I+(t-S);I+=j-S,I+=n-I%n,S=j+1}}var Z=function(){this.id=null,this.f=null,this.time=0,this.handler=B(this.onTimeout,this)};Z.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Z.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 ie(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var se=50,Te={toString:function(){return"CodeMirror.Pass"}},he={scroll:!1},xe={origin:"*mouse"},pe={origin:"+move"};function ge(e,t,n){for(var r=0,i=0;;){var S=e.indexOf(" ",r);S==-1&&(S=e.length);var I=S-r;if(S==e.length||i+I>=t)return r+Math.min(I,t-i);if(i+=S-r,i+=n-i%n,r=S+1,i>=t)return r}}var le=[""];function ue(e){for(;le.length<=e;)le.push(Le(le)+" ");return le[e]}function Le(e){return e[e.length-1]}function Fe(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Ie(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function Ne(){}function Ue(e,t){var n;return Object.create?n=Object.create(e):(Ne.prototype=e,n=new Ne),t&&U(t,n),n}var Ee=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ye(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Ee.test(e))}function _e(e,t){return t?t.source.indexOf("\\w")>-1&&ye(e)?!0:t.test(e):ye(e)}function Me(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Pe=/[\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 we(e){return e.charCodeAt(0)>=768&&Pe.test(e)}function Ce(e,t,n){for(;(n<0?t>0:t<e.length)&&we(e.charAt(t));)t+=n;return t}function Ye(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 Ge(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,S=0;S<e.length;++S){var I=e[S];(I.from<n&&I.to>t||t==n&&I.to==t)&&(r(Math.max(I.from,t),Math.min(I.to,n),I.level==1?"rtl":"ltr",S),i=!0)}i||r(t,n,"ltr")}var ze=null;function Be(e,t,n){var r;ze=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:ze=i),S.from==t&&(S.from!=S.to&&n!="before"?r=i:ze=i)}return r!=null?r:ze}var rt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(V){return V<=247?e.charAt(V):1424<=V&&V<=1524?"R":1536<=V&&V<=1785?t.charAt(V-1536):1774<=V&&V<=2220?"r":8192<=V&&V<=8203?"w":V==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,S=/[LRr]/,I=/[Lb1n]/,j=/[1n]/;function K(V,re,oe){this.level=V,this.from=re,this.to=oe}return function(V,re){var oe=re=="ltr"?"L":"R";if(V.length==0||re=="ltr"&&!r.test(V))return!1;for(var fe=V.length,ce=[],Se=0;Se<fe;++Se)ce.push(n(V.charCodeAt(Se)));for(var Ae=0,ke=oe;Ae<fe;++Ae){var He=ce[Ae];He=="m"?ce[Ae]=ke:ke=He}for(var Ze=0,Ke=oe;Ze<fe;++Ze){var tt=ce[Ze];tt=="1"&&Ke=="r"?ce[Ze]="n":S.test(tt)&&(Ke=tt,tt=="r"&&(ce[Ze]="R"))}for(var st=1,at=ce[0];st<fe-1;++st){var gt=ce[st];gt=="+"&&at=="1"&&ce[st+1]=="1"?ce[st]="1":gt==","&&at==ce[st+1]&&(at=="1"||at=="n")&&(ce[st]=at),at=gt}for(var Lt=0;Lt<fe;++Lt){var Gt=ce[Lt];if(Gt==",")ce[Lt]="N";else if(Gt=="%"){var Pt=void 0;for(Pt=Lt+1;Pt<fe&&ce[Pt]=="%";++Pt);for(var ur=Lt&&ce[Lt-1]=="!"||Pt<fe&&ce[Pt]=="1"?"1":"N",nr=Lt;nr<Pt;++nr)ce[nr]=ur;Lt=Pt-1}}for(var Ft=0,ir=oe;Ft<fe;++Ft){var Xt=ce[Ft];ir=="L"&&Xt=="1"?ce[Ft]="L":S.test(Xt)&&(ir=Xt)}for(var jt=0;jt<fe;++jt)if(i.test(ce[jt])){var Bt=void 0;for(Bt=jt+1;Bt<fe&&i.test(ce[Bt]);++Bt);for(var Mt=(jt?ce[jt-1]:oe)=="L",ar=(Bt<fe?ce[Bt]:oe)=="L",Un=Mt==ar?Mt?"L":"R":oe,Yr=jt;Yr<Bt;++Yr)ce[Yr]=Un;jt=Bt-1}for(var Qt=[],Dr,zt=0;zt<fe;)if(I.test(ce[zt])){var Ia=zt;for(++zt;zt<fe&&I.test(ce[zt]);++zt);Qt.push(new K(0,Ia,zt))}else{var kr=zt,cn=Qt.length,fn=re=="rtl"?1:0;for(++zt;zt<fe&&ce[zt]!="L";++zt);for(var er=kr;er<zt;)if(j.test(ce[er])){kr<er&&(Qt.splice(cn,0,new K(1,kr,er)),cn+=fn);var Nn=er;for(++er;er<zt&&j.test(ce[er]);++er);Qt.splice(cn,0,new K(2,Nn,er)),cn+=fn,kr=er}else++er;kr<zt&&Qt.splice(cn,0,new K(1,kr,zt))}return re=="ltr"&&(Qt[0].level==1&&(Dr=V.match(/^\s+/))&&(Qt[0].from=Dr[0].length,Qt.unshift(new K(0,0,Dr[0].length))),Le(Qt).level==1&&(Dr=V.match(/\s+$/))&&(Le(Qt).to-=Dr[0].length,Qt.push(new K(0,fe-Dr[0].length,fe)))),re=="rtl"?Qt.reverse():Qt}}();function Ve(e,t){var n=e.order;return n==null&&(n=e.order=rt(e.text,t)),n}var We=[],ve=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]||We).concat(n)}};function qe(e,t){return e._handlers&&e._handlers[t]||We}function Xe(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=ie(i,n);S>-1&&(r[t]=i.slice(0,S).concat(i.slice(S+1)))}}}function be(e,t){var n=qe(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Oe(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),be(e,n||t.type,e,t),J(t)||t.codemirrorIgnore}function te(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)ie(n,t[r])==-1&&n.push(t[r])}function ne(e,t){return qe(e,t).length>0}function ae(e){e.prototype.on=function(t,n){ve(this,t,n)},e.prototype.off=function(t,n){Xe(this,t,n)}}function Y(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function $(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function J(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function q(e){Y(e),$(e)}function de(e){return e.target||e.srcElement}function me(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var De=function(){if(N&&k<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),$e;function ot(e){if($e==null){var t=a("span","\u200B");u(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&($e=t.offsetWidth<=1&&t.offsetHeight>2&&!(N&&k<8))}var n=$e?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var Qe;function pt(e){if(Qe!=null)return Qe;var t=u(e,document.createTextNode("A\u062EA")),n=p(t,0,1).getBoundingClientRect(),r=p(t,1,2).getBoundingClientRect();return c(e),!n||n.left==n.right?!1:Qe=r.right-n.right<3}var ct=`
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),I=S.indexOf("\r");I!=-1?(n.push(S.slice(0,I)),t+=I+1):(n.push(S),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},et=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},Rt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ft=null;function Ut(e){if(ft!=null)return ft;var t=u(e,a("span","x")),n=t.getBoundingClientRect(),r=p(t,0,1).getBoundingClientRect();return ft=Math.abs(n.left-r.left)>1}var Wt={},yt={};function pr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Wt[e]=t}function Ar(e,t){yt[e]=t}function or(e){if(typeof e=="string"&&yt.hasOwnProperty(e))e=yt[e];else if(e&&typeof e.name=="string"&&yt.hasOwnProperty(e.name)){var t=yt[e.name];typeof t=="string"&&(t={name:t}),e=Ue(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return or("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return or("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function dr(e,t){t=or(t);var n=Wt[t.name];if(!n)return dr(e,"text/plain");var r=n(e,t);if(cr.hasOwnProperty(t.name)){var i=cr[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 I in t.modeProps)r[I]=t.modeProps[I];return r}var cr={};function hn(e,t){var n=cr.hasOwnProperty(e)?cr[e]:cr[e]={};U(t,n)}function bt(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 Nt(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 Ct(e,t,n){return e.startState?e.startState(t,n):!0}var vt=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};vt.prototype.eol=function(){return this.pos>=this.string.length},vt.prototype.sol=function(){return this.pos==this.lineStart},vt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},vt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},vt.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},vt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},vt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},vt.prototype.skipToEnd=function(){this.pos=this.string.length},vt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},vt.prototype.backUp=function(e){this.pos-=e},vt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=z(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},vt.prototype.indentation=function(){return z(this.string,null,this.tabSize)-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},vt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(I){return n?I.toLowerCase():I},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)}},vt.prototype.current=function(){return this.string.slice(this.start,this.pos)},vt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},vt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},vt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function nt(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 Zt(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(S){var I=S.text;i==n.line&&(I=I.slice(0,n.ch)),i==t.line&&(I=I.slice(t.ch)),r.push(I),++i}),r}function gr(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function vr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Et(e){if(e.parent==null)return null;for(var t=e.parent,n=ie(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 _r(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 I=0;I<e.lines.length;++I){var j=e.lines[I],K=j.height;if(t<K)break;t-=K}return n+I}function Ir(e,t){return t>=e.first&&t<e.first+e.size}function $r(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Re(e,t,n){if(n===void 0&&(n=null),!(this instanceof Re))return new Re(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 je(e,t){return e.sticky==t.sticky&&dt(e,t)==0}function Fn(e){return Re(e.line,e.ch)}function mn(e,t){return dt(e,t)<0?t:e}function Jr(e,t){return dt(e,t)<0?e:t}function Qr(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ut(e,t){if(t.line<e.first)return Re(e.first,0);var n=e.first+e.size-1;return t.line>n?Re(n,nt(e,n).text.length):Qi(t,nt(e,t.line).text.length)}function Qi(e,t){var n=e.ch;return n==null||n>t?Re(e.line,t):n<0?Re(e.line,0):e}function Bn(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ut(e,t[r]);return n}var yr=function(e,t){this.state=e,this.lookAhead=t},fr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};fr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},fr.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}},fr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},fr.fromSaved=function(e,t,n){return t instanceof yr?new fr(e,bt(e.mode,t.state),n,t.lookAhead):new fr(e,bt(e.mode,t),n)},fr.prototype.save=function(e){var t=e!==!1?bt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new yr(t,this.maxLookAhead):t};function bi(e,t,n,r){var i=[e.state.modeGen],S={};Wn(e,t.text,e.doc.mode,n,function(V,re){return i.push(V,re)},S,r);for(var I=n.state,j=function(V){n.baseTokens=i;var re=e.state.overlays[V],oe=1,fe=0;n.state=!0,Wn(e,t.text,re.mode,n,function(ce,Se){for(var Ae=oe;fe<ce;){var ke=i[oe];ke>ce&&i.splice(oe,1,ce,i[oe+1],ke),oe+=2,fe=Math.min(ce,ke)}if(!Se)return;if(re.opaque)i.splice(Ae,oe-Ae,ce,"overlay "+Se),oe=Ae+2;else for(;Ae<oe;Ae+=2){var He=i[Ae+1];i[Ae+1]=(He?He+" ":"")+"overlay "+Se}},S),n.state=I,n.baseTokens=null,n.baseTokenPos=1},K=0;K<e.state.overlays.length;++K)j(K);return{styles:i,classes:S.bgClass||S.textClass?S:null}}function jn(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=sr(e,Et(t)),i=t.text.length>e.options.maxHighlightLength&&bt(e.doc.mode,r.state),S=bi(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 sr(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new fr(r,!0,t);var S=Zr(e,t,n),I=S>r.first&&nt(r,S-1).stateAfter,j=I?fr.fromSaved(r,I,S):new fr(r,Ct(r.mode),S);return r.iter(S,t,function(K){pn(e,K.text,j);var V=j.line;K.stateAfter=V==t-1||V%5==0||V>=i.viewFrom&&V<i.viewTo?j.save():null,j.nextLine()}),n&&(r.modeFrontier=j.line),j}function pn(e,t,n,r){var i=e.doc.mode,S=new vt(t,e.options.tabSize,n);for(S.start=S.pos=r||0,t==""&&Ei(i,n.state);!S.eol();)gn(i,S,n.state),S.start=S.pos}function Ei(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Nt(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function gn(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Nt(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 Or=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Rr(e,t,n,r){var i=e.doc,S=i.mode,I;t=ut(i,t);var j=nt(i,t.line),K=sr(e,t.line,n),V=new vt(j.text,e.options.tabSize,K),re;for(r&&(re=[]);(r||V.pos<t.ch)&&!V.eol();)V.start=V.pos,I=gn(S,V,K.state),r&&re.push(new Or(V,I,bt(i.mode,K.state)));return r?re:new Or(V,I,K.state)}function xi(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 Wn(e,t,n,r,i,S,I){var j=n.flattenSpans;j==null&&(j=e.options.flattenSpans);var K=0,V=null,re=new vt(t,e.options.tabSize,r),oe,fe=e.options.addModeClass&&[null];for(t==""&&xi(Ei(n,r.state),S);!re.eol();){if(re.pos>e.options.maxHighlightLength?(j=!1,I&&pn(e,t,r,re.pos),re.pos=t.length,oe=null):oe=xi(gn(n,re,r.state,fe),S),fe){var ce=fe[0].name;ce&&(oe="m-"+(oe?ce+" "+oe:ce))}if(!j||V!=oe){for(;K<re.start;)K=Math.min(re.start,K+5e3),i(K,V);V=oe}re.start=re.pos}for(;K<re.pos;){var Se=Math.min(re.pos,K+5e3);i(Se,V),K=Se}}function Zr(e,t,n){for(var r,i,S=e.doc,I=n?-1:t-(e.doc.mode.innerMode?1e3:100),j=t;j>I;--j){if(j<=S.first)return S.first;var K=nt(S,j-1),V=K.stateAfter;if(V&&(!n||j+(V instanceof yr?V.lookAhead:0)<=S.modeFrontier))return j;var re=z(K.text,null,e.options.tabSize);(i==null||r>re)&&(i=j-1,r=re)}return i}function Hn(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=nt(e,r).stateAfter;if(i&&(!(i instanceof yr)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Ti=!1,br=!1;function Si(){Ti=!0}function wi(){br=!0}function vn(e,t,n){this.marker=e,this.from=t,this.to=n}function Ur(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Na(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Kn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function qr(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var S=e[i],I=S.marker,j=S.from==null||(I.inclusiveLeft?S.from<=t:S.from<t);if(j||S.from==t&&I.type=="bookmark"&&(!n||!S.marker.insertLeft)){var K=S.to==null||(I.inclusiveRight?S.to>=t:S.to>t);(r||(r=[])).push(new vn(I,S.from,K?null:S.to))}}return r}function Gn(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var S=e[i],I=S.marker,j=S.to==null||(I.inclusiveRight?S.to>=t:S.to>t);if(j||S.from==t&&I.type=="bookmark"&&(!n||S.marker.insertLeft)){var K=S.from==null||(I.inclusiveLeft?S.from<=t:S.from<t);(r||(r=[])).push(new vn(I,K?null:S.from-t,S.to==null?null:S.to-t))}}return r}function Nr(e,t){if(t.full)return null;var n=Ir(e,t.from.line)&&nt(e,t.from.line).markedSpans,r=Ir(e,t.to.line)&&nt(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,S=t.to.ch,I=dt(t.from,t.to)==0,j=qr(n,i,I),K=Gn(r,S,I),V=t.text.length==1,re=Le(t.text).length+(V?i:0);if(j)for(var oe=0;oe<j.length;++oe){var fe=j[oe];if(fe.to==null){var ce=Ur(K,fe.marker);ce?V&&(fe.to=ce.to==null?null:ce.to+re):fe.to=i}}if(K)for(var Se=0;Se<K.length;++Se){var Ae=K[Se];if(Ae.to!=null&&(Ae.to+=re),Ae.from==null){var ke=Ur(j,Ae.marker);ke||(Ae.from=re,V&&(j||(j=[])).push(Ae))}else Ae.from+=re,V&&(j||(j=[])).push(Ae)}j&&(j=en(j)),K&&K!=j&&(K=en(K));var He=[j];if(!V){var Ze=t.text.length-2,Ke;if(Ze>0&&j)for(var tt=0;tt<j.length;++tt)j[tt].to==null&&(Ke||(Ke=[])).push(new vn(j[tt].marker,null,null));for(var st=0;st<Ze;++st)He.push(Ke);He.push(K)}return He}function en(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 Ci(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(ce){if(ce.markedSpans)for(var Se=0;Se<ce.markedSpans.length;++Se){var Ae=ce.markedSpans[Se].marker;Ae.readOnly&&(!r||ie(r,Ae)==-1)&&(r||(r=[])).push(Ae)}}),!r)return null;for(var i=[{from:t,to:n}],S=0;S<r.length;++S)for(var I=r[S],j=I.find(0),K=0;K<i.length;++K){var V=i[K];if(dt(V.to,j.from)<0||dt(V.from,j.to)>0)continue;var re=[K,1],oe=dt(V.from,j.from),fe=dt(V.to,j.to);(oe<0||!I.inclusiveLeft&&!oe)&&re.push({from:V.from,to:j.from}),(fe>0||!I.inclusiveRight&&!fe)&&re.push({from:j.to,to:V.to}),i.splice.apply(i,re),K+=re.length-3}return i}function zn(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 tn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function yn(e){return e.inclusiveLeft?-1:0}function wr(e){return e.inclusiveRight?1:0}function Vn(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)||yn(e)-yn(t);if(S)return-S;var I=dt(r.to,i.to)||wr(e)-wr(t);return I||t.id-e.id}function Li(e,t){var n=br&&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||Vn(r,i.marker)<0)&&(r=i.marker);return r}function Di(e){return Li(e,!0)}function Xn(e){return Li(e,!1)}function Fa(e,t){var n=br&&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||Vn(r,S.marker)<0)&&(r=S.marker)}return r}function Zi(e,t,n,r,i){var S=nt(e,t),I=br&&S.markedSpans;if(I)for(var j=0;j<I.length;++j){var K=I[j];if(!K.marker.collapsed)continue;var V=K.marker.find(0),re=dt(V.from,n)||yn(K.marker)-yn(i),oe=dt(V.to,r)||wr(K.marker)-wr(i);if(re>=0&&oe<=0||re<=0&&oe>=0)continue;if(re<=0&&(K.marker.inclusiveRight&&i.inclusiveLeft?dt(V.to,n)>=0:dt(V.to,n)>0)||re>=0&&(K.marker.inclusiveRight&&i.inclusiveLeft?dt(V.from,r)<=0:dt(V.from,r)<0))return!0}}function it(e){for(var t;t=Di(e);)e=t.find(-1,!0).line;return e}function ht(e){for(var t;t=Xn(e);)e=t.find(1,!0).line;return e}function mt(e){for(var t,n;t=Xn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function St(e,t){var n=nt(e,t),r=it(n);return n==r?t:Et(r)}function wt(e,t){if(t>e.lastLine())return t;var n=nt(e,t),r;if(!Dt(e,n))return t;for(;r=Xn(n);)n=r.find(1,!0).line;return Et(n)+1}function Dt(e,t){var n=br&&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&&kt(e,t,r))return!0}}function kt(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return kt(e,r.line,Ur(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)&&kt(e,t,i))return!0}function _t(e){e=it(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 I=0;I<S.children.length;++I){var j=S.children[I];if(j==n)break;t+=j.height}return t}function Yt(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Di(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Xn(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 Er(e){var t=e.display,n=e.doc;t.maxLine=nt(n,n.first),t.maxLineLength=Yt(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Yt(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var At=function(e,t,n){this.text=e,tn(this,t),this.height=n?n(this):1};At.prototype.lineNo=function(){return Et(this)},ae(At);function Fr(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),zn(e),tn(e,n);var i=r?r(e):1;i!=e.height&&vr(e,i)}function $t(e){e.parent=null,zn(e)}var Br={},jr={};function bn(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?jr:Br;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Ba(e,t){var n=v("span",null,null,A?"padding-right: .1px":null),r={pre:v("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,I=void 0;r.pos=0,r.addToken=Cs,pt(e.display.measure)&&(I=Ve(S,e.doc.direction))&&(r.addToken=Ds(r.addToken,I)),r.map=[];var j=t!=e.display.externalMeasured&&Et(S);As(S,r,jn(e,S,j)),S.styleClasses&&(S.styleClasses.bgClass&&(r.bgClass=H(S.styleClasses.bgClass,r.bgClass||"")),S.styleClasses.textClass&&(r.textClass=H(S.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ot(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(A){var K=r.content.lastChild;(/\bcm-tab\b/.test(K.className)||K.querySelector&&K.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return be(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=H(r.pre.className,r.textClass||"")),r}function ws(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 Cs(e,t,n,r,i,S,I){if(!t)return;var j=e.splitSpaces?Ls(t,e.trailingSpace):t,K=e.cm.state.specialChars,V=!1,re;if(!K.test(t))e.col+=t.length,re=document.createTextNode(j),e.map.push(e.pos,e.pos+t.length,re),N&&k<9&&(V=!0),e.pos+=t.length;else{re=document.createDocumentFragment();for(var oe=0;;){K.lastIndex=oe;var fe=K.exec(t),ce=fe?fe.index-oe:t.length-oe;if(ce){var Se=document.createTextNode(j.slice(oe,oe+ce));N&&k<9?re.appendChild(a("span",[Se])):re.appendChild(Se),e.map.push(e.pos,e.pos+ce,Se),e.col+=ce,e.pos+=ce}if(!fe)break;oe+=ce+1;var Ae=void 0;if(fe[0]==" "){var ke=e.cm.options.tabSize,He=ke-e.col%ke;Ae=re.appendChild(a("span",ue(He),"cm-tab")),Ae.setAttribute("role","presentation"),Ae.setAttribute("cm-text"," "),e.col+=He}else fe[0]=="\r"||fe[0]==`
`?(Ae=re.appendChild(a("span",fe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ae.setAttribute("cm-text",fe[0]),e.col+=1):(Ae=e.cm.options.specialCharPlaceholder(fe[0]),Ae.setAttribute("cm-text",fe[0]),N&&k<9?re.appendChild(a("span",[Ae])):re.appendChild(Ae),e.col+=1);e.map.push(e.pos,e.pos+1,Ae),e.pos++}}if(e.trailingSpace=j.charCodeAt(t.length-1)==32,n||r||i||V||S||I){var Ze=n||"";r&&(Ze+=r),i&&(Ze+=i);var Ke=a("span",[re],Ze,S);if(I)for(var tt in I)I.hasOwnProperty(tt)&&tt!="style"&&tt!="class"&&Ke.setAttribute(tt,I[tt]);return e.content.appendChild(Ke)}e.content.appendChild(re)}function Ls(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 Ds(e,t){return function(n,r,i,S,I,j,K){i=i?i+" cm-force-border":"cm-force-border";for(var V=n.pos,re=V+r.length;;){for(var oe=void 0,fe=0;fe<t.length&&!(oe=t[fe],oe.to>V&&oe.from<=V);fe++);if(oe.to>=re)return e(n,r,i,S,I,j,K);e(n,r.slice(0,oe.to-V),i,S,null,j,K),S=null,r=r.slice(oe.to-V),V=oe.to}}}function ja(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 As(e,t,n){var r=e.markedSpans,i=e.text,S=0;if(!r){for(var I=1;I<n.length;I+=2)t.addToken(t,i.slice(S,S=n[I]),bn(n[I+1],t.cm.options));return}for(var j=i.length,K=0,V=1,re="",oe,fe,ce=0,Se,Ae,ke,He,Ze;;){if(ce==K){Se=Ae=ke=fe="",Ze=null,He=null,ce=Infinity;for(var Ke=[],tt=void 0,st=0;st<r.length;++st){var at=r[st],gt=at.marker;if(gt.type=="bookmark"&&at.from==K&&gt.widgetNode)Ke.push(gt);else if(at.from<=K&&(at.to==null||at.to>K||gt.collapsed&&at.to==K&&at.from==K)){if(at.to!=null&&at.to!=K&&ce>at.to&&(ce=at.to,Ae=""),gt.className&&(Se+=" "+gt.className),gt.css&&(fe=(fe?fe+";":"")+gt.css),gt.startStyle&&at.from==K&&(ke+=" "+gt.startStyle),gt.endStyle&&at.to==ce&&(tt||(tt=[])).push(gt.endStyle,at.to),gt.title&&((Ze||(Ze={})).title=gt.title),gt.attributes)for(var Lt in gt.attributes)(Ze||(Ze={}))[Lt]=gt.attributes[Lt];gt.collapsed&&(!He||Vn(He.marker,gt)<0)&&(He=at)}else at.from>K&&ce>at.from&&(ce=at.from)}if(tt)for(var Gt=0;Gt<tt.length;Gt+=2)tt[Gt+1]==ce&&(Ae+=" "+tt[Gt]);if(!He||He.from==K)for(var Pt=0;Pt<Ke.length;++Pt)ja(t,0,Ke[Pt]);if(He&&(He.from||0)==K){if(ja(t,(He.to==null?j+1:He.to)-K,He.marker,He.from==null),He.to==null)return;He.to==K&&(He=!1)}}if(K>=j)break;for(var ur=Math.min(j,ce);;){if(re){var nr=K+re.length;if(!He){var Ft=nr>ur?re.slice(0,ur-K):re;t.addToken(t,Ft,oe?oe+Se:Se,ke,K+Ft.length==ce?Ae:"",fe,Ze)}if(nr>=ur){re=re.slice(ur-K),K=ur;break}K=nr,ke=""}re=i.slice(S,S=n[V++]),oe=bn(n[V++],t.cm.options)}}}function Wa(e,t,n){this.line=t,this.rest=mt(t),this.size=this.rest?Et(Le(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Dt(e,t)}function Ai(e,t,n){for(var r=[],i,S=t;S<n;S=i){var I=new Wa(e.doc,nt(e.doc,S),S);i=S+I.size,r.push(I)}return r}var En=null;function _s(e){En?En.ops.push(e):e.ownsGroup=En={ops:[e],delayedCallbacks:[]}}function Os(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Rs(e,t){var n=e.ownsGroup;if(!n)return;try{Os(n)}finally{En=null,t(n)}}var Yn=null;function Vt(e,t){var n=qe(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;En?i=En.delayedCallbacks:Yn?i=Yn:(i=Yn=[],setTimeout(Ps,0));for(var S=function(j){i.push(function(){return n[j].apply(null,r)})},I=0;I<n.length;++I)S(I)}function Ps(){var e=Yn;Yn=null;for(var t=0;t<e.length;++t)e[t]()}function Ha(e,t,n,r){for(var i=0;i<t.changes.length;i++){var S=t.changes[i];S=="text"?ks(e,t):S=="gutter"?Ga(e,t,n,r):S=="class"?qi(e,t):S=="widget"&&Is(e,t,r)}t.changes=null}function $n(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),N&&k<8&&(e.node.style.zIndex=2)),e.node}function Ms(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=$n(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Ka(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Ba(e,t)}function ks(e,t){var n=t.text.className,r=Ka(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,qi(e,t)):n&&(t.text.className=n)}function qi(e,t){Ms(e,t),t.line.wrapClass?$n(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 Ga(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=$n(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 I=$n(t),j=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(j),I.insertBefore(j,t.text),t.line.gutterClass&&(j.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!S||!S["CodeMirror-linenumbers"])&&(t.lineNumber=j.appendChild(a("div",$r(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),S)for(var K=0;K<e.display.gutterSpecs.length;++K){var V=e.display.gutterSpecs[K].className,re=S.hasOwnProperty(V)&&S[V];re&&j.appendChild(a("div",[re],"CodeMirror-gutter-elt","left: "+r.gutterLeft[V]+"px; width: "+r.gutterWidth[V]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=x("CodeMirror-linewidget"),i=t.node.firstChild,S=void 0;i;i=S)S=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);za(e,t,n)}function Us(e,t,n,r){var i=Ka(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),qi(e,t),Ga(e,t,n,r),za(e,t,r),t.node}function za(e,t,n){if(Va(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Va(e,t.rest[r],t,n,!1)}function Va(e,t,n,r,i){if(!t.widgets)return;for(var S=$n(n),I=0,j=t.widgets;I<j.length;++I){var K=j[I],V=a("div",[K.node],"CodeMirror-linewidget"+(K.className?" "+K.className:""));K.handleMouseEvents||V.setAttribute("cm-ignore-events","true"),Ns(K,V,n,r),e.display.input.setUneditable(V),i&&K.above?S.insertBefore(V,n.gutter||n.text):S.appendChild(V),Vt(K,"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 Jn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!b(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),u(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Pr(e,t){for(var n=de(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 _i(e){return e.lineSpace.offsetTop}function ea(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Xa(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 Cr(e){return se-e.display.nativeBarWidth}function rn(e){return e.display.scroller.clientWidth-Cr(e)-e.display.barWidth}function ta(e){return e.display.scroller.clientHeight-Cr(e)-e.display.barHeight}function Fs(e,t,n){var r=e.options.lineWrapping,i=r&&rn(e);if(!t.measure.heights||r&&t.measure.width!=i){var S=t.measure.heights=[];if(r){t.measure.width=i;for(var I=t.text.firstChild.getClientRects(),j=0;j<I.length-1;j++){var K=I[j],V=I[j+1];Math.abs(K.bottom-V.bottom)>2&&S.push((K.bottom+V.top)/2-n.top)}}S.push(n.bottom-n.top)}}function Ya(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(Et(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=it(t);var n=Et(t),r=e.display.externalMeasured=new Wa(e.doc,t,n);r.lineN=n;var i=r.built=Ba(e,r);return r.text=i.pre,u(e.display.lineMeasure,i.pre),r}function $a(e,t,n,r){return Lr(e,xn(e,t),n,r)}function ra(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[on(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function xn(e,t){var n=Et(t),r=ra(e,n);r&&!r.text?r=null:r&&r.changes&&(Ha(e,r,n,la(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=Ya(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||""),I;return t.cache.hasOwnProperty(S)?I=t.cache[S]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fs(e,t.view,t.rect),t.hasHeights=!0),I=Ws(e,t,n,r),I.bogus||(t.cache[S]=I)),{left:I.left,right:I.right,top:i?I.rtop:I.top,bottom:i?I.rbottom:I.bottom}}var Ja={left:0,right:0,top:0,bottom:0};function Qa(e,t,n){for(var r,i,S,I,j,K,V=0;V<e.length;V+=3)if(j=e[V],K=e[V+1],t<j?(i=0,S=1,I="left"):t<K?(i=t-j,S=i+1):(V==e.length-3||t==K&&e[V+3]>t)&&(S=K-j,i=S-1,t>=K&&(I="right")),i!=null){if(r=e[V+2],j==K&&n==(r.insertLeft?"left":"right")&&(I=n),n=="left"&&i==0)for(;V&&e[V-2]==e[V-3]&&e[V-1].insertLeft;)r=e[(V-=3)+2],I="left";if(n=="right"&&i==K-j)for(;V<e.length-3&&e[V+3]==e[V+4]&&!e[V+5].insertLeft;)r=e[(V+=3)+2],I="right";break}return{node:r,start:i,end:S,collapse:I,coverStart:j,coverEnd:K}}function js(e,t){var n=Ja;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=Qa(t.map,n,r),S=i.node,I=i.start,j=i.end,K=i.collapse,V;if(S.nodeType==3){for(var re=0;re<4;re++){for(;I&&we(t.line.text.charAt(i.coverStart+I));)--I;for(;i.coverStart+j<i.coverEnd&&we(t.line.text.charAt(i.coverStart+j));)++j;if(N&&k<9&&I==0&&j==i.coverEnd-i.coverStart?V=S.parentNode.getBoundingClientRect():V=js(p(S,I,j).getClientRects(),r),V.left||V.right||I==0)break;j=I,I=I-1,K="right"}N&&k<11&&(V=Hs(e.display.measure,V))}else{I>0&&(K=r="right");var oe;e.options.lineWrapping&&(oe=S.getClientRects()).length>1?V=oe[r=="right"?oe.length-1:0]:V=S.getBoundingClientRect()}if(N&&k<9&&!I&&(!V||!V.left&&!V.right)){var fe=S.parentNode.getClientRects()[0];fe?V={left:fe.left,right:fe.left+Sn(e.display),top:fe.top,bottom:fe.bottom}:V=Ja}for(var ce=V.top-t.rect.top,Se=V.bottom-t.rect.top,Ae=(ce+Se)/2,ke=t.view.measure.heights,He=0;He<ke.length-1&&!(Ae<ke[He]);He++);var Ze=He?ke[He-1]:0,Ke=ke[He],tt={left:(K=="right"?V.right:V.left)-t.rect.left,right:(K=="left"?V.left:V.right)-t.rect.left,top:Ze,bottom:Ke};return!V.left&&!V.right&&(tt.bogus=!0),e.options.singleCursorHeightPerLine||(tt.rtop=ce,tt.rbottom=Se),tt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Ut(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 Za(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 qa(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Za(e.display.view[t])}function Qn(e){qa(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function eo(){return E&&l?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function to(){return E&&l?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function na(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=Jn(e.widgets[n]));return t}function Oi(e,t,n,r,i){if(!i){var S=na(t);n.top+=S,n.bottom+=S}if(r=="line")return n;r||(r="local");var I=_t(t);if(r=="local"?I+=_i(e.display):I-=e.display.viewOffset,r=="page"||r=="window"){var j=e.display.lineSpace.getBoundingClientRect();I+=j.top+(r=="window"?0:to());var K=j.left+(r=="window"?0:eo());n.left+=K,n.right+=K}return n.top+=I,n.bottom+=I,n}function ro(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=eo(),i-=to();else if(n=="local"||!n){var S=e.display.sizer.getBoundingClientRect();r+=S.left,i+=S.top}var I=e.display.lineSpace.getBoundingClientRect();return{left:r-I.left,top:i-I.top}}function ia(e,t,n,r,i){return r||(r=nt(e.doc,t.line)),Oi(e,r,$a(e,r,t.ch,i),n)}function xr(e,t,n,r,i,S){r=r||nt(e.doc,t.line),i||(i=xn(e,r));function I(Se,Ae){var ke=Lr(e,i,Se,Ae?"right":"left",S);return Ae?ke.left=ke.right:ke.right=ke.left,Oi(e,r,ke,n)}var j=Ve(r,e.doc.direction),K=t.ch,V=t.sticky;if(K>=r.text.length?(K=r.text.length,V="before"):K<=0&&(K=0,V="after"),!j)return I(V=="before"?K-1:K,V=="before");function re(Se,Ae,ke){var He=j[Ae],Ze=He.level==1;return I(ke?Se-1:Se,Ze!=ke)}var oe=Be(j,K,V),fe=ze,ce=re(K,oe,V=="before");return fe!=null&&(ce.other=re(K,fe,V!="before")),ce}function no(e,t){var n=0;t=ut(e.doc,t),e.options.lineWrapping||(n=Sn(e.display)*t.ch);var r=nt(e.doc,t.line),i=_t(r)+_i(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function aa(e,t,n,r,i){var S=Re(e,t,n);return S.xRel=i,r&&(S.outside=r),S}function oa(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return aa(r.first,0,null,-1,-1);var i=_r(r,n),S=r.first+r.size-1;if(i>S)return aa(r.first+r.size-1,nt(r,S).text.length,null,1,1);t<0&&(t=0);for(var I=nt(r,i);;){var j=Ks(e,I,i,t,n),K=Fa(I,j.ch+(j.xRel>0||j.outside>0?1:0));if(!K)return j;var V=K.find(1);if(V.line==i)return V;I=nt(r,i=V.line)}}function io(e,t,n,r){r-=na(t);var i=t.text.length,S=Ye(function(I){return Lr(e,n,I-1).bottom<=r},i,0);return i=Ye(function(I){return Lr(e,n,I).top>r},S,i),{begin:S,end:i}}function ao(e,t,n,r){n||(n=xn(e,t));var i=Oi(e,t,Lr(e,n,r),"line").top;return io(e,t,n,i)}function sa(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-=_t(t);var S=xn(e,t),I=na(t),j=0,K=t.text.length,V=!0,re=Ve(t,e.doc.direction);if(re){var oe=(e.options.lineWrapping?zs:Gs)(e,t,n,S,re,r,i);V=oe.level!=1,j=V?oe.from:oe.to-1,K=V?oe.to:oe.from-1}var fe=null,ce=null,Se=Ye(function(st){var at=Lr(e,S,st);return at.top+=I,at.bottom+=I,sa(at,r,i,!1)?(at.top<=i&&at.left<=r&&(fe=st,ce=at),!0):!1},j,K),Ae,ke,He=!1;if(ce){var Ze=r-ce.left<ce.right-r,Ke=Ze==V;Se=fe+(Ke?0:1),ke=Ke?"after":"before",Ae=Ze?ce.left:ce.right}else{!V&&(Se==K||Se==j)&&Se++,ke=Se==0?"after":Se==t.text.length?"before":Lr(e,S,Se-(V?1:0)).bottom+I<=i==V?"after":"before";var tt=xr(e,Re(n,Se,ke),"line",t,S);Ae=tt.left,He=i<tt.top?-1:i>=tt.bottom?1:0}return Se=Ce(t.text,Se,1),aa(n,Se,ke,He,r-Ae)}function Gs(e,t,n,r,i,S,I){var j=Ye(function(oe){var fe=i[oe],ce=fe.level!=1;return sa(xr(e,Re(n,ce?fe.to:fe.from,ce?"before":"after"),"line",t,r),S,I,!0)},0,i.length-1),K=i[j];if(j>0){var V=K.level!=1,re=xr(e,Re(n,V?K.from:K.to,V?"after":"before"),"line",t,r);sa(re,S,I,!0)&&re.top>I&&(K=i[j-1])}return K}function zs(e,t,n,r,i,S,I){var j=io(e,t,r,I),K=j.begin,V=j.end;/\s/.test(t.text.charAt(V-1))&&V--;for(var re=null,oe=null,fe=0;fe<i.length;fe++){var ce=i[fe];if(ce.from>=V||ce.to<=K)continue;var Se=ce.level!=1,Ae=Lr(e,r,Se?Math.min(V,ce.to)-1:Math.max(K,ce.from)).right,ke=Ae<S?S-Ae+1e9:Ae-S;(!re||oe>ke)&&(re=ce,oe=ke)}return re||(re=i[i.length-1]),re.from<K&&(re={from:K,to:re.to,level:re.level}),re.to>V&&(re={from:re.from,to:V,level:re.level}),re}var nn;function Tn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(nn==null){nn=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)nn.appendChild(document.createTextNode("x")),nn.appendChild(a("br"));nn.appendChild(document.createTextNode("x"))}u(e.measure,nn);var n=nn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function Sn(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 la(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,S=t.gutters.firstChild,I=0;S;S=S.nextSibling,++I){var j=e.display.gutterSpecs[I].className;n[j]=S.offsetLeft+S.clientLeft+i,r[j]=S.clientWidth}return{fixedPos:ua(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function ua(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function oo(e){var t=Tn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Sn(e.display)-3);return function(i){if(Dt(e.doc,i))return 0;var S=0;if(i.widgets)for(var I=0;I<i.widgets.length;I++)i.widgets[I].height&&(S+=i.widgets[I].height);return n?S+(Math.ceil(i.text.length/r)||1)*t:S+t}}function da(e){var t=e.doc,n=oo(e);t.iter(function(r){var i=n(r);i!=r.height&&vr(r,i)})}function an(e,t,n,r){var i=e.display;if(!n&&de(t).getAttribute("cm-not-content")=="true")return null;var S,I,j=i.lineSpace.getBoundingClientRect();try{S=t.clientX-j.left,I=t.clientY-j.top}catch(oe){return null}var K=oa(e,S,I),V;if(r&&K.xRel>0&&(V=nt(e.doc,K.line).text).length==K.ch){var re=z(V,V.length,e.options.tabSize)-V.length;K=Re(K.line,Math.max(0,Math.round((S-Xa(e.display).left)/Sn(e.display))-re))}return K}function on(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)br&&St(e.doc,t)<i.viewTo&&Hr(e);else if(n<=i.viewFrom)br&&wt(e.doc,n+r)>i.viewFrom?Hr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Hr(e);else if(t<=i.viewFrom){var S=Ri(e,n,n+r,1);S?(i.view=i.view.slice(S.index),i.viewFrom=S.lineN,i.viewTo+=r):Hr(e)}else if(n>=i.viewTo){var I=Ri(e,t,t,-1);I?(i.view=i.view.slice(0,I.index),i.viewTo=I.lineN):Hr(e)}else{var j=Ri(e,t,t,-1),K=Ri(e,n,n+r,1);j&&K?(i.view=i.view.slice(0,j.index).concat(Ai(e,j.lineN,K.lineN)).concat(i.view.slice(K.index)),i.viewTo+=r):Hr(e)}var V=i.externalMeasured;V&&(n<V.lineN?V.lineN+=r:t<V.lineN+V.size&&(i.externalMeasured=null))}function Wr(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[on(e,t)];if(S.node==null)return;var I=S.changes||(S.changes=[]);ie(I,n)==-1&&I.push(n)}function Hr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ri(e,t,n,r){var i=on(e,t),S,I=e.display.view;if(!br||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var j=e.display.viewFrom,K=0;K<i;K++)j+=I[K].size;if(j!=t){if(r>0){if(i==I.length-1)return null;S=j+I[i].size-t,i++}else S=j-t;t+=S,n+=S}for(;St(e.doc,n)!=n;){if(i==(r<0?0:I.length-1))return null;n+=r*I[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=Ai(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Ai(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(on(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Ai(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,on(e,n)))),r.viewTo=n}function so(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 Zn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function lo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),S=r.selection=document.createDocumentFragment(),I=0;I<n.sel.ranges.length;I++){if(!t&&I==n.sel.primIndex)continue;var j=n.sel.ranges[I];if(j.from().line>=e.display.viewTo||j.to().line<e.display.viewFrom)continue;var K=j.empty();(K||e.options.showCursorWhenSelecting)&&uo(e,j.head,i),K||Xs(e,j,S)}return r}function uo(e,t,n){var r=xr(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 Pi(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(),I=Xa(e.display),j=I.left,K=Math.max(r.sizerWidth,rn(e)-r.sizer.offsetLeft)-I.right,V=i.direction=="ltr";function re(Ke,tt,st,at){tt<0&&(tt=0),tt=Math.round(tt),at=Math.round(at),S.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Ke+`px;
top: `+tt+"px; width: "+(st==null?K-Ke:st)+`px;
height: `+(at-tt)+"px"))}function oe(Ke,tt,st){var at=nt(i,Ke),gt=at.text.length,Lt,Gt;function Pt(Ft,ir){return ia(e,Re(Ke,Ft),"div",at,ir)}function ur(Ft,ir,Xt){var jt=ao(e,at,null,Ft),Bt=ir=="ltr"==(Xt=="after")?"left":"right",Mt=Xt=="after"?jt.begin:jt.end-(/\s/.test(at.text.charAt(jt.end-1))?2:1);return Pt(Mt,Bt)[Bt]}var nr=Ve(at,i.direction);return Ge(nr,tt||0,st==null?gt:st,function(Ft,ir,Xt,jt){var Bt=Xt=="ltr",Mt=Pt(Ft,Bt?"left":"right"),ar=Pt(ir-1,Bt?"right":"left"),Un=tt==null&&Ft==0,Yr=st==null&&ir==gt,Qt=jt==0,Dr=!nr||jt==nr.length-1;if(ar.top-Mt.top<=3){var zt=(V?Un:Yr)&&Qt,Ia=(V?Yr:Un)&&Dr,kr=zt?j:(Bt?Mt:ar).left,cn=Ia?K:(Bt?ar:Mt).right;re(kr,Mt.top,cn-kr,Mt.bottom)}else{var fn,er,Nn,Ua;Bt?(fn=V&&Un&&Qt?j:Mt.left,er=V?K:ur(Ft,Xt,"before"),Nn=V?j:ur(ir,Xt,"after"),Ua=V&&Yr&&Dr?K:ar.right):(fn=V?ur(Ft,Xt,"before"):j,er=!V&&Un&&Qt?K:Mt.right,Nn=!V&&Yr&&Dr?j:ar.left,Ua=V?ur(ir,Xt,"after"):K),re(fn,Mt.top,er-fn,Mt.bottom),Mt.bottom<ar.top&&re(j,Mt.bottom,null,ar.top),re(Nn,ar.top,Ua-Nn,ar.bottom)}(!Lt||Pi(Mt,Lt)<0)&&(Lt=Mt),Pi(ar,Lt)<0&&(Lt=ar),(!Gt||Pi(Mt,Gt)<0)&&(Gt=Mt),Pi(ar,Gt)<0&&(Gt=ar)}),{start:Lt,end:Gt}}var fe=t.from(),ce=t.to();if(fe.line==ce.line)oe(fe.line,fe.ch,ce.ch);else{var Se=nt(i,fe.line),Ae=nt(i,ce.line),ke=it(Se)==it(Ae),He=oe(fe.line,fe.ch,ke?Se.text.length+1:null).end,Ze=oe(ce.line,ke?0:null,ce.ch).start;ke&&(He.top<Ze.top-2?(re(He.right,He.top,null,He.bottom),re(j,Ze.top,Ze.left,Ze.bottom)):re(He.right,He.top,Ze.left-He.right,He.bottom)),He.bottom<Ze.top&&re(j,He.bottom,null,Ze.top)}n.appendChild(S)}function ca(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()||wn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function co(e){e.state.focused||(e.display.input.focus(),fa(e))}function fo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,wn(e))},100)}function fa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(be(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(),A&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),ca(e)}function wn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(be(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 Mi(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,I=void 0,j=0;if(i.hidden)continue;if(N&&k<8){var K=i.node.offsetTop+i.node.offsetHeight;I=K-n,n=K}else{var V=i.node.getBoundingClientRect();I=V.bottom-V.top,!S&&i.text.firstChild&&(j=i.text.firstChild.getBoundingClientRect().right-V.left-1)}var re=i.line.height-I;if((re>.005||re<-.005)&&(vr(i.line,I),ho(i.line),i.rest))for(var oe=0;oe<i.rest.length;oe++)ho(i.rest[oe]);if(j>e.display.sizerWidth){var fe=Math.ceil(j/Sn(e.display));fe>e.display.maxLineLength&&(e.display.maxLineLength=fe,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function ho(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 ki(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-_i(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,S=_r(t,r),I=_r(t,i);if(n&&n.ensure){var j=n.ensure.from.line,K=n.ensure.to.line;j<S?(S=j,I=_r(t,_t(nt(t,j))+e.wrapper.clientHeight)):Math.min(K,t.lastLine())>=I&&(S=_r(t,_t(nt(t,K))-e.wrapper.clientHeight),I=K)}return{from:S,to:Math.max(I,S+1)}}function Ys(e,t){if(Oe(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&&!y){var S=a("div","\u200B",null,`position: absolute;
top: `+(t.top-n.viewOffset-_i(e.display))+`px;
height: `+(t.bottom-t.top+Cr(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?Re(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Re(t.line,t.ch+1,"before"):t);for(var S=0;S<5;S++){var I=!1,j=xr(e,t),K=!n||n==t?j:xr(e,n);i={left:Math.min(j.left,K.left),top:Math.min(j.top,K.top)-r,right:Math.max(j.left,K.left),bottom:Math.max(j.bottom,K.bottom)+r};var V=ha(e,i),re=e.doc.scrollTop,oe=e.doc.scrollLeft;if(V.scrollTop!=null&&(ei(e,V.scrollTop),Math.abs(e.doc.scrollTop-re)>1&&(I=!0)),V.scrollLeft!=null&&(sn(e,V.scrollLeft),Math.abs(e.doc.scrollLeft-oe)>1&&(I=!0)),!I)break}return i}function Js(e,t){var n=ha(e,t);n.scrollTop!=null&&ei(e,n.scrollTop),n.scrollLeft!=null&&sn(e,n.scrollLeft)}function ha(e,t){var n=e.display,r=Tn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,S=ta(e),I={};t.bottom-t.top>S&&(t.bottom=t.top+S);var j=e.doc.height+ea(n),K=t.top<r,V=t.bottom>j-r;if(t.top<i)I.scrollTop=K?0:t.top;else if(t.bottom>i+S){var re=Math.min(t.top,(V?j:t.bottom)-S);re!=i&&(I.scrollTop=re)}var oe=e.options.fixedGutter?0:n.gutters.offsetWidth,fe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-oe,ce=rn(e)-n.gutters.offsetWidth,Se=t.right-t.left>ce;return Se&&(t.right=t.left+ce),t.left<10?I.scrollLeft=0:t.left<fe?I.scrollLeft=Math.max(0,t.left+oe-(Se?0:10)):t.right>ce+fe-3&&(I.scrollLeft=t.right+(Se?0:10)-ce),I}function ma(e,t){if(t==null)return;Ii(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Cn(e){Ii(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function qn(e,t,n){(t!=null||n!=null)&&Ii(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Qs(e,t){Ii(e),e.curOp.scrollToPos=t}function Ii(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=no(e,t.from),r=no(e,t.to);mo(e,n,r,t.margin)}}function mo(e,t,n,r){var i=ha(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});qn(e,i.scrollLeft,i.scrollTop)}function ei(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||ga(e,{top:t}),po(e,t,!0),D&&ga(e),ni(e,100)}function po(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 sn(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,Eo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function ti(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ea(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+Cr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var ln=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),ve(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ve(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,N&&k<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};ln.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}},ln.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},ln.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},ln.prototype.zeroWidthHack=function(){var e=s&&!C?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Z,this.disableVert=new Z},ln.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)},ln.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ri=function(){};ri.prototype.update=function(){return{bottom:0,right:0}},ri.prototype.setScrollLeft=function(){},ri.prototype.setScrollTop=function(){},ri.prototype.clear=function(){};function Ln(e,t){t||(t=ti(e));var n=e.display.barWidth,r=e.display.barHeight;go(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Mi(e),go(e,ti(e)),n=e.display.barWidth,r=e.display.barHeight}function go(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 vo={native:ln,null:ri};function yo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&h(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new vo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ve(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"?sn(e,t):ei(e,t)},e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function un(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},_s(e.curOp)}function dn(e){var t=e.curOp;t&&Rs(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 I=0;I<t.length;I++)il(t[I])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&Er(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 Ui(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&pa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Mi(t),e.barMeasure=ti(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=$a(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+Cr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-rn(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&&sn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==M();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Ln(t,e.barMeasure),e.updatedDisplay&&ya(t,e.barMeasure),e.selectionChanged&&ca(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&co(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&bo(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&po(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&sn(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,ut(r,e.scrollToPos.from),ut(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var S=e.maybeHiddenMarkers,I=e.maybeUnhiddenMarkers;if(S)for(var j=0;j<S.length;++j)S[j].lines.length||be(S[j],"hide");if(I)for(var K=0;K<I.length;++K)I[K].lines.length&&be(I[K],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&be(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function lr(e,t){if(e.curOp)return t();un(e);try{return t()}finally{dn(e)}}function Ht(e,t){return function(){if(e.curOp)return t.apply(e,arguments);un(e);try{return t.apply(e,arguments)}finally{dn(e)}}}function qt(e){return function(){if(this.curOp)return e.apply(this,arguments);un(this);try{return e.apply(this,arguments)}finally{dn(this)}}}function Kt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);un(t);try{return e.apply(this,arguments)}finally{dn(t)}}}function ni(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,B(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=sr(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 I=S.styles,j=S.text.length>e.options.maxHighlightLength?bt(t.mode,r.state):null,K=bi(e,S,r,!0);j&&(r.state=j),S.styles=K.styles;var V=S.styleClasses,re=K.classes;re?S.styleClasses=re:V&&(S.styleClasses=null);for(var oe=!I||I.length!=S.styles.length||V!=re&&(!V||!re||V.bgClass!=re.bgClass||V.textClass!=re.textClass),fe=0;!oe&&fe<I.length;++fe)oe=I[fe]!=S.styles[fe];oe&&i.push(r.line),S.stateAfter=r.save(),r.nextLine()}else S.text.length<=e.options.maxHighlightLength&&pn(e,S.text,r),S.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return ni(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&lr(e,function(){for(var S=0;S<i.length;S++)Wr(e,i[S],"text")})}var Ui=function(e,t,n){var r=e.display;this.viewport=t,this.visible=ki(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=rn(e),this.force=n,this.dims=la(e),this.events=[]};Ui.prototype.signal=function(e,t){ne(e,t)&&this.events.push(arguments)},Ui.prototype.finish=function(){for(var e=0;e<this.events.length;e++)be.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=Cr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Cr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=M();if(!t||!b(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&b(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==M())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&b(document.body,e.anchorNode)&&b(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function pa(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Hr(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&&so(e)==0)return!1;xo(e)&&(Hr(e),t.dims=la(e));var i=r.first+r.size,S=Math.max(t.visible.from-e.options.viewportMargin,r.first),I=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>I&&n.viewTo-I<20&&(I=Math.min(i,n.viewTo)),br&&(S=St(e.doc,S),I=wt(e.doc,I));var j=S!=n.viewFrom||I!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,S,I),n.viewOffset=_t(nt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var K=so(e);if(!j&&K==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var V=sl(e);return K>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),K>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(V),c(n.cursorDiv),c(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,j&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ni(e,400)),n.updateLineNumbers=null,!0}function bo(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==rn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ea(e.display)-ta(e),n.top)}),t.visible=ki(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=ki(e.display,e.doc,n));if(!pa(e,t))break;Mi(e);var i=ti(e);Zn(e),Ln(e,i),ya(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function ga(e,t){var n=new Ui(e,t);if(pa(e,n)){Mi(e),bo(e,n);var r=ti(e);Zn(e),Ln(e,r),ya(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,S=r.lineDiv,I=S.firstChild;function j(Se){var Ae=Se.nextSibling;return A&&s&&e.display.currentWheelTarget==Se?Se.style.display="none":Se.parentNode.removeChild(Se),Ae}for(var K=r.view,V=r.viewFrom,re=0;re<K.length;re++){var oe=K[re];if(!oe.hidden)if(!oe.node||oe.node.parentNode!=S){var fe=Us(e,oe,V,n);S.insertBefore(fe,I)}else{for(;I!=oe.node;)I=j(I);var ce=i&&t!=null&&t<=V&&oe.lineNumber;oe.changes&&(ie(oe.changes,"gutter")>-1&&(ce=!1),Ha(e,oe,V,n)),ce&&(c(oe.lineNumber),oe.lineNumber.appendChild(document.createTextNode($r(e.options,V)))),I=oe.node.nextSibling}V+=oe.size}for(;I;)I=j(I)}function va(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ya(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+Cr(e)+"px"}function Eo(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=ua(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,S=r+"px",I=0;I<n.length;I++)if(!n[I].hidden){e.options.fixedGutter&&(n[I].gutter&&(n[I].gutter.style.left=S),n[I].gutterBackground&&(n[I].gutterBackground.style.left=S));var j=n[I].alignable;if(j)for(var K=0;K<j.length;K++)j[K].style.left=S}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function xo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=$r(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,I=i.offsetWidth-S;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(S,r.lineGutter.offsetWidth-I)+1,r.lineNumWidth=r.lineNumInnerWidth+I,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",va(e.display),!0}return!1}function ba(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var S=e[i],I=null;if(typeof S!="string"&&(I=S.style,S=S.className),S=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:S,style:I})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function To(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,I=i.style,j=t.appendChild(a("div",null,"CodeMirror-gutter "+S));I&&(j.style.cssText=I),S=="CodeMirror-linenumbers"&&(e.lineGutter=j,j.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",va(e)}function ii(e){To(e.display),tr(e),Eo(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=v("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=v("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var S=v("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: "+se+"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"),N&&k<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!A&&!(D&&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=ba(r.gutters,r.lineNumbers),To(i),n.init(i)}var Ni=0,hr=null;N?hr=-.53:D?hr=15:E?hr=-.7:_&&(hr=-1/3);function So(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=So(e);return t.x*=hr,t.y*=hr,t}function wo(e,t){var n=So(t),r=n.x,i=n.y,S=e.display,I=S.scroller,j=I.scrollWidth>I.clientWidth,K=I.scrollHeight>I.clientHeight;if(!(r&&j||i&&K))return;if(i&&s&&A){e:for(var V=t.target,re=S.view;V!=I;V=V.parentNode)for(var oe=0;oe<re.length;oe++)if(re[oe].node==V){e.display.currentWheelTarget=V;break e}}if(r&&!D&&!T&&hr!=null){i&&K&&ei(e,Math.max(0,I.scrollTop+i*hr)),sn(e,Math.max(0,I.scrollLeft+r*hr)),(!i||i&&K)&&Y(t),S.wheelStartX=null;return}if(i&&hr!=null){var fe=i*hr,ce=e.doc.scrollTop,Se=ce+S.wrapper.clientHeight;fe<0?ce=Math.max(0,ce+fe-50):Se=Math.min(e.doc.height,Se+fe+50),ga(e,{top:ce,bottom:Se})}Ni<20&&(S.wheelStartX==null?(S.wheelStartX=I.scrollLeft,S.wheelStartY=I.scrollTop,S.wheelDX=r,S.wheelDY=i,setTimeout(function(){if(S.wheelStartX==null)return;var Ae=I.scrollLeft-S.wheelStartX,ke=I.scrollTop-S.wheelStartY,He=ke&&S.wheelDY&&ke/S.wheelDY||Ae&&S.wheelDX&&Ae/S.wheelDX;if(S.wheelStartX=S.wheelStartY=null,!He)return;hr=(hr*Ni+He)/(Ni+1),++Ni},200)):(S.wheelDX+=r,S.wheelDY+=i))}var mr=function(e,t){this.ranges=e,this.primIndex=t};mr.prototype.primary=function(){return this.ranges[this.primIndex]},mr.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(!je(n.anchor,r.anchor)||!je(n.head,r.head))return!1}return!0},mr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new xt(Fn(this.ranges[t].anchor),Fn(this.ranges[t].head));return new mr(e,this.primIndex)},mr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},mr.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 xt=function(e,t){this.anchor=e,this.head=t};xt.prototype.from=function(){return Jr(this.anchor,this.head)},xt.prototype.to=function(){return mn(this.anchor,this.head)},xt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Tr(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(fe,ce){return dt(fe.from(),ce.from())}),n=ie(t,i);for(var S=1;S<t.length;S++){var I=t[S],j=t[S-1],K=dt(j.to(),I.from());if(r&&!I.empty()?K>0:K>=0){var V=Jr(j.from(),I.from()),re=mn(j.to(),I.to()),oe=j.empty()?I.from()==I.head:j.from()==j.head;S<=n&&--n,t.splice(--S,2,new xt(oe?re:V,oe?V:re))}}return new mr(t,n)}function Kr(e,t){return new mr([new xt(e,t||e)],0)}function Gr(e){return e.text?Re(e.from.line+e.text.length-1,Le(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Co(e,t){if(dt(e,t.from)<0)return e;if(dt(e,t.to)<=0)return Gr(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+=Gr(t).ch-t.to.ch),Re(n,r)}function Ea(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new xt(Co(i.anchor,t),Co(i.head,t)))}return Tr(e.cm,n,e.sel.primIndex)}function Lo(e,t,n){return e.line==t.line?Re(n.line,e.ch-t.ch+n.ch):Re(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Re(e.first,0),S=i,I=0;I<t.length;I++){var j=t[I],K=Lo(j.from,i,S),V=Lo(Gr(j),i,S);if(i=j.to,S=V,n=="around"){var re=e.sel.ranges[I],oe=dt(re.head,re.anchor)<0;r[I]=new xt(oe?V:K,oe?K:V)}else r[I]=new xt(K,K)}return new mr(r,e.sel.primIndex)}function xa(e){e.doc.mode=dr(e.options,e.doc.modeOption),ai(e)}function ai(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,ni(e,100),e.state.modeGen++,e.curOp&&tr(e)}function Do(e,t){return t.from.ch==0&&t.to.ch==0&&Le(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ta(e,t,n,r){function i(Ze){return n?n[Ze]:null}function S(Ze,Ke,tt){Fr(Ze,Ke,tt,r),Vt(Ze,"change",Ze,t)}function I(Ze,Ke){for(var tt=[],st=Ze;st<Ke;++st)tt.push(new At(V[st],i(st),r));return tt}var j=t.from,K=t.to,V=t.text,re=nt(e,j.line),oe=nt(e,K.line),fe=Le(V),ce=i(V.length-1),Se=K.line-j.line;if(t.full)e.insert(0,I(0,V.length)),e.remove(V.length,e.size-V.length);else if(Do(e,t)){var Ae=I(0,V.length-1);S(oe,oe.text,ce),Se&&e.remove(j.line,Se),Ae.length&&e.insert(j.line,Ae)}else if(re==oe)if(V.length==1)S(re,re.text.slice(0,j.ch)+fe+re.text.slice(K.ch),ce);else{var ke=I(1,V.length-1);ke.push(new At(fe+re.text.slice(K.ch),ce,r)),S(re,re.text.slice(0,j.ch)+V[0],i(0)),e.insert(j.line+1,ke)}else if(V.length==1)S(re,re.text.slice(0,j.ch)+V[0]+oe.text.slice(K.ch),i(0)),e.remove(j.line+1,Se);else{S(re,re.text.slice(0,j.ch)+V[0],i(0)),S(oe,fe+oe.text.slice(K.ch),ce);var He=I(1,V.length-1);Se>1&&e.remove(j.line+1,Se-1),e.insert(j.line+1,He)}Vt(e,"change",e,t)}function zr(e,t,n){function r(i,S,I){if(i.linked)for(var j=0;j<i.linked.length;++j){var K=i.linked[j];if(K.doc==S)continue;var V=I&&K.sharedHist;if(n&&!V)continue;t(K.doc,V),r(K.doc,i,V)}}r(e,null,!0)}function Ao(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,da(e),xa(e),_o(e),e.options.lineWrapping||Er(e),e.options.mode=t.modeOption,tr(e)}function _o(e){(e.doc.direction=="rtl"?F:h)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){lr(e,function(){_o(e),tr(e)})}function Fi(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 Sa(e,t){var n={from:Fn(t.from),to:Gr(t),text:Zt(e,t.from,t.to)};return Po(e,n,t.from.line,t.to.line+1),zr(e,function(r){return Po(r,n,t.from.line,t.to.line+1)},!0),n}function Oo(e){for(;e.length;){var t=Le(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Oo(e.done),Le(e.done);if(e.done.length&&!Le(e.done).ranges)return Le(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Le(e.done)}function Ro(e,t,n,r){var i=e.history;i.undone.length=0;var S=+new Date,I,j;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)=="*"))&&(I=ml(i,i.lastOp==r)))j=Le(I.changes),dt(t.from,t.to)==0&&dt(t.from,j.to)==0?j.to=Gr(t):I.changes.push(Sa(e,t));else{var K=Le(i.done);for((!K||!K.ranges)&&Bi(e.sel,i.done),I={changes:[Sa(e,t)],generation:i.generation},i.done.push(I);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,j||be(e,"historyAdded")}function pl(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||pl(e,S,Le(i.done),t))?i.done[i.done.length-1]=t:Bi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=S,i.lastSelOp=n,r&&r.clearRedo!==!1&&Oo(i.undone)}function Bi(e,t){var n=Le(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Po(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(I){I.markedSpans&&((i||(i=t["spans_"+e.id]={}))[S]=I.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 Mo(e,t){var n=yl(e,t),r=Nr(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var S=n[i],I=r[i];if(S&&I){e:for(var j=0;j<I.length;++j){for(var K=I[j],V=0;V<S.length;++V)if(S[V].marker==K.marker)continue e;S.push(K)}}else I&&(n[i]=I)}return n}function Dn(e,t,n){for(var r=[],i=0;i<e.length;++i){var S=e[i];if(S.ranges){r.push(n?mr.prototype.deepCopy.call(S):S);continue}var I=S.changes,j=[];r.push({changes:j});for(var K=0;K<I.length;++K){var V=I[K],re=void 0;if(j.push({from:V.from,to:V.to,text:V.text}),t)for(var oe in V)(re=oe.match(/^spans_(\d+)$/))&&(ie(t,Number(re[1]))>-1&&(Le(j)[oe]=V[oe],delete V[oe]))}}return r}function wa(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 xt(i,t)}else return new xt(n||t,t)}function ji(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Jt(e,new mr([wa(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]=wa(e.sel.ranges[S],t[S],null,i);var I=Tr(e.cm,r,e.sel.primIndex);Jt(e,I,n)}function Ca(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Jt(e,Tr(e.cm,i,e.sel.primIndex),r)}function Io(e,t,n,r){Jt(e,Kr(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 xt(ut(e,i[S].anchor),ut(e,i[S].head))},origin:n&&n.origin};return be(e,"beforeSelectionChange",e,r),e.cm&&be(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Tr(e.cm,r.ranges,r.ranges.length-1):t}function Uo(e,t,n){var r=e.history.done,i=Le(r);i&&i.ranges?(r[r.length-1]=t,Wi(e,t,n)):Jt(e,t,n)}function Jt(e,t,n){Wi(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Wi(e,t,n){(ne(e,"beforeSelectionChange")||e.cm&&ne(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(dt(t.primary().head,e.sel.primary().head)<0?-1:1);No(e,Bo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Cn(e.cm)}function No(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,te(e.cm)),Vt(e,"cursorActivity",e)}function Fo(e){No(e,Bo(e,e.sel,null,!1))}function Bo(e,t,n,r){for(var i,S=0;S<t.ranges.length;S++){var I=t.ranges[S],j=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[S],K=Hi(e,I.anchor,j&&j.anchor,n,r),V=Hi(e,I.head,j&&j.head,n,r);(i||K!=I.anchor||V!=I.head)&&(i||(i=t.ranges.slice(0,S)),i[S]=new xt(K,V))}return i?Tr(e.cm,i,t.primIndex):t}function An(e,t,n,r,i){var S=nt(e,t.line);if(S.markedSpans)for(var I=0;I<S.markedSpans.length;++I){var j=S.markedSpans[I],K=j.marker,V="selectLeft"in K?!K.selectLeft:K.inclusiveLeft,re="selectRight"in K?!K.selectRight:K.inclusiveRight;if((j.from==null||(V?j.from<=t.ch:j.from<t.ch))&&(j.to==null||(re?j.to>=t.ch:j.to>t.ch))){if(i&&(be(K,"beforeCursorEnter"),K.explicitlyCleared))if(S.markedSpans){--I;continue}else break;if(!K.atomic)continue;if(n){var oe=K.find(r<0?1:-1),fe=void 0;if((r<0?re:V)&&(oe=jo(e,oe,-r,oe&&oe.line==t.line?S:null)),oe&&oe.line==t.line&&(fe=dt(oe,n))&&(r<0?fe<0:fe>0))return An(e,oe,t,r,i)}var ce=K.find(r<0?-1:1);return(r<0?V:re)&&(ce=jo(e,ce,r,ce.line==t.line?S:null)),ce?An(e,ce,t,r,i):null}}return t}function Hi(e,t,n,r,i){var S=r||1,I=An(e,t,n,S,i)||!i&&An(e,t,n,S,!0)||An(e,t,n,-S,i)||!i&&An(e,t,n,-S,!0);return I||(e.cantEdit=!0,Re(e.first,0))}function jo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ut(e,Re(t.line-1)):null:n>0&&t.ch==(r||nt(e,t.line)).text.length?t.line<e.first+e.size-1?Re(t.line+1,0):null:new Re(t.line,t.ch+n)}function Wo(e){e.setSelection(Re(e.firstLine(),0),Re(e.lastLine()),he)}function Ho(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,I,j){i&&(r.from=ut(e,i)),S&&(r.to=ut(e,S)),I&&(r.text=I),j!==void 0&&(r.origin=j)}),be(e,"beforeChange",e,r),e.cm&&be(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function _n(e,t,n){if(e.cm){if(!e.cm.curOp)return Ht(e.cm,_n)(e,t,n);if(e.cm.state.suppressEdits)return}if((ne(e,"beforeChange")||e.cm&&ne(e.cm,"beforeChange"))&&(t=Ho(e,t,!0),!t))return;var r=Ti&&!n&&Ci(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Ko(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Ko(e,t)}function Ko(e,t){if(t.text.length==1&&t.text[0]==""&&dt(t.from,t.to)==0)return;var n=Ea(e,t);Ro(e,t,n,e.cm?e.cm.curOp.id:NaN),oi(e,t,n,Nr(e,t));var r=[];zr(e,function(i,S){!S&&ie(r,i.history)==-1&&(Xo(i.history,t),r.push(i.history)),oi(i,t,null,Nr(i,t))})}function Ki(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,S,I=e.sel,j=t=="undo"?i.done:i.undone,K=t=="undo"?i.undone:i.done,V=0;V<j.length&&!(S=j[V],n?S.ranges&&!S.equals(e.sel):!S.ranges);V++);if(V==j.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(S=j.pop(),S.ranges){if(Bi(S,K),n&&!S.equals(e.sel)){Jt(e,S,{clearRedo:!1});return}I=S}else if(r){j.push(S);return}else break;var re=[];Bi(I,K),K.push({changes:re,generation:i.generation}),i.generation=S.generation||++i.maxGeneration;for(var oe=ne(e,"beforeChange")||e.cm&&ne(e.cm,"beforeChange"),fe=function(Ae){var ke=S.changes[Ae];if(ke.origin=t,oe&&!Ho(e,ke,!1))return j.length=0,{};re.push(Sa(e,ke));var He=Ae?Ea(e,ke):Le(j);oi(e,ke,He,Mo(e,ke)),!Ae&&e.cm&&e.cm.scrollIntoView({from:ke.from,to:Gr(ke)});var Ze=[];zr(e,function(Ke,tt){!tt&&ie(Ze,Ke.history)==-1&&(Xo(Ke.history,ke),Ze.push(Ke.history)),oi(Ke,ke,null,Mo(Ke,ke))})},ce=S.changes.length-1;ce>=0;--ce){var Se=fe(ce);if(Se)return Se.v}}function Go(e,t){if(t==0)return;if(e.first+=t,e.sel=new mr(Fe(e.sel.ranges,function(i){return new xt(Re(i.anchor.line+t,i.anchor.ch),Re(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++)Wr(e.cm,r,"gutter")}}function oi(e,t,n,r){if(e.cm&&!e.cm.curOp)return Ht(e.cm,oi)(e,t,n,r);if(t.to.line<e.first){Go(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);Go(e,i),t={from:Re(e.first,0),to:Re(t.to.line+i,t.to.ch),text:[Le(t.text)],origin:t.origin}}var S=e.lastLine();t.to.line>S&&(t={from:t.from,to:Re(S,nt(e,S).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Zt(e,t.from,t.to),n||(n=Ea(e,t)),e.cm?El(e.cm,t,r):Ta(e,t,r),Wi(e,n,he),e.cantEdit&&Hi(e,Re(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,S=t.from,I=t.to,j=!1,K=S.line;e.options.lineWrapping||(K=Et(it(nt(r,S.line))),r.iter(K,I.line+1,function(ce){if(ce==i.maxLine)return j=!0,!0})),r.sel.contains(t.from,t.to)>-1&&te(e),Ta(r,t,n,oo(e)),e.options.lineWrapping||(r.iter(K,S.line+t.text.length,function(ce){var Se=Yt(ce);Se>i.maxLineLength&&(i.maxLine=ce,i.maxLineLength=Se,i.maxLineChanged=!0,j=!1)}),j&&(e.curOp.updateMaxLine=!0)),Hn(r,S.line),ni(e,400);var V=t.text.length-(I.line-S.line)-1;t.full?tr(e):S.line==I.line&&t.text.length==1&&!Do(e.doc,t)?Wr(e,S.line,"text"):tr(e,S.line,I.line+1,V);var re=ne(e,"changes"),oe=ne(e,"change");if(oe||re){var fe={from:S,to:I,text:t.text,removed:t.removed,origin:t.origin};oe&&Vt(e,"change",e,fe),re&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(fe)}e.display.selForContextMenu=null}function On(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)),_n(e,{from:n,to:r,text:t,origin:i})}function zo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Vo(e,t,n,r){for(var i=0;i<e.length;++i){var S=e[i],I=!0;if(S.ranges){S.copied||(S=e[i]=S.deepCopy(),S.copied=!0);for(var j=0;j<S.ranges.length;j++)zo(S.ranges[j].anchor,t,n,r),zo(S.ranges[j].head,t,n,r);continue}for(var K=0;K<S.changes.length;++K){var V=S.changes[K];if(n<V.from.line)V.from=Re(V.from.line+r,V.from.ch),V.to=Re(V.to.line+r,V.to.ch);else if(t<=V.to.line){I=!1;break}}I||(e.splice(0,i+1),i=0)}}function Xo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Vo(e.done,n,r,i),Vo(e.undone,n,r,i)}function si(e,t,n,r){var i=t,S=t;return typeof t=="number"?S=nt(e,Qr(e,t)):i=Et(t),i==null?null:(r(S,i)&&e.cm&&Wr(e.cm,i,n),S)}function li(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}li.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,$t(i),Vt(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 ui(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}ui.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),I=r.height;if(r.removeInner(e,S),this.height-=I-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 li))){var j=[];this.collapse(j),this.children=[new li(j)],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 I=i.lines.length%25+25,j=I;j<i.lines.length;){var K=new li(i.lines.slice(j,j+=25));i.height-=K.height,this.children.splice(++r,0,K),K.parent=this}i.lines=i.lines.slice(0,I),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 ui(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=ie(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new ui(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 I=Math.min(t,S-e);if(i.iterN(e,I,n))return!0;if((t-=I)==0)break;e=0}else e-=S}}};var di=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};di.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Et(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=Jn(this);vr(n,Math.max(0,n.height-S)),e&&(lr(e,function(){Yo(e,n,-S),Wr(e,r,"widget")}),Vt(e,"lineWidgetCleared",e,this,r))},di.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=Jn(this)-t;if(!i)return;Dt(this.doc,r)||vr(r,r.height+i),n&&lr(n,function(){n.curOp.forceUpdate=!0,Yo(n,r,i),Vt(n,"lineWidgetChanged",n,e,Et(r))})},ae(di);function Yo(e,t,n){_t(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&ma(e,n)}function xl(e,t,n,r){var i=new di(e,n,r),S=e.cm;return S&&i.noHScroll&&(S.display.alignWidgets=!0),si(e,t,"widget",function(I){var j=I.widgets||(I.widgets=[]);if(i.insertAt==null?j.push(i):j.splice(Math.min(j.length-1,Math.max(0,i.insertAt)),0,i),i.line=I,S&&!Dt(e,I)){var K=_t(I)<e.scrollTop;vr(I,I.height+Jn(i)),K&&ma(S,i.height),S.curOp.forceUpdate=!0}return!0}),S&&Vt(S,"lineWidgetAdded",S,i,typeof t=="number"?t:Et(t)),i}var $o=0,Vr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++$o};Vr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&un(e),ne(this,"clear")){var n=this.find();n&&Vt(this,"clear",n.from,n.to)}for(var r=null,i=null,S=0;S<this.lines.length;++S){var I=this.lines[S],j=Ur(I.markedSpans,this);e&&!this.collapsed?Wr(e,Et(I),"text"):e&&(j.to!=null&&(i=Et(I)),j.from!=null&&(r=Et(I))),I.markedSpans=Na(I.markedSpans,j),j.from==null&&this.collapsed&&!Dt(this.doc,I)&&e&&vr(I,Tn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var K=0;K<this.lines.length;++K){var V=it(this.lines[K]),re=Yt(V);re>e.display.maxLineLength&&(e.display.maxLine=V,e.display.maxLineLength=re,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&tr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Fo(e.doc)),e&&Vt(e,"markerCleared",e,this,r,i),t&&dn(e),this.parent&&this.parent.clear()},Vr.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],I=Ur(S.markedSpans,this);if(I.from!=null&&(n=Re(t?S:Et(S),I.from),e==-1))return n;if(I.to!=null&&(r=Re(t?S:Et(S),I.to),e==1))return r}return n&&{from:n,to:r}},Vr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;lr(r,function(){var i=t.line,S=Et(t.line),I=ra(r,S);if(I&&(Za(I),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Dt(n.doc,i)&&n.height!=null){var j=n.height;n.height=null;var K=Jn(n)-j;K&&vr(i,i.height+K)}Vt(r,"markerChanged",r,e)})},Vr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ie(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Vr.prototype.detachLine=function(e){if(this.lines.splice(ie(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ae(Vr);function Rn(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Ht(e.cm,Rn)(e,t,n,r,i);var S=new Vr(e,i),I=dt(t,n);if(r&&U(r,S,!1),I>0||I==0&&S.clearWhenEmpty!==!1)return S;if(S.replacedWith&&(S.collapsed=!0,S.widgetNode=v("span",[S.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||S.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(S.widgetNode.insertLeft=!0)),S.collapsed){if(Zi(e,t.line,t,n,S)||t.line!=n.line&&Zi(e,n.line,t,n,S))throw new Error("Inserting collapsed marker partially overlapping an existing one");wi()}S.addToHistory&&Ro(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var j=t.line,K=e.cm,V;if(e.iter(j,n.line+1,function(oe){K&&S.collapsed&&!K.options.lineWrapping&&it(oe)==K.display.maxLine&&(V=!0),S.collapsed&&j!=t.line&&vr(oe,0),Kn(oe,new vn(S,j==t.line?t.ch:null,j==n.line?n.ch:null)),++j}),S.collapsed&&e.iter(t.line,n.line+1,function(oe){Dt(e,oe)&&vr(oe,0)}),S.clearOnEnter&&ve(S,"beforeCursorEnter",function(){return S.clear()}),S.readOnly&&(Si(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),S.collapsed&&(S.id=++$o,S.atomic=!0),K){if(V&&(K.curOp.updateMaxLine=!0),S.collapsed)tr(K,t.line,n.line+1);else if(S.className||S.startStyle||S.endStyle||S.css||S.attributes||S.title)for(var re=t.line;re<=n.line;re++)Wr(K,re,"text");S.atomic&&Fo(K.doc),Vt(K,"markerAdded",K,S)}return S}var ci=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};ci.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Vt(this,"clear")},ci.prototype.find=function(e,t){return this.primary.find(e,t)},ae(ci);function Tl(e,t,n,r,i){r=U(r),r.shared=!1;var S=[Rn(e,t,n,r,i)],I=S[0],j=r.widgetNode;return zr(e,function(K){j&&(r.widgetNode=j.cloneNode(!0)),S.push(Rn(K,ut(K,t),ut(K,n),r,i));for(var V=0;V<K.linked.length;++V)if(K.linked[V].isParent)return;I=Le(S)}),new ci(S,I)}function Jo(e){return e.findMarks(Re(e.first,0),e.clipPos(Re(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),I=e.clipPos(i.to);if(dt(S,I)){var j=Rn(e,S,I,r.primary,r.primary.type);r.markers.push(j),j.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],S=[i.primary.doc];zr(i.primary.doc,function(K){return S.push(K)});for(var I=0;I<i.markers.length;I++){var j=i.markers[I];ie(S,j.doc)==-1&&(j.parent=null,i.markers.splice(I--,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),ui.call(this,[new li([new At("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var S=Re(n,0);this.sel=Kr(S),this.history=new Fi(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)),Ta(this,{from:S,to:S,text:e}),Jt(this,Kr(S),he)};rr.prototype=Ue(ui.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=gr(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Kt(function(e){var t=Re(this.first,0),n=this.first+this.size-1;_n(this,{from:t,to:Re(n,nt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&qn(this.cm,0,0),Jt(this,Kr(t),he)}),replaceRange:function(e,t,n,r){t=ut(this,t),n=n?ut(this,n):t,On(this,e,t,n,r)},getRange:function(e,t,n){var r=Zt(this,ut(this,e),ut(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(Ir(this,e))return nt(this,e)},getLineNumber:function(e){return Et(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=nt(this,e)),it(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ut(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:Kt(function(e,t,n){Io(this,ut(this,typeof e=="number"?Re(e,t||0):e),null,n)}),setSelection:Kt(function(e,t,n){Io(this,ut(this,e),ut(this,t||e),n)}),extendSelection:Kt(function(e,t,n){ji(this,ut(this,e),t&&ut(this,t),n)}),extendSelections:Kt(function(e,t){ko(this,Bn(this,e),t)}),extendSelectionsBy:Kt(function(e,t){var n=Fe(this.sel.ranges,e);ko(this,Bn(this,n),t)}),setSelections:Kt(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new xt(ut(this,e[i].anchor),ut(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Jt(this,Tr(this.cm,r,t),n)}),addSelection:Kt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new xt(ut(this,e),ut(this,t||e))),Jt(this,Tr(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=Zt(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=Zt(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:Kt(function(e,t,n){for(var r=[],i=this.sel,S=0;S<i.ranges.length;S++){var I=i.ranges[S];r[S]={from:I.from(),to:I.to(),text:this.splitLines(e[S]),origin:n}}for(var j=t&&t!="end"&&fl(this,r,t),K=r.length-1;K>=0;K--)_n(this,r[K]);j?Uo(this,j):this.cm&&Cn(this.cm)}),undo:Kt(function(){Ki(this,"undo")}),redo:Kt(function(){Ki(this,"redo")}),undoSelection:Kt(function(){Ki(this,"undo",!0)}),redoSelection:Kt(function(){Ki(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 Fi(this.history.maxGeneration),zr(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:Dn(this.history.done),undone:Dn(this.history.undone)}},setHistory:function(e){var t=this.history=new Fi(this.history.maxGeneration);t.done=Dn(e.done.slice(0),null,!0),t.undone=Dn(e.undone.slice(0),null,!0)},setGutterMarker:Kt(function(e,t,n){return si(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Me(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Kt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&si(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Me(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Ir(this,e))return null;if(t=e,e=nt(this,e),!e)return null}else if(t=Et(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:Kt(function(e,t,n){return si(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(x(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Kt(function(e,t,n){return si(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 I=S.match(x(n));if(!I)return!1;var j=I.index+I[0].length;r[i]=S.slice(0,I.index)+(!I.index||j==S.length?"":" ")+S.slice(j)||null}else return!1;return!0})}),addLineWidget:Kt(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Rn(this,ut(this,e),ut(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=ut(this,e),Rn(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ut(this,e);var t=[],n=nt(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=ut(this,e),t=ut(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(S){var I=S.markedSpans;if(I)for(var j=0;j<I.length;j++){var K=I[j];!(K.to!=null&&i==e.line&&e.ch>=K.to||K.from==null&&i!=e.line||K.from!=null&&i==t.line&&K.from>=t.ch)&&(!n||n(K.marker))&&r.push(K.marker.parent||K.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}),ut(this,Re(n,t))},indexFromPos:function(e){e=ut(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(gr(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(gr(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,Jo(this)),r},unlinkDoc:function(e){if(e instanceof Ot&&(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(Jo(this));break}if(e.history==this.history){var r=[e.id];zr(e,function(i){return r.push(i.id)},!0),e.history=new Fi(null),e.history.done=Dn(this.history.done,r),e.history.undone=Dn(this.history.undone,r)}},iterLinkedDocs:function(e){zr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):ct(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:Kt(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 Qo=0;function Ll(e){var t=this;if(Zo(t),Oe(t,e)||Pr(t.display,e))return;Y(e),N&&(Qo=+new Date);var n=an(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),I=0,j=function(){++I==i&&Ht(t,function(){n=ut(t.doc,n);var ce={from:n,to:n,text:t.doc.splitLines(S.filter(function(Se){return Se!=null}).join(t.doc.lineSeparator())),origin:"paste"};_n(t.doc,ce),Uo(t.doc,Kr(ut(t.doc,n),ut(t.doc,Gr(ce))))})()},K=function(ce,Se){if(t.options.allowDropFileTypes&&ie(t.options.allowDropFileTypes,ce.type)==-1){j();return}var Ae=new FileReader;Ae.onerror=function(){return j()},Ae.onload=function(){var ke=Ae.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(ke)){j();return}S[Se]=ke,j()},Ae.readAsText(ce)},V=0;V<r.length;V++)K(r[V],V);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var re=e.dataTransfer.getData("Text");if(re){var oe;if(t.state.draggingText&&!t.state.draggingText.copy&&(oe=t.listSelections()),Wi(t.doc,Kr(n,n)),oe)for(var fe=0;fe<oe.length;++fe)On(t.doc,"",oe[fe].anchor,oe[fe].head,"drag");t.replaceSelection(re,"around","paste"),t.display.input.focus()}}catch(ce){}}}function Dl(e,t){if(N&&(!e.state.draggingText||+new Date-Qo<100)){q(t);return}if(Oe(e,t)||Pr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!_){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",T&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),T&&n.parentNode.removeChild(n)}}function Al(e,t){var n=an(e,t);if(!n)return;var r=document.createDocumentFragment();uo(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 Zo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function qo(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 es=!1;function _l(){if(es)return;Ol(),es=!0}function Ol(){var e;ve(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,qo(Rl)},100))}),ve(window,"blur",function(){return qo(wn)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Xr={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"},fi=0;fi<10;fi++)Xr[fi+48]=Xr[fi+96]=String(fi);for(var Gi=65;Gi<=90;Gi++)Xr[Gi]=String.fromCharCode(Gi);for(var hi=1;hi<=12;hi++)Xr[hi+111]=Xr[hi+63235]="F"+hi;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 Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,S,I=0;I<t.length-1;I++){var j=t[I];if(/^(cmd|meta|m)$/i.test(j))S=!0;else if(/^a(lt)?$/i.test(j))n=!0;else if(/^(c|ctrl|control)$/i.test(j))r=!0;else if(/^s(hift)?$/i.test(j))i=!0;else throw new Error("Unrecognized modifier name: "+j)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),S&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Ml(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=Fe(n.split(" "),Pl),S=0;S<i.length;S++){var I=void 0,j=void 0;S==i.length-1?(j=i.join(" "),I=r):(j=i.slice(0,S+1).join(" "),I="...");var K=t[j];if(!K)t[j]=I;else if(K!=I)throw new Error("Inconsistent bindings for "+j)}delete e[n]}for(var V in t)e[V]=t[V];return e}function Pn(e,t,n,r){t=zi(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Pn(e,t.fallthrough,n,r);for(var S=0;S<t.fallthrough.length;S++){var I=Pn(e,t.fallthrough[S],n,r);if(I)return I}}}function ts(e){var t=typeof e=="string"?e:Xr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function rs(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 ns(e,t){if(T&&e.keyCode==34&&e.char)return!1;var n=Xr[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),rs(n,e,t))}function zi(e){return typeof e=="string"?Mr[e]:e}function Mn(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,Le(r).to)<=0;){var I=r.pop();if(dt(I.from,S.from)<0){S.from=I.from;break}}r.push(S)}lr(e,function(){for(var j=r.length-1;j>=0;j--)On(e.doc,"",r[j].from,r[j].to,"+delete");Cn(e)})}function La(e,t,n){var r=Ce(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Da(e,t,n){var r=La(e,t.ch,n);return r==null?null:new Re(t.line,r,n<0?"after":"before")}function Aa(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var S=Ve(n,t.doc.direction);if(S){var I=i<0?Le(S):S[0],j=i<0==(I.level==1),K=j?"after":"before",V;if(I.level>0||t.doc.direction=="rtl"){var re=xn(t,n);V=i<0?n.text.length-1:0;var oe=Lr(t,re,V).top;V=Ye(function(fe){return Lr(t,re,fe).top==oe},i<0==(I.level==1)?I.from:I.to-1,V),K=="before"&&(V=La(n,V,1))}else V=i<0?I.to:I.from;return new Re(r,V,K)}}return new Re(r,i<0?n.text.length:0,i<0?"before":"after")}function kl(e,t,n,r){var i=Ve(t,e.doc.direction);if(!i)return Da(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=Be(i,n.ch,n.sticky),I=i[S];if(e.doc.direction=="ltr"&&I.level%2==0&&(r>0?I.to>n.ch:I.from<n.ch))return Da(t,n,r);var j=function(He,Ze){return La(t,He instanceof Re?He.ch:He,Ze)},K,V=function(He){return e.options.lineWrapping?(K=K||xn(e,t),ao(e,t,K,He)):{begin:0,end:t.text.length}},re=V(n.sticky=="before"?j(n,-1):n.ch);if(e.doc.direction=="rtl"||I.level==1){var oe=I.level==1==r<0,fe=j(n,oe?1:-1);if(fe!=null&&(oe?fe<=I.to&&fe<=re.end:fe>=I.from&&fe>=re.begin)){var ce=oe?"before":"after";return new Re(n.line,fe,ce)}}var Se=function(He,Ze,Ke){for(var tt=function(Lt,Gt){return Gt?new Re(n.line,j(Lt,1),"before"):new Re(n.line,Lt,"after")};He>=0&&He<i.length;He+=Ze){var st=i[He],at=Ze>0==(st.level!=1),gt=at?Ke.begin:j(Ke.end,-1);if(st.from<=gt&&gt<st.to)return tt(gt,at);if(gt=at?st.from:j(st.to,-1),Ke.begin<=gt&&gt<Ke.end)return tt(gt,at)}},Ae=Se(S+r,r,re);if(Ae)return Ae;var ke=r>0?re.end:j(re.begin,-1);return ke!=null&&!(r>0&&ke==t.text.length)&&(Ae=Se(r>0?0:i.length-1,r,V(ke)),Ae)?Ae:null}var mi={selectAll:Wo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),he)},killLine:function(e){return Mn(e,function(t){if(t.empty()){var n=nt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Re(t.head.line+1,0)}:{from:t.head,to:Re(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Mn(e,function(t){return{from:Re(t.from().line,0),to:ut(e.doc,Re(t.to().line+1,0))}})},delLineLeft:function(e){return Mn(e,function(t){return{from:Re(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Mn(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 Mn(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(Re(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Re(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return is(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return as(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")},pe)},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")},pe)},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/)?as(e,t.head):r},pe)},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(),I=z(e.getLine(S.line),S.ch,r);t.push(ue(r-I%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return lr(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=nt(e.doc,i.line).text;if(S){if(i.ch==S.length&&(i=new Re(i.line,i.ch-1)),i.ch>0)i=new Re(i.line,i.ch+1),e.replaceRange(S.charAt(i.ch-1)+S.charAt(i.ch-2),Re(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var I=nt(e.doc,i.line-1).text;I&&(i=new Re(i.line,1),e.replaceRange(S.charAt(0)+e.doc.lineSeparator()+I.charAt(I.length-1),Re(i.line-1,I.length-1),i,"+transpose"))}}n.push(new xt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return lr(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);Cn(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function is(e,t){var n=nt(e.doc,t),r=it(n);return r!=n&&(t=Et(r)),Aa(!0,e,r,t,1)}function Il(e,t){var n=nt(e.doc,t),r=ht(n);return r!=n&&(t=Et(r)),Aa(!0,e,n,t,-1)}function as(e,t){var n=is(e,t.line),r=nt(e.doc,n.line),i=Ve(r,e.doc.direction);if(!i||i[0].level==0){var S=Math.max(n.ch,r.text.search(/\S/)),I=t.line==n.line&&t.ch<=S&&t.ch;return Re(n.line,I?0:S,n.sticky)}return n}function Vi(e,t,n){if(typeof t=="string"&&(t=mi[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Te}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Ul(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Pn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Pn(t,e.options.extraKeys,n,e)||Pn(t,e.options.keyMap,n,e)}var Nl=new Z;function pi(e,t,n,r){var i=e.state.keySeq;if(i){if(ts(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())}),os(e,i+" "+t,n,r))return!0}return os(e,t,n,r)}function os(e,t,n,r){var i=Ul(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Vt(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(Y(n),ca(e)),!!i}function ss(e,t){var n=ns(t,!0);return n?t.shiftKey&&!e.state.keySeq?pi(e,"Shift-"+n,t,function(r){return Vi(e,r,!0)})||pi(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Vi(e,r)}):pi(e,n,t,function(r){return Vi(e,r)}):!1}function Fl(e,t,n){return pi(e,"'"+n+"'",t,function(r){return Vi(e,r,!0)})}var _a=null;function ls(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=M(),Oe(t,e))return;N&&k<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=ss(t,e);T&&(_a=r?n:null,!r&&n==88&&!Rt&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!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"),Xe(document,"keyup",n),Xe(document,"mouseover",n))}ve(document,"keyup",n),ve(document,"mouseover",n)}function us(e){e.keyCode==16&&(this.doc.sel.shift=!1),Oe(this,e)}function ds(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Pr(t.display,e)||Oe(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(T&&n==_a){_a=null,Y(e);return}if(T&&(!e.which||e.which<10)&&ss(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Fl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Oa=function(e,t,n){this.time=e,this.pos=t,this.button=n};Oa.prototype.compare=function(e,t,n){return this.time+jl>e&&dt(t,this.pos)==0&&n==this.button};var gi,vi;function Wl(e,t){var n=+new Date;return vi&&vi.compare(n,e,t)?(gi=vi=null,"triple"):gi&&gi.compare(n,e,t)?(vi=new Oa(n,e,t),gi=null,"double"):(gi=new Oa(n,e,t),vi=null,"single")}function cs(e){var t=this,n=t.display;if(Oe(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Pr(n,e)){A||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ra(t,e))return;var r=an(t,e),i=me(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):de(e)==n.scroller&&Y(e):i==2?(r&&ji(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(L?t.display.input.onContextMenu(e):fo(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,pi(e,rs(S,i),i,function(I){if(typeof I=="string"&&(I=mi[I]),!I)return!1;var j=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),j=I(e,n)!=Te}finally{e.state.suppressEdits=!1}return j})}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){N?setTimeout(B(co,e),0):e.curOp.focus=M();var i=Kl(e,n,r),S=e.doc.sel,I;e.options.dragDrop&&De&&!e.isReadOnly()&&n=="single"&&(I=S.contains(t))>-1&&(dt((I=S.ranges[I]).from(),t)<0||t.xRel>0)&&(dt(I.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,I=Ht(e,function(V){A&&(i.scroller.draggable=!1),e.state.draggingText=!1,Xe(i.wrapper.ownerDocument,"mouseup",I),Xe(i.wrapper.ownerDocument,"mousemove",j),Xe(i.scroller,"dragstart",K),Xe(i.scroller,"drop",I),S||(Y(V),r.addNew||ji(e.doc,n,null,null,r.extend),A&&!_||N&&k==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),j=function(V){S=S||Math.abs(t.clientX-V.clientX)+Math.abs(t.clientY-V.clientY)>=10},K=function(){return S=!0};A&&(i.scroller.draggable=!0),e.state.draggingText=I,I.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),ve(i.wrapper.ownerDocument,"mouseup",I),ve(i.wrapper.ownerDocument,"mousemove",j),ve(i.scroller,"dragstart",K),ve(i.scroller,"drop",I),fo(e),setTimeout(function(){return i.input.focus()},20)}function fs(e,t,n){if(n=="char")return new xt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new xt(Re(t.line,0),ut(e.doc,Re(t.line+1,0)));var r=n(e,t);return new xt(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,S=e.doc;Y(t);var I,j,K=S.sel,V=K.ranges;if(r.addNew&&!r.extend?(j=S.sel.contains(n),j>-1?I=V[j]:I=new xt(n,n)):(I=S.sel.primary(),j=S.sel.primIndex),r.unit=="rectangle")r.addNew||(I=new xt(n,n)),n=an(e,t,!0,!0),j=-1;else{var re=fs(e,n,r.unit);r.extend?I=wa(I,re.anchor,re.head,r.extend):I=re}r.addNew?j==-1?(j=V.length,Jt(S,Tr(e,V.concat([I]),j),{scroll:!1,origin:"*mouse"})):V.length>1&&V[j].empty()&&r.unit=="char"&&!r.extend?(Jt(S,Tr(e,V.slice(0,j).concat(V.slice(j+1)),0),{scroll:!1,origin:"*mouse"}),K=S.sel):Ca(S,j,I,xe):(j=0,Jt(S,new mr([I],0),xe),K=S.sel);var oe=n;function fe(Ke){if(dt(oe,Ke)==0)return;if(oe=Ke,r.unit=="rectangle"){for(var tt=[],st=e.options.tabSize,at=z(nt(S,n.line).text,n.ch,st),gt=z(nt(S,Ke.line).text,Ke.ch,st),Lt=Math.min(at,gt),Gt=Math.max(at,gt),Pt=Math.min(n.line,Ke.line),ur=Math.min(e.lastLine(),Math.max(n.line,Ke.line));Pt<=ur;Pt++){var nr=nt(S,Pt).text,Ft=ge(nr,Lt,st);Lt==Gt?tt.push(new xt(Re(Pt,Ft),Re(Pt,Ft))):nr.length>Ft&&tt.push(new xt(Re(Pt,Ft),Re(Pt,ge(nr,Gt,st))))}tt.length||tt.push(new xt(n,n)),Jt(S,Tr(e,K.ranges.slice(0,j).concat(tt),j),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ke)}else{var ir=I,Xt=fs(e,Ke,r.unit),jt=ir.anchor,Bt;dt(Xt.anchor,jt)>0?(Bt=Xt.head,jt=Jr(ir.from(),Xt.anchor)):(Bt=Xt.anchor,jt=mn(ir.to(),Xt.head));var Mt=K.ranges.slice(0);Mt[j]=Xl(e,new xt(ut(S,jt),Bt)),Jt(S,Tr(e,Mt,j),xe)}}var ce=i.wrapper.getBoundingClientRect(),Se=0;function Ae(Ke){var tt=++Se,st=an(e,Ke,!0,r.unit=="rectangle");if(!st)return;if(dt(st,oe)!=0){e.curOp.focus=M(),fe(st);var at=ki(i,S);(st.line>=at.to||st.line<at.from)&&setTimeout(Ht(e,function(){Se==tt&&Ae(Ke)}),150)}else{var gt=Ke.clientY<ce.top?-20:Ke.clientY>ce.bottom?20:0;gt&&setTimeout(Ht(e,function(){if(Se!=tt)return;i.scroller.scrollTop+=gt,Ae(Ke)}),50)}}function ke(Ke){e.state.selectingText=!1,Se=Infinity,Ke&&(Y(Ke),i.input.focus()),Xe(i.wrapper.ownerDocument,"mousemove",He),Xe(i.wrapper.ownerDocument,"mouseup",Ze),S.history.lastSelOrigin=null}var He=Ht(e,function(Ke){Ke.buttons===0||!me(Ke)?ke(Ke):Ae(Ke)}),Ze=Ht(e,ke);e.state.selectingText=Ze,ve(i.wrapper.ownerDocument,"mousemove",He),ve(i.wrapper.ownerDocument,"mouseup",Ze)}function Xl(e,t){var n=t.anchor,r=t.head,i=nt(e.doc,n.line);if(dt(n,r)==0&&n.sticky==r.sticky)return t;var S=Ve(i);if(!S)return t;var I=Be(S,n.ch,n.sticky),j=S[I];if(j.from!=n.ch&&j.to!=n.ch)return t;var K=I+(j.from==n.ch==(j.level!=1)?0:1);if(K==0||K==S.length)return t;var V;if(r.line!=n.line)V=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var re=Be(S,r.ch,r.sticky),oe=re-I||(r.ch-n.ch)*(j.level==1?-1:1);re==K-1||re==K?V=oe<0:V=oe>0}var fe=S[K+(V?-1:0)],ce=V==(fe.level==1),Se=ce?fe.from:fe.to,Ae=ce?"after":"before";return n.ch==Se&&n.sticky==Ae?t:new xt(new Re(n.line,Se,Ae),r)}function hs(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(fe){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Y(t);var I=e.display,j=I.lineDiv.getBoundingClientRect();if(S>j.bottom||!ne(e,n))return J(t);S-=j.top-I.viewOffset;for(var K=0;K<e.display.gutterSpecs.length;++K){var V=I.gutters.childNodes[K];if(V&&V.getBoundingClientRect().right>=i){var re=_r(e.doc,S),oe=e.display.gutterSpecs[K];return be(e,n,e,re,oe.className,t),J(t)}}}function Ra(e,t){return hs(e,t,"gutterClick",!0)}function ms(e,t){if(Pr(e.display,t)||Yl(e,t))return;if(Oe(e,t,"contextmenu"))return;L||e.display.input.onContextMenu(t)}function Yl(e,t){return ne(e,"gutterContextMenu")?hs(e,t,"gutterContextMenu",!1):!1}function ps(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Qn(e)}var kn={toString:function(){return"CodeMirror.Init"}},gs={},Xi={};function $l(e){var t=e.optionHandlers;function n(r,i,S,I){e.defaults[r]=i,S&&(t[r]=I?function(j,K,V){V!=kn&&S(j,K,V)}:S)}e.defineOption=n,e.Init=kn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,xa(r)},!0),n("indentUnit",2,xa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){ai(r),Qn(r),tr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var S=[],I=r.doc.first;r.doc.iter(function(K){for(var V=0;;){var re=K.text.indexOf(i,V);if(re==-1)break;V=re+i.length,S.push(Re(I,re))}I++});for(var j=S.length-1;j>=0;j--)On(r.doc,i,S[j],Re(S[j].line,S[j].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!=kn&&r.refresh()}),n("specialCharPlaceholder",ws,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",!w),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){ps(r),ii(r)},!0),n("keyMap","default",function(r,i,S){var I=zi(i),j=S!=kn&&zi(S);j&&j.detach&&j.detach(r,I),I.attach&&I.attach(r,j||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ql,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=ba(i,r.options.lineNumbers),ii(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?ua(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Ln(r)},!0),n("scrollbarStyle","native",function(r){yo(r),Ln(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=ba(r.options.gutters,i),ii(r)},!0),n("firstLineNumber",1,ii,!0),n("lineNumberFormatter",function(r){return r},ii,!0),n("showCursorWhenSelecting",!1,Zn,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(wn(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,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,Zn,!0),n("singleCursorHeightPerLine",!0,Zn,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,ai,!0),n("addModeClass",!1,ai,!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,ai,!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 Jl(e,t,n){var r=n&&n!=kn;if(!t!=!r){var i=e.display.dragFunctions,S=t?ve:Xe;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 Ql(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"),Er(e)),da(e),tr(e),Qn(e),setTimeout(function(){return Ln(e)},100)}function Ot(e,t){var n=this;if(!(this instanceof Ot))return new Ot(e,t);this.options=t=t?U(t):{},U(gs,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 Ot.inputStyles[t.inputStyle](this),S=this.display=new dl(e,r,i,t);S.wrapper.CodeMirror=this,ps(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),yo(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 Z,keySeq:null,specialChars:null},t.autofocus&&!o&&S.input.focus(),N&&k<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),_l(),un(this),this.curOp.forceUpdate=!0,Ao(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&fa(n)},20):wn(this);for(var I in Xi)Xi.hasOwnProperty(I)&&Xi[I](this,t[I],kn);xo(this),t.finishInit&&t.finishInit(this);for(var j=0;j<Pa.length;++j)Pa[j](this);dn(this),A&&t.lineWrapping&&getComputedStyle(S.lineDiv).textRendering=="optimizelegibility"&&(S.lineDiv.style.textRendering="auto")}Ot.defaults=gs,Ot.optionHandlers=Xi;function Zl(e){var t=e.display;ve(t.scroller,"mousedown",Ht(e,cs)),N&&k<11?ve(t.scroller,"dblclick",Ht(e,function(K){if(Oe(e,K))return;var V=an(e,K);if(!V||Ra(e,K)||Pr(e.display,K))return;Y(K);var re=e.findWordAt(V);ji(e.doc,re.anchor,re.head)})):ve(t.scroller,"dblclick",function(K){return Oe(e,K)||Y(K)}),ve(t.scroller,"contextmenu",function(K){return ms(e,K)}),ve(t.input.getField(),"contextmenu",function(K){t.scroller.contains(K.target)||ms(e,K)});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(K){if(K.touches.length!=1)return!1;var V=K.touches[0];return V.radiusX<=1&&V.radiusY<=1}function I(K,V){if(V.left==null)return!0;var re=V.left-K.left,oe=V.top-K.top;return re*re+oe*oe>20*20}ve(t.scroller,"touchstart",function(K){if(!Oe(e,K)&&!S(K)&&!Ra(e,K)){t.input.ensurePolled(),clearTimeout(n);var V=+new Date;t.activeTouch={start:V,moved:!1,prev:V-r.end<=300?r:null},K.touches.length==1&&(t.activeTouch.left=K.touches[0].pageX,t.activeTouch.top=K.touches[0].pageY)}}),ve(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ve(t.scroller,"touchend",function(K){var V=t.activeTouch;if(V&&!Pr(t,K)&&V.left!=null&&!V.moved&&new Date-V.start<300){var re=e.coordsChar(t.activeTouch,"page"),oe;!V.prev||I(V,V.prev)?oe=new xt(re,re):!V.prev.prev||I(V,V.prev.prev)?oe=e.findWordAt(re):oe=new xt(Re(re.line,0),ut(e.doc,Re(re.line+1,0))),e.setSelection(oe.anchor,oe.head),e.focus(),Y(K)}i()}),ve(t.scroller,"touchcancel",i),ve(t.scroller,"scroll",function(){t.scroller.clientHeight&&(ei(e,t.scroller.scrollTop),sn(e,t.scroller.scrollLeft,!0),be(e,"scroll",e))}),ve(t.scroller,"mousewheel",function(K){return wo(e,K)}),ve(t.scroller,"DOMMouseScroll",function(K){return wo(e,K)}),ve(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(K){Oe(e,K)||q(K)},over:function(K){Oe(e,K)||(Al(e,K),q(K))},start:function(K){return Dl(e,K)},drop:Ht(e,Ll),leave:function(K){Oe(e,K)||Zo(e)}};var j=t.input.getField();ve(j,"keyup",function(K){return us.call(e,K)}),ve(j,"keydown",Ht(e,ls)),ve(j,"keypress",Ht(e,ds)),ve(j,"focus",function(K){return fa(e,K)}),ve(j,"blur",function(K){return wn(e,K)})}var Pa=[];Ot.defineInitHook=function(e){return Pa.push(e)};function yi(e,t,n,r){var i=e.doc,S;n==null&&(n="add"),n=="smart"&&(i.mode.indent?S=sr(e,t).state:n="prev");var I=e.options.tabSize,j=nt(i,t),K=z(j.text,null,I);j.stateAfter&&(j.stateAfter=null);var V=j.text.match(/^\s*/)[0],re;if(!r&&!/\S/.test(j.text))re=0,n="not";else if(n=="smart"&&(re=i.mode.indent(S,j.text.slice(V.length),j.text),re==Te||re>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?re=z(nt(i,t-1).text,null,I):re=0:n=="add"?re=K+e.options.indentUnit:n=="subtract"?re=K-e.options.indentUnit:typeof n=="number"&&(re=K+n),re=Math.max(0,re);var oe="",fe=0;if(e.options.indentWithTabs)for(var ce=Math.floor(re/I);ce;--ce)fe+=I,oe+=" ";if(fe<re&&(oe+=ue(re-fe)),oe!=V)return On(i,oe,Re(t,0),Re(t,V.length),"+input"),j.stateAfter=null,!0;for(var Se=0;Se<i.sel.ranges.length;Se++){var Ae=i.sel.ranges[Se];if(Ae.head.line==t&&Ae.head.ch<V.length){var ke=Re(t,V.length);Ca(i,Se,new xt(ke,ke));break}}}var Sr=null;function Yi(e){Sr=e}function Ma(e,t,n,r,i){var S=e.doc;e.display.shift=!1,r||(r=S.sel);var I=+new Date-200,j=i=="paste"||e.state.pasteIncoming>I,K=ct(t),V=null;if(j&&r.ranges.length>1)if(Sr&&Sr.text.join(`
`)==t){if(r.ranges.length%Sr.text.length==0){V=[];for(var re=0;re<Sr.text.length;re++)V.push(S.splitLines(Sr.text[re]))}}else K.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(V=Fe(K,function(He){return[He]}));for(var oe=e.curOp.updateInput,fe=r.ranges.length-1;fe>=0;fe--){var ce=r.ranges[fe],Se=ce.from(),Ae=ce.to();ce.empty()&&(n&&n>0?Se=Re(Se.line,Se.ch-n):e.state.overwrite&&!j?Ae=Re(Ae.line,Math.min(nt(S,Ae.line).text.length,Ae.ch+Le(K).length)):j&&Sr&&Sr.lineWise&&Sr.text.join(`
`)==K.join(`
`)&&(Se=Ae=Re(Se.line,0)));var ke={from:Se,to:Ae,text:V?V[fe%V.length]:K,origin:i||(j?"paste":e.state.cutIncoming>I?"cut":"+input")};_n(e.doc,ke),Vt(e,"inputRead",e,ke)}t&&!j&&ys(e,t),Cn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=oe),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function vs(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&lr(t,function(){return Ma(t,n,0,null,"paste")}),!0}function ys(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),I=!1;if(S.electricChars){for(var j=0;j<S.electricChars.length;j++)if(t.indexOf(S.electricChars.charAt(j))>-1){I=yi(e,i.head.line,"smart");break}}else S.electricInput&&(S.electricInput.test(nt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(I=yi(e,i.head.line,"smart")));I&&Vt(e,"electricInput",e,i.head.line)}}function bs(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:Re(i,0),head:Re(i+1,0)};n.push(S),t.push(e.getRange(S.anchor,S.head))}return{text:t,ranges:n}}function Es(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function xs(){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 A?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(e.style.border="1px solid black"),Es(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,I=S[r];if(S[r]==i&&r!="mode")return;S[r]=i,t.hasOwnProperty(r)&&Ht(this,t[r])(this,i,I),be(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](zi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,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.");Ie(this.state.overlays,{mode:S,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(I){return I.priority}),this.state.modeGen++,tr(this)}),removeOverlay:qt(function(r){for(var i=this.state.overlays,S=0;S<i.length;++S){var I=i[S].modeSpec;if(I==r||typeof r=="string"&&I.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"),Ir(this.doc,r)&&yi(this,r,i,S)}),indentSelection:qt(function(r){for(var i=this.doc.sel.ranges,S=-1,I=0;I<i.length;I++){var j=i[I];if(j.empty())j.head.line>S&&(yi(this,j.head.line,r,!0),S=j.head.line,I==this.doc.sel.primIndex&&Cn(this));else{var K=j.from(),V=j.to(),re=Math.max(S,K.line);S=Math.min(this.lastLine(),V.line-(V.ch?0:1))+1;for(var oe=re;oe<S;++oe)yi(this,oe,r);var fe=this.doc.sel.ranges;K.ch==0&&i.length==fe.length&&fe[I].from().ch>0&&Ca(this.doc,I,new xt(K,fe[I].to()),he)}}}),getTokenAt:function(r,i){return Rr(this,r,i)},getLineTokens:function(r,i){return Rr(this,Re(r),i,!0)},getTokenTypeAt:function(r){r=ut(this.doc,r);var i=jn(this,nt(this.doc,r.line)),S=0,I=(i.length-1)/2,j=r.ch,K;if(j==0)K=i[2];else for(;;){var V=S+I>>1;if((V?i[V*2-1]:0)>=j)I=V;else if(i[V*2+1]<j)S=V+1;else{K=i[V*2+2];break}}var re=K?K.indexOf("overlay "):-1;return re<0?K:re==0?null:K.slice(0,re-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var S=[];if(!n.hasOwnProperty(i))return S;var I=n[i],j=this.getModeAt(r);if(typeof j[i]=="string")I[j[i]]&&S.push(I[j[i]]);else if(j[i])for(var K=0;K<j[i].length;K++){var V=I[j[i][K]];V&&S.push(V)}else j.helperType&&I[j.helperType]?S.push(I[j.helperType]):I[j.name]&&S.push(I[j.name]);for(var re=0;re<I._global.length;re++){var oe=I._global[re];oe.pred(j,this)&&ie(S,oe.val)==-1&&S.push(oe.val)}return S},getStateAfter:function(r,i){var S=this.doc;return r=Qr(S,r==null?S.first+S.size-1:r),sr(this,r+1,i).state},cursorCoords:function(r,i){var S,I=this.doc.sel.primary();return r==null?S=I.head:typeof r=="object"?S=ut(this.doc,r):S=r?I.from():I.to(),xr(this,S,i||"page")},charCoords:function(r,i){return ia(this,ut(this.doc,r),i||"page")},coordsChar:function(r,i){return r=ro(this,r,i||"page"),oa(this,r.left,r.top)},lineAtHeight:function(r,i){return r=ro(this,{top:r,left:0},i||"page").top,_r(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,S){var I=!1,j;if(typeof r=="number"){var K=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>K&&(r=K,I=!0),j=nt(this.doc,r)}else j=r;return Oi(this,j,{top:0,left:0},i||"page",S||I).top+(I?this.doc.height-_t(j):0)},defaultTextHeight:function(){return Tn(this.display)},defaultCharWidth:function(){return Sn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,S,I,j){var K=this.display;r=xr(this,ut(this.doc,r));var V=r.bottom,re=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),K.sizer.appendChild(i),I=="over")V=r.top;else if(I=="above"||I=="near"){var oe=Math.max(K.wrapper.clientHeight,this.doc.height),fe=Math.max(K.sizer.clientWidth,K.lineSpace.clientWidth);(I=="above"||r.bottom+i.offsetHeight>oe)&&r.top>i.offsetHeight?V=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=oe&&(V=r.bottom),re+i.offsetWidth>fe&&(re=fe-i.offsetWidth)}i.style.top=V+"px",i.style.left=i.style.right="",j=="right"?(re=K.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(j=="left"?re=0:j=="middle"&&(re=(K.sizer.clientWidth-i.offsetWidth)/2),i.style.left=re+"px"),S&&Js(this,{left:re,top:V,right:re+i.offsetWidth,bottom:V+i.offsetHeight})},triggerOnKeyDown:qt(ls),triggerOnKeyPress:qt(ds),triggerOnKeyUp:us,triggerOnMouseDown:qt(cs),execCommand:function(r){if(mi.hasOwnProperty(r))return mi[r].call(null,this)},triggerElectric:qt(function(r){ys(this,r)}),findPosH:function(r,i,S,I){var j=1;i<0&&(j=-1,i=-i);for(var K=ut(this.doc,r),V=0;V<i&&!(K=ka(this.doc,K,j,S,I),K.hitSide);++V);return K},moveH:qt(function(r,i){var S=this;this.extendSelectionsBy(function(I){return S.display.shift||S.doc.extend||I.empty()?ka(S.doc,I.head,r,i,S.options.rtlMoveVisually):r<0?I.from():I.to()},pe)}),deleteH:qt(function(r,i){var S=this.doc.sel,I=this.doc;S.somethingSelected()?I.replaceSelection("",null,"+delete"):Mn(this,function(j){var K=ka(I,j.head,r,i,!1);return r<0?{from:K,to:j.head}:{from:j.head,to:K}})}),findPosV:function(r,i,S,I){var j=1,K=I;i<0&&(j=-1,i=-i);for(var V=ut(this.doc,r),re=0;re<i;++re){var oe=xr(this,V,"div");if(K==null?K=oe.left:oe.left=K,V=Ts(this,oe,j,S),V.hitSide)break}return V},moveV:qt(function(r,i){var S=this,I=this.doc,j=[],K=!this.display.shift&&!I.extend&&I.sel.somethingSelected();if(I.extendSelectionsBy(function(re){if(K)return r<0?re.from():re.to();var oe=xr(S,re.head,"div");re.goalColumn!=null&&(oe.left=re.goalColumn),j.push(oe.left);var fe=Ts(S,oe,r,i);return i=="page"&&re==I.sel.primary()&&ma(S,ia(S,fe,"div").top-oe.top),fe},pe),j.length)for(var V=0;V<I.sel.ranges.length;V++)I.sel.ranges[V].goalColumn=j[V]}),findWordAt:function(r){var i=this.doc,S=nt(i,r.line).text,I=r.ch,j=r.ch;if(S){var K=this.getHelper(r,"wordChars");(r.sticky=="before"||j==S.length)&&I?--I:++j;for(var V=S.charAt(I),re=_e(V,K)?function(oe){return _e(oe,K)}:/\s/.test(V)?function(oe){return/\s/.test(oe)}:function(oe){return!/\s/.test(oe)&&!_e(oe)};I>0&&re(S.charAt(I-1));)--I;for(;j<S.length&&re(S.charAt(j));)++j}return new xt(Re(r.line,I),Re(r.line,j))},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"),be(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==M()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:qt(function(r,i){qn(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Cr(this)-this.display.barHeight,width:r.scrollWidth-Cr(this)-this.display.barWidth,clientHeight:ta(this),clientWidth:rn(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:Re(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?Qs(this,r):mo(this,r.from,r.to,r.margin)}),setSize:qt(function(r,i){var S=this,I=function(K){return typeof K=="number"||/^\d+$/.test(String(K))?K+"px":K};r!=null&&(this.display.wrapper.style.width=I(r)),i!=null&&(this.display.wrapper.style.height=I(i)),this.options.lineWrapping&&qa(this);var j=this.display.viewFrom;this.doc.iter(j,this.display.viewTo,function(K){if(K.widgets){for(var V=0;V<K.widgets.length;V++)if(K.widgets[V].noHScroll){Wr(S,j,"widget");break}}++j}),this.curOp.forceUpdate=!0,be(this,"refresh",this)}),operation:function(r){return lr(this,r)},startOperation:function(){return un(this)},endOperation:function(){return dn(this)},refresh:qt(function(){var r=this.display.cachedTextHeight;tr(this),this.curOp.forceUpdate=!0,Qn(this),qn(this,this.doc.scrollLeft,this.doc.scrollTop),va(this.display),(r==null||Math.abs(r-Tn(this.display))>.5||this.options.lineWrapping)&&da(this),be(this,"refresh",this)}),swapDoc:qt(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Ao(this,r),Qn(this),this.display.input.reset(),qn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Vt(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}},ae(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,I){e.registerHelper(r,i,I),n[r]._global.push({pred:S,val:I})}}function ka(e,t,n,r,i){var S=t,I=n,j=nt(e,t.line),K=i&&e.direction=="rtl"?-n:n;function V(){var Ze=t.line+K;return Ze<e.first||Ze>=e.first+e.size?!1:(t=new Re(Ze,t.ch,t.sticky),j=nt(e,Ze))}function re(Ze){var Ke;if(r=="codepoint"){var tt=j.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(tt)?Ke=null:Ke=new Re(t.line,Math.max(0,Math.min(j.text.length,t.ch+n*(tt>=55296&&tt<56320?2:1))),-n)}else i?Ke=kl(e.cm,j,t,n):Ke=Da(j,t,n);if(Ke==null)if(!Ze&&V())t=Aa(i,e.cm,j,t.line,K);else return!1;else t=Ke;return!0}if(r=="char"||r=="codepoint")re();else if(r=="column")re(!0);else if(r=="word"||r=="group")for(var oe=null,fe=r=="group",ce=e.cm&&e.cm.getHelper(t,"wordChars"),Se=!0;!(n<0&&!re(!Se));Se=!1){var Ae=j.text.charAt(t.ch)||`
`,ke=_e(Ae,ce)?"w":fe&&Ae==`
`?"n":!fe||/\s/.test(Ae)?null:"p";if(fe&&!Se&&!ke&&(ke="s"),oe&&oe!=ke){n<0&&(n=1,re(),t.sticky="after");break}if(ke&&(oe=ke),n>0&&!re(!Se))break}var He=Hi(e,t,S,I,!0);return je(S,He)&&(He.hitSide=!0),He}function Ts(e,t,n,r){var i=e.doc,S=t.left,I;if(r=="page"){var j=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),K=Math.max(j-.5*Tn(e.display),3);I=(n>0?t.bottom:t.top)+n*K}else r=="line"&&(I=n>0?t.bottom+3:t.top-3);for(var V;!(V=oa(e,S,I),!V.outside);){if(n<0?I<=0:I>=i.height){V.hitSide=!0;break}I+=n*5}return V}var Tt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Z,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Tt.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;Es(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function S(j){for(var K=j.target;K;K=K.parentNode){if(K==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(K.className))break}return!1}ve(i,"paste",function(j){if(!S(j)||Oe(r,j)||vs(j,r))return;k<=11&&setTimeout(Ht(r,function(){return t.updateFromDOM()}),20)}),ve(i,"compositionstart",function(j){t.composing={data:j.data,done:!1}}),ve(i,"compositionupdate",function(j){t.composing||(t.composing={data:j.data,done:!1})}),ve(i,"compositionend",function(j){t.composing&&(j.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ve(i,"touchstart",function(){return n.forceCompositionEnd()}),ve(i,"input",function(){t.composing||t.readFromDOMSoon()});function I(j){if(!S(j)||Oe(r,j))return;if(r.somethingSelected())Yi({lineWise:!1,text:r.getSelections()}),j.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var K=bs(r);Yi({lineWise:!0,text:K.text}),j.type=="cut"&&r.operation(function(){r.setSelections(K.ranges,0,he),r.replaceSelection("",null,"cut")})}else return;if(j.clipboardData){j.clipboardData.clearData();var V=Sr.text.join(`
`);if(j.clipboardData.setData("Text",V),j.clipboardData.getData("Text")==V){j.preventDefault();return}}var re=xs(),oe=re.firstChild;r.display.lineSpace.insertBefore(re,r.display.lineSpace.firstChild),oe.value=Sr.text.join(`
`);var fe=document.activeElement;X(oe),setTimeout(function(){r.display.lineSpace.removeChild(re),fe.focus(),fe==i&&n.showPrimarySelection()},50)}ve(i,"copy",I),ve(i,"cut",I)},Tt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Tt.prototype.prepareSelection=function(){var e=lo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Tt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Tt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Tt.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=$i(t,e.anchorNode,e.anchorOffset),I=$i(t,e.focusNode,e.focusOffset);if(S&&!S.bad&&I&&!I.bad&&dt(Jr(S,I),r)==0&&dt(mn(S,I),i)==0)return;var j=t.display.view,K=r.line>=t.display.viewFrom&&Ss(t,r)||{node:j[0].measure.map[2],offset:0},V=i.line<t.display.viewTo&&Ss(t,i);if(!V){var re=j[j.length-1].measure,oe=re.maps?re.maps[re.maps.length-1]:re.map;V={node:oe[oe.length-1],offset:oe[oe.length-2]-oe[oe.length-3]}}if(!K||!V){e.removeAllRanges();return}var fe=e.rangeCount&&e.getRangeAt(0),ce;try{ce=p(K.node,K.offset,V.offset,V.node)}catch(Se){}ce&&(!D&&t.state.focused?(e.collapse(K.node,K.offset),ce.collapsed||(e.removeAllRanges(),e.addRange(ce))):(e.removeAllRanges(),e.addRange(ce)),fe&&e.anchorNode==null?e.addRange(fe):D&&this.startGracePeriod()),this.rememberSelection()},Tt.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)},Tt.prototype.showMultipleSelections=function(e){u(this.cm.display.cursorDiv,e.cursors),u(this.cm.display.selectionDiv,e.selection)},Tt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Tt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return b(this.div,t)},Tt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Tt.prototype.blur=function(){this.div.blur()},Tt.prototype.getField=function(){return this.div},Tt.prototype.supportsTouch=function(){return!0},Tt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():lr(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)},Tt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Tt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(l&&E&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=$i(t,e.anchorNode,e.anchorOffset),r=$i(t,e.focusNode,e.focusOffset);n&&r&&lr(t,function(){Jt(t.doc,Kr(n,r),he),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Tt.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=Re(r.line-1,nt(e.doc,r.line-1).length)),i.ch==nt(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Re(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var S,I,j;r.line==t.viewFrom||(S=on(e,r.line))==0?(I=Et(t.view[0].line),j=t.view[0].node):(I=Et(t.view[S].line),j=t.view[S-1].node.nextSibling);var K=on(e,i.line),V,re;if(K==t.view.length-1?(V=t.viewTo-1,re=t.lineDiv.lastChild):(V=Et(t.view[K+1].line)-1,re=t.view[K+1].node.previousSibling),!j)return!1;for(var oe=e.doc.splitLines(tu(e,j,re,I,V)),fe=Zt(e.doc,Re(I,0),Re(V,nt(e.doc,V).text.length));oe.length>1&&fe.length>1;)if(Le(oe)==Le(fe))oe.pop(),fe.pop(),V--;else if(oe[0]==fe[0])oe.shift(),fe.shift(),I++;else break;for(var ce=0,Se=0,Ae=oe[0],ke=fe[0],He=Math.min(Ae.length,ke.length);ce<He&&Ae.charCodeAt(ce)==ke.charCodeAt(ce);)++ce;for(var Ze=Le(oe),Ke=Le(fe),tt=Math.min(Ze.length-(oe.length==1?ce:0),Ke.length-(fe.length==1?ce:0));Se<tt&&Ze.charCodeAt(Ze.length-Se-1)==Ke.charCodeAt(Ke.length-Se-1);)++Se;if(oe.length==1&&fe.length==1&&I==r.line)for(;ce&&ce>r.ch&&Ze.charCodeAt(Ze.length-Se-1)==Ke.charCodeAt(Ke.length-Se-1);)ce--,Se++;oe[oe.length-1]=Ze.slice(0,Ze.length-Se).replace(/^\u200b+/,""),oe[0]=oe[0].slice(ce).replace(/\u200b+$/,"");var st=Re(I,ce),at=Re(V,fe.length?Le(fe).length-Se:0);if(oe.length>1||oe[0]||dt(st,at))return On(e.doc,oe,st,at,"+input"),!0},Tt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Tt.prototype.reset=function(){this.forceCompositionEnd()},Tt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Tt.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)},Tt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&lr(this.cm,function(){return tr(e.cm)})},Tt.prototype.setUneditable=function(e){e.contentEditable="false"},Tt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Ht(this.cm,Ma)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Tt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Tt.prototype.onContextMenu=function(){},Tt.prototype.resetPosition=function(){},Tt.prototype.needsContentAttribute=!0;function Ss(e,t){var n=ra(e,t.line);if(!n||n.hidden)return null;var r=nt(e.doc,t.line),i=Ya(n,r,t.line),S=Ve(r,e.doc.direction),I="left";if(S){var j=Be(S,t.ch);I=j%2?"right":"left"}var K=Qa(i.map,t.ch,I);return K.offset=K.collapse=="right"?K.end:K.start,K}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function In(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var S="",I=!1,j=e.doc.lineSeparator(),K=!1;function V(ce){return function(Se){return Se.id==ce}}function re(){I&&(S+=j,K&&(S+=j),I=K=!1)}function oe(ce){ce&&(re(),S+=ce)}function fe(ce){if(ce.nodeType==1){var Se=ce.getAttribute("cm-text");if(Se){oe(Se);return}var Ae=ce.getAttribute("cm-marker"),ke;if(Ae){var He=e.findMarks(Re(r,0),Re(i+1,0),V(+Ae));He.length&&(ke=He[0].find(0))&&oe(Zt(e.doc,ke.from,ke.to).join(j));return}if(ce.getAttribute("contenteditable")=="false")return;var Ze=/^(pre|div|p|li|table|br)$/i.test(ce.nodeName);if(!/^br$/i.test(ce.nodeName)&&ce.textContent.length==0)return;Ze&&re();for(var Ke=0;Ke<ce.childNodes.length;Ke++)fe(ce.childNodes[Ke]);/^(pre|p)$/i.test(ce.nodeName)&&(K=!0),Ze&&(I=!0)}else ce.nodeType==3&&oe(ce.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(fe(t),t==n);)t=t.nextSibling,K=!1;return S}function $i(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return In(e.clipPos(Re(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||!b(r,t))return In(Re(Et(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var S=e.rest?Le(e.rest):e.line;return In(Re(Et(S),S.text.length),i)}var I=t.nodeType==3?t:null,j=t;for(!I&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(I=t.firstChild,n&&(n=I.nodeValue.length));j.parentNode!=r;)j=j.parentNode;var K=e.measure,V=K.maps;function re(ke,He,Ze){for(var Ke=-1;Ke<(V?V.length:0);Ke++)for(var tt=Ke<0?K.map:V[Ke],st=0;st<tt.length;st+=3){var at=tt[st+2];if(at==ke||at==He){var gt=Et(Ke<0?e.line:e.rest[Ke]),Lt=tt[st]+Ze;return(Ze<0||at!=ke)&&(Lt=tt[st+(Ze?1:0)]),Re(gt,Lt)}}}var oe=re(I,j,n);if(oe)return In(oe,i);for(var fe=j.nextSibling,ce=I?I.nodeValue.length-n:0;fe;fe=fe.nextSibling){if(oe=re(fe,fe.firstChild,0),oe)return In(Re(oe.line,oe.ch-ce),i);ce+=fe.textContent.length}for(var Se=j.previousSibling,Ae=n;Se;Se=Se.previousSibling){if(oe=re(Se,Se.firstChild,-1),oe)return In(Re(oe.line,oe.ch+Ae),i);Ae+=Se.textContent.length}}var It=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Z,this.hasSelection=!1,this.composing=null};It.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),g&&(i.style.width="0px"),ve(i,"input",function(){N&&k>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),ve(i,"paste",function(I){if(Oe(r,I)||vs(I,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function S(I){if(Oe(r,I))return;if(r.somethingSelected())Yi({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var j=bs(r);Yi({lineWise:!0,text:j.text}),I.type=="cut"?r.setSelections(j.ranges,null,he):(n.prevInput="",i.value=j.text.join(`
`),X(i))}else return;I.type=="cut"&&(r.state.cutIncoming=+new Date)}ve(i,"cut",S),ve(i,"copy",S),ve(e.scroller,"paste",function(I){if(Pr(e,I)||Oe(r,I))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var j=new Event("paste");j.clipboardData=I.clipboardData,i.dispatchEvent(j)}),ve(e.lineSpace,"selectstart",function(I){Pr(e,I)||Y(I)}),ve(i,"compositionstart",function(){var I=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:I,range:r.markText(I,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ve(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},It.prototype.createField=function(e){this.wrapper=xs(),this.textarea=this.wrapper.firstChild},It.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},It.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=lo(e);if(e.options.moveInputWithCursor){var i=xr(e,n.sel.primary().head,"div"),S=t.wrapper.getBoundingClientRect(),I=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+I.top-S.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+I.left-S.left))}return r},It.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")},It.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&&X(this.textarea),N&&k>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",N&&k>=9&&(this.hasSelection=null))},It.prototype.getField=function(){return this.textarea},It.prototype.supportsTouch=function(){return!1},It.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||M()!=this.textarea))try{this.textarea.focus()}catch(e){}},It.prototype.blur=function(){this.textarea.blur()},It.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},It.prototype.receivedFocus=function(){this.slowPoll()},It.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()})},It.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)},It.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||et(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(N&&k>=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 I=0,j=Math.min(r.length,i.length);I<j&&r.charCodeAt(I)==i.charCodeAt(I);)++I;return lr(t,function(){Ma(t,i.slice(I),r.length-I,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},It.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},It.prototype.onKeyPress=function(){N&&k>=9&&(this.hasSelection=null),this.fastPoll()},It.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var S=an(n,e),I=r.scroller.scrollTop;if(!S||T)return;var j=n.options.resetSelectionOnContextMenu;j&&n.doc.sel.contains(S)==-1&&Ht(n,Jt)(n.doc,Kr(S),he);var K=i.style.cssText,V=t.wrapper.style.cssText,re=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-re.top-5)+"px; left: "+(e.clientX-re.left-5)+`px;
z-index: 1000; background: `+(N?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var oe;A&&(oe=window.scrollY),r.input.focus(),A&&window.scrollTo(null,oe),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=ce,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function fe(){if(i.selectionStart!=null){var Ae=n.somethingSelected(),ke="\u200B"+(Ae?i.value:"");i.value="\u21DA",i.value=ke,t.prevInput=Ae?"":"\u200B",i.selectionStart=1,i.selectionEnd=ke.length,r.selForContextMenu=n.doc.sel}}function ce(){if(t.contextMenuPending!=ce)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=V,i.style.cssText=K,N&&k<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=I),i.selectionStart!=null){(!N||N&&k<9)&&fe();var Ae=0,ke=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Ht(n,Wo)(n):Ae++<10?r.detectingSelectAll=setTimeout(ke,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(ke,200)}}if(N&&k>=9&&fe(),L){q(e);var Se=function(){Xe(window,"mouseup",Se),setTimeout(ce,20)};ve(window,"mouseup",Se)}else setTimeout(ce,50)},It.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},It.prototype.setUneditable=function(){},It.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?U(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=M();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=j.getValue()}var i;if(e.form&&(ve(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var S=e.form;i=S.submit;try{var I=S.submit=function(){r(),S.submit=i,S.submit(),S.submit=I}}catch(K){}}t.finishInit=function(K){K.save=r,K.getTextArea=function(){return e},K.toTextArea=function(){K.toTextArea=isNaN,r(),e.parentNode.removeChild(K.getWrapperElement()),e.style.display="",e.form&&(Xe(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var j=Ot(function(K){return e.parentNode.insertBefore(K,e.nextSibling)},t);return j}function iu(e){e.off=Xe,e.on=ve,e.wheelEventPixels=cl,e.Doc=rr,e.splitLines=ct,e.countColumn=z,e.findColumn=ge,e.isWordChar=ye,e.Pass=Te,e.signal=be,e.Line=At,e.changeEnd=Gr,e.scrollbarModel=vo,e.Pos=Re,e.cmpPos=dt,e.modes=Wt,e.mimeModes=yt,e.resolveMode=or,e.getMode=dr,e.modeExtensions=cr,e.extendMode=hn,e.copyState=bt,e.startState=Ct,e.innerMode=Nt,e.commands=mi,e.keyMap=Mr,e.keyName=ns,e.isModifierKey=ts,e.lookupKey=Pn,e.normalizeKeyMap=Ml,e.StringStream=vt,e.SharedTextMarker=ci,e.TextMarker=Vr,e.LineWidget=di,e.e_preventDefault=Y,e.e_stopPropagation=$,e.e_stop=q,e.addClass=F,e.contains=b,e.rmClass=h,e.keyNames=Xr}$l(Ot),ql(Ot);var au="iter insert remove copy getEditor constructor".split(" ");for(var Ji in rr.prototype)rr.prototype.hasOwnProperty(Ji)&&ie(au,Ji)<0&&(Ot.prototype[Ji]=function(e){return function(){return e.apply(this.doc,arguments)}}(rr.prototype[Ji]));return ae(rr),Ot.inputStyles={textarea:It,contenteditable:Tt},Ot.defineMode=function(e){!Ot.defaults.mode&&e!="null"&&(Ot.defaults.mode=e),pr.apply(this,arguments)},Ot.defineMIME=Ar,Ot.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ot.defineMIME("text/plain","null"),Ot.defineExtension=function(e,t){Ot.prototype[e]=t},Ot.defineDocExtension=function(e,t){rr.prototype[e]=t},Ot.fromTextArea=nu,iu(Ot),Ot.version="5.58.2",Ot})},Y1PL:function(lt,Je,Q){"use strict";Q.r(Je),Q.d(Je,"ResizableTextArea",function(){return ie});var ee=Q("wx14"),G=Q("1OyB"),D=Q("vuIU"),W=Q("Ji7U"),R=Q("LK+K"),P=Q("cDcd"),N=Q("VTBJ"),k=Q("rePB"),A=Q("Zm9Q"),O=Q("Kwbf"),E=Q("c+Xe"),T=Q("m+aA"),_=Q("bdgK"),C=new Map;function y(he){he.forEach(function(xe){var pe,ge=xe.target;(pe=C.get(ge))===null||pe===void 0||pe.forEach(function(le){return le(ge)})})}var g=new _.default(y),l=null,o=null;function s(he,xe){C.has(he)||(C.set(he,new Set),g.observe(he)),C.get(he).add(xe)}function d(he,xe){C.has(he)&&(C.get(he).delete(xe),C.get(he).size||(g.unobserve(he),C.delete(he)))}var w=function(he){Object(W.a)(pe,he);var xe=Object(R.a)(pe);function pe(){return Object(G.a)(this,pe),xe.apply(this,arguments)}return Object(D.a)(pe,[{key:"render",value:function(){return this.props.children}}]),pe}(P.Component),f=P.createContext(null);function m(he){var xe=he.children,pe=he.onBatchResize,ge=P.useRef(0),le=P.useRef([]),ue=P.useContext(f),Le=P.useCallback(function(Fe,Ie,Ne){ge.current+=1;var Ue=ge.current;le.current.push({size:Fe,element:Ie,data:Ne}),Promise.resolve().then(function(){Ue===ge.current&&(pe==null||pe(le.current),le.current=[])}),ue==null||ue(Fe,Ie,Ne)},[pe,ue]);return P.createElement(f.Provider,{value:Le},xe)}function L(he){var xe=he.children,pe=he.disabled,ge=P.useRef(null),le=P.useRef(null),ue=P.useContext(f),Le=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Fe=P.isValidElement(xe)&&Object(E.c)(xe),Ie=Fe?xe.ref:null,Ne=P.useMemo(function(){return Object(E.a)(Ie,ge)},[Ie,ge]),Ue=P.useRef(he);Ue.current=he;var Ee=P.useCallback(function(ye){var _e=Ue.current,Me=_e.onResize,Pe=_e.data,we=ye.getBoundingClientRect(),Ce=we.width,Ye=we.height,Ge=ye.offsetWidth,ze=ye.offsetHeight,Be=Math.floor(Ce),rt=Math.floor(Ye);if(Le.current.width!==Be||Le.current.height!==rt||Le.current.offsetWidth!==Ge||Le.current.offsetHeight!==ze){var Ve={width:Be,height:rt,offsetWidth:Ge,offsetHeight:ze};Le.current=Ve;var We=Ge===Math.round(Ce)?Ce:Ge,ve=ze===Math.round(Ye)?Ye:ze,qe=Object(N.a)(Object(N.a)({},Ve),{},{offsetWidth:We,offsetHeight:ve});ue==null||ue(qe,ye,Pe),Me&&Promise.resolve().then(function(){Me(qe,ye)})}},[]);return P.useEffect(function(){var ye=Object(T.a)(ge.current)||Object(T.a)(le.current);return ye&&!pe&&s(ye,Ee),function(){return d(ye,Ee)}},[ge.current,pe]),P.createElement(w,{ref:le},Fe?P.cloneElement(xe,{ref:Ne}):xe)}var x="rc-observer-key";function h(he){var xe=he.children,pe=Object(A.a)(xe);return pe.map(function(ge,le){var ue=(ge==null?void 0:ge.key)||"".concat(x,"-").concat(le);return P.createElement(L,Object(ee.a)({},he,{key:ue}),ge)})}h.Collection=m;var c=h,u=Q("bT9E"),a=Q("TSYQ"),v=Q.n(a),p=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important
`,b=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],M={},F;function H(he){var xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,pe=he.getAttribute("id")||he.getAttribute("data-reactid")||he.getAttribute("name");if(xe&&M[pe])return M[pe];var ge=window.getComputedStyle(he),le=ge.getPropertyValue("box-sizing")||ge.getPropertyValue("-moz-box-sizing")||ge.getPropertyValue("-webkit-box-sizing"),ue=parseFloat(ge.getPropertyValue("padding-bottom"))+parseFloat(ge.getPropertyValue("padding-top")),Le=parseFloat(ge.getPropertyValue("border-bottom-width"))+parseFloat(ge.getPropertyValue("border-top-width")),Fe=b.map(function(Ne){return"".concat(Ne,":").concat(ge.getPropertyValue(Ne))}).join(";"),Ie={sizingStyle:Fe,paddingSize:ue,borderSize:Le,boxSizing:le};return xe&&pe&&(M[pe]=Ie),Ie}function X(he){var xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,pe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,ge=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)),he.getAttribute("wrap")?F.setAttribute("wrap",he.getAttribute("wrap")):F.removeAttribute("wrap");var le=H(he,xe),ue=le.paddingSize,Le=le.borderSize,Fe=le.boxSizing,Ie=le.sizingStyle;F.setAttribute("style","".concat(Ie,";").concat(p)),F.value=he.value||he.placeholder||"";var Ne=Number.MIN_SAFE_INTEGER,Ue=Number.MAX_SAFE_INTEGER,Ee=F.scrollHeight,ye;if(Fe==="border-box"?Ee+=Le:Fe==="content-box"&&(Ee-=ue),pe!==null||ge!==null){F.value=" ";var _e=F.scrollHeight-ue;pe!==null&&(Ne=_e*pe,Fe==="border-box"&&(Ne=Ne+ue+Le),Ee=Math.max(Ne,Ee)),ge!==null&&(Ue=_e*ge,Fe==="border-box"&&(Ue=Ue+ue+Le),ye=Ee>Ue?"":"hidden",Ee=Math.min(Ue,Ee))}return{height:Ee,minHeight:Ne,maxHeight:Ue,overflowY:ye,resize:"none"}}var B=Q("Gytx"),U=Q.n(B),z;(function(he){he[he.NONE=0]="NONE",he[he.RESIZING=1]="RESIZING",he[he.RESIZED=2]="RESIZED"})(z||(z={}));var Z=function(he){Object(W.a)(pe,he);var xe=Object(R.a)(pe);function pe(ge){var le;return Object(G.a)(this,pe),le=xe.call(this,ge),le.nextFrameActionId=void 0,le.resizeFrameId=void 0,le.textArea=void 0,le.saveTextArea=function(ue){le.textArea=ue},le.handleResize=function(ue){var Le=le.state.resizeStatus,Fe=le.props,Ie=Fe.autoSize,Ne=Fe.onResize;if(Le!==z.NONE)return;typeof Ne=="function"&&Ne(ue),Ie&&le.resizeOnNextFrame()},le.resizeOnNextFrame=function(){cancelAnimationFrame(le.nextFrameActionId),le.nextFrameActionId=requestAnimationFrame(le.resizeTextarea)},le.resizeTextarea=function(){var ue=le.props.autoSize;if(!ue||!le.textArea)return;var Le=ue.minRows,Fe=ue.maxRows,Ie=X(le.textArea,!1,Le,Fe);le.setState({textareaStyles:Ie,resizeStatus:z.RESIZING},function(){cancelAnimationFrame(le.resizeFrameId),le.resizeFrameId=requestAnimationFrame(function(){le.setState({resizeStatus:z.RESIZED},function(){le.resizeFrameId=requestAnimationFrame(function(){le.setState({resizeStatus:z.NONE}),le.fixFirefoxAutoScroll()})})})})},le.renderTextArea=function(){var ue=le.props,Le=ue.prefixCls,Fe=Le===void 0?"rc-textarea":Le,Ie=ue.autoSize,Ne=ue.onResize,Ue=ue.className,Ee=ue.disabled,ye=le.state,_e=ye.textareaStyles,Me=ye.resizeStatus,Pe=Object(u.a)(le.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),we=v()(Fe,Ue,Object(k.a)({},"".concat(Fe,"-disabled"),Ee));"value"in Pe&&(Pe.value=Pe.value||"");var Ce=Object(N.a)(Object(N.a)(Object(N.a)({},le.props.style),_e),Me===z.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(c,{onResize:le.handleResize,disabled:!(Ie||Ne)},P.createElement("textarea",Object(ee.a)({},Pe,{className:we,style:Ce,ref:le.saveTextArea})))},le.state={textareaStyles:{},resizeStatus:z.NONE},le}return Object(D.a)(pe,[{key:"componentDidUpdate",value:function(le){(le.value!==this.props.value||!U()(le.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 le=this.textArea.selectionStart,ue=this.textArea.selectionEnd;this.textArea.setSelectionRange(le,ue)}}catch(Le){}}},{key:"render",value:function(){return this.renderTextArea()}}]),pe}(P.Component),ie=Z,se=function(he){Object(W.a)(pe,he);var xe=Object(R.a)(pe);function pe(ge){var le;Object(G.a)(this,pe),le=xe.call(this,ge),le.resizableTextArea=void 0,le.focus=function(){le.resizableTextArea.textArea.focus()},le.saveTextArea=function(Le){le.resizableTextArea=Le},le.handleChange=function(Le){var Fe=le.props.onChange;le.setValue(Le.target.value,function(){le.resizableTextArea.resizeTextarea()}),Fe&&Fe(Le)},le.handleKeyDown=function(Le){var Fe=le.props,Ie=Fe.onPressEnter,Ne=Fe.onKeyDown;Le.keyCode===13&&Ie&&Ie(Le),Ne&&Ne(Le)};var ue=typeof ge.value=="undefined"||ge.value===null?ge.defaultValue:ge.value;return le.state={value:ue},le}return Object(D.a)(pe,[{key:"setValue",value:function(le,ue){"value"in this.props||this.setState({value:le},ue)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(ie,Object(ee.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(le){return"value"in le?{value:le.value}:null}}]),pe}(P.Component),Te=Je.default=se},ZW9T:function(lt,Je,Q){"use strict";Q.d(Je,"a",function(){return w});var ee=Q("k1fw"),G=Q("miYZ"),D=Q("tsqr"),W=Q("rAM+"),R=Q("tJVT"),P=Q("PpiC"),N=Q("cDcd"),k=Q.n(N),A=Q("bdgK");function O(f,m,L,x,h){var c=m.getWordUntilPosition(L),u={startLineNumber:L.lineNumber,endLineNumber:L.lineNumber,startColumn:c.startColumn,endColumn:c.endColumn},a=x.map(function(v){return{label:v,kind:f.languages.CompletionItemKind.Keyword,insertText:v,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:u}});return h.map(function(v){a.push(Object(ee.a)(Object(ee.a)({},v),{},{range:u}))}),a}var E=function(f){var m={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},L=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];f.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(u,a){var v=O(f,u,a,L,[m]);return{suggestions:v}}});var x=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];f.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(u,a){var v=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],p=O(f,u,a,x,v);return{suggestions:p}}});var h=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];f.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(u,a){var v=[m,{label:"main",kind:f.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:f.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],p=O(f,u,a,h,v);return{suggestions:p}}})},T="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",_=Q("LvDl");function C(f){return/^\d+$/.test(f)?"".concat(f,"px"):f}function y(){}var g=!1,l={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function o(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],m=f;if(Array.isArray(f)){for(var L=0;L<f.length;L++){var x=l[f[L]];if(x)return x}return m[0]}return l[m]||m}var s=null,d=Je.b=function(f){var m=f.width,L=m===void 0?"100%":m,x=f.height,h=x===void 0?"100%":x,c=f.value,u=f.language,a=u===void 0?"javascript":u,v=f.style,p=v===void 0?{}:v,b=f.options,M=b===void 0?{}:b,F=f.overrideServices,H=F===void 0?{}:F,X=f.theme,B=X===void 0?"vs-dark":X,U=f.onEditBlur,z=f.onSave,Z=f.autoHeight,ie=Z===void 0?!1:Z,se=f.forbidCopy,Te=se===void 0?!1:se,he=f.onChange,xe=he===void 0?y:he,pe=f.editorDidMount,ge=pe===void 0?y:pe,le=f.onFocus,ue=le===void 0?y:le,Le=f.filename,Fe=Le===void 0?"educoder.txt":Le,Ie=Object(P.a)(f,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),Ne=Object(N.useRef)(),Ue=Object(N.useRef)({}),Ee=Object(N.useRef)(),ye=Object(N.useRef)(!1),_e=Object(N.useRef)(),Me=Object(N.useState)(!1),Pe=Object(R.a)(Me,2),we=Pe[0],Ce=Pe[1];function Ye(){var J;return Ne.current&&(J=new A.default(function(q){var de=Object(W.a)(q),me;try{for(de.s();!(me=de.n()).done;){var De=me.value;(De.target.offsetHeight>0||De.target.offsetWidth>0)&&Ue.current.instance.layout()}}catch($e){de.e($e)}finally{de.f()}}),J.observe(Ne.current)),J}function Ge(){D.b.warn(decodeURIComponent(T))}var ze=function(){var q=Ue.current.instance;if(c!=null&&q&&we){var de=q.getModel();de&&c!==de.getValue()&&(g=!0,de.setValue(c),q.layout(),g=!1)}};Object(N.useEffect)(function(){Ee.current&&clearTimeout(Ee.current),Ee.current=setTimeout(function(){ze()},500)},[c,we,Ue.current]);function Be(){var J=Ue.current.instance;if(J){var q=J.getSelection(),de=Ue.current.pastePos||{},me=new s.Range(de.startLineNumber||q.endLineNumber,de.startColumn||q.endColumn,de.endLineNumber||q.endLineNumber,de.endColumn||q.endColumn);setTimeout(function(){J.executeEdits("",[{range:me,text:""}])},300)}}function rt(J){(window.navigator.platform.match("Mac")?J.metaKey:J.ctrlKey)&&J.keyCode==83&&(J.preventDefault(),z())}var Ve=function(){if(ie&&Ue.current.instance){var q=Ue.current.instance.getContentHeight();Y(q<h?h:q)}else Y(h)};function We(J){var q=document.createEvent("MouseEvents");q.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),J.dispatchEvent(q)}function ve(J,q){var de=window.URL||window.webkitURL||window,me=new Blob([q]),De=document.createElementNS("http://www.w3.org/1999/xhtml","a");De.href=de.createObjectURL(me),De.download=J,We(De)}Object(N.useEffect)(function(){Ve()},[Ve]),Object(N.useEffect)(function(){Ne.current&&!we&&Q.e(27).then(Q.t.bind(null,"M/lh",7)).then(function(J){try{s=J,Ue.current.instance=s.editor.create(Ne.current,{value:c,language:o(a),theme:B,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},H);var q=Ue.current.instance;if(ge(q,s),setTimeout(function(){Ve(),Ue.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){ve(Fe||"educoder.txt",q.getValue())}})},500),Ue.current.subscription=q.onDidChangeModelContent(function(me){ye.current?clearTimeout(_e.current):(Ve(),xe(q.getValue(),me)),_e.current=setTimeout(function(){ye.current=!1},500)}),window.Monaco||E(s),Te&&(q.addCommand(s.KeyMod.CtrlCmd|s.KeyMod.Shift|s.KeyCode.KEY_V,function(){return Ge(),null}),q.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_C,function(){return Ge(),null})),window.Monaco=s,U&&q.onDidBlurEditorWidget(function(){U(q.getValue())}),ue&&q.onDidFocusEditorText(function(){ue(q.getValue())}),Te){q.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_V,function(){return Ge(),null}),q.onDidPaste(function(me){Ue.current.pastePos=me});try{window.addEventListener("paste",Be)}catch(me){}}var de=Ye();return Ce(!0),function(){var me=Ue.current.instance;me.dispose();var De=me.getModel();De&&De.dispose(),Ue.current.subscription&&Ue.current.subscription.dispose(),Te&&window.removeEventListener("paste",Be),de.unobserve(Ne.current)}}catch(me){}})},[]),Object(N.useEffect)(function(){var J=Ue.current.instance;if(J&&we)return document.addEventListener("keydown",rt,!1),function(){document.removeEventListener("keydown",rt)}},[z,we]),Object(N.useEffect)(function(){var J=Ue.current.instance;if(J&&we){var q=o(a);s.editor.setModelLanguage(J.getModel(),q),console.log("language:",a,J.getModel(),q)}},[a,we]),Object(N.useEffect)(function(){var J=Ue.current.instance;J&&we&&s.editor.setTheme(B)},[B,we]),Object(N.useEffect)(function(){var J=Ue.current.instance;J&&we&&(J.updateOptions(Object(ee.a)({},M)),setTimeout(function(){J.getModel().updateOptions(Object(ee.a)({},M))},200))},[JSON.stringify(M),we]),Object(N.useEffect)(function(){var J=Ue.current.instance;J&&we&&J.layout()},[L,h,we]);var qe=Object(N.useState)(C(L)),Xe=Object(R.a)(qe,2),be=Xe[0],Oe=Xe[1],te=Object(N.useState)(C(h)),ne=Object(R.a)(te,2),ae=ne[0],Y=ne[1],$=Object(ee.a)(Object(ee.a)({},p),{},{width:be,height:ae});return k.a.createElement("div",{className:"my-monaco-editor",ref:Ne,style:$})};function w(f){var m=f.width,L=m===void 0?"100%":m,x=f.height,h=x===void 0?"100%":x,c=f.original,u=f.modified,a=f.language,v=f.options,p=v===void 0?{}:v,b=Object(N.useRef)(),M=Object(N.useState)(null),F=Object(R.a)(M,2),H=F[0],X=F[1];function B(ie){var se;return b.current&&(se=new A.default(function(Te){var he=Object(W.a)(Te),xe;try{for(he.s();!(xe=he.n()).done;){var pe=xe.value;(pe.target.offsetHeight>0||pe.target.offsetWidth>0)&&ie.layout()}}catch(ge){he.e(ge)}finally{he.f()}}),se.observe(b.current)),se}Object(N.useEffect)(function(){b.current&&Q.e(27).then(Q.t.bind(null,"M/lh",7)).then(function(ie){s=ie;var se=s.editor.createDiffEditor(b.current,Object(ee.a)(Object(ee.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},p),{},{wordWrap:!0}));X(se);var Te=B(se);return function(){se.dispose();var he=se.getModel();he&&he.dispose(),Te.unobserve(b.current)}})},[]),Object(N.useEffect)(function(){H&&H.setModel({original:s.editor.createModel(c,a),modified:s.editor.createModel(u,a)})},[c,u,a,H]);var U=C(L),z=C(h),Z={width:U,height:z};return k.a.createElement("div",{className:"my-diff-editor",ref:b,style:Z})}},ZpRC:function(lt,Je,Q){"use strict";function ee(E){return typeof E=="object"&&E!=null&&E.nodeType===1}function G(E,T){return(!T||E!=="hidden")&&E!=="visible"&&E!=="clip"}function D(E,T){if(E.clientHeight<E.scrollHeight||E.clientWidth<E.scrollWidth){var _=getComputedStyle(E,null);return G(_.overflowY,T)||G(_.overflowX,T)||function(C){var y=function(g){if(!g.ownerDocument||!g.ownerDocument.defaultView)return null;try{return g.ownerDocument.defaultView.frameElement}catch(l){return null}}(C);return!!y&&(y.clientHeight<C.scrollHeight||y.clientWidth<C.scrollWidth)}(E)}return!1}function W(E,T,_,C,y,g,l,o){return g<E&&l>T||g>E&&l<T?0:g<=E&&o<=_||l>=T&&o>=_?g-E-C:l>T&&o<_||g<E&&o>_?l-T+y:0}var R=function(E,T){var _=window,C=T.scrollMode,y=T.block,g=T.inline,l=T.boundary,o=T.skipOverflowHiddenElements,s=typeof l=="function"?l:function(_e){return _e!==l};if(!ee(E))throw new TypeError("Invalid target");for(var d=document.scrollingElement||document.documentElement,w=[],f=E;ee(f)&&s(f);){if((f=f.parentElement)===d){w.push(f);break}f!=null&&f===document.body&&D(f)&&!D(document.documentElement)||f!=null&&D(f,o)&&w.push(f)}for(var m=_.visualViewport?_.visualViewport.width:innerWidth,L=_.visualViewport?_.visualViewport.height:innerHeight,x=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,c=E.getBoundingClientRect(),u=c.height,a=c.width,v=c.top,p=c.right,b=c.bottom,M=c.left,F=y==="start"||y==="nearest"?v:y==="end"?b:v+u/2,H=g==="center"?M+a/2:g==="end"?p:M,X=[],B=0;B<w.length;B++){var U=w[B],z=U.getBoundingClientRect(),Z=z.height,ie=z.width,se=z.top,Te=z.right,he=z.bottom,xe=z.left;if(C==="if-needed"&&v>=0&&M>=0&&b<=L&&p<=m&&v>=se&&b<=he&&M>=xe&&p<=Te)return X;var pe=getComputedStyle(U),ge=parseInt(pe.borderLeftWidth,10),le=parseInt(pe.borderTopWidth,10),ue=parseInt(pe.borderRightWidth,10),Le=parseInt(pe.borderBottomWidth,10),Fe=0,Ie=0,Ne="offsetWidth"in U?U.offsetWidth-U.clientWidth-ge-ue:0,Ue="offsetHeight"in U?U.offsetHeight-U.clientHeight-le-Le:0;if(d===U)Fe=y==="start"?F:y==="end"?F-L:y==="nearest"?W(h,h+L,L,le,Le,h+F,h+F+u,u):F-L/2,Ie=g==="start"?H:g==="center"?H-m/2:g==="end"?H-m:W(x,x+m,m,ge,ue,x+H,x+H+a,a),Fe=Math.max(0,Fe+h),Ie=Math.max(0,Ie+x);else{Fe=y==="start"?F-se-le:y==="end"?F-he+Le+Ue:y==="nearest"?W(se,he,Z,le,Le+Ue,F,F+u,u):F-(se+Z/2)+Ue/2,Ie=g==="start"?H-xe-ge:g==="center"?H-(xe+ie/2)+Ne/2:g==="end"?H-Te+ue+Ne:W(xe,Te,ie,ge,ue+Ne,H,H+a,a);var Ee=U.scrollLeft,ye=U.scrollTop;F+=ye-(Fe=Math.max(0,Math.min(ye+Fe,U.scrollHeight-Z+Ue))),H+=Ee-(Ie=Math.max(0,Math.min(Ee+Ie,U.scrollWidth-ie+Ne)))}X.push({el:U,top:Fe,left:Ie})}return X};function P(E){return E===Object(E)&&Object.keys(E).length!==0}function N(E,T){T===void 0&&(T="auto");var _="scrollBehavior"in document.body.style;E.forEach(function(C){var y=C.el,g=C.top,l=C.left;y.scroll&&_?y.scroll({top:g,left:l,behavior:T}):(y.scrollTop=g,y.scrollLeft=l)})}function k(E){return E===!1?{block:"end",inline:"nearest"}:P(E)?E:{block:"start",inline:"nearest"}}function A(E,T){var _=!E.ownerDocument.documentElement.contains(E);if(P(T)&&typeof T.behavior=="function")return T.behavior(_?[]:R(E,T));if(_)return;var C=k(T);return N(R(E,C),C.behavior)}var O=Je.a=A},bT9E:function(lt,Je,Q){"use strict";Q.d(Je,"a",function(){return G});var ee=Q("VTBJ");function G(D,W){var R=Object(ee.a)({},D);return Array.isArray(W)&&W.forEach(function(P){delete R[P]}),R}},c5Ni:function(lt,Je,Q){},dejd:function(lt,Je,Q){},dmUQ:function(lt,Je,Q){"use strict";var ee=Q("Ff2n"),G=Q("rePB"),D=Q("1OyB"),W=Q("vuIU"),R=Q("Ji7U"),P=Q("md7G"),N=Q("foSv"),k=Q("cDcd"),A=Q.n(k),O=Q("TSYQ"),E=Q.n(O),T=Q("4IlW");function _(u,a){var v=Object.keys(u);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(u);a&&(p=p.filter(function(b){return Object.getOwnPropertyDescriptor(u,b).enumerable})),v.push.apply(v,p)}return v}function C(u){for(var a=1;a<arguments.length;a++){var v=arguments[a]!=null?arguments[a]:{};a%2?_(Object(v),!0).forEach(function(p){Object(G.a)(u,p,v[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(v)):_(Object(v)).forEach(function(p){Object.defineProperty(u,p,Object.getOwnPropertyDescriptor(v,p))})}return u}function y(u){var a=g();return function(){var p=Object(N.a)(u),b;if(a){var M=Object(N.a)(this).constructor;b=Reflect.construct(p,arguments,M)}else b=p.apply(this,arguments);return Object(P.a)(this,b)}}function g(){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,w=600,f=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,m=function(a){return a!=null},L=function(a,v){return v===a||typeof v=="number"&&typeof a=="number"&&isNaN(v)&&isNaN(a)},x=function(u){Object(R.a)(v,u);var a=y(v);function v(p){var b;Object(D.a)(this,v),b=a.call(this,p),b.onKeyDown=function(H){var X=b.props,B=X.onKeyDown,U=X.onPressEnter;if(H.keyCode===T.a.UP){var z=b.getRatio(H);b.up(H,z,null),b.stop()}else if(H.keyCode===T.a.DOWN){var Z=b.getRatio(H);b.down(H,Z,null),b.stop()}else H.keyCode===T.a.ENTER&&U&&U(H);if(b.recordCursorPosition(),b.lastKeyCode=H.keyCode,B){for(var ie=arguments.length,se=new Array(ie>1?ie-1:0),Te=1;Te<ie;Te++)se[Te-1]=arguments[Te];B.apply(void 0,[H].concat(se))}},b.onKeyUp=function(H){var X=b.props.onKeyUp;if(b.stop(),b.recordCursorPosition(),X){for(var B=arguments.length,U=new Array(B>1?B-1:0),z=1;z<B;z++)U[z-1]=arguments[z];X.apply(void 0,[H].concat(U))}},b.onChange=function(H){var X=b.props.onChange;b.state.focused&&(b.inputting=!0),b.rawInput=b.props.parser(b.getValueFromEvent(H)),b.setState({inputValue:b.rawInput}),X(b.toNumber(b.rawInput))},b.onMouseUp=function(){var H=b.props.onMouseUp;b.recordCursorPosition(),H&&H.apply(void 0,arguments)},b.onFocus=function(){var H;b.setState({focused:!0}),(H=b.props).onFocus.apply(H,arguments)},b.onBlur=function(){var H=b.props.onBlur;b.inputting=!1,b.setState({focused:!1});var X=b.getCurrentValidValue(b.state.inputValue),B=b.setValue(X,l);if(H){var U=b.input.value,z=b.getInputDisplayValue({focus:!1,value:B});b.input.value=z&&Number(z),H.apply(void 0,arguments),b.input.value=U}},b.getRatio=function(H){var X=1;return H.metaKey||H.ctrlKey?X=.1:H.shiftKey&&(X=10),X},b.getFullNum=function(H){return isNaN(H)?H:/e/i.test(String(H))?Number(H).toFixed(18).replace(/\.?0+$/,""):H},b.getPrecision=function(H){if(m(b.props.precision))return b.props.precision;var X=String(H);if(X.indexOf("e-")>=0)return parseInt(X.slice(X.indexOf("e-")+2),10);var B=0;return X.indexOf(".")>=0&&(B=X.length-X.indexOf(".")-1),B},b.getInputDisplayValue=function(H){var X=H||b.state,B=X.focused,U=X.inputValue,z=X.value,Z;B?Z=U:Z=b.toPrecisionAsStep(z),Z==null&&(Z="");var ie=b.formatWrapper(Z);return m(b.props.decimalSeparator)&&(ie=ie.toString().replace(".",b.props.decimalSeparator)),ie},b.recordCursorPosition=function(){try{b.cursorStart=b.input.selectionStart,b.cursorEnd=b.input.selectionEnd,b.currentValue=b.input.value,b.cursorBefore=b.input.value.substring(0,b.cursorStart),b.cursorAfter=b.input.value.substring(b.cursorEnd)}catch(H){}},b.restoreByAfter=function(H){if(H===void 0)return!1;var X=b.input.value,B=X.lastIndexOf(H);if(B===-1)return!1;var U=b.cursorBefore.length;return b.lastKeyCode===T.a.DELETE&&b.cursorBefore.charAt(U-1)===H[0]?(b.fixCaret(U,U),!0):B+H.length===X.length?(b.fixCaret(B,B),!0):!1},b.partRestoreByAfter=function(H){return H===void 0?!1:Array.prototype.some.call(H,function(X,B){var U=H.substring(B);return b.restoreByAfter(U)})},b.isNotCompleteNumber=function(H){return isNaN(H)||H===""||H===null||H&&H.toString().indexOf(".")===H.toString().length-1},b.stop=function(){b.autoStepTimer&&clearTimeout(b.autoStepTimer)},b.down=function(H,X,B){b.pressingUpOrDown=!0,b.step("down",H,X,B)},b.up=function(H,X,B){b.pressingUpOrDown=!0,b.step("up",H,X,B)},b.saveInput=function(H){b.input=H};var M=p.value;M===void 0&&(M=p.defaultValue),b.state={focused:p.autoFocus};var F=b.getValidValue(b.toNumber(M));return b.state=C(C({},b.state),{},{inputValue:b.toPrecisionAsStep(F),value:F}),b}return Object(W.a)(v,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(b){var M=this.props,F=M.value,H=M.onChange,X=M.max,B=M.min,U=this.state.focused;if(b){if(!L(b.value,F)||!L(b.max,X)||!L(b.min,B)){var z=U?F:this.getValidValue(F),Z;this.pressingUpOrDown?Z=z:this.inputting?Z=this.rawInput:Z=this.toPrecisionAsStep(z),this.setState({value:z,inputValue:Z})}var ie="value"in this.props?F:this.state.value;"max"in this.props&&b.max!==X&&typeof ie=="number"&&ie>X&&H&&H(X),"min"in this.props&&b.min!==B&&typeof ie=="number"&&ie<B&&H&&H(B)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var se=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===T.a.BACKSPACE?se=this.cursorStart-1:this.lastKeyCode===T.a.DELETE&&(se=this.cursorStart):se=this.input.value.length,this.fixCaret(se,se)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case T.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case T.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Te){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(b){var M=b;return M===""?M="":this.isNotCompleteNumber(parseFloat(M))?M=this.state.value:M=this.getValidValue(M),this.toNumber(M)}},{key:"getValueFromEvent",value:function(b){var M=b.target.value.trim().replace(/。/g,".");return m(this.props.decimalSeparator)&&(M=M.replace(this.props.decimalSeparator,".")),M}},{key:"getValidValue",value:function(b){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,H=parseFloat(b);return isNaN(H)?b:(H<M&&(H=M),H>F&&(H=F),H)}},{key:"setValue",value:function(b,M){var F=this.props.precision,H=this.isNotCompleteNumber(parseFloat(b))?null:parseFloat(b),X=this.state.value,B=X===void 0?null:X,U=this.state.inputValue,z=U===void 0?null:U,Z=typeof H=="number"?H.toFixed(F):"".concat(H),ie=H!==B||Z!=="".concat(z);return"value"in this.props?(z=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:z},M)):this.setState({value:H,inputValue:this.toPrecisionAsStep(b)},M),ie&&this.props.onChange(H),H}},{key:"getMaxPrecision",value:function(b){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.props,H=F.precision,X=F.step;if(m(H))return H;var B=this.getPrecision(M),U=this.getPrecision(X),z=this.getPrecision(b);return b?Math.max(z,B+U):B+U}},{key:"getPrecisionFactor",value:function(b){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.getMaxPrecision(b,M);return Math.pow(10,F)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(b){return this.props.formatter?this.props.formatter(b):b}},{key:"toPrecisionAsStep",value:function(b){if(this.isNotCompleteNumber(b)||b==="")return b;var M=Math.abs(this.getMaxPrecision(b));return isNaN(M)?b.toString():Number(b).toFixed(M)}},{key:"toNumber",value:function(b){var M=this.props.precision,F=this.state.focused,H=b&&b.length>16&&F;return this.isNotCompleteNumber(b)||H?b:m(M)?Math.round(b*Math.pow(10,M))/Math.pow(10,M):Number(b)}},{key:"upStep",value:function(b,M){var F=this.props.step,H=this.getPrecisionFactor(b,M),X=Math.abs(this.getMaxPrecision(b,M)),B=((H*b+H*F*M)/H).toFixed(X);return this.toNumber(B)}},{key:"downStep",value:function(b,M){var F=this.props.step,H=this.getPrecisionFactor(b,M),X=Math.abs(this.getMaxPrecision(b,M)),B=((H*b-H*F*M)/H).toFixed(X);return this.toNumber(B)}},{key:"step",value:function(b,M){var F=this,H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,X=arguments.length>3?arguments[3]:void 0;this.stop(),M&&(M.persist(),M.preventDefault());var B=this.props;if(B.disabled)return;var U=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(U))return;var z=this["".concat(b,"Step")](U,H),Z=z>B.max||z<B.min;if(z>B.max?z=B.max:z<B.min&&(z=B.min),this.setValue(z,null),this.setState({focused:!0},function(){F.pressingUpOrDown=!1}),Z)return;this.autoStepTimer=setTimeout(function(){F[b](M,H,!0)},X?d:w)}},{key:"fixCaret",value:function(b,M){if(b===void 0||M===void 0||!this.input||!this.input.value)return;try{var F=this.input.selectionStart,H=this.input.selectionEnd;(b!==F||M!==H)&&this.input.setSelectionRange(b,M)}catch(X){}}},{key:"render",value:function(){var b,M=this.props,F=M.prefixCls,H=M.disabled,X=M.readOnly,B=M.useTouch,U=M.autoComplete,z=M.upHandler,Z=M.downHandler,ie=M.className,se=M.max,Te=M.min,he=M.style,xe=M.title,pe=M.onMouseEnter,ge=M.onMouseLeave,le=M.onMouseOver,ue=M.onMouseOut,Le=M.required,Fe=M.onClick,Ie=M.tabIndex,Ne=M.type,Ue=M.placeholder,Ee=M.id,ye=M.inputMode,_e=M.pattern,Me=M.step,Pe=M.maxLength,we=M.autoFocus,Ce=M.name,Ye=M.onPaste,Ge=M.onInput,ze=Object(ee.a)(M,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Be=this.state,rt=Be.value,Ve=Be.focused,We=E()(F,(b={},Object(G.a)(b,ie,!!ie),Object(G.a)(b,"".concat(F,"-disabled"),H),Object(G.a)(b,"".concat(F,"-focused"),Ve),b)),ve={};Object.keys(ze).forEach(function(q){(q.substr(0,5)==="data-"||q.substr(0,5)==="aria-"||q==="role")&&(ve[q]=ze[q])});var qe=!X&&!H,Xe=this.getInputDisplayValue(null),be=(rt||rt===0)&&(isNaN(rt)||Number(rt)>=se),Oe=(rt||rt===0)&&(isNaN(rt)||Number(rt)<=Te),te=be||H||X,ne=Oe||H||X,ae=E()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(G.a)({},"".concat(F,"-handler-up-disabled"),te)),Y=E()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(G.a)({},"".concat(F,"-handler-down-disabled"),ne)),$=B?{onTouchStart:te?l:this.up,onTouchEnd:this.stop}:{onMouseDown:te?l:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},J=B?{onTouchStart:ne?l:this.down,onTouchEnd:this.stop}:{onMouseDown:ne?l:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return A.a.createElement("div",{className:We,style:he,title:xe,onMouseEnter:pe,onMouseLeave:ge,onMouseOver:le,onMouseOut:ue,onFocus:function(){return null},onBlur:function(){return null}},A.a.createElement("div",{className:"".concat(F,"-handler-wrap")},A.a.createElement("span",Object.assign({unselectable:"on"},$,{role:"button","aria-label":"Increase Value","aria-disabled":te,className:ae}),z||A.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-up-inner"),onClick:o})),A.a.createElement("span",Object.assign({unselectable:"on"},J,{role:"button","aria-label":"Decrease Value","aria-disabled":ne,className:Y}),Z||A.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-down-inner"),onClick:o}))),A.a.createElement("div",{className:"".concat(F,"-input-wrap")},A.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Te,"aria-valuemax":se,"aria-valuenow":rt,required:Le,type:Ne,placeholder:Ue,onPaste:Ye,onClick:Fe,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:Ie,autoComplete:U,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:qe?this.onKeyDown:l,onKeyUp:qe?this.onKeyUp:l,autoFocus:we,maxLength:Pe,readOnly:X,disabled:H,max:se,min:Te,step:Me,name:Ce,title:xe,id:Ee,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Xe),pattern:_e,inputMode:ye,onInput:Ge},ve))))}}]),v}(A.a.Component);x.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:f,min:-f,step:1,style:{},onChange:l,onKeyDown:l,onPressEnter:l,onFocus:l,onBlur:l,parser:s,required:!1,autoComplete:"off"};var h=x,c=Je.a=h},fB9n:function(lt,Je,Q){"use strict";Q.r(Je);var ee=Q("14J3"),G=Q("BMrR"),D=Q("jCWc"),W=Q("kPKH"),R=Q("k1fw"),P=Q("9og8"),N=Q("tJVT"),k=Q("PpiC"),A=Q("WmNS"),O=Q.n(A),E=Q("cDcd"),T=Q.n(E),_=Q("55Ip"),C=Q("9kvl"),y=Q("T2oS"),g=Q("W9HT"),l=Q("oBTY"),o=Q("B9cy"),s=Q("Ol7k"),d=Q("lUTK"),w=Q("BvKs"),f=Q("Ty5D"),m=Q("wd/R"),L=Q.n(m),x=Q("RotF"),h=Q.n(x),c=Q("m3rI"),u=Q("9Bee"),a=Q("SbmS"),v=Q.n(a),p=w.a.SubMenu,b=s.a.Sider,M=s.a.Content,F=function(ye){var _e=ye.messages,Me=ye.globalSetting,Pe=ye.loading,we=ye.user,Ce=ye.dispatch,Ye=Object(k.a)(ye,["messages","globalSetting","loading","user","dispatch"]),Ge=Object(f.i)(),ze=Object(f.h)(),Be=we.userInfo,rt=Object(E.useState)(!1),Ve=Object(N.a)(rt,2),We=Ve[0],ve=Ve[1],qe=Object(E.useState)({per_page:20,page:1}),Xe=Object(N.a)(qe,2),be=Xe[0],Oe=Xe[1],te=Object(E.useState)({per_page:20,page:1}),ne=Object(N.a)(te,2),ae=ne[0],Y=ne[1],$=Object(E.useState)([]),J=Object(N.a)($,2),q=J[0],de=J[1];Object(E.useEffect)(function(){be.page=1,De()},[Ge.userId]);var me=function(ot){var Qe,pt;C.d.push("/messages/".concat(we==null||((Qe=we.userInfo)===null||Qe===void 0)?void 0:Qe.login,"/message_detail?target_ids=").concat(ot==null||((pt=ot.target)===null||pt===void 0)?void 0:pt.id))},De=function(){var $e=Object(P.a)(O.a.mark(function ot(){var Qe,pt;return O.a.wrap(function(et){for(;;)switch(et.prev=et.next){case 0:return ve(!1),et.next=3,Ce({type:"messages/getPrivateMessages",payload:Object(R.a)(Object(R.a)({},Ge),ae)});case 3:Qe=et.sent,Qe!=null&&Qe.private_messages&&(de([].concat(Object(l.a)(q),Object(l.a)(Qe.private_messages))),((pt=Qe.private_messages)===null||pt===void 0?void 0:pt.length)===20&&ve(!0));case 5:case"end":return et.stop()}},ot)}));return function(){return $e.apply(this,arguments)}}();return T.a.createElement("aside",{className:v.a.listRightMessage},T.a.createElement(h.a,{loadMore:function(){ae.page++,De()},hasMore:We,useWindow:!1},T.a.createElement(g.a,{spinning:Pe["messages/getPrivateMessages"]},T.a.createElement("div",{className:"minH500"},q==null?void 0:q.map(function($e,ot){var Qe,pt;return T.a.createElement("aside",{key:ot},T.a.createElement(G.a,{onClick:function(){return me($e)}},T.a.createElement(W.a,{flex:"58px"},T.a.createElement("img",{src:c.a.IMG_SERVER+"/images/"+($e==null||((Qe=$e.target)===null||Qe===void 0)?void 0:Qe.image_url),alt:""})),T.a.createElement(W.a,{flex:"1"},T.a.createElement(G.a,null,T.a.createElement(W.a,{span:24},T.a.createElement(G.a,null,T.a.createElement(W.a,{flex:"1"},T.a.createElement("span",{className:v.a.userName},$e==null||((pt=$e.target)===null||pt===void 0)?void 0:pt.name)),T.a.createElement(W.a,null,T.a.createElement("span",{className:"ml15 c-grey-c"},L()($e.send_time).fromNow())))),T.a.createElement(W.a,{span:24},T.a.createElement("div",{className:["mt15",v.a.content].join(" ")},T.a.createElement(u.a,{value:$e.content||""})))))))})))))},H=Object(C.a)(function(Ee){var ye=Ee.messages,_e=Ee.loading,Me=Ee.user,Pe=Ee.globalSetting;return{messages:ye,globalSetting:Pe,user:Me,loading:_e.effects}})(F),X=Q("+L6B"),B=Q("2/Rp"),U=Q("miYZ"),z=Q("tsqr"),Z=Q("y8nQ"),ie=Q("Vl3Y"),se=Q("kaH+"),Te=Q("1vsH"),he=Q("5WQS"),xe=Q("Ot1p"),pe=Q("dhSg"),ge=w.a.SubMenu,le=s.a.Sider,ue=s.a.Content,Le=function(ye){var _e=ye.messages,Me=ye.globalSetting,Pe=ye.loading,we=ye.user,Ce=ye.dispatch,Ye=Object(k.a)(ye,["messages","globalSetting","loading","user","dispatch"]),Ge=Object(f.i)(),ze=Object(f.h)(),Be=ze.query,rt=Object(E.useState)({per_page:20,page:1}),Ve=Object(N.a)(rt,2),We=Ve[0],ve=Ve[1],qe=Object(E.useState)([]),Xe=Object(N.a)(qe,2),be=Xe[0],Oe=Xe[1],te=Object(E.useState)(!1),ne=Object(N.a)(te,2),ae=ne[0],Y=ne[1],$=Object(E.useState)(!1),J=Object(N.a)($,2),q=J[0],de=J[1],me=Object(E.useState)(""),De=Object(N.a)(me,2),$e=De[0],ot=De[1],Qe=Object(E.useRef)(),pt=ie.a.useForm(),ct=Object(N.a)(pt,1),et=ct[0],Rt=Object(E.useState)([]),ft=Object(N.a)(Rt,2),Ut=ft[0],Wt=ft[1],yt=Object(E.useState)(!0),pr=Object(N.a)(yt,2),Ar=pr[0],or=pr[1];Object(E.useEffect)(function(){We.page=1,dr()},[Be.target_ids]);var dr=function(){var bt=Object(P.a)(O.a.mark(function Nt(){var Ct,vt;return O.a.wrap(function(Zt){for(;;)switch(Zt.prev=Zt.next){case 0:return Y(!1),Zt.next=3,Ce({type:"messages/getPrivateMessageDetails",payload:Object(R.a)(Object(R.a)({},Ge),{},{target_id:Be==null?void 0:Be.target_ids},We)});case 3:Ct=Zt.sent,Ct!=null&&Ct.messages&&(Ut=Ct==null?void 0:Ct.messages,((vt=Ut)===null||vt===void 0?void 0:vt.length)===20&&setTimeout(function(){Y(!0),or(!1)},500),We.page===1?Oe(Object(l.a)(Ct==null?void 0:Ct.messages.reverse())):Oe([].concat(Object(l.a)(be),Object(l.a)(Ct==null?void 0:Ct.messages.reverse()))));case 5:case"end":return Zt.stop()}},Nt)}));return function(){return bt.apply(this,arguments)}}();Object(E.useEffect)(function(){console.log("newData.length:",We,Ut.length,Ut),We.page===1&&Ar&&(Qe.current.scrollTop=Qe.current.scrollHeight)},[be]),Object(E.useEffect)(function(){Qe.current.onclick=function(bt){bt.target.nodeName==="IMG"&&bt.target.alt!==""&&pe.a.publish("preview-image",bt.target.src)}},[]);var cr=function(){var bt=Object(P.a)(O.a.mark(function Nt(Ct,vt){var nt;return O.a.wrap(function(gr){for(;;)switch(gr.prev=gr.next){case 0:return gr.next=2,Object(he.a)(Object(R.a)(Object(R.a)({},Ge),{},{id:Ct.id}));case 2:nt=gr.sent,nt.status===0&&(be.splice(vt,1),Oe(Object(l.a)(be)));case 5:case"end":return gr.stop()}},Nt)}));return function(Ct,vt){return bt.apply(this,arguments)}}(),hn=function(){var bt=Object(P.a)(O.a.mark(function Nt(){return O.a.wrap(function(vt){for(;;)switch(vt.prev=vt.next){case 0:if(!($e==="")){vt.next=3;break}return z.b.error("\u8BF7\u8F93\u5165\u60A8\u7684\u56DE\u590D"),vt.abrupt("return",!1);case 3:return ot(""),de(!0),vt.next=8,Object(he.g)(Object(R.a)(Object(R.a)({},Ge),{},{content:$e,target_id:Be==null?void 0:Be.target_ids}));case 8:de(!1),We.page=1,et.resetFields(),dr();case 12:case"end":return vt.stop()}},Nt)}));return function(){return bt.apply(this,arguments)}}();return T.a.createElement("section",null,T.a.createElement("aside",{className:v.a.listMessage,ref:Qe},T.a.createElement(h.a,{isReverse:!0,loadMore:function(){We.page++,dr()},hasMore:ae,useWindow:!1},!ae&&T.a.createElement("div",{className:"tc mt20 animated fadeIn"},T.a.createElement("span",{className:v.a.msgDate},"\u6CA1\u6709\u4FE1\u606F\u4E86\uFF5E\uFF5E")),T.a.createElement(g.a,{spinning:Pe["messages/getPrivateMessageDetails"]},T.a.createElement("aside",{className:"minH500"},be==null?void 0:be.map(function(bt,Nt){var Ct;return T.a.createElement("aside",{key:Nt},T.a.createElement(G.a,{justify:"center"},T.a.createElement(W.a,{flex:"1",className:"tc"},T.a.createElement("span",{className:v.a.msgDate},L()(bt.send_time).format("YYYY-MM-DD")))),T.a.createElement(G.a,{onClick:function(){return Object(Te.H)(bt)}},T.a.createElement(W.a,{flex:"58px"},T.a.createElement("img",{src:c.a.IMG_SERVER+"/images/"+(bt==null||((Ct=bt.sender)===null||Ct===void 0)?void 0:Ct.image_url),alt:""})),T.a.createElement(W.a,null,T.a.createElement("div",{className:v.a.msg},T.a.createElement(u.a,{value:bt.content||""}),T.a.createElement("span",{onClick:function(){return cr(bt,Nt)},className:["current",v.a.deleteMsg].join(" ")},"\u5220\u9664"))),T.a.createElement(W.a,null,T.a.createElement("span",{className:"c-grey-c ml10"},L()(bt.send_time).format("HH:mm")))))}))))),T.a.createElement("aside",{className:"pl30 pr30 mb30 mt30"},T.a.createElement(ie.a,{form:et},T.a.createElement(ie.a.Item,{name:"content"},T.a.createElement(xe.a,{placeholder:"\u8BF7\u8F93\u5165\u4F60\u7684\u56DE\u590D",height:150,onChange:function(Nt){return ot(Nt)}})),T.a.createElement(G.a,null,T.a.createElement(W.a,{flex:"1"},T.a.createElement("span",{className:"c-red font14"},"\u5728\u95EE\u9898\u53CD\u9988\u65F6\uFF0C\u8BF7\u540C\u65F6\u53D1\u9001\u95EE\u9898\u53D1\u751F\u9875\u7684\u7F51\u5740\u94FE\u63A5\uFF0C\u4EE5\u4FBF\u6211\u4EEC\u9AD8\u6548\u7684\u4E3A\u60A8\u670D\u52A1")),T.a.createElement(W.a,null,T.a.createElement(B.a,{loading:q,type:"primary",onClick:function(){return hn()}},"\u56DE\u590D"))))),T.a.createElement(se.a,null))},Fe=Object(C.a)(function(Ee){var ye=Ee.messages,_e=Ee.loading,Me=Ee.user,Pe=Ee.globalSetting;return{messages:ye,globalSetting:Pe,user:Me,loading:_e.effects}})(Le),Ie=Q("30zm"),Ne=function(ye){var _e,Me=ye.messages,Pe=ye.globalSetting,we=ye.loading,Ce=ye.user,Ye=ye.dispatch,Ge=Object(k.a)(ye,["messages","globalSetting","loading","user","dispatch"]),ze=Ge.match.params,Be=Ge.location.query,rt=Ce.userInfo,Ve=Me.tidingsList,We=Me.privateMessageDetails,ve=Object(E.useState)({per_page:20,page:1}),qe=Object(N.a)(ve,2),Xe=qe[0],be=qe[1],Oe=Object(E.useState)({per_page:20,page:1}),te=Object(N.a)(Oe,2),ne=te[0],ae=te[1],Y=Object(E.useState)([]),$=Object(N.a)(Y,2),J=$[0],q=$[1],de=Object(E.useState)([]),me=Object(N.a)(de,2),De=me[0],$e=me[1];Object(E.useEffect)(function(){Xe.page=1},[ze.userId]);var ot=function(){var pt=Object(P.a)(O.a.mark(function ct(){var et;return O.a.wrap(function(ft){for(;;)switch(ft.prev=ft.next){case 0:return ft.next=2,Ye({type:"messages/getPrivateMessageDetails",payload:Object(R.a)(Object(R.a)({},ze),{},{target_id:Be==null?void 0:Be.target_ids})});case 2:et=ft.sent,et!=null&&et.messages&&q(et.messages);case 4:case"end":return ft.stop()}},ct)}));return function(){return pt.apply(this,arguments)}}(),Qe=function(){var pt=Object(P.a)(O.a.mark(function ct(){var et;return O.a.wrap(function(ft){for(;;)switch(ft.prev=ft.next){case 0:return ft.next=2,Ye({type:"messages/getPrivateMessages",payload:Object(R.a)(Object(R.a)({},ze),ne)});case 2:et=ft.sent,et!=null&&et.private_messages&&$e(et.private_messages);case 4:case"end":return ft.stop()}},ct)}));return function(){return pt.apply(this,arguments)}}();return T.a.createElement("section",{className:v.a.bg},T.a.createElement("section",{className:"edu-container mt20"},T.a.createElement(G.a,{gutter:[20,20]},T.a.createElement(Ie.a,null),T.a.createElement(W.a,{flex:"1"},T.a.createElement("aside",{className:"bg-white"},T.a.createElement("aside",{className:["font16",v.a.topBar].join(" ")},T.a.createElement(G.a,null,T.a.createElement(W.a,{flex:"30px",className:"tc"},T.a.createElement(_.a,{to:"/messages/".concat(ze.userId,"/private_messages"),className:"iconfont icon-zuojiantou c-black pl10"})),T.a.createElement(W.a,{flex:"1",className:"tc"},We==null||((_e=We.target)===null||_e===void 0)?void 0:_e.name,"\u4E0E\u4F60\u7684\u79C1\u4FE1"),T.a.createElement(W.a,{flex:"290px",className:"tl"},T.a.createElement("span",{className:"pl30"},"\u79C1\u4FE1\u5217\u8868")))),T.a.createElement(G.a,null,T.a.createElement(W.a,{flex:"1"},T.a.createElement(Fe,null)),T.a.createElement(W.a,{flex:"290px"},T.a.createElement(H,null))))))))},Ue=Je.default=Object(C.a)(function(Ee){var ye=Ee.messages,_e=Ee.loading,Me=Ee.user,Pe=Ee.globalSetting;return{messages:ye,globalSetting:Pe,user:Me,loading:_e.effects}})(Ne)},kSUc:function(lt,Je,Q){},"kaH+":function(lt,Je,Q){"use strict";var ee=Q("+L6B"),G=Q("2/Rp"),D=Q("tJVT"),W=Q("cDcd"),R=Q.n(W),P=Q("UZu5"),N=Q.n(P),k=Q("dhSg"),A=Q("rLCj"),O=Q("dF/Y"),E=Q("4i/N");Je.a=function(){var T=Object(W.useState)(""),_=Object(D.a)(T,2),C=_[0],y=_[1],g=Object(W.useState)(0),l=Object(D.a)(g,2),o=l[0],s=l[1],d=Object(W.useRef)("");Object(W.useEffect)(function(){var L=k.a.subscribe("preview-image",function(x){y(x),document.body.style.overflow="hidden"});return L},[]),Object(W.useEffect)(function(){return document.addEventListener("keydown",w),function(){document.removeEventListener("keydown",w)}},[]),Object(W.useEffect)(function(){d.current=C},[C]);function w(L){L.keyCode==27&&d.current&&f()}function f(){document.body.style.overflow="auto",y("")}function m(){s(o+90)}return R.a.createElement(W.Fragment,null,C?R.a.createElement("div",{className:"image-preview-container"},R.a.createElement("div",{className:"button-group"},R.a.createElement(G.a,{onClick:m},"\u65CB\u8F6C",R.a.createElement(A.a,null)),R.a.createElement(G.a,{href:C},"\u4E0B\u8F7D",R.a.createElement(O.a,null)),R.a.createElement(G.a,{onClick:f},"\u5173\u95ED",R.a.createElement(E.a,null))),R.a.createElement("div",{className:"preview-wrp-group"},R.a.createElement("img",{className:"image-preview",src:C,alt:"\u9884\u89C8\u5927\u56FE",style:{transform:"rotate(".concat(o,"deg)")}}))):null)}},kzJb:function(lt,Je,Q){lt.exports={flex_box_center:"flex_box_center___2qtoc",flex_space_between:"flex_space_between___NF1Yf",flex_box_vertical_center:"flex_box_vertical_center___2qH_j",flex_box_center_end:"flex_box_center_end___22P0N",flex_box_column:"flex_box_column___1IKP8",userInfo:"userInfo___2Dupy",navInfo:"navInfo___3fEvD",actived:"actived___3F322",newTip:"newTip___1Ta-b"}},lZu9:function(lt,Je,Q){(function(ee){ee(Q("VrN/"),Q("1eCo"),Q("8EBN"))})(function(ee){"use strict";ee.defineMode("markdown",function(G,D){var W=ee.getMode(G,"text/html"),R=W.name=="null";function P(B){if(ee.findModeByName){var U=ee.findModeByName(B);U&&(B=U.mime||U.mimes[0])}var z=ee.getMode(G,B);return z.name=="null"?null:z}D.highlightFormatting===void 0&&(D.highlightFormatting=!1),D.maxBlockquoteDepth===void 0&&(D.maxBlockquoteDepth=0),D.taskLists===void 0&&(D.taskLists=!1),D.strikethrough===void 0&&(D.strikethrough=!1),D.emoji===void 0&&(D.emoji=!1),D.fencedCodeBlockHighlighting===void 0&&(D.fencedCodeBlockHighlighting=!0),D.fencedCodeBlockDefaultMode===void 0&&(D.fencedCodeBlockDefaultMode="text/plain"),D.xml===void 0&&(D.xml=!0),D.tokenTypeOverrides===void 0&&(D.tokenTypeOverrides={});var N={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 k in N)N.hasOwnProperty(k)&&D.tokenTypeOverrides[k]&&(N[k]=D.tokenTypeOverrides[k]);var A=/^([*\-_])(?:\s*\1){2,}\s*$/,O=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,E=/^\[(x| )\](?=\s)/i,T=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,_=/^ {0,3}(?:\={1,}|-{2,})\s*$/,C=/^[^#!\[\]*_\\<>` "'(~:]+/,y=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,g=/^\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(B,U,z){return U.f=U.inline=z,z(B,U)}function d(B,U,z){return U.f=U.block=z,z(B,U)}function w(B){return!B||!/\S/.test(B.string)}function f(B){if(B.linkTitle=!1,B.linkHref=!1,B.linkText=!1,B.em=!1,B.strong=!1,B.strikethrough=!1,B.quote=0,B.indentedCode=!1,B.f==L){var U=R;if(!U){var z=ee.innerMode(W,B.htmlState);U=z.mode.name=="xml"&&z.state.tagStart===null&&!z.state.context&&z.state.tokenize.isInText}U&&(B.f=u,B.block=m,B.htmlState=null)}return B.trailingSpace=0,B.trailingSpaceNewLine=!1,B.prevLine=B.thisLine,B.thisLine={stream:null},null}function m(B,U){var z=B.column()===U.indentation,Z=w(U.prevLine.stream),ie=U.indentedCode,se=U.prevLine.hr,Te=U.list!==!1,he=(U.listStack[U.listStack.length-1]||0)+3;U.indentedCode=!1;var xe=U.indentation;if(U.indentationDiff===null&&(U.indentationDiff=U.indentation,Te)){for(U.list=null;xe<U.listStack[U.listStack.length-1];)U.listStack.pop(),U.listStack.length?U.indentation=U.listStack[U.listStack.length-1]:U.list=!1;U.list!==!1&&(U.indentationDiff=xe-U.listStack[U.listStack.length-1])}var pe=!Z&&!se&&!U.prevLine.header&&(!Te||!ie)&&!U.prevLine.fencedCodeEnd,ge=(U.list===!1||se||Z)&&U.indentation<=he&&B.match(A),le=null;if(U.indentationDiff>=4&&(ie||U.prevLine.fencedCodeEnd||U.prevLine.header||Z))return B.skipToEnd(),U.indentedCode=!0,N.code;if(B.eatSpace())return null;if(z&&U.indentation<=he&&(le=B.match(T))&&le[1].length<=6)return U.quote=0,U.header=le[1].length,U.thisLine.header=!0,D.highlightFormatting&&(U.formatting="header"),U.f=U.inline,h(U);if(U.indentation<=he&&B.eat(">"))return U.quote=z?1:U.quote+1,D.highlightFormatting&&(U.formatting="quote"),B.eatSpace(),h(U);if(!ge&&!U.setext&&z&&U.indentation<=he&&(le=B.match(O))){var ue=le[1]?"ol":"ul";return U.indentation=xe+B.current().length,U.list=!0,U.quote=0,U.listStack.push(U.indentation),U.em=!1,U.strong=!1,U.code=!1,U.strikethrough=!1,D.taskLists&&B.match(E,!1)&&(U.taskList=!0),U.f=U.inline,D.highlightFormatting&&(U.formatting=["list","list-"+ue]),h(U)}else{if(z&&U.indentation<=he&&(le=B.match(y,!0)))return U.quote=0,U.fencedEndRE=new RegExp(le[1]+"+ *$"),U.localMode=D.fencedCodeBlockHighlighting&&P(le[2]||D.fencedCodeBlockDefaultMode),U.localMode&&(U.localState=ee.startState(U.localMode)),U.f=U.block=x,D.highlightFormatting&&(U.formatting="code-block"),U.code=-1,h(U);if(U.setext||(!pe||!Te)&&!U.quote&&U.list===!1&&!U.code&&!ge&&!g.test(B.string)&&(le=B.lookAhead(1))&&(le=le.match(_)))return U.setext?(U.header=U.setext,U.setext=0,B.skipToEnd(),D.highlightFormatting&&(U.formatting="header")):(U.header=le[0].charAt(0)=="="?1:2,U.setext=U.header),U.thisLine.header=!0,U.f=U.inline,h(U);if(ge)return B.skipToEnd(),U.hr=!0,U.thisLine.hr=!0,N.hr;if(B.peek()==="[")return s(B,U,M)}return s(B,U,U.inline)}function L(B,U){var z=W.token(B,U.htmlState);if(!R){var Z=ee.innerMode(W,U.htmlState);(Z.mode.name=="xml"&&Z.state.tagStart===null&&!Z.state.context&&Z.state.tokenize.isInText||U.md_inside&&B.current().indexOf(">")>-1)&&(U.f=u,U.block=m,U.htmlState=null)}return z}function x(B,U){var z=U.listStack[U.listStack.length-1]||0,Z=U.indentation<z,ie=z+3;if(U.fencedEndRE&&U.indentation<=ie&&(Z||B.match(U.fencedEndRE))){D.highlightFormatting&&(U.formatting="code-block");var se;return Z||(se=h(U)),U.localMode=U.localState=null,U.block=m,U.f=u,U.fencedEndRE=null,U.code=0,U.thisLine.fencedCodeEnd=!0,Z?d(B,U,U.block):se}else return U.localMode?U.localMode.token(B,U.localState):(B.skipToEnd(),N.code)}function h(B){var U=[];if(B.formatting){U.push(N.formatting),typeof B.formatting=="string"&&(B.formatting=[B.formatting]);for(var z=0;z<B.formatting.length;z++)U.push(N.formatting+"-"+B.formatting[z]),B.formatting[z]==="header"&&U.push(N.formatting+"-"+B.formatting[z]+"-"+B.header),B.formatting[z]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=B.quote?U.push(N.formatting+"-"+B.formatting[z]+"-"+B.quote):U.push("error"))}if(B.taskOpen)return U.push("meta"),U.length?U.join(" "):null;if(B.taskClosed)return U.push("property"),U.length?U.join(" "):null;if(B.linkHref?U.push(N.linkHref,"url"):(B.strong&&U.push(N.strong),B.em&&U.push(N.em),B.strikethrough&&U.push(N.strikethrough),B.emoji&&U.push(N.emoji),B.linkText&&U.push(N.linkText),B.code&&U.push(N.code),B.image&&U.push(N.image),B.imageAltText&&U.push(N.imageAltText,"link"),B.imageMarker&&U.push(N.imageMarker)),B.header&&U.push(N.header,N.header+"-"+B.header),B.quote&&(U.push(N.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=B.quote?U.push(N.quote+"-"+B.quote):U.push(N.quote+"-"+D.maxBlockquoteDepth)),B.list!==!1){var Z=(B.listStack.length-1)%3;Z?Z===1?U.push(N.list2):U.push(N.list3):U.push(N.list1)}return B.trailingSpaceNewLine?U.push("trailing-space-new-line"):B.trailingSpace&&U.push("trailing-space-"+(B.trailingSpace%2?"a":"b")),U.length?U.join(" "):null}function c(B,U){return B.match(C,!0)?h(U):void 0}function u(B,U){var z=U.text(B,U);if(typeof z!="undefined")return z;if(U.list)return U.list=null,h(U);if(U.taskList){var Z=B.match(E,!0)[1]===" ";return Z?U.taskOpen=!0:U.taskClosed=!0,D.highlightFormatting&&(U.formatting="task"),U.taskList=!1,h(U)}if(U.taskOpen=!1,U.taskClosed=!1,U.header&&B.match(/^#+$/,!0))return D.highlightFormatting&&(U.formatting="header"),h(U);var ie=B.next();if(U.linkTitle){U.linkTitle=!1;var se=ie;ie==="("&&(se=")"),se=(se+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Te="^\\s*(?:[^"+se+"\\\\]+|\\\\\\\\|\\\\.)"+se;if(B.match(new RegExp(Te),!0))return N.linkHref}if(ie==="`"){var he=U.formatting;D.highlightFormatting&&(U.formatting="code"),B.eatWhile("`");var xe=B.current().length;if(U.code==0&&(!U.quote||xe==1))return U.code=xe,h(U);if(xe==U.code){var pe=h(U);return U.code=0,pe}else return U.formatting=he,h(U)}else if(U.code)return h(U);if(ie==="\\"&&(B.next(),D.highlightFormatting)){var ge=h(U),le=N.formatting+"-escape";return ge?ge+" "+le:le}if(ie==="!"&&B.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return U.imageMarker=!0,U.image=!0,D.highlightFormatting&&(U.formatting="image"),h(U);if(ie==="["&&U.imageMarker&&B.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return U.imageMarker=!1,U.imageAltText=!0,D.highlightFormatting&&(U.formatting="image"),h(U);if(ie==="]"&&U.imageAltText){D.highlightFormatting&&(U.formatting="image");var ge=h(U);return U.imageAltText=!1,U.image=!1,U.inline=U.f=v,ge}if(ie==="["&&!U.image)return U.linkText&&B.match(/^.*?\]/)||(U.linkText=!0,D.highlightFormatting&&(U.formatting="link")),h(U);if(ie==="]"&&U.linkText){D.highlightFormatting&&(U.formatting="link");var ge=h(U);return U.linkText=!1,U.inline=U.f=B.match(/\(.*?\)| ?\[.*?\]/,!1)?v:u,ge}if(ie==="<"&&B.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){U.f=U.inline=a,D.highlightFormatting&&(U.formatting="link");var ge=h(U);return ge?ge+=" ":ge="",ge+N.linkInline}if(ie==="<"&&B.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){U.f=U.inline=a,D.highlightFormatting&&(U.formatting="link");var ge=h(U);return ge?ge+=" ":ge="",ge+N.linkEmail}if(D.xml&&ie==="<"&&B.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ue=B.string.indexOf(">",B.pos);if(ue!=-1){var Le=B.string.substring(B.start,ue);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Le)&&(U.md_inside=!0)}return B.backUp(1),U.htmlState=ee.startState(W),d(B,U,L)}if(D.xml&&ie==="<"&&B.match(/^\/\w*?>/))return U.md_inside=!1,"tag";if(ie==="*"||ie==="_"){for(var Fe=1,Ie=B.pos==1?" ":B.string.charAt(B.pos-2);Fe<3&&B.eat(ie);)Fe++;var Ne=B.peek()||" ",Ue=!/\s/.test(Ne)&&(!l.test(Ne)||/\s/.test(Ie)||l.test(Ie)),Ee=!/\s/.test(Ie)&&(!l.test(Ie)||/\s/.test(Ne)||l.test(Ne)),ye=null,_e=null;if(Fe%2&&(!U.em&&Ue&&(ie==="*"||!Ee||l.test(Ie))?ye=!0:U.em==ie&&Ee&&(ie==="*"||!Ue||l.test(Ne))&&(ye=!1)),Fe>1&&(!U.strong&&Ue&&(ie==="*"||!Ee||l.test(Ie))?_e=!0:U.strong==ie&&Ee&&(ie==="*"||!Ue||l.test(Ne))&&(_e=!1)),_e!=null||ye!=null){D.highlightFormatting&&(U.formatting=ye==null?"strong":_e==null?"em":"strong em"),ye===!0&&(U.em=ie),_e===!0&&(U.strong=ie);var pe=h(U);return ye===!1&&(U.em=!1),_e===!1&&(U.strong=!1),pe}}else if(ie===" "&&(B.eat("*")||B.eat("_"))){if(B.peek()===" ")return h(U);B.backUp(1)}if(D.strikethrough){if(ie==="~"&&B.eatWhile(ie)){if(U.strikethrough){D.highlightFormatting&&(U.formatting="strikethrough");var pe=h(U);return U.strikethrough=!1,pe}else if(B.match(/^[^\s]/,!1))return U.strikethrough=!0,D.highlightFormatting&&(U.formatting="strikethrough"),h(U)}else if(ie===" "&&B.match(/^~~/,!0)){if(B.peek()===" ")return h(U);B.backUp(2)}}if(D.emoji&&ie===":"&&B.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){U.emoji=!0,D.highlightFormatting&&(U.formatting="emoji");var Me=h(U);return U.emoji=!1,Me}return ie===" "&&(B.match(/^ +$/,!1)?U.trailingSpace++:U.trailingSpace&&(U.trailingSpaceNewLine=!0)),h(U)}function a(B,U){var z=B.next();if(z===">"){U.f=U.inline=u,D.highlightFormatting&&(U.formatting="link");var Z=h(U);return Z?Z+=" ":Z="",Z+N.linkInline}return B.match(/^[^>]+/,!0),N.linkInline}function v(B,U){if(B.eatSpace())return null;var z=B.next();return z==="("||z==="["?(U.f=U.inline=b(z==="("?")":"]"),D.highlightFormatting&&(U.formatting="link-string"),U.linkHref=!0,h(U)):"error"}var p={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function b(B){return function(U,z){var Z=U.next();if(Z===B){z.f=z.inline=u,D.highlightFormatting&&(z.formatting="link-string");var ie=h(z);return z.linkHref=!1,ie}return U.match(p[B]),z.linkHref=!0,h(z)}}function M(B,U){return B.match(/^([^\]\\]|\\.)*\]:/,!1)?(U.f=F,B.next(),D.highlightFormatting&&(U.formatting="link"),U.linkText=!0,h(U)):s(B,U,u)}function F(B,U){if(B.match(/^\]:/,!0)){U.f=U.inline=H,D.highlightFormatting&&(U.formatting="link");var z=h(U);return U.linkText=!1,z}return B.match(/^([^\]\\]|\\.)+/,!0),N.linkText}function H(B,U){return B.eatSpace()?null:(B.match(/^[^\s]+/,!0),B.peek()===void 0?U.linkTitle=!0:B.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),U.f=U.inline=u,N.linkHref+" url")}var X={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(B){return{f:B.f,prevLine:B.prevLine,thisLine:B.thisLine,block:B.block,htmlState:B.htmlState&&ee.copyState(W,B.htmlState),indentation:B.indentation,localMode:B.localMode,localState:B.localMode?ee.copyState(B.localMode,B.localState):null,inline:B.inline,text:B.text,formatting:!1,linkText:B.linkText,linkTitle:B.linkTitle,linkHref:B.linkHref,code:B.code,em:B.em,strong:B.strong,strikethrough:B.strikethrough,emoji:B.emoji,header:B.header,setext:B.setext,hr:B.hr,taskList:B.taskList,list:B.list,listStack:B.listStack.slice(0),quote:B.quote,indentedCode:B.indentedCode,trailingSpace:B.trailingSpace,trailingSpaceNewLine:B.trailingSpaceNewLine,md_inside:B.md_inside,fencedEndRE:B.fencedEndRE}},token:function(B,U){if(U.formatting=!1,B!=U.thisLine.stream){if(U.header=0,U.hr=!1,B.match(/^\s*$/,!0))return f(U),null;if(U.prevLine=U.thisLine,U.thisLine={stream:B},U.taskList=!1,U.trailingSpace=0,U.trailingSpaceNewLine=!1,!U.localState&&(U.f=U.block,U.f!=L)){var z=B.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(U.indentation=z,U.indentationDiff=null,z>0)return null}}return U.f(B,U)},innerMode:function(B){return B.block==L?{state:B.htmlState,mode:W}:B.localState?{state:B.localState,mode:B.localMode}:{state:B,mode:X}},indent:function(B,U,z){return B.block==L&&W.indent?W.indent(B.htmlState,U,z):B.localState&&B.localMode.indent?B.localMode.indent(B.localState,U,z):ee.Pass},blankLine:f,getType:h,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return X},"xml"),ee.defineMIME("text/markdown","markdown"),ee.defineMIME("text/x-markdown","markdown")})},osHv:function(lt,Je,Q){(function(ee){ee(Q("VrN/"))})(function(ee){"use strict";var G=ee.Pos;function D(l,o){return l.line-o.line||l.ch-o.ch}var W="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",R=W+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+W+"]["+R+"]*)","g");function N(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 k(l,o){var s=l.cm.getTokenTypeAt(G(l.line,o));return s&&/\btag\b/.test(s)}function A(l){return l.line>=l.max?void 0:(l.ch=0,l.text=l.cm.getLine(++l.line),!0)}function O(l){return l.line<=l.min?void 0:(l.text=l.cm.getLine(--l.line),l.ch=l.text.length,!0)}function E(l){for(;;){var o=l.text.indexOf(">",l.ch);if(o==-1){if(A(l))continue;return}if(!k(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 T(l){for(;;){var o=l.ch?l.text.lastIndexOf("<",l.ch-1):-1;if(o==-1){if(O(l))continue;return}if(!k(l,o+1)){l.ch=o;continue}P.lastIndex=o,l.ch=o;var s=P.exec(l.text);if(s&&s.index==o)return s}}function _(l){for(;;){P.lastIndex=l.ch;var o=P.exec(l.text);if(!o){if(A(l))continue;return}if(!k(l,o.index+1)){l.ch=o.index+1;continue}return l.ch=o.index+o[0].length,o}}function C(l){for(;;){var o=l.ch?l.text.lastIndexOf(">",l.ch-1):-1;if(o==-1){if(O(l))continue;return}if(!k(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 y(l,o){for(var s=[];;){var d=_(l),w,f=l.line,m=l.ch-(d?d[0].length:0);if(!d||!(w=E(l)))return;if(w=="selfClose")continue;if(d[1]){for(var L=s.length-1;L>=0;--L)if(s[L]==d[2]){s.length=L;break}if(L<0&&(!o||o==d[2]))return{tag:d[2],from:G(f,m),to:G(l.line,l.ch)}}else s.push(d[2])}}function g(l,o){for(var s=[];;){var d=C(l);if(!d)return;if(d=="selfClose"){T(l);continue}var w=l.line,f=l.ch,m=T(l);if(!m)return;if(m[1])s.push(m[2]);else{for(var L=s.length-1;L>=0;--L)if(s[L]==m[2]){s.length=L;break}if(L<0&&(!o||o==m[2]))return{tag:m[2],from:G(l.line,l.ch),to:G(w,f)}}}}ee.registerHelper("fold","xml",function(l,o){for(var s=new N(l,o.line,0);;){var d=_(s);if(!d||s.line!=o.line)return;var w=E(s);if(!w)return;if(!d[1]&&w!="selfClose"){var f=G(s.line,s.ch),m=y(s,d[2]);return m&&D(m.from,f)>0?{from:f,to:m.from}:null}}}),ee.findMatchingTag=function(l,o,s){var d=new N(l,o.line,o.ch,s);if(d.text.indexOf(">")==-1&&d.text.indexOf("<")==-1)return;var w=E(d),f=w&&G(d.line,d.ch),m=w&&T(d);if(!w||!m||D(d,o)>0)return;var L={from:G(d.line,d.ch),to:f,tag:m[2]};return w=="selfClose"?{open:L,close:null,at:"open"}:m[1]?{open:g(d,m[2]),close:L,at:"close"}:(d=new N(l,f.line,f.ch,s),{open:L,close:y(d,m[2]),at:"open"})},ee.findEnclosingTag=function(l,o,s,d){for(var w=new N(l,o.line,o.ch,s);;){var f=g(w,d);if(!f)break;var m=new N(l,o.line,o.ch,s),L=y(m,f.tag);if(L)return{open:f,close:L}}},ee.scanForClosingTag=function(l,o,s,d){var w=new N(l,o.line,o.ch,d?{from:0,to:d}:null);return y(w,s)}})},p5ED:function(lt,Je,Q){"use strict";var ee=Q("+L6B"),G=Q("2/Rp"),D=Q("5Dmo"),W=Q("3S7+"),R=Q("k1fw"),P=Q("tJVT"),N=Q("cDcd"),k=Q.n(N),A=Q("vHTk"),O=Q.n(A),E=Q("yEEn"),T=Q("ZW9T"),_=Q("1vsH");Je.a=function(C){var y=C.name,g=C.data,l=C.theme,o=C.type,s=C.filename,d=C.monacoEditor,w=C.className,f=C.style,m=C.close,L=C.onClose,x=C.hasMask,h=Object(N.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),c=Object(P.a)(h,2),u=c[0],a=c[1],v=Object(N.useState)(""),p=Object(P.a)(v,2),b=p[0],M=p[1],F=Object(N.useRef)();s&&(d.filename=s),Object(N.useEffect)(function(){var B,U,z=(B=document.cookie)===null||B===void 0||((U=B.replace(/\s/g,""))===null||U===void 0)?void 0:U.split(";");z==null||z.map(function(Z){var ie=Z.split("=");ie[0]==="_educoder_session"&&M(ie[1])})},[]);var H=function(){if(g.startsWith("http")||g.startsWith("/")){X();return}Object(_.x)(s||"educoder",g,s)},X=function(){Object(_.v)(s||y,g)};return console.log("data:",g,"fileanme:",s," name:",y),k.a.createElement("div",{style:Object(R.a)({},f||{}),className:"".concat(x&&O.a.bgBlack," ").concat(o?O.a.wrp:"hide")},m&&k.a.createElement("div",{className:O.a.close,ref:F},k.a.createElement(W.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return F.current}},k.a.createElement("span",{onClick:X},k.a.createElement("i",{className:"icon-quxiaozhiding"}))),k.a.createElement(W.a,{title:"\u5173\u95ED",getPopupContainer:function(){return F.current}},k.a.createElement("span",{className:"",onClick:L},k.a.createElement("i",{className:"icon-guanbi1"})))),k.a.createElement("div",{className:"".concat(O.a[w]," ").concat(w," ").concat(O.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&k.a.createElement(T.b,d)),o==="audio"&&k.a.createElement("audio",{src:"".concat(g!=null&&g.startsWith("/")||(g==null?void 0:g.indexOf("https://"))>-1?g:"data:audio/mp3;base64,").concat(g),autoPlay:!0}),o==="video"&&k.a.createElement(k.a.Fragment,null,g!=null&&g.startsWith("/")?k.a.createElement("video",{controls:!0,src:"".concat(g),autoPlay:!0}):k.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(g),autoPlay:!0})),o==="pdf"&&k.a.createElement("embed",{className:O.a.embed,src:g}),o==="image"&&k.a.createElement(k.a.Fragment,null,k.a.createElement("img",{src:"".concat(g!=null&&g.startsWith("/")||(g==null?void 0:g.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(g)})),o==="other"&&k.a.createElement("div",null,k.a.createElement(G.a,{type:"primary",size:"large",onClick:H},k.a.createElement(E.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&k.a.createElement(G.a,{type:"primary",size:"large",onClick:H},k.a.createElement(E.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(lt,Je,Q){},"rAM+":function(lt,Je,Q){"use strict";Q.d(Je,"a",function(){return G});var ee=Q("Qw5x");function G(D,W){var R;if(typeof Symbol=="undefined"||D[Symbol.iterator]==null){if(Array.isArray(D)||(R=Object(ee.a)(D))||W&&D&&typeof D.length=="number"){R&&(D=R);var P=0,N=function(){};return{s:N,n:function(){return P>=D.length?{done:!0}:{done:!1,value:D[P++]}},e:function(T){throw T},f:N}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var k=!0,A=!1,O;return{s:function(){R=D[Symbol.iterator]()},n:function(){var T=R.next();return k=T.done,T},e:function(T){A=!0,O=T},f:function(){try{!k&&R.return!=null&&R.return()}finally{if(A)throw O}}}}},rUJ1:function(lt,Je){const Q=/[&<>"']/,ee=/[&<>"']/g,G=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,W={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},R=x=>W[x];function P(x,h){if(h){if(Q.test(x))return x.replace(ee,R)}else if(G.test(x))return x.replace(D,R);return x}const N=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function k(x){return x.replace(N,(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 A=/(^|[^\[])\^/g;function O(x,h){x=x.source||x,h=h||"";const c={replace:(u,a)=>(a=a.source||a,a=a.replace(A,"$1"),x=x.replace(u,a),c),getRegex:()=>new RegExp(x,h)};return c}const E=/[^\w:]/g,T=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _(x,h,c){if(x){let u;try{u=decodeURIComponent(k(c)).replace(E,"").toLowerCase()}catch(a){return null}if(u.indexOf("javascript:")===0||u.indexOf("vbscript:")===0||u.indexOf("data:")===0)return null}h&&!T.test(c)&&(c=o(h,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(u){return null}return c}const C={},y=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(x,h){C[" "+x]||(y.test(x)?C[" "+x]=x+"/":C[" "+x]=f(x,"/",!0)),x=C[" "+x];const c=x.indexOf(":")===-1;return h.substring(0,2)==="//"?c?h:x.replace(g,"$1")+h:h.charAt(0)==="/"?c?h:x.replace(l,"$1")+h:x+h}const s={exec:function(){}};function d(x){let h=1,c,u;for(;h<arguments.length;h++){c=arguments[h];for(u in c)Object.prototype.hasOwnProperty.call(c,u)&&(x[u]=c[u])}return x}function w(x,h){const c=x.replace(/\|/g,(v,p,b)=>{let M=!1,F=p;for(;--F>=0&&b[F]==="\\";)M=!M;return M?"|":" |"}),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 f(x,h,c){const u=x.length;if(u===0)return"";let a=0;for(;a<u;){const v=x.charAt(u-a-1);if(v===h&&!c)a++;else if(v!==h&&c)a++;else break}return x.substr(0,u-a)}function m(x,h){if(x.indexOf(h[1])===-1)return-1;const c=x.length;let u=0,a=0;for(;a<c;a++)if(x[a]==="\\")a++;else if(x[a]===h[0])u++;else if(x[a]===h[1]&&(u--,u<0))return a;return-1}function L(x){x&&x.sanitize&&!x.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}lt.exports={escape:P,unescape:k,edit:O,cleanUrl:_,resolveUrl:o,noopTest:s,merge:d,splitCells:w,rtrim:f,findClosingBracket:m,checkSanitizeDeprecation:L}},ulZh:function(lt,Je,Q){typeof window!="undefined"&&function(G,D){lt.exports=D()}(this,function(){return function(ee){var G={};function D(W){if(G[W])return G[W].exports;var R=G[W]={i:W,l:!1,exports:{}};return ee[W].call(R.exports,R,R.exports,D),R.l=!0,R.exports}return D.m=ee,D.c=G,D.d=function(W,R,P){D.o(W,R)||Object.defineProperty(W,R,{enumerable:!0,get:P})},D.r=function(W){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(W,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(W,"__esModule",{value:!0})},D.t=function(W,R){if(R&1&&(W=D(W)),R&8)return W;if(R&4&&typeof W=="object"&&W&&W.__esModule)return W;var P=Object.create(null);if(D.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:W}),R&2&&typeof W!="string")for(var N in W)D.d(P,N,function(k){return W[k]}.bind(null,N));return P},D.n=function(W){var R=W&&W.__esModule?function(){return W.default}:function(){return W};return D.d(R,"a",R),R},D.o=function(W,R){return Object.prototype.hasOwnProperty.call(W,R)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ee,G,D){"use strict";var W=Object.prototype.hasOwnProperty,R="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(R=!1));function N(E,T,_){this.fn=E,this.context=T,this.once=_||!1}function k(E,T,_,C,y){if(typeof _!="function")throw new TypeError("The listener must be a function");var g=new N(_,C||E,y),l=R?R+T:T;return E._events[l]?E._events[l].fn?E._events[l]=[E._events[l],g]:E._events[l].push(g):(E._events[l]=g,E._eventsCount++),E}function A(E,T){--E._eventsCount===0?E._events=new P:delete E._events[T]}function O(){this._events=new P,this._eventsCount=0}O.prototype.eventNames=function(){var T=[],_,C;if(this._eventsCount===0)return T;for(C in _=this._events)W.call(_,C)&&T.push(R?C.slice(1):C);return Object.getOwnPropertySymbols?T.concat(Object.getOwnPropertySymbols(_)):T},O.prototype.listeners=function(T){var _=R?R+T:T,C=this._events[_];if(!C)return[];if(C.fn)return[C.fn];for(var y=0,g=C.length,l=new Array(g);y<g;y++)l[y]=C[y].fn;return l},O.prototype.listenerCount=function(T){var _=R?R+T:T,C=this._events[_];return C?C.fn?1:C.length:0},O.prototype.emit=function(T,_,C,y,g,l){var o=R?R+T:T;if(!this._events[o])return!1;var s=this._events[o],d=arguments.length,w,f;if(s.fn){s.once&&this.removeListener(T,s.fn,void 0,!0);switch(d){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,_),!0;case 3:return s.fn.call(s.context,_,C),!0;case 4:return s.fn.call(s.context,_,C,y),!0;case 5:return s.fn.call(s.context,_,C,y,g),!0;case 6:return s.fn.call(s.context,_,C,y,g,l),!0}for(f=1,w=new Array(d-1);f<d;f++)w[f-1]=arguments[f];s.fn.apply(s.context,w)}else{var m=s.length,L;for(f=0;f<m;f++){s[f].once&&this.removeListener(T,s[f].fn,void 0,!0);switch(d){case 1:s[f].fn.call(s[f].context);break;case 2:s[f].fn.call(s[f].context,_);break;case 3:s[f].fn.call(s[f].context,_,C);break;case 4:s[f].fn.call(s[f].context,_,C,y);break;default:if(!w)for(L=1,w=new Array(d-1);L<d;L++)w[L-1]=arguments[L];s[f].fn.apply(s[f].context,w)}}}return!0},O.prototype.on=function(T,_,C){return k(this,T,_,C,!1)},O.prototype.once=function(T,_,C){return k(this,T,_,C,!0)},O.prototype.removeListener=function(T,_,C,y){var g=R?R+T:T;if(!this._events[g])return this;if(!_)return A(this,g),this;var l=this._events[g];if(l.fn)l.fn===_&&(!y||l.once)&&(!C||l.context===C)&&A(this,g);else{for(var o=0,s=[],d=l.length;o<d;o++)(l[o].fn!==_||y&&!l[o].once||C&&l[o].context!==C)&&s.push(l[o]);s.length?this._events[g]=s.length===1?s[0]:s:A(this,g)}return this},O.prototype.removeAllListeners=function(T){var _;return T?(_=R?R+T:T,this._events[_]&&A(this,_)):(this._events=new P,this._eventsCount=0),this},O.prototype.off=O.prototype.removeListener,O.prototype.addListener=O.prototype.on,O.prefixed=R,O.EventEmitter=O,ee.exports=O},"./node_modules/url-toolkit/src/url-toolkit.js":function(ee,G,D){(function(W){var R=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,N=/(?:\/|^)\.(?=\/)/g,k=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,A={buildAbsoluteURL:function(O,E,T){if(T=T||{},O=O.trim(),E=E.trim(),!E){if(!T.alwaysNormalize)return O;var _=A.parseURL(O);if(!_)throw new Error("Error trying to parse base URL.");return _.path=A.normalizePath(_.path),A.buildURLFromParts(_)}var C=A.parseURL(E);if(!C)throw new Error("Error trying to parse relative URL.");if(C.scheme)return T.alwaysNormalize?(C.path=A.normalizePath(C.path),A.buildURLFromParts(C)):E;var y=A.parseURL(O);if(!y)throw new Error("Error trying to parse base URL.");if(!y.netLoc&&y.path&&y.path[0]!=="/"){var g=P.exec(y.path);y.netLoc=g[1],y.path=g[2]}y.netLoc&&!y.path&&(y.path="/");var l={scheme:y.scheme,netLoc:C.netLoc,path:null,params:C.params,query:C.query,fragment:C.fragment};if(!C.netLoc&&(l.netLoc=y.netLoc,C.path[0]!=="/"))if(!C.path)l.path=y.path,C.params||(l.params=y.params,C.query||(l.query=y.query));else{var o=y.path,s=o.substring(0,o.lastIndexOf("/")+1)+C.path;l.path=A.normalizePath(s)}return l.path===null&&(l.path=T.alwaysNormalize?A.normalizePath(C.path):C.path),A.buildURLFromParts(l)},parseURL:function(O){var E=R.exec(O);return E?{scheme:E[1]||"",netLoc:E[2]||"",path:E[3]||"",params:E[4]||"",query:E[5]||"",fragment:E[6]||""}:null},normalizePath:function(O){for(O=O.split("").reverse().join("").replace(N,"");O.length!==(O=O.replace(k,"")).length;);return O.split("").reverse().join("")},buildURLFromParts:function(O){return O.scheme+O.netLoc+O.path+O.params+O.query+O.fragment}};ee.exports=A})(this)},"./node_modules/webworkify-webpack/index.js":function(ee,G,D){function W(T){var _={};function C(g){if(_[g])return _[g].exports;var l=_[g]={i:g,l:!1,exports:{}};return T[g].call(l.exports,l,l.exports,C),l.l=!0,l.exports}C.m=T,C.c=_,C.i=function(g){return g},C.d=function(g,l,o){C.o(g,l)||Object.defineProperty(g,l,{configurable:!1,enumerable:!0,get:o})},C.r=function(g){Object.defineProperty(g,"__esModule",{value:!0})},C.n=function(g){var l=g&&g.__esModule?function(){return g.default}:function(){return g};return C.d(l,"a",l),l},C.o=function(g,l){return Object.prototype.hasOwnProperty.call(g,l)},C.p="/",C.oe=function(g){throw console.error(g),g};var y=C(C.s=ENTRY_MODULE);return y.default||y}var R="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+R+").*?\\)";function N(T){return(T+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function k(T){return!isNaN(1*T)}function A(T,_,C){var y={};y[C]=[];var g=_.toString(),l=g.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!l)return y;for(var o=l[1],s=new RegExp("(\\\\n|\\W)"+N(o)+P,"g"),d;d=s.exec(g);){if(d[3]==="dll-reference")continue;y[C].push(d[3])}for(s=new RegExp("\\("+N(o)+'\\("(dll-reference\\s('+R+'))"\\)\\)'+P,"g");d=s.exec(g);)T[d[2]]||(y[C].push(d[1]),T[d[2]]=D(d[1]).m),y[d[2]]=y[d[2]]||[],y[d[2]].push(d[4]);for(var w=Object.keys(y),f=0;f<w.length;f++)for(var m=0;m<y[w[f]].length;m++)k(y[w[f]][m])&&(y[w[f]][m]=1*y[w[f]][m]);return y}function O(T){var _=Object.keys(T);return _.reduce(function(C,y){return C||T[y].length>0},!1)}function E(T,_){for(var C={main:[_]},y={main:[]},g={main:{}};O(C);)for(var l=Object.keys(C),o=0;o<l.length;o++){var s=l[o],d=C[s],w=d.pop();if(g[s]=g[s]||{},g[s][w]||!T[s][w])continue;g[s][w]=!0,y[s]=y[s]||[],y[s].push(w);for(var f=A(T,T[s][w],s),m=Object.keys(f),L=0;L<m.length;L++)C[m[L]]=C[m[L]]||[],C[m[L]]=C[m[L]].concat(f[m[L]])}return y}ee.exports=function(T,_){_=_||{};var C={main:D.m},y=_.all?{main:Object.keys(C.main)}:E(C,T),g="";Object.keys(y).filter(function(w){return w!=="main"}).forEach(function(w){for(var f=0;y[w][f];)f++;y[w].push(f),C[w][f]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",g=g+"var "+w+" = ("+W.toString().replace("ENTRY_MODULE",JSON.stringify(f))+")({"+y[w].map(function(m){return""+JSON.stringify(m)+": "+C[w][m].toString()}).join(",")+`});
`}),g=g+"new (("+W.toString().replace("ENTRY_MODULE",JSON.stringify(T))+")({"+y.main.map(function(w){return""+JSON.stringify(w)+": "+C.main[w].toString()}).join(",")+"}))(self);";var l=new window.Blob([g],{type:"text/javascript"});if(_.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(ee,G,D){"use strict";D.r(G),D.d(G,"hlsDefaultConfig",function(){return L}),D.d(G,"mergeConfig",function(){return h}),D.d(G,"enableStreamingMode",function(){return c});var W=D("./src/controller/abr-controller.ts"),R=D("./src/controller/audio-stream-controller.ts"),P=D("./src/controller/audio-track-controller.ts"),N=D("./src/controller/subtitle-stream-controller.ts"),k=D("./src/controller/subtitle-track-controller.ts"),A=D("./src/controller/buffer-controller.ts"),O=D("./src/controller/timeline-controller.ts"),E=D("./src/controller/cap-level-controller.ts"),T=D("./src/controller/fps-controller.ts"),_=D("./src/controller/eme-controller.ts"),C=D("./src/controller/cmcd-controller.ts"),y=D("./src/utils/xhr-loader.ts"),g=D("./src/utils/fetch-loader.ts"),l=D("./src/utils/cues.ts"),o=D("./src/utils/mediakeys-helper.ts"),s=D("./src/utils/logger.ts");function d(){return d=Object.assign||function(u){for(var a=1;a<arguments.length;a++){var v=arguments[a];for(var p in v)Object.prototype.hasOwnProperty.call(v,p)&&(u[p]=v[p])}return u},d.apply(this,arguments)}function w(u,a){var v=Object.keys(u);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(u);a&&(p=p.filter(function(b){return Object.getOwnPropertyDescriptor(u,b).enumerable})),v.push.apply(v,p)}return v}function f(u){for(var a=1;a<arguments.length;a++){var v=arguments[a]!=null?arguments[a]:{};a%2?w(Object(v),!0).forEach(function(p){m(u,p,v[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(v)):w(Object(v)).forEach(function(p){Object.defineProperty(u,p,Object.getOwnPropertyDescriptor(v,p))})}return u}function m(u,a,v){return a in u?Object.defineProperty(u,a,{value:v,enumerable:!0,configurable:!0,writable:!0}):u[a]=v,u}var L=f(f({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:y.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:W.default,bufferController:A.default,capLevelController:E.default,fpsController:T.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},x()),{},{subtitleStreamController:N.SubtitleStreamController,subtitleTrackController:k.default,timelineController:O.TimelineController,audioStreamController:R.default,audioTrackController:P.default,emeController:_.default,cmcdController:C.default});function x(){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!==g.default&&a!==y.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),u.progressive=!1;else{var v=Object(g.fetchSupported)();v&&(u.loader=g.default,u.progressive=!0,u.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ee,G,D){"use strict";D.r(G);var W=D("./src/polyfills/number.ts"),R=D("./src/utils/ewma-bandwidth-estimator.ts"),P=D("./src/events.ts"),N=D("./src/utils/buffer-helper.ts"),k=D("./src/errors.ts"),A=D("./src/types/loader.ts"),O=D("./src/utils/logger.ts");function E(C,y){for(var g=0;g<y.length;g++){var l=y[g];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(C,l.key,l)}}function T(C,y,g){return y&&E(C.prototype,y),g&&E(C,g),C}var _=function(){function C(g){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=g;var l=g.config;this.bwEstimator=new R.default(l.abrEwmaSlowVoD,l.abrEwmaFastVoD,l.abrEwmaDefaultEstimate),this.registerListeners()}var y=C.prototype;return y.registerListeners=function(){var l=this.hls;l.on(P.Events.FRAG_LOADING,this.onFragLoading,this),l.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(P.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){var l=this.hls;l.off(P.Events.FRAG_LOADING,this.onFragLoading,this),l.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(P.Events.ERROR,this.onError,this)},y.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},y.onFragLoading=function(l,o){var s=o.frag;if(s.type===A.PlaylistLevelType.MAIN&&!this.timer){var d;this.fragCurrent=s,this.partCurrent=(d=o.part)!=null?d:null,this.timer=self.setInterval(this.onCheck,100)}},y.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)},y._abandonRulesCheck=function(){var l=this.fragCurrent,o=this.partCurrent,s=this.hls,d=s.autoLevelEnabled,w=s.config,f=s.media;if(!l||!f)return;var m=o?o.stats:l.stats,L=o?o.duration:l.duration;if(m.aborted){O.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!d||f.paused||!f.playbackRate||!f.readyState)return;var x=performance.now()-m.loading.start,h=Math.abs(f.playbackRate);if(x<=500*L/h)return;var c=s.levels,u=s.minAutoLevel,a=c[l.level],v=m.total||Math.max(m.loaded,Math.round(L*a.maxBitrate/8)),p=Math.max(1,m.bwEstimate?m.bwEstimate/8:m.loaded*1e3/x),b=(v-m.loaded)/p,M=f.currentTime,F=(N.BufferHelper.bufferInfo(f,M,w.maxBufferHole).end-M)/h;if(F>=2*L/h||b<=F)return;var H=Number.POSITIVE_INFINITY,X;for(X=l.level-1;X>u;X--){var B=c[X].maxBitrate;if(H=L*B/(8*.8*p),H<F)break}if(H>=b)return;var U=this.bwEstimator.getEstimate();O.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 "+X+`
Current BW estimate: `+(Object(W.isFiniteNumber)(U)?(U/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+b.toFixed(3)+` s
Estimated load time for the next fragment: `+H.toFixed(3)+` s
Time to underbuffer: `+F.toFixed(3)+" s"),s.nextLoadLevel=X,this.bwEstimator.sample(x,m.loaded),this.clearTimer(),l.loader&&(this.fragCurrent=this.partCurrent=null,l.loader.abort()),s.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:l,part:o,stats:m})},y.onFragLoaded=function(l,o){var s=o.frag,d=o.part;if(s.type===A.PlaylistLevelType.MAIN&&Object(W.isFiniteNumber)(s.sn)){var w=d?d.stats:s.stats,f=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],L=(m.loaded?m.loaded.bytes:0)+w.loaded,x=(m.loaded?m.loaded.duration:0)+f;m.loaded={bytes:L,duration:x},m.realBitrate=Math.round(8*L/x)}if(s.bitrateTest){var h={stats:w,frag:s,part:d,id:s.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,h),s.bitrateTest=!1}}},y.onFragBuffered=function(l,o){var s=o.frag,d=o.part,w=d?d.stats:s.stats;if(w.aborted)return;if(s.type!==A.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var f=w.parsing.end-w.loading.start;this.bwEstimator.sample(f,w.loaded),w.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=f/1e3:this.bitrateTestDelay=0},y.onError=function(l,o){switch(o.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},y.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},y.getNextABRAutoLevel=function(){var l=this.fragCurrent,o=this.partCurrent,s=this.hls,d=s.maxAutoLevel,w=s.config,f=s.minAutoLevel,m=s.media,L=o?o.duration:l?l.duration:0,x=m?m.currentTime:0,h=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():w.abrEwmaDefaultEstimate,u=(N.BufferHelper.bufferInfo(m,x,w.maxBufferHole).end-x)/h,a=this.findBestLevel(c,f,d,u,w.abrBandWidthFactor,w.abrBandWidthUpFactor);if(a>=0)return a;O.logger.trace((u?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var v=L?Math.min(L,w.maxStarvationDelay):w.maxStarvationDelay,p=w.abrBandWidthFactor,b=w.abrBandWidthUpFactor;if(!u){var M=this.bitrateTestDelay;if(M){var F=L?Math.min(L,w.maxLoadingDelay):w.maxLoadingDelay;v=F-M,O.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*v)+" ms"),p=b=1}}return a=this.findBestLevel(c,f,d,u+v,p,b),Math.max(a,0)},y.findBestLevel=function(l,o,s,d,w,f){for(var m,L=this.fragCurrent,x=this.partCurrent,h=this.lastLoadedFragLevel,c=this.hls.levels,u=c[h],a=!!(u!=null&&(m=u.details)!==null&&m!==void 0&&m.live),v=u==null?void 0:u.codecSet,p=x?x.duration:L?L.duration:0,b=s;b>=o;b--){var M=c[b];if(!M||v&&M.codecSet!==v)continue;var F=M.details,H=(x?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||p,X=void 0;b<=h?X=w*l:X=f*l;var B=c[b].maxBitrate,U=B*H/X;if(O.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+b+"/"+Math.round(X)+"/"+B+"/"+H+"/"+d+"/"+U),X>B&&(!U||a&&!this.bitrateTestDelay||U<d))return b}return-1},T(C,[{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}}]),C}();G.default=_},"./src/controller/audio-stream-controller.ts":function(ee,G,D){"use strict";D.r(G);var W=D("./src/polyfills/number.ts"),R=D("./src/controller/base-stream-controller.ts"),P=D("./src/events.ts"),N=D("./src/utils/buffer-helper.ts"),k=D("./src/controller/fragment-tracker.ts"),A=D("./src/types/level.ts"),O=D("./src/types/loader.ts"),E=D("./src/loader/fragment.ts"),T=D("./src/demux/chunk-cache.ts"),_=D("./src/demux/transmuxer-interface.ts"),C=D("./src/types/transmuxer.ts"),y=D("./src/controller/fragment-finders.ts"),g=D("./src/utils/discontinuities.ts"),l=D("./src/errors.ts"),o=D("./src/utils/logger.ts");function s(){return s=Object.assign||function(L){for(var x=1;x<arguments.length;x++){var h=arguments[x];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(L[c]=h[c])}return L},s.apply(this,arguments)}function d(L,x){L.prototype=Object.create(x.prototype),L.prototype.constructor=L,w(L,x)}function w(L,x){return w=Object.setPrototypeOf||function(c,u){return c.__proto__=u,c},w(L,x)}var f=100,m=function(L){d(x,L);function x(c,u){var a;return a=L.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=x.prototype;return h.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},h._registerListeners=function(){var u=this.hls;u.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(P.Events.ERROR,this.onError,this),u.on(P.Events.BUFFER_RESET,this.onBufferReset,this),u.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),u.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var u=this.hls;u.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(P.Events.ERROR,this.onError,this),u.off(P.Events.BUFFER_RESET,this.onBufferReset,this),u.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),u.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onInitPtsFound=function(u,a){var v=a.frag,p=a.id,b=a.initPTS;if(p==="main"){var M=v.cc;this.initPTS[v.cc]=b,this.log("InitPTS for cc: "+M+" found from main: "+b),this.videoTrackCC=M,this.state===R.State.WAITING_INIT_PTS&&this.tick()}},h.startLoad=function(u){if(!this.levels){this.startPosition=u,this.state=R.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(f),this.fragLoadError=0,a>0&&u===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=R.State.IDLE):(this.loadedmetadata=!1,this.state=R.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=u,this.tick()},h.doTick=function(){switch(this.state){case R.State.IDLE:this.doTickIdle();break;case R.State.WAITING_TRACK:{var u,a=this.levels,v=this.trackId,p=a==null||((u=a[v])===null||u===void 0)?void 0:u.details;if(p){if(this.waitForCdnTuneIn(p))break;this.state=R.State.WAITING_INIT_PTS}break}case R.State.FRAG_LOADING_WAITING_RETRY:{var b,M=performance.now(),F=this.retryDate;(!F||M>=F||(b=this.media)!==null&&b!==void 0&&b.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=R.State.IDLE);break}case R.State.WAITING_INIT_PTS:{var H=this.waitingData;if(H){var X=H.frag,B=H.part,U=H.cache,z=H.complete;if(this.initPTS[X.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=R.State.FRAG_LOADING;var Z=U.flush(),ie={frag:X,part:B,payload:Z,networkDetails:null};this._handleFragmentLoadProgress(ie),z&&L.prototype._handleFragmentLoadComplete.call(this,ie)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+X.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var se=this.getLoadPosition(),Te=N.BufferHelper.bufferInfo(this.mediaBuffer,se,this.config.maxBufferHole),he=Object(y.fragmentWithinToleranceTest)(Te.end,this.config.maxFragLookUpTolerance,X);he<0&&(o.logger.log("Waiting fragment cc ("+X.cc+") @ "+X.start+" cancelled because another fragment at "+Te.end+" is needed"),this.clearWaitingFragment())}}else this.state=R.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=R.State.IDLE)},h.onTickEnd=function(){var u=this.media;if(!u||!u.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:u,v=a.buffered;!this.loadedmetadata&&v.length&&(this.loadedmetadata=!0),this.lastCurrentTime=u.currentTime},h.doTickIdle=function(){var u,a,v=this.hls,p=this.levels,b=this.media,M=this.trackId,F=v.config;if(!p||!p[M])return;if(!b&&(this.startFragRequested||!F.startFragPrefetch))return;var H=p[M],X=H.details;if(!X||X.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(X)){this.state=R.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,E.ElementaryStreamTypes.AUDIO,O.PlaylistLevelType.AUDIO));var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,O.PlaylistLevelType.AUDIO);if(B===null)return;var U=B.len,z=this.getMaxBufferLength(),Z=this.audioSwitch;if(U>=z&&!Z)return;if(!Z&&this._streamEnded(B,X)){v.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=R.State.ENDED;return}var ie=X.fragments,se=ie[0].start,Te=B.end;if(Z){var he=this.getLoadPosition();Te=he,X.PTSKnown&&he<se&&((B.end>se||B.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),b.currentTime=se+.05))}var xe=this.getNextFragment(Te,X);if(!xe){this.bufferFlushed=!0;return}((u=xe.decryptdata)===null||u===void 0?void 0:u.keyFormat)==="identity"&&!((a=xe.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(xe,X):this.loadFragment(xe,X,Te)},h.getMaxBufferLength=function(){var u=L.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,O.PlaylistLevelType.MAIN);return a===null?u:Math.max(u,a.len)},h.onMediaDetaching=function(){this.videoBuffer=null,L.prototype.onMediaDetaching.call(this)},h.onAudioTracksUpdated=function(u,a){var v=a.audioTracks;this.resetTransmuxer(),this.levels=v.map(function(p){return new A.Level(p)})},h.onAudioTrackSwitching=function(u,a){var v=!!a.url;this.trackId=a.id;var p=this.fragCurrent;p!=null&&p.loader&&p.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),v?this.setInterval(f):this.resetTransmuxer(),v?(this.audioSwitch=!0,this.state=R.State.IDLE):this.state=R.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 v,p=this.levels,b=a.details,M=a.id;if(!p){this.warn("Audio tracks were reset while loading level "+M);return}this.log("Track "+M+" loaded ["+b.startSN+","+b.endSN+"],duration:"+b.totalduration);var F=p[M],H=0;if(b.live||(v=F.details)!==null&&v!==void 0&&v.live){var X=this.mainDetails;if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed||!X)return;!F.details&&b.hasProgramDateTime&&X.hasProgramDateTime?(Object(g.alignMediaPlaylistByPDT)(b,X),H=b.fragments[0].start):H=this.alignPlaylists(b,F.details)}F.details=b,this.levelLastLoaded=M,!this.startFragRequested&&(this.mainDetails||!b.live)&&this.setStartPosition(F.details,H),this.state===R.State.WAITING_TRACK&&!this.waitForCdnTuneIn(b)&&(this.state=R.State.IDLE),this.tick()},h._handleFragmentLoadProgress=function(u){var a,v=u.frag,p=u.part,b=u.payload,M=this.config,F=this.trackId,H=this.levels;if(!H){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+v.sn+" of level "+v.level+" will not be buffered");return}var X=H[F];console.assert(X,"Audio track is defined on fragment load progress");var B=X.details;console.assert(B,"Audio track details are defined on fragment load progress");var U=M.defaultAudioCodec||X.audioCodec||"mp4a.40.2",z=this.transmuxer;z||(z=this.transmuxer=new _.default(this.hls,O.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Z=this.initPTS[v.cc],ie=(a=v.initSegment)===null||a===void 0?void 0:a.data;if(Z!==void 0){var se=!1,Te=p?p.index:-1,he=Te!==-1,xe=new C.ChunkMetadata(v.level,v.sn,v.stats.chunkCount,b.byteLength,Te,he);z.push(b,ie,U,"",v,p,B.totalduration,se,xe,Z)}else{o.logger.log("Unknown video PTS for cc "+v.cc+", waiting for video PTS before demuxing audio frag "+v.sn+" of ["+B.startSN+" ,"+B.endSN+"],track "+F);var pe=this.waitingData=this.waitingData||{frag:v,part:p,cache:new T.default,complete:!1},ge=pe.cache;ge.push(new Uint8Array(b)),this.waitingVideoCC=this.videoTrackCC,this.state=R.State.WAITING_INIT_PTS}},h._handleFragmentLoadComplete=function(u){if(this.waitingData){this.waitingData.complete=!0;return}L.prototype._handleFragmentLoadComplete.call(this,u)},h.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},h.onBufferCreated=function(u,a){var v=a.tracks.audio;v&&(this.mediaBuffer=v.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},h.onFragBuffered=function(u,a){var v=a.frag,p=a.part;if(v.type!==O.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(v)){this.warn("Fragment "+v.sn+(p?" p: "+p.index:"")+" of level "+v.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}v.sn!=="initSegment"&&(this.fragPrevious=v,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(v,p)},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(O.PlaylistLevelType.AUDIO,a);break;case l.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case l.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==R.State.ERROR&&this.state!==R.State.STOPPED&&(this.state=a.fatal?R.State.ERROR:R.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===R.State.PARSING||this.state===R.State.PARSED)){var v=!0,p=this.getFwdBufferInfo(this.mediaBuffer,O.PlaylistLevelType.AUDIO);p&&p.len>.5&&(v=!this.reduceMaxBufferLength(p.len)),v&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},h.onBufferFlushed=function(u,a){var v=a.type;v===E.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(u){var a,v="audio",p=this.hls,b=u.remuxResult,M=u.chunkMeta,F=this.getCurrentContext(M);if(!F){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var H=F.frag,X=F.part,B=b.audio,U=b.text,z=b.id3,Z=b.initSegment;if(this.fragContextChanged(H))return;if(this.state=R.State.PARSING,this.audioSwitch&&B&&this.completeAudioSwitch(),Z!=null&&Z.tracks&&(this._bufferInitSegment(Z.tracks,H,M),p.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:H,id:v,tracks:Z.tracks})),B){var ie=B.startPTS,se=B.endPTS,Te=B.startDTS,he=B.endDTS;X&&(X.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:ie,endPTS:se,startDTS:Te,endDTS:he}),H.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,ie,se,Te,he),this.bufferFragmentData(B,H,X,M)}if(z!=null&&(a=z.samples)!==null&&a!==void 0&&a.length){var xe=s({frag:H,id:v},z);p.trigger(P.Events.FRAG_PARSING_METADATA,xe)}if(U){var pe=s({frag:H,id:v},U);p.trigger(P.Events.FRAG_PARSING_USERDATA,pe)}},h._bufferInitSegment=function(u,a,v){if(this.state!==R.State.PARSING)return;u.video&&delete u.video;var p=u.audio;if(!p)return;p.levelCodec=p.codec,p.id="audio",this.log("Init audio buffer, container:"+p.container+", codecs[parsed]=["+p.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,u);var b=p.initSegment;if(b!=null&&b.byteLength){var M={type:"audio",frag:a,part:null,chunkMeta:v,parent:a.type,data:b};this.hls.trigger(P.Events.BUFFER_APPENDING,M)}this.tick()},h.loadFragment=function(u,a,v){var p=this.fragmentTracker.getState(u);this.fragCurrent=u,(this.audioSwitch||p===k.FragmentState.NOT_LOADED||p===k.FragmentState.PARTIAL)&&(u.sn==="initSegment"?this._loadInitSegment(u):a.live&&!Object(W.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=R.State.WAITING_INIT_PTS):(this.startFragRequested=!0,L.prototype.loadFragment.call(this,u,a,v)))},h.completeAudioSwitch=function(){var u=this.hls,a=this.media,v=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,u.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:v})},x}(R.default);G.default=m},"./src/controller/audio-track-controller.ts":function(ee,G,D){"use strict";D.r(G);var W=D("./src/events.ts"),R=D("./src/errors.ts"),P=D("./src/controller/base-playlist-controller.ts"),N=D("./src/types/loader.ts");function k(_,C){for(var y=0;y<C.length;y++){var g=C[y];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(_,g.key,g)}}function A(_,C,y){return C&&k(_.prototype,C),y&&k(_,y),_}function O(_,C){_.prototype=Object.create(C.prototype),_.prototype.constructor=_,E(_,C)}function E(_,C){return E=Object.setPrototypeOf||function(g,l){return g.__proto__=l,g},E(_,C)}var T=function(_){O(C,_);function C(g){var l;return l=_.call(this,g,"[audio-track-controller]")||this,l.tracks=[],l.groupId=null,l.tracksInGroup=[],l.trackId=-1,l.trackName="",l.selectDefaultTrack=!0,l.registerListeners(),l}var y=C.prototype;return y.registerListeners=function(){var l=this.hls;l.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.on(W.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(W.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){var l=this.hls;l.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(W.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.off(W.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(W.Events.ERROR,this.onError,this)},y.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,_.prototype.destroy.call(this)},y.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},y.onManifestParsed=function(l,o){this.tracks=o.audioTracks||[]},y.onAudioTrackLoaded=function(l,o){var s=o.id,d=o.details,w=this.tracksInGroup[s];if(!w){this.warn("Invalid audio track id "+s);return}var f=w.details;w.details=o.details,this.log("audioTrack "+s+" loaded ["+d.startSN+"-"+d.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,o,f))},y.onLevelLoading=function(l,o){this.switchLevel(o.level)},y.onLevelSwitching=function(l,o){this.switchLevel(o.level)},y.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(f){return!s||f.groupId===s});this.selectDefaultTrack&&!d.some(function(f){return f.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=d;var w={audioTracks:d};this.log("Updating audio tracks, "+d.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(W.Events.AUDIO_TRACKS_UPDATED,w),this.selectInitialTrack()}},y.onError=function(l,o){if(_.prototype.onError.call(this,l,o),o.fatal||!o.context)return;o.context.type===N.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},y.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],w=d.id,f=d.groupId,m=f===void 0?"":f,L=d.name,x=d.type,h=d.url;if(this.trackId=l,this.trackName=L,this.selectDefaultTrack=!1,this.hls.trigger(W.Events.AUDIO_TRACK_SWITCHING,{id:w,groupId:m,name:L,type:x,url:h}),d.details&&!d.details.live)return;var c=this.switchParams(d.url,s==null?void 0:s.details);this.loadPlaylist(c)},y.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(W.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},y.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},y.loadPlaylist=function(l){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var s=o.id,d=o.groupId,w=o.url;if(l)try{w=l.addDirectives(w)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(W.Events.AUDIO_TRACK_LOADING,{url:w,id:s,groupId:d,deliveryDirectives:l||null})}},A(C,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(l){this.selectDefaultTrack=!1,this.setAudioTrack(l)}}]),C}(P.default);G.default=T},"./src/controller/base-playlist-controller.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"default",function(){return A});var W=D("./src/polyfills/number.ts"),R=D("./src/types/level.ts"),P=D("./src/controller/level-helper.ts"),N=D("./src/utils/logger.ts"),k=D("./src/errors.ts"),A=function(){function O(T,_){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=N.logger.log.bind(N.logger,_+":"),this.warn=N.logger.warn.bind(N.logger,_+":"),this.hls=T}var E=O.prototype;return E.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},E.onError=function(_,C){C.fatal&&C.type===k.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},E.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},E.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},E.stopLoad=function(){this.canLoad=!1,this.clearTimer()},E.switchParams=function(_,C){var y=C==null?void 0:C.renditionReports;if(y)for(var g=0;g<y.length;g++){var l=y[g],o=""+l.URI;if(o===_.substr(-o.length)){var s=parseInt(l["LAST-MSN"]),d=parseInt(l["LAST-PART"]);if(C&&this.hls.config.lowLatencyMode){var w=Math.min(C.age-C.partTarget,C.targetduration);d!==void 0&&w>C.partTarget&&(d+=1)}if(Object(W.isFiniteNumber)(s))return new R.HlsUrlParameters(s,Object(W.isFiniteNumber)(d)?d:void 0,R.HlsSkip.No)}}},E.loadPlaylist=function(_){},E.shouldLoadTrack=function(_){return this.canLoad&&_&&!!_.url&&(!_.details||_.details.live)},E.playlistLoaded=function(_,C,y){var g=this,l=C.details,o=C.stats,s=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(l.advancedDateTime=Date.now()-s,l.live||y!=null&&y.live){if(l.reloaded(y),y&&this.log("live playlist "+_+" "+(l.advanced?"REFRESHED "+l.lastPartSn+"-"+l.lastPartIndex:"MISSED")),y&&l.fragments.length>0&&Object(P.mergeDetails)(y,l),!this.canLoad||!l.live)return;var d,w=void 0,f=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var m=this.hls.config.lowLatencyMode,L=l.lastPartSn,x=l.endSN,h=l.lastPartIndex,c=h!==-1,u=L===x,a=m?0:h;c?(w=u?x+1:L,f=u?a:h+1):w=x+1;var v=l.age,p=v+l.ageHeader,b=Math.min(p-l.partTarget,l.targetduration*1.5);if(b>0){if(y&&b>y.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+y.tuneInGoal+" to: "+b+" with playlist age: "+l.age),b=0;else{var M=Math.floor(b/l.targetduration);if(w+=M,f!==void 0){var F=Math.round(b%l.targetduration/l.partTarget);f+=F}this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+v.toFixed(2)+"s goal: "+b+" skip sn "+M+" to part "+f)}l.tuneInGoal=b}if(d=this.getDeliveryDirectives(l,C.deliveryDirectives,w,f),m||!u){this.loadPlaylist(d);return}}else d=this.getDeliveryDirectives(l,C.deliveryDirectives,w,f);var H=Object(P.computeReloadInterval)(l,o);w!==void 0&&l.canBlockReload&&(H-=l.partTarget||1),this.log("reload live playlist "+_+" in "+Math.round(H)+" ms"),this.timer=self.setTimeout(function(){return g.loadPlaylist(d)},H)}else this.clearTimer()},E.getDeliveryDirectives=function(_,C,y,g){var l=Object(R.getSkipValue)(_,y);return C!=null&&C.skip&&_.deltaUpdateFailed&&(y=C.msn,g=C.part,l=R.HlsSkip.No),new R.HlsUrlParameters(y,g,l)},E.retryLoadingOrFail=function(_){var C=this,y=this.hls.config,g=this.retryCount<y.levelLoadingMaxRetry;if(g){var l;if(this.retryCount++,_.details.indexOf("LoadTimeOut")>-1&&(l=_.context)!==null&&l!==void 0&&l.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+_.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*y.levelLoadingRetryDelay,y.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return C.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+_.details+'"')}}else this.warn('cannot recover from error "'+_.details+'"'),this.clearTimer(),_.fatal=!0;return g},O}()},"./src/controller/base-stream-controller.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"State",function(){return x}),D.d(G,"default",function(){return h});var W=D("./src/polyfills/number.ts"),R=D("./src/task-loop.ts"),P=D("./src/controller/fragment-tracker.ts"),N=D("./src/utils/buffer-helper.ts"),k=D("./src/utils/logger.ts"),A=D("./src/events.ts"),O=D("./src/errors.ts"),E=D("./src/types/transmuxer.ts"),T=D("./src/utils/mp4-tools.ts"),_=D("./src/utils/discontinuities.ts"),C=D("./src/controller/fragment-finders.ts"),y=D("./src/controller/level-helper.ts"),g=D("./src/loader/fragment-loader.ts"),l=D("./src/crypt/decrypter.ts"),o=D("./src/utils/time-ranges.ts"),s=D("./src/types/loader.ts");function d(c,u){for(var a=0;a<u.length;a++){var v=u[a];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(c,v.key,v)}}function w(c,u,a){return u&&d(c.prototype,u),a&&d(c,a),c}function f(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function m(c,u){c.prototype=Object.create(u.prototype),c.prototype.constructor=c,L(c,u)}function L(c,u){return L=Object.setPrototypeOf||function(v,p){return v.__proto__=p,v},L(c,u)}var x={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},h=function(c){m(u,c);function u(v,p,b){var M;return M=c.call(this)||this,M.hls=void 0,M.fragPrevious=null,M.fragCurrent=null,M.fragmentTracker=void 0,M.transmuxer=null,M._state=x.STOPPED,M.media=void 0,M.mediaBuffer=void 0,M.config=void 0,M.bitrateTest=!1,M.lastCurrentTime=0,M.nextLoadPosition=0,M.startPosition=0,M.loadedmetadata=!1,M.fragLoadError=0,M.retryDate=0,M.levels=null,M.fragmentLoader=void 0,M.levelLastLoaded=null,M.startFragRequested=!1,M.decrypter=void 0,M.initPTS=[],M.onvseeking=null,M.onvended=null,M.logPrefix="",M.log=void 0,M.warn=void 0,M.logPrefix=b,M.log=k.logger.log.bind(k.logger,b+":"),M.warn=k.logger.warn.bind(k.logger,b+":"),M.hls=v,M.fragmentLoader=new g.default(v.config),M.fragmentTracker=p,M.config=v.config,M.decrypter=new l.default(v,v.config),v.on(A.Events.KEY_LOADED,M.onKeyLoaded,f(M)),M}var a=u.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(p){},a.stopLoad=function(){this.fragmentLoader.abort();var p=this.fragCurrent;p&&this.fragmentTracker.removeFragment(p),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=x.STOPPED},a._streamEnded=function(p,b){var M=this.fragCurrent,F=this.fragmentTracker;if(!b.live&&M&&M.sn===b.endSN&&!p.nextStart){var H=F.getState(M);return H===P.FragmentState.PARTIAL||H===P.FragmentState.OK}return!1},a.onMediaAttached=function(p,b){var M=this.media=this.mediaBuffer=b.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),M.addEventListener("seeking",this.onvseeking),M.addEventListener("ended",this.onvended);var F=this.config;this.levels&&F.autoStartLoad&&this.state===x.STOPPED&&this.startLoad(F.startPosition)},a.onMediaDetaching=function(){var p=this.media;p!=null&&p.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),p&&(p.removeEventListener("seeking",this.onvseeking),p.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 p=this.config,b=this.fragCurrent,M=this.media,F=this.mediaBuffer,H=this.state,X=M?M.currentTime:0,B=N.BufferHelper.bufferInfo(F||M,X,p.maxBufferHole);if(this.log("media seeking to "+(Object(W.isFiniteNumber)(X)?X.toFixed(3):X)+", state: "+H),H===x.ENDED)this.resetLoadingState();else if(b&&!B.len){var U=p.maxFragLookUpTolerance,z=b.start-U,Z=b.start+b.duration+U,ie=X>Z;(X<z||ie)&&(ie&&b.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),b.loader.abort()),this.resetLoadingState())}M&&(this.lastCurrentTime=X),!this.loadedmetadata&&!B.len&&(this.nextLoadPosition=this.startPosition=X),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(p,b){if(this.state!==x.KEY_LOADING||b.frag!==this.fragCurrent||!this.levels)return;this.state=x.IDLE;var M=this.levels[b.frag.level].details;M&&this.loadFragment(b.frag,M,b.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=x.STOPPED,this.hls.off(A.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(p,b){this.log("Loading key for "+p.sn+" of ["+b.startSN+"-"+b.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level),this.state=x.KEY_LOADING,this.fragCurrent=p,this.hls.trigger(A.Events.KEY_LOADING,{frag:p})},a.loadFragment=function(p,b,M){this._loadFragForPlayback(p,b,M)},a._loadFragForPlayback=function(p,b,M){var F=this,H=function(B){if(F.fragContextChanged(p)){F.warn("Fragment "+p.sn+(B.part?" p: "+B.part.index:"")+" of level "+p.level+" was dropped during download."),F.fragmentTracker.removeFragment(p);return}p.stats.chunkCount++,F._handleFragmentLoadProgress(B)};this._doFragLoad(p,b,M,H).then(function(X){if(!X)return;F.fragLoadError=0;var B=F.state;if(F.fragContextChanged(p)){(B===x.FRAG_LOADING||B===x.BACKTRACKING||!F.fragCurrent&&B===x.PARSING)&&(F.fragmentTracker.removeFragment(p),F.state=x.IDLE);return}if("payload"in X&&(F.log("Loaded fragment "+p.sn+" of level "+p.level),F.hls.trigger(A.Events.FRAG_LOADED,X),F.state===x.BACKTRACKING)){F.fragmentTracker.backtrack(p,X),F.resetFragmentLoading(p);return}F._handleFragmentLoadComplete(X)}).catch(function(X){F.warn(X),F.resetFragmentLoading(p)})},a.flushMainBuffer=function(p,b,M){if(M===void 0&&(M=null),!(p-b))return;var F={startOffset:p,endOffset:b,type:M};this.fragLoadError=0,this.hls.trigger(A.Events.BUFFER_FLUSHING,F)},a._loadInitSegment=function(p){var b=this;this._doFragLoad(p).then(function(M){if(!M||b.fragContextChanged(p)||!b.levels)throw new Error("init load aborted");return M}).then(function(M){var F=b.hls,H=M.payload,X=p.decryptdata;if(H&&H.byteLength>0&&X&&X.key&&X.iv&&X.method==="AES-128"){var B=self.performance.now();return b.decrypter.webCryptoDecrypt(new Uint8Array(H),X.key.buffer,X.iv.buffer).then(function(U){var z=self.performance.now();return F.trigger(A.Events.FRAG_DECRYPTED,{frag:p,payload:U,stats:{tstart:B,tdecrypt:z}}),M.payload=U,M})}return M}).then(function(M){var F=b.fragCurrent,H=b.hls,X=b.levels;if(!X)throw new Error("init load aborted, missing levels");var B=X[p.level].details;console.assert(B,"Level details are defined when init segment is loaded");var U=p.stats;b.state=x.IDLE,b.fragLoadError=0,p.data=new Uint8Array(M.payload),U.parsing.start=U.buffering.start=self.performance.now(),U.parsing.end=U.buffering.end=self.performance.now(),M.frag===F&&H.trigger(A.Events.FRAG_BUFFERED,{stats:U,frag:F,part:null,id:p.type}),b.tick()}).catch(function(M){b.warn(M),b.resetFragmentLoading(p)})},a.fragContextChanged=function(p){var b=this.fragCurrent;return!p||!b||p.level!==b.level||p.sn!==b.sn||p.urlId!==b.urlId},a.fragBufferedComplete=function(p,b){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+p.type+" sn: "+p.sn+(b?" part: "+b.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level+" "+o.default.toString(N.BufferHelper.getBuffered(M))),this.state=x.IDLE,this.tick()},a._handleFragmentLoadComplete=function(p){var b=this.transmuxer;if(!b)return;var M=p.frag,F=p.part,H=p.partsLoaded,X=!H||H.length===0||H.some(function(U){return!U}),B=new E.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,F?F.index:-1,!X);b.flush(B)},a._handleFragmentLoadProgress=function(p){},a._doFragLoad=function(p,b,M,F){var H=this;if(M===void 0&&(M=null),!this.levels)throw new Error("frag load aborted, missing levels");if(M=Math.max(p.start,M||0),this.config.lowLatencyMode&&b){var X=b.partList;if(X&&F){M>p.end&&b.fragmentHint&&(p=b.fragmentHint);var B=this.getNextPart(X,p,M);if(B>-1){var U=X[B];return this.log("Loading part sn: "+p.sn+" p: "+U.index+" cc: "+p.cc+" of playlist ["+b.startSN+"-"+b.endSN+"] parts [0-"+B+"-"+(X.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=U.start+U.duration,this.state=x.FRAG_LOADING,this.hls.trigger(A.Events.FRAG_LOADING,{frag:p,part:X[B],targetBufferTime:M}),this.doFragPartsLoad(p,X,B,F).catch(function(z){return H.handleFragLoadError(z)})}else if(!p.url||this.loadedEndOfParts(X,M))return Promise.resolve(null)}}return this.log("Loading fragment "+p.sn+" cc: "+p.cc+" "+(b?"of ["+b.startSN+"-"+b.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(M.toFixed(3))),Object(W.isFiniteNumber)(p.sn)&&!this.bitrateTest&&(this.nextLoadPosition=p.start+p.duration),this.state=x.FRAG_LOADING,this.hls.trigger(A.Events.FRAG_LOADING,{frag:p,targetBufferTime:M}),this.fragmentLoader.load(p,F).catch(function(z){return H.handleFragLoadError(z)})},a.doFragPartsLoad=function(p,b,M,F){var H=this;return new Promise(function(X,B){var U=[],z=function Z(ie){var se=b[ie];H.fragmentLoader.loadPart(p,se,F).then(function(Te){U[se.index]=Te;var he=Te.part;H.hls.trigger(A.Events.FRAG_LOADED,Te);var xe=b[ie+1];if(xe&&xe.fragment===p)Z(ie+1);else return X({frag:p,part:he,partsLoaded:U})}).catch(B)};z(M)})},a.handleFragLoadError=function(p){var b=p.data;return b&&b.details===O.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(b.frag,b.part):this.hls.trigger(A.Events.ERROR,b),null},a._handleTransmuxerFlush=function(p){var b=this.getCurrentContext(p);if(!b||this.state!==x.PARSING){this.fragCurrent||(this.state=x.IDLE);return}var M=b.frag,F=b.part,H=b.level,X=self.performance.now();M.stats.parsing.end=X,F&&(F.stats.parsing.end=X),this.updateLevelTiming(M,F,H,p.partial)},a.getCurrentContext=function(p){var b=this.levels,M=p.level,F=p.sn,H=p.part;if(!b||!b[M])return this.warn("Levels object was unset while buffering fragment "+F+" of level "+M+". The current chunk will not be buffered."),null;var X=b[M],B=H>-1?Object(y.getPartWith)(X,F,H):null,U=B?B.fragment:Object(y.getFragmentWithSN)(X,F,this.fragCurrent);return U?{frag:U,part:B,level:X}:null},a.bufferFragmentData=function(p,b,M,F){if(!p||this.state!==x.PARSING)return;var H=p.data1,X=p.data2,B=H;if(H&&X&&(B=Object(T.appendUint8Array)(H,X)),!B||!B.length)return;var U={type:p.type,frag:b,part:M,chunkMeta:F,parent:b.type,data:B};this.hls.trigger(A.Events.BUFFER_APPENDING,U),p.dropped&&p.independent&&!M&&this.flushBufferGap(b)},a.flushBufferGap=function(p){var b=this.media;if(!b)return;if(!N.BufferHelper.isBuffered(b,b.currentTime)){this.flushMainBuffer(0,p.start);return}var M=b.currentTime,F=N.BufferHelper.bufferInfo(b,M,0),H=p.duration,X=Math.min(this.config.maxFragLookUpTolerance*2,H*.25),B=Math.max(Math.min(p.start-X,F.end-X),M+X);p.start-B>X&&this.flushMainBuffer(B,p.start)},a.getFwdBufferInfo=function(p,b){var M=this.config,F=this.getLoadPosition();if(!Object(W.isFiniteNumber)(F))return null;var H=N.BufferHelper.bufferInfo(p,F,M.maxBufferHole);if(H.len===0&&H.nextStart!==void 0){var X=this.fragmentTracker.getBufferedFrag(F,b);if(X&&H.nextStart<X.end)return N.BufferHelper.bufferInfo(p,F,Math.max(H.nextStart,M.maxBufferHole))}return H},a.getMaxBufferLength=function(p){var b=this.config,M;return p?M=Math.max(8*b.maxBufferSize/p,b.maxBufferLength):M=b.maxBufferLength,Math.min(M,b.maxMaxBufferLength)},a.reduceMaxBufferLength=function(p){var b=this.config,M=p||b.maxBufferLength;return b.maxMaxBufferLength>=M?(b.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+b.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(p,b){var M,F,H=b.fragments,X=H.length;if(!X)return null;var B=this.config,U=H[0].start,z;if(b.live){var Z=B.initialLiveManifestSize;if(X<Z)return this.warn("Not enough fragments to start playback (have: "+X+", need: "+Z+")"),null;!b.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(z=this.getInitialLiveFragment(b,H),this.startPosition=z?this.hls.liveSyncPosition||z.start:p)}else p<=U&&(z=H[0]);if(!z){var ie=B.lowLatencyMode?b.partEnd:b.fragmentEnd;z=this.getFragmentAtPosition(p,ie,b)}return(M=z)!==null&&M!==void 0&&M.initSegment&&!((F=z)!==null&&F!==void 0&&F.initSegment.data)&&!this.bitrateTest&&(z=z.initSegment),z},a.getNextPart=function(p,b,M){for(var F=-1,H=!1,X=!0,B=0,U=p.length;B<U;B++){var z=p[B];if(X=X&&!z.independent,F>-1&&M<z.start)break;var Z=z.loaded;!Z&&(H||z.independent||X)&&z.fragment===b&&(F=B),H=Z}return F},a.loadedEndOfParts=function(p,b){var M=p[p.length-1];return M&&b>M.start&&M.loaded},a.getInitialLiveFragment=function(p,b){var M=this.fragPrevious,F=null;if(M){if(p.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+M.programDateTime),F=Object(C.findFragmentByPDT)(b,M.endProgramDateTime,this.config.maxFragLookUpTolerance)),!F){var H=M.sn+1;if(H>=p.startSN&&H<=p.endSN){var X=b[H-p.startSN];M.cc===X.cc&&(F=X,this.log("Live playlist, switching playlist, load frag with next SN: "+F.sn))}F||(F=Object(C.findFragWithCC)(b,M.cc),F&&this.log("Live playlist, switching playlist, load frag with same CC: "+F.sn))}}else{var B=this.hls.liveSyncPosition;B!==null&&(F=this.getFragmentAtPosition(B,this.bitrateTest?p.fragmentEnd:p.edge,p))}return F},a.getFragmentAtPosition=function(p,b,M){var F=this.config,H=this.fragPrevious,X=M.fragments,B=M.endSN,U=M.fragmentHint,z=F.maxFragLookUpTolerance,Z=!!(F.lowLatencyMode&&M.partList&&U);Z&&U&&!this.bitrateTest&&(X=X.concat(U),B=U.sn);var ie;if(p<b){var se=p>b-z?0:z;ie=Object(C.findFragmentByPTS)(H,X,p,se)}else ie=X[X.length-1];if(ie){var Te=ie.sn-M.startSN,he=H&&ie.level===H.level,xe=X[Te+1],pe=this.fragmentTracker.getState(ie);if(pe===P.FragmentState.BACKTRACKED){ie=null;for(var ge=Te;X[ge]&&this.fragmentTracker.getState(X[ge])===P.FragmentState.BACKTRACKED;)H?ie=X[ge--]:ie=X[--ge];ie||(ie=xe)}else H&&ie.sn===H.sn&&!Z&&(he&&(ie.sn<B&&this.fragmentTracker.getState(xe)!==P.FragmentState.OK?(this.log("SN "+ie.sn+" just loaded, load next one: "+xe.sn),ie=xe):ie=null))}return ie},a.synchronizeToLiveEdge=function(p){var b=this.config,M=this.media;if(!M)return;var F=this.hls.liveSyncPosition,H=M.currentTime,X=p.fragments[0].start,B=p.edge,U=H>=X-b.maxFragLookUpTolerance&&H<=B;if(F!==null&&M.duration>F&&(H<F||!U)){var z=b.liveMaxLatencyDuration!==void 0?b.liveMaxLatencyDuration:b.liveMaxLatencyDurationCount*p.targetduration;(!U&&M.readyState<4||H<B-z)&&(this.loadedmetadata||(this.nextLoadPosition=F),M.readyState&&(this.warn("Playback: "+H.toFixed(3)+" is located too far from the end of live sliding playlist: "+B+", reset currentTime to : "+F.toFixed(3)),M.currentTime=F))}},a.alignPlaylists=function(p,b){var M=this.levels,F=this.levelLastLoaded,H=this.fragPrevious,X=F!==null?M[F]:null,B=p.fragments.length;if(!B)return this.warn("No fragments in live playlist"),0;var U=p.fragments[0].start,z=!b,Z=p.alignedSliding&&Object(W.isFiniteNumber)(U);if(z||!Z&&!U){Object(_.alignStream)(H,X,p);var ie=p.fragments[0].start;return this.log("Live playlist sliding: "+ie.toFixed(2)+" start-sn: "+(b?b.startSN:"na")+"->"+p.startSN+" prev-sn: "+(H?H.sn:"na")+" fragments: "+B),ie}return U},a.waitForCdnTuneIn=function(p){var b=3;return p.live&&p.canBlockReload&&p.tuneInGoal>Math.max(p.partHoldBack,p.partTarget*b)},a.setStartPosition=function(p,b){var M=this.startPosition;if(M<b&&(M=-1),M===-1||this.lastCurrentTime===-1){var F=p.startTimeOffset;Object(W.isFiniteNumber)(F)?(M=b+F,F<0&&(M+=p.totalduration),M=Math.min(Math.max(b,M),b+p.totalduration),this.log("Start time offset "+F+" found in playlist, adjust startPosition to "+M),this.startPosition=M):p.live?M=this.hls.liveSyncPosition||b:this.startPosition=M=0,this.lastCurrentTime=M}this.nextLoadPosition=M},a.getLoadPosition=function(){var p=this.media,b=0;return this.loadedmetadata&&p?b=p.currentTime:this.nextLoadPosition&&(b=this.nextLoadPosition),b},a.handleFragLoadAborted=function(p,b){this.transmuxer&&p.sn!=="initSegment"&&p.stats.aborted&&(this.warn("Fragment "+p.sn+(b?" part"+b.index:"")+" of level "+p.level+" was aborted"),this.resetFragmentLoading(p))},a.resetFragmentLoading=function(p){(!this.fragCurrent||!this.fragContextChanged(p))&&(this.state=x.IDLE)},a.onFragmentOrKeyLoadError=function(p,b){if(b.fatal)return;var M=b.frag;if(!M||M.type!==p)return;var F=this.fragCurrent;console.assert(F&&M.sn===F.sn&&M.level===F.level&&M.urlId===F.urlId,"Frag load error must match current frag to retry");var H=this.config;if(this.fragLoadError+1<=H.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(M.level))return;var X=Math.min(Math.pow(2,this.fragLoadError)*H.fragLoadingRetryDelay,H.fragLoadingMaxRetryTimeout);this.warn("Fragment "+M.sn+" of "+p+" "+M.level+" failed to load, retrying in "+X+"ms"),this.retryDate=self.performance.now()+X,this.fragLoadError++,this.state=x.FRAG_LOADING_WAITING_RETRY}else b.levelRetry?(p===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=x.IDLE):(k.logger.error(b.details+" reaches max retry, redispatch as fatal ..."),b.fatal=!0,this.hls.stopLoad(),this.state=x.ERROR)},a.afterBufferFlushed=function(p,b,M){if(!p)return;var F=N.BufferHelper.getBuffered(p);this.fragmentTracker.detectEvictedFragments(b,F,M),this.state===x.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=x.IDLE},a.resetLiveStartWhenNotLoaded=function(p){if(!this.loadedmetadata){this.startFragRequested=!1;var b=this.levels?this.levels[p].details:null;if(b!=null&&b.live)return this.startPosition=-1,this.setStartPosition(b,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(p,b,M,F){var H=this,X=M.details;console.assert(!!X,"level.details must be defined");var B=Object.keys(p.elementaryStreams).reduce(function(U,z){var Z=p.elementaryStreams[z];if(Z){var ie=Z.endPTS-Z.startPTS;if(ie<=0)return H.warn("Could not parse fragment "+p.sn+" "+z+" duration reliably ("+ie+") resetting transmuxer to fallback to playlist timing"),H.resetTransmuxer(),U||!1;var se=F?0:Object(y.updateFragPTSDTS)(X,p,Z.startPTS,Z.endPTS,Z.startDTS,Z.endDTS);return H.hls.trigger(A.Events.LEVEL_PTS_UPDATED,{details:X,level:M,drift:se,type:z,frag:p,start:Z.startPTS,end:Z.endPTS}),!0}return U},!1);B?(this.state=x.PARSED,this.hls.trigger(A.Events.FRAG_PARSED,{frag:p,part:b})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},w(u,[{key:"state",get:function(){return this._state},set:function(p){var b=this._state;b!==p&&(this._state=p,this.log(b+"->"+p))}}]),u}(R.default)},"./src/controller/buffer-controller.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"default",function(){return C});var W=D("./src/polyfills/number.ts"),R=D("./src/events.ts"),P=D("./src/utils/logger.ts"),N=D("./src/errors.ts"),k=D("./src/utils/buffer-helper.ts"),A=D("./src/utils/mediasource-helper.ts"),O=D("./src/loader/fragment.ts"),E=D("./src/controller/buffer-operation-queue.ts"),T=Object(A.getMediaSource)(),_=/([ha]vc.)(?:\.[^.,]+)+/,C=function(){function y(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,w=o.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),d&&(o.updateMediaElementDuration(),s.trigger(R.Events.MEDIA_ATTACHED,{media:d})),w&&w.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=l,this._initSourceBuffer(),this.registerListeners()}var g=y.prototype;return g.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},g.destroy=function(){this.unregisterListeners(),this.details=null},g.registerListeners=function(){var o=this.hls;o.on(R.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(R.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(R.Events.BUFFER_RESET,this.onBufferReset,this),o.on(R.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(R.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(R.Events.BUFFER_EOS,this.onBufferEos,this),o.on(R.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(R.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(R.Events.FRAG_PARSED,this.onFragParsed,this),o.on(R.Events.FRAG_CHANGED,this.onFragChanged,this)},g.unregisterListeners=function(){var o=this.hls;o.off(R.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(R.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(R.Events.BUFFER_RESET,this.onBufferReset,this),o.off(R.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(R.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(R.Events.BUFFER_EOS,this.onBufferEos,this),o.off(R.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(R.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(R.Events.FRAG_PARSED,this.onFragParsed,this),o.off(R.Events.FRAG_CHANGED,this.onFragChanged,this)},g._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new E.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},g.onManifestParsed=function(o,s){var d=2;(s.audio&&!s.video||!s.altAudio)&&(d=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=d,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},g.onMediaAttaching=function(o,s){var d=this.media=s.media;if(d&&T){var w=this.mediaSource=new T;w.addEventListener("sourceopen",this._onMediaSourceOpen),w.addEventListener("sourceended",this._onMediaSourceEnded),w.addEventListener("sourceclose",this._onMediaSourceClose),d.src=self.URL.createObjectURL(w),this._objectUrl=d.src}},g.onMediaDetaching=function(){var o=this.media,s=this.mediaSource,d=this._objectUrl;if(s){if(P.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(w){P.logger.warn("[buffer-controller]: onMediaDetaching: "+w.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(d&&self.URL.revokeObjectURL(d),o.src===d?(o.removeAttribute("src"),o.load()):P.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(R.Events.MEDIA_DETACHED,void 0)},g.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(w){P.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",w)}}),this._initSourceBuffer()},g.onBufferCodecs=function(o,s){var d=this,w=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(f){if(w){var m=d.tracks[f];if(m&&typeof m.buffer.changeType=="function"){var L=s[f],x=L.codec,h=L.levelCodec,c=L.container,u=(m.levelCodec||m.codec).replace(_,"$1"),a=(h||x).replace(_,"$1");if(u!==a){var v=c+";codecs="+(h||x);d.appendChangeType(f,v)}}}else d.pendingTracks[f]=s[f]}),w)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},g.appendChangeType=function(o,s){var d=this,w=this.operationQueue,f={execute:function(){var L=d.sourceBuffer[o];L&&(P.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+s),L.changeType(s)),w.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(L){P.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",L)}};w.append(f,o)},g.onBufferAppending=function(o,s){var d=this,w=this.hls,f=this.operationQueue,m=this.tracks,L=s.data,x=s.type,h=s.frag,c=s.part,u=s.chunkMeta,a=u.buffering[x],v=self.performance.now();a.start=v;var p=h.stats.buffering,b=c?c.stats.buffering:null;p.start===0&&(p.start=v),b&&b.start===0&&(b.start=v);var M=m.audio,F=x==="audio"&&u.id===1&&(M==null?void 0:M.container)==="audio/mpeg",H={execute:function(){if(a.executeStart=self.performance.now(),F){var B=d.sourceBuffer[x];if(B){var U=h.start-B.timestampOffset;Math.abs(U)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+U+") sn: "+h.sn+")"),B.timestampOffset=h.start)}}d.appendExecutor(L,x)},onStart:function(){},onComplete:function(){var B=self.performance.now();a.executeEnd=a.end=B,p.first===0&&(p.first=B),b&&b.first===0&&(b.first=B);var U=d.sourceBuffer,z={};for(var Z in U)z[Z]=k.BufferHelper.getBuffered(U[Z]);d.appendError=0,d.hls.trigger(R.Events.BUFFER_APPENDED,{type:x,frag:h,part:c,chunkMeta:u,parent:h.type,timeRanges:z})},onError:function(B){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+x+" SourceBuffer",B);var U={type:N.ErrorTypes.MEDIA_ERROR,parent:h.type,details:N.ErrorDetails.BUFFER_APPEND_ERROR,err:B,fatal:!1};B.code===DOMException.QUOTA_EXCEEDED_ERR?U.details=N.ErrorDetails.BUFFER_FULL_ERROR:(d.appendError++,U.details=N.ErrorDetails.BUFFER_APPEND_ERROR,d.appendError>w.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+w.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),U.fatal=!0)),w.trigger(R.Events.ERROR,U)}};f.append(H,x)},g.onBufferFlushing=function(o,s){var d=this,w=this.operationQueue,f=function(L){return{execute:d.removeExecutor.bind(d,L,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){d.hls.trigger(R.Events.BUFFER_FLUSHED,{type:L})},onError:function(h){P.logger.warn("[buffer-controller]: Failed to remove from "+L+" SourceBuffer",h)}}};s.type?w.append(f(s.type),s.type):this.getSourceBufferTypes().forEach(function(m){w.append(f(m),m)})},g.onFragParsed=function(o,s){var d=this,w=s.frag,f=s.part,m=[],L=f?f.elementaryStreams:w.elementaryStreams;L[O.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(L[O.ElementaryStreamTypes.AUDIO]&&m.push("audio"),L[O.ElementaryStreamTypes.VIDEO]&&m.push("video"));var x=function(){var c=self.performance.now();w.stats.buffering.end=c,f&&(f.stats.buffering.end=c);var u=f?f.stats:w.stats;d.hls.trigger(R.Events.FRAG_BUFFERED,{frag:w,part:f,stats:u,id:w.type})};m.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+w.type+" level: "+w.level+" sn: "+w.sn),this.blockBuffers(x,m)},g.onFragChanged=function(o,s){this.flushBackBuffer()},g.onBufferEos=function(o,s){var d=this,w=this.getSourceBufferTypes().reduce(function(f,m){var L=d.sourceBuffer[m];return(!s.type||s.type===m)&&(L&&!L.ended&&(L.ended=!0,P.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),f&&!!(!L||L.ended)},!0);w&&this.blockBuffers(function(){var f=d.mediaSource;if(!f||f.readyState!=="open")return;f.endOfStream()})},g.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()},g.flushBackBuffer=function(){var o=this.hls,s=this.details,d=this.media,w=this.sourceBuffer;if(!d||s===null)return;var f=this.getSourceBufferTypes();if(!f.length)return;var m=s.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(W.isFiniteNumber)(m)||m<0)return;var L=d.currentTime,x=s.levelTargetDuration,h=Math.max(m,x),c=Math.floor(L/x)*x-h;f.forEach(function(u){var a=w[u];if(a){var v=k.BufferHelper.getBuffered(a);v.length>0&&c>v.start(0)&&(o.trigger(R.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),s.live&&o.trigger(R.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(R.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:u}))}})},g.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,s=this.hls,d=this.media,w=this.mediaSource,f=o.fragments[0].start+o.totalduration,m=d.duration,L=Object(W.isFiniteNumber)(w.duration)?w.duration:0;o.live&&s.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),w.duration=Infinity,this.updateSeekableRange(o)):(f>L&&f>m||!Object(W.isFiniteNumber)(m))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+f.toFixed(3)),w.duration=f)},g.updateSeekableRange=function(o){var s=this.mediaSource,d=o.fragments,w=d.length;if(w&&o.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var f=Math.max(0,d[0].start),m=Math.max(f,f+o.totalduration);s.setLiveSeekableRange(f,m)}},g.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,s=this.operationQueue,d=this.pendingTracks,w=Object.keys(d).length;if(w&&!o||w===2){this.createSourceBuffers(d),this.pendingTracks={};var f=this.getSourceBufferTypes();if(f.length===0){this.hls.trigger(R.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}f.forEach(function(m){s.executeNext(m)})}},g.createSourceBuffers=function(o){var s=this.sourceBuffer,d=this.mediaSource;if(!d)throw Error("createSourceBuffers called when mediaSource was null");var w=0;for(var f in o)if(!s[f]){var m=o[f];if(!m)throw Error("source buffer exists for track "+f+", however track does not");var L=m.levelCodec||m.codec,x=m.container+";codecs="+L;P.logger.log("[buffer-controller]: creating sourceBuffer("+x+")");try{var h=s[f]=d.addSourceBuffer(x),c=f;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[f]={buffer:h,codec:L,container:m.container,levelCodec:m.levelCodec,id:m.id},w++}catch(u){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+u.message),this.hls.trigger(R.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,mimeType:x})}}w&&this.hls.trigger(R.Events.BUFFER_CREATED,{tracks:this.tracks})},g._onSBUpdateStart=function(o){var s=this.operationQueue,d=s.current(o);d.onStart()},g._onSBUpdateEnd=function(o){var s=this.operationQueue,d=s.current(o);d.onComplete(),s.shiftAndExecuteNext(o)},g._onSBUpdateError=function(o,s){P.logger.error("[buffer-controller]: "+o+" SourceBuffer error",s),this.hls.trigger(R.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var d=this.operationQueue.current(o);d&&d.onError(s)},g.removeExecutor=function(o,s,d){var w=this.media,f=this.mediaSource,m=this.operationQueue,L=this.sourceBuffer,x=L[o];if(!w||!f||!x){P.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(o);return}var h=Object(W.isFiniteNumber)(w.duration)?w.duration:Infinity,c=Object(W.isFiniteNumber)(f.duration)?f.duration:Infinity,u=Math.max(0,s),a=Math.min(d,h,c);a>u?(P.logger.log("[buffer-controller]: Removing ["+u+","+a+"] from the "+o+" SourceBuffer"),console.assert(!x.updating,o+" sourceBuffer must not be updating"),x.remove(u,a)):m.shiftAndExecuteNext(o)},g.appendExecutor=function(o,s){var d=this.operationQueue,w=this.sourceBuffer,f=w[s];if(!f){P.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),d.shiftAndExecuteNext(s);return}f.ended=!1,console.assert(!f.updating,s+" sourceBuffer must not be updating"),f.appendBuffer(o)},g.blockBuffers=function(o,s){var d=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var w=this.operationQueue,f=s.map(function(m){return w.appendBlocker(m)});Promise.all(f).then(function(){o(),s.forEach(function(m){var L=d.sourceBuffer[m];(!L||!L.updating)&&w.shiftAndExecuteNext(m)})})},g.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},g.addBufferListener=function(o,s,d){var w=this.sourceBuffer[o];if(!w)return;var f=d.bind(this,o);this.listeners[o].push({event:s,listener:f}),w.addEventListener(s,f)},g.removeBufferListeners=function(o){var s=this.sourceBuffer[o];if(!s)return;this.listeners[o].forEach(function(d){s.removeEventListener(d.event,d.listener)})},y}()},"./src/controller/buffer-operation-queue.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"default",function(){return R});var W=D("./src/utils/logger.ts"),R=function(){function P(k){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=k}var N=P.prototype;return N.append=function(A,O){var E=this.queues[O];E.push(A),E.length===1&&this.buffers[O]&&this.executeNext(O)},N.insertAbort=function(A,O){var E=this.queues[O];E.unshift(A),this.executeNext(O)},N.appendBlocker=function(A){var O,E=new Promise(function(_){O=_}),T={execute:O,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(T,A),E},N.executeNext=function(A){var O=this.buffers,E=this.queues,T=O[A],_=E[A];if(_.length){var C=_[0];try{C.execute()}catch(y){W.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),C.onError(y),(!T||!T.updating)&&(_.shift(),this.executeNext(A))}}},N.shiftAndExecuteNext=function(A){this.queues[A].shift(),this.executeNext(A)},N.current=function(A){return this.queues[A][0]},P}()},"./src/controller/cap-level-controller.ts":function(ee,G,D){"use strict";D.r(G);var W=D("./src/events.ts");function R(k,A){for(var O=0;O<A.length;O++){var E=A[O];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(k,E.key,E)}}function P(k,A,O){return A&&R(k.prototype,A),O&&R(k,O),k}var N=function(){function k(O){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=O,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var A=k.prototype;return A.setStreamController=function(E){this.streamController=E},A.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},A.registerListeners=function(){var E=this.hls;E.on(W.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.on(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.on(W.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},A.unregisterListener=function(){var E=this.hls;E.off(W.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.off(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.off(W.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},A.onFpsDropLevelCapping=function(E,T){k.isLevelAllowed(T.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(T.droppedLevel)},A.onMediaAttaching=function(E,T){this.media=T.media instanceof HTMLVideoElement?T.media:null},A.onManifestParsed=function(E,T){var _=this.hls;this.restrictedLevels=[],this.firstLevel=T.firstLevel,_.config.capLevelToPlayerSize&&T.video&&this.startCapping()},A.onBufferCodecs=function(E,T){var _=this.hls;_.config.capLevelToPlayerSize&&T.video&&this.startCapping()},A.onMediaDetaching=function(){this.stopCapping()},A.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var E=this.hls.levels;if(E.length){var T=this.hls;T.autoLevelCapping=this.getMaxLevel(E.length-1),T.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=T.autoLevelCapping}}},A.getMaxLevel=function(E){var T=this,_=this.hls.levels;if(!_.length)return-1;var C=_.filter(function(y,g){return k.isLevelAllowed(g,T.restrictedLevels)&&g<=E});return this.clientRect=null,k.getMaxLevelByMediaSize(C,this.mediaWidth,this.mediaHeight)},A.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()},A.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},A.getDimensions=function(){if(this.clientRect)return this.clientRect;var E=this.media,T={width:0,height:0};if(E){var _=E.getBoundingClientRect();T.width=_.width,T.height=_.height,!T.width&&!T.height&&(T.width=_.right-_.left||E.width||0,T.height=_.bottom-_.top||E.height||0)}return this.clientRect=T,T},k.isLevelAllowed=function(E,T){return T===void 0&&(T=[]),T.indexOf(E)===-1},k.getMaxLevelByMediaSize=function(E,T,_){if(!E||!E.length)return-1;for(var C=function(s,d){return d?s.width!==d.width||s.height!==d.height:!0},y=E.length-1,g=0;g<E.length;g+=1){var l=E[g];if((l.width>=T||l.height>=_)&&C(l,E[g+1])){y=g;break}}return y},P(k,[{key:"mediaWidth",get:function(){return this.getDimensions().width*k.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*k.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var E=1;try{E=self.devicePixelRatio}catch(T){}return E}}]),k}();G.default=N},"./src/controller/cmcd-controller.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"default",function(){return C});var W=D("./src/events.ts"),R=D("./src/types/cmcd.ts"),P=D("./src/utils/buffer-helper.ts"),N=D("./src/utils/logger.ts");function k(y,g){for(var l=0;l<g.length;l++){var o=g[l];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(y,o.key,o)}}function A(y,g,l){return g&&k(y.prototype,g),l&&k(y,l),y}function O(y,g){var l=typeof Symbol!="undefined"&&y[Symbol.iterator]||y["@@iterator"];if(l)return(l=l.call(y)).next.bind(l);if(Array.isArray(y)||(l=E(y))||g&&y&&typeof y.length=="number"){l&&(y=l);var o=0;return function(){return o>=y.length?{done:!0}:{done:!1,value:y[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E(y,g){if(!y)return;if(typeof y=="string")return T(y,g);var l=Object.prototype.toString.call(y).slice(8,-1);if(l==="Object"&&y.constructor&&(l=y.constructor.name),l==="Map"||l==="Set")return Array.from(y);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return T(y,g)}function T(y,g){(g==null||g>y.length)&&(g=y.length);for(var l=0,o=new Array(g);l<g;l++)o[l]=y[l];return o}function _(){return _=Object.assign||function(y){for(var g=1;g<arguments.length;g++){var l=arguments[g];for(var o in l)Object.prototype.hasOwnProperty.call(l,o)&&(y[o]=l[o])}return y},_.apply(this,arguments)}var C=function(){function y(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(w){try{o.apply(w,{ot:R.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(f){N.logger.warn("Could not generate manifest CMCD data.",f)}},this.applyFragmentData=function(w){try{var f=w.frag,m=o.hls.levels[f.level],L=o.getObjectType(f),x={d:f.duration*1e3,ot:L};(L===R.CMCDObjectType.VIDEO||L===R.CMCDObjectType.AUDIO||L==R.CMCDObjectType.MUXED)&&(x.br=m.bitrate/1e3,x.tb=o.getTopBandwidth(L),x.bl=o.getBufferLength(L)),o.apply(w,x)}catch(h){N.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||y.uuid(),this.cid=d.contentId,this.useHeaders=d.useHeaders===!0,this.registerListeners())}var g=y.prototype;return g.registerListeners=function(){var o=this.hls;o.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(W.Events.BUFFER_CREATED,this.onBufferCreated,this)},g.unregisterListeners=function(){var o=this.hls;o.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(W.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},g.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},g.onMediaAttached=function(o,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},g.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},g.onBufferCreated=function(o,s){var d,w;this.audioBuffer=(d=s.tracks.audio)===null||d===void 0?void 0:d.buffer,this.videoBuffer=(w=s.tracks.video)===null||w===void 0?void 0:w.buffer},g.createData=function(){var o;return{v:R.CMCDVersion,sf:R.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}},g.apply=function(o,s){s===void 0&&(s={}),_(s,this.createData());var d=s.ot===R.CMCDObjectType.INIT||s.ot===R.CMCDObjectType.VIDEO||s.ot===R.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 w=y.toHeaders(s);if(!Object.keys(w).length)return;o.headers||(o.headers={}),_(o.headers,w)}else{var f=y.toQuery(s);if(!f)return;o.url=y.appendQueryToUri(o.url,f)}},g.getObjectType=function(o){var s=o.type;return s==="subtitle"?R.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?R.CMCDObjectType.INIT:s==="audio"?R.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?R.CMCDObjectType.VIDEO:R.CMCDObjectType.MUXED:void 0},g.getTopBandwidth=function(o){for(var s=0,d=o===R.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,w=O(d),f;!(f=w()).done;){var m=f.value;m.bitrate>s&&(s=m.bitrate)}return s>0?s:NaN},g.getBufferLength=function(o){var s=this.hls.media,d=o===R.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!d||!s)return NaN;var w=P.BufferHelper.bufferInfo(d,s.currentTime,this.config.maxBufferHole);return w.len*1e3},g.createPlaylistLoader=function(){var o=this.config.pLoader,s=this.applyPlaylistData,d=o||this.config.loader;return function(){function w(m){this.loader=void 0,this.loader=new d(m)}var f=w.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(L,x,h){s(L),this.loader.load(L,x,h)},A(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},g.createFragmentLoader=function(){var o=this.config.fLoader,s=this.applyFragmentData,d=o||this.config.loader;return function(){function w(m){this.loader=void 0,this.loader=new d(m)}var f=w.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(L,x,h){s(L),this.loader.load(L,x,h)},A(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},y.uuid=function(){var o=URL.createObjectURL(new Blob),s=o.toString();return URL.revokeObjectURL(o),s.substr(s.lastIndexOf("/")+1)},y.serialize=function(o){for(var s=[],d=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},w=function(F){return Math.round(F)},f=function(F){return w(F/100)*100},m=function(F){return encodeURIComponent(F)},L={br:w,d:w,bl:f,dl:f,mtp:f,nor:m,rtp:f,tb:w},x=Object.keys(o||{}).sort(),h=O(x),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 v=L[u];v&&(a=v(a));var p=typeof a,b=void 0;u==="ot"||u==="sf"||u==="st"?b=u+"="+a:p==="boolean"?b=u:p==="number"?b=u+"="+a:b=u+"="+JSON.stringify(a),s.push(b)}return s.join(",")},y.toHeaders=function(o){for(var s=Object.keys(o),d={},w=["Object","Request","Session","Status"],f=[{},{},{},{}],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},L=0,x=s;L<x.length;L++){var h=x[L],c=m[h]!=null?m[h]:1;f[c][h]=o[h]}for(var u=0;u<f.length;u++){var a=y.serialize(f[u]);a&&(d["CMCD-"+w[u]]=a)}return d},y.toQuery=function(o){return"CMCD="+encodeURIComponent(y.serialize(o))},y.appendQueryToUri=function(o,s){if(!s)return o;var d=o.includes("?")?"&":"?";return""+o+d+s},y}()},"./src/controller/eme-controller.ts":function(ee,G,D){"use strict";D.r(G);var W=D("./src/events.ts"),R=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),N=D("./src/utils/mediakeys-helper.ts");function k(C,y){for(var g=0;g<y.length;g++){var l=y[g];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(C,l.key,l)}}function A(C,y,g){return y&&k(C.prototype,y),g&&k(C,g),C}var O=3,E=function(y,g,l){var o={audioCapabilities:[],videoCapabilities:[]};return y.forEach(function(s){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:l.audioRobustness||""})}),g.forEach(function(s){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:l.videoRobustness||""})}),[o]},T=function(y,g,l,o){switch(y){case N.KeySystems.WIDEVINE:return E(g,l,o);default:throw new Error("Unknown key-system: "+y)}},_=function(){function C(g){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=g,this._config=g.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 y=C.prototype;return y.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},y._registerListeners=function(){this.hls.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this)},y._unregisterListeners=function(){this.hls.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this)},y.getLicenseServerUrl=function(l){switch(l){case N.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+l+'"')},y._attemptKeySystemAccess=function(l,o,s){var d=this,w=T(l,o,s,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var f=this.requestMediaKeySystemAccess(l,w);this.mediaKeysPromise=f.then(function(m){return d._onMediaKeySystemAccessObtained(l,m)}),f.catch(function(m){P.logger.error('Failed to obtain key-system "'+l+'" access:',m)})},y._onMediaKeySystemAccessObtained=function(l,o){var s=this;P.logger.log('Access for key-system "'+l+'" obtained');var d={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:l};this._mediaKeysList.push(d);var w=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(f){return d.mediaKeys=f,P.logger.log('Media-keys created for key-system "'+l+'"'),s._onMediaKeysCreated(),f});return w.catch(function(f){P.logger.error("Failed to create media-keys:",f)}),w},y._onMediaKeysCreated=function(){var l=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),l._onNewMediaKeySession(o.mediaKeysSession))})},y._onNewMediaKeySession=function(l){var o=this;P.logger.log("New key-system session "+l.sessionId),l.addEventListener("message",function(s){o._onKeySessionMessage(l,s.message)},!1)},y._onKeySessionMessage=function(l,o){P.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(s){P.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),l.update(s)})},y.onMediaEncrypted=function(l){var o=this;if(P.logger.log('Media is encrypted using "'+l.initDataType+'" init data type'),!this.mediaKeysPromise){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(W.Events.ERROR,{type:R.ErrorTypes.KEY_SYSTEM_ERROR,details:R.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(w){if(!o._media)return;o._attemptSetMediaKeys(w),o._generateRequestWithPreferredKeySession(l.initDataType,l.initData)};this.mediaKeysPromise.then(s).catch(s)},y._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){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(W.Events.ERROR,{type:R.ErrorTypes.KEY_SYSTEM_ERROR,details:R.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}P.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},y._generateRequestWithPreferredKeySession=function(l,o){var s=this,d=this._mediaKeysList[0];if(!d){P.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(W.Events.ERROR,{type:R.ErrorTypes.KEY_SYSTEM_ERROR,details:R.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(d.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var w=d.mediaKeysSession;if(!w){P.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(W.Events.ERROR,{type:R.ErrorTypes.KEY_SYSTEM_ERROR,details:R.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){P.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(W.Events.ERROR,{type:R.ErrorTypes.KEY_SYSTEM_ERROR,details:R.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}P.logger.log('Generating key-session request for "'+l+'" init data type'),d.mediaKeysSessionInitialized=!0,w.generateRequest(l,o).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(f){P.logger.error("Error generating key-session request:",f),s.hls.trigger(W.Events.ERROR,{type:R.ErrorTypes.KEY_SYSTEM_ERROR,details:R.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},y._createLicenseXhr=function(l,o,s){var d=new XMLHttpRequest;d.responseType="arraybuffer",d.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,d,l,o,s);var w=this._licenseXhrSetup;if(w)try{w.call(this.hls,d,l),w=void 0}catch(f){P.logger.error(f)}try{d.readyState||d.open("POST",l,!0),w&&w.call(this.hls,d,l)}catch(f){throw new Error("issue setting up KeySystem license XHR "+f)}return d},y._onLicenseRequestReadyStageChange=function(l,o,s,d){switch(l.readyState){case 4:if(l.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var w=l.response,f=this._licenseResponseCallback;if(f)try{w=f.call(this.hls,l,o)}catch(L){P.logger.error(L)}d(w)}else{if(P.logger.error("License Request XHR failed ("+o+"). Status: "+l.status+" ("+l.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>O){this.hls.trigger(W.Events.ERROR,{type:R.ErrorTypes.KEY_SYSTEM_ERROR,details:R.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=O-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(s,d)}break}},y._generateLicenseRequestChallenge=function(l,o){switch(l.mediaKeySystemDomain){case N.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+l.mediaKeySystemDomain)},y._requestLicense=function(l,o){P.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(W.Events.ERROR,{type:R.ErrorTypes.KEY_SYSTEM_ERROR,details:R.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var d=this.getLicenseServerUrl(s.mediaKeySystemDomain),w=this._createLicenseXhr(d,l,o);P.logger.log("Sending license request to URL: "+d);var f=this._generateLicenseRequestChallenge(s,l);w.send(f)}catch(m){P.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(W.Events.ERROR,{type:R.ErrorTypes.KEY_SYSTEM_ERROR,details:R.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},y.onMediaAttached=function(l,o){if(!this._emeEnabled)return;var s=o.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},y.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(){})},y.onManifestParsed=function(l,o){if(!this._emeEnabled)return;var s=o.levels.map(function(w){return w.audioCodec}).filter(function(w){return!!w}),d=o.levels.map(function(w){return w.videoCodec}).filter(function(w){return!!w});this._attemptKeySystemAccess(N.KeySystems.WIDEVINE,s,d)},A(C,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),C}();G.default=_},"./src/controller/fps-controller.ts":function(ee,G,D){"use strict";D.r(G);var W=D("./src/events.ts"),R=D("./src/utils/logger.ts"),P=function(){function N(A){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=A,this.registerListeners()}var k=N.prototype;return k.setStreamController=function(O){this.streamController=O},k.registerListeners=function(){this.hls.on(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},k.unregisterListeners=function(){this.hls.off(W.Events.MEDIA_ATTACHING,this.onMediaAttaching)},k.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},k.onMediaAttaching=function(O,E){var T=this.hls.config;if(T.capLevelOnFPSDrop){var _=E.media instanceof self.HTMLVideoElement?E.media:null;this.media=_,_&&typeof _.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),T.fpsDroppedMonitoringPeriod)}},k.checkFPS=function(O,E,T){var _=performance.now();if(E){if(this.lastTime){var C=_-this.lastTime,y=T-this.lastDroppedFrames,g=E-this.lastDecodedFrames,l=1e3*y/C,o=this.hls;if(o.trigger(W.Events.FPS_DROP,{currentDropped:y,currentDecoded:g,totalDroppedFrames:T}),l>0&&y>o.config.fpsDroppedMonitoringThreshold*g){var s=o.currentLevel;R.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(W.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:o.currentLevel}),o.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=_,this.lastDroppedFrames=T,this.lastDecodedFrames=E}},k.checkFPSInterval=function(){var O=this.media;if(O)if(this.isVideoPlaybackQualityAvailable){var E=O.getVideoPlaybackQuality();this.checkFPS(O,E.totalVideoFrames,E.droppedVideoFrames)}else this.checkFPS(O,O.webkitDecodedFrameCount,O.webkitDroppedFrameCount)},N}();G.default=P},"./src/controller/fragment-finders.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"findFragmentByPDT",function(){return P}),D.d(G,"findFragmentByPTS",function(){return N}),D.d(G,"fragmentWithinToleranceTest",function(){return k}),D.d(G,"pdtWithinToleranceTest",function(){return A}),D.d(G,"findFragWithCC",function(){return O});var W=D("./src/polyfills/number.ts"),R=D("./src/utils/binary-search.ts");function P(E,T,_){if(T===null||!Array.isArray(E)||!E.length||!Object(W.isFiniteNumber)(T))return null;var C=E[0].programDateTime;if(T<(C||0))return null;var y=E[E.length-1].endProgramDateTime;if(T>=(y||0))return null;_=_||0;for(var g=0;g<E.length;++g){var l=E[g];if(A(T,_,l))return l}return null}function N(E,T,_,C){_===void 0&&(_=0),C===void 0&&(C=0);var y=null;if(E?y=T[E.sn-T[0].sn+1]||null:_===0&&T[0].start===0&&(y=T[0]),y&&k(_,C,y)===0)return y;var g=R.default.search(T,k.bind(null,_,C));return g||y}function k(E,T,_){E===void 0&&(E=0),T===void 0&&(T=0);var C=Math.min(T,_.duration+(_.deltaPTS?_.deltaPTS:0));return _.start+_.duration-C<=E?1:_.start-C>E&&_.start?-1:0}function A(E,T,_){var C=Math.min(T,_.duration+(_.deltaPTS?_.deltaPTS:0))*1e3,y=_.endProgramDateTime||0;return y-C>E}function O(E,T){return R.default.search(E,function(_){return _.cc<T?1:_.cc>T?-1:0})}},"./src/controller/fragment-tracker.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"FragmentState",function(){return P}),D.d(G,"FragmentTracker",function(){return N});var W=D("./src/events.ts"),R=D("./src/types/loader.ts"),P;(function(O){O.NOT_LOADED="NOT_LOADED",O.BACKTRACKED="BACKTRACKED",O.APPENDING="APPENDING",O.PARTIAL="PARTIAL",O.OK="OK"})(P||(P={}));var N=function(){function O(T){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=T,this._registerListeners()}var E=O.prototype;return E._registerListeners=function(){var _=this.hls;_.on(W.Events.BUFFER_APPENDED,this.onBufferAppended,this),_.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this),_.on(W.Events.FRAG_LOADED,this.onFragLoaded,this)},E._unregisterListeners=function(){var _=this.hls;_.off(W.Events.BUFFER_APPENDED,this.onBufferAppended,this),_.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this),_.off(W.Events.FRAG_LOADED,this.onFragLoaded,this)},E.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},E.getAppendedFrag=function(_,C){if(C===R.PlaylistLevelType.MAIN){var y=this.activeFragment,g=this.activeParts;if(!y)return null;if(g)for(var l=g.length;l--;){var o=g[l],s=o?o.end:y.appendedPTS;if(o.start<=_&&s!==void 0&&_<=s)return l>9&&(this.activeParts=g.slice(l-9)),o}else if(y.start<=_&&y.appendedPTS!==void 0&&_<=y.appendedPTS)return y}return this.getBufferedFrag(_,C)},E.getBufferedFrag=function(_,C){for(var y=this.fragments,g=Object.keys(y),l=g.length;l--;){var o=y[g[l]];if((o==null?void 0:o.body.type)===C&&o.buffered){var s=o.body;if(s.start<=_&&_<=s.end)return s}}return null},E.detectEvictedFragments=function(_,C,y){var g=this;Object.keys(this.fragments).forEach(function(l){var o=g.fragments[l];if(!o)return;if(!o.buffered){o.body.type===y&&g.removeFragment(o.body);return}var s=o.range[_];if(!s)return;s.time.some(function(d){var w=!g.isTimeBuffered(d.startPTS,d.endPTS,C);return w&&g.removeFragment(o.body),w})})},E.detectPartialFragments=function(_){var C=this,y=this.timeRanges,g=_.frag,l=_.part;if(!y||g.sn==="initSegment")return;var o=A(g),s=this.fragments[o];if(!s)return;Object.keys(y).forEach(function(d){var w=g.elementaryStreams[d];if(!w)return;var f=y[d],m=l!==null||w.partial===!0;s.range[d]=C.getBufferedTimes(g,l,m,f)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},E.fragBuffered=function(_){var C=A(_),y=this.fragments[C];y&&(y.backtrack=y.loaded=null,y.buffered=!0)},E.getBufferedTimes=function(_,C,y,g){for(var l={time:[],partial:y},o=C?C.start:_.start,s=C?C.end:_.end,d=_.minEndPTS||s,w=_.maxStartPTS||o,f=0;f<g.length;f++){var m=g.start(f)-this.bufferPadding,L=g.end(f)+this.bufferPadding;if(w>=m&&d<=L){l.time.push({startPTS:Math.max(o,g.start(f)),endPTS:Math.min(s,g.end(f))});break}else if(o<L&&s>m)l.partial=!0,l.time.push({startPTS:Math.max(o,g.start(f)),endPTS:Math.min(s,g.end(f))});else if(s<=m)break}return l},E.getPartialFragment=function(_){var C=null,y,g,l,o=0,s=this.bufferPadding,d=this.fragments;return Object.keys(d).forEach(function(w){var f=d[w];if(!f)return;k(f)&&(g=f.body.start-s,l=f.body.end+s,_>=g&&_<=l&&(y=Math.min(_-g,l-_),o<=y&&(C=f.body,o=y)))}),C},E.getState=function(_){var C=A(_),y=this.fragments[C];return y?y.buffered?k(y)?P.PARTIAL:P.OK:y.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},E.backtrack=function(_,C){var y=A(_),g=this.fragments[y];if(!g||g.backtrack)return null;var l=g.backtrack=C||g.loaded;return g.loaded=null,l},E.getBacktrackData=function(_){var C=A(_),y=this.fragments[C];if(y){var g,l=y.backtrack;if(l!=null&&(g=l.payload)!==null&&g!==void 0&&g.byteLength)return l;this.removeFragment(_)}return null},E.isTimeBuffered=function(_,C,y){for(var g,l,o=0;o<y.length;o++){if(g=y.start(o)-this.bufferPadding,l=y.end(o)+this.bufferPadding,_>=g&&C<=l)return!0;if(C<=g)return!1}return!1},E.onFragLoaded=function(_,C){var y=C.frag,g=C.part;if(y.sn==="initSegment"||y.bitrateTest||g)return;var l=A(y);this.fragments[l]={body:y,loaded:C,backtrack:null,buffered:!1,range:Object.create(null)}},E.onBufferAppended=function(_,C){var y=this,g=C.frag,l=C.part,o=C.timeRanges;if(g.type===R.PlaylistLevelType.MAIN)if(this.activeFragment=g,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 w=o[d];if(y.detectEvictedFragments(d,w),!l)for(var f=0;f<w.length;f++)g.appendedPTS=Math.max(w.end(f),g.appendedPTS||0)})},E.onFragBuffered=function(_,C){this.detectPartialFragments(C)},E.hasFragment=function(_){var C=A(_);return!!this.fragments[C]},E.removeFragmentsInRange=function(_,C,y){var g=this;Object.keys(this.fragments).forEach(function(l){var o=g.fragments[l];if(!o)return;if(o.buffered){var s=o.body;s.type===y&&s.start<C&&s.end>_&&g.removeFragment(s)}})},E.removeFragment=function(_){var C=A(_);_.stats.loaded=0,_.clearElementaryStreamInfo(),delete this.fragments[C]},E.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},O}();function k(O){var E,T;return O.buffered&&(((E=O.range.video)===null||E===void 0?void 0:E.partial)||((T=O.range.audio)===null||T===void 0?void 0:T.partial))}function A(O){return O.type+"_"+O.level+"_"+O.urlId+"_"+O.sn}},"./src/controller/gap-controller.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"STALL_MINIMUM_DURATION_MS",function(){return k}),D.d(G,"MAX_START_GAP_JUMP",function(){return A}),D.d(G,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return O}),D.d(G,"SKIP_BUFFER_RANGE_START",function(){return E}),D.d(G,"default",function(){return T});var W=D("./src/utils/buffer-helper.ts"),R=D("./src/errors.ts"),P=D("./src/events.ts"),N=D("./src/utils/logger.ts"),k=250,A=2,O=.1,E=.05,T=function(){function _(y,g,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=y,this.media=g,this.fragmentTracker=l,this.hls=o}var C=_.prototype;return C.destroy=function(){this.hls=this.fragmentTracker=this.media=null},C.poll=function(g){var l=this.config,o=this.media,s=this.stalled,d=o.currentTime,w=o.seeking,f=this.seeking&&!w,m=!this.seeking&&w;if(this.seeking=w,d!==g){if(this.moved=!0,s!==null){if(this.stallReported){var L=self.performance.now()-s;N.logger.warn("playback not stuck anymore @"+d+", after "+Math.round(L)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||f)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!W.BufferHelper.getBuffered(o).length)return;var x=W.BufferHelper.bufferInfo(o,d,0),h=x.len>0,c=x.nextStart||0;if(!h&&!c)return;if(w){var u=x.len>A,a=!c||c-d>A&&!this.fragmentTracker.getPartialFragment(d);if(u||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var v,p=Math.max(c,x.start||0)-d,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=b==null||((v=b.details)===null||v===void 0)?void 0:v.live,F=M?b.details.targetduration*2:A;if(p>0&&p<=F){this._trySkipBufferHole(null);return}}var H=self.performance.now();if(s===null){this.stalled=H;return}var X=H-s;!w&&X>=k&&this._reportStall(x.len);var B=W.BufferHelper.bufferInfo(o,d,l.maxBufferHole);this._tryFixBufferStall(B,X)},C._tryFixBufferStall=function(g,l){var o=this.config,s=this.fragmentTracker,d=this.media,w=d.currentTime,f=s.getPartialFragment(w);if(f){var m=this._trySkipBufferHole(f);if(m)return}g.len>o.maxBufferHole&&l>o.highBufferWatchdogPeriod*1e3&&(N.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},C._reportStall=function(g){var l=this.hls,o=this.media,s=this.stallReported;s||(this.stallReported=!0,N.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+g+")"),l.trigger(P.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:g}))},C._trySkipBufferHole=function(g){for(var l=this.config,o=this.hls,s=this.media,d=s.currentTime,w=0,f=W.BufferHelper.getBuffered(s),m=0;m<f.length;m++){var L=f.start(m);if(d+l.maxBufferHole>=w&&d<L){var x=Math.max(L+E,s.currentTime+O);return N.logger.warn("skipping hole, adjusting currentTime from "+d+" to "+x),this.moved=!0,this.stalled=null,s.currentTime=x,g&&o.trigger(P.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+d+" to "+x,frag:g}),x}w=f.end(m)}return 0},C._tryNudgeBuffer=function(){var g=this.config,l=this.hls,o=this.media,s=o.currentTime,d=(this.nudgeRetry||0)+1;if(this.nudgeRetry=d,d<g.nudgeMaxRetry){var w=s+d*g.nudgeOffset;N.logger.warn("Nudging 'currentTime' from "+s+" to "+w),o.currentTime=w,l.trigger(P.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else N.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+g.nudgeMaxRetry+" nudges"),l.trigger(P.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},_}()},"./src/controller/id3-track-controller.ts":function(ee,G,D){"use strict";D.r(G);var W=D("./src/events.ts"),R=D("./src/utils/texttrack-utils.ts"),P=D("./src/demux/id3.ts"),N=.25,k=function(){function A(E){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=E,this._registerListeners()}var O=A.prototype;return O.destroy=function(){this._unregisterListeners()},O._registerListeners=function(){var T=this.hls;T.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.on(W.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.on(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O._unregisterListeners=function(){var T=this.hls;T.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.off(W.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.off(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O.onMediaAttached=function(T,_){this.media=_.media},O.onMediaDetaching=function(){if(!this.id3Track)return;Object(R.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},O.getID3Track=function(T){if(!this.media)return;for(var _=0;_<T.length;_++){var C=T[_];if(C.kind==="metadata"&&C.label==="id3")return Object(R.sendAddTrackEvent)(C,this.media),C}return this.media.addTextTrack("metadata","id3")},O.onFragParsingMetadata=function(T,_){if(!this.media)return;var C=_.frag,y=_.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var g=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,l=0;l<y.length;l++){var o=P.getID3Frames(y[l].data);if(o){var s=y[l].pts,d=l<y.length-1?y[l+1].pts:C.end,w=d-s;w<=0&&(d=s+N);for(var f=0;f<o.length;f++){var m=o[f];if(!P.isTimeStampFrame(m)){var L=new g(s,d,"");L.value=m,this.id3Track.addCue(L)}}}}},O.onBufferFlushing=function(T,_){var C=_.startOffset,y=_.endOffset,g=_.type;if(!g||g==="audio"){var l=this.id3Track;l&&Object(R.removeCuesInRange)(l,C,y)}},A}();G.default=k},"./src/controller/latency-controller.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"default",function(){return A});var W=D("./src/errors.ts"),R=D("./src/events.ts"),P=D("./src/utils/logger.ts");function N(O,E){for(var T=0;T<E.length;T++){var _=E[T];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(O,_.key,_)}}function k(O,E,T){return E&&N(O.prototype,E),T&&N(O,T),O}var A=function(){function O(T){var _=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 _.timeupdate()},this.hls=T,this.config=T.config,this.registerListeners()}var E=O.prototype;return E.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},E.registerListeners=function(){this.hls.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(R.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(R.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){this.hls.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(R.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(R.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(R.Events.ERROR,this.onError)},E.onMediaAttached=function(_,C){this.media=C.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},E.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},E.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},E.onLevelUpdated=function(_,C){var y=C.details;this.levelDetails=y,y.advanced&&this.timeupdate(),!y.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},E.onError=function(_,C){if(C.details!==W.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},E.timeupdate=function(){var _=this.media,C=this.levelDetails;if(!_||!C)return;this.currentTime=_.currentTime;var y=this.computeLatency();if(y===null)return;this._latency=y;var g=this.config,l=g.lowLatencyMode,o=g.maxLiveSyncPlaybackRate;if(!l||o===1)return;var s=this.targetLatency;if(s===null)return;var d=y-s,w=Math.min(this.maxLatency,s+C.targetduration),f=d<w;if(C.live&&f&&d>.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,o)),L=Math.round(2/(1+Math.exp(-.75*d-this.edgeStalled))*20)/20;_.playbackRate=Math.min(m,Math.max(1,L))}else _.playbackRate!==1&&_.playbackRate!==0&&(_.playbackRate=1)},E.estimateLiveEdge=function(){var _=this.levelDetails;return _===null?null:_.edge+_.age},E.computeLatency=function(){var _=this.estimateLiveEdge();return _===null?null:_-this.currentTime},k(O,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var _=this.config,C=this.levelDetails;return _.liveMaxLatencyDuration!==void 0?_.liveMaxLatencyDuration:C?_.liveMaxLatencyDurationCount*C.targetduration:0}},{key:"targetLatency",get:function(){var _=this.levelDetails;if(_===null)return null;var C=_.holdBack,y=_.partHoldBack,g=_.targetduration,l=this.config,o=l.liveSyncDuration,s=l.liveSyncDurationCount,d=l.lowLatencyMode,w=this.hls.userConfig,f=d&&y||C;(w.liveSyncDuration||w.liveSyncDurationCount||f===0)&&(f=o!==void 0?o:s*g);var m=g,L=1;return f+Math.min(this.stallCount*L,m)}},{key:"liveSyncPosition",get:function(){var _=this.estimateLiveEdge(),C=this.targetLatency,y=this.levelDetails;if(_===null||C===null||y===null)return null;var g=y.edge,l=_-C-this.edgeStalled,o=g-y.totalduration,s=g-(this.config.lowLatencyMode&&y.partTarget||y.targetduration);return Math.min(Math.max(o,l),s)}},{key:"drift",get:function(){var _=this.levelDetails;return _===null?1:_.drift}},{key:"edgeStalled",get:function(){var _=this.levelDetails;if(_===null)return 0;var C=(this.config.lowLatencyMode&&_.partTarget||_.targetduration)*3;return Math.max(_.age-C,0)}},{key:"forwardBufferLength",get:function(){var _=this.media,C=this.levelDetails;if(!_||!C)return 0;var y=_.buffered.length;return y?_.buffered.end(y-1):C.edge-this.currentTime}}]),O}()},"./src/controller/level-controller.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"default",function(){return l});var W=D("./src/types/level.ts"),R=D("./src/events.ts"),P=D("./src/errors.ts"),N=D("./src/utils/codecs.ts"),k=D("./src/controller/level-helper.ts"),A=D("./src/controller/base-playlist-controller.ts"),O=D("./src/types/loader.ts");function E(){return E=Object.assign||function(o){for(var s=1;s<arguments.length;s++){var d=arguments[s];for(var w in d)Object.prototype.hasOwnProperty.call(d,w)&&(o[w]=d[w])}return o},E.apply(this,arguments)}function T(o,s){for(var d=0;d<s.length;d++){var w=s[d];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function _(o,s,d){return s&&T(o.prototype,s),d&&T(o,d),o}function C(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,y(o,s)}function y(o,s){return y=Object.setPrototypeOf||function(w,f){return w.__proto__=f,w},y(o,s)}var g=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),l=function(o){C(s,o);function s(w){var f;return f=o.call(this,w,"[level-controller]")||this,f._levels=[],f._firstLevel=-1,f._startLevel=void 0,f.currentLevelIndex=-1,f.manualLevelIndex=-1,f.onParsedComplete=void 0,f._registerListeners(),f}var d=s.prototype;return d._registerListeners=function(){var f=this.hls;f.on(R.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(R.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(R.Events.FRAG_LOADED,this.onFragLoaded,this),f.on(R.Events.ERROR,this.onError,this)},d._unregisterListeners=function(){var f=this.hls;f.off(R.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(R.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(R.Events.FRAG_LOADED,this.onFragLoaded,this),f.off(R.Events.ERROR,this.onError,this)},d.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},d.startLoad=function(){var f=this._levels;f.forEach(function(m){m.loadError=0}),o.prototype.startLoad.call(this)},d.onManifestLoaded=function(f,m){var L=[],x=[],h=[],c,u={},a,v=!1,p=!1,b=!1;if(m.levels.forEach(function(X){var B=X.attrs;v=v||!!(X.width&&X.height),p=p||!!X.videoCodec,b=b||!!X.audioCodec,g&&X.audioCodec&&X.audioCodec.indexOf("mp4a.40.34")!==-1&&(X.audioCodec=void 0);var U=X.bitrate+"-"+X.attrs.RESOLUTION+"-"+X.attrs.CODECS;a=u[U],a?a.url.push(X.url):(a=new W.Level(X),u[U]=a,L.push(a)),B&&(B.AUDIO&&Object(k.addGroupId)(a,"audio",B.AUDIO),B.SUBTITLES&&Object(k.addGroupId)(a,"text",B.SUBTITLES))}),(v||p)&&b&&(L=L.filter(function(X){var B=X.videoCodec,U=X.width,z=X.height;return!!B||!!(U&&z)})),L=L.filter(function(X){var B=X.audioCodec,U=X.videoCodec;return(!B||Object(N.isCodecSupportedInMp4)(B,"audio"))&&(!U||Object(N.isCodecSupportedInMp4)(U,"video"))}),m.audioTracks&&(x=m.audioTracks.filter(function(X){return!X.audioCodec||Object(N.isCodecSupportedInMp4)(X.audioCodec,"audio")}),Object(k.assignTrackIdsByGroup)(x)),m.subtitles&&(h=m.subtitles,Object(k.assignTrackIdsByGroup)(h)),L.length>0){c=L[0].bitrate,L.sort(function(X,B){return X.bitrate-B.bitrate}),this._levels=L;for(var M=0;M<L.length;M++)if(L[M].bitrate===c){this._firstLevel=M,this.log("manifest loaded, "+L.length+" level(s) found, first bitrate: "+c);break}var F=b&&!p,H={levels:L,audioTracks:x,subtitleTracks:h,firstLevel:this._firstLevel,stats:m.stats,audio:b,video:p,altAudio:!F&&x.some(function(X){return!!X.url})};this.hls.trigger(R.Events.MANIFEST_PARSED,H),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(R.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:m.url,reason:"no level with compatible codecs found in manifest"})},d.onError=function(f,m){if(o.prototype.onError.call(this,f,m),m.fatal)return;var L=m.context,x=this._levels[this.currentLevelIndex];if(L&&(L.type===O.PlaylistContextType.AUDIO_TRACK&&x.audioGroupIds&&L.groupId===x.audioGroupIds[x.urlId]||L.type===O.PlaylistContextType.SUBTITLE_TRACK&&x.textGroupIds&&L.groupId===x.textGroupIds[x.urlId])){this.redundantFailover(this.currentLevelIndex);return}var h=!1,c=!0,u;switch(m.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(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 P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:L&&(L.deliveryDirectives&&(c=!1),u=L.level),h=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:u=m.level,h=!0;break}u!==void 0&&this.recoverLevel(m,u,h,c)},d.recoverLevel=function(f,m,L,x){var h=f.details,c=this._levels[m];if(c.loadError++,L){var u=this.retryLoadingOrFail(f);if(u)f.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(x){var a=c.url.length;if(a>1&&c.loadError<a)f.levelRetry=!0,this.redundantFailover(m);else if(this.manualLevelIndex===-1){var v=m===0?this._levels.length-1:m-1;this.currentLevelIndex!==v&&this._levels[v].loadError===0&&(this.warn(h+": switch to "+v),f.levelRetry=!0,this.hls.nextAutoLevel=v)}}},d.redundantFailover=function(f){var m=this._levels[f],L=m.url.length;if(L>1){var x=(m.urlId+1)%L;this.warn("Switching to redundant URL-id "+x),this._levels.forEach(function(h){h.urlId=x}),this.level=f}},d.onFragLoaded=function(f,m){var L=m.frag;if(L!==void 0&&L.type===O.PlaylistLevelType.MAIN){var x=this._levels[L.level];x!==void 0&&(x.fragmentError=0,x.loadError=0)}},d.onLevelLoaded=function(f,m){var L,x=m.level,h=m.details,c=this._levels[x];if(!c){var u;this.warn("Invalid level index "+x),(u=m.deliveryDirectives)!==null&&u!==void 0&&u.skip&&(h.deltaUpdateFailed=!0);return}x===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(x,m,c.details)):(L=m.deliveryDirectives)!==null&&L!==void 0&&L.skip&&(h.deltaUpdateFailed=!0)},d.onAudioTrackSwitched=function(f,m){var L=this.hls.levels[this.currentLevelIndex];if(!L)return;if(L.audioGroupIds){for(var x=-1,h=this.hls.audioTracks[m.id].groupId,c=0;c<L.audioGroupIds.length;c++)if(L.audioGroupIds[c]===h){x=c;break}x!==L.urlId&&(L.urlId=x,this.startLoad())}},d.loadPlaylist=function(f){var m=this.currentLevelIndex,L=this._levels[m];if(this.canLoad&&L&&L.url.length>0){var x=L.urlId,h=L.url[x];if(f)try{h=f.addDirectives(h)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+m+(f?" at sn "+f.msn+" part "+f.part:"")+" with URL-id "+x+" "+h),this.clearTimer(),this.hls.trigger(R.Events.LEVEL_LOADING,{url:h,level:m,id:x,deliveryDirectives:f||null})}},d.removeLevel=function(f,m){var L=function(c,u){return u!==m},x=this._levels.filter(function(h,c){return c!==f?!0:h.url.length>1&&m!==void 0?(h.url=h.url.filter(L),h.audioGroupIds&&(h.audioGroupIds=h.audioGroupIds.filter(L)),h.textGroupIds&&(h.textGroupIds=h.textGroupIds.filter(L)),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=x,this.hls.trigger(R.Events.LEVELS_UPDATED,{levels:x})},_(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(f){var m,L=this._levels;if(L.length===0)return;if(this.currentLevelIndex===f&&(m=L[f])!==null&&m!==void 0&&m.details)return;if(f<0||f>=L.length){var x=f<0;if(this.hls.trigger(R.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:f,fatal:x,reason:"invalid level idx"}),x)return;f=Math.min(f,L.length-1)}this.clearTimer();var h=this.currentLevelIndex,c=L[h],u=L[f];this.log("switching to level "+f+" from "+h),this.currentLevelIndex=f;var a=E({},u,{level:f,maxBitrate:u.maxBitrate,uri:u.uri,urlId:u.urlId});delete a._urlId,this.hls.trigger(R.Events.LEVEL_SWITCHING,a);var v=u.details;if(!v||v.live){var p=this.switchParams(u.uri,c==null?void 0:c.details);this.loadPlaylist(p)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(f){this.manualLevelIndex=f,this._startLevel===void 0&&(this._startLevel=f),f!==-1&&(this.level=f)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(f){this._firstLevel=f}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var f=this.hls.config.startLevel;return f!==void 0?f:this._firstLevel}else return this._startLevel},set:function(f){this._startLevel=f}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(f){this.level=f,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=f)}}]),s}(A.default)},"./src/controller/level-helper.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"addGroupId",function(){return P}),D.d(G,"assignTrackIdsByGroup",function(){return N}),D.d(G,"updatePTS",function(){return k}),D.d(G,"updateFragPTSDTS",function(){return O}),D.d(G,"mergeDetails",function(){return E}),D.d(G,"mapPartIntersection",function(){return T}),D.d(G,"mapFragmentIntersection",function(){return _}),D.d(G,"adjustSliding",function(){return C}),D.d(G,"addSliding",function(){return y}),D.d(G,"computeReloadInterval",function(){return g}),D.d(G,"getFragmentWithSN",function(){return l}),D.d(G,"getPartWith",function(){return o});var W=D("./src/polyfills/number.ts"),R=D("./src/utils/logger.ts");function P(s,d,w){switch(d){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(w);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(w);break}}function N(s){var d={};s.forEach(function(w){var f=w.groupId||"";w.id=d[f]=d[f]||0,d[f]++})}function k(s,d,w){var f=s[d],m=s[w];A(f,m)}function A(s,d){var w=d.startPTS;if(Object(W.isFiniteNumber)(w)){var f=0,m;d.sn>s.sn?(f=w-s.start,m=s):(f=s.start-w,m=d),m.duration!==f&&(m.duration=f)}else if(d.sn>s.sn){var L=s.cc===d.cc;L&&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 O(s,d,w,f,m,L){var x=f-w;x<=0&&(R.logger.warn("Fragment should have a positive duration",d),f=w+d.duration,L=m+d.duration);var h=w,c=f,u=d.startPTS,a=d.endPTS;if(Object(W.isFiniteNumber)(u)){var v=Math.abs(u-w);Object(W.isFiniteNumber)(d.deltaPTS)?d.deltaPTS=Math.max(v,d.deltaPTS):d.deltaPTS=v,h=Math.max(w,u),w=Math.min(w,u),m=Math.min(m,d.startDTS),c=Math.min(f,a),f=Math.max(f,a),L=Math.max(L,d.endDTS)}d.duration=f-w;var p=w-d.start;d.appendedPTS=f,d.start=d.startPTS=w,d.maxStartPTS=h,d.startDTS=m,d.endPTS=f,d.minEndPTS=c,d.endDTS=L;var b=d.sn;if(!s||b<s.startSN||b>s.endSN)return 0;var M,F=b-s.startSN,H=s.fragments;for(H[F]=d,M=F;M>0;M--)A(H[M],H[M-1]);for(M=F;M<H.length-1;M++)A(H[M],H[M+1]);return s.fragmentHint&&A(H[H.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,p}function E(s,d){for(var w=null,f=s.fragments,m=f.length-1;m>=0;m--){var L=f[m].initSegment;if(L){w=L;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var x=0,h;if(_(s,d,function(M,F){M.relurl&&(x=M.cc-F.cc),Object(W.isFiniteNumber)(M.startPTS)&&Object(W.isFiniteNumber)(M.endPTS)&&(F.start=F.startPTS=M.startPTS,F.startDTS=M.startDTS,F.appendedPTS=M.appendedPTS,F.maxStartPTS=M.maxStartPTS,F.endPTS=M.endPTS,F.endDTS=M.endDTS,F.minEndPTS=M.minEndPTS,F.duration=M.endPTS-M.startPTS,F.duration&&(h=F),d.PTSKnown=d.alignedSliding=!0),F.elementaryStreams=M.elementaryStreams,F.loader=M.loader,F.stats=M.stats,F.urlId=M.urlId,M.initSegment&&(F.initSegment=M.initSegment,w=M.initSegment)}),w){var c=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments;c.forEach(function(M){var F;(!M.initSegment||M.initSegment.relurl===((F=w)===null||F===void 0?void 0:F.relurl))&&(M.initSegment=w)})}if(d.skippedSegments&&(d.deltaUpdateFailed=d.fragments.some(function(M){return!M}),d.deltaUpdateFailed)){R.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(x){R.logger.warn("discontinuity sliding from playlist, take drift into account");for(var v=0;v<a.length;v++)a[v].cc+=x}d.skippedSegments&&(d.startCC=d.fragments[0].cc),T(s.partList,d.partList,function(M,F){F.elementaryStreams=M.elementaryStreams,F.stats=M.stats}),h?O(d,h,h.startPTS,h.endPTS,h.startDTS,h.endDTS):C(s,d),a.length&&(d.totalduration=d.edge-a[0].start),d.driftStartTime=s.driftStartTime,d.driftStart=s.driftStart;var p=d.advancedDateTime;if(d.advanced&&p){var b=d.edge;d.driftStart||(d.driftStartTime=p,d.driftStart=b),d.driftEndTime=p,d.driftEnd=b}else d.driftEndTime=s.driftEndTime,d.driftEnd=s.driftEnd,d.advancedDateTime=s.advancedDateTime}function T(s,d,w){if(s&&d)for(var f=0,m=0,L=s.length;m<=L;m++){var x=s[m],h=d[m+f];x&&h&&x.index===h.index&&x.fragment.sn===h.fragment.sn?w(x,h):f--}}function _(s,d,w){for(var f=d.skippedSegments,m=Math.max(s.startSN,d.startSN)-d.startSN,L=(s.fragmentHint?1:0)+(f?d.endSN:Math.min(s.endSN,d.endSN))-d.startSN,x=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<=L;u++){var a=c[x+u],v=h[u];f&&!v&&u<f&&(v=d.fragments[u]=a),a&&v&&w(a,v)}}function C(s,d){var w=d.startSN+d.skippedSegments-s.startSN,f=s.fragments;if(w<0||w>=f.length)return;y(d,f[w].start)}function y(s,d){if(d){for(var w=s.fragments,f=s.skippedSegments;f<w.length;f++)w[f].start+=d;s.fragmentHint&&(s.fragmentHint.start+=d)}}function g(s,d){var w=1e3*s.levelTargetDuration,f=w/2,m=s.age,L=m>0&&m<w*3,x=d.loading.end-d.loading.start,h,c=s.availabilityDelay;if(s.updated===!1)if(L){var u=333*s.misses;h=Math.max(Math.min(f,x*2),u),s.availabilityDelay=(s.availabilityDelay||0)+h}else h=f;else L?(c=Math.min(c||w/2,m),s.availabilityDelay=c,h=c+w-m):h=w-x;return Math.round(h)}function l(s,d,w){if(!s||!s.details)return null;var f=s.details,m=f.fragments[d-f.startSN];return m||(m=f.fragmentHint,m&&m.sn===d?m:d<f.startSN&&w&&w.sn===d?w:null)}function o(s,d,w){if(!s||!s.details)return null;var f=s.details.partList;if(f)for(var m=f.length;m--;){var L=f[m];if(L.index===w&&L.fragment.sn===d)return L}return null}},"./src/controller/stream-controller.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"default",function(){return f});var W=D("./src/polyfills/number.ts"),R=D("./src/controller/base-stream-controller.ts"),P=D("./src/is-supported.ts"),N=D("./src/events.ts"),k=D("./src/utils/buffer-helper.ts"),A=D("./src/controller/fragment-tracker.ts"),O=D("./src/types/loader.ts"),E=D("./src/loader/fragment.ts"),T=D("./src/demux/transmuxer-interface.ts"),_=D("./src/types/transmuxer.ts"),C=D("./src/controller/gap-controller.ts"),y=D("./src/errors.ts"),g=D("./src/utils/logger.ts");function l(m,L){for(var x=0;x<L.length;x++){var h=L[x];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(m,h.key,h)}}function o(m,L,x){return L&&l(m.prototype,L),x&&l(m,x),m}function s(m,L){m.prototype=Object.create(L.prototype),m.prototype.constructor=m,d(m,L)}function d(m,L){return d=Object.setPrototypeOf||function(h,c){return h.__proto__=c,h},d(m,L)}var w=100,f=function(m){s(L,m);function L(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 x=L.prototype;return x._registerListeners=function(){var c=this.hls;c.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(N.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(N.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(N.Events.ERROR,this.onError,this),c.on(N.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(N.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(N.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(N.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(N.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x._unregisterListeners=function(){var c=this.hls;c.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(N.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(N.Events.ERROR,this.onError,this),c.off(N.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(N.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(N.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(N.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(N.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},x.startLoad=function(c){if(this.levels){var u=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(w),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var v=a.startLevel;v===-1&&(a.config.testBandwidth?(v=0,this.bitrateTest=!0):v=a.nextAutoLevel),this.level=a.nextLoadLevel=v,this.loadedmetadata=!1}u>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),c=u),this.state=R.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=R.State.STOPPED},x.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},x.doTick=function(){switch(this.state){case R.State.IDLE:this.doTickIdle();break;case R.State.WAITING_LEVEL:{var c,u=this.levels,a=this.level,v=u==null||((c=u[a])===null||c===void 0)?void 0:c.details;if(v&&(!v.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(v))break;this.state=R.State.IDLE;break}break}case R.State.FRAG_LOADING_WAITING_RETRY:{var p,b=self.performance.now(),M=this.retryDate;(!M||b>=M||(p=this.media)!==null&&p!==void 0&&p.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=R.State.IDLE)}break;default:break}this.onTickEnd()},x.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},x.doTickIdle=function(){var c,u,a=this.hls,v=this.levelLastLoaded,p=this.levels,b=this.media,M=a.config,F=a.nextLoadLevel;if(v===null||!b&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!p||!p[F])return;var H=p[F];this.level=a.nextLoadLevel=F;var X=H.details;if(!X||this.state===R.State.WAITING_LEVEL||X.live&&this.levelLastLoaded!==F){this.state=R.State.WAITING_LEVEL;return}var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:b,O.PlaylistLevelType.MAIN);if(B===null)return;var U=B.len,z=this.getMaxBufferLength(H.maxBitrate);if(U>=z)return;if(this._streamEnded(B,X)){var Z={};this.altAudio&&(Z.type="video"),this.hls.trigger(N.Events.BUFFER_EOS,Z),this.state=R.State.ENDED;return}var ie=B.end,se=this.getNextFragment(ie,X);if(this.couldBacktrack&&!this.fragPrevious&&se&&se.sn!=="initSegment"){var Te=se.sn-X.startSN;Te>1&&(se=X.fragments[Te-1],this.fragmentTracker.removeFragment(se))}if(se&&this.fragmentTracker.getState(se)===A.FragmentState.OK&&this.nextLoadPosition>ie){var he=this.audioOnly&&!this.altAudio?E.ElementaryStreamTypes.AUDIO:E.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(b,he,O.PlaylistLevelType.MAIN),se=this.getNextFragment(this.nextLoadPosition,X)}if(!se)return;se.initSegment&&!se.initSegment.data&&!this.bitrateTest&&(se=se.initSegment),((c=se.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((u=se.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(se,X):this.loadFragment(se,X,ie)},x.loadFragment=function(c,u,a){var v,p=this.fragmentTracker.getState(c);if(this.fragCurrent=c,p===A.FragmentState.BACKTRACKED){var b=this.fragmentTracker.getBacktrackData(c);if(b){this._handleFragmentLoadProgress(b),this._handleFragmentLoadComplete(b);return}else p=A.FragmentState.NOT_LOADED}p===A.FragmentState.NOT_LOADED||p===A.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)):p===A.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((v=this.media)===null||v===void 0?void 0:v.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},x.getAppendedFrag=function(c){var u=this.fragmentTracker.getAppendedFrag(c,O.PlaylistLevelType.MAIN);return u&&"fragment"in u?u.fragment:u},x.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,O.PlaylistLevelType.MAIN)},x.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},x.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},x.nextLevelSwitch=function(){var c=this.levels,u=this.media;if(u!=null&&u.readyState){var a,v=this.getAppendedFrag(u.currentTime);if(v&&v.start>1&&this.flushMainBuffer(0,v.start-1),!u.paused&&c){var p=this.hls.nextLoadLevel,b=c[p],M=this.fragLastKbps;M&&this.fragCurrent?a=this.fragCurrent.duration*b.maxBitrate/(1e3*M)+1:a=0}else a=0;var F=this.getBufferedFrag(u.currentTime+a);if(F){var H=this.followingBufferedFrag(F);if(H){this.abortCurrentFrag();var X=H.maxStartPTS?H.maxStartPTS:H.start,B=H.duration,U=Math.max(F.end,X+Math.min(Math.max(B-this.config.maxFragLookUpTolerance,B*.5),B*.75));this.flushMainBuffer(U,Number.POSITIVE_INFINITY)}}}},x.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===R.State.KEY_LOADING&&(this.state=R.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},x.flushMainBuffer=function(c,u){m.prototype.flushMainBuffer.call(this,c,u,this.altAudio?"video":null)},x.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 C.default(this.config,a,this.fragmentTracker,this.hls)},x.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),m.prototype.onMediaDetaching.call(this)},x.onMediaPlaying=function(){this.tick()},x.onMediaSeeked=function(){var c=this.media,u=c?c.currentTime:null;Object(W.isFiniteNumber)(u)&&this.log("Media seeked to "+u.toFixed(3)),this.tick()},x.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(N.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},x.onManifestParsed=function(c,u){var a=!1,v=!1,p;u.levels.forEach(function(b){p=b.audioCodec,p&&(p.indexOf("mp4a.40.2")!==-1&&(a=!0),p.indexOf("mp4a.40.5")!==-1&&(v=!0))}),this.audioCodecSwitch=a&&v&&!Object(P.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},x.onLevelLoading=function(c,u){var a=this.levels;if(!a||this.state!==R.State.IDLE)return;var v=a[u.level];(!v.details||v.details.live&&this.levelLastLoaded!==u.level||this.waitForCdnTuneIn(v.details))&&(this.state=R.State.WAITING_LEVEL)},x.onLevelLoaded=function(c,u){var a,v=this.levels,p=u.level,b=u.details,M=b.totalduration;if(!v){this.warn("Levels were reset while loading level "+p);return}this.log("Level "+p+" loaded ["+b.startSN+","+b.endSN+"], cc ["+b.startCC+", "+b.endCC+"] duration:"+M);var F=this.fragCurrent;F&&(this.state===R.State.FRAG_LOADING||this.state===R.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==u.level&&F.loader&&(this.state=R.State.IDLE,F.loader.abort()));var H=v[p],X=0;if(b.live||(a=H.details)!==null&&a!==void 0&&a.live){if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed)return;X=this.alignPlaylists(b,H.details)}if(H.details=b,this.levelLastLoaded=p,this.hls.trigger(N.Events.LEVEL_UPDATED,{details:b,level:p}),this.state===R.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(b))return;this.state=R.State.IDLE}this.startFragRequested?b.live&&this.synchronizeToLiveEdge(b):this.setStartPosition(b,X),this.tick()},x._handleFragmentLoadProgress=function(c){var u,a=c.frag,v=c.part,p=c.payload,b=this.levels;if(!b){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var M=b[a.level],F=M.details;if(!F){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var H=M.videoCodec,X=F.PTSKnown||!F.live,B=(u=a.initSegment)===null||u===void 0?void 0:u.data,U=this._getAudioCodec(M),z=this.transmuxer=this.transmuxer||new T.default(this.hls,O.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Z=v?v.index:-1,ie=Z!==-1,se=new _.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,p.byteLength,Z,ie),Te=this.initPTS[a.cc];z.push(p,B,U,H,a,v,F.totalduration,X,se,Te)},x.onAudioTrackSwitching=function(c,u){var a=this.altAudio,v=!!u.url,p=u.id;if(!v){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var b=this.fragCurrent;b!=null&&b.loader&&(this.log("Switching to main audio track, cancel main fragment load"),b.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var M=this.hls;a&&M.trigger(N.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),M.trigger(N.Events.AUDIO_TRACK_SWITCHED,{id:p})}},x.onAudioTrackSwitched=function(c,u){var a=u.id,v=!!this.hls.audioTracks[a].url;if(v){var p=this.videoBuffer;p&&this.mediaBuffer!==p&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=p)}this.altAudio=v,this.tick()},x.onBufferCreated=function(c,u){var a=u.tracks,v,p,b=!1;for(var M in a){var F=a[M];if(F.id==="main"){if(p=M,v=F,M==="video"){var H=a[M];H&&(this.videoBuffer=H.buffer)}}else b=!0}b&&v?(this.log("Alternate track found, use "+p+".buffered to schedule main fragment loading"),this.mediaBuffer=v.buffer):this.mediaBuffer=this.media},x.onFragBuffered=function(c,u){var a=u.frag,v=u.part;if(a&&a.type!==O.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(v?" p: "+v.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===R.State.PARSED&&(this.state=R.State.IDLE);return}var p=v?v.stats:a.stats;this.fragLastKbps=Math.round(8*p.total/(p.buffering.end-p.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,v)},x.onError=function(c,u){switch(u.details){case y.ErrorDetails.FRAG_LOAD_ERROR:case y.ErrorDetails.FRAG_LOAD_TIMEOUT:case y.ErrorDetails.KEY_LOAD_ERROR:case y.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(O.PlaylistLevelType.MAIN,u);break;case y.ErrorDetails.LEVEL_LOAD_ERROR:case y.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==R.State.ERROR&&(u.fatal?(this.warn(""+u.details),this.state=R.State.ERROR):!u.levelRetry&&this.state===R.State.WAITING_LEVEL&&(this.state=R.State.IDLE));break;case y.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="main"&&(this.state===R.State.PARSING||this.state===R.State.PARSED)){var a=!0,v=this.getFwdBufferInfo(this.media,O.PlaylistLevelType.MAIN);v&&v.len>.5&&(a=!this.reduceMaxBufferLength(v.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},x.checkBuffer=function(){var c=this.media,u=this.gapController;if(!c||!u||!c.readyState)return;var a=k.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):u.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},x.onFragLoadEmergencyAborted=function(){this.state=R.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},x.onBufferFlushed=function(c,u){var a=u.type;if(a!==E.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var v=(a===E.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(v,a,O.PlaylistLevelType.MAIN)}},x.onLevelsUpdated=function(c,u){this.levels=u.levels},x.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},x.seekToStartPos=function(){var c=this.media,u=c.currentTime,a=this.startPosition;if(a>=0&&u<a){if(c.seeking){g.logger.log("could not seek to "+a+", already seeking at "+u);return}var v=k.BufferHelper.getBuffered(c),p=v.length?v.start(0):0,b=p-a;b>0&&(b<this.config.maxBufferHole||b<this.config.maxFragLookUpTolerance)&&(g.logger.log("adjusting start position by "+b+" to match buffer start"),a+=b,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+u),c.currentTime=a}},x._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},x._loadBitrateTestFrag=function(c){var u=this;this._doFragLoad(c).then(function(a){var v=u.hls;if(!a||v.nextLoadLevel||u.fragContextChanged(c))return;u.fragLoadError=0,u.state=R.State.IDLE,u.startFragRequested=!1,u.bitrateTest=!1;var p=c.stats;p.parsing.start=p.parsing.end=p.buffering.start=p.buffering.end=self.performance.now(),v.trigger(N.Events.FRAG_LOADED,a)})},x._handleTransmuxComplete=function(c){var u,a="main",v=this.hls,p=c.remuxResult,b=c.chunkMeta,M=this.getCurrentContext(b);if(!M){this.warn("The loading context changed while buffering fragment "+b.sn+" of level "+b.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(b.level);return}var F=M.frag,H=M.part,X=M.level,B=p.video,U=p.text,z=p.id3,Z=p.initSegment,ie=this.altAudio?void 0:p.audio;if(this.fragContextChanged(F))return;if(this.state=R.State.PARSING,Z){Z.tracks&&(this._bufferInitSegment(X,Z.tracks,F,b),v.trigger(N.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:a,tracks:Z.tracks}));var se=Z.initPTS,Te=Z.timescale;Object(W.isFiniteNumber)(se)&&(this.initPTS[F.cc]=se,v.trigger(N.Events.INIT_PTS_FOUND,{frag:F,id:a,initPTS:se,timescale:Te}))}if(B&&p.independent!==!1){if(X.details){var he=B.startPTS,xe=B.endPTS,pe=B.startDTS,ge=B.endDTS;if(H)H.elementaryStreams[B.type]={startPTS:he,endPTS:xe,startDTS:pe,endDTS:ge};else if(B.firstKeyFrame&&B.independent&&(this.couldBacktrack=!0),B.dropped&&B.independent){var le=this.getLoadPosition()+this.config.maxBufferHole;if(le<he){this.backtrack(F);return}F.setElementaryStreamInfo(B.type,F.start,xe,F.start,ge,!0)}F.setElementaryStreamInfo(B.type,he,xe,pe,ge),this.bufferFragmentData(B,F,H,b)}}else if(p.independent===!1){this.backtrack(F);return}if(ie){var ue=ie.startPTS,Le=ie.endPTS,Fe=ie.startDTS,Ie=ie.endDTS;H&&(H.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:Le,startDTS:Fe,endDTS:Ie}),F.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,ue,Le,Fe,Ie),this.bufferFragmentData(ie,F,H,b)}if(z!=null&&(u=z.samples)!==null&&u!==void 0&&u.length){var Ne={frag:F,id:a,samples:z.samples};v.trigger(N.Events.FRAG_PARSING_METADATA,Ne)}if(U){var Ue={frag:F,id:a,samples:U.samples};v.trigger(N.Events.FRAG_PARSING_USERDATA,Ue)}},x._bufferInitSegment=function(c,u,a,v){var p=this;if(this.state!==R.State.PARSING)return;this.audioOnly=!!u.audio&&!u.video,this.altAudio&&!this.audioOnly&&delete u.audio;var b=u.audio,M=u.video,F=u.audiovideo;if(b){var H=c.audioCodec,X=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(H&&(H.indexOf("mp4a.40.5")!==-1?H="mp4a.40.2":H="mp4a.40.5"),b.metadata.channelCount!==1&&X.indexOf("firefox")===-1&&(H="mp4a.40.5")),X.indexOf("android")!==-1&&b.container!=="audio/mpeg"&&(H="mp4a.40.2",this.log("Android: force audio codec to "+H)),c.audioCodec&&c.audioCodec!==H&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+H+'"'),b.levelCodec=H,b.id="main",this.log("Init audio buffer, container:"+b.container+", codecs[selected/level/parsed]=["+(H||"")+"/"+(c.audioCodec||"")+"/"+b.codec+"]")}M&&(M.levelCodec=c.videoCodec,M.id="main",this.log("Init video buffer, container:"+M.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+M.codec+"]")),F&&this.log("Init audiovideo buffer, container:"+F.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+F.codec+"]"),this.hls.trigger(N.Events.BUFFER_CODECS,u),Object.keys(u).forEach(function(B){var U=u[B],z=U.initSegment;z!=null&&z.byteLength&&p.hls.trigger(N.Events.BUFFER_APPENDING,{type:B,data:z,frag:a,part:null,chunkMeta:v,parent:a.type})}),this.tick()},x.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=R.State.BACKTRACKING},x.checkFragmentChanged=function(){var c=this.media,u=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(k.BufferHelper.isBuffered(c,a)?u=this.getAppendedFrag(a):k.BufferHelper.isBuffered(c,a+.1)&&(u=this.getAppendedFrag(a+.1)),u){var v=this.fragPlaying,p=u.level;(!v||u.sn!==v.sn||v.level!==p||u.urlId!==v.urlId)&&(this.hls.trigger(N.Events.FRAG_CHANGED,{frag:u}),(!v||v.level!==p)&&this.hls.trigger(N.Events.LEVEL_SWITCHED,{level:p}),this.fragPlaying=u)}}},o(L,[{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}}]),L}(R.default)},"./src/controller/subtitle-stream-controller.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"SubtitleStreamController",function(){return s});var W=D("./src/events.ts"),R=D("./src/utils/logger.ts"),P=D("./src/utils/buffer-helper.ts"),N=D("./src/controller/fragment-finders.ts"),k=D("./src/utils/discontinuities.ts"),A=D("./src/controller/level-helper.ts"),O=D("./src/controller/fragment-tracker.ts"),E=D("./src/controller/base-stream-controller.ts"),T=D("./src/types/loader.ts"),_=D("./src/types/level.ts");function C(d,w){for(var f=0;f<w.length;f++){var m=w[f];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(d,m.key,m)}}function y(d,w,f){return w&&C(d.prototype,w),f&&C(d,f),d}function g(d,w){d.prototype=Object.create(w.prototype),d.prototype.constructor=d,l(d,w)}function l(d,w){return l=Object.setPrototypeOf||function(m,L){return m.__proto__=L,m},l(d,w)}var o=500,s=function(d){g(w,d);function w(m,L){var x;return x=d.call(this,m,L,"[subtitle-stream-controller]")||this,x.levels=[],x.currentTrackId=-1,x.tracksBuffered=[],x.mainDetails=null,x._registerListeners(),x}var f=w.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var L=this.hls;L.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.on(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.on(W.Events.ERROR,this.onError,this),L.on(W.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.on(W.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.on(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.on(W.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.on(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f._unregisterListeners=function(){var L=this.hls;L.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.off(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.off(W.Events.ERROR,this.onError,this),L.off(W.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.off(W.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.off(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.off(W.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.off(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f.startLoad=function(){this.stopLoad(),this.state=E.State.IDLE,this.setInterval(o),this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},f.onLevelLoaded=function(L,x){this.mainDetails=x.details},f.onSubtitleFragProcessed=function(L,x){var h=x.frag,c=x.success;if(this.fragPrevious=h,this.state=E.State.IDLE,!c)return;var u=this.tracksBuffered[this.currentTrackId];if(!u)return;for(var a,v=h.start,p=0;p<u.length;p++)if(v>=u[p].start&&v<=u[p].end){a=u[p];break}var b=h.start+h.duration;a?a.end=b:(a={start:v,end:b},u.push(a)),this.fragmentTracker.fragBuffered(h)},f.onBufferFlushing=function(L,x){var h=x.startOffset,c=x.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 v=a[u].details,p=v.targetduration,b=c-p;if(b<=0)return;x.endOffsetSubtitles=Math.max(0,b),this.tracksBuffered.forEach(function(M){for(var F=0;F<M.length;){if(M[F].end<=b){M.shift();continue}else if(M[F].start<b)M[F].start=b;else break;F++}}),this.fragmentTracker.removeFragmentsInRange(h,b,T.PlaylistLevelType.SUBTITLE)}},f.onError=function(L,x){var h,c=x.frag;if(!c||c.type!==T.PlaylistLevelType.SUBTITLE)return;(h=this.fragCurrent)!==null&&h!==void 0&&h.loader&&this.fragCurrent.loader.abort(),this.state=E.State.IDLE},f.onSubtitleTracksUpdated=function(L,x){var h=this,c=x.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(u){return new _.Level(u)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(u){h.tracksBuffered[u.id]=[]}),this.mediaBuffer=null},f.onSubtitleTrackSwitch=function(L,x){if(this.currentTrackId=x.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)},f.onSubtitleTrackLoaded=function(L,x){var h,c=x.details,u=x.id,a=this.currentTrackId,v=this.levels;if(!v.length)return;var p=v[a];if(u>=v.length||u!==a||!p)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(h=p.details)!==null&&h!==void 0&&h.live){var b=this.mainDetails;if(c.deltaUpdateFailed||!b)return;var M=b.fragments[0];if(!p.details)c.hasProgramDateTime&&b.hasProgramDateTime?Object(k.alignMediaPlaylistByPDT)(c,b):M&&Object(A.addSliding)(c,M.start);else{var F=this.alignPlaylists(c,p.details);F===0&&M&&Object(A.addSliding)(c,M.start)}}if(p.details=c,this.levelLastLoaded=u,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===E.State.IDLE){var H=Object(N.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);H||(this.warn("Subtitle playlist not aligned with playback"),p.details=void 0)}},f._handleFragmentLoadComplete=function(L){var x=L.frag,h=L.payload,c=x.decryptdata,u=this.hls;if(this.fragContextChanged(x))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(v){var p=performance.now();u.trigger(W.Events.FRAG_DECRYPTED,{frag:x,payload:v,stats:{tstart:a,tdecrypt:p}})})}},f.doTick=function(){if(!this.media){this.state=E.State.IDLE;return}if(this.state===E.State.IDLE){var L,x=this.currentTrackId,h=this.levels;if(!h.length||!h[x]||!h[x].details)return;var c=h[x].details,u=c.targetduration,a=this.config,v=this.media,p=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,v.currentTime-u,a.maxBufferHole),b=p.end,M=p.len,F=this.getMaxBufferLength()+u;if(M>F)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var H=c.fragments,X=H.length,B=c.edge,U,z=this.fragPrevious;if(b<B){var Z=a.maxFragLookUpTolerance;z&&c.hasProgramDateTime&&(U=Object(N.findFragmentByPDT)(H,z.endProgramDateTime,Z)),U||(U=Object(N.findFragmentByPTS)(z,H,b,Z),!U&&z&&z.start<H[0].start&&(U=H[0]))}else U=H[X-1];(L=U)!==null&&L!==void 0&&L.encrypted?(R.logger.log("Loading key for "+U.sn),this.state=E.State.KEY_LOADING,this.hls.trigger(W.Events.KEY_LOADING,{frag:U})):U&&this.fragmentTracker.getState(U)===O.FragmentState.NOT_LOADED&&this.loadFragment(U,c,b)}},f.loadFragment=function(L,x,h){this.fragCurrent=L,d.prototype.loadFragment.call(this,L,x,h)},y(w,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),w}(E.default)},"./src/controller/subtitle-track-controller.ts":function(ee,G,D){"use strict";D.r(G);var W=D("./src/events.ts"),R=D("./src/utils/texttrack-utils.ts"),P=D("./src/controller/base-playlist-controller.ts"),N=D("./src/types/loader.ts");function k(C,y){for(var g=0;g<y.length;g++){var l=y[g];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(C,l.key,l)}}function A(C,y,g){return y&&k(C.prototype,y),g&&k(C,g),C}function O(C,y){C.prototype=Object.create(y.prototype),C.prototype.constructor=C,E(C,y)}function E(C,y){return E=Object.setPrototypeOf||function(l,o){return l.__proto__=o,l},E(C,y)}var T=function(C){O(y,C);function y(l){var o;return o=C.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 g=y.prototype;return g.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,C.prototype.destroy.call(this)},g.registerListeners=function(){var o=this.hls;o.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(W.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){var o=this.hls;o.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(W.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(W.Events.ERROR,this.onError,this)},g.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)},g.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},g.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=_(this.media.textTracks);o.forEach(function(s){Object(R.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},g.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},g.onManifestParsed=function(o,s){this.tracks=s.subtitleTracks},g.onSubtitleTrackLoaded=function(o,s){var d=s.id,w=s.details,f=this.trackId,m=this.tracksInGroup[f];if(!m){this.warn("Invalid subtitle track id "+d);return}var L=m.details;m.details=s.details,this.log("subtitle track "+d+" loaded ["+w.startSN+"-"+w.endSN+"]"),d===this.trackId&&(this.retryCount=0,this.playlistLoaded(d,s,L))},g.onLevelLoading=function(o,s){this.switchLevel(s.level)},g.onLevelSwitching=function(o,s){this.switchLevel(s.level)},g.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 w=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,f=this.tracks.filter(function(x){return!d||x.groupId===d});this.tracksInGroup=f;var m=this.findTrackId(w==null?void 0:w.name)||this.findTrackId();this.groupId=d;var L={subtitleTracks:f};this.log("Updating subtitle tracks, "+f.length+' track(s) found in "'+d+'" group-id'),this.hls.trigger(W.Events.SUBTITLE_TRACKS_UPDATED,L),m!==-1&&this.setSubtitleTrack(m,w)}},g.findTrackId=function(o){for(var s=this.tracksInGroup,d=0;d<s.length;d++){var w=s[d];if((!this.selectDefaultTrack||w.default)&&(!o||o===w.name))return w.id}return-1},g.onError=function(o,s){if(C.prototype.onError.call(this,o,s),s.fatal||!s.context)return;s.context.type===N.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},g.loadPlaylist=function(o){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var d=s.id,w=s.groupId,f=s.url;if(o)try{f=o.addDirectives(f)}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(W.Events.SUBTITLE_TRACK_LOADING,{url:f,id:d,groupId:w,deliveryDirectives:o||null})}},g.toggleTrackModes=function(o){var s=this,d=this.media,w=this.subtitleDisplay,f=this.trackId;if(!d)return;var m=_(d.textTracks),L=m.filter(function(c){return c.groupId===s.groupId});if(o===-1)[].slice.call(m).forEach(function(c){c.mode="disabled"});else{var x=L[f];x&&(x.mode="disabled")}var h=L[o];h&&(h.mode=w?"showing":"hidden")},g.setSubtitleTrack=function(o,s){var d,w=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(d=w[o])!==null&&d!==void 0&&d.details)||o<-1||o>=w.length)return;this.clearTimer();var f=w[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,f){var m=f.id,L=f.groupId,x=L===void 0?"":L,h=f.name,c=f.type,u=f.url;this.hls.trigger(W.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:x,name:h,type:c,url:u});var a=this.switchParams(f.url,s==null?void 0:s.details);this.loadPlaylist(a)}else this.hls.trigger(W.Events.SUBTITLE_TRACK_SWITCH,{id:o})},g.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,s=_(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)},A(y,[{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)}}]),y}(P.default);function _(C){for(var y=[],g=0;g<C.length;g++){var l=C[g];l.kind==="subtitles"&&l.label&&y.push(C[g])}return y}G.default=T},"./src/controller/timeline-controller.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"TimelineController",function(){return _});var W=D("./src/polyfills/number.ts"),R=D("./src/events.ts"),P=D("./src/utils/cea-608-parser.ts"),N=D("./src/utils/output-filter.ts"),k=D("./src/utils/webvtt-parser.ts"),A=D("./src/utils/texttrack-utils.ts"),O=D("./src/utils/imsc1-ttml-parser.ts"),E=D("./src/types/loader.ts"),T=D("./src/utils/logger.ts"),_=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=g(),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 N.default(this,"textTrack1"),w=new N.default(this,"textTrack2"),f=new N.default(this,"textTrack3"),m=new N.default(this,"textTrack4");this.cea608Parser1=new P.default(1,d,w),this.cea608Parser2=new P.default(3,f,m)}s.on(R.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(R.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(R.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(R.Events.FRAG_LOADING,this.onFragLoading,this),s.on(R.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(R.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(R.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(R.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(R.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=l.prototype;return o.destroy=function(){var d=this.hls;d.off(R.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(R.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(R.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),d.off(R.Events.FRAG_LOADING,this.onFragLoading,this),d.off(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(R.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),d.off(R.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),d.off(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(R.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),d.off(R.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(d,w,f,m,L){for(var x=!1,h=L.length;h--;){var c=L[h],u=y(c[0],c[1],w,f);if(u>=0&&(c[0]=Math.min(c[0],w),c[1]=Math.max(c[1],f),x=!0,u/(f-w)>.5))return}if(x||L.push([w,f]),this.config.renderTextTracksNatively){var a=this.captionsTracks[d];this.Cues.newCue(a,w,f,m)}else{var v=this.Cues.newCue(null,w,f,m);this.hls.trigger(R.Events.CUES_PARSED,{type:"captions",cues:v,track:d})}},o.onInitPtsFound=function(d,w){var f=this,m=w.frag,L=w.id,x=w.initPTS,h=w.timescale,c=this.unparsedVttFrags;L==="main"&&(this.initPTS[m.cc]=x,this.timescale[m.cc]=h),c.length&&(this.unparsedVttFrags=[],c.forEach(function(u){f.onFragLoaded(R.Events.FRAG_LOADED,u)}))},o.getExistingTrack=function(d){var w=this.media;if(w)for(var f=0;f<w.textTracks.length;f++){var m=w.textTracks[f];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 w=this.captionsProperties,f=this.captionsTracks,m=this.media,L=w[d],x=L.label,h=L.languageCode,c=this.getExistingTrack(d);if(c)f[d]=c,Object(A.clearCurrentCues)(f[d]),Object(A.sendAddTrackEvent)(f[d],m);else{var u=this.createTextTrack("captions",x,h);u&&(u[d]=!0,f[d]=u)}},o.createNonNativeTrack=function(d){if(this.nonNativeCaptionsTracks[d])return;var w=this.captionsProperties[d];if(!w)return;var f=w.label,m={_id:d,label:f,kind:"captions",default:w.media?!!w.media.default:!1,closedCaptions:w.media};this.nonNativeCaptionsTracks[d]=m,this.hls.trigger(R.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[m]})},o.createTextTrack=function(d,w,f){var m=this.media;return m?m.addTextTrack(d,w,f):void 0},o.onMediaAttaching=function(d,w){this.media=w.media,this._cleanTracks()},o.onMediaDetaching=function(){var d=this.captionsTracks;Object.keys(d).forEach(function(w){Object(A.clearCurrentCues)(d[w]),delete d[w]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=g(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var d=this.media;if(!d)return;var w=d.textTracks;if(w)for(var f=0;f<w.length;f++)Object(A.clearCurrentCues)(w[f])},o.onSubtitleTracksUpdated=function(d,w){var f=this;this.textTracks=[];var m=w.subtitleTracks||[],L=m.some(function(u){return u.textCodec===O.IMSC1_CODEC});if(this.config.enableWebVTT||L&&this.config.enableIMSC1){var x=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 v;if(a<h.length){for(var p=null,b=0;b<h.length;b++)if(C(h[b],u)){p=h[b];break}p&&(v=p)}v?Object(A.clearCurrentCues)(v):(v=f.createTextTrack("subtitles",u.name,u.lang),v&&(v.mode="disabled")),v&&(v.groupId=u.groupId,f.textTracks.push(v))})}else if(!x&&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(R.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(d,w){var f=this;this.config.enableCEA708Captions&&w.captions&&w.captions.forEach(function(m){var L=/(?:CC|SERVICE)([1-4])/.exec(m.instreamId);if(!L)return;var x="textTrack"+L[1],h=f.captionsProperties[x];if(!h)return;h.label=m.name,m.lang&&(h.languageCode=m.lang),h.media=m})},o.onFragLoading=function(d,w){var f=this.cea608Parser1,m=this.cea608Parser2,L=this.lastSn,x=this.lastPartIndex;if(!this.enabled||!(f&&m))return;if(w.frag.type===E.PlaylistLevelType.MAIN){var h,c,u=w.frag.sn,a=(h=w==null||((c=w.part)===null||c===void 0)?void 0:c.index)!=null?h:-1;u===L+1||u===L&&a===x+1||(f.reset(),m.reset()),this.lastSn=u,this.lastPartIndex=a}},o.onFragLoaded=function(d,w){var f=w.frag,m=w.payload,L=this.initPTS,x=this.unparsedVttFrags;if(f.type===E.PlaylistLevelType.SUBTITLE)if(m.byteLength){if(!Object(W.isFiniteNumber)(L[f.cc])){x.push(w),L.length&&this.hls.trigger(R.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Missing initial subtitle PTS")});return}var h=f.decryptdata;if(h==null||h.key==null||h.method!=="AES-128"){var c=this.tracks[f.level],u=this.vttCCs;u[f.cc]||(u[f.cc]={start:f.start,prevCC:this.prevCC,new:!0},this.prevCC=f.cc),c&&c.textCodec===O.IMSC1_CODEC?this._parseIMSC1(f,m):this._parseVTTs(f,m,u)}}else this.hls.trigger(R.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(d,w){var f=this,m=this.hls;Object(O.parseIMSC1)(w,this.initPTS[d.cc],this.timescale[d.cc],function(L){f._appendCues(L,d.level),m.trigger(R.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(L){T.logger.log("Failed to parse IMSC1: "+L),m.trigger(R.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:L})})},o._parseVTTs=function(d,w,f){var m=this,L=this.hls;Object(k.parseWebVTT)(w,this.initPTS[d.cc],this.timescale[d.cc],f,d.cc,d.start,function(x){m._appendCues(x,d.level),L.trigger(R.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(x){m._fallbackToIMSC1(d,w),T.logger.log("Failed to parse VTT cue: "+x),L.trigger(R.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:x})})},o._fallbackToIMSC1=function(d,w){var f=this,m=this.tracks[d.level];m.textCodec||Object(O.parseIMSC1)(w,this.initPTS[d.cc],this.timescale[d.cc],function(){m.textCodec=O.IMSC1_CODEC,f._parseIMSC1(d,w)},function(){m.textCodec="wvtt"})},o._appendCues=function(d,w){var f=this.hls;if(this.config.renderTextTracksNatively){var m=this.textTracks[w];if(m.mode==="disabled")return;d.forEach(function(h){return Object(A.addCueToTrack)(m,h)})}else{var L=this.tracks[w],x=L.default?"default":"subtitles"+w;f.trigger(R.Events.CUES_PARSED,{type:"subtitles",cues:d,track:x})}},o.onFragDecrypted=function(d,w){var f=w.frag;if(f.type===E.PlaylistLevelType.SUBTITLE){if(!Object(W.isFiniteNumber)(this.initPTS[f.cc])){this.unparsedVttFrags.push(w);return}this.onFragLoaded(R.Events.FRAG_LOADED,w)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(d,w){var f=this.cea608Parser1,m=this.cea608Parser2;if(!this.enabled||!(f&&m))return;for(var L=0;L<w.samples.length;L++){var x=w.samples[L].bytes;if(x){var h=this.extractCea608Data(x);f.addData(w.samples[L].pts,h[0]),m.addData(w.samples[L].pts,h[1])}}},o.onBufferFlushing=function(d,w){var f=w.startOffset,m=w.endOffset,L=w.endOffsetSubtitles,x=w.type,h=this.media;if(!h||h.currentTime<m)return;if(!x||x==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(A.removeCuesInRange)(c[a],f,m)})}if(this.config.renderTextTracksNatively&&(f===0&&L!==void 0)){var u=this.textTracks;Object.keys(u).forEach(function(a){return Object(A.removeCuesInRange)(u[a],f,L)})}},o.extractCea608Data=function(d){for(var w=d[0]&31,f=2,m=[[],[]],L=0;L<w;L++){var x=d[f++],h=127&d[f++],c=127&d[f++],u=(4&x)!==0,a=3&x;if(h===0&&c===0)continue;u&&((a===0||a===1)&&(m[a].push(h),m[a].push(c)))}return m},l}();function C(l,o){return l&&l.label===o.name&&!(l.textTrack1||l.textTrack2)}function y(l,o,s,d){return Math.min(o,d)-Math.max(l,s)}function g(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"default",function(){return W});var W=function(){function R(N,k){this.subtle=void 0,this.aesIV=void 0,this.subtle=N,this.aesIV=k}var P=R.prototype;return P.decrypt=function(k,A){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},A,k)},R}()},"./src/crypt/aes-decryptor.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"removePadding",function(){return R}),D.d(G,"default",function(){return P});var W=D("./src/utils/typed-array.ts");function R(N){var k=N.byteLength,A=k&&new DataView(N.buffer).getUint8(k-1);return A?Object(W.sliceUint8)(N,0,k-A):N}var P=function(){function N(){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 k=N.prototype;return k.uint8ArrayToUint32Array_=function(O){for(var E=new DataView(O),T=new Uint32Array(4),_=0;_<4;_++)T[_]=E.getUint32(_*4);return T},k.initTable=function(){var O=this.sBox,E=this.invSBox,T=this.subMix,_=T[0],C=T[1],y=T[2],g=T[3],l=this.invSubMix,o=l[0],s=l[1],d=l[2],w=l[3],f=new Uint32Array(256),m=0,L=0,x=0;for(x=0;x<256;x++)x<128?f[x]=x<<1:f[x]=x<<1^283;for(x=0;x<256;x++){var h=L^L<<1^L<<2^L<<3^L<<4;h=h>>>8^h&255^99,O[m]=h,E[h]=m;var c=f[m],u=f[c],a=f[u],v=f[h]*257^h*16843008;_[m]=v<<24|v>>>8,C[m]=v<<16|v>>>16,y[m]=v<<8|v>>>24,g[m]=v,v=a*16843009^u*65537^c*257^m*16843008,o[h]=v<<24|v>>>8,s[h]=v<<16|v>>>16,d[h]=v<<8|v>>>24,w[h]=v,m?(m=c^f[f[f[a^c]]],L^=f[f[L]]):m=L=1}},k.expandKey=function(O){for(var E=this.uint8ArrayToUint32Array_(O),T=!0,_=0;_<E.length&&T;)T=E[_]===this.key[_],_++;if(T)return;this.key=E;var C=this.keySize=E.length;if(C!==4&&C!==6&&C!==8)throw new Error("Invalid aes key size="+C);var y=this.ksRows=(C+6+1)*4,g,l,o=this.keySchedule=new Uint32Array(y),s=this.invKeySchedule=new Uint32Array(y),d=this.sBox,w=this.rcon,f=this.invSubMix,m=f[0],L=f[1],x=f[2],h=f[3],c,u;for(g=0;g<y;g++){if(g<C){c=o[g]=E[g];continue}u=c,g%C===0?(u=u<<8|u>>>24,u=d[u>>>24]<<24|d[u>>>16&255]<<16|d[u>>>8&255]<<8|d[u&255],u^=w[g/C|0]<<24):C>6&&g%C===4&&(u=d[u>>>24]<<24|d[u>>>16&255]<<16|d[u>>>8&255]<<8|d[u&255]),o[g]=c=(o[g-C]^u)>>>0}for(l=0;l<y;l++)g=y-l,l&3?u=o[g]:u=o[g-4],l<4||g<=4?s[l]=u:s[l]=m[d[u>>>24]]^L[d[u>>>16&255]]^x[d[u>>>8&255]]^h[d[u&255]],s[l]=s[l]>>>0},k.networkToHostOrderSwap=function(O){return O<<24|(O&65280)<<8|(O&16711680)>>8|O>>>24},k.decrypt=function(O,E,T){for(var _=this.keySize+6,C=this.invKeySchedule,y=this.invSBox,g=this.invSubMix,l=g[0],o=g[1],s=g[2],d=g[3],w=this.uint8ArrayToUint32Array_(T),f=w[0],m=w[1],L=w[2],x=w[3],h=new Int32Array(O),c=new Int32Array(h.length),u,a,v,p,b,M,F,H,X,B,U,z,Z,ie,se=this.networkToHostOrderSwap;E<h.length;){for(X=se(h[E]),B=se(h[E+1]),U=se(h[E+2]),z=se(h[E+3]),b=X^C[0],M=z^C[1],F=U^C[2],H=B^C[3],Z=4,ie=1;ie<_;ie++)u=l[b>>>24]^o[M>>16&255]^s[F>>8&255]^d[H&255]^C[Z],a=l[M>>>24]^o[F>>16&255]^s[H>>8&255]^d[b&255]^C[Z+1],v=l[F>>>24]^o[H>>16&255]^s[b>>8&255]^d[M&255]^C[Z+2],p=l[H>>>24]^o[b>>16&255]^s[M>>8&255]^d[F&255]^C[Z+3],b=u,M=a,F=v,H=p,Z=Z+4;u=y[b>>>24]<<24^y[M>>16&255]<<16^y[F>>8&255]<<8^y[H&255]^C[Z],a=y[M>>>24]<<24^y[F>>16&255]<<16^y[H>>8&255]<<8^y[b&255]^C[Z+1],v=y[F>>>24]<<24^y[H>>16&255]<<16^y[b>>8&255]<<8^y[M&255]^C[Z+2],p=y[H>>>24]<<24^y[b>>16&255]<<16^y[M>>8&255]<<8^y[F&255]^C[Z+3],c[E]=se(u^f),c[E+1]=se(p^m),c[E+2]=se(v^L),c[E+3]=se(a^x),f=X,m=B,L=U,x=z,E=E+4}return c.buffer},N}()},"./src/crypt/decrypter.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"default",function(){return E});var W=D("./src/crypt/aes-crypto.ts"),R=D("./src/crypt/fast-aes-key.ts"),P=D("./src/crypt/aes-decryptor.ts"),N=D("./src/utils/logger.ts"),k=D("./src/utils/mp4-tools.ts"),A=D("./src/utils/typed-array.ts"),O=16,E=function(){function T(C,y,g){var l=g===void 0?{}:g,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=C,this.config=y,this.removePKCS7Padding=s,s)try{var d=self.crypto;d&&(this.subtle=d.subtle||d.webkitSubtle)}catch(w){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var _=T.prototype;return _.destroy=function(){this.observer=null},_.isSync=function(){return this.config.enableSoftwareAES},_.flush=function(){var y=this.currentResult;if(!y){this.reset();return}var g=new Uint8Array(y);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(g):g},_.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},_.decrypt=function(y,g,l,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(y),g,l);var s=this.flush();s&&o(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(y),g,l).then(o)},_.softwareDecrypt=function(y,g,l){var o=this.currentIV,s=this.currentResult,d=this.remainderData;this.logOnce("JS AES decrypt"),d&&(y=Object(k.appendUint8Array)(d,y),this.remainderData=null);var w=this.getValidChunk(y);if(!w.length)return null;o&&(l=o);var f=this.softwareDecrypter;f||(f=this.softwareDecrypter=new P.default),f.expandKey(g);var m=s;return this.currentResult=f.decrypt(w.buffer,0,l),this.currentIV=Object(A.sliceUint8)(w,-16).buffer,m||null},_.webCryptoDecrypt=function(y,g,l){var o=this,s=this.subtle;return(this.key!==g||!this.fastAesKey)&&(this.key=g,this.fastAesKey=new R.default(s,g)),this.fastAesKey.expandKey().then(function(d){if(!s)return Promise.reject(new Error("web crypto not initialized"));var w=new W.default(s,l);return w.decrypt(y.buffer,d)}).catch(function(d){return o.onWebCryptoError(d,y,g,l)})},_.onWebCryptoError=function(y,g,l,o){return N.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",y),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(g,l,o)},_.getValidChunk=function(y){var g=y,l=y.length-y.length%O;return l!==y.length&&(g=Object(A.sliceUint8)(y,0,l),this.remainderData=Object(A.sliceUint8)(y,l)),g},_.logOnce=function(y){if(!this.logEnabled)return;N.logger.log("[decrypter.ts]: "+y),this.logEnabled=!1},T}()},"./src/crypt/fast-aes-key.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"default",function(){return W});var W=function(){function R(N,k){this.subtle=void 0,this.key=void 0,this.subtle=N,this.key=k}var P=R.prototype;return P.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},R}()},"./src/demux/aacdemuxer.ts":function(ee,G,D){"use strict";D.r(G);var W=D("./src/demux/base-audio-demuxer.ts"),R=D("./src/demux/adts.ts"),P=D("./src/utils/logger.ts"),N=D("./src/demux/id3.ts");function k(E,T){E.prototype=Object.create(T.prototype),E.prototype.constructor=E,A(E,T)}function A(E,T){return A=Object.setPrototypeOf||function(C,y){return C.__proto__=y,C},A(E,T)}var O=function(E){k(T,E);function T(C,y){var g;return g=E.call(this)||this,g.observer=void 0,g.config=void 0,g.observer=C,g.config=y,g}var _=T.prototype;return _.resetInitSegment=function(y,g,l){E.prototype.resetInitSegment.call(this,y,g,l),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:y,duration:l,inputTimeScale:9e4,dropped:0}},T.probe=function(y){if(!y)return!1;for(var g=N.getID3Data(y,0)||[],l=g.length,o=y.length;l<o;l++)if(R.probe(y,l))return P.logger.log("ADTS sync word found !"),!0;return!1},_.canParse=function(y,g){return R.canParse(y,g)},_.appendFrame=function(y,g,l){R.initTrackConfig(y,this.observer,g,l,y.manifestCodec);var o=R.appendFrame(y,g,l,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},T}(W.default);O.minProbeByteLength=9,G.default=O},"./src/demux/adts.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"getAudioConfig",function(){return N}),D.d(G,"isHeaderPattern",function(){return k}),D.d(G,"getHeaderLength",function(){return A}),D.d(G,"getFullFrameLength",function(){return O}),D.d(G,"canGetFrameLength",function(){return E}),D.d(G,"isHeader",function(){return T}),D.d(G,"canParse",function(){return _}),D.d(G,"probe",function(){return C}),D.d(G,"initTrackConfig",function(){return y}),D.d(G,"getFrameDuration",function(){return g}),D.d(G,"parseFrameHeader",function(){return l}),D.d(G,"appendFrame",function(){return o});var W=D("./src/utils/logger.ts"),R=D("./src/errors.ts"),P=D("./src/events.ts");function N(s,d,w,f){var m,L,x,h,c=navigator.userAgent.toLowerCase(),u=f,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];m=((d[w+2]&192)>>>6)+1;var v=(d[w+2]&60)>>>2;if(v>a.length-1){s.trigger(P.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+v});return}return x=(d[w+2]&1)<<2,x|=(d[w+3]&192)>>>6,W.logger.log("manifest codec:"+f+", ADTS type:"+m+", samplingIndex:"+v),/firefox/i.test(c)?v>=6?(m=5,h=new Array(4),L=v-3):(m=2,h=new Array(2),L=v):c.indexOf("android")!==-1?(m=2,h=new Array(2),L=v):(m=5,h=new Array(4),f&&(f.indexOf("mp4a.40.29")!==-1||f.indexOf("mp4a.40.5")!==-1)||!f&&v>=6?L=v-3:((f&&f.indexOf("mp4a.40.2")!==-1&&(v>=6&&x===1||/vivaldi/i.test(c))||!f&&x===1)&&(m=2,h=new Array(2)),L=v)),h[0]=m<<3,h[0]|=(v&14)>>1,h[1]|=(v&1)<<7,h[1]|=x<<3,m===5&&(h[1]|=(L&14)>>1,h[2]=(L&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:a[v],channelCount:x,codec:"mp4a.40."+m,manifestCodec:u}}function k(s,d){return s[d]===255&&(s[d+1]&246)===240}function A(s,d){return s[d+1]&1?7:9}function O(s,d){return(s[d+3]&3)<<11|s[d+4]<<3|(s[d+5]&224)>>>5}function E(s,d){return d+5<s.length}function T(s,d){return d+1<s.length&&k(s,d)}function _(s,d){return E(s,d)&&k(s,d)&&O(s,d)<=s.length-d}function C(s,d){if(T(s,d)){var w=A(s,d);if(d+w>=s.length)return!1;var f=O(s,d);if(f<=w)return!1;var m=d+f;return m===s.length||T(s,m)}return!1}function y(s,d,w,f,m){if(!s.samplerate){var L=N(d,w,f,m);if(!L)return;s.config=L.config,s.samplerate=L.samplerate,s.channelCount=L.channelCount,s.codec=L.codec,s.manifestCodec=L.manifestCodec,W.logger.log("parsed codec:"+s.codec+", rate:"+L.samplerate+", channels:"+L.channelCount)}}function g(s){return 1024*9e4/s}function l(s,d,w,f,m){var L=A(s,d),x=O(s,d);if(x-=L,x>0){var h=w+f*m;return{headerLength:L,frameLength:x,stamp:h}}}function o(s,d,w,f,m){var L=g(s.samplerate),x=l(d,w,f,m,L);if(x){var h=x.frameLength,c=x.headerLength,u=x.stamp,a=c+h,v=Math.max(0,w+a-d.length),p;v?(p=new Uint8Array(a-c),p.set(d.subarray(w+c,d.length),0)):p=d.subarray(w+c,w+a);var b={unit:p,pts:u};return v||s.samples.push(b),{sample:b,length:a,missing:v}}}},"./src/demux/base-audio-demuxer.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"initPTSFn",function(){return O});var W=D("./src/polyfills/number.ts"),R=D("./src/demux/id3.ts"),P=D("./src/demux/dummy-demuxed-track.ts"),N=D("./src/utils/mp4-tools.ts"),k=D("./src/utils/typed-array.ts"),A=function(){function E(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var T=E.prototype;return T.resetInitSegment=function(C,y,g){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},T.resetTimeStamp=function(){},T.resetContiguity=function(){},T.canParse=function(C,y){return!1},T.appendFrame=function(C,y,g){},T.demux=function(C,y){this.cachedData&&(C=Object(N.appendUint8Array)(this.cachedData,C),this.cachedData=null);var g=R.getID3Data(C,0),l=g?g.length:0,o,s,d=this._audioTrack,w=this._id3Track,f=g?R.getTimeStamp(g):void 0,m=C.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=O(f,y)),g&&g.length>0&&w.samples.push({pts:this.initPTS,dts:this.initPTS,data:g}),s=this.initPTS;l<m;){if(this.canParse(C,l)){var L=this.appendFrame(d,C,l);L?(this.frameIndex++,s=L.sample.pts,l+=L.length,o=l):l=m}else R.canParse(C,l)?(g=R.getID3Data(C,l),w.samples.push({pts:s,dts:s,data:g}),l+=g.length,o=l):l++;if(l===m&&o!==m){var x=Object(k.sliceUint8)(C,o);this.cachedData?this.cachedData=Object(N.appendUint8Array)(this.cachedData,x):this.cachedData=x}}return{audioTrack:d,avcTrack:Object(P.dummyTrack)(),id3Track:w,textTrack:Object(P.dummyTrack)()}},T.demuxSampleAes=function(C,y,g){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},T.flush=function(C){var y=this.cachedData;return y&&(this.cachedData=null,this.demux(y,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},T.destroy=function(){},E}(),O=function(T,_){return Object(W.isFiniteNumber)(T)?T*90:_*9e4};G.default=A},"./src/demux/chunk-cache.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"default",function(){return W});var W=function(){function P(){this.chunks=[],this.dataLength=0}var N=P.prototype;return N.push=function(A){this.chunks.push(A),this.dataLength+=A.length},N.flush=function(){var A=this.chunks,O=this.dataLength,E;if(A.length)A.length===1?E=A[0]:E=R(A,O);else return new Uint8Array(0);return this.reset(),E},N.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function R(P,N){for(var k=new Uint8Array(N),A=0,O=0;O<P.length;O++){var E=P[O];k.set(E,A),A+=E.length}return k}},"./src/demux/dummy-demuxed-track.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"dummyTrack",function(){return W});function W(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ee,G,D){"use strict";D.r(G);var W=D("./src/utils/logger.ts"),R=function(){function P(k){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=k,this.bytesAvailable=k.byteLength,this.word=0,this.bitsAvailable=0}var N=P.prototype;return N.loadWord=function(){var A=this.data,O=this.bytesAvailable,E=A.byteLength-O,T=new Uint8Array(4),_=Math.min(4,O);if(_===0)throw new Error("no bytes available");T.set(A.subarray(E,E+_)),this.word=new DataView(T.buffer).getUint32(0),this.bitsAvailable=_*8,this.bytesAvailable-=_},N.skipBits=function(A){var O;this.bitsAvailable>A?(this.word<<=A,this.bitsAvailable-=A):(A-=this.bitsAvailable,O=A>>3,A-=O>>3,this.bytesAvailable-=O,this.loadWord(),this.word<<=A,this.bitsAvailable-=A)},N.readBits=function(A){var O=Math.min(this.bitsAvailable,A),E=this.word>>>32-O;return A>32&&W.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=O,this.bitsAvailable>0?this.word<<=O:this.bytesAvailable>0&&this.loadWord(),O=A-O,O>0&&this.bitsAvailable?E<<O|this.readBits(O):E},N.skipLZ=function(){var A;for(A=0;A<this.bitsAvailable;++A)if((this.word&2147483648>>>A)!==0)return this.word<<=A,this.bitsAvailable-=A,A;return this.loadWord(),A+this.skipLZ()},N.skipUEG=function(){this.skipBits(1+this.skipLZ())},N.skipEG=function(){this.skipBits(1+this.skipLZ())},N.readUEG=function(){var A=this.skipLZ();return this.readBits(A+1)-1},N.readEG=function(){var A=this.readUEG();return 1&A?1+A>>>1:-1*(A>>>1)},N.readBoolean=function(){return this.readBits(1)===1},N.readUByte=function(){return this.readBits(8)},N.readUShort=function(){return this.readBits(16)},N.readUInt=function(){return this.readBits(32)},N.skipScalingList=function(A){for(var O=8,E=8,T,_=0;_<A;_++)E!==0&&(T=this.readEG(),E=(O+T+256)%256),O=E===0?O:E},N.readSPS=function(){var A=0,O=0,E=0,T=0,_,C,y,g=this.readUByte.bind(this),l=this.readBits.bind(this),o=this.readUEG.bind(this),s=this.readBoolean.bind(this),d=this.skipBits.bind(this),w=this.skipEG.bind(this),f=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);g();var L=g();if(l(5),d(3),g(),f(),L===100||L===110||L===122||L===244||L===44||L===83||L===86||L===118||L===128){var x=o();if(x===3&&d(1),f(),f(),d(1),s())for(C=x!==3?8:12,y=0;y<C;y++)s()&&(y<6?m(16):m(64))}f();var h=o();if(h===0)o();else if(h===1)for(d(1),w(),w(),_=o(),y=0;y<_;y++)w();f(),d(1);var c=o(),u=o(),a=l(1);a===0&&d(1),d(1),s()&&(A=o(),O=o(),E=o(),T=o());var v=[1,1];if(s()&&s()){var p=g();switch(p){case 1:v=[1,1];break;case 2:v=[12,11];break;case 3:v=[10,11];break;case 4:v=[16,11];break;case 5:v=[40,33];break;case 6:v=[24,11];break;case 7:v=[20,11];break;case 8:v=[32,11];break;case 9:v=[80,33];break;case 10:v=[18,11];break;case 11:v=[15,11];break;case 12:v=[64,33];break;case 13:v=[160,99];break;case 14:v=[4,3];break;case 15:v=[3,2];break;case 16:v=[2,1];break;case 255:{v=[g()<<8|g(),g()<<8|g()];break}}}return{width:Math.ceil((c+1)*16-A*2-O*2),height:(2-a)*(u+1)*16-(a?2:4)*(E+T),pixelRatio:v}},N.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();G.default=R},"./src/demux/id3.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"isHeader",function(){return W}),D.d(G,"isFooter",function(){return R}),D.d(G,"getID3Data",function(){return P}),D.d(G,"canParse",function(){return k}),D.d(G,"getTimeStamp",function(){return A}),D.d(G,"isTimeStampFrame",function(){return O}),D.d(G,"getID3Frames",function(){return T}),D.d(G,"decodeFrame",function(){return _}),D.d(G,"utf8ArrayToStr",function(){return o}),D.d(G,"testables",function(){return s});var W=function(m,L){return L+10<=m.length&&(m[L]===73&&m[L+1]===68&&m[L+2]===51&&(m[L+3]<255&&m[L+4]<255&&(m[L+6]<128&&m[L+7]<128&&m[L+8]<128&&m[L+9]<128)))},R=function(m,L){return L+10<=m.length&&(m[L]===51&&m[L+1]===68&&m[L+2]===73&&(m[L+3]<255&&m[L+4]<255&&(m[L+6]<128&&m[L+7]<128&&m[L+8]<128&&m[L+9]<128)))},P=function(m,L){for(var x=L,h=0;W(m,L);){h+=10;var c=N(m,L+6);h+=c,R(m,L+10)&&(h+=10),L+=h}return h>0?m.subarray(x,x+h):void 0},N=function(m,L){var x=0;return x=(m[L]&127)<<21,x|=(m[L+1]&127)<<14,x|=(m[L+2]&127)<<7,x|=m[L+3]&127,x},k=function(m,L){return W(m,L)&&N(m,L+6)+10<=m.length-L},A=function(m){for(var L=T(m),x=0;x<L.length;x++){var h=L[x];if(O(h))return l(h)}return},O=function(m){return m&&m.key==="PRIV"&&m.info==="com.apple.streaming.transportStreamTimestamp"},E=function(m){var L=String.fromCharCode(m[0],m[1],m[2],m[3]),x=N(m,4),h=10;return{type:L,size:x,data:m.subarray(h,h+x)}},T=function(m){for(var L=0,x=[];W(m,L);){var h=N(m,L+6);L+=10;for(var c=L+h;L+8<c;){var u=E(m.subarray(L)),a=_(u);a&&x.push(a),L+=u.size+10}R(m,L)&&(L+=10)}return x},_=function(m){return m.type==="PRIV"?C(m):m.type[0]==="W"?g(m):y(m)},C=function(m){if(m.size<2)return;var L=o(m.data,!0),x=new Uint8Array(m.data.subarray(L.length+1));return{key:m.type,info:L,data:x.buffer}},y=function(m){if(m.size<2)return;if(m.type==="TXXX"){var L=1,x=o(m.data.subarray(L),!0);L+=x.length+1;var h=o(m.data.subarray(L));return{key:m.type,info:x,data:h}}var c=o(m.data.subarray(1));return{key:m.type,data:c}},g=function(m){if(m.type==="WXXX"){if(m.size<2)return;var L=1,x=o(m.data.subarray(L),!0);L+=x.length+1;var h=o(m.data.subarray(L));return{key:m.type,info:x,data:h}}var c=o(m.data);return{key:m.type,data:c}},l=function(m){if(m.data.byteLength===8){var L=new Uint8Array(m.data),x=L[3]&1,h=(L[4]<<23)+(L[5]<<15)+(L[6]<<7)+L[7];return h/=45,x&&(h+=4772185884e-2),Math.round(h)}return},o=function(m,L){L===void 0&&(L=!1);var x=w();if(x){var h=x.decode(m);if(L){var c=h.indexOf("\0");return c!==-1?h.substring(0,c):h}return h.replace(/\0/g,"")}for(var u=m.length,a,v,p,b="",M=0;M<u;){if(a=m[M++],a===0&&L)return b;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:b+=String.fromCharCode(a);break;case 12:case 13:v=m[M++],b+=String.fromCharCode((a&31)<<6|v&63);break;case 14:v=m[M++],p=m[M++],b+=String.fromCharCode((a&15)<<12|(v&63)<<6|(p&63)<<0);break;default:}}return b},s={decodeTextFrame:y},d;function w(){return!d&&typeof self.TextDecoder!="undefined"&&(d=new self.TextDecoder("utf-8")),d}},"./src/demux/mp3demuxer.ts":function(ee,G,D){"use strict";D.r(G);var W=D("./src/demux/base-audio-demuxer.ts"),R=D("./src/demux/id3.ts"),P=D("./src/utils/logger.ts"),N=D("./src/demux/mpegaudio.ts");function k(E,T){E.prototype=Object.create(T.prototype),E.prototype.constructor=E,A(E,T)}function A(E,T){return A=Object.setPrototypeOf||function(C,y){return C.__proto__=y,C},A(E,T)}var O=function(E){k(T,E);function T(){return E.apply(this,arguments)||this}var _=T.prototype;return _.resetInitSegment=function(y,g,l){E.prototype.resetInitSegment.call(this,y,g,l),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:y,duration:l,inputTimeScale:9e4,dropped:0}},T.probe=function(y){if(!y)return!1;for(var g=R.getID3Data(y,0)||[],l=g.length,o=y.length;l<o;l++)if(N.probe(y,l))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},_.canParse=function(y,g){return N.canParse(y,g)},_.appendFrame=function(y,g,l){return this.initPTS===null?void 0:N.appendFrame(y,g,l,this.initPTS,this.frameIndex)},T}(W.default);O.minProbeByteLength=4,G.default=O},"./src/demux/mp4demuxer.ts":function(ee,G,D){"use strict";D.r(G);var W=D("./src/utils/mp4-tools.ts"),R=D("./src/demux/dummy-demuxed-track.ts"),P=function(){function N(A,O){this.remainderData=null,this.config=void 0,this.config=O}var k=N.prototype;return k.resetTimeStamp=function(){},k.resetInitSegment=function(){},k.resetContiguity=function(){},N.probe=function(O){return Object(W.findBox)({data:O,start:0,end:Math.min(O.length,16384)},["moof"]).length>0},k.demux=function(O){var E=O,T=Object(R.dummyTrack)();if(this.config.progressive){this.remainderData&&(E=Object(W.appendUint8Array)(this.remainderData,O));var _=Object(W.segmentValidRange)(E);this.remainderData=_.remainder,T.samples=_.valid||new Uint8Array}else T.samples=E;return{audioTrack:Object(R.dummyTrack)(),avcTrack:T,id3Track:Object(R.dummyTrack)(),textTrack:Object(R.dummyTrack)()}},k.flush=function(){var O=Object(R.dummyTrack)();return O.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(R.dummyTrack)(),avcTrack:O,id3Track:Object(R.dummyTrack)(),textTrack:Object(R.dummyTrack)()}},k.demuxSampleAes=function(O,E,T){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},k.destroy=function(){},N}();P.minProbeByteLength=1024,G.default=P},"./src/demux/mpegaudio.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"appendFrame",function(){return A}),D.d(G,"parseHeader",function(){return O}),D.d(G,"isHeaderPattern",function(){return E}),D.d(G,"isHeader",function(){return T}),D.d(G,"canParse",function(){return _}),D.d(G,"probe",function(){return C});var W=null,R=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],P=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],N=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],k=[0,1,1,4];function A(y,g,l,o,s){if(l+24>g.length)return;var d=O(g,l);if(d&&l+d.frameLength<=g.length){var w=d.samplesPerFrame*9e4/d.sampleRate,f=o+s*w,m={unit:g.subarray(l,l+d.frameLength),pts:f,dts:f};return y.config=[],y.channelCount=d.channelCount,y.samplerate=d.sampleRate,y.samples.push(m),{sample:m,length:d.frameLength,missing:0}}}function O(y,g){var l=y[g+1]>>3&3,o=y[g+1]>>1&3,s=y[g+2]>>4&15,d=y[g+2]>>2&3;if(l!==1&&s!==0&&s!==15&&d!==3){var w=y[g+2]>>1&1,f=y[g+3]>>6,m=l===3?3-o:o===3?3:4,L=R[m*14+s-1]*1e3,x=l===3?0:l===2?1:2,h=P[x*3+d],c=f===3?1:2,u=N[l][o],a=k[o],v=u*8*a,p=Math.floor(u*L/h+w)*a;if(W===null){var b=navigator.userAgent||"",M=b.match(/Chrome\/(\d+)/i);W=M?parseInt(M[1]):0}var F=!!W&&W<=87;return F&&o===2&&L>=224e3&&f===0&&(y[g+3]=y[g+3]|128),{sampleRate:h,channelCount:c,frameLength:p,samplesPerFrame:v}}}function E(y,g){return y[g]===255&&(y[g+1]&224)===224&&(y[g+1]&6)!==0}function T(y,g){return g+1<y.length&&E(y,g)}function _(y,g){var l=4;return E(y,g)&&l<=y.length-g}function C(y,g){if(g+1<y.length&&E(y,g)){var l=4,o=O(y,g),s=l;o!=null&&o.frameLength&&(s=o.frameLength);var d=g+s;return d===y.length||T(y,d)}return!1}},"./src/demux/sample-aes.ts":function(ee,G,D){"use strict";D.r(G);var W=D("./src/crypt/decrypter.ts"),R=D("./src/demux/tsdemuxer.ts"),P=function(){function N(A,O,E){this.keyData=void 0,this.decrypter=void 0,this.keyData=E,this.decrypter=new W.default(A,O,{removePKCS7Padding:!1})}var k=N.prototype;return k.decryptBuffer=function(O,E){this.decrypter.decrypt(O,this.keyData.key.buffer,this.keyData.iv.buffer,E)},k.decryptAacSample=function(O,E,T,_){var C=O[E].unit,y=C.subarray(16,C.length-C.length%16),g=y.buffer.slice(y.byteOffset,y.byteOffset+y.length),l=this;this.decryptBuffer(g,function(o){var s=new Uint8Array(o);C.set(s,16),_||l.decryptAacSamples(O,E+1,T)})},k.decryptAacSamples=function(O,E,T){for(;;E++){if(E>=O.length){T();return}if(O[E].unit.length<32)continue;var _=this.decrypter.isSync();if(this.decryptAacSample(O,E,T,_),!_)return}},k.getAvcEncryptedData=function(O){for(var E=Math.floor((O.length-48)/160)*16+16,T=new Int8Array(E),_=0,C=32;C<=O.length-16;C+=160,_+=16)T.set(O.subarray(C,C+16),_);return T},k.getAvcDecryptedUnit=function(O,E){for(var T=new Uint8Array(E),_=0,C=32;C<=O.length-16;C+=160,_+=16)O.set(T.subarray(_,_+16),C);return O},k.decryptAvcSample=function(O,E,T,_,C,y){var g=Object(R.discardEPB)(C.data),l=this.getAvcEncryptedData(g),o=this;this.decryptBuffer(l.buffer,function(s){C.data=o.getAvcDecryptedUnit(g,s),y||o.decryptAvcSamples(O,E,T+1,_)})},k.decryptAvcSamples=function(O,E,T,_){if(O instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;E++,T=0){if(E>=O.length){_();return}for(var C=O[E].units;!(T>=C.length);T++){var y=C[T];if(y.data.length<=48||y.type!==1&&y.type!==5)continue;var g=this.decrypter.isSync();if(this.decryptAvcSample(O,E,T,_,y,g),!g)return}}},N}();G.default=P},"./src/demux/transmuxer-interface.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"default",function(){return C});var W=D("./node_modules/webworkify-webpack/index.js"),R=D.n(W),P=D("./src/events.ts"),N=D("./src/demux/transmuxer.ts"),k=D("./src/utils/logger.ts"),A=D("./src/errors.ts"),O=D("./src/utils/mediasource-helper.ts"),E=D("./node_modules/eventemitter3/index.js"),T=D.n(E),_=Object(O.getMediaSource)()||{isTypeSupported:function(){return!1}},C=function(){function y(l,o,s,d){var w=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=l,this.id=o,this.onTransmuxComplete=s,this.onFlush=d;var f=l.config,m=function(u,a){a=a||{},a.frag=w.frag,a.id=w.id,l.trigger(u,a)};this.observer=new E.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,m),this.observer.on(P.Events.ERROR,m);var L={mp4:_.isTypeSupported("video/mp4"),mpeg:_.isTypeSupported("audio/mpeg"),mp3:_.isTypeSupported('audio/mp4; codecs="mp3"')},x=navigator.vendor;if(f.enableWorker&&typeof Worker!="undefined"){k.logger.log("demuxing in webworker");var h;try{h=this.worker=W("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(c){l.trigger(P.Events.ERROR,{type:A.ErrorTypes.OTHER_ERROR,details:A.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},h.postMessage({cmd:"init",typeSupported:L,vendor:x,id:o,config:JSON.stringify(f)})}catch(c){k.logger.warn("Error in worker:",c),k.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new N.default(this.observer,L,f,x,o),this.worker=null}}else this.transmuxer=new N.default(this.observer,L,f,x,o)}var g=y.prototype;return g.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},g.push=function(o,s,d,w,f,m,L,x,h,c){var u=this;h.transmuxing.start=self.performance.now();var a=this.transmuxer,v=this.worker,p=m?m.start:f.start,b=f.decryptdata,M=this.frag,F=!(M&&f.cc===M.cc),H=!(M&&h.level===M.level),X=M?h.sn-M.sn:-1,B=this.part?h.part-this.part.index:1,U=!H&&(X===1||X===0&&B===1),z=self.performance.now();(H||X||f.stats.parsing.start===0)&&(f.stats.parsing.start=z),m&&(B||!U)&&(m.stats.parsing.start=z);var Z=new N.TransmuxState(F,U,x,H,p);if(!U||F){k.logger.log("[transmuxer-interface, "+f.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
discontinuity: `+F+`
trackSwitch: `+H+`
contiguous: `+U+`
accurateTimeOffset: `+x+`
timeOffset: `+p);var ie=new N.TransmuxConfig(d,w,s,L,c);this.configureTransmuxer(ie)}if(this.frag=f,this.part=m,v)v.postMessage({cmd:"demux",data:o,decryptdata:b,chunkMeta:h,state:Z},o instanceof ArrayBuffer?[o]:[]);else if(a){var se=a.push(o,b,h,Z);Object(N.isPromise)(se)?se.then(function(Te){u.handleTransmuxComplete(Te)}):this.handleTransmuxComplete(se)}},g.flush=function(o){var s=this;o.transmuxing.start=self.performance.now();var d=this.transmuxer,w=this.worker;if(w)w.postMessage({cmd:"flush",chunkMeta:o});else if(d){var f=d.flush(o);Object(N.isPromise)(f)?f.then(function(m){s.handleFlushResult(m,o)}):this.handleFlushResult(f,o)}},g.handleFlushResult=function(o,s){var d=this;o.forEach(function(w){d.handleTransmuxComplete(w)}),this.onFlush(s)},g.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}}},g.configureTransmuxer=function(o){var s=this.worker,d=this.transmuxer;s?s.postMessage({cmd:"configure",config:o}):d&&d.configure(o)},g.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},y}()},"./src/demux/transmuxer-worker.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"default",function(){return A});var W=D("./src/demux/transmuxer.ts"),R=D("./src/events.ts"),P=D("./src/utils/logger.ts"),N=D("./node_modules/eventemitter3/index.js"),k=D.n(N);function A(C){var y=new N.EventEmitter,g=function(o,s){C.postMessage({event:o,data:s})};y.on(R.Events.FRAG_DECRYPTED,g),y.on(R.Events.ERROR,g),C.addEventListener("message",function(l){var o=l.data;switch(o.cmd){case"init":{var s=JSON.parse(o.config);C.transmuxer=new W.default(y,o.typeSupported,s,o.vendor,o.id),Object(P.enableLogs)(s.debug),g("init",null);break}case"configure":{C.transmuxer.configure(o.config);break}case"demux":{var d=C.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(W.isPromise)(d)?d.then(function(m){O(C,m)}):O(C,d);break}case"flush":{var w=o.chunkMeta,f=C.transmuxer.flush(w);Object(W.isPromise)(f)?f.then(function(m){T(C,m,w)}):T(C,f,w);break}default:break}})}function O(C,y){if(_(y.remuxResult))return;var g=[],l=y.remuxResult,o=l.audio,s=l.video;o&&E(g,o),s&&E(g,s),C.postMessage({event:"transmuxComplete",data:y},g)}function E(C,y){y.data1&&C.push(y.data1.buffer),y.data2&&C.push(y.data2.buffer)}function T(C,y,g){y.forEach(function(l){O(C,l)}),C.postMessage({event:"flush",data:g})}function _(C){return!C.audio&&!C.video&&!C.text&&!C.id3&&!C.initSegment}},"./src/demux/transmuxer.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"default",function(){return s}),D.d(G,"isPromise",function(){return f}),D.d(G,"TransmuxConfig",function(){return m}),D.d(G,"TransmuxState",function(){return L});var W=D("./src/events.ts"),R=D("./src/errors.ts"),P=D("./src/crypt/decrypter.ts"),N=D("./src/demux/aacdemuxer.ts"),k=D("./src/demux/mp4demuxer.ts"),A=D("./src/demux/tsdemuxer.ts"),O=D("./src/demux/mp3demuxer.ts"),E=D("./src/remux/mp4-remuxer.ts"),T=D("./src/remux/passthrough-remuxer.ts"),_=D("./src/demux/chunk-cache.ts"),C=D("./src/utils/mp4-tools.ts"),y=D("./src/utils/logger.ts"),g;try{g=self.performance.now.bind(self.performance)}catch(x){y.logger.debug("Unable to use Performance API on this environment"),g=self.Date.now}var l=[{demux:A.default,remux:E.default},{demux:k.default,remux:T.default},{demux:N.default,remux:E.default},{demux:O.default,remux:E.default}],o=1024;l.forEach(function(x){var h=x.demux;o=Math.max(o,h.minProbeByteLength)});var s=function(){function x(c,u,a,v,p){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 _.default,this.observer=c,this.typeSupported=u,this.config=a,this.vendor=v,this.id=p}var h=x.prototype;return h.configure=function(u){this.transmuxConfig=u,this.decrypter&&this.decrypter.reset()},h.push=function(u,a,v,p){var b=this,M=v.transmuxing;M.executeStart=g();var F=new Uint8Array(u),H=this.cache,X=this.config,B=this.currentTransmuxState,U=this.transmuxConfig;p&&(this.currentTransmuxState=p);var z=d(F,a);if(z&&z.method==="AES-128"){var Z=this.getDecrypter();if(X.enableSoftwareAES){var ie=Z.softwareDecrypt(F,z.key.buffer,z.iv.buffer);if(!ie)return M.executeEnd=g(),w(v);F=new Uint8Array(ie)}else return this.decryptionPromise=Z.webCryptoDecrypt(F,z.key.buffer,z.iv.buffer).then(function(ye){var _e=b.push(ye,null,v);return b.decryptionPromise=null,_e}),this.decryptionPromise}var se=p||B,Te=se.contiguous,he=se.discontinuity,xe=se.trackSwitch,pe=se.accurateTimeOffset,ge=se.timeOffset,le=U.audioCodec,ue=U.videoCodec,Le=U.defaultInitPts,Fe=U.duration,Ie=U.initSegmentData;if((he||xe)&&this.resetInitSegment(Ie,le,ue,Fe),he&&this.resetInitialTimestamp(Le),Te||this.resetContiguity(),this.needsProbing(F,he,xe)){if(H.dataLength){var Ne=H.flush();F=Object(C.appendUint8Array)(Ne,F)}this.configureTransmuxer(F,U)}var Ue=this.transmux(F,z,ge,pe,v),Ee=this.currentTransmuxState;return Ee.contiguous=!0,Ee.discontinuity=!1,Ee.trackSwitch=!1,M.executeEnd=g(),Ue},h.flush=function(u){var a=this,v=u.transmuxing;v.executeStart=g();var p=this.decrypter,b=this.cache,M=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return a.flush(u)});var H=[],X=M.timeOffset;if(p){var B=p.flush();B&&H.push(this.push(B,null,u))}var U=b.dataLength;b.reset();var z=this.demuxer,Z=this.remuxer;if(!z||!Z)return U>=o&&this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),v.executeEnd=g(),[w(u)];var ie=z.flush(X);return f(ie)?ie.then(function(se){return a.flushRemux(H,se,u),H}):(this.flushRemux(H,ie,u),H)},h.flushRemux=function(u,a,v){var p=a.audioTrack,b=a.avcTrack,M=a.id3Track,F=a.textTrack,H=this.currentTransmuxState,X=H.accurateTimeOffset,B=H.timeOffset;y.logger.log("[transmuxer.ts]: Flushed fragment "+v.sn+(v.part>-1?" p: "+v.part:"")+" of level "+v.level);var U=this.remuxer.remux(p,b,M,F,B,X,!0,this.id);u.push({remuxResult:U,chunkMeta:v}),v.transmuxing.executeEnd=g()},h.resetInitialTimestamp=function(u){var a=this.demuxer,v=this.remuxer;if(!a||!v)return;a.resetTimeStamp(u),v.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,v,p){var b=this.demuxer,M=this.remuxer;if(!b||!M)return;b.resetInitSegment(a,v,p),M.resetInitSegment(u,a,v)},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,v,p,b){var M;return a&&a.method==="SAMPLE-AES"?M=this.transmuxSampleAes(u,a,v,p,b):M=this.transmuxUnencrypted(u,v,p,b),M},h.transmuxUnencrypted=function(u,a,v,p){var b=this.demuxer.demux(u,a,!1,!this.config.progressive),M=b.audioTrack,F=b.avcTrack,H=b.id3Track,X=b.textTrack,B=this.remuxer.remux(M,F,H,X,a,v,!1,this.id);return{remuxResult:B,chunkMeta:p}},h.transmuxSampleAes=function(u,a,v,p,b){var M=this;return this.demuxer.demuxSampleAes(u,a,v).then(function(F){var H=M.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,v,p,!1,M.id);return{remuxResult:H,chunkMeta:b}})},h.configureTransmuxer=function(u,a){for(var v=this.config,p=this.observer,b=this.typeSupported,M=this.vendor,F=a.audioCodec,H=a.defaultInitPts,X=a.duration,B=a.initSegmentData,U=a.videoCodec,z,Z=0,ie=l.length;Z<ie;Z++)if(l[Z].demux.probe(u)){z=l[Z];break}z||(y.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),z={demux:k.default,remux:T.default});var se=this.demuxer,Te=this.remuxer,he=z.remux,xe=z.demux;(!Te||!(Te instanceof he))&&(this.remuxer=new he(p,v,b,M)),(!se||!(se instanceof xe))&&(this.demuxer=new xe(p,v,b),this.probe=xe.probe),this.resetInitSegment(B,F,U,X),this.resetInitialTimestamp(H)},h.needsProbing=function(u,a,v){return!this.demuxer||!this.remuxer||a||v},h.getDecrypter=function(){var u=this.decrypter;return u||(u=this.decrypter=new P.default(this.observer,this.config)),u},x}();function d(x,h){var c=null;return x.byteLength>0&&h!=null&&h.key!=null&&h.iv!==null&&h.method!=null&&(c=h),c}var w=function(h){return{remuxResult:{},chunkMeta:h}};function f(x){return"then"in x&&x.then instanceof Function}var m=function(h,c,u,a,v){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=v},L=function(h,c,u,a,v){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=v}},"./src/demux/tsdemuxer.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"discardEPB",function(){return w});var W=D("./src/demux/adts.ts"),R=D("./src/demux/mpegaudio.ts"),P=D("./src/demux/exp-golomb.ts"),N=D("./src/demux/id3.ts"),k=D("./src/demux/sample-aes.ts"),A=D("./src/events.ts"),O=D("./src/utils/mp4-tools.ts"),E=D("./src/utils/logger.ts"),T=D("./src/errors.ts"),_={video:1,audio:2,id3:3,text:4},C=function(){function f(L,x,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=L,this.config=x,this.typeSupported=h}f.probe=function(x){var h=f.syncOffset(x);return h<0?!1:(h&&E.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},f.syncOffset=function(x){for(var h=Math.min(1e3,x.length-3*188),c=0;c<h;){if(x[c]===71&&x[c+188]===71&&x[c+2*188]===71)return c;c++}return-1},f.createTrack=function(x,h){return{container:x==="video"||x==="audio"?"video/mp2t":void 0,type:x,id:_[x],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:x==="audio"?h:void 0}};var m=f.prototype;return m.resetInitSegment=function(x,h,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=f.createTrack("video",c),this._audioTrack=f.createTrack("audio",c),this._id3Track=f.createTrack("id3",c),this._txtTrack=f.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=x,this.videoCodec=h,this._duration=c},m.resetTimeStamp=function(){},m.resetContiguity=function(){var x=this._audioTrack,h=this._avcTrack,c=this._id3Track;x&&(x.pesData=null),h&&(h.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},m.demux=function(x,h,c,u){c===void 0&&(c=!1),u===void 0&&(u=!1),c||(this.sampleAes=null);var a,v=this._avcTrack,p=this._audioTrack,b=this._id3Track,M=v.pid,F=v.pesData,H=p.pid,X=b.pid,B=p.pesData,U=b.pesData,z=!1,Z=this.pmtParsed,ie=this._pmtId,se=x.length;if(this.remainderData&&(x=Object(O.appendUint8Array)(this.remainderData,x),se=x.length,this.remainderData=null),se<188&&!u)return this.remainderData=x,{audioTrack:p,avcTrack:v,id3Track:b,textTrack:this._txtTrack};var Te=Math.max(0,f.syncOffset(x));se-=(se+Te)%188,se<x.byteLength&&!u&&(this.remainderData=new Uint8Array(x.buffer,se,x.buffer.byteLength-se));for(var he=Te;he<se;he+=188)if(x[he]===71){var xe=!!(x[he+1]&64),pe=((x[he+1]&31)<<8)+x[he+2],ge=(x[he+3]&48)>>4,le=void 0;if(ge>1){if(le=he+5+x[he+4],le===he+188)continue}else le=he+4;switch(pe){case M:xe&&(F&&(a=o(F))&&this.parseAVCPES(a,!1),F={data:[],size:0}),F&&(F.data.push(x.subarray(le,he+188)),F.size+=he+188-le);break;case H:xe&&(B&&(a=o(B))&&(p.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),B={data:[],size:0}),B&&(B.data.push(x.subarray(le,he+188)),B.size+=he+188-le);break;case X:xe&&(U&&(a=o(U))&&this.parseID3PES(a),U={data:[],size:0}),U&&(U.data.push(x.subarray(le,he+188)),U.size+=he+188-le);break;case 0:xe&&(le+=x[le]+1),ie=this._pmtId=g(x,le);break;case ie:{xe&&(le+=x[le]+1);var ue=l(x,le,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);M=ue.avc,M>0&&(v.pid=M),H=ue.audio,H>0&&(p.pid=H,p.isAAC=ue.isAAC),X=ue.id3,X>0&&(b.pid=X),z&&!Z&&(E.logger.log("reparse from beginning"),z=!1,he=Te-188),Z=this.pmtParsed=!0;break}case 17:case 8191:break;default:z=!0;break}}else this.observer.emit(A.Events.ERROR,A.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});v.pesData=F,p.pesData=B,b.pesData=U;var Le={audioTrack:p,avcTrack:v,id3Track:b,textTrack:this._txtTrack};return u&&this.extractRemainingSamples(Le),Le},m.flush=function(){var x=this.remainderData;this.remainderData=null;var h;return x?h=this.demux(x,-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(x){var h=x.audioTrack,c=x.avcTrack,u=x.id3Track,a=c.pesData,v=h.pesData,p=u.pesData,b;a&&(b=o(a))?(this.parseAVCPES(b,!0),c.pesData=null):c.pesData=a,v&&(b=o(v))?(h.isAAC?this.parseAACPES(b):this.parseMPEGPES(b),h.pesData=null):(v!=null&&v.size&&E.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=v),p&&(b=o(p))?(this.parseID3PES(b),u.pesData=null):u.pesData=p},m.demuxSampleAes=function(x,h,c){var u=this.demux(x,c,!0,!this.config.progressive),a=this.sampleAes=new k.default(this.observer,this.config,h);return this.decrypt(u,a)},m.decrypt=function(x,h){return new Promise(function(c){var u=x.audioTrack,a=x.avcTrack;u.samples&&u.isAAC?h.decryptAacSamples(u.samples,0,function(){a.samples?h.decryptAvcSamples(a.samples,0,0,function(){c(x)}):c(x)}):a.samples&&h.decryptAvcSamples(a.samples,0,0,function(){c(x)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(x,h){var c=this,u=this._avcTrack,a=this.parseAVCNALu(x.data),v=!1,p=this.avcSample,b,M=!1;x.data=null,p&&a.length&&!u.audFound&&(s(p,u),p=this.avcSample=y(!1,x.pts,x.dts,"")),a.forEach(function(F){switch(F.type){case 1:{b=!0,p||(p=c.avcSample=y(!0,x.pts,x.dts,"")),v&&(p.debug+="NDR "),p.frame=!0;var H=F.data;if(M&&H.length>4){var X=new P.default(H).readSliceType();(X===2||X===4||X===7||X===9)&&(p.key=!0)}break}case 5:b=!0,p||(p=c.avcSample=y(!0,x.pts,x.dts,"")),v&&(p.debug+="IDR "),p.key=!0,p.frame=!0;break;case 6:{b=!0,v&&p&&(p.debug+="SEI ");var B=new P.default(w(F.data));B.readUByte();for(var U=0,z=0,Z=!1,ie=0;!Z&&B.bytesAvailable>1;){U=0;do ie=B.readUByte(),U+=ie;while(ie===255);z=0;do ie=B.readUByte(),z+=ie;while(ie===255);if(U===4&&B.bytesAvailable!==0){Z=!0;var se=B.readUByte();if(se===181){var Te=B.readUShort();if(Te===49){var he=B.readUInt();if(he===1195456820){var xe=B.readUByte();if(xe===3){for(var pe=B.readUByte(),ge=B.readUByte(),le=31&pe,ue=[pe,ge],Le=0;Le<le;Le++)ue.push(B.readUByte()),ue.push(B.readUByte()),ue.push(B.readUByte());d(c._txtTrack.samples,{type:3,pts:x.pts,bytes:ue})}}}}}else if(U===5&&B.bytesAvailable!==0){if(Z=!0,z>16){for(var Fe=[],Ie=0;Ie<16;Ie++)Fe.push(B.readUByte().toString(16)),(Ie===3||Ie===5||Ie===7||Ie===9)&&Fe.push("-");for(var Ne=z-16,Ue=new Uint8Array(Ne),Ee=0;Ee<Ne;Ee++)Ue[Ee]=B.readUByte();d(c._txtTrack.samples,{pts:x.pts,payloadType:U,uuid:Fe.join(""),userData:Object(N.utf8ArrayToStr)(Ue),userDataBytes:Ue})}}else if(z<B.bytesAvailable)for(var ye=0;ye<z;ye++)B.readUByte()}break}case 7:if(b=!0,M=!0,v&&p&&(p.debug+="SPS "),!u.sps){var _e=new P.default(F.data),Me=_e.readSPS();u.width=Me.width,u.height=Me.height,u.pixelRatio=Me.pixelRatio,u.sps=[F.data],u.duration=c._duration;for(var Pe=F.data.subarray(1,4),we="avc1.",Ce=0;Ce<3;Ce++){var Ye=Pe[Ce].toString(16);Ye.length<2&&(Ye="0"+Ye),we+=Ye}u.codec=we}break;case 8:b=!0,v&&p&&(p.debug+="PPS "),u.pps||(u.pps=[F.data]);break;case 9:b=!1,u.audFound=!0,p&&s(p,u),p=c.avcSample=y(!1,x.pts,x.dts,v?"AUD ":"");break;case 12:b=!1;break;default:b=!1,p&&(p.debug+="unknown NAL "+F.type+" ");break}if(p&&b){var Ge=p.units;Ge.push(F)}}),h&&p&&(s(p,u),this.avcSample=null)},m.getLastNalUnit=function(){var x,h=this.avcSample,c;if(!h||h.units.length===0){var u=this._avcTrack.samples;h=u[u.length-1]}if((x=h)!==null&&x!==void 0&&x.units){var a=h.units;c=a[a.length-1]}return c},m.parseAVCNALu=function(x){var h=x.byteLength,c=this._avcTrack,u=c.naluState||0,a=u,v=[],p=0,b,M,F,H=-1,X=0;for(u===-1&&(H=0,X=x[0]&31,u=0,p=1);p<h;){if(b=x[p++],!u){u=b?0:1;continue}if(u===1){u=b?0:2;continue}if(!b)u=3;else if(b===1){if(H>=0){var B={data:x.subarray(H,p-u-1),type:X};v.push(B)}else{var U=this.getLastNalUnit();if(U&&(a&&p<=4-a&&(U.state&&(U.data=U.data.subarray(0,U.data.byteLength-a))),M=p-u-1,M>0)){var z=new Uint8Array(U.data.byteLength+M);z.set(U.data,0),z.set(x.subarray(0,M),U.data.byteLength),U.data=z,U.state=0}}p<h?(F=x[p]&31,H=p,X=F,u=0):u=-1}else u=0}if(H>=0&&u>=0){var Z={data:x.subarray(H,h),type:X,state:u};v.push(Z)}if(v.length===0){var ie=this.getLastNalUnit();if(ie){var se=new Uint8Array(ie.data.byteLength+x.byteLength);se.set(ie.data,0),se.set(x,ie.data.byteLength),ie.data=se}}return c.naluState=u,v},m.parseAACPES=function(x){var h=0,c=this._audioTrack,u=this.aacOverFlow,a=x.data;if(u){this.aacOverFlow=null;var v=u.sample.unit.byteLength,p=Math.min(u.missing,v),b=v-p;u.sample.unit.set(a.subarray(0,p),b),c.samples.push(u.sample),h=u.missing}var M,F;for(M=h,F=a.length;M<F-1&&!W.isHeader(a,M);M++);if(M!==h){var H,X;if(M<F-1?(H="AAC PES did not start with ADTS header,offset:"+M,X=!1):(H="no ADTS header found in AAC PES",X=!0),E.logger.warn("parsing error:"+H),this.observer.emit(A.Events.ERROR,A.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:X,reason:H}),X)return}W.initTrackConfig(c,this.observer,a,M,this.audioCodec);var B;if(x.pts!==void 0)B=x.pts;else if(u){var U=W.getFrameDuration(c.samplerate);B=u.sample.pts+U}else{E.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var z=0;M<F;)if(W.isHeader(a,M)){if(M+5<F){var Z=W.appendFrame(c,a,M,B,z);if(Z)if(Z.missing)this.aacOverFlow=Z;else{M+=Z.length,z++;continue}}break}else M++},m.parseMPEGPES=function(x){var h=x.data,c=h.length,u=0,a=0,v=x.pts;if(v===void 0){E.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(R.isHeader(h,a)){var p=R.appendFrame(this._audioTrack,h,a,v,u);if(p)a+=p.length,u++;else break}else a++},m.parseID3PES=function(x){if(x.pts===void 0){E.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(x)},f}();C.minProbeByteLength=188;function y(f,m,L,x){return{key:f,frame:!1,pts:m,dts:L,units:[],debug:x,length:0}}function g(f,m){return(f[m+10]&31)<<8|f[m+11]}function l(f,m,L,x){var h={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(f[m+1]&15)<<8|f[m+2],u=m+3+c-4,a=(f[m+10]&15)<<8|f[m+11];for(m+=12+a;m<u;){var v=(f[m+1]&31)<<8|f[m+2];switch(f[m]){case 207:if(!x){E.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:h.audio===-1&&(h.audio=v);break;case 21:h.id3===-1&&(h.id3=v);break;case 219:if(!x){E.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:h.avc===-1&&(h.avc=v);break;case 3:case 4:L?h.audio===-1&&(h.audio=v,h.isAAC=!1):E.logger.log("MPEG audio found, not supported in this browser");break;case 36:E.logger.warn("Unsupported HEVC stream type found");break;default:break}m+=((f[m+3]&15)<<8|f[m+4])+5}return h}function o(f){var m=0,L,x,h,c,u,a=f.data;if(!f||f.size===0)return null;for(;a[0].length<19&&a.length>1;){var v=new Uint8Array(a[0].length+a[1].length);v.set(a[0]),v.set(a[1],a[0].length),a[0]=v,a.splice(1,1)}L=a[0];var p=(L[0]<<16)+(L[1]<<8)+L[2];if(p===1){if(x=(L[4]<<8)+L[5],x&&x>f.size-6)return null;var b=L[7];b&192&&(c=(L[9]&14)*536870912+(L[10]&255)*4194304+(L[11]&254)*16384+(L[12]&255)*128+(L[13]&254)/2,b&64?(u=(L[14]&14)*536870912+(L[15]&255)*4194304+(L[16]&254)*16384+(L[17]&255)*128+(L[18]&254)/2,c-u>60*9e4&&(E.logger.warn(Math.round((c-u)/9e4)+"s delta between PTS and DTS, align them"),c=u)):u=c),h=L[8];var M=h+9;if(f.size<=M)return null;f.size-=M;for(var F=new Uint8Array(f.size),H=0,X=a.length;H<X;H++){L=a[H];var B=L.byteLength;if(M)if(M>B){M-=B;continue}else L=L.subarray(M),B-=M,M=0;F.set(L,m),m+=B}return x&&(x-=h+3),{data:F,pts:c,dts:u,len:x}}return null}function s(f,m){if(f.units.length&&f.frame){if(f.pts===void 0){var L=m.samples,x=L.length;if(x){var h=L[x-1];f.pts=h.pts,f.dts=h.dts}else{m.dropped++;return}}m.samples.push(f)}f.debug.length&&E.logger.log(f.pts+"/"+f.dts+":"+f.debug)}function d(f,m){var L=f.length;if(L>0){if(m.pts>=f[L-1].pts)f.push(m);else for(var x=L-1;x>=0;x--)if(m.pts<f[x].pts){f.splice(x,0,m);break}}else f.push(m)}function w(f){for(var m=f.byteLength,L=[],x=1;x<m-2;)f[x]===0&&f[x+1]===0&&f[x+2]===3?(L.push(x+2),x+=2):x++;if(L.length===0)return f;var h=m-L.length,c=new Uint8Array(h),u=0;for(x=0;x<h;u++,x++)u===L[0]&&(u++,L.shift()),c[x]=f[u];return c}G.default=C},"./src/errors.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"ErrorTypes",function(){return W}),D.d(G,"ErrorDetails",function(){return R});var W;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(W||(W={}));var R;(function(P){P.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",P.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",P.KEY_SYSTEM_NO_SESSION="keySystemNoSession",P.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",P.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",P.MANIFEST_LOAD_ERROR="manifestLoadError",P.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",P.MANIFEST_PARSING_ERROR="manifestParsingError",P.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",P.LEVEL_EMPTY_ERROR="levelEmptyError",P.LEVEL_LOAD_ERROR="levelLoadError",P.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",P.LEVEL_SWITCH_ERROR="levelSwitchError",P.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",P.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",P.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",P.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",P.FRAG_LOAD_ERROR="fragLoadError",P.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",P.FRAG_DECRYPT_ERROR="fragDecryptError",P.FRAG_PARSING_ERROR="fragParsingError",P.REMUX_ALLOC_ERROR="remuxAllocError",P.KEY_LOAD_ERROR="keyLoadError",P.KEY_LOAD_TIMEOUT="keyLoadTimeOut",P.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",P.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",P.BUFFER_APPEND_ERROR="bufferAppendError",P.BUFFER_APPENDING_ERROR="bufferAppendingError",P.BUFFER_STALLED_ERROR="bufferStalledError",P.BUFFER_FULL_ERROR="bufferFullError",P.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",P.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",P.INTERNAL_EXCEPTION="internalException",P.INTERNAL_ABORTED="aborted",P.UNKNOWN="unknown"})(R||(R={}))},"./src/events.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"Events",function(){return W});var W;(function(R){R.MEDIA_ATTACHING="hlsMediaAttaching",R.MEDIA_ATTACHED="hlsMediaAttached",R.MEDIA_DETACHING="hlsMediaDetaching",R.MEDIA_DETACHED="hlsMediaDetached",R.BUFFER_RESET="hlsBufferReset",R.BUFFER_CODECS="hlsBufferCodecs",R.BUFFER_CREATED="hlsBufferCreated",R.BUFFER_APPENDING="hlsBufferAppending",R.BUFFER_APPENDED="hlsBufferAppended",R.BUFFER_EOS="hlsBufferEos",R.BUFFER_FLUSHING="hlsBufferFlushing",R.BUFFER_FLUSHED="hlsBufferFlushed",R.MANIFEST_LOADING="hlsManifestLoading",R.MANIFEST_LOADED="hlsManifestLoaded",R.MANIFEST_PARSED="hlsManifestParsed",R.LEVEL_SWITCHING="hlsLevelSwitching",R.LEVEL_SWITCHED="hlsLevelSwitched",R.LEVEL_LOADING="hlsLevelLoading",R.LEVEL_LOADED="hlsLevelLoaded",R.LEVEL_UPDATED="hlsLevelUpdated",R.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",R.LEVELS_UPDATED="hlsLevelsUpdated",R.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",R.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",R.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",R.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",R.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",R.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",R.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",R.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",R.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",R.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",R.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",R.CUES_PARSED="hlsCuesParsed",R.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",R.INIT_PTS_FOUND="hlsInitPtsFound",R.FRAG_LOADING="hlsFragLoading",R.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",R.FRAG_LOADED="hlsFragLoaded",R.FRAG_DECRYPTED="hlsFragDecrypted",R.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",R.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",R.FRAG_PARSING_METADATA="hlsFragParsingMetadata",R.FRAG_PARSED="hlsFragParsed",R.FRAG_BUFFERED="hlsFragBuffered",R.FRAG_CHANGED="hlsFragChanged",R.FPS_DROP="hlsFpsDrop",R.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",R.ERROR="hlsError",R.DESTROYING="hlsDestroying",R.KEY_LOADING="hlsKeyLoading",R.KEY_LOADED="hlsKeyLoaded",R.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",R.BACK_BUFFER_REACHED="hlsBackBufferReached"})(W||(W={}))},"./src/hls.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"default",function(){return f});var W=D("./node_modules/url-toolkit/src/url-toolkit.js"),R=D.n(W),P=D("./src/loader/playlist-loader.ts"),N=D("./src/loader/key-loader.ts"),k=D("./src/controller/id3-track-controller.ts"),A=D("./src/controller/latency-controller.ts"),O=D("./src/controller/level-controller.ts"),E=D("./src/controller/fragment-tracker.ts"),T=D("./src/controller/stream-controller.ts"),_=D("./src/is-supported.ts"),C=D("./src/utils/logger.ts"),y=D("./src/config.ts"),g=D("./node_modules/eventemitter3/index.js"),l=D.n(g),o=D("./src/events.ts"),s=D("./src/errors.ts");function d(m,L){for(var x=0;x<L.length;x++){var h=L[x];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(m,h.key,h)}}function w(m,L,x){return L&&d(m.prototype,L),x&&d(m,x),m}var f=function(){m.isSupported=function(){return Object(_.isSupported)()};function m(x){x===void 0&&(x={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new g.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(y.mergeConfig)(m.DefaultConfig,x);this.userConfig=x,Object(C.enableLogs)(h.debug),this._autoLevelCapping=-1,h.progressive&&Object(y.enableStreamingMode)(h);var c=h.abrController,u=h.bufferController,a=h.capLevelController,v=h.fpsController,p=this.abrController=new c(this),b=this.bufferController=new u(this),M=this.capLevelController=new a(this),F=new v(this),H=new P.default(this),X=new N.default(this),B=new k.default(this),U=this.levelController=new O.default(this),z=new E.FragmentTracker(this),Z=this.streamController=new T.default(this,z);M.setStreamController(Z),F.setStreamController(Z);var ie=[U,Z];this.networkControllers=ie;var se=[H,X,p,b,M,F,B,z];this.audioTrackController=this.createController(h.audioTrackController,null,ie),this.createController(h.audioStreamController,z,ie),this.subtitleTrackController=this.createController(h.subtitleTrackController,null,ie),this.createController(h.subtitleStreamController,z,ie),this.createController(h.timelineController,null,se),this.emeController=this.createController(h.emeController,null,se),this.cmcdController=this.createController(h.cmcdController,null,se),this.latencyController=this.createController(A.default,null,se),this.coreComponents=se}var L=m.prototype;return L.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},L.on=function(h,c,u){u===void 0&&(u=this),this._emitter.on(h,c,u)},L.once=function(h,c,u){u===void 0&&(u=this),this._emitter.once(h,c,u)},L.removeAllListeners=function(h){this._emitter.removeAllListeners(h)},L.off=function(h,c,u,a){u===void 0&&(u=this),this._emitter.off(h,c,u,a)},L.listeners=function(h){return this._emitter.listeners(h)},L.emit=function(h,c,u){return this._emitter.emit(h,c,u)},L.trigger=function(h,c){if(this.config.debug)return this.emit(h,h,c);try{return this.emit(h,h,c)}catch(u){C.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},L.listenerCount=function(h){return this._emitter.listenerCount(h)},L.destroy=function(){C.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(h){return h.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(h){return h.destroy()}),this.coreComponents.length=0},L.attachMedia=function(h){C.logger.log("attachMedia"),this._media=h,this.trigger(o.Events.MEDIA_ATTACHING,{media:h})},L.detachMedia=function(){C.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},L.loadSource=function(h){this.stopLoad();var c=this.media,u=this.url,a=this.url=W.buildAbsoluteURL(self.location.href,h,{alwaysNormalize:!0});C.logger.log("loadSource:"+a),c&&u&&u!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:h})},L.startLoad=function(h){h===void 0&&(h=-1),C.logger.log("startLoad("+h+")"),this.networkControllers.forEach(function(c){c.startLoad(h)})},L.stopLoad=function(){C.logger.log("stopLoad"),this.networkControllers.forEach(function(h){h.stopLoad()})},L.swapAudioCodec=function(){C.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},L.recoverMediaError=function(){C.logger.log("recoverMediaError");var h=this._media;this.detachMedia(),h&&this.attachMedia(h)},L.removeLevel=function(h,c){c===void 0&&(c=0),this.levelController.removeLevel(h,c)},w(m,[{key:"levels",get:function(){var h=this.levelController.levels;return h||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(h){C.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){C.logger.log("set nextLevel:"+h),this.levelController.manualLevel=h,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(h){C.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){C.logger.log("set firstLevel:"+h),this.levelController.firstLevel=h}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(h){C.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&&(C.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:y.hlsDefaultConfig},set:function(h){m.defaultConfig=h}}]),m}();f.defaultConfig=void 0},"./src/is-supported.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"isSupported",function(){return P}),D.d(G,"changeTypeSupported",function(){return N});var W=D("./src/utils/mediasource-helper.ts");function R(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var k=Object(W.getMediaSource)();if(!k)return!1;var A=R(),O=k&&typeof k.isTypeSupported=="function"&&k.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),E=!A||A.prototype&&typeof A.prototype.appendBuffer=="function"&&typeof A.prototype.remove=="function";return!!O&&!!E}function N(){var k,A=R();return typeof(A==null||((k=A.prototype)===null||k===void 0)?void 0:k.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"default",function(){return C}),D.d(G,"LoadError",function(){return g});var W=D("./src/polyfills/number.ts"),R=D("./src/errors.ts");function P(l,o){l.prototype=Object.create(o.prototype),l.prototype.constructor=l,E(l,o)}function N(l){var o=typeof Map=="function"?new Map:void 0;return N=function(d){if(d===null||!O(d))return d;if(typeof d!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(d))return o.get(d);o.set(d,w)}function w(){return k(d,arguments,T(this).constructor)}return w.prototype=Object.create(d.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),E(w,d)},N(l)}function k(l,o,s){return A()?k=Reflect.construct:k=function(w,f,m){var L=[null];L.push.apply(L,f);var x=Function.bind.apply(w,L),h=new x;return m&&E(h,m.prototype),h},k.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(l){return!1}}function O(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function E(l,o){return E=Object.setPrototypeOf||function(d,w){return d.__proto__=w,d},E(l,o)}function T(l){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},T(l)}var _=Math.pow(2,17),C=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,w){var f=this,m=d.url;if(!m)return Promise.reject(new g({type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var L=this.config,x=L.fLoader,h=L.loader;return new Promise(function(c,u){f.loader&&f.loader.destroy();var a=f.loader=d.loader=x?new x(L):new h(L),v=y(d),p={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:_};d.stats=a.stats,a.load(v,p,{onSuccess:function(M,F,H,X){f.resetLoader(d,a),c({frag:d,part:null,payload:M.data,networkDetails:X})},onError:function(M,F,H){f.resetLoader(d,a),u(new g({type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,response:M,networkDetails:H}))},onAbort:function(M,F,H){f.resetLoader(d,a),u(new g({type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,networkDetails:H}))},onTimeout:function(M,F,H){f.resetLoader(d,a),u(new g({type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,networkDetails:H}))},onProgress:function(M,F,H,X){w&&w({frag:d,part:null,payload:H,networkDetails:X})}})})},o.loadPart=function(d,w,f){var m=this;this.abort();var L=this.config,x=L.fLoader,h=L.loader;return new Promise(function(c,u){m.loader&&m.loader.destroy();var a=m.loader=d.loader=x?new x(L):new h(L),v=y(d,w),p={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:_};w.stats=a.stats,a.load(v,p,{onSuccess:function(M,F,H,X){m.resetLoader(d,a),m.updateStatsFromPart(d,w);var B={frag:d,part:w,payload:M.data,networkDetails:X};f(B),c(B)},onError:function(M,F,H){m.resetLoader(d,a),u(new g({type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,part:w,response:M,networkDetails:H}))},onAbort:function(M,F,H){d.stats.aborted=w.stats.aborted,m.resetLoader(d,a),u(new g({type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,part:w,networkDetails:H}))},onTimeout:function(M,F,H){m.resetLoader(d,a),u(new g({type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,part:w,networkDetails:H}))}})})},o.updateStatsFromPart=function(d,w){var f=d.stats,m=w.stats,L=m.total;if(f.loaded+=m.loaded,L){var x=Math.round(d.duration/w.duration),h=Math.min(Math.round(f.loaded/L),x),c=x-h,u=c*Math.round(f.loaded/h);f.total=f.loaded+u}else f.total=Math.max(f.loaded,f.total);var a=f.loading,v=m.loading;a.start?a.first+=v.first-v.start:(a.start=v.start,a.first=v.first),a.end=v.end},o.resetLoader=function(d,w){d.loader=null,this.loader===w&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),w.destroy()},l}();function y(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},w=s.byteRangeStartOffset,f=s.byteRangeEndOffset;return Object(W.isFiniteNumber)(w)&&Object(W.isFiniteNumber)(f)&&(d.rangeStart=w,d.rangeEnd=f),d}var g=function(l){P(o,l);function o(s){for(var d,w=arguments.length,f=new Array(w>1?w-1:0),m=1;m<w;m++)f[m-1]=arguments[m];return d=l.call.apply(l,[this].concat(f))||this,d.data=void 0,d.data=s,d}return o}(N(Error))},"./src/loader/fragment.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"ElementaryStreamTypes",function(){return C}),D.d(G,"BaseSegment",function(){return y}),D.d(G,"Fragment",function(){return g}),D.d(G,"Part",function(){return l});var W=D("./src/polyfills/number.ts"),R=D("./node_modules/url-toolkit/src/url-toolkit.js"),P=D.n(R),N=D("./src/utils/logger.ts"),k=D("./src/loader/level-key.ts"),A=D("./src/loader/load-stats.ts");function O(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,E(o,s)}function E(o,s){return E=Object.setPrototypeOf||function(w,f){return w.__proto__=f,w},E(o,s)}function T(o,s){for(var d=0;d<s.length;d++){var w=s[d];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function _(o,s,d){return s&&T(o.prototype,s),d&&T(o,d),o}var C;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(C||(C={}));var y=function(){function o(d){var w;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(w={},w[C.AUDIO]=null,w[C.VIDEO]=null,w[C.AUDIOVIDEO]=null,w),this.baseurl=d}var s=o.prototype;return s.setByteRange=function(w,f){var m=w.split("@",2),L=[];m.length===1?L[0]=f?f.byteRangeEndOffset:0:L[0]=parseInt(m[1]),L[1]=parseInt(m[0])+L[0],this._byteRange=L},_(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(R.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(w){this._url=w}}]),o}(),g=function(o){O(s,o);function s(w,f){var m;return m=o.call(this,f)||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 A.LoadStats,m.urlId=0,m.data=void 0,m.bitrateTest=!1,m.title=null,m.initSegment=null,m.type=w,m}var d=s.prototype;return d.createInitializationVector=function(f){for(var m=new Uint8Array(16),L=12;L<16;L++)m[L]=f>>8*(15-L)&255;return m},d.setDecryptDataFromLevelKey=function(f,m){var L=f;return(f==null?void 0:f.method)==="AES-128"&&f.uri&&!f.iv&&(L=k.LevelKey.fromURI(f.uri),L.method=f.method,L.iv=this.createInitializationVector(m),L.keyFormat="identity"),L},d.setElementaryStreamInfo=function(f,m,L,x,h,c){c===void 0&&(c=!1);var u=this.elementaryStreams,a=u[f];if(!a){u[f]={startPTS:m,endPTS:L,startDTS:x,endDTS:h,partial:c};return}a.startPTS=Math.min(a.startPTS,m),a.endPTS=Math.max(a.endPTS,L),a.startDTS=Math.min(a.startDTS,x),a.endDTS=Math.max(a.endDTS,h)},d.clearElementaryStreamInfo=function(){var f=this.elementaryStreams;f[C.AUDIO]=null,f[C.VIDEO]=null,f[C.AUDIOVIDEO]=null},_(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var f=this.sn;typeof f!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&N.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),f=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,f)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(W.isFiniteNumber)(this.programDateTime))return null;var f=Object(W.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+f*1e3}},{key:"encrypted",get:function(){var f;return!!((f=this.decryptdata)!==null&&f!==void 0&&f.keyFormat&&this.decryptdata.uri)}}]),s}(y),l=function(o){O(s,o);function s(d,w,f,m,L){var x;x=o.call(this,f)||this,x.fragOffset=0,x.duration=0,x.gap=!1,x.independent=!1,x.relurl=void 0,x.fragment=void 0,x.index=void 0,x.stats=new A.LoadStats,x.duration=d.decimalFloatingPoint("DURATION"),x.gap=d.bool("GAP"),x.independent=d.bool("INDEPENDENT"),x.relurl=d.enumeratedString("URI"),x.fragment=w,x.index=m;var h=d.enumeratedString("BYTERANGE");return h&&x.setByteRange(h,L),L&&(x.fragOffset=L.fragOffset+L.duration),x}return _(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 w=this.elementaryStreams;return!!(w.audio||w.video||w.audiovideo)}}]),s}(y)},"./src/loader/key-loader.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"default",function(){return N});var W=D("./src/events.ts"),R=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),N=function(){function k(O){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=O,this._registerListeners()}var A=k.prototype;return A._registerListeners=function(){this.hls.on(W.Events.KEY_LOADING,this.onKeyLoading,this)},A._unregisterListeners=function(){this.hls.off(W.Events.KEY_LOADING,this.onKeyLoading)},A.destroy=function(){this._unregisterListeners();for(var E in this.loaders){var T=this.loaders[E];T&&T.destroy()}this.loaders={}},A.onKeyLoading=function(E,T){var _=T.frag,C=_.type,y=this.loaders[C];if(!_.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var g=_.decryptdata.uri;if(g!==this.decrypturl||this.decryptkey===null){var l=this.hls.config;if(y&&(P.logger.warn("abort previous key loader for type:"+C),y.abort()),!g){P.logger.warn("key uri is falsy");return}var o=l.loader,s=_.loader=this.loaders[C]=new o(l);this.decrypturl=g,this.decryptkey=null;var d={url:g,frag:_,responseType:"arraybuffer"},w={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(d,w,f)}else this.decryptkey&&(_.decryptdata.key=this.decryptkey,this.hls.trigger(W.Events.KEY_LOADED,{frag:_}))},A.loadsuccess=function(E,T,_){var C=_.frag;if(!C.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=C.decryptdata.key=new Uint8Array(E.data),C.loader=null,delete this.loaders[C.type],this.hls.trigger(W.Events.KEY_LOADED,{frag:C})},A.loaderror=function(E,T){var _=T.frag,C=_.loader;C&&C.abort(),delete this.loaders[_.type],this.hls.trigger(W.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:_,response:E})},A.loadtimeout=function(E,T){var _=T.frag,C=_.loader;C&&C.abort(),delete this.loaders[_.type],this.hls.trigger(W.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:_})},k}()},"./src/loader/level-details.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"LevelDetails",function(){return k});var W=D("./src/polyfills/number.ts");function R(A,O){for(var E=0;E<O.length;E++){var T=O[E];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(A,T.key,T)}}function P(A,O,E){return O&&R(A.prototype,O),E&&R(A,E),A}var N=10,k=function(){function A(E){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=E}var O=A.prototype;return O.reloaded=function(T){if(!T){this.advanced=!0,this.updated=!0;return}var _=this.lastPartSn-T.lastPartSn,C=this.lastPartIndex-T.lastPartIndex;this.updated=this.endSN!==T.endSN||!!C||!!_,this.advanced=this.endSN>T.endSN||_>0||_===0&&C>0,this.updated||this.advanced?this.misses=Math.floor(T.misses*.6):this.misses=T.misses+1,this.availabilityDelay=T.availabilityDelay},P(A,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(W.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||N}},{key:"drift",get:function(){var T=this.driftEndTime-this.driftStartTime;if(T>0){var _=this.driftEnd-this.driftStart;return _*1e3/T}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var T;return(T=this.fragments)!==null&&T!==void 0&&T.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 T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),A}()},"./src/loader/level-key.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"LevelKey",function(){return k});var W=D("./node_modules/url-toolkit/src/url-toolkit.js"),R=D.n(W);function P(A,O){for(var E=0;E<O.length;E++){var T=O[E];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(A,T.key,T)}}function N(A,O,E){return O&&P(A.prototype,O),E&&P(A,E),A}var k=function(){A.fromURL=function(E,T){return new A(E,T)},A.fromURI=function(E){return new A(E)};function A(O,E){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,E?this._uri=Object(W.buildAbsoluteURL)(O,E,{alwaysNormalize:!0}):this._uri=O}return N(A,[{key:"uri",get:function(){return this._uri}}]),A}()},"./src/loader/load-stats.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"LoadStats",function(){return W});var W=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"default",function(){return s});var W=D("./src/polyfills/number.ts"),R=D("./node_modules/url-toolkit/src/url-toolkit.js"),P=D.n(R),N=D("./src/loader/fragment.ts"),k=D("./src/loader/level-details.ts"),A=D("./src/loader/level-key.ts"),O=D("./src/utils/attr-list.ts"),E=D("./src/utils/logger.ts"),T=D("./src/utils/codecs.ts"),_=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,C=/#EXT-X-MEDIA:(.*)/g,y=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),g=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(L){var x,h;return l.test((x=(h=R.parseURL(L))===null||h===void 0?void 0:h.path)!=null?x:"")}var s=function(){function L(){}return L.findGroup=function(h,c){for(var u=0;u<h.length;u++){var a=h[u];if(a.id===c)return a}},L.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},L.resolve=function(h,c){return R.buildAbsoluteURL(c,h,{alwaysNormalize:!0})},L.parseMasterPlaylist=function(h,c){var u=[],a={},v=!1;_.lastIndex=0;for(var p;(p=_.exec(h))!=null;)if(p[1]){var b=new O.AttrList(p[1]),M={attrs:b,bitrate:b.decimalInteger("AVERAGE-BANDWIDTH")||b.decimalInteger("BANDWIDTH"),name:b.NAME,url:L.resolve(p[2],c)},F=b.decimalResolution("RESOLUTION");F&&(M.width=F.width,M.height=F.height),d((b.CODECS||"").split(/[ ,]+/).filter(function(X){return X}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=L.convertAVC1ToAVCOTI(M.videoCodec)),u.push(M)}else if(p[3]){var H=new O.AttrList(p[3]);H["DATA-ID"]&&(v=!0,a[H["DATA-ID"]]=H)}return{levels:u,sessionData:v?a:null}},L.parseMasterPlaylistMedia=function(h,c,u,a){a===void 0&&(a=[]);var v,p=[],b=0;for(C.lastIndex=0;(v=C.exec(h))!==null;){var M=new O.AttrList(v[1]);if(M.TYPE===u){var F={attrs:M,bitrate:0,id:b++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:u,default:M.bool("DEFAULT"),autoselect:M.bool("AUTOSELECT"),forced:M.bool("FORCED"),lang:M.LANGUAGE,url:M.URI?L.resolve(M.URI,c):""};if(a.length){var H=L.findGroup(a,F.groupId)||a[0];w(F,H,"audioCodec"),w(F,H,"textCodec")}p.push(F)}}return p},L.parseLevelPlaylist=function(h,c,u,a,v){var p=new k.LevelDetails(c),b=p.fragments,M=null,F=0,H=0,X=0,B=0,U=null,z=new N.Fragment(a,c),Z,ie,se,Te=-1,he=!1;for(y.lastIndex=0,p.m3u8=h;(Z=y.exec(h))!==null;){he&&(he=!1,z=new N.Fragment(a,c),z.start=X,z.sn=F,z.cc=B,z.level=u,M&&(z.initSegment=M,z.rawProgramDateTime=M.rawProgramDateTime));var xe=Z[1];if(xe){z.duration=parseFloat(xe);var pe=(" "+Z[2]).slice(1);z.title=pe||null,z.tagList.push(pe?["INF",xe,pe]:["INF",xe])}else if(Z[3])Object(W.isFiniteNumber)(z.duration)&&(z.start=X,se&&(z.levelkey=se),z.sn=F,z.level=u,z.cc=B,z.urlId=v,b.push(z),z.relurl=(" "+Z[3]).slice(1),m(z,U),U=z,X+=z.duration,F++,H=0,he=!0);else if(Z[4]){var ge=(" "+Z[4]).slice(1);U?z.setByteRange(ge,U):z.setByteRange(ge)}else if(Z[5])z.rawProgramDateTime=(" "+Z[5]).slice(1),z.tagList.push(["PROGRAM-DATE-TIME",z.rawProgramDateTime]),Te===-1&&(Te=b.length);else{if(Z=Z[0].match(g),!Z){E.logger.warn("No matches on slow regex match for level playlist!");continue}for(ie=1;ie<Z.length&&!(typeof Z[ie]!="undefined");ie++);var le=(" "+Z[ie]).slice(1),ue=(" "+Z[ie+1]).slice(1),Le=Z[ie+2]?(" "+Z[ie+2]).slice(1):"";switch(le){case"PLAYLIST-TYPE":p.type=ue.toUpperCase();break;case"MEDIA-SEQUENCE":F=p.startSN=parseInt(ue);break;case"SKIP":{var Fe=new O.AttrList(ue),Ie=Fe.decimalInteger("SKIPPED-SEGMENTS");if(Object(W.isFiniteNumber)(Ie)){p.skippedSegments=Ie;for(var Ne=Ie;Ne--;)b.unshift(null);F+=Ie}var Ue=Fe.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ue&&(p.recentlyRemovedDateranges=Ue.split(" "));break}case"TARGETDURATION":p.targetduration=parseFloat(ue);break;case"VERSION":p.version=parseInt(ue);break;case"EXTM3U":break;case"ENDLIST":p.live=!1;break;case"#":(ue||Le)&&z.tagList.push(Le?[ue,Le]:[ue]);break;case"DIS":B++;case"GAP":z.tagList.push([le]);break;case"BITRATE":z.tagList.push([le,ue]);break;case"DISCONTINUITY-SEQ":B=parseInt(ue);break;case"KEY":{var Ee,ye=new O.AttrList(ue),_e=ye.enumeratedString("METHOD"),Me=ye.URI,Pe=ye.hexadecimalInteger("IV"),we=ye.enumeratedString("KEYFORMATVERSIONS"),Ce=ye.enumeratedString("KEYID"),Ye=(Ee=ye.enumeratedString("KEYFORMAT"))!=null?Ee:"identity",Ge=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ge.indexOf(Ye)>-1){E.logger.warn("Keyformat "+Ye+" is not supported from the manifest");continue}else if(Ye!=="identity")continue;_e&&(se=A.LevelKey.fromURL(c,Me),Me&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(_e)>=0&&(se.method=_e,se.keyFormat=Ye,Ce&&(se.keyID=Ce),we&&(se.keyFormatVersions=we),se.iv=Pe));break}case"START":{var ze=new O.AttrList(ue),Be=ze.decimalFloatingPoint("TIME-OFFSET");Object(W.isFiniteNumber)(Be)&&(p.startTimeOffset=Be);break}case"MAP":{var rt=new O.AttrList(ue);z.relurl=rt.URI,rt.BYTERANGE&&z.setByteRange(rt.BYTERANGE),z.level=u,z.sn="initSegment",se&&(z.levelkey=se),z.initSegment=null,M=z,he=!0;break}case"SERVER-CONTROL":{var Ve=new O.AttrList(ue);p.canBlockReload=Ve.bool("CAN-BLOCK-RELOAD"),p.canSkipUntil=Ve.optionalFloat("CAN-SKIP-UNTIL",0),p.canSkipDateRanges=p.canSkipUntil>0&&Ve.bool("CAN-SKIP-DATERANGES"),p.partHoldBack=Ve.optionalFloat("PART-HOLD-BACK",0),p.holdBack=Ve.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var We=new O.AttrList(ue);p.partTarget=We.decimalFloatingPoint("PART-TARGET");break}case"PART":{var ve=p.partList;ve||(ve=p.partList=[]);var qe=H>0?ve[ve.length-1]:void 0,Xe=H++,be=new N.Part(new O.AttrList(ue),z,c,Xe,qe);ve.push(be),z.duration+=be.duration;break}case"PRELOAD-HINT":{var Oe=new O.AttrList(ue);p.preloadHint=Oe;break}case"RENDITION-REPORT":{var te=new O.AttrList(ue);p.renditionReports=p.renditionReports||[],p.renditionReports.push(te);break}default:E.logger.warn("line parsed but not handled: "+Z);break}}}U&&!U.relurl?(b.pop(),X-=U.duration,p.partList&&(p.fragmentHint=U)):p.partList&&(m(z,U),z.cc=B,p.fragmentHint=z);var ne=b.length,ae=b[0],Y=b[ne-1];if(X+=p.skippedSegments*p.targetduration,X>0&&ne&&Y){p.averagetargetduration=X/ne;var $=Y.sn;p.endSN=$!=="initSegment"?$:0,ae&&(p.startCC=ae.cc,ae.initSegment||p.fragments.every(function(J){return J.relurl&&o(J.relurl)})&&(E.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),z=new N.Fragment(a,c),z.relurl=Y.relurl,z.level=u,z.sn="initSegment",ae.initSegment=z,p.needSidxRanges=!0))}else p.endSN=0,p.startCC=0;return p.fragmentHint&&(X+=p.fragmentHint.duration),p.totalduration=X,p.endCC=B,Te>0&&f(b,Te),p},L}();function d(L,x){["video","audio","text"].forEach(function(h){var c=L.filter(function(a){return Object(T.isCodecType)(a,h)});if(c.length){var u=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});x[h+"Codec"]=u.length>0?u[0]:c[0],L=L.filter(function(a){return c.indexOf(a)===-1})}}),x.unknownCodecs=L}function w(L,x,h){var c=x[h];c&&(L[h]=c)}function f(L,x){for(var h=L[x],c=x;c--;){var u=L[c];if(!u)return;u.programDateTime=h.programDateTime-u.duration*1e3,h=u}}function m(L,x){L.rawProgramDateTime?L.programDateTime=Date.parse(L.rawProgramDateTime):x!=null&&x.programDateTime&&(L.programDateTime=x.endProgramDateTime),Object(W.isFiniteNumber)(L.programDateTime)||(L.programDateTime=null,L.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ee,G,D){"use strict";D.r(G);var W=D("./src/polyfills/number.ts"),R=D("./src/events.ts"),P=D("./src/errors.ts"),N=D("./src/utils/logger.ts"),k=D("./src/utils/mp4-tools.ts"),A=D("./src/loader/m3u8-parser.ts"),O=D("./src/types/loader.ts"),E=D("./src/utils/attr-list.ts");function T(y){var g=y.type;switch(g){case O.PlaylistContextType.AUDIO_TRACK:return O.PlaylistLevelType.AUDIO;case O.PlaylistContextType.SUBTITLE_TRACK:return O.PlaylistLevelType.SUBTITLE;default:return O.PlaylistLevelType.MAIN}}function _(y,g){var l=y.url;return(l===void 0||l.indexOf("data:")===0)&&(l=g.url),l}var C=function(){function y(l){this.hls=void 0,this.loaders=Object.create(null),this.hls=l,this.registerListeners()}var g=y.prototype;return g.registerListeners=function(){var o=this.hls;o.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(R.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(R.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(R.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.unregisterListeners=function(){var o=this.hls;o.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(R.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(R.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(R.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.createInternalLoader=function(o){var s=this.hls.config,d=s.pLoader,w=s.loader,f=d||w,m=new f(s);return o.loader=m,this.loaders[o.type]=m,m},g.getInternalLoader=function(o){return this.loaders[o.type]},g.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},g.destroyInternalLoaders=function(){for(var o in this.loaders){var s=this.loaders[o];s&&s.destroy(),this.resetInternalLoader(o)}},g.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},g.onManifestLoading=function(o,s){var d=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:O.PlaylistContextType.MANIFEST,url:d,deliveryDirectives:null})},g.onLevelLoading=function(o,s){var d=s.id,w=s.level,f=s.url,m=s.deliveryDirectives;this.load({id:d,groupId:null,level:w,responseType:"text",type:O.PlaylistContextType.LEVEL,url:f,deliveryDirectives:m})},g.onAudioTrackLoading=function(o,s){var d=s.id,w=s.groupId,f=s.url,m=s.deliveryDirectives;this.load({id:d,groupId:w,level:null,responseType:"text",type:O.PlaylistContextType.AUDIO_TRACK,url:f,deliveryDirectives:m})},g.onSubtitleTrackLoading=function(o,s){var d=s.id,w=s.groupId,f=s.url,m=s.deliveryDirectives;this.load({id:d,groupId:w,level:null,responseType:"text",type:O.PlaylistContextType.SUBTITLE_TRACK,url:f,deliveryDirectives:m})},g.load=function(o){var s,d=this.hls.config,w=this.getInternalLoader(o);if(w){var f=w.context;if(f&&f.url===o.url){N.logger.trace("[playlist-loader]: playlist request ongoing");return}N.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),w.abort()}var m,L,x,h;switch(o.type){case O.PlaylistContextType.MANIFEST:m=d.manifestLoadingMaxRetry,L=d.manifestLoadingTimeOut,x=d.manifestLoadingRetryDelay,h=d.manifestLoadingMaxRetryTimeout;break;case O.PlaylistContextType.LEVEL:case O.PlaylistContextType.AUDIO_TRACK:case O.PlaylistContextType.SUBTITLE_TRACK:m=0,L=d.levelLoadingTimeOut;break;default:m=d.levelLoadingMaxRetry,L=d.levelLoadingTimeOut,x=d.levelLoadingRetryDelay,h=d.levelLoadingMaxRetryTimeout;break}if(w=this.createInternalLoader(o),(s=o.deliveryDirectives)!==null&&s!==void 0&&s.part){var c;if(o.type===O.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===O.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===O.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var u=c.partTarget,a=c.targetduration;u&&a&&(L=Math.min(Math.max(u*3,a*.8)*1e3,L))}}var v={timeout:L,maxRetry:m,retryDelay:x,maxRetryDelay:h,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};w.load(o,v,p)},g.loadsuccess=function(o,s,d,w){if(w===void 0&&(w=null),d.isSidxRequest){this.handleSidxRequest(o,d),this.handlePlaylistLoaded(o,s,d,w);return}this.resetInternalLoader(d.type);var f=o.data;if(f.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,d,"no EXTM3U delimiter",w);return}s.parsing.start=performance.now(),f.indexOf("#EXTINF:")>0||f.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,s,d,w):this.handleMasterPlaylist(o,s,d,w)},g.loaderror=function(o,s,d){d===void 0&&(d=null),this.handleNetworkError(s,d,!1,o)},g.loadtimeout=function(o,s,d){d===void 0&&(d=null),this.handleNetworkError(s,d,!0)},g.handleMasterPlaylist=function(o,s,d,w){var f=this.hls,m=o.data,L=_(o,d),x=A.default.parseMasterPlaylist(m,L),h=x.levels,c=x.sessionData;if(!h.length){this.handleManifestParsingError(o,d,"no level found in manifest",w);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}}),v=A.default.parseMasterPlaylistMedia(m,L,"AUDIO",u),p=A.default.parseMasterPlaylistMedia(m,L,"SUBTITLES",a),b=A.default.parseMasterPlaylistMedia(m,L,"CLOSED-CAPTIONS");if(v.length){var M=v.some(function(F){return!F.url});!M&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(N.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),v.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new E.AttrList({}),bitrate:0,url:""}))}f.trigger(R.Events.MANIFEST_LOADED,{levels:h,audioTracks:v,subtitles:p,captions:b,url:L,stats:s,networkDetails:w,sessionData:c})},g.handleTrackOrLevelPlaylist=function(o,s,d,w){var f=this.hls,m=d.id,L=d.level,x=d.type,h=_(o,d),c=Object(W.isFiniteNumber)(m)?m:0,u=Object(W.isFiniteNumber)(L)?L:c,a=T(d),v=A.default.parseLevelPlaylist(o.data,h,u,a,c);if(!v.fragments.length){f.trigger(R.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.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(x===O.PlaylistContextType.MANIFEST){var p={attrs:new E.AttrList({}),bitrate:0,details:v,name:"",url:h};f.trigger(R.Events.MANIFEST_LOADED,{levels:[p],audioTracks:[],url:h,stats:s,networkDetails:w,sessionData:null})}if(s.parsing.end=performance.now(),v.needSidxRanges){var b,M=(b=v.fragments[0].initSegment)===null||b===void 0?void 0:b.url;this.load({url:M,isSidxRequest:!0,type:x,level:L,levelDetails:v,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}d.levelDetails=v,this.handlePlaylistLoaded(o,s,d,w)},g.handleSidxRequest=function(o,s){var d=Object(k.parseSegmentIndex)(new Uint8Array(o.data));if(!d)return;var w=d.references,f=s.levelDetails;w.forEach(function(m,L){var x=m.info,h=f.fragments[L];h.byteRange.length===0&&h.setByteRange(String(1+x.end-x.start)+"@"+String(x.start)),h.initSegment&&h.initSegment.setByteRange(String(d.moovEndOffset)+"@0")})},g.handleManifestParsingError=function(o,s,d,w){this.hls.trigger(R.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===O.PlaylistContextType.MANIFEST,url:o.url,reason:d,response:o,context:s,networkDetails:w})},g.handleNetworkError=function(o,s,d,w){d===void 0&&(d=!1),N.logger.warn("[playlist-loader]: A network "+(d?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var f=P.ErrorDetails.UNKNOWN,m=!1,L=this.getInternalLoader(o);switch(o.type){case O.PlaylistContextType.MANIFEST:f=d?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case O.PlaylistContextType.LEVEL:f=d?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case O.PlaylistContextType.AUDIO_TRACK:f=d?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case O.PlaylistContextType.SUBTITLE_TRACK:f=d?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}L&&this.resetInternalLoader(o.type);var x={type:P.ErrorTypes.NETWORK_ERROR,details:f,fatal:m,url:o.url,loader:L,context:o,networkDetails:s};w&&(x.response=w),this.hls.trigger(R.Events.ERROR,x)},g.handlePlaylistLoaded=function(o,s,d,w){var f=d.type,m=d.level,L=d.id,x=d.groupId,h=d.loader,c=d.levelDetails,u=d.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,d,"invalid target duration",w);return}if(!h)return;c.live&&(h.getCacheAge&&(c.ageHeader=h.getCacheAge()||0),(!h.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(f){case O.PlaylistContextType.MANIFEST:case O.PlaylistContextType.LEVEL:this.hls.trigger(R.Events.LEVEL_LOADED,{details:c,level:m||0,id:L||0,stats:s,networkDetails:w,deliveryDirectives:u});break;case O.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(R.Events.AUDIO_TRACK_LOADED,{details:c,id:L||0,groupId:x||"",stats:s,networkDetails:w,deliveryDirectives:u});break;case O.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(R.Events.SUBTITLE_TRACK_LOADED,{details:c,id:L||0,groupId:x||"",stats:s,networkDetails:w,deliveryDirectives:u});break}},y}();G.default=C},"./src/polyfills/number.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"isFiniteNumber",function(){return W}),D.d(G,"MAX_SAFE_INTEGER",function(){return R});var W=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},R=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ee,G,D){"use strict";D.r(G);var W=function(){function R(){}return R.getSilentFrame=function(N,k){switch(N){case"mp4a.40.2":if(k===1)return new Uint8Array([0,200,0,128,35,128]);if(k===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(k===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(k===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(k===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(k===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(k===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(k===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(k===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},R}();G.default=W},"./src/remux/mp4-generator.ts":function(ee,G,D){"use strict";D.r(G);var W=Math.pow(2,32)-1,R=function(){function P(){}return P.init=function(){P.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var k;for(k in P.types)P.types.hasOwnProperty(k)&&(P.types[k]=[k.charCodeAt(0),k.charCodeAt(1),k.charCodeAt(2),k.charCodeAt(3)]);var A=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]),O=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);P.HDLR_TYPES={video:A,audio:O};var E=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),T=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=T,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var _=new Uint8Array([105,115,111,109]),C=new Uint8Array([97,118,99,49]),y=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,_,y,_,C),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,E))},P.box=function(k){for(var A=8,O=arguments.length,E=new Array(O>1?O-1:0),T=1;T<O;T++)E[T-1]=arguments[T];for(var _=E.length,C=_;_--;)A+=E[_].byteLength;var y=new Uint8Array(A);for(y[0]=A>>24&255,y[1]=A>>16&255,y[2]=A>>8&255,y[3]=A&255,y.set(k,4),_=0,A=8;_<C;_++)y.set(E[_],A),A+=E[_].byteLength;return y},P.hdlr=function(k){return P.box(P.types.hdlr,P.HDLR_TYPES[k])},P.mdat=function(k){return P.box(P.types.mdat,k)},P.mdhd=function(k,A){A*=k;var O=Math.floor(A/(W+1)),E=Math.floor(A%(W+1));return P.box(P.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,O>>24,O>>16&255,O>>8&255,O&255,E>>24,E>>16&255,E>>8&255,E&255,85,196,0,0]))},P.mdia=function(k){return P.box(P.types.mdia,P.mdhd(k.timescale,k.duration),P.hdlr(k.type),P.minf(k))},P.mfhd=function(k){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255]))},P.minf=function(k){return k.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(k)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(k))},P.moof=function(k,A,O){return P.box(P.types.moof,P.mfhd(k),P.traf(O,A))},P.moov=function(k){for(var A=k.length,O=[];A--;)O[A]=P.trak(k[A]);return P.box.apply(null,[P.types.moov,P.mvhd(k[0].timescale,k[0].duration)].concat(O).concat(P.mvex(k)))},P.mvex=function(k){for(var A=k.length,O=[];A--;)O[A]=P.trex(k[A]);return P.box.apply(null,[P.types.mvex].concat(O))},P.mvhd=function(k,A){A*=k;var O=Math.floor(A/(W+1)),E=Math.floor(A%(W+1)),T=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,O>>24,O>>16&255,O>>8&255,O&255,E>>24,E>>16&255,E>>8&255,E&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return P.box(P.types.mvhd,T)},P.sdtp=function(k){var A=k.samples||[],O=new Uint8Array(4+A.length),E,T;for(E=0;E<A.length;E++)T=A[E].flags,O[E+4]=T.dependsOn<<4|T.isDependedOn<<2|T.hasRedundancy;return P.box(P.types.sdtp,O)},P.stbl=function(k){return P.box(P.types.stbl,P.stsd(k),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))},P.avc1=function(k){var A=[],O=[],E,T,_;for(E=0;E<k.sps.length;E++)T=k.sps[E],_=T.byteLength,A.push(_>>>8&255),A.push(_&255),A=A.concat(Array.prototype.slice.call(T));for(E=0;E<k.pps.length;E++)T=k.pps[E],_=T.byteLength,O.push(_>>>8&255),O.push(_&255),O=O.concat(Array.prototype.slice.call(T));var C=P.box(P.types.avcC,new Uint8Array([1,A[3],A[4],A[5],252|3,224|k.sps.length].concat(A).concat([k.pps.length]).concat(O))),y=k.width,g=k.height,l=k.pixelRatio[0],o=k.pixelRatio[1];return P.box(P.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,y>>8&255,y&255,g>>8&255,g&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),C,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([l>>24,l>>16&255,l>>8&255,l&255,o>>24,o>>16&255,o>>8&255,o&255])))},P.esds=function(k){var A=k.config.length;return new Uint8Array([0,0,0,0,3,23+A,0,1,0,4,15+A,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([A]).concat(k.config).concat([6,1,2]))},P.mp4a=function(k){var A=k.samplerate;return P.box(P.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,k.channelCount,0,16,0,0,0,0,A>>8&255,A&255,0,0]),P.box(P.types.esds,P.esds(k)))},P.mp3=function(k){var A=k.samplerate;return P.box(P.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,k.channelCount,0,16,0,0,0,0,A>>8&255,A&255,0,0]))},P.stsd=function(k){return k.type==="audio"?!k.isAAC&&k.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(k)):P.box(P.types.stsd,P.STSD,P.mp4a(k)):P.box(P.types.stsd,P.STSD,P.avc1(k))},P.tkhd=function(k){var A=k.id,O=k.duration*k.timescale,E=k.width,T=k.height,_=Math.floor(O/(W+1)),C=Math.floor(O%(W+1));return P.box(P.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,A>>24&255,A>>16&255,A>>8&255,A&255,0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,C>>24,C>>16&255,C>>8&255,C&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,E>>8&255,E&255,0,0,T>>8&255,T&255,0,0]))},P.traf=function(k,A){var O=P.sdtp(k),E=k.id,T=Math.floor(A/(W+1)),_=Math.floor(A%(W+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,E>>24,E>>16&255,E>>8&255,E&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,T>>24,T>>16&255,T>>8&255,T&255,_>>24,_>>16&255,_>>8&255,_&255])),P.trun(k,O.length+16+20+8+16+8+8),O)},P.trak=function(k){return k.duration=k.duration||4294967295,P.box(P.types.trak,P.tkhd(k),P.mdia(k))},P.trex=function(k){var A=k.id;return P.box(P.types.trex,new Uint8Array([0,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},P.trun=function(k,A){var O=k.samples||[],E=O.length,T=12+16*E,_=new Uint8Array(T),C,y,g,l,o,s;for(A+=8+T,_.set([0,0,15,1,E>>>24&255,E>>>16&255,E>>>8&255,E&255,A>>>24&255,A>>>16&255,A>>>8&255,A&255],0),C=0;C<E;C++)y=O[C],g=y.duration,l=y.size,o=y.flags,s=y.cts,_.set([g>>>24&255,g>>>16&255,g>>>8&255,g&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*C);return P.box(P.types.trun,_)},P.initSegment=function(k){P.types||P.init();var A=P.moov(k),O=new Uint8Array(P.FTYP.byteLength+A.byteLength);return O.set(P.FTYP),O.set(A,P.FTYP.byteLength),O},P}();R.types=void 0,R.HDLR_TYPES=void 0,R.STTS=void 0,R.STSC=void 0,R.STCO=void 0,R.STSZ=void 0,R.VMHD=void 0,R.SMHD=void 0,R.STSD=void 0,R.FTYP=void 0,R.DINF=void 0,G.default=R},"./src/remux/mp4-remuxer.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"default",function(){return s}),D.d(G,"normalizePts",function(){return d});var W=D("./src/polyfills/number.ts"),R=D("./src/remux/aac-helper.ts"),P=D("./src/remux/mp4-generator.ts"),N=D("./src/events.ts"),k=D("./src/errors.ts"),A=D("./src/utils/logger.ts"),O=D("./src/types/loader.ts"),E=D("./src/utils/timescale-conversion.ts");function T(){return T=Object.assign||function(L){for(var x=1;x<arguments.length;x++){var h=arguments[x];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(L[c]=h[c])}return L},T.apply(this,arguments)}var _=10*1e3,C=1024,y=1152,g=null,l=null,o=!1,s=function(){function L(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,g===null){var v=navigator.userAgent||"",p=v.match(/Chrome\/(\d+)/i);g=p?parseInt(p[1]):0}if(l===null){var b=navigator.userAgent.match(/Safari\/(\d+)/i);l=b?parseInt(b[1]):0}o=!!g&&g<75||!!l&&l<600}var x=L.prototype;return x.destroy=function(){},x.resetTimeStamp=function(c){A.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},x.resetNextTimestamp=function(){A.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},x.resetInitSegment=function(){A.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},x.getVideoStartPts=function(c){var u=!1,a=c.reduce(function(v,p){var b=p.pts-v;return b<-4294967296?(u=!0,d(v,p.pts)):b>0?v:p.pts},c[0].pts);return u&&A.logger.debug("PTS rollover detected"),a},x.remux=function(c,u,a,v,p,b,M,F){var H,X,B,U,z,Z,ie=p,se=p,Te=c.pid>-1,he=u.pid>-1,xe=u.samples.length,pe=c.samples.length>0,ge=xe>1,le=(!Te||pe)&&(!he||ge)||this.ISGenerated||M;if(le){this.ISGenerated||(B=this.generateIS(c,u,p));var ue=this.isVideoContiguous,Le=-1;if(ge&&(Le=w(u.samples),!ue&&this.config.forceKeyFrameOnDiscontinuity))if(Z=!0,Le>0){A.logger.warn("[mp4-remuxer]: Dropped "+Le+" out of "+xe+" video samples due to a missing keyframe");var Fe=this.getVideoStartPts(u.samples);u.samples=u.samples.slice(Le),u.dropped+=Le,se+=(u.samples[0].pts-Fe)/(u.timescale||9e4)}else Le===-1&&(A.logger.warn("[mp4-remuxer]: No keyframe found out of "+xe+" video samples"),Z=!1);if(this.ISGenerated){if(pe&&ge){var Ie=this.getVideoStartPts(u.samples),Ne=d(c.samples[0].pts,Ie)-Ie,Ue=Ne/u.inputTimeScale;ie+=Math.max(0,Ue),se+=Math.max(0,-Ue)}if(pe){if(c.samplerate||(A.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),B=this.generateIS(c,u,p)),X=this.remuxAudio(c,ie,this.isAudioContiguous,b,he||ge||F===O.PlaylistLevelType.AUDIO?se:void 0),ge){var Ee=X?X.endPTS-X.startPTS:0;u.inputTimeScale||(A.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),B=this.generateIS(c,u,p)),H=this.remuxVideo(u,se,ue,Ee)}}else ge&&(H=this.remuxVideo(u,se,ue,0));H&&(H.firstKeyFrame=Le,H.independent=Le!==-1)}}return this.ISGenerated&&(a.samples.length&&(z=this.remuxID3(a,p)),v.samples.length&&(U=this.remuxText(v,p))),{audio:X,video:H,initSegment:B,independent:Z,text:U,id3:z}},x.generateIS=function(c,u,a){var v=c.samples,p=u.samples,b=this.typeSupported,M={},F=!Object(W.isFiniteNumber)(this._initPTS),H="audio/mp4",X,B,U;if(F&&(X=B=Infinity),c.config&&v.length&&(c.timescale=c.samplerate,c.isAAC||(b.mpeg?(H="audio/mpeg",c.codec=""):b.mp3&&(c.codec="mp3")),M.audio={id:"audio",container:H,codec:c.codec,initSegment:!c.isAAC&&b.mpeg?new Uint8Array(0):P.default.initSegment([c]),metadata:{channelCount:c.channelCount}},F&&(U=c.inputTimeScale,X=B=v[0].pts-Math.round(U*a))),u.sps&&u.pps&&p.length&&(u.timescale=u.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:u.codec,initSegment:P.default.initSegment([u]),metadata:{width:u.width,height:u.height}},F)){U=u.inputTimeScale;var z=this.getVideoStartPts(p),Z=Math.round(U*a);B=Math.min(B,d(p[0].dts,z)-Z),X=Math.min(X,z-Z)}if(Object.keys(M).length)return this.ISGenerated=!0,F&&(this._initPTS=X,this._initDTS=B),{tracks:M,initPTS:X,timescale:U}},x.remuxVideo=function(c,u,a,v){var p=c.inputTimeScale,b=c.samples,M=[],F=b.length,H=this._initPTS,X=this.nextAvcDts,B=8,U,z,Z,ie=Number.POSITIVE_INFINITY,se=Number.NEGATIVE_INFINITY,Te=0,he=!1;if(!a||X===null){var xe=u*p,pe=b[0].pts-d(b[0].dts,b[0].pts);X=xe-pe}for(var ge=0;ge<F;ge++){var le=b[ge];if(le.pts=d(le.pts-H,X),le.dts=d(le.dts-H,X),le.dts>le.pts){var ue=9e4*.2;Te=Math.max(Math.min(Te,le.pts-le.dts),-1*ue)}le.dts<b[ge>0?ge-1:ge].dts&&(he=!0)}he&&b.sort(function(pt,ct){var et=pt.dts-ct.dts,Rt=pt.pts-ct.pts;return et||Rt}),z=b[0].dts,Z=b[b.length-1].dts;var Le=Math.round((Z-z)/(F-1));if(Te<0){if(Te<Le*-2){A.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(E.toMsFromMpegTsClock)(-Le,!0)+" ms");for(var Fe=Te,Ie=0;Ie<F;Ie++)b[Ie].dts=Fe=Math.max(Fe,b[Ie].pts-Le),b[Ie].pts=Math.max(Fe,b[Ie].pts)}else{A.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(E.toMsFromMpegTsClock)(Te,!0)+" ms to overcome this issue");for(var Ne=0;Ne<F;Ne++)b[Ne].dts=b[Ne].dts+Te}z=b[0].dts}if(a){var Ue=z-X,Ee=Ue>Le,ye=Ue<-1;if(Ee||ye){Ee?A.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(Ue,!0)+" ms ("+Ue+"dts) hole between fragments detected, filling it"):A.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(-Ue,!0)+" ms ("+Ue+"dts) overlapping between fragments detected"),z=X;var _e=b[0].pts-Ue;b[0].dts=z,b[0].pts=_e,A.logger.log("Video: First PTS/DTS adjusted: "+Object(E.toMsFromMpegTsClock)(_e,!0)+"/"+Object(E.toMsFromMpegTsClock)(z,!0)+", delta: "+Object(E.toMsFromMpegTsClock)(Ue,!0)+" ms")}}o&&(z=Math.max(0,z));for(var Me=0,Pe=0,we=0;we<F;we++){for(var Ce=b[we],Ye=Ce.units,Ge=Ye.length,ze=0,Be=0;Be<Ge;Be++)ze+=Ye[Be].data.length;Pe+=ze,Me+=Ge,Ce.length=ze,Ce.dts=Math.max(Ce.dts,z),Ce.pts=Math.max(Ce.pts,Ce.dts,0),ie=Math.min(Ce.pts,ie),se=Math.max(Ce.pts,se)}Z=b[F-1].dts;var rt=Pe+4*Me+8,Ve;try{Ve=new Uint8Array(rt)}catch(pt){this.observer.emit(N.Events.ERROR,N.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:rt,reason:"fail allocating video mdat "+rt});return}var We=new DataView(Ve.buffer);We.setUint32(0,rt),Ve.set(P.default.types.mdat,4);for(var ve=0;ve<F;ve++){for(var qe=b[ve],Xe=qe.units,be=0,Oe=0,te=Xe.length;Oe<te;Oe++){var ne=Xe[Oe],ae=ne.data,Y=ne.data.byteLength;We.setUint32(B,Y),B+=4,Ve.set(ae,B),B+=Y,be+=4+Y}if(ve<F-1)U=b[ve+1].dts-qe.dts;else{var $=this.config,J=qe.dts-b[ve>0?ve-1:ve].dts;if($.stretchShortVideoTrack&&this.nextAudioPts!==null){var q=Math.floor($.maxBufferHole*p),de=(v?ie+v*p:this.nextAudioPts)-qe.pts;de>q?(U=de-J,U<0&&(U=J),A.logger.log("[mp4-remuxer]: It is approximately "+de/90+" ms to the next segment; using duration "+U/90+" ms for the last video frame.")):U=J}else U=J}var me=Math.round(qe.pts-qe.dts);M.push(new f(qe.key,U,be,me))}if(M.length&&g&&g<70){var De=M[0].flags;De.dependsOn=2,De.isNonSync=0}console.assert(U!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=X=Z+U,this.isVideoContiguous=!0;var $e=P.default.moof(c.sequenceNumber++,z,T({},c,{samples:M})),ot="video",Qe={data1:$e,data2:Ve,startPTS:ie/p,endPTS:(se+U)/p,startDTS:z/p,endDTS:X/p,type:ot,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Ve.length,"MDAT length must not be zero"),Qe},x.remuxAudio=function(c,u,a,v,p){var b=c.inputTimeScale,M=c.samplerate?c.samplerate:b,F=b/M,H=c.isAAC?C:y,X=H*F,B=this._initPTS,U=!c.isAAC&&this.typeSupported.mpeg,z=[],Z=c.samples,ie=U?0:8,se=this.nextAudioPts||-1,Te=u*b;if(this.isAudioContiguous=a=a||Z.length&&se>0&&(v&&Math.abs(Te-se)<9e3||Math.abs(d(Z[0].pts-B,Te)-se)<20*X),Z.forEach(function(ae){ae.pts=d(ae.pts-B,Te)}),!a||se<0){if(Z=Z.filter(function(ae){return ae.pts>=0}),!Z.length)return;p===0?se=0:v?se=Math.max(0,Te):se=Z[0].pts}if(c.isAAC)for(var he=p!==void 0,xe=this.config.maxAudioFramesDrift,pe=0,ge=se;pe<Z.length;pe++){var le=Z[pe],ue=le.pts,Le=ue-ge,Fe=Math.abs(1e3*Le/b);if(Le<=-xe*X&&he)pe===0&&(A.logger.warn("Audio frame @ "+(ue/b).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Le/b)+" ms."),this.nextAudioPts=se=ge=ue);else if(Le>=xe*X&&Fe<_&&he){var Ie=Math.round(Le/X);ge=ue-Ie*X,ge<0&&(Ie--,ge+=X),pe===0&&(this.nextAudioPts=se=ge),A.logger.warn("[mp4-remuxer]: Injecting "+Ie+" audio frame @ "+(ge/b).toFixed(3)+"s due to "+Math.round(1e3*Le/b)+" ms gap.");for(var Ne=0;Ne<Ie;Ne++){var Ue=Math.max(ge,0),Ee=R.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);Ee||(A.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ee=le.unit.subarray()),Z.splice(pe,0,{unit:Ee,pts:Ue}),ge+=X,pe++}}le.pts=ge,ge+=X}for(var ye=null,_e=null,Me,Pe=0,we=Z.length;we--;)Pe+=Z[we].unit.byteLength;for(var Ce=0,Ye=Z.length;Ce<Ye;Ce++){var Ge=Z[Ce],ze=Ge.unit,Be=Ge.pts;if(_e!==null){var rt=z[Ce-1];rt.duration=Math.round((Be-_e)/F)}else if(a&&c.isAAC&&(Be=se),ye=Be,Pe>0){Pe+=ie;try{Me=new Uint8Array(Pe)}catch(ae){this.observer.emit(N.Events.ERROR,N.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Pe,reason:"fail allocating audio mdat "+Pe});return}if(!U){var Ve=new DataView(Me.buffer);Ve.setUint32(0,Pe),Me.set(P.default.types.mdat,4)}}else return;Me.set(ze,ie);var We=ze.byteLength;ie+=We,z.push(new f(!0,H,We,0)),_e=Be}var ve=z.length;if(!ve)return;var qe=z[z.length-1];this.nextAudioPts=se=_e+F*qe.duration;var Xe=U?new Uint8Array(0):P.default.moof(c.sequenceNumber++,ye/F,T({},c,{samples:z}));c.samples=[];var be=ye/b,Oe=se/b,te="audio",ne={data1:Xe,data2:Me,startPTS:be,endPTS:Oe,startDTS:be,endDTS:Oe,type:te,hasAudio:!0,hasVideo:!1,nb:ve};return this.isAudioContiguous=!0,console.assert(Me.length,"MDAT length must not be zero"),ne},x.remuxEmptyAudio=function(c,u,a,v){var p=c.inputTimeScale,b=c.samplerate?c.samplerate:p,M=p/b,F=this.nextAudioPts,H=(F!==null?F:v.startDTS*p)+this._initDTS,X=v.endDTS*p+this._initDTS,B=M*C,U=Math.ceil((X-H)/B),z=R.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(A.logger.warn("[mp4-remuxer]: remux empty Audio"),!z){A.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Z=[],ie=0;ie<U;ie++){var se=H+ie*B;Z.push({unit:z,pts:se,dts:se})}return c.samples=Z,this.remuxAudio(c,u,a,!1)},x.remuxID3=function(c,u){var a=c.samples.length;if(!a)return;for(var v=c.inputTimeScale,p=this._initPTS,b=this._initDTS,M=0;M<a;M++){var F=c.samples[M];F.pts=d(F.pts-p,u*v)/v,F.dts=d(F.dts-b,u*v)/v}var H=c.samples;return c.samples=[],{samples:H}},x.remuxText=function(c,u){var a=c.samples.length;if(!a)return;for(var v=c.inputTimeScale,p=this._initPTS,b=0;b<a;b++){var M=c.samples[b];M.pts=d(M.pts-p,u*v)/v}c.samples.sort(function(H,X){return H.pts-X.pts});var F=c.samples;return c.samples=[],{samples:F}},L}();function d(L,x){var h;if(x===null)return L;for(x<L?h=-8589934592:h=8589934592;Math.abs(L-x)>4294967296;)L+=h;return L}function w(L){for(var x=0;x<L.length;x++)if(L[x].key)return x;return-1}var f=function(x,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(x)},m=function(x){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=x?2:1,this.isNonSync=x?0:1}},"./src/remux/passthrough-remuxer.ts":function(ee,G,D){"use strict";D.r(G);var W=D("./src/polyfills/number.ts"),R=D("./src/utils/mp4-tools.ts"),P=D("./src/loader/fragment.ts"),N=D("./src/utils/logger.ts"),k=function(){function E(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var T=E.prototype;return T.destroy=function(){},T.resetTimeStamp=function(C){this.initPTS=C,this.lastEndDTS=null},T.resetNextTimestamp=function(){this.lastEndDTS=null},T.resetInitSegment=function(C,y,g){this.audioCodec=y,this.videoCodec=g,this.generateInitSegment(C),this.emitInitSegment=!0},T.generateInitSegment=function(C){var y=this.audioCodec,g=this.videoCodec;if(!C||!C.byteLength){this.initTracks=void 0,this.initData=void 0;return}var l=this.initData=Object(R.parseInitSegment)(C);y||(y=O(l.audio,P.ElementaryStreamTypes.AUDIO)),g||(g=O(l.video,P.ElementaryStreamTypes.VIDEO));var o={};l.audio&&l.video?o.audiovideo={container:"video/mp4",codec:y+","+g,initSegment:C,id:"main"}:l.audio?o.audio={container:"audio/mp4",codec:y,initSegment:C,id:"audio"}:l.video?o.video={container:"video/mp4",codec:g,initSegment:C,id:"main"}:N.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},T.remux=function(C,y,g,l,o){var s=this.initPTS,d=this.lastEndDTS,w={audio:void 0,video:void 0,text:l,id3:g,initSegment:void 0};Object(W.isFiniteNumber)(d)||(d=this.lastEndDTS=o||0);var f=y.samples;if(!f||!f.length)return w;var m={initPTS:void 0,timescale:1},L=this.initData;if((!L||!L.length)&&(this.generateInitSegment(f),L=this.initData),!L||!L.length)return N.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),w;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1),Object(W.isFiniteNumber)(s)||(this.initPTS=m.initPTS=s=A(L,f,d));var x=Object(R.getDuration)(f,L),h=d,c=x+h;Object(R.offsetStartDTS)(L,f,s),x>0?this.lastEndDTS=c:(N.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var u=!!L.audio,a=!!L.video,v="";u&&(v+="audio"),a&&(v+="video");var p={data1:f,startPTS:h,startDTS:h,endPTS:c,endDTS:c,type:v,hasAudio:u,hasVideo:a,nb:1,dropped:0};return w.audio=p.type==="audio"?p:void 0,w.video=p.type!=="audio"?p:void 0,w.text=l,w.id3=g,w.initSegment=m,w},E}(),A=function(T,_,C){return Object(R.getStartDTS)(T,_)-C};function O(E,T){var _=E==null?void 0:E.codec;return _&&_.length>4?_:_==="hvc1"?"hvc1.1.c.L120.90":_==="av01"?"av01.0.04M.08":_==="avc1"||T===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}G.default=k},"./src/task-loop.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"default",function(){return W});var W=function(){function R(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var P=R.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(k){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,k),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},R}()},"./src/types/cmcd.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"CMCDVersion",function(){return W}),D.d(G,"CMCDObjectType",function(){return R}),D.d(G,"CMCDStreamingFormat",function(){return P}),D.d(G,"CMCDStreamType",function(){return N});var W=1,R;(function(k){k.MANIFEST="m",k.AUDIO="a",k.VIDEO="v",k.MUXED="av",k.INIT="i",k.CAPTION="c",k.TIMED_TEXT="tt",k.KEY="k",k.OTHER="o"})(R||(R={}));var P;(function(k){k.DASH="d",k.HLS="h",k.SMOOTH="s",k.OTHER="o"})(P||(P={}));var N;(function(k){k.VOD="v",k.LIVE="l"})(N||(N={}))},"./src/types/level.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"HlsSkip",function(){return P}),D.d(G,"getSkipValue",function(){return N}),D.d(G,"HlsUrlParameters",function(){return k}),D.d(G,"Level",function(){return A});function W(O,E){for(var T=0;T<E.length;T++){var _=E[T];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(O,_.key,_)}}function R(O,E,T){return E&&W(O.prototype,E),T&&W(O,T),O}var P;(function(O){O.No="",O.Yes="YES",O.v2="v2"})(P||(P={}));function N(O,E){var T=O.canSkipUntil,_=O.canSkipDateRanges,C=O.endSN,y=E!==void 0?E-C:0;return T&&y<T?_?P.v2:P.Yes:P.No}var k=function(){function O(T,_,C){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=T,this.part=_,this.skip=C}var E=O.prototype;return E.addDirectives=function(_){var C=new self.URL(_);return this.msn!==void 0&&C.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&C.searchParams.set("_HLS_part",this.part.toString()),this.skip&&C.searchParams.set("_HLS_skip",this.skip),C.toString()},O}(),A=function(){function O(E){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[E.url],this.attrs=E.attrs,this.bitrate=E.bitrate,E.details&&(this.details=E.details),this.id=E.id||0,this.name=E.name,this.width=E.width||0,this.height=E.height||0,this.audioCodec=E.audioCodec,this.videoCodec=E.videoCodec,this.unknownCodecs=E.unknownCodecs,this.codecSet=[E.videoCodec,E.audioCodec].filter(function(T){return T}).join(",").replace(/\.[^.,]+/g,"")}return R(O,[{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(T){var _=T%this.url.length;this._urlId!==_&&(this.details=void 0,this._urlId=_)}}]),O}()},"./src/types/loader.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"PlaylistContextType",function(){return W}),D.d(G,"PlaylistLevelType",function(){return R});var W;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(W||(W={}));var R;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(R||(R={}))},"./src/types/transmuxer.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"ChunkMetadata",function(){return W});var W=function(N,k,A,O,E,T){O===void 0&&(O=0),E===void 0&&(E=-1),T===void 0&&(T=!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=R(),this.buffering={audio:R(),video:R(),audiovideo:R()},this.level=N,this.sn=k,this.id=A,this.size=O,this.part=E,this.partial=T};function R(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"AttrList",function(){return P});var W=/^(\d+)x(\d+)$/,R=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=function(){function N(A){typeof A=="string"&&(A=N.parseAttrList(A));for(var O in A)A.hasOwnProperty(O)&&(this[O]=A[O])}var k=N.prototype;return k.decimalInteger=function(O){var E=parseInt(this[O],10);return E>Number.MAX_SAFE_INTEGER?Infinity:E},k.hexadecimalInteger=function(O){if(this[O]){var E=(this[O]||"0x").slice(2);E=(E.length&1?"0":"")+E;for(var T=new Uint8Array(E.length/2),_=0;_<E.length/2;_++)T[_]=parseInt(E.slice(_*2,_*2+2),16);return T}else return null},k.hexadecimalIntegerAsNumber=function(O){var E=parseInt(this[O],16);return E>Number.MAX_SAFE_INTEGER?Infinity:E},k.decimalFloatingPoint=function(O){return parseFloat(this[O])},k.optionalFloat=function(O,E){var T=this[O];return T?parseFloat(T):E},k.enumeratedString=function(O){return this[O]},k.bool=function(O){return this[O]==="YES"},k.decimalResolution=function(O){var E=W.exec(this[O]);return E===null?void 0:{width:parseInt(E[1],10),height:parseInt(E[2],10)}},N.parseAttrList=function(O){var E,T={},_='"';for(R.lastIndex=0;(E=R.exec(O))!==null;){var C=E[2];C.indexOf(_)===0&&C.lastIndexOf(_)===C.length-1&&(C=C.slice(1,-1)),T[E[1]]=C}return T},N}()},"./src/utils/binary-search.ts":function(ee,G,D){"use strict";D.r(G);var W={search:function(P,N){for(var k=0,A=P.length-1,O=null,E=null;k<=A;){O=(k+A)/2|0,E=P[O];var T=N(E);if(T>0)k=O+1;else if(T<0)A=O-1;else return E}return null}};G.default=W},"./src/utils/buffer-helper.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"BufferHelper",function(){return P});var W=D("./src/utils/logger.ts"),R={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function N(){}return N.isBuffered=function(A,O){try{if(A){for(var E=N.getBuffered(A),T=0;T<E.length;T++)if(O>=E.start(T)&&O<=E.end(T))return!0}}catch(_){}return!1},N.bufferInfo=function(A,O,E){try{if(A){var T=N.getBuffered(A),_=[],C;for(C=0;C<T.length;C++)_.push({start:T.start(C),end:T.end(C)});return this.bufferedInfo(_,O,E)}}catch(y){}return{len:0,start:O,end:O,nextStart:void 0}},N.bufferedInfo=function(A,O,E){O=Math.max(0,O),A.sort(function(m,L){var x=m.start-L.start;return x||L.end-m.end});var T=[];if(E)for(var _=0;_<A.length;_++){var C=T.length;if(C){var y=T[C-1].end;A[_].start-y<E?A[_].end>y&&(T[C-1].end=A[_].end):T.push(A[_])}else T.push(A[_])}else T=A;for(var g=0,l,o=O,s=O,d=0;d<T.length;d++){var w=T[d].start,f=T[d].end;if(O+E>=w&&O<f)o=w,s=f,g=s-O;else if(O+E<w){l=w;break}}return{len:g,start:o||0,end:s||0,nextStart:l}},N.getBuffered=function(A){try{return A.buffered}catch(O){return W.logger.log("failed to get media.buffered",O),R}},N}()},"./src/utils/cea-608-parser.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"Row",function(){return s}),D.d(G,"CaptionScreen",function(){return d});var W=D("./src/utils/logger.ts"),R={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},P=function(c){var u=c;return R.hasOwnProperty(c)&&(u=R[c]),String.fromCharCode(u)},N=15,k=100,A={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},O={17:2,18:4,21:6,22:8,23:10,19:13,20:15},E={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},T={25:2,26:4,29:6,30:8,31:10,27:13,28:15},_=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],C;(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"})(C||(C={}));var y=function(){function h(){this.time=null,this.verboseLevel=C.ERROR}var c=h.prototype;return c.log=function(a,v){this.verboseLevel>=a&&W.logger.log(this.time+" ["+a+"] "+v)},h}(),g=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,v,p,b){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=v||!1,this.background=p||"black",this.flash=b||!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 v=["foreground","underline","italics","background","flash"],p=0;p<v.length;p++){var b=v[p];a.hasOwnProperty(b)&&(this[b]=a[b])}},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,v,p,b,M){this.uchar=void 0,this.penState=void 0,this.uchar=u||" ",this.penState=new l(a,v,p,b,M)}var c=h.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,v){this.uchar=a,this.penState.copy(v)},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<k;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 v=!0,p=0;p<k;p++)if(!this.chars[p].equals(a.chars[p])){v=!1;break}return v},c.copy=function(a){for(var v=0;v<k;v++)this.chars[v].copy(a.chars[v])},c.isEmpty=function(){for(var a=!0,v=0;v<k;v++)if(!this.chars[v].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(C.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>k&&(this.logger.log(C.DEBUG,"Too large cursor position "+this.pos),this.pos=k)},c.moveCursor=function(a){var v=this.pos+a;if(a>1)for(var p=this.pos+1;p<v+1;p++)this.chars[p].setPenState(this.currPenState);this.setCursor(v)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var v=P(a);if(this.pos>=k){this.logger.log(C.ERROR,"Cannot insert "+a.toString(16)+" ("+v+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(v,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var v;for(v=a;v<k;v++)this.chars[v].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=[],v=!0,p=0;p<k;p++){var b=this.chars[p].uchar;b!==" "&&(v=!1),a.push(b)}return v?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var v=this.chars[this.pos];v.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<N;a++)this.rows.push(new s(u));this.logger=u,this.currRow=N-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=h.prototype;return c.reset=function(){for(var a=0;a<N;a++)this.rows[a].clear();this.currRow=N-1},c.equals=function(a){for(var v=!0,p=0;p<N;p++)if(!this.rows[p].equals(a.rows[p])){v=!1;break}return v},c.copy=function(a){for(var v=0;v<N;v++)this.rows[v].copy(a.rows[v])},c.isEmpty=function(){for(var a=!0,v=0;v<N;v++)if(!this.rows[v].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 v=this.rows[this.currRow];v.insertChar(a)},c.setPen=function(a){var v=this.rows[this.currRow];v.setPenStyles(a)},c.moveCursor=function(a){var v=this.rows[this.currRow];v.moveCursor(a)},c.setCursor=function(a){this.logger.log(C.INFO,"setCursor: "+a);var v=this.rows[this.currRow];v.setCursor(a)},c.setPAC=function(a){this.logger.log(C.INFO,"pacData = "+JSON.stringify(a));var v=a.row-1;if(this.nrRollUpRows&&v<this.nrRollUpRows-1&&(v=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==v){for(var p=0;p<N;p++)this.rows[p].clear();var b=this.currRow+1-this.nrRollUpRows,M=this.lastOutputScreen;if(M){var F=M.rows[b].cueStartTime,H=this.logger.time;if(F&&H!==null&&F<H)for(var X=0;X<this.nrRollUpRows;X++)this.rows[v-this.nrRollUpRows+X+1].copy(M.rows[b+X])}}this.currRow=v;var B=this.rows[this.currRow];if(a.indent!==null){var U=a.indent,z=Math.max(U-1,0);B.setCursor(a.indent),a.color=B.chars[z].penState.foreground}var Z={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(Z)},c.setBkgData=function(a){this.logger.log(C.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},c.setRollUpRows=function(a){this.nrRollUpRows=a},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(C.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(C.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,v=this.rows.splice(a,1)[0];v.clear(),this.rows.splice(this.currRow,0,v),this.logger.log(C.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var v=[],p="",b=-1,M=0;M<N;M++){var F=this.rows[M].getTextString();F&&(b=M+1,a?v.push("Row "+b+": '"+F+"'"):v.push(F.trim()))}return v.length>0&&(a?p="["+v.join(" | ")+"]":p=v.join(`
`)),p},c.getTextAndFormat=function(){return this.rows},h}(),w=function(){function h(u,a,v){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(v),this.nonDisplayedMemory=new d(v),this.lastOutputScreen=new d(v),this.currRollUpRow=this.displayedMemory.rows[N-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=v}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[N-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(a){this.outputFilter=a},c.setPAC=function(a){this.writeScreen.setPAC(a)},c.setBkgData=function(a){this.writeScreen.setBkgData(a)},c.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(C.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},c.insertChars=function(a){for(var v=0;v<a.length;v++)this.writeScreen.insertChar(a[v]);var p=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(C.INFO,p+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(C.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(C.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(C.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},c.ccAOF=function(){},c.ccAON=function(){},c.ccDER=function(){this.logger.log(C.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(C.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(C.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(C.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(C.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(C.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(C.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(C.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(C.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(C.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(C.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(C.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var v={flash:!1};if(v.underline=a%2===1,v.italics=a>=46,v.italics)v.foreground="white";else{var p=Math.floor(a/2)-16,b=["white","green","blue","cyan","red","yellow","magenta"];v.foreground=b[p]}this.logger.log(C.INFO,"MIDROW: "+JSON.stringify(v)),this.writeScreen.setPen(v)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var v=this.logger.time;if(v===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=v:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,v,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:v),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}(),f=function(){function h(u,a,v){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var p=new y;this.channels=[null,new w(u,a,p),new w(u+1,v,p)],this.cmdHistory=x(),this.logger=p}var c=h.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,v){this.channels[a].setHandler(v)},c.addData=function(a,v){var p,b,M,F=!1;this.logger.time=a;for(var H=0;H<v.length;H+=2){if(b=v[H]&127,M=v[H+1]&127,b===0&&M===0)continue;if(this.logger.log(C.DATA,"["+g([v[H],v[H+1]])+"] -> ("+g([b,M])+")"),p=this.parseCmd(b,M),p||(p=this.parseMidrow(b,M)),p||(p=this.parsePAC(b,M)),p||(p=this.parseBackgroundAttributes(b,M)),!p&&(F=this.parseChars(b,M),F)){var X=this.currentChannel;if(X&&X>0){var B=this.channels[X];B.insertChars(F)}else this.logger.log(C.WARNING,"No channel found yet. TEXT-MODE?")}!p&&!F&&this.logger.log(C.WARNING,"Couldn't parse cleaned data "+g([b,M])+" orig: "+g([v[H],v[H+1]]))}},c.parseCmd=function(a,v){var p=this.cmdHistory,b=(a===20||a===28||a===21||a===29)&&v>=32&&v<=47,M=(a===23||a===31)&&v>=33&&v<=35;if(!(b||M))return!1;if(L(a,v,p))return m(null,null,p),this.logger.log(C.DEBUG,"Repeated command ("+g([a,v])+") is dropped"),!0;var F=a===20||a===21||a===23?1:2,H=this.channels[F];return a===20||a===21||a===28||a===29?v===32?H.ccRCL():v===33?H.ccBS():v===34?H.ccAOF():v===35?H.ccAON():v===36?H.ccDER():v===37?H.ccRU(2):v===38?H.ccRU(3):v===39?H.ccRU(4):v===40?H.ccFON():v===41?H.ccRDC():v===42?H.ccTR():v===43?H.ccRTD():v===44?H.ccEDM():v===45?H.ccCR():v===46?H.ccENM():v===47&&H.ccEOC():H.ccTO(v-32),m(a,v,p),this.currentChannel=F,!0},c.parseMidrow=function(a,v){var p=0;if((a===17||a===25)&&v>=32&&v<=47){if(a===17?p=1:p=2,p!==this.currentChannel)return this.logger.log(C.ERROR,"Mismatch channel in midrow parsing"),!1;var b=this.channels[p];return b?(b.ccMIDROW(v),this.logger.log(C.DEBUG,"MIDROW ("+g([a,v])+")"),!0):!1}return!1},c.parsePAC=function(a,v){var p,b=this.cmdHistory,M=(a>=17&&a<=23||a>=25&&a<=31)&&v>=64&&v<=127,F=(a===16||a===24)&&v>=64&&v<=95;if(!(M||F))return!1;if(L(a,v,b))return m(null,null,b),!0;var H=a<=23?1:2;v>=64&&v<=95?p=H===1?A[a]:E[a]:p=H===1?O[a]:T[a];var X=this.channels[H];return X?(X.setPAC(this.interpretPAC(p,v)),m(a,v,b),this.currentChannel=H,!0):!1},c.interpretPAC=function(a,v){var p,b={color:null,italics:!1,indent:null,underline:!1,row:a};return v>95?p=v-96:p=v-64,b.underline=(p&1)===1,p<=13?b.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(p/2)]:p<=15?(b.italics=!0,b.color="white"):b.indent=Math.floor((p-16)/2)*4,b},c.parseChars=function(a,v){var p,b=null,M=null;if(a>=25?(p=2,M=a-8):(p=1,M=a),M>=17&&M<=19){var F;M===17?F=v+80:M===18?F=v+112:F=v+144,this.logger.log(C.INFO,"Special char '"+P(F)+"' in channel "+p),b=[F]}else a>=32&&a<=127&&(b=v===0?[a]:[a,v]);if(b){var H=g(b);this.logger.log(C.DEBUG,"Char codes = "+H.join(",")),m(a,v,this.cmdHistory)}return b},c.parseBackgroundAttributes=function(a,v){var p=(a===16||a===24)&&v>=32&&v<=47,b=(a===23||a===31)&&v>=45&&v<=47;if(!(p||b))return!1;var M,F={};a===16||a===24?(M=Math.floor((v-32)/2),F.background=_[M],v%2===1&&(F.background=F.background+"_semi")):v===45?F.background="transparent":(F.foreground="black",v===47&&(F.underline=!0));var H=a<=23?1:2,X=this.channels[H];return X.setBkgData(F),m(a,v,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var v=this.channels[a];v&&v.reset()}this.cmdHistory=x()},c.cueSplitAtTime=function(a){for(var v=0;v<this.channels.length;v++){var p=this.channels[v];p&&p.cueSplitAtTime(a)}},h}();function m(h,c,u){u.a=h,u.b=c}function L(h,c,u){return u.a===h&&u.b===c}function x(){return{a:null,b:null}}G.default=f},"./src/utils/codecs.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"isCodecType",function(){return R}),D.d(G,"isCodecSupportedInMp4",function(){return P});var W={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 R(N,k){var A=W[k];return!!A&&A[N.slice(0,4)]===!0}function P(N,k){return MediaSource.isTypeSupported((k||"video")+'/mp4;codecs="'+N+'"')}},"./src/utils/cues.ts":function(ee,G,D){"use strict";D.r(G);var W=D("./src/utils/vttparser.ts"),R=D("./src/utils/webvtt-parser.ts"),P=D("./src/utils/texttrack-utils.ts"),N=/\s/,k={newCue:function(O,E,T,_){for(var C=[],y,g,l,o,s,d=self.VTTCue||self.TextTrackCue,w=0;w<_.rows.length;w++)if(y=_.rows[w],l=!0,o=0,s="",!y.isEmpty()){for(var f=0;f<y.chars.length;f++)N.test(y.chars[f].uchar)&&l?o++:(s+=y.chars[f].uchar,l=!1);y.cueStartTime=E,E===T&&(T+=1e-4),o>=16?o--:o++;var m=Object(W.fixLineBreaks)(s.trim()),L=Object(R.generateCueId)(E,T,m);(!O||!O.cues||!O.cues.getCueById(L))&&(g=new d(E,T,m),g.id=L,g.line=w+1,g.align="left",g.position=10+Math.min(80,Math.floor(o*8/32)*10),C.push(g))}return O&&C.length&&(C.sort(function(x,h){return x.line==="auto"||h.line==="auto"?0:x.line>8&&h.line>8?h.line-x.line:x.line-h.line}),C.forEach(function(x){return Object(P.addCueToTrack)(O,x)})),C}};G.default=k},"./src/utils/discontinuities.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"findFirstFragWithCC",function(){return N}),D.d(G,"shouldAlignOnDiscontinuities",function(){return k}),D.d(G,"findDiscontinuousReferenceFrag",function(){return A}),D.d(G,"adjustSlidingStart",function(){return E}),D.d(G,"alignStream",function(){return T}),D.d(G,"alignPDT",function(){return C}),D.d(G,"alignFragmentByPDTDelta",function(){return y}),D.d(G,"alignMediaPlaylistByPDT",function(){return g});var W=D("./src/polyfills/number.ts"),R=D("./src/utils/logger.ts"),P=D("./src/controller/level-helper.ts");function N(l,o){for(var s=null,d=0,w=l.length;d<w;d++){var f=l[d];if(f&&f.cc===o){s=f;break}}return s}function k(l,o,s){return!!(o.details&&(s.endCC>s.startCC||l&&l.cc<s.startCC))}function A(l,o){var s=l.fragments,d=o.fragments;if(!d.length||!s.length){R.logger.log("No fragments to align");return}var w=N(s,d[0].cc);if(!w||w&&!w.startPTS){R.logger.log("No frag in previous level to align on");return}return w}function O(l,o){if(l){var s=l.start+o;l.start=l.startPTS=s,l.endPTS=s+l.duration}}function E(l,o){for(var s=o.fragments,d=0,w=s.length;d<w;d++)O(s[d],l);o.fragmentHint&&O(o.fragmentHint,l),o.alignedSliding=!0}function T(l,o,s){if(!o)return;_(l,s,o),!s.alignedSliding&&o.details&&C(s,o.details),!s.alignedSliding&&o.details&&!s.skippedSegments&&Object(P.adjustSliding)(o.details,s)}function _(l,o,s){if(k(l,s,o)){var d=A(s.details,o);d&&Object(W.isFiniteNumber)(d.start)&&(R.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),E(d.start,o))}}function C(l,o){if(!o.fragments.length||!l.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,d=l.fragments[0].programDateTime,w=(d-s)/1e3+o.fragments[0].start;w&&Object(W.isFiniteNumber)(w)&&(R.logger.log("Adjusting PTS using programDateTime delta "+(d-s)+"ms, sliding:"+w.toFixed(3)+" "+l.url+" "),E(w,l))}function y(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 g(l,o){if(!o.fragments.length||!l.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,d=o.fragments[0].start,w=s-d*1e3;l.fragments.forEach(function(f){y(f,w)}),l.fragmentHint&&y(l.fragmentHint,w),l.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ee,G,D){"use strict";D.r(G);var W=D("./src/utils/ewma.ts"),R=function(){function P(k,A,O){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=O,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new W.default(k),this.fast_=new W.default(A)}var N=P.prototype;return N.update=function(A,O){var E=this.slow_,T=this.fast_;this.slow_.halfLife!==A&&(this.slow_=new W.default(A,E.getEstimate(),E.getTotalWeight())),this.fast_.halfLife!==O&&(this.fast_=new W.default(O,T.getEstimate(),T.getTotalWeight()))},N.sample=function(A,O){A=Math.max(A,this.minDelayMs_);var E=8*O,T=A/1e3,_=E/T;this.fast_.sample(T,_),this.slow_.sample(T,_)},N.canEstimate=function(){var A=this.fast_;return A&&A.getTotalWeight()>=this.minWeight_},N.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},N.destroy=function(){},P}();G.default=R},"./src/utils/ewma.ts":function(ee,G,D){"use strict";D.r(G);var W=function(){function R(N,k,A){k===void 0&&(k=0),A===void 0&&(A=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=N,this.alpha_=N?Math.exp(Math.log(.5)/N):0,this.estimate_=k,this.totalWeight_=A}var P=R.prototype;return P.sample=function(k,A){var O=Math.pow(this.alpha_,k);this.estimate_=A*(1-O)+O*this.estimate_,this.totalWeight_+=k},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var k=1-Math.pow(this.alpha_,this.totalWeight_);if(k)return this.estimate_/k}return this.estimate_},R}();G.default=W},"./src/utils/fetch-loader.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"fetchSupported",function(){return y});var W=D("./src/polyfills/number.ts"),R=D("./src/loader/load-stats.ts"),P=D("./src/demux/chunk-cache.ts");function N(d,w){d.prototype=Object.create(w.prototype),d.prototype.constructor=d,T(d,w)}function k(d){var w=typeof Map=="function"?new Map:void 0;return k=function(m){if(m===null||!E(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(typeof w!="undefined"){if(w.has(m))return w.get(m);w.set(m,L)}function L(){return A(m,arguments,_(this).constructor)}return L.prototype=Object.create(m.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),T(L,m)},k(d)}function A(d,w,f){return O()?A=Reflect.construct:A=function(L,x,h){var c=[null];c.push.apply(c,x);var u=Function.bind.apply(L,c),a=new u;return h&&T(a,h.prototype),a},A.apply(null,arguments)}function O(){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 E(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function T(d,w){return T=Object.setPrototypeOf||function(m,L){return m.__proto__=L,m},T(d,w)}function _(d){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(f){return f.__proto__||Object.getPrototypeOf(f)},_(d)}function C(){return C=Object.assign||function(d){for(var w=1;w<arguments.length;w++){var f=arguments[w];for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&(d[m]=f[m])}return d},C.apply(this,arguments)}function y(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(d){}return!1}var g=function(){function d(f){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=f.fetchSetup||o,this.controller=new self.AbortController,this.stats=new R.LoadStats}var w=d.prototype;return w.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},w.abortInternal=function(){var m=this.response;(!m||!m.ok)&&(this.stats.aborted=!0,this.controller.abort())},w.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},w.load=function(m,L,x){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=x.onProgress,v=m.responseType==="arraybuffer",p=v?"byteLength":"length";this.context=m,this.config=L,this.callbacks=x,this.request=this.fetchSetup(m,u),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){h.abortInternal(),x.onTimeout(c,m,h.response)},L.timeout),self.fetch(this.request).then(function(b){if(h.response=h.loader=b,!b.ok){var M=b.status,F=b.statusText;throw new s(F||"fetch, bad network response",M,b)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(b.headers.get("Content-Length")||"0"),a&&Object(W.isFiniteNumber)(L.highWaterMark)?h.loadProgressively(b,c,m,L.highWaterMark,a):v?b.arrayBuffer():b.text()}).then(function(b){var M=h.response;self.clearTimeout(h.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=b[p];var F={url:M.url,data:b};a&&!Object(W.isFiniteNumber)(L.highWaterMark)&&a(c,m,b,M),x.onSuccess(F,c,m,M)}).catch(function(b){if(self.clearTimeout(h.requestTimeout),c.aborted)return;var M=b.code||0;x.onError({code:M,text:b.message},m,b.details)})},w.getCacheAge=function(){var m=null;if(this.response){var L=this.response.headers.get("age");m=L?parseFloat(L):null}return m},w.loadProgressively=function(m,L,x,h,c){h===void 0&&(h=0);var u=new P.default,a=m.body.getReader(),v=function p(){return a.read().then(function(b){if(b.done)return u.dataLength&&c(L,x,u.flush(),m),Promise.resolve(new ArrayBuffer(0));var M=b.value,F=M.length;return L.loaded+=F,F<h||u.dataLength?(u.push(M),u.dataLength>=h&&c(L,x,u.flush(),m)):c(L,x,M,m),p()}).catch(function(){return Promise.reject()})};return v()},d}();function l(d,w){var f={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(C({},d.headers))};return d.rangeEnd&&f.headers.set("Range","bytes="+d.rangeStart+"-"+String(d.rangeEnd-1)),f}function o(d,w){return new self.Request(d.url,w)}var s=function(d){N(w,d);function w(f,m,L){var x;return x=d.call(this,f)||this,x.code=void 0,x.details=void 0,x.code=m,x.details=L,x}return w}(k(Error));G.default=g},"./src/utils/imsc1-ttml-parser.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"IMSC1_CODEC",function(){return E}),D.d(G,"parseIMSC1",function(){return y});var W=D("./src/utils/mp4-tools.ts"),R=D("./src/utils/vttparser.ts"),P=D("./src/utils/vttcue.ts"),N=D("./src/demux/id3.ts"),k=D("./src/utils/timescale-conversion.ts"),A=D("./src/utils/webvtt-parser.ts");function O(){return O=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},O.apply(this,arguments)}var E="stpp.ttml.im1t",T=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,_=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,C={left:"start",center:"center",right:"end",start:"start",end:"end"};function y(h,c,u,a,v){var p=Object(W.findBox)(new Uint8Array(h),["mdat"]);if(p.length===0){v(new Error("Could not parse IMSC1 mdat"));return}var b=p[0],M=Object(N.utf8ArrayToStr)(new Uint8Array(h,b.start,b.end-b.start)),F=Object(k.toTimescaleFromScale)(c,1,u);try{a(g(M,F))}catch(H){v(H)}}function g(h,c){var u=new DOMParser,a=u.parseFromString(h,"text/xml"),v=a.getElementsByTagName("tt")[0];if(!v)throw new Error("Invalid ttml");var p={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},b=Object.keys(p).reduce(function(B,U){return B[U]=v.getAttribute("ttp:"+U)||p[U],B},{}),M=v.getAttribute("xml:space")!=="preserve",F=o(l(v,"styling","style")),H=o(l(v,"layout","region")),X=l(v,"body","[begin]");return[].map.call(X,function(B){var U=s(B,M);if(!U||!B.hasAttribute("begin"))return null;var z=m(B.getAttribute("begin"),b),Z=m(B.getAttribute("dur"),b),ie=m(B.getAttribute("end"),b);if(z===null)throw f(B);if(ie===null){if(Z===null)throw f(B);ie=z+Z}var se=new P.default(z-c,ie-c,U);se.id=Object(A.generateCueId)(se.startTime,se.endTime,se.text);var Te=H[B.getAttribute("region")],he=F[B.getAttribute("style")];se.position=10,se.size=80;var xe=d(Te,he),pe=xe.textAlign;if(pe){var ge=C[pe];ge&&(se.lineAlign=ge),se.align=pe}return O(se,xe),se}).filter(function(B){return B!==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,v){var p;return a.nodeName==="br"&&v?u+`
`:(p=a.childNodes)!==null&&p!==void 0&&p.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(v,p){var b=w(c,u,p)||w(h,u,p);return b&&(v[p]=b),v},{})}function w(h,c,u){return h.hasAttributeNS(c,u)?h.getAttributeNS(c,u):null}function f(h){return new Error("Could not parse ttml timestamp "+h)}function m(h,c){if(!h)return null;var u=Object(R.parseTimeStamp)(h);return u===null&&(T.test(h)?u=L(h,c):_.test(h)&&(u=x(h,c))),u}function L(h,c){var u=T.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 x(h,c){var u=_.exec(h),a=Number(u[1]),v=u[2];switch(v){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/c.frameRate;case"t":return a/c.tickRate}return a}},"./src/utils/logger.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"enableLogs",function(){return A}),D.d(G,"logger",function(){return O});var W=function(){},R={trace:W,debug:W,log:W,warn:W,info:W,error:W},P=R;function N(E){var T=self.console[E];return T?T.bind(self.console,"["+E+"] >"):W}function k(E){for(var T=arguments.length,_=new Array(T>1?T-1:0),C=1;C<T;C++)_[C-1]=arguments[C];_.forEach(function(y){P[y]=E[y]?E[y].bind(E):N(y)})}function A(E){if(self.console&&E===!0||typeof E=="object"){k(E,"debug","log","info","warn","error");try{P.log()}catch(T){P=R}}else P=R}var O=P},"./src/utils/mediakeys-helper.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"KeySystems",function(){return W}),D.d(G,"requestMediaKeySystemAccess",function(){return R});var W;(function(P){P.WIDEVINE="com.widevine.alpha",P.PLAYREADY="com.microsoft.playready"})(W||(W={}));var R=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"getMediaSource",function(){return W});function W(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"bin2str",function(){return k}),D.d(G,"readUint16",function(){return A}),D.d(G,"readUint32",function(){return O}),D.d(G,"writeUint32",function(){return E}),D.d(G,"findBox",function(){return T}),D.d(G,"parseSegmentIndex",function(){return _}),D.d(G,"parseInitSegment",function(){return C}),D.d(G,"getStartDTS",function(){return y}),D.d(G,"getDuration",function(){return g}),D.d(G,"computeRawDurationFromSamples",function(){return l}),D.d(G,"offsetStartDTS",function(){return o}),D.d(G,"segmentValidRange",function(){return s}),D.d(G,"appendUint8Array",function(){return d});var W=D("./src/utils/typed-array.ts"),R=D("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,N=[].push;function k(w){return String.fromCharCode.apply(null,w)}function A(w,f){"data"in w&&(f+=w.start,w=w.data);var m=w[f]<<8|w[f+1];return m<0?65536+m:m}function O(w,f){"data"in w&&(f+=w.start,w=w.data);var m=w[f]<<24|w[f+1]<<16|w[f+2]<<8|w[f+3];return m<0?4294967296+m:m}function E(w,f,m){"data"in w&&(f+=w.start,w=w.data),w[f]=m>>24,w[f+1]=m>>16&255,w[f+2]=m>>8&255,w[f+3]=m&255}function T(w,f){var m=[];if(!f.length)return m;var L,x,h;"data"in w?(L=w.data,x=w.start,h=w.end):(L=w,x=0,h=L.byteLength);for(var c=x;c<h;){var u=O(L,c),a=k(L.subarray(c+4,c+8)),v=u>1?c+u:h;if(a===f[0])if(f.length===1)m.push({data:L,start:c+8,end:v});else{var p=T({data:L,start:c+8,end:v},f.slice(1));p.length&&N.apply(m,p)}c=v}return m}function _(w){var f=T(w,["moov"]),m=f[0],L=m?m.end:null,x=T(w,["sidx"]);if(!x||!x[0])return null;var h=[],c=x[0],u=c.data[0],a=u===0?8:16,v=O(c,a);a+=4;var p=0,b=0;u===0?a+=8:a+=16,a+=2;var M=c.end+b,F=A(c,a);a+=2;for(var H=0;H<F;H++){var X=a,B=O(c,X);X+=4;var U=B&2147483647,z=(B&2147483648)>>>31;if(z===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Z=O(c,X);X+=4,h.push({referenceSize:U,subsegmentDuration:Z,info:{duration:Z/v,start:M,end:M+U-1}}),M+=U,X+=4,a=X}return{earliestPresentationTime:p,timescale:v,version:u,referencesCount:F,references:h,moovEndOffset:L}}function C(w){for(var f=[],m=T(w,["moov","trak"]),L=0;L<m.length;L++){var x=m[L],h=T(x,["tkhd"])[0];if(h){var c=h.data[h.start],u=c===0?12:20,a=O(h,u),v=T(x,["mdia","mdhd"])[0];if(v){c=v.data[v.start],u=c===0?12:20;var p=O(v,u),b=T(x,["mdia","hdlr"])[0];if(b){var M=k(b.data.subarray(b.start+8,b.start+12)),F={soun:R.ElementaryStreamTypes.AUDIO,vide:R.ElementaryStreamTypes.VIDEO}[M];if(F){var H=T(x,["mdia","minf","stbl","stsd"])[0],X=void 0;H&&(X=k(H.data.subarray(H.start+12,H.start+16))),f[a]={timescale:p,type:F},f[F]={timescale:p,id:a,codec:X}}}}}}var B=T(w,["moov","mvex","trex"]);return B.forEach(function(U){var z=O(U,4),Z=f[z];Z&&(Z.default={duration:O(U,12),flags:O(U,20)})}),f}function y(w,f){return T(f,["moof","traf"]).reduce(function(m,L){var x=T(L,["tfdt"])[0],h=x.data[x.start],c=T(L,["tfhd"]).reduce(function(u,a){var v=O(a,4),p=w[v];if(p){var b=O(x,4);h===1&&(b*=Math.pow(2,32),b+=O(x,8));var M=p.timescale||9e4,F=b/M;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 g(w,f){for(var m=0,L=0,x=0,h=T(w,["moof","traf"]),c=0;c<h.length;c++){var u=h[c],a=T(u,["tfhd"])[0],v=O(a,4),p=f[v];if(!p)continue;var b=p.default,M=O(a,0)|(b==null?void 0:b.flags),F=b==null?void 0:b.duration;M&8&&(M&2?F=O(a,12):F=O(a,8));for(var H=p.timescale||9e4,X=T(u,["trun"]),B=0;B<X.length;B++){if(F){var U=O(X[B],4);m=F*U}else m=l(X[B]);p.type===R.ElementaryStreamTypes.VIDEO?L+=m/H:p.type===R.ElementaryStreamTypes.AUDIO&&(x+=m/H)}}if(L===0&&x===0){var z=_(w);if(z!=null&&z.references)return z.references.reduce(function(Z,ie){return Z+ie.info.duration||0},0)}return L||x}function l(w){var f=O(w,0),m=8;f&1&&(m+=4),f&4&&(m+=4);for(var L=0,x=O(w,4),h=0;h<x;h++){if(f&256){var c=O(w,m);L+=c,m+=4}f&512&&(m+=4),f&1024&&(m+=4),f&2048&&(m+=4)}return L}function o(w,f,m){T(f,["moof","traf"]).forEach(function(L){T(L,["tfhd"]).forEach(function(x){var h=O(x,4),c=w[h];if(!c)return;var u=c.timescale||9e4;T(L,["tfdt"]).forEach(function(a){var v=a.data[a.start],p=O(a,4);if(v===0)E(a,4,p-m*u);else{p*=Math.pow(2,32),p+=O(a,8),p-=m*u,p=Math.max(p,0);var b=Math.floor(p/(P+1)),M=Math.floor(p%(P+1));E(a,4,b),E(a,8,M)}})})})}function s(w){var f={valid:null,remainder:null},m=T(w,["moof"]);if(m){if(m.length<2)return f.remainder=w,f}else return f;var L=m[m.length-1];return f.valid=Object(W.sliceUint8)(w,0,L.start-8),f.remainder=Object(W.sliceUint8)(w,L.start-8),f}function d(w,f){var m=new Uint8Array(w.length+f.length);return m.set(w),m.set(f,w.length),m}},"./src/utils/output-filter.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"default",function(){return W});var W=function(){function R(N,k){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=N,this.trackName=k}var P=R.prototype;return P.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},P.newCue=function(k,A,O){(this.startTime===null||this.startTime>k)&&(this.startTime=k),this.endTime=A,this.screen=O,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},R}()},"./src/utils/texttrack-utils.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"sendAddTrackEvent",function(){return R}),D.d(G,"addCueToTrack",function(){return P}),D.d(G,"clearCurrentCues",function(){return N}),D.d(G,"removeCuesInRange",function(){return k}),D.d(G,"getCuesInRange",function(){return O});var W=D("./src/utils/logger.ts");function R(E,T){var _;try{_=new Event("addtrack")}catch(C){_=document.createEvent("Event"),_.initEvent("addtrack",!1,!1)}_.track=E,T.dispatchEvent(_)}function P(E,T){var _=E.mode;if(_==="disabled"&&(E.mode="hidden"),E.cues&&!E.cues.getCueById(T.id))try{if(E.addCue(T),!E.cues.getCueById(T.id))throw new Error("addCue is failed for: "+T)}catch(y){W.logger.debug("[texttrack-utils]: "+y);var C=new self.TextTrackCue(T.startTime,T.endTime,T.text);C.id=T.id,E.addCue(C)}_==="disabled"&&(E.mode=_)}function N(E){var T=E.mode;if(T==="disabled"&&(E.mode="hidden"),E.cues)for(var _=E.cues.length;_--;)E.removeCue(E.cues[_]);T==="disabled"&&(E.mode=T)}function k(E,T,_){var C=E.mode;if(C==="disabled"&&(E.mode="hidden"),E.cues&&E.cues.length>0)for(var y=O(E.cues,T,_),g=0;g<y.length;g++)E.removeCue(y[g]);C==="disabled"&&(E.mode=C)}function A(E,T){if(T<E[0].startTime)return 0;var _=E.length-1;if(T>E[_].endTime)return-1;for(var C=0,y=_;C<=y;){var g=Math.floor((y+C)/2);if(T<E[g].startTime)y=g-1;else if(T>E[g].startTime&&C<_)C=g+1;else return g}return E[C].startTime-T<T-E[y].startTime?C:y}function O(E,T,_){var C=[],y=A(E,T);if(y>-1)for(var g=y,l=E.length;g<l;g++){var o=E[g];if(o.startTime>=T&&o.endTime<=_)C.push(o);else if(o.startTime>_)return C}return C}},"./src/utils/time-ranges.ts":function(ee,G,D){"use strict";D.r(G);var W={toString:function(P){for(var N="",k=P.length,A=0;A<k;A++)N+="["+P.start(A).toFixed(3)+","+P.end(A).toFixed(3)+"]";return N}};G.default=W},"./src/utils/timescale-conversion.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"toTimescaleFromBase",function(){return R}),D.d(G,"toTimescaleFromScale",function(){return P}),D.d(G,"toMsFromMpegTsClock",function(){return N}),D.d(G,"toMpegTsClockFromTimescale",function(){return k});var W=9e4;function R(A,O,E,T){E===void 0&&(E=1),T===void 0&&(T=!1);var _=A*O*E;return T?Math.round(_):_}function P(A,O,E,T){return E===void 0&&(E=1),T===void 0&&(T=!1),R(A,O,1/E,T)}function N(A,O){return O===void 0&&(O=!1),R(A,1e3,1/W,O)}function k(A,O){return O===void 0&&(O=1),R(A,W,1/O)}},"./src/utils/typed-array.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"sliceUint8",function(){return W});function W(R,P,N){return Uint8Array.prototype.slice?R.slice(P,N):new Uint8Array(Array.prototype.slice.call(R,P,N))}},"./src/utils/vttcue.ts":function(ee,G,D){"use strict";D.r(G),G.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var W=["","lr","rl"],R=["start","middle","end","left","right"];function P(E,T){if(typeof T!="string")return!1;if(!Array.isArray(E))return!1;var _=T.toLowerCase();return~E.indexOf(_)?_:!1}function N(E){return P(W,E)}function k(E){return P(R,E)}function A(E){for(var T=arguments.length,_=new Array(T>1?T-1:0),C=1;C<T;C++)_[C-1]=arguments[C];for(var y=1;y<arguments.length;y++){var g=arguments[y];for(var l in g)E[l]=g[l]}return E}function O(E,T,_){var C=this,y={enumerable:!0};C.hasBeenReset=!1;var g="",l=!1,o=E,s=T,d=_,w=null,f="",m=!0,L="auto",x="start",h=50,c="middle",u=50,a="middle";Object.defineProperty(C,"id",A({},y,{get:function(){return g},set:function(p){g=""+p}})),Object.defineProperty(C,"pauseOnExit",A({},y,{get:function(){return l},set:function(p){l=!!p}})),Object.defineProperty(C,"startTime",A({},y,{get:function(){return o},set:function(p){if(typeof p!="number")throw new TypeError("Start time must be set to a number.");o=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"endTime",A({},y,{get:function(){return s},set:function(p){if(typeof p!="number")throw new TypeError("End time must be set to a number.");s=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"text",A({},y,{get:function(){return d},set:function(p){d=""+p,this.hasBeenReset=!0}})),Object.defineProperty(C,"region",A({},y,{get:function(){return w},set:function(p){w=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"vertical",A({},y,{get:function(){return f},set:function(p){var b=N(p);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");f=b,this.hasBeenReset=!0}})),Object.defineProperty(C,"snapToLines",A({},y,{get:function(){return m},set:function(p){m=!!p,this.hasBeenReset=!0}})),Object.defineProperty(C,"line",A({},y,{get:function(){return L},set:function(p){if(typeof p!="number"&&p!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");L=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"lineAlign",A({},y,{get:function(){return x},set:function(p){var b=k(p);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");x=b,this.hasBeenReset=!0}})),Object.defineProperty(C,"position",A({},y,{get:function(){return h},set:function(p){if(p<0||p>100)throw new Error("Position must be between 0 and 100.");h=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"positionAlign",A({},y,{get:function(){return c},set:function(p){var b=k(p);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");c=b,this.hasBeenReset=!0}})),Object.defineProperty(C,"size",A({},y,{get:function(){return u},set:function(p){if(p<0||p>100)throw new Error("Size must be between 0 and 100.");u=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"align",A({},y,{get:function(){return a},set:function(p){var b=k(p);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");a=b,this.hasBeenReset=!0}})),C.displayState=void 0}return O.prototype.getCueAsHTML=function(){var E=self.WebVTT;return E.convertCueToDOMTree(self,this.text)},O}()},"./src/utils/vttparser.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"parseTimeStamp",function(){return P}),D.d(G,"fixLineBreaks",function(){return T}),D.d(G,"VTTParser",function(){return _});var W=D("./src/utils/vttcue.ts"),R=function(){function C(){}var y=C.prototype;return y.decode=function(l,o){if(!l)return"";if(typeof l!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(l))},C}();function P(C){function y(l,o,s,d){return(l|0)*3600+(o|0)*60+(s|0)+parseFloat(d||0)}var g=C.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return g?parseFloat(g[2])>59?y(g[2],g[3],0,g[4]):y(g[1],g[2],g[3],g[4]):null}var N=function(){function C(){this.values=Object.create(null)}var y=C.prototype;return y.set=function(l,o){!this.get(l)&&o!==""&&(this.values[l]=o)},y.get=function(l,o,s){return s?this.has(l)?this.values[l]:o[s]:this.has(l)?this.values[l]:o},y.has=function(l){return l in this.values},y.alt=function(l,o,s){for(var d=0;d<s.length;++d)if(o===s[d]){this.set(l,o);break}},y.integer=function(l,o){/^-?\d+$/.test(o)&&this.set(l,parseInt(o,10))},y.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},C}();function k(C,y,g,l){var o=l?C.split(l):[C];for(var s in o){if(typeof o[s]!="string")continue;var d=o[s].split(g);if(d.length!==2)continue;var w=d[0],f=d[1];y(w,f)}}var A=new W.default(0,0,""),O=A.align==="middle"?"middle":"center";function E(C,y,g){var l=C;function o(){var w=P(C);if(w===null)throw new Error("Malformed timestamp: "+l);return C=C.replace(/^[^\sa-zA-Z-]+/,""),w}function s(w,f){var m=new N;k(w,function(h,c){var u;switch(h){case"region":for(var a=g.length-1;a>=0;a--)if(g[a].id===c){m.set(h,g[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",O,"end"]);break;case"position":u=c.split(","),m.percent(h,u[0]),u.length===2&&m.alt("positionAlign",u[1],["start",O,"end","line-left","line-right","auto"]);break;case"size":m.percent(h,c);break;case"align":m.alt(h,c,["start",O,"end","left","right"]);break}},/:/,/\s/),f.region=m.get("region",null),f.vertical=m.get("vertical","");var L=m.get("line","auto");L==="auto"&&A.line===-1&&(L=-1),f.line=L,f.lineAlign=m.get("lineAlign","start"),f.snapToLines=m.get("snapToLines",!0),f.size=m.get("size",100),f.align=m.get("align",O);var x=m.get("position","auto");x==="auto"&&A.position===50&&(x=f.align==="start"||f.align==="left"?0:f.align==="end"||f.align==="right"?100:50),f.position=x}function d(){C=C.replace(/^\s+/,"")}if(d(),y.startTime=o(),d(),C.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+l);C=C.substr(3),d(),y.endTime=o(),d(),s(C,y)}function T(C){return C.replace(/<br(?: \/)?>/gi,`
`)}var _=function(){function C(){this.state="INITIAL",this.buffer="",this.decoder=new R,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var y=C.prototype;return y.parse=function(l){var o=this;l&&(o.buffer+=o.decoder.decode(l,{stream:!0}));function s(){var x=o.buffer,h=0;for(x=T(x);h<x.length&&x[h]!=="\r"&&x[h]!==`
`;)++h;var c=x.substr(0,h);return x[h]==="\r"&&++h,x[h]===`
`&&++h,o.buffer=x.substr(h),c}function d(x){k(x,function(h,c){},/:/)}try{var w="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;w=s();var f=w.match(/^()?WEBVTT([ \t].*)?$/);if(!f||!f[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:w=s();switch(o.state){case"HEADER":/:/.test(w)?d(w):w||(o.state="ID");continue;case"NOTE":w||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(w)){o.state="NOTE";break}if(!w)continue;if(o.cue=new W.default(0,0,""),o.state="CUE",w.indexOf("-->")===-1){o.cue.id=w;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{E(w,o.cue,o.regionList)}catch(x){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var L=w.indexOf("-->")!==-1;if(!w||L&&(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+=w}continue;case"BADCUE":w||(o.state="ID")}}}catch(x){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},y.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},C}()},"./src/utils/webvtt-parser.ts":function(ee,G,D){"use strict";D.r(G),D.d(G,"generateCueId",function(){return _}),D.d(G,"parseWebVTT",function(){return y});var W=D("./src/polyfills/number.ts"),R=D("./src/utils/vttparser.ts"),P=D("./src/demux/id3.ts"),N=D("./src/utils/timescale-conversion.ts"),k=D("./src/remux/mp4-remuxer.ts"),A=/\r\n|\n\r|\n|\r/g,O=function(l,o,s){return s===void 0&&(s=0),l.substr(s,o.length)===o},E=function(l){var o=parseInt(l.substr(-3)),s=parseInt(l.substr(-6,2)),d=parseInt(l.substr(-9,2)),w=l.length>9?parseInt(l.substr(0,l.indexOf(":"))):0;if(!Object(W.isFiniteNumber)(o)||!Object(W.isFiniteNumber)(s)||!Object(W.isFiniteNumber)(d)||!Object(W.isFiniteNumber)(w))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+l);return o+=1e3*s,o+=60*1e3*d,o+=60*60*1e3*w,o},T=function(l){for(var o=5381,s=l.length;s;)o=o*33^l.charCodeAt(--s);return(o>>>0).toString()};function _(g,l,o){return T(g.toString())+T(l.toString())+T(o)}var C=function(l,o,s){var d=l[o],w=l[d.prevCC];if(!w||!w.new&&d.new){l.ccOffset=l.presentationOffset=d.start,d.new=!1;return}for(;(f=w)!==null&&f!==void 0&&f.new;){var f;l.ccOffset+=d.start-w.start,d.new=!1,d=w,w=l[d.prevCC]}l.presentationOffset=s};function y(g,l,o,s,d,w,f,m){var L=new R.VTTParser,x=Object(P.utf8ArrayToStr)(new Uint8Array(g)).trim().replace(A,`
`).split(`
`),h=[],c=Object(N.toMpegTsClockFromTimescale)(l,o),u="00:00.000",a=0,v=0,p,b=!0,M=!1;L.oncue=function(F){var H=s[d],X=s.ccOffset,B=(a-c)/9e4;if(H!=null&&H.new&&(v!==void 0?X=s.ccOffset=H.start:C(s,d,B)),B&&(X=B-s.presentationOffset),M){var U=F.endTime-F.startTime,z=Object(k.normalizePts)((F.startTime+X-v)*9e4,w*9e4)/9e4;F.startTime=z,F.endTime=z+U}var Z=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(Z)),F.id||(F.id=_(F.startTime,F.endTime,Z)),F.endTime>0&&h.push(F)},L.onparsingerror=function(F){p=F},L.onflush=function(){if(p){m(p);return}f(h)},x.forEach(function(F){if(b)if(O(F,"X-TIMESTAMP-MAP=")){b=!1,M=!0,F.substr(16).split(",").forEach(function(H){O(H,"LOCAL:")?u=H.substr(6):O(H,"MPEGTS:")&&(a=parseInt(H.substr(7)))});try{v=E(u)/1e3}catch(H){M=!1,p=H}return}else F===""&&(b=!1);L.parse(F+`
`)}),L.flush()}},"./src/utils/xhr-loader.ts":function(ee,G,D){"use strict";D.r(G);var W=D("./src/utils/logger.ts"),R=D("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,N=function(){function k(O){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=O?O.xhrSetup:null,this.stats=new R.LoadStats,this.retryDelay=0}var A=k.prototype;return A.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},A.abortInternal=function(){var E=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),E&&(E.onreadystatechange=null,E.onprogress=null,E.readyState!==4&&(this.stats.aborted=!0,E.abort()))},A.abort=function(){var E;this.abortInternal(),(E=this.callbacks)!==null&&E!==void 0&&E.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},A.load=function(E,T,_){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=E,this.config=T,this.callbacks=_,this.retryDelay=T.retryDelay,this.loadInternal()},A.loadInternal=function(){var E=this.config,T=this.context;if(!E)return;var _=this.loader=new self.XMLHttpRequest,C=this.stats;C.loading.first=0,C.loaded=0;var y=this.xhrSetup;try{if(y)try{y(_,T.url)}catch(o){_.open("GET",T.url,!0),y(_,T.url)}_.readyState||_.open("GET",T.url,!0);var g=this.context.headers;if(g)for(var l in g)_.setRequestHeader(l,g[l])}catch(o){this.callbacks.onError({code:_.status,text:o.message},T,_);return}T.rangeEnd&&_.setRequestHeader("Range","bytes="+T.rangeStart+"-"+(T.rangeEnd-1)),_.onreadystatechange=this.readystatechange.bind(this),_.onprogress=this.loadprogress.bind(this),_.responseType=T.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),E.timeout),_.send()},A.readystatechange=function(){var E=this.context,T=this.loader,_=this.stats;if(!E||!T)return;var C=T.readyState,y=this.config;if(_.aborted)return;if(C>=2)if(self.clearTimeout(this.requestTimeout),_.loading.first===0&&(_.loading.first=Math.max(self.performance.now(),_.loading.start)),C===4){T.onreadystatechange=null,T.onprogress=null;var g=T.status;if(g>=200&&g<300){_.loading.end=Math.max(self.performance.now(),_.loading.first);var l,o;if(E.responseType==="arraybuffer"?(l=T.response,o=l.byteLength):(l=T.responseText,o=l.length),_.loaded=_.total=o,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(_,E,l,T),!this.callbacks)return;var d={url:T.responseURL,data:l};this.callbacks.onSuccess(d,_,E,T)}else _.retry>=y.maxRetry||g>=400&&g<499?(W.logger.error(g+" while loading "+E.url),this.callbacks.onError({code:g,text:T.statusText},E,T)):(W.logger.warn(g+" while loading "+E.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,y.maxRetryDelay),_.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout)},A.loadtimeout=function(){W.logger.warn("timeout while loading "+this.context.url);var E=this.callbacks;E&&(this.abortInternal(),E.onTimeout(this.stats,this.context,this.loader))},A.loadprogress=function(E){var T=this.stats;T.loaded=E.loaded,E.lengthComputable&&(T.total=E.total)},A.getCacheAge=function(){var E=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var T=this.loader.getResponseHeader("age");E=T?parseFloat(T):null}return E},k}();G.default=N}}).default})},vHTk:function(lt,Je,Q){lt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);