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.
133 lines
705 KiB
133 lines
705 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[244,7],{"+NIl":function(dt,Qe,J){(function(Z){Z(J("VrN/"))})(function(Z){"use strict";Z.defineMode("stex",function(G,D){"use strict";function W(L,S){L.cmdState.push(S)}function M(L){return L.cmdState.length>0?L.cmdState[L.cmdState.length-1]:null}function O(L){var S=L.cmdState.pop();S&&S.closeBracket()}function F(L){for(var S=L.cmdState,y=S.length-1;y>=0;y--){var u=S[y];if(u.name=="DEFAULT")continue;return u}return{styleIdentifier:function(){return null}}}function I(L,S,y){return function(){this.name=L,this.bracketNo=0,this.style=S,this.styles=y,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var R={};R.importmodule=I("importmodule","tag",["string","builtin"]),R.documentclass=I("documentclass","tag",["","atom"]),R.usepackage=I("usepackage","tag",["atom"]),R.begin=I("begin","tag",["atom"]),R.end=I("end","tag",["atom"]),R.label=I("label","tag",["atom"]),R.ref=I("ref","tag",["atom"]),R.eqref=I("eqref","tag",["atom"]),R.cite=I("cite","tag",["atom"]),R.bibitem=I("bibitem","tag",["atom"]),R.Bibitem=I("Bibitem","tag",["atom"]),R.RBibitem=I("RBibitem","tag",["atom"]),R.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function _(L,S){L.f=S}function g(L,S){var y;if(L.match(/^\\[a-zA-Z@]+/)){var u=L.current().slice(1);return y=R.hasOwnProperty(u)?R[u]:R.DEFAULT,y=new y,W(S,y),_(S,A),y.style}if(L.match(/^\\[$&%#{}_]/))return"tag";if(L.match(/^\\[,;!\/\\]/))return"tag";if(L.match("\\["))return _(S,function(s,l){return T(s,l,"\\]")}),"keyword";if(L.match("\\("))return _(S,function(s,l){return T(s,l,"\\)")}),"keyword";if(L.match("$$"))return _(S,function(s,l){return T(s,l,"$$")}),"keyword";if(L.match("$"))return _(S,function(s,l){return T(s,l,"$")}),"keyword";var o=L.next();if(o=="%")return L.skipToEnd(),"comment";if(o=="}"||o=="]"){if(y=M(S),y)y.closeBracket(o),_(S,A);else return"error";return"bracket"}else return o=="{"||o=="["?(y=R.DEFAULT,y=new y,W(S,y),"bracket"):/\d/.test(o)?(L.eatWhile(/[\w.%]/),"atom"):(L.eatWhile(/[\w\-_]/),y=F(S),y.name=="begin"&&(y.argument=L.current()),y.styleIdentifier())}function T(L,S,y){if(L.eatSpace())return null;if(y&&L.match(y))return _(S,g),"keyword";if(L.match(/^\\[a-zA-Z@]+/))return"tag";if(L.match(/^[a-zA-Z]+/))return"variable-2";if(L.match(/^\\[$&%#{}_]/))return"tag";if(L.match(/^\\[,;!\/]/))return"tag";if(L.match(/^[\^_&]/))return"tag";if(L.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(L.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var u=L.next();return u=="{"||u=="}"||u=="["||u=="]"||u=="("||u==")"?"bracket":u=="%"?(L.skipToEnd(),"comment"):"error"}function A(L,S){var y=L.peek(),u;return y=="{"||y=="["?(u=M(S),u.openBracket(y),L.eat(y),_(S,g),"bracket"):/[ \t\r]/.test(y)?(L.eat(y),null):(_(S,g),O(S),g(L,S))}return{startState:function(){var L=D.inMathMode?function(S,y){return T(S,y)}:g;return{cmdState:[],f:L}},copyState:function(L){return{cmdState:L.cmdState.slice(),f:L.f}},token:function(L,S){return S.f(L,S)},blankLine:function(L){L.f=g,L.cmdState.length=0},lineComment:"%"}}),Z.defineMIME("text/x-stex","stex"),Z.defineMIME("text/x-latex","stex")})},"19Vz":function(dt,Qe,J){(function(Z){Z(J("VrN/"))})(function(Z){Z.defineOption("placeholder","",function(I,R,_){var g=_&&_!=Z.Init;if(R&&!g)I.on("blur",M),I.on("change",O),I.on("swapDoc",O),Z.on(I.getInputField(),"compositionupdate",I.state.placeholderCompose=function(){W(I)}),O(I);else if(!R&&g){I.off("blur",M),I.off("change",O),I.off("swapDoc",O),Z.off(I.getInputField(),"compositionupdate",I.state.placeholderCompose),G(I);var T=I.getWrapperElement();T.className=T.className.replace(" CodeMirror-empty","")}R&&!I.hasFocus()&&M(I)});function G(I){I.state.placeholder&&(I.state.placeholder.parentNode.removeChild(I.state.placeholder),I.state.placeholder=null)}function D(I){G(I);var R=I.state.placeholder=document.createElement("pre");R.style.cssText="height: 0; overflow: visible",R.style.direction=I.getOption("direction"),R.className="CodeMirror-placeholder CodeMirror-line-like";var _=I.getOption("placeholder");typeof _=="string"&&(_=document.createTextNode(_)),R.appendChild(_),I.display.lineSpace.insertBefore(R,I.display.lineSpace.firstChild)}function W(I){setTimeout(function(){var R=!1,_=I.getInputField();_.nodeName=="TEXTAREA"?R=!_.value:I.lineCount()==1&&(R=!/[^\u200b]/.test(_.querySelector(".CodeMirror-line").textContent)),R?D(I):G(I)},20)}function M(I){F(I)&&D(I)}function O(I){var R=I.getWrapperElement(),_=F(I);R.className=R.className.replace(" CodeMirror-empty","")+(_?" CodeMirror-empty":""),_?D(I):G(I)}function F(I){return I.lineCount()===1&&I.getLine(0)===""}})},"1eCo":function(dt,Qe,J){(function(Z){Z(J("VrN/"))})(function(Z){"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};Z.defineMode("xml",function(W,M){var O=W.indentUnit,F={},I=M.htmlMode?G:D;for(var R in I)F[R]=I[R];for(var R in M)F[R]=M[R];var _,g;function T(a,b){function p(N){return b.tokenize=N,N(a,b)}var x=a.next();if(x=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?p(S("atom","]]>")):null:a.match("--")?p(S("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),p(y(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),b.tokenize=S("meta","?>"),"meta"):(_=a.eat("/")?"closeTag":"openTag",b.tokenize=A,"tag bracket");if(x=="&"){var P;return a.eat("#")?a.eat("x")?P=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):P=a.eatWhile(/[\d]/)&&a.eat(";"):P=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),P?"atom":"error"}else return a.eatWhile(/[^&<]/),null}T.isInText=!0;function A(a,b){var p=a.next();if(p==">"||p=="/"&&a.eat(">"))return b.tokenize=T,_=p==">"?"endTag":"selfcloseTag","tag bracket";if(p=="=")return _="equals",null;if(p=="<"){b.tokenize=T,b.state=l,b.tagName=b.tagStart=null;var x=b.tokenize(a,b);return x?x+" tag error":"tag error"}else return/[\'\"]/.test(p)?(b.tokenize=L(p),b.stringStartCol=a.column(),b.tokenize(a,b)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function L(a){var b=function(p,x){for(;!p.eol();)if(p.next()==a){x.tokenize=A;break}return"string"};return b.isInAttribute=!0,b}function S(a,b){return function(p,x){for(;!p.eol();){if(p.match(b)){x.tokenize=T;break}p.next()}return a}}function y(a){return function(b,p){for(var x;(x=b.next())!=null;){if(x=="<")return p.tokenize=y(a+1),p.tokenize(b,p);if(x==">")if(a==1){p.tokenize=T;break}else return p.tokenize=y(a-1),p.tokenize(b,p)}return"meta"}}function u(a,b,p){this.prev=a.context,this.tagName=b,this.indent=a.indented,this.startOfLine=p,(F.doNotIndent.hasOwnProperty(b)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function s(a,b){for(var p;;){if(!a.context)return;if(p=a.context.tagName,!F.contextGrabbers.hasOwnProperty(p)||!F.contextGrabbers[p].hasOwnProperty(b))return;o(a)}}function l(a,b,p){return a=="openTag"?(p.tagStart=b.column(),w):a=="closeTag"?m:l}function w(a,b,p){return a=="word"?(p.tagName=b.current(),g="tag",v):F.allowMissingTagName&&a=="endTag"?(g="tag bracket",v(a,b,p)):(g="error",w)}function m(a,b,p){if(a=="word"){var x=b.current();return p.context&&p.context.tagName!=x&&F.implicitlyClosed.hasOwnProperty(p.context.tagName)&&o(p),p.context&&p.context.tagName==x||F.matchClosing===!1?(g="tag",h):(g="tag error",C)}else return F.allowMissingTagName&&a=="endTag"?(g="tag bracket",h(a,b,p)):(g="error",C)}function h(a,b,p){return a!="endTag"?(g="error",h):(o(p),l)}function C(a,b,p){return g="error",h(a,b,p)}function v(a,b,p){if(a=="word")return g="attribute",c;if(a=="endTag"||a=="selfcloseTag"){var x=p.tagName,P=p.tagStart;return p.tagName=p.tagStart=null,a=="selfcloseTag"||F.autoSelfClosers.hasOwnProperty(x)?s(p,x):(s(p,x),p.context=new u(p,x,P==p.indented)),l}return g="error",v}function c(a,b,p){return a=="equals"?f:(F.allowMissing||(g="error"),v(a,b,p))}function f(a,b,p){return a=="string"?d:a=="word"&&F.allowUnquoted?(g="string",v):(g="error",v(a,b,p))}function d(a,b,p){return a=="string"?d:v(a,b,p)}return{startState:function(a){var b={tokenize:T,state:l,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(b.baseIndent=a),b},token:function(a,b){if(!b.tagName&&a.sol()&&(b.indented=a.indentation()),a.eatSpace())return null;_=null;var p=b.tokenize(a,b);return(p||_)&&p!="comment"&&(g=null,b.state=b.state(_||p,a,b),g&&(p=g=="error"?p+" error":g)),p},indent:function(a,b,p){var x=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+O;if(x&&x.noIndent)return Z.Pass;if(a.tokenize!=A&&a.tokenize!=T)return p?p.match(/^(\s*)/)[0].length:0;if(a.tagName)return F.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+O*(F.multilineTagIndentFactor||1);if(F.alignCDATA&&/<!\[CDATA\[/.test(b))return 0;var P=b&&/^<(\/)?([\w_:\.-]*)/.exec(b);if(P&&P[1])for(;x;)if(x.tagName==P[2]){x=x.prev;break}else if(F.implicitlyClosed.hasOwnProperty(x.tagName))x=x.prev;else break;else if(P)for(;x;){var N=F.contextGrabbers[x.tagName];if(N&&N.hasOwnProperty(P[2]))x=x.prev;else break}for(;x&&x.prev&&!x.startOfLine;)x=x.prev;return x?x.indent+O:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:F.htmlMode?"html":"xml",helperType:F.htmlMode?"html":"xml",skipAttribute:function(a){a.state==f&&(a.state=v)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var b=[],p=a.context;p;p=p.prev)p.tagName&&b.push(p.tagName);return b.reverse()}}}),Z.defineMIME("text/xml","xml"),Z.defineMIME("application/xml","xml"),Z.mimeModes.hasOwnProperty("text/html")||Z.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"2RCv":function(dt,Qe,J){"use strict";var Z=J("Awhp"),G=J("KrTs"),D=J("+L6B"),W=J("2/Rp"),M=J("5NDa"),O=J("5rEg"),F=J("0Owb"),I=J("oBTY"),R=J("tJVT"),_=J("PpiC"),g=J("cDcd"),T=J.n(g),A=function(S){var y=S.InputRight,u=S.value,o=u===void 0?[]:u,s=S.onChange,l=s===void 0?function(){}:s,w=Object(_.a)(S,["InputRight","value","onChange"]),m=Object(g.useState)(),h=Object(R.a)(m,2),C=h[0],v=h[1],c=function(a){var b=o.filter(function(p,x){return x!==a});l(b)},f=function(a){if(a.preventDefault(),!C)return;l([].concat(Object(I.a)(o),[C])),v(null)};return T.a.createElement("div",null,T.a.createElement(O.a,Object(F.a)({},w,{value:C,onChange:function(a){return v(a.target.value)},onPressEnter:f,onBlur:f})),y,T.a.createElement("div",{className:"mt20"},o==null?void 0:o.map(function(d,a){return T.a.createElement(G.a,{className:"ml10 mr10",count:"x",onClick:function(){return c(a)}},T.a.createElement(W.a,{type:"primary",ghost:!0},d))})))};Qe.a=A},"7Cbv":function(dt,Qe,J){"use strict";var Z=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),G=new Uint8Array(16);function D(){if(!Z)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Z(G)}var W=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function M(A){return typeof A=="string"&&W.test(A)}for(var O=M,F=[],I=0;I<256;++I)F.push((I+256).toString(16).substr(1));function R(A){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,S=(F[A[L+0]]+F[A[L+1]]+F[A[L+2]]+F[A[L+3]]+"-"+F[A[L+4]]+F[A[L+5]]+"-"+F[A[L+6]]+F[A[L+7]]+"-"+F[A[L+8]]+F[A[L+9]]+"-"+F[A[L+10]]+F[A[L+11]]+F[A[L+12]]+F[A[L+13]]+F[A[L+14]]+F[A[L+15]]).toLowerCase();if(!O(S))throw TypeError("Stringified UUID is invalid");return S}var _=R;function g(A,L,S){A=A||{};var y=A.random||(A.rng||D)();if(y[6]=y[6]&15|64,y[8]=y[8]&63|128,L){S=S||0;for(var u=0;u<16;++u)L[S+u]=y[u];return L}return _(y)}var T=Qe.a=g},"7ahc":function(dt,Qe,J){"use strict";J.d(Qe,"a",function(){return w});var Z=J("k1fw"),G=J("0Owb"),D=J("+L6B"),W=J("2/Rp"),M=J("y8nQ"),O=J("Vl3Y"),F=J("tJVT"),I=J("OaEy"),R=J("2fM7"),_=J("cDcd"),g=J.n(_),T=J("VrN/"),A=J.n(T),L=J("p77/"),S=J.n(L),y=J("c5Ni"),u=J.n(y),o=R.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},l={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};Qe.b=function(m){var h=m.callback,C=m.onCancel,v=Object(_.useState)("python"),c=Object(F.a)(v,2),f=c[0],d=c[1];function a(p){d(l[p][1])}function b(p){h(p)}return g.a.createElement(O.a,Object(G.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:b}),g.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},g.a.createElement(R.a,{onChange:a},Object.keys(l).map(function(p){return g.a.createElement(o,{key:p,value:p},l[p][0])}))),g.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},g.a.createElement(w,{mode:f})),g.a.createElement("div",{className:"flex-container flex-end"},g.a.createElement(W.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),g.a.createElement(W.a,{type:"ghost",onClick:C},"\u53D6\u6D88")))};function w(m){var h=m.value,C=m.onChange,v=m.mode,c=m.options,f=c===void 0?{}:c,d=Object(_.useRef)(),a=Object(_.useState)(),b=Object(F.a)(a,2),p=b[0],x=b[1];return Object(_.useEffect)(function(){if(p){function P(N){var K=N.getValue();C&&C(K)}return p.on("change",P),function(){p.off("change",P)}}},[p,C]),Object(_.useEffect)(function(){p&&p.setOption("mode",v)},[p,v]),Object(_.useEffect)(function(){p&&((h!==p.getValue()||h==="")&&setTimeout(function(){p.setValue(h||" ")},300))},[p,h]),Object(_.useEffect)(function(){if(d.current&&!p){var P=A.a.fromTextArea(d.current,Object(Z.a)({mode:v,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},f));x(P)}},[d.current,p]),g.a.createElement("div",{className:"my-codemirror-container"},g.a.createElement("textarea",{ref:d}))}},"7ixt":function(dt,Qe,J){"use strict";J.d(Qe,"a",function(){return D});var Z={adjustX:1,adjustY:1},G=[0,0],D={left:{points:["cr","cl"],overflow:Z,offset:[-4,0],targetOffset:G},right:{points:["cl","cr"],overflow:Z,offset:[4,0],targetOffset:G},top:{points:["bc","tc"],overflow:Z,offset:[0,-4],targetOffset:G},bottom:{points:["tc","bc"],overflow:Z,offset:[0,4],targetOffset:G},topLeft:{points:["bl","tl"],overflow:Z,offset:[0,-4],targetOffset:G},leftTop:{points:["tr","tl"],overflow:Z,offset:[-4,0],targetOffset:G},topRight:{points:["br","tr"],overflow:Z,offset:[0,-4],targetOffset:G},rightTop:{points:["tl","tr"],overflow:Z,offset:[4,0],targetOffset:G},bottomRight:{points:["tr","br"],overflow:Z,offset:[0,4],targetOffset:G},rightBottom:{points:["bl","br"],overflow:Z,offset:[4,0],targetOffset:G},bottomLeft:{points:["tl","bl"],overflow:Z,offset:[0,4],targetOffset:G},leftBottom:{points:["br","bl"],overflow:Z,offset:[-4,0],targetOffset:G}},W=D},"8EBN":function(dt,Qe,J){(function(Z){Z(J("VrN/"))})(function(Z){"use strict";Z.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<Z.modeInfo.length;G++){var D=Z.modeInfo[G];D.mimes&&(D.mime=D.mimes[0])}Z.findModeByMIME=function(W){W=W.toLowerCase();for(var M=0;M<Z.modeInfo.length;M++){var O=Z.modeInfo[M];if(O.mime==W)return O;if(O.mimes){for(var F=0;F<O.mimes.length;F++)if(O.mimes[F]==W)return O}}if(/\+xml$/.test(W))return Z.findModeByMIME("application/xml");if(/\+json$/.test(W))return Z.findModeByMIME("application/json")},Z.findModeByExtension=function(W){W=W.toLowerCase();for(var M=0;M<Z.modeInfo.length;M++){var O=Z.modeInfo[M];if(O.ext){for(var F=0;F<O.ext.length;F++)if(O.ext[F]==W)return O}}},Z.findModeByFileName=function(W){for(var M=0;M<Z.modeInfo.length;M++){var O=Z.modeInfo[M];if(O.file&&O.file.test(W))return O}var F=W.lastIndexOf("."),I=F>-1&&W.substring(F+1,W.length);if(I)return Z.findModeByExtension(I)},Z.findModeByName=function(W){W=W.toLowerCase();for(var M=0;M<Z.modeInfo.length;M++){var O=Z.modeInfo[M];if(O.name.toLowerCase()==W)return O;if(O.alias){for(var F=0;F<O.alias.length;F++)if(O.alias[F].toLowerCase()==W)return O}}}})},"8hTe":function(dt,Qe,J){dt.exports={button:"button___1wy9m"}},"93VE":function(dt,Qe,J){},"9Bee":function(dt,Qe,J){"use strict";var Z=J("DYRE"),G=J("zeV3"),D=J("+L6B"),W=J("2/Rp"),M=J("k1fw"),O=J("tJVT"),F=J("cDcd"),I=J.n(F),R=J("vg9a"),_=J("DlQD"),g=J.n(_),T=J("rUJ1");function A(pe,fe){var me=pe.match(/^(\s+)(?:```)/);if(me===null)return fe;var ae=me[1];return fe.split(`
|
|
`).map(function(ue){var Ee=ue.match(/^\s+/);if(Ee===null)return ue;var Ie=Object(O.a)(Ee,1),ke=Ie[0];return ke.length>=ae.length?ue.slice(ae.length):ue}).join(`
|
|
`)}var L=[],S=["<ul>"],y=new g.a.Renderer,u=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function o(){L.length=0,S=["<ul>"]}var s={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function l(pe,fe,me,ae){if(fe>=pe.length||pe[fe].level<=me)return fe;var ue=pe[fe];ae.push("<li><a href='#"+ue.anchor+"'>"+ue.text+"</a>"),fe++;var Ee=[];return fe=l(pe,fe,ue.level,Ee),Ee.length>0&&(ae.push("<ul>"),Ee.forEach(function(Ie){ae.push(Ie)}),ae.push("</ul>")),ae.push("</li>"),fe=l(pe,fe,me,ae),fe}function w(){return l(L,0,0,S),S.push("</ul>"),S.join("")}var m={heading:function(fe){var me=u.exec(fe);if(me)return{type:"heading",raw:me[0],depth:me[1].length,text:me[2]}},fences:function(fe){var me=this.rules.block.fences.exec(fe);if(me){var ae=me[0],ue=A(ae,me[3]||""),Ee=me[2]?me[2].trim():me[2];if(["latex","katex","math"].indexOf(Ee)>=0){var Ie=v(),ke=ue;ue=Ie,c[Ie]={type:"block",expression:ke}}return{type:"code",raw:ae,lang:Ee,text:ue}}}},h=/(?:\${2})([^\n`]+?)(?:\${2})/gi,C=0,v=function(){return"__special_katext_id_".concat(C++,"__")},c={};function f(){return c}function d(){C=0,c={}}function a(pe){return pe=pe.replace(h,function(fe,me){var ae=v();return c[ae]={type:"inline",expression:me},ae}),pe}var b=y.listitem;y.listitem=function(pe){return b(a(pe))};var p=y.paragraph;y.paragraph=function(pe){return p(a(pe))};var x=y.tablecell;y.tablecell=function(pe,fe){return x(a(pe),fe)},y.code=function(pe,fe,me){var ae=(fe||"").match(/\S*/)[0];return ae?["latex","katex","math"].indexOf(ae)>=0?"<p class='editormd-tex'>".concat(pe,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(fe,'">').concat(me?pe:Object(T.escape)(pe,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(me?pe:Object(T.escape)(pe,!0))+"</code></pre>"},y.heading=function(pe,fe,me){var ae=this.options.headerPrefix+me.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return L.push({anchor:ae,level:fe,text:pe}),"<h"+fe+' id="'+ae+'">'+pe+"</h"+fe+">"},g.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),g.a.use({tokenizer:m,renderer:y});var P=g.a,N=J("SJMd"),K=J("ulZh"),V=J.n(K),B=J("m3rI"),U=J("Oy/b"),Y=J("p5ED"),ee=J("8hTe"),oe=J.n(ee),de=/<pre[^>]*>/g;function Te(pe){var fe=document.createElement("div");return fe.innerHTML=pe,fe.childNodes.length===0?"":fe.childNodes[0].nodeValue}var ge=Qe.a=function(pe){var fe=pe.value,me=fe===void 0?"":fe,ae=pe.edit,ue=ae===void 0?!1:ae,Ee=pe.className,Ie=pe.showTextOnly,ke=pe.showLines,Xe=pe.replaces,Ne=pe.zoomImg,we=pe.hasMask,Ce=pe.style,Re=Ce===void 0?{}:Ce,Be=pe.stylesPrev,je=Be===void 0?{}:Be,Ae=String(me),Le=Object(F.useRef)(),Je=Object(F.useRef)(),Ye=Object(F.useState)(""),He=Object(O.a)(Ye,2),Ke=He[0],et=He[1],Ve=Object(F.useState)("office"),Ge=Object(O.a)(Ve,2),ye=Ge[0],Ze=Ge[1],ze=Object(F.useMemo)(function(){try{var ie=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,X=/\"\/api\/attachments\/|\"\/attachments\/download\//g,$=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Ae=Ae.replace(ie,"("+B.a.API_SERVER+"/api/attachments/").replace(X,'"'+B.a.API_SERVER+"/api/attachments/").replace($,'"'+B.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`)}catch(ve){}var Q=P(Ae),te=f();if(Ae.match(/\[TOC\]/)&&(Q=Q.replace("<p>[TOC]</p>",w()),o()),Q=Q.replace(/(__special_katext_id_\d+__)/g,function(ve,Se){var We=te[Se],rt=We.type,tt=We.expression;return Object(U.renderToString)(Te(tt)||"",{displayMode:rt==="block",throwOnError:!1,output:"html"})}),Q=Q.replace(/▁/g,"\u2581\u2581\u2581"),d(),Ie){var se=document.createElement("div");return se.innerHTML=Q,se.innerText}return setTimeout(function(){return le()},500),Q},[Ae]),be=Object(F.useRef)();s.WebkitLineClamp=ke,ke&&(Re=Object(M.a)(Object(M.a)({},Re),s));function _e(ie){var X=ie.target;if(X.tagName.toUpperCase()==="IMG"){if(Ne){var $=X.getAttribute("src");et($),Ze("image")}}else if(X.tagName.toUpperCase()==="A"){var Q=X.getAttribute("href");if(Q.indexOf("office")>-1)ie.preventDefault(),et(Q),Ze("office");else if(Q.indexOf("application/pdf")>-1)ie.preventDefault(),et(Q),Ze("pdf");else if(Q.indexOf("text/html")>-1)ie.preventDefault(),et(Q),Ze("html");else if(Q.startsWith("#")){ie.preventDefault();var te=document.getElementById(Q.replace("#",""));te&&te.scrollIntoView(!0)}}}var le=function(){var X,$=(X=be.current)===null||X===void 0?void 0:X.querySelectorAll("video");$==null||$.forEach(function(Q){if(Q.oncontextmenu=function(){return!1},Q.src.indexOf(".m3u8")>-1&&!Q.canPlayType("application/vnd.apple.mpegurl")){if(V.a.isSupported()){var te=new V.a;te.loadSource(Q.src),te.attachMedia(Q)}}})};Object(F.useEffect)(function(){if(be.current&&ze&&(ze.match(de)&&window.PR.prettyPrint()),be.current)return be.current.addEventListener("click",_e),function(){be.current.removeEventListener("click",_e),d(),o()}},[ze,be.current,_e]);var ne=function(X){if(!ue)return;X.target.nodeName==="IMG"?(Le.current.style.display="flex",Le.current.style.width=X.target.clientWidth+"px",Le.current.style.height=X.target.clientHeight+"px",Le.current.style.top=X.target.offsetTop+"px",Le.current.style.left=X.target.offsetLeft+"px",Je.current.src=X.target.getAttribute("src")):Le.current.style.display="none"};return I.a.createElement("div",{style:{position:"relative"}},I.a.createElement("div",{ref:be,style:Object(M.a)({},Re),className:"".concat(Ee||""," markdown-body ").concat(oe.a.mdBody),onMouseOver:ne,dangerouslySetInnerHTML:{__html:ze}}),I.a.createElement("div",{ref:Le,className:oe.a.button},I.a.createElement(G.a,null,I.a.createElement(W.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),I.a.createElement(W.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),I.a.createElement("img",{ref:Je,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),I.a.createElement(Y.a,{close:!0,data:Ke,type:Ke!=null&&Ke.length?ye:"",style:Object(M.a)({},je),onClose:function(){return et("")}}))}},"9VGf":function(dt,Qe,J){"use strict";J.d(Qe,"a",function(){return D});var Z=J("cDcd"),G=J.n(Z);function D(W,M){var O=Object(Z.useRef)();Object(Z.useEffect)(function(){O.current=W}),Object(Z.useEffect)(function(){function F(){O.current()}if(M!==null){var I=setInterval(F,M);return function(){return clearInterval(I)}}},[M])}},"9ZNV":function(dt,Qe,J){"use strict";J.d(Qe,"a",function(){return _});var Z=J("0Owb"),G=J("+L6B"),D=J("2/Rp"),W=J("cDcd"),M=J.n(W),O=J("UUDw"),F=J.n(O),I=J("TSYQ"),R=J.n(I),_=function(T){var A=T.cancelText,L=A===void 0?"\u53D6\u6D88":A,S=T.okText,y=S===void 0?"\u786E\u5B9A":S,u=T.loading,o=u===void 0?!1:u,s=T.hasOkBtn,l=s===void 0?!0:s,w=T.okButtonProps,m=w===void 0?{}:w,h=T.onCancel,C=h===void 0?function(){}:h,v=T.onOk,c=v===void 0?function(){}:v,f=T.className,d=f===void 0?"":f;return M.a.createElement("div",{className:R()(F.a.buttonFixed,d)},M.a.createElement("div",{className:F.a.buttonWrap},M.a.createElement(D.a,{size:"large",className:"".concat(F.a.button," mr20"),onClick:C},L),l&&M.a.createElement(D.a,Object(Z.a)({size:"large",type:"primary",className:"".concat(F.a.button," mr20"),loading:o,onClick:c},m),y)))}},Bd2K:function(dt,Qe,J){(function(Z){Z(J("VrN/"),J("osHv"))})(function(Z){Z.defineOption("autoCloseTags",!1,function(R,_,g){if(g!=Z.Init&&g&&R.removeKeyMap("autoCloseTags"),!_)return;var T={name:"autoCloseTags"};(typeof _!="object"||_.whenClosing!==!1)&&(T["'/'"]=function(A){return O(A)}),(typeof _!="object"||_.whenOpening!==!1)&&(T["'>'"]=function(A){return W(A)}),R.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(R){if(R.getOption("disableInput"))return Z.Pass;for(var _=R.listSelections(),g=[],T=R.getOption("autoCloseTags"),A=0;A<_.length;A++){if(!_[A].empty())return Z.Pass;var L=_[A].head,S=R.getTokenAt(L),y=Z.innerMode(R.getMode(),S.state),u=y.state,o=y.mode.xmlCurrentTag&&y.mode.xmlCurrentTag(u),s=o&&o.name;if(!s)return Z.Pass;var l=y.mode.configuration=="html",w=typeof T=="object"&&T.dontCloseTags||l&&G,m=typeof T=="object"&&T.indentTags||l&&D;S.end>L.ch&&(s=s.slice(0,s.length-S.end+L.ch));var h=s.toLowerCase();if(!s||S.type=="string"&&(S.end!=L.ch||!/[\"\']/.test(S.string.charAt(S.string.length-1))||S.string.length==1)||S.type=="tag"&&o.close||S.string.indexOf("/")==L.ch-S.start-1||w&&F(w,h)>-1||I(R,y.mode.xmlCurrentContext&&y.mode.xmlCurrentContext(u)||[],s,L,!0))return Z.Pass;var C=typeof T=="object"&&T.emptyTags;if(C&&F(C,s)>-1){g[A]={text:"/>",newPos:Z.Pos(L.line,L.ch+2)};continue}var v=m&&F(m,h)>-1;g[A]={indent:v,text:">"+(v?`
|
|
|
|
`:"")+"</"+s+">",newPos:v?Z.Pos(L.line+1,0):Z.Pos(L.line,L.ch+1)}}for(var c=typeof T=="object"&&T.dontIndentOnAutoClose,A=_.length-1;A>=0;A--){var f=g[A];R.replaceRange(f.text,_[A].head,_[A].anchor,"+insert");var d=R.listSelections().slice(0);d[A]={head:f.newPos,anchor:f.newPos},R.setSelections(d),!c&&f.indent&&(R.indentLine(f.newPos.line,null,!0),R.indentLine(f.newPos.line+1,null,!0))}}function M(R,_){for(var g=R.listSelections(),T=[],A=_?"/":"</",L=R.getOption("autoCloseTags"),S=typeof L=="object"&&L.dontIndentOnSlash,y=0;y<g.length;y++){if(!g[y].empty())return Z.Pass;var u=g[y].head,o=R.getTokenAt(u),s=Z.innerMode(R.getMode(),o.state),l=s.state;if(_&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=u.ch-1))return Z.Pass;var w,m=s.mode.name!="xml"&&R.getMode().name=="htmlmixed";if(m&&s.mode.name=="javascript")w=A+"script";else if(m&&s.mode.name=="css")w=A+"style";else{var h=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(l);if(!h||h.length&&I(R,h,h[h.length-1],u))return Z.Pass;w=A+h[h.length-1]}R.getLine(u.line).charAt(o.end)!=">"&&(w+=">"),T[y]=w}if(R.replaceSelections(T),g=R.listSelections(),!S)for(var y=0;y<g.length;y++)(y==g.length-1||g[y].head.line<g[y+1].head.line)&&R.indentLine(g[y].head.line)}function O(R){return R.getOption("disableInput")?Z.Pass:M(R,!0)}Z.commands.closeTag=function(R){return M(R)};function F(R,_){if(R.indexOf)return R.indexOf(_);for(var g=0,T=R.length;g<T;++g)if(R[g]==_)return g;return-1}function I(R,_,g,T,A){if(!Z.scanForClosingTag)return!1;var L=Math.min(R.lastLine()+1,T.line+500),S=Z.scanForClosingTag(R,T,null,L);if(!S||S.tag!=g)return!1;for(var y=A?1:0,u=_.length-1;u>=0&&_[u]==g;u--)++y;T=S.to;for(var u=1;u<y;u++){var o=Z.scanForClosingTag(R,T,null,L);if(!o||o.tag!=g)return!1;T=o.to}return!0}})},BjJ7:function(dt,Qe,J){"use strict";J.d(Qe,"d",function(){return G}),J.d(Qe,"c",function(){return D}),J.d(Qe,"e",function(){return W}),J.d(Qe,"b",function(){return M}),J.d(Qe,"a",function(){return F});var Z=J("m3rI");function G(I){var R=!0;if(I.length>0){for(var _=0;_<I.length;_++)if(I[_].compile_success==0||!I[_].compile_success){R=!1;break}}else R=!1;return R}function D(I){for(var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",_=[],g=0;g<I.length;g++){var T=I[g],A=R?"".concat(R,"/").concat(T.name):"".concat(T.name);_.push({title:T.name,isLeaf:!(T.type==="tree"),key:A})}return _}function W(I,R,_){for(var g=0;g<I.length;g++){var T=I[g];if(T.key===R){T.children=_;break}T.children&&W(T.children,R,_)}return I}function M(I,R,_){var g;return function(){var T=this,A=arguments,L=function(){g=null,_||I.apply(T,A)},S=_&&!g;clearTimeout(g),g=setTimeout(L,R),S&&I.apply(T,A)}}var O=!0,F=Z.a.API_SERVER},"C+DQ":function(dt,Qe,J){},DlQD:function(dt,Qe,J){(function(Z,G){dt.exports=G()})(this,function(){"use strict";function Z(le,ne){for(var ie=0;ie<ne.length;ie++){var X=ne[ie];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(le,X.key,X)}}function G(le,ne,ie){return ne&&Z(le.prototype,ne),ie&&Z(le,ie),le}function D(le,ne){if(!le)return;if(typeof le=="string")return W(le,ne);var ie=Object.prototype.toString.call(le).slice(8,-1);if(ie==="Object"&&le.constructor&&(ie=le.constructor.name),ie==="Map"||ie==="Set")return Array.from(le);if(ie==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ie))return W(le,ne)}function W(le,ne){(ne==null||ne>le.length)&&(ne=le.length);for(var ie=0,X=new Array(ne);ie<ne;ie++)X[ie]=le[ie];return X}function M(le,ne){var ie;if(typeof Symbol=="undefined"||le[Symbol.iterator]==null){if(Array.isArray(le)||(ie=D(le))||ne&&le&&typeof le.length=="number"){ie&&(le=ie);var X=0;return function(){return X>=le.length?{done:!0}:{done:!1,value:le[X++]}}}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 ie=le[Symbol.iterator](),ie.next.bind(ie)}function O(le,ne){return ne={exports:{}},le(ne,ne.exports),ne.exports}var F=O(function(le){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 ie(X){le.exports.defaults=X}le.exports={defaults:ne(),getDefaults:ne,changeDefaults:ie}}),I=F.defaults,R=F.getDefaults,_=F.changeDefaults,g=/[&<>"']/,T=/[&<>"']/g,A=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,S={"&":"&","<":"<",">":">",'"':""","'":"'"},y=function(ne){return S[ne]};function u(le,ne){if(ne){if(g.test(le))return le.replace(T,y)}else if(A.test(le))return le.replace(L,y);return le}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(le){return le.replace(o,function(ne,ie){return ie=ie.toLowerCase(),ie==="colon"?":":ie.charAt(0)==="#"?ie.charAt(1)==="x"?String.fromCharCode(parseInt(ie.substring(2),16)):String.fromCharCode(+ie.substring(1)):""})}var l=/(^|[^\[])\^/g;function w(le,ne){le=le.source||le,ne=ne||"";var ie={replace:function($,Q){return Q=Q.source||Q,Q=Q.replace(l,"$1"),le=le.replace($,Q),ie},getRegex:function(){return new RegExp(le,ne)}};return ie}var m=/[^\w:]/g,h=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function C(le,ne,ie){if(le){var X;try{X=decodeURIComponent(s(ie)).replace(m,"").toLowerCase()}catch($){return null}if(X.indexOf("javascript:")===0||X.indexOf("vbscript:")===0||X.indexOf("data:")===0)return null}ne&&!h.test(ie)&&(ie=a(ne,ie));try{ie=encodeURI(ie).replace(/%25/g,"%")}catch($){return null}return ie}var v={},c=/^[^:]+:\/*[^/]*$/,f=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(le,ne){v[" "+le]||(c.test(le)?v[" "+le]=le+"/":v[" "+le]=P(le,"/",!0)),le=v[" "+le];var ie=le.indexOf(":")===-1;return ne.substring(0,2)==="//"?ie?ne:le.replace(f,"$1")+ne:ne.charAt(0)==="/"?ie?ne:le.replace(d,"$1")+ne:le+ne}var b={exec:function(){}};function p(le){for(var ne=1,ie,X;ne<arguments.length;ne++){ie=arguments[ne];for(X in ie)Object.prototype.hasOwnProperty.call(ie,X)&&(le[X]=ie[X])}return le}function x(le,ne){var ie=le.replace(/\|/g,function(Q,te,se){for(var ve=!1,Se=te;--Se>=0&&se[Se]==="\\";)ve=!ve;return ve?"|":" |"}),X=ie.split(/ \|/),$=0;if(X.length>ne)X.splice(ne);else for(;X.length<ne;)X.push("");for(;$<X.length;$++)X[$]=X[$].trim().replace(/\\\|/g,"|");return X}function P(le,ne,ie){var X=le.length;if(X===0)return"";for(var $=0;$<X;){var Q=le.charAt(X-$-1);if(Q===ne&&!ie)$++;else if(Q!==ne&&ie)$++;else break}return le.substr(0,X-$)}function N(le,ne){if(le.indexOf(ne[1])===-1)return-1;for(var ie=le.length,X=0,$=0;$<ie;$++)if(le[$]==="\\")$++;else if(le[$]===ne[0])X++;else if(le[$]===ne[1]&&(X--,X<0))return $;return-1}function K(le){le&&le.sanitize&&!le.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var V={escape:u,unescape:s,edit:w,cleanUrl:C,resolveUrl:a,noopTest:b,merge:p,splitCells:x,rtrim:P,findClosingBracket:N,checkSanitizeDeprecation:K},B=F.defaults,U=V.rtrim,Y=V.splitCells,ee=V.escape,oe=V.findClosingBracket;function de(le,ne,ie){var X=ne.href,$=ne.title?ee(ne.title):null,Q=le[1].replace(/\\([\[\]])/g,"$1");return le[0].charAt(0)!=="!"?{type:"link",raw:ie,href:X,title:$,text:Q}:{type:"image",raw:ie,href:X,title:$,text:ee(Q)}}function Te(le,ne){var ie=le.match(/^(\s+)(?:```)/);if(ie===null)return ne;var X=ie[1];return ne.split(`
|
|
`).map(function($){var Q=$.match(/^\s+/);if(Q===null)return $;var te=Q[0];return te.length>=X.length?$.slice(X.length):$}).join(`
|
|
`)}var ge=function(){function le(ie){this.options=ie||B}var ne=le.prototype;return ne.space=function(X){var $=this.rules.block.newline.exec(X);if($)return $[0].length>1?{type:"space",raw:$[0]}:{raw:`
|
|
`}},ne.code=function(X,$){var Q=this.rules.block.code.exec(X);if(Q){var te=$[$.length-1];if(te&&te.type==="paragraph")return{raw:Q[0],text:Q[0].trimRight()};var se=Q[0].replace(/^ {4}/gm,"");return{type:"code",raw:Q[0],codeBlockStyle:"indented",text:this.options.pedantic?se:U(se,`
|
|
`)}}},ne.fences=function(X){var $=this.rules.block.fences.exec(X);if($){var Q=$[0],te=Te(Q,$[3]||"");return{type:"code",raw:Q,lang:$[2]?$[2].trim():$[2],text:te}}},ne.heading=function(X){var $=this.rules.block.heading.exec(X);if($)return{type:"heading",raw:$[0],depth:$[1].length,text:$[2]}},ne.nptable=function(X){var $=this.rules.block.nptable.exec(X);if($){var Q={type:"table",header:Y($[1].replace(/^ *| *\| *$/g,"")),align:$[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:$[3]?$[3].replace(/\n$/,"").split(`
|
|
`):[],raw:$[0]};if(Q.header.length===Q.align.length){var te=Q.align.length,se;for(se=0;se<te;se++)/^ *-+: *$/.test(Q.align[se])?Q.align[se]="right":/^ *:-+: *$/.test(Q.align[se])?Q.align[se]="center":/^ *:-+ *$/.test(Q.align[se])?Q.align[se]="left":Q.align[se]=null;for(te=Q.cells.length,se=0;se<te;se++)Q.cells[se]=Y(Q.cells[se],Q.header.length);return Q}}},ne.hr=function(X){var $=this.rules.block.hr.exec(X);if($)return{type:"hr",raw:$[0]}},ne.blockquote=function(X){var $=this.rules.block.blockquote.exec(X);if($){var Q=$[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:$[0],text:Q}}},ne.list=function(X){var $=this.rules.block.list.exec(X);if($){for(var Q=$[0],te=$[2],se=te.length>1,ve=te[te.length-1]===")",Se={type:"list",raw:Q,ordered:se,start:se?+te.slice(0,-1):"",loose:!1,items:[]},We=$[0].match(this.rules.block.item),rt=!1,tt,Tt,ct,ot,Ct,ft,gt,vt=We.length,at=0;at<vt;at++)tt=We[at],Q=tt,Tt=tt.length,tt=tt.replace(/^ *([*+-]|\d+[.)]) */,""),~tt.indexOf(`
|
|
`)&&(Tt-=tt.length,tt=this.options.pedantic?tt.replace(/^ {1,4}/gm,""):tt.replace(new RegExp("^ {1,"+Tt+"}","gm"),"")),at!==vt-1&&(ct=this.rules.block.bullet.exec(We[at+1])[0],(se?ct.length===1||!ve&&ct[ct.length-1]===")":ct.length>1||this.options.smartLists&&ct!==te)&&(ot=We.slice(at+1).join(`
|
|
`),Se.raw=Se.raw.substring(0,Se.raw.length-ot.length),at=vt-1)),Ct=rt||/\n\n(?!\s*$)/.test(tt),at!==vt-1&&(rt=tt.charAt(tt.length-1)===`
|
|
`,Ct||(Ct=rt)),Ct&&(Se.loose=!0),ft=/^\[[ xX]\] /.test(tt),gt=void 0,ft&&(gt=tt[1]!==" ",tt=tt.replace(/^\[[ xX]\] +/,"")),Se.items.push({type:"list_item",raw:Q,task:ft,checked:gt,loose:Ct,text:tt});return Se}},ne.html=function(X){var $=this.rules.block.html.exec(X);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]):ee($[0]):$[0]}},ne.def=function(X){var $=this.rules.block.def.exec(X);if($){$[3]&&($[3]=$[3].substring(1,$[3].length-1));var Q=$[1].toLowerCase().replace(/\s+/g," ");return{tag:Q,raw:$[0],href:$[2],title:$[3]}}},ne.table=function(X){var $=this.rules.block.table.exec(X);if($){var Q={type:"table",header:Y($[1].replace(/^ *| *\| *$/g,"")),align:$[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:$[3]?$[3].replace(/\n$/,"").split(`
|
|
`):[]};if(Q.header.length===Q.align.length){Q.raw=$[0];var te=Q.align.length,se;for(se=0;se<te;se++)/^ *-+: *$/.test(Q.align[se])?Q.align[se]="right":/^ *:-+: *$/.test(Q.align[se])?Q.align[se]="center":/^ *:-+ *$/.test(Q.align[se])?Q.align[se]="left":Q.align[se]=null;for(te=Q.cells.length,se=0;se<te;se++)Q.cells[se]=Y(Q.cells[se].replace(/^ *\| *| *\| *$/g,""),Q.header.length);return Q}}},ne.lheading=function(X){var $=this.rules.block.lheading.exec(X);if($)return{type:"heading",raw:$[0],depth:$[2].charAt(0)==="="?1:2,text:$[1]}},ne.paragraph=function(X){var $=this.rules.block.paragraph.exec(X);if($)return{type:"paragraph",raw:$[0],text:$[1].charAt($[1].length-1)===`
|
|
`?$[1].slice(0,-1):$[1]}},ne.text=function(X,$){var Q=this.rules.block.text.exec(X);if(Q){var te=$[$.length-1];return te&&te.type==="text"?{raw:Q[0],text:Q[0]}:{type:"text",raw:Q[0],text:Q[0]}}},ne.escape=function(X){var $=this.rules.inline.escape.exec(X);if($)return{type:"escape",raw:$[0],text:ee($[1])}},ne.tag=function(X,$,Q){var te=this.rules.inline.tag.exec(X);if(te)return!$&&/^<a /i.test(te[0])?$=!0:$&&/^<\/a>/i.test(te[0])&&($=!1),!Q&&/^<(pre|code|kbd|script)(\s|>)/i.test(te[0])?Q=!0:Q&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(te[0])&&(Q=!1),{type:this.options.sanitize?"text":"html",raw:te[0],inLink:$,inRawBlock:Q,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(te[0]):ee(te[0]):te[0]}},ne.link=function(X){var $=this.rules.inline.link.exec(X);if($){var Q=oe($[2],"()");if(Q>-1){var te=$[0].indexOf("!")===0?5:4,se=te+$[1].length+Q;$[2]=$[2].substring(0,Q),$[0]=$[0].substring(0,se).trim(),$[3]=""}var ve=$[2],Se="";if(this.options.pedantic){var We=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ve);We?(ve=We[1],Se=We[3]):Se=""}else Se=$[3]?$[3].slice(1,-1):"";ve=ve.trim().replace(/^<([\s\S]*)>$/,"$1");var rt=de($,{href:ve&&ve.replace(this.rules.inline._escapes,"$1"),title:Se&&Se.replace(this.rules.inline._escapes,"$1")},$[0]);return rt}},ne.reflink=function(X,$){var Q;if((Q=this.rules.inline.reflink.exec(X))||(Q=this.rules.inline.nolink.exec(X))){var te=(Q[2]||Q[1]).replace(/\s+/g," ");if(te=$[te.toLowerCase()],!te||!te.href){var se=Q[0].charAt(0);return{type:"text",raw:se,text:se}}var ve=de(Q,te,Q[0]);return ve}},ne.strong=function(X,$,Q){Q===void 0&&(Q="");var te=this.rules.inline.strong.start.exec(X);if(te&&(!te[1]||te[1]&&(Q===""||this.rules.inline.punctuation.exec(Q)))){$=$.slice(-1*X.length);var se=te[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;se.lastIndex=0;for(var ve;(te=se.exec($))!=null;)if(ve=this.rules.inline.strong.middle.exec($.slice(0,te.index+3)),ve)return{type:"strong",raw:X.slice(0,ve[0].length),text:X.slice(2,ve[0].length-2)}}},ne.em=function(X,$,Q){Q===void 0&&(Q="");var te=this.rules.inline.em.start.exec(X);if(te&&(!te[1]||te[1]&&(Q===""||this.rules.inline.punctuation.exec(Q)))){$=$.slice(-1*X.length);var se=te[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;se.lastIndex=0;for(var ve;(te=se.exec($))!=null;)if(ve=this.rules.inline.em.middle.exec($.slice(0,te.index+2)),ve)return{type:"em",raw:X.slice(0,ve[0].length),text:X.slice(1,ve[0].length-1)}}},ne.codespan=function(X){var $=this.rules.inline.code.exec(X);if($){var Q=$[2].replace(/\n/g," "),te=/[^ ]/.test(Q),se=Q.startsWith(" ")&&Q.endsWith(" ");return te&&se&&(Q=Q.substring(1,Q.length-1)),Q=ee(Q,!0),{type:"codespan",raw:$[0],text:Q}}},ne.br=function(X){var $=this.rules.inline.br.exec(X);if($)return{type:"br",raw:$[0]}},ne.del=function(X){var $=this.rules.inline.del.exec(X);if($)return{type:"del",raw:$[0],text:$[1]}},ne.autolink=function(X,$){var Q=this.rules.inline.autolink.exec(X);if(Q){var te,se;return Q[2]==="@"?(te=ee(this.options.mangle?$(Q[1]):Q[1]),se="mailto:"+te):(te=ee(Q[1]),se=te),{type:"link",raw:Q[0],text:te,href:se,tokens:[{type:"text",raw:te,text:te}]}}},ne.url=function(X,$){var Q;if(Q=this.rules.inline.url.exec(X)){var te,se;if(Q[2]==="@")te=ee(this.options.mangle?$(Q[0]):Q[0]),se="mailto:"+te;else{var ve;do ve=Q[0],Q[0]=this.rules.inline._backpedal.exec(Q[0])[0];while(ve!==Q[0]);te=ee(Q[0]),Q[1]==="www."?se="http://"+te:se=te}return{type:"link",raw:Q[0],text:te,href:se,tokens:[{type:"text",raw:te,text:te}]}}},ne.inlineText=function(X,$,Q){var te=this.rules.inline.text.exec(X);if(te){var se;return $?se=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(te[0]):ee(te[0]):te[0]:se=ee(this.options.smartypants?Q(te[0]):te[0]),{type:"text",raw:te[0],text:se}}},le}(),pe=V.noopTest,fe=V.edit,me=V.merge,ae={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:pe,table:pe,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ae._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ae._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ae.def=fe(ae.def).replace("label",ae._label).replace("title",ae._title).getRegex(),ae.bullet=/(?:[*+-]|\d{1,9}[.)])/,ae.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ae.item=fe(ae.item,"gm").replace(/bull/g,ae.bullet).getRegex(),ae.list=fe(ae.list).replace(/bull/g,ae.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ae.def.source+")").getRegex(),ae._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",ae._comment=/<!--(?!-?>)[\s\S]*?-->/,ae.html=fe(ae.html,"i").replace("comment",ae._comment).replace("tag",ae._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ae.paragraph=fe(ae._paragraph).replace("hr",ae.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",ae._tag).getRegex(),ae.blockquote=fe(ae.blockquote).replace("paragraph",ae.paragraph).getRegex(),ae.normal=me({},ae),ae.gfm=me({},ae.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*|$)"}),ae.gfm.nptable=fe(ae.gfm.nptable).replace("hr",ae.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",ae._tag).getRegex(),ae.gfm.table=fe(ae.gfm.table).replace("hr",ae.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",ae._tag).getRegex(),ae.pedantic=me({},ae.normal,{html:fe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ae._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:pe,paragraph:fe(ae.normal._paragraph).replace("hr",ae.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ae.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ue={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:pe,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:pe,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};ue._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ue.punctuation=fe(ue.punctuation).replace(/punctuation/g,ue._punctuation).getRegex(),ue._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ue._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ue.em.start=fe(ue.em.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.middle=fe(ue.em.middle).replace(/punctuation/g,ue._punctuation).replace(/overlapSkip/g,ue._overlapSkip).getRegex(),ue.em.endAst=fe(ue.em.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.endUnd=fe(ue.em.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.start=fe(ue.strong.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.middle=fe(ue.strong.middle).replace(/punctuation/g,ue._punctuation).replace(/blockSkip/g,ue._blockSkip).getRegex(),ue.strong.endAst=fe(ue.strong.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.endUnd=fe(ue.strong.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.blockSkip=fe(ue._blockSkip,"g").getRegex(),ue.overlapSkip=fe(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=fe(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=fe(ue.tag).replace("comment",ae._comment).replace("attribute",ue._attribute).getRegex(),ue._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ue._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ue._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ue.link=fe(ue.link).replace("label",ue._label).replace("href",ue._href).replace("title",ue._title).getRegex(),ue.reflink=fe(ue.reflink).replace("label",ue._label).getRegex(),ue.reflinkSearch=fe(ue.reflinkSearch,"g").replace("reflink",ue.reflink).replace("nolink",ue.nolink).getRegex(),ue.normal=me({},ue),ue.pedantic=me({},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:fe(/^!?\[(label)\]\((.*?)\)/).replace("label",ue._label).getRegex(),reflink:fe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ue._label).getRegex()}),ue.gfm=me({},ue.normal,{escape:fe(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=fe(ue.gfm.url,"i").replace("email",ue.gfm._extended_email).getRegex(),ue.breaks=me({},ue.gfm,{br:fe(ue.br).replace("{2,}","*").getRegex(),text:fe(ue.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Ee={block:ae,inline:ue},Ie=F.defaults,ke=Ee.block,Xe=Ee.inline;function Ne(le){return le.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 we(le){var ne="",ie,X,$=le.length;for(ie=0;ie<$;ie++)X=le.charCodeAt(ie),Math.random()>.5&&(X="x"+X.toString(16)),ne+="&#"+X+";";return ne}var Ce=function(){function le(ie){this.tokens=[],this.tokens.links=Object.create(null),this.options=ie||Ie,this.options.tokenizer=this.options.tokenizer||new ge,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var X={block:ke.normal,inline:Xe.normal};this.options.pedantic?(X.block=ke.pedantic,X.inline=Xe.pedantic):this.options.gfm&&(X.block=ke.gfm,this.options.breaks?X.inline=Xe.breaks:X.inline=Xe.gfm),this.tokenizer.rules=X}le.lex=function(X,$){var Q=new le($);return Q.lex(X)};var ne=le.prototype;return ne.lex=function(X){return X=X.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(X,this.tokens,!0),this.inline(this.tokens),this.tokens},ne.blockTokens=function(X,$,Q){$===void 0&&($=[]),Q===void 0&&(Q=!0),X=X.replace(/^ +$/gm,"");for(var te,se,ve,Se;X;){if(te=this.tokenizer.space(X)){X=X.substring(te.raw.length),te.type&&$.push(te);continue}if(te=this.tokenizer.code(X,$)){X=X.substring(te.raw.length),te.type?$.push(te):(Se=$[$.length-1],Se.raw+=`
|
|
`+te.raw,Se.text+=`
|
|
`+te.text);continue}if(te=this.tokenizer.fences(X)){X=X.substring(te.raw.length),$.push(te);continue}if(te=this.tokenizer.heading(X)){X=X.substring(te.raw.length),$.push(te);continue}if(te=this.tokenizer.nptable(X)){X=X.substring(te.raw.length),$.push(te);continue}if(te=this.tokenizer.hr(X)){X=X.substring(te.raw.length),$.push(te);continue}if(te=this.tokenizer.blockquote(X)){X=X.substring(te.raw.length),te.tokens=this.blockTokens(te.text,[],Q),$.push(te);continue}if(te=this.tokenizer.list(X)){for(X=X.substring(te.raw.length),ve=te.items.length,se=0;se<ve;se++)te.items[se].tokens=this.blockTokens(te.items[se].text,[],!1);$.push(te);continue}if(te=this.tokenizer.html(X)){X=X.substring(te.raw.length),$.push(te);continue}if(Q&&(te=this.tokenizer.def(X))){X=X.substring(te.raw.length),this.tokens.links[te.tag]||(this.tokens.links[te.tag]={href:te.href,title:te.title});continue}if(te=this.tokenizer.table(X)){X=X.substring(te.raw.length),$.push(te);continue}if(te=this.tokenizer.lheading(X)){X=X.substring(te.raw.length),$.push(te);continue}if(Q&&(te=this.tokenizer.paragraph(X))){X=X.substring(te.raw.length),$.push(te);continue}if(te=this.tokenizer.text(X,$)){X=X.substring(te.raw.length),te.type?$.push(te):(Se=$[$.length-1],Se.raw+=`
|
|
`+te.raw,Se.text+=`
|
|
`+te.text);continue}if(X){var We="Infinite loop on byte: "+X.charCodeAt(0);if(this.options.silent){console.error(We);break}else throw new Error(We)}}return $},ne.inline=function(X){var $,Q,te,se,ve,Se,We=X.length;for($=0;$<We;$++){Se=X[$];switch(Se.type){case"paragraph":case"text":case"heading":{Se.tokens=[],this.inlineTokens(Se.text,Se.tokens);break}case"table":{for(Se.tokens={header:[],cells:[]},se=Se.header.length,Q=0;Q<se;Q++)Se.tokens.header[Q]=[],this.inlineTokens(Se.header[Q],Se.tokens.header[Q]);for(se=Se.cells.length,Q=0;Q<se;Q++)for(ve=Se.cells[Q],Se.tokens.cells[Q]=[],te=0;te<ve.length;te++)Se.tokens.cells[Q][te]=[],this.inlineTokens(ve[te],Se.tokens.cells[Q][te]);break}case"blockquote":{this.inline(Se.tokens);break}case"list":{for(se=Se.items.length,Q=0;Q<se;Q++)this.inline(Se.items[Q].tokens);break}}}return X},ne.inlineTokens=function(X,$,Q,te,se){$===void 0&&($=[]),Q===void 0&&(Q=!1),te===void 0&&(te=!1),se===void 0&&(se="");var ve,Se=X,We;if(this.tokens.links){var rt=Object.keys(this.tokens.links);if(rt.length>0)for(;(We=this.tokenizer.rules.inline.reflinkSearch.exec(Se))!=null;)rt.includes(We[0].slice(We[0].lastIndexOf("[")+1,-1))&&(Se=Se.slice(0,We.index)+"["+"a".repeat(We[0].length-2)+"]"+Se.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(We=this.tokenizer.rules.inline.blockSkip.exec(Se))!=null;)Se=Se.slice(0,We.index)+"["+"a".repeat(We[0].length-2)+"]"+Se.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;X;){if(ve=this.tokenizer.escape(X)){X=X.substring(ve.raw.length),$.push(ve);continue}if(ve=this.tokenizer.tag(X,Q,te)){X=X.substring(ve.raw.length),Q=ve.inLink,te=ve.inRawBlock,$.push(ve);continue}if(ve=this.tokenizer.link(X)){X=X.substring(ve.raw.length),ve.type==="link"&&(ve.tokens=this.inlineTokens(ve.text,[],!0,te)),$.push(ve);continue}if(ve=this.tokenizer.reflink(X,this.tokens.links)){X=X.substring(ve.raw.length),ve.type==="link"&&(ve.tokens=this.inlineTokens(ve.text,[],!0,te)),$.push(ve);continue}if(ve=this.tokenizer.strong(X,Se,se)){X=X.substring(ve.raw.length),ve.tokens=this.inlineTokens(ve.text,[],Q,te),$.push(ve);continue}if(ve=this.tokenizer.em(X,Se,se)){X=X.substring(ve.raw.length),ve.tokens=this.inlineTokens(ve.text,[],Q,te),$.push(ve);continue}if(ve=this.tokenizer.codespan(X)){X=X.substring(ve.raw.length),$.push(ve);continue}if(ve=this.tokenizer.br(X)){X=X.substring(ve.raw.length),$.push(ve);continue}if(ve=this.tokenizer.del(X)){X=X.substring(ve.raw.length),ve.tokens=this.inlineTokens(ve.text,[],Q,te),$.push(ve);continue}if(ve=this.tokenizer.autolink(X,we)){X=X.substring(ve.raw.length),$.push(ve);continue}if(!Q&&(ve=this.tokenizer.url(X,we))){X=X.substring(ve.raw.length),$.push(ve);continue}if(ve=this.tokenizer.inlineText(X,te,Ne)){X=X.substring(ve.raw.length),se=ve.raw.slice(-1),$.push(ve);continue}if(X){var tt="Infinite loop on byte: "+X.charCodeAt(0);if(this.options.silent){console.error(tt);break}else throw new Error(tt)}}return $},G(le,null,[{key:"rules",get:function(){return{block:ke,inline:Xe}}}]),le}(),Re=F.defaults,Be=V.cleanUrl,je=V.escape,Ae=function(){function le(ie){this.options=ie||Re}var ne=le.prototype;return ne.code=function(X,$,Q){var te=($||"").match(/\S*/)[0];if(this.options.highlight){var se=this.options.highlight(X,te);se!=null&&se!==X&&(Q=!0,X=se)}return te?'<pre><code class="'+this.options.langPrefix+je(te,!0)+'">'+(Q?X:je(X,!0))+`</code></pre>
|
|
`:"<pre><code>"+(Q?X:je(X,!0))+`</code></pre>
|
|
`},ne.blockquote=function(X){return`<blockquote>
|
|
`+X+`</blockquote>
|
|
`},ne.html=function(X){return X},ne.heading=function(X,$,Q,te){return this.options.headerIds?"<h"+$+' id="'+this.options.headerPrefix+te.slug(Q)+'">'+X+"</h"+$+`>
|
|
`:"<h"+$+">"+X+"</h"+$+`>
|
|
`},ne.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ne.list=function(X,$,Q){var te=$?"ol":"ul",se=$&&Q!==1?' start="'+Q+'"':"";return"<"+te+se+`>
|
|
`+X+"</"+te+`>
|
|
`},ne.listitem=function(X){return"<li>"+X+`</li>
|
|
`},ne.checkbox=function(X){return"<input "+(X?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ne.paragraph=function(X){return"<p>"+X+`</p>
|
|
`},ne.table=function(X,$){return $&&($="<tbody>"+$+"</tbody>"),`<table>
|
|
<thead>
|
|
`+X+`</thead>
|
|
`+$+`</table>
|
|
`},ne.tablerow=function(X){return`<tr>
|
|
`+X+`</tr>
|
|
`},ne.tablecell=function(X,$){var Q=$.header?"th":"td",te=$.align?"<"+Q+' align="'+$.align+'">':"<"+Q+">";return te+X+"</"+Q+`>
|
|
`},ne.strong=function(X){return"<strong>"+X+"</strong>"},ne.em=function(X){return"<em>"+X+"</em>"},ne.codespan=function(X){return"<code>"+X+"</code>"},ne.br=function(){return this.options.xhtml?"<br/>":"<br>"},ne.del=function(X){return"<del>"+X+"</del>"},ne.link=function(X,$,Q){if(X=Be(this.options.sanitize,this.options.baseUrl,X),X===null)return Q;var te='<a href="'+je(X)+'"';return $&&(te+=' title="'+$+'"'),te+=">"+Q+"</a>",te},ne.image=function(X,$,Q){if(X=Be(this.options.sanitize,this.options.baseUrl,X),X===null)return Q;var te='<img src="'+X+'" alt="'+Q+'"';return $&&(te+=' title="'+$+'"'),te+=this.options.xhtml?"/>":">",te},ne.text=function(X){return X},le}(),Le=function(){function le(){}var ne=le.prototype;return ne.strong=function(X){return X},ne.em=function(X){return X},ne.codespan=function(X){return X},ne.del=function(X){return X},ne.html=function(X){return X},ne.text=function(X){return X},ne.link=function(X,$,Q){return""+Q},ne.image=function(X,$,Q){return""+Q},ne.br=function(){return""},le}(),Je=function(){function le(){this.seen={}}var ne=le.prototype;return ne.slug=function(X){var $=X.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty($)){var Q=$;do this.seen[Q]++,$=Q+"-"+this.seen[Q];while(this.seen.hasOwnProperty($))}return this.seen[$]=0,$},le}(),Ye=F.defaults,He=V.unescape,Ke=function(){function le(ie){this.options=ie||Ye,this.options.renderer=this.options.renderer||new Ae,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Le,this.slugger=new Je}le.parse=function(X,$){var Q=new le($);return Q.parse(X)};var ne=le.prototype;return ne.parse=function(X,$){$===void 0&&($=!0);var Q="",te,se,ve,Se,We,rt,tt,Tt,ct,ot,Ct,ft,gt,vt,at,Jt,It,Xt,tr=X.length;for(te=0;te<tr;te++){ot=X[te];switch(ot.type){case"space":continue;case"hr":{Q+=this.renderer.hr();continue}case"heading":{Q+=this.renderer.heading(this.parseInline(ot.tokens),ot.depth,He(this.parseInline(ot.tokens,this.textRenderer)),this.slugger);continue}case"code":{Q+=this.renderer.code(ot.text,ot.lang,ot.escaped);continue}case"table":{for(Tt="",tt="",Se=ot.header.length,se=0;se<Se;se++)tt+=this.renderer.tablecell(this.parseInline(ot.tokens.header[se]),{header:!0,align:ot.align[se]});for(Tt+=this.renderer.tablerow(tt),ct="",Se=ot.cells.length,se=0;se<Se;se++){for(rt=ot.tokens.cells[se],tt="",We=rt.length,ve=0;ve<We;ve++)tt+=this.renderer.tablecell(this.parseInline(rt[ve]),{header:!1,align:ot.align[ve]});ct+=this.renderer.tablerow(tt)}Q+=this.renderer.table(Tt,ct);continue}case"blockquote":{ct=this.parse(ot.tokens),Q+=this.renderer.blockquote(ct);continue}case"list":{for(Ct=ot.ordered,ft=ot.start,gt=ot.loose,Se=ot.items.length,ct="",se=0;se<Se;se++)at=ot.items[se],Jt=at.checked,It=at.task,vt="",at.task&&(Xt=this.renderer.checkbox(Jt),gt?at.tokens.length>0&&at.tokens[0].type==="text"?(at.tokens[0].text=Xt+" "+at.tokens[0].text,at.tokens[0].tokens&&at.tokens[0].tokens.length>0&&at.tokens[0].tokens[0].type==="text"&&(at.tokens[0].tokens[0].text=Xt+" "+at.tokens[0].tokens[0].text)):at.tokens.unshift({type:"text",text:Xt}):vt+=Xt),vt+=this.parse(at.tokens,gt),ct+=this.renderer.listitem(vt,It,Jt);Q+=this.renderer.list(ct,Ct,ft);continue}case"html":{Q+=this.renderer.html(ot.text);continue}case"paragraph":{Q+=this.renderer.paragraph(this.parseInline(ot.tokens));continue}case"text":{for(ct=ot.tokens?this.parseInline(ot.tokens):ot.text;te+1<tr&&X[te+1].type==="text";)ot=X[++te],ct+=`
|
|
`+(ot.tokens?this.parseInline(ot.tokens):ot.text);Q+=$?this.renderer.paragraph(ct):ct;continue}default:{var hr='Token with "'+ot.type+'" type was not found.';if(this.options.silent){console.error(hr);return}else throw new Error(hr)}}}return Q},ne.parseInline=function(X,$){$=$||this.renderer;var Q="",te,se,ve=X.length;for(te=0;te<ve;te++){se=X[te];switch(se.type){case"escape":{Q+=$.text(se.text);break}case"html":{Q+=$.html(se.text);break}case"link":{Q+=$.link(se.href,se.title,this.parseInline(se.tokens,$));break}case"image":{Q+=$.image(se.href,se.title,se.text);break}case"strong":{Q+=$.strong(this.parseInline(se.tokens,$));break}case"em":{Q+=$.em(this.parseInline(se.tokens,$));break}case"codespan":{Q+=$.codespan(se.text);break}case"br":{Q+=$.br();break}case"del":{Q+=$.del(this.parseInline(se.tokens,$));break}case"text":{Q+=$.text(se.text);break}default:{var Se='Token with "'+se.type+'" type was not found.';if(this.options.silent){console.error(Se);return}else throw new Error(Se)}}}return Q},le}(),et=V.merge,Ve=V.checkSanitizeDeprecation,Ge=V.escape,ye=F.getDefaults,Ze=F.changeDefaults,ze=F.defaults;function be(le,ne,ie){if(typeof le=="undefined"||le===null)throw new Error("marked(): input parameter is undefined or null");if(typeof le!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(le)+", string expected");if(typeof ne=="function"&&(ie=ne,ne=null),ne=et({},be.defaults,ne||{}),Ve(ne),ie){var X=ne.highlight,$;try{$=Ce.lex(le,ne)}catch(ve){return ie(ve)}var Q=function(Se){var We;if(!Se)try{We=Ke.parse($,ne)}catch(rt){Se=rt}return ne.highlight=X,Se?ie(Se):ie(null,We)};if(!X||X.length<3)return Q();if(delete ne.highlight,!$.length)return Q();var te=0;be.walkTokens($,function(ve){ve.type==="code"&&(te++,setTimeout(function(){X(ve.text,ve.lang,function(Se,We){if(Se)return Q(Se);We!=null&&We!==ve.text&&(ve.text=We,ve.escaped=!0),te--,te===0&&Q()})},0))}),te===0&&Q();return}try{var se=Ce.lex(le,ne);return ne.walkTokens&&be.walkTokens(se,ne.walkTokens),Ke.parse(se,ne)}catch(ve){if(ve.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ne.silent)return"<p>An error occurred:</p><pre>"+Ge(ve.message+"",!0)+"</pre>";throw ve}}be.options=be.setOptions=function(le){return et(be.defaults,le),Ze(be.defaults),be},be.getDefaults=ye,be.defaults=ze,be.use=function(le){var ne=et({},le);if(le.renderer&&function(){var X=be.defaults.renderer||new Ae,$=function(se){var ve=X[se];X[se]=function(){for(var Se=arguments.length,We=new Array(Se),rt=0;rt<Se;rt++)We[rt]=arguments[rt];var tt=le.renderer[se].apply(X,We);return tt===!1&&(tt=ve.apply(X,We)),tt}};for(var Q in le.renderer)$(Q);ne.renderer=X}(),le.tokenizer&&function(){var X=be.defaults.tokenizer||new ge,$=function(se){var ve=X[se];X[se]=function(){for(var Se=arguments.length,We=new Array(Se),rt=0;rt<Se;rt++)We[rt]=arguments[rt];var tt=le.tokenizer[se].apply(X,We);return tt===!1&&(tt=ve.apply(X,We)),tt}};for(var Q in le.tokenizer)$(Q);ne.tokenizer=X}(),le.walkTokens){var ie=be.defaults.walkTokens;ne.walkTokens=function(X){le.walkTokens(X),ie&&ie(X)}}be.setOptions(ne)},be.walkTokens=function(le,ne){for(var ie=M(le),X;!(X=ie()).done;){var $=X.value;ne($);switch($.type){case"table":{for(var Q=M($.tokens.header),te;!(te=Q()).done;){var se=te.value;be.walkTokens(se,ne)}for(var ve=M($.tokens.cells),Se;!(Se=ve()).done;)for(var We=Se.value,rt=M(We),tt;!(tt=rt()).done;){var Tt=tt.value;be.walkTokens(Tt,ne)}break}case"list":{be.walkTokens($.items,ne);break}default:$.tokens&&be.walkTokens($.tokens,ne)}}},be.Parser=Ke,be.parser=Ke.parse,be.Renderer=Ae,be.TextRenderer=Le,be.Lexer=Ce,be.lexer=Ce.lex,be.Tokenizer=ge,be.Slugger=Je,be.parse=be;var _e=be;return _e})},ELLl:function(dt,Qe,J){(function(Z){Z(J("VrN/"))})(function(Z){var G={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=Z.Pos;Z.defineOption("autoCloseBrackets",!1,function(S,y,u){u&&u!=Z.Init&&(S.removeKeyMap(M),S.state.closeBrackets=null),y&&(O(W(y,"pairs")),S.state.closeBrackets=y,S.addKeyMap(M))});function W(S,y){return y=="pairs"&&typeof S=="string"?S:typeof S=="object"&&S[y]!=null?S[y]:G[y]}var M={Backspace:R,Enter:_};function O(S){for(var y=0;y<S.length;y++){var u=S.charAt(y),o="'"+u+"'";M[o]||(M[o]=F(u))}}O(G.pairs+"`");function F(S){return function(y){return T(y,S)}}function I(S){var y=S.state.closeBrackets;if(!y||y.override)return y;var u=S.getModeAt(S.getCursor());return u.closeBrackets||y}function R(S){var y=I(S);if(!y||S.getOption("disableInput"))return Z.Pass;for(var u=W(y,"pairs"),o=S.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return Z.Pass;var l=A(S,o[s].head);if(!l||u.indexOf(l)%2!=0)return Z.Pass}for(var s=o.length-1;s>=0;s--){var w=o[s].head;S.replaceRange("",D(w.line,w.ch-1),D(w.line,w.ch+1),"+delete")}}function _(S){var y=I(S),u=y&&W(y,"explode");if(!u||S.getOption("disableInput"))return Z.Pass;for(var o=S.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return Z.Pass;var l=A(S,o[s].head);if(!l||u.indexOf(l)%2!=0)return Z.Pass}S.operation(function(){var w=S.lineSeparator()||`
|
|
`;S.replaceSelection(w+w,null),S.execCommand("goCharLeft"),o=S.listSelections();for(var m=0;m<o.length;m++){var h=o[m].head.line;S.indentLine(h,null,!0),S.indentLine(h+1,null,!0)}})}function g(S){var y=Z.cmpPos(S.anchor,S.head)>0;return{anchor:new D(S.anchor.line,S.anchor.ch+(y?-1:1)),head:new D(S.head.line,S.head.ch+(y?1:-1))}}function T(S,y){var u=I(S);if(!u||S.getOption("disableInput"))return Z.Pass;var o=W(u,"pairs"),s=o.indexOf(y);if(s==-1)return Z.Pass;for(var l=W(u,"closeBefore"),w=W(u,"triples"),m=o.charAt(s+1)==y,h=S.listSelections(),C=s%2==0,v,c=0;c<h.length;c++){var f=h[c],d=f.head,a,b=S.getRange(d,D(d.line,d.ch+1));if(C&&!f.empty())a="surround";else if((m||!C)&&b==y)m&&L(S,d)?a="both":w.indexOf(y)>=0&&S.getRange(d,D(d.line,d.ch+3))==y+y+y?a="skipThree":a="skip";else if(m&&d.ch>1&&w.indexOf(y)>=0&&S.getRange(D(d.line,d.ch-2),d)==y+y){if(d.ch>2&&/\bstring/.test(S.getTokenTypeAt(D(d.line,d.ch-2))))return Z.Pass;a="addFour"}else if(m){var p=d.ch==0?" ":S.getRange(D(d.line,d.ch-1),d);if(!Z.isWordChar(b)&&p!=y&&!Z.isWordChar(p))a="both";else return Z.Pass}else if(C&&(b.length===0||/\s/.test(b)||l.indexOf(b)>-1))a="both";else return Z.Pass;if(!v)v=a;else if(v!=a)return Z.Pass}var x=s%2?o.charAt(s-1):y,P=s%2?y:o.charAt(s+1);S.operation(function(){if(v=="skip")S.execCommand("goCharRight");else if(v=="skipThree")for(var N=0;N<3;N++)S.execCommand("goCharRight");else if(v=="surround"){for(var K=S.getSelections(),N=0;N<K.length;N++)K[N]=x+K[N]+P;S.replaceSelections(K,"around"),K=S.listSelections().slice();for(var N=0;N<K.length;N++)K[N]=g(K[N]);S.setSelections(K)}else v=="both"?(S.replaceSelection(x+P,null),S.triggerElectric(x+P),S.execCommand("goCharLeft")):v=="addFour"&&(S.replaceSelection(x+x+x+x,"before"),S.execCommand("goCharRight"))})}function A(S,y){var u=S.getRange(D(y.line,y.ch-1),D(y.line,y.ch+1));return u.length==2?u:null}function L(S,y){var u=S.getTokenAt(D(y.line,y.ch+1));return/\bstring/.test(u.type)&&u.start==y.ch&&(y.ch==0||!/\bstring/.test(S.getTokenTypeAt(y)))}})},F8wB:function(dt,Qe,J){dt.exports={loading:"loading___1SIOG"}},Gytx:function(dt,Qe){dt.exports=function(Z,G,D,W){var M=D?D.call(W,Z,G):void 0;if(M!==void 0)return!!M;if(Z===G)return!0;if(typeof Z!="object"||!Z||typeof G!="object"||!G)return!1;var O=Object.keys(Z),F=Object.keys(G);if(O.length!==F.length)return!1;for(var I=Object.prototype.hasOwnProperty.bind(G),R=0;R<O.length;R++){var _=O[R];if(!I(_))return!1;var g=Z[_],T=G[_];if(M=D?D.call(W,g,T,_):void 0,M===!1||M===void 0&&g!==T)return!1}return!0}},HV1I:function(dt,Qe,J){dt.exports={flex_box_center:"flex_box_center___1nEOe",flex_space_between:"flex_space_between___21gJ7",flex_box_vertical_center:"flex_box_vertical_center___2iHIq",flex_box_center_end:"flex_box_center_end___19LSZ",flex_box_column:"flex_box_column___2zG50",bg:"bg___u_uqy",formWrap:"formWrap___3rl8w"}},HmJG:function(dt,Qe,J){},LdHM:function(dt,Qe,J){"use strict";J.d(Qe,"b",function(){return l}),J.d(Qe,"a",function(){return m});var Z=J("1OyB"),G=J("vuIU"),D=J("Ji7U"),W=J("LK+K"),M=J("cDcd"),O=J("rePB"),F=J("Ff2n"),I=J("ODXe"),R=J("4IlW"),_=J("bX4T"),g=J("YrtM"),T=J("TSYQ"),A=J.n(T),L=J("+nKL"),S=J("8OUc"),y=function(Y,ee){var oe=Y.prefixCls,de=Y.id,Te=Y.flattenOptions,ge=Y.childrenAsData,pe=Y.values,fe=Y.searchValue,me=Y.multiple,ae=Y.defaultActiveFirstOption,ue=Y.height,Ee=Y.itemHeight,Ie=Y.notFoundContent,ke=Y.open,Xe=Y.menuItemSelectedIcon,Ne=Y.virtual,we=Y.onSelect,Ce=Y.onToggleOpen,Re=Y.onActiveValue,Be=Y.onScroll,je=Y.onMouseEnter,Ae="".concat(oe,"-item"),Le=Object(g.a)(function(){return Te},[ke,Te],function(_e,le){return le[0]&&_e[1]!==le[1]}),Je=M.useRef(null),Ye=function(le){le.preventDefault()},He=function(le){Je.current&&Je.current.scrollTo({index:le})},Ke=function(le){for(var ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ie=Le.length,X=0;X<ie;X+=1){var $=(le+X*ne+ie)%ie,Q=Le[$],te=Q.group,se=Q.data;if(!te&&!se.disabled)return $}return-1},et=M.useState(function(){return Ke(0)}),Ve=Object(I.a)(et,2),Ge=Ve[0],ye=Ve[1],Ze=function(le){ye(le);var ne=Le[le];if(!ne){Re(null,-1);return}Re(ne.data.value,le)};M.useEffect(function(){Ze(ae!==!1?Ke(0):-1)},[Le.length,fe]),M.useEffect(function(){var _e=setTimeout(function(){if(!me&&ke&&pe.size===1){var le=Array.from(pe)[0],ne=Le.findIndex(function(ie){var X=ie.data;return X.value===le});Ze(ne),He(ne)}});return function(){return clearTimeout(_e)}},[ke]);var ze=function(le){le!==void 0&&we(le,{selected:!pe.has(le)}),me||Ce(!1)};if(M.useImperativeHandle(ee,function(){return{onKeyDown:function(le){var ne=le.which;switch(ne){case R.a.UP:case R.a.DOWN:{var ie=0;if(ne===R.a.UP?ie=-1:ne===R.a.DOWN&&(ie=1),ie!==0){var X=Ke(Ge+ie,ie);He(X),Ze(X)}break}case R.a.ENTER:{var $=Le[Ge];$&&!$.data.disabled?ze($.data.value):ze(void 0),ke&&le.preventDefault();break}case R.a.ESC:Ce(!1)}},onKeyUp:function(){},scrollTo:function(le){He(le)}}}),Le.length===0)return M.createElement("div",{role:"listbox",id:"".concat(de,"_list"),className:"".concat(Ae,"-empty"),onMouseDown:Ye},Ie);function be(_e){var le=Le[_e];if(!le)return null;var ne=le.data||{},ie=ne.value,X=ne.label,$=ne.children,Q=Object(_.a)(ne,!0),te=ge?$:X;return le?M.createElement("div",Object.assign({"aria-label":typeof te=="string"?te:null},Q,{key:_e,role:"option",id:"".concat(de,"_list_").concat(_e),"aria-selected":pe.has(ie)}),ie):null}return M.createElement(M.Fragment,null,M.createElement("div",{role:"listbox",id:"".concat(de,"_list"),style:{height:0,width:0,overflow:"hidden"}},be(Ge-1),be(Ge),be(Ge+1)),M.createElement(L.a,{itemKey:"key",ref:Je,data:Le,height:ue,itemHeight:Ee,fullHeight:!1,onMouseDown:Ye,onScroll:Be,virtual:Ne,onMouseEnter:je},function(_e,le){var ne,ie=_e.group,X=_e.groupOption,$=_e.data,Q=$.label,te=$.key;if(ie)return M.createElement("div",{className:A()(Ae,"".concat(Ae,"-group"))},Q!==void 0?Q:te);var se=$.disabled,ve=$.value,Se=$.title,We=$.children,rt=$.style,tt=$.className,Tt=Object(F.a)($,["disabled","value","title","children","style","className"]),ct=pe.has(ve),ot="".concat(Ae,"-option"),Ct=A()(Ae,ot,tt,(ne={},Object(O.a)(ne,"".concat(ot,"-grouped"),X),Object(O.a)(ne,"".concat(ot,"-active"),Ge===le&&!se),Object(O.a)(ne,"".concat(ot,"-disabled"),se),Object(O.a)(ne,"".concat(ot,"-selected"),ct),ne)),ft=ge?We:Q,gt=!Xe||typeof Xe=="function"||ct;return M.createElement("div",Object.assign({},Tt,{"aria-selected":ct,className:Ct,title:Se,onMouseMove:function(){if(Ge===le||se)return;Ze(le)},onClick:function(){se||ze(ve)},style:rt}),M.createElement("div",{className:"".concat(ot,"-content")},ft||ve),M.isValidElement(Xe)||ct,gt&&M.createElement(S.a,{className:"".concat(Ae,"-option-state"),customizeIcon:Xe,customizeIconProps:{isSelected:ct}},ct?"\u2713":null))}))},u=M.forwardRef(y);u.displayName="OptionList";var o=u,s=function(){return null};s.isSelectOption=!0;var l=s,w=function(){return null};w.isSelectOptGroup=!0;var m=w,h=J("VTBJ"),C=J("Zm9Q");function v(U){var Y=U.key,ee=U.props,oe=ee.children,de=ee.value,Te=Object(F.a)(ee,["children","value"]);return Object(h.a)({key:Y,value:de!==void 0?de:Y,children:oe},Te)}function c(U){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(C.a)(U).map(function(ee,oe){if(!M.isValidElement(ee)||!ee.type)return null;var de=ee.type.isSelectOptGroup,Te=ee.key,ge=ee.props,pe=ge.children,fe=Object(F.a)(ge,["children"]);return Y||!de?v(ee):Object(h.a)(Object(h.a)({key:"__RC_SELECT_GRP__".concat(Te===null?oe:Te,"__"),label:Te},fe),{},{options:c(pe)})}).filter(function(ee){return ee})}var f=J("2Qr1"),d=J("qNPg"),a=J("U8pU"),b=J("Kwbf"),p=J("WKfj");function x(U){var Y=U.mode,ee=U.options,oe=U.children,de=U.backfill,Te=U.allowClear,ge=U.placeholder,pe=U.getInputElement,fe=U.showSearch,me=U.onSearch,ae=U.defaultOpen,ue=U.autoFocus,Ee=U.labelInValue,Ie=U.value,ke=U.inputValue,Xe=U.optionLabelProp,Ne=Y==="multiple"||Y==="tags",we=fe!==void 0?fe:Ne||Y==="combobox",Ce=ee||c(oe);if(Object(b.a)(Y!=="tags"||Ce.every(function(Ae){return!Ae.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),Y==="tags"||Y==="combobox"){var Re=Ce.some(function(Ae){return Ae.options?Ae.options.some(function(Le){return typeof("value"in Le?Le.value:Le.key)=="number"}):typeof("value"in Ae?Ae.value:Ae.key)=="number"});Object(b.a)(!Re,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(b.a)(Y!=="combobox"||!Xe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(b.a)(Y==="combobox"||!de,"`backfill` only works with `combobox` mode."),Object(b.a)(Y==="combobox"||!pe,"`getInputElement` only work with `combobox` mode."),Object(b.b)(Y!=="combobox"||!pe||!Te||!ge,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),me&&!we&&Y!=="combobox"&&Y!=="tags"&&Object(b.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(b.b)(!ae||ue,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Ie!=null){var Be=Object(p.d)(Ie);Object(b.a)(!Ee||Be.every(function(Ae){return Object(a.a)(Ae)==="object"&&("key"in Ae||"value"in Ae)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(b.a)(!Ne||Array.isArray(Ie),"`value` should be array when `mode` is `multiple` or `tags`")}if(oe){var je=null;Object(C.a)(oe).some(function(Ae){if(!M.isValidElement(Ae)||!Ae.type)return!1;var Le=Ae.type;if(Le.isSelectOption)return!1;if(Le.isSelectOptGroup){var Je=Object(C.a)(Ae.props.children).every(function(Ye){return!M.isValidElement(Ye)||!Ae.type||Ye.type.isSelectOption?!0:(je=Ye.type,!1)});return!Je}return je=Le,!0}),je&&Object(b.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(je.displayName||je.name||je,"`.")),Object(b.a)(ke===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var P=x,N=Object(d.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:c,flattenOptions:f.d,getLabeledValue:f.e,filterOptions:f.b,isValueDisabled:f.g,findValueOption:f.c,warningProps:P,fillOptionsWithMissingValue:f.a}),K=function(U){Object(D.a)(ee,U);var Y=Object(W.a)(ee);function ee(){var oe;return Object(Z.a)(this,ee),oe=Y.apply(this,arguments),oe.selectRef=M.createRef(),oe.focus=function(){oe.selectRef.current.focus()},oe.blur=function(){oe.selectRef.current.blur()},oe}return Object(G.a)(ee,[{key:"render",value:function(){return M.createElement(N,Object.assign({ref:this.selectRef},this.props))}}]),ee}(M.Component);K.Option=l,K.OptGroup=m;var V=K,B=Qe.c=V},Ly88:function(dt,Qe,J){"use strict";J.r(Qe);var Z=J("14J3"),G=J("BMrR"),D=J("jCWc"),W=J("kPKH"),M=J("OaEy"),O=J("2fM7"),F=J("7Kak"),I=J("9yH6"),R=J("5NDa"),_=J("5rEg"),g=J("2qtc"),T=J("kLXV"),A=J("miYZ"),L=J("tsqr"),S=J("9og8"),y=J("k1fw"),u=J("y8nQ"),o=J("Vl3Y"),s=J("tJVT"),l=J("PpiC"),w=J("WmNS"),m=J.n(w),h=J("cDcd"),C=J.n(h),v=J("9kvl"),c=J("Ot1p"),f=J("HBuW"),d=J("HV1I"),a=J.n(d),b=J("LvDl"),p=J.n(b),x=J("9ZNV"),P=J("nuEh"),N=J("fnXi"),K=J("UqFu"),V=J("2RCv"),B={1:[100,200],2:[300,400,500,600],3:[700,800,900,1e3]},U=function(ee){var oe,de,Te,ge=ee.shixunsDetail,pe=ee.dispatch,fe=ee.match,me=ee.practiceSetting,ae=Object(l.a)(ee,["shixunsDetail","dispatch","match","practiceSetting"]),ue=o.a.useForm(),Ee=Object(s.a)(ue,1),Ie=Ee[0],ke=Object(h.useState)({}),Xe=Object(s.a)(ke,2),Ne=Xe[0],we=Xe[1],Ce=Object(h.useState)([100,200]),Re=Object(s.a)(Ce,2),Be=Re[0],je=Re[1],Ae=ge.challengesNew,Le=Object(h.useState)(),Je=Object(s.a)(Le,2),Ye=Je[0],He=Je[1],Ke=Object(h.useState)(),et=Object(s.a)(Ke,2),Ve=et[0],Ge=et[1],ye=Object(h.useState)(!0),Ze=Object(s.a)(ye,2),ze=Ze[0],be=Ze[1],_e=Object(h.useState)(1),le=Object(s.a)(_e,2),ne=le[0],ie=le[1],X=Object(h.useRef)({subject:"",difficulty:1,score:100,task_pass:Object(K.a)(Ae.task_pass_default)}),$=Object(h.useRef)(null),Q=me.selectQuestionParams,te=me.id,se=me.newQuestion;Object(h.useEffect)(function(){fe.params.challengesId?(Ge(!0),ve()):(be(!0),Ge(!1),pe({type:"shixunsDetail/getChallengesNew",payload:Object(y.a)({},fe.params)}),be(!1)),setTimeout(function(){document.getElementById("practice-scroll").scrollTo(0,0)},300)},[fe.params]),Object(h.useEffect)(function(){return ct(),function(){clearTimeout($.current)}},[Ne]);var ve=function(){var ft=Object(S.a)(m.a.mark(function gt(){var vt,at;return m.a.wrap(function(It){for(;;)switch(It.prev=It.next){case 0:return be(!0),It.next=3,Object(f.H)({id:fe.params.id,challengeId:fe.params.challengesId,tab:0});case 3:vt=It.sent,vt&&(at=Object(y.a)(Object(y.a)({},vt),{},{task_pass:Object(K.a)(vt.task_pass)}),He(at),Se(at),be(!1),X.current={subject:at.subject,difficulty:at.difficulty,score:at.score,task_pass:at.task_pass});case 5:case"end":return It.stop()}},gt)}));return function(){return ft.apply(this,arguments)}}(),Se=function(gt){var vt={subject:gt.name,difficulty:gt.difficulty,score:gt.score,challenge_tag:gt.tags,task_pass:gt.task_pass},at=B[gt.difficulty];je(at),Ie.setFieldsValue(Object(y.a)({},vt)),we(Object(y.a)({},vt))},We=function(gt){var vt=B[gt],at=vt==null?void 0:vt[0];je(vt),Ie.setFieldsValue({score:at}),we(Object(y.a)(Object(y.a)({},Ie.getFieldsValue()),{score:at}))},rt=function(gt,vt){we(Object(y.a)({},Ie.getFieldsValue())),"difficulty"in gt&&We(gt.difficulty)},tt=function(){var ft=Object(S.a)(m.a.mark(function gt(){var vt,at,Jt,It,Xt,tr=arguments;return m.a.wrap(function(rr){for(;;)switch(rr.prev=rr.next){case 0:if(at=tr.length>0&&tr[0]!==void 0?tr[0]:{},!(!Ve&&((vt=ge.detail)===null||vt===void 0?void 0:vt.shixun_status)===2)){rr.next=4;break}return L.b.info("\u8BE5\u5B9E\u8BAD\u5DF2\u7ECF\u53D1\u5E03\u4E0D\u80FD\u65B0\u5EFA"),rr.abrupt("return");case 4:if(!Ve){rr.next=10;break}return rr.next=7,Object(f.Mb)(Object(y.a)(Object(y.a)({},fe.params),{},{tab:0,challenge:Object(y.a)({},at),challenge_tag:at.challenge_tag}));case 7:return Jt=rr.sent,Jt&&(pe({type:"practiceSetting/setUpdateIndex"}),v.d.replace("/shixuns/".concat(fe.params.id,"/edit/").concat(fe.params.challengesId,"/tab=2"))),rr.abrupt("return");case 10:return It=Object(y.a)({},Ne),It.identifier=fe.params.id,It.st=0,rr.next=15,Object(f.b)(Object(y.a)({},It));case 15:Xt=rr.sent,Xt.status===1&&(v.d.replace("/shixuns/".concat(fe.params.id,"/edit/").concat(Xt.challenge_id,"/tab=2")),setTimeout(function(){pe({type:"practiceSetting/setParams",payload:{newQuestion:null}}),pe({type:"practiceSetting/setUpdateIndex"})},200));case 17:case"end":return rr.stop()}},gt)}));return function(){return ft.apply(this,arguments)}}(),Tt=function(){Ct()},ct=function(){clearTimeout($.current),$.current=setTimeout(ot,500)},ot=function(){"subject"in Ne&&se&&pe({type:"practiceSetting/setParams",payload:{newQuestion:{st:0,name:Ne==null?void 0:Ne.subject}}});var gt=["subject","difficulty","score","task_pass"],vt=gt.some(function(at){var Jt=Object(b.isNumber)(Ne[at])?String(Ne[at]):Ne[at],It=Object(b.isNumber)(X.current[at])?String(X.current[at]):X.current[at];return!Object(b.isEqual)(Jt,It)});pe(vt?{type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!0}}:{type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1}})},Ct=function(){var gt,vt=function(){v.d.push("/shixuns/".concat(te,"/challenges")),pe({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1}})};me!=null&&(gt=me.sideBar)!==null&>!==void 0&>.confirmLeave?T.a.confirm({title:"\u79BB\u5F00\u6B64\u9875\u63D0\u793A",content:"\u7CFB\u7EDF\u53EF\u80FD\u4E0D\u4F1A\u4FDD\u5B58\u60A8\u6240\u505A\u7684\u66F4\u6539\u3002",okText:"\u79BB\u5F00",cancelText:"\u53D6\u6D88",onOk:function(){vt()}}):vt()};return C.a.createElement(C.a.Fragment,null,C.a.createElement("section",{key:1,className:a.a.bg,id:"practice-scroll"},C.a.createElement(o.a,{key:ne,form:Ie,className:a.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:rt,onFinish:tt},C.a.createElement(N.a,{activeIndex:0,isEdit:Ve}),C.a.createElement(o.a.Item,{initialValue:"",name:"subject",label:"\u4EFB\u52A1\u540D\u79F0:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EFB\u52A1\u540D\u79F0"}]},C.a.createElement(_.a,{bordered:!1,maxLength:60,suffix:"".concat(((oe=Ne.subject)===null||oe===void 0?void 0:oe.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"})),C.a.createElement(o.a.Item,{name:"task_pass",label:"\u4EFB\u52A1\u8981\u6C42:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u7684\u7B80\u4ECB"},{max:35e3,message:"\u8FC7\u5173\u4EFB\u52A1\u7B80\u4ECB\u6700\u5927\u9650\u523635000\u4E2A\u5B57\u7B26"}]},C.a.createElement(c.a,{key:fe.params.challengesId||"3",watch:!0,defaultValue:Ve?Ye==null?void 0:Ye.task_pass:Ae.task_pass_default})),C.a.createElement(o.a.Item,{initialValue:1,name:"difficulty",label:"\u96BE\u5EA6\u7CFB\u6570:",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u96BE\u5EA6\u7CFB\u6570"}]},C.a.createElement(I.a.Group,{disabled:((de=ge.detail)===null||de===void 0?void 0:de.shixun_status)===2},C.a.createElement(I.a,{value:1},"\u7B80\u5355"),C.a.createElement(I.a,{style:{marginLeft:70},value:2},"\u4E2D\u7B49"),C.a.createElement(I.a,{style:{marginLeft:70},value:3},"\u56F0\u96BE"))),C.a.createElement(o.a.Item,{name:"challenge_tag",label:C.a.createElement("div",null,"\u6280\u80FD\u6807\u7B7E ",C.a.createElement("span",{className:"pl20 font12 c-light-black"},"\u5B66\u5458\u7B54\u9898\u6B63\u786E\u5C06\u83B7\u5F97\u6280\u80FD\uFF0C\u5426\u5219\u4E0D\u80FD\u83B7\u5F97\u6280\u80FD\uFF08\u56DE\u8F66\u6DFB\u52A0\u6807\u7B7E\uFF09")),rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6280\u80FD\u6807\u7B7E"}]},C.a.createElement(V.a,{placeholder:"\u6DFB\u52A0\u6807\u7B7E",style:{width:"260px"},InputRight:C.a.createElement("span",{className:"ml5"},"(\u56DE\u8F66\u6DFB\u52A0\u6807\u7B7E)")})),C.a.createElement(G.a,{className:"customItemSelect"},C.a.createElement(W.a,null,C.a.createElement(o.a.Item,{name:"score",initialValue:100,label:"\u5956\u52B1\u91D1\u5E01:",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u5956\u52B1\u7ECF\u9A8C\u503C"}]},C.a.createElement(O.a,{disabled:((Te=ge.detail)===null||Te===void 0?void 0:Te.shixun_status)===2,bordered:!1,style:{width:260}},Be==null?void 0:Be.map(function(ft,gt){return C.a.createElement(O.a.Option,{key:gt,value:ft},ft)})))),C.a.createElement(W.a,{flex:1},C.a.createElement("div",{style:{marginTop:88},className:"font12 c-light-black ml10"}," \u5B66\u5458\u6B63\u786E\u7B54\u9898\u65F6\u83B7\u5F97\u91D1\u5E01\uFF0C\u5E76\u4E14\u83B7\u5F97\u7B49\u91CF\u7684\u7ECF\u9A8C\u503C\u3002\u5982\uFF1A+100\u91D1\u5E01\u3001+100\u7ECF\u9A8C\u503C"))))),C.a.createElement(x.a,{key:2,onOk:function(){return Ie.submit()},className:"customFixedButton",onCancel:Tt}),C.a.createElement(P.a,{loading:ze}))};Qe.default=Object(v.a)(function(Y){var ee=Y.shixunsDetail,oe=Y.newCourse,de=Y.globalSetting,Te=Y.practiceSetting;return{shixunsDetail:ee,newCourse:oe,globalSetting:de,practiceSetting:Te}})(U)},M8RZ:function(dt,Qe,J){"use strict";J.d(Qe,"a",function(){return R});var Z=J("fWQN"),G=J("mtLc"),D=J("yKVA"),W=J("879j"),M=J("cDcd"),O=J.n(M),F=J("faye"),I=J.n(F),R=function(_){Object(D.a)(T,_);var g=Object(W.a)(T);function T(A){var L;Object(Z.a)(this,T),L=g.call(this,A);var S=window.document;return L.node=S.createElement("div"),S.body.appendChild(L.node),L}return Object(G.a)(T,[{key:"render",value:function(){var L=this.props.children;return Object(F.createPortal)(L,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),T}(O.a.Component)},OLES:function(dt,Qe,J){"use strict";var Z=J("U8pU"),G=J("VTBJ"),D=J("Ff2n"),W=J("cDcd"),M=J("uciX"),O=J("7ixt"),F=function(A){var L=A.overlay,S=A.prefixCls,y=A.id,u=A.overlayInnerStyle;return W.createElement("div",{className:"".concat(S,"-inner"),id:y,role:"tooltip",style:u},typeof L=="function"?L():L)},I=F,R=function(A,L){var S=A.overlayClassName,y=A.trigger,u=y===void 0?["hover"]:y,o=A.mouseEnterDelay,s=o===void 0?0:o,l=A.mouseLeaveDelay,w=l===void 0?.1:l,m=A.overlayStyle,h=A.prefixCls,C=h===void 0?"rc-tooltip":h,v=A.children,c=A.onVisibleChange,f=A.afterVisibleChange,d=A.transitionName,a=A.animation,b=A.placement,p=b===void 0?"right":b,x=A.align,P=x===void 0?{}:x,N=A.destroyTooltipOnHide,K=N===void 0?!1:N,V=A.defaultVisible,B=A.getTooltipContainer,U=A.overlayInnerStyle,Y=Object(D.a)(A,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),ee=Object(W.useRef)(null);Object(W.useImperativeHandle)(L,function(){return ee.current});var oe=Object(G.a)({},Y);"visible"in A&&(oe.popupVisible=A.visible);var de=function(){var me=A.arrowContent,ae=me===void 0?null:me,ue=A.overlay,Ee=A.id;return[W.createElement("div",{className:"".concat(C,"-arrow"),key:"arrow"},ae),W.createElement(I,{key:"content",prefixCls:C,id:Ee,overlay:ue,overlayInnerStyle:U})]},Te=!1,ge=!1;if(typeof K=="boolean")Te=K;else if(K&&Object(Z.a)(K)==="object"){var pe=K.keepParent;Te=pe===!0,ge=pe===!1}return W.createElement(M.a,Object.assign({popupClassName:S,prefixCls:C,popup:de,action:u,builtinPlacements:O.a,popupPlacement:p,ref:ee,popupAlign:P,getPopupContainer:B,onPopupVisibleChange:c,afterPopupVisibleChange:f,popupTransitionName:d,popupAnimation:a,defaultPopupVisible:V,destroyPopupOnHide:Te,autoDestroy:ge,mouseLeaveDelay:w,popupStyle:m,mouseEnterDelay:s},oe),v)},_=Object(W.forwardRef)(R),g=Qe.a=_},Ot1p:function(dt,Qe,J){"use strict";var Z=J("2qtc"),G=J("kLXV"),D=J("rAM+"),W=J("miYZ"),M=J("tsqr"),O=J("9og8"),F=J("tJVT"),I=J("jrin"),R=J("WmNS"),_=J.n(R),g=J("cDcd"),T=J.n(g),A=J("VrN/"),L=J.n(A),S=J("bdgK"),y=J("p77/"),u=J("Bd2K"),o=J("ELLl"),s=J("19Vz"),l=J("lZu9"),w=J("+NIl"),m=J("kSUc"),h=J("9Bee"),C=function(se){var ve=se.value,Se=ve===void 0?"":ve,We=se.className,rt=se.showTextOnly,tt=se.showLines,Tt=se.style,ct=Tt===void 0?{}:Tt,ot=Object(g.useMemo)(function(){return""},[Se]);return T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{dangerouslySetInnerHTML:{__html:ot}}))},v=J("0Owb"),c=J("dejd"),f=J("C+DQ"),d=J("1vsH"),a=J("m3rI"),b=[{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 p(se){var ve=se.onActionCallback,Se=se.title,We=se.icon,rt=se.actionName,tt=se.className,Tt=tt===void 0?"":tt,ct=se.children;function ot(){ve(rt)}return T.a.createElement("a",{title:Se,className:Tt,onClick:ot},T.a.createElement("i",{className:"md-iconfont ".concat(We)}),ct)}var x=function(se){var ve=se.watch,Se=se.showNullButton,We=se.onActionCallback,rt=se.fullScreen,tt=se.insertTemp,Tt=se.hidetoolBar,ct=se.uuid,ot=se.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(d.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(d.G)("_educoder_session"),"&key=").concat(ct,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Ct=[].concat(b,[{title:"".concat(ve?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ve?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return T.a.createElement("ul",{className:"markdown-toolbar-container"},!Tt&&Ct.map(function(ft,gt){return T.a.createElement("li",{key:gt},ft.actionName?T.a.createElement(p,Object(v.a)({},ft,{onActionCallback:We})):T.a.createElement("span",{className:"v-line"}))}),Se?T.a.createElement("li",null,T.a.createElement(p,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:We},T.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,tt&&T.a.createElement("li",null,T.a.createElement(p,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(tt),onActionCallback:We},T.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),T.a.createElement("li",{className:"btn-full-screen"},T.a.createElement(p,{icon:"".concat(rt?"icon-shrink":"icon-enlarge"),title:rt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:We})))},P=J("M8RZ"),N=J("+L6B"),K=J("2/Rp"),V=J("y8nQ"),B=J("Vl3Y"),U=J("5NDa"),Y=J("5rEg"),ee={labelCol:{span:4},wrapperCol:{span:20}},oe=function(se){var ve=se.callback,Se=se.onCancel;function We(rt){ve(rt)}return T.a.createElement(B.a,Object(v.a)({},ee,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:We}),T.a.createElement(B.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},T.a.createElement(Y.a,null)),T.a.createElement(B.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},T.a.createElement(Y.a,null)),T.a.createElement("div",{className:"flex-container flex-end"},T.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(K.a,{type:"ghost",onClick:Se},"\u53D6\u6D88")))},de=J("7ahc"),Te=J("HmJG"),ge=J("BjJ7"),pe=B.a.useForm,fe={width:280,marginRight:10},me={labelCol:{span:5},wrapperCol:{span:19}},ae=function(se){var ve=se.callback,Se=se.onCancel,We=pe(),rt=Object(F.a)(We,1),tt=rt[0];function Tt(Ct){ve(Ct)}function ct(Ct,ft){if(Ct.status===-1){M.b.error(Ct.message);return}tt.setFieldsValue({src:"/api/attachments/".concat(Ct.id),type:ft.type})}function ot(Ct){var ft=Ct.target.files[0];Ee(ft,ct)}return T.a.createElement(B.a,Object(v.a)({form:tt},me,{className:"upload-image-panel",onFinish:Tt}),T.a.createElement(B.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},T.a.createElement("div",{className:"flex-container"},T.a.createElement(B.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},T.a.createElement(Y.a,{style:fe})),T.a.createElement(ue,{onFileChange:ot}))),T.a.createElement(B.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},T.a.createElement(Y.a,{style:{width:264}})),T.a.createElement(B.a.Item,{style:{textAlign:"right"}},T.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(K.a,{type:"ghost",onClick:Se},"\u53D6\u6D88")))};function ue(se){var ve=se.onFileChange;return T.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",T.a.createElement("input",{type:"file",onChange:ve}))}function Ee(se,ve){if(!se)throw new String("\u6CA1\u6709\u6587\u4EF6");var Se=new FormData;Se.append("editormd-image-file",se),Se.append("file_param_name","editormd-image-file"),Se.append("byxhr","true");var We=new window.XMLHttpRequest;We.withCredentials=!0,We.addEventListener("load",function(rt){ve(JSON.parse(rt.target.responseText),se)},!1),We.addEventListener("error",function(rt){console.error(rt)},!1),We.open("POST","".concat(ge.a,"/api/attachments.json")),We.send(Se)}var Ie=J("giR+"),ke=J("fyUT"),Xe=J("7Kak"),Ne=J("9yH6"),we=Ne.a.Group,Ce={margin:"0 8px"},Re=function(se){var ve=se.callback,Se=se.onCancel;function We(rt){ve(rt)}return T.a.createElement(B.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:We},T.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},T.a.createElement("span",{style:Ce},"\u5355\u5143\u683C\u6570\uFF1A"),T.a.createElement("span",{style:Ce},"\u884C\u6570"),T.a.createElement(B.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},T.a.createElement(ke.a,null)),T.a.createElement("span",{style:Ce},"\u5217\u6570"),T.a.createElement(B.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},T.a.createElement(ke.a,null))),T.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},T.a.createElement("span",{style:Ce},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),T.a.createElement(B.a.Item,{name:"align"},T.a.createElement(we,null,T.a.createElement(Ne.a,{value:"default"},T.a.createElement("i",{className:"fa fa-align-justify"})),T.a.createElement(Ne.a,{value:"left"},T.a.createElement("i",{className:"fa fa-align-left"})),T.a.createElement(Ne.a,{value:"center"},T.a.createElement("i",{className:"fa fa-align-center"})),T.a.createElement(Ne.a,{value:"right"},T.a.createElement("i",{className:"fa fa-align-right"}))))),T.a.createElement("div",{className:"flex-container flex-end"},T.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(K.a,{type:"ghost",onClick:Se},"\u53D6\u6D88")))},Be=J("ErOA"),je=J("7Cbv"),Ae="link",Le="upload-image",Je="code-block",Ye="add-table",He="------------",Ke={default:He,left:":".concat(He),center:":".concat(He,":"),right:"".concat(He,":")},et=J("9VGf"),Ve,Ge;function ye(){}var Ze=0,ze=1e4,be="\u2581",_e=`
|
|
**\u6A21\u677F\u6807\u9898**
|
|
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function le(se){return/^\d+$/.test(se)?"".concat(se,"px"):se}var ne=navigator.platform.toUpperCase().indexOf("MAC")>=0,ie=ne?"Cmd":"Ctrl",X=["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"],$=(Ve={},Object(I.a)(Ve,ie+"-B","bold"),Object(I.a)(Ve,ie+"-I","italic"),Ve),Q=(Ge={},Object(I.a)(Ge,Ae,"\u6DFB\u52A0\u94FE\u63A5"),Object(I.a)(Ge,Je,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(I.a)(Ge,Le,"\u6DFB\u52A0\u6587\u4EF6"),Object(I.a)(Ge,Ye,"\u6DFB\u52A0\u8868\u683C"),Ge),te=Qe.a=function(se){var ve=se.defaultValue,Se=ve===void 0?"":ve,We=se.onChange,rt=se.width,tt=rt===void 0?"100%":rt,Tt=se.height,ct=Tt===void 0?400:Tt,ot=se.miniToolbar,Ct=ot===void 0?!1:ot,ft=se.isFocus,gt=ft===void 0?!1:ft,vt=se.watch,at=se.insertTemp,Jt=se.mode,It=Jt===void 0?"markdown":Jt,Xt=se.id,tr=Xt===void 0?"markdown-editor-id":Xt,hr=se.showResizeBar,rr=hr===void 0?!1:hr,Ar=se.noStorage,Hn=Ar===void 0?!1:Ar,Gn=se.showNullButton,Mt=Gn===void 0?!1:Gn,nt=se.hidetoolBar,Mr=nt===void 0?!1:nt,pn=se.fullScreen,nr=pn===void 0?!1:pn,wt=se.onBlur,br=se.onCMBeforeChange,kr=se.onFullScreen,gn=se.className,Oe=gn===void 0?"":gn,ht=se.disablePaste,zn=ht===void 0?!1:ht,vn=se.placeholder,yn=vn===void 0?"":vn,Zr=se.values,bn=Zr===void 0?"":Zr,pt=Object(g.useState)(null),Di=Object(F.a)(pt,2),Pe=Di[0],En=Di[1],vr=Object(g.useState)(Se),Vn=Object(F.a)(vr,2),qr=Vn[0],Er=Vn[1],Xn=Object(g.useState)(vt),Yn=Object(F.a)(Xn,2),xr=Yn[0],$n=Yn[1],Ai=Object(g.useState)(nr),Qn=Object(F.a)(Ai,2),Tr=Qn[0],_i=Qn[1],aa=Object(g.useState)(""),Jn=Object(F.a)(aa,2),Zt=Jn[0],Kr=Jn[1],oa=Object(g.useState)(0),en=Object(F.a)(oa,2),Sr=en[0],Zn=en[1],sa=Object(g.useState)(ct),Oi=Object(F.a)(sa,2),Ri=Oi[0],xn=Oi[1],Pi=Object(g.useState)(!1),Mi=Object(F.a)(Pi,2),la=Mi[0],Tn=Mi[1],tn=Object(g.useRef)(Object(je.a)()),rn=Object(g.useRef)(!1),Sn=Object(g.useRef)(),Ir=Object(g.useRef)(),Ur=Object(g.useRef)(),Fr=Object(g.useRef)(),wn=Object(g.useRef)(),ki=function(){var it=Object(O.a)(_.a.mark(function mt(){var lt,bt;return _.a.wrap(function(_t){for(;;)switch(_t.prev=_t.next){case 0:return _t.next=2,Object(Be.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:tn.current}});case 2:bt=_t.sent,bt!=null&&(lt=bt.attachments)!==null&<!==void 0&<.length&&(console.log("cm:",Pe,Ir),bt.attachments.map(function(xt){xt.content_type.indexOf("image")>-1?Pe.replaceSelection(".concat(xt.content_type,")")):xt.content_type.indexOf("video")>-1?Pe.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):xt.content_type.indexOf("pdf")>-1?Pe.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(xt.id,"?type=").concat(xt.content_type,'&disposition=inline" target="_blank">').concat(xt.name,"</a>")):Pe.replaceSelection("[".concat(xt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(xt.id,"?type=").concat(xt.content_type,")"))}));case 4:case"end":return _t.stop()}},mt)}));return function(){return it.apply(this,arguments)}}();Object(g.useEffect)(function(){Er(bn),Pe==null||Pe.setValue(bn)},[bn]),Object(g.useEffect)(function(){kr==null||kr(Tr)},[Tr]),Object(g.useEffect)(function(){if(Ir.current){var it=L.a.fromTextArea(Ir.current,{mode:It,lineNumbers:!Ct,lineWrapping:!0,value:Se,autoCloseTags:!0,autoCloseBrackets:!0});gt&&it.focus();function mt(lt,bt){if(zn){bt.preventDefault();return}var St=bt.clipboardData;if(St){var _t=St.types.toString(),xt=St.items;if(_t==="Files"||St.types.indexOf("Files")>-1){if(bt.preventDefault(),It=="stex")return;try{var Bt,ir=xt[1];((Bt=xt[0])===null||Bt===void 0?void 0:Bt.kind)==="file"&&(ir=xt[0]);var Et=ir.getAsFile(),Nr=Et.name.split(".").pop();Ee(Et,function(Lt){if(Lt.id){var ar,Yt,yr;(Et==null||((ar=Et.type)===null||ar===void 0)?void 0:ar.indexOf("image"))>-1?it.replaceSelection(".concat(Lt.content_type,")")):(Et==null||((Yt=Et.type)===null||Yt===void 0)?void 0:Yt.indexOf("video"))>-1?it.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Lt.id,'"></video>')):(Et==null||((yr=Et.type)===null||yr===void 0)?void 0:yr.indexOf("pdf"))>-1?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Lt.id,"?type=").concat(Et.type,'&disposition=inline" target="_blank">').concat(Et.name,"</a>")):X.includes(Nr)?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Lt.id,'?type=office&disposition=inline" target="_blank">').concat(Et.name,"</a>")):it.replaceSelection("[".concat(Et.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Lt.id,"?type=").concat(Lt.content_type,")"))}else(Lt==null?void 0:Lt.status)===401&&(document.location.href="/user/login")})}catch(Lt){M.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return it.on("paste",mt),it.on("dragleave",function(lt,bt){Ur.current.classList.remove("mouse-hover-md")}),it.on("dragover",function(lt,bt){Ur.current.classList.add("mouse-hover-md")}),it.on("drop",function(lt,bt){Ur.current.classList.add("mouse-hover-md");var St;if(St=bt.dataTransfer.files,St.length>0){bt.preventDefault(),bt.stopPropagation();for(var _t=function(ir){var Et=St[ir],Nr=Et.name.split(".").pop();Ee(Et,function(Lt){if(Lt.id){var ar,Yt,yr;(Et==null||((ar=Et.type)===null||ar===void 0)?void 0:ar.indexOf("image"))>-1?it.replaceSelection(".concat(Lt.content_type,")")):(Et==null||((Yt=Et.type)===null||Yt===void 0)?void 0:Yt.indexOf("video"))>-1?it.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Lt.id,'"></video>')):(Et==null||((yr=Et.type)===null||yr===void 0)?void 0:yr.indexOf("pdf"))>-1?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Lt.id,"?type=").concat(Et.type,'&disposition=inline" target="_blank">').concat(Et.name,"</a>")):X.includes(Nr)?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Lt.id,'?type=office&disposition=inline" target="_blank">').concat(Et.name,"</a>")):it.replaceSelection("[".concat(Et.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Lt.id,"?type=").concat(Lt.content_type,")"))}else(Lt==null?void 0:Lt.status)===401&&(document.location.href="/user/login")})},xt=0;xt<St.length;xt++)_t(xt)}}),En(it),function(){it.off("paste",mt)}}},[]);var mr=Object(g.useCallback)(function(){if(Ur.current)try{}catch(it){console.log(it,"---- to set md editor body height")}},[Ri,Ur,Tr]);Object(g.useEffect)(function(){function it(){var lt=new S.default(function(bt){var St=Object(D.a)(bt),_t;try{for(St.s();!(_t=St.n()).done;){var xt=_t.value;(xt.target.offsetHeight>0||xt.target.offsetWidth>0)&&(mr(),Pe.setSize("100%","100%"),Pe.refresh())}}catch(Bt){St.e(Bt)}finally{St.f()}});return lt.observe(Ir.current.parentElement),lt}if(Pe){var mt=it();return function(){mt.unobserve(Ir.current.parentElement)}}},[Pe,mr]),Object(g.useEffect)(function(){if(Pe){for(var it=[],mt=function(){var xt=bt[lt];St=Object(F.a)(xt,2);var Bt=St[0],ir=St[1],Et=Object(I.a)({},Bt,function(){Ii(ir)});it.push(Et),Pe.addKeyMap(Et)},lt=0,bt=Object.entries($);lt<bt.length;lt++){var St;mt()}return Sn.current=setInterval(function(){rn.current&&ki()},4e3),function(){clearInterval(Sn.current);var _t=Object(D.a)(it),xt;try{for(_t.s();!(xt=_t.n()).done;){var Bt=xt.value;Pe.removeKeyMap(Bt)}}catch(ir){_t.e(ir)}finally{_t.f()}}}},[Pe]),Object(g.useEffect)(function(){nr!==Tr&&_i(nr)},[nr]),Object(et.a)(function(){if(!Hn&&Sr>0){var it=new Date().getTime(),mt=window.sessionStorage.getItem(tr);it>=Sr+ze&&(!mt||mt!==qr)&&(window.sessionStorage.setItem(tr,qr),Tn(!0))}},ze),Object(g.useEffect)(function(){$n(vt)},[Pe,vt]),Object(g.useEffect)(function(){Pe&&(gt&&Pe.focus())},[Pe,gt]),Object(g.useEffect)(function(){if(xr&&Pe){var it=Pe.getScrollerElement();function mt(lt){var bt=lt.target;if(wn.current){var St=bt.scrollTop/bt.scrollHeight;wn.current.scrollTop=wn.current.scrollHeight*St}}return it.addEventListener("scroll",mt),function(){it.removeEventListener("scroll",mt)}}},[Pe,xr]),Object(g.useEffect)(function(){if(Pe&&br){function it(mt,lt){br(mt,lt)}return Pe.on("beforeChange",it),function(){Pe.off("beforeChange",it)}}},[Pe,br]),Object(g.useEffect)(function(){if(Pe&&wt){function it(){wt(Pe.getValue())}return Pe.on("blur",it),function(){Pe.off("blur",it)}}},[Pe,wt]),Object(g.useEffect)(function(){if(Pe){function it(mt){var lt=mt.getValue();Er(lt),Zn(new Date().getTime()),mt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),We&&We(lt)}return Pe.on("change",it),function(){Pe.off("change",it)}}},[Pe,We]),Object(g.useEffect)(function(){Pe&&(Se==null?(Pe.setValue(""),Er("")):Se!==Pe.getValue()&&(Pe.setValue(Se),Er(Se),Pe.setCursor(Pe.lineCount(),0)))},[Pe,Se]);var Ii=Object(g.useCallback)(function(it){var mt=Pe.getCursor(),lt=Pe.getSelection(),bt=lt.split(`
|
|
`);switch(it){case"bold":return Pe.replaceSelection("**"+lt+"**"),lt===""&&Pe.setCursor(mt.line,mt.ch+2),Pe.focus();case"italic":return Pe.replaceSelection("*"+lt+"*"),lt===""&&Pe.setCursor(mt.line,mt.ch+1),Pe.focus();case"code":return Pe.replaceSelection("`"+lt+"`"),lt===""&&Pe.setCursor(mt.line,mt.ch+1),Pe.focus();case"inline-latex":return Pe.replaceSelection("`$$"+lt+"$$`"),lt===""&&Pe.setCursor(mt.line,mt.ch+3),Pe.focus();case"latex":return Pe.replaceSelection("```latex\n"+lt+"\n```"),Pe.setCursor(mt.line+1,lt.length+1),Pe.focus();case"line-break":return Pe.replaceSelection(`<br/>
|
|
`),Pe.focus();case"list-ul":return lt===""?Pe.replaceSelection("- "+lt):Pe.replaceSelection(bt.map(function(St){return St===""?"":"- ".concat(St)}).join(`
|
|
`)),Pe.focus();case"list-ol":return lt===""?Pe.replaceSelection("1. "+lt):Pe.replaceSelection(bt.map(function(St,_t){return St===""?"":"".concat(_t+1,". ").concat(St)}).join(`
|
|
`)),Pe.focus();case"add-null-ch":return lt===""&&Pe.setCursor(mt.line,mt.ch+1),Pe.replaceSelection(be),Pe.focus();case"inster-template-1":return lt===""&&Pe.setCursor(mt.line,mt.ch),Pe.replaceSelection(_e),Pe.focus();case"eraser":return Pe.setValue(""),Pe.focus();case"trigger-watch":return $n(!xr),Pe.focus();case"trigger-full-screen":return _i(!Tr),Pe.focus();case Ae:Kr(Ae);return;case Je:Kr(Je);return;case Le:Kr(Le);return;case Ye:Kr(Ye);return;default:throw new Error}},[Pe,xr,Tr]),Cn=Object(g.useCallback)(function(it){Kr("");switch(Zt){case Ae:var mt=it.title,lt=it.link;return Pe.replaceSelection("[".concat(mt,"](").concat(lt,")")),Pe.focus();case Je:var bt=it.language,St=it.content;return Pe.replaceSelection(["```"+bt,St,"```"].join(`
|
|
`)),Pe.focus();case Le:var _t=it.src,xt=it.alt;return xt?Pe.replaceSelection(".concat(_t,' "').concat(xt,'" )')):Pe.replaceSelection("")),Pe.focus();case Ye:for(var Bt=it.row,ir=it.col,Et=it.align,Nr=`
|
|
`,Lt=0;Lt<Bt;Lt++){for(var ar=[],Yt=[],yr=0;yr<ir;yr++)Lt===1&&Yt.push(Ke[Et]),ar.push(" ");Lt===1&&(Nr+="| ".concat(Yt.join(" | "),` |
|
|
`)),Nr+="| ".concat(ar.join(ir===1?"":" | "),` |
|
|
`)}return Pe.replaceSelection(Nr+`
|
|
`),Pe.focus();default:throw new Error}},[Pe,Zt]),qn=Object(g.useMemo)(function(){switch(Zt){case Ae:return T.a.createElement(oe,{callback:Cn,onCancel:Hr});case Je:return T.a.createElement(de.b,{callback:Cn,onCancel:Hr});case Le:return T.a.createElement(ae,{callback:Cn,onCancel:Hr});case Ye:return T.a.createElement(Re,{callback:Cn,onCancel:Hr});default:return null}},[Zt]);function Hr(){Kr("")}Object(g.useEffect)(function(){if(Fr.current){var it=Fr.current,mt=!1,lt=0;function bt(xt){mt=!0,lt=xt.pageY}function St(){mt=!1}function _t(xt){if(mt){var Bt=xt.pageY-lt;Bt<0&&(Bt=0),Bt>300&&(Bt=300);var ir=ct+Bt+"px";xn(ir)}}return it.addEventListener("mousedown",bt),document.addEventListener("mousemove",_t),document.addEventListener("mouseup",St),function(){it.removeEventListener("mousedown",bt),document.removeEventListener("mousemove",_t),document.removeEventListener("mouseup",St)}}},[Pe,Fr]),Object(g.useEffect)(function(){xn(ct)},[ct]);var _r=le(tt),ei=le(Ri),wr={width:_r,height:ei},ti=Object(g.useMemo)(function(){if(Sr){var it=new Date(Sr),mt=it.getHours(),lt=it.getMinutes(),bt=it.getSeconds();return mt=mt<10?"0"+mt:mt,lt=lt<10?"0"+lt:lt,bt=bt<10?"0"+bt:bt,"".concat(mt,":").concat(lt,":").concat(bt)}return 0},[Sr]);function Ui(){window.sessionStorage.removeItem(tr),Tn(!1),Zn(0)}function nn(){Tn(!1),Zn(0),Pe.setValue(window.sessionStorage.getItem(tr))}function ua(it,mt){var lt=Pe.getValue();lt=lt.replace(it,mt),Er(lt),Pe==null||Pe.setValue(lt)}return T.a.createElement(g.Fragment,null,T.a.createElement("div",{className:"markdown-editor-wrapper",ref:Ur},T.a.createElement("div",{className:"markdown-editor-container ".concat(Oe," ").concat(xr?"on-preview":""," ").concat(Ct?"mini":""," ").concat(Tr?"full-screen":""),style:wr},T.a.createElement(x,{insertTemp:at,watch:xr,fullScreen:Tr,showNullButton:Mt,onActionCallback:Ii,hidetoolBar:Mr,uuid:tn.current,setOpenPhones:function(){rn.current=!0}}),T.a.createElement("div",{className:"markdown-editor-body"},T.a.createElement("div",{className:"codemirror-container"},T.a.createElement("textarea",{ref:Ir,placeholder:yn})),xr?T.a.createElement("div",{ref:wn,className:"preview-container"},It==="stex"&&T.a.createElement(C,{value:qr}),It!=="stex"&&T.a.createElement(h.a,{edit:!0,value:qr,replaces:ua})):null))),rr?T.a.createElement("a",{ref:Fr,className:"editor-resize"}):null,T.a.createElement(P.a,null,Q[Zt]?T.a.createElement(G.a,{centered:!0,title:Q[Zt],visible:!0,onCancel:Hr,footer:null,className:"markdown-popup-form"},qn):null))}},SJMd:function(dt,Qe){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var J,Z,G,D=!1,W,M;window.PR_SHOULD_USE_CONTINUATION=!0;var O,F;(function(){var I=window,R=["break,continue,do,else,for,if,return,while"],_=[R,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],g=[_,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],T=[g,"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"],A=[g,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],L=[g,"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"],S="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",y=[g,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],u="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[R,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],s=[R,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],l=[R,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[T,L,A,y,u,o,s,l],m=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,h="str",C="kwd",v="com",c="typ",f="lit",d="pun",a="pln",b="tag",p="dec",x="src",P="atn",N="atv",K="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function B(we){for(var Ce=0,Re=!1,Be=!1,je=0,Ae=we.length;je<Ae;++je){var Le=we[je];if(Le.ignoreCase)Be=!0;else if(/[a-z]/i.test(Le.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Re=!0,Be=!1;break}}var Je={b:8,t:9,n:10,v:11,f:12,r:13};function Ye(Ge){var ye=Ge.charCodeAt(0);if(ye!==92)return ye;var Ze=Ge.charAt(1);return ye=Je[Ze],ye||("0"<=Ze&&Ze<="7"?parseInt(Ge.substring(1),8):Ze==="u"||Ze==="x"?parseInt(Ge.substring(2),16):Ge.charCodeAt(1))}function He(Ge){if(Ge<32)return(Ge<16?"\\x0":"\\x")+Ge.toString(16);var ye=String.fromCharCode(Ge);return ye==="\\"||ye==="-"||ye==="]"||ye==="^"?"\\"+ye:ye}function Ke(Ge){var ye=Ge.substring(1,Ge.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")),Ze=[],ze=ye[0]==="^",be=["["];ze&&be.push("^");for(var _e=ze?1:0,le=ye.length;_e<le;++_e){var ne=ye[_e];if(/\\[bdsw]/i.test(ne))be.push(ne);else{var ie=Ye(ne),X;_e+2<le&&ye[_e+1]==="-"?(X=Ye(ye[_e+2]),_e+=2):X=ie,Ze.push([ie,X]),X<65||ie>122||(X<65||ie>90||Ze.push([Math.max(65,ie)|32,Math.min(X,90)|32]),X<97||ie>122||Ze.push([Math.max(97,ie)&~32,Math.min(X,122)&~32]))}}Ze.sort(function(se,ve){return se[0]-ve[0]||ve[1]-se[1]});for(var $=[],Q=[],_e=0;_e<Ze.length;++_e){var te=Ze[_e];te[0]<=Q[1]+1?Q[1]=Math.max(Q[1],te[1]):$.push(Q=te)}for(var _e=0;_e<$.length;++_e){var te=$[_e];be.push(He(te[0])),te[1]>te[0]&&(te[1]+1>te[0]&&be.push("-"),be.push(He(te[1])))}return be.push("]"),be.join("")}function et(Ge){for(var ye=Ge.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")),Ze=ye.length,ze=[],be=0,_e=0;be<Ze;++be){var le=ye[be];if(le==="(")++_e;else if(le.charAt(0)==="\\"){var ne=+le.substring(1);ne&&(ne<=_e?ze[ne]=-1:ye[be]=He(ne))}}for(var be=1;be<ze.length;++be)ze[be]===-1&&(ze[be]=++Ce);for(var be=0,_e=0;be<Ze;++be){var le=ye[be];if(le==="(")++_e,ze[_e]||(ye[be]="(?:");else if(le.charAt(0)==="\\"){var ne=+le.substring(1);ne&&ne<=_e&&(ye[be]="\\"+ze[ne])}}for(var be=0;be<Ze;++be)ye[be]==="^"&&ye[be+1]!=="^"&&(ye[be]="");if(Ge.ignoreCase&&Re)for(var be=0;be<Ze;++be){var le=ye[be],ie=le.charAt(0);le.length>=2&&ie==="["?ye[be]=Ke(le):ie!=="\\"&&(ye[be]=le.replace(/[a-zA-Z]/g,function(Q){var te=Q.charCodeAt(0);return"["+String.fromCharCode(te&~32,te|32)+"]"}))}return ye.join("")}for(var Ve=[],je=0,Ae=we.length;je<Ae;++je){var Le=we[je];if(Le.global||Le.multiline)throw new Error(""+Le);Ve.push("(?:"+et(Le)+")")}return new RegExp(Ve.join("|"),Be?"gi":"g")}function U(we,Ce){var Re=/(?:^|\s)nocode(?:\s|$)/,Be=[],je=0,Ae=[],Le=0;function Je(Ye){var He=Ye.nodeType;if(He==1){if(Re.test(Ye.className))return;for(var Ke=Ye.firstChild;Ke;Ke=Ke.nextSibling)Je(Ke);var et=Ye.nodeName.toLowerCase();(et==="br"||et==="li")&&(Be[Le]=`
|
|
`,Ae[Le<<1]=je++,Ae[Le++<<1|1]=Ye)}else if(He==3||He==4){var Ve=Ye.nodeValue;Ve.length&&(Ce?Ve=Ve.replace(/\r\n?/g,`
|
|
`):Ve=Ve.replace(/[ \t\r\n]+/g," "),Be[Le]=Ve,Ae[Le<<1]=je,je+=Ve.length,Ae[Le++<<1|1]=Ye)}}return Je(we),{sourceCode:Be.join("").replace(/\n$/,""),spans:Ae}}function Y(we,Ce,Re,Be,je){if(!Re)return;var Ae={sourceNode:we,pre:1,langExtension:null,numberLines:null,sourceCode:Re,spans:null,basePos:Ce,decorations:null};Be(Ae),je.push.apply(je,Ae.decorations)}var ee=/\S/;function oe(we){for(var Ce=void 0,Re=we.firstChild;Re;Re=Re.nextSibling){var Be=Re.nodeType;Ce=Be===1?Ce?we:Re:Be===3&&ee.test(Re.nodeValue)?we:Ce}return Ce===we?void 0:Ce}function de(we,Ce){var Re={},Be;(function(){for(var Le=we.concat(Ce),Je=[],Ye={},He=0,Ke=Le.length;He<Ke;++He){var et=Le[He],Ve=et[3];if(Ve)for(var Ge=Ve.length;--Ge>=0;)Re[Ve.charAt(Ge)]=et;var ye=et[1],Ze=""+ye;Ye.hasOwnProperty(Ze)||(Je.push(ye),Ye[Ze]=null)}Je.push(/[\0-\uffff]/),Be=B(Je)})();var je=Ce.length,Ae=function(Le){for(var Je=Le.sourceCode,Ye=Le.basePos,He=Le.sourceNode,Ke=[Ye,a],et=0,Ve=Je.match(Be)||[],Ge={},ye=0,Ze=Ve.length;ye<Ze;++ye){var ze=Ve[ye],be=Ge[ze],_e=void 0,le;if(typeof be=="string")le=!1;else{var ne=Re[ze.charAt(0)];if(ne)_e=ze.match(ne[1]),be=ne[0];else{for(var ie=0;ie<je;++ie)if(ne=Ce[ie],_e=ze.match(ne[1]),_e){be=ne[0];break}_e||(be=a)}le=be.length>=5&&be.substring(0,5)==="lang-",le&&!(_e&&typeof _e[1]=="string")&&(le=!1,be=x),le||(Ge[ze]=be)}var X=et;if(et+=ze.length,!le)Ke.push(Ye+X,be);else{var $=_e[1],Q=ze.indexOf($),te=Q+$.length;_e[2]&&(te=ze.length-_e[2].length,Q=te-$.length);var se=be.substring(5);Y(He,Ye+X,ze.substring(0,Q),Ae,Ke),Y(He,Ye+X+Q,$,ue(se,$),Ke),Y(He,Ye+X+te,ze.substring(te),Ae,Ke)}}Le.decorations=Ke};return Ae}function Te(we){var Ce=[],Re=[];we.tripleQuotedStrings?Ce.push([h,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):we.multiLineStrings?Ce.push([h,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Ce.push([h,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),we.verbatimStrings&&Re.push([h,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Be=we.hashComments;Be&&(we.cStyleComments?(Be>1?Ce.push([v,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Ce.push([v,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Re.push([h,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Ce.push([v,/^#[^\r\n]*/,null,"#"])),we.cStyleComments&&(Re.push([v,/^\/\/[^\r\n]*/,null]),Re.push([v,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var je=we.regexLiterals;if(je){var Ae=je>1?"":`
|
|
\r`,Le=Ae?".":"[\\S\\s]",Je="/(?=[^/*"+Ae+"])(?:[^/\\x5B\\x5C"+Ae+"]|\\x5C"+Le+"|\\x5B(?:[^\\x5C\\x5D"+Ae+"]|\\x5C"+Le+")*(?:\\x5D|$))+/";Re.push(["lang-regex",RegExp("^"+V+"("+Je+")")])}var Ye=we.types;Ye&&Re.push([c,Ye]);var He=(""+we.keywords).replace(/^ | $/g,"");He.length&&Re.push([C,new RegExp("^(?:"+He.replace(/[\s,]+/g,"|")+")\\b"),null]),Ce.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var Ke="^.[^\\s\\w.$@'\"`/\\\\]*";return we.regexLiterals&&(Ke+="(?!s*/)"),Re.push([f,/^@[a-z_$][a-z_$@0-9]*/i,null],[c,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[f,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[d,new RegExp(Ke),null]),de(Ce,Re)}var ge=Te({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function pe(we,Ce,Re){for(var Be=/(?:^|\s)nocode(?:\s|$)/,je=/\r\n?|\n/,Ae=we.ownerDocument,Le=Ae.createElement("li");we.firstChild;)Le.appendChild(we.firstChild);var Je=[Le];function Ye(ye){var Ze=ye.nodeType;if(Ze==1&&!Be.test(ye.className))if(ye.nodeName==="br")He(ye),ye.parentNode&&ye.parentNode.removeChild(ye);else for(var ze=ye.firstChild;ze;ze=ze.nextSibling)Ye(ze);else if((Ze==3||Ze==4)&&Re){var be=ye.nodeValue,_e=be.match(je);if(_e){var le=be.substring(0,_e.index);ye.nodeValue=le;var ne=be.substring(_e.index+_e[0].length);if(ne){var ie=ye.parentNode;ie.insertBefore(Ae.createTextNode(ne),ye.nextSibling)}He(ye),le||ye.parentNode.removeChild(ye)}}}function He(ye){for(;!ye.nextSibling;)if(ye=ye.parentNode,!ye)return;function Ze(_e,le){var ne=le?_e.cloneNode(!1):_e,ie=_e.parentNode;if(ie){var X=Ze(ie,1),$=_e.nextSibling;X.appendChild(ne);for(var Q=$;Q;Q=$)$=Q.nextSibling,X.appendChild(Q)}return ne}for(var ze=Ze(ye.nextSibling,0),be;(be=ze.parentNode)&&be.nodeType===1;)ze=be;Je.push(ze)}for(var Ke=0;Ke<Je.length;++Ke)Ye(Je[Ke]);Ce===(Ce|0)&&Je[0].setAttribute("value",Ce);var et=Ae.createElement("ol");et.className="linenums";for(var Ve=Math.max(0,Ce-1|0)||0,Ke=0,Ge=Je.length;Ke<Ge;++Ke)Le=Je[Ke],Le.className="L"+(Ke+Ve)%10,Le.firstChild||Le.appendChild(Ae.createTextNode("\xA0")),et.appendChild(Le);we.appendChild(et)}function fe(we){var Ce=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Ce=Ce&&+Ce[1]<=8;var Re=/\n/g,Be=we.sourceCode,je=Be.length,Ae=0,Le=we.spans,Je=Le.length,Ye=0,He=we.decorations,Ke=He.length,et=0;He[Ke]=je;var Ve,Ge;for(Ge=Ve=0;Ge<Ke;)He[Ge]!==He[Ge+2]?(He[Ve++]=He[Ge++],He[Ve++]=He[Ge++]):Ge+=2;for(Ke=Ve,Ge=Ve=0;Ge<Ke;){for(var ye=He[Ge],Ze=He[Ge+1],ze=Ge+2;ze+2<=Ke&&He[ze+1]===Ze;)ze+=2;He[Ve++]=ye,He[Ve++]=Ze,Ge=ze}Ke=He.length=Ve;var be=we.sourceNode,_e="";be&&(_e=be.style.display,be.style.display="none");try{for(var le=null;Ye<Je;){var ne=Le[Ye],ie=Le[Ye+2]||je,X=He[et+2]||je,ze=Math.min(ie,X),$=Le[Ye+1],Q;if($.nodeType!==1&&(Q=Be.substring(Ae,ze))){Ce&&(Q=Q.replace(Re,"\r")),$.nodeValue=Q;var te=$.ownerDocument,se=te.createElement("span");se.className=He[et+1];var ve=$.parentNode;ve.replaceChild(se,$),se.appendChild($),Ae<ie&&(Le[Ye+1]=$=te.createTextNode(Be.substring(ze,ie)),ve.insertBefore($,se.nextSibling))}Ae=ze,Ae>=ie&&(Ye+=2),Ae>=X&&(et+=2)}}finally{be&&(be.style.display=_e)}}var me={};function ae(we,Ce){for(var Re=Ce.length;--Re>=0;){var Be=Ce[Re];me.hasOwnProperty(Be)?I.console&&console.warn("cannot override language handler %s",Be):me[Be]=we}}function ue(we,Ce){return we&&me.hasOwnProperty(we)||(we=/^\s*</.test(Ce)?"default-markup":"default-code"),me[we]}ae(ge,["default-code"]),ae(de([],[[a,/^[^<?]+/],[p,/^<!\w[^>]*(?:>|$)/],[v,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[d,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ae(de([[a,/^[\s]+/,null,` \r
|
|
`],[N,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[b,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[d,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ae(de([],[[N,/^[\s\S]+/]]),["uq.val"]),ae(Te({keywords:T,hashComments:!0,cStyleComments:!0,types:m}),["c","cc","cpp","cxx","cyc","m"]),ae(Te({keywords:"null,true,false"}),["json"]),ae(Te({keywords:L,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:m}),["cs"]),ae(Te({keywords:A,cStyleComments:!0}),["java"]),ae(Te({keywords:l,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ae(Te({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ae(Te({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ae(Te({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ae(Te({keywords:y,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ae(Te({keywords:S,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ae(de([],[[h,/^[\s\S]+/]]),["regex"]);function Ee(we){var Ce=we.langExtension;try{var Re=U(we.sourceNode,we.pre),Be=Re.sourceCode;we.sourceCode=Be,we.spans=Re.spans,we.basePos=0,ue(Ce,Be)(we),fe(we)}catch(je){I.console&&console.log(je&&je.stack||je)}}function Ie(we,Ce,Re){var Be=Re||!1,je=Ce||null,Ae=document.createElement("div");Ae.innerHTML="<pre>"+we+"</pre>",Ae=Ae.firstChild,Be&&pe(Ae,Be,!0);var Le={langExtension:je,numberLines:Be,sourceNode:Ae,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Ee(Le),Ae.innerHTML}function ke(we,Ce){var Re=Ce||document.body,Be=Re.ownerDocument||document;function je(ne){return Re.getElementsByTagName(ne)}for(var Ae=[je("pre"),je("code"),je("xmp")],Le=[],Je=0;Je<Ae.length;++Je)for(var Ye=0,He=Ae[Je].length;Ye<He;++Ye)Le.push(Ae[Je][Ye]);Ae=null;var Ke=Date;Ke.now||(Ke={now:function(){return+new Date}});var et=0,Ve=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ge=/\bprettyprint\b/,ye=/\bprettyprinted\b/,Ze=/pre|xmp/i,ze=/^code$/i,be=/^(?:pre|code|xmp)$/i,_e={};function le(){for(var ne=I.PR_SHOULD_USE_CONTINUATION?Ke.now()+250:Infinity;et<Le.length&&Ke.now()<ne;et++){for(var ie=Le[et],X=_e,$=ie;$=$.previousSibling;){var Q=$.nodeType,te=(Q===7||Q===8)&&$.nodeValue;if(te?!/^\??prettify\b/.test(te):Q!==3||/\S/.test($.nodeValue))break;if(te){X={},te.replace(/\b(\w+)=([\w:.%+-]+)/g,function(vt,at,Jt){X[at]=Jt});break}}var se=ie.className;if((X!==_e||Ge.test(se))&&!ye.test(se)){for(var ve=!1,Se=ie.parentNode;Se;Se=Se.parentNode){var We=Se.tagName;if(be.test(We)&&Se.className&&Ge.test(Se.className)){ve=!0;break}}if(!ve){ie.className+=" prettyprinted";var rt=X.lang;if(!rt){rt=se.match(Ve);var tt;!rt&&(tt=oe(ie))&&ze.test(tt.tagName)&&(rt=tt.className.match(Ve)),rt&&(rt=rt[1])}var Tt;if(Ze.test(ie.tagName))Tt=1;else{var ct=ie.currentStyle,ot=Be.defaultView,Ct=ct?ct.whiteSpace:ot&&ot.getComputedStyle?ot.getComputedStyle(ie,null).getPropertyValue("white-space"):0;Tt=Ct&&Ct.substring(0,3)==="pre"}var ft=X.linenums;(ft=ft==="true"||+ft)||(ft=se.match(/\blinenums\b(?::(\d+))?/),ft=ft?ft[1]&&ft[1].length?+ft[1]:!0:!1),ft&&pe(ie,ft,Tt);var gt={langExtension:rt,sourceNode:ie,numberLines:ft,pre:Tt,sourceCode:null,basePos:null,spans:null,decorations:null};Ee(gt)}}}et<Le.length?I.setTimeout(le,250):typeof we=="function"&&we()}le()}var Xe=I.PR={createSimpleLexer:de,registerLangHandler:ae,sourceDecorator:Te,PR_ATTRIB_NAME:P,PR_ATTRIB_VALUE:N,PR_COMMENT:v,PR_DECLARATION:p,PR_KEYWORD:C,PR_LITERAL:f,PR_NOCODE:K,PR_PLAIN:a,PR_PUNCTUATION:d,PR_SOURCE:x,PR_STRING:h,PR_TAG:b,PR_TYPE:c,prettyPrintOne:D?I.prettyPrintOne=Ie:O=Ie,prettyPrint:F=D?I.prettyPrint=ke:F=ke},Ne=I.define;typeof Ne=="function"&&Ne.amd&&Ne("google-code-prettify",[],function(){return Xe})})()},UUDw:function(dt,Qe,J){dt.exports={buttonFixed:"buttonFixed___2zLVJ",button:"button___-JgFH",buttonWrap:"buttonWrap___aZhhk"}},UqFu:function(dt,Qe,J){"use strict";J.d(Qe,"a",function(){return Z});var Z=function(D){var W=document.createElement("textarea");return W.value=D,W.value}},"VrN/":function(dt,Qe,J){(function(Z,G){dt.exports=G()})(this,function(){"use strict";var Z=navigator.userAgent,G=navigator.platform,D=/gecko\/\d/i.test(Z),W=/MSIE \d/.test(Z),M=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Z),O=/Edge\/(\d+)/.exec(Z),F=W||M||O,I=F&&(W?document.documentMode||6:+(O||M)[1]),R=!O&&/WebKit\//.test(Z),_=R&&/Qt\/\d+\.\d+/.test(Z),g=!O&&/Chrome\//.test(Z),T=/Opera\//.test(Z),A=/Apple Computer/.test(navigator.vendor),L=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(Z),S=/PhantomJS/.test(Z),y=!O&&/AppleWebKit/.test(Z)&&/Mobile\/\w+/.test(Z),u=/Android/.test(Z),o=y||u||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(Z),s=y||/Mac/.test(G),l=/\bCrOS\b/.test(Z),w=/win/i.test(G),m=T&&Z.match(/Version\/(\d*\.\d*)/);m&&(m=Number(m[1])),m&&m>=15&&(T=!1,R=!0);var h=s&&(_||T&&(m==null||m<12.11)),C=D||F&&I>=9;function v(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var c=function(e,t){var n=e.className,r=v(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function f(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function d(e,t){return f(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var E=0;E<t.length;++E)i.appendChild(t[E]);return i}function b(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 x(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 P(){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 N(e,t){var n=e.className;v(t).test(n)||(e.className+=(n?" ":"")+t)}function K(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!v(n[r]).test(t)&&(t+=" "+n[r]);return t}var V=function(e){e.select()};y?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:F&&(V=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 Y(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var E=r||0,k=i||0;;){var j=e.indexOf(" ",E);if(j<0||j>=t)return k+(t-E);k+=j-E,k+=n-k%n,E=j+1}}var ee=function(){this.id=null,this.f=null,this.time=0,this.handler=B(this.onTimeout,this)};ee.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ee.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 oe(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var de=50,Te={toString:function(){return"CodeMirror.Pass"}},ge={scroll:!1},pe={origin:"*mouse"},fe={origin:"+move"};function me(e,t,n){for(var r=0,i=0;;){var E=e.indexOf(" ",r);E==-1&&(E=e.length);var k=E-r;if(E==e.length||i+k>=t)return r+Math.min(k,t-i);if(i+=E-r,i+=n-i%n,r=E+1,i>=t)return r}}var ae=[""];function ue(e){for(;ae.length<=e;)ae.push(Ee(ae)+" ");return ae[e]}function Ee(e){return e[e.length-1]}function Ie(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function ke(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function Xe(){}function Ne(e,t){var n;return Object.create?n=Object.create(e):(Xe.prototype=e,n=new Xe),t&&U(t,n),n}var we=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Ce(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||we.test(e))}function Re(e,t){return t?t.source.indexOf("\\w")>-1&&Ce(e)?!0:t.test(e):Ce(e)}function Be(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var je=/[\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 Ae(e){return e.charCodeAt(0)>=768&&je.test(e)}function Le(e,t,n){for(;(n<0?t>0:t<e.length)&&Ae(e.charAt(t));)t+=n;return t}function Je(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,E=r<0?Math.ceil(i):Math.floor(i);if(E==t)return e(E)?t:n;e(E)?n=E:t=E+r}}function Ye(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,E=0;E<e.length;++E){var k=e[E];(k.from<n&&k.to>t||t==n&&k.to==t)&&(r(Math.max(k.from,t),Math.min(k.to,n),k.level==1?"rtl":"ltr",E),i=!0)}i||r(t,n,"ltr")}var He=null;function Ke(e,t,n){var r;He=null;for(var i=0;i<e.length;++i){var E=e[i];if(E.from<t&&E.to>t)return i;E.to==t&&(E.from!=E.to&&n=="before"?r=i:He=i),E.from==t&&(E.from!=E.to&&n!="before"?r=i:He=i)}return r!=null?r:He}var et=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(z){return z<=247?e.charAt(z):1424<=z&&z<=1524?"R":1536<=z&&z<=1785?t.charAt(z-1536):1774<=z&&z<=2220?"r":8192<=z&&z<=8203?"w":z==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,E=/[LRr]/,k=/[Lb1n]/,j=/[1n]/;function H(z,q,re){this.level=z,this.from=q,this.to=re}return function(z,q){var re=q=="ltr"?"L":"R";if(z.length==0||q=="ltr"&&!r.test(z))return!1;for(var he=z.length,ce=[],xe=0;xe<he;++xe)ce.push(n(z.charCodeAt(xe)));for(var De=0,Me=re;De<he;++De){var Ue=ce[De];Ue=="m"?ce[De]=Me:Me=Ue}for(var $e=0,Fe=re;$e<he;++$e){var qe=ce[$e];qe=="1"&&Fe=="r"?ce[$e]="n":E.test(qe)&&(Fe=qe,qe=="r"&&(ce[$e]="R"))}for(var ut=1,st=ce[0];ut<he-1;++ut){var yt=ce[ut];yt=="+"&&st=="1"&&ce[ut+1]=="1"?ce[ut]="1":yt==","&&st==ce[ut+1]&&(st=="1"||st=="n")&&(ce[ut]=st),st=yt}for(var Ot=0;Ot<he;++Ot){var Ht=ce[Ot];if(Ht==",")ce[Ot]="N";else if(Ht=="%"){var Pt=void 0;for(Pt=Ot+1;Pt<he&&ce[Pt]=="%";++Pt);for(var fr=Ot&&ce[Ot-1]=="!"||Pt<he&&ce[Pt]=="1"?"1":"N",lr=Ot;lr<Pt;++lr)ce[lr]=fr;Ot=Pt-1}}for(var Ft=0,ur=re;Ft<he;++Ft){var Vt=ce[Ft];ur=="L"&&Vt=="1"?ce[Ft]="L":E.test(Vt)&&(ur=Vt)}for(var jt=0;jt<he;++jt)if(i.test(ce[jt])){var Nt=void 0;for(Nt=jt+1;Nt<he&&i.test(ce[Nt]);++Nt);for(var kt=(jt?ce[jt-1]:re)=="L",dr=(Nt<he?ce[Nt]:re)=="L",Wn=kt==dr?kt?"L":"R":re,Jr=jt;Jr<Nt;++Jr)ce[Jr]=Wn;jt=Nt-1}for(var Qt=[],Pr,Gt=0;Gt<he;)if(k.test(ce[Gt])){var Va=Gt;for(++Gt;Gt<he&&k.test(ce[Gt]);++Gt);Qt.push(new H(0,Va,Gt))}else{var Wr=Gt,hn=Qt.length,mn=q=="rtl"?1:0;for(++Gt;Gt<he&&ce[Gt]!="L";++Gt);for(var er=Wr;er<Gt;)if(j.test(ce[er])){Wr<er&&(Qt.splice(hn,0,new H(1,Wr,er)),hn+=mn);var Kn=er;for(++er;er<Gt&&j.test(ce[er]);++er);Qt.splice(hn,0,new H(2,Kn,er)),hn+=mn,Wr=er}else++er;Wr<Gt&&Qt.splice(hn,0,new H(1,Wr,Gt))}return q=="ltr"&&(Qt[0].level==1&&(Pr=z.match(/^\s+/))&&(Qt[0].from=Pr[0].length,Qt.unshift(new H(0,0,Pr[0].length))),Ee(Qt).level==1&&(Pr=z.match(/\s+$/))&&(Ee(Qt).to-=Pr[0].length,Qt.push(new H(0,he-Pr[0].length,he)))),q=="rtl"?Qt.reverse():Qt}}();function Ve(e,t){var n=e.order;return n==null&&(n=e.order=et(e.text,t)),n}var Ge=[],ye=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]||Ge).concat(n)}};function Ze(e,t){return e._handlers&&e._handlers[t]||Ge}function ze(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 E=oe(i,n);E>-1&&(r[t]=i.slice(0,E).concat(i.slice(E+1)))}}}function be(e,t){var n=Ze(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 _e(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),be(e,n||t.type,e,t),Q(t)||t.codemirrorIgnore}function le(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)oe(n,t[r])==-1&&n.push(t[r])}function ne(e,t){return Ze(e,t).length>0}function ie(e){e.prototype.on=function(t,n){ye(this,t,n)},e.prototype.off=function(t,n){ze(this,t,n)}}function X(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function $(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Q(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function te(e){X(e),$(e)}function se(e){return e.target||e.srcElement}function ve(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 Se=function(){if(F&&I<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),We;function rt(e){if(We==null){var t=a("span","\u200B");d(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(We=t.offsetWidth<=1&&t.offsetHeight>2&&!(F&&I<8))}var n=We?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var tt;function Tt(e){if(tt!=null)return tt;var t=d(e,document.createTextNode("A\u062EA")),n=p(t,0,1).getBoundingClientRect(),r=p(t,1,2).getBoundingClientRect();return f(e),!n||n.left==n.right?!1:tt=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 E=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),k=E.indexOf("\r");k!=-1?(n.push(E.slice(0,k)),t+=k+1):(n.push(E),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},ot=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Ct=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ft=null;function gt(e){if(ft!=null)return ft;var t=d(e,a("span","x")),n=t.getBoundingClientRect(),r=p(t,0,1).getBoundingClientRect();return ft=Math.abs(n.left-r.left)>1}var vt={},at={};function Jt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),vt[e]=t}function It(e,t){at[e]=t}function Xt(e){if(typeof e=="string"&&at.hasOwnProperty(e))e=at[e];else if(e&&typeof e.name=="string"&&at.hasOwnProperty(e.name)){var t=at[e.name];typeof t=="string"&&(t={name:t}),e=Ne(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Xt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Xt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function tr(e,t){t=Xt(t);var n=vt[t.name];if(!n)return tr(e,"text/plain");var r=n(e,t);if(hr.hasOwnProperty(t.name)){var i=hr[t.name];for(var E in i){if(!i.hasOwnProperty(E))continue;r.hasOwnProperty(E)&&(r["_"+E]=r[E]),r[E]=i[E]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var k in t.modeProps)r[k]=t.modeProps[k];return r}var hr={};function rr(e,t){var n=hr.hasOwnProperty(e)?hr[e]:hr[e]={};U(t,n)}function Ar(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Hn(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Gn(e,t,n){return e.startState?e.startState(t,n):!0}var Mt=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};Mt.prototype.eol=function(){return this.pos>=this.string.length},Mt.prototype.sol=function(){return this.pos==this.lineStart},Mt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Mt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Mt.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},Mt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Mt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Mt.prototype.skipToEnd=function(){this.pos=this.string.length},Mt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Mt.prototype.backUp=function(e){this.pos-=e},Mt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Y(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Y(this.string,this.lineStart,this.tabSize):0)},Mt.prototype.indentation=function(){return Y(this.string,null,this.tabSize)-(this.lineStart?Y(this.string,this.lineStart,this.tabSize):0)},Mt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(k){return n?k.toLowerCase():k},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var E=this.string.slice(this.pos).match(e);return E&&E.index>0?null:(E&&t!==!1&&(this.pos+=E[0].length),E)}},Mt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Mt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Mt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Mt.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],E=i.chunkSize();if(t<E){n=i;break}t-=E}return n.lines[t]}function Mr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(E){var k=E.text;i==n.line&&(k=k.slice(0,n.ch)),i==t.line&&(k=k.slice(t.ch)),r.push(k),++i}),r}function pn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function nr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function wt(e){if(e.parent==null)return null;for(var t=e.parent,n=oe(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 br(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],E=i.height;if(t<E){e=i;continue e}t-=E,n+=i.chunkSize()}return n}while(!e.lines);for(var k=0;k<e.lines.length;++k){var j=e.lines[k],H=j.height;if(t<H)break;t-=H}return n+k}function kr(e,t){return t>=e.first&&t<e.first+e.size}function gn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Oe(e,t,n){if(n===void 0&&(n=null),!(this instanceof Oe))return new Oe(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ht(e,t){return e.line-t.line||e.ch-t.ch}function zn(e,t){return e.sticky==t.sticky&&ht(e,t)==0}function vn(e){return Oe(e.line,e.ch)}function yn(e,t){return ht(e,t)<0?t:e}function Zr(e,t){return ht(e,t)<0?e:t}function bn(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function pt(e,t){if(t.line<e.first)return Oe(e.first,0);var n=e.first+e.size-1;return t.line>n?Oe(n,nt(e,n).text.length):Di(t,nt(e,t.line).text.length)}function Di(e,t){var n=e.ch;return n==null||n>t?Oe(e.line,t):n<0?Oe(e.line,0):e}function Pe(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=pt(e,t[r]);return n}var En=function(e,t){this.state=e,this.lookAhead=t},vr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};vr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},vr.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}},vr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},vr.fromSaved=function(e,t,n){return t instanceof En?new vr(e,Ar(e.mode,t.state),n,t.lookAhead):new vr(e,Ar(e.mode,t),n)},vr.prototype.save=function(e){var t=e!==!1?Ar(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new En(t,this.maxLookAhead):t};function Vn(e,t,n,r){var i=[e.state.modeGen],E={};Tr(e,t.text,e.doc.mode,n,function(z,q){return i.push(z,q)},E,r);for(var k=n.state,j=function(z){n.baseTokens=i;var q=e.state.overlays[z],re=1,he=0;n.state=!0,Tr(e,t.text,q.mode,n,function(ce,xe){for(var De=re;he<ce;){var Me=i[re];Me>ce&&i.splice(re,1,ce,i[re+1],Me),re+=2,he=Math.min(ce,Me)}if(!xe)return;if(q.opaque)i.splice(De,re-De,ce,"overlay "+xe),re=De+2;else for(;De<re;De+=2){var Ue=i[De+1];i[De+1]=(Ue?Ue+" ":"")+"overlay "+xe}},E),n.state=k,n.baseTokens=null,n.baseTokenPos=1},H=0;H<e.state.overlays.length;++H)j(H);return{styles:i,classes:E.bgClass||E.textClass?E:null}}function qr(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Er(e,wt(t)),i=t.text.length>e.options.maxHighlightLength&&Ar(e.doc.mode,r.state),E=Vn(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=E.styles,E.classes?t.styleClasses=E.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 Er(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new vr(r,!0,t);var E=_i(e,t,n),k=E>r.first&&nt(r,E-1).stateAfter,j=k?vr.fromSaved(r,k,E):new vr(r,Gn(r.mode),E);return r.iter(E,t,function(H){Xn(e,H.text,j);var z=j.line;H.stateAfter=z==t-1||z%5==0||z>=i.viewFrom&&z<i.viewTo?j.save():null,j.nextLine()}),n&&(r.modeFrontier=j.line),j}function Xn(e,t,n,r){var i=e.doc.mode,E=new Mt(t,e.options.tabSize,n);for(E.start=E.pos=r||0,t==""&&Yn(i,n.state);!E.eol();)xr(i,E,n.state),E.start=E.pos}function Yn(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Hn(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function xr(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Hn(e,n).mode);var E=e.token(t,n);if(t.pos>t.start)return E}throw new Error("Mode "+e.name+" failed to advance stream.")}var $n=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Ai(e,t,n,r){var i=e.doc,E=i.mode,k;t=pt(i,t);var j=nt(i,t.line),H=Er(e,t.line,n),z=new Mt(j.text,e.options.tabSize,H),q;for(r&&(q=[]);(r||z.pos<t.ch)&&!z.eol();)z.start=z.pos,k=xr(E,z,H.state),r&&q.push(new $n(z,k,Ar(i.mode,H.state)));return r?q:new $n(z,k,H.state)}function Qn(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 Tr(e,t,n,r,i,E,k){var j=n.flattenSpans;j==null&&(j=e.options.flattenSpans);var H=0,z=null,q=new Mt(t,e.options.tabSize,r),re,he=e.options.addModeClass&&[null];for(t==""&&Qn(Yn(n,r.state),E);!q.eol();){if(q.pos>e.options.maxHighlightLength?(j=!1,k&&Xn(e,t,r,q.pos),q.pos=t.length,re=null):re=Qn(xr(n,q,r.state,he),E),he){var ce=he[0].name;ce&&(re="m-"+(re?ce+" "+re:ce))}if(!j||z!=re){for(;H<q.start;)H=Math.min(q.start,H+5e3),i(H,z);z=re}q.start=q.pos}for(;H<q.pos;){var xe=Math.min(q.pos,H+5e3);i(xe,z),H=xe}}function _i(e,t,n){for(var r,i,E=e.doc,k=n?-1:t-(e.doc.mode.innerMode?1e3:100),j=t;j>k;--j){if(j<=E.first)return E.first;var H=nt(E,j-1),z=H.stateAfter;if(z&&(!n||j+(z instanceof En?z.lookAhead:0)<=E.modeFrontier))return j;var q=Y(H.text,null,e.options.tabSize);(i==null||r>q)&&(i=j-1,r=q)}return i}function aa(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var i=nt(e,r).stateAfter;if(i&&(!(i instanceof En)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Jn=!1,Zt=!1;function Kr(){Jn=!0}function oa(){Zt=!0}function en(e,t,n){this.marker=e,this.from=t,this.to=n}function Sr(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Zn(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function sa(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Oi(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var E=e[i],k=E.marker,j=E.from==null||(k.inclusiveLeft?E.from<=t:E.from<t);if(j||E.from==t&&k.type=="bookmark"&&(!n||!E.marker.insertLeft)){var H=E.to==null||(k.inclusiveRight?E.to>=t:E.to>t);(r||(r=[])).push(new en(k,E.from,H?null:E.to))}}return r}function Ri(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var E=e[i],k=E.marker,j=E.to==null||(k.inclusiveRight?E.to>=t:E.to>t);if(j||E.from==t&&k.type=="bookmark"&&(!n||E.marker.insertLeft)){var H=E.from==null||(k.inclusiveLeft?E.from<=t:E.from<t);(r||(r=[])).push(new en(k,H?null:E.from-t,E.to==null?null:E.to-t))}}return r}function xn(e,t){if(t.full)return null;var n=kr(e,t.from.line)&&nt(e,t.from.line).markedSpans,r=kr(e,t.to.line)&&nt(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,E=t.to.ch,k=ht(t.from,t.to)==0,j=Oi(n,i,k),H=Ri(r,E,k),z=t.text.length==1,q=Ee(t.text).length+(z?i:0);if(j)for(var re=0;re<j.length;++re){var he=j[re];if(he.to==null){var ce=Sr(H,he.marker);ce?z&&(he.to=ce.to==null?null:ce.to+q):he.to=i}}if(H)for(var xe=0;xe<H.length;++xe){var De=H[xe];if(De.to!=null&&(De.to+=q),De.from==null){var Me=Sr(j,De.marker);Me||(De.from=q,z&&(j||(j=[])).push(De))}else De.from+=q,z&&(j||(j=[])).push(De)}j&&(j=Pi(j)),H&&H!=j&&(H=Pi(H));var Ue=[j];if(!z){var $e=t.text.length-2,Fe;if($e>0&&j)for(var qe=0;qe<j.length;++qe)j[qe].to==null&&(Fe||(Fe=[])).push(new en(j[qe].marker,null,null));for(var ut=0;ut<$e;++ut)Ue.push(Fe);Ue.push(H)}return Ue}function Pi(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 Mi(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(ce){if(ce.markedSpans)for(var xe=0;xe<ce.markedSpans.length;++xe){var De=ce.markedSpans[xe].marker;De.readOnly&&(!r||oe(r,De)==-1)&&(r||(r=[])).push(De)}}),!r)return null;for(var i=[{from:t,to:n}],E=0;E<r.length;++E)for(var k=r[E],j=k.find(0),H=0;H<i.length;++H){var z=i[H];if(ht(z.to,j.from)<0||ht(z.from,j.to)>0)continue;var q=[H,1],re=ht(z.from,j.from),he=ht(z.to,j.to);(re<0||!k.inclusiveLeft&&!re)&&q.push({from:z.from,to:j.from}),(he>0||!k.inclusiveRight&&!he)&&q.push({from:j.to,to:z.to}),i.splice.apply(i,q),H+=q.length-3}return i}function la(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function Tn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function tn(e){return e.inclusiveLeft?-1:0}function rn(e){return e.inclusiveRight?1:0}function Sn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),E=ht(r.from,i.from)||tn(e)-tn(t);if(E)return-E;var k=ht(r.to,i.to)||rn(e)-rn(t);return k||t.id-e.id}function Ir(e,t){var n=Zt&&e.markedSpans,r;if(n)for(var i=void 0,E=0;E<n.length;++E)i=n[E],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Sn(r,i.marker)<0)&&(r=i.marker);return r}function Ur(e){return Ir(e,!0)}function Fr(e){return Ir(e,!1)}function wn(e,t){var n=Zt&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var E=n[i];E.marker.collapsed&&(E.from==null||E.from<t)&&(E.to==null||E.to>t)&&(!r||Sn(r,E.marker)<0)&&(r=E.marker)}return r}function ki(e,t,n,r,i){var E=nt(e,t),k=Zt&&E.markedSpans;if(k)for(var j=0;j<k.length;++j){var H=k[j];if(!H.marker.collapsed)continue;var z=H.marker.find(0),q=ht(z.from,n)||tn(H.marker)-tn(i),re=ht(z.to,r)||rn(H.marker)-rn(i);if(q>=0&&re<=0||q<=0&&re>=0)continue;if(q<=0&&(H.marker.inclusiveRight&&i.inclusiveLeft?ht(z.to,n)>=0:ht(z.to,n)>0)||q>=0&&(H.marker.inclusiveRight&&i.inclusiveLeft?ht(z.from,r)<=0:ht(z.from,r)<0))return!0}}function mr(e){for(var t;t=Ur(e);)e=t.find(-1,!0).line;return e}function Ii(e){for(var t;t=Fr(e);)e=t.find(1,!0).line;return e}function Cn(e){for(var t,n;t=Fr(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function qn(e,t){var n=nt(e,t),r=mr(n);return n==r?t:wt(r)}function Hr(e,t){if(t>e.lastLine())return t;var n=nt(e,t),r;if(!_r(e,n))return t;for(;r=Fr(n);)n=r.find(1,!0).line;return wt(n)+1}function _r(e,t){var n=Zt&&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&&ei(e,t,r))return!0}}function ei(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return ei(e,r.line,Sr(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,E=0;E<t.markedSpans.length;++E)if(i=t.markedSpans[E],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&ei(e,t,i))return!0}function wr(e){e=mr(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 E=n.parent;E;n=E,E=n.parent)for(var k=0;k<E.children.length;++k){var j=E.children[k];if(j==n)break;t+=j.height}return t}function ti(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Ur(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Fr(r);){var E=n.find(0,!0);t-=r.text.length-E.from.ch,r=E.to.line,t+=r.text.length-E.to.ch}return t}function Ui(e){var t=e.display,n=e.doc;t.maxLine=nt(n,n.first),t.maxLineLength=ti(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=ti(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var nn=function(e,t,n){this.text=e,Tn(this,t),this.height=n?n(this):1};nn.prototype.lineNo=function(){return wt(this)},ie(nn);function ua(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),la(e),Tn(e,n);var i=r?r(e):1;i!=e.height&&nr(e,i)}function it(e){e.parent=null,la(e)}var mt={},lt={};function bt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?lt:mt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function St(e,t){var n=b("span",null,null,R?"padding-right: .1px":null),r={pre:b("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 E=i?t.rest[i-1]:t.line,k=void 0;r.pos=0,r.addToken=xt,Tt(e.display.measure)&&(k=Ve(E,e.doc.direction))&&(r.addToken=ir(r.addToken,k)),r.map=[];var j=t!=e.display.externalMeasured&&wt(E);Nr(E,r,qr(e,E,j)),E.styleClasses&&(E.styleClasses.bgClass&&(r.bgClass=K(E.styleClasses.bgClass,r.bgClass||"")),E.styleClasses.textClass&&(r.textClass=K(E.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(rt(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(R){var H=r.content.lastChild;(/\bcm-tab\b/.test(H.className)||H.querySelector&&H.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return be(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=K(r.pre.className,r.textClass||"")),r}function _t(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 xt(e,t,n,r,i,E,k){if(!t)return;var j=e.splitSpaces?Bt(t,e.trailingSpace):t,H=e.cm.state.specialChars,z=!1,q;if(!H.test(t))e.col+=t.length,q=document.createTextNode(j),e.map.push(e.pos,e.pos+t.length,q),F&&I<9&&(z=!0),e.pos+=t.length;else{q=document.createDocumentFragment();for(var re=0;;){H.lastIndex=re;var he=H.exec(t),ce=he?he.index-re:t.length-re;if(ce){var xe=document.createTextNode(j.slice(re,re+ce));F&&I<9?q.appendChild(a("span",[xe])):q.appendChild(xe),e.map.push(e.pos,e.pos+ce,xe),e.col+=ce,e.pos+=ce}if(!he)break;re+=ce+1;var De=void 0;if(he[0]==" "){var Me=e.cm.options.tabSize,Ue=Me-e.col%Me;De=q.appendChild(a("span",ue(Ue),"cm-tab")),De.setAttribute("role","presentation"),De.setAttribute("cm-text"," "),e.col+=Ue}else he[0]=="\r"||he[0]==`
|
|
`?(De=q.appendChild(a("span",he[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),De.setAttribute("cm-text",he[0]),e.col+=1):(De=e.cm.options.specialCharPlaceholder(he[0]),De.setAttribute("cm-text",he[0]),F&&I<9?q.appendChild(a("span",[De])):q.appendChild(De),e.col+=1);e.map.push(e.pos,e.pos+1,De),e.pos++}}if(e.trailingSpace=j.charCodeAt(t.length-1)==32,n||r||i||z||E||k){var $e=n||"";r&&($e+=r),i&&($e+=i);var Fe=a("span",[q],$e,E);if(k)for(var qe in k)k.hasOwnProperty(qe)&&qe!="style"&&qe!="class"&&Fe.setAttribute(qe,k[qe]);return e.content.appendChild(Fe)}e.content.appendChild(q)}function Bt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var E=e.charAt(i);E==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(E="\xA0"),r+=E,n=E==" "}return r}function ir(e,t){return function(n,r,i,E,k,j,H){i=i?i+" cm-force-border":"cm-force-border";for(var z=n.pos,q=z+r.length;;){for(var re=void 0,he=0;he<t.length&&!(re=t[he],re.to>z&&re.from<=z);he++);if(re.to>=q)return e(n,r,i,E,k,j,H);e(n,r.slice(0,re.to-z),i,E,null,j,H),E=null,r=r.slice(re.to-z),z=re.to}}}function Et(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 Nr(e,t,n){var r=e.markedSpans,i=e.text,E=0;if(!r){for(var k=1;k<n.length;k+=2)t.addToken(t,i.slice(E,E=n[k]),bt(n[k+1],t.cm.options));return}for(var j=i.length,H=0,z=1,q="",re,he,ce=0,xe,De,Me,Ue,$e;;){if(ce==H){xe=De=Me=he="",$e=null,Ue=null,ce=Infinity;for(var Fe=[],qe=void 0,ut=0;ut<r.length;++ut){var st=r[ut],yt=st.marker;if(yt.type=="bookmark"&&st.from==H&&yt.widgetNode)Fe.push(yt);else if(st.from<=H&&(st.to==null||st.to>H||yt.collapsed&&st.to==H&&st.from==H)){if(st.to!=null&&st.to!=H&&ce>st.to&&(ce=st.to,De=""),yt.className&&(xe+=" "+yt.className),yt.css&&(he=(he?he+";":"")+yt.css),yt.startStyle&&st.from==H&&(Me+=" "+yt.startStyle),yt.endStyle&&st.to==ce&&(qe||(qe=[])).push(yt.endStyle,st.to),yt.title&&(($e||($e={})).title=yt.title),yt.attributes)for(var Ot in yt.attributes)($e||($e={}))[Ot]=yt.attributes[Ot];yt.collapsed&&(!Ue||Sn(Ue.marker,yt)<0)&&(Ue=st)}else st.from>H&&ce>st.from&&(ce=st.from)}if(qe)for(var Ht=0;Ht<qe.length;Ht+=2)qe[Ht+1]==ce&&(De+=" "+qe[Ht]);if(!Ue||Ue.from==H)for(var Pt=0;Pt<Fe.length;++Pt)Et(t,0,Fe[Pt]);if(Ue&&(Ue.from||0)==H){if(Et(t,(Ue.to==null?j+1:Ue.to)-H,Ue.marker,Ue.from==null),Ue.to==null)return;Ue.to==H&&(Ue=!1)}}if(H>=j)break;for(var fr=Math.min(j,ce);;){if(q){var lr=H+q.length;if(!Ue){var Ft=lr>fr?q.slice(0,fr-H):q;t.addToken(t,Ft,re?re+xe:xe,Me,H+Ft.length==ce?De:"",he,$e)}if(lr>=fr){q=q.slice(fr-H),H=fr;break}H=lr,Me=""}q=i.slice(E,E=n[z++]),re=bt(n[z++],t.cm.options)}}}function Lt(e,t,n){this.line=t,this.rest=Cn(t),this.size=this.rest?wt(Ee(this.rest))-n+1:1,this.node=this.text=null,this.hidden=_r(e,t)}function ar(e,t,n){for(var r=[],i,E=t;E<n;E=i){var k=new Lt(e.doc,nt(e.doc,E),E);i=E+k.size,r.push(k)}return r}var Yt=null;function yr(e){Yt?Yt.ops.push(e):e.ownsGroup=Yt={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{Yt=null,t(n)}}var ri=null;function zt(e,t){var n=Ze(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Yt?i=Yt.delayedCallbacks:ri?i=ri:(i=ri=[],setTimeout(Ps,0));for(var E=function(j){i.push(function(){return n[j].apply(null,r)})},k=0;k<n.length;++k)E(k)}function Ps(){var e=ri;ri=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,n,r){for(var i=0;i<t.changes.length;i++){var E=t.changes[i];E=="text"?ks(e,t):E=="gutter"?Qa(e,t,n,r):E=="class"?da(e,t):E=="widget"&&Is(e,t,r)}t.changes=null}function ni(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),F&&I<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=ni(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):St(e,t)}function ks(e,t){var n=t.text.className,r=$a(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,da(e,t)):n&&(t.text.className=n)}function da(e,t){Ms(e,t),t.line.wrapClass?ni(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Qa(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=ni(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 E=t.line.gutterMarkers;if(e.options.lineNumbers||E){var k=ni(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),k.insertBefore(j,t.text),t.line.gutterClass&&(j.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!E||!E["CodeMirror-linenumbers"])&&(t.lineNumber=j.appendChild(a("div",gn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),E)for(var H=0;H<e.display.gutterSpecs.length;++H){var z=e.display.gutterSpecs[H].className,q=E.hasOwnProperty(z)&&E[z];q&&j.appendChild(a("div",[q],"CodeMirror-gutter-elt","left: "+r.gutterLeft[z]+"px; width: "+r.gutterWidth[z]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=v("CodeMirror-linewidget"),i=t.node.firstChild,E=void 0;i;i=E)E=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Ja(e,t,n)}function Us(e,t,n,r){var i=$a(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),da(e,t),Qa(e,t,n,r),Ja(e,t,r),t.node}function Ja(e,t,n){if(Za(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Za(e,t.rest[r],t,n,!1)}function Za(e,t,n,r,i){if(!t.widgets)return;for(var E=ni(n),k=0,j=t.widgets;k<j.length;++k){var H=j[k],z=a("div",[H.node],"CodeMirror-linewidget"+(H.className?" "+H.className:""));H.handleMouseEvents||z.setAttribute("cm-ignore-events","true"),Fs(H,z,n,r),e.display.input.setUneditable(z),i&&H.above?E.insertBefore(z,n.gutter||n.text):E.appendChild(z),zt(H,"redraw")}}function Fs(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 ii(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!x(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),d(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Br(e,t){for(var n=se(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Fi(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=d(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Or(e){return de-e.display.nativeBarWidth}function an(e){return e.display.scroller.clientWidth-Or(e)-e.display.barWidth}function fa(e){return e.display.scroller.clientHeight-Or(e)-e.display.barHeight}function Ns(e,t,n){var r=e.options.lineWrapping,i=r&&an(e);if(!t.measure.heights||r&&t.measure.width!=i){var E=t.measure.heights=[];if(r){t.measure.width=i;for(var k=t.text.firstChild.getClientRects(),j=0;j<k.length-1;j++){var H=k[j],z=k[j+1];Math.abs(H.bottom-z.bottom)>2&&E.push((H.bottom+z.top)/2-n.top)}}E.push(n.bottom-n.top)}}function eo(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(wt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=mr(t);var n=wt(t),r=e.display.externalMeasured=new Lt(e.doc,t,n);r.lineN=n;var i=r.built=St(e,r);return r.text=i.pre,d(e.display.lineMeasure,i.pre),r}function to(e,t,n,r){return Rr(e,Ln(e,t),n,r)}function ha(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[ln(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Ln(e,t){var n=wt(t),r=ha(e,n);r&&!r.text?r=null:r&&r.changes&&(Ya(e,r,n,ba(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=eo(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Rr(e,t,n,r,i){t.before&&(n=-1);var E=n+(r||""),k;return t.cache.hasOwnProperty(E)?k=t.cache[E]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ns(e,t.view,t.rect),t.hasHeights=!0),k=Ws(e,t,n,r),k.bogus||(t.cache[E]=k)),{left:k.left,right:k.right,top:i?k.rtop:k.top,bottom:i?k.rbottom:k.bottom}}var ro={left:0,right:0,top:0,bottom:0};function no(e,t,n){for(var r,i,E,k,j,H,z=0;z<e.length;z+=3)if(j=e[z],H=e[z+1],t<j?(i=0,E=1,k="left"):t<H?(i=t-j,E=i+1):(z==e.length-3||t==H&&e[z+3]>t)&&(E=H-j,i=E-1,t>=H&&(k="right")),i!=null){if(r=e[z+2],j==H&&n==(r.insertLeft?"left":"right")&&(k=n),n=="left"&&i==0)for(;z&&e[z-2]==e[z-3]&&e[z-1].insertLeft;)r=e[(z-=3)+2],k="left";if(n=="right"&&i==H-j)for(;z<e.length-3&&e[z+3]==e[z+4]&&!e[z+5].insertLeft;)r=e[(z+=3)+2],k="right";break}return{node:r,start:i,end:E,collapse:k,coverStart:j,coverEnd:H}}function js(e,t){var n=ro;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=no(t.map,n,r),E=i.node,k=i.start,j=i.end,H=i.collapse,z;if(E.nodeType==3){for(var q=0;q<4;q++){for(;k&&Ae(t.line.text.charAt(i.coverStart+k));)--k;for(;i.coverStart+j<i.coverEnd&&Ae(t.line.text.charAt(i.coverStart+j));)++j;if(F&&I<9&&k==0&&j==i.coverEnd-i.coverStart?z=E.parentNode.getBoundingClientRect():z=js(p(E,k,j).getClientRects(),r),z.left||z.right||k==0)break;j=k,k=k-1,H="right"}F&&I<11&&(z=Ks(e.display.measure,z))}else{k>0&&(H=r="right");var re;e.options.lineWrapping&&(re=E.getClientRects()).length>1?z=re[r=="right"?re.length-1:0]:z=E.getBoundingClientRect()}if(F&&I<9&&!k&&(!z||!z.left&&!z.right)){var he=E.parentNode.getClientRects()[0];he?z={left:he.left,right:he.left+An(e.display),top:he.top,bottom:he.bottom}:z=ro}for(var ce=z.top-t.rect.top,xe=z.bottom-t.rect.top,De=(ce+xe)/2,Me=t.view.measure.heights,Ue=0;Ue<Me.length-1&&!(De<Me[Ue]);Ue++);var $e=Ue?Me[Ue-1]:0,Fe=Me[Ue],qe={left:(H=="right"?z.right:z.left)-t.rect.left,right:(H=="left"?z.left:z.right)-t.rect.left,top:$e,bottom:Fe};return!z.left&&!z.right&&(qe.bogus=!0),e.options.singleCursorHeightPerLine||(qe.rtop=ce,qe.rbottom=xe),qe}function Ks(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!gt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function io(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function ao(e){e.display.externalMeasure=null,f(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)io(e.display.view[t])}function ai(e){ao(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function oo(){return g&&u?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return g&&u?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ma(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=ii(e.widgets[n]));return t}function Ni(e,t,n,r,i){if(!i){var E=ma(t);n.top+=E,n.bottom+=E}if(r=="line")return n;r||(r="local");var k=wr(t);if(r=="local"?k+=Fi(e.display):k-=e.display.viewOffset,r=="page"||r=="window"){var j=e.display.lineSpace.getBoundingClientRect();k+=j.top+(r=="window"?0:so());var H=j.left+(r=="window"?0:oo());n.left+=H,n.right+=H}return n.top+=k,n.bottom+=k,n}function lo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=oo(),i-=so();else if(n=="local"||!n){var E=e.display.sizer.getBoundingClientRect();r+=E.left,i+=E.top}var k=e.display.lineSpace.getBoundingClientRect();return{left:r-k.left,top:i-k.top}}function pa(e,t,n,r,i){return r||(r=nt(e.doc,t.line)),Ni(e,r,to(e,r,t.ch,i),n)}function Cr(e,t,n,r,i,E){r=r||nt(e.doc,t.line),i||(i=Ln(e,r));function k(xe,De){var Me=Rr(e,i,xe,De?"right":"left",E);return De?Me.left=Me.right:Me.right=Me.left,Ni(e,r,Me,n)}var j=Ve(r,e.doc.direction),H=t.ch,z=t.sticky;if(H>=r.text.length?(H=r.text.length,z="before"):H<=0&&(H=0,z="after"),!j)return k(z=="before"?H-1:H,z=="before");function q(xe,De,Me){var Ue=j[De],$e=Ue.level==1;return k(Me?xe-1:xe,$e!=Me)}var re=Ke(j,H,z),he=He,ce=q(H,re,z=="before");return he!=null&&(ce.other=q(H,he,z!="before")),ce}function uo(e,t){var n=0;t=pt(e.doc,t),e.options.lineWrapping||(n=An(e.display)*t.ch);var r=nt(e.doc,t.line),i=wr(r)+Fi(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function ga(e,t,n,r,i){var E=Oe(e,t,n);return E.xRel=i,r&&(E.outside=r),E}function va(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return ga(r.first,0,null,-1,-1);var i=br(r,n),E=r.first+r.size-1;if(i>E)return ga(r.first+r.size-1,nt(r,E).text.length,null,1,1);t<0&&(t=0);for(var k=nt(r,i);;){var j=Hs(e,k,i,t,n),H=wn(k,j.ch+(j.xRel>0||j.outside>0?1:0));if(!H)return j;var z=H.find(1);if(z.line==i)return z;k=nt(r,i=z.line)}}function co(e,t,n,r){r-=ma(t);var i=t.text.length,E=Je(function(k){return Rr(e,n,k-1).bottom<=r},i,0);return i=Je(function(k){return Rr(e,n,k).top>r},E,i),{begin:E,end:i}}function fo(e,t,n,r){n||(n=Ln(e,t));var i=Ni(e,t,Rr(e,n,r),"line").top;return co(e,t,n,i)}function ya(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Hs(e,t,n,r,i){i-=wr(t);var E=Ln(e,t),k=ma(t),j=0,H=t.text.length,z=!0,q=Ve(t,e.doc.direction);if(q){var re=(e.options.lineWrapping?zs:Gs)(e,t,n,E,q,r,i);z=re.level!=1,j=z?re.from:re.to-1,H=z?re.to:re.from-1}var he=null,ce=null,xe=Je(function(ut){var st=Rr(e,E,ut);return st.top+=k,st.bottom+=k,ya(st,r,i,!1)?(st.top<=i&&st.left<=r&&(he=ut,ce=st),!0):!1},j,H),De,Me,Ue=!1;if(ce){var $e=r-ce.left<ce.right-r,Fe=$e==z;xe=he+(Fe?0:1),Me=Fe?"after":"before",De=$e?ce.left:ce.right}else{!z&&(xe==H||xe==j)&&xe++,Me=xe==0?"after":xe==t.text.length?"before":Rr(e,E,xe-(z?1:0)).bottom+k<=i==z?"after":"before";var qe=Cr(e,Oe(n,xe,Me),"line",t,E);De=qe.left,Ue=i<qe.top?-1:i>=qe.bottom?1:0}return xe=Le(t.text,xe,1),ga(n,xe,Me,Ue,r-De)}function Gs(e,t,n,r,i,E,k){var j=Je(function(re){var he=i[re],ce=he.level!=1;return ya(Cr(e,Oe(n,ce?he.to:he.from,ce?"before":"after"),"line",t,r),E,k,!0)},0,i.length-1),H=i[j];if(j>0){var z=H.level!=1,q=Cr(e,Oe(n,z?H.from:H.to,z?"after":"before"),"line",t,r);ya(q,E,k,!0)&&q.top>k&&(H=i[j-1])}return H}function zs(e,t,n,r,i,E,k){var j=co(e,t,r,k),H=j.begin,z=j.end;/\s/.test(t.text.charAt(z-1))&&z--;for(var q=null,re=null,he=0;he<i.length;he++){var ce=i[he];if(ce.from>=z||ce.to<=H)continue;var xe=ce.level!=1,De=Rr(e,r,xe?Math.min(z,ce.to)-1:Math.max(H,ce.from)).right,Me=De<E?E-De+1e9:De-E;(!q||re>Me)&&(q=ce,re=Me)}return q||(q=i[i.length-1]),q.from<H&&(q={from:H,to:q.to,level:q.level}),q.to>z&&(q={from:q.from,to:z,level:q.level}),q}var on;function Dn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(on==null){on=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)on.appendChild(document.createTextNode("x")),on.appendChild(a("br"));on.appendChild(document.createTextNode("x"))}d(e.measure,on);var n=on.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),f(e.measure),n||1}function An(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");d(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function ba(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,E=t.gutters.firstChild,k=0;E;E=E.nextSibling,++k){var j=e.display.gutterSpecs[k].className;n[j]=E.offsetLeft+E.clientLeft+i,r[j]=E.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ho(e){var t=Dn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/An(e.display)-3);return function(i){if(_r(e.doc,i))return 0;var E=0;if(i.widgets)for(var k=0;k<i.widgets.length;k++)i.widgets[k].height&&(E+=i.widgets[k].height);return n?E+(Math.ceil(i.text.length/r)||1)*t:E+t}}function xa(e){var t=e.doc,n=ho(e);t.iter(function(r){var i=n(r);i!=r.height&&nr(r,i)})}function sn(e,t,n,r){var i=e.display;if(!n&&se(t).getAttribute("cm-not-content")=="true")return null;var E,k,j=i.lineSpace.getBoundingClientRect();try{E=t.clientX-j.left,k=t.clientY-j.top}catch(re){return null}var H=va(e,E,k),z;if(r&&H.xRel>0&&(z=nt(e.doc,H.line).text).length==H.ch){var q=Y(z,z.length,e.options.tabSize)-z.length;H=Oe(H.line,Math.max(0,Math.round((E-qa(e.display).left)/An(e.display))-q))}return H}function ln(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 or(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)Zt&&qn(e.doc,t)<i.viewTo&&zr(e);else if(n<=i.viewFrom)Zt&&Hr(e.doc,n+r)>i.viewFrom?zr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)zr(e);else if(t<=i.viewFrom){var E=Bi(e,n,n+r,1);E?(i.view=i.view.slice(E.index),i.viewFrom=E.lineN,i.viewTo+=r):zr(e)}else if(n>=i.viewTo){var k=Bi(e,t,t,-1);k?(i.view=i.view.slice(0,k.index),i.viewTo=k.lineN):zr(e)}else{var j=Bi(e,t,t,-1),H=Bi(e,n,n+r,1);j&&H?(i.view=i.view.slice(0,j.index).concat(ar(e,j.lineN,H.lineN)).concat(i.view.slice(H.index)),i.viewTo+=r):zr(e)}var z=i.externalMeasured;z&&(n<z.lineN?z.lineN+=r:t<z.lineN+z.size&&(i.externalMeasured=null))}function Gr(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 E=r.view[ln(e,t)];if(E.node==null)return;var k=E.changes||(E.changes=[]);oe(k,n)==-1&&k.push(n)}function zr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Bi(e,t,n,r){var i=ln(e,t),E,k=e.display.view;if(!Zt||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var j=e.display.viewFrom,H=0;H<i;H++)j+=k[H].size;if(j!=t){if(r>0){if(i==k.length-1)return null;E=j+k[i].size-t,i++}else E=j-t;t+=E,n+=E}for(;qn(e.doc,n)!=n;){if(i==(r<0?0:k.length-1))return null;n+=r*k[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=ar(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=ar(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(ln(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(ar(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,ln(e,n)))),r.viewTo=n}function mo(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 oi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function po(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),E=r.selection=document.createDocumentFragment(),k=0;k<n.sel.ranges.length;k++){if(!t&&k==n.sel.primIndex)continue;var j=n.sel.ranges[k];if(j.from().line>=e.display.viewTo||j.to().line<e.display.viewFrom)continue;var H=j.empty();(H||e.options.showCursorWhenSelecting)&&go(e,j.head,i),H||Xs(e,j,E)}return r}function go(e,t,n){var r=Cr(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 E=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));E.style.display="",E.style.left=r.other.left+"px",E.style.top=r.other.top+"px",E.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function ji(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,E=document.createDocumentFragment(),k=qa(e.display),j=k.left,H=Math.max(r.sizerWidth,an(e)-r.sizer.offsetLeft)-k.right,z=i.direction=="ltr";function q(Fe,qe,ut,st){qe<0&&(qe=0),qe=Math.round(qe),st=Math.round(st),E.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Fe+`px;
|
|
top: `+qe+"px; width: "+(ut==null?H-Fe:ut)+`px;
|
|
height: `+(st-qe)+"px"))}function re(Fe,qe,ut){var st=nt(i,Fe),yt=st.text.length,Ot,Ht;function Pt(Ft,ur){return pa(e,Oe(Fe,Ft),"div",st,ur)}function fr(Ft,ur,Vt){var jt=fo(e,st,null,Ft),Nt=ur=="ltr"==(Vt=="after")?"left":"right",kt=Vt=="after"?jt.begin:jt.end-(/\s/.test(st.text.charAt(jt.end-1))?2:1);return Pt(kt,Nt)[Nt]}var lr=Ve(st,i.direction);return Ye(lr,qe||0,ut==null?yt:ut,function(Ft,ur,Vt,jt){var Nt=Vt=="ltr",kt=Pt(Ft,Nt?"left":"right"),dr=Pt(ur-1,Nt?"right":"left"),Wn=qe==null&&Ft==0,Jr=ut==null&&ur==yt,Qt=jt==0,Pr=!lr||jt==lr.length-1;if(dr.top-kt.top<=3){var Gt=(z?Wn:Jr)&&Qt,Va=(z?Jr:Wn)&&Pr,Wr=Gt?j:(Nt?kt:dr).left,hn=Va?H:(Nt?dr:kt).right;q(Wr,kt.top,hn-Wr,kt.bottom)}else{var mn,er,Kn,Xa;Nt?(mn=z&&Wn&&Qt?j:kt.left,er=z?H:fr(Ft,Vt,"before"),Kn=z?j:fr(ur,Vt,"after"),Xa=z&&Jr&&Pr?H:dr.right):(mn=z?fr(Ft,Vt,"before"):j,er=!z&&Wn&&Qt?H:kt.right,Kn=!z&&Jr&&Pr?j:dr.left,Xa=z?fr(ur,Vt,"after"):H),q(mn,kt.top,er-mn,kt.bottom),kt.bottom<dr.top&&q(j,kt.bottom,null,dr.top),q(Kn,dr.top,Xa-Kn,dr.bottom)}(!Ot||ji(kt,Ot)<0)&&(Ot=kt),ji(dr,Ot)<0&&(Ot=dr),(!Ht||ji(kt,Ht)<0)&&(Ht=kt),ji(dr,Ht)<0&&(Ht=dr)}),{start:Ot,end:Ht}}var he=t.from(),ce=t.to();if(he.line==ce.line)re(he.line,he.ch,ce.ch);else{var xe=nt(i,he.line),De=nt(i,ce.line),Me=mr(xe)==mr(De),Ue=re(he.line,he.ch,Me?xe.text.length+1:null).end,$e=re(ce.line,Me?0:null,ce.ch).start;Me&&(Ue.top<$e.top-2?(q(Ue.right,Ue.top,null,Ue.bottom),q(j,$e.top,$e.left,$e.bottom)):q(Ue.right,Ue.top,$e.left-Ue.right,Ue.bottom)),Ue.bottom<$e.top&&q(j,Ue.bottom,null,$e.top)}n.appendChild(E)}function Ta(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||_n(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function vo(e){e.state.focused||(e.display.input.focus(),Sa(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,_n(e))},100)}function Sa(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,N(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),R&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ta(e)}function _n(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(be(e,"blur",e,t),e.state.focused=!1,c(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Wi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],E=e.options.lineWrapping,k=void 0,j=0;if(i.hidden)continue;if(F&&I<8){var H=i.node.offsetTop+i.node.offsetHeight;k=H-n,n=H}else{var z=i.node.getBoundingClientRect();k=z.bottom-z.top,!E&&i.text.firstChild&&(j=i.text.firstChild.getBoundingClientRect().right-z.left-1)}var q=i.line.height-k;if((q>.005||q<-.005)&&(nr(i.line,k),bo(i.line),i.rest))for(var re=0;re<i.rest.length;re++)bo(i.rest[re]);if(j>e.display.sizerWidth){var he=Math.ceil(j/An(e.display));he>e.display.maxLineLength&&(e.display.maxLineLength=he,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function bo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Ki(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Fi(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,E=br(t,r),k=br(t,i);if(n&&n.ensure){var j=n.ensure.from.line,H=n.ensure.to.line;j<E?(E=j,k=br(t,wr(nt(t,j))+e.wrapper.clientHeight)):Math.min(H,t.lastLine())>=k&&(E=br(t,wr(nt(t,H))-e.wrapper.clientHeight),k=H)}return{from:E,to:Math.max(k,E+1)}}function Ys(e,t){if(_e(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&&!S){var E=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Fi(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Or(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(E),E.scrollIntoView(i),e.display.lineSpace.removeChild(E)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Oe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Oe(t.line,t.ch+1,"before"):t);for(var E=0;E<5;E++){var k=!1,j=Cr(e,t),H=!n||n==t?j:Cr(e,n);i={left:Math.min(j.left,H.left),top:Math.min(j.top,H.top)-r,right:Math.max(j.left,H.left),bottom:Math.max(j.bottom,H.bottom)+r};var z=wa(e,i),q=e.doc.scrollTop,re=e.doc.scrollLeft;if(z.scrollTop!=null&&(li(e,z.scrollTop),Math.abs(e.doc.scrollTop-q)>1&&(k=!0)),z.scrollLeft!=null&&(un(e,z.scrollLeft),Math.abs(e.doc.scrollLeft-re)>1&&(k=!0)),!k)break}return i}function Qs(e,t){var n=wa(e,t);n.scrollTop!=null&&li(e,n.scrollTop),n.scrollLeft!=null&&un(e,n.scrollLeft)}function wa(e,t){var n=e.display,r=Dn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,E=fa(e),k={};t.bottom-t.top>E&&(t.bottom=t.top+E);var j=e.doc.height+ca(n),H=t.top<r,z=t.bottom>j-r;if(t.top<i)k.scrollTop=H?0:t.top;else if(t.bottom>i+E){var q=Math.min(t.top,(z?j:t.bottom)-E);q!=i&&(k.scrollTop=q)}var re=e.options.fixedGutter?0:n.gutters.offsetWidth,he=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-re,ce=an(e)-n.gutters.offsetWidth,xe=t.right-t.left>ce;return xe&&(t.right=t.left+ce),t.left<10?k.scrollLeft=0:t.left<he?k.scrollLeft=Math.max(0,t.left+re-(xe?0:10)):t.right>ce+he-3&&(k.scrollLeft=t.right+(xe?0:10)-ce),k}function Ca(e,t){if(t==null)return;Hi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function On(e){Hi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function si(e,t,n){(t!=null||n!=null)&&Hi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Js(e,t){Hi(e),e.curOp.scrollToPos=t}function Hi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=uo(e,t.from),r=uo(e,t.to);Eo(e,n,r,t.margin)}}function Eo(e,t,n,r){var i=wa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});si(e,i.scrollLeft,i.scrollTop)}function li(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||Da(e,{top:t}),xo(e,t,!0),D&&Da(e),ci(e,100)}function xo(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function un(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,Lo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function ui(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ca(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Or(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var dn=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),ye(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ye(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,F&&I<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};dn.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 E=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+E)+"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}},dn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},dn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},dn.prototype.zeroWidthHack=function(){var e=s&&!L?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ee,this.disableVert=new ee},dn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),E=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);E!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},dn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var di=function(){};di.prototype.update=function(){return{bottom:0,right:0}},di.prototype.setScrollLeft=function(){},di.prototype.setScrollTop=function(){},di.prototype.clear=function(){};function Rn(e,t){t||(t=ui(e));var n=e.display.barWidth,r=e.display.barHeight;To(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Wi(e),To(e,ui(e)),n=e.display.barWidth,r=e.display.barHeight}function To(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var So={native:dn,null:di};function wo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&c(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new So[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ye(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"?un(e,t):li(e,t)},e),e.display.scrollbars.addClass&&N(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function cn(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},yr(e.curOp)}function fn(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 E=0;E<t.length;E++)nl(t[E]);for(var k=0;k<t.length;k++)il(t[k])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&Ui(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Gi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&La(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Wi(t),e.barMeasure=ui(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=to(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Or(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-an(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&&un(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==P();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Rn(t,e.barMeasure),e.updatedDisplay&&_a(t,e.barMeasure),e.selectionChanged&&Ta(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&vo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Co(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&xo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&un(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,pt(r,e.scrollToPos.from),pt(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var E=e.maybeHiddenMarkers,k=e.maybeUnhiddenMarkers;if(E)for(var j=0;j<E.length;++j)E[j].lines.length||be(E[j],"hide");if(k)for(var H=0;H<k.length;++H)k[H].lines.length&&be(k[H],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&be(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function cr(e,t){if(e.curOp)return t();cn(e);try{return t()}finally{fn(e)}}function Wt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);cn(e);try{return t.apply(e,arguments)}finally{fn(e)}}}function qt(e){return function(){if(this.curOp)return e.apply(this,arguments);cn(this);try{return e.apply(this,arguments)}finally{fn(this)}}}function Kt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);cn(t);try{return e.apply(this,arguments)}finally{fn(t)}}}function ci(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=Er(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(E){if(r.line>=e.display.viewFrom){var k=E.styles,j=E.text.length>e.options.maxHighlightLength?Ar(t.mode,r.state):null,H=Vn(e,E,r,!0);j&&(r.state=j),E.styles=H.styles;var z=E.styleClasses,q=H.classes;q?E.styleClasses=q:z&&(E.styleClasses=null);for(var re=!k||k.length!=E.styles.length||z!=q&&(!z||!q||z.bgClass!=q.bgClass||z.textClass!=q.textClass),he=0;!re&&he<k.length;++he)re=k[he]!=E.styles[he];re&&i.push(r.line),E.stateAfter=r.save(),r.nextLine()}else E.text.length<=e.options.maxHighlightLength&&Xn(e,E.text,r),E.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return ci(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&cr(e,function(){for(var E=0;E<i.length;E++)Gr(e,i[E],"text")})}var Gi=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=an(e),this.force=n,this.dims=ba(e),this.events=[]};Gi.prototype.signal=function(e,t){ne(e,t)&&this.events.push(arguments)},Gi.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=Or(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Or(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=P();if(!t||!x(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&x(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==P())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&x(document.body,e.anchorNode)&&x(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function La(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return zr(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&&mo(e)==0)return!1;Do(e)&&(zr(e),t.dims=ba(e));var i=r.first+r.size,E=Math.max(t.visible.from-e.options.viewportMargin,r.first),k=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<E&&E-n.viewFrom<20&&(E=Math.max(r.first,n.viewFrom)),n.viewTo>k&&n.viewTo-k<20&&(k=Math.min(i,n.viewTo)),Zt&&(E=qn(e.doc,E),k=Hr(e.doc,k));var j=E!=n.viewFrom||k!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,E,k),n.viewOffset=wr(nt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var H=mo(e);if(!j&&H==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var z=sl(e);return H>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),H>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(z),f(n.cursorDiv),f(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,j&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ci(e,400)),n.updateLineNumbers=null,!0}function Co(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==an(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ca(e.display)-fa(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(!La(e,t))break;Wi(e);var i=ui(e);oi(e),Rn(e,i),_a(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Da(e,t){var n=new Gi(e,t);if(La(e,n)){Wi(e),Co(e,n);var r=ui(e);oi(e),Rn(e,r),_a(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,E=r.lineDiv,k=E.firstChild;function j(xe){var De=xe.nextSibling;return R&&s&&e.display.currentWheelTarget==xe?xe.style.display="none":xe.parentNode.removeChild(xe),De}for(var H=r.view,z=r.viewFrom,q=0;q<H.length;q++){var re=H[q];if(!re.hidden)if(!re.node||re.node.parentNode!=E){var he=Us(e,re,z,n);E.insertBefore(he,k)}else{for(;k!=re.node;)k=j(k);var ce=i&&t!=null&&t<=z&&re.lineNumber;re.changes&&(oe(re.changes,"gutter")>-1&&(ce=!1),Ya(e,re,z,n)),ce&&(f(re.lineNumber),re.lineNumber.appendChild(document.createTextNode(gn(e.options,z)))),k=re.node.nextSibling}z+=re.size}for(;k;)k=j(k)}function Aa(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function _a(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Or(e)+"px"}function Lo(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,E=r+"px",k=0;k<n.length;k++)if(!n[k].hidden){e.options.fixedGutter&&(n[k].gutter&&(n[k].gutter.style.left=E),n[k].gutterBackground&&(n[k].gutterBackground.style.left=E));var j=n[k].alignable;if(j)for(var H=0;H<j.length;H++)j[H].style.left=E}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Do(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=gn(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")),E=i.firstChild.offsetWidth,k=i.offsetWidth-E;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(E,r.lineGutter.offsetWidth-k)+1,r.lineNumWidth=r.lineNumInnerWidth+k,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Aa(e.display),!0}return!1}function Oa(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var E=e[i],k=null;if(typeof E!="string"&&(k=E.style,E=E.className),E=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:E,style:k})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Ao(e){var t=e.gutters,n=e.gutterSpecs;f(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],E=i.className,k=i.style,j=t.appendChild(a("div",null,"CodeMirror-gutter "+E));k&&(j.style.cssText=k),E=="CodeMirror-linenumbers"&&(e.lineGutter=j,j.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Aa(e)}function fi(e){Ao(e.display),or(e),Lo(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=b("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=b("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var E=b("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[E],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+de+"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"),F&&I<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!R&&!(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=Oa(r.gutters,r.lineNumbers),Ao(i),n.init(i)}var zi=0,pr=null;F?pr=-.53:D?pr=15:g?pr=-.7:A&&(pr=-1/3);function _o(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=_o(e);return t.x*=pr,t.y*=pr,t}function Oo(e,t){var n=_o(t),r=n.x,i=n.y,E=e.display,k=E.scroller,j=k.scrollWidth>k.clientWidth,H=k.scrollHeight>k.clientHeight;if(!(r&&j||i&&H))return;if(i&&s&&R){e:for(var z=t.target,q=E.view;z!=k;z=z.parentNode)for(var re=0;re<q.length;re++)if(q[re].node==z){e.display.currentWheelTarget=z;break e}}if(r&&!D&&!T&&pr!=null){i&&H&&li(e,Math.max(0,k.scrollTop+i*pr)),un(e,Math.max(0,k.scrollLeft+r*pr)),(!i||i&&H)&&X(t),E.wheelStartX=null;return}if(i&&pr!=null){var he=i*pr,ce=e.doc.scrollTop,xe=ce+E.wrapper.clientHeight;he<0?ce=Math.max(0,ce+he-50):xe=Math.min(e.doc.height,xe+he+50),Da(e,{top:ce,bottom:xe})}zi<20&&(E.wheelStartX==null?(E.wheelStartX=k.scrollLeft,E.wheelStartY=k.scrollTop,E.wheelDX=r,E.wheelDY=i,setTimeout(function(){if(E.wheelStartX==null)return;var De=k.scrollLeft-E.wheelStartX,Me=k.scrollTop-E.wheelStartY,Ue=Me&&E.wheelDY&&Me/E.wheelDY||De&&E.wheelDX&&De/E.wheelDX;if(E.wheelStartX=E.wheelStartY=null,!Ue)return;pr=(pr*zi+Ue)/(zi+1),++zi},200)):(E.wheelDX+=r,E.wheelDY+=i))}var gr=function(e,t){this.ranges=e,this.primIndex=t};gr.prototype.primary=function(){return this.ranges[this.primIndex]},gr.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(!zn(n.anchor,r.anchor)||!zn(n.head,r.head))return!1}return!0},gr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Dt(vn(this.ranges[t].anchor),vn(this.ranges[t].head));return new gr(e,this.primIndex)},gr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},gr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ht(t,r.from())>=0&&ht(e,r.to())<=0)return n}return-1};var Dt=function(e,t){this.anchor=e,this.head=t};Dt.prototype.from=function(){return Zr(this.anchor,this.head)},Dt.prototype.to=function(){return yn(this.anchor,this.head)},Dt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Lr(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(he,ce){return ht(he.from(),ce.from())}),n=oe(t,i);for(var E=1;E<t.length;E++){var k=t[E],j=t[E-1],H=ht(j.to(),k.from());if(r&&!k.empty()?H>0:H>=0){var z=Zr(j.from(),k.from()),q=yn(j.to(),k.to()),re=j.empty()?k.from()==k.head:j.from()==j.head;E<=n&&--n,t.splice(--E,2,new Dt(re?q:z,re?z:q))}}return new gr(t,n)}function Vr(e,t){return new gr([new Dt(e,t||e)],0)}function Xr(e){return e.text?Oe(e.from.line+e.text.length-1,Ee(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ro(e,t){if(ht(e,t.from)<0)return e;if(ht(e,t.to)<=0)return Xr(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+=Xr(t).ch-t.to.ch),Oe(n,r)}function Ra(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new Dt(Ro(i.anchor,t),Ro(i.head,t)))}return Lr(e.cm,n,e.sel.primIndex)}function Po(e,t,n){return e.line==t.line?Oe(n.line,e.ch-t.ch+n.ch):Oe(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Oe(e.first,0),E=i,k=0;k<t.length;k++){var j=t[k],H=Po(j.from,i,E),z=Po(Xr(j),i,E);if(i=j.to,E=z,n=="around"){var q=e.sel.ranges[k],re=ht(q.head,q.anchor)<0;r[k]=new Dt(re?z:H,re?H:z)}else r[k]=new Dt(H,H)}return new gr(r,e.sel.primIndex)}function Pa(e){e.doc.mode=tr(e.options,e.doc.modeOption),hi(e)}function hi(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,ci(e,100),e.state.modeGen++,e.curOp&&or(e)}function Mo(e,t){return t.from.ch==0&&t.to.ch==0&&Ee(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ma(e,t,n,r){function i($e){return n?n[$e]:null}function E($e,Fe,qe){ua($e,Fe,qe,r),zt($e,"change",$e,t)}function k($e,Fe){for(var qe=[],ut=$e;ut<Fe;++ut)qe.push(new nn(z[ut],i(ut),r));return qe}var j=t.from,H=t.to,z=t.text,q=nt(e,j.line),re=nt(e,H.line),he=Ee(z),ce=i(z.length-1),xe=H.line-j.line;if(t.full)e.insert(0,k(0,z.length)),e.remove(z.length,e.size-z.length);else if(Mo(e,t)){var De=k(0,z.length-1);E(re,re.text,ce),xe&&e.remove(j.line,xe),De.length&&e.insert(j.line,De)}else if(q==re)if(z.length==1)E(q,q.text.slice(0,j.ch)+he+q.text.slice(H.ch),ce);else{var Me=k(1,z.length-1);Me.push(new nn(he+q.text.slice(H.ch),ce,r)),E(q,q.text.slice(0,j.ch)+z[0],i(0)),e.insert(j.line+1,Me)}else if(z.length==1)E(q,q.text.slice(0,j.ch)+z[0]+re.text.slice(H.ch),i(0)),e.remove(j.line+1,xe);else{E(q,q.text.slice(0,j.ch)+z[0],i(0)),E(re,he+re.text.slice(H.ch),ce);var Ue=k(1,z.length-1);xe>1&&e.remove(j.line+1,xe-1),e.insert(j.line+1,Ue)}zt(e,"change",e,t)}function Yr(e,t,n){function r(i,E,k){if(i.linked)for(var j=0;j<i.linked.length;++j){var H=i.linked[j];if(H.doc==E)continue;var z=k&&H.sharedHist;if(n&&!z)continue;t(H.doc,z),r(H.doc,i,z)}}r(e,null,!0)}function ko(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,xa(e),Pa(e),Io(e),e.options.lineWrapping||Ui(e),e.options.mode=t.modeOption,or(e)}function Io(e){(e.doc.direction=="rtl"?N:c)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){cr(e,function(){Io(e),or(e)})}function Vi(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function ka(e,t){var n={from:vn(t.from),to:Xr(t),text:Mr(e,t.from,t.to)};return No(e,n,t.from.line,t.to.line+1),Yr(e,function(r){return No(r,n,t.from.line,t.to.line+1)},!0),n}function Uo(e){for(;e.length;){var t=Ee(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Uo(e.done),Ee(e.done);if(e.done.length&&!Ee(e.done).ranges)return Ee(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Ee(e.done)}function Fo(e,t,n,r){var i=e.history;i.undone.length=0;var E=+new Date,k,j;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>E-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(k=ml(i,i.lastOp==r)))j=Ee(k.changes),ht(t.from,t.to)==0&&ht(t.from,j.to)==0?j.to=Xr(t):k.changes.push(ka(e,t));else{var H=Ee(i.done);for((!H||!H.ranges)&&Xi(e.sel,i.done),k={changes:[ka(e,t)],generation:i.generation},i.done.push(k);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=E,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,E=r&&r.origin;n==i.lastSelOp||E&&i.lastSelOrigin==E&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==E||pl(e,E,Ee(i.done),t))?i.done[i.done.length-1]=t:Xi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=E,i.lastSelOp=n,r&&r.clearRedo!==!1&&Uo(i.undone)}function Xi(e,t){var n=Ee(t);n&&n.ranges&&n.equals(e)||t.push(e)}function No(e,t,n,r){var i=t["spans_"+e.id],E=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(k){k.markedSpans&&((i||(i=t["spans_"+e.id]={}))[E]=k.markedSpans),++E})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function Bo(e,t){var n=yl(e,t),r=xn(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var E=n[i],k=r[i];if(E&&k){e:for(var j=0;j<k.length;++j){for(var H=k[j],z=0;z<E.length;++z)if(E[z].marker==H.marker)continue e;E.push(H)}}else k&&(n[i]=k)}return n}function Pn(e,t,n){for(var r=[],i=0;i<e.length;++i){var E=e[i];if(E.ranges){r.push(n?gr.prototype.deepCopy.call(E):E);continue}var k=E.changes,j=[];r.push({changes:j});for(var H=0;H<k.length;++H){var z=k[H],q=void 0;if(j.push({from:z.from,to:z.to,text:z.text}),t)for(var re in z)(q=re.match(/^spans_(\d+)$/))&&(oe(t,Number(q[1]))>-1&&(Ee(j)[re]=z[re],delete z[re]))}}return r}function Ia(e,t,n,r){if(r){var i=e.anchor;if(n){var E=ht(t,i)<0;E!=ht(n,i)<0?(i=t,t=n):E!=ht(t,n)<0&&(t=n)}return new Dt(i,t)}else return new Dt(n||t,t)}function Yi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),$t(e,new gr([Ia(e.sel.primary(),t,n,i)],0),r)}function jo(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),E=0;E<e.sel.ranges.length;E++)r[E]=Ia(e.sel.ranges[E],t[E],null,i);var k=Lr(e.cm,r,e.sel.primIndex);$t(e,k,n)}function Ua(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,$t(e,Lr(e.cm,i,e.sel.primIndex),r)}function Wo(e,t,n,r){$t(e,Vr(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var E=0;E<i.length;E++)this.ranges[E]=new Dt(pt(e,i[E].anchor),pt(e,i[E].head))},origin:n&&n.origin};return be(e,"beforeSelectionChange",e,r),e.cm&&be(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Lr(e.cm,r.ranges,r.ranges.length-1):t}function Ko(e,t,n){var r=e.history.done,i=Ee(r);i&&i.ranges?(r[r.length-1]=t,$i(e,t,n)):$t(e,t,n)}function $t(e,t,n){$i(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function $i(e,t,n){(ne(e,"beforeSelectionChange")||e.cm&&ne(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(ht(t.primary().head,e.sel.primary().head)<0?-1:1);Ho(e,zo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&On(e.cm)}function Ho(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,le(e.cm)),zt(e,"cursorActivity",e)}function Go(e){Ho(e,zo(e,e.sel,null,!1))}function zo(e,t,n,r){for(var i,E=0;E<t.ranges.length;E++){var k=t.ranges[E],j=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[E],H=Qi(e,k.anchor,j&&j.anchor,n,r),z=Qi(e,k.head,j&&j.head,n,r);(i||H!=k.anchor||z!=k.head)&&(i||(i=t.ranges.slice(0,E)),i[E]=new Dt(H,z))}return i?Lr(e.cm,i,t.primIndex):t}function Mn(e,t,n,r,i){var E=nt(e,t.line);if(E.markedSpans)for(var k=0;k<E.markedSpans.length;++k){var j=E.markedSpans[k],H=j.marker,z="selectLeft"in H?!H.selectLeft:H.inclusiveLeft,q="selectRight"in H?!H.selectRight:H.inclusiveRight;if((j.from==null||(z?j.from<=t.ch:j.from<t.ch))&&(j.to==null||(q?j.to>=t.ch:j.to>t.ch))){if(i&&(be(H,"beforeCursorEnter"),H.explicitlyCleared))if(E.markedSpans){--k;continue}else break;if(!H.atomic)continue;if(n){var re=H.find(r<0?1:-1),he=void 0;if((r<0?q:z)&&(re=Vo(e,re,-r,re&&re.line==t.line?E:null)),re&&re.line==t.line&&(he=ht(re,n))&&(r<0?he<0:he>0))return Mn(e,re,t,r,i)}var ce=H.find(r<0?-1:1);return(r<0?z:q)&&(ce=Vo(e,ce,r,ce.line==t.line?E:null)),ce?Mn(e,ce,t,r,i):null}}return t}function Qi(e,t,n,r,i){var E=r||1,k=Mn(e,t,n,E,i)||!i&&Mn(e,t,n,E,!0)||Mn(e,t,n,-E,i)||!i&&Mn(e,t,n,-E,!0);return k||(e.cantEdit=!0,Oe(e.first,0))}function Vo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?pt(e,Oe(t.line-1)):null:n>0&&t.ch==(r||nt(e,t.line)).text.length?t.line<e.first+e.size-1?Oe(t.line+1,0):null:new Oe(t.line,t.ch+n)}function Xo(e){e.setSelection(Oe(e.firstLine(),0),Oe(e.lastLine()),ge)}function Yo(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,E,k,j){i&&(r.from=pt(e,i)),E&&(r.to=pt(e,E)),k&&(r.text=k),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 kn(e,t,n){if(e.cm){if(!e.cm.curOp)return Wt(e.cm,kn)(e,t,n);if(e.cm.state.suppressEdits)return}if((ne(e,"beforeChange")||e.cm&&ne(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=Jn&&!n&&Mi(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)$o(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else $o(e,t)}function $o(e,t){if(t.text.length==1&&t.text[0]==""&&ht(t.from,t.to)==0)return;var n=Ra(e,t);Fo(e,t,n,e.cm?e.cm.curOp.id:NaN),mi(e,t,n,xn(e,t));var r=[];Yr(e,function(i,E){!E&&oe(r,i.history)==-1&&(qo(i.history,t),r.push(i.history)),mi(i,t,null,xn(i,t))})}function Ji(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,E,k=e.sel,j=t=="undo"?i.done:i.undone,H=t=="undo"?i.undone:i.done,z=0;z<j.length&&!(E=j[z],n?E.ranges&&!E.equals(e.sel):!E.ranges);z++);if(z==j.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(E=j.pop(),E.ranges){if(Xi(E,H),n&&!E.equals(e.sel)){$t(e,E,{clearRedo:!1});return}k=E}else if(r){j.push(E);return}else break;var q=[];Xi(k,H),H.push({changes:q,generation:i.generation}),i.generation=E.generation||++i.maxGeneration;for(var re=ne(e,"beforeChange")||e.cm&&ne(e.cm,"beforeChange"),he=function(De){var Me=E.changes[De];if(Me.origin=t,re&&!Yo(e,Me,!1))return j.length=0,{};q.push(ka(e,Me));var Ue=De?Ra(e,Me):Ee(j);mi(e,Me,Ue,Bo(e,Me)),!De&&e.cm&&e.cm.scrollIntoView({from:Me.from,to:Xr(Me)});var $e=[];Yr(e,function(Fe,qe){!qe&&oe($e,Fe.history)==-1&&(qo(Fe.history,Me),$e.push(Fe.history)),mi(Fe,Me,null,Bo(Fe,Me))})},ce=E.changes.length-1;ce>=0;--ce){var xe=he(ce);if(xe)return xe.v}}function Qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new gr(Ie(e.sel.ranges,function(i){return new Dt(Oe(i.anchor.line+t,i.anchor.ch),Oe(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){or(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Gr(e.cm,r,"gutter")}}function mi(e,t,n,r){if(e.cm&&!e.cm.curOp)return Wt(e.cm,mi)(e,t,n,r);if(t.to.line<e.first){Qo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Qo(e,i),t={from:Oe(e.first,0),to:Oe(t.to.line+i,t.to.ch),text:[Ee(t.text)],origin:t.origin}}var E=e.lastLine();t.to.line>E&&(t={from:t.from,to:Oe(E,nt(e,E).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Mr(e,t.from,t.to),n||(n=Ra(e,t)),e.cm?El(e.cm,t,r):Ma(e,t,r),$i(e,n,ge),e.cantEdit&&Qi(e,Oe(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,E=t.from,k=t.to,j=!1,H=E.line;e.options.lineWrapping||(H=wt(mr(nt(r,E.line))),r.iter(H,k.line+1,function(ce){if(ce==i.maxLine)return j=!0,!0})),r.sel.contains(t.from,t.to)>-1&&le(e),Ma(r,t,n,ho(e)),e.options.lineWrapping||(r.iter(H,E.line+t.text.length,function(ce){var xe=ti(ce);xe>i.maxLineLength&&(i.maxLine=ce,i.maxLineLength=xe,i.maxLineChanged=!0,j=!1)}),j&&(e.curOp.updateMaxLine=!0)),aa(r,E.line),ci(e,400);var z=t.text.length-(k.line-E.line)-1;t.full?or(e):E.line==k.line&&t.text.length==1&&!Mo(e.doc,t)?Gr(e,E.line,"text"):or(e,E.line,k.line+1,z);var q=ne(e,"changes"),re=ne(e,"change");if(re||q){var he={from:E,to:k,text:t.text,removed:t.removed,origin:t.origin};re&&zt(e,"change",e,he),q&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(he)}e.display.selForContextMenu=null}function In(e,t,n,r,i){var E;r||(r=n),ht(r,n)<0&&(E=[r,n],n=E[0],r=E[1]),typeof t=="string"&&(t=e.splitLines(t)),kn(e,{from:n,to:r,text:t,origin:i})}function Jo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Zo(e,t,n,r){for(var i=0;i<e.length;++i){var E=e[i],k=!0;if(E.ranges){E.copied||(E=e[i]=E.deepCopy(),E.copied=!0);for(var j=0;j<E.ranges.length;j++)Jo(E.ranges[j].anchor,t,n,r),Jo(E.ranges[j].head,t,n,r);continue}for(var H=0;H<E.changes.length;++H){var z=E.changes[H];if(n<z.from.line)z.from=Oe(z.from.line+r,z.from.ch),z.to=Oe(z.to.line+r,z.to.ch);else if(t<=z.to.line){k=!1;break}}k||(e.splice(0,i+1),i=0)}}function qo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Zo(e.done,n,r,i),Zo(e.undone,n,r,i)}function pi(e,t,n,r){var i=t,E=t;return typeof t=="number"?E=nt(e,bn(e,t)):i=wt(t),i==null?null:(r(E,i)&&e.cm&&Gr(e.cm,i,n),E)}function gi(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}gi.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,it(i),zt(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 vi(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}vi.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 E=Math.min(t,i-e),k=r.height;if(r.removeInner(e,E),this.height-=k-r.height,i==E&&(this.children.splice(n--,1),r.parent=null),(t-=E)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof gi))){var j=[];this.collapse(j),this.children=[new gi(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],E=i.chunkSize();if(e<=E){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var k=i.lines.length%25+25,j=k;j<i.lines.length;){var H=new gi(i.lines.slice(j,j+=25));i.height-=H.height,this.children.splice(++r,0,H),H.parent=this}i.lines=i.lines.slice(0,k),this.maybeSpill()}break}e-=E}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new vi(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=oe(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new vi(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],E=i.chunkSize();if(e<E){var k=Math.min(t,E-e);if(i.iterN(e,k,n))return!0;if((t-=k)==0)break;e=0}else e-=E}}};var yi=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};yi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=wt(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 E=ii(this);nr(n,Math.max(0,n.height-E)),e&&(cr(e,function(){es(e,n,-E),Gr(e,r,"widget")}),zt(e,"lineWidgetCleared",e,this,r))},yi.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ii(this)-t;if(!i)return;_r(this.doc,r)||nr(r,r.height+i),n&&cr(n,function(){n.curOp.forceUpdate=!0,es(n,r,i),zt(n,"lineWidgetChanged",n,e,wt(r))})},ie(yi);function es(e,t,n){wr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ca(e,n)}function xl(e,t,n,r){var i=new yi(e,n,r),E=e.cm;return E&&i.noHScroll&&(E.display.alignWidgets=!0),pi(e,t,"widget",function(k){var j=k.widgets||(k.widgets=[]);if(i.insertAt==null?j.push(i):j.splice(Math.min(j.length-1,Math.max(0,i.insertAt)),0,i),i.line=k,E&&!_r(e,k)){var H=wr(k)<e.scrollTop;nr(k,k.height+ii(i)),H&&Ca(E,i.height),E.curOp.forceUpdate=!0}return!0}),E&&zt(E,"lineWidgetAdded",E,i,typeof t=="number"?t:wt(t)),i}var ts=0,$r=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};$r.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&cn(e),ne(this,"clear")){var n=this.find();n&&zt(this,"clear",n.from,n.to)}for(var r=null,i=null,E=0;E<this.lines.length;++E){var k=this.lines[E],j=Sr(k.markedSpans,this);e&&!this.collapsed?Gr(e,wt(k),"text"):e&&(j.to!=null&&(i=wt(k)),j.from!=null&&(r=wt(k))),k.markedSpans=Zn(k.markedSpans,j),j.from==null&&this.collapsed&&!_r(this.doc,k)&&e&&nr(k,Dn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var H=0;H<this.lines.length;++H){var z=mr(this.lines[H]),q=ti(z);q>e.display.maxLineLength&&(e.display.maxLine=z,e.display.maxLineLength=q,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&or(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Go(e.doc)),e&&zt(e,"markerCleared",e,this,r,i),t&&fn(e),this.parent&&this.parent.clear()},$r.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var E=this.lines[i],k=Sr(E.markedSpans,this);if(k.from!=null&&(n=Oe(t?E:wt(E),k.from),e==-1))return n;if(k.to!=null&&(r=Oe(t?E:wt(E),k.to),e==1))return r}return n&&{from:n,to:r}},$r.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;cr(r,function(){var i=t.line,E=wt(t.line),k=ha(r,E);if(k&&(io(k),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!_r(n.doc,i)&&n.height!=null){var j=n.height;n.height=null;var H=ii(n)-j;H&&nr(i,i.height+H)}zt(r,"markerChanged",r,e)})},$r.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||oe(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},$r.prototype.detachLine=function(e){if(this.lines.splice(oe(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ie($r);function Un(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Wt(e.cm,Un)(e,t,n,r,i);var E=new $r(e,i),k=ht(t,n);if(r&&U(r,E,!1),k>0||k==0&&E.clearWhenEmpty!==!1)return E;if(E.replacedWith&&(E.collapsed=!0,E.widgetNode=b("span",[E.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||E.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(E.widgetNode.insertLeft=!0)),E.collapsed){if(ki(e,t.line,t,n,E)||t.line!=n.line&&ki(e,n.line,t,n,E))throw new Error("Inserting collapsed marker partially overlapping an existing one");oa()}E.addToHistory&&Fo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var j=t.line,H=e.cm,z;if(e.iter(j,n.line+1,function(re){H&&E.collapsed&&!H.options.lineWrapping&&mr(re)==H.display.maxLine&&(z=!0),E.collapsed&&j!=t.line&&nr(re,0),sa(re,new en(E,j==t.line?t.ch:null,j==n.line?n.ch:null)),++j}),E.collapsed&&e.iter(t.line,n.line+1,function(re){_r(e,re)&&nr(re,0)}),E.clearOnEnter&&ye(E,"beforeCursorEnter",function(){return E.clear()}),E.readOnly&&(Kr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),E.collapsed&&(E.id=++ts,E.atomic=!0),H){if(z&&(H.curOp.updateMaxLine=!0),E.collapsed)or(H,t.line,n.line+1);else if(E.className||E.startStyle||E.endStyle||E.css||E.attributes||E.title)for(var q=t.line;q<=n.line;q++)Gr(H,q,"text");E.atomic&&Go(H.doc),zt(H,"markerAdded",H,E)}return E}var bi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};bi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();zt(this,"clear")},bi.prototype.find=function(e,t){return this.primary.find(e,t)},ie(bi);function Tl(e,t,n,r,i){r=U(r),r.shared=!1;var E=[Un(e,t,n,r,i)],k=E[0],j=r.widgetNode;return Yr(e,function(H){j&&(r.widgetNode=j.cloneNode(!0)),E.push(Un(H,pt(H,t),pt(H,n),r,i));for(var z=0;z<H.linked.length;++z)if(H.linked[z].isParent)return;k=Ee(E)}),new bi(E,k)}function rs(e){return e.findMarks(Oe(e.first,0),e.clipPos(Oe(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(),E=e.clipPos(i.from),k=e.clipPos(i.to);if(ht(E,k)){var j=Un(e,E,k,r.primary,r.primary.type);r.markers.push(j),j.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],E=[i.primary.doc];Yr(i.primary.doc,function(H){return E.push(H)});for(var k=0;k<i.markers.length;k++){var j=i.markers[k];oe(E,j.doc)==-1&&(j.parent=null,i.markers.splice(k--,1))}},n=0;n<e.length;n++)t(n)}var Cl=0,sr=function(e,t,n,r,i){if(!(this instanceof sr))return new sr(e,t,n,r,i);n==null&&(n=0),vi.call(this,[new gi([new nn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var E=Oe(n,0);this.sel=Vr(E),this.history=new Vi(null),this.id=++Cl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ma(this,{from:E,to:E,text:e}),$t(this,Vr(E),ge)};sr.prototype=Ne(vi.prototype,{constructor:sr,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=pn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Kt(function(e){var t=Oe(this.first,0),n=this.first+this.size-1;kn(this,{from:t,to:Oe(n,nt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&si(this.cm,0,0),$t(this,Vr(t),ge)}),replaceRange:function(e,t,n,r){t=pt(this,t),n=n?pt(this,n):t,In(this,e,t,n,r)},getRange:function(e,t,n){var r=Mr(this,pt(this,e),pt(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(kr(this,e))return nt(this,e)},getLineNumber:function(e){return wt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=nt(this,e)),mr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return pt(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){Wo(this,pt(this,typeof e=="number"?Oe(e,t||0):e),null,n)}),setSelection:Kt(function(e,t,n){Wo(this,pt(this,e),pt(this,t||e),n)}),extendSelection:Kt(function(e,t,n){Yi(this,pt(this,e),t&&pt(this,t),n)}),extendSelections:Kt(function(e,t){jo(this,Pe(this,e),t)}),extendSelectionsBy:Kt(function(e,t){var n=Ie(this.sel.ranges,e);jo(this,Pe(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 Dt(pt(this,e[i].anchor),pt(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),$t(this,Lr(this.cm,r,t),n)}),addSelection:Kt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Dt(pt(this,e),pt(this,t||e))),$t(this,Lr(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=Mr(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=Mr(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,E=0;E<i.ranges.length;E++){var k=i.ranges[E];r[E]={from:k.from(),to:k.to(),text:this.splitLines(e[E]),origin:n}}for(var j=t&&t!="end"&&fl(this,r,t),H=r.length-1;H>=0;H--)kn(this,r[H]);j?Ko(this,j):this.cm&&On(this.cm)}),undo:Kt(function(){Ji(this,"undo")}),redo:Kt(function(){Ji(this,"redo")}),undoSelection:Kt(function(){Ji(this,"undo",!0)}),redoSelection:Kt(function(){Ji(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Vi(this.history.maxGeneration),Yr(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:Pn(this.history.done),undone:Pn(this.history.undone)}},setHistory:function(e){var t=this.history=new Vi(this.history.maxGeneration);t.done=Pn(e.done.slice(0),null,!0),t.undone=Pn(e.undone.slice(0),null,!0)},setGutterMarker:Kt(function(e,t,n){return pi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Be(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Kt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&pi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Be(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!kr(this,e))return null;if(t=e,e=nt(this,e),!e)return null}else if(t=wt(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 pi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(v(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Kt(function(e,t,n){return pi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",E=r[i];if(E)if(n==null)r[i]=null;else{var k=E.match(v(n));if(!k)return!1;var j=k.index+k[0].length;r[i]=E.slice(0,k.index)+(!k.index||j==E.length?"":" ")+E.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 Un(this,pt(this,e),pt(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=pt(this,e),Un(this,e,e,n,"bookmark")},findMarksAt:function(e){e=pt(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=pt(this,e),t=pt(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(E){var k=E.markedSpans;if(k)for(var j=0;j<k.length;j++){var H=k[j];!(H.to!=null&&i==e.line&&e.ch>=H.to||H.from==null&&i!=e.line||H.from!=null&&i==t.line&&H.from>=t.ch)&&(!n||n(H.marker))&&r.push(H.marker.parent||H.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 E=i.text.length+r;if(E>e)return t=e,!0;e-=E,++n}),pt(this,Oe(n,t))},indexFromPos:function(e){e=pt(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 sr(pn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new sr(pn(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(r,rs(this)),r},unlinkDoc:function(e){if(e instanceof Rt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(rs(this));break}if(e.history==this.history){var r=[e.id];Yr(e,function(i){return r.push(i.id)},!0),e.history=new Vi(null),e.history.done=Pn(this.history.done,r),e.history.undone=Pn(this.history.undone,r)}},iterLinkedDocs:function(e){Yr(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)})}),sr.prototype.eachLine=sr.prototype.iter;var ns=0;function Ll(e){var t=this;if(is(t),_e(t,e)||Br(t.display,e))return;X(e),F&&(ns=+new Date);var n=sn(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,E=Array(i),k=0,j=function(){++k==i&&Wt(t,function(){n=pt(t.doc,n);var ce={from:n,to:n,text:t.doc.splitLines(E.filter(function(xe){return xe!=null}).join(t.doc.lineSeparator())),origin:"paste"};kn(t.doc,ce),Ko(t.doc,Vr(pt(t.doc,n),pt(t.doc,Xr(ce))))})()},H=function(ce,xe){if(t.options.allowDropFileTypes&&oe(t.options.allowDropFileTypes,ce.type)==-1){j();return}var De=new FileReader;De.onerror=function(){return j()},De.onload=function(){var Me=De.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Me)){j();return}E[xe]=Me,j()},De.readAsText(ce)},z=0;z<r.length;z++)H(r[z],z);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 q=e.dataTransfer.getData("Text");if(q){var re;if(t.state.draggingText&&!t.state.draggingText.copy&&(re=t.listSelections()),$i(t.doc,Vr(n,n)),re)for(var he=0;he<re.length;++he)In(t.doc,"",re[he].anchor,re[he].head,"drag");t.replaceSelection(q,"around","paste"),t.display.input.focus()}}catch(ce){}}}function Dl(e,t){if(F&&(!e.state.draggingText||+new Date-ns<100)){te(t);return}if(_e(e,t)||Br(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!A){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=sn(e,t);if(!n)return;var r=document.createDocumentFragment();go(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),d(e.display.dragCursor,r)}function is(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function as(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var E=0;E<n.length;E++)e(n[E])})}var os=!1;function _l(){if(os)return;Ol(),os=!0}function Ol(){var e;ye(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(Rl)},100))}),ye(window,"blur",function(){return as(_n)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Qr={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"},Ei=0;Ei<10;Ei++)Qr[Ei+48]=Qr[Ei+96]=String(Ei);for(var Zi=65;Zi<=90;Zi++)Qr[Zi]=String.fromCharCode(Zi);for(var xi=1;xi<=12;xi++)Qr[xi+111]=Qr[xi+63235]="F"+xi;var jr={};jr.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"},jr.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"},jr.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"},jr.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"]},jr.default=s?jr.macDefault:jr.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,E,k=0;k<t.length-1;k++){var j=t[k];if(/^(cmd|meta|m)$/i.test(j))E=!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),E&&(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=Ie(n.split(" "),Pl),E=0;E<i.length;E++){var k=void 0,j=void 0;E==i.length-1?(j=i.join(" "),k=r):(j=i.slice(0,E+1).join(" "),k="...");var H=t[j];if(!H)t[j]=k;else if(H!=k)throw new Error("Inconsistent bindings for "+j)}delete e[n]}for(var z in t)e[z]=t[z];return e}function Fn(e,t,n,r){t=qi(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Fn(e,t.fallthrough,n,r);for(var E=0;E<t.fallthrough.length;E++){var k=Fn(e,t.fallthrough[E],n,r);if(k)return k}}}function ss(e){var t=typeof e=="string"?e:Qr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ls(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(h?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(h?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function us(e,t){if(T&&e.keyCode==34&&e.char)return!1;var n=Qr[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),ls(n,e,t))}function qi(e){return typeof e=="string"?jr[e]:e}function Nn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var E=t(n[i]);r.length&&ht(E.from,Ee(r).to)<=0;){var k=r.pop();if(ht(k.from,E.from)<0){E.from=k.from;break}}r.push(E)}cr(e,function(){for(var j=r.length-1;j>=0;j--)In(e.doc,"",r[j].from,r[j].to,"+delete");On(e)})}function Fa(e,t,n){var r=Le(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Na(e,t,n){var r=Fa(e,t.ch,n);return r==null?null:new Oe(t.line,r,n<0?"after":"before")}function Ba(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var E=Ve(n,t.doc.direction);if(E){var k=i<0?Ee(E):E[0],j=i<0==(k.level==1),H=j?"after":"before",z;if(k.level>0||t.doc.direction=="rtl"){var q=Ln(t,n);z=i<0?n.text.length-1:0;var re=Rr(t,q,z).top;z=Je(function(he){return Rr(t,q,he).top==re},i<0==(k.level==1)?k.from:k.to-1,z),H=="before"&&(z=Fa(n,z,1))}else z=i<0?k.to:k.from;return new Oe(r,z,H)}}return new Oe(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 Na(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var E=Ke(i,n.ch,n.sticky),k=i[E];if(e.doc.direction=="ltr"&&k.level%2==0&&(r>0?k.to>n.ch:k.from<n.ch))return Na(t,n,r);var j=function(Ue,$e){return Fa(t,Ue instanceof Oe?Ue.ch:Ue,$e)},H,z=function(Ue){return e.options.lineWrapping?(H=H||Ln(e,t),fo(e,t,H,Ue)):{begin:0,end:t.text.length}},q=z(n.sticky=="before"?j(n,-1):n.ch);if(e.doc.direction=="rtl"||k.level==1){var re=k.level==1==r<0,he=j(n,re?1:-1);if(he!=null&&(re?he<=k.to&&he<=q.end:he>=k.from&&he>=q.begin)){var ce=re?"before":"after";return new Oe(n.line,he,ce)}}var xe=function(Ue,$e,Fe){for(var qe=function(Ot,Ht){return Ht?new Oe(n.line,j(Ot,1),"before"):new Oe(n.line,Ot,"after")};Ue>=0&&Ue<i.length;Ue+=$e){var ut=i[Ue],st=$e>0==(ut.level!=1),yt=st?Fe.begin:j(Fe.end,-1);if(ut.from<=yt&&yt<ut.to)return qe(yt,st);if(yt=st?ut.from:j(ut.to,-1),Fe.begin<=yt&&yt<Fe.end)return qe(yt,st)}},De=xe(E+r,r,q);if(De)return De;var Me=r>0?q.end:j(q.begin,-1);return Me!=null&&!(r>0&&Me==t.text.length)&&(De=xe(r>0?0:i.length-1,r,z(Me)),De)?De:null}var Ti={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ge)},killLine:function(e){return Nn(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:Oe(t.head.line+1,0)}:{from:t.head,to:Oe(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Nn(e,function(t){return{from:Oe(t.from().line,0),to:pt(e.doc,Oe(t.to().line+1,0))}})},delLineLeft:function(e){return Nn(e,function(t){return{from:Oe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Nn(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 Nn(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(Oe(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Oe(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ds(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return cs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},fe)},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")},fe)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?cs(e,t.head):r},fe)},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 E=n[i].from(),k=Y(e.getLine(E.line),E.ch,r);t.push(ue(r-k%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return cr(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,E=nt(e.doc,i.line).text;if(E){if(i.ch==E.length&&(i=new Oe(i.line,i.ch-1)),i.ch>0)i=new Oe(i.line,i.ch+1),e.replaceRange(E.charAt(i.ch-1)+E.charAt(i.ch-2),Oe(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var k=nt(e.doc,i.line-1).text;k&&(i=new Oe(i.line,1),e.replaceRange(E.charAt(0)+e.doc.lineSeparator()+k.charAt(k.length-1),Oe(i.line-1,k.length-1),i,"+transpose"))}}n.push(new Dt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return cr(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);On(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ds(e,t){var n=nt(e.doc,t),r=mr(n);return r!=n&&(t=wt(r)),Ba(!0,e,r,t,1)}function Il(e,t){var n=nt(e.doc,t),r=Ii(n);return r!=n&&(t=wt(r)),Ba(!0,e,n,t,-1)}function cs(e,t){var n=ds(e,t.line),r=nt(e.doc,n.line),i=Ve(r,e.doc.direction);if(!i||i[0].level==0){var E=Math.max(n.ch,r.text.search(/\S/)),k=t.line==n.line&&t.ch<=E&&t.ch;return Oe(n.line,k?0:E,n.sticky)}return n}function ea(e,t,n){if(typeof t=="string"&&(t=Ti[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=Fn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Fn(t,e.options.extraKeys,n,e)||Fn(t,e.options.keyMap,n,e)}var Fl=new ee;function Si(e,t,n,r){var i=e.state.keySeq;if(i){if(ss(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),fs(e,i+" "+t,n,r))return!0}return fs(e,t,n,r)}function fs(e,t,n,r){var i=Ul(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&zt(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(X(n),Ta(e)),!!i}function hs(e,t){var n=us(t,!0);return n?t.shiftKey&&!e.state.keySeq?Si(e,"Shift-"+n,t,function(r){return ea(e,r,!0)})||Si(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return ea(e,r)}):Si(e,n,t,function(r){return ea(e,r)}):!1}function Nl(e,t,n){return Si(e,"'"+n+"'",t,function(r){return ea(e,r,!0)})}var ja=null;function ms(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=P(),_e(t,e))return;F&&I<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=hs(t,e);T&&(ja=r?n:null,!r&&n==88&&!Ct&&(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;N(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(c(t,"CodeMirror-crosshair"),ze(document,"keyup",n),ze(document,"mouseover",n))}ye(document,"keyup",n),ye(document,"mouseover",n)}function ps(e){e.keyCode==16&&(this.doc.sel.shift=!1),_e(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Br(t.display,e)||_e(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(T&&n==ja){ja=null,X(e);return}if(T&&(!e.which||e.which<10)&&hs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Nl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Wa=function(e,t,n){this.time=e,this.pos=t,this.button=n};Wa.prototype.compare=function(e,t,n){return this.time+jl>e&&ht(t,this.pos)==0&&n==this.button};var wi,Ci;function Wl(e,t){var n=+new Date;return Ci&&Ci.compare(n,e,t)?(wi=Ci=null,"triple"):wi&&wi.compare(n,e,t)?(Ci=new Wa(n,e,t),wi=null,"double"):(wi=new Wa(n,e,t),Ci=null,"single")}function vs(e){var t=this,n=t.display;if(_e(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Br(n,e)){R||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ka(t,e))return;var r=sn(t,e),i=ve(e),E=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Kl(t,i,r,E,e))return;i==1?r?Gl(t,r,E,e):se(e)==n.scroller&&X(e):i==2?(r&&Yi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(C?t.display.input.onContextMenu(e):yo(t))}function Kl(e,t,n,r,i){var E="Click";return r=="double"?E="Double"+E:r=="triple"&&(E="Triple"+E),E=(t==1?"Left":t==2?"Middle":"Right")+E,Si(e,ls(E,i),i,function(k){if(typeof k=="string"&&(k=Ti[k]),!k)return!1;var j=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),j=k(e,n)!=Te}finally{e.state.suppressEdits=!1}return j})}function Hl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var E=l?n.shiftKey&&n.metaKey:n.altKey;i.unit=E?"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){F?setTimeout(B(vo,e),0):e.curOp.focus=P();var i=Hl(e,n,r),E=e.doc.sel,k;e.options.dragDrop&&Se&&!e.isReadOnly()&&n=="single"&&(k=E.contains(t))>-1&&(ht((k=E.ranges[k]).from(),t)<0||t.xRel>0)&&(ht(k.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,E=!1,k=Wt(e,function(z){R&&(i.scroller.draggable=!1),e.state.draggingText=!1,ze(i.wrapper.ownerDocument,"mouseup",k),ze(i.wrapper.ownerDocument,"mousemove",j),ze(i.scroller,"dragstart",H),ze(i.scroller,"drop",k),E||(X(z),r.addNew||Yi(e.doc,n,null,null,r.extend),R&&!A||F&&I==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),j=function(z){E=E||Math.abs(t.clientX-z.clientX)+Math.abs(t.clientY-z.clientY)>=10},H=function(){return E=!0};R&&(i.scroller.draggable=!0),e.state.draggingText=k,k.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),ye(i.wrapper.ownerDocument,"mouseup",k),ye(i.wrapper.ownerDocument,"mousemove",j),ye(i.scroller,"dragstart",H),ye(i.scroller,"drop",k),yo(e),setTimeout(function(){return i.input.focus()},20)}function ys(e,t,n){if(n=="char")return new Dt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Dt(Oe(t.line,0),pt(e.doc,Oe(t.line+1,0)));var r=n(e,t);return new Dt(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,E=e.doc;X(t);var k,j,H=E.sel,z=H.ranges;if(r.addNew&&!r.extend?(j=E.sel.contains(n),j>-1?k=z[j]:k=new Dt(n,n)):(k=E.sel.primary(),j=E.sel.primIndex),r.unit=="rectangle")r.addNew||(k=new Dt(n,n)),n=sn(e,t,!0,!0),j=-1;else{var q=ys(e,n,r.unit);r.extend?k=Ia(k,q.anchor,q.head,r.extend):k=q}r.addNew?j==-1?(j=z.length,$t(E,Lr(e,z.concat([k]),j),{scroll:!1,origin:"*mouse"})):z.length>1&&z[j].empty()&&r.unit=="char"&&!r.extend?($t(E,Lr(e,z.slice(0,j).concat(z.slice(j+1)),0),{scroll:!1,origin:"*mouse"}),H=E.sel):Ua(E,j,k,pe):(j=0,$t(E,new gr([k],0),pe),H=E.sel);var re=n;function he(Fe){if(ht(re,Fe)==0)return;if(re=Fe,r.unit=="rectangle"){for(var qe=[],ut=e.options.tabSize,st=Y(nt(E,n.line).text,n.ch,ut),yt=Y(nt(E,Fe.line).text,Fe.ch,ut),Ot=Math.min(st,yt),Ht=Math.max(st,yt),Pt=Math.min(n.line,Fe.line),fr=Math.min(e.lastLine(),Math.max(n.line,Fe.line));Pt<=fr;Pt++){var lr=nt(E,Pt).text,Ft=me(lr,Ot,ut);Ot==Ht?qe.push(new Dt(Oe(Pt,Ft),Oe(Pt,Ft))):lr.length>Ft&&qe.push(new Dt(Oe(Pt,Ft),Oe(Pt,me(lr,Ht,ut))))}qe.length||qe.push(new Dt(n,n)),$t(E,Lr(e,H.ranges.slice(0,j).concat(qe),j),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Fe)}else{var ur=k,Vt=ys(e,Fe,r.unit),jt=ur.anchor,Nt;ht(Vt.anchor,jt)>0?(Nt=Vt.head,jt=Zr(ur.from(),Vt.anchor)):(Nt=Vt.anchor,jt=yn(ur.to(),Vt.head));var kt=H.ranges.slice(0);kt[j]=Xl(e,new Dt(pt(E,jt),Nt)),$t(E,Lr(e,kt,j),pe)}}var ce=i.wrapper.getBoundingClientRect(),xe=0;function De(Fe){var qe=++xe,ut=sn(e,Fe,!0,r.unit=="rectangle");if(!ut)return;if(ht(ut,re)!=0){e.curOp.focus=P(),he(ut);var st=Ki(i,E);(ut.line>=st.to||ut.line<st.from)&&setTimeout(Wt(e,function(){xe==qe&&De(Fe)}),150)}else{var yt=Fe.clientY<ce.top?-20:Fe.clientY>ce.bottom?20:0;yt&&setTimeout(Wt(e,function(){if(xe!=qe)return;i.scroller.scrollTop+=yt,De(Fe)}),50)}}function Me(Fe){e.state.selectingText=!1,xe=Infinity,Fe&&(X(Fe),i.input.focus()),ze(i.wrapper.ownerDocument,"mousemove",Ue),ze(i.wrapper.ownerDocument,"mouseup",$e),E.history.lastSelOrigin=null}var Ue=Wt(e,function(Fe){Fe.buttons===0||!ve(Fe)?Me(Fe):De(Fe)}),$e=Wt(e,Me);e.state.selectingText=$e,ye(i.wrapper.ownerDocument,"mousemove",Ue),ye(i.wrapper.ownerDocument,"mouseup",$e)}function Xl(e,t){var n=t.anchor,r=t.head,i=nt(e.doc,n.line);if(ht(n,r)==0&&n.sticky==r.sticky)return t;var E=Ve(i);if(!E)return t;var k=Ke(E,n.ch,n.sticky),j=E[k];if(j.from!=n.ch&&j.to!=n.ch)return t;var H=k+(j.from==n.ch==(j.level!=1)?0:1);if(H==0||H==E.length)return t;var z;if(r.line!=n.line)z=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var q=Ke(E,r.ch,r.sticky),re=q-k||(r.ch-n.ch)*(j.level==1?-1:1);q==H-1||q==H?z=re<0:z=re>0}var he=E[H+(z?-1:0)],ce=z==(he.level==1),xe=ce?he.from:he.to,De=ce?"after":"before";return n.ch==xe&&n.sticky==De?t:new Dt(new Oe(n.line,xe,De),r)}function bs(e,t,n,r){var i,E;if(t.touches)i=t.touches[0].clientX,E=t.touches[0].clientY;else try{i=t.clientX,E=t.clientY}catch(he){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&X(t);var k=e.display,j=k.lineDiv.getBoundingClientRect();if(E>j.bottom||!ne(e,n))return Q(t);E-=j.top-k.viewOffset;for(var H=0;H<e.display.gutterSpecs.length;++H){var z=k.gutters.childNodes[H];if(z&&z.getBoundingClientRect().right>=i){var q=br(e.doc,E),re=e.display.gutterSpecs[H];return be(e,n,e,q,re.className,t),Q(t)}}}function Ka(e,t){return bs(e,t,"gutterClick",!0)}function Es(e,t){if(Br(e.display,t)||Yl(e,t))return;if(_e(e,t,"contextmenu"))return;C||e.display.input.onContextMenu(t)}function Yl(e,t){return ne(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function xs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ai(e)}var Bn={toString:function(){return"CodeMirror.Init"}},Ts={},ta={};function $l(e){var t=e.optionHandlers;function n(r,i,E,k){e.defaults[r]=i,E&&(t[r]=k?function(j,H,z){z!=Bn&&E(j,H,z)}:E)}e.defineOption=n,e.Init=Bn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Pa(r)},!0),n("indentUnit",2,Pa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){hi(r),ai(r),or(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var E=[],k=r.doc.first;r.doc.iter(function(H){for(var z=0;;){var q=H.text.indexOf(i,z);if(q==-1)break;z=q+i.length,E.push(Oe(k,q))}k++});for(var j=E.length-1;j>=0;j--)In(r.doc,i,E[j],Oe(E[j].line,E[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,E){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),E!=Bn&&r.refresh()}),n("specialCharPlaceholder",_t,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){xs(r),fi(r)},!0),n("keyMap","default",function(r,i,E){var k=qi(i),j=E!=Bn&&qi(E);j&&j.detach&&j.detach(r,k),k.attach&&k.attach(r,j||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Oa(i,r.options.lineNumbers),fi(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Ea(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Rn(r)},!0),n("scrollbarStyle","native",function(r){wo(r),Rn(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Oa(r.options.gutters,i),fi(r)},!0),n("firstLineNumber",1,fi,!0),n("lineNumberFormatter",function(r){return r},fi,!0),n("showCursorWhenSelecting",!1,oi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(_n(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Ql),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,oi,!0),n("singleCursorHeightPerLine",!0,oi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,hi,!0),n("addModeClass",!1,hi,!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,hi,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Ql(e,t,n){var r=n&&n!=Bn;if(!t!=!r){var i=e.display.dragFunctions,E=t?ye:ze;E(e.display.scroller,"dragstart",i.start),E(e.display.scroller,"dragenter",i.enter),E(e.display.scroller,"dragover",i.over),E(e.display.scroller,"dragleave",i.leave),E(e.display.scroller,"drop",i.drop)}}function Jl(e){e.options.lineWrapping?(N(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(c(e.display.wrapper,"CodeMirror-wrap"),Ui(e)),xa(e),or(e),ai(e),setTimeout(function(){return Rn(e)},100)}function Rt(e,t){var n=this;if(!(this instanceof Rt))return new Rt(e,t);this.options=t=t?U(t):{},U(Ts,t,!1);var r=t.value;typeof r=="string"?r=new sr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Rt.inputStyles[t.inputStyle](this),E=this.display=new dl(e,r,i,t);E.wrapper.CodeMirror=this,xs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),wo(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new ee,keySeq:null,specialChars:null},t.autofocus&&!o&&E.input.focus(),F&&I<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),_l(),cn(this),this.curOp.forceUpdate=!0,ko(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Sa(n)},20):_n(this);for(var k in ta)ta.hasOwnProperty(k)&&ta[k](this,t[k],Bn);Do(this),t.finishInit&&t.finishInit(this);for(var j=0;j<Ha.length;++j)Ha[j](this);fn(this),R&&t.lineWrapping&&getComputedStyle(E.lineDiv).textRendering=="optimizelegibility"&&(E.lineDiv.style.textRendering="auto")}Rt.defaults=Ts,Rt.optionHandlers=ta;function Zl(e){var t=e.display;ye(t.scroller,"mousedown",Wt(e,vs)),F&&I<11?ye(t.scroller,"dblclick",Wt(e,function(H){if(_e(e,H))return;var z=sn(e,H);if(!z||Ka(e,H)||Br(e.display,H))return;X(H);var q=e.findWordAt(z);Yi(e.doc,q.anchor,q.head)})):ye(t.scroller,"dblclick",function(H){return _e(e,H)||X(H)}),ye(t.scroller,"contextmenu",function(H){return Es(e,H)}),ye(t.input.getField(),"contextmenu",function(H){t.scroller.contains(H.target)||Es(e,H)});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 E(H){if(H.touches.length!=1)return!1;var z=H.touches[0];return z.radiusX<=1&&z.radiusY<=1}function k(H,z){if(z.left==null)return!0;var q=z.left-H.left,re=z.top-H.top;return q*q+re*re>20*20}ye(t.scroller,"touchstart",function(H){if(!_e(e,H)&&!E(H)&&!Ka(e,H)){t.input.ensurePolled(),clearTimeout(n);var z=+new Date;t.activeTouch={start:z,moved:!1,prev:z-r.end<=300?r:null},H.touches.length==1&&(t.activeTouch.left=H.touches[0].pageX,t.activeTouch.top=H.touches[0].pageY)}}),ye(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ye(t.scroller,"touchend",function(H){var z=t.activeTouch;if(z&&!Br(t,H)&&z.left!=null&&!z.moved&&new Date-z.start<300){var q=e.coordsChar(t.activeTouch,"page"),re;!z.prev||k(z,z.prev)?re=new Dt(q,q):!z.prev.prev||k(z,z.prev.prev)?re=e.findWordAt(q):re=new Dt(Oe(q.line,0),pt(e.doc,Oe(q.line+1,0))),e.setSelection(re.anchor,re.head),e.focus(),X(H)}i()}),ye(t.scroller,"touchcancel",i),ye(t.scroller,"scroll",function(){t.scroller.clientHeight&&(li(e,t.scroller.scrollTop),un(e,t.scroller.scrollLeft,!0),be(e,"scroll",e))}),ye(t.scroller,"mousewheel",function(H){return Oo(e,H)}),ye(t.scroller,"DOMMouseScroll",function(H){return Oo(e,H)}),ye(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(H){_e(e,H)||te(H)},over:function(H){_e(e,H)||(Al(e,H),te(H))},start:function(H){return Dl(e,H)},drop:Wt(e,Ll),leave:function(H){_e(e,H)||is(e)}};var j=t.input.getField();ye(j,"keyup",function(H){return ps.call(e,H)}),ye(j,"keydown",Wt(e,ms)),ye(j,"keypress",Wt(e,gs)),ye(j,"focus",function(H){return Sa(e,H)}),ye(j,"blur",function(H){return _n(e,H)})}var Ha=[];Rt.defineInitHook=function(e){return Ha.push(e)};function Li(e,t,n,r){var i=e.doc,E;n==null&&(n="add"),n=="smart"&&(i.mode.indent?E=Er(e,t).state:n="prev");var k=e.options.tabSize,j=nt(i,t),H=Y(j.text,null,k);j.stateAfter&&(j.stateAfter=null);var z=j.text.match(/^\s*/)[0],q;if(!r&&!/\S/.test(j.text))q=0,n="not";else if(n=="smart"&&(q=i.mode.indent(E,j.text.slice(z.length),j.text),q==Te||q>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?q=Y(nt(i,t-1).text,null,k):q=0:n=="add"?q=H+e.options.indentUnit:n=="subtract"?q=H-e.options.indentUnit:typeof n=="number"&&(q=H+n),q=Math.max(0,q);var re="",he=0;if(e.options.indentWithTabs)for(var ce=Math.floor(q/k);ce;--ce)he+=k,re+=" ";if(he<q&&(re+=ue(q-he)),re!=z)return In(i,re,Oe(t,0),Oe(t,z.length),"+input"),j.stateAfter=null,!0;for(var xe=0;xe<i.sel.ranges.length;xe++){var De=i.sel.ranges[xe];if(De.head.line==t&&De.head.ch<z.length){var Me=Oe(t,z.length);Ua(i,xe,new Dt(Me,Me));break}}}var Dr=null;function ra(e){Dr=e}function Ga(e,t,n,r,i){var E=e.doc;e.display.shift=!1,r||(r=E.sel);var k=+new Date-200,j=i=="paste"||e.state.pasteIncoming>k,H=ct(t),z=null;if(j&&r.ranges.length>1)if(Dr&&Dr.text.join(`
|
|
`)==t){if(r.ranges.length%Dr.text.length==0){z=[];for(var q=0;q<Dr.text.length;q++)z.push(E.splitLines(Dr.text[q]))}}else H.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(z=Ie(H,function(Ue){return[Ue]}));for(var re=e.curOp.updateInput,he=r.ranges.length-1;he>=0;he--){var ce=r.ranges[he],xe=ce.from(),De=ce.to();ce.empty()&&(n&&n>0?xe=Oe(xe.line,xe.ch-n):e.state.overwrite&&!j?De=Oe(De.line,Math.min(nt(E,De.line).text.length,De.ch+Ee(H).length)):j&&Dr&&Dr.lineWise&&Dr.text.join(`
|
|
`)==H.join(`
|
|
`)&&(xe=De=Oe(xe.line,0)));var Me={from:xe,to:De,text:z?z[he%z.length]:H,origin:i||(j?"paste":e.state.cutIncoming>k?"cut":"+input")};kn(e.doc,Me),zt(e,"inputRead",e,Me)}t&&!j&&ws(e,t),On(e),e.curOp.updateInput<2&&(e.curOp.updateInput=re),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ss(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&cr(t,function(){return Ga(t,n,0,null,"paste")}),!0}function ws(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var E=e.getModeAt(i.head),k=!1;if(E.electricChars){for(var j=0;j<E.electricChars.length;j++)if(t.indexOf(E.electricChars.charAt(j))>-1){k=Li(e,i.head.line,"smart");break}}else E.electricInput&&(E.electricInput.test(nt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(k=Li(e,i.head.line,"smart")));k&&zt(e,"electricInput",e,i.head.line)}}function Cs(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,E={anchor:Oe(i,0),head:Oe(i+1,0)};n.push(E),t.push(e.getRange(E.anchor,E.head))}return{text:t,ranges:n}}function Ls(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Ds(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return R?e.style.width="1000px":e.setAttribute("wrap","off"),y&&(e.style.border="1px solid black"),Ls(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 E=this.options,k=E[r];if(E[r]==i&&r!="mode")return;E[r]=i,t.hasOwnProperty(r)&&Wt(this,t[r])(this,i,k),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"](qi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,E=0;E<i.length;++E)if(i[E]==r||i[E].name==r)return i.splice(E,1),!0},addOverlay:qt(function(r,i){var E=r.token?r:e.getMode(this.options,r);if(E.startState)throw new Error("Overlays may not be stateful.");ke(this.state.overlays,{mode:E,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(k){return k.priority}),this.state.modeGen++,or(this)}),removeOverlay:qt(function(r){for(var i=this.state.overlays,E=0;E<i.length;++E){var k=i[E].modeSpec;if(k==r||typeof r=="string"&&k.name==r){i.splice(E,1),this.state.modeGen++,or(this);return}}}),indentLine:qt(function(r,i,E){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),kr(this.doc,r)&&Li(this,r,i,E)}),indentSelection:qt(function(r){for(var i=this.doc.sel.ranges,E=-1,k=0;k<i.length;k++){var j=i[k];if(j.empty())j.head.line>E&&(Li(this,j.head.line,r,!0),E=j.head.line,k==this.doc.sel.primIndex&&On(this));else{var H=j.from(),z=j.to(),q=Math.max(E,H.line);E=Math.min(this.lastLine(),z.line-(z.ch?0:1))+1;for(var re=q;re<E;++re)Li(this,re,r);var he=this.doc.sel.ranges;H.ch==0&&i.length==he.length&&he[k].from().ch>0&&Ua(this.doc,k,new Dt(H,he[k].to()),ge)}}}),getTokenAt:function(r,i){return Ai(this,r,i)},getLineTokens:function(r,i){return Ai(this,Oe(r),i,!0)},getTokenTypeAt:function(r){r=pt(this.doc,r);var i=qr(this,nt(this.doc,r.line)),E=0,k=(i.length-1)/2,j=r.ch,H;if(j==0)H=i[2];else for(;;){var z=E+k>>1;if((z?i[z*2-1]:0)>=j)k=z;else if(i[z*2+1]<j)E=z+1;else{H=i[z*2+2];break}}var q=H?H.indexOf("overlay "):-1;return q<0?H:q==0?null:H.slice(0,q-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 E=[];if(!n.hasOwnProperty(i))return E;var k=n[i],j=this.getModeAt(r);if(typeof j[i]=="string")k[j[i]]&&E.push(k[j[i]]);else if(j[i])for(var H=0;H<j[i].length;H++){var z=k[j[i][H]];z&&E.push(z)}else j.helperType&&k[j.helperType]?E.push(k[j.helperType]):k[j.name]&&E.push(k[j.name]);for(var q=0;q<k._global.length;q++){var re=k._global[q];re.pred(j,this)&&oe(E,re.val)==-1&&E.push(re.val)}return E},getStateAfter:function(r,i){var E=this.doc;return r=bn(E,r==null?E.first+E.size-1:r),Er(this,r+1,i).state},cursorCoords:function(r,i){var E,k=this.doc.sel.primary();return r==null?E=k.head:typeof r=="object"?E=pt(this.doc,r):E=r?k.from():k.to(),Cr(this,E,i||"page")},charCoords:function(r,i){return pa(this,pt(this.doc,r),i||"page")},coordsChar:function(r,i){return r=lo(this,r,i||"page"),va(this,r.left,r.top)},lineAtHeight:function(r,i){return r=lo(this,{top:r,left:0},i||"page").top,br(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,E){var k=!1,j;if(typeof r=="number"){var H=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>H&&(r=H,k=!0),j=nt(this.doc,r)}else j=r;return Ni(this,j,{top:0,left:0},i||"page",E||k).top+(k?this.doc.height-wr(j):0)},defaultTextHeight:function(){return Dn(this.display)},defaultCharWidth:function(){return An(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,E,k,j){var H=this.display;r=Cr(this,pt(this.doc,r));var z=r.bottom,q=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),H.sizer.appendChild(i),k=="over")z=r.top;else if(k=="above"||k=="near"){var re=Math.max(H.wrapper.clientHeight,this.doc.height),he=Math.max(H.sizer.clientWidth,H.lineSpace.clientWidth);(k=="above"||r.bottom+i.offsetHeight>re)&&r.top>i.offsetHeight?z=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=re&&(z=r.bottom),q+i.offsetWidth>he&&(q=he-i.offsetWidth)}i.style.top=z+"px",i.style.left=i.style.right="",j=="right"?(q=H.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(j=="left"?q=0:j=="middle"&&(q=(H.sizer.clientWidth-i.offsetWidth)/2),i.style.left=q+"px"),E&&Qs(this,{left:q,top:z,right:q+i.offsetWidth,bottom:z+i.offsetHeight})},triggerOnKeyDown:qt(ms),triggerOnKeyPress:qt(gs),triggerOnKeyUp:ps,triggerOnMouseDown:qt(vs),execCommand:function(r){if(Ti.hasOwnProperty(r))return Ti[r].call(null,this)},triggerElectric:qt(function(r){ws(this,r)}),findPosH:function(r,i,E,k){var j=1;i<0&&(j=-1,i=-i);for(var H=pt(this.doc,r),z=0;z<i&&!(H=za(this.doc,H,j,E,k),H.hitSide);++z);return H},moveH:qt(function(r,i){var E=this;this.extendSelectionsBy(function(k){return E.display.shift||E.doc.extend||k.empty()?za(E.doc,k.head,r,i,E.options.rtlMoveVisually):r<0?k.from():k.to()},fe)}),deleteH:qt(function(r,i){var E=this.doc.sel,k=this.doc;E.somethingSelected()?k.replaceSelection("",null,"+delete"):Nn(this,function(j){var H=za(k,j.head,r,i,!1);return r<0?{from:H,to:j.head}:{from:j.head,to:H}})}),findPosV:function(r,i,E,k){var j=1,H=k;i<0&&(j=-1,i=-i);for(var z=pt(this.doc,r),q=0;q<i;++q){var re=Cr(this,z,"div");if(H==null?H=re.left:re.left=H,z=As(this,re,j,E),z.hitSide)break}return z},moveV:qt(function(r,i){var E=this,k=this.doc,j=[],H=!this.display.shift&&!k.extend&&k.sel.somethingSelected();if(k.extendSelectionsBy(function(q){if(H)return r<0?q.from():q.to();var re=Cr(E,q.head,"div");q.goalColumn!=null&&(re.left=q.goalColumn),j.push(re.left);var he=As(E,re,r,i);return i=="page"&&q==k.sel.primary()&&Ca(E,pa(E,he,"div").top-re.top),he},fe),j.length)for(var z=0;z<k.sel.ranges.length;z++)k.sel.ranges[z].goalColumn=j[z]}),findWordAt:function(r){var i=this.doc,E=nt(i,r.line).text,k=r.ch,j=r.ch;if(E){var H=this.getHelper(r,"wordChars");(r.sticky=="before"||j==E.length)&&k?--k:++j;for(var z=E.charAt(k),q=Re(z,H)?function(re){return Re(re,H)}:/\s/.test(z)?function(re){return/\s/.test(re)}:function(re){return!/\s/.test(re)&&!Re(re)};k>0&&q(E.charAt(k-1));)--k;for(;j<E.length&&q(E.charAt(j));)++j}return new Dt(Oe(r.line,k),Oe(r.line,j))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?N(this.display.cursorDiv,"CodeMirror-overwrite"):c(this.display.cursorDiv,"CodeMirror-overwrite"),be(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==P()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:qt(function(r,i){si(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Or(this)-this.display.barHeight,width:r.scrollWidth-Or(this)-this.display.barWidth,clientHeight:fa(this),clientWidth:an(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:Oe(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Js(this,r):Eo(this,r.from,r.to,r.margin)}),setSize:qt(function(r,i){var E=this,k=function(H){return typeof H=="number"||/^\d+$/.test(String(H))?H+"px":H};r!=null&&(this.display.wrapper.style.width=k(r)),i!=null&&(this.display.wrapper.style.height=k(i)),this.options.lineWrapping&&ao(this);var j=this.display.viewFrom;this.doc.iter(j,this.display.viewTo,function(H){if(H.widgets){for(var z=0;z<H.widgets.length;z++)if(H.widgets[z].noHScroll){Gr(E,j,"widget");break}}++j}),this.curOp.forceUpdate=!0,be(this,"refresh",this)}),operation:function(r){return cr(this,r)},startOperation:function(){return cn(this)},endOperation:function(){return fn(this)},refresh:qt(function(){var r=this.display.cachedTextHeight;or(this),this.curOp.forceUpdate=!0,ai(this),si(this,this.doc.scrollLeft,this.doc.scrollTop),Aa(this.display),(r==null||Math.abs(r-Dn(this.display))>.5||this.options.lineWrapping)&&xa(this),be(this,"refresh",this)}),swapDoc:qt(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),ko(this,r),ai(this),this.display.input.reset(),si(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,zt(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}},ie(e),e.registerHelper=function(r,i,E){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=E},e.registerGlobalHelper=function(r,i,E,k){e.registerHelper(r,i,k),n[r]._global.push({pred:E,val:k})}}function za(e,t,n,r,i){var E=t,k=n,j=nt(e,t.line),H=i&&e.direction=="rtl"?-n:n;function z(){var $e=t.line+H;return $e<e.first||$e>=e.first+e.size?!1:(t=new Oe($e,t.ch,t.sticky),j=nt(e,$e))}function q($e){var Fe;if(r=="codepoint"){var qe=j.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(qe)?Fe=null:Fe=new Oe(t.line,Math.max(0,Math.min(j.text.length,t.ch+n*(qe>=55296&&qe<56320?2:1))),-n)}else i?Fe=kl(e.cm,j,t,n):Fe=Na(j,t,n);if(Fe==null)if(!$e&&z())t=Ba(i,e.cm,j,t.line,H);else return!1;else t=Fe;return!0}if(r=="char"||r=="codepoint")q();else if(r=="column")q(!0);else if(r=="word"||r=="group")for(var re=null,he=r=="group",ce=e.cm&&e.cm.getHelper(t,"wordChars"),xe=!0;!(n<0&&!q(!xe));xe=!1){var De=j.text.charAt(t.ch)||`
|
|
`,Me=Re(De,ce)?"w":he&&De==`
|
|
`?"n":!he||/\s/.test(De)?null:"p";if(he&&!xe&&!Me&&(Me="s"),re&&re!=Me){n<0&&(n=1,q(),t.sticky="after");break}if(Me&&(re=Me),n>0&&!q(!xe))break}var Ue=Qi(e,t,E,k,!0);return zn(E,Ue)&&(Ue.hitSide=!0),Ue}function As(e,t,n,r){var i=e.doc,E=t.left,k;if(r=="page"){var j=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),H=Math.max(j-.5*Dn(e.display),3);k=(n>0?t.bottom:t.top)+n*H}else r=="line"&&(k=n>0?t.bottom+3:t.top-3);for(var z;!(z=va(e,E,k),!z.outside);){if(n<0?k<=0:k>=i.height){z.hitSide=!0;break}k+=n*5}return z}var At=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ee,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};At.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;Ls(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function E(j){for(var H=j.target;H;H=H.parentNode){if(H==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(H.className))break}return!1}ye(i,"paste",function(j){if(!E(j)||_e(r,j)||Ss(j,r))return;I<=11&&setTimeout(Wt(r,function(){return t.updateFromDOM()}),20)}),ye(i,"compositionstart",function(j){t.composing={data:j.data,done:!1}}),ye(i,"compositionupdate",function(j){t.composing||(t.composing={data:j.data,done:!1})}),ye(i,"compositionend",function(j){t.composing&&(j.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ye(i,"touchstart",function(){return n.forceCompositionEnd()}),ye(i,"input",function(){t.composing||t.readFromDOMSoon()});function k(j){if(!E(j)||_e(r,j))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()}),j.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var H=Cs(r);ra({lineWise:!0,text:H.text}),j.type=="cut"&&r.operation(function(){r.setSelections(H.ranges,0,ge),r.replaceSelection("",null,"cut")})}else return;if(j.clipboardData){j.clipboardData.clearData();var z=Dr.text.join(`
|
|
`);if(j.clipboardData.setData("Text",z),j.clipboardData.getData("Text")==z){j.preventDefault();return}}var q=Ds(),re=q.firstChild;r.display.lineSpace.insertBefore(q,r.display.lineSpace.firstChild),re.value=Dr.text.join(`
|
|
`);var he=document.activeElement;V(re),setTimeout(function(){r.display.lineSpace.removeChild(q),he.focus(),he==i&&n.showPrimarySelection()},50)}ye(i,"copy",k),ye(i,"cut",k)},At.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},At.prototype.prepareSelection=function(){var e=po(this.cm,!1);return e.focus=document.activeElement==this.div,e},At.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},At.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},At.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var E=na(t,e.anchorNode,e.anchorOffset),k=na(t,e.focusNode,e.focusOffset);if(E&&!E.bad&&k&&!k.bad&&ht(Zr(E,k),r)==0&&ht(yn(E,k),i)==0)return;var j=t.display.view,H=r.line>=t.display.viewFrom&&_s(t,r)||{node:j[0].measure.map[2],offset:0},z=i.line<t.display.viewTo&&_s(t,i);if(!z){var q=j[j.length-1].measure,re=q.maps?q.maps[q.maps.length-1]:q.map;z={node:re[re.length-1],offset:re[re.length-2]-re[re.length-3]}}if(!H||!z){e.removeAllRanges();return}var he=e.rangeCount&&e.getRangeAt(0),ce;try{ce=p(H.node,H.offset,z.offset,z.node)}catch(xe){}ce&&(!D&&t.state.focused?(e.collapse(H.node,H.offset),ce.collapsed||(e.removeAllRanges(),e.addRange(ce))):(e.removeAllRanges(),e.addRange(ce)),he&&e.anchorNode==null?e.addRange(he):D&&this.startGracePeriod()),this.rememberSelection()},At.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},At.prototype.showMultipleSelections=function(e){d(this.cm.display.cursorDiv,e.cursors),d(this.cm.display.selectionDiv,e.selection)},At.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},At.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return x(this.div,t)},At.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},At.prototype.blur=function(){this.div.blur()},At.prototype.getField=function(){return this.div},At.prototype.supportsTouch=function(){return!0},At.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():cr(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},At.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},At.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(u&&g&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=na(t,e.anchorNode,e.anchorOffset),r=na(t,e.focusNode,e.focusOffset);n&&r&&cr(t,function(){$t(t.doc,Vr(n,r),ge),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},At.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Oe(r.line-1,nt(e.doc,r.line-1).length)),i.ch==nt(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Oe(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var E,k,j;r.line==t.viewFrom||(E=ln(e,r.line))==0?(k=wt(t.view[0].line),j=t.view[0].node):(k=wt(t.view[E].line),j=t.view[E-1].node.nextSibling);var H=ln(e,i.line),z,q;if(H==t.view.length-1?(z=t.viewTo-1,q=t.lineDiv.lastChild):(z=wt(t.view[H+1].line)-1,q=t.view[H+1].node.previousSibling),!j)return!1;for(var re=e.doc.splitLines(tu(e,j,q,k,z)),he=Mr(e.doc,Oe(k,0),Oe(z,nt(e.doc,z).text.length));re.length>1&&he.length>1;)if(Ee(re)==Ee(he))re.pop(),he.pop(),z--;else if(re[0]==he[0])re.shift(),he.shift(),k++;else break;for(var ce=0,xe=0,De=re[0],Me=he[0],Ue=Math.min(De.length,Me.length);ce<Ue&&De.charCodeAt(ce)==Me.charCodeAt(ce);)++ce;for(var $e=Ee(re),Fe=Ee(he),qe=Math.min($e.length-(re.length==1?ce:0),Fe.length-(he.length==1?ce:0));xe<qe&&$e.charCodeAt($e.length-xe-1)==Fe.charCodeAt(Fe.length-xe-1);)++xe;if(re.length==1&&he.length==1&&k==r.line)for(;ce&&ce>r.ch&&$e.charCodeAt($e.length-xe-1)==Fe.charCodeAt(Fe.length-xe-1);)ce--,xe++;re[re.length-1]=$e.slice(0,$e.length-xe).replace(/^\u200b+/,""),re[0]=re[0].slice(ce).replace(/\u200b+$/,"");var ut=Oe(k,ce),st=Oe(z,he.length?Ee(he).length-xe:0);if(re.length>1||re[0]||ht(ut,st))return In(e.doc,re,ut,st,"+input"),!0},At.prototype.ensurePolled=function(){this.forceCompositionEnd()},At.prototype.reset=function(){this.forceCompositionEnd()},At.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},At.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},At.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&cr(this.cm,function(){return or(e.cm)})},At.prototype.setUneditable=function(e){e.contentEditable="false"},At.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Wt(this.cm,Ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},At.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},At.prototype.onContextMenu=function(){},At.prototype.resetPosition=function(){},At.prototype.needsContentAttribute=!0;function _s(e,t){var n=ha(e,t.line);if(!n||n.hidden)return null;var r=nt(e.doc,t.line),i=eo(n,r,t.line),E=Ve(r,e.doc.direction),k="left";if(E){var j=Ke(E,t.ch);k=j%2?"right":"left"}var H=no(i.map,t.ch,k);return H.offset=H.collapse=="right"?H.end:H.start,H}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function jn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var E="",k=!1,j=e.doc.lineSeparator(),H=!1;function z(ce){return function(xe){return xe.id==ce}}function q(){k&&(E+=j,H&&(E+=j),k=H=!1)}function re(ce){ce&&(q(),E+=ce)}function he(ce){if(ce.nodeType==1){var xe=ce.getAttribute("cm-text");if(xe){re(xe);return}var De=ce.getAttribute("cm-marker"),Me;if(De){var Ue=e.findMarks(Oe(r,0),Oe(i+1,0),z(+De));Ue.length&&(Me=Ue[0].find(0))&&re(Mr(e.doc,Me.from,Me.to).join(j));return}if(ce.getAttribute("contenteditable")=="false")return;var $e=/^(pre|div|p|li|table|br)$/i.test(ce.nodeName);if(!/^br$/i.test(ce.nodeName)&&ce.textContent.length==0)return;$e&&q();for(var Fe=0;Fe<ce.childNodes.length;Fe++)he(ce.childNodes[Fe]);/^(pre|p)$/i.test(ce.nodeName)&&(H=!0),$e&&(k=!0)}else ce.nodeType==3&&re(ce.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(he(t),t==n);)t=t.nextSibling,H=!1;return E}function na(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return jn(e.clipPos(Oe(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 E=e.display.view[i];if(E.node==r)return ru(E,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!x(r,t))return jn(Oe(wt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var E=e.rest?Ee(e.rest):e.line;return jn(Oe(wt(E),E.text.length),i)}var k=t.nodeType==3?t:null,j=t;for(!k&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(k=t.firstChild,n&&(n=k.nodeValue.length));j.parentNode!=r;)j=j.parentNode;var H=e.measure,z=H.maps;function q(Me,Ue,$e){for(var Fe=-1;Fe<(z?z.length:0);Fe++)for(var qe=Fe<0?H.map:z[Fe],ut=0;ut<qe.length;ut+=3){var st=qe[ut+2];if(st==Me||st==Ue){var yt=wt(Fe<0?e.line:e.rest[Fe]),Ot=qe[ut]+$e;return($e<0||st!=Me)&&(Ot=qe[ut+($e?1:0)]),Oe(yt,Ot)}}}var re=q(k,j,n);if(re)return jn(re,i);for(var he=j.nextSibling,ce=k?k.nodeValue.length-n:0;he;he=he.nextSibling){if(re=q(he,he.firstChild,0),re)return jn(Oe(re.line,re.ch-ce),i);ce+=he.textContent.length}for(var xe=j.previousSibling,De=n;xe;xe=xe.previousSibling){if(re=q(xe,xe.firstChild,-1),re)return jn(Oe(re.line,re.ch+De),i);De+=xe.textContent.length}}var Ut=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ee,this.hasSelection=!1,this.composing=null};Ut.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),y&&(i.style.width="0px"),ye(i,"input",function(){F&&I>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),ye(i,"paste",function(k){if(_e(r,k)||Ss(k,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function E(k){if(_e(r,k))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var j=Cs(r);ra({lineWise:!0,text:j.text}),k.type=="cut"?r.setSelections(j.ranges,null,ge):(n.prevInput="",i.value=j.text.join(`
|
|
`),V(i))}else return;k.type=="cut"&&(r.state.cutIncoming=+new Date)}ye(i,"cut",E),ye(i,"copy",E),ye(e.scroller,"paste",function(k){if(Br(e,k)||_e(r,k))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var j=new Event("paste");j.clipboardData=k.clipboardData,i.dispatchEvent(j)}),ye(e.lineSpace,"selectstart",function(k){Br(e,k)||X(k)}),ye(i,"compositionstart",function(){var k=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:k,range:r.markText(k,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ye(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Ut.prototype.createField=function(e){this.wrapper=Ds(),this.textarea=this.wrapper.firstChild},Ut.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Ut.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=po(e);if(e.options.moveInputWithCursor){var i=Cr(e,n.sel.primary().head,"div"),E=t.wrapper.getBoundingClientRect(),k=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+k.top-E.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+k.left-E.left))}return r},Ut.prototype.showSelection=function(e){var t=this.cm,n=t.display;d(n.cursorDiv,e.cursors),d(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ut.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&&V(this.textarea),F&&I>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",F&&I>=9&&(this.hasSelection=null))},Ut.prototype.getField=function(){return this.textarea},Ut.prototype.supportsTouch=function(){return!1},Ut.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||P()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ut.prototype.blur=function(){this.textarea.blur()},Ut.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ut.prototype.receivedFocus=function(){this.slowPoll()},Ut.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()})},Ut.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)},Ut.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||ot(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(F&&I>=9&&this.hasSelection===i||s&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var E=i.charCodeAt(0);if(E==8203&&!r&&(r="\u200B"),E==8666)return this.reset(),this.cm.execCommand("undo")}for(var k=0,j=Math.min(r.length,i.length);k<j&&r.charCodeAt(k)==i.charCodeAt(k);)++k;return cr(t,function(){Ga(t,i.slice(k),r.length-k,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},Ut.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ut.prototype.onKeyPress=function(){F&&I>=9&&(this.hasSelection=null),this.fastPoll()},Ut.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var E=sn(n,e),k=r.scroller.scrollTop;if(!E||T)return;var j=n.options.resetSelectionOnContextMenu;j&&n.doc.sel.contains(E)==-1&&Wt(n,$t)(n.doc,Vr(E),ge);var H=i.style.cssText,z=t.wrapper.style.cssText,q=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-q.top-5)+"px; left: "+(e.clientX-q.left-5)+`px;
|
|
z-index: 1000; background: `+(F?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var re;R&&(re=window.scrollY),r.input.focus(),R&&window.scrollTo(null,re),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=ce,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function he(){if(i.selectionStart!=null){var De=n.somethingSelected(),Me="\u200B"+(De?i.value:"");i.value="\u21DA",i.value=Me,t.prevInput=De?"":"\u200B",i.selectionStart=1,i.selectionEnd=Me.length,r.selForContextMenu=n.doc.sel}}function ce(){if(t.contextMenuPending!=ce)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=z,i.style.cssText=H,F&&I<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=k),i.selectionStart!=null){(!F||F&&I<9)&&he();var De=0,Me=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Wt(n,Xo)(n):De++<10?r.detectingSelectAll=setTimeout(Me,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Me,200)}}if(F&&I>=9&&he(),C){te(e);var xe=function(){ze(window,"mouseup",xe),setTimeout(ce,20)};ye(window,"mouseup",xe)}else setTimeout(ce,50)},Ut.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Ut.prototype.setUneditable=function(){},Ut.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=P();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=j.getValue()}var i;if(e.form&&(ye(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var E=e.form;i=E.submit;try{var k=E.submit=function(){r(),E.submit=i,E.submit(),E.submit=k}}catch(H){}}t.finishInit=function(H){H.save=r,H.getTextArea=function(){return e},H.toTextArea=function(){H.toTextArea=isNaN,r(),e.parentNode.removeChild(H.getWrapperElement()),e.style.display="",e.form&&(ze(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var j=Rt(function(H){return e.parentNode.insertBefore(H,e.nextSibling)},t);return j}function iu(e){e.off=ze,e.on=ye,e.wheelEventPixels=cl,e.Doc=sr,e.splitLines=ct,e.countColumn=Y,e.findColumn=me,e.isWordChar=Ce,e.Pass=Te,e.signal=be,e.Line=nn,e.changeEnd=Xr,e.scrollbarModel=So,e.Pos=Oe,e.cmpPos=ht,e.modes=vt,e.mimeModes=at,e.resolveMode=Xt,e.getMode=tr,e.modeExtensions=hr,e.extendMode=rr,e.copyState=Ar,e.startState=Gn,e.innerMode=Hn,e.commands=Ti,e.keyMap=jr,e.keyName=us,e.isModifierKey=ss,e.lookupKey=Fn,e.normalizeKeyMap=Ml,e.StringStream=Mt,e.SharedTextMarker=bi,e.TextMarker=$r,e.LineWidget=yi,e.e_preventDefault=X,e.e_stopPropagation=$,e.e_stop=te,e.addClass=N,e.contains=x,e.rmClass=c,e.keyNames=Qr}$l(Rt),ql(Rt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ia in sr.prototype)sr.prototype.hasOwnProperty(ia)&&oe(au,ia)<0&&(Rt.prototype[ia]=function(e){return function(){return e.apply(this.doc,arguments)}}(sr.prototype[ia]));return ie(sr),Rt.inputStyles={textarea:Ut,contenteditable:At},Rt.defineMode=function(e){!Rt.defaults.mode&&e!="null"&&(Rt.defaults.mode=e),Jt.apply(this,arguments)},Rt.defineMIME=It,Rt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Rt.defineMIME("text/plain","null"),Rt.defineExtension=function(e,t){Rt.prototype[e]=t},Rt.defineDocExtension=function(e,t){sr.prototype[e]=t},Rt.fromTextArea=nu,iu(Rt),Rt.version="5.58.2",Rt})},Y1PL:function(dt,Qe,J){"use strict";J.r(Qe),J.d(Qe,"ResizableTextArea",function(){return oe});var Z=J("wx14"),G=J("1OyB"),D=J("vuIU"),W=J("Ji7U"),M=J("LK+K"),O=J("cDcd"),F=J("VTBJ"),I=J("rePB"),R=J("Zm9Q"),_=J("Kwbf"),g=J("c+Xe"),T=J("m+aA"),A=J("bdgK"),L=new Map;function S(ge){ge.forEach(function(pe){var fe,me=pe.target;(fe=L.get(me))===null||fe===void 0||fe.forEach(function(ae){return ae(me)})})}var y=new A.default(S),u=null,o=null;function s(ge,pe){L.has(ge)||(L.set(ge,new Set),y.observe(ge)),L.get(ge).add(pe)}function l(ge,pe){L.has(ge)&&(L.get(ge).delete(pe),L.get(ge).size||(y.unobserve(ge),L.delete(ge)))}var w=function(ge){Object(W.a)(fe,ge);var pe=Object(M.a)(fe);function fe(){return Object(G.a)(this,fe),pe.apply(this,arguments)}return Object(D.a)(fe,[{key:"render",value:function(){return this.props.children}}]),fe}(O.Component),m=O.createContext(null);function h(ge){var pe=ge.children,fe=ge.onBatchResize,me=O.useRef(0),ae=O.useRef([]),ue=O.useContext(m),Ee=O.useCallback(function(Ie,ke,Xe){me.current+=1;var Ne=me.current;ae.current.push({size:Ie,element:ke,data:Xe}),Promise.resolve().then(function(){Ne===me.current&&(fe==null||fe(ae.current),ae.current=[])}),ue==null||ue(Ie,ke,Xe)},[fe,ue]);return O.createElement(m.Provider,{value:Ee},pe)}function C(ge){var pe=ge.children,fe=ge.disabled,me=O.useRef(null),ae=O.useRef(null),ue=O.useContext(m),Ee=O.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Ie=O.isValidElement(pe)&&Object(g.c)(pe),ke=Ie?pe.ref:null,Xe=O.useMemo(function(){return Object(g.a)(ke,me)},[ke,me]),Ne=O.useRef(ge);Ne.current=ge;var we=O.useCallback(function(Ce){var Re=Ne.current,Be=Re.onResize,je=Re.data,Ae=Ce.getBoundingClientRect(),Le=Ae.width,Je=Ae.height,Ye=Ce.offsetWidth,He=Ce.offsetHeight,Ke=Math.floor(Le),et=Math.floor(Je);if(Ee.current.width!==Ke||Ee.current.height!==et||Ee.current.offsetWidth!==Ye||Ee.current.offsetHeight!==He){var Ve={width:Ke,height:et,offsetWidth:Ye,offsetHeight:He};Ee.current=Ve;var Ge=Ye===Math.round(Le)?Le:Ye,ye=He===Math.round(Je)?Je:He,Ze=Object(F.a)(Object(F.a)({},Ve),{},{offsetWidth:Ge,offsetHeight:ye});ue==null||ue(Ze,Ce,je),Be&&Promise.resolve().then(function(){Be(Ze,Ce)})}},[]);return O.useEffect(function(){var Ce=Object(T.a)(me.current)||Object(T.a)(ae.current);return Ce&&!fe&&s(Ce,we),function(){return l(Ce,we)}},[me.current,fe]),O.createElement(w,{ref:ae},Ie?O.cloneElement(pe,{ref:Xe}):pe)}var v="rc-observer-key";function c(ge){var pe=ge.children,fe=Object(R.a)(pe);return fe.map(function(me,ae){var ue=(me==null?void 0:me.key)||"".concat(v,"-").concat(ae);return O.createElement(C,Object(Z.a)({},ge,{key:ue}),me)})}c.Collection=h;var f=c,d=J("bT9E"),a=J("TSYQ"),b=J.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
|
|
`,x=["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"],P={},N;function K(ge){var pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,fe=ge.getAttribute("id")||ge.getAttribute("data-reactid")||ge.getAttribute("name");if(pe&&P[fe])return P[fe];var me=window.getComputedStyle(ge),ae=me.getPropertyValue("box-sizing")||me.getPropertyValue("-moz-box-sizing")||me.getPropertyValue("-webkit-box-sizing"),ue=parseFloat(me.getPropertyValue("padding-bottom"))+parseFloat(me.getPropertyValue("padding-top")),Ee=parseFloat(me.getPropertyValue("border-bottom-width"))+parseFloat(me.getPropertyValue("border-top-width")),Ie=x.map(function(Xe){return"".concat(Xe,":").concat(me.getPropertyValue(Xe))}).join(";"),ke={sizingStyle:Ie,paddingSize:ue,borderSize:Ee,boxSizing:ae};return pe&&fe&&(P[fe]=ke),ke}function V(ge){var pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,fe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;N||(N=document.createElement("textarea"),N.setAttribute("tab-index","-1"),N.setAttribute("aria-hidden","true"),document.body.appendChild(N)),ge.getAttribute("wrap")?N.setAttribute("wrap",ge.getAttribute("wrap")):N.removeAttribute("wrap");var ae=K(ge,pe),ue=ae.paddingSize,Ee=ae.borderSize,Ie=ae.boxSizing,ke=ae.sizingStyle;N.setAttribute("style","".concat(ke,";").concat(p)),N.value=ge.value||ge.placeholder||"";var Xe=Number.MIN_SAFE_INTEGER,Ne=Number.MAX_SAFE_INTEGER,we=N.scrollHeight,Ce;if(Ie==="border-box"?we+=Ee:Ie==="content-box"&&(we-=ue),fe!==null||me!==null){N.value=" ";var Re=N.scrollHeight-ue;fe!==null&&(Xe=Re*fe,Ie==="border-box"&&(Xe=Xe+ue+Ee),we=Math.max(Xe,we)),me!==null&&(Ne=Re*me,Ie==="border-box"&&(Ne=Ne+ue+Ee),Ce=we>Ne?"":"hidden",we=Math.min(Ne,we))}return{height:we,minHeight:Xe,maxHeight:Ne,overflowY:Ce,resize:"none"}}var B=J("Gytx"),U=J.n(B),Y;(function(ge){ge[ge.NONE=0]="NONE",ge[ge.RESIZING=1]="RESIZING",ge[ge.RESIZED=2]="RESIZED"})(Y||(Y={}));var ee=function(ge){Object(W.a)(fe,ge);var pe=Object(M.a)(fe);function fe(me){var ae;return Object(G.a)(this,fe),ae=pe.call(this,me),ae.nextFrameActionId=void 0,ae.resizeFrameId=void 0,ae.textArea=void 0,ae.saveTextArea=function(ue){ae.textArea=ue},ae.handleResize=function(ue){var Ee=ae.state.resizeStatus,Ie=ae.props,ke=Ie.autoSize,Xe=Ie.onResize;if(Ee!==Y.NONE)return;typeof Xe=="function"&&Xe(ue),ke&&ae.resizeOnNextFrame()},ae.resizeOnNextFrame=function(){cancelAnimationFrame(ae.nextFrameActionId),ae.nextFrameActionId=requestAnimationFrame(ae.resizeTextarea)},ae.resizeTextarea=function(){var ue=ae.props.autoSize;if(!ue||!ae.textArea)return;var Ee=ue.minRows,Ie=ue.maxRows,ke=V(ae.textArea,!1,Ee,Ie);ae.setState({textareaStyles:ke,resizeStatus:Y.RESIZING},function(){cancelAnimationFrame(ae.resizeFrameId),ae.resizeFrameId=requestAnimationFrame(function(){ae.setState({resizeStatus:Y.RESIZED},function(){ae.resizeFrameId=requestAnimationFrame(function(){ae.setState({resizeStatus:Y.NONE}),ae.fixFirefoxAutoScroll()})})})})},ae.renderTextArea=function(){var ue=ae.props,Ee=ue.prefixCls,Ie=Ee===void 0?"rc-textarea":Ee,ke=ue.autoSize,Xe=ue.onResize,Ne=ue.className,we=ue.disabled,Ce=ae.state,Re=Ce.textareaStyles,Be=Ce.resizeStatus,je=Object(d.a)(ae.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ae=b()(Ie,Ne,Object(I.a)({},"".concat(Ie,"-disabled"),we));"value"in je&&(je.value=je.value||"");var Le=Object(F.a)(Object(F.a)(Object(F.a)({},ae.props.style),Re),Be===Y.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return O.createElement(f,{onResize:ae.handleResize,disabled:!(ke||Xe)},O.createElement("textarea",Object(Z.a)({},je,{className:Ae,style:Le,ref:ae.saveTextArea})))},ae.state={textareaStyles:{},resizeStatus:Y.NONE},ae}return Object(D.a)(fe,[{key:"componentDidUpdate",value:function(ae){(ae.value!==this.props.value||!U()(ae.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 ae=this.textArea.selectionStart,ue=this.textArea.selectionEnd;this.textArea.setSelectionRange(ae,ue)}}catch(Ee){}}},{key:"render",value:function(){return this.renderTextArea()}}]),fe}(O.Component),oe=ee,de=function(ge){Object(W.a)(fe,ge);var pe=Object(M.a)(fe);function fe(me){var ae;Object(G.a)(this,fe),ae=pe.call(this,me),ae.resizableTextArea=void 0,ae.focus=function(){ae.resizableTextArea.textArea.focus()},ae.saveTextArea=function(Ee){ae.resizableTextArea=Ee},ae.handleChange=function(Ee){var Ie=ae.props.onChange;ae.setValue(Ee.target.value,function(){ae.resizableTextArea.resizeTextarea()}),Ie&&Ie(Ee)},ae.handleKeyDown=function(Ee){var Ie=ae.props,ke=Ie.onPressEnter,Xe=Ie.onKeyDown;Ee.keyCode===13&&ke&&ke(Ee),Xe&&Xe(Ee)};var ue=typeof me.value=="undefined"||me.value===null?me.defaultValue:me.value;return ae.state={value:ue},ae}return Object(D.a)(fe,[{key:"setValue",value:function(ae,ue){"value"in this.props||this.setState({value:ae},ue)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return O.createElement(oe,Object(Z.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ae){return"value"in ae?{value:ae.value}:null}}]),fe}(O.Component),Te=Qe.default=de},ZpRC:function(dt,Qe,J){"use strict";function Z(g){return typeof g=="object"&&g!=null&&g.nodeType===1}function G(g,T){return(!T||g!=="hidden")&&g!=="visible"&&g!=="clip"}function D(g,T){if(g.clientHeight<g.scrollHeight||g.clientWidth<g.scrollWidth){var A=getComputedStyle(g,null);return G(A.overflowY,T)||G(A.overflowX,T)||function(L){var S=function(y){if(!y.ownerDocument||!y.ownerDocument.defaultView)return null;try{return y.ownerDocument.defaultView.frameElement}catch(u){return null}}(L);return!!S&&(S.clientHeight<L.scrollHeight||S.clientWidth<L.scrollWidth)}(g)}return!1}function W(g,T,A,L,S,y,u,o){return y<g&&u>T||y>g&&u<T?0:y<=g&&o<=A||u>=T&&o>=A?y-g-L:u>T&&o<A||y<g&&o>A?u-T+S:0}var M=function(g,T){var A=window,L=T.scrollMode,S=T.block,y=T.inline,u=T.boundary,o=T.skipOverflowHiddenElements,s=typeof u=="function"?u:function(Re){return Re!==u};if(!Z(g))throw new TypeError("Invalid target");for(var l=document.scrollingElement||document.documentElement,w=[],m=g;Z(m)&&s(m);){if((m=m.parentElement)===l){w.push(m);break}m!=null&&m===document.body&&D(m)&&!D(document.documentElement)||m!=null&&D(m,o)&&w.push(m)}for(var h=A.visualViewport?A.visualViewport.width:innerWidth,C=A.visualViewport?A.visualViewport.height:innerHeight,v=window.scrollX||pageXOffset,c=window.scrollY||pageYOffset,f=g.getBoundingClientRect(),d=f.height,a=f.width,b=f.top,p=f.right,x=f.bottom,P=f.left,N=S==="start"||S==="nearest"?b:S==="end"?x:b+d/2,K=y==="center"?P+a/2:y==="end"?p:P,V=[],B=0;B<w.length;B++){var U=w[B],Y=U.getBoundingClientRect(),ee=Y.height,oe=Y.width,de=Y.top,Te=Y.right,ge=Y.bottom,pe=Y.left;if(L==="if-needed"&&b>=0&&P>=0&&x<=C&&p<=h&&b>=de&&x<=ge&&P>=pe&&p<=Te)return V;var fe=getComputedStyle(U),me=parseInt(fe.borderLeftWidth,10),ae=parseInt(fe.borderTopWidth,10),ue=parseInt(fe.borderRightWidth,10),Ee=parseInt(fe.borderBottomWidth,10),Ie=0,ke=0,Xe="offsetWidth"in U?U.offsetWidth-U.clientWidth-me-ue:0,Ne="offsetHeight"in U?U.offsetHeight-U.clientHeight-ae-Ee:0;if(l===U)Ie=S==="start"?N:S==="end"?N-C:S==="nearest"?W(c,c+C,C,ae,Ee,c+N,c+N+d,d):N-C/2,ke=y==="start"?K:y==="center"?K-h/2:y==="end"?K-h:W(v,v+h,h,me,ue,v+K,v+K+a,a),Ie=Math.max(0,Ie+c),ke=Math.max(0,ke+v);else{Ie=S==="start"?N-de-ae:S==="end"?N-ge+Ee+Ne:S==="nearest"?W(de,ge,ee,ae,Ee+Ne,N,N+d,d):N-(de+ee/2)+Ne/2,ke=y==="start"?K-pe-me:y==="center"?K-(pe+oe/2)+Xe/2:y==="end"?K-Te+ue+Xe:W(pe,Te,oe,me,ue+Xe,K,K+a,a);var we=U.scrollLeft,Ce=U.scrollTop;N+=Ce-(Ie=Math.max(0,Math.min(Ce+Ie,U.scrollHeight-ee+Ne))),K+=we-(ke=Math.max(0,Math.min(we+ke,U.scrollWidth-oe+Xe)))}V.push({el:U,top:Ie,left:ke})}return V};function O(g){return g===Object(g)&&Object.keys(g).length!==0}function F(g,T){T===void 0&&(T="auto");var A="scrollBehavior"in document.body.style;g.forEach(function(L){var S=L.el,y=L.top,u=L.left;S.scroll&&A?S.scroll({top:y,left:u,behavior:T}):(S.scrollTop=y,S.scrollLeft=u)})}function I(g){return g===!1?{block:"end",inline:"nearest"}:O(g)?g:{block:"start",inline:"nearest"}}function R(g,T){var A=!g.ownerDocument.documentElement.contains(g);if(O(T)&&typeof T.behavior=="function")return T.behavior(A?[]:M(g,T));if(A)return;var L=I(T);return F(M(g,L),L.behavior)}var _=Qe.a=R},bT9E:function(dt,Qe,J){"use strict";J.d(Qe,"a",function(){return G});var Z=J("VTBJ");function G(D,W){var M=Object(Z.a)({},D);return Array.isArray(W)&&W.forEach(function(O){delete M[O]}),M}},c5Ni:function(dt,Qe,J){},dejd:function(dt,Qe,J){},dmUQ:function(dt,Qe,J){"use strict";var Z=J("Ff2n"),G=J("rePB"),D=J("1OyB"),W=J("vuIU"),M=J("Ji7U"),O=J("md7G"),F=J("foSv"),I=J("cDcd"),R=J.n(I),_=J("TSYQ"),g=J.n(_),T=J("4IlW");function A(d,a){var b=Object.keys(d);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(d);a&&(p=p.filter(function(x){return Object.getOwnPropertyDescriptor(d,x).enumerable})),b.push.apply(b,p)}return b}function L(d){for(var a=1;a<arguments.length;a++){var b=arguments[a]!=null?arguments[a]:{};a%2?A(Object(b),!0).forEach(function(p){Object(G.a)(d,p,b[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(b)):A(Object(b)).forEach(function(p){Object.defineProperty(d,p,Object.getOwnPropertyDescriptor(b,p))})}return d}function S(d){var a=y();return function(){var p=Object(F.a)(d),x;if(a){var P=Object(F.a)(this).constructor;x=Reflect.construct(p,arguments,P)}else x=p.apply(this,arguments);return Object(O.a)(this,x)}}function y(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(d){return!1}}function u(){}function o(d){d.preventDefault()}var s=function(a){return a.replace(/[^\w.-]+/g,"")},l=200,w=600,m=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,h=function(a){return a!=null},C=function(a,b){return b===a||typeof b=="number"&&typeof a=="number"&&isNaN(b)&&isNaN(a)},v=function(d){Object(M.a)(b,d);var a=S(b);function b(p){var x;Object(D.a)(this,b),x=a.call(this,p),x.onKeyDown=function(K){var V=x.props,B=V.onKeyDown,U=V.onPressEnter;if(K.keyCode===T.a.UP){var Y=x.getRatio(K);x.up(K,Y,null),x.stop()}else if(K.keyCode===T.a.DOWN){var ee=x.getRatio(K);x.down(K,ee,null),x.stop()}else K.keyCode===T.a.ENTER&&U&&U(K);if(x.recordCursorPosition(),x.lastKeyCode=K.keyCode,B){for(var oe=arguments.length,de=new Array(oe>1?oe-1:0),Te=1;Te<oe;Te++)de[Te-1]=arguments[Te];B.apply(void 0,[K].concat(de))}},x.onKeyUp=function(K){var V=x.props.onKeyUp;if(x.stop(),x.recordCursorPosition(),V){for(var B=arguments.length,U=new Array(B>1?B-1:0),Y=1;Y<B;Y++)U[Y-1]=arguments[Y];V.apply(void 0,[K].concat(U))}},x.onChange=function(K){var V=x.props.onChange;x.state.focused&&(x.inputting=!0),x.rawInput=x.props.parser(x.getValueFromEvent(K)),x.setState({inputValue:x.rawInput}),V(x.toNumber(x.rawInput))},x.onMouseUp=function(){var K=x.props.onMouseUp;x.recordCursorPosition(),K&&K.apply(void 0,arguments)},x.onFocus=function(){var K;x.setState({focused:!0}),(K=x.props).onFocus.apply(K,arguments)},x.onBlur=function(){var K=x.props.onBlur;x.inputting=!1,x.setState({focused:!1});var V=x.getCurrentValidValue(x.state.inputValue),B=x.setValue(V,u);if(K){var U=x.input.value,Y=x.getInputDisplayValue({focus:!1,value:B});x.input.value=Y&&Number(Y),K.apply(void 0,arguments),x.input.value=U}},x.getRatio=function(K){var V=1;return K.metaKey||K.ctrlKey?V=.1:K.shiftKey&&(V=10),V},x.getFullNum=function(K){return isNaN(K)?K:/e/i.test(String(K))?Number(K).toFixed(18).replace(/\.?0+$/,""):K},x.getPrecision=function(K){if(h(x.props.precision))return x.props.precision;var V=String(K);if(V.indexOf("e-")>=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var B=0;return V.indexOf(".")>=0&&(B=V.length-V.indexOf(".")-1),B},x.getInputDisplayValue=function(K){var V=K||x.state,B=V.focused,U=V.inputValue,Y=V.value,ee;B?ee=U:ee=x.toPrecisionAsStep(Y),ee==null&&(ee="");var oe=x.formatWrapper(ee);return h(x.props.decimalSeparator)&&(oe=oe.toString().replace(".",x.props.decimalSeparator)),oe},x.recordCursorPosition=function(){try{x.cursorStart=x.input.selectionStart,x.cursorEnd=x.input.selectionEnd,x.currentValue=x.input.value,x.cursorBefore=x.input.value.substring(0,x.cursorStart),x.cursorAfter=x.input.value.substring(x.cursorEnd)}catch(K){}},x.restoreByAfter=function(K){if(K===void 0)return!1;var V=x.input.value,B=V.lastIndexOf(K);if(B===-1)return!1;var U=x.cursorBefore.length;return x.lastKeyCode===T.a.DELETE&&x.cursorBefore.charAt(U-1)===K[0]?(x.fixCaret(U,U),!0):B+K.length===V.length?(x.fixCaret(B,B),!0):!1},x.partRestoreByAfter=function(K){return K===void 0?!1:Array.prototype.some.call(K,function(V,B){var U=K.substring(B);return x.restoreByAfter(U)})},x.isNotCompleteNumber=function(K){return isNaN(K)||K===""||K===null||K&&K.toString().indexOf(".")===K.toString().length-1},x.stop=function(){x.autoStepTimer&&clearTimeout(x.autoStepTimer)},x.down=function(K,V,B){x.pressingUpOrDown=!0,x.step("down",K,V,B)},x.up=function(K,V,B){x.pressingUpOrDown=!0,x.step("up",K,V,B)},x.saveInput=function(K){x.input=K};var P=p.value;P===void 0&&(P=p.defaultValue),x.state={focused:p.autoFocus};var N=x.getValidValue(x.toNumber(P));return x.state=L(L({},x.state),{},{inputValue:x.toPrecisionAsStep(N),value:N}),x}return Object(W.a)(b,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(x){var P=this.props,N=P.value,K=P.onChange,V=P.max,B=P.min,U=this.state.focused;if(x){if(!C(x.value,N)||!C(x.max,V)||!C(x.min,B)){var Y=U?N:this.getValidValue(N),ee;this.pressingUpOrDown?ee=Y:this.inputting?ee=this.rawInput:ee=this.toPrecisionAsStep(Y),this.setState({value:Y,inputValue:ee})}var oe="value"in this.props?N:this.state.value;"max"in this.props&&x.max!==V&&typeof oe=="number"&&oe>V&&K&&K(V),"min"in this.props&&x.min!==B&&typeof oe=="number"&&oe<B&&K&&K(B)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var de=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===T.a.BACKSPACE?de=this.cursorStart-1:this.lastKeyCode===T.a.DELETE&&(de=this.cursorStart):de=this.input.value.length,this.fixCaret(de,de)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case 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(x){var P=x;return P===""?P="":this.isNotCompleteNumber(parseFloat(P))?P=this.state.value:P=this.getValidValue(P),this.toNumber(P)}},{key:"getValueFromEvent",value:function(x){var P=x.target.value.trim().replace(/。/g,".");return h(this.props.decimalSeparator)&&(P=P.replace(this.props.decimalSeparator,".")),P}},{key:"getValidValue",value:function(x){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,K=parseFloat(x);return isNaN(K)?x:(K<P&&(K=P),K>N&&(K=N),K)}},{key:"setValue",value:function(x,P){var N=this.props.precision,K=this.isNotCompleteNumber(parseFloat(x))?null:parseFloat(x),V=this.state.value,B=V===void 0?null:V,U=this.state.inputValue,Y=U===void 0?null:U,ee=typeof K=="number"?K.toFixed(N):"".concat(K),oe=K!==B||ee!=="".concat(Y);return"value"in this.props?(Y=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:Y},P)):this.setState({value:K,inputValue:this.toPrecisionAsStep(x)},P),oe&&this.props.onChange(K),K}},{key:"getMaxPrecision",value:function(x){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,N=this.props,K=N.precision,V=N.step;if(h(K))return K;var B=this.getPrecision(P),U=this.getPrecision(V),Y=this.getPrecision(x);return x?Math.max(Y,B+U):B+U}},{key:"getPrecisionFactor",value:function(x){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,N=this.getMaxPrecision(x,P);return Math.pow(10,N)}},{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(x){return this.props.formatter?this.props.formatter(x):x}},{key:"toPrecisionAsStep",value:function(x){if(this.isNotCompleteNumber(x)||x==="")return x;var P=Math.abs(this.getMaxPrecision(x));return isNaN(P)?x.toString():Number(x).toFixed(P)}},{key:"toNumber",value:function(x){var P=this.props.precision,N=this.state.focused,K=x&&x.length>16&&N;return this.isNotCompleteNumber(x)||K?x:h(P)?Math.round(x*Math.pow(10,P))/Math.pow(10,P):Number(x)}},{key:"upStep",value:function(x,P){var N=this.props.step,K=this.getPrecisionFactor(x,P),V=Math.abs(this.getMaxPrecision(x,P)),B=((K*x+K*N*P)/K).toFixed(V);return this.toNumber(B)}},{key:"downStep",value:function(x,P){var N=this.props.step,K=this.getPrecisionFactor(x,P),V=Math.abs(this.getMaxPrecision(x,P)),B=((K*x-K*N*P)/K).toFixed(V);return this.toNumber(B)}},{key:"step",value:function(x,P){var N=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),P&&(P.persist(),P.preventDefault());var B=this.props;if(B.disabled)return;var U=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(U))return;var Y=this["".concat(x,"Step")](U,K),ee=Y>B.max||Y<B.min;if(Y>B.max?Y=B.max:Y<B.min&&(Y=B.min),this.setValue(Y,null),this.setState({focused:!0},function(){N.pressingUpOrDown=!1}),ee)return;this.autoStepTimer=setTimeout(function(){N[x](P,K,!0)},V?l:w)}},{key:"fixCaret",value:function(x,P){if(x===void 0||P===void 0||!this.input||!this.input.value)return;try{var N=this.input.selectionStart,K=this.input.selectionEnd;(x!==N||P!==K)&&this.input.setSelectionRange(x,P)}catch(V){}}},{key:"render",value:function(){var x,P=this.props,N=P.prefixCls,K=P.disabled,V=P.readOnly,B=P.useTouch,U=P.autoComplete,Y=P.upHandler,ee=P.downHandler,oe=P.className,de=P.max,Te=P.min,ge=P.style,pe=P.title,fe=P.onMouseEnter,me=P.onMouseLeave,ae=P.onMouseOver,ue=P.onMouseOut,Ee=P.required,Ie=P.onClick,ke=P.tabIndex,Xe=P.type,Ne=P.placeholder,we=P.id,Ce=P.inputMode,Re=P.pattern,Be=P.step,je=P.maxLength,Ae=P.autoFocus,Le=P.name,Je=P.onPaste,Ye=P.onInput,He=Object(Z.a)(P,["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"]),Ke=this.state,et=Ke.value,Ve=Ke.focused,Ge=g()(N,(x={},Object(G.a)(x,oe,!!oe),Object(G.a)(x,"".concat(N,"-disabled"),K),Object(G.a)(x,"".concat(N,"-focused"),Ve),x)),ye={};Object.keys(He).forEach(function(te){(te.substr(0,5)==="data-"||te.substr(0,5)==="aria-"||te==="role")&&(ye[te]=He[te])});var Ze=!V&&!K,ze=this.getInputDisplayValue(null),be=(et||et===0)&&(isNaN(et)||Number(et)>=de),_e=(et||et===0)&&(isNaN(et)||Number(et)<=Te),le=be||K||V,ne=_e||K||V,ie=g()("".concat(N,"-handler"),"".concat(N,"-handler-up"),Object(G.a)({},"".concat(N,"-handler-up-disabled"),le)),X=g()("".concat(N,"-handler"),"".concat(N,"-handler-down"),Object(G.a)({},"".concat(N,"-handler-down-disabled"),ne)),$=B?{onTouchStart:le?u:this.up,onTouchEnd:this.stop}:{onMouseDown:le?u:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},Q=B?{onTouchStart:ne?u:this.down,onTouchEnd:this.stop}:{onMouseDown:ne?u:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return R.a.createElement("div",{className:Ge,style:ge,title:pe,onMouseEnter:fe,onMouseLeave:me,onMouseOver:ae,onMouseOut:ue,onFocus:function(){return null},onBlur:function(){return null}},R.a.createElement("div",{className:"".concat(N,"-handler-wrap")},R.a.createElement("span",Object.assign({unselectable:"on"},$,{role:"button","aria-label":"Increase Value","aria-disabled":le,className:ie}),Y||R.a.createElement("span",{unselectable:"on",className:"".concat(N,"-handler-up-inner"),onClick:o})),R.a.createElement("span",Object.assign({unselectable:"on"},Q,{role:"button","aria-label":"Decrease Value","aria-disabled":ne,className:X}),ee||R.a.createElement("span",{unselectable:"on",className:"".concat(N,"-handler-down-inner"),onClick:o}))),R.a.createElement("div",{className:"".concat(N,"-input-wrap")},R.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Te,"aria-valuemax":de,"aria-valuenow":et,required:Ee,type:Xe,placeholder:Ne,onPaste:Je,onClick:Ie,onMouseUp:this.onMouseUp,className:"".concat(N,"-input"),tabIndex:ke,autoComplete:U,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Ze?this.onKeyDown:u,onKeyUp:Ze?this.onKeyUp:u,autoFocus:Ae,maxLength:je,readOnly:V,disabled:K,max:de,min:Te,step:Be,name:Le,title:pe,id:we,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(ze),pattern:Re,inputMode:Ce,onInput:Ye},ye))))}}]),b}(R.a.Component);v.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:m,min:-m,step:1,style:{},onChange:u,onKeyDown:u,onPressEnter:u,onFocus:u,onBlur:u,parser:s,required:!1,autoComplete:"off"};var c=v,f=Qe.a=c},fnXi:function(dt,Qe,J){"use strict";var Z=J("2qtc"),G=J("kLXV"),D=J("cDcd"),W=J.n(D),M=J("Ty5D"),O=J("9kvl"),F=J("93VE"),I=J.n(F),R=function(g){var T=g.activeIndex,A=g.isEdit,L=A===void 0?!0:A,S=g.dispatch,y=g.practiceSetting,u=Object(M.i)(),o=u.id,s=u.challengesId,l=Object(D.useMemo)(function(){return[{name:"\u672C\u5173\u4EFB\u52A1",url:"/shixuns/".concat(o,"/edit/").concat(s,"/editcheckpoint")},{name:"\u8BC4\u6D4B\u8BBE\u7F6E",url:"/shixuns/".concat(o,"/edit/").concat(s,"/tab=2")},{name:"\u53C2\u8003\u7B54\u6848",url:"/shixuns/".concat(o,"/edit/").concat(s,"/tab=3")},{name:"\u5173\u5361\u6392\u884C\u699C",url:"/shixuns/".concat(o,"/edit/").concat(s,"/tab=4")}]},[o,s]),w=function(h){var C,v=function(){O.d.push(h),S({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1}})};y!=null&&(C=y.sideBar)!==null&&C!==void 0&&C.confirmLeave?G.a.confirm({title:"\u79BB\u5F00\u6B64\u9875\u63D0\u793A",content:"\u7CFB\u7EDF\u53EF\u80FD\u4E0D\u4F1A\u4FDD\u5B58\u60A8\u6240\u505A\u7684\u66F4\u6539\u3002",okText:"\u79BB\u5F00",cancelText:"\u53D6\u6D88",onOk:function(){v()}}):v()};return W.a.createElement("ul",{className:"challenge-nav"},L?l.map(function(m,h){return T===h?W.a.createElement("li",{key:m.url}," ",W.a.createElement("a",{className:"active"},m.name)," "):W.a.createElement("li",{key:m.url}," ",W.a.createElement("a",{onClick:function(){return w(m.url)}},m.name)," ")}):W.a.createElement("li",{key:l[0].url}," ",W.a.createElement("a",{className:"active"},l[0].name)," "))};Qe.a=Object(O.a)(function(_){var g=_.globalSetting,T=_.practiceSetting;return{globalSetting:g,practiceSetting:T}})(R)},kSUc:function(dt,Qe,J){},lZu9:function(dt,Qe,J){(function(Z){Z(J("VrN/"),J("1eCo"),J("8EBN"))})(function(Z){"use strict";Z.defineMode("markdown",function(G,D){var W=Z.getMode(G,"text/html"),M=W.name=="null";function O(B){if(Z.findModeByName){var U=Z.findModeByName(B);U&&(B=U.mime||U.mimes[0])}var Y=Z.getMode(G,B);return Y.name=="null"?null:Y}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 F={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 I in F)F.hasOwnProperty(I)&&D.tokenTypeOverrides[I]&&(F[I]=D.tokenTypeOverrides[I]);var R=/^([*\-_])(?:\s*\1){2,}\s*$/,_=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,g=/^\[(x| )\](?=\s)/i,T=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,A=/^ {0,3}(?:\={1,}|-{2,})\s*$/,L=/^[^#!\[\]*_\\<>` "'(~:]+/,S=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,y=/^\s*\[[^\]]+?\]:.*$/,u=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function s(B,U,Y){return U.f=U.inline=Y,Y(B,U)}function l(B,U,Y){return U.f=U.block=Y,Y(B,U)}function w(B){return!B||!/\S/.test(B.string)}function m(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==C){var U=M;if(!U){var Y=Z.innerMode(W,B.htmlState);U=Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText}U&&(B.f=d,B.block=h,B.htmlState=null)}return B.trailingSpace=0,B.trailingSpaceNewLine=!1,B.prevLine=B.thisLine,B.thisLine={stream:null},null}function h(B,U){var Y=B.column()===U.indentation,ee=w(U.prevLine.stream),oe=U.indentedCode,de=U.prevLine.hr,Te=U.list!==!1,ge=(U.listStack[U.listStack.length-1]||0)+3;U.indentedCode=!1;var pe=U.indentation;if(U.indentationDiff===null&&(U.indentationDiff=U.indentation,Te)){for(U.list=null;pe<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=pe-U.listStack[U.listStack.length-1])}var fe=!ee&&!de&&!U.prevLine.header&&(!Te||!oe)&&!U.prevLine.fencedCodeEnd,me=(U.list===!1||de||ee)&&U.indentation<=ge&&B.match(R),ae=null;if(U.indentationDiff>=4&&(oe||U.prevLine.fencedCodeEnd||U.prevLine.header||ee))return B.skipToEnd(),U.indentedCode=!0,F.code;if(B.eatSpace())return null;if(Y&&U.indentation<=ge&&(ae=B.match(T))&&ae[1].length<=6)return U.quote=0,U.header=ae[1].length,U.thisLine.header=!0,D.highlightFormatting&&(U.formatting="header"),U.f=U.inline,c(U);if(U.indentation<=ge&&B.eat(">"))return U.quote=Y?1:U.quote+1,D.highlightFormatting&&(U.formatting="quote"),B.eatSpace(),c(U);if(!me&&!U.setext&&Y&&U.indentation<=ge&&(ae=B.match(_))){var ue=ae[1]?"ol":"ul";return U.indentation=pe+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(g,!1)&&(U.taskList=!0),U.f=U.inline,D.highlightFormatting&&(U.formatting=["list","list-"+ue]),c(U)}else{if(Y&&U.indentation<=ge&&(ae=B.match(S,!0)))return U.quote=0,U.fencedEndRE=new RegExp(ae[1]+"+ *$"),U.localMode=D.fencedCodeBlockHighlighting&&O(ae[2]||D.fencedCodeBlockDefaultMode),U.localMode&&(U.localState=Z.startState(U.localMode)),U.f=U.block=v,D.highlightFormatting&&(U.formatting="code-block"),U.code=-1,c(U);if(U.setext||(!fe||!Te)&&!U.quote&&U.list===!1&&!U.code&&!me&&!y.test(B.string)&&(ae=B.lookAhead(1))&&(ae=ae.match(A)))return U.setext?(U.header=U.setext,U.setext=0,B.skipToEnd(),D.highlightFormatting&&(U.formatting="header")):(U.header=ae[0].charAt(0)=="="?1:2,U.setext=U.header),U.thisLine.header=!0,U.f=U.inline,c(U);if(me)return B.skipToEnd(),U.hr=!0,U.thisLine.hr=!0,F.hr;if(B.peek()==="[")return s(B,U,P)}return s(B,U,U.inline)}function C(B,U){var Y=W.token(B,U.htmlState);if(!M){var ee=Z.innerMode(W,U.htmlState);(ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText||U.md_inside&&B.current().indexOf(">")>-1)&&(U.f=d,U.block=h,U.htmlState=null)}return Y}function v(B,U){var Y=U.listStack[U.listStack.length-1]||0,ee=U.indentation<Y,oe=Y+3;if(U.fencedEndRE&&U.indentation<=oe&&(ee||B.match(U.fencedEndRE))){D.highlightFormatting&&(U.formatting="code-block");var de;return ee||(de=c(U)),U.localMode=U.localState=null,U.block=h,U.f=d,U.fencedEndRE=null,U.code=0,U.thisLine.fencedCodeEnd=!0,ee?l(B,U,U.block):de}else return U.localMode?U.localMode.token(B,U.localState):(B.skipToEnd(),F.code)}function c(B){var U=[];if(B.formatting){U.push(F.formatting),typeof B.formatting=="string"&&(B.formatting=[B.formatting]);for(var Y=0;Y<B.formatting.length;Y++)U.push(F.formatting+"-"+B.formatting[Y]),B.formatting[Y]==="header"&&U.push(F.formatting+"-"+B.formatting[Y]+"-"+B.header),B.formatting[Y]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=B.quote?U.push(F.formatting+"-"+B.formatting[Y]+"-"+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(F.linkHref,"url"):(B.strong&&U.push(F.strong),B.em&&U.push(F.em),B.strikethrough&&U.push(F.strikethrough),B.emoji&&U.push(F.emoji),B.linkText&&U.push(F.linkText),B.code&&U.push(F.code),B.image&&U.push(F.image),B.imageAltText&&U.push(F.imageAltText,"link"),B.imageMarker&&U.push(F.imageMarker)),B.header&&U.push(F.header,F.header+"-"+B.header),B.quote&&(U.push(F.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=B.quote?U.push(F.quote+"-"+B.quote):U.push(F.quote+"-"+D.maxBlockquoteDepth)),B.list!==!1){var ee=(B.listStack.length-1)%3;ee?ee===1?U.push(F.list2):U.push(F.list3):U.push(F.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 f(B,U){return B.match(L,!0)?c(U):void 0}function d(B,U){var Y=U.text(B,U);if(typeof Y!="undefined")return Y;if(U.list)return U.list=null,c(U);if(U.taskList){var ee=B.match(g,!0)[1]===" ";return ee?U.taskOpen=!0:U.taskClosed=!0,D.highlightFormatting&&(U.formatting="task"),U.taskList=!1,c(U)}if(U.taskOpen=!1,U.taskClosed=!1,U.header&&B.match(/^#+$/,!0))return D.highlightFormatting&&(U.formatting="header"),c(U);var oe=B.next();if(U.linkTitle){U.linkTitle=!1;var de=oe;oe==="("&&(de=")"),de=(de+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Te="^\\s*(?:[^"+de+"\\\\]+|\\\\\\\\|\\\\.)"+de;if(B.match(new RegExp(Te),!0))return F.linkHref}if(oe==="`"){var ge=U.formatting;D.highlightFormatting&&(U.formatting="code"),B.eatWhile("`");var pe=B.current().length;if(U.code==0&&(!U.quote||pe==1))return U.code=pe,c(U);if(pe==U.code){var fe=c(U);return U.code=0,fe}else return U.formatting=ge,c(U)}else if(U.code)return c(U);if(oe==="\\"&&(B.next(),D.highlightFormatting)){var me=c(U),ae=F.formatting+"-escape";return me?me+" "+ae:ae}if(oe==="!"&&B.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return U.imageMarker=!0,U.image=!0,D.highlightFormatting&&(U.formatting="image"),c(U);if(oe==="["&&U.imageMarker&&B.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return U.imageMarker=!1,U.imageAltText=!0,D.highlightFormatting&&(U.formatting="image"),c(U);if(oe==="]"&&U.imageAltText){D.highlightFormatting&&(U.formatting="image");var me=c(U);return U.imageAltText=!1,U.image=!1,U.inline=U.f=b,me}if(oe==="["&&!U.image)return U.linkText&&B.match(/^.*?\]/)||(U.linkText=!0,D.highlightFormatting&&(U.formatting="link")),c(U);if(oe==="]"&&U.linkText){D.highlightFormatting&&(U.formatting="link");var me=c(U);return U.linkText=!1,U.inline=U.f=B.match(/\(.*?\)| ?\[.*?\]/,!1)?b:d,me}if(oe==="<"&&B.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){U.f=U.inline=a,D.highlightFormatting&&(U.formatting="link");var me=c(U);return me?me+=" ":me="",me+F.linkInline}if(oe==="<"&&B.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){U.f=U.inline=a,D.highlightFormatting&&(U.formatting="link");var me=c(U);return me?me+=" ":me="",me+F.linkEmail}if(D.xml&&oe==="<"&&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 Ee=B.string.substring(B.start,ue);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Ee)&&(U.md_inside=!0)}return B.backUp(1),U.htmlState=Z.startState(W),l(B,U,C)}if(D.xml&&oe==="<"&&B.match(/^\/\w*?>/))return U.md_inside=!1,"tag";if(oe==="*"||oe==="_"){for(var Ie=1,ke=B.pos==1?" ":B.string.charAt(B.pos-2);Ie<3&&B.eat(oe);)Ie++;var Xe=B.peek()||" ",Ne=!/\s/.test(Xe)&&(!u.test(Xe)||/\s/.test(ke)||u.test(ke)),we=!/\s/.test(ke)&&(!u.test(ke)||/\s/.test(Xe)||u.test(Xe)),Ce=null,Re=null;if(Ie%2&&(!U.em&&Ne&&(oe==="*"||!we||u.test(ke))?Ce=!0:U.em==oe&&we&&(oe==="*"||!Ne||u.test(Xe))&&(Ce=!1)),Ie>1&&(!U.strong&&Ne&&(oe==="*"||!we||u.test(ke))?Re=!0:U.strong==oe&&we&&(oe==="*"||!Ne||u.test(Xe))&&(Re=!1)),Re!=null||Ce!=null){D.highlightFormatting&&(U.formatting=Ce==null?"strong":Re==null?"em":"strong em"),Ce===!0&&(U.em=oe),Re===!0&&(U.strong=oe);var fe=c(U);return Ce===!1&&(U.em=!1),Re===!1&&(U.strong=!1),fe}}else if(oe===" "&&(B.eat("*")||B.eat("_"))){if(B.peek()===" ")return c(U);B.backUp(1)}if(D.strikethrough){if(oe==="~"&&B.eatWhile(oe)){if(U.strikethrough){D.highlightFormatting&&(U.formatting="strikethrough");var fe=c(U);return U.strikethrough=!1,fe}else if(B.match(/^[^\s]/,!1))return U.strikethrough=!0,D.highlightFormatting&&(U.formatting="strikethrough"),c(U)}else if(oe===" "&&B.match(/^~~/,!0)){if(B.peek()===" ")return c(U);B.backUp(2)}}if(D.emoji&&oe===":"&&B.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){U.emoji=!0,D.highlightFormatting&&(U.formatting="emoji");var Be=c(U);return U.emoji=!1,Be}return oe===" "&&(B.match(/^ +$/,!1)?U.trailingSpace++:U.trailingSpace&&(U.trailingSpaceNewLine=!0)),c(U)}function a(B,U){var Y=B.next();if(Y===">"){U.f=U.inline=d,D.highlightFormatting&&(U.formatting="link");var ee=c(U);return ee?ee+=" ":ee="",ee+F.linkInline}return B.match(/^[^>]+/,!0),F.linkInline}function b(B,U){if(B.eatSpace())return null;var Y=B.next();return Y==="("||Y==="["?(U.f=U.inline=x(Y==="("?")":"]"),D.highlightFormatting&&(U.formatting="link-string"),U.linkHref=!0,c(U)):"error"}var p={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function x(B){return function(U,Y){var ee=U.next();if(ee===B){Y.f=Y.inline=d,D.highlightFormatting&&(Y.formatting="link-string");var oe=c(Y);return Y.linkHref=!1,oe}return U.match(p[B]),Y.linkHref=!0,c(Y)}}function P(B,U){return B.match(/^([^\]\\]|\\.)*\]:/,!1)?(U.f=N,B.next(),D.highlightFormatting&&(U.formatting="link"),U.linkText=!0,c(U)):s(B,U,d)}function N(B,U){if(B.match(/^\]:/,!0)){U.f=U.inline=K,D.highlightFormatting&&(U.formatting="link");var Y=c(U);return U.linkText=!1,Y}return B.match(/^([^\]\\]|\\.)+/,!0),F.linkText}function K(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=d,F.linkHref+" url")}var V={startState:function(){return{f:h,prevLine:{stream:null},thisLine:{stream:null},block:h,htmlState:null,indentation:0,inline:d,text:f,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(B){return{f:B.f,prevLine:B.prevLine,thisLine:B.thisLine,block:B.block,htmlState:B.htmlState&&Z.copyState(W,B.htmlState),indentation:B.indentation,localMode:B.localMode,localState:B.localMode?Z.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 m(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!=C)){var Y=B.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(U.indentation=Y,U.indentationDiff=null,Y>0)return null}}return U.f(B,U)},innerMode:function(B){return B.block==C?{state:B.htmlState,mode:W}:B.localState?{state:B.localState,mode:B.localMode}:{state:B,mode:V}},indent:function(B,U,Y){return B.block==C&&W.indent?W.indent(B.htmlState,U,Y):B.localState&&B.localMode.indent?B.localMode.indent(B.localState,U,Y):Z.Pass},blankLine:m,getType:c,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),Z.defineMIME("text/markdown","markdown"),Z.defineMIME("text/x-markdown","markdown")})},nuEh:function(dt,Qe,J){"use strict";var Z=J("T2oS"),G=J("W9HT"),D=J("cDcd"),W=J.n(D),M=J("F8wB"),O=J.n(M),F=function(R){var _=R.loading;return _?W.a.createElement("div",{className:O.a.loading},W.a.createElement(G.a,null)):W.a.createElement(W.a.Fragment,null)};Qe.a=F},osHv:function(dt,Qe,J){(function(Z){Z(J("VrN/"))})(function(Z){"use strict";var G=Z.Pos;function D(u,o){return u.line-o.line||u.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",M=W+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",O=new RegExp("<(/?)(["+W+"]["+M+"]*)","g");function F(u,o,s,l){this.line=o,this.ch=s,this.cm=u,this.text=u.getLine(o),this.min=l?Math.max(l.from,u.firstLine()):u.firstLine(),this.max=l?Math.min(l.to-1,u.lastLine()):u.lastLine()}function I(u,o){var s=u.cm.getTokenTypeAt(G(u.line,o));return s&&/\btag\b/.test(s)}function R(u){return u.line>=u.max?void 0:(u.ch=0,u.text=u.cm.getLine(++u.line),!0)}function _(u){return u.line<=u.min?void 0:(u.text=u.cm.getLine(--u.line),u.ch=u.text.length,!0)}function g(u){for(;;){var o=u.text.indexOf(">",u.ch);if(o==-1){if(R(u))continue;return}if(!I(u,o+1)){u.ch=o+1;continue}var s=u.text.lastIndexOf("/",o),l=s>-1&&!/\S/.test(u.text.slice(s+1,o));return u.ch=o+1,l?"selfClose":"regular"}}function T(u){for(;;){var o=u.ch?u.text.lastIndexOf("<",u.ch-1):-1;if(o==-1){if(_(u))continue;return}if(!I(u,o+1)){u.ch=o;continue}O.lastIndex=o,u.ch=o;var s=O.exec(u.text);if(s&&s.index==o)return s}}function A(u){for(;;){O.lastIndex=u.ch;var o=O.exec(u.text);if(!o){if(R(u))continue;return}if(!I(u,o.index+1)){u.ch=o.index+1;continue}return u.ch=o.index+o[0].length,o}}function L(u){for(;;){var o=u.ch?u.text.lastIndexOf(">",u.ch-1):-1;if(o==-1){if(_(u))continue;return}if(!I(u,o+1)){u.ch=o;continue}var s=u.text.lastIndexOf("/",o),l=s>-1&&!/\S/.test(u.text.slice(s+1,o));return u.ch=o+1,l?"selfClose":"regular"}}function S(u,o){for(var s=[];;){var l=A(u),w,m=u.line,h=u.ch-(l?l[0].length:0);if(!l||!(w=g(u)))return;if(w=="selfClose")continue;if(l[1]){for(var C=s.length-1;C>=0;--C)if(s[C]==l[2]){s.length=C;break}if(C<0&&(!o||o==l[2]))return{tag:l[2],from:G(m,h),to:G(u.line,u.ch)}}else s.push(l[2])}}function y(u,o){for(var s=[];;){var l=L(u);if(!l)return;if(l=="selfClose"){T(u);continue}var w=u.line,m=u.ch,h=T(u);if(!h)return;if(h[1])s.push(h[2]);else{for(var C=s.length-1;C>=0;--C)if(s[C]==h[2]){s.length=C;break}if(C<0&&(!o||o==h[2]))return{tag:h[2],from:G(u.line,u.ch),to:G(w,m)}}}}Z.registerHelper("fold","xml",function(u,o){for(var s=new F(u,o.line,0);;){var l=A(s);if(!l||s.line!=o.line)return;var w=g(s);if(!w)return;if(!l[1]&&w!="selfClose"){var m=G(s.line,s.ch),h=S(s,l[2]);return h&&D(h.from,m)>0?{from:m,to:h.from}:null}}}),Z.findMatchingTag=function(u,o,s){var l=new F(u,o.line,o.ch,s);if(l.text.indexOf(">")==-1&&l.text.indexOf("<")==-1)return;var w=g(l),m=w&&G(l.line,l.ch),h=w&&T(l);if(!w||!h||D(l,o)>0)return;var C={from:G(l.line,l.ch),to:m,tag:h[2]};return w=="selfClose"?{open:C,close:null,at:"open"}:h[1]?{open:y(l,h[2]),close:C,at:"close"}:(l=new F(u,m.line,m.ch,s),{open:C,close:S(l,h[2]),at:"open"})},Z.findEnclosingTag=function(u,o,s,l){for(var w=new F(u,o.line,o.ch,s);;){var m=y(w,l);if(!m)break;var h=new F(u,o.line,o.ch,s),C=S(h,m.tag);if(C)return{open:m,close:C}}},Z.scanForClosingTag=function(u,o,s,l){var w=new F(u,o.line,o.ch,l?{from:0,to:l}:null);return S(w,s)}})},"p77/":function(dt,Qe,J){},rUJ1:function(dt,Qe){const J=/[&<>"']/,Z=/[&<>"']/g,G=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,W={"&":"&","<":"<",">":">",'"':""","'":"'"},M=v=>W[v];function O(v,c){if(c){if(J.test(v))return v.replace(Z,M)}else if(G.test(v))return v.replace(D,M);return v}const F=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function I(v){return v.replace(F,(c,f)=>(f=f.toLowerCase(),f==="colon"?":":f.charAt(0)==="#"?f.charAt(1)==="x"?String.fromCharCode(parseInt(f.substring(2),16)):String.fromCharCode(+f.substring(1)):""))}const R=/(^|[^\[])\^/g;function _(v,c){v=v.source||v,c=c||"";const f={replace:(d,a)=>(a=a.source||a,a=a.replace(R,"$1"),v=v.replace(d,a),f),getRegex:()=>new RegExp(v,c)};return f}const g=/[^\w:]/g,T=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function A(v,c,f){if(v){let d;try{d=decodeURIComponent(I(f)).replace(g,"").toLowerCase()}catch(a){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}c&&!T.test(f)&&(f=o(c,f));try{f=encodeURI(f).replace(/%25/g,"%")}catch(d){return null}return f}const L={},S=/^[^:]+:\/*[^/]*$/,y=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(v,c){L[" "+v]||(S.test(v)?L[" "+v]=v+"/":L[" "+v]=m(v,"/",!0)),v=L[" "+v];const f=v.indexOf(":")===-1;return c.substring(0,2)==="//"?f?c:v.replace(y,"$1")+c:c.charAt(0)==="/"?f?c:v.replace(u,"$1")+c:v+c}const s={exec:function(){}};function l(v){let c=1,f,d;for(;c<arguments.length;c++){f=arguments[c];for(d in f)Object.prototype.hasOwnProperty.call(f,d)&&(v[d]=f[d])}return v}function w(v,c){const f=v.replace(/\|/g,(b,p,x)=>{let P=!1,N=p;for(;--N>=0&&x[N]==="\\";)P=!P;return P?"|":" |"}),d=f.split(/ \|/);let a=0;if(d.length>c)d.splice(c);else for(;d.length<c;)d.push("");for(;a<d.length;a++)d[a]=d[a].trim().replace(/\\\|/g,"|");return d}function m(v,c,f){const d=v.length;if(d===0)return"";let a=0;for(;a<d;){const b=v.charAt(d-a-1);if(b===c&&!f)a++;else if(b!==c&&f)a++;else break}return v.substr(0,d-a)}function h(v,c){if(v.indexOf(c[1])===-1)return-1;const f=v.length;let d=0,a=0;for(;a<f;a++)if(v[a]==="\\")a++;else if(v[a]===c[0])d++;else if(v[a]===c[1]&&(d--,d<0))return a;return-1}function C(v){v&&v.sanitize&&!v.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")}dt.exports={escape:O,unescape:I,edit:_,cleanUrl:A,resolveUrl:o,noopTest:s,merge:l,splitCells:w,rtrim:m,findClosingBracket:h,checkSanitizeDeprecation:C}},ulZh:function(dt,Qe,J){typeof window!="undefined"&&function(G,D){dt.exports=D()}(this,function(){return function(Z){var G={};function D(W){if(G[W])return G[W].exports;var M=G[W]={i:W,l:!1,exports:{}};return Z[W].call(M.exports,M,M.exports,D),M.l=!0,M.exports}return D.m=Z,D.c=G,D.d=function(W,M,O){D.o(W,M)||Object.defineProperty(W,M,{enumerable:!0,get:O})},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,M){if(M&1&&(W=D(W)),M&8)return W;if(M&4&&typeof W=="object"&&W&&W.__esModule)return W;var O=Object.create(null);if(D.r(O),Object.defineProperty(O,"default",{enumerable:!0,value:W}),M&2&&typeof W!="string")for(var F in W)D.d(O,F,function(I){return W[I]}.bind(null,F));return O},D.n=function(W){var M=W&&W.__esModule?function(){return W.default}:function(){return W};return D.d(M,"a",M),M},D.o=function(W,M){return Object.prototype.hasOwnProperty.call(W,M)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(Z,G,D){"use strict";var W=Object.prototype.hasOwnProperty,M="~";function O(){}Object.create&&(O.prototype=Object.create(null),new O().__proto__||(M=!1));function F(g,T,A){this.fn=g,this.context=T,this.once=A||!1}function I(g,T,A,L,S){if(typeof A!="function")throw new TypeError("The listener must be a function");var y=new F(A,L||g,S),u=M?M+T:T;return g._events[u]?g._events[u].fn?g._events[u]=[g._events[u],y]:g._events[u].push(y):(g._events[u]=y,g._eventsCount++),g}function R(g,T){--g._eventsCount===0?g._events=new O:delete g._events[T]}function _(){this._events=new O,this._eventsCount=0}_.prototype.eventNames=function(){var T=[],A,L;if(this._eventsCount===0)return T;for(L in A=this._events)W.call(A,L)&&T.push(M?L.slice(1):L);return Object.getOwnPropertySymbols?T.concat(Object.getOwnPropertySymbols(A)):T},_.prototype.listeners=function(T){var A=M?M+T:T,L=this._events[A];if(!L)return[];if(L.fn)return[L.fn];for(var S=0,y=L.length,u=new Array(y);S<y;S++)u[S]=L[S].fn;return u},_.prototype.listenerCount=function(T){var A=M?M+T:T,L=this._events[A];return L?L.fn?1:L.length:0},_.prototype.emit=function(T,A,L,S,y,u){var o=M?M+T:T;if(!this._events[o])return!1;var s=this._events[o],l=arguments.length,w,m;if(s.fn){s.once&&this.removeListener(T,s.fn,void 0,!0);switch(l){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,A),!0;case 3:return s.fn.call(s.context,A,L),!0;case 4:return s.fn.call(s.context,A,L,S),!0;case 5:return s.fn.call(s.context,A,L,S,y),!0;case 6:return s.fn.call(s.context,A,L,S,y,u),!0}for(m=1,w=new Array(l-1);m<l;m++)w[m-1]=arguments[m];s.fn.apply(s.context,w)}else{var h=s.length,C;for(m=0;m<h;m++){s[m].once&&this.removeListener(T,s[m].fn,void 0,!0);switch(l){case 1:s[m].fn.call(s[m].context);break;case 2:s[m].fn.call(s[m].context,A);break;case 3:s[m].fn.call(s[m].context,A,L);break;case 4:s[m].fn.call(s[m].context,A,L,S);break;default:if(!w)for(C=1,w=new Array(l-1);C<l;C++)w[C-1]=arguments[C];s[m].fn.apply(s[m].context,w)}}}return!0},_.prototype.on=function(T,A,L){return I(this,T,A,L,!1)},_.prototype.once=function(T,A,L){return I(this,T,A,L,!0)},_.prototype.removeListener=function(T,A,L,S){var y=M?M+T:T;if(!this._events[y])return this;if(!A)return R(this,y),this;var u=this._events[y];if(u.fn)u.fn===A&&(!S||u.once)&&(!L||u.context===L)&&R(this,y);else{for(var o=0,s=[],l=u.length;o<l;o++)(u[o].fn!==A||S&&!u[o].once||L&&u[o].context!==L)&&s.push(u[o]);s.length?this._events[y]=s.length===1?s[0]:s:R(this,y)}return this},_.prototype.removeAllListeners=function(T){var A;return T?(A=M?M+T:T,this._events[A]&&R(this,A)):(this._events=new O,this._eventsCount=0),this},_.prototype.off=_.prototype.removeListener,_.prototype.addListener=_.prototype.on,_.prefixed=M,_.EventEmitter=_,Z.exports=_},"./node_modules/url-toolkit/src/url-toolkit.js":function(Z,G,D){(function(W){var M=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,O=/^([^\/?#]*)([^]*)$/,F=/(?:\/|^)\.(?=\/)/g,I=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,R={buildAbsoluteURL:function(_,g,T){if(T=T||{},_=_.trim(),g=g.trim(),!g){if(!T.alwaysNormalize)return _;var A=R.parseURL(_);if(!A)throw new Error("Error trying to parse base URL.");return A.path=R.normalizePath(A.path),R.buildURLFromParts(A)}var L=R.parseURL(g);if(!L)throw new Error("Error trying to parse relative URL.");if(L.scheme)return T.alwaysNormalize?(L.path=R.normalizePath(L.path),R.buildURLFromParts(L)):g;var S=R.parseURL(_);if(!S)throw new Error("Error trying to parse base URL.");if(!S.netLoc&&S.path&&S.path[0]!=="/"){var y=O.exec(S.path);S.netLoc=y[1],S.path=y[2]}S.netLoc&&!S.path&&(S.path="/");var u={scheme:S.scheme,netLoc:L.netLoc,path:null,params:L.params,query:L.query,fragment:L.fragment};if(!L.netLoc&&(u.netLoc=S.netLoc,L.path[0]!=="/"))if(!L.path)u.path=S.path,L.params||(u.params=S.params,L.query||(u.query=S.query));else{var o=S.path,s=o.substring(0,o.lastIndexOf("/")+1)+L.path;u.path=R.normalizePath(s)}return u.path===null&&(u.path=T.alwaysNormalize?R.normalizePath(L.path):L.path),R.buildURLFromParts(u)},parseURL:function(_){var g=M.exec(_);return g?{scheme:g[1]||"",netLoc:g[2]||"",path:g[3]||"",params:g[4]||"",query:g[5]||"",fragment:g[6]||""}:null},normalizePath:function(_){for(_=_.split("").reverse().join("").replace(F,"");_.length!==(_=_.replace(I,"")).length;);return _.split("").reverse().join("")},buildURLFromParts:function(_){return _.scheme+_.netLoc+_.path+_.params+_.query+_.fragment}};Z.exports=R})(this)},"./node_modules/webworkify-webpack/index.js":function(Z,G,D){function W(T){var A={};function L(y){if(A[y])return A[y].exports;var u=A[y]={i:y,l:!1,exports:{}};return T[y].call(u.exports,u,u.exports,L),u.l=!0,u.exports}L.m=T,L.c=A,L.i=function(y){return y},L.d=function(y,u,o){L.o(y,u)||Object.defineProperty(y,u,{configurable:!1,enumerable:!0,get:o})},L.r=function(y){Object.defineProperty(y,"__esModule",{value:!0})},L.n=function(y){var u=y&&y.__esModule?function(){return y.default}:function(){return y};return L.d(u,"a",u),u},L.o=function(y,u){return Object.prototype.hasOwnProperty.call(y,u)},L.p="/",L.oe=function(y){throw console.error(y),y};var S=L(L.s=ENTRY_MODULE);return S.default||S}var M="[\\.|\\-|\\+|\\w|/|@]+",O="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+M+").*?\\)";function F(T){return(T+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function I(T){return!isNaN(1*T)}function R(T,A,L){var S={};S[L]=[];var y=A.toString(),u=y.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return S;for(var o=u[1],s=new RegExp("(\\\\n|\\W)"+F(o)+O,"g"),l;l=s.exec(y);){if(l[3]==="dll-reference")continue;S[L].push(l[3])}for(s=new RegExp("\\("+F(o)+'\\("(dll-reference\\s('+M+'))"\\)\\)'+O,"g");l=s.exec(y);)T[l[2]]||(S[L].push(l[1]),T[l[2]]=D(l[1]).m),S[l[2]]=S[l[2]]||[],S[l[2]].push(l[4]);for(var w=Object.keys(S),m=0;m<w.length;m++)for(var h=0;h<S[w[m]].length;h++)I(S[w[m]][h])&&(S[w[m]][h]=1*S[w[m]][h]);return S}function _(T){var A=Object.keys(T);return A.reduce(function(L,S){return L||T[S].length>0},!1)}function g(T,A){for(var L={main:[A]},S={main:[]},y={main:{}};_(L);)for(var u=Object.keys(L),o=0;o<u.length;o++){var s=u[o],l=L[s],w=l.pop();if(y[s]=y[s]||{},y[s][w]||!T[s][w])continue;y[s][w]=!0,S[s]=S[s]||[],S[s].push(w);for(var m=R(T,T[s][w],s),h=Object.keys(m),C=0;C<h.length;C++)L[h[C]]=L[h[C]]||[],L[h[C]]=L[h[C]].concat(m[h[C]])}return S}Z.exports=function(T,A){A=A||{};var L={main:D.m},S=A.all?{main:Object.keys(L.main)}:g(L,T),y="";Object.keys(S).filter(function(w){return w!=="main"}).forEach(function(w){for(var m=0;S[w][m];)m++;S[w].push(m),L[w][m]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",y=y+"var "+w+" = ("+W.toString().replace("ENTRY_MODULE",JSON.stringify(m))+")({"+S[w].map(function(h){return""+JSON.stringify(h)+": "+L[w][h].toString()}).join(",")+`});
|
|
`}),y=y+"new (("+W.toString().replace("ENTRY_MODULE",JSON.stringify(T))+")({"+S.main.map(function(w){return""+JSON.stringify(w)+": "+L.main[w].toString()}).join(",")+"}))(self);";var u=new window.Blob([y],{type:"text/javascript"});if(A.bare)return u;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,s=o.createObjectURL(u),l=new window.Worker(s);return l.objectURL=s,l}},"./src/config.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"hlsDefaultConfig",function(){return C}),D.d(G,"mergeConfig",function(){return c}),D.d(G,"enableStreamingMode",function(){return f});var W=D("./src/controller/abr-controller.ts"),M=D("./src/controller/audio-stream-controller.ts"),O=D("./src/controller/audio-track-controller.ts"),F=D("./src/controller/subtitle-stream-controller.ts"),I=D("./src/controller/subtitle-track-controller.ts"),R=D("./src/controller/buffer-controller.ts"),_=D("./src/controller/timeline-controller.ts"),g=D("./src/controller/cap-level-controller.ts"),T=D("./src/controller/fps-controller.ts"),A=D("./src/controller/eme-controller.ts"),L=D("./src/controller/cmcd-controller.ts"),S=D("./src/utils/xhr-loader.ts"),y=D("./src/utils/fetch-loader.ts"),u=D("./src/utils/cues.ts"),o=D("./src/utils/mediakeys-helper.ts"),s=D("./src/utils/logger.ts");function l(){return l=Object.assign||function(d){for(var a=1;a<arguments.length;a++){var b=arguments[a];for(var p in b)Object.prototype.hasOwnProperty.call(b,p)&&(d[p]=b[p])}return d},l.apply(this,arguments)}function w(d,a){var b=Object.keys(d);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(d);a&&(p=p.filter(function(x){return Object.getOwnPropertyDescriptor(d,x).enumerable})),b.push.apply(b,p)}return b}function m(d){for(var a=1;a<arguments.length;a++){var b=arguments[a]!=null?arguments[a]:{};a%2?w(Object(b),!0).forEach(function(p){h(d,p,b[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(b)):w(Object(b)).forEach(function(p){Object.defineProperty(d,p,Object.getOwnPropertyDescriptor(b,p))})}return d}function h(d,a,b){return a in d?Object.defineProperty(d,a,{value:b,enumerable:!0,configurable:!0,writable:!0}):d[a]=b,d}var C=m(m({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:S.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:W.default,bufferController:R.default,capLevelController:g.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},v()),{},{subtitleStreamController:F.SubtitleStreamController,subtitleTrackController:I.default,timelineController:_.TimelineController,audioStreamController:M.default,audioTrackController:O.default,emeController:A.default,cmcdController:L.default});function v(){return{cueHandler:u.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function c(d,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return l({},d,a)}function f(d){var a=d.loader;if(a!==y.default&&a!==S.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var b=Object(y.fetchSupported)();b&&(d.loader=y.default,d.progressive=!0,d.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(Z,G,D){"use strict";D.r(G);var W=D("./src/polyfills/number.ts"),M=D("./src/utils/ewma-bandwidth-estimator.ts"),O=D("./src/events.ts"),F=D("./src/utils/buffer-helper.ts"),I=D("./src/errors.ts"),R=D("./src/types/loader.ts"),_=D("./src/utils/logger.ts");function g(L,S){for(var y=0;y<S.length;y++){var u=S[y];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(L,u.key,u)}}function T(L,S,y){return S&&g(L.prototype,S),y&&g(L,y),L}var A=function(){function L(y){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=y;var u=y.config;this.bwEstimator=new M.default(u.abrEwmaSlowVoD,u.abrEwmaFastVoD,u.abrEwmaDefaultEstimate),this.registerListeners()}var S=L.prototype;return S.registerListeners=function(){var u=this.hls;u.on(O.Events.FRAG_LOADING,this.onFragLoading,this),u.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(O.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var u=this.hls;u.off(O.Events.FRAG_LOADING,this.onFragLoading,this),u.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(O.Events.ERROR,this.onError,this)},S.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},S.onFragLoading=function(u,o){var s=o.frag;if(s.type===R.PlaylistLevelType.MAIN&&!this.timer){var l;this.fragCurrent=s,this.partCurrent=(l=o.part)!=null?l:null,this.timer=self.setInterval(this.onCheck,100)}},S.onLevelLoaded=function(u,o){var s=this.hls.config;o.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},S._abandonRulesCheck=function(){var u=this.fragCurrent,o=this.partCurrent,s=this.hls,l=s.autoLevelEnabled,w=s.config,m=s.media;if(!u||!m)return;var h=o?o.stats:u.stats,C=o?o.duration:u.duration;if(h.aborted){_.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!l||m.paused||!m.playbackRate||!m.readyState)return;var v=performance.now()-h.loading.start,c=Math.abs(m.playbackRate);if(v<=500*C/c)return;var f=s.levels,d=s.minAutoLevel,a=f[u.level],b=h.total||Math.max(h.loaded,Math.round(C*a.maxBitrate/8)),p=Math.max(1,h.bwEstimate?h.bwEstimate/8:h.loaded*1e3/v),x=(b-h.loaded)/p,P=m.currentTime,N=(F.BufferHelper.bufferInfo(m,P,w.maxBufferHole).end-P)/c;if(N>=2*C/c||x<=N)return;var K=Number.POSITIVE_INFINITY,V;for(V=u.level-1;V>d;V--){var B=f[V].maxBitrate;if(K=C*B/(8*.8*p),K<N)break}if(K>=x)return;var U=this.bwEstimator.getEstimate();_.logger.warn("Fragment "+u.sn+(o?" part "+o.index:"")+" of level "+u.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
|
|
Current BW estimate: `+(Object(W.isFiniteNumber)(U)?(U/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+x.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+K.toFixed(3)+` s
|
|
Time to underbuffer: `+N.toFixed(3)+" s"),s.nextLoadLevel=V,this.bwEstimator.sample(v,h.loaded),this.clearTimer(),u.loader&&(this.fragCurrent=this.partCurrent=null,u.loader.abort()),s.trigger(O.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:u,part:o,stats:h})},S.onFragLoaded=function(u,o){var s=o.frag,l=o.part;if(s.type===R.PlaylistLevelType.MAIN&&Object(W.isFiniteNumber)(s.sn)){var w=l?l.stats:s.stats,m=l?l.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var h=this.hls.levels[s.level],C=(h.loaded?h.loaded.bytes:0)+w.loaded,v=(h.loaded?h.loaded.duration:0)+m;h.loaded={bytes:C,duration:v},h.realBitrate=Math.round(8*C/v)}if(s.bitrateTest){var c={stats:w,frag:s,part:l,id:s.type};this.onFragBuffered(O.Events.FRAG_BUFFERED,c),s.bitrateTest=!1}}},S.onFragBuffered=function(u,o){var s=o.frag,l=o.part,w=l?l.stats:s.stats;if(w.aborted)return;if(s.type!==R.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var m=w.parsing.end-w.loading.start;this.bwEstimator.sample(m,w.loaded),w.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=m/1e3:this.bitrateTestDelay=0},S.onError=function(u,o){switch(o.details){case I.ErrorDetails.FRAG_LOAD_ERROR:case I.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},S.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},S.getNextABRAutoLevel=function(){var u=this.fragCurrent,o=this.partCurrent,s=this.hls,l=s.maxAutoLevel,w=s.config,m=s.minAutoLevel,h=s.media,C=o?o.duration:u?u.duration:0,v=h?h.currentTime:0,c=h&&h.playbackRate!==0?Math.abs(h.playbackRate):1,f=this.bwEstimator?this.bwEstimator.getEstimate():w.abrEwmaDefaultEstimate,d=(F.BufferHelper.bufferInfo(h,v,w.maxBufferHole).end-v)/c,a=this.findBestLevel(f,m,l,d,w.abrBandWidthFactor,w.abrBandWidthUpFactor);if(a>=0)return a;_.logger.trace((d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var b=C?Math.min(C,w.maxStarvationDelay):w.maxStarvationDelay,p=w.abrBandWidthFactor,x=w.abrBandWidthUpFactor;if(!d){var P=this.bitrateTestDelay;if(P){var N=C?Math.min(C,w.maxLoadingDelay):w.maxLoadingDelay;b=N-P,_.logger.trace("bitrate test took "+Math.round(1e3*P)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*b)+" ms"),p=x=1}}return a=this.findBestLevel(f,m,l,d+b,p,x),Math.max(a,0)},S.findBestLevel=function(u,o,s,l,w,m){for(var h,C=this.fragCurrent,v=this.partCurrent,c=this.lastLoadedFragLevel,f=this.hls.levels,d=f[c],a=!!(d!=null&&(h=d.details)!==null&&h!==void 0&&h.live),b=d==null?void 0:d.codecSet,p=v?v.duration:C?C.duration:0,x=s;x>=o;x--){var P=f[x];if(!P||b&&P.codecSet!==b)continue;var N=P.details,K=(v?N==null?void 0:N.partTarget:N==null?void 0:N.averagetargetduration)||p,V=void 0;x<=c?V=w*u:V=m*u;var B=f[x].maxBitrate,U=B*K/V;if(_.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+x+"/"+Math.round(V)+"/"+B+"/"+K+"/"+l+"/"+U),V>B&&(!U||a&&!this.bitrateTestDelay||U<l))return x}return-1},T(L,[{key:"nextAutoLevel",get:function(){var u=this._nextAutoLevel,o=this.bwEstimator;if(u!==-1&&(!o||!o.canEstimate()))return u;var s=this.getNextABRAutoLevel();return u!==-1&&(s=Math.min(u,s)),s},set:function(u){this._nextAutoLevel=u}}]),L}();G.default=A},"./src/controller/audio-stream-controller.ts":function(Z,G,D){"use strict";D.r(G);var W=D("./src/polyfills/number.ts"),M=D("./src/controller/base-stream-controller.ts"),O=D("./src/events.ts"),F=D("./src/utils/buffer-helper.ts"),I=D("./src/controller/fragment-tracker.ts"),R=D("./src/types/level.ts"),_=D("./src/types/loader.ts"),g=D("./src/loader/fragment.ts"),T=D("./src/demux/chunk-cache.ts"),A=D("./src/demux/transmuxer-interface.ts"),L=D("./src/types/transmuxer.ts"),S=D("./src/controller/fragment-finders.ts"),y=D("./src/utils/discontinuities.ts"),u=D("./src/errors.ts"),o=D("./src/utils/logger.ts");function s(){return s=Object.assign||function(C){for(var v=1;v<arguments.length;v++){var c=arguments[v];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(C[f]=c[f])}return C},s.apply(this,arguments)}function l(C,v){C.prototype=Object.create(v.prototype),C.prototype.constructor=C,w(C,v)}function w(C,v){return w=Object.setPrototypeOf||function(f,d){return f.__proto__=d,f},w(C,v)}var m=100,h=function(C){l(v,C);function v(f,d){var a;return a=C.call(this,f,d,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var c=v.prototype;return c.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},c._registerListeners=function(){var d=this.hls;d.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.on(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(O.Events.ERROR,this.onError,this),d.on(O.Events.BUFFER_RESET,this.onBufferReset,this),d.on(O.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c._unregisterListeners=function(){var d=this.hls;d.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.off(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(O.Events.ERROR,this.onError,this),d.off(O.Events.BUFFER_RESET,this.onBufferReset,this),d.off(O.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c.onInitPtsFound=function(d,a){var b=a.frag,p=a.id,x=a.initPTS;if(p==="main"){var P=b.cc;this.initPTS[b.cc]=x,this.log("InitPTS for cc: "+P+" found from main: "+x),this.videoTrackCC=P,this.state===M.State.WAITING_INIT_PTS&&this.tick()}},c.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=M.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(m),this.fragLoadError=0,a>0&&d===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=M.State.IDLE):(this.loadedmetadata=!1,this.state=M.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()},c.doTick=function(){switch(this.state){case M.State.IDLE:this.doTickIdle();break;case M.State.WAITING_TRACK:{var d,a=this.levels,b=this.trackId,p=a==null||((d=a[b])===null||d===void 0)?void 0:d.details;if(p){if(this.waitForCdnTuneIn(p))break;this.state=M.State.WAITING_INIT_PTS}break}case M.State.FRAG_LOADING_WAITING_RETRY:{var x,P=performance.now(),N=this.retryDate;(!N||P>=N||(x=this.media)!==null&&x!==void 0&&x.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=M.State.IDLE);break}case M.State.WAITING_INIT_PTS:{var K=this.waitingData;if(K){var V=K.frag,B=K.part,U=K.cache,Y=K.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=M.State.FRAG_LOADING;var ee=U.flush(),oe={frag:V,part:B,payload:ee,networkDetails:null};this._handleFragmentLoadProgress(oe),Y&&C.prototype._handleFragmentLoadComplete.call(this,oe)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+V.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var de=this.getLoadPosition(),Te=F.BufferHelper.bufferInfo(this.mediaBuffer,de,this.config.maxBufferHole),ge=Object(S.fragmentWithinToleranceTest)(Te.end,this.config.maxFragLookUpTolerance,V);ge<0&&(o.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+Te.end+" is needed"),this.clearWaitingFragment())}}else this.state=M.State.IDLE}}this.onTickEnd()},c.clearWaitingFragment=function(){var d=this.waitingData;d&&(this.fragmentTracker.removeFragment(d.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=M.State.IDLE)},c.onTickEnd=function(){var d=this.media;if(!d||!d.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:d,b=a.buffered;!this.loadedmetadata&&b.length&&(this.loadedmetadata=!0),this.lastCurrentTime=d.currentTime},c.doTickIdle=function(){var d,a,b=this.hls,p=this.levels,x=this.media,P=this.trackId,N=b.config;if(!p||!p[P])return;if(!x&&(this.startFragRequested||!N.startFragPrefetch))return;var K=p[P],V=K.details;if(!V||V.live&&this.levelLastLoaded!==P||this.waitForCdnTuneIn(V)){this.state=M.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,g.ElementaryStreamTypes.AUDIO,_.PlaylistLevelType.AUDIO));var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,_.PlaylistLevelType.AUDIO);if(B===null)return;var U=B.len,Y=this.getMaxBufferLength(),ee=this.audioSwitch;if(U>=Y&&!ee)return;if(!ee&&this._streamEnded(B,V)){b.trigger(O.Events.BUFFER_EOS,{type:"audio"}),this.state=M.State.ENDED;return}var oe=V.fragments,de=oe[0].start,Te=B.end;if(ee){var ge=this.getLoadPosition();Te=ge,V.PTSKnown&&ge<de&&((B.end>de||B.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),x.currentTime=de+.05))}var pe=this.getNextFragment(Te,V);if(!pe){this.bufferFlushed=!0;return}((d=pe.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((a=pe.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(pe,V):this.loadFragment(pe,V,Te)},c.getMaxBufferLength=function(){var d=C.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,_.PlaylistLevelType.MAIN);return a===null?d:Math.max(d,a.len)},c.onMediaDetaching=function(){this.videoBuffer=null,C.prototype.onMediaDetaching.call(this)},c.onAudioTracksUpdated=function(d,a){var b=a.audioTracks;this.resetTransmuxer(),this.levels=b.map(function(p){return new R.Level(p)})},c.onAudioTrackSwitching=function(d,a){var b=!!a.url;this.trackId=a.id;var p=this.fragCurrent;p!=null&&p.loader&&p.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),b?this.setInterval(m):this.resetTransmuxer(),b?(this.audioSwitch=!0,this.state=M.State.IDLE):this.state=M.State.STOPPED,this.tick()},c.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},c.onLevelLoaded=function(d,a){this.mainDetails=a.details},c.onAudioTrackLoaded=function(d,a){var b,p=this.levels,x=a.details,P=a.id;if(!p){this.warn("Audio tracks were reset while loading level "+P);return}this.log("Track "+P+" loaded ["+x.startSN+","+x.endSN+"],duration:"+x.totalduration);var N=p[P],K=0;if(x.live||(b=N.details)!==null&&b!==void 0&&b.live){var V=this.mainDetails;if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed||!V)return;!N.details&&x.hasProgramDateTime&&V.hasProgramDateTime?(Object(y.alignMediaPlaylistByPDT)(x,V),K=x.fragments[0].start):K=this.alignPlaylists(x,N.details)}N.details=x,this.levelLastLoaded=P,!this.startFragRequested&&(this.mainDetails||!x.live)&&this.setStartPosition(N.details,K),this.state===M.State.WAITING_TRACK&&!this.waitForCdnTuneIn(x)&&(this.state=M.State.IDLE),this.tick()},c._handleFragmentLoadProgress=function(d){var a,b=d.frag,p=d.part,x=d.payload,P=this.config,N=this.trackId,K=this.levels;if(!K){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+b.sn+" of level "+b.level+" will not be buffered");return}var V=K[N];console.assert(V,"Audio track is defined on fragment load progress");var B=V.details;console.assert(B,"Audio track details are defined on fragment load progress");var U=P.defaultAudioCodec||V.audioCodec||"mp4a.40.2",Y=this.transmuxer;Y||(Y=this.transmuxer=new A.default(this.hls,_.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ee=this.initPTS[b.cc],oe=(a=b.initSegment)===null||a===void 0?void 0:a.data;if(ee!==void 0){var de=!1,Te=p?p.index:-1,ge=Te!==-1,pe=new L.ChunkMetadata(b.level,b.sn,b.stats.chunkCount,x.byteLength,Te,ge);Y.push(x,oe,U,"",b,p,B.totalduration,de,pe,ee)}else{o.logger.log("Unknown video PTS for cc "+b.cc+", waiting for video PTS before demuxing audio frag "+b.sn+" of ["+B.startSN+" ,"+B.endSN+"],track "+N);var fe=this.waitingData=this.waitingData||{frag:b,part:p,cache:new T.default,complete:!1},me=fe.cache;me.push(new Uint8Array(x)),this.waitingVideoCC=this.videoTrackCC,this.state=M.State.WAITING_INIT_PTS}},c._handleFragmentLoadComplete=function(d){if(this.waitingData){this.waitingData.complete=!0;return}C.prototype._handleFragmentLoadComplete.call(this,d)},c.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},c.onBufferCreated=function(d,a){var b=a.tracks.audio;b&&(this.mediaBuffer=b.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},c.onFragBuffered=function(d,a){var b=a.frag,p=a.part;if(b.type!==_.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(b)){this.warn("Fragment "+b.sn+(p?" p: "+p.index:"")+" of level "+b.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}b.sn!=="initSegment"&&(this.fragPrevious=b,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(b,p)},c.onError=function(d,a){switch(a.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(_.PlaylistLevelType.AUDIO,a);break;case u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case u.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==M.State.ERROR&&this.state!==M.State.STOPPED&&(this.state=a.fatal?M.State.ERROR:M.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case u.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===M.State.PARSING||this.state===M.State.PARSED)){var b=!0,p=this.getFwdBufferInfo(this.mediaBuffer,_.PlaylistLevelType.AUDIO);p&&p.len>.5&&(b=!this.reduceMaxBufferLength(p.len)),b&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,C.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},c.onBufferFlushed=function(d,a){var b=a.type;b===g.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},c._handleTransmuxComplete=function(d){var a,b="audio",p=this.hls,x=d.remuxResult,P=d.chunkMeta,N=this.getCurrentContext(P);if(!N){this.warn("The loading context changed while buffering fragment "+P.sn+" of level "+P.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(P.level);return}var K=N.frag,V=N.part,B=x.audio,U=x.text,Y=x.id3,ee=x.initSegment;if(this.fragContextChanged(K))return;if(this.state=M.State.PARSING,this.audioSwitch&&B&&this.completeAudioSwitch(),ee!=null&&ee.tracks&&(this._bufferInitSegment(ee.tracks,K,P),p.trigger(O.Events.FRAG_PARSING_INIT_SEGMENT,{frag:K,id:b,tracks:ee.tracks})),B){var oe=B.startPTS,de=B.endPTS,Te=B.startDTS,ge=B.endDTS;V&&(V.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:oe,endPTS:de,startDTS:Te,endDTS:ge}),K.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,oe,de,Te,ge),this.bufferFragmentData(B,K,V,P)}if(Y!=null&&(a=Y.samples)!==null&&a!==void 0&&a.length){var pe=s({frag:K,id:b},Y);p.trigger(O.Events.FRAG_PARSING_METADATA,pe)}if(U){var fe=s({frag:K,id:b},U);p.trigger(O.Events.FRAG_PARSING_USERDATA,fe)}},c._bufferInitSegment=function(d,a,b){if(this.state!==M.State.PARSING)return;d.video&&delete d.video;var p=d.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(O.Events.BUFFER_CODECS,d);var x=p.initSegment;if(x!=null&&x.byteLength){var P={type:"audio",frag:a,part:null,chunkMeta:b,parent:a.type,data:x};this.hls.trigger(O.Events.BUFFER_APPENDING,P)}this.tick()},c.loadFragment=function(d,a,b){var p=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||p===I.FragmentState.NOT_LOADED||p===I.FragmentState.PARTIAL)&&(d.sn==="initSegment"?this._loadInitSegment(d):a.live&&!Object(W.isFiniteNumber)(this.initPTS[d.cc])?(this.log("Waiting for video PTS in continuity counter "+d.cc+" of live stream before loading audio fragment "+d.sn+" of level "+this.trackId),this.state=M.State.WAITING_INIT_PTS):(this.startFragRequested=!0,C.prototype.loadFragment.call(this,d,a,b)))},c.completeAudioSwitch=function(){var d=this.hls,a=this.media,b=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),C.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,d.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:b})},v}(M.default);G.default=h},"./src/controller/audio-track-controller.ts":function(Z,G,D){"use strict";D.r(G);var W=D("./src/events.ts"),M=D("./src/errors.ts"),O=D("./src/controller/base-playlist-controller.ts"),F=D("./src/types/loader.ts");function I(A,L){for(var S=0;S<L.length;S++){var y=L[S];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(A,y.key,y)}}function R(A,L,S){return L&&I(A.prototype,L),S&&I(A,S),A}function _(A,L){A.prototype=Object.create(L.prototype),A.prototype.constructor=A,g(A,L)}function g(A,L){return g=Object.setPrototypeOf||function(y,u){return y.__proto__=u,y},g(A,L)}var T=function(A){_(L,A);function L(y){var u;return u=A.call(this,y,"[audio-track-controller]")||this,u.tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.trackName="",u.selectDefaultTrack=!0,u.registerListeners(),u}var S=L.prototype;return S.registerListeners=function(){var u=this.hls;u.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),u.on(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.on(W.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(W.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var u=this.hls;u.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.off(W.Events.LEVEL_LOADING,this.onLevelLoading,this),u.off(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.off(W.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(W.Events.ERROR,this.onError,this)},S.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,A.prototype.destroy.call(this)},S.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},S.onManifestParsed=function(u,o){this.tracks=o.audioTracks||[]},S.onAudioTrackLoaded=function(u,o){var s=o.id,l=o.details,w=this.tracksInGroup[s];if(!w){this.warn("Invalid audio track id "+s);return}var m=w.details;w.details=o.details,this.log("audioTrack "+s+" loaded ["+l.startSN+"-"+l.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,o,m))},S.onLevelLoading=function(u,o){this.switchLevel(o.level)},S.onLevelSwitching=function(u,o){this.switchLevel(o.level)},S.switchLevel=function(u){var o=this.hls.levels[u];if(!(o!=null&&o.audioGroupIds))return;var s=o.audioGroupIds[o.urlId];if(this.groupId!==s){this.groupId=s;var l=this.tracks.filter(function(m){return!s||m.groupId===s});this.selectDefaultTrack&&!l.some(function(m){return m.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=l;var w={audioTracks:l};this.log("Updating audio tracks, "+l.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(W.Events.AUDIO_TRACKS_UPDATED,w),this.selectInitialTrack()}},S.onError=function(u,o){if(A.prototype.onError.call(this,u,o),o.fatal||!o.context)return;o.context.type===F.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},S.setAudioTrack=function(u){var o=this.tracksInGroup;if(u<0||u>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=o[this.trackId];this.log("Now switching to audio-track index "+u);var l=o[u],w=l.id,m=l.groupId,h=m===void 0?"":m,C=l.name,v=l.type,c=l.url;if(this.trackId=u,this.trackName=C,this.selectDefaultTrack=!1,this.hls.trigger(W.Events.AUDIO_TRACK_SWITCHING,{id:w,groupId:h,name:C,type:v,url:c}),l.details&&!l.details.live)return;var f=this.switchParams(l.url,s==null?void 0:s.details);this.loadPlaylist(f)},S.selectInitialTrack=function(){var u=this.tracksInGroup;console.assert(u.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,s=this.findTrackId(o)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},S.findTrackId=function(u){for(var o=this.tracksInGroup,s=0;s<o.length;s++){var l=o[s];if((!this.selectDefaultTrack||l.default)&&(!u||u===l.name))return l.id}return-1},S.loadPlaylist=function(u){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var s=o.id,l=o.groupId,w=o.url;if(u)try{w=u.addDirectives(w)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(W.Events.AUDIO_TRACK_LOADING,{url:w,id:s,groupId:l,deliveryDirectives:u||null})}},R(L,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(u){this.selectDefaultTrack=!1,this.setAudioTrack(u)}}]),L}(O.default);G.default=T},"./src/controller/base-playlist-controller.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return R});var W=D("./src/polyfills/number.ts"),M=D("./src/types/level.ts"),O=D("./src/controller/level-helper.ts"),F=D("./src/utils/logger.ts"),I=D("./src/errors.ts"),R=function(){function _(T,A){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=F.logger.log.bind(F.logger,A+":"),this.warn=F.logger.warn.bind(F.logger,A+":"),this.hls=T}var g=_.prototype;return g.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},g.onError=function(A,L){L.fatal&&L.type===I.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},g.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},g.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},g.stopLoad=function(){this.canLoad=!1,this.clearTimer()},g.switchParams=function(A,L){var S=L==null?void 0:L.renditionReports;if(S)for(var y=0;y<S.length;y++){var u=S[y],o=""+u.URI;if(o===A.substr(-o.length)){var s=parseInt(u["LAST-MSN"]),l=parseInt(u["LAST-PART"]);if(L&&this.hls.config.lowLatencyMode){var w=Math.min(L.age-L.partTarget,L.targetduration);l!==void 0&&w>L.partTarget&&(l+=1)}if(Object(W.isFiniteNumber)(s))return new M.HlsUrlParameters(s,Object(W.isFiniteNumber)(l)?l:void 0,M.HlsSkip.No)}}},g.loadPlaylist=function(A){},g.shouldLoadTrack=function(A){return this.canLoad&&A&&!!A.url&&(!A.details||A.details.live)},g.playlistLoaded=function(A,L,S){var y=this,u=L.details,o=L.stats,s=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(u.advancedDateTime=Date.now()-s,u.live||S!=null&&S.live){if(u.reloaded(S),S&&this.log("live playlist "+A+" "+(u.advanced?"REFRESHED "+u.lastPartSn+"-"+u.lastPartIndex:"MISSED")),S&&u.fragments.length>0&&Object(O.mergeDetails)(S,u),!this.canLoad||!u.live)return;var l,w=void 0,m=void 0;if(u.canBlockReload&&u.endSN&&u.advanced){var h=this.hls.config.lowLatencyMode,C=u.lastPartSn,v=u.endSN,c=u.lastPartIndex,f=c!==-1,d=C===v,a=h?0:c;f?(w=d?v+1:C,m=d?a:c+1):w=v+1;var b=u.age,p=b+u.ageHeader,x=Math.min(p-u.partTarget,u.targetduration*1.5);if(x>0){if(S&&x>S.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+S.tuneInGoal+" to: "+x+" with playlist age: "+u.age),x=0;else{var P=Math.floor(x/u.targetduration);if(w+=P,m!==void 0){var N=Math.round(x%u.targetduration/u.partTarget);m+=N}this.log("CDN Tune-in age: "+u.ageHeader+"s last advanced "+b.toFixed(2)+"s goal: "+x+" skip sn "+P+" to part "+m)}u.tuneInGoal=x}if(l=this.getDeliveryDirectives(u,L.deliveryDirectives,w,m),h||!d){this.loadPlaylist(l);return}}else l=this.getDeliveryDirectives(u,L.deliveryDirectives,w,m);var K=Object(O.computeReloadInterval)(u,o);w!==void 0&&u.canBlockReload&&(K-=u.partTarget||1),this.log("reload live playlist "+A+" in "+Math.round(K)+" ms"),this.timer=self.setTimeout(function(){return y.loadPlaylist(l)},K)}else this.clearTimer()},g.getDeliveryDirectives=function(A,L,S,y){var u=Object(M.getSkipValue)(A,S);return L!=null&&L.skip&&A.deltaUpdateFailed&&(S=L.msn,y=L.part,u=M.HlsSkip.No),new M.HlsUrlParameters(S,y,u)},g.retryLoadingOrFail=function(A){var L=this,S=this.hls.config,y=this.retryCount<S.levelLoadingMaxRetry;if(y){var u;if(this.retryCount++,A.details.indexOf("LoadTimeOut")>-1&&(u=A.context)!==null&&u!==void 0&&u.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+A.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*S.levelLoadingRetryDelay,S.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return L.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+A.details+'"')}}else this.warn('cannot recover from error "'+A.details+'"'),this.clearTimer(),A.fatal=!0;return y},_}()},"./src/controller/base-stream-controller.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"State",function(){return v}),D.d(G,"default",function(){return c});var W=D("./src/polyfills/number.ts"),M=D("./src/task-loop.ts"),O=D("./src/controller/fragment-tracker.ts"),F=D("./src/utils/buffer-helper.ts"),I=D("./src/utils/logger.ts"),R=D("./src/events.ts"),_=D("./src/errors.ts"),g=D("./src/types/transmuxer.ts"),T=D("./src/utils/mp4-tools.ts"),A=D("./src/utils/discontinuities.ts"),L=D("./src/controller/fragment-finders.ts"),S=D("./src/controller/level-helper.ts"),y=D("./src/loader/fragment-loader.ts"),u=D("./src/crypt/decrypter.ts"),o=D("./src/utils/time-ranges.ts"),s=D("./src/types/loader.ts");function l(f,d){for(var a=0;a<d.length;a++){var b=d[a];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(f,b.key,b)}}function w(f,d,a){return d&&l(f.prototype,d),a&&l(f,a),f}function m(f){if(f===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f}function h(f,d){f.prototype=Object.create(d.prototype),f.prototype.constructor=f,C(f,d)}function C(f,d){return C=Object.setPrototypeOf||function(b,p){return b.__proto__=p,b},C(f,d)}var v={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"},c=function(f){h(d,f);function d(b,p,x){var P;return P=f.call(this)||this,P.hls=void 0,P.fragPrevious=null,P.fragCurrent=null,P.fragmentTracker=void 0,P.transmuxer=null,P._state=v.STOPPED,P.media=void 0,P.mediaBuffer=void 0,P.config=void 0,P.bitrateTest=!1,P.lastCurrentTime=0,P.nextLoadPosition=0,P.startPosition=0,P.loadedmetadata=!1,P.fragLoadError=0,P.retryDate=0,P.levels=null,P.fragmentLoader=void 0,P.levelLastLoaded=null,P.startFragRequested=!1,P.decrypter=void 0,P.initPTS=[],P.onvseeking=null,P.onvended=null,P.logPrefix="",P.log=void 0,P.warn=void 0,P.logPrefix=x,P.log=I.logger.log.bind(I.logger,x+":"),P.warn=I.logger.warn.bind(I.logger,x+":"),P.hls=b,P.fragmentLoader=new y.default(b.config),P.fragmentTracker=p,P.config=b.config,P.decrypter=new u.default(b,b.config),b.on(R.Events.KEY_LOADED,P.onKeyLoaded,m(P)),P}var a=d.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=v.STOPPED},a._streamEnded=function(p,x){var P=this.fragCurrent,N=this.fragmentTracker;if(!x.live&&P&&P.sn===x.endSN&&!p.nextStart){var K=N.getState(P);return K===O.FragmentState.PARTIAL||K===O.FragmentState.OK}return!1},a.onMediaAttached=function(p,x){var P=this.media=this.mediaBuffer=x.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),P.addEventListener("seeking",this.onvseeking),P.addEventListener("ended",this.onvended);var N=this.config;this.levels&&N.autoStartLoad&&this.state===v.STOPPED&&this.startLoad(N.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,x=this.fragCurrent,P=this.media,N=this.mediaBuffer,K=this.state,V=P?P.currentTime:0,B=F.BufferHelper.bufferInfo(N||P,V,p.maxBufferHole);if(this.log("media seeking to "+(Object(W.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+K),K===v.ENDED)this.resetLoadingState();else if(x&&!B.len){var U=p.maxFragLookUpTolerance,Y=x.start-U,ee=x.start+x.duration+U,oe=V>ee;(V<Y||oe)&&(oe&&x.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),x.loader.abort()),this.resetLoadingState())}P&&(this.lastCurrentTime=V),!this.loadedmetadata&&!B.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(p,x){if(this.state!==v.KEY_LOADING||x.frag!==this.fragCurrent||!this.levels)return;this.state=v.IDLE;var P=this.levels[x.frag.level].details;P&&this.loadFragment(x.frag,P,x.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),f.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=v.STOPPED,this.hls.off(R.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,f.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(p,x){this.log("Loading key for "+p.sn+" of ["+x.startSN+"-"+x.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level),this.state=v.KEY_LOADING,this.fragCurrent=p,this.hls.trigger(R.Events.KEY_LOADING,{frag:p})},a.loadFragment=function(p,x,P){this._loadFragForPlayback(p,x,P)},a._loadFragForPlayback=function(p,x,P){var N=this,K=function(B){if(N.fragContextChanged(p)){N.warn("Fragment "+p.sn+(B.part?" p: "+B.part.index:"")+" of level "+p.level+" was dropped during download."),N.fragmentTracker.removeFragment(p);return}p.stats.chunkCount++,N._handleFragmentLoadProgress(B)};this._doFragLoad(p,x,P,K).then(function(V){if(!V)return;N.fragLoadError=0;var B=N.state;if(N.fragContextChanged(p)){(B===v.FRAG_LOADING||B===v.BACKTRACKING||!N.fragCurrent&&B===v.PARSING)&&(N.fragmentTracker.removeFragment(p),N.state=v.IDLE);return}if("payload"in V&&(N.log("Loaded fragment "+p.sn+" of level "+p.level),N.hls.trigger(R.Events.FRAG_LOADED,V),N.state===v.BACKTRACKING)){N.fragmentTracker.backtrack(p,V),N.resetFragmentLoading(p);return}N._handleFragmentLoadComplete(V)}).catch(function(V){N.warn(V),N.resetFragmentLoading(p)})},a.flushMainBuffer=function(p,x,P){if(P===void 0&&(P=null),!(p-x))return;var N={startOffset:p,endOffset:x,type:P};this.fragLoadError=0,this.hls.trigger(R.Events.BUFFER_FLUSHING,N)},a._loadInitSegment=function(p){var x=this;this._doFragLoad(p).then(function(P){if(!P||x.fragContextChanged(p)||!x.levels)throw new Error("init load aborted");return P}).then(function(P){var N=x.hls,K=P.payload,V=p.decryptdata;if(K&&K.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var B=self.performance.now();return x.decrypter.webCryptoDecrypt(new Uint8Array(K),V.key.buffer,V.iv.buffer).then(function(U){var Y=self.performance.now();return N.trigger(R.Events.FRAG_DECRYPTED,{frag:p,payload:U,stats:{tstart:B,tdecrypt:Y}}),P.payload=U,P})}return P}).then(function(P){var N=x.fragCurrent,K=x.hls,V=x.levels;if(!V)throw new Error("init load aborted, missing levels");var B=V[p.level].details;console.assert(B,"Level details are defined when init segment is loaded");var U=p.stats;x.state=v.IDLE,x.fragLoadError=0,p.data=new Uint8Array(P.payload),U.parsing.start=U.buffering.start=self.performance.now(),U.parsing.end=U.buffering.end=self.performance.now(),P.frag===N&&K.trigger(R.Events.FRAG_BUFFERED,{stats:U,frag:N,part:null,id:p.type}),x.tick()}).catch(function(P){x.warn(P),x.resetFragmentLoading(p)})},a.fragContextChanged=function(p){var x=this.fragCurrent;return!p||!x||p.level!==x.level||p.sn!==x.sn||p.urlId!==x.urlId},a.fragBufferedComplete=function(p,x){var P=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+p.type+" sn: "+p.sn+(x?" part: "+x.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level+" "+o.default.toString(F.BufferHelper.getBuffered(P))),this.state=v.IDLE,this.tick()},a._handleFragmentLoadComplete=function(p){var x=this.transmuxer;if(!x)return;var P=p.frag,N=p.part,K=p.partsLoaded,V=!K||K.length===0||K.some(function(U){return!U}),B=new g.ChunkMetadata(P.level,P.sn,P.stats.chunkCount+1,0,N?N.index:-1,!V);x.flush(B)},a._handleFragmentLoadProgress=function(p){},a._doFragLoad=function(p,x,P,N){var K=this;if(P===void 0&&(P=null),!this.levels)throw new Error("frag load aborted, missing levels");if(P=Math.max(p.start,P||0),this.config.lowLatencyMode&&x){var V=x.partList;if(V&&N){P>p.end&&x.fragmentHint&&(p=x.fragmentHint);var B=this.getNextPart(V,p,P);if(B>-1){var U=V[B];return this.log("Loading part sn: "+p.sn+" p: "+U.index+" cc: "+p.cc+" of playlist ["+x.startSN+"-"+x.endSN+"] parts [0-"+B+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(P.toFixed(3))),this.nextLoadPosition=U.start+U.duration,this.state=v.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:p,part:V[B],targetBufferTime:P}),this.doFragPartsLoad(p,V,B,N).catch(function(Y){return K.handleFragLoadError(Y)})}else if(!p.url||this.loadedEndOfParts(V,P))return Promise.resolve(null)}}return this.log("Loading fragment "+p.sn+" cc: "+p.cc+" "+(x?"of ["+x.startSN+"-"+x.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(P.toFixed(3))),Object(W.isFiniteNumber)(p.sn)&&!this.bitrateTest&&(this.nextLoadPosition=p.start+p.duration),this.state=v.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:p,targetBufferTime:P}),this.fragmentLoader.load(p,N).catch(function(Y){return K.handleFragLoadError(Y)})},a.doFragPartsLoad=function(p,x,P,N){var K=this;return new Promise(function(V,B){var U=[],Y=function ee(oe){var de=x[oe];K.fragmentLoader.loadPart(p,de,N).then(function(Te){U[de.index]=Te;var ge=Te.part;K.hls.trigger(R.Events.FRAG_LOADED,Te);var pe=x[oe+1];if(pe&&pe.fragment===p)ee(oe+1);else return V({frag:p,part:ge,partsLoaded:U})}).catch(B)};Y(P)})},a.handleFragLoadError=function(p){var x=p.data;return x&&x.details===_.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(x.frag,x.part):this.hls.trigger(R.Events.ERROR,x),null},a._handleTransmuxerFlush=function(p){var x=this.getCurrentContext(p);if(!x||this.state!==v.PARSING){this.fragCurrent||(this.state=v.IDLE);return}var P=x.frag,N=x.part,K=x.level,V=self.performance.now();P.stats.parsing.end=V,N&&(N.stats.parsing.end=V),this.updateLevelTiming(P,N,K,p.partial)},a.getCurrentContext=function(p){var x=this.levels,P=p.level,N=p.sn,K=p.part;if(!x||!x[P])return this.warn("Levels object was unset while buffering fragment "+N+" of level "+P+". The current chunk will not be buffered."),null;var V=x[P],B=K>-1?Object(S.getPartWith)(V,N,K):null,U=B?B.fragment:Object(S.getFragmentWithSN)(V,N,this.fragCurrent);return U?{frag:U,part:B,level:V}:null},a.bufferFragmentData=function(p,x,P,N){if(!p||this.state!==v.PARSING)return;var K=p.data1,V=p.data2,B=K;if(K&&V&&(B=Object(T.appendUint8Array)(K,V)),!B||!B.length)return;var U={type:p.type,frag:x,part:P,chunkMeta:N,parent:x.type,data:B};this.hls.trigger(R.Events.BUFFER_APPENDING,U),p.dropped&&p.independent&&!P&&this.flushBufferGap(x)},a.flushBufferGap=function(p){var x=this.media;if(!x)return;if(!F.BufferHelper.isBuffered(x,x.currentTime)){this.flushMainBuffer(0,p.start);return}var P=x.currentTime,N=F.BufferHelper.bufferInfo(x,P,0),K=p.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,K*.25),B=Math.max(Math.min(p.start-V,N.end-V),P+V);p.start-B>V&&this.flushMainBuffer(B,p.start)},a.getFwdBufferInfo=function(p,x){var P=this.config,N=this.getLoadPosition();if(!Object(W.isFiniteNumber)(N))return null;var K=F.BufferHelper.bufferInfo(p,N,P.maxBufferHole);if(K.len===0&&K.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(N,x);if(V&&K.nextStart<V.end)return F.BufferHelper.bufferInfo(p,N,Math.max(K.nextStart,P.maxBufferHole))}return K},a.getMaxBufferLength=function(p){var x=this.config,P;return p?P=Math.max(8*x.maxBufferSize/p,x.maxBufferLength):P=x.maxBufferLength,Math.min(P,x.maxMaxBufferLength)},a.reduceMaxBufferLength=function(p){var x=this.config,P=p||x.maxBufferLength;return x.maxMaxBufferLength>=P?(x.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+x.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(p,x){var P,N,K=x.fragments,V=K.length;if(!V)return null;var B=this.config,U=K[0].start,Y;if(x.live){var ee=B.initialLiveManifestSize;if(V<ee)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+ee+")"),null;!x.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(Y=this.getInitialLiveFragment(x,K),this.startPosition=Y?this.hls.liveSyncPosition||Y.start:p)}else p<=U&&(Y=K[0]);if(!Y){var oe=B.lowLatencyMode?x.partEnd:x.fragmentEnd;Y=this.getFragmentAtPosition(p,oe,x)}return(P=Y)!==null&&P!==void 0&&P.initSegment&&!((N=Y)!==null&&N!==void 0&&N.initSegment.data)&&!this.bitrateTest&&(Y=Y.initSegment),Y},a.getNextPart=function(p,x,P){for(var N=-1,K=!1,V=!0,B=0,U=p.length;B<U;B++){var Y=p[B];if(V=V&&!Y.independent,N>-1&&P<Y.start)break;var ee=Y.loaded;!ee&&(K||Y.independent||V)&&Y.fragment===x&&(N=B),K=ee}return N},a.loadedEndOfParts=function(p,x){var P=p[p.length-1];return P&&x>P.start&&P.loaded},a.getInitialLiveFragment=function(p,x){var P=this.fragPrevious,N=null;if(P){if(p.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+P.programDateTime),N=Object(L.findFragmentByPDT)(x,P.endProgramDateTime,this.config.maxFragLookUpTolerance)),!N){var K=P.sn+1;if(K>=p.startSN&&K<=p.endSN){var V=x[K-p.startSN];P.cc===V.cc&&(N=V,this.log("Live playlist, switching playlist, load frag with next SN: "+N.sn))}N||(N=Object(L.findFragWithCC)(x,P.cc),N&&this.log("Live playlist, switching playlist, load frag with same CC: "+N.sn))}}else{var B=this.hls.liveSyncPosition;B!==null&&(N=this.getFragmentAtPosition(B,this.bitrateTest?p.fragmentEnd:p.edge,p))}return N},a.getFragmentAtPosition=function(p,x,P){var N=this.config,K=this.fragPrevious,V=P.fragments,B=P.endSN,U=P.fragmentHint,Y=N.maxFragLookUpTolerance,ee=!!(N.lowLatencyMode&&P.partList&&U);ee&&U&&!this.bitrateTest&&(V=V.concat(U),B=U.sn);var oe;if(p<x){var de=p>x-Y?0:Y;oe=Object(L.findFragmentByPTS)(K,V,p,de)}else oe=V[V.length-1];if(oe){var Te=oe.sn-P.startSN,ge=K&&oe.level===K.level,pe=V[Te+1],fe=this.fragmentTracker.getState(oe);if(fe===O.FragmentState.BACKTRACKED){oe=null;for(var me=Te;V[me]&&this.fragmentTracker.getState(V[me])===O.FragmentState.BACKTRACKED;)K?oe=V[me--]:oe=V[--me];oe||(oe=pe)}else K&&oe.sn===K.sn&&!ee&&(ge&&(oe.sn<B&&this.fragmentTracker.getState(pe)!==O.FragmentState.OK?(this.log("SN "+oe.sn+" just loaded, load next one: "+pe.sn),oe=pe):oe=null))}return oe},a.synchronizeToLiveEdge=function(p){var x=this.config,P=this.media;if(!P)return;var N=this.hls.liveSyncPosition,K=P.currentTime,V=p.fragments[0].start,B=p.edge,U=K>=V-x.maxFragLookUpTolerance&&K<=B;if(N!==null&&P.duration>N&&(K<N||!U)){var Y=x.liveMaxLatencyDuration!==void 0?x.liveMaxLatencyDuration:x.liveMaxLatencyDurationCount*p.targetduration;(!U&&P.readyState<4||K<B-Y)&&(this.loadedmetadata||(this.nextLoadPosition=N),P.readyState&&(this.warn("Playback: "+K.toFixed(3)+" is located too far from the end of live sliding playlist: "+B+", reset currentTime to : "+N.toFixed(3)),P.currentTime=N))}},a.alignPlaylists=function(p,x){var P=this.levels,N=this.levelLastLoaded,K=this.fragPrevious,V=N!==null?P[N]:null,B=p.fragments.length;if(!B)return this.warn("No fragments in live playlist"),0;var U=p.fragments[0].start,Y=!x,ee=p.alignedSliding&&Object(W.isFiniteNumber)(U);if(Y||!ee&&!U){Object(A.alignStream)(K,V,p);var oe=p.fragments[0].start;return this.log("Live playlist sliding: "+oe.toFixed(2)+" start-sn: "+(x?x.startSN:"na")+"->"+p.startSN+" prev-sn: "+(K?K.sn:"na")+" fragments: "+B),oe}return U},a.waitForCdnTuneIn=function(p){var x=3;return p.live&&p.canBlockReload&&p.tuneInGoal>Math.max(p.partHoldBack,p.partTarget*x)},a.setStartPosition=function(p,x){var P=this.startPosition;if(P<x&&(P=-1),P===-1||this.lastCurrentTime===-1){var N=p.startTimeOffset;Object(W.isFiniteNumber)(N)?(P=x+N,N<0&&(P+=p.totalduration),P=Math.min(Math.max(x,P),x+p.totalduration),this.log("Start time offset "+N+" found in playlist, adjust startPosition to "+P),this.startPosition=P):p.live?P=this.hls.liveSyncPosition||x:this.startPosition=P=0,this.lastCurrentTime=P}this.nextLoadPosition=P},a.getLoadPosition=function(){var p=this.media,x=0;return this.loadedmetadata&&p?x=p.currentTime:this.nextLoadPosition&&(x=this.nextLoadPosition),x},a.handleFragLoadAborted=function(p,x){this.transmuxer&&p.sn!=="initSegment"&&p.stats.aborted&&(this.warn("Fragment "+p.sn+(x?" part"+x.index:"")+" of level "+p.level+" was aborted"),this.resetFragmentLoading(p))},a.resetFragmentLoading=function(p){(!this.fragCurrent||!this.fragContextChanged(p))&&(this.state=v.IDLE)},a.onFragmentOrKeyLoadError=function(p,x){if(x.fatal)return;var P=x.frag;if(!P||P.type!==p)return;var N=this.fragCurrent;console.assert(N&&P.sn===N.sn&&P.level===N.level&&P.urlId===N.urlId,"Frag load error must match current frag to retry");var K=this.config;if(this.fragLoadError+1<=K.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(P.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*K.fragLoadingRetryDelay,K.fragLoadingMaxRetryTimeout);this.warn("Fragment "+P.sn+" of "+p+" "+P.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=v.FRAG_LOADING_WAITING_RETRY}else x.levelRetry?(p===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=v.IDLE):(I.logger.error(x.details+" reaches max retry, redispatch as fatal ..."),x.fatal=!0,this.hls.stopLoad(),this.state=v.ERROR)},a.afterBufferFlushed=function(p,x,P){if(!p)return;var N=F.BufferHelper.getBuffered(p);this.fragmentTracker.detectEvictedFragments(x,N,P),this.state===v.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=v.IDLE},a.resetLiveStartWhenNotLoaded=function(p){if(!this.loadedmetadata){this.startFragRequested=!1;var x=this.levels?this.levels[p].details:null;if(x!=null&&x.live)return this.startPosition=-1,this.setStartPosition(x,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(p,x,P,N){var K=this,V=P.details;console.assert(!!V,"level.details must be defined");var B=Object.keys(p.elementaryStreams).reduce(function(U,Y){var ee=p.elementaryStreams[Y];if(ee){var oe=ee.endPTS-ee.startPTS;if(oe<=0)return K.warn("Could not parse fragment "+p.sn+" "+Y+" duration reliably ("+oe+") resetting transmuxer to fallback to playlist timing"),K.resetTransmuxer(),U||!1;var de=N?0:Object(S.updateFragPTSDTS)(V,p,ee.startPTS,ee.endPTS,ee.startDTS,ee.endDTS);return K.hls.trigger(R.Events.LEVEL_PTS_UPDATED,{details:V,level:P,drift:de,type:Y,frag:p,start:ee.startPTS,end:ee.endPTS}),!0}return U},!1);B?(this.state=v.PARSED,this.hls.trigger(R.Events.FRAG_PARSED,{frag:p,part:x})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},w(d,[{key:"state",get:function(){return this._state},set:function(p){var x=this._state;x!==p&&(this._state=p,this.log(x+"->"+p))}}]),d}(M.default)},"./src/controller/buffer-controller.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return L});var W=D("./src/polyfills/number.ts"),M=D("./src/events.ts"),O=D("./src/utils/logger.ts"),F=D("./src/errors.ts"),I=D("./src/utils/buffer-helper.ts"),R=D("./src/utils/mediasource-helper.ts"),_=D("./src/loader/fragment.ts"),g=D("./src/controller/buffer-operation-queue.ts"),T=Object(R.getMediaSource)(),A=/([ha]vc.)(?:\.[^.,]+)+/,L=function(){function S(u){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=o.hls,l=o.media,w=o.mediaSource;O.logger.log("[buffer-controller]: Media source opened"),l&&(o.updateMediaElementDuration(),s.trigger(M.Events.MEDIA_ATTACHED,{media:l})),w&&w.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){O.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){O.logger.log("[buffer-controller]: Media source ended")},this.hls=u,this._initSourceBuffer(),this.registerListeners()}var y=S.prototype;return y.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},y.destroy=function(){this.unregisterListeners(),this.details=null},y.registerListeners=function(){var o=this.hls;o.on(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(M.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(M.Events.BUFFER_RESET,this.onBufferReset,this),o.on(M.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(M.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(M.Events.BUFFER_EOS,this.onBufferEos,this),o.on(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(M.Events.FRAG_PARSED,this.onFragParsed,this),o.on(M.Events.FRAG_CHANGED,this.onFragChanged,this)},y.unregisterListeners=function(){var o=this.hls;o.off(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(M.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(M.Events.BUFFER_RESET,this.onBufferReset,this),o.off(M.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(M.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(M.Events.BUFFER_EOS,this.onBufferEos,this),o.off(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(M.Events.FRAG_PARSED,this.onFragParsed,this),o.off(M.Events.FRAG_CHANGED,this.onFragChanged,this)},y._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new g.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},y.onManifestParsed=function(o,s){var l=2;(s.audio&&!s.video||!s.altAudio)&&(l=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=l,this.details=null,O.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},y.onMediaAttaching=function(o,s){var l=this.media=s.media;if(l&&T){var w=this.mediaSource=new T;w.addEventListener("sourceopen",this._onMediaSourceOpen),w.addEventListener("sourceended",this._onMediaSourceEnded),w.addEventListener("sourceclose",this._onMediaSourceClose),l.src=self.URL.createObjectURL(w),this._objectUrl=l.src}},y.onMediaDetaching=function(){var o=this.media,s=this.mediaSource,l=this._objectUrl;if(s){if(O.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(w){O.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&&(l&&self.URL.revokeObjectURL(l),o.src===l?(o.removeAttribute("src"),o.load()):O.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(M.Events.MEDIA_DETACHED,void 0)},y.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(s){var l=o.sourceBuffer[s];try{l&&(o.removeBufferListeners(s),o.mediaSource&&o.mediaSource.removeSourceBuffer(l),o.sourceBuffer[s]=void 0)}catch(w){O.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",w)}}),this._initSourceBuffer()},y.onBufferCodecs=function(o,s){var l=this,w=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(m){if(w){var h=l.tracks[m];if(h&&typeof h.buffer.changeType=="function"){var C=s[m],v=C.codec,c=C.levelCodec,f=C.container,d=(h.levelCodec||h.codec).replace(A,"$1"),a=(c||v).replace(A,"$1");if(d!==a){var b=f+";codecs="+(c||v);l.appendChangeType(m,b)}}}else l.pendingTracks[m]=s[m]}),w)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},y.appendChangeType=function(o,s){var l=this,w=this.operationQueue,m={execute:function(){var C=l.sourceBuffer[o];C&&(O.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+s),C.changeType(s)),w.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(C){O.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",C)}};w.append(m,o)},y.onBufferAppending=function(o,s){var l=this,w=this.hls,m=this.operationQueue,h=this.tracks,C=s.data,v=s.type,c=s.frag,f=s.part,d=s.chunkMeta,a=d.buffering[v],b=self.performance.now();a.start=b;var p=c.stats.buffering,x=f?f.stats.buffering:null;p.start===0&&(p.start=b),x&&x.start===0&&(x.start=b);var P=h.audio,N=v==="audio"&&d.id===1&&(P==null?void 0:P.container)==="audio/mpeg",K={execute:function(){if(a.executeStart=self.performance.now(),N){var B=l.sourceBuffer[v];if(B){var U=c.start-B.timestampOffset;Math.abs(U)>=.1&&(O.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+c.start+" (delta: "+U+") sn: "+c.sn+")"),B.timestampOffset=c.start)}}l.appendExecutor(C,v)},onStart:function(){},onComplete:function(){var B=self.performance.now();a.executeEnd=a.end=B,p.first===0&&(p.first=B),x&&x.first===0&&(x.first=B);var U=l.sourceBuffer,Y={};for(var ee in U)Y[ee]=I.BufferHelper.getBuffered(U[ee]);l.appendError=0,l.hls.trigger(M.Events.BUFFER_APPENDED,{type:v,frag:c,part:f,chunkMeta:d,parent:c.type,timeRanges:Y})},onError:function(B){O.logger.error("[buffer-controller]: Error encountered while trying to append to the "+v+" SourceBuffer",B);var U={type:F.ErrorTypes.MEDIA_ERROR,parent:c.type,details:F.ErrorDetails.BUFFER_APPEND_ERROR,err:B,fatal:!1};B.code===DOMException.QUOTA_EXCEEDED_ERR?U.details=F.ErrorDetails.BUFFER_FULL_ERROR:(l.appendError++,U.details=F.ErrorDetails.BUFFER_APPEND_ERROR,l.appendError>w.config.appendErrorMaxRetry&&(O.logger.error("[buffer-controller]: Failed "+w.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),U.fatal=!0)),w.trigger(M.Events.ERROR,U)}};m.append(K,v)},y.onBufferFlushing=function(o,s){var l=this,w=this.operationQueue,m=function(C){return{execute:l.removeExecutor.bind(l,C,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){l.hls.trigger(M.Events.BUFFER_FLUSHED,{type:C})},onError:function(c){O.logger.warn("[buffer-controller]: Failed to remove from "+C+" SourceBuffer",c)}}};s.type?w.append(m(s.type),s.type):this.getSourceBufferTypes().forEach(function(h){w.append(m(h),h)})},y.onFragParsed=function(o,s){var l=this,w=s.frag,m=s.part,h=[],C=m?m.elementaryStreams:w.elementaryStreams;C[_.ElementaryStreamTypes.AUDIOVIDEO]?h.push("audiovideo"):(C[_.ElementaryStreamTypes.AUDIO]&&h.push("audio"),C[_.ElementaryStreamTypes.VIDEO]&&h.push("video"));var v=function(){var f=self.performance.now();w.stats.buffering.end=f,m&&(m.stats.buffering.end=f);var d=m?m.stats:w.stats;l.hls.trigger(M.Events.FRAG_BUFFERED,{frag:w,part:m,stats:d,id:w.type})};h.length===0&&O.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+w.type+" level: "+w.level+" sn: "+w.sn),this.blockBuffers(v,h)},y.onFragChanged=function(o,s){this.flushBackBuffer()},y.onBufferEos=function(o,s){var l=this,w=this.getSourceBufferTypes().reduce(function(m,h){var C=l.sourceBuffer[h];return(!s.type||s.type===h)&&(C&&!C.ended&&(C.ended=!0,O.logger.log("[buffer-controller]: "+h+" sourceBuffer now EOS"))),m&&!!(!C||C.ended)},!0);w&&this.blockBuffers(function(){var m=l.mediaSource;if(!m||m.readyState!=="open")return;m.endOfStream()})},y.onLevelUpdated=function(o,s){var l=s.details;if(!l.fragments.length)return;this.details=l,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},y.flushBackBuffer=function(){var o=this.hls,s=this.details,l=this.media,w=this.sourceBuffer;if(!l||s===null)return;var m=this.getSourceBufferTypes();if(!m.length)return;var h=s.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(W.isFiniteNumber)(h)||h<0)return;var C=l.currentTime,v=s.levelTargetDuration,c=Math.max(h,v),f=Math.floor(C/v)*v-c;m.forEach(function(d){var a=w[d];if(a){var b=I.BufferHelper.getBuffered(a);b.length>0&&f>b.start(0)&&(o.trigger(M.Events.BACK_BUFFER_REACHED,{bufferEnd:f}),s.live&&o.trigger(M.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:f}),o.trigger(M.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:f,type:d}))}})},y.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,s=this.hls,l=this.media,w=this.mediaSource,m=o.fragments[0].start+o.totalduration,h=l.duration,C=Object(W.isFiniteNumber)(w.duration)?w.duration:0;o.live&&s.config.liveDurationInfinity?(O.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),w.duration=Infinity,this.updateSeekableRange(o)):(m>C&&m>h||!Object(W.isFiniteNumber)(h))&&(O.logger.log("[buffer-controller]: Updating Media Source duration to "+m.toFixed(3)),w.duration=m)},y.updateSeekableRange=function(o){var s=this.mediaSource,l=o.fragments,w=l.length;if(w&&o.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var m=Math.max(0,l[0].start),h=Math.max(m,m+o.totalduration);s.setLiveSeekableRange(m,h)}},y.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,s=this.operationQueue,l=this.pendingTracks,w=Object.keys(l).length;if(w&&!o||w===2){this.createSourceBuffers(l),this.pendingTracks={};var m=this.getSourceBufferTypes();if(m.length===0){this.hls.trigger(M.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}m.forEach(function(h){s.executeNext(h)})}},y.createSourceBuffers=function(o){var s=this.sourceBuffer,l=this.mediaSource;if(!l)throw Error("createSourceBuffers called when mediaSource was null");var w=0;for(var m in o)if(!s[m]){var h=o[m];if(!h)throw Error("source buffer exists for track "+m+", however track does not");var C=h.levelCodec||h.codec,v=h.container+";codecs="+C;O.logger.log("[buffer-controller]: creating sourceBuffer("+v+")");try{var c=s[m]=l.addSourceBuffer(v),f=m;this.addBufferListener(f,"updatestart",this._onSBUpdateStart),this.addBufferListener(f,"updateend",this._onSBUpdateEnd),this.addBufferListener(f,"error",this._onSBUpdateError),this.tracks[m]={buffer:c,codec:C,container:h.container,levelCodec:h.levelCodec,id:h.id},w++}catch(d){O.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+d.message),this.hls.trigger(M.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,mimeType:v})}}w&&this.hls.trigger(M.Events.BUFFER_CREATED,{tracks:this.tracks})},y._onSBUpdateStart=function(o){var s=this.operationQueue,l=s.current(o);l.onStart()},y._onSBUpdateEnd=function(o){var s=this.operationQueue,l=s.current(o);l.onComplete(),s.shiftAndExecuteNext(o)},y._onSBUpdateError=function(o,s){O.logger.error("[buffer-controller]: "+o+" SourceBuffer error",s),this.hls.trigger(M.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var l=this.operationQueue.current(o);l&&l.onError(s)},y.removeExecutor=function(o,s,l){var w=this.media,m=this.mediaSource,h=this.operationQueue,C=this.sourceBuffer,v=C[o];if(!w||!m||!v){O.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(o);return}var c=Object(W.isFiniteNumber)(w.duration)?w.duration:Infinity,f=Object(W.isFiniteNumber)(m.duration)?m.duration:Infinity,d=Math.max(0,s),a=Math.min(l,c,f);a>d?(O.logger.log("[buffer-controller]: Removing ["+d+","+a+"] from the "+o+" SourceBuffer"),console.assert(!v.updating,o+" sourceBuffer must not be updating"),v.remove(d,a)):h.shiftAndExecuteNext(o)},y.appendExecutor=function(o,s){var l=this.operationQueue,w=this.sourceBuffer,m=w[s];if(!m){O.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),l.shiftAndExecuteNext(s);return}m.ended=!1,console.assert(!m.updating,s+" sourceBuffer must not be updating"),m.appendBuffer(o)},y.blockBuffers=function(o,s){var l=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){O.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var w=this.operationQueue,m=s.map(function(h){return w.appendBlocker(h)});Promise.all(m).then(function(){o(),s.forEach(function(h){var C=l.sourceBuffer[h];(!C||!C.updating)&&w.shiftAndExecuteNext(h)})})},y.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},y.addBufferListener=function(o,s,l){var w=this.sourceBuffer[o];if(!w)return;var m=l.bind(this,o);this.listeners[o].push({event:s,listener:m}),w.addEventListener(s,m)},y.removeBufferListeners=function(o){var s=this.sourceBuffer[o];if(!s)return;this.listeners[o].forEach(function(l){s.removeEventListener(l.event,l.listener)})},S}()},"./src/controller/buffer-operation-queue.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return M});var W=D("./src/utils/logger.ts"),M=function(){function O(I){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=I}var F=O.prototype;return F.append=function(R,_){var g=this.queues[_];g.push(R),g.length===1&&this.buffers[_]&&this.executeNext(_)},F.insertAbort=function(R,_){var g=this.queues[_];g.unshift(R),this.executeNext(_)},F.appendBlocker=function(R){var _,g=new Promise(function(A){_=A}),T={execute:_,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(T,R),g},F.executeNext=function(R){var _=this.buffers,g=this.queues,T=_[R],A=g[R];if(A.length){var L=A[0];try{L.execute()}catch(S){W.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),L.onError(S),(!T||!T.updating)&&(A.shift(),this.executeNext(R))}}},F.shiftAndExecuteNext=function(R){this.queues[R].shift(),this.executeNext(R)},F.current=function(R){return this.queues[R][0]},O}()},"./src/controller/cap-level-controller.ts":function(Z,G,D){"use strict";D.r(G);var W=D("./src/events.ts");function M(I,R){for(var _=0;_<R.length;_++){var g=R[_];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(I,g.key,g)}}function O(I,R,_){return R&&M(I.prototype,R),_&&M(I,_),I}var F=function(){function I(_){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=_,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var R=I.prototype;return R.setStreamController=function(g){this.streamController=g},R.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},R.registerListeners=function(){var g=this.hls;g.on(W.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.on(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.on(W.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.unregisterListener=function(){var g=this.hls;g.off(W.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.off(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.off(W.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.onFpsDropLevelCapping=function(g,T){I.isLevelAllowed(T.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(T.droppedLevel)},R.onMediaAttaching=function(g,T){this.media=T.media instanceof HTMLVideoElement?T.media:null},R.onManifestParsed=function(g,T){var A=this.hls;this.restrictedLevels=[],this.firstLevel=T.firstLevel,A.config.capLevelToPlayerSize&&T.video&&this.startCapping()},R.onBufferCodecs=function(g,T){var A=this.hls;A.config.capLevelToPlayerSize&&T.video&&this.startCapping()},R.onMediaDetaching=function(){this.stopCapping()},R.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var g=this.hls.levels;if(g.length){var T=this.hls;T.autoLevelCapping=this.getMaxLevel(g.length-1),T.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=T.autoLevelCapping}}},R.getMaxLevel=function(g){var T=this,A=this.hls.levels;if(!A.length)return-1;var L=A.filter(function(S,y){return I.isLevelAllowed(y,T.restrictedLevels)&&y<=g});return this.clientRect=null,I.getMaxLevelByMediaSize(L,this.mediaWidth,this.mediaHeight)},R.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},R.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},R.getDimensions=function(){if(this.clientRect)return this.clientRect;var g=this.media,T={width:0,height:0};if(g){var A=g.getBoundingClientRect();T.width=A.width,T.height=A.height,!T.width&&!T.height&&(T.width=A.right-A.left||g.width||0,T.height=A.bottom-A.top||g.height||0)}return this.clientRect=T,T},I.isLevelAllowed=function(g,T){return T===void 0&&(T=[]),T.indexOf(g)===-1},I.getMaxLevelByMediaSize=function(g,T,A){if(!g||!g.length)return-1;for(var L=function(s,l){return l?s.width!==l.width||s.height!==l.height:!0},S=g.length-1,y=0;y<g.length;y+=1){var u=g[y];if((u.width>=T||u.height>=A)&&L(u,g[y+1])){S=y;break}}return S},O(I,[{key:"mediaWidth",get:function(){return this.getDimensions().width*I.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*I.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var g=1;try{g=self.devicePixelRatio}catch(T){}return g}}]),I}();G.default=F},"./src/controller/cmcd-controller.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return L});var W=D("./src/events.ts"),M=D("./src/types/cmcd.ts"),O=D("./src/utils/buffer-helper.ts"),F=D("./src/utils/logger.ts");function I(S,y){for(var u=0;u<y.length;u++){var o=y[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(S,o.key,o)}}function R(S,y,u){return y&&I(S.prototype,y),u&&I(S,u),S}function _(S,y){var u=typeof Symbol!="undefined"&&S[Symbol.iterator]||S["@@iterator"];if(u)return(u=u.call(S)).next.bind(u);if(Array.isArray(S)||(u=g(S))||y&&S&&typeof S.length=="number"){u&&(S=u);var o=0;return function(){return o>=S.length?{done:!0}:{done:!1,value:S[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 g(S,y){if(!S)return;if(typeof S=="string")return T(S,y);var u=Object.prototype.toString.call(S).slice(8,-1);if(u==="Object"&&S.constructor&&(u=S.constructor.name),u==="Map"||u==="Set")return Array.from(S);if(u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return T(S,y)}function T(S,y){(y==null||y>S.length)&&(y=S.length);for(var u=0,o=new Array(y);u<y;u++)o[u]=S[u];return o}function A(){return A=Object.assign||function(S){for(var y=1;y<arguments.length;y++){var u=arguments[y];for(var o in u)Object.prototype.hasOwnProperty.call(u,o)&&(S[o]=u[o])}return S},A.apply(this,arguments)}var L=function(){function S(u){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(w){try{o.apply(w,{ot:M.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(m){F.logger.warn("Could not generate manifest CMCD data.",m)}},this.applyFragmentData=function(w){try{var m=w.frag,h=o.hls.levels[m.level],C=o.getObjectType(m),v={d:m.duration*1e3,ot:C};(C===M.CMCDObjectType.VIDEO||C===M.CMCDObjectType.AUDIO||C==M.CMCDObjectType.MUXED)&&(v.br=h.bitrate/1e3,v.tb=o.getTopBandwidth(C),v.bl=o.getBufferLength(C)),o.apply(w,v)}catch(c){F.logger.warn("Could not generate segment CMCD data.",c)}},this.hls=u;var s=this.config=u.config,l=s.cmcd;l!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=l.sessionId||S.uuid(),this.cid=l.contentId,this.useHeaders=l.useHeaders===!0,this.registerListeners())}var y=S.prototype;return y.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)},y.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()},y.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},y.onMediaAttached=function(o,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},y.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},y.onBufferCreated=function(o,s){var l,w;this.audioBuffer=(l=s.tracks.audio)===null||l===void 0?void 0:l.buffer,this.videoBuffer=(w=s.tracks.video)===null||w===void 0?void 0:w.buffer},y.createData=function(){var o;return{v:M.CMCDVersion,sf:M.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}},y.apply=function(o,s){s===void 0&&(s={}),A(s,this.createData());var l=s.ot===M.CMCDObjectType.INIT||s.ot===M.CMCDObjectType.VIDEO||s.ot===M.CMCDObjectType.MUXED;if(this.starved&&l&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var w=S.toHeaders(s);if(!Object.keys(w).length)return;o.headers||(o.headers={}),A(o.headers,w)}else{var m=S.toQuery(s);if(!m)return;o.url=S.appendQueryToUri(o.url,m)}},y.getObjectType=function(o){var s=o.type;return s==="subtitle"?M.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?M.CMCDObjectType.INIT:s==="audio"?M.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?M.CMCDObjectType.VIDEO:M.CMCDObjectType.MUXED:void 0},y.getTopBandwidth=function(o){for(var s=0,l=o===M.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,w=_(l),m;!(m=w()).done;){var h=m.value;h.bitrate>s&&(s=h.bitrate)}return s>0?s:NaN},y.getBufferLength=function(o){var s=this.hls.media,l=o===M.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!l||!s)return NaN;var w=O.BufferHelper.bufferInfo(l,s.currentTime,this.config.maxBufferHole);return w.len*1e3},y.createPlaylistLoader=function(){var o=this.config.pLoader,s=this.applyPlaylistData,l=o||this.config.loader;return function(){function w(h){this.loader=void 0,this.loader=new l(h)}var m=w.prototype;return m.destroy=function(){this.loader.destroy()},m.abort=function(){this.loader.abort()},m.load=function(C,v,c){s(C),this.loader.load(C,v,c)},R(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},y.createFragmentLoader=function(){var o=this.config.fLoader,s=this.applyFragmentData,l=o||this.config.loader;return function(){function w(h){this.loader=void 0,this.loader=new l(h)}var m=w.prototype;return m.destroy=function(){this.loader.destroy()},m.abort=function(){this.loader.abort()},m.load=function(C,v,c){s(C),this.loader.load(C,v,c)},R(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},S.uuid=function(){var o=URL.createObjectURL(new Blob),s=o.toString();return URL.revokeObjectURL(o),s.substr(s.lastIndexOf("/")+1)},S.serialize=function(o){for(var s=[],l=function(N){return!Number.isNaN(N)&&N!=null&&N!==""&&N!==!1},w=function(N){return Math.round(N)},m=function(N){return w(N/100)*100},h=function(N){return encodeURIComponent(N)},C={br:w,d:w,bl:m,dl:m,mtp:m,nor:h,rtp:m,tb:w},v=Object.keys(o||{}).sort(),c=_(v),f;!(f=c()).done;){var d=f.value,a=o[d];if(!l(a))continue;if(d==="v"&&a===1)continue;if(d=="pr"&&a===1)continue;var b=C[d];b&&(a=b(a));var p=typeof a,x=void 0;d==="ot"||d==="sf"||d==="st"?x=d+"="+a:p==="boolean"?x=d:p==="number"?x=d+"="+a:x=d+"="+JSON.stringify(a),s.push(x)}return s.join(",")},S.toHeaders=function(o){for(var s=Object.keys(o),l={},w=["Object","Request","Session","Status"],m=[{},{},{},{}],h={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},C=0,v=s;C<v.length;C++){var c=v[C],f=h[c]!=null?h[c]:1;m[f][c]=o[c]}for(var d=0;d<m.length;d++){var a=S.serialize(m[d]);a&&(l["CMCD-"+w[d]]=a)}return l},S.toQuery=function(o){return"CMCD="+encodeURIComponent(S.serialize(o))},S.appendQueryToUri=function(o,s){if(!s)return o;var l=o.includes("?")?"&":"?";return""+o+l+s},S}()},"./src/controller/eme-controller.ts":function(Z,G,D){"use strict";D.r(G);var W=D("./src/events.ts"),M=D("./src/errors.ts"),O=D("./src/utils/logger.ts"),F=D("./src/utils/mediakeys-helper.ts");function I(L,S){for(var y=0;y<S.length;y++){var u=S[y];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(L,u.key,u)}}function R(L,S,y){return S&&I(L.prototype,S),y&&I(L,y),L}var _=3,g=function(S,y,u){var o={audioCapabilities:[],videoCapabilities:[]};return S.forEach(function(s){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:u.audioRobustness||""})}),y.forEach(function(s){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:u.videoRobustness||""})}),[o]},T=function(S,y,u,o){switch(S){case F.KeySystems.WIDEVINE:return g(y,u,o);default:throw new Error("Unknown key-system: "+S)}},A=function(){function L(y){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=y,this._config=y.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 S=L.prototype;return S.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},S._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)},S._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)},S.getLicenseServerUrl=function(u){switch(u){case F.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+u+'"')},S._attemptKeySystemAccess=function(u,o,s){var l=this,w=T(u,o,s,this._drmSystemOptions);O.logger.log("Requesting encrypted media key-system access");var m=this.requestMediaKeySystemAccess(u,w);this.mediaKeysPromise=m.then(function(h){return l._onMediaKeySystemAccessObtained(u,h)}),m.catch(function(h){O.logger.error('Failed to obtain key-system "'+u+'" access:',h)})},S._onMediaKeySystemAccessObtained=function(u,o){var s=this;O.logger.log('Access for key-system "'+u+'" obtained');var l={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:u};this._mediaKeysList.push(l);var w=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(m){return l.mediaKeys=m,O.logger.log('Media-keys created for key-system "'+u+'"'),s._onMediaKeysCreated(),m});return w.catch(function(m){O.logger.error("Failed to create media-keys:",m)}),w},S._onMediaKeysCreated=function(){var u=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),u._onNewMediaKeySession(o.mediaKeysSession))})},S._onNewMediaKeySession=function(u){var o=this;O.logger.log("New key-system session "+u.sessionId),u.addEventListener("message",function(s){o._onKeySessionMessage(u,s.message)},!1)},S._onKeySessionMessage=function(u,o){O.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(s){O.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),u.update(s)})},S.onMediaEncrypted=function(u){var o=this;if(O.logger.log('Media is encrypted using "'+u.initDataType+'" init data type'),!this.mediaKeysPromise){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(w){if(!o._media)return;o._attemptSetMediaKeys(w),o._generateRequestWithPreferredKeySession(u.initDataType,u.initData)};this.mediaKeysPromise.then(s).catch(s)},S._attemptSetMediaKeys=function(u){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}O.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},S._generateRequestWithPreferredKeySession=function(u,o){var s=this,l=this._mediaKeysList[0];if(!l){O.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(l.mediaKeysSessionInitialized){O.logger.warn("Key-Session already initialized but requested again");return}var w=l.mediaKeysSession;if(!w){O.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){O.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}O.logger.log('Generating key-session request for "'+u+'" init data type'),l.mediaKeysSessionInitialized=!0,w.generateRequest(u,o).then(function(){O.logger.debug("Key-session generation succeeded")}).catch(function(m){O.logger.error("Error generating key-session request:",m),s.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},S._createLicenseXhr=function(u,o,s){var l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,l,u,o,s);var w=this._licenseXhrSetup;if(w)try{w.call(this.hls,l,u),w=void 0}catch(m){O.logger.error(m)}try{l.readyState||l.open("POST",u,!0),w&&w.call(this.hls,l,u)}catch(m){throw new Error("issue setting up KeySystem license XHR "+m)}return l},S._onLicenseRequestReadyStageChange=function(u,o,s,l){switch(u.readyState){case 4:if(u.status===200){this._requestLicenseFailureCount=0,O.logger.log("License request succeeded");var w=u.response,m=this._licenseResponseCallback;if(m)try{w=m.call(this.hls,u,o)}catch(C){O.logger.error(C)}l(w)}else{if(O.logger.error("License Request XHR failed ("+o+"). Status: "+u.status+" ("+u.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>_){this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var h=_-this._requestLicenseFailureCount+1;O.logger.warn("Retrying license request, "+h+" attempts left"),this._requestLicense(s,l)}break}},S._generateLicenseRequestChallenge=function(u,o){switch(u.mediaKeySystemDomain){case F.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+u.mediaKeySystemDomain)},S._requestLicense=function(u,o){O.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){O.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var l=this.getLicenseServerUrl(s.mediaKeySystemDomain),w=this._createLicenseXhr(l,u,o);O.logger.log("Sending license request to URL: "+l);var m=this._generateLicenseRequestChallenge(s,u);w.send(m)}catch(h){O.logger.error("Failure requesting DRM license: "+h),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},S.onMediaAttached=function(u,o){if(!this._emeEnabled)return;var s=o.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},S.onMediaDetached=function(){var u=this._media,o=this._mediaKeysList;if(!u)return;u.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return u.setMediaKeys(null)}).catch(function(){})},S.onManifestParsed=function(u,o){if(!this._emeEnabled)return;var s=o.levels.map(function(w){return w.audioCodec}).filter(function(w){return!!w}),l=o.levels.map(function(w){return w.videoCodec}).filter(function(w){return!!w});this._attemptKeySystemAccess(F.KeySystems.WIDEVINE,s,l)},R(L,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),L}();G.default=A},"./src/controller/fps-controller.ts":function(Z,G,D){"use strict";D.r(G);var W=D("./src/events.ts"),M=D("./src/utils/logger.ts"),O=function(){function F(R){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=R,this.registerListeners()}var I=F.prototype;return I.setStreamController=function(_){this.streamController=_},I.registerListeners=function(){this.hls.on(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},I.unregisterListeners=function(){this.hls.off(W.Events.MEDIA_ATTACHING,this.onMediaAttaching)},I.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},I.onMediaAttaching=function(_,g){var T=this.hls.config;if(T.capLevelOnFPSDrop){var A=g.media instanceof self.HTMLVideoElement?g.media:null;this.media=A,A&&typeof A.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),T.fpsDroppedMonitoringPeriod)}},I.checkFPS=function(_,g,T){var A=performance.now();if(g){if(this.lastTime){var L=A-this.lastTime,S=T-this.lastDroppedFrames,y=g-this.lastDecodedFrames,u=1e3*S/L,o=this.hls;if(o.trigger(W.Events.FPS_DROP,{currentDropped:S,currentDecoded:y,totalDroppedFrames:T}),u>0&&S>o.config.fpsDroppedMonitoringThreshold*y){var s=o.currentLevel;M.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=A,this.lastDroppedFrames=T,this.lastDecodedFrames=g}},I.checkFPSInterval=function(){var _=this.media;if(_)if(this.isVideoPlaybackQualityAvailable){var g=_.getVideoPlaybackQuality();this.checkFPS(_,g.totalVideoFrames,g.droppedVideoFrames)}else this.checkFPS(_,_.webkitDecodedFrameCount,_.webkitDroppedFrameCount)},F}();G.default=O},"./src/controller/fragment-finders.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"findFragmentByPDT",function(){return O}),D.d(G,"findFragmentByPTS",function(){return F}),D.d(G,"fragmentWithinToleranceTest",function(){return I}),D.d(G,"pdtWithinToleranceTest",function(){return R}),D.d(G,"findFragWithCC",function(){return _});var W=D("./src/polyfills/number.ts"),M=D("./src/utils/binary-search.ts");function O(g,T,A){if(T===null||!Array.isArray(g)||!g.length||!Object(W.isFiniteNumber)(T))return null;var L=g[0].programDateTime;if(T<(L||0))return null;var S=g[g.length-1].endProgramDateTime;if(T>=(S||0))return null;A=A||0;for(var y=0;y<g.length;++y){var u=g[y];if(R(T,A,u))return u}return null}function F(g,T,A,L){A===void 0&&(A=0),L===void 0&&(L=0);var S=null;if(g?S=T[g.sn-T[0].sn+1]||null:A===0&&T[0].start===0&&(S=T[0]),S&&I(A,L,S)===0)return S;var y=M.default.search(T,I.bind(null,A,L));return y||S}function I(g,T,A){g===void 0&&(g=0),T===void 0&&(T=0);var L=Math.min(T,A.duration+(A.deltaPTS?A.deltaPTS:0));return A.start+A.duration-L<=g?1:A.start-L>g&&A.start?-1:0}function R(g,T,A){var L=Math.min(T,A.duration+(A.deltaPTS?A.deltaPTS:0))*1e3,S=A.endProgramDateTime||0;return S-L>g}function _(g,T){return M.default.search(g,function(A){return A.cc<T?1:A.cc>T?-1:0})}},"./src/controller/fragment-tracker.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"FragmentState",function(){return O}),D.d(G,"FragmentTracker",function(){return F});var W=D("./src/events.ts"),M=D("./src/types/loader.ts"),O;(function(_){_.NOT_LOADED="NOT_LOADED",_.BACKTRACKED="BACKTRACKED",_.APPENDING="APPENDING",_.PARTIAL="PARTIAL",_.OK="OK"})(O||(O={}));var F=function(){function _(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 g=_.prototype;return g._registerListeners=function(){var A=this.hls;A.on(W.Events.BUFFER_APPENDED,this.onBufferAppended,this),A.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this),A.on(W.Events.FRAG_LOADED,this.onFragLoaded,this)},g._unregisterListeners=function(){var A=this.hls;A.off(W.Events.BUFFER_APPENDED,this.onBufferAppended,this),A.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this),A.off(W.Events.FRAG_LOADED,this.onFragLoaded,this)},g.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},g.getAppendedFrag=function(A,L){if(L===M.PlaylistLevelType.MAIN){var S=this.activeFragment,y=this.activeParts;if(!S)return null;if(y)for(var u=y.length;u--;){var o=y[u],s=o?o.end:S.appendedPTS;if(o.start<=A&&s!==void 0&&A<=s)return u>9&&(this.activeParts=y.slice(u-9)),o}else if(S.start<=A&&S.appendedPTS!==void 0&&A<=S.appendedPTS)return S}return this.getBufferedFrag(A,L)},g.getBufferedFrag=function(A,L){for(var S=this.fragments,y=Object.keys(S),u=y.length;u--;){var o=S[y[u]];if((o==null?void 0:o.body.type)===L&&o.buffered){var s=o.body;if(s.start<=A&&A<=s.end)return s}}return null},g.detectEvictedFragments=function(A,L,S){var y=this;Object.keys(this.fragments).forEach(function(u){var o=y.fragments[u];if(!o)return;if(!o.buffered){o.body.type===S&&y.removeFragment(o.body);return}var s=o.range[A];if(!s)return;s.time.some(function(l){var w=!y.isTimeBuffered(l.startPTS,l.endPTS,L);return w&&y.removeFragment(o.body),w})})},g.detectPartialFragments=function(A){var L=this,S=this.timeRanges,y=A.frag,u=A.part;if(!S||y.sn==="initSegment")return;var o=R(y),s=this.fragments[o];if(!s)return;Object.keys(S).forEach(function(l){var w=y.elementaryStreams[l];if(!w)return;var m=S[l],h=u!==null||w.partial===!0;s.range[l]=L.getBufferedTimes(y,u,h,m)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},g.fragBuffered=function(A){var L=R(A),S=this.fragments[L];S&&(S.backtrack=S.loaded=null,S.buffered=!0)},g.getBufferedTimes=function(A,L,S,y){for(var u={time:[],partial:S},o=L?L.start:A.start,s=L?L.end:A.end,l=A.minEndPTS||s,w=A.maxStartPTS||o,m=0;m<y.length;m++){var h=y.start(m)-this.bufferPadding,C=y.end(m)+this.bufferPadding;if(w>=h&&l<=C){u.time.push({startPTS:Math.max(o,y.start(m)),endPTS:Math.min(s,y.end(m))});break}else if(o<C&&s>h)u.partial=!0,u.time.push({startPTS:Math.max(o,y.start(m)),endPTS:Math.min(s,y.end(m))});else if(s<=h)break}return u},g.getPartialFragment=function(A){var L=null,S,y,u,o=0,s=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach(function(w){var m=l[w];if(!m)return;I(m)&&(y=m.body.start-s,u=m.body.end+s,A>=y&&A<=u&&(S=Math.min(A-y,u-A),o<=S&&(L=m.body,o=S)))}),L},g.getState=function(A){var L=R(A),S=this.fragments[L];return S?S.buffered?I(S)?O.PARTIAL:O.OK:S.backtrack?O.BACKTRACKED:O.APPENDING:O.NOT_LOADED},g.backtrack=function(A,L){var S=R(A),y=this.fragments[S];if(!y||y.backtrack)return null;var u=y.backtrack=L||y.loaded;return y.loaded=null,u},g.getBacktrackData=function(A){var L=R(A),S=this.fragments[L];if(S){var y,u=S.backtrack;if(u!=null&&(y=u.payload)!==null&&y!==void 0&&y.byteLength)return u;this.removeFragment(A)}return null},g.isTimeBuffered=function(A,L,S){for(var y,u,o=0;o<S.length;o++){if(y=S.start(o)-this.bufferPadding,u=S.end(o)+this.bufferPadding,A>=y&&L<=u)return!0;if(L<=y)return!1}return!1},g.onFragLoaded=function(A,L){var S=L.frag,y=L.part;if(S.sn==="initSegment"||S.bitrateTest||y)return;var u=R(S);this.fragments[u]={body:S,loaded:L,backtrack:null,buffered:!1,range:Object.create(null)}},g.onBufferAppended=function(A,L){var S=this,y=L.frag,u=L.part,o=L.timeRanges;if(y.type===M.PlaylistLevelType.MAIN)if(this.activeFragment=y,u){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(u)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(l){var w=o[l];if(S.detectEvictedFragments(l,w),!u)for(var m=0;m<w.length;m++)y.appendedPTS=Math.max(w.end(m),y.appendedPTS||0)})},g.onFragBuffered=function(A,L){this.detectPartialFragments(L)},g.hasFragment=function(A){var L=R(A);return!!this.fragments[L]},g.removeFragmentsInRange=function(A,L,S){var y=this;Object.keys(this.fragments).forEach(function(u){var o=y.fragments[u];if(!o)return;if(o.buffered){var s=o.body;s.type===S&&s.start<L&&s.end>A&&y.removeFragment(s)}})},g.removeFragment=function(A){var L=R(A);A.stats.loaded=0,A.clearElementaryStreamInfo(),delete this.fragments[L]},g.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},_}();function I(_){var g,T;return _.buffered&&(((g=_.range.video)===null||g===void 0?void 0:g.partial)||((T=_.range.audio)===null||T===void 0?void 0:T.partial))}function R(_){return _.type+"_"+_.level+"_"+_.urlId+"_"+_.sn}},"./src/controller/gap-controller.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"STALL_MINIMUM_DURATION_MS",function(){return I}),D.d(G,"MAX_START_GAP_JUMP",function(){return R}),D.d(G,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return _}),D.d(G,"SKIP_BUFFER_RANGE_START",function(){return g}),D.d(G,"default",function(){return T});var W=D("./src/utils/buffer-helper.ts"),M=D("./src/errors.ts"),O=D("./src/events.ts"),F=D("./src/utils/logger.ts"),I=250,R=2,_=.1,g=.05,T=function(){function A(S,y,u,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=S,this.media=y,this.fragmentTracker=u,this.hls=o}var L=A.prototype;return L.destroy=function(){this.hls=this.fragmentTracker=this.media=null},L.poll=function(y){var u=this.config,o=this.media,s=this.stalled,l=o.currentTime,w=o.seeking,m=this.seeking&&!w,h=!this.seeking&&w;if(this.seeking=w,l!==y){if(this.moved=!0,s!==null){if(this.stallReported){var C=self.performance.now()-s;F.logger.warn("playback not stuck anymore @"+l+", after "+Math.round(C)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((h||m)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!W.BufferHelper.getBuffered(o).length)return;var v=W.BufferHelper.bufferInfo(o,l,0),c=v.len>0,f=v.nextStart||0;if(!c&&!f)return;if(w){var d=v.len>R,a=!f||f-l>R&&!this.fragmentTracker.getPartialFragment(l);if(d||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var b,p=Math.max(f,v.start||0)-l,x=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,P=x==null||((b=x.details)===null||b===void 0)?void 0:b.live,N=P?x.details.targetduration*2:R;if(p>0&&p<=N){this._trySkipBufferHole(null);return}}var K=self.performance.now();if(s===null){this.stalled=K;return}var V=K-s;!w&&V>=I&&this._reportStall(v.len);var B=W.BufferHelper.bufferInfo(o,l,u.maxBufferHole);this._tryFixBufferStall(B,V)},L._tryFixBufferStall=function(y,u){var o=this.config,s=this.fragmentTracker,l=this.media,w=l.currentTime,m=s.getPartialFragment(w);if(m){var h=this._trySkipBufferHole(m);if(h)return}y.len>o.maxBufferHole&&u>o.highBufferWatchdogPeriod*1e3&&(F.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},L._reportStall=function(y){var u=this.hls,o=this.media,s=this.stallReported;s||(this.stallReported=!0,F.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+y+")"),u.trigger(O.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:y}))},L._trySkipBufferHole=function(y){for(var u=this.config,o=this.hls,s=this.media,l=s.currentTime,w=0,m=W.BufferHelper.getBuffered(s),h=0;h<m.length;h++){var C=m.start(h);if(l+u.maxBufferHole>=w&&l<C){var v=Math.max(C+g,s.currentTime+_);return F.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+v),this.moved=!0,this.stalled=null,s.currentTime=v,y&&o.trigger(O.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+l+" to "+v,frag:y}),v}w=m.end(h)}return 0},L._tryNudgeBuffer=function(){var y=this.config,u=this.hls,o=this.media,s=o.currentTime,l=(this.nudgeRetry||0)+1;if(this.nudgeRetry=l,l<y.nudgeMaxRetry){var w=s+l*y.nudgeOffset;F.logger.warn("Nudging 'currentTime' from "+s+" to "+w),o.currentTime=w,u.trigger(O.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else F.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+y.nudgeMaxRetry+" nudges"),u.trigger(O.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},A}()},"./src/controller/id3-track-controller.ts":function(Z,G,D){"use strict";D.r(G);var W=D("./src/events.ts"),M=D("./src/utils/texttrack-utils.ts"),O=D("./src/demux/id3.ts"),F=.25,I=function(){function R(g){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=g,this._registerListeners()}var _=R.prototype;return _.destroy=function(){this._unregisterListeners()},_._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)},_._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)},_.onMediaAttached=function(T,A){this.media=A.media},_.onMediaDetaching=function(){if(!this.id3Track)return;Object(M.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},_.getID3Track=function(T){if(!this.media)return;for(var A=0;A<T.length;A++){var L=T[A];if(L.kind==="metadata"&&L.label==="id3")return Object(M.sendAddTrackEvent)(L,this.media),L}return this.media.addTextTrack("metadata","id3")},_.onFragParsingMetadata=function(T,A){if(!this.media)return;var L=A.frag,S=A.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var y=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,u=0;u<S.length;u++){var o=O.getID3Frames(S[u].data);if(o){var s=S[u].pts,l=u<S.length-1?S[u+1].pts:L.end,w=l-s;w<=0&&(l=s+F);for(var m=0;m<o.length;m++){var h=o[m];if(!O.isTimeStampFrame(h)){var C=new y(s,l,"");C.value=h,this.id3Track.addCue(C)}}}}},_.onBufferFlushing=function(T,A){var L=A.startOffset,S=A.endOffset,y=A.type;if(!y||y==="audio"){var u=this.id3Track;u&&Object(M.removeCuesInRange)(u,L,S)}},R}();G.default=I},"./src/controller/latency-controller.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return R});var W=D("./src/errors.ts"),M=D("./src/events.ts"),O=D("./src/utils/logger.ts");function F(_,g){for(var T=0;T<g.length;T++){var A=g[T];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(_,A.key,A)}}function I(_,g,T){return g&&F(_.prototype,g),T&&F(_,T),_}var R=function(){function _(T){var A=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 A.timeupdate()},this.hls=T,this.config=T.config,this.registerListeners()}var g=_.prototype;return g.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},g.registerListeners=function(){this.hls.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(M.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){this.hls.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(M.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(M.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(M.Events.ERROR,this.onError)},g.onMediaAttached=function(A,L){this.media=L.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},g.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},g.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},g.onLevelUpdated=function(A,L){var S=L.details;this.levelDetails=S,S.advanced&&this.timeupdate(),!S.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},g.onError=function(A,L){if(L.details!==W.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,O.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},g.timeupdate=function(){var A=this.media,L=this.levelDetails;if(!A||!L)return;this.currentTime=A.currentTime;var S=this.computeLatency();if(S===null)return;this._latency=S;var y=this.config,u=y.lowLatencyMode,o=y.maxLiveSyncPlaybackRate;if(!u||o===1)return;var s=this.targetLatency;if(s===null)return;var l=S-s,w=Math.min(this.maxLatency,s+L.targetduration),m=l<w;if(L.live&&m&&l>.05&&this.forwardBufferLength>1){var h=Math.min(2,Math.max(1,o)),C=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20;A.playbackRate=Math.min(h,Math.max(1,C))}else A.playbackRate!==1&&A.playbackRate!==0&&(A.playbackRate=1)},g.estimateLiveEdge=function(){var A=this.levelDetails;return A===null?null:A.edge+A.age},g.computeLatency=function(){var A=this.estimateLiveEdge();return A===null?null:A-this.currentTime},I(_,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var A=this.config,L=this.levelDetails;return A.liveMaxLatencyDuration!==void 0?A.liveMaxLatencyDuration:L?A.liveMaxLatencyDurationCount*L.targetduration:0}},{key:"targetLatency",get:function(){var A=this.levelDetails;if(A===null)return null;var L=A.holdBack,S=A.partHoldBack,y=A.targetduration,u=this.config,o=u.liveSyncDuration,s=u.liveSyncDurationCount,l=u.lowLatencyMode,w=this.hls.userConfig,m=l&&S||L;(w.liveSyncDuration||w.liveSyncDurationCount||m===0)&&(m=o!==void 0?o:s*y);var h=y,C=1;return m+Math.min(this.stallCount*C,h)}},{key:"liveSyncPosition",get:function(){var A=this.estimateLiveEdge(),L=this.targetLatency,S=this.levelDetails;if(A===null||L===null||S===null)return null;var y=S.edge,u=A-L-this.edgeStalled,o=y-S.totalduration,s=y-(this.config.lowLatencyMode&&S.partTarget||S.targetduration);return Math.min(Math.max(o,u),s)}},{key:"drift",get:function(){var A=this.levelDetails;return A===null?1:A.drift}},{key:"edgeStalled",get:function(){var A=this.levelDetails;if(A===null)return 0;var L=(this.config.lowLatencyMode&&A.partTarget||A.targetduration)*3;return Math.max(A.age-L,0)}},{key:"forwardBufferLength",get:function(){var A=this.media,L=this.levelDetails;if(!A||!L)return 0;var S=A.buffered.length;return S?A.buffered.end(S-1):L.edge-this.currentTime}}]),_}()},"./src/controller/level-controller.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return u});var W=D("./src/types/level.ts"),M=D("./src/events.ts"),O=D("./src/errors.ts"),F=D("./src/utils/codecs.ts"),I=D("./src/controller/level-helper.ts"),R=D("./src/controller/base-playlist-controller.ts"),_=D("./src/types/loader.ts");function g(){return g=Object.assign||function(o){for(var s=1;s<arguments.length;s++){var l=arguments[s];for(var w in l)Object.prototype.hasOwnProperty.call(l,w)&&(o[w]=l[w])}return o},g.apply(this,arguments)}function T(o,s){for(var l=0;l<s.length;l++){var w=s[l];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function A(o,s,l){return s&&T(o.prototype,s),l&&T(o,l),o}function L(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,S(o,s)}function S(o,s){return S=Object.setPrototypeOf||function(w,m){return w.__proto__=m,w},S(o,s)}var y=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),u=function(o){L(s,o);function s(w){var m;return m=o.call(this,w,"[level-controller]")||this,m._levels=[],m._firstLevel=-1,m._startLevel=void 0,m.currentLevelIndex=-1,m.manualLevelIndex=-1,m.onParsedComplete=void 0,m._registerListeners(),m}var l=s.prototype;return l._registerListeners=function(){var m=this.hls;m.on(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),m.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.on(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),m.on(M.Events.ERROR,this.onError,this)},l._unregisterListeners=function(){var m=this.hls;m.off(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),m.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.off(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),m.off(M.Events.ERROR,this.onError,this)},l.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},l.startLoad=function(){var m=this._levels;m.forEach(function(h){h.loadError=0}),o.prototype.startLoad.call(this)},l.onManifestLoaded=function(m,h){var C=[],v=[],c=[],f,d={},a,b=!1,p=!1,x=!1;if(h.levels.forEach(function(V){var B=V.attrs;b=b||!!(V.width&&V.height),p=p||!!V.videoCodec,x=x||!!V.audioCodec,y&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var U=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;a=d[U],a?a.url.push(V.url):(a=new W.Level(V),d[U]=a,C.push(a)),B&&(B.AUDIO&&Object(I.addGroupId)(a,"audio",B.AUDIO),B.SUBTITLES&&Object(I.addGroupId)(a,"text",B.SUBTITLES))}),(b||p)&&x&&(C=C.filter(function(V){var B=V.videoCodec,U=V.width,Y=V.height;return!!B||!!(U&&Y)})),C=C.filter(function(V){var B=V.audioCodec,U=V.videoCodec;return(!B||Object(F.isCodecSupportedInMp4)(B,"audio"))&&(!U||Object(F.isCodecSupportedInMp4)(U,"video"))}),h.audioTracks&&(v=h.audioTracks.filter(function(V){return!V.audioCodec||Object(F.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(I.assignTrackIdsByGroup)(v)),h.subtitles&&(c=h.subtitles,Object(I.assignTrackIdsByGroup)(c)),C.length>0){f=C[0].bitrate,C.sort(function(V,B){return V.bitrate-B.bitrate}),this._levels=C;for(var P=0;P<C.length;P++)if(C[P].bitrate===f){this._firstLevel=P,this.log("manifest loaded, "+C.length+" level(s) found, first bitrate: "+f);break}var N=x&&!p,K={levels:C,audioTracks:v,subtitleTracks:c,firstLevel:this._firstLevel,stats:h.stats,audio:x,video:p,altAudio:!N&&v.some(function(V){return!!V.url})};this.hls.trigger(M.Events.MANIFEST_PARSED,K),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(M.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:h.url,reason:"no level with compatible codecs found in manifest"})},l.onError=function(m,h){if(o.prototype.onError.call(this,m,h),h.fatal)return;var C=h.context,v=this._levels[this.currentLevelIndex];if(C&&(C.type===_.PlaylistContextType.AUDIO_TRACK&&v.audioGroupIds&&C.groupId===v.audioGroupIds[v.urlId]||C.type===_.PlaylistContextType.SUBTITLE_TRACK&&v.textGroupIds&&C.groupId===v.textGroupIds[v.urlId])){this.redundantFailover(this.currentLevelIndex);return}var c=!1,f=!0,d;switch(h.details){case O.ErrorDetails.FRAG_LOAD_ERROR:case O.ErrorDetails.FRAG_LOAD_TIMEOUT:case O.ErrorDetails.KEY_LOAD_ERROR:case O.ErrorDetails.KEY_LOAD_TIMEOUT:if(h.frag){var a=this._levels[h.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(d=h.frag.level)):d=h.frag.level}break;case O.ErrorDetails.LEVEL_LOAD_ERROR:case O.ErrorDetails.LEVEL_LOAD_TIMEOUT:C&&(C.deliveryDirectives&&(f=!1),d=C.level),c=!0;break;case O.ErrorDetails.REMUX_ALLOC_ERROR:d=h.level,c=!0;break}d!==void 0&&this.recoverLevel(h,d,c,f)},l.recoverLevel=function(m,h,C,v){var c=m.details,f=this._levels[h];if(f.loadError++,C){var d=this.retryLoadingOrFail(m);if(d)m.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(v){var a=f.url.length;if(a>1&&f.loadError<a)m.levelRetry=!0,this.redundantFailover(h);else if(this.manualLevelIndex===-1){var b=h===0?this._levels.length-1:h-1;this.currentLevelIndex!==b&&this._levels[b].loadError===0&&(this.warn(c+": switch to "+b),m.levelRetry=!0,this.hls.nextAutoLevel=b)}}},l.redundantFailover=function(m){var h=this._levels[m],C=h.url.length;if(C>1){var v=(h.urlId+1)%C;this.warn("Switching to redundant URL-id "+v),this._levels.forEach(function(c){c.urlId=v}),this.level=m}},l.onFragLoaded=function(m,h){var C=h.frag;if(C!==void 0&&C.type===_.PlaylistLevelType.MAIN){var v=this._levels[C.level];v!==void 0&&(v.fragmentError=0,v.loadError=0)}},l.onLevelLoaded=function(m,h){var C,v=h.level,c=h.details,f=this._levels[v];if(!f){var d;this.warn("Invalid level index "+v),(d=h.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(c.deltaUpdateFailed=!0);return}v===this.currentLevelIndex?(f.fragmentError===0&&(f.loadError=0,this.retryCount=0),this.playlistLoaded(v,h,f.details)):(C=h.deliveryDirectives)!==null&&C!==void 0&&C.skip&&(c.deltaUpdateFailed=!0)},l.onAudioTrackSwitched=function(m,h){var C=this.hls.levels[this.currentLevelIndex];if(!C)return;if(C.audioGroupIds){for(var v=-1,c=this.hls.audioTracks[h.id].groupId,f=0;f<C.audioGroupIds.length;f++)if(C.audioGroupIds[f]===c){v=f;break}v!==C.urlId&&(C.urlId=v,this.startLoad())}},l.loadPlaylist=function(m){var h=this.currentLevelIndex,C=this._levels[h];if(this.canLoad&&C&&C.url.length>0){var v=C.urlId,c=C.url[v];if(m)try{c=m.addDirectives(c)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Attempt loading level index "+h+(m?" at sn "+m.msn+" part "+m.part:"")+" with URL-id "+v+" "+c),this.clearTimer(),this.hls.trigger(M.Events.LEVEL_LOADING,{url:c,level:h,id:v,deliveryDirectives:m||null})}},l.removeLevel=function(m,h){var C=function(f,d){return d!==h},v=this._levels.filter(function(c,f){return f!==m?!0:c.url.length>1&&h!==void 0?(c.url=c.url.filter(C),c.audioGroupIds&&(c.audioGroupIds=c.audioGroupIds.filter(C)),c.textGroupIds&&(c.textGroupIds=c.textGroupIds.filter(C)),c.urlId=0,!0):!1}).map(function(c,f){var d=c.details;return d!=null&&d.fragments&&d.fragments.forEach(function(a){a.level=f}),c});this._levels=v,this.hls.trigger(M.Events.LEVELS_UPDATED,{levels:v})},A(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(m){var h,C=this._levels;if(C.length===0)return;if(this.currentLevelIndex===m&&(h=C[m])!==null&&h!==void 0&&h.details)return;if(m<0||m>=C.length){var v=m<0;if(this.hls.trigger(M.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.LEVEL_SWITCH_ERROR,level:m,fatal:v,reason:"invalid level idx"}),v)return;m=Math.min(m,C.length-1)}this.clearTimer();var c=this.currentLevelIndex,f=C[c],d=C[m];this.log("switching to level "+m+" from "+c),this.currentLevelIndex=m;var a=g({},d,{level:m,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete a._urlId,this.hls.trigger(M.Events.LEVEL_SWITCHING,a);var b=d.details;if(!b||b.live){var p=this.switchParams(d.uri,f==null?void 0:f.details);this.loadPlaylist(p)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(m){this.manualLevelIndex=m,this._startLevel===void 0&&(this._startLevel=m),m!==-1&&(this.level=m)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(m){this._firstLevel=m}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var m=this.hls.config.startLevel;return m!==void 0?m:this._firstLevel}else return this._startLevel},set:function(m){this._startLevel=m}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(m){this.level=m,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=m)}}]),s}(R.default)},"./src/controller/level-helper.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"addGroupId",function(){return O}),D.d(G,"assignTrackIdsByGroup",function(){return F}),D.d(G,"updatePTS",function(){return I}),D.d(G,"updateFragPTSDTS",function(){return _}),D.d(G,"mergeDetails",function(){return g}),D.d(G,"mapPartIntersection",function(){return T}),D.d(G,"mapFragmentIntersection",function(){return A}),D.d(G,"adjustSliding",function(){return L}),D.d(G,"addSliding",function(){return S}),D.d(G,"computeReloadInterval",function(){return y}),D.d(G,"getFragmentWithSN",function(){return u}),D.d(G,"getPartWith",function(){return o});var W=D("./src/polyfills/number.ts"),M=D("./src/utils/logger.ts");function O(s,l,w){switch(l){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(w);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(w);break}}function F(s){var l={};s.forEach(function(w){var m=w.groupId||"";w.id=l[m]=l[m]||0,l[m]++})}function I(s,l,w){var m=s[l],h=s[w];R(m,h)}function R(s,l){var w=l.startPTS;if(Object(W.isFiniteNumber)(w)){var m=0,h;l.sn>s.sn?(m=w-s.start,h=s):(m=s.start-w,h=l),h.duration!==m&&(h.duration=m)}else if(l.sn>s.sn){var C=s.cc===l.cc;C&&s.minEndPTS?l.start=s.start+(s.minEndPTS-s.start):l.start=s.start+s.duration}else l.start=Math.max(s.start-l.duration,0)}function _(s,l,w,m,h,C){var v=m-w;v<=0&&(M.logger.warn("Fragment should have a positive duration",l),m=w+l.duration,C=h+l.duration);var c=w,f=m,d=l.startPTS,a=l.endPTS;if(Object(W.isFiniteNumber)(d)){var b=Math.abs(d-w);Object(W.isFiniteNumber)(l.deltaPTS)?l.deltaPTS=Math.max(b,l.deltaPTS):l.deltaPTS=b,c=Math.max(w,d),w=Math.min(w,d),h=Math.min(h,l.startDTS),f=Math.min(m,a),m=Math.max(m,a),C=Math.max(C,l.endDTS)}l.duration=m-w;var p=w-l.start;l.appendedPTS=m,l.start=l.startPTS=w,l.maxStartPTS=c,l.startDTS=h,l.endPTS=m,l.minEndPTS=f,l.endDTS=C;var x=l.sn;if(!s||x<s.startSN||x>s.endSN)return 0;var P,N=x-s.startSN,K=s.fragments;for(K[N]=l,P=N;P>0;P--)R(K[P],K[P-1]);for(P=N;P<K.length-1;P++)R(K[P],K[P+1]);return s.fragmentHint&&R(K[K.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,p}function g(s,l){for(var w=null,m=s.fragments,h=m.length-1;h>=0;h--){var C=m[h].initSegment;if(C){w=C;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var v=0,c;if(A(s,l,function(P,N){P.relurl&&(v=P.cc-N.cc),Object(W.isFiniteNumber)(P.startPTS)&&Object(W.isFiniteNumber)(P.endPTS)&&(N.start=N.startPTS=P.startPTS,N.startDTS=P.startDTS,N.appendedPTS=P.appendedPTS,N.maxStartPTS=P.maxStartPTS,N.endPTS=P.endPTS,N.endDTS=P.endDTS,N.minEndPTS=P.minEndPTS,N.duration=P.endPTS-P.startPTS,N.duration&&(c=N),l.PTSKnown=l.alignedSliding=!0),N.elementaryStreams=P.elementaryStreams,N.loader=P.loader,N.stats=P.stats,N.urlId=P.urlId,P.initSegment&&(N.initSegment=P.initSegment,w=P.initSegment)}),w){var f=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments;f.forEach(function(P){var N;(!P.initSegment||P.initSegment.relurl===((N=w)===null||N===void 0?void 0:N.relurl))&&(P.initSegment=w)})}if(l.skippedSegments&&(l.deltaUpdateFailed=l.fragments.some(function(P){return!P}),l.deltaUpdateFailed)){M.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var d=l.skippedSegments;d--;)l.fragments.shift();l.startSN=l.fragments[0].sn,l.startCC=l.fragments[0].cc}var a=l.fragments;if(v){M.logger.warn("discontinuity sliding from playlist, take drift into account");for(var b=0;b<a.length;b++)a[b].cc+=v}l.skippedSegments&&(l.startCC=l.fragments[0].cc),T(s.partList,l.partList,function(P,N){N.elementaryStreams=P.elementaryStreams,N.stats=P.stats}),c?_(l,c,c.startPTS,c.endPTS,c.startDTS,c.endDTS):L(s,l),a.length&&(l.totalduration=l.edge-a[0].start),l.driftStartTime=s.driftStartTime,l.driftStart=s.driftStart;var p=l.advancedDateTime;if(l.advanced&&p){var x=l.edge;l.driftStart||(l.driftStartTime=p,l.driftStart=x),l.driftEndTime=p,l.driftEnd=x}else l.driftEndTime=s.driftEndTime,l.driftEnd=s.driftEnd,l.advancedDateTime=s.advancedDateTime}function T(s,l,w){if(s&&l)for(var m=0,h=0,C=s.length;h<=C;h++){var v=s[h],c=l[h+m];v&&c&&v.index===c.index&&v.fragment.sn===c.fragment.sn?w(v,c):m--}}function A(s,l,w){for(var m=l.skippedSegments,h=Math.max(s.startSN,l.startSN)-l.startSN,C=(s.fragmentHint?1:0)+(m?l.endSN:Math.min(s.endSN,l.endSN))-l.startSN,v=l.startSN-s.startSN,c=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,f=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,d=h;d<=C;d++){var a=f[v+d],b=c[d];m&&!b&&d<m&&(b=l.fragments[d]=a),a&&b&&w(a,b)}}function L(s,l){var w=l.startSN+l.skippedSegments-s.startSN,m=s.fragments;if(w<0||w>=m.length)return;S(l,m[w].start)}function S(s,l){if(l){for(var w=s.fragments,m=s.skippedSegments;m<w.length;m++)w[m].start+=l;s.fragmentHint&&(s.fragmentHint.start+=l)}}function y(s,l){var w=1e3*s.levelTargetDuration,m=w/2,h=s.age,C=h>0&&h<w*3,v=l.loading.end-l.loading.start,c,f=s.availabilityDelay;if(s.updated===!1)if(C){var d=333*s.misses;c=Math.max(Math.min(m,v*2),d),s.availabilityDelay=(s.availabilityDelay||0)+c}else c=m;else C?(f=Math.min(f||w/2,h),s.availabilityDelay=f,c=f+w-h):c=w-v;return Math.round(c)}function u(s,l,w){if(!s||!s.details)return null;var m=s.details,h=m.fragments[l-m.startSN];return h||(h=m.fragmentHint,h&&h.sn===l?h:l<m.startSN&&w&&w.sn===l?w:null)}function o(s,l,w){if(!s||!s.details)return null;var m=s.details.partList;if(m)for(var h=m.length;h--;){var C=m[h];if(C.index===w&&C.fragment.sn===l)return C}return null}},"./src/controller/stream-controller.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return m});var W=D("./src/polyfills/number.ts"),M=D("./src/controller/base-stream-controller.ts"),O=D("./src/is-supported.ts"),F=D("./src/events.ts"),I=D("./src/utils/buffer-helper.ts"),R=D("./src/controller/fragment-tracker.ts"),_=D("./src/types/loader.ts"),g=D("./src/loader/fragment.ts"),T=D("./src/demux/transmuxer-interface.ts"),A=D("./src/types/transmuxer.ts"),L=D("./src/controller/gap-controller.ts"),S=D("./src/errors.ts"),y=D("./src/utils/logger.ts");function u(h,C){for(var v=0;v<C.length;v++){var c=C[v];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(h,c.key,c)}}function o(h,C,v){return C&&u(h.prototype,C),v&&u(h,v),h}function s(h,C){h.prototype=Object.create(C.prototype),h.prototype.constructor=h,l(h,C)}function l(h,C){return l=Object.setPrototypeOf||function(c,f){return c.__proto__=f,c},l(h,C)}var w=100,m=function(h){s(C,h);function C(c,f){var d;return d=h.call(this,c,f,"[stream-controller]")||this,d.audioCodecSwap=!1,d.gapController=null,d.level=-1,d._forceStartLoad=!1,d.altAudio=!1,d.audioOnly=!1,d.fragPlaying=null,d.onvplaying=null,d.onvseeked=null,d.fragLastKbps=0,d.stalled=!1,d.couldBacktrack=!1,d.audioCodecSwitch=!1,d.videoBuffer=null,d._registerListeners(),d}var v=C.prototype;return v._registerListeners=function(){var f=this.hls;f.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),f.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(F.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.on(F.Events.ERROR,this.onError,this),f.on(F.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.on(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(F.Events.BUFFER_CREATED,this.onBufferCreated,this),f.on(F.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.on(F.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.on(F.Events.FRAG_BUFFERED,this.onFragBuffered,this)},v._unregisterListeners=function(){var f=this.hls;f.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(F.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.off(F.Events.ERROR,this.onError,this),f.off(F.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.off(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(F.Events.BUFFER_CREATED,this.onBufferCreated,this),f.off(F.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.off(F.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.off(F.Events.FRAG_BUFFERED,this.onFragBuffered,this)},v.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},v.startLoad=function(f){if(this.levels){var d=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(w),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var b=a.startLevel;b===-1&&(a.config.testBandwidth?(b=0,this.bitrateTest=!0):b=a.nextAutoLevel),this.level=a.nextLoadLevel=b,this.loadedmetadata=!1}d>0&&f===-1&&(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),f=d),this.state=M.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=f,this.tick()}else this._forceStartLoad=!0,this.state=M.State.STOPPED},v.stopLoad=function(){this._forceStartLoad=!1,h.prototype.stopLoad.call(this)},v.doTick=function(){switch(this.state){case M.State.IDLE:this.doTickIdle();break;case M.State.WAITING_LEVEL:{var f,d=this.levels,a=this.level,b=d==null||((f=d[a])===null||f===void 0)?void 0:f.details;if(b&&(!b.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(b))break;this.state=M.State.IDLE;break}break}case M.State.FRAG_LOADING_WAITING_RETRY:{var p,x=self.performance.now(),P=this.retryDate;(!P||x>=P||(p=this.media)!==null&&p!==void 0&&p.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=M.State.IDLE)}break;default:break}this.onTickEnd()},v.onTickEnd=function(){h.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},v.doTickIdle=function(){var f,d,a=this.hls,b=this.levelLastLoaded,p=this.levels,x=this.media,P=a.config,N=a.nextLoadLevel;if(b===null||!x&&(this.startFragRequested||!P.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!p||!p[N])return;var K=p[N];this.level=a.nextLoadLevel=N;var V=K.details;if(!V||this.state===M.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==N){this.state=M.State.WAITING_LEVEL;return}var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:x,_.PlaylistLevelType.MAIN);if(B===null)return;var U=B.len,Y=this.getMaxBufferLength(K.maxBitrate);if(U>=Y)return;if(this._streamEnded(B,V)){var ee={};this.altAudio&&(ee.type="video"),this.hls.trigger(F.Events.BUFFER_EOS,ee),this.state=M.State.ENDED;return}var oe=B.end,de=this.getNextFragment(oe,V);if(this.couldBacktrack&&!this.fragPrevious&&de&&de.sn!=="initSegment"){var Te=de.sn-V.startSN;Te>1&&(de=V.fragments[Te-1],this.fragmentTracker.removeFragment(de))}if(de&&this.fragmentTracker.getState(de)===R.FragmentState.OK&&this.nextLoadPosition>oe){var ge=this.audioOnly&&!this.altAudio?g.ElementaryStreamTypes.AUDIO:g.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(x,ge,_.PlaylistLevelType.MAIN),de=this.getNextFragment(this.nextLoadPosition,V)}if(!de)return;de.initSegment&&!de.initSegment.data&&!this.bitrateTest&&(de=de.initSegment),((f=de.decryptdata)===null||f===void 0?void 0:f.keyFormat)==="identity"&&!((d=de.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(de,V):this.loadFragment(de,V,oe)},v.loadFragment=function(f,d,a){var b,p=this.fragmentTracker.getState(f);if(this.fragCurrent=f,p===R.FragmentState.BACKTRACKED){var x=this.fragmentTracker.getBacktrackData(f);if(x){this._handleFragmentLoadProgress(x),this._handleFragmentLoadComplete(x);return}else p=R.FragmentState.NOT_LOADED}p===R.FragmentState.NOT_LOADED||p===R.FragmentState.PARTIAL?f.sn==="initSegment"?this._loadInitSegment(f):this.bitrateTest?(f.bitrateTest=!0,this.log("Fragment "+f.sn+" of level "+f.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(f)):(this.startFragRequested=!0,h.prototype.loadFragment.call(this,f,d,a)):p===R.FragmentState.APPENDING?this.reduceMaxBufferLength(f.duration)&&this.fragmentTracker.removeFragment(f):((b=this.media)===null||b===void 0?void 0:b.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},v.getAppendedFrag=function(f){var d=this.fragmentTracker.getAppendedFrag(f,_.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},v.getBufferedFrag=function(f){return this.fragmentTracker.getBufferedFrag(f,_.PlaylistLevelType.MAIN)},v.followingBufferedFrag=function(f){return f?this.getBufferedFrag(f.end+.5):null},v.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},v.nextLevelSwitch=function(){var f=this.levels,d=this.media;if(d!=null&&d.readyState){var a,b=this.getAppendedFrag(d.currentTime);if(b&&b.start>1&&this.flushMainBuffer(0,b.start-1),!d.paused&&f){var p=this.hls.nextLoadLevel,x=f[p],P=this.fragLastKbps;P&&this.fragCurrent?a=this.fragCurrent.duration*x.maxBitrate/(1e3*P)+1:a=0}else a=0;var N=this.getBufferedFrag(d.currentTime+a);if(N){var K=this.followingBufferedFrag(N);if(K){this.abortCurrentFrag();var V=K.maxStartPTS?K.maxStartPTS:K.start,B=K.duration,U=Math.max(N.end,V+Math.min(Math.max(B-this.config.maxFragLookUpTolerance,B*.5),B*.75));this.flushMainBuffer(U,Number.POSITIVE_INFINITY)}}}},v.abortCurrentFrag=function(){var f=this.fragCurrent;this.fragCurrent=null,f!=null&&f.loader&&f.loader.abort(),this.state===M.State.KEY_LOADING&&(this.state=M.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},v.flushMainBuffer=function(f,d){h.prototype.flushMainBuffer.call(this,f,d,this.altAudio?"video":null)},v.onMediaAttached=function(f,d){h.prototype.onMediaAttached.call(this,f,d);var a=d.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new L.default(this.config,a,this.fragmentTracker,this.hls)},v.onMediaDetaching=function(){var f=this.media;f&&(f.removeEventListener("playing",this.onvplaying),f.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),h.prototype.onMediaDetaching.call(this)},v.onMediaPlaying=function(){this.tick()},v.onMediaSeeked=function(){var f=this.media,d=f?f.currentTime:null;Object(W.isFiniteNumber)(d)&&this.log("Media seeked to "+d.toFixed(3)),this.tick()},v.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(F.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},v.onManifestParsed=function(f,d){var a=!1,b=!1,p;d.levels.forEach(function(x){p=x.audioCodec,p&&(p.indexOf("mp4a.40.2")!==-1&&(a=!0),p.indexOf("mp4a.40.5")!==-1&&(b=!0))}),this.audioCodecSwitch=a&&b&&!Object(O.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=d.levels,this.startFragRequested=!1},v.onLevelLoading=function(f,d){var a=this.levels;if(!a||this.state!==M.State.IDLE)return;var b=a[d.level];(!b.details||b.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(b.details))&&(this.state=M.State.WAITING_LEVEL)},v.onLevelLoaded=function(f,d){var a,b=this.levels,p=d.level,x=d.details,P=x.totalduration;if(!b){this.warn("Levels were reset while loading level "+p);return}this.log("Level "+p+" loaded ["+x.startSN+","+x.endSN+"], cc ["+x.startCC+", "+x.endCC+"] duration:"+P);var N=this.fragCurrent;N&&(this.state===M.State.FRAG_LOADING||this.state===M.State.FRAG_LOADING_WAITING_RETRY)&&(N.level!==d.level&&N.loader&&(this.state=M.State.IDLE,N.loader.abort()));var K=b[p],V=0;if(x.live||(a=K.details)!==null&&a!==void 0&&a.live){if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed)return;V=this.alignPlaylists(x,K.details)}if(K.details=x,this.levelLastLoaded=p,this.hls.trigger(F.Events.LEVEL_UPDATED,{details:x,level:p}),this.state===M.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(x))return;this.state=M.State.IDLE}this.startFragRequested?x.live&&this.synchronizeToLiveEdge(x):this.setStartPosition(x,V),this.tick()},v._handleFragmentLoadProgress=function(f){var d,a=f.frag,b=f.part,p=f.payload,x=this.levels;if(!x){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var P=x[a.level],N=P.details;if(!N){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var K=P.videoCodec,V=N.PTSKnown||!N.live,B=(d=a.initSegment)===null||d===void 0?void 0:d.data,U=this._getAudioCodec(P),Y=this.transmuxer=this.transmuxer||new T.default(this.hls,_.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ee=b?b.index:-1,oe=ee!==-1,de=new A.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,p.byteLength,ee,oe),Te=this.initPTS[a.cc];Y.push(p,B,U,K,a,b,N.totalduration,V,de,Te)},v.onAudioTrackSwitching=function(f,d){var a=this.altAudio,b=!!d.url,p=d.id;if(!b){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var x=this.fragCurrent;x!=null&&x.loader&&(this.log("Switching to main audio track, cancel main fragment load"),x.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var P=this.hls;a&&P.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),P.trigger(F.Events.AUDIO_TRACK_SWITCHED,{id:p})}},v.onAudioTrackSwitched=function(f,d){var a=d.id,b=!!this.hls.audioTracks[a].url;if(b){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=b,this.tick()},v.onBufferCreated=function(f,d){var a=d.tracks,b,p,x=!1;for(var P in a){var N=a[P];if(N.id==="main"){if(p=P,b=N,P==="video"){var K=a[P];K&&(this.videoBuffer=K.buffer)}}else x=!0}x&&b?(this.log("Alternate track found, use "+p+".buffered to schedule main fragment loading"),this.mediaBuffer=b.buffer):this.mediaBuffer=this.media},v.onFragBuffered=function(f,d){var a=d.frag,b=d.part;if(a&&a.type!==_.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(b?" p: "+b.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===M.State.PARSED&&(this.state=M.State.IDLE);return}var p=b?b.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,b)},v.onError=function(f,d){switch(d.details){case S.ErrorDetails.FRAG_LOAD_ERROR:case S.ErrorDetails.FRAG_LOAD_TIMEOUT:case S.ErrorDetails.KEY_LOAD_ERROR:case S.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(_.PlaylistLevelType.MAIN,d);break;case S.ErrorDetails.LEVEL_LOAD_ERROR:case S.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==M.State.ERROR&&(d.fatal?(this.warn(""+d.details),this.state=M.State.ERROR):!d.levelRetry&&this.state===M.State.WAITING_LEVEL&&(this.state=M.State.IDLE));break;case S.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="main"&&(this.state===M.State.PARSING||this.state===M.State.PARSED)){var a=!0,b=this.getFwdBufferInfo(this.media,_.PlaylistLevelType.MAIN);b&&b.len>.5&&(a=!this.reduceMaxBufferLength(b.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},v.checkBuffer=function(){var f=this.media,d=this.gapController;if(!f||!d||!f.readyState)return;var a=I.BufferHelper.getBuffered(f);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.poll(this.lastCurrentTime),this.lastCurrentTime=f.currentTime},v.onFragLoadEmergencyAborted=function(){this.state=M.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},v.onBufferFlushed=function(f,d){var a=d.type;if(a!==g.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var b=(a===g.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(b,a,_.PlaylistLevelType.MAIN)}},v.onLevelsUpdated=function(f,d){this.levels=d.levels},v.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},v.seekToStartPos=function(){var f=this.media,d=f.currentTime,a=this.startPosition;if(a>=0&&d<a){if(f.seeking){y.logger.log("could not seek to "+a+", already seeking at "+d);return}var b=I.BufferHelper.getBuffered(f),p=b.length?b.start(0):0,x=p-a;x>0&&(x<this.config.maxBufferHole||x<this.config.maxFragLookUpTolerance)&&(y.logger.log("adjusting start position by "+x+" to match buffer start"),a+=x,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+d),f.currentTime=a}},v._getAudioCodec=function(f){var d=this.config.defaultAudioCodec||f.audioCodec;return this.audioCodecSwap&&d&&(this.log("Swapping audio codec"),d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5"),d},v._loadBitrateTestFrag=function(f){var d=this;this._doFragLoad(f).then(function(a){var b=d.hls;if(!a||b.nextLoadLevel||d.fragContextChanged(f))return;d.fragLoadError=0,d.state=M.State.IDLE,d.startFragRequested=!1,d.bitrateTest=!1;var p=f.stats;p.parsing.start=p.parsing.end=p.buffering.start=p.buffering.end=self.performance.now(),b.trigger(F.Events.FRAG_LOADED,a)})},v._handleTransmuxComplete=function(f){var d,a="main",b=this.hls,p=f.remuxResult,x=f.chunkMeta,P=this.getCurrentContext(x);if(!P){this.warn("The loading context changed while buffering fragment "+x.sn+" of level "+x.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(x.level);return}var N=P.frag,K=P.part,V=P.level,B=p.video,U=p.text,Y=p.id3,ee=p.initSegment,oe=this.altAudio?void 0:p.audio;if(this.fragContextChanged(N))return;if(this.state=M.State.PARSING,ee){ee.tracks&&(this._bufferInitSegment(V,ee.tracks,N,x),b.trigger(F.Events.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:a,tracks:ee.tracks}));var de=ee.initPTS,Te=ee.timescale;Object(W.isFiniteNumber)(de)&&(this.initPTS[N.cc]=de,b.trigger(F.Events.INIT_PTS_FOUND,{frag:N,id:a,initPTS:de,timescale:Te}))}if(B&&p.independent!==!1){if(V.details){var ge=B.startPTS,pe=B.endPTS,fe=B.startDTS,me=B.endDTS;if(K)K.elementaryStreams[B.type]={startPTS:ge,endPTS:pe,startDTS:fe,endDTS:me};else if(B.firstKeyFrame&&B.independent&&(this.couldBacktrack=!0),B.dropped&&B.independent){var ae=this.getLoadPosition()+this.config.maxBufferHole;if(ae<ge){this.backtrack(N);return}N.setElementaryStreamInfo(B.type,N.start,pe,N.start,me,!0)}N.setElementaryStreamInfo(B.type,ge,pe,fe,me),this.bufferFragmentData(B,N,K,x)}}else if(p.independent===!1){this.backtrack(N);return}if(oe){var ue=oe.startPTS,Ee=oe.endPTS,Ie=oe.startDTS,ke=oe.endDTS;K&&(K.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:Ee,startDTS:Ie,endDTS:ke}),N.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,ue,Ee,Ie,ke),this.bufferFragmentData(oe,N,K,x)}if(Y!=null&&(d=Y.samples)!==null&&d!==void 0&&d.length){var Xe={frag:N,id:a,samples:Y.samples};b.trigger(F.Events.FRAG_PARSING_METADATA,Xe)}if(U){var Ne={frag:N,id:a,samples:U.samples};b.trigger(F.Events.FRAG_PARSING_USERDATA,Ne)}},v._bufferInitSegment=function(f,d,a,b){var p=this;if(this.state!==M.State.PARSING)return;this.audioOnly=!!d.audio&&!d.video,this.altAudio&&!this.audioOnly&&delete d.audio;var x=d.audio,P=d.video,N=d.audiovideo;if(x){var K=f.audioCodec,V=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(K&&(K.indexOf("mp4a.40.5")!==-1?K="mp4a.40.2":K="mp4a.40.5"),x.metadata.channelCount!==1&&V.indexOf("firefox")===-1&&(K="mp4a.40.5")),V.indexOf("android")!==-1&&x.container!=="audio/mpeg"&&(K="mp4a.40.2",this.log("Android: force audio codec to "+K)),f.audioCodec&&f.audioCodec!==K&&this.log('Swapping manifest audio codec "'+f.audioCodec+'" for "'+K+'"'),x.levelCodec=K,x.id="main",this.log("Init audio buffer, container:"+x.container+", codecs[selected/level/parsed]=["+(K||"")+"/"+(f.audioCodec||"")+"/"+x.codec+"]")}P&&(P.levelCodec=f.videoCodec,P.id="main",this.log("Init video buffer, container:"+P.container+", codecs[level/parsed]=["+(f.videoCodec||"")+"/"+P.codec+"]")),N&&this.log("Init audiovideo buffer, container:"+N.container+", codecs[level/parsed]=["+(f.attrs.CODECS||"")+"/"+N.codec+"]"),this.hls.trigger(F.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(B){var U=d[B],Y=U.initSegment;Y!=null&&Y.byteLength&&p.hls.trigger(F.Events.BUFFER_APPENDING,{type:B,data:Y,frag:a,part:null,chunkMeta:b,parent:a.type})}),this.tick()},v.backtrack=function(f){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(f);var d=this.fragmentTracker.backtrack(f);this.fragPrevious=null,this.nextLoadPosition=f.start,d?this.resetFragmentLoading(f):this.state=M.State.BACKTRACKING},v.checkFragmentChanged=function(){var f=this.media,d=null;if(f&&f.readyState>1&&f.seeking===!1){var a=f.currentTime;if(I.BufferHelper.isBuffered(f,a)?d=this.getAppendedFrag(a):I.BufferHelper.isBuffered(f,a+.1)&&(d=this.getAppendedFrag(a+.1)),d){var b=this.fragPlaying,p=d.level;(!b||d.sn!==b.sn||b.level!==p||d.urlId!==b.urlId)&&(this.hls.trigger(F.Events.FRAG_CHANGED,{frag:d}),(!b||b.level!==p)&&this.hls.trigger(F.Events.LEVEL_SWITCHED,{level:p}),this.fragPlaying=d)}}},o(C,[{key:"nextLevel",get:function(){var f=this.nextBufferedFrag;return f?f.level:-1}},{key:"currentLevel",get:function(){var f=this.media;if(f){var d=this.getAppendedFrag(f.currentTime);if(d)return d.level}return-1}},{key:"nextBufferedFrag",get:function(){var f=this.media;if(f){var d=this.getAppendedFrag(f.currentTime);return this.followingBufferedFrag(d)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),C}(M.default)},"./src/controller/subtitle-stream-controller.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"SubtitleStreamController",function(){return s});var W=D("./src/events.ts"),M=D("./src/utils/logger.ts"),O=D("./src/utils/buffer-helper.ts"),F=D("./src/controller/fragment-finders.ts"),I=D("./src/utils/discontinuities.ts"),R=D("./src/controller/level-helper.ts"),_=D("./src/controller/fragment-tracker.ts"),g=D("./src/controller/base-stream-controller.ts"),T=D("./src/types/loader.ts"),A=D("./src/types/level.ts");function L(l,w){for(var m=0;m<w.length;m++){var h=w[m];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(l,h.key,h)}}function S(l,w,m){return w&&L(l.prototype,w),m&&L(l,m),l}function y(l,w){l.prototype=Object.create(w.prototype),l.prototype.constructor=l,u(l,w)}function u(l,w){return u=Object.setPrototypeOf||function(h,C){return h.__proto__=C,h},u(l,w)}var o=500,s=function(l){y(w,l);function w(h,C){var v;return v=l.call(this,h,C,"[subtitle-stream-controller]")||this,v.levels=[],v.currentTrackId=-1,v.tracksBuffered=[],v.mainDetails=null,v._registerListeners(),v}var m=w.prototype;return m.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},m._registerListeners=function(){var C=this.hls;C.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),C.on(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),C.on(W.Events.ERROR,this.onError,this),C.on(W.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),C.on(W.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),C.on(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),C.on(W.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),C.on(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m._unregisterListeners=function(){var C=this.hls;C.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),C.off(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),C.off(W.Events.ERROR,this.onError,this),C.off(W.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),C.off(W.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),C.off(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),C.off(W.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),C.off(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m.startLoad=function(){this.stopLoad(),this.state=g.State.IDLE,this.setInterval(o),this.tick()},m.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},m.onLevelLoaded=function(C,v){this.mainDetails=v.details},m.onSubtitleFragProcessed=function(C,v){var c=v.frag,f=v.success;if(this.fragPrevious=c,this.state=g.State.IDLE,!f)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var a,b=c.start,p=0;p<d.length;p++)if(b>=d[p].start&&b<=d[p].end){a=d[p];break}var x=c.start+c.duration;a?a.end=x:(a={start:b,end:x},d.push(a)),this.fragmentTracker.fragBuffered(c)},m.onBufferFlushing=function(C,v){var c=v.startOffset,f=v.endOffset;if(c===0&&f!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,a=this.levels;if(!a.length||!a[d]||!a[d].details)return;var b=a[d].details,p=b.targetduration,x=f-p;if(x<=0)return;v.endOffsetSubtitles=Math.max(0,x),this.tracksBuffered.forEach(function(P){for(var N=0;N<P.length;){if(P[N].end<=x){P.shift();continue}else if(P[N].start<x)P[N].start=x;else break;N++}}),this.fragmentTracker.removeFragmentsInRange(c,x,T.PlaylistLevelType.SUBTITLE)}},m.onError=function(C,v){var c,f=v.frag;if(!f||f.type!==T.PlaylistLevelType.SUBTITLE)return;(c=this.fragCurrent)!==null&&c!==void 0&&c.loader&&this.fragCurrent.loader.abort(),this.state=g.State.IDLE},m.onSubtitleTracksUpdated=function(C,v){var c=this,f=v.subtitleTracks;this.tracksBuffered=[],this.levels=f.map(function(d){return new A.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){c.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},m.onSubtitleTrackSwitch=function(C,v){if(this.currentTrackId=v.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var c=this.levels[this.currentTrackId];c!=null&&c.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,c&&this.setInterval(o)},m.onSubtitleTrackLoaded=function(C,v){var c,f=v.details,d=v.id,a=this.currentTrackId,b=this.levels;if(!b.length)return;var p=b[a];if(d>=b.length||d!==a||!p)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,f.live||(c=p.details)!==null&&c!==void 0&&c.live){var x=this.mainDetails;if(f.deltaUpdateFailed||!x)return;var P=x.fragments[0];if(!p.details)f.hasProgramDateTime&&x.hasProgramDateTime?Object(I.alignMediaPlaylistByPDT)(f,x):P&&Object(R.addSliding)(f,P.start);else{var N=this.alignPlaylists(f,p.details);N===0&&P&&Object(R.addSliding)(f,P.start)}}if(p.details=f,this.levelLastLoaded=d,this.tick(),f.live&&!this.fragCurrent&&this.media&&this.state===g.State.IDLE){var K=Object(F.findFragmentByPTS)(null,f.fragments,this.media.currentTime,0);K||(this.warn("Subtitle playlist not aligned with playback"),p.details=void 0)}},m._handleFragmentLoadComplete=function(C){var v=C.frag,c=C.payload,f=v.decryptdata,d=this.hls;if(this.fragContextChanged(v))return;if(c&&c.byteLength>0&&f&&f.key&&f.iv&&f.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(c),f.key.buffer,f.iv.buffer).then(function(b){var p=performance.now();d.trigger(W.Events.FRAG_DECRYPTED,{frag:v,payload:b,stats:{tstart:a,tdecrypt:p}})})}},m.doTick=function(){if(!this.media){this.state=g.State.IDLE;return}if(this.state===g.State.IDLE){var C,v=this.currentTrackId,c=this.levels;if(!c.length||!c[v]||!c[v].details)return;var f=c[v].details,d=f.targetduration,a=this.config,b=this.media,p=O.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,b.currentTime-d,a.maxBufferHole),x=p.end,P=p.len,N=this.getMaxBufferLength()+d;if(P>N)return;console.assert(f,"Subtitle track details are defined on idle subtitle stream controller tick");var K=f.fragments,V=K.length,B=f.edge,U,Y=this.fragPrevious;if(x<B){var ee=a.maxFragLookUpTolerance;Y&&f.hasProgramDateTime&&(U=Object(F.findFragmentByPDT)(K,Y.endProgramDateTime,ee)),U||(U=Object(F.findFragmentByPTS)(Y,K,x,ee),!U&&Y&&Y.start<K[0].start&&(U=K[0]))}else U=K[V-1];(C=U)!==null&&C!==void 0&&C.encrypted?(M.logger.log("Loading key for "+U.sn),this.state=g.State.KEY_LOADING,this.hls.trigger(W.Events.KEY_LOADING,{frag:U})):U&&this.fragmentTracker.getState(U)===_.FragmentState.NOT_LOADED&&this.loadFragment(U,f,x)}},m.loadFragment=function(C,v,c){this.fragCurrent=C,l.prototype.loadFragment.call(this,C,v,c)},S(w,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),w}(g.default)},"./src/controller/subtitle-track-controller.ts":function(Z,G,D){"use strict";D.r(G);var W=D("./src/events.ts"),M=D("./src/utils/texttrack-utils.ts"),O=D("./src/controller/base-playlist-controller.ts"),F=D("./src/types/loader.ts");function I(L,S){for(var y=0;y<S.length;y++){var u=S[y];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(L,u.key,u)}}function R(L,S,y){return S&&I(L.prototype,S),y&&I(L,y),L}function _(L,S){L.prototype=Object.create(S.prototype),L.prototype.constructor=L,g(L,S)}function g(L,S){return g=Object.setPrototypeOf||function(u,o){return u.__proto__=o,u},g(L,S)}var T=function(L){_(S,L);function S(u){var o;return o=L.call(this,u,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var y=S.prototype;return y.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,L.prototype.destroy.call(this)},y.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)},y.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)},y.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)},y.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},y.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=A(this.media.textTracks);o.forEach(function(s){Object(M.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},y.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},y.onManifestParsed=function(o,s){this.tracks=s.subtitleTracks},y.onSubtitleTrackLoaded=function(o,s){var l=s.id,w=s.details,m=this.trackId,h=this.tracksInGroup[m];if(!h){this.warn("Invalid subtitle track id "+l);return}var C=h.details;h.details=s.details,this.log("subtitle track "+l+" loaded ["+w.startSN+"-"+w.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,s,C))},y.onLevelLoading=function(o,s){this.switchLevel(s.level)},y.onLevelSwitching=function(o,s){this.switchLevel(s.level)},y.switchLevel=function(o){var s=this.hls.levels[o];if(!(s!=null&&s.textGroupIds))return;var l=s.textGroupIds[s.urlId];if(this.groupId!==l){var w=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,m=this.tracks.filter(function(v){return!l||v.groupId===l});this.tracksInGroup=m;var h=this.findTrackId(w==null?void 0:w.name)||this.findTrackId();this.groupId=l;var C={subtitleTracks:m};this.log("Updating subtitle tracks, "+m.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(W.Events.SUBTITLE_TRACKS_UPDATED,C),h!==-1&&this.setSubtitleTrack(h,w)}},y.findTrackId=function(o){for(var s=this.tracksInGroup,l=0;l<s.length;l++){var w=s[l];if((!this.selectDefaultTrack||w.default)&&(!o||o===w.name))return w.id}return-1},y.onError=function(o,s){if(L.prototype.onError.call(this,o,s),s.fatal||!s.context)return;s.context.type===F.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},y.loadPlaylist=function(o){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var l=s.id,w=s.groupId,m=s.url;if(o)try{m=o.addDirectives(m)}catch(h){this.warn("Could not construct new URL with HLS Delivery Directives: "+h)}this.log("Loading subtitle playlist for id "+l),this.hls.trigger(W.Events.SUBTITLE_TRACK_LOADING,{url:m,id:l,groupId:w,deliveryDirectives:o||null})}},y.toggleTrackModes=function(o){var s=this,l=this.media,w=this.subtitleDisplay,m=this.trackId;if(!l)return;var h=A(l.textTracks),C=h.filter(function(f){return f.groupId===s.groupId});if(o===-1)[].slice.call(h).forEach(function(f){f.mode="disabled"});else{var v=C[m];v&&(v.mode="disabled")}var c=C[o];c&&(c.mode=w?"showing":"hidden")},y.setSubtitleTrack=function(o,s){var l,w=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(l=w[o])!==null&&l!==void 0&&l.details)||o<-1||o>=w.length)return;this.clearTimer();var m=w[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,m){var h=m.id,C=m.groupId,v=C===void 0?"":C,c=m.name,f=m.type,d=m.url;this.hls.trigger(W.Events.SUBTITLE_TRACK_SWITCH,{id:h,groupId:v,name:c,type:f,url:d});var a=this.switchParams(m.url,s==null?void 0:s.details);this.loadPlaylist(a)}else this.hls.trigger(W.Events.SUBTITLE_TRACK_SWITCH,{id:o})},y.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,s=A(this.media.textTracks),l=0;l<s.length;l++)if(s[l].mode==="hidden")o=l;else if(s[l].mode==="showing"){o=l;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},R(S,[{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)}}]),S}(O.default);function A(L){for(var S=[],y=0;y<L.length;y++){var u=L[y];u.kind==="subtitles"&&u.label&&S.push(L[y])}return S}G.default=T},"./src/controller/timeline-controller.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"TimelineController",function(){return A});var W=D("./src/polyfills/number.ts"),M=D("./src/events.ts"),O=D("./src/utils/cea-608-parser.ts"),F=D("./src/utils/output-filter.ts"),I=D("./src/utils/webvtt-parser.ts"),R=D("./src/utils/texttrack-utils.ts"),_=D("./src/utils/imsc1-ttml-parser.ts"),g=D("./src/types/loader.ts"),T=D("./src/utils/logger.ts"),A=function(){function u(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=y(),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 l=new F.default(this,"textTrack1"),w=new F.default(this,"textTrack2"),m=new F.default(this,"textTrack3"),h=new F.default(this,"textTrack4");this.cea608Parser1=new O.default(1,l,w),this.cea608Parser2=new O.default(3,m,h)}s.on(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(M.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(M.Events.FRAG_LOADING,this.onFragLoading,this),s.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(M.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(M.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(M.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=u.prototype;return o.destroy=function(){var l=this.hls;l.off(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.off(M.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.off(M.Events.FRAG_LOADING,this.onFragLoading,this),l.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(M.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.off(M.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(M.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.off(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(l,w,m,h,C){for(var v=!1,c=C.length;c--;){var f=C[c],d=S(f[0],f[1],w,m);if(d>=0&&(f[0]=Math.min(f[0],w),f[1]=Math.max(f[1],m),v=!0,d/(m-w)>.5))return}if(v||C.push([w,m]),this.config.renderTextTracksNatively){var a=this.captionsTracks[l];this.Cues.newCue(a,w,m,h)}else{var b=this.Cues.newCue(null,w,m,h);this.hls.trigger(M.Events.CUES_PARSED,{type:"captions",cues:b,track:l})}},o.onInitPtsFound=function(l,w){var m=this,h=w.frag,C=w.id,v=w.initPTS,c=w.timescale,f=this.unparsedVttFrags;C==="main"&&(this.initPTS[h.cc]=v,this.timescale[h.cc]=c),f.length&&(this.unparsedVttFrags=[],f.forEach(function(d){m.onFragLoaded(M.Events.FRAG_LOADED,d)}))},o.getExistingTrack=function(l){var w=this.media;if(w)for(var m=0;m<w.textTracks.length;m++){var h=w.textTracks[m];if(h[l])return h}return null},o.createCaptionsTrack=function(l){this.config.renderTextTracksNatively?this.createNativeTrack(l):this.createNonNativeTrack(l)},o.createNativeTrack=function(l){if(this.captionsTracks[l])return;var w=this.captionsProperties,m=this.captionsTracks,h=this.media,C=w[l],v=C.label,c=C.languageCode,f=this.getExistingTrack(l);if(f)m[l]=f,Object(R.clearCurrentCues)(m[l]),Object(R.sendAddTrackEvent)(m[l],h);else{var d=this.createTextTrack("captions",v,c);d&&(d[l]=!0,m[l]=d)}},o.createNonNativeTrack=function(l){if(this.nonNativeCaptionsTracks[l])return;var w=this.captionsProperties[l];if(!w)return;var m=w.label,h={_id:l,label:m,kind:"captions",default:w.media?!!w.media.default:!1,closedCaptions:w.media};this.nonNativeCaptionsTracks[l]=h,this.hls.trigger(M.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[h]})},o.createTextTrack=function(l,w,m){var h=this.media;return h?h.addTextTrack(l,w,m):void 0},o.onMediaAttaching=function(l,w){this.media=w.media,this._cleanTracks()},o.onMediaDetaching=function(){var l=this.captionsTracks;Object.keys(l).forEach(function(w){Object(R.clearCurrentCues)(l[w]),delete l[w]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=y(),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 l=this.media;if(!l)return;var w=l.textTracks;if(w)for(var m=0;m<w.length;m++)Object(R.clearCurrentCues)(w[m])},o.onSubtitleTracksUpdated=function(l,w){var m=this;this.textTracks=[];var h=w.subtitleTracks||[],C=h.some(function(d){return d.textCodec===_.IMSC1_CODEC});if(this.config.enableWebVTT||C&&this.config.enableIMSC1){var v=this.tracks&&h&&this.tracks.length===h.length;if(this.tracks=h||[],this.config.renderTextTracksNatively){var c=this.media?this.media.textTracks:[];this.tracks.forEach(function(d,a){var b;if(a<c.length){for(var p=null,x=0;x<c.length;x++)if(L(c[x],d)){p=c[x];break}p&&(b=p)}b?Object(R.clearCurrentCues)(b):(b=m.createTextTrack("subtitles",d.name,d.lang),b&&(b.mode="disabled")),b&&(b.groupId=d.groupId,m.textTracks.push(b))})}else if(!v&&this.tracks&&this.tracks.length){var f=this.tracks.map(function(d){return{label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}});this.hls.trigger(M.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:f})}}},o.onManifestLoaded=function(l,w){var m=this;this.config.enableCEA708Captions&&w.captions&&w.captions.forEach(function(h){var C=/(?:CC|SERVICE)([1-4])/.exec(h.instreamId);if(!C)return;var v="textTrack"+C[1],c=m.captionsProperties[v];if(!c)return;c.label=h.name,h.lang&&(c.languageCode=h.lang),c.media=h})},o.onFragLoading=function(l,w){var m=this.cea608Parser1,h=this.cea608Parser2,C=this.lastSn,v=this.lastPartIndex;if(!this.enabled||!(m&&h))return;if(w.frag.type===g.PlaylistLevelType.MAIN){var c,f,d=w.frag.sn,a=(c=w==null||((f=w.part)===null||f===void 0)?void 0:f.index)!=null?c:-1;d===C+1||d===C&&a===v+1||(m.reset(),h.reset()),this.lastSn=d,this.lastPartIndex=a}},o.onFragLoaded=function(l,w){var m=w.frag,h=w.payload,C=this.initPTS,v=this.unparsedVttFrags;if(m.type===g.PlaylistLevelType.SUBTITLE)if(h.byteLength){if(!Object(W.isFiniteNumber)(C[m.cc])){v.push(w),C.length&&this.hls.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:m,error:new Error("Missing initial subtitle PTS")});return}var c=m.decryptdata;if(c==null||c.key==null||c.method!=="AES-128"){var f=this.tracks[m.level],d=this.vttCCs;d[m.cc]||(d[m.cc]={start:m.start,prevCC:this.prevCC,new:!0},this.prevCC=m.cc),f&&f.textCodec===_.IMSC1_CODEC?this._parseIMSC1(m,h):this._parseVTTs(m,h,d)}}else this.hls.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:m,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(l,w){var m=this,h=this.hls;Object(_.parseIMSC1)(w,this.initPTS[l.cc],this.timescale[l.cc],function(C){m._appendCues(C,l.level),h.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(C){T.logger.log("Failed to parse IMSC1: "+C),h.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:C})})},o._parseVTTs=function(l,w,m){var h=this,C=this.hls;Object(I.parseWebVTT)(w,this.initPTS[l.cc],this.timescale[l.cc],m,l.cc,l.start,function(v){h._appendCues(v,l.level),C.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(v){h._fallbackToIMSC1(l,w),T.logger.log("Failed to parse VTT cue: "+v),C.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:v})})},o._fallbackToIMSC1=function(l,w){var m=this,h=this.tracks[l.level];h.textCodec||Object(_.parseIMSC1)(w,this.initPTS[l.cc],this.timescale[l.cc],function(){h.textCodec=_.IMSC1_CODEC,m._parseIMSC1(l,w)},function(){h.textCodec="wvtt"})},o._appendCues=function(l,w){var m=this.hls;if(this.config.renderTextTracksNatively){var h=this.textTracks[w];if(h.mode==="disabled")return;l.forEach(function(c){return Object(R.addCueToTrack)(h,c)})}else{var C=this.tracks[w],v=C.default?"default":"subtitles"+w;m.trigger(M.Events.CUES_PARSED,{type:"subtitles",cues:l,track:v})}},o.onFragDecrypted=function(l,w){var m=w.frag;if(m.type===g.PlaylistLevelType.SUBTITLE){if(!Object(W.isFiniteNumber)(this.initPTS[m.cc])){this.unparsedVttFrags.push(w);return}this.onFragLoaded(M.Events.FRAG_LOADED,w)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(l,w){var m=this.cea608Parser1,h=this.cea608Parser2;if(!this.enabled||!(m&&h))return;for(var C=0;C<w.samples.length;C++){var v=w.samples[C].bytes;if(v){var c=this.extractCea608Data(v);m.addData(w.samples[C].pts,c[0]),h.addData(w.samples[C].pts,c[1])}}},o.onBufferFlushing=function(l,w){var m=w.startOffset,h=w.endOffset,C=w.endOffsetSubtitles,v=w.type,c=this.media;if(!c||c.currentTime<h)return;if(!v||v==="video"){var f=this.captionsTracks;Object.keys(f).forEach(function(a){return Object(R.removeCuesInRange)(f[a],m,h)})}if(this.config.renderTextTracksNatively&&(m===0&&C!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(a){return Object(R.removeCuesInRange)(d[a],m,C)})}},o.extractCea608Data=function(l){for(var w=l[0]&31,m=2,h=[[],[]],C=0;C<w;C++){var v=l[m++],c=127&l[m++],f=127&l[m++],d=(4&v)!==0,a=3&v;if(c===0&&f===0)continue;d&&((a===0||a===1)&&(h[a].push(c),h[a].push(f)))}return h},u}();function L(u,o){return u&&u.label===o.name&&!(u.textTrack1||u.textTrack2)}function S(u,o,s,l){return Math.min(o,l)-Math.max(u,s)}function y(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return W});var W=function(){function M(F,I){this.subtle=void 0,this.aesIV=void 0,this.subtle=F,this.aesIV=I}var O=M.prototype;return O.decrypt=function(I,R){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},R,I)},M}()},"./src/crypt/aes-decryptor.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"removePadding",function(){return M}),D.d(G,"default",function(){return O});var W=D("./src/utils/typed-array.ts");function M(F){var I=F.byteLength,R=I&&new DataView(F.buffer).getUint8(I-1);return R?Object(W.sliceUint8)(F,0,I-R):F}var O=function(){function F(){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 I=F.prototype;return I.uint8ArrayToUint32Array_=function(_){for(var g=new DataView(_),T=new Uint32Array(4),A=0;A<4;A++)T[A]=g.getUint32(A*4);return T},I.initTable=function(){var _=this.sBox,g=this.invSBox,T=this.subMix,A=T[0],L=T[1],S=T[2],y=T[3],u=this.invSubMix,o=u[0],s=u[1],l=u[2],w=u[3],m=new Uint32Array(256),h=0,C=0,v=0;for(v=0;v<256;v++)v<128?m[v]=v<<1:m[v]=v<<1^283;for(v=0;v<256;v++){var c=C^C<<1^C<<2^C<<3^C<<4;c=c>>>8^c&255^99,_[h]=c,g[c]=h;var f=m[h],d=m[f],a=m[d],b=m[c]*257^c*16843008;A[h]=b<<24|b>>>8,L[h]=b<<16|b>>>16,S[h]=b<<8|b>>>24,y[h]=b,b=a*16843009^d*65537^f*257^h*16843008,o[c]=b<<24|b>>>8,s[c]=b<<16|b>>>16,l[c]=b<<8|b>>>24,w[c]=b,h?(h=f^m[m[m[a^f]]],C^=m[m[C]]):h=C=1}},I.expandKey=function(_){for(var g=this.uint8ArrayToUint32Array_(_),T=!0,A=0;A<g.length&&T;)T=g[A]===this.key[A],A++;if(T)return;this.key=g;var L=this.keySize=g.length;if(L!==4&&L!==6&&L!==8)throw new Error("Invalid aes key size="+L);var S=this.ksRows=(L+6+1)*4,y,u,o=this.keySchedule=new Uint32Array(S),s=this.invKeySchedule=new Uint32Array(S),l=this.sBox,w=this.rcon,m=this.invSubMix,h=m[0],C=m[1],v=m[2],c=m[3],f,d;for(y=0;y<S;y++){if(y<L){f=o[y]=g[y];continue}d=f,y%L===0?(d=d<<8|d>>>24,d=l[d>>>24]<<24|l[d>>>16&255]<<16|l[d>>>8&255]<<8|l[d&255],d^=w[y/L|0]<<24):L>6&&y%L===4&&(d=l[d>>>24]<<24|l[d>>>16&255]<<16|l[d>>>8&255]<<8|l[d&255]),o[y]=f=(o[y-L]^d)>>>0}for(u=0;u<S;u++)y=S-u,u&3?d=o[y]:d=o[y-4],u<4||y<=4?s[u]=d:s[u]=h[l[d>>>24]]^C[l[d>>>16&255]]^v[l[d>>>8&255]]^c[l[d&255]],s[u]=s[u]>>>0},I.networkToHostOrderSwap=function(_){return _<<24|(_&65280)<<8|(_&16711680)>>8|_>>>24},I.decrypt=function(_,g,T){for(var A=this.keySize+6,L=this.invKeySchedule,S=this.invSBox,y=this.invSubMix,u=y[0],o=y[1],s=y[2],l=y[3],w=this.uint8ArrayToUint32Array_(T),m=w[0],h=w[1],C=w[2],v=w[3],c=new Int32Array(_),f=new Int32Array(c.length),d,a,b,p,x,P,N,K,V,B,U,Y,ee,oe,de=this.networkToHostOrderSwap;g<c.length;){for(V=de(c[g]),B=de(c[g+1]),U=de(c[g+2]),Y=de(c[g+3]),x=V^L[0],P=Y^L[1],N=U^L[2],K=B^L[3],ee=4,oe=1;oe<A;oe++)d=u[x>>>24]^o[P>>16&255]^s[N>>8&255]^l[K&255]^L[ee],a=u[P>>>24]^o[N>>16&255]^s[K>>8&255]^l[x&255]^L[ee+1],b=u[N>>>24]^o[K>>16&255]^s[x>>8&255]^l[P&255]^L[ee+2],p=u[K>>>24]^o[x>>16&255]^s[P>>8&255]^l[N&255]^L[ee+3],x=d,P=a,N=b,K=p,ee=ee+4;d=S[x>>>24]<<24^S[P>>16&255]<<16^S[N>>8&255]<<8^S[K&255]^L[ee],a=S[P>>>24]<<24^S[N>>16&255]<<16^S[K>>8&255]<<8^S[x&255]^L[ee+1],b=S[N>>>24]<<24^S[K>>16&255]<<16^S[x>>8&255]<<8^S[P&255]^L[ee+2],p=S[K>>>24]<<24^S[x>>16&255]<<16^S[P>>8&255]<<8^S[N&255]^L[ee+3],f[g]=de(d^m),f[g+1]=de(p^h),f[g+2]=de(b^C),f[g+3]=de(a^v),m=V,h=B,C=U,v=Y,g=g+4}return f.buffer},F}()},"./src/crypt/decrypter.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return g});var W=D("./src/crypt/aes-crypto.ts"),M=D("./src/crypt/fast-aes-key.ts"),O=D("./src/crypt/aes-decryptor.ts"),F=D("./src/utils/logger.ts"),I=D("./src/utils/mp4-tools.ts"),R=D("./src/utils/typed-array.ts"),_=16,g=function(){function T(L,S,y){var u=y===void 0?{}:y,o=u.removePKCS7Padding,s=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=L,this.config=S,this.removePKCS7Padding=s,s)try{var l=self.crypto;l&&(this.subtle=l.subtle||l.webkitSubtle)}catch(w){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var A=T.prototype;return A.destroy=function(){this.observer=null},A.isSync=function(){return this.config.enableSoftwareAES},A.flush=function(){var S=this.currentResult;if(!S){this.reset();return}var y=new Uint8Array(S);return this.reset(),this.removePKCS7Padding?Object(O.removePadding)(y):y},A.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},A.decrypt=function(S,y,u,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(S),y,u);var s=this.flush();s&&o(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(S),y,u).then(o)},A.softwareDecrypt=function(S,y,u){var o=this.currentIV,s=this.currentResult,l=this.remainderData;this.logOnce("JS AES decrypt"),l&&(S=Object(I.appendUint8Array)(l,S),this.remainderData=null);var w=this.getValidChunk(S);if(!w.length)return null;o&&(u=o);var m=this.softwareDecrypter;m||(m=this.softwareDecrypter=new O.default),m.expandKey(y);var h=s;return this.currentResult=m.decrypt(w.buffer,0,u),this.currentIV=Object(R.sliceUint8)(w,-16).buffer,h||null},A.webCryptoDecrypt=function(S,y,u){var o=this,s=this.subtle;return(this.key!==y||!this.fastAesKey)&&(this.key=y,this.fastAesKey=new M.default(s,y)),this.fastAesKey.expandKey().then(function(l){if(!s)return Promise.reject(new Error("web crypto not initialized"));var w=new W.default(s,u);return w.decrypt(S.buffer,l)}).catch(function(l){return o.onWebCryptoError(l,S,y,u)})},A.onWebCryptoError=function(S,y,u,o){return F.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",S),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(y,u,o)},A.getValidChunk=function(S){var y=S,u=S.length-S.length%_;return u!==S.length&&(y=Object(R.sliceUint8)(S,0,u),this.remainderData=Object(R.sliceUint8)(S,u)),y},A.logOnce=function(S){if(!this.logEnabled)return;F.logger.log("[decrypter.ts]: "+S),this.logEnabled=!1},T}()},"./src/crypt/fast-aes-key.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return W});var W=function(){function M(F,I){this.subtle=void 0,this.key=void 0,this.subtle=F,this.key=I}var O=M.prototype;return O.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},M}()},"./src/demux/aacdemuxer.ts":function(Z,G,D){"use strict";D.r(G);var W=D("./src/demux/base-audio-demuxer.ts"),M=D("./src/demux/adts.ts"),O=D("./src/utils/logger.ts"),F=D("./src/demux/id3.ts");function I(g,T){g.prototype=Object.create(T.prototype),g.prototype.constructor=g,R(g,T)}function R(g,T){return R=Object.setPrototypeOf||function(L,S){return L.__proto__=S,L},R(g,T)}var _=function(g){I(T,g);function T(L,S){var y;return y=g.call(this)||this,y.observer=void 0,y.config=void 0,y.observer=L,y.config=S,y}var A=T.prototype;return A.resetInitSegment=function(S,y,u){g.prototype.resetInitSegment.call(this,S,y,u),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:S,duration:u,inputTimeScale:9e4,dropped:0}},T.probe=function(S){if(!S)return!1;for(var y=F.getID3Data(S,0)||[],u=y.length,o=S.length;u<o;u++)if(M.probe(S,u))return O.logger.log("ADTS sync word found !"),!0;return!1},A.canParse=function(S,y){return M.canParse(S,y)},A.appendFrame=function(S,y,u){M.initTrackConfig(S,this.observer,y,u,S.manifestCodec);var o=M.appendFrame(S,y,u,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},T}(W.default);_.minProbeByteLength=9,G.default=_},"./src/demux/adts.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"getAudioConfig",function(){return F}),D.d(G,"isHeaderPattern",function(){return I}),D.d(G,"getHeaderLength",function(){return R}),D.d(G,"getFullFrameLength",function(){return _}),D.d(G,"canGetFrameLength",function(){return g}),D.d(G,"isHeader",function(){return T}),D.d(G,"canParse",function(){return A}),D.d(G,"probe",function(){return L}),D.d(G,"initTrackConfig",function(){return S}),D.d(G,"getFrameDuration",function(){return y}),D.d(G,"parseFrameHeader",function(){return u}),D.d(G,"appendFrame",function(){return o});var W=D("./src/utils/logger.ts"),M=D("./src/errors.ts"),O=D("./src/events.ts");function F(s,l,w,m){var h,C,v,c,f=navigator.userAgent.toLowerCase(),d=m,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];h=((l[w+2]&192)>>>6)+1;var b=(l[w+2]&60)>>>2;if(b>a.length-1){s.trigger(O.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+b});return}return v=(l[w+2]&1)<<2,v|=(l[w+3]&192)>>>6,W.logger.log("manifest codec:"+m+", ADTS type:"+h+", samplingIndex:"+b),/firefox/i.test(f)?b>=6?(h=5,c=new Array(4),C=b-3):(h=2,c=new Array(2),C=b):f.indexOf("android")!==-1?(h=2,c=new Array(2),C=b):(h=5,c=new Array(4),m&&(m.indexOf("mp4a.40.29")!==-1||m.indexOf("mp4a.40.5")!==-1)||!m&&b>=6?C=b-3:((m&&m.indexOf("mp4a.40.2")!==-1&&(b>=6&&v===1||/vivaldi/i.test(f))||!m&&v===1)&&(h=2,c=new Array(2)),C=b)),c[0]=h<<3,c[0]|=(b&14)>>1,c[1]|=(b&1)<<7,c[1]|=v<<3,h===5&&(c[1]|=(C&14)>>1,c[2]=(C&1)<<7,c[2]|=2<<2,c[3]=0),{config:c,samplerate:a[b],channelCount:v,codec:"mp4a.40."+h,manifestCodec:d}}function I(s,l){return s[l]===255&&(s[l+1]&246)===240}function R(s,l){return s[l+1]&1?7:9}function _(s,l){return(s[l+3]&3)<<11|s[l+4]<<3|(s[l+5]&224)>>>5}function g(s,l){return l+5<s.length}function T(s,l){return l+1<s.length&&I(s,l)}function A(s,l){return g(s,l)&&I(s,l)&&_(s,l)<=s.length-l}function L(s,l){if(T(s,l)){var w=R(s,l);if(l+w>=s.length)return!1;var m=_(s,l);if(m<=w)return!1;var h=l+m;return h===s.length||T(s,h)}return!1}function S(s,l,w,m,h){if(!s.samplerate){var C=F(l,w,m,h);if(!C)return;s.config=C.config,s.samplerate=C.samplerate,s.channelCount=C.channelCount,s.codec=C.codec,s.manifestCodec=C.manifestCodec,W.logger.log("parsed codec:"+s.codec+", rate:"+C.samplerate+", channels:"+C.channelCount)}}function y(s){return 1024*9e4/s}function u(s,l,w,m,h){var C=R(s,l),v=_(s,l);if(v-=C,v>0){var c=w+m*h;return{headerLength:C,frameLength:v,stamp:c}}}function o(s,l,w,m,h){var C=y(s.samplerate),v=u(l,w,m,h,C);if(v){var c=v.frameLength,f=v.headerLength,d=v.stamp,a=f+c,b=Math.max(0,w+a-l.length),p;b?(p=new Uint8Array(a-f),p.set(l.subarray(w+f,l.length),0)):p=l.subarray(w+f,w+a);var x={unit:p,pts:d};return b||s.samples.push(x),{sample:x,length:a,missing:b}}}},"./src/demux/base-audio-demuxer.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"initPTSFn",function(){return _});var W=D("./src/polyfills/number.ts"),M=D("./src/demux/id3.ts"),O=D("./src/demux/dummy-demuxed-track.ts"),F=D("./src/utils/mp4-tools.ts"),I=D("./src/utils/typed-array.ts"),R=function(){function g(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var T=g.prototype;return T.resetInitSegment=function(L,S,y){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},T.resetTimeStamp=function(){},T.resetContiguity=function(){},T.canParse=function(L,S){return!1},T.appendFrame=function(L,S,y){},T.demux=function(L,S){this.cachedData&&(L=Object(F.appendUint8Array)(this.cachedData,L),this.cachedData=null);var y=M.getID3Data(L,0),u=y?y.length:0,o,s,l=this._audioTrack,w=this._id3Track,m=y?M.getTimeStamp(y):void 0,h=L.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=_(m,S)),y&&y.length>0&&w.samples.push({pts:this.initPTS,dts:this.initPTS,data:y}),s=this.initPTS;u<h;){if(this.canParse(L,u)){var C=this.appendFrame(l,L,u);C?(this.frameIndex++,s=C.sample.pts,u+=C.length,o=u):u=h}else M.canParse(L,u)?(y=M.getID3Data(L,u),w.samples.push({pts:s,dts:s,data:y}),u+=y.length,o=u):u++;if(u===h&&o!==h){var v=Object(I.sliceUint8)(L,o);this.cachedData?this.cachedData=Object(F.appendUint8Array)(this.cachedData,v):this.cachedData=v}}return{audioTrack:l,avcTrack:Object(O.dummyTrack)(),id3Track:w,textTrack:Object(O.dummyTrack)()}},T.demuxSampleAes=function(L,S,y){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},T.flush=function(L){var S=this.cachedData;return S&&(this.cachedData=null,this.demux(S,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(O.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(O.dummyTrack)()}},T.destroy=function(){},g}(),_=function(T,A){return Object(W.isFiniteNumber)(T)?T*90:A*9e4};G.default=R},"./src/demux/chunk-cache.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return W});var W=function(){function O(){this.chunks=[],this.dataLength=0}var F=O.prototype;return F.push=function(R){this.chunks.push(R),this.dataLength+=R.length},F.flush=function(){var R=this.chunks,_=this.dataLength,g;if(R.length)R.length===1?g=R[0]:g=M(R,_);else return new Uint8Array(0);return this.reset(),g},F.reset=function(){this.chunks.length=0,this.dataLength=0},O}();function M(O,F){for(var I=new Uint8Array(F),R=0,_=0;_<O.length;_++){var g=O[_];I.set(g,R),R+=g.length}return I}},"./src/demux/dummy-demuxed-track.ts":function(Z,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(Z,G,D){"use strict";D.r(G);var W=D("./src/utils/logger.ts"),M=function(){function O(I){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=I,this.bytesAvailable=I.byteLength,this.word=0,this.bitsAvailable=0}var F=O.prototype;return F.loadWord=function(){var R=this.data,_=this.bytesAvailable,g=R.byteLength-_,T=new Uint8Array(4),A=Math.min(4,_);if(A===0)throw new Error("no bytes available");T.set(R.subarray(g,g+A)),this.word=new DataView(T.buffer).getUint32(0),this.bitsAvailable=A*8,this.bytesAvailable-=A},F.skipBits=function(R){var _;this.bitsAvailable>R?(this.word<<=R,this.bitsAvailable-=R):(R-=this.bitsAvailable,_=R>>3,R-=_>>3,this.bytesAvailable-=_,this.loadWord(),this.word<<=R,this.bitsAvailable-=R)},F.readBits=function(R){var _=Math.min(this.bitsAvailable,R),g=this.word>>>32-_;return R>32&&W.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=_,this.bitsAvailable>0?this.word<<=_:this.bytesAvailable>0&&this.loadWord(),_=R-_,_>0&&this.bitsAvailable?g<<_|this.readBits(_):g},F.skipLZ=function(){var R;for(R=0;R<this.bitsAvailable;++R)if((this.word&2147483648>>>R)!==0)return this.word<<=R,this.bitsAvailable-=R,R;return this.loadWord(),R+this.skipLZ()},F.skipUEG=function(){this.skipBits(1+this.skipLZ())},F.skipEG=function(){this.skipBits(1+this.skipLZ())},F.readUEG=function(){var R=this.skipLZ();return this.readBits(R+1)-1},F.readEG=function(){var R=this.readUEG();return 1&R?1+R>>>1:-1*(R>>>1)},F.readBoolean=function(){return this.readBits(1)===1},F.readUByte=function(){return this.readBits(8)},F.readUShort=function(){return this.readBits(16)},F.readUInt=function(){return this.readBits(32)},F.skipScalingList=function(R){for(var _=8,g=8,T,A=0;A<R;A++)g!==0&&(T=this.readEG(),g=(_+T+256)%256),_=g===0?_:g},F.readSPS=function(){var R=0,_=0,g=0,T=0,A,L,S,y=this.readUByte.bind(this),u=this.readBits.bind(this),o=this.readUEG.bind(this),s=this.readBoolean.bind(this),l=this.skipBits.bind(this),w=this.skipEG.bind(this),m=this.skipUEG.bind(this),h=this.skipScalingList.bind(this);y();var C=y();if(u(5),l(3),y(),m(),C===100||C===110||C===122||C===244||C===44||C===83||C===86||C===118||C===128){var v=o();if(v===3&&l(1),m(),m(),l(1),s())for(L=v!==3?8:12,S=0;S<L;S++)s()&&(S<6?h(16):h(64))}m();var c=o();if(c===0)o();else if(c===1)for(l(1),w(),w(),A=o(),S=0;S<A;S++)w();m(),l(1);var f=o(),d=o(),a=u(1);a===0&&l(1),l(1),s()&&(R=o(),_=o(),g=o(),T=o());var b=[1,1];if(s()&&s()){var p=y();switch(p){case 1:b=[1,1];break;case 2:b=[12,11];break;case 3:b=[10,11];break;case 4:b=[16,11];break;case 5:b=[40,33];break;case 6:b=[24,11];break;case 7:b=[20,11];break;case 8:b=[32,11];break;case 9:b=[80,33];break;case 10:b=[18,11];break;case 11:b=[15,11];break;case 12:b=[64,33];break;case 13:b=[160,99];break;case 14:b=[4,3];break;case 15:b=[3,2];break;case 16:b=[2,1];break;case 255:{b=[y()<<8|y(),y()<<8|y()];break}}}return{width:Math.ceil((f+1)*16-R*2-_*2),height:(2-a)*(d+1)*16-(a?2:4)*(g+T),pixelRatio:b}},F.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},O}();G.default=M},"./src/demux/id3.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"isHeader",function(){return W}),D.d(G,"isFooter",function(){return M}),D.d(G,"getID3Data",function(){return O}),D.d(G,"canParse",function(){return I}),D.d(G,"getTimeStamp",function(){return R}),D.d(G,"isTimeStampFrame",function(){return _}),D.d(G,"getID3Frames",function(){return T}),D.d(G,"decodeFrame",function(){return A}),D.d(G,"utf8ArrayToStr",function(){return o}),D.d(G,"testables",function(){return s});var W=function(h,C){return C+10<=h.length&&(h[C]===73&&h[C+1]===68&&h[C+2]===51&&(h[C+3]<255&&h[C+4]<255&&(h[C+6]<128&&h[C+7]<128&&h[C+8]<128&&h[C+9]<128)))},M=function(h,C){return C+10<=h.length&&(h[C]===51&&h[C+1]===68&&h[C+2]===73&&(h[C+3]<255&&h[C+4]<255&&(h[C+6]<128&&h[C+7]<128&&h[C+8]<128&&h[C+9]<128)))},O=function(h,C){for(var v=C,c=0;W(h,C);){c+=10;var f=F(h,C+6);c+=f,M(h,C+10)&&(c+=10),C+=c}return c>0?h.subarray(v,v+c):void 0},F=function(h,C){var v=0;return v=(h[C]&127)<<21,v|=(h[C+1]&127)<<14,v|=(h[C+2]&127)<<7,v|=h[C+3]&127,v},I=function(h,C){return W(h,C)&&F(h,C+6)+10<=h.length-C},R=function(h){for(var C=T(h),v=0;v<C.length;v++){var c=C[v];if(_(c))return u(c)}return},_=function(h){return h&&h.key==="PRIV"&&h.info==="com.apple.streaming.transportStreamTimestamp"},g=function(h){var C=String.fromCharCode(h[0],h[1],h[2],h[3]),v=F(h,4),c=10;return{type:C,size:v,data:h.subarray(c,c+v)}},T=function(h){for(var C=0,v=[];W(h,C);){var c=F(h,C+6);C+=10;for(var f=C+c;C+8<f;){var d=g(h.subarray(C)),a=A(d);a&&v.push(a),C+=d.size+10}M(h,C)&&(C+=10)}return v},A=function(h){return h.type==="PRIV"?L(h):h.type[0]==="W"?y(h):S(h)},L=function(h){if(h.size<2)return;var C=o(h.data,!0),v=new Uint8Array(h.data.subarray(C.length+1));return{key:h.type,info:C,data:v.buffer}},S=function(h){if(h.size<2)return;if(h.type==="TXXX"){var C=1,v=o(h.data.subarray(C),!0);C+=v.length+1;var c=o(h.data.subarray(C));return{key:h.type,info:v,data:c}}var f=o(h.data.subarray(1));return{key:h.type,data:f}},y=function(h){if(h.type==="WXXX"){if(h.size<2)return;var C=1,v=o(h.data.subarray(C),!0);C+=v.length+1;var c=o(h.data.subarray(C));return{key:h.type,info:v,data:c}}var f=o(h.data);return{key:h.type,data:f}},u=function(h){if(h.data.byteLength===8){var C=new Uint8Array(h.data),v=C[3]&1,c=(C[4]<<23)+(C[5]<<15)+(C[6]<<7)+C[7];return c/=45,v&&(c+=4772185884e-2),Math.round(c)}return},o=function(h,C){C===void 0&&(C=!1);var v=w();if(v){var c=v.decode(h);if(C){var f=c.indexOf("\0");return f!==-1?c.substring(0,f):c}return c.replace(/\0/g,"")}for(var d=h.length,a,b,p,x="",P=0;P<d;){if(a=h[P++],a===0&&C)return x;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:x+=String.fromCharCode(a);break;case 12:case 13:b=h[P++],x+=String.fromCharCode((a&31)<<6|b&63);break;case 14:b=h[P++],p=h[P++],x+=String.fromCharCode((a&15)<<12|(b&63)<<6|(p&63)<<0);break;default:}}return x},s={decodeTextFrame:S},l;function w(){return!l&&typeof self.TextDecoder!="undefined"&&(l=new self.TextDecoder("utf-8")),l}},"./src/demux/mp3demuxer.ts":function(Z,G,D){"use strict";D.r(G);var W=D("./src/demux/base-audio-demuxer.ts"),M=D("./src/demux/id3.ts"),O=D("./src/utils/logger.ts"),F=D("./src/demux/mpegaudio.ts");function I(g,T){g.prototype=Object.create(T.prototype),g.prototype.constructor=g,R(g,T)}function R(g,T){return R=Object.setPrototypeOf||function(L,S){return L.__proto__=S,L},R(g,T)}var _=function(g){I(T,g);function T(){return g.apply(this,arguments)||this}var A=T.prototype;return A.resetInitSegment=function(S,y,u){g.prototype.resetInitSegment.call(this,S,y,u),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:S,duration:u,inputTimeScale:9e4,dropped:0}},T.probe=function(S){if(!S)return!1;for(var y=M.getID3Data(S,0)||[],u=y.length,o=S.length;u<o;u++)if(F.probe(S,u))return O.logger.log("MPEG Audio sync word found !"),!0;return!1},A.canParse=function(S,y){return F.canParse(S,y)},A.appendFrame=function(S,y,u){return this.initPTS===null?void 0:F.appendFrame(S,y,u,this.initPTS,this.frameIndex)},T}(W.default);_.minProbeByteLength=4,G.default=_},"./src/demux/mp4demuxer.ts":function(Z,G,D){"use strict";D.r(G);var W=D("./src/utils/mp4-tools.ts"),M=D("./src/demux/dummy-demuxed-track.ts"),O=function(){function F(R,_){this.remainderData=null,this.config=void 0,this.config=_}var I=F.prototype;return I.resetTimeStamp=function(){},I.resetInitSegment=function(){},I.resetContiguity=function(){},F.probe=function(_){return Object(W.findBox)({data:_,start:0,end:Math.min(_.length,16384)},["moof"]).length>0},I.demux=function(_){var g=_,T=Object(M.dummyTrack)();if(this.config.progressive){this.remainderData&&(g=Object(W.appendUint8Array)(this.remainderData,_));var A=Object(W.segmentValidRange)(g);this.remainderData=A.remainder,T.samples=A.valid||new Uint8Array}else T.samples=g;return{audioTrack:Object(M.dummyTrack)(),avcTrack:T,id3Track:Object(M.dummyTrack)(),textTrack:Object(M.dummyTrack)()}},I.flush=function(){var _=Object(M.dummyTrack)();return _.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(M.dummyTrack)(),avcTrack:_,id3Track:Object(M.dummyTrack)(),textTrack:Object(M.dummyTrack)()}},I.demuxSampleAes=function(_,g,T){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},I.destroy=function(){},F}();O.minProbeByteLength=1024,G.default=O},"./src/demux/mpegaudio.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"appendFrame",function(){return R}),D.d(G,"parseHeader",function(){return _}),D.d(G,"isHeaderPattern",function(){return g}),D.d(G,"isHeader",function(){return T}),D.d(G,"canParse",function(){return A}),D.d(G,"probe",function(){return L});var W=null,M=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],O=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],F=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],I=[0,1,1,4];function R(S,y,u,o,s){if(u+24>y.length)return;var l=_(y,u);if(l&&u+l.frameLength<=y.length){var w=l.samplesPerFrame*9e4/l.sampleRate,m=o+s*w,h={unit:y.subarray(u,u+l.frameLength),pts:m,dts:m};return S.config=[],S.channelCount=l.channelCount,S.samplerate=l.sampleRate,S.samples.push(h),{sample:h,length:l.frameLength,missing:0}}}function _(S,y){var u=S[y+1]>>3&3,o=S[y+1]>>1&3,s=S[y+2]>>4&15,l=S[y+2]>>2&3;if(u!==1&&s!==0&&s!==15&&l!==3){var w=S[y+2]>>1&1,m=S[y+3]>>6,h=u===3?3-o:o===3?3:4,C=M[h*14+s-1]*1e3,v=u===3?0:u===2?1:2,c=O[v*3+l],f=m===3?1:2,d=F[u][o],a=I[o],b=d*8*a,p=Math.floor(d*C/c+w)*a;if(W===null){var x=navigator.userAgent||"",P=x.match(/Chrome\/(\d+)/i);W=P?parseInt(P[1]):0}var N=!!W&&W<=87;return N&&o===2&&C>=224e3&&m===0&&(S[y+3]=S[y+3]|128),{sampleRate:c,channelCount:f,frameLength:p,samplesPerFrame:b}}}function g(S,y){return S[y]===255&&(S[y+1]&224)===224&&(S[y+1]&6)!==0}function T(S,y){return y+1<S.length&&g(S,y)}function A(S,y){var u=4;return g(S,y)&&u<=S.length-y}function L(S,y){if(y+1<S.length&&g(S,y)){var u=4,o=_(S,y),s=u;o!=null&&o.frameLength&&(s=o.frameLength);var l=y+s;return l===S.length||T(S,l)}return!1}},"./src/demux/sample-aes.ts":function(Z,G,D){"use strict";D.r(G);var W=D("./src/crypt/decrypter.ts"),M=D("./src/demux/tsdemuxer.ts"),O=function(){function F(R,_,g){this.keyData=void 0,this.decrypter=void 0,this.keyData=g,this.decrypter=new W.default(R,_,{removePKCS7Padding:!1})}var I=F.prototype;return I.decryptBuffer=function(_,g){this.decrypter.decrypt(_,this.keyData.key.buffer,this.keyData.iv.buffer,g)},I.decryptAacSample=function(_,g,T,A){var L=_[g].unit,S=L.subarray(16,L.length-L.length%16),y=S.buffer.slice(S.byteOffset,S.byteOffset+S.length),u=this;this.decryptBuffer(y,function(o){var s=new Uint8Array(o);L.set(s,16),A||u.decryptAacSamples(_,g+1,T)})},I.decryptAacSamples=function(_,g,T){for(;;g++){if(g>=_.length){T();return}if(_[g].unit.length<32)continue;var A=this.decrypter.isSync();if(this.decryptAacSample(_,g,T,A),!A)return}},I.getAvcEncryptedData=function(_){for(var g=Math.floor((_.length-48)/160)*16+16,T=new Int8Array(g),A=0,L=32;L<=_.length-16;L+=160,A+=16)T.set(_.subarray(L,L+16),A);return T},I.getAvcDecryptedUnit=function(_,g){for(var T=new Uint8Array(g),A=0,L=32;L<=_.length-16;L+=160,A+=16)_.set(T.subarray(A,A+16),L);return _},I.decryptAvcSample=function(_,g,T,A,L,S){var y=Object(M.discardEPB)(L.data),u=this.getAvcEncryptedData(y),o=this;this.decryptBuffer(u.buffer,function(s){L.data=o.getAvcDecryptedUnit(y,s),S||o.decryptAvcSamples(_,g,T+1,A)})},I.decryptAvcSamples=function(_,g,T,A){if(_ instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;g++,T=0){if(g>=_.length){A();return}for(var L=_[g].units;!(T>=L.length);T++){var S=L[T];if(S.data.length<=48||S.type!==1&&S.type!==5)continue;var y=this.decrypter.isSync();if(this.decryptAvcSample(_,g,T,A,S,y),!y)return}}},F}();G.default=O},"./src/demux/transmuxer-interface.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return L});var W=D("./node_modules/webworkify-webpack/index.js"),M=D.n(W),O=D("./src/events.ts"),F=D("./src/demux/transmuxer.ts"),I=D("./src/utils/logger.ts"),R=D("./src/errors.ts"),_=D("./src/utils/mediasource-helper.ts"),g=D("./node_modules/eventemitter3/index.js"),T=D.n(g),A=Object(_.getMediaSource)()||{isTypeSupported:function(){return!1}},L=function(){function S(u,o,s,l){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=u,this.id=o,this.onTransmuxComplete=s,this.onFlush=l;var m=u.config,h=function(d,a){a=a||{},a.frag=w.frag,a.id=w.id,u.trigger(d,a)};this.observer=new g.EventEmitter,this.observer.on(O.Events.FRAG_DECRYPTED,h),this.observer.on(O.Events.ERROR,h);var C={mp4:A.isTypeSupported("video/mp4"),mpeg:A.isTypeSupported("audio/mpeg"),mp3:A.isTypeSupported('audio/mp4; codecs="mp3"')},v=navigator.vendor;if(m.enableWorker&&typeof Worker!="undefined"){I.logger.log("demuxing in webworker");var c;try{c=this.worker=W("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),c.addEventListener("message",this.onwmsg),c.onerror=function(f){u.trigger(O.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(f.message+" ("+f.filename+":"+f.lineno+")")})},c.postMessage({cmd:"init",typeSupported:C,vendor:v,id:o,config:JSON.stringify(m)})}catch(f){I.logger.warn("Error in worker:",f),I.logger.error("Error while initializing DemuxerWorker, fallback to inline"),c&&self.URL.revokeObjectURL(c.objectURL),this.transmuxer=new F.default(this.observer,C,m,v,o),this.worker=null}}else this.transmuxer=new F.default(this.observer,C,m,v,o)}var y=S.prototype;return y.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 l=this.observer;l&&l.removeAllListeners(),this.observer=null},y.push=function(o,s,l,w,m,h,C,v,c,f){var d=this;c.transmuxing.start=self.performance.now();var a=this.transmuxer,b=this.worker,p=h?h.start:m.start,x=m.decryptdata,P=this.frag,N=!(P&&m.cc===P.cc),K=!(P&&c.level===P.level),V=P?c.sn-P.sn:-1,B=this.part?c.part-this.part.index:1,U=!K&&(V===1||V===0&&B===1),Y=self.performance.now();(K||V||m.stats.parsing.start===0)&&(m.stats.parsing.start=Y),h&&(B||!U)&&(h.stats.parsing.start=Y);var ee=new F.TransmuxState(N,U,v,K,p);if(!U||N){I.logger.log("[transmuxer-interface, "+m.type+"]: Starting new transmux session for sn: "+c.sn+" p: "+c.part+" level: "+c.level+" id: "+c.id+`
|
|
discontinuity: `+N+`
|
|
trackSwitch: `+K+`
|
|
contiguous: `+U+`
|
|
accurateTimeOffset: `+v+`
|
|
timeOffset: `+p);var oe=new F.TransmuxConfig(l,w,s,C,f);this.configureTransmuxer(oe)}if(this.frag=m,this.part=h,b)b.postMessage({cmd:"demux",data:o,decryptdata:x,chunkMeta:c,state:ee},o instanceof ArrayBuffer?[o]:[]);else if(a){var de=a.push(o,x,c,ee);Object(F.isPromise)(de)?de.then(function(Te){d.handleTransmuxComplete(Te)}):this.handleTransmuxComplete(de)}},y.flush=function(o){var s=this;o.transmuxing.start=self.performance.now();var l=this.transmuxer,w=this.worker;if(w)w.postMessage({cmd:"flush",chunkMeta:o});else if(l){var m=l.flush(o);Object(F.isPromise)(m)?m.then(function(h){s.handleFlushResult(h,o)}):this.handleFlushResult(m,o)}},y.handleFlushResult=function(o,s){var l=this;o.forEach(function(w){l.handleTransmuxComplete(w)}),this.onFlush(s)},y.onWorkerMessage=function(o){var s=o.data,l=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,l.trigger(s.event,s.data);break}}},y.configureTransmuxer=function(o){var s=this.worker,l=this.transmuxer;s?s.postMessage({cmd:"configure",config:o}):l&&l.configure(o)},y.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},S}()},"./src/demux/transmuxer-worker.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return R});var W=D("./src/demux/transmuxer.ts"),M=D("./src/events.ts"),O=D("./src/utils/logger.ts"),F=D("./node_modules/eventemitter3/index.js"),I=D.n(F);function R(L){var S=new F.EventEmitter,y=function(o,s){L.postMessage({event:o,data:s})};S.on(M.Events.FRAG_DECRYPTED,y),S.on(M.Events.ERROR,y),L.addEventListener("message",function(u){var o=u.data;switch(o.cmd){case"init":{var s=JSON.parse(o.config);L.transmuxer=new W.default(S,o.typeSupported,s,o.vendor,o.id),Object(O.enableLogs)(s.debug),y("init",null);break}case"configure":{L.transmuxer.configure(o.config);break}case"demux":{var l=L.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(W.isPromise)(l)?l.then(function(h){_(L,h)}):_(L,l);break}case"flush":{var w=o.chunkMeta,m=L.transmuxer.flush(w);Object(W.isPromise)(m)?m.then(function(h){T(L,h,w)}):T(L,m,w);break}default:break}})}function _(L,S){if(A(S.remuxResult))return;var y=[],u=S.remuxResult,o=u.audio,s=u.video;o&&g(y,o),s&&g(y,s),L.postMessage({event:"transmuxComplete",data:S},y)}function g(L,S){S.data1&&L.push(S.data1.buffer),S.data2&&L.push(S.data2.buffer)}function T(L,S,y){S.forEach(function(u){_(L,u)}),L.postMessage({event:"flush",data:y})}function A(L){return!L.audio&&!L.video&&!L.text&&!L.id3&&!L.initSegment}},"./src/demux/transmuxer.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return s}),D.d(G,"isPromise",function(){return m}),D.d(G,"TransmuxConfig",function(){return h}),D.d(G,"TransmuxState",function(){return C});var W=D("./src/events.ts"),M=D("./src/errors.ts"),O=D("./src/crypt/decrypter.ts"),F=D("./src/demux/aacdemuxer.ts"),I=D("./src/demux/mp4demuxer.ts"),R=D("./src/demux/tsdemuxer.ts"),_=D("./src/demux/mp3demuxer.ts"),g=D("./src/remux/mp4-remuxer.ts"),T=D("./src/remux/passthrough-remuxer.ts"),A=D("./src/demux/chunk-cache.ts"),L=D("./src/utils/mp4-tools.ts"),S=D("./src/utils/logger.ts"),y;try{y=self.performance.now.bind(self.performance)}catch(v){S.logger.debug("Unable to use Performance API on this environment"),y=self.Date.now}var u=[{demux:R.default,remux:g.default},{demux:I.default,remux:T.default},{demux:F.default,remux:g.default},{demux:_.default,remux:g.default}],o=1024;u.forEach(function(v){var c=v.demux;o=Math.max(o,c.minProbeByteLength)});var s=function(){function v(f,d,a,b,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 A.default,this.observer=f,this.typeSupported=d,this.config=a,this.vendor=b,this.id=p}var c=v.prototype;return c.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},c.push=function(d,a,b,p){var x=this,P=b.transmuxing;P.executeStart=y();var N=new Uint8Array(d),K=this.cache,V=this.config,B=this.currentTransmuxState,U=this.transmuxConfig;p&&(this.currentTransmuxState=p);var Y=l(N,a);if(Y&&Y.method==="AES-128"){var ee=this.getDecrypter();if(V.enableSoftwareAES){var oe=ee.softwareDecrypt(N,Y.key.buffer,Y.iv.buffer);if(!oe)return P.executeEnd=y(),w(b);N=new Uint8Array(oe)}else return this.decryptionPromise=ee.webCryptoDecrypt(N,Y.key.buffer,Y.iv.buffer).then(function(Ce){var Re=x.push(Ce,null,b);return x.decryptionPromise=null,Re}),this.decryptionPromise}var de=p||B,Te=de.contiguous,ge=de.discontinuity,pe=de.trackSwitch,fe=de.accurateTimeOffset,me=de.timeOffset,ae=U.audioCodec,ue=U.videoCodec,Ee=U.defaultInitPts,Ie=U.duration,ke=U.initSegmentData;if((ge||pe)&&this.resetInitSegment(ke,ae,ue,Ie),ge&&this.resetInitialTimestamp(Ee),Te||this.resetContiguity(),this.needsProbing(N,ge,pe)){if(K.dataLength){var Xe=K.flush();N=Object(L.appendUint8Array)(Xe,N)}this.configureTransmuxer(N,U)}var Ne=this.transmux(N,Y,me,fe,b),we=this.currentTransmuxState;return we.contiguous=!0,we.discontinuity=!1,we.trackSwitch=!1,P.executeEnd=y(),Ne},c.flush=function(d){var a=this,b=d.transmuxing;b.executeStart=y();var p=this.decrypter,x=this.cache,P=this.currentTransmuxState,N=this.decryptionPromise;if(N)return N.then(function(){return a.flush(d)});var K=[],V=P.timeOffset;if(p){var B=p.flush();B&&K.push(this.push(B,null,d))}var U=x.dataLength;x.reset();var Y=this.demuxer,ee=this.remuxer;if(!Y||!ee)return U>=o&&this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),b.executeEnd=y(),[w(d)];var oe=Y.flush(V);return m(oe)?oe.then(function(de){return a.flushRemux(K,de,d),K}):(this.flushRemux(K,oe,d),K)},c.flushRemux=function(d,a,b){var p=a.audioTrack,x=a.avcTrack,P=a.id3Track,N=a.textTrack,K=this.currentTransmuxState,V=K.accurateTimeOffset,B=K.timeOffset;S.logger.log("[transmuxer.ts]: Flushed fragment "+b.sn+(b.part>-1?" p: "+b.part:"")+" of level "+b.level);var U=this.remuxer.remux(p,x,P,N,B,V,!0,this.id);d.push({remuxResult:U,chunkMeta:b}),b.transmuxing.executeEnd=y()},c.resetInitialTimestamp=function(d){var a=this.demuxer,b=this.remuxer;if(!a||!b)return;a.resetTimeStamp(d),b.resetTimeStamp(d)},c.resetContiguity=function(){var d=this.demuxer,a=this.remuxer;if(!d||!a)return;d.resetContiguity(),a.resetNextTimestamp()},c.resetInitSegment=function(d,a,b,p){var x=this.demuxer,P=this.remuxer;if(!x||!P)return;x.resetInitSegment(a,b,p),P.resetInitSegment(d,a,b)},c.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},c.transmux=function(d,a,b,p,x){var P;return a&&a.method==="SAMPLE-AES"?P=this.transmuxSampleAes(d,a,b,p,x):P=this.transmuxUnencrypted(d,b,p,x),P},c.transmuxUnencrypted=function(d,a,b,p){var x=this.demuxer.demux(d,a,!1,!this.config.progressive),P=x.audioTrack,N=x.avcTrack,K=x.id3Track,V=x.textTrack,B=this.remuxer.remux(P,N,K,V,a,b,!1,this.id);return{remuxResult:B,chunkMeta:p}},c.transmuxSampleAes=function(d,a,b,p,x){var P=this;return this.demuxer.demuxSampleAes(d,a,b).then(function(N){var K=P.remuxer.remux(N.audioTrack,N.avcTrack,N.id3Track,N.textTrack,b,p,!1,P.id);return{remuxResult:K,chunkMeta:x}})},c.configureTransmuxer=function(d,a){for(var b=this.config,p=this.observer,x=this.typeSupported,P=this.vendor,N=a.audioCodec,K=a.defaultInitPts,V=a.duration,B=a.initSegmentData,U=a.videoCodec,Y,ee=0,oe=u.length;ee<oe;ee++)if(u[ee].demux.probe(d)){Y=u[ee];break}Y||(S.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),Y={demux:I.default,remux:T.default});var de=this.demuxer,Te=this.remuxer,ge=Y.remux,pe=Y.demux;(!Te||!(Te instanceof ge))&&(this.remuxer=new ge(p,b,x,P)),(!de||!(de instanceof pe))&&(this.demuxer=new pe(p,b,x),this.probe=pe.probe),this.resetInitSegment(B,N,U,V),this.resetInitialTimestamp(K)},c.needsProbing=function(d,a,b){return!this.demuxer||!this.remuxer||a||b},c.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new O.default(this.observer,this.config)),d},v}();function l(v,c){var f=null;return v.byteLength>0&&c!=null&&c.key!=null&&c.iv!==null&&c.method!=null&&(f=c),f}var w=function(c){return{remuxResult:{},chunkMeta:c}};function m(v){return"then"in v&&v.then instanceof Function}var h=function(c,f,d,a,b){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=c,this.videoCodec=f,this.initSegmentData=d,this.duration=a,this.defaultInitPts=b},C=function(c,f,d,a,b){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=c,this.contiguous=f,this.accurateTimeOffset=d,this.trackSwitch=a,this.timeOffset=b}},"./src/demux/tsdemuxer.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"discardEPB",function(){return w});var W=D("./src/demux/adts.ts"),M=D("./src/demux/mpegaudio.ts"),O=D("./src/demux/exp-golomb.ts"),F=D("./src/demux/id3.ts"),I=D("./src/demux/sample-aes.ts"),R=D("./src/events.ts"),_=D("./src/utils/mp4-tools.ts"),g=D("./src/utils/logger.ts"),T=D("./src/errors.ts"),A={video:1,audio:2,id3:3,text:4},L=function(){function m(C,v,c){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=C,this.config=v,this.typeSupported=c}m.probe=function(v){var c=m.syncOffset(v);return c<0?!1:(c&&g.logger.warn("MPEG2-TS detected but first sync word found @ offset "+c+", junk ahead ?"),!0)},m.syncOffset=function(v){for(var c=Math.min(1e3,v.length-3*188),f=0;f<c;){if(v[f]===71&&v[f+188]===71&&v[f+2*188]===71)return f;f++}return-1},m.createTrack=function(v,c){return{container:v==="video"||v==="audio"?"video/mp2t":void 0,type:v,id:A[v],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:v==="audio"?c:void 0}};var h=m.prototype;return h.resetInitSegment=function(v,c,f){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=m.createTrack("video",f),this._audioTrack=m.createTrack("audio",f),this._id3Track=m.createTrack("id3",f),this._txtTrack=m.createTrack("text",f),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=v,this.videoCodec=c,this._duration=f},h.resetTimeStamp=function(){},h.resetContiguity=function(){var v=this._audioTrack,c=this._avcTrack,f=this._id3Track;v&&(v.pesData=null),c&&(c.pesData=null),f&&(f.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},h.demux=function(v,c,f,d){f===void 0&&(f=!1),d===void 0&&(d=!1),f||(this.sampleAes=null);var a,b=this._avcTrack,p=this._audioTrack,x=this._id3Track,P=b.pid,N=b.pesData,K=p.pid,V=x.pid,B=p.pesData,U=x.pesData,Y=!1,ee=this.pmtParsed,oe=this._pmtId,de=v.length;if(this.remainderData&&(v=Object(_.appendUint8Array)(this.remainderData,v),de=v.length,this.remainderData=null),de<188&&!d)return this.remainderData=v,{audioTrack:p,avcTrack:b,id3Track:x,textTrack:this._txtTrack};var Te=Math.max(0,m.syncOffset(v));de-=(de+Te)%188,de<v.byteLength&&!d&&(this.remainderData=new Uint8Array(v.buffer,de,v.buffer.byteLength-de));for(var ge=Te;ge<de;ge+=188)if(v[ge]===71){var pe=!!(v[ge+1]&64),fe=((v[ge+1]&31)<<8)+v[ge+2],me=(v[ge+3]&48)>>4,ae=void 0;if(me>1){if(ae=ge+5+v[ge+4],ae===ge+188)continue}else ae=ge+4;switch(fe){case P:pe&&(N&&(a=o(N))&&this.parseAVCPES(a,!1),N={data:[],size:0}),N&&(N.data.push(v.subarray(ae,ge+188)),N.size+=ge+188-ae);break;case K:pe&&(B&&(a=o(B))&&(p.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),B={data:[],size:0}),B&&(B.data.push(v.subarray(ae,ge+188)),B.size+=ge+188-ae);break;case V:pe&&(U&&(a=o(U))&&this.parseID3PES(a),U={data:[],size:0}),U&&(U.data.push(v.subarray(ae,ge+188)),U.size+=ge+188-ae);break;case 0:pe&&(ae+=v[ae]+1),oe=this._pmtId=y(v,ae);break;case oe:{pe&&(ae+=v[ae]+1);var ue=u(v,ae,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,f);P=ue.avc,P>0&&(b.pid=P),K=ue.audio,K>0&&(p.pid=K,p.isAAC=ue.isAAC),V=ue.id3,V>0&&(x.pid=V),Y&&!ee&&(g.logger.log("reparse from beginning"),Y=!1,ge=Te-188),ee=this.pmtParsed=!0;break}case 17:case 8191:break;default:Y=!0;break}}else this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});b.pesData=N,p.pesData=B,x.pesData=U;var Ee={audioTrack:p,avcTrack:b,id3Track:x,textTrack:this._txtTrack};return d&&this.extractRemainingSamples(Ee),Ee},h.flush=function(){var v=this.remainderData;this.remainderData=null;var c;return v?c=this.demux(v,-1,!1,!0):c={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(c),this.sampleAes?this.decrypt(c,this.sampleAes):c},h.extractRemainingSamples=function(v){var c=v.audioTrack,f=v.avcTrack,d=v.id3Track,a=f.pesData,b=c.pesData,p=d.pesData,x;a&&(x=o(a))?(this.parseAVCPES(x,!0),f.pesData=null):f.pesData=a,b&&(x=o(b))?(c.isAAC?this.parseAACPES(x):this.parseMPEGPES(x),c.pesData=null):(b!=null&&b.size&&g.logger.log("last AAC PES packet truncated,might overlap between fragments"),c.pesData=b),p&&(x=o(p))?(this.parseID3PES(x),d.pesData=null):d.pesData=p},h.demuxSampleAes=function(v,c,f){var d=this.demux(v,f,!0,!this.config.progressive),a=this.sampleAes=new I.default(this.observer,this.config,c);return this.decrypt(d,a)},h.decrypt=function(v,c){return new Promise(function(f){var d=v.audioTrack,a=v.avcTrack;d.samples&&d.isAAC?c.decryptAacSamples(d.samples,0,function(){a.samples?c.decryptAvcSamples(a.samples,0,0,function(){f(v)}):f(v)}):a.samples&&c.decryptAvcSamples(a.samples,0,0,function(){f(v)})})},h.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},h.parseAVCPES=function(v,c){var f=this,d=this._avcTrack,a=this.parseAVCNALu(v.data),b=!1,p=this.avcSample,x,P=!1;v.data=null,p&&a.length&&!d.audFound&&(s(p,d),p=this.avcSample=S(!1,v.pts,v.dts,"")),a.forEach(function(N){switch(N.type){case 1:{x=!0,p||(p=f.avcSample=S(!0,v.pts,v.dts,"")),b&&(p.debug+="NDR "),p.frame=!0;var K=N.data;if(P&&K.length>4){var V=new O.default(K).readSliceType();(V===2||V===4||V===7||V===9)&&(p.key=!0)}break}case 5:x=!0,p||(p=f.avcSample=S(!0,v.pts,v.dts,"")),b&&(p.debug+="IDR "),p.key=!0,p.frame=!0;break;case 6:{x=!0,b&&p&&(p.debug+="SEI ");var B=new O.default(w(N.data));B.readUByte();for(var U=0,Y=0,ee=!1,oe=0;!ee&&B.bytesAvailable>1;){U=0;do oe=B.readUByte(),U+=oe;while(oe===255);Y=0;do oe=B.readUByte(),Y+=oe;while(oe===255);if(U===4&&B.bytesAvailable!==0){ee=!0;var de=B.readUByte();if(de===181){var Te=B.readUShort();if(Te===49){var ge=B.readUInt();if(ge===1195456820){var pe=B.readUByte();if(pe===3){for(var fe=B.readUByte(),me=B.readUByte(),ae=31&fe,ue=[fe,me],Ee=0;Ee<ae;Ee++)ue.push(B.readUByte()),ue.push(B.readUByte()),ue.push(B.readUByte());l(f._txtTrack.samples,{type:3,pts:v.pts,bytes:ue})}}}}}else if(U===5&&B.bytesAvailable!==0){if(ee=!0,Y>16){for(var Ie=[],ke=0;ke<16;ke++)Ie.push(B.readUByte().toString(16)),(ke===3||ke===5||ke===7||ke===9)&&Ie.push("-");for(var Xe=Y-16,Ne=new Uint8Array(Xe),we=0;we<Xe;we++)Ne[we]=B.readUByte();l(f._txtTrack.samples,{pts:v.pts,payloadType:U,uuid:Ie.join(""),userData:Object(F.utf8ArrayToStr)(Ne),userDataBytes:Ne})}}else if(Y<B.bytesAvailable)for(var Ce=0;Ce<Y;Ce++)B.readUByte()}break}case 7:if(x=!0,P=!0,b&&p&&(p.debug+="SPS "),!d.sps){var Re=new O.default(N.data),Be=Re.readSPS();d.width=Be.width,d.height=Be.height,d.pixelRatio=Be.pixelRatio,d.sps=[N.data],d.duration=f._duration;for(var je=N.data.subarray(1,4),Ae="avc1.",Le=0;Le<3;Le++){var Je=je[Le].toString(16);Je.length<2&&(Je="0"+Je),Ae+=Je}d.codec=Ae}break;case 8:x=!0,b&&p&&(p.debug+="PPS "),d.pps||(d.pps=[N.data]);break;case 9:x=!1,d.audFound=!0,p&&s(p,d),p=f.avcSample=S(!1,v.pts,v.dts,b?"AUD ":"");break;case 12:x=!1;break;default:x=!1,p&&(p.debug+="unknown NAL "+N.type+" ");break}if(p&&x){var Ye=p.units;Ye.push(N)}}),c&&p&&(s(p,d),this.avcSample=null)},h.getLastNalUnit=function(){var v,c=this.avcSample,f;if(!c||c.units.length===0){var d=this._avcTrack.samples;c=d[d.length-1]}if((v=c)!==null&&v!==void 0&&v.units){var a=c.units;f=a[a.length-1]}return f},h.parseAVCNALu=function(v){var c=v.byteLength,f=this._avcTrack,d=f.naluState||0,a=d,b=[],p=0,x,P,N,K=-1,V=0;for(d===-1&&(K=0,V=v[0]&31,d=0,p=1);p<c;){if(x=v[p++],!d){d=x?0:1;continue}if(d===1){d=x?0:2;continue}if(!x)d=3;else if(x===1){if(K>=0){var B={data:v.subarray(K,p-d-1),type:V};b.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))),P=p-d-1,P>0)){var Y=new Uint8Array(U.data.byteLength+P);Y.set(U.data,0),Y.set(v.subarray(0,P),U.data.byteLength),U.data=Y,U.state=0}}p<c?(N=v[p]&31,K=p,V=N,d=0):d=-1}else d=0}if(K>=0&&d>=0){var ee={data:v.subarray(K,c),type:V,state:d};b.push(ee)}if(b.length===0){var oe=this.getLastNalUnit();if(oe){var de=new Uint8Array(oe.data.byteLength+v.byteLength);de.set(oe.data,0),de.set(v,oe.data.byteLength),oe.data=de}}return f.naluState=d,b},h.parseAACPES=function(v){var c=0,f=this._audioTrack,d=this.aacOverFlow,a=v.data;if(d){this.aacOverFlow=null;var b=d.sample.unit.byteLength,p=Math.min(d.missing,b),x=b-p;d.sample.unit.set(a.subarray(0,p),x),f.samples.push(d.sample),c=d.missing}var P,N;for(P=c,N=a.length;P<N-1&&!W.isHeader(a,P);P++);if(P!==c){var K,V;if(P<N-1?(K="AAC PES did not start with ADTS header,offset:"+P,V=!1):(K="no ADTS header found in AAC PES",V=!0),g.logger.warn("parsing error:"+K),this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:K}),V)return}W.initTrackConfig(f,this.observer,a,P,this.audioCodec);var B;if(v.pts!==void 0)B=v.pts;else if(d){var U=W.getFrameDuration(f.samplerate);B=d.sample.pts+U}else{g.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var Y=0;P<N;)if(W.isHeader(a,P)){if(P+5<N){var ee=W.appendFrame(f,a,P,B,Y);if(ee)if(ee.missing)this.aacOverFlow=ee;else{P+=ee.length,Y++;continue}}break}else P++},h.parseMPEGPES=function(v){var c=v.data,f=c.length,d=0,a=0,b=v.pts;if(b===void 0){g.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<f;)if(M.isHeader(c,a)){var p=M.appendFrame(this._audioTrack,c,a,b,d);if(p)a+=p.length,d++;else break}else a++},h.parseID3PES=function(v){if(v.pts===void 0){g.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(v)},m}();L.minProbeByteLength=188;function S(m,h,C,v){return{key:m,frame:!1,pts:h,dts:C,units:[],debug:v,length:0}}function y(m,h){return(m[h+10]&31)<<8|m[h+11]}function u(m,h,C,v){var c={audio:-1,avc:-1,id3:-1,isAAC:!0},f=(m[h+1]&15)<<8|m[h+2],d=h+3+f-4,a=(m[h+10]&15)<<8|m[h+11];for(h+=12+a;h<d;){var b=(m[h+1]&31)<<8|m[h+2];switch(m[h]){case 207:if(!v){g.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:c.audio===-1&&(c.audio=b);break;case 21:c.id3===-1&&(c.id3=b);break;case 219:if(!v){g.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:c.avc===-1&&(c.avc=b);break;case 3:case 4:C?c.audio===-1&&(c.audio=b,c.isAAC=!1):g.logger.log("MPEG audio found, not supported in this browser");break;case 36:g.logger.warn("Unsupported HEVC stream type found");break;default:break}h+=((m[h+3]&15)<<8|m[h+4])+5}return c}function o(m){var h=0,C,v,c,f,d,a=m.data;if(!m||m.size===0)return null;for(;a[0].length<19&&a.length>1;){var b=new Uint8Array(a[0].length+a[1].length);b.set(a[0]),b.set(a[1],a[0].length),a[0]=b,a.splice(1,1)}C=a[0];var p=(C[0]<<16)+(C[1]<<8)+C[2];if(p===1){if(v=(C[4]<<8)+C[5],v&&v>m.size-6)return null;var x=C[7];x&192&&(f=(C[9]&14)*536870912+(C[10]&255)*4194304+(C[11]&254)*16384+(C[12]&255)*128+(C[13]&254)/2,x&64?(d=(C[14]&14)*536870912+(C[15]&255)*4194304+(C[16]&254)*16384+(C[17]&255)*128+(C[18]&254)/2,f-d>60*9e4&&(g.logger.warn(Math.round((f-d)/9e4)+"s delta between PTS and DTS, align them"),f=d)):d=f),c=C[8];var P=c+9;if(m.size<=P)return null;m.size-=P;for(var N=new Uint8Array(m.size),K=0,V=a.length;K<V;K++){C=a[K];var B=C.byteLength;if(P)if(P>B){P-=B;continue}else C=C.subarray(P),B-=P,P=0;N.set(C,h),h+=B}return v&&(v-=c+3),{data:N,pts:f,dts:d,len:v}}return null}function s(m,h){if(m.units.length&&m.frame){if(m.pts===void 0){var C=h.samples,v=C.length;if(v){var c=C[v-1];m.pts=c.pts,m.dts=c.dts}else{h.dropped++;return}}h.samples.push(m)}m.debug.length&&g.logger.log(m.pts+"/"+m.dts+":"+m.debug)}function l(m,h){var C=m.length;if(C>0){if(h.pts>=m[C-1].pts)m.push(h);else for(var v=C-1;v>=0;v--)if(h.pts<m[v].pts){m.splice(v,0,h);break}}else m.push(h)}function w(m){for(var h=m.byteLength,C=[],v=1;v<h-2;)m[v]===0&&m[v+1]===0&&m[v+2]===3?(C.push(v+2),v+=2):v++;if(C.length===0)return m;var c=h-C.length,f=new Uint8Array(c),d=0;for(v=0;v<c;d++,v++)d===C[0]&&(d++,C.shift()),f[v]=m[d];return f}G.default=L},"./src/errors.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"ErrorTypes",function(){return W}),D.d(G,"ErrorDetails",function(){return M});var W;(function(O){O.NETWORK_ERROR="networkError",O.MEDIA_ERROR="mediaError",O.KEY_SYSTEM_ERROR="keySystemError",O.MUX_ERROR="muxError",O.OTHER_ERROR="otherError"})(W||(W={}));var M;(function(O){O.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",O.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",O.KEY_SYSTEM_NO_SESSION="keySystemNoSession",O.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",O.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",O.MANIFEST_LOAD_ERROR="manifestLoadError",O.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",O.MANIFEST_PARSING_ERROR="manifestParsingError",O.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",O.LEVEL_EMPTY_ERROR="levelEmptyError",O.LEVEL_LOAD_ERROR="levelLoadError",O.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",O.LEVEL_SWITCH_ERROR="levelSwitchError",O.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",O.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",O.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",O.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",O.FRAG_LOAD_ERROR="fragLoadError",O.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",O.FRAG_DECRYPT_ERROR="fragDecryptError",O.FRAG_PARSING_ERROR="fragParsingError",O.REMUX_ALLOC_ERROR="remuxAllocError",O.KEY_LOAD_ERROR="keyLoadError",O.KEY_LOAD_TIMEOUT="keyLoadTimeOut",O.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",O.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",O.BUFFER_APPEND_ERROR="bufferAppendError",O.BUFFER_APPENDING_ERROR="bufferAppendingError",O.BUFFER_STALLED_ERROR="bufferStalledError",O.BUFFER_FULL_ERROR="bufferFullError",O.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",O.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",O.INTERNAL_EXCEPTION="internalException",O.INTERNAL_ABORTED="aborted",O.UNKNOWN="unknown"})(M||(M={}))},"./src/events.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"Events",function(){return W});var W;(function(M){M.MEDIA_ATTACHING="hlsMediaAttaching",M.MEDIA_ATTACHED="hlsMediaAttached",M.MEDIA_DETACHING="hlsMediaDetaching",M.MEDIA_DETACHED="hlsMediaDetached",M.BUFFER_RESET="hlsBufferReset",M.BUFFER_CODECS="hlsBufferCodecs",M.BUFFER_CREATED="hlsBufferCreated",M.BUFFER_APPENDING="hlsBufferAppending",M.BUFFER_APPENDED="hlsBufferAppended",M.BUFFER_EOS="hlsBufferEos",M.BUFFER_FLUSHING="hlsBufferFlushing",M.BUFFER_FLUSHED="hlsBufferFlushed",M.MANIFEST_LOADING="hlsManifestLoading",M.MANIFEST_LOADED="hlsManifestLoaded",M.MANIFEST_PARSED="hlsManifestParsed",M.LEVEL_SWITCHING="hlsLevelSwitching",M.LEVEL_SWITCHED="hlsLevelSwitched",M.LEVEL_LOADING="hlsLevelLoading",M.LEVEL_LOADED="hlsLevelLoaded",M.LEVEL_UPDATED="hlsLevelUpdated",M.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",M.LEVELS_UPDATED="hlsLevelsUpdated",M.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",M.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",M.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",M.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",M.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",M.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",M.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",M.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",M.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",M.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",M.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",M.CUES_PARSED="hlsCuesParsed",M.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",M.INIT_PTS_FOUND="hlsInitPtsFound",M.FRAG_LOADING="hlsFragLoading",M.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",M.FRAG_LOADED="hlsFragLoaded",M.FRAG_DECRYPTED="hlsFragDecrypted",M.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",M.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",M.FRAG_PARSING_METADATA="hlsFragParsingMetadata",M.FRAG_PARSED="hlsFragParsed",M.FRAG_BUFFERED="hlsFragBuffered",M.FRAG_CHANGED="hlsFragChanged",M.FPS_DROP="hlsFpsDrop",M.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",M.ERROR="hlsError",M.DESTROYING="hlsDestroying",M.KEY_LOADING="hlsKeyLoading",M.KEY_LOADED="hlsKeyLoaded",M.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",M.BACK_BUFFER_REACHED="hlsBackBufferReached"})(W||(W={}))},"./src/hls.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return m});var W=D("./node_modules/url-toolkit/src/url-toolkit.js"),M=D.n(W),O=D("./src/loader/playlist-loader.ts"),F=D("./src/loader/key-loader.ts"),I=D("./src/controller/id3-track-controller.ts"),R=D("./src/controller/latency-controller.ts"),_=D("./src/controller/level-controller.ts"),g=D("./src/controller/fragment-tracker.ts"),T=D("./src/controller/stream-controller.ts"),A=D("./src/is-supported.ts"),L=D("./src/utils/logger.ts"),S=D("./src/config.ts"),y=D("./node_modules/eventemitter3/index.js"),u=D.n(y),o=D("./src/events.ts"),s=D("./src/errors.ts");function l(h,C){for(var v=0;v<C.length;v++){var c=C[v];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(h,c.key,c)}}function w(h,C,v){return C&&l(h.prototype,C),v&&l(h,v),h}var m=function(){h.isSupported=function(){return Object(A.isSupported)()};function h(v){v===void 0&&(v={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new y.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 c=this.config=Object(S.mergeConfig)(h.DefaultConfig,v);this.userConfig=v,Object(L.enableLogs)(c.debug),this._autoLevelCapping=-1,c.progressive&&Object(S.enableStreamingMode)(c);var f=c.abrController,d=c.bufferController,a=c.capLevelController,b=c.fpsController,p=this.abrController=new f(this),x=this.bufferController=new d(this),P=this.capLevelController=new a(this),N=new b(this),K=new O.default(this),V=new F.default(this),B=new I.default(this),U=this.levelController=new _.default(this),Y=new g.FragmentTracker(this),ee=this.streamController=new T.default(this,Y);P.setStreamController(ee),N.setStreamController(ee);var oe=[U,ee];this.networkControllers=oe;var de=[K,V,p,x,P,N,B,Y];this.audioTrackController=this.createController(c.audioTrackController,null,oe),this.createController(c.audioStreamController,Y,oe),this.subtitleTrackController=this.createController(c.subtitleTrackController,null,oe),this.createController(c.subtitleStreamController,Y,oe),this.createController(c.timelineController,null,de),this.emeController=this.createController(c.emeController,null,de),this.cmcdController=this.createController(c.cmcdController,null,de),this.latencyController=this.createController(R.default,null,de),this.coreComponents=de}var C=h.prototype;return C.createController=function(c,f,d){if(c){var a=f?new c(this,f):new c(this);return d&&d.push(a),a}return null},C.on=function(c,f,d){d===void 0&&(d=this),this._emitter.on(c,f,d)},C.once=function(c,f,d){d===void 0&&(d=this),this._emitter.once(c,f,d)},C.removeAllListeners=function(c){this._emitter.removeAllListeners(c)},C.off=function(c,f,d,a){d===void 0&&(d=this),this._emitter.off(c,f,d,a)},C.listeners=function(c){return this._emitter.listeners(c)},C.emit=function(c,f,d){return this._emitter.emit(c,f,d)},C.trigger=function(c,f){if(this.config.debug)return this.emit(c,c,f);try{return this.emit(c,c,f)}catch(d){L.logger.error("An internal error happened while handling event "+c+'. Error message: "'+d.message+'". Here is a stacktrace:',d),this.trigger(o.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:c,error:d})}return!1},C.listenerCount=function(c){return this._emitter.listenerCount(c)},C.destroy=function(){L.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(c){return c.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(c){return c.destroy()}),this.coreComponents.length=0},C.attachMedia=function(c){L.logger.log("attachMedia"),this._media=c,this.trigger(o.Events.MEDIA_ATTACHING,{media:c})},C.detachMedia=function(){L.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},C.loadSource=function(c){this.stopLoad();var f=this.media,d=this.url,a=this.url=W.buildAbsoluteURL(self.location.href,c,{alwaysNormalize:!0});L.logger.log("loadSource:"+a),f&&d&&d!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(f)),this.trigger(o.Events.MANIFEST_LOADING,{url:c})},C.startLoad=function(c){c===void 0&&(c=-1),L.logger.log("startLoad("+c+")"),this.networkControllers.forEach(function(f){f.startLoad(c)})},C.stopLoad=function(){L.logger.log("stopLoad"),this.networkControllers.forEach(function(c){c.stopLoad()})},C.swapAudioCodec=function(){L.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},C.recoverMediaError=function(){L.logger.log("recoverMediaError");var c=this._media;this.detachMedia(),c&&this.attachMedia(c)},C.removeLevel=function(c,f){f===void 0&&(f=0),this.levelController.removeLevel(c,f)},w(h,[{key:"levels",get:function(){var c=this.levelController.levels;return c||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(c){L.logger.log("set currentLevel:"+c),this.loadLevel=c,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(c){L.logger.log("set nextLevel:"+c),this.levelController.manualLevel=c,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(c){L.logger.log("set loadLevel:"+c),this.levelController.manualLevel=c}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(c){this.levelController.nextLoadLevel=c}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(c){L.logger.log("set firstLevel:"+c),this.levelController.firstLevel=c}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(c){L.logger.log("set startLevel:"+c),c!==-1&&(c=Math.max(c,this.minAutoLevel)),this.levelController.startLevel=c}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(c){var f=!!c;f!==this.config.capLevelToPlayerSize&&(f?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=f)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(c){this._autoLevelCapping!==c&&(L.logger.log("set autoLevelCapping:"+c),this._autoLevelCapping=c)}},{key:"bandwidthEstimate",get:function(){var c=this.abrController.bwEstimator;return c?c.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var c=this.levels,f=this.config.minAutoBitrate;if(!c)return 0;for(var d=c.length,a=0;a<d;a++)if(c[a].maxBitrate>f)return a;return 0}},{key:"maxAutoLevel",get:function(){var c=this.levels,f=this.autoLevelCapping,d;return f===-1&&c&&c.length?d=c.length-1:d=f,d}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(c){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,c)}},{key:"audioTracks",get:function(){var c=this.audioTrackController;return c?c.audioTracks:[]}},{key:"audioTrack",get:function(){var c=this.audioTrackController;return c?c.audioTrack:-1},set:function(c){var f=this.audioTrackController;f&&(f.audioTrack=c)}},{key:"subtitleTracks",get:function(){var c=this.subtitleTrackController;return c?c.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var c=this.subtitleTrackController;return c?c.subtitleTrack:-1},set:function(c){var f=this.subtitleTrackController;f&&(f.subtitleTrack=c)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var c=this.subtitleTrackController;return c?c.subtitleDisplay:!1},set:function(c){var f=this.subtitleTrackController;f&&(f.subtitleDisplay=c)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(c){this.config.lowLatencyMode=c}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return h.defaultConfig?h.defaultConfig:S.hlsDefaultConfig},set:function(c){h.defaultConfig=c}}]),h}();m.defaultConfig=void 0},"./src/is-supported.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"isSupported",function(){return O}),D.d(G,"changeTypeSupported",function(){return F});var W=D("./src/utils/mediasource-helper.ts");function M(){return self.SourceBuffer||self.WebKitSourceBuffer}function O(){var I=Object(W.getMediaSource)();if(!I)return!1;var R=M(),_=I&&typeof I.isTypeSupported=="function"&&I.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),g=!R||R.prototype&&typeof R.prototype.appendBuffer=="function"&&typeof R.prototype.remove=="function";return!!_&&!!g}function F(){var I,R=M();return typeof(R==null||((I=R.prototype)===null||I===void 0)?void 0:I.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return L}),D.d(G,"LoadError",function(){return y});var W=D("./src/polyfills/number.ts"),M=D("./src/errors.ts");function O(u,o){u.prototype=Object.create(o.prototype),u.prototype.constructor=u,g(u,o)}function F(u){var o=typeof Map=="function"?new Map:void 0;return F=function(l){if(l===null||!_(l))return l;if(typeof l!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(l))return o.get(l);o.set(l,w)}function w(){return I(l,arguments,T(this).constructor)}return w.prototype=Object.create(l.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),g(w,l)},F(u)}function I(u,o,s){return R()?I=Reflect.construct:I=function(w,m,h){var C=[null];C.push.apply(C,m);var v=Function.bind.apply(w,C),c=new v;return h&&g(c,h.prototype),c},I.apply(null,arguments)}function R(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function _(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function g(u,o){return g=Object.setPrototypeOf||function(l,w){return l.__proto__=w,l},g(u,o)}function T(u){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},T(u)}var A=Math.pow(2,17),L=function(){function u(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var o=u.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(l,w){var m=this,h=l.url;if(!h)return Promise.reject(new y({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,networkDetails:null},"Fragment does not have a "+(h?"part list":"url")));this.abort();var C=this.config,v=C.fLoader,c=C.loader;return new Promise(function(f,d){m.loader&&m.loader.destroy();var a=m.loader=l.loader=v?new v(C):new c(C),b=S(l),p={timeout:C.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:C.fragLoadingMaxRetryTimeout,highWaterMark:A};l.stats=a.stats,a.load(b,p,{onSuccess:function(P,N,K,V){m.resetLoader(l,a),f({frag:l,part:null,payload:P.data,networkDetails:V})},onError:function(P,N,K){m.resetLoader(l,a),d(new y({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,response:P,networkDetails:K}))},onAbort:function(P,N,K){m.resetLoader(l,a),d(new y({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,networkDetails:K}))},onTimeout:function(P,N,K){m.resetLoader(l,a),d(new y({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,networkDetails:K}))},onProgress:function(P,N,K,V){w&&w({frag:l,part:null,payload:K,networkDetails:V})}})})},o.loadPart=function(l,w,m){var h=this;this.abort();var C=this.config,v=C.fLoader,c=C.loader;return new Promise(function(f,d){h.loader&&h.loader.destroy();var a=h.loader=l.loader=v?new v(C):new c(C),b=S(l,w),p={timeout:C.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:C.fragLoadingMaxRetryTimeout,highWaterMark:A};w.stats=a.stats,a.load(b,p,{onSuccess:function(P,N,K,V){h.resetLoader(l,a),h.updateStatsFromPart(l,w);var B={frag:l,part:w,payload:P.data,networkDetails:V};m(B),f(B)},onError:function(P,N,K){h.resetLoader(l,a),d(new y({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,part:w,response:P,networkDetails:K}))},onAbort:function(P,N,K){l.stats.aborted=w.stats.aborted,h.resetLoader(l,a),d(new y({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,part:w,networkDetails:K}))},onTimeout:function(P,N,K){h.resetLoader(l,a),d(new y({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,part:w,networkDetails:K}))}})})},o.updateStatsFromPart=function(l,w){var m=l.stats,h=w.stats,C=h.total;if(m.loaded+=h.loaded,C){var v=Math.round(l.duration/w.duration),c=Math.min(Math.round(m.loaded/C),v),f=v-c,d=f*Math.round(m.loaded/c);m.total=m.loaded+d}else m.total=Math.max(m.loaded,m.total);var a=m.loading,b=h.loading;a.start?a.first+=b.first-b.start:(a.start=b.start,a.first=b.first),a.end=b.end},o.resetLoader=function(l,w){l.loader=null,this.loader===w&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),w.destroy()},u}();function S(u,o){o===void 0&&(o=null);var s=o||u,l={frag:u,part:o,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},w=s.byteRangeStartOffset,m=s.byteRangeEndOffset;return Object(W.isFiniteNumber)(w)&&Object(W.isFiniteNumber)(m)&&(l.rangeStart=w,l.rangeEnd=m),l}var y=function(u){O(o,u);function o(s){for(var l,w=arguments.length,m=new Array(w>1?w-1:0),h=1;h<w;h++)m[h-1]=arguments[h];return l=u.call.apply(u,[this].concat(m))||this,l.data=void 0,l.data=s,l}return o}(F(Error))},"./src/loader/fragment.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"ElementaryStreamTypes",function(){return L}),D.d(G,"BaseSegment",function(){return S}),D.d(G,"Fragment",function(){return y}),D.d(G,"Part",function(){return u});var W=D("./src/polyfills/number.ts"),M=D("./node_modules/url-toolkit/src/url-toolkit.js"),O=D.n(M),F=D("./src/utils/logger.ts"),I=D("./src/loader/level-key.ts"),R=D("./src/loader/load-stats.ts");function _(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,g(o,s)}function g(o,s){return g=Object.setPrototypeOf||function(w,m){return w.__proto__=m,w},g(o,s)}function T(o,s){for(var l=0;l<s.length;l++){var w=s[l];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function A(o,s,l){return s&&T(o.prototype,s),l&&T(o,l),o}var L;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(L||(L={}));var S=function(){function o(l){var w;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(w={},w[L.AUDIO]=null,w[L.VIDEO]=null,w[L.AUDIOVIDEO]=null,w),this.baseurl=l}var s=o.prototype;return s.setByteRange=function(w,m){var h=w.split("@",2),C=[];h.length===1?C[0]=m?m.byteRangeEndOffset:0:C[0]=parseInt(h[1]),C[1]=parseInt(h[0])+C[0],this._byteRange=C},A(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(M.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(w){this._url=w}}]),o}(),y=function(o){_(s,o);function s(w,m){var h;return h=o.call(this,m)||this,h._decryptdata=null,h.rawProgramDateTime=null,h.programDateTime=null,h.tagList=[],h.duration=0,h.sn=0,h.levelkey=void 0,h.type=void 0,h.loader=null,h.level=-1,h.cc=0,h.startPTS=void 0,h.endPTS=void 0,h.appendedPTS=void 0,h.startDTS=void 0,h.endDTS=void 0,h.start=0,h.deltaPTS=void 0,h.maxStartPTS=void 0,h.minEndPTS=void 0,h.stats=new R.LoadStats,h.urlId=0,h.data=void 0,h.bitrateTest=!1,h.title=null,h.initSegment=null,h.type=w,h}var l=s.prototype;return l.createInitializationVector=function(m){for(var h=new Uint8Array(16),C=12;C<16;C++)h[C]=m>>8*(15-C)&255;return h},l.setDecryptDataFromLevelKey=function(m,h){var C=m;return(m==null?void 0:m.method)==="AES-128"&&m.uri&&!m.iv&&(C=I.LevelKey.fromURI(m.uri),C.method=m.method,C.iv=this.createInitializationVector(h),C.keyFormat="identity"),C},l.setElementaryStreamInfo=function(m,h,C,v,c,f){f===void 0&&(f=!1);var d=this.elementaryStreams,a=d[m];if(!a){d[m]={startPTS:h,endPTS:C,startDTS:v,endDTS:c,partial:f};return}a.startPTS=Math.min(a.startPTS,h),a.endPTS=Math.max(a.endPTS,C),a.startDTS=Math.min(a.startDTS,v),a.endDTS=Math.max(a.endDTS,c)},l.clearElementaryStreamInfo=function(){var m=this.elementaryStreams;m[L.AUDIO]=null,m[L.VIDEO]=null,m[L.AUDIOVIDEO]=null},A(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var m=this.sn;typeof m!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&F.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),m=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,m)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(W.isFiniteNumber)(this.programDateTime))return null;var m=Object(W.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+m*1e3}},{key:"encrypted",get:function(){var m;return!!((m=this.decryptdata)!==null&&m!==void 0&&m.keyFormat&&this.decryptdata.uri)}}]),s}(S),u=function(o){_(s,o);function s(l,w,m,h,C){var v;v=o.call(this,m)||this,v.fragOffset=0,v.duration=0,v.gap=!1,v.independent=!1,v.relurl=void 0,v.fragment=void 0,v.index=void 0,v.stats=new R.LoadStats,v.duration=l.decimalFloatingPoint("DURATION"),v.gap=l.bool("GAP"),v.independent=l.bool("INDEPENDENT"),v.relurl=l.enumeratedString("URI"),v.fragment=w,v.index=h;var c=l.enumeratedString("BYTERANGE");return c&&v.setByteRange(c,C),C&&(v.fragOffset=C.fragOffset+C.duration),v}return A(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}(S)},"./src/loader/key-loader.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return F});var W=D("./src/events.ts"),M=D("./src/errors.ts"),O=D("./src/utils/logger.ts"),F=function(){function I(_){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=_,this._registerListeners()}var R=I.prototype;return R._registerListeners=function(){this.hls.on(W.Events.KEY_LOADING,this.onKeyLoading,this)},R._unregisterListeners=function(){this.hls.off(W.Events.KEY_LOADING,this.onKeyLoading)},R.destroy=function(){this._unregisterListeners();for(var g in this.loaders){var T=this.loaders[g];T&&T.destroy()}this.loaders={}},R.onKeyLoading=function(g,T){var A=T.frag,L=A.type,S=this.loaders[L];if(!A.decryptdata){O.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var y=A.decryptdata.uri;if(y!==this.decrypturl||this.decryptkey===null){var u=this.hls.config;if(S&&(O.logger.warn("abort previous key loader for type:"+L),S.abort()),!y){O.logger.warn("key uri is falsy");return}var o=u.loader,s=A.loader=this.loaders[L]=new o(u);this.decrypturl=y,this.decryptkey=null;var l={url:y,frag:A,responseType:"arraybuffer"},w={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(l,w,m)}else this.decryptkey&&(A.decryptdata.key=this.decryptkey,this.hls.trigger(W.Events.KEY_LOADED,{frag:A}))},R.loadsuccess=function(g,T,A){var L=A.frag;if(!L.decryptdata){O.logger.error("after key load, decryptdata unset");return}this.decryptkey=L.decryptdata.key=new Uint8Array(g.data),L.loader=null,delete this.loaders[L.type],this.hls.trigger(W.Events.KEY_LOADED,{frag:L})},R.loaderror=function(g,T){var A=T.frag,L=A.loader;L&&L.abort(),delete this.loaders[A.type],this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:A,response:g})},R.loadtimeout=function(g,T){var A=T.frag,L=A.loader;L&&L.abort(),delete this.loaders[A.type],this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:A})},I}()},"./src/loader/level-details.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"LevelDetails",function(){return I});var W=D("./src/polyfills/number.ts");function M(R,_){for(var g=0;g<_.length;g++){var T=_[g];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(R,T.key,T)}}function O(R,_,g){return _&&M(R.prototype,_),g&&M(R,g),R}var F=10,I=function(){function R(g){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=g}var _=R.prototype;return _.reloaded=function(T){if(!T){this.advanced=!0,this.updated=!0;return}var A=this.lastPartSn-T.lastPartSn,L=this.lastPartIndex-T.lastPartIndex;this.updated=this.endSN!==T.endSN||!!L||!!A,this.advanced=this.endSN>T.endSN||A>0||A===0&&L>0,this.updated||this.advanced?this.misses=Math.floor(T.misses*.6):this.misses=T.misses+1,this.availabilityDelay=T.availabilityDelay},O(R,[{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||F}},{key:"drift",get:function(){var T=this.driftEndTime-this.driftStartTime;if(T>0){var A=this.driftEnd-this.driftStart;return A*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}}]),R}()},"./src/loader/level-key.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"LevelKey",function(){return I});var W=D("./node_modules/url-toolkit/src/url-toolkit.js"),M=D.n(W);function O(R,_){for(var g=0;g<_.length;g++){var T=_[g];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(R,T.key,T)}}function F(R,_,g){return _&&O(R.prototype,_),g&&O(R,g),R}var I=function(){R.fromURL=function(g,T){return new R(g,T)},R.fromURI=function(g){return new R(g)};function R(_,g){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,g?this._uri=Object(W.buildAbsoluteURL)(_,g,{alwaysNormalize:!0}):this._uri=_}return F(R,[{key:"uri",get:function(){return this._uri}}]),R}()},"./src/loader/load-stats.ts":function(Z,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(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return s});var W=D("./src/polyfills/number.ts"),M=D("./node_modules/url-toolkit/src/url-toolkit.js"),O=D.n(M),F=D("./src/loader/fragment.ts"),I=D("./src/loader/level-details.ts"),R=D("./src/loader/level-key.ts"),_=D("./src/utils/attr-list.ts"),g=D("./src/utils/logger.ts"),T=D("./src/utils/codecs.ts"),A=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,L=/#EXT-X-MEDIA:(.*)/g,S=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),y=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),u=/\.(mp4|m4s|m4v|m4a)$/i;function o(C){var v,c;return u.test((v=(c=M.parseURL(C))===null||c===void 0?void 0:c.path)!=null?v:"")}var s=function(){function C(){}return C.findGroup=function(c,f){for(var d=0;d<c.length;d++){var a=c[d];if(a.id===f)return a}},C.convertAVC1ToAVCOTI=function(c){var f=c.split(".");if(f.length>2){var d=f.shift()+".";return d+=parseInt(f.shift()).toString(16),d+=("000"+parseInt(f.shift()).toString(16)).substr(-4),d}return c},C.resolve=function(c,f){return M.buildAbsoluteURL(f,c,{alwaysNormalize:!0})},C.parseMasterPlaylist=function(c,f){var d=[],a={},b=!1;A.lastIndex=0;for(var p;(p=A.exec(c))!=null;)if(p[1]){var x=new _.AttrList(p[1]),P={attrs:x,bitrate:x.decimalInteger("AVERAGE-BANDWIDTH")||x.decimalInteger("BANDWIDTH"),name:x.NAME,url:C.resolve(p[2],f)},N=x.decimalResolution("RESOLUTION");N&&(P.width=N.width,P.height=N.height),l((x.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),P),P.videoCodec&&P.videoCodec.indexOf("avc1")!==-1&&(P.videoCodec=C.convertAVC1ToAVCOTI(P.videoCodec)),d.push(P)}else if(p[3]){var K=new _.AttrList(p[3]);K["DATA-ID"]&&(b=!0,a[K["DATA-ID"]]=K)}return{levels:d,sessionData:b?a:null}},C.parseMasterPlaylistMedia=function(c,f,d,a){a===void 0&&(a=[]);var b,p=[],x=0;for(L.lastIndex=0;(b=L.exec(c))!==null;){var P=new _.AttrList(b[1]);if(P.TYPE===d){var N={attrs:P,bitrate:0,id:x++,groupId:P["GROUP-ID"],instreamId:P["INSTREAM-ID"],name:P.NAME||P.LANGUAGE||"",type:d,default:P.bool("DEFAULT"),autoselect:P.bool("AUTOSELECT"),forced:P.bool("FORCED"),lang:P.LANGUAGE,url:P.URI?C.resolve(P.URI,f):""};if(a.length){var K=C.findGroup(a,N.groupId)||a[0];w(N,K,"audioCodec"),w(N,K,"textCodec")}p.push(N)}}return p},C.parseLevelPlaylist=function(c,f,d,a,b){var p=new I.LevelDetails(f),x=p.fragments,P=null,N=0,K=0,V=0,B=0,U=null,Y=new F.Fragment(a,f),ee,oe,de,Te=-1,ge=!1;for(S.lastIndex=0,p.m3u8=c;(ee=S.exec(c))!==null;){ge&&(ge=!1,Y=new F.Fragment(a,f),Y.start=V,Y.sn=N,Y.cc=B,Y.level=d,P&&(Y.initSegment=P,Y.rawProgramDateTime=P.rawProgramDateTime));var pe=ee[1];if(pe){Y.duration=parseFloat(pe);var fe=(" "+ee[2]).slice(1);Y.title=fe||null,Y.tagList.push(fe?["INF",pe,fe]:["INF",pe])}else if(ee[3])Object(W.isFiniteNumber)(Y.duration)&&(Y.start=V,de&&(Y.levelkey=de),Y.sn=N,Y.level=d,Y.cc=B,Y.urlId=b,x.push(Y),Y.relurl=(" "+ee[3]).slice(1),h(Y,U),U=Y,V+=Y.duration,N++,K=0,ge=!0);else if(ee[4]){var me=(" "+ee[4]).slice(1);U?Y.setByteRange(me,U):Y.setByteRange(me)}else if(ee[5])Y.rawProgramDateTime=(" "+ee[5]).slice(1),Y.tagList.push(["PROGRAM-DATE-TIME",Y.rawProgramDateTime]),Te===-1&&(Te=x.length);else{if(ee=ee[0].match(y),!ee){g.logger.warn("No matches on slow regex match for level playlist!");continue}for(oe=1;oe<ee.length&&!(typeof ee[oe]!="undefined");oe++);var ae=(" "+ee[oe]).slice(1),ue=(" "+ee[oe+1]).slice(1),Ee=ee[oe+2]?(" "+ee[oe+2]).slice(1):"";switch(ae){case"PLAYLIST-TYPE":p.type=ue.toUpperCase();break;case"MEDIA-SEQUENCE":N=p.startSN=parseInt(ue);break;case"SKIP":{var Ie=new _.AttrList(ue),ke=Ie.decimalInteger("SKIPPED-SEGMENTS");if(Object(W.isFiniteNumber)(ke)){p.skippedSegments=ke;for(var Xe=ke;Xe--;)x.unshift(null);N+=ke}var Ne=Ie.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ne&&(p.recentlyRemovedDateranges=Ne.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||Ee)&&Y.tagList.push(Ee?[ue,Ee]:[ue]);break;case"DIS":B++;case"GAP":Y.tagList.push([ae]);break;case"BITRATE":Y.tagList.push([ae,ue]);break;case"DISCONTINUITY-SEQ":B=parseInt(ue);break;case"KEY":{var we,Ce=new _.AttrList(ue),Re=Ce.enumeratedString("METHOD"),Be=Ce.URI,je=Ce.hexadecimalInteger("IV"),Ae=Ce.enumeratedString("KEYFORMATVERSIONS"),Le=Ce.enumeratedString("KEYID"),Je=(we=Ce.enumeratedString("KEYFORMAT"))!=null?we:"identity",Ye=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ye.indexOf(Je)>-1){g.logger.warn("Keyformat "+Je+" is not supported from the manifest");continue}else if(Je!=="identity")continue;Re&&(de=R.LevelKey.fromURL(f,Be),Be&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Re)>=0&&(de.method=Re,de.keyFormat=Je,Le&&(de.keyID=Le),Ae&&(de.keyFormatVersions=Ae),de.iv=je));break}case"START":{var He=new _.AttrList(ue),Ke=He.decimalFloatingPoint("TIME-OFFSET");Object(W.isFiniteNumber)(Ke)&&(p.startTimeOffset=Ke);break}case"MAP":{var et=new _.AttrList(ue);Y.relurl=et.URI,et.BYTERANGE&&Y.setByteRange(et.BYTERANGE),Y.level=d,Y.sn="initSegment",de&&(Y.levelkey=de),Y.initSegment=null,P=Y,ge=!0;break}case"SERVER-CONTROL":{var Ve=new _.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 Ge=new _.AttrList(ue);p.partTarget=Ge.decimalFloatingPoint("PART-TARGET");break}case"PART":{var ye=p.partList;ye||(ye=p.partList=[]);var Ze=K>0?ye[ye.length-1]:void 0,ze=K++,be=new F.Part(new _.AttrList(ue),Y,f,ze,Ze);ye.push(be),Y.duration+=be.duration;break}case"PRELOAD-HINT":{var _e=new _.AttrList(ue);p.preloadHint=_e;break}case"RENDITION-REPORT":{var le=new _.AttrList(ue);p.renditionReports=p.renditionReports||[],p.renditionReports.push(le);break}default:g.logger.warn("line parsed but not handled: "+ee);break}}}U&&!U.relurl?(x.pop(),V-=U.duration,p.partList&&(p.fragmentHint=U)):p.partList&&(h(Y,U),Y.cc=B,p.fragmentHint=Y);var ne=x.length,ie=x[0],X=x[ne-1];if(V+=p.skippedSegments*p.targetduration,V>0&&ne&&X){p.averagetargetduration=V/ne;var $=X.sn;p.endSN=$!=="initSegment"?$:0,ie&&(p.startCC=ie.cc,ie.initSegment||p.fragments.every(function(Q){return Q.relurl&&o(Q.relurl)})&&(g.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),Y=new F.Fragment(a,f),Y.relurl=X.relurl,Y.level=d,Y.sn="initSegment",ie.initSegment=Y,p.needSidxRanges=!0))}else p.endSN=0,p.startCC=0;return p.fragmentHint&&(V+=p.fragmentHint.duration),p.totalduration=V,p.endCC=B,Te>0&&m(x,Te),p},C}();function l(C,v){["video","audio","text"].forEach(function(c){var f=C.filter(function(a){return Object(T.isCodecType)(a,c)});if(f.length){var d=f.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});v[c+"Codec"]=d.length>0?d[0]:f[0],C=C.filter(function(a){return f.indexOf(a)===-1})}}),v.unknownCodecs=C}function w(C,v,c){var f=v[c];f&&(C[c]=f)}function m(C,v){for(var c=C[v],f=v;f--;){var d=C[f];if(!d)return;d.programDateTime=c.programDateTime-d.duration*1e3,c=d}}function h(C,v){C.rawProgramDateTime?C.programDateTime=Date.parse(C.rawProgramDateTime):v!=null&&v.programDateTime&&(C.programDateTime=v.endProgramDateTime),Object(W.isFiniteNumber)(C.programDateTime)||(C.programDateTime=null,C.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(Z,G,D){"use strict";D.r(G);var W=D("./src/polyfills/number.ts"),M=D("./src/events.ts"),O=D("./src/errors.ts"),F=D("./src/utils/logger.ts"),I=D("./src/utils/mp4-tools.ts"),R=D("./src/loader/m3u8-parser.ts"),_=D("./src/types/loader.ts"),g=D("./src/utils/attr-list.ts");function T(S){var y=S.type;switch(y){case _.PlaylistContextType.AUDIO_TRACK:return _.PlaylistLevelType.AUDIO;case _.PlaylistContextType.SUBTITLE_TRACK:return _.PlaylistLevelType.SUBTITLE;default:return _.PlaylistLevelType.MAIN}}function A(S,y){var u=S.url;return(u===void 0||u.indexOf("data:")===0)&&(u=y.url),u}var L=function(){function S(u){this.hls=void 0,this.loaders=Object.create(null),this.hls=u,this.registerListeners()}var y=S.prototype;return y.registerListeners=function(){var o=this.hls;o.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(M.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(M.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(M.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},y.unregisterListeners=function(){var o=this.hls;o.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(M.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(M.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(M.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},y.createInternalLoader=function(o){var s=this.hls.config,l=s.pLoader,w=s.loader,m=l||w,h=new m(s);return o.loader=h,this.loaders[o.type]=h,h},y.getInternalLoader=function(o){return this.loaders[o.type]},y.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},y.destroyInternalLoaders=function(){for(var o in this.loaders){var s=this.loaders[o];s&&s.destroy(),this.resetInternalLoader(o)}},y.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},y.onManifestLoading=function(o,s){var l=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:_.PlaylistContextType.MANIFEST,url:l,deliveryDirectives:null})},y.onLevelLoading=function(o,s){var l=s.id,w=s.level,m=s.url,h=s.deliveryDirectives;this.load({id:l,groupId:null,level:w,responseType:"text",type:_.PlaylistContextType.LEVEL,url:m,deliveryDirectives:h})},y.onAudioTrackLoading=function(o,s){var l=s.id,w=s.groupId,m=s.url,h=s.deliveryDirectives;this.load({id:l,groupId:w,level:null,responseType:"text",type:_.PlaylistContextType.AUDIO_TRACK,url:m,deliveryDirectives:h})},y.onSubtitleTrackLoading=function(o,s){var l=s.id,w=s.groupId,m=s.url,h=s.deliveryDirectives;this.load({id:l,groupId:w,level:null,responseType:"text",type:_.PlaylistContextType.SUBTITLE_TRACK,url:m,deliveryDirectives:h})},y.load=function(o){var s,l=this.hls.config,w=this.getInternalLoader(o);if(w){var m=w.context;if(m&&m.url===o.url){F.logger.trace("[playlist-loader]: playlist request ongoing");return}F.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),w.abort()}var h,C,v,c;switch(o.type){case _.PlaylistContextType.MANIFEST:h=l.manifestLoadingMaxRetry,C=l.manifestLoadingTimeOut,v=l.manifestLoadingRetryDelay,c=l.manifestLoadingMaxRetryTimeout;break;case _.PlaylistContextType.LEVEL:case _.PlaylistContextType.AUDIO_TRACK:case _.PlaylistContextType.SUBTITLE_TRACK:h=0,C=l.levelLoadingTimeOut;break;default:h=l.levelLoadingMaxRetry,C=l.levelLoadingTimeOut,v=l.levelLoadingRetryDelay,c=l.levelLoadingMaxRetryTimeout;break}if(w=this.createInternalLoader(o),(s=o.deliveryDirectives)!==null&&s!==void 0&&s.part){var f;if(o.type===_.PlaylistContextType.LEVEL&&o.level!==null?f=this.hls.levels[o.level].details:o.type===_.PlaylistContextType.AUDIO_TRACK&&o.id!==null?f=this.hls.audioTracks[o.id].details:o.type===_.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(f=this.hls.subtitleTracks[o.id].details),f){var d=f.partTarget,a=f.targetduration;d&&a&&(C=Math.min(Math.max(d*3,a*.8)*1e3,C))}}var b={timeout:C,maxRetry:h,retryDelay:v,maxRetryDelay:c,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};w.load(o,b,p)},y.loadsuccess=function(o,s,l,w){if(w===void 0&&(w=null),l.isSidxRequest){this.handleSidxRequest(o,l),this.handlePlaylistLoaded(o,s,l,w);return}this.resetInternalLoader(l.type);var m=o.data;if(m.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,l,"no EXTM3U delimiter",w);return}s.parsing.start=performance.now(),m.indexOf("#EXTINF:")>0||m.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,s,l,w):this.handleMasterPlaylist(o,s,l,w)},y.loaderror=function(o,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!1,o)},y.loadtimeout=function(o,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!0)},y.handleMasterPlaylist=function(o,s,l,w){var m=this.hls,h=o.data,C=A(o,l),v=R.default.parseMasterPlaylist(h,C),c=v.levels,f=v.sessionData;if(!c.length){this.handleManifestParsingError(o,l,"no level found in manifest",w);return}var d=c.map(function(N){return{id:N.attrs.AUDIO,audioCodec:N.audioCodec}}),a=c.map(function(N){return{id:N.attrs.SUBTITLES,textCodec:N.textCodec}}),b=R.default.parseMasterPlaylistMedia(h,C,"AUDIO",d),p=R.default.parseMasterPlaylistMedia(h,C,"SUBTITLES",a),x=R.default.parseMasterPlaylistMedia(h,C,"CLOSED-CAPTIONS");if(b.length){var P=b.some(function(N){return!N.url});!P&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(F.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),b.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new g.AttrList({}),bitrate:0,url:""}))}m.trigger(M.Events.MANIFEST_LOADED,{levels:c,audioTracks:b,subtitles:p,captions:x,url:C,stats:s,networkDetails:w,sessionData:f})},y.handleTrackOrLevelPlaylist=function(o,s,l,w){var m=this.hls,h=l.id,C=l.level,v=l.type,c=A(o,l),f=Object(W.isFiniteNumber)(h)?h:0,d=Object(W.isFiniteNumber)(C)?C:f,a=T(l),b=R.default.parseLevelPlaylist(o.data,c,d,a,f);if(!b.fragments.length){m.trigger(M.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:c,reason:"no fragments found in level",level:typeof l.level=="number"?l.level:void 0});return}if(v===_.PlaylistContextType.MANIFEST){var p={attrs:new g.AttrList({}),bitrate:0,details:b,name:"",url:c};m.trigger(M.Events.MANIFEST_LOADED,{levels:[p],audioTracks:[],url:c,stats:s,networkDetails:w,sessionData:null})}if(s.parsing.end=performance.now(),b.needSidxRanges){var x,P=(x=b.fragments[0].initSegment)===null||x===void 0?void 0:x.url;this.load({url:P,isSidxRequest:!0,type:v,level:C,levelDetails:b,id:h,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}l.levelDetails=b,this.handlePlaylistLoaded(o,s,l,w)},y.handleSidxRequest=function(o,s){var l=Object(I.parseSegmentIndex)(new Uint8Array(o.data));if(!l)return;var w=l.references,m=s.levelDetails;w.forEach(function(h,C){var v=h.info,c=m.fragments[C];c.byteRange.length===0&&c.setByteRange(String(1+v.end-v.start)+"@"+String(v.start)),c.initSegment&&c.initSegment.setByteRange(String(l.moovEndOffset)+"@0")})},y.handleManifestParsingError=function(o,s,l,w){this.hls.trigger(M.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===_.PlaylistContextType.MANIFEST,url:o.url,reason:l,response:o,context:s,networkDetails:w})},y.handleNetworkError=function(o,s,l,w){l===void 0&&(l=!1),F.logger.warn("[playlist-loader]: A network "+(l?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var m=O.ErrorDetails.UNKNOWN,h=!1,C=this.getInternalLoader(o);switch(o.type){case _.PlaylistContextType.MANIFEST:m=l?O.ErrorDetails.MANIFEST_LOAD_TIMEOUT:O.ErrorDetails.MANIFEST_LOAD_ERROR,h=!0;break;case _.PlaylistContextType.LEVEL:m=l?O.ErrorDetails.LEVEL_LOAD_TIMEOUT:O.ErrorDetails.LEVEL_LOAD_ERROR,h=!1;break;case _.PlaylistContextType.AUDIO_TRACK:m=l?O.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:O.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,h=!1;break;case _.PlaylistContextType.SUBTITLE_TRACK:m=l?O.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:O.ErrorDetails.SUBTITLE_LOAD_ERROR,h=!1;break}C&&this.resetInternalLoader(o.type);var v={type:O.ErrorTypes.NETWORK_ERROR,details:m,fatal:h,url:o.url,loader:C,context:o,networkDetails:s};w&&(v.response=w),this.hls.trigger(M.Events.ERROR,v)},y.handlePlaylistLoaded=function(o,s,l,w){var m=l.type,h=l.level,C=l.id,v=l.groupId,c=l.loader,f=l.levelDetails,d=l.deliveryDirectives;if(!(f!=null&&f.targetduration)){this.handleManifestParsingError(o,l,"invalid target duration",w);return}if(!c)return;f.live&&(c.getCacheAge&&(f.ageHeader=c.getCacheAge()||0),(!c.getCacheAge||isNaN(f.ageHeader))&&(f.ageHeader=0));switch(m){case _.PlaylistContextType.MANIFEST:case _.PlaylistContextType.LEVEL:this.hls.trigger(M.Events.LEVEL_LOADED,{details:f,level:h||0,id:C||0,stats:s,networkDetails:w,deliveryDirectives:d});break;case _.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(M.Events.AUDIO_TRACK_LOADED,{details:f,id:C||0,groupId:v||"",stats:s,networkDetails:w,deliveryDirectives:d});break;case _.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(M.Events.SUBTITLE_TRACK_LOADED,{details:f,id:C||0,groupId:v||"",stats:s,networkDetails:w,deliveryDirectives:d});break}},S}();G.default=L},"./src/polyfills/number.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"isFiniteNumber",function(){return W}),D.d(G,"MAX_SAFE_INTEGER",function(){return M});var W=Number.isFinite||function(O){return typeof O=="number"&&isFinite(O)},M=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(Z,G,D){"use strict";D.r(G);var W=function(){function M(){}return M.getSilentFrame=function(F,I){switch(F){case"mp4a.40.2":if(I===1)return new Uint8Array([0,200,0,128,35,128]);if(I===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(I===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(I===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(I===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(I===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(I===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(I===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(I===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},M}();G.default=W},"./src/remux/mp4-generator.ts":function(Z,G,D){"use strict";D.r(G);var W=Math.pow(2,32)-1,M=function(){function O(){}return O.init=function(){O.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var I;for(I in O.types)O.types.hasOwnProperty(I)&&(O.types[I]=[I.charCodeAt(0),I.charCodeAt(1),I.charCodeAt(2),I.charCodeAt(3)]);var R=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),_=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);O.HDLR_TYPES={video:R,audio:_};var g=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]);O.STTS=O.STSC=O.STCO=T,O.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),O.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),O.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),O.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var A=new Uint8Array([105,115,111,109]),L=new Uint8Array([97,118,99,49]),S=new Uint8Array([0,0,0,1]);O.FTYP=O.box(O.types.ftyp,A,S,A,L),O.DINF=O.box(O.types.dinf,O.box(O.types.dref,g))},O.box=function(I){for(var R=8,_=arguments.length,g=new Array(_>1?_-1:0),T=1;T<_;T++)g[T-1]=arguments[T];for(var A=g.length,L=A;A--;)R+=g[A].byteLength;var S=new Uint8Array(R);for(S[0]=R>>24&255,S[1]=R>>16&255,S[2]=R>>8&255,S[3]=R&255,S.set(I,4),A=0,R=8;A<L;A++)S.set(g[A],R),R+=g[A].byteLength;return S},O.hdlr=function(I){return O.box(O.types.hdlr,O.HDLR_TYPES[I])},O.mdat=function(I){return O.box(O.types.mdat,I)},O.mdhd=function(I,R){R*=I;var _=Math.floor(R/(W+1)),g=Math.floor(R%(W+1));return O.box(O.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&255,_>>24,_>>16&255,_>>8&255,_&255,g>>24,g>>16&255,g>>8&255,g&255,85,196,0,0]))},O.mdia=function(I){return O.box(O.types.mdia,O.mdhd(I.timescale,I.duration),O.hdlr(I.type),O.minf(I))},O.mfhd=function(I){return O.box(O.types.mfhd,new Uint8Array([0,0,0,0,I>>24,I>>16&255,I>>8&255,I&255]))},O.minf=function(I){return I.type==="audio"?O.box(O.types.minf,O.box(O.types.smhd,O.SMHD),O.DINF,O.stbl(I)):O.box(O.types.minf,O.box(O.types.vmhd,O.VMHD),O.DINF,O.stbl(I))},O.moof=function(I,R,_){return O.box(O.types.moof,O.mfhd(I),O.traf(_,R))},O.moov=function(I){for(var R=I.length,_=[];R--;)_[R]=O.trak(I[R]);return O.box.apply(null,[O.types.moov,O.mvhd(I[0].timescale,I[0].duration)].concat(_).concat(O.mvex(I)))},O.mvex=function(I){for(var R=I.length,_=[];R--;)_[R]=O.trex(I[R]);return O.box.apply(null,[O.types.mvex].concat(_))},O.mvhd=function(I,R){R*=I;var _=Math.floor(R/(W+1)),g=Math.floor(R%(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,I>>24&255,I>>16&255,I>>8&255,I&255,_>>24,_>>16&255,_>>8&255,_&255,g>>24,g>>16&255,g>>8&255,g&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return O.box(O.types.mvhd,T)},O.sdtp=function(I){var R=I.samples||[],_=new Uint8Array(4+R.length),g,T;for(g=0;g<R.length;g++)T=R[g].flags,_[g+4]=T.dependsOn<<4|T.isDependedOn<<2|T.hasRedundancy;return O.box(O.types.sdtp,_)},O.stbl=function(I){return O.box(O.types.stbl,O.stsd(I),O.box(O.types.stts,O.STTS),O.box(O.types.stsc,O.STSC),O.box(O.types.stsz,O.STSZ),O.box(O.types.stco,O.STCO))},O.avc1=function(I){var R=[],_=[],g,T,A;for(g=0;g<I.sps.length;g++)T=I.sps[g],A=T.byteLength,R.push(A>>>8&255),R.push(A&255),R=R.concat(Array.prototype.slice.call(T));for(g=0;g<I.pps.length;g++)T=I.pps[g],A=T.byteLength,_.push(A>>>8&255),_.push(A&255),_=_.concat(Array.prototype.slice.call(T));var L=O.box(O.types.avcC,new Uint8Array([1,R[3],R[4],R[5],252|3,224|I.sps.length].concat(R).concat([I.pps.length]).concat(_))),S=I.width,y=I.height,u=I.pixelRatio[0],o=I.pixelRatio[1];return O.box(O.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,S>>8&255,S&255,y>>8&255,y&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),L,O.box(O.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),O.box(O.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,o>>24,o>>16&255,o>>8&255,o&255])))},O.esds=function(I){var R=I.config.length;return new Uint8Array([0,0,0,0,3,23+R,0,1,0,4,15+R,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([R]).concat(I.config).concat([6,1,2]))},O.mp4a=function(I){var R=I.samplerate;return O.box(O.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,I.channelCount,0,16,0,0,0,0,R>>8&255,R&255,0,0]),O.box(O.types.esds,O.esds(I)))},O.mp3=function(I){var R=I.samplerate;return O.box(O.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,I.channelCount,0,16,0,0,0,0,R>>8&255,R&255,0,0]))},O.stsd=function(I){return I.type==="audio"?!I.isAAC&&I.codec==="mp3"?O.box(O.types.stsd,O.STSD,O.mp3(I)):O.box(O.types.stsd,O.STSD,O.mp4a(I)):O.box(O.types.stsd,O.STSD,O.avc1(I))},O.tkhd=function(I){var R=I.id,_=I.duration*I.timescale,g=I.width,T=I.height,A=Math.floor(_/(W+1)),L=Math.floor(_%(W+1));return O.box(O.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,R>>24&255,R>>16&255,R>>8&255,R&255,0,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,L>>24,L>>16&255,L>>8&255,L&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,g>>8&255,g&255,0,0,T>>8&255,T&255,0,0]))},O.traf=function(I,R){var _=O.sdtp(I),g=I.id,T=Math.floor(R/(W+1)),A=Math.floor(R%(W+1));return O.box(O.types.traf,O.box(O.types.tfhd,new Uint8Array([0,0,0,0,g>>24,g>>16&255,g>>8&255,g&255])),O.box(O.types.tfdt,new Uint8Array([1,0,0,0,T>>24,T>>16&255,T>>8&255,T&255,A>>24,A>>16&255,A>>8&255,A&255])),O.trun(I,_.length+16+20+8+16+8+8),_)},O.trak=function(I){return I.duration=I.duration||4294967295,O.box(O.types.trak,O.tkhd(I),O.mdia(I))},O.trex=function(I){var R=I.id;return O.box(O.types.trex,new Uint8Array([0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},O.trun=function(I,R){var _=I.samples||[],g=_.length,T=12+16*g,A=new Uint8Array(T),L,S,y,u,o,s;for(R+=8+T,A.set([0,0,15,1,g>>>24&255,g>>>16&255,g>>>8&255,g&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255],0),L=0;L<g;L++)S=_[L],y=S.duration,u=S.size,o=S.flags,s=S.cts,A.set([y>>>24&255,y>>>16&255,y>>>8&255,y&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*L);return O.box(O.types.trun,A)},O.initSegment=function(I){O.types||O.init();var R=O.moov(I),_=new Uint8Array(O.FTYP.byteLength+R.byteLength);return _.set(O.FTYP),_.set(R,O.FTYP.byteLength),_},O}();M.types=void 0,M.HDLR_TYPES=void 0,M.STTS=void 0,M.STSC=void 0,M.STCO=void 0,M.STSZ=void 0,M.VMHD=void 0,M.SMHD=void 0,M.STSD=void 0,M.FTYP=void 0,M.DINF=void 0,G.default=M},"./src/remux/mp4-remuxer.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return s}),D.d(G,"normalizePts",function(){return l});var W=D("./src/polyfills/number.ts"),M=D("./src/remux/aac-helper.ts"),O=D("./src/remux/mp4-generator.ts"),F=D("./src/events.ts"),I=D("./src/errors.ts"),R=D("./src/utils/logger.ts"),_=D("./src/types/loader.ts"),g=D("./src/utils/timescale-conversion.ts");function T(){return T=Object.assign||function(C){for(var v=1;v<arguments.length;v++){var c=arguments[v];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(C[f]=c[f])}return C},T.apply(this,arguments)}var A=10*1e3,L=1024,S=1152,y=null,u=null,o=!1,s=function(){function C(c,f,d,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=c,this.config=f,this.typeSupported=d,this.ISGenerated=!1,y===null){var b=navigator.userAgent||"",p=b.match(/Chrome\/(\d+)/i);y=p?parseInt(p[1]):0}if(u===null){var x=navigator.userAgent.match(/Safari\/(\d+)/i);u=x?parseInt(x[1]):0}o=!!y&&y<75||!!u&&u<600}var v=C.prototype;return v.destroy=function(){},v.resetTimeStamp=function(f){R.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=f},v.resetNextTimestamp=function(){R.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},v.resetInitSegment=function(){R.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},v.getVideoStartPts=function(f){var d=!1,a=f.reduce(function(b,p){var x=p.pts-b;return x<-4294967296?(d=!0,l(b,p.pts)):x>0?b:p.pts},f[0].pts);return d&&R.logger.debug("PTS rollover detected"),a},v.remux=function(f,d,a,b,p,x,P,N){var K,V,B,U,Y,ee,oe=p,de=p,Te=f.pid>-1,ge=d.pid>-1,pe=d.samples.length,fe=f.samples.length>0,me=pe>1,ae=(!Te||fe)&&(!ge||me)||this.ISGenerated||P;if(ae){this.ISGenerated||(B=this.generateIS(f,d,p));var ue=this.isVideoContiguous,Ee=-1;if(me&&(Ee=w(d.samples),!ue&&this.config.forceKeyFrameOnDiscontinuity))if(ee=!0,Ee>0){R.logger.warn("[mp4-remuxer]: Dropped "+Ee+" out of "+pe+" video samples due to a missing keyframe");var Ie=this.getVideoStartPts(d.samples);d.samples=d.samples.slice(Ee),d.dropped+=Ee,de+=(d.samples[0].pts-Ie)/(d.timescale||9e4)}else Ee===-1&&(R.logger.warn("[mp4-remuxer]: No keyframe found out of "+pe+" video samples"),ee=!1);if(this.ISGenerated){if(fe&&me){var ke=this.getVideoStartPts(d.samples),Xe=l(f.samples[0].pts,ke)-ke,Ne=Xe/d.inputTimeScale;oe+=Math.max(0,Ne),de+=Math.max(0,-Ne)}if(fe){if(f.samplerate||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),B=this.generateIS(f,d,p)),V=this.remuxAudio(f,oe,this.isAudioContiguous,x,ge||me||N===_.PlaylistLevelType.AUDIO?de:void 0),me){var we=V?V.endPTS-V.startPTS:0;d.inputTimeScale||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),B=this.generateIS(f,d,p)),K=this.remuxVideo(d,de,ue,we)}}else me&&(K=this.remuxVideo(d,de,ue,0));K&&(K.firstKeyFrame=Ee,K.independent=Ee!==-1)}}return this.ISGenerated&&(a.samples.length&&(Y=this.remuxID3(a,p)),b.samples.length&&(U=this.remuxText(b,p))),{audio:V,video:K,initSegment:B,independent:ee,text:U,id3:Y}},v.generateIS=function(f,d,a){var b=f.samples,p=d.samples,x=this.typeSupported,P={},N=!Object(W.isFiniteNumber)(this._initPTS),K="audio/mp4",V,B,U;if(N&&(V=B=Infinity),f.config&&b.length&&(f.timescale=f.samplerate,f.isAAC||(x.mpeg?(K="audio/mpeg",f.codec=""):x.mp3&&(f.codec="mp3")),P.audio={id:"audio",container:K,codec:f.codec,initSegment:!f.isAAC&&x.mpeg?new Uint8Array(0):O.default.initSegment([f]),metadata:{channelCount:f.channelCount}},N&&(U=f.inputTimeScale,V=B=b[0].pts-Math.round(U*a))),d.sps&&d.pps&&p.length&&(d.timescale=d.inputTimeScale,P.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:O.default.initSegment([d]),metadata:{width:d.width,height:d.height}},N)){U=d.inputTimeScale;var Y=this.getVideoStartPts(p),ee=Math.round(U*a);B=Math.min(B,l(p[0].dts,Y)-ee),V=Math.min(V,Y-ee)}if(Object.keys(P).length)return this.ISGenerated=!0,N&&(this._initPTS=V,this._initDTS=B),{tracks:P,initPTS:V,timescale:U}},v.remuxVideo=function(f,d,a,b){var p=f.inputTimeScale,x=f.samples,P=[],N=x.length,K=this._initPTS,V=this.nextAvcDts,B=8,U,Y,ee,oe=Number.POSITIVE_INFINITY,de=Number.NEGATIVE_INFINITY,Te=0,ge=!1;if(!a||V===null){var pe=d*p,fe=x[0].pts-l(x[0].dts,x[0].pts);V=pe-fe}for(var me=0;me<N;me++){var ae=x[me];if(ae.pts=l(ae.pts-K,V),ae.dts=l(ae.dts-K,V),ae.dts>ae.pts){var ue=9e4*.2;Te=Math.max(Math.min(Te,ae.pts-ae.dts),-1*ue)}ae.dts<x[me>0?me-1:me].dts&&(ge=!0)}ge&&x.sort(function(Tt,ct){var ot=Tt.dts-ct.dts,Ct=Tt.pts-ct.pts;return ot||Ct}),Y=x[0].dts,ee=x[x.length-1].dts;var Ee=Math.round((ee-Y)/(N-1));if(Te<0){if(Te<Ee*-2){R.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(g.toMsFromMpegTsClock)(-Ee,!0)+" ms");for(var Ie=Te,ke=0;ke<N;ke++)x[ke].dts=Ie=Math.max(Ie,x[ke].pts-Ee),x[ke].pts=Math.max(Ie,x[ke].pts)}else{R.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(g.toMsFromMpegTsClock)(Te,!0)+" ms to overcome this issue");for(var Xe=0;Xe<N;Xe++)x[Xe].dts=x[Xe].dts+Te}Y=x[0].dts}if(a){var Ne=Y-V,we=Ne>Ee,Ce=Ne<-1;if(we||Ce){we?R.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(Ne,!0)+" ms ("+Ne+"dts) hole between fragments detected, filling it"):R.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(-Ne,!0)+" ms ("+Ne+"dts) overlapping between fragments detected"),Y=V;var Re=x[0].pts-Ne;x[0].dts=Y,x[0].pts=Re,R.logger.log("Video: First PTS/DTS adjusted: "+Object(g.toMsFromMpegTsClock)(Re,!0)+"/"+Object(g.toMsFromMpegTsClock)(Y,!0)+", delta: "+Object(g.toMsFromMpegTsClock)(Ne,!0)+" ms")}}o&&(Y=Math.max(0,Y));for(var Be=0,je=0,Ae=0;Ae<N;Ae++){for(var Le=x[Ae],Je=Le.units,Ye=Je.length,He=0,Ke=0;Ke<Ye;Ke++)He+=Je[Ke].data.length;je+=He,Be+=Ye,Le.length=He,Le.dts=Math.max(Le.dts,Y),Le.pts=Math.max(Le.pts,Le.dts,0),oe=Math.min(Le.pts,oe),de=Math.max(Le.pts,de)}ee=x[N-1].dts;var et=je+4*Be+8,Ve;try{Ve=new Uint8Array(et)}catch(Tt){this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:et,reason:"fail allocating video mdat "+et});return}var Ge=new DataView(Ve.buffer);Ge.setUint32(0,et),Ve.set(O.default.types.mdat,4);for(var ye=0;ye<N;ye++){for(var Ze=x[ye],ze=Ze.units,be=0,_e=0,le=ze.length;_e<le;_e++){var ne=ze[_e],ie=ne.data,X=ne.data.byteLength;Ge.setUint32(B,X),B+=4,Ve.set(ie,B),B+=X,be+=4+X}if(ye<N-1)U=x[ye+1].dts-Ze.dts;else{var $=this.config,Q=Ze.dts-x[ye>0?ye-1:ye].dts;if($.stretchShortVideoTrack&&this.nextAudioPts!==null){var te=Math.floor($.maxBufferHole*p),se=(b?oe+b*p:this.nextAudioPts)-Ze.pts;se>te?(U=se-Q,U<0&&(U=Q),R.logger.log("[mp4-remuxer]: It is approximately "+se/90+" ms to the next segment; using duration "+U/90+" ms for the last video frame.")):U=Q}else U=Q}var ve=Math.round(Ze.pts-Ze.dts);P.push(new m(Ze.key,U,be,ve))}if(P.length&&y&&y<70){var Se=P[0].flags;Se.dependsOn=2,Se.isNonSync=0}console.assert(U!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ee+U,this.isVideoContiguous=!0;var We=O.default.moof(f.sequenceNumber++,Y,T({},f,{samples:P})),rt="video",tt={data1:We,data2:Ve,startPTS:oe/p,endPTS:(de+U)/p,startDTS:Y/p,endDTS:V/p,type:rt,hasAudio:!1,hasVideo:!0,nb:P.length,dropped:f.dropped};return f.samples=[],f.dropped=0,console.assert(Ve.length,"MDAT length must not be zero"),tt},v.remuxAudio=function(f,d,a,b,p){var x=f.inputTimeScale,P=f.samplerate?f.samplerate:x,N=x/P,K=f.isAAC?L:S,V=K*N,B=this._initPTS,U=!f.isAAC&&this.typeSupported.mpeg,Y=[],ee=f.samples,oe=U?0:8,de=this.nextAudioPts||-1,Te=d*x;if(this.isAudioContiguous=a=a||ee.length&&de>0&&(b&&Math.abs(Te-de)<9e3||Math.abs(l(ee[0].pts-B,Te)-de)<20*V),ee.forEach(function(ie){ie.pts=l(ie.pts-B,Te)}),!a||de<0){if(ee=ee.filter(function(ie){return ie.pts>=0}),!ee.length)return;p===0?de=0:b?de=Math.max(0,Te):de=ee[0].pts}if(f.isAAC)for(var ge=p!==void 0,pe=this.config.maxAudioFramesDrift,fe=0,me=de;fe<ee.length;fe++){var ae=ee[fe],ue=ae.pts,Ee=ue-me,Ie=Math.abs(1e3*Ee/x);if(Ee<=-pe*V&&ge)fe===0&&(R.logger.warn("Audio frame @ "+(ue/x).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Ee/x)+" ms."),this.nextAudioPts=de=me=ue);else if(Ee>=pe*V&&Ie<A&&ge){var ke=Math.round(Ee/V);me=ue-ke*V,me<0&&(ke--,me+=V),fe===0&&(this.nextAudioPts=de=me),R.logger.warn("[mp4-remuxer]: Injecting "+ke+" audio frame @ "+(me/x).toFixed(3)+"s due to "+Math.round(1e3*Ee/x)+" ms gap.");for(var Xe=0;Xe<ke;Xe++){var Ne=Math.max(me,0),we=M.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);we||(R.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),we=ae.unit.subarray()),ee.splice(fe,0,{unit:we,pts:Ne}),me+=V,fe++}}ae.pts=me,me+=V}for(var Ce=null,Re=null,Be,je=0,Ae=ee.length;Ae--;)je+=ee[Ae].unit.byteLength;for(var Le=0,Je=ee.length;Le<Je;Le++){var Ye=ee[Le],He=Ye.unit,Ke=Ye.pts;if(Re!==null){var et=Y[Le-1];et.duration=Math.round((Ke-Re)/N)}else if(a&&f.isAAC&&(Ke=de),Ce=Ke,je>0){je+=oe;try{Be=new Uint8Array(je)}catch(ie){this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:je,reason:"fail allocating audio mdat "+je});return}if(!U){var Ve=new DataView(Be.buffer);Ve.setUint32(0,je),Be.set(O.default.types.mdat,4)}}else return;Be.set(He,oe);var Ge=He.byteLength;oe+=Ge,Y.push(new m(!0,K,Ge,0)),Re=Ke}var ye=Y.length;if(!ye)return;var Ze=Y[Y.length-1];this.nextAudioPts=de=Re+N*Ze.duration;var ze=U?new Uint8Array(0):O.default.moof(f.sequenceNumber++,Ce/N,T({},f,{samples:Y}));f.samples=[];var be=Ce/x,_e=de/x,le="audio",ne={data1:ze,data2:Be,startPTS:be,endPTS:_e,startDTS:be,endDTS:_e,type:le,hasAudio:!0,hasVideo:!1,nb:ye};return this.isAudioContiguous=!0,console.assert(Be.length,"MDAT length must not be zero"),ne},v.remuxEmptyAudio=function(f,d,a,b){var p=f.inputTimeScale,x=f.samplerate?f.samplerate:p,P=p/x,N=this.nextAudioPts,K=(N!==null?N:b.startDTS*p)+this._initDTS,V=b.endDTS*p+this._initDTS,B=P*L,U=Math.ceil((V-K)/B),Y=M.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);if(R.logger.warn("[mp4-remuxer]: remux empty Audio"),!Y){R.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ee=[],oe=0;oe<U;oe++){var de=K+oe*B;ee.push({unit:Y,pts:de,dts:de})}return f.samples=ee,this.remuxAudio(f,d,a,!1)},v.remuxID3=function(f,d){var a=f.samples.length;if(!a)return;for(var b=f.inputTimeScale,p=this._initPTS,x=this._initDTS,P=0;P<a;P++){var N=f.samples[P];N.pts=l(N.pts-p,d*b)/b,N.dts=l(N.dts-x,d*b)/b}var K=f.samples;return f.samples=[],{samples:K}},v.remuxText=function(f,d){var a=f.samples.length;if(!a)return;for(var b=f.inputTimeScale,p=this._initPTS,x=0;x<a;x++){var P=f.samples[x];P.pts=l(P.pts-p,d*b)/b}f.samples.sort(function(K,V){return K.pts-V.pts});var N=f.samples;return f.samples=[],{samples:N}},C}();function l(C,v){var c;if(v===null)return C;for(v<C?c=-8589934592:c=8589934592;Math.abs(C-v)>4294967296;)C+=c;return C}function w(C){for(var v=0;v<C.length;v++)if(C[v].key)return v;return-1}var m=function(v,c,f,d){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=c,this.size=f,this.cts=d,this.flags=new h(v)},h=function(v){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=v?2:1,this.isNonSync=v?0:1}},"./src/remux/passthrough-remuxer.ts":function(Z,G,D){"use strict";D.r(G);var W=D("./src/polyfills/number.ts"),M=D("./src/utils/mp4-tools.ts"),O=D("./src/loader/fragment.ts"),F=D("./src/utils/logger.ts"),I=function(){function g(){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=g.prototype;return T.destroy=function(){},T.resetTimeStamp=function(L){this.initPTS=L,this.lastEndDTS=null},T.resetNextTimestamp=function(){this.lastEndDTS=null},T.resetInitSegment=function(L,S,y){this.audioCodec=S,this.videoCodec=y,this.generateInitSegment(L),this.emitInitSegment=!0},T.generateInitSegment=function(L){var S=this.audioCodec,y=this.videoCodec;if(!L||!L.byteLength){this.initTracks=void 0,this.initData=void 0;return}var u=this.initData=Object(M.parseInitSegment)(L);S||(S=_(u.audio,O.ElementaryStreamTypes.AUDIO)),y||(y=_(u.video,O.ElementaryStreamTypes.VIDEO));var o={};u.audio&&u.video?o.audiovideo={container:"video/mp4",codec:S+","+y,initSegment:L,id:"main"}:u.audio?o.audio={container:"audio/mp4",codec:S,initSegment:L,id:"audio"}:u.video?o.video={container:"video/mp4",codec:y,initSegment:L,id:"main"}:F.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},T.remux=function(L,S,y,u,o){var s=this.initPTS,l=this.lastEndDTS,w={audio:void 0,video:void 0,text:u,id3:y,initSegment:void 0};Object(W.isFiniteNumber)(l)||(l=this.lastEndDTS=o||0);var m=S.samples;if(!m||!m.length)return w;var h={initPTS:void 0,timescale:1},C=this.initData;if((!C||!C.length)&&(this.generateInitSegment(m),C=this.initData),!C||!C.length)return F.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),w;this.emitInitSegment&&(h.tracks=this.initTracks,this.emitInitSegment=!1),Object(W.isFiniteNumber)(s)||(this.initPTS=h.initPTS=s=R(C,m,l));var v=Object(M.getDuration)(m,C),c=l,f=v+c;Object(M.offsetStartDTS)(C,m,s),v>0?this.lastEndDTS=f:(F.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!C.audio,a=!!C.video,b="";d&&(b+="audio"),a&&(b+="video");var p={data1:m,startPTS:c,startDTS:c,endPTS:f,endDTS:f,type:b,hasAudio:d,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=u,w.id3=y,w.initSegment=h,w},g}(),R=function(T,A,L){return Object(M.getStartDTS)(T,A)-L};function _(g,T){var A=g==null?void 0:g.codec;return A&&A.length>4?A:A==="hvc1"?"hvc1.1.c.L120.90":A==="av01"?"av01.0.04M.08":A==="avc1"||T===O.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}G.default=I},"./src/task-loop.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return W});var W=function(){function M(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var O=M.prototype;return O.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},O.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},O.onHandlerDestroyed=function(){},O.hasInterval=function(){return!!this._tickInterval},O.hasNextTick=function(){return!!this._tickTimer},O.setInterval=function(I){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,I),!0)},O.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},O.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},O.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},O.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},O.doTick=function(){},M}()},"./src/types/cmcd.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"CMCDVersion",function(){return W}),D.d(G,"CMCDObjectType",function(){return M}),D.d(G,"CMCDStreamingFormat",function(){return O}),D.d(G,"CMCDStreamType",function(){return F});var W=1,M;(function(I){I.MANIFEST="m",I.AUDIO="a",I.VIDEO="v",I.MUXED="av",I.INIT="i",I.CAPTION="c",I.TIMED_TEXT="tt",I.KEY="k",I.OTHER="o"})(M||(M={}));var O;(function(I){I.DASH="d",I.HLS="h",I.SMOOTH="s",I.OTHER="o"})(O||(O={}));var F;(function(I){I.VOD="v",I.LIVE="l"})(F||(F={}))},"./src/types/level.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"HlsSkip",function(){return O}),D.d(G,"getSkipValue",function(){return F}),D.d(G,"HlsUrlParameters",function(){return I}),D.d(G,"Level",function(){return R});function W(_,g){for(var T=0;T<g.length;T++){var A=g[T];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(_,A.key,A)}}function M(_,g,T){return g&&W(_.prototype,g),T&&W(_,T),_}var O;(function(_){_.No="",_.Yes="YES",_.v2="v2"})(O||(O={}));function F(_,g){var T=_.canSkipUntil,A=_.canSkipDateRanges,L=_.endSN,S=g!==void 0?g-L:0;return T&&S<T?A?O.v2:O.Yes:O.No}var I=function(){function _(T,A,L){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=T,this.part=A,this.skip=L}var g=_.prototype;return g.addDirectives=function(A){var L=new self.URL(A);return this.msn!==void 0&&L.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&L.searchParams.set("_HLS_part",this.part.toString()),this.skip&&L.searchParams.set("_HLS_skip",this.skip),L.toString()},_}(),R=function(){function _(g){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=[g.url],this.attrs=g.attrs,this.bitrate=g.bitrate,g.details&&(this.details=g.details),this.id=g.id||0,this.name=g.name,this.width=g.width||0,this.height=g.height||0,this.audioCodec=g.audioCodec,this.videoCodec=g.videoCodec,this.unknownCodecs=g.unknownCodecs,this.codecSet=[g.videoCodec,g.audioCodec].filter(function(T){return T}).join(",").replace(/\.[^.,]+/g,"")}return M(_,[{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 A=T%this.url.length;this._urlId!==A&&(this.details=void 0,this._urlId=A)}}]),_}()},"./src/types/loader.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"PlaylistContextType",function(){return W}),D.d(G,"PlaylistLevelType",function(){return M});var W;(function(O){O.MANIFEST="manifest",O.LEVEL="level",O.AUDIO_TRACK="audioTrack",O.SUBTITLE_TRACK="subtitleTrack"})(W||(W={}));var M;(function(O){O.MAIN="main",O.AUDIO="audio",O.SUBTITLE="subtitle"})(M||(M={}))},"./src/types/transmuxer.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"ChunkMetadata",function(){return W});var W=function(F,I,R,_,g,T){_===void 0&&(_=0),g===void 0&&(g=-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=M(),this.buffering={audio:M(),video:M(),audiovideo:M()},this.level=F,this.sn=I,this.id=R,this.size=_,this.part=g,this.partial=T};function M(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"AttrList",function(){return O});var W=/^(\d+)x(\d+)$/,M=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,O=function(){function F(R){typeof R=="string"&&(R=F.parseAttrList(R));for(var _ in R)R.hasOwnProperty(_)&&(this[_]=R[_])}var I=F.prototype;return I.decimalInteger=function(_){var g=parseInt(this[_],10);return g>Number.MAX_SAFE_INTEGER?Infinity:g},I.hexadecimalInteger=function(_){if(this[_]){var g=(this[_]||"0x").slice(2);g=(g.length&1?"0":"")+g;for(var T=new Uint8Array(g.length/2),A=0;A<g.length/2;A++)T[A]=parseInt(g.slice(A*2,A*2+2),16);return T}else return null},I.hexadecimalIntegerAsNumber=function(_){var g=parseInt(this[_],16);return g>Number.MAX_SAFE_INTEGER?Infinity:g},I.decimalFloatingPoint=function(_){return parseFloat(this[_])},I.optionalFloat=function(_,g){var T=this[_];return T?parseFloat(T):g},I.enumeratedString=function(_){return this[_]},I.bool=function(_){return this[_]==="YES"},I.decimalResolution=function(_){var g=W.exec(this[_]);return g===null?void 0:{width:parseInt(g[1],10),height:parseInt(g[2],10)}},F.parseAttrList=function(_){var g,T={},A='"';for(M.lastIndex=0;(g=M.exec(_))!==null;){var L=g[2];L.indexOf(A)===0&&L.lastIndexOf(A)===L.length-1&&(L=L.slice(1,-1)),T[g[1]]=L}return T},F}()},"./src/utils/binary-search.ts":function(Z,G,D){"use strict";D.r(G);var W={search:function(O,F){for(var I=0,R=O.length-1,_=null,g=null;I<=R;){_=(I+R)/2|0,g=O[_];var T=F(g);if(T>0)I=_+1;else if(T<0)R=_-1;else return g}return null}};G.default=W},"./src/utils/buffer-helper.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"BufferHelper",function(){return O});var W=D("./src/utils/logger.ts"),M={length:0,start:function(){return 0},end:function(){return 0}},O=function(){function F(){}return F.isBuffered=function(R,_){try{if(R){for(var g=F.getBuffered(R),T=0;T<g.length;T++)if(_>=g.start(T)&&_<=g.end(T))return!0}}catch(A){}return!1},F.bufferInfo=function(R,_,g){try{if(R){var T=F.getBuffered(R),A=[],L;for(L=0;L<T.length;L++)A.push({start:T.start(L),end:T.end(L)});return this.bufferedInfo(A,_,g)}}catch(S){}return{len:0,start:_,end:_,nextStart:void 0}},F.bufferedInfo=function(R,_,g){_=Math.max(0,_),R.sort(function(h,C){var v=h.start-C.start;return v||C.end-h.end});var T=[];if(g)for(var A=0;A<R.length;A++){var L=T.length;if(L){var S=T[L-1].end;R[A].start-S<g?R[A].end>S&&(T[L-1].end=R[A].end):T.push(R[A])}else T.push(R[A])}else T=R;for(var y=0,u,o=_,s=_,l=0;l<T.length;l++){var w=T[l].start,m=T[l].end;if(_+g>=w&&_<m)o=w,s=m,y=s-_;else if(_+g<w){u=w;break}}return{len:y,start:o||0,end:s||0,nextStart:u}},F.getBuffered=function(R){try{return R.buffered}catch(_){return W.logger.log("failed to get media.buffered",_),M}},F}()},"./src/utils/cea-608-parser.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"Row",function(){return s}),D.d(G,"CaptionScreen",function(){return l});var W=D("./src/utils/logger.ts"),M={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},O=function(f){var d=f;return M.hasOwnProperty(f)&&(d=M[f]),String.fromCharCode(d)},F=15,I=100,R={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},_={17:2,18:4,21:6,22:8,23:10,19:13,20:15},g={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},A=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],L;(function(c){c[c.ERROR=0]="ERROR",c[c.TEXT=1]="TEXT",c[c.WARNING=2]="WARNING",c[c.INFO=2]="INFO",c[c.DEBUG=3]="DEBUG",c[c.DATA=3]="DATA"})(L||(L={}));var S=function(){function c(){this.time=null,this.verboseLevel=L.ERROR}var f=c.prototype;return f.log=function(a,b){this.verboseLevel>=a&&W.logger.log(this.time+" ["+a+"] "+b)},c}(),y=function(f){for(var d=[],a=0;a<f.length;a++)d.push(f[a].toString(16));return d},u=function(){function c(d,a,b,p,x){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=d||"white",this.underline=a||!1,this.italics=b||!1,this.background=p||"black",this.flash=x||!1}var f=c.prototype;return f.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},f.setStyles=function(a){for(var b=["foreground","underline","italics","background","flash"],p=0;p<b.length;p++){var x=b[p];a.hasOwnProperty(x)&&(this[x]=a[x])}},f.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},f.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},f.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},f.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},c}(),o=function(){function c(d,a,b,p,x,P){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new u(a,b,p,x,P)}var f=c.prototype;return f.reset=function(){this.uchar=" ",this.penState.reset()},f.setChar=function(a,b){this.uchar=a,this.penState.copy(b)},f.setPenState=function(a){this.penState.copy(a)},f.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},f.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},f.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},c}(),s=function(){function c(d){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<I;a++)this.chars.push(new o);this.logger=d,this.pos=0,this.currPenState=new u}var f=c.prototype;return f.equals=function(a){for(var b=!0,p=0;p<I;p++)if(!this.chars[p].equals(a.chars[p])){b=!1;break}return b},f.copy=function(a){for(var b=0;b<I;b++)this.chars[b].copy(a.chars[b])},f.isEmpty=function(){for(var a=!0,b=0;b<I;b++)if(!this.chars[b].isEmpty()){a=!1;break}return a},f.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(L.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>I&&(this.logger.log(L.DEBUG,"Too large cursor position "+this.pos),this.pos=I)},f.moveCursor=function(a){var b=this.pos+a;if(a>1)for(var p=this.pos+1;p<b+1;p++)this.chars[p].setPenState(this.currPenState);this.setCursor(b)},f.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},f.insertChar=function(a){a>=144&&this.backSpace();var b=O(a);if(this.pos>=I){this.logger.log(L.ERROR,"Cannot insert "+a.toString(16)+" ("+b+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(b,this.currPenState),this.moveCursor(1)},f.clearFromPos=function(a){var b;for(b=a;b<I;b++)this.chars[b].reset()},f.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},f.clearToEndOfRow=function(){this.clearFromPos(this.pos)},f.getTextString=function(){for(var a=[],b=!0,p=0;p<I;p++){var x=this.chars[p].uchar;x!==" "&&(b=!1),a.push(x)}return b?"":a.join("")},f.setPenStyles=function(a){this.currPenState.setStyles(a);var b=this.chars[this.pos];b.setPenState(this.currPenState)},c}(),l=function(){function c(d){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<F;a++)this.rows.push(new s(d));this.logger=d,this.currRow=F-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var f=c.prototype;return f.reset=function(){for(var a=0;a<F;a++)this.rows[a].clear();this.currRow=F-1},f.equals=function(a){for(var b=!0,p=0;p<F;p++)if(!this.rows[p].equals(a.rows[p])){b=!1;break}return b},f.copy=function(a){for(var b=0;b<F;b++)this.rows[b].copy(a.rows[b])},f.isEmpty=function(){for(var a=!0,b=0;b<F;b++)if(!this.rows[b].isEmpty()){a=!1;break}return a},f.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},f.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},f.insertChar=function(a){var b=this.rows[this.currRow];b.insertChar(a)},f.setPen=function(a){var b=this.rows[this.currRow];b.setPenStyles(a)},f.moveCursor=function(a){var b=this.rows[this.currRow];b.moveCursor(a)},f.setCursor=function(a){this.logger.log(L.INFO,"setCursor: "+a);var b=this.rows[this.currRow];b.setCursor(a)},f.setPAC=function(a){this.logger.log(L.INFO,"pacData = "+JSON.stringify(a));var b=a.row-1;if(this.nrRollUpRows&&b<this.nrRollUpRows-1&&(b=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==b){for(var p=0;p<F;p++)this.rows[p].clear();var x=this.currRow+1-this.nrRollUpRows,P=this.lastOutputScreen;if(P){var N=P.rows[x].cueStartTime,K=this.logger.time;if(N&&K!==null&&N<K)for(var V=0;V<this.nrRollUpRows;V++)this.rows[b-this.nrRollUpRows+V+1].copy(P.rows[x+V])}}this.currRow=b;var B=this.rows[this.currRow];if(a.indent!==null){var U=a.indent,Y=Math.max(U-1,0);B.setCursor(a.indent),a.color=B.chars[Y].penState.foreground}var ee={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(ee)},f.setBkgData=function(a){this.logger.log(L.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},f.setRollUpRows=function(a){this.nrRollUpRows=a},f.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(L.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(L.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,b=this.rows.splice(a,1)[0];b.clear(),this.rows.splice(this.currRow,0,b),this.logger.log(L.INFO,"Rolling up")},f.getDisplayText=function(a){a=a||!1;for(var b=[],p="",x=-1,P=0;P<F;P++){var N=this.rows[P].getTextString();N&&(x=P+1,a?b.push("Row "+x+": '"+N+"'"):b.push(N.trim()))}return b.length>0&&(a?p="["+b.join(" | ")+"]":p=b.join(`
|
|
`)),p},f.getTextAndFormat=function(){return this.rows},c}(),w=function(){function c(d,a,b){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=d,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new l(b),this.nonDisplayedMemory=new l(b),this.lastOutputScreen=new l(b),this.currRollUpRow=this.displayedMemory.rows[F-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=b}var f=c.prototype;return f.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[F-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},f.getHandler=function(){return this.outputFilter},f.setHandler=function(a){this.outputFilter=a},f.setPAC=function(a){this.writeScreen.setPAC(a)},f.setBkgData=function(a){this.writeScreen.setBkgData(a)},f.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(L.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},f.insertChars=function(a){for(var b=0;b<a.length;b++)this.writeScreen.insertChar(a[b]);var p=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(L.INFO,p+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(L.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},f.ccRCL=function(){this.logger.log(L.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},f.ccBS=function(){if(this.logger.log(L.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},f.ccAOF=function(){},f.ccAON=function(){},f.ccDER=function(){this.logger.log(L.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},f.ccRU=function(a){this.logger.log(L.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},f.ccFON=function(){this.logger.log(L.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},f.ccRDC=function(){this.logger.log(L.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},f.ccTR=function(){this.logger.log(L.INFO,"TR"),this.setMode("MODE_TEXT")},f.ccRTD=function(){this.logger.log(L.INFO,"RTD"),this.setMode("MODE_TEXT")},f.ccEDM=function(){this.logger.log(L.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},f.ccCR=function(){this.logger.log(L.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},f.ccENM=function(){this.logger.log(L.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},f.ccEOC=function(){if(this.logger.log(L.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(L.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},f.ccTO=function(a){this.logger.log(L.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},f.ccMIDROW=function(a){var b={flash:!1};if(b.underline=a%2===1,b.italics=a>=46,b.italics)b.foreground="white";else{var p=Math.floor(a/2)-16,x=["white","green","blue","cyan","red","yellow","magenta"];b.foreground=x[p]}this.logger.log(L.INFO,"MIDROW: "+JSON.stringify(b)),this.writeScreen.setPen(b)},f.outputDataUpdate=function(a){a===void 0&&(a=!1);var b=this.logger.time;if(b===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=b:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,b,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:b),this.lastOutputScreen.copy(this.displayedMemory))},f.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},c}(),m=function(){function c(d,a,b){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var p=new S;this.channels=[null,new w(d,a,p),new w(d+1,b,p)],this.cmdHistory=v(),this.logger=p}var f=c.prototype;return f.getHandler=function(a){return this.channels[a].getHandler()},f.setHandler=function(a,b){this.channels[a].setHandler(b)},f.addData=function(a,b){var p,x,P,N=!1;this.logger.time=a;for(var K=0;K<b.length;K+=2){if(x=b[K]&127,P=b[K+1]&127,x===0&&P===0)continue;if(this.logger.log(L.DATA,"["+y([b[K],b[K+1]])+"] -> ("+y([x,P])+")"),p=this.parseCmd(x,P),p||(p=this.parseMidrow(x,P)),p||(p=this.parsePAC(x,P)),p||(p=this.parseBackgroundAttributes(x,P)),!p&&(N=this.parseChars(x,P),N)){var V=this.currentChannel;if(V&&V>0){var B=this.channels[V];B.insertChars(N)}else this.logger.log(L.WARNING,"No channel found yet. TEXT-MODE?")}!p&&!N&&this.logger.log(L.WARNING,"Couldn't parse cleaned data "+y([x,P])+" orig: "+y([b[K],b[K+1]]))}},f.parseCmd=function(a,b){var p=this.cmdHistory,x=(a===20||a===28||a===21||a===29)&&b>=32&&b<=47,P=(a===23||a===31)&&b>=33&&b<=35;if(!(x||P))return!1;if(C(a,b,p))return h(null,null,p),this.logger.log(L.DEBUG,"Repeated command ("+y([a,b])+") is dropped"),!0;var N=a===20||a===21||a===23?1:2,K=this.channels[N];return a===20||a===21||a===28||a===29?b===32?K.ccRCL():b===33?K.ccBS():b===34?K.ccAOF():b===35?K.ccAON():b===36?K.ccDER():b===37?K.ccRU(2):b===38?K.ccRU(3):b===39?K.ccRU(4):b===40?K.ccFON():b===41?K.ccRDC():b===42?K.ccTR():b===43?K.ccRTD():b===44?K.ccEDM():b===45?K.ccCR():b===46?K.ccENM():b===47&&K.ccEOC():K.ccTO(b-32),h(a,b,p),this.currentChannel=N,!0},f.parseMidrow=function(a,b){var p=0;if((a===17||a===25)&&b>=32&&b<=47){if(a===17?p=1:p=2,p!==this.currentChannel)return this.logger.log(L.ERROR,"Mismatch channel in midrow parsing"),!1;var x=this.channels[p];return x?(x.ccMIDROW(b),this.logger.log(L.DEBUG,"MIDROW ("+y([a,b])+")"),!0):!1}return!1},f.parsePAC=function(a,b){var p,x=this.cmdHistory,P=(a>=17&&a<=23||a>=25&&a<=31)&&b>=64&&b<=127,N=(a===16||a===24)&&b>=64&&b<=95;if(!(P||N))return!1;if(C(a,b,x))return h(null,null,x),!0;var K=a<=23?1:2;b>=64&&b<=95?p=K===1?R[a]:g[a]:p=K===1?_[a]:T[a];var V=this.channels[K];return V?(V.setPAC(this.interpretPAC(p,b)),h(a,b,x),this.currentChannel=K,!0):!1},f.interpretPAC=function(a,b){var p,x={color:null,italics:!1,indent:null,underline:!1,row:a};return b>95?p=b-96:p=b-64,x.underline=(p&1)===1,p<=13?x.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(p/2)]:p<=15?(x.italics=!0,x.color="white"):x.indent=Math.floor((p-16)/2)*4,x},f.parseChars=function(a,b){var p,x=null,P=null;if(a>=25?(p=2,P=a-8):(p=1,P=a),P>=17&&P<=19){var N;P===17?N=b+80:P===18?N=b+112:N=b+144,this.logger.log(L.INFO,"Special char '"+O(N)+"' in channel "+p),x=[N]}else a>=32&&a<=127&&(x=b===0?[a]:[a,b]);if(x){var K=y(x);this.logger.log(L.DEBUG,"Char codes = "+K.join(",")),h(a,b,this.cmdHistory)}return x},f.parseBackgroundAttributes=function(a,b){var p=(a===16||a===24)&&b>=32&&b<=47,x=(a===23||a===31)&&b>=45&&b<=47;if(!(p||x))return!1;var P,N={};a===16||a===24?(P=Math.floor((b-32)/2),N.background=A[P],b%2===1&&(N.background=N.background+"_semi")):b===45?N.background="transparent":(N.foreground="black",b===47&&(N.underline=!0));var K=a<=23?1:2,V=this.channels[K];return V.setBkgData(N),h(a,b,this.cmdHistory),!0},f.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var b=this.channels[a];b&&b.reset()}this.cmdHistory=v()},f.cueSplitAtTime=function(a){for(var b=0;b<this.channels.length;b++){var p=this.channels[b];p&&p.cueSplitAtTime(a)}},c}();function h(c,f,d){d.a=c,d.b=f}function C(c,f,d){return d.a===c&&d.b===f}function v(){return{a:null,b:null}}G.default=m},"./src/utils/codecs.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"isCodecType",function(){return M}),D.d(G,"isCodecSupportedInMp4",function(){return O});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 M(F,I){var R=W[I];return!!R&&R[F.slice(0,4)]===!0}function O(F,I){return MediaSource.isTypeSupported((I||"video")+'/mp4;codecs="'+F+'"')}},"./src/utils/cues.ts":function(Z,G,D){"use strict";D.r(G);var W=D("./src/utils/vttparser.ts"),M=D("./src/utils/webvtt-parser.ts"),O=D("./src/utils/texttrack-utils.ts"),F=/\s/,I={newCue:function(_,g,T,A){for(var L=[],S,y,u,o,s,l=self.VTTCue||self.TextTrackCue,w=0;w<A.rows.length;w++)if(S=A.rows[w],u=!0,o=0,s="",!S.isEmpty()){for(var m=0;m<S.chars.length;m++)F.test(S.chars[m].uchar)&&u?o++:(s+=S.chars[m].uchar,u=!1);S.cueStartTime=g,g===T&&(T+=1e-4),o>=16?o--:o++;var h=Object(W.fixLineBreaks)(s.trim()),C=Object(M.generateCueId)(g,T,h);(!_||!_.cues||!_.cues.getCueById(C))&&(y=new l(g,T,h),y.id=C,y.line=w+1,y.align="left",y.position=10+Math.min(80,Math.floor(o*8/32)*10),L.push(y))}return _&&L.length&&(L.sort(function(v,c){return v.line==="auto"||c.line==="auto"?0:v.line>8&&c.line>8?c.line-v.line:v.line-c.line}),L.forEach(function(v){return Object(O.addCueToTrack)(_,v)})),L}};G.default=I},"./src/utils/discontinuities.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"findFirstFragWithCC",function(){return F}),D.d(G,"shouldAlignOnDiscontinuities",function(){return I}),D.d(G,"findDiscontinuousReferenceFrag",function(){return R}),D.d(G,"adjustSlidingStart",function(){return g}),D.d(G,"alignStream",function(){return T}),D.d(G,"alignPDT",function(){return L}),D.d(G,"alignFragmentByPDTDelta",function(){return S}),D.d(G,"alignMediaPlaylistByPDT",function(){return y});var W=D("./src/polyfills/number.ts"),M=D("./src/utils/logger.ts"),O=D("./src/controller/level-helper.ts");function F(u,o){for(var s=null,l=0,w=u.length;l<w;l++){var m=u[l];if(m&&m.cc===o){s=m;break}}return s}function I(u,o,s){return!!(o.details&&(s.endCC>s.startCC||u&&u.cc<s.startCC))}function R(u,o){var s=u.fragments,l=o.fragments;if(!l.length||!s.length){M.logger.log("No fragments to align");return}var w=F(s,l[0].cc);if(!w||w&&!w.startPTS){M.logger.log("No frag in previous level to align on");return}return w}function _(u,o){if(u){var s=u.start+o;u.start=u.startPTS=s,u.endPTS=s+u.duration}}function g(u,o){for(var s=o.fragments,l=0,w=s.length;l<w;l++)_(s[l],u);o.fragmentHint&&_(o.fragmentHint,u),o.alignedSliding=!0}function T(u,o,s){if(!o)return;A(u,s,o),!s.alignedSliding&&o.details&&L(s,o.details),!s.alignedSliding&&o.details&&!s.skippedSegments&&Object(O.adjustSliding)(o.details,s)}function A(u,o,s){if(I(u,s,o)){var l=R(s.details,o);l&&Object(W.isFiniteNumber)(l.start)&&(M.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),g(l.start,o))}}function L(u,o){if(!o.fragments.length||!u.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,l=u.fragments[0].programDateTime,w=(l-s)/1e3+o.fragments[0].start;w&&Object(W.isFiniteNumber)(w)&&(M.logger.log("Adjusting PTS using programDateTime delta "+(l-s)+"ms, sliding:"+w.toFixed(3)+" "+u.url+" "),g(w,u))}function S(u,o){var s=u.programDateTime;if(!s)return;var l=(s-o)/1e3;u.start=u.startPTS=l,u.endPTS=l+u.duration}function y(u,o){if(!o.fragments.length||!u.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,l=o.fragments[0].start,w=s-l*1e3;u.fragments.forEach(function(m){S(m,w)}),u.fragmentHint&&S(u.fragmentHint,w),u.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(Z,G,D){"use strict";D.r(G);var W=D("./src/utils/ewma.ts"),M=function(){function O(I,R,_){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=_,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new W.default(I),this.fast_=new W.default(R)}var F=O.prototype;return F.update=function(R,_){var g=this.slow_,T=this.fast_;this.slow_.halfLife!==R&&(this.slow_=new W.default(R,g.getEstimate(),g.getTotalWeight())),this.fast_.halfLife!==_&&(this.fast_=new W.default(_,T.getEstimate(),T.getTotalWeight()))},F.sample=function(R,_){R=Math.max(R,this.minDelayMs_);var g=8*_,T=R/1e3,A=g/T;this.fast_.sample(T,A),this.slow_.sample(T,A)},F.canEstimate=function(){var R=this.fast_;return R&&R.getTotalWeight()>=this.minWeight_},F.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},F.destroy=function(){},O}();G.default=M},"./src/utils/ewma.ts":function(Z,G,D){"use strict";D.r(G);var W=function(){function M(F,I,R){I===void 0&&(I=0),R===void 0&&(R=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=F,this.alpha_=F?Math.exp(Math.log(.5)/F):0,this.estimate_=I,this.totalWeight_=R}var O=M.prototype;return O.sample=function(I,R){var _=Math.pow(this.alpha_,I);this.estimate_=R*(1-_)+_*this.estimate_,this.totalWeight_+=I},O.getTotalWeight=function(){return this.totalWeight_},O.getEstimate=function(){if(this.alpha_){var I=1-Math.pow(this.alpha_,this.totalWeight_);if(I)return this.estimate_/I}return this.estimate_},M}();G.default=W},"./src/utils/fetch-loader.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"fetchSupported",function(){return S});var W=D("./src/polyfills/number.ts"),M=D("./src/loader/load-stats.ts"),O=D("./src/demux/chunk-cache.ts");function F(l,w){l.prototype=Object.create(w.prototype),l.prototype.constructor=l,T(l,w)}function I(l){var w=typeof Map=="function"?new Map:void 0;return I=function(h){if(h===null||!g(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof w!="undefined"){if(w.has(h))return w.get(h);w.set(h,C)}function C(){return R(h,arguments,A(this).constructor)}return C.prototype=Object.create(h.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),T(C,h)},I(l)}function R(l,w,m){return _()?R=Reflect.construct:R=function(C,v,c){var f=[null];f.push.apply(f,v);var d=Function.bind.apply(C,f),a=new d;return c&&T(a,c.prototype),a},R.apply(null,arguments)}function _(){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 g(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function T(l,w){return T=Object.setPrototypeOf||function(h,C){return h.__proto__=C,h},T(l,w)}function A(l){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(m){return m.__proto__||Object.getPrototypeOf(m)},A(l)}function L(){return L=Object.assign||function(l){for(var w=1;w<arguments.length;w++){var m=arguments[w];for(var h in m)Object.prototype.hasOwnProperty.call(m,h)&&(l[h]=m[h])}return l},L.apply(this,arguments)}function S(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(l){}return!1}var y=function(){function l(m){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=m.fetchSetup||o,this.controller=new self.AbortController,this.stats=new M.LoadStats}var w=l.prototype;return w.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},w.abortInternal=function(){var h=this.response;(!h||!h.ok)&&(this.stats.aborted=!0,this.controller.abort())},w.abort=function(){var h;this.abortInternal(),(h=this.callbacks)!==null&&h!==void 0&&h.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},w.load=function(h,C,v){var c=this,f=this.stats;if(f.loading.start)throw new Error("Loader can only be used once.");f.loading.start=self.performance.now();var d=u(h,this.controller.signal),a=v.onProgress,b=h.responseType==="arraybuffer",p=b?"byteLength":"length";this.context=h,this.config=C,this.callbacks=v,this.request=this.fetchSetup(h,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){c.abortInternal(),v.onTimeout(f,h,c.response)},C.timeout),self.fetch(this.request).then(function(x){if(c.response=c.loader=x,!x.ok){var P=x.status,N=x.statusText;throw new s(N||"fetch, bad network response",P,x)}return f.loading.first=Math.max(self.performance.now(),f.loading.start),f.total=parseInt(x.headers.get("Content-Length")||"0"),a&&Object(W.isFiniteNumber)(C.highWaterMark)?c.loadProgressively(x,f,h,C.highWaterMark,a):b?x.arrayBuffer():x.text()}).then(function(x){var P=c.response;self.clearTimeout(c.requestTimeout),f.loading.end=Math.max(self.performance.now(),f.loading.first),f.loaded=f.total=x[p];var N={url:P.url,data:x};a&&!Object(W.isFiniteNumber)(C.highWaterMark)&&a(f,h,x,P),v.onSuccess(N,f,h,P)}).catch(function(x){if(self.clearTimeout(c.requestTimeout),f.aborted)return;var P=x.code||0;v.onError({code:P,text:x.message},h,x.details)})},w.getCacheAge=function(){var h=null;if(this.response){var C=this.response.headers.get("age");h=C?parseFloat(C):null}return h},w.loadProgressively=function(h,C,v,c,f){c===void 0&&(c=0);var d=new O.default,a=h.body.getReader(),b=function p(){return a.read().then(function(x){if(x.done)return d.dataLength&&f(C,v,d.flush(),h),Promise.resolve(new ArrayBuffer(0));var P=x.value,N=P.length;return C.loaded+=N,N<c||d.dataLength?(d.push(P),d.dataLength>=c&&f(C,v,d.flush(),h)):f(C,v,P,h),p()}).catch(function(){return Promise.reject()})};return b()},l}();function u(l,w){var m={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(L({},l.headers))};return l.rangeEnd&&m.headers.set("Range","bytes="+l.rangeStart+"-"+String(l.rangeEnd-1)),m}function o(l,w){return new self.Request(l.url,w)}var s=function(l){F(w,l);function w(m,h,C){var v;return v=l.call(this,m)||this,v.code=void 0,v.details=void 0,v.code=h,v.details=C,v}return w}(I(Error));G.default=y},"./src/utils/imsc1-ttml-parser.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"IMSC1_CODEC",function(){return g}),D.d(G,"parseIMSC1",function(){return S});var W=D("./src/utils/mp4-tools.ts"),M=D("./src/utils/vttparser.ts"),O=D("./src/utils/vttcue.ts"),F=D("./src/demux/id3.ts"),I=D("./src/utils/timescale-conversion.ts"),R=D("./src/utils/webvtt-parser.ts");function _(){return _=Object.assign||function(c){for(var f=1;f<arguments.length;f++){var d=arguments[f];for(var a in d)Object.prototype.hasOwnProperty.call(d,a)&&(c[a]=d[a])}return c},_.apply(this,arguments)}var g="stpp.ttml.im1t",T=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,A=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,L={left:"start",center:"center",right:"end",start:"start",end:"end"};function S(c,f,d,a,b){var p=Object(W.findBox)(new Uint8Array(c),["mdat"]);if(p.length===0){b(new Error("Could not parse IMSC1 mdat"));return}var x=p[0],P=Object(F.utf8ArrayToStr)(new Uint8Array(c,x.start,x.end-x.start)),N=Object(I.toTimescaleFromScale)(f,1,d);try{a(y(P,N))}catch(K){b(K)}}function y(c,f){var d=new DOMParser,a=d.parseFromString(c,"text/xml"),b=a.getElementsByTagName("tt")[0];if(!b)throw new Error("Invalid ttml");var p={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},x=Object.keys(p).reduce(function(B,U){return B[U]=b.getAttribute("ttp:"+U)||p[U],B},{}),P=b.getAttribute("xml:space")!=="preserve",N=o(u(b,"styling","style")),K=o(u(b,"layout","region")),V=u(b,"body","[begin]");return[].map.call(V,function(B){var U=s(B,P);if(!U||!B.hasAttribute("begin"))return null;var Y=h(B.getAttribute("begin"),x),ee=h(B.getAttribute("dur"),x),oe=h(B.getAttribute("end"),x);if(Y===null)throw m(B);if(oe===null){if(ee===null)throw m(B);oe=Y+ee}var de=new O.default(Y-f,oe-f,U);de.id=Object(R.generateCueId)(de.startTime,de.endTime,de.text);var Te=K[B.getAttribute("region")],ge=N[B.getAttribute("style")];de.position=10,de.size=80;var pe=l(Te,ge),fe=pe.textAlign;if(fe){var me=L[fe];me&&(de.lineAlign=me),de.align=fe}return _(de,pe),de}).filter(function(B){return B!==null})}function u(c,f,d){var a=c.getElementsByTagName(f)[0];return a?[].slice.call(a.querySelectorAll(d)):[]}function o(c){return c.reduce(function(f,d){var a=d.getAttribute("xml:id");return a&&(f[a]=d),f},{})}function s(c,f){return[].slice.call(c.childNodes).reduce(function(d,a,b){var p;return a.nodeName==="br"&&b?d+`
|
|
`:(p=a.childNodes)!==null&&p!==void 0&&p.length?s(a,f):f?d+a.textContent.trim().replace(/\s+/g," "):d+a.textContent},"")}function l(c,f){var d="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(b,p){var x=w(f,d,p)||w(c,d,p);return x&&(b[p]=x),b},{})}function w(c,f,d){return c.hasAttributeNS(f,d)?c.getAttributeNS(f,d):null}function m(c){return new Error("Could not parse ttml timestamp "+c)}function h(c,f){if(!c)return null;var d=Object(M.parseTimeStamp)(c);return d===null&&(T.test(c)?d=C(c,f):A.test(c)&&(d=v(c,f))),d}function C(c,f){var d=T.exec(c),a=(d[4]|0)+(d[5]|0)/f.subFrameRate;return(d[1]|0)*3600+(d[2]|0)*60+(d[3]|0)+a/f.frameRate}function v(c,f){var d=A.exec(c),a=Number(d[1]),b=d[2];switch(b){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/f.frameRate;case"t":return a/f.tickRate}return a}},"./src/utils/logger.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"enableLogs",function(){return R}),D.d(G,"logger",function(){return _});var W=function(){},M={trace:W,debug:W,log:W,warn:W,info:W,error:W},O=M;function F(g){var T=self.console[g];return T?T.bind(self.console,"["+g+"] >"):W}function I(g){for(var T=arguments.length,A=new Array(T>1?T-1:0),L=1;L<T;L++)A[L-1]=arguments[L];A.forEach(function(S){O[S]=g[S]?g[S].bind(g):F(S)})}function R(g){if(self.console&&g===!0||typeof g=="object"){I(g,"debug","log","info","warn","error");try{O.log()}catch(T){O=M}}else O=M}var _=O},"./src/utils/mediakeys-helper.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"KeySystems",function(){return W}),D.d(G,"requestMediaKeySystemAccess",function(){return M});var W;(function(O){O.WIDEVINE="com.widevine.alpha",O.PLAYREADY="com.microsoft.playready"})(W||(W={}));var M=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(Z,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(Z,G,D){"use strict";D.r(G),D.d(G,"bin2str",function(){return I}),D.d(G,"readUint16",function(){return R}),D.d(G,"readUint32",function(){return _}),D.d(G,"writeUint32",function(){return g}),D.d(G,"findBox",function(){return T}),D.d(G,"parseSegmentIndex",function(){return A}),D.d(G,"parseInitSegment",function(){return L}),D.d(G,"getStartDTS",function(){return S}),D.d(G,"getDuration",function(){return y}),D.d(G,"computeRawDurationFromSamples",function(){return u}),D.d(G,"offsetStartDTS",function(){return o}),D.d(G,"segmentValidRange",function(){return s}),D.d(G,"appendUint8Array",function(){return l});var W=D("./src/utils/typed-array.ts"),M=D("./src/loader/fragment.ts"),O=Math.pow(2,32)-1,F=[].push;function I(w){return String.fromCharCode.apply(null,w)}function R(w,m){"data"in w&&(m+=w.start,w=w.data);var h=w[m]<<8|w[m+1];return h<0?65536+h:h}function _(w,m){"data"in w&&(m+=w.start,w=w.data);var h=w[m]<<24|w[m+1]<<16|w[m+2]<<8|w[m+3];return h<0?4294967296+h:h}function g(w,m,h){"data"in w&&(m+=w.start,w=w.data),w[m]=h>>24,w[m+1]=h>>16&255,w[m+2]=h>>8&255,w[m+3]=h&255}function T(w,m){var h=[];if(!m.length)return h;var C,v,c;"data"in w?(C=w.data,v=w.start,c=w.end):(C=w,v=0,c=C.byteLength);for(var f=v;f<c;){var d=_(C,f),a=I(C.subarray(f+4,f+8)),b=d>1?f+d:c;if(a===m[0])if(m.length===1)h.push({data:C,start:f+8,end:b});else{var p=T({data:C,start:f+8,end:b},m.slice(1));p.length&&F.apply(h,p)}f=b}return h}function A(w){var m=T(w,["moov"]),h=m[0],C=h?h.end:null,v=T(w,["sidx"]);if(!v||!v[0])return null;var c=[],f=v[0],d=f.data[0],a=d===0?8:16,b=_(f,a);a+=4;var p=0,x=0;d===0?a+=8:a+=16,a+=2;var P=f.end+x,N=R(f,a);a+=2;for(var K=0;K<N;K++){var V=a,B=_(f,V);V+=4;var U=B&2147483647,Y=(B&2147483648)>>>31;if(Y===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ee=_(f,V);V+=4,c.push({referenceSize:U,subsegmentDuration:ee,info:{duration:ee/b,start:P,end:P+U-1}}),P+=U,V+=4,a=V}return{earliestPresentationTime:p,timescale:b,version:d,referencesCount:N,references:c,moovEndOffset:C}}function L(w){for(var m=[],h=T(w,["moov","trak"]),C=0;C<h.length;C++){var v=h[C],c=T(v,["tkhd"])[0];if(c){var f=c.data[c.start],d=f===0?12:20,a=_(c,d),b=T(v,["mdia","mdhd"])[0];if(b){f=b.data[b.start],d=f===0?12:20;var p=_(b,d),x=T(v,["mdia","hdlr"])[0];if(x){var P=I(x.data.subarray(x.start+8,x.start+12)),N={soun:M.ElementaryStreamTypes.AUDIO,vide:M.ElementaryStreamTypes.VIDEO}[P];if(N){var K=T(v,["mdia","minf","stbl","stsd"])[0],V=void 0;K&&(V=I(K.data.subarray(K.start+12,K.start+16))),m[a]={timescale:p,type:N},m[N]={timescale:p,id:a,codec:V}}}}}}var B=T(w,["moov","mvex","trex"]);return B.forEach(function(U){var Y=_(U,4),ee=m[Y];ee&&(ee.default={duration:_(U,12),flags:_(U,20)})}),m}function S(w,m){return T(m,["moof","traf"]).reduce(function(h,C){var v=T(C,["tfdt"])[0],c=v.data[v.start],f=T(C,["tfhd"]).reduce(function(d,a){var b=_(a,4),p=w[b];if(p){var x=_(v,4);c===1&&(x*=Math.pow(2,32),x+=_(v,8));var P=p.timescale||9e4,N=x/P;if(isFinite(N)&&(d===null||N<d))return N}return d},null);return f!==null&&isFinite(f)&&(h===null||f<h)?f:h},null)||0}function y(w,m){for(var h=0,C=0,v=0,c=T(w,["moof","traf"]),f=0;f<c.length;f++){var d=c[f],a=T(d,["tfhd"])[0],b=_(a,4),p=m[b];if(!p)continue;var x=p.default,P=_(a,0)|(x==null?void 0:x.flags),N=x==null?void 0:x.duration;P&8&&(P&2?N=_(a,12):N=_(a,8));for(var K=p.timescale||9e4,V=T(d,["trun"]),B=0;B<V.length;B++){if(N){var U=_(V[B],4);h=N*U}else h=u(V[B]);p.type===M.ElementaryStreamTypes.VIDEO?C+=h/K:p.type===M.ElementaryStreamTypes.AUDIO&&(v+=h/K)}}if(C===0&&v===0){var Y=A(w);if(Y!=null&&Y.references)return Y.references.reduce(function(ee,oe){return ee+oe.info.duration||0},0)}return C||v}function u(w){var m=_(w,0),h=8;m&1&&(h+=4),m&4&&(h+=4);for(var C=0,v=_(w,4),c=0;c<v;c++){if(m&256){var f=_(w,h);C+=f,h+=4}m&512&&(h+=4),m&1024&&(h+=4),m&2048&&(h+=4)}return C}function o(w,m,h){T(m,["moof","traf"]).forEach(function(C){T(C,["tfhd"]).forEach(function(v){var c=_(v,4),f=w[c];if(!f)return;var d=f.timescale||9e4;T(C,["tfdt"]).forEach(function(a){var b=a.data[a.start],p=_(a,4);if(b===0)g(a,4,p-h*d);else{p*=Math.pow(2,32),p+=_(a,8),p-=h*d,p=Math.max(p,0);var x=Math.floor(p/(O+1)),P=Math.floor(p%(O+1));g(a,4,x),g(a,8,P)}})})})}function s(w){var m={valid:null,remainder:null},h=T(w,["moof"]);if(h){if(h.length<2)return m.remainder=w,m}else return m;var C=h[h.length-1];return m.valid=Object(W.sliceUint8)(w,0,C.start-8),m.remainder=Object(W.sliceUint8)(w,C.start-8),m}function l(w,m){var h=new Uint8Array(w.length+m.length);return h.set(w),h.set(m,w.length),h}},"./src/utils/output-filter.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return W});var W=function(){function M(F,I){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=F,this.trackName=I}var O=M.prototype;return O.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},O.newCue=function(I,R,_){(this.startTime===null||this.startTime>I)&&(this.startTime=I),this.endTime=R,this.screen=_,this.timelineController.createCaptionsTrack(this.trackName)},O.reset=function(){this.cueRanges=[]},M}()},"./src/utils/texttrack-utils.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"sendAddTrackEvent",function(){return M}),D.d(G,"addCueToTrack",function(){return O}),D.d(G,"clearCurrentCues",function(){return F}),D.d(G,"removeCuesInRange",function(){return I}),D.d(G,"getCuesInRange",function(){return _});var W=D("./src/utils/logger.ts");function M(g,T){var A;try{A=new Event("addtrack")}catch(L){A=document.createEvent("Event"),A.initEvent("addtrack",!1,!1)}A.track=g,T.dispatchEvent(A)}function O(g,T){var A=g.mode;if(A==="disabled"&&(g.mode="hidden"),g.cues&&!g.cues.getCueById(T.id))try{if(g.addCue(T),!g.cues.getCueById(T.id))throw new Error("addCue is failed for: "+T)}catch(S){W.logger.debug("[texttrack-utils]: "+S);var L=new self.TextTrackCue(T.startTime,T.endTime,T.text);L.id=T.id,g.addCue(L)}A==="disabled"&&(g.mode=A)}function F(g){var T=g.mode;if(T==="disabled"&&(g.mode="hidden"),g.cues)for(var A=g.cues.length;A--;)g.removeCue(g.cues[A]);T==="disabled"&&(g.mode=T)}function I(g,T,A){var L=g.mode;if(L==="disabled"&&(g.mode="hidden"),g.cues&&g.cues.length>0)for(var S=_(g.cues,T,A),y=0;y<S.length;y++)g.removeCue(S[y]);L==="disabled"&&(g.mode=L)}function R(g,T){if(T<g[0].startTime)return 0;var A=g.length-1;if(T>g[A].endTime)return-1;for(var L=0,S=A;L<=S;){var y=Math.floor((S+L)/2);if(T<g[y].startTime)S=y-1;else if(T>g[y].startTime&&L<A)L=y+1;else return y}return g[L].startTime-T<T-g[S].startTime?L:S}function _(g,T,A){var L=[],S=R(g,T);if(S>-1)for(var y=S,u=g.length;y<u;y++){var o=g[y];if(o.startTime>=T&&o.endTime<=A)L.push(o);else if(o.startTime>A)return L}return L}},"./src/utils/time-ranges.ts":function(Z,G,D){"use strict";D.r(G);var W={toString:function(O){for(var F="",I=O.length,R=0;R<I;R++)F+="["+O.start(R).toFixed(3)+","+O.end(R).toFixed(3)+"]";return F}};G.default=W},"./src/utils/timescale-conversion.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"toTimescaleFromBase",function(){return M}),D.d(G,"toTimescaleFromScale",function(){return O}),D.d(G,"toMsFromMpegTsClock",function(){return F}),D.d(G,"toMpegTsClockFromTimescale",function(){return I});var W=9e4;function M(R,_,g,T){g===void 0&&(g=1),T===void 0&&(T=!1);var A=R*_*g;return T?Math.round(A):A}function O(R,_,g,T){return g===void 0&&(g=1),T===void 0&&(T=!1),M(R,_,1/g,T)}function F(R,_){return _===void 0&&(_=!1),M(R,1e3,1/W,_)}function I(R,_){return _===void 0&&(_=1),M(R,W,1/_)}},"./src/utils/typed-array.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"sliceUint8",function(){return W});function W(M,O,F){return Uint8Array.prototype.slice?M.slice(O,F):new Uint8Array(Array.prototype.slice.call(M,O,F))}},"./src/utils/vttcue.ts":function(Z,G,D){"use strict";D.r(G),G.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var W=["","lr","rl"],M=["start","middle","end","left","right"];function O(g,T){if(typeof T!="string")return!1;if(!Array.isArray(g))return!1;var A=T.toLowerCase();return~g.indexOf(A)?A:!1}function F(g){return O(W,g)}function I(g){return O(M,g)}function R(g){for(var T=arguments.length,A=new Array(T>1?T-1:0),L=1;L<T;L++)A[L-1]=arguments[L];for(var S=1;S<arguments.length;S++){var y=arguments[S];for(var u in y)g[u]=y[u]}return g}function _(g,T,A){var L=this,S={enumerable:!0};L.hasBeenReset=!1;var y="",u=!1,o=g,s=T,l=A,w=null,m="",h=!0,C="auto",v="start",c=50,f="middle",d=50,a="middle";Object.defineProperty(L,"id",R({},S,{get:function(){return y},set:function(p){y=""+p}})),Object.defineProperty(L,"pauseOnExit",R({},S,{get:function(){return u},set:function(p){u=!!p}})),Object.defineProperty(L,"startTime",R({},S,{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(L,"endTime",R({},S,{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(L,"text",R({},S,{get:function(){return l},set:function(p){l=""+p,this.hasBeenReset=!0}})),Object.defineProperty(L,"region",R({},S,{get:function(){return w},set:function(p){w=p,this.hasBeenReset=!0}})),Object.defineProperty(L,"vertical",R({},S,{get:function(){return m},set:function(p){var x=F(p);if(x===!1)throw new SyntaxError("An invalid or illegal string was specified.");m=x,this.hasBeenReset=!0}})),Object.defineProperty(L,"snapToLines",R({},S,{get:function(){return h},set:function(p){h=!!p,this.hasBeenReset=!0}})),Object.defineProperty(L,"line",R({},S,{get:function(){return C},set:function(p){if(typeof p!="number"&&p!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");C=p,this.hasBeenReset=!0}})),Object.defineProperty(L,"lineAlign",R({},S,{get:function(){return v},set:function(p){var x=I(p);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");v=x,this.hasBeenReset=!0}})),Object.defineProperty(L,"position",R({},S,{get:function(){return c},set:function(p){if(p<0||p>100)throw new Error("Position must be between 0 and 100.");c=p,this.hasBeenReset=!0}})),Object.defineProperty(L,"positionAlign",R({},S,{get:function(){return f},set:function(p){var x=I(p);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");f=x,this.hasBeenReset=!0}})),Object.defineProperty(L,"size",R({},S,{get:function(){return d},set:function(p){if(p<0||p>100)throw new Error("Size must be between 0 and 100.");d=p,this.hasBeenReset=!0}})),Object.defineProperty(L,"align",R({},S,{get:function(){return a},set:function(p){var x=I(p);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");a=x,this.hasBeenReset=!0}})),L.displayState=void 0}return _.prototype.getCueAsHTML=function(){var g=self.WebVTT;return g.convertCueToDOMTree(self,this.text)},_}()},"./src/utils/vttparser.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"parseTimeStamp",function(){return O}),D.d(G,"fixLineBreaks",function(){return T}),D.d(G,"VTTParser",function(){return A});var W=D("./src/utils/vttcue.ts"),M=function(){function L(){}var S=L.prototype;return S.decode=function(u,o){if(!u)return"";if(typeof u!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(u))},L}();function O(L){function S(u,o,s,l){return(u|0)*3600+(o|0)*60+(s|0)+parseFloat(l||0)}var y=L.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return y?parseFloat(y[2])>59?S(y[2],y[3],0,y[4]):S(y[1],y[2],y[3],y[4]):null}var F=function(){function L(){this.values=Object.create(null)}var S=L.prototype;return S.set=function(u,o){!this.get(u)&&o!==""&&(this.values[u]=o)},S.get=function(u,o,s){return s?this.has(u)?this.values[u]:o[s]:this.has(u)?this.values[u]:o},S.has=function(u){return u in this.values},S.alt=function(u,o,s){for(var l=0;l<s.length;++l)if(o===s[l]){this.set(u,o);break}},S.integer=function(u,o){/^-?\d+$/.test(o)&&this.set(u,parseInt(o,10))},S.percent=function(u,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var s=parseFloat(o);if(s>=0&&s<=100)return this.set(u,s),!0}return!1},L}();function I(L,S,y,u){var o=u?L.split(u):[L];for(var s in o){if(typeof o[s]!="string")continue;var l=o[s].split(y);if(l.length!==2)continue;var w=l[0],m=l[1];S(w,m)}}var R=new W.default(0,0,""),_=R.align==="middle"?"middle":"center";function g(L,S,y){var u=L;function o(){var w=O(L);if(w===null)throw new Error("Malformed timestamp: "+u);return L=L.replace(/^[^\sa-zA-Z-]+/,""),w}function s(w,m){var h=new F;I(w,function(c,f){var d;switch(c){case"region":for(var a=y.length-1;a>=0;a--)if(y[a].id===f){h.set(c,y[a].region);break}break;case"vertical":h.alt(c,f,["rl","lr"]);break;case"line":d=f.split(","),h.integer(c,d[0]),h.percent(c,d[0])&&h.set("snapToLines",!1),h.alt(c,d[0],["auto"]),d.length===2&&h.alt("lineAlign",d[1],["start",_,"end"]);break;case"position":d=f.split(","),h.percent(c,d[0]),d.length===2&&h.alt("positionAlign",d[1],["start",_,"end","line-left","line-right","auto"]);break;case"size":h.percent(c,f);break;case"align":h.alt(c,f,["start",_,"end","left","right"]);break}},/:/,/\s/),m.region=h.get("region",null),m.vertical=h.get("vertical","");var C=h.get("line","auto");C==="auto"&&R.line===-1&&(C=-1),m.line=C,m.lineAlign=h.get("lineAlign","start"),m.snapToLines=h.get("snapToLines",!0),m.size=h.get("size",100),m.align=h.get("align",_);var v=h.get("position","auto");v==="auto"&&R.position===50&&(v=m.align==="start"||m.align==="left"?0:m.align==="end"||m.align==="right"?100:50),m.position=v}function l(){L=L.replace(/^\s+/,"")}if(l(),S.startTime=o(),l(),L.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+u);L=L.substr(3),l(),S.endTime=o(),l(),s(L,S)}function T(L){return L.replace(/<br(?: \/)?>/gi,`
|
|
`)}var A=function(){function L(){this.state="INITIAL",this.buffer="",this.decoder=new M,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var S=L.prototype;return S.parse=function(u){var o=this;u&&(o.buffer+=o.decoder.decode(u,{stream:!0}));function s(){var v=o.buffer,c=0;for(v=T(v);c<v.length&&v[c]!=="\r"&&v[c]!==`
|
|
`;)++c;var f=v.substr(0,c);return v[c]==="\r"&&++c,v[c]===`
|
|
`&&++c,o.buffer=v.substr(c),f}function l(v){I(v,function(c,f){},/:/)}try{var w="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;w=s();var m=w.match(/^()?WEBVTT([ \t].*)?$/);if(!m||!m[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var h=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;h?h=!1:w=s();switch(o.state){case"HEADER":/:/.test(w)?l(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{g(w,o.cue,o.regionList)}catch(v){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var C=w.indexOf("-->")!==-1;if(!w||C&&(h=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
|
|
`),o.cue.text+=w}continue;case"BADCUE":w||(o.state="ID")}}}catch(v){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},S.flush=function(){var u=this;try{if((u.cue||u.state==="HEADER")&&(u.buffer+=`
|
|
|
|
`,u.parse()),u.state==="INITIAL"||u.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){u.onparsingerror&&u.onparsingerror(o)}return u.onflush&&u.onflush(),this},L}()},"./src/utils/webvtt-parser.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"generateCueId",function(){return A}),D.d(G,"parseWebVTT",function(){return S});var W=D("./src/polyfills/number.ts"),M=D("./src/utils/vttparser.ts"),O=D("./src/demux/id3.ts"),F=D("./src/utils/timescale-conversion.ts"),I=D("./src/remux/mp4-remuxer.ts"),R=/\r\n|\n\r|\n|\r/g,_=function(u,o,s){return s===void 0&&(s=0),u.substr(s,o.length)===o},g=function(u){var o=parseInt(u.substr(-3)),s=parseInt(u.substr(-6,2)),l=parseInt(u.substr(-9,2)),w=u.length>9?parseInt(u.substr(0,u.indexOf(":"))):0;if(!Object(W.isFiniteNumber)(o)||!Object(W.isFiniteNumber)(s)||!Object(W.isFiniteNumber)(l)||!Object(W.isFiniteNumber)(w))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+u);return o+=1e3*s,o+=60*1e3*l,o+=60*60*1e3*w,o},T=function(u){for(var o=5381,s=u.length;s;)o=o*33^u.charCodeAt(--s);return(o>>>0).toString()};function A(y,u,o){return T(y.toString())+T(u.toString())+T(o)}var L=function(u,o,s){var l=u[o],w=u[l.prevCC];if(!w||!w.new&&l.new){u.ccOffset=u.presentationOffset=l.start,l.new=!1;return}for(;(m=w)!==null&&m!==void 0&&m.new;){var m;u.ccOffset+=l.start-w.start,l.new=!1,l=w,w=u[l.prevCC]}u.presentationOffset=s};function S(y,u,o,s,l,w,m,h){var C=new M.VTTParser,v=Object(O.utf8ArrayToStr)(new Uint8Array(y)).trim().replace(R,`
|
|
`).split(`
|
|
`),c=[],f=Object(F.toMpegTsClockFromTimescale)(u,o),d="00:00.000",a=0,b=0,p,x=!0,P=!1;C.oncue=function(N){var K=s[l],V=s.ccOffset,B=(a-f)/9e4;if(K!=null&&K.new&&(b!==void 0?V=s.ccOffset=K.start:L(s,l,B)),B&&(V=B-s.presentationOffset),P){var U=N.endTime-N.startTime,Y=Object(I.normalizePts)((N.startTime+V-b)*9e4,w*9e4)/9e4;N.startTime=Y,N.endTime=Y+U}var ee=N.text.trim();N.text=decodeURIComponent(encodeURIComponent(ee)),N.id||(N.id=A(N.startTime,N.endTime,ee)),N.endTime>0&&c.push(N)},C.onparsingerror=function(N){p=N},C.onflush=function(){if(p){h(p);return}m(c)},v.forEach(function(N){if(x)if(_(N,"X-TIMESTAMP-MAP=")){x=!1,P=!0,N.substr(16).split(",").forEach(function(K){_(K,"LOCAL:")?d=K.substr(6):_(K,"MPEGTS:")&&(a=parseInt(K.substr(7)))});try{b=g(d)/1e3}catch(K){P=!1,p=K}return}else N===""&&(x=!1);C.parse(N+`
|
|
`)}),C.flush()}},"./src/utils/xhr-loader.ts":function(Z,G,D){"use strict";D.r(G);var W=D("./src/utils/logger.ts"),M=D("./src/loader/load-stats.ts"),O=/^age:\s*[\d.]+\s*$/m,F=function(){function I(_){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=_?_.xhrSetup:null,this.stats=new M.LoadStats,this.retryDelay=0}var R=I.prototype;return R.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},R.abortInternal=function(){var g=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),g&&(g.onreadystatechange=null,g.onprogress=null,g.readyState!==4&&(this.stats.aborted=!0,g.abort()))},R.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},R.load=function(g,T,A){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=g,this.config=T,this.callbacks=A,this.retryDelay=T.retryDelay,this.loadInternal()},R.loadInternal=function(){var g=this.config,T=this.context;if(!g)return;var A=this.loader=new self.XMLHttpRequest,L=this.stats;L.loading.first=0,L.loaded=0;var S=this.xhrSetup;try{if(S)try{S(A,T.url)}catch(o){A.open("GET",T.url,!0),S(A,T.url)}A.readyState||A.open("GET",T.url,!0);var y=this.context.headers;if(y)for(var u in y)A.setRequestHeader(u,y[u])}catch(o){this.callbacks.onError({code:A.status,text:o.message},T,A);return}T.rangeEnd&&A.setRequestHeader("Range","bytes="+T.rangeStart+"-"+(T.rangeEnd-1)),A.onreadystatechange=this.readystatechange.bind(this),A.onprogress=this.loadprogress.bind(this),A.responseType=T.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),g.timeout),A.send()},R.readystatechange=function(){var g=this.context,T=this.loader,A=this.stats;if(!g||!T)return;var L=T.readyState,S=this.config;if(A.aborted)return;if(L>=2)if(self.clearTimeout(this.requestTimeout),A.loading.first===0&&(A.loading.first=Math.max(self.performance.now(),A.loading.start)),L===4){T.onreadystatechange=null,T.onprogress=null;var y=T.status;if(y>=200&&y<300){A.loading.end=Math.max(self.performance.now(),A.loading.first);var u,o;if(g.responseType==="arraybuffer"?(u=T.response,o=u.byteLength):(u=T.responseText,o=u.length),A.loaded=A.total=o,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(A,g,u,T),!this.callbacks)return;var l={url:T.responseURL,data:u};this.callbacks.onSuccess(l,A,g,T)}else A.retry>=S.maxRetry||y>=400&&y<499?(W.logger.error(y+" while loading "+g.url),this.callbacks.onError({code:y,text:T.statusText},g,T)):(W.logger.warn(y+" while loading "+g.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,S.maxRetryDelay),A.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),S.timeout)},R.loadtimeout=function(){W.logger.warn("timeout while loading "+this.context.url);var g=this.callbacks;g&&(this.abortInternal(),g.onTimeout(this.stats,this.context,this.loader))},R.loadprogress=function(g){var T=this.stats;T.loaded=g.loaded,g.lengthComputable&&(T.total=g.total)},R.getCacheAge=function(){var g=null;if(this.loader&&O.test(this.loader.getAllResponseHeaders())){var T=this.loader.getResponseHeader("age");g=T?parseFloat(T):null}return g},I}();G.default=F}}).default})}}]);
|