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.
148 lines
778 KiB
148 lines
778 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[163,5,6,7],{"+NIl":function(gt,nt,Z){(function(te){te(Z("VrN/"))})(function(te){"use strict";te.defineMode("stex",function(K,D){"use strict";function H(A,w){A.cmdState.push(w)}function M(A){return A.cmdState.length>0?A.cmdState[A.cmdState.length-1]:null}function P(A){var w=A.cmdState.pop();w&&w.closeBracket()}function B(A){for(var w=A.cmdState,b=w.length-1;b>=0;b--){var d=w[b];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function k(A,w,b){return function(){this.name=A,this.bracketNo=0,this.style=w,this.styles=b,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var O={};O.importmodule=k("importmodule","tag",["string","builtin"]),O.documentclass=k("documentclass","tag",["","atom"]),O.usepackage=k("usepackage","tag",["atom"]),O.begin=k("begin","tag",["atom"]),O.end=k("end","tag",["atom"]),O.label=k("label","tag",["atom"]),O.ref=k("ref","tag",["atom"]),O.eqref=k("eqref","tag",["atom"]),O.cite=k("cite","tag",["atom"]),O.bibitem=k("bibitem","tag",["atom"]),O.Bibitem=k("Bibitem","tag",["atom"]),O.RBibitem=k("RBibitem","tag",["atom"]),O.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function L(A,w){A.f=w}function E(A,w){var b;if(A.match(/^\\[a-zA-Z@]+/)){var d=A.current().slice(1);return b=O.hasOwnProperty(d)?O[d]:O.DEFAULT,b=new b,H(w,b),L(w,R),b.style}if(A.match(/^\\[$&%#{}_]/))return"tag";if(A.match(/^\\[,;!\/\\]/))return"tag";if(A.match("\\["))return L(w,function(s,u){return C(s,u,"\\]")}),"keyword";if(A.match("\\("))return L(w,function(s,u){return C(s,u,"\\)")}),"keyword";if(A.match("$$"))return L(w,function(s,u){return C(s,u,"$$")}),"keyword";if(A.match("$"))return L(w,function(s,u){return C(s,u,"$")}),"keyword";var o=A.next();if(o=="%")return A.skipToEnd(),"comment";if(o=="}"||o=="]"){if(b=M(w),b)b.closeBracket(o),L(w,R);else return"error";return"bracket"}else return o=="{"||o=="["?(b=O.DEFAULT,b=new b,H(w,b),"bracket"):/\d/.test(o)?(A.eatWhile(/[\w.%]/),"atom"):(A.eatWhile(/[\w\-_]/),b=B(w),b.name=="begin"&&(b.argument=A.current()),b.styleIdentifier())}function C(A,w,b){if(A.eatSpace())return null;if(b&&A.match(b))return L(w,E),"keyword";if(A.match(/^\\[a-zA-Z@]+/))return"tag";if(A.match(/^[a-zA-Z]+/))return"variable-2";if(A.match(/^\\[$&%#{}_]/))return"tag";if(A.match(/^\\[,;!\/]/))return"tag";if(A.match(/^[\^_&]/))return"tag";if(A.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(A.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=A.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(A.skipToEnd(),"comment"):"error"}function R(A,w){var b=A.peek(),d;return b=="{"||b=="["?(d=M(w),d.openBracket(b),A.eat(b),L(w,E),"bracket"):/[ \t\r]/.test(b)?(A.eat(b),null):(L(w,E),P(w),E(A,w))}return{startState:function(){var A=D.inMathMode?function(w,b){return C(w,b)}:E;return{cmdState:[],f:A}},copyState:function(A){return{cmdState:A.cmdState.slice(),f:A.f}},token:function(A,w){return w.f(A,w)},blankLine:function(A){A.f=E,A.cmdState.length=0},lineComment:"%"}}),te.defineMIME("text/x-stex","stex"),te.defineMIME("text/x-latex","stex")})},"19Vz":function(gt,nt,Z){(function(te){te(Z("VrN/"))})(function(te){te.defineOption("placeholder","",function(k,O,L){var E=L&&L!=te.Init;if(O&&!E)k.on("blur",M),k.on("change",P),k.on("swapDoc",P),te.on(k.getInputField(),"compositionupdate",k.state.placeholderCompose=function(){H(k)}),P(k);else if(!O&&E){k.off("blur",M),k.off("change",P),k.off("swapDoc",P),te.off(k.getInputField(),"compositionupdate",k.state.placeholderCompose),K(k);var C=k.getWrapperElement();C.className=C.className.replace(" CodeMirror-empty","")}O&&!k.hasFocus()&&M(k)});function K(k){k.state.placeholder&&(k.state.placeholder.parentNode.removeChild(k.state.placeholder),k.state.placeholder=null)}function D(k){K(k);var O=k.state.placeholder=document.createElement("pre");O.style.cssText="height: 0; overflow: visible",O.style.direction=k.getOption("direction"),O.className="CodeMirror-placeholder CodeMirror-line-like";var L=k.getOption("placeholder");typeof L=="string"&&(L=document.createTextNode(L)),O.appendChild(L),k.display.lineSpace.insertBefore(O,k.display.lineSpace.firstChild)}function H(k){setTimeout(function(){var O=!1,L=k.getInputField();L.nodeName=="TEXTAREA"?O=!L.value:k.lineCount()==1&&(O=!/[^\u200b]/.test(L.querySelector(".CodeMirror-line").textContent)),O?D(k):K(k)},20)}function M(k){B(k)&&D(k)}function P(k){var O=k.getWrapperElement(),L=B(k);O.className=O.className.replace(" CodeMirror-empty","")+(L?" CodeMirror-empty":""),L?D(k):K(k)}function B(k){return k.lineCount()===1&&k.getLine(0)===""}})},"1eCo":function(gt,nt,Z){(function(te){te(Z("VrN/"))})(function(te){"use strict";var K={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};te.defineMode("xml",function(H,M){var P=H.indentUnit,B={},k=M.htmlMode?K:D;for(var O in k)B[O]=k[O];for(var O in M)B[O]=M[O];var L,E;function C(a,v){function p(U){return v.tokenize=U,U(a,v)}var g=a.next();if(g=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?p(w("atom","]]>")):null:a.match("--")?p(w("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),p(b(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),v.tokenize=w("meta","?>"),"meta"):(L=a.eat("/")?"closeTag":"openTag",v.tokenize=R,"tag bracket");if(g=="&"){var S;return a.eat("#")?a.eat("x")?S=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):S=a.eatWhile(/[\d]/)&&a.eat(";"):S=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),S?"atom":"error"}else return a.eatWhile(/[^&<]/),null}C.isInText=!0;function R(a,v){var p=a.next();if(p==">"||p=="/"&&a.eat(">"))return v.tokenize=C,L=p==">"?"endTag":"selfcloseTag","tag bracket";if(p=="=")return L="equals",null;if(p=="<"){v.tokenize=C,v.state=u,v.tagName=v.tagStart=null;var g=v.tokenize(a,v);return g?g+" tag error":"tag error"}else return/[\'\"]/.test(p)?(v.tokenize=A(p),v.stringStartCol=a.column(),v.tokenize(a,v)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function A(a){var v=function(p,g){for(;!p.eol();)if(p.next()==a){g.tokenize=R;break}return"string"};return v.isInAttribute=!0,v}function w(a,v){return function(p,g){for(;!p.eol();){if(p.match(v)){g.tokenize=C;break}p.next()}return a}}function b(a){return function(v,p){for(var g;(g=v.next())!=null;){if(g=="<")return p.tokenize=b(a+1),p.tokenize(v,p);if(g==">")if(a==1){p.tokenize=C;break}else return p.tokenize=b(a-1),p.tokenize(v,p)}return"meta"}}function d(a,v,p){this.prev=a.context,this.tagName=v,this.indent=a.indented,this.startOfLine=p,(B.doNotIndent.hasOwnProperty(v)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function s(a,v){for(var p;;){if(!a.context)return;if(p=a.context.tagName,!B.contextGrabbers.hasOwnProperty(p)||!B.contextGrabbers[p].hasOwnProperty(v))return;o(a)}}function u(a,v,p){return a=="openTag"?(p.tagStart=v.column(),x):a=="closeTag"?f:u}function x(a,v,p){return a=="word"?(p.tagName=v.current(),E="tag",y):B.allowMissingTagName&&a=="endTag"?(E="tag bracket",y(a,v,p)):(E="error",x)}function f(a,v,p){if(a=="word"){var g=v.current();return p.context&&p.context.tagName!=g&&B.implicitlyClosed.hasOwnProperty(p.context.tagName)&&o(p),p.context&&p.context.tagName==g||B.matchClosing===!1?(E="tag",m):(E="tag error",_)}else return B.allowMissingTagName&&a=="endTag"?(E="tag bracket",m(a,v,p)):(E="error",_)}function m(a,v,p){return a!="endTag"?(E="error",m):(o(p),u)}function _(a,v,p){return E="error",m(a,v,p)}function y(a,v,p){if(a=="word")return E="attribute",h;if(a=="endTag"||a=="selfcloseTag"){var g=p.tagName,S=p.tagStart;return p.tagName=p.tagStart=null,a=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(g)?s(p,g):(s(p,g),p.context=new d(p,g,S==p.indented)),u}return E="error",y}function h(a,v,p){return a=="equals"?c:(B.allowMissing||(E="error"),y(a,v,p))}function c(a,v,p){return a=="string"?l:a=="word"&&B.allowUnquoted?(E="string",y):(E="error",y(a,v,p))}function l(a,v,p){return a=="string"?l:y(a,v,p)}return{startState:function(a){var v={tokenize:C,state:u,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(v.baseIndent=a),v},token:function(a,v){if(!v.tagName&&a.sol()&&(v.indented=a.indentation()),a.eatSpace())return null;L=null;var p=v.tokenize(a,v);return(p||L)&&p!="comment"&&(E=null,v.state=v.state(L||p,a,v),E&&(p=E=="error"?p+" error":E)),p},indent:function(a,v,p){var g=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+P;if(g&&g.noIndent)return te.Pass;if(a.tokenize!=R&&a.tokenize!=C)return p?p.match(/^(\s*)/)[0].length:0;if(a.tagName)return B.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+P*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/<!\[CDATA\[/.test(v))return 0;var S=v&&/^<(\/)?([\w_:\.-]*)/.exec(v);if(S&&S[1])for(;g;)if(g.tagName==S[2]){g=g.prev;break}else if(B.implicitlyClosed.hasOwnProperty(g.tagName))g=g.prev;else break;else if(S)for(;g;){var U=B.contextGrabbers[g.tagName];if(U&&U.hasOwnProperty(S[2]))g=g.prev;else break}for(;g&&g.prev&&!g.startOfLine;)g=g.prev;return g?g.indent+P:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:B.htmlMode?"html":"xml",helperType:B.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=y)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var v=[],p=a.context;p;p=p.prev)p.tagName&&v.push(p.tagName);return v.reverse()}}}),te.defineMIME("text/xml","xml"),te.defineMIME("application/xml","xml"),te.mimeModes.hasOwnProperty("text/html")||te.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"55Ip":function(gt,nt,Z){"use strict";Z.d(nt,"a",function(){return s}),Z.d(nt,"b",function(){return y});var te=Z("Ty5D"),K=Z("dI71"),D=Z("q1tI"),H=Z.n(D),M=Z("YS25"),P=Z("17x9"),B=Z.n(P),k=Z("wx14"),O=Z("zLVn"),L=Z("9R94"),E=function(c){Object(K.a)(l,c);function l(){for(var v,p=arguments.length,g=new Array(p),S=0;S<p;S++)g[S]=arguments[S];return v=c.call.apply(c,[this].concat(g))||this,v.history=Object(M.a)(v.props),v}var a=l.prototype;return a.render=function(){return H.a.createElement(te.c,{history:this.history,children:this.props.children})},l}(H.a.Component),C=function(c){Object(K.a)(l,c);function l(){for(var v,p=arguments.length,g=new Array(p),S=0;S<p;S++)g[S]=arguments[S];return v=c.call.apply(c,[this].concat(g))||this,v.history=Object(M.b)(v.props),v}var a=l.prototype;return a.render=function(){return H.a.createElement(te.c,{history:this.history,children:this.props.children})},l}(H.a.Component),R=function(l,a){return typeof l=="function"?l(a):l},A=function(l,a){return typeof l=="string"?Object(M.c)(l,null,null,a):l},w=function(l){return l},b=H.a.forwardRef;typeof b=="undefined"&&(b=w);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=b(function(c,l){var a=c.innerRef,v=c.navigate,p=c.onClick,g=Object(O.a)(c,["innerRef","navigate","onClick"]),S=g.target,U=Object(k.a)({},g,{onClick:function(G){try{p&&p(G)}catch(N){throw G.preventDefault(),N}!G.defaultPrevented&&G.button===0&&(!S||S==="_self")&&!d(G)&&(G.preventDefault(),v())}});return w!==b?U.ref=l||a:U.ref=a,H.a.createElement("a",U)}),s=b(function(c,l){var a=c.component,v=a===void 0?o:a,p=c.replace,g=c.to,S=c.innerRef,U=Object(O.a)(c,["component","replace","to","innerRef"]);return H.a.createElement(te.e.Consumer,null,function(j){j||Object(L.a)(!1);var G=j.history,N=A(R(g,j.location),j.location),I=N?G.createHref(N):"",V=Object(k.a)({},U,{href:I,navigate:function(){var ne=R(g,j.location),se=p?G.replace:G.push;se(ne)}});return w!==b?V.ref=l||S:V.innerRef=S,H.a.createElement(v,V)})});if(!1)var u,x;var f=function(l){return l},m=H.a.forwardRef;typeof m=="undefined"&&(m=f);function _(){for(var c=arguments.length,l=new Array(c),a=0;a<c;a++)l[a]=arguments[a];return l.filter(function(v){return v}).join(" ")}var y=m(function(c,l){var a=c["aria-current"],v=a===void 0?"page":a,p=c.activeClassName,g=p===void 0?"active":p,S=c.activeStyle,U=c.className,j=c.exact,G=c.isActive,N=c.location,I=c.sensitive,V=c.strict,Q=c.style,ne=c.to,se=c.innerRef,xe=Object(O.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return H.a.createElement(te.e.Consumer,null,function(me){me||Object(L.a)(!1);var Le=N||me.location,Ee=A(R(ne,Le),Le),Te=Ee.pathname,ce=Te&&Te.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),fe=ce?Object(te.f)(Le.pathname,{path:ce,exact:j,sensitive:I,strict:V}):null,J=!!(G?G(fe,Le):fe),le=J?_(U,g):U,ee=J?Object(k.a)({},Q,{},S):Q,pe=Object(k.a)({"aria-current":J&&v||null,className:le,style:ee,to:Ee},xe);return f!==m?pe.ref=l||se:pe.innerRef=se,H.a.createElement(s,pe)})});if(!1)var h},"7ahc":function(gt,nt,Z){"use strict";Z.d(nt,"a",function(){return x});var te=Z("k1fw"),K=Z("0Owb"),D=Z("+L6B"),H=Z("2/Rp"),M=Z("y8nQ"),P=Z("Vl3Y"),B=Z("tJVT"),k=Z("OaEy"),O=Z("2fM7"),L=Z("q1tI"),E=Z.n(L),C=Z("VrN/"),R=Z.n(C),A=Z("p77/"),w=Z.n(A),b=Z("c5Ni"),d=Z.n(b),o=O.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},u={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};nt.b=function(f){var m=f.callback,_=f.onCancel,y=Object(L.useState)("python"),h=Object(B.a)(y,2),c=h[0],l=h[1];function a(p){l(u[p][1])}function v(p){m(p)}return E.a.createElement(P.a,Object(K.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:v}),E.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},E.a.createElement(O.a,{onChange:a},Object.keys(u).map(function(p){return E.a.createElement(o,{key:p,value:p},u[p][0])}))),E.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},E.a.createElement(x,{mode:c})),E.a.createElement("div",{className:"flex-container flex-end"},E.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),E.a.createElement(H.a,{type:"ghost",onClick:_},"\u53D6\u6D88")))};function x(f){var m=f.value,_=f.onChange,y=f.mode,h=f.options,c=h===void 0?{}:h,l=Object(L.useRef)(),a=Object(L.useState)(),v=Object(B.a)(a,2),p=v[0],g=v[1];return Object(L.useEffect)(function(){if(p){function S(U){var j=U.getValue();_&&_(j)}return p.on("change",S),function(){p.off("change",S)}}},[p,_]),Object(L.useEffect)(function(){p&&p.setOption("mode",y)},[p,y]),Object(L.useEffect)(function(){p&&((m!==p.getValue()||m==="")&&setTimeout(function(){p.setValue(m||" ")},300))},[p,m]),Object(L.useEffect)(function(){if(l.current&&!p){var S=R.a.fromTextArea(l.current,Object(te.a)({mode:y,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));g(S)}},[l.current,p]),E.a.createElement("div",{className:"my-codemirror-container"},E.a.createElement("textarea",{ref:l}))}},"7ixt":function(gt,nt,Z){"use strict";Z.d(nt,"a",function(){return D});var te={adjustX:1,adjustY:1},K=[0,0],D={left:{points:["cr","cl"],overflow:te,offset:[-4,0],targetOffset:K},right:{points:["cl","cr"],overflow:te,offset:[4,0],targetOffset:K},top:{points:["bc","tc"],overflow:te,offset:[0,-4],targetOffset:K},bottom:{points:["tc","bc"],overflow:te,offset:[0,4],targetOffset:K},topLeft:{points:["bl","tl"],overflow:te,offset:[0,-4],targetOffset:K},leftTop:{points:["tr","tl"],overflow:te,offset:[-4,0],targetOffset:K},topRight:{points:["br","tr"],overflow:te,offset:[0,-4],targetOffset:K},rightTop:{points:["tl","tr"],overflow:te,offset:[4,0],targetOffset:K},bottomRight:{points:["tr","br"],overflow:te,offset:[0,4],targetOffset:K},rightBottom:{points:["bl","br"],overflow:te,offset:[4,0],targetOffset:K},bottomLeft:{points:["tl","bl"],overflow:te,offset:[0,4],targetOffset:K},leftBottom:{points:["br","bl"],overflow:te,offset:[-4,0],targetOffset:K}},H=D},"8EBN":function(gt,nt,Z){(function(te){te(Z("VrN/"))})(function(te){"use strict";te.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var K=0;K<te.modeInfo.length;K++){var D=te.modeInfo[K];D.mimes&&(D.mime=D.mimes[0])}te.findModeByMIME=function(H){H=H.toLowerCase();for(var M=0;M<te.modeInfo.length;M++){var P=te.modeInfo[M];if(P.mime==H)return P;if(P.mimes){for(var B=0;B<P.mimes.length;B++)if(P.mimes[B]==H)return P}}if(/\+xml$/.test(H))return te.findModeByMIME("application/xml");if(/\+json$/.test(H))return te.findModeByMIME("application/json")},te.findModeByExtension=function(H){H=H.toLowerCase();for(var M=0;M<te.modeInfo.length;M++){var P=te.modeInfo[M];if(P.ext){for(var B=0;B<P.ext.length;B++)if(P.ext[B]==H)return P}}},te.findModeByFileName=function(H){for(var M=0;M<te.modeInfo.length;M++){var P=te.modeInfo[M];if(P.file&&P.file.test(H))return P}var B=H.lastIndexOf("."),k=B>-1&&H.substring(B+1,H.length);if(k)return te.findModeByExtension(k)},te.findModeByName=function(H){H=H.toLowerCase();for(var M=0;M<te.modeInfo.length;M++){var P=te.modeInfo[M];if(P.name.toLowerCase()==H)return P;if(P.alias){for(var B=0;B<P.alias.length;B++)if(P.alias[B].toLowerCase()==H)return P}}}})},"9Bee":function(gt,nt,Z){"use strict";var te=Z("k1fw"),K=Z("tJVT"),D=Z("q1tI"),H=Z.n(D),M=Z("vg9a"),P=Z("DlQD"),B=Z.n(P),k=Z("rUJ1");function O(V,Q){var ne=V.match(/^(\s+)(?:```)/);if(ne===null)return Q;var se=ne[1];return Q.split(`
|
|
`).map(function(xe){var me=xe.match(/^\s+/);if(me===null)return xe;var Le=Object(K.a)(me,1),Ee=Le[0];return Ee.length>=se.length?xe.slice(se.length):xe}).join(`
|
|
`)}var L=[],E=["<ul>"],C=new B.a.Renderer,R=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function A(){L.length=0,E=["<ul>"]}var w={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function b(V,Q,ne,se){if(Q>=V.length||V[Q].level<=ne)return Q;var xe=V[Q];se.push("<li><a href='#"+xe.anchor+"'>"+xe.text+"</a>"),Q++;var me=[];return Q=b(V,Q,xe.level,me),me.length>0&&(se.push("<ul>"),me.forEach(function(Le){se.push(Le)}),se.push("</ul>")),se.push("</li>"),Q=b(V,Q,ne,se),Q}function d(){return b(L,0,0,E),E.push("</ul>"),E.join("")}var o={heading:function(Q){var ne=R.exec(Q);if(ne)return{type:"heading",raw:ne[0],depth:ne[1].length,text:ne[2]}},fences:function(Q){var ne=this.rules.block.fences.exec(Q);if(ne){var se=ne[0],xe=O(se,ne[3]||""),me=ne[2]?ne[2].trim():ne[2];if(["latex","katex","math"].indexOf(me)>=0){var Le=x(),Ee=xe;xe=Le,f[Le]={type:"block",expression:Ee}}return{type:"code",raw:se,lang:me,text:xe}}}},s=/(?:\${2})([^\n`]+?)(?:\${2})/gi,u=0,x=function(){return"__special_katext_id_".concat(u++,"__")},f={};function m(){return f}function _(){u=0,f={}}function y(V){return V=V.replace(s,function(Q,ne){var se=x();return f[se]={type:"inline",expression:ne},se}),V}var h=C.listitem;C.listitem=function(V){return h(y(V))};var c=C.paragraph;C.paragraph=function(V){return c(y(V))};var l=C.tablecell;C.tablecell=function(V,Q){return l(y(V),Q)},C.code=function(V,Q,ne){var se=(Q||"").match(/\S*/)[0];return se?["latex","katex","math"].indexOf(se)>=0?"<p class='editormd-tex'>".concat(V,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(Q,'">').concat(ne?V:Object(k.escape)(V,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(ne?V:Object(k.escape)(V,!0))+"</code></pre>"},C.heading=function(V,Q,ne){var se=this.options.headerPrefix+ne.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return L.push({anchor:se,level:Q,text:V}),"<h"+Q+' id="'+se+'">'+V+"</h"+Q+">"},B.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),B.a.use({tokenizer:o,renderer:C});var a=B.a,v=Z("SJMd"),p=Z("ulZh"),g=Z.n(p),S=Z("m3rI"),U=Z("Oy/b"),j=Z("p5ED"),G=/<pre[^>]*>/g;function N(V){var Q=document.createElement("div");return Q.innerHTML=V,Q.childNodes.length===0?"":Q.childNodes[0].nodeValue}var I=nt.a=function(V){var Q=V.value,ne=Q===void 0?"":Q,se=V.className,xe=V.showTextOnly,me=V.showLines,Le=V.style,Ee=Le===void 0?{}:Le,Te=V.stylesPrev,ce=Te===void 0?{}:Te,fe=String(ne),J=Object(D.useState)(""),le=Object(K.a)(J,2),ee=le[0],pe=le[1],ye=Object(D.useMemo)(function(){try{var Re=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,ke=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Ce=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;fe=fe.replace(Re,"("+S.a.API_SERVER+"/api/attachments/").replace(ke,'"'+S.a.API_SERVER+"/api/attachments/").replace(Ce,'"'+S.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,`
|
|
`),fe=fe.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
`)}catch(je){}var Ae=a(fe),ze=m();if(fe.match(/\[TOC\]/)&&(Ae=Ae.replace("<p>[TOC]</p>",d()),A()),Ae=Ae.replace(/(__special_katext_id_\d+__)/g,function(je,Ve){var it=ze[Ve],rt=it.type,Je=it.expression;return Object(U.renderToString)(N(Je)||"",{displayMode:rt==="block",throwOnError:!1,output:"html"})}),Ae=Ae.replace(/▁/g,"\u2581\u2581\u2581"),_(),xe){var $e=document.createElement("div");return $e.innerHTML=Ae,$e.innerText}return setTimeout(function(){return De()},500),Ae},[fe]),he=Object(D.useRef)();w.WebkitLineClamp=me,me&&(Ee=Object(te.a)(Object(te.a)({},Ee),w));function we(Re){var ke=Re.target;if(ke.tagName.toUpperCase()==="A"){var Ce=ke.getAttribute("href");if(Ce.indexOf("office")>-1)Re.preventDefault(),pe(Ce);else if(Ce.startsWith("#")){Re.preventDefault();var Ae=document.getElementById(Ce.replace("#",""));Ae&&Ae.scrollIntoView(!0)}}}var De=function(){var ke,Ce=(ke=he.current)===null||ke===void 0?void 0:ke.querySelectorAll("video");Ce==null||Ce.forEach(function(Ae){if(Ae.oncontextmenu=function(){return!1},Ae.src.indexOf(".m3u8")>-1&&!Ae.canPlayType("application/vnd.apple.mpegurl")){if(g.a.isSupported()){var ze=new g.a;ze.loadSource(Ae.src),ze.attachMedia(Ae)}}})};return Object(D.useEffect)(function(){if(he.current&&ye&&(ye.match(G)&&window.PR.prettyPrint()),he.current)return he.current.addEventListener("click",we),function(){he.current.removeEventListener("click",we),_(),A()}},[ye,he.current,we]),H.a.createElement(H.a.Fragment,null,H.a.createElement("div",{ref:he,style:Object(te.a)({},Ee),className:"".concat(se||""," markdown-body "),dangerouslySetInnerHTML:{__html:ye}}),H.a.createElement(j.a,{close:!0,data:ee,type:ee!=null&&ee.length?"office":"",style:Object(te.a)({},ce),onClose:function(){return pe("")}}))}},"9VGf":function(gt,nt,Z){"use strict";Z.d(nt,"a",function(){return D});var te=Z("q1tI"),K=Z.n(te);function D(H,M){var P=Object(te.useRef)();Object(te.useEffect)(function(){P.current=H}),Object(te.useEffect)(function(){function B(){P.current()}if(M!==null){var k=setInterval(B,M);return function(){return clearInterval(k)}}},[M])}},BU3w:function(gt,nt,Z){"use strict";Z.d(nt,"a",function(){return P});var te=Z("MNnm"),K="rc-util-key";function D(B){if(B.attachTo)return B.attachTo;var k=document.querySelector("head");return k||document.body}function H(B){var k,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(te.a)())return null;var L=document.createElement("style");if((k=O.csp)===null||k===void 0?void 0:k.nonce){var E;L.nonce=(E=O.csp)===null||E===void 0?void 0:E.nonce}L.innerHTML=B;var C=D(O),R=C.firstChild;return O.prepend&&C.prepend?C.prepend(L):O.prepend&&R?C.insertBefore(L,R):C.appendChild(L),L}var M=new Map;function P(B,k){var O=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},L=D(O);if(!M.has(L)){var E=H("",O),C=E.parentNode;M.set(L,C),C.removeChild(E)}var R=Array.from(M.get(L).children).find(function(o){return o.tagName==="STYLE"&&o[K]===k});if(R){var A,w;if(((A=O.csp)===null||A===void 0?void 0:A.nonce)&&R.nonce!==((w=O.csp)===null||w===void 0?void 0:w.nonce)){var b;R.nonce=(b=O.csp)===null||b===void 0?void 0:b.nonce}return R.innerHTML!==B&&(R.innerHTML=B),R}var d=H(B,O);return d[K]=k,d}},Bd2K:function(gt,nt,Z){(function(te){te(Z("VrN/"),Z("osHv"))})(function(te){te.defineOption("autoCloseTags",!1,function(O,L,E){if(E!=te.Init&&E&&O.removeKeyMap("autoCloseTags"),!L)return;var C={name:"autoCloseTags"};(typeof L!="object"||L.whenClosing!==!1)&&(C["'/'"]=function(R){return P(R)}),(typeof L!="object"||L.whenOpening!==!1)&&(C["'>'"]=function(R){return H(R)}),O.addKeyMap(C)});var K=["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 H(O){if(O.getOption("disableInput"))return te.Pass;for(var L=O.listSelections(),E=[],C=O.getOption("autoCloseTags"),R=0;R<L.length;R++){if(!L[R].empty())return te.Pass;var A=L[R].head,w=O.getTokenAt(A),b=te.innerMode(O.getMode(),w.state),d=b.state,o=b.mode.xmlCurrentTag&&b.mode.xmlCurrentTag(d),s=o&&o.name;if(!s)return te.Pass;var u=b.mode.configuration=="html",x=typeof C=="object"&&C.dontCloseTags||u&&K,f=typeof C=="object"&&C.indentTags||u&&D;w.end>A.ch&&(s=s.slice(0,s.length-w.end+A.ch));var m=s.toLowerCase();if(!s||w.type=="string"&&(w.end!=A.ch||!/[\"\']/.test(w.string.charAt(w.string.length-1))||w.string.length==1)||w.type=="tag"&&o.close||w.string.indexOf("/")==A.ch-w.start-1||x&&B(x,m)>-1||k(O,b.mode.xmlCurrentContext&&b.mode.xmlCurrentContext(d)||[],s,A,!0))return te.Pass;var _=typeof C=="object"&&C.emptyTags;if(_&&B(_,s)>-1){E[R]={text:"/>",newPos:te.Pos(A.line,A.ch+2)};continue}var y=f&&B(f,m)>-1;E[R]={indent:y,text:">"+(y?`
|
|
|
|
`:"")+"</"+s+">",newPos:y?te.Pos(A.line+1,0):te.Pos(A.line,A.ch+1)}}for(var h=typeof C=="object"&&C.dontIndentOnAutoClose,R=L.length-1;R>=0;R--){var c=E[R];O.replaceRange(c.text,L[R].head,L[R].anchor,"+insert");var l=O.listSelections().slice(0);l[R]={head:c.newPos,anchor:c.newPos},O.setSelections(l),!h&&c.indent&&(O.indentLine(c.newPos.line,null,!0),O.indentLine(c.newPos.line+1,null,!0))}}function M(O,L){for(var E=O.listSelections(),C=[],R=L?"/":"</",A=O.getOption("autoCloseTags"),w=typeof A=="object"&&A.dontIndentOnSlash,b=0;b<E.length;b++){if(!E[b].empty())return te.Pass;var d=E[b].head,o=O.getTokenAt(d),s=te.innerMode(O.getMode(),o.state),u=s.state;if(L&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=d.ch-1))return te.Pass;var x,f=s.mode.name!="xml"&&O.getMode().name=="htmlmixed";if(f&&s.mode.name=="javascript")x=R+"script";else if(f&&s.mode.name=="css")x=R+"style";else{var m=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(u);if(!m||m.length&&k(O,m,m[m.length-1],d))return te.Pass;x=R+m[m.length-1]}O.getLine(d.line).charAt(o.end)!=">"&&(x+=">"),C[b]=x}if(O.replaceSelections(C),E=O.listSelections(),!w)for(var b=0;b<E.length;b++)(b==E.length-1||E[b].head.line<E[b+1].head.line)&&O.indentLine(E[b].head.line)}function P(O){return O.getOption("disableInput")?te.Pass:M(O,!0)}te.commands.closeTag=function(O){return M(O)};function B(O,L){if(O.indexOf)return O.indexOf(L);for(var E=0,C=O.length;E<C;++E)if(O[E]==L)return E;return-1}function k(O,L,E,C,R){if(!te.scanForClosingTag)return!1;var A=Math.min(O.lastLine()+1,C.line+500),w=te.scanForClosingTag(O,C,null,A);if(!w||w.tag!=E)return!1;for(var b=R?1:0,d=L.length-1;d>=0&&L[d]==E;d--)++b;C=w.to;for(var d=1;d<b;d++){var o=te.scanForClosingTag(O,C,null,A);if(!o||o.tag!=E)return!1;C=o.to}return!0}})},BjJ7:function(gt,nt,Z){"use strict";Z.d(nt,"d",function(){return K}),Z.d(nt,"c",function(){return D}),Z.d(nt,"e",function(){return H}),Z.d(nt,"b",function(){return M}),Z.d(nt,"a",function(){return B});var te=Z("m3rI");function K(k){var O=!0;if(k.length>0){for(var L=0;L<k.length;L++)if(k[L].compile_success==0||!k[L].compile_success){O=!1;break}}else O=!1;return O}function D(k){for(var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",L=[],E=0;E<k.length;E++){var C=k[E],R=O?"".concat(O,"/").concat(C.name):"".concat(C.name);L.push({title:C.name,isLeaf:!(C.type==="tree"),key:R})}return L}function H(k,O,L){for(var E=0;E<k.length;E++){var C=k[E];if(C.key===O){C.children=L;break}C.children&&H(C.children,O,L)}return k}function M(k,O,L){var E;return function(){var C=this,R=arguments,A=function(){E=null,L||k.apply(C,R)},w=L&&!E;clearTimeout(E),E=setTimeout(A,O),w&&k.apply(C,R)}}var P=!0,B=te.a.API_SERVER},BlwA:function(gt,nt,Z){"use strict";var te=Z("9og8"),K=Z("miYZ"),D=Z("tsqr"),H=Z("tJVT"),M=Z("WmNS"),P=Z.n(M),B=Z("q1tI"),k=Z.n(B),O=Z("Ty5D"),L=Z("ErOA"),E=Z("m3rI"),C=Z("DR4n"),R=Z.n(C),A=function(d,o){for(var s=d.split(","),u=s[0].match(/:(.*?);/)[1],x=atob(s[1]),f=x.length,m=new Uint8Array(f);f--;)m[f]=x.charCodeAt(f);return new Blob([m],{type:u})},w=Object(B.forwardRef)(function(b,d){var o=b.time,s=b.number,u=b.supportCamera,x=b.take_photo,f=b.update,m=b.id,_=Object(B.useRef)(),y=Object(B.useRef)(),h=Object(O.i)(),c=Object(B.useState)([]),l=Object(H.a)(c,2),a=l[0],v=l[1],p=Object(B.useState)(0),g=Object(H.a)(p,2),S=g[0],U=g[1],j=Object(B.useState)(""),G=Object(H.a)(j,2),N=G[0],I=G[1],V=Object(B.useState)(),Q=Object(H.a)(V,2),ne=Q[0],se=Q[1],xe=Object(B.useState)(0),me=Object(H.a)(xe,2),Le=me[0],Ee=me[1];Object(B.useEffect)(function(){return fe(),function(){le(),Te()}},[]),Object(B.useEffect)(function(){S===2&&o&&s>0&&(ce(),Ee(1))},[o]),Object(B.useEffect)(function(){if(Le===0)return;if(Le===2)clearInterval(ne);else{var pe=0,ye=setInterval(function(){a.includes(pe)&&J(),pe++},1e3);se(ye)}return function(){return clearInterval(ne)}},[Le]),Object(B.useImperativeHandle)(d,function(){return{handlePhoto:J}});var Te=function(){Ee(2)},ce=function(){var ye=o/s,he=[];function we(De,Re){return parseInt(Math.floor(Math.random()*(Re-De+1))+De)}new Array(s).fill(0).map(function(De,Re){x?he.push(we(ye*Re,ye*(Re+1))):Re==0?he.push(0):he.push(we(ye*Re,ye*(Re+1)))}),a=he,v([].concat(he)),console.log(he)},fe=function(){navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(ye){var he=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia;return he?new Promise(function(we,De){he.call(navigator,ye,we,De)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}),navigator.mediaDevices.getUserMedia({video:{width:640,height:480}}).then(function(ye){u&&u(2),U(2),"srcObject"in _.current?_.current.srcObject=ye:_.current.src=window.URL.createObjectURL(ye),_.current.onloadedmetadata=function(he){_.current.play()},_.current.addEventListener("ended",function(){console.log("\u64AD\u653E\u7ED3\u675F"),Te(),D.b.error({content:"\u60A8\u5DF2\u7ECF\u5173\u95ED\u4E86\u6444\u50CF\u5934\uFF0C\u8BF7\u572810\u79D2\u949F\u5185\u6062\u590D\u6444\u50CF\u5934\uFF0C\u5426\u5219\u5C06\u63A8\u51FA\u8003\u8BD5",duration:10,key:9998})},!1)}).catch(function(ye){U(1),u&&u(1),ye.message==="Permission denied"||ye.name==="NotAllowedError"?D.b.error("\u60A8\u5DF2\u62D2\u7EDD\u4E86\u83B7\u53D6\u6444\u50CF\u5934"):D.b.error("\u6444\u50CF\u5934\u83B7\u53D6\u5931\u8D25\uFF0C\u6216\u60A8\u5DF2\u62D2\u7EDD\u4E86\u83B7\u53D6\u6444\u50CF\u5934"),console.log("errname: "+ye.name),console.log("err: "+ye.message)})},J=function(){try{y.current.width=_.current.videoWidth,y.current.height=_.current.videoHeight;var ye=y.current.getContext("2d");ye.drawImage(_.current,0,0,y.current.width,y.current.height),I(y.current.toDataURL("image/png")),ee(y.current.toDataURL("image/png"))}catch(he){}},le=function(){try{var ye=_.current.srcObject,he=ye.getTracks();he.forEach(function(we){we.stop()}),_.current.srcObject=null}catch(we){}},ee=function(){var pe=Object(te.a)(P.a.mark(function ye(he){var we,De;return P.a.wrap(function(ke){for(;;)switch(ke.prev=ke.next){case 0:we=new FormData,we.append("file",A(he,"1")),we.append("1","123"),De=new window.XMLHttpRequest,De.withCredentials=!0,De.addEventListener("load",function(Ce){var Ae=JSON.parse(Ce.target.responseText);Object(L.a)("/api/exercises/".concat(m,"/upload_photo.json"),{method:"post",body:{attachment_id:Ae.id}})},!1),De.addEventListener("error",function(Ce){console.error(Ce)},!1),De.open("POST","".concat(E.a.API_SERVER,"/api/attachments.json")),De.send(we);case 9:case"end":return ke.stop()}},ye)}));return function(he){return pe.apply(this,arguments)}}();return k.a.createElement(k.a.Fragment,null,S!==3&&k.a.createElement("aside",{className:R.a.video,id:"screenshot"},S===0&&k.a.createElement("span",null,"\u6B63\u5728\u5F00\u542F\u6444\u50CF\u5934..."),S===1&&k.a.createElement("span",null,"\u6444\u50CF\u5934\u5F00\u542F\u5931\u8D25"),S===2&&k.a.createElement("div",null,k.a.createElement("video",{width:"288",ref:_,autoPlay:!0}),k.a.createElement("canvas",{style:{display:"none"},ref:y}))))});nt.a=w},"C+DQ":function(gt,nt,Z){},DR4n:function(gt,nt,Z){gt.exports={flex_box_center:"flex_box_center___2zmmW",flex_space_between:"flex_space_between___3nCIw",flex_box_vertical_center:"flex_box_vertical_center___1PFij",flex_box_center_end:"flex_box_center_end___2FA05",flex_box_column:"flex_box_column___2k0kx",video:"video___1mYnG"}},DlQD:function(gt,nt,Z){(function(te,K){gt.exports=K()})(this,function(){"use strict";function te(ie,oe){for(var ue=0;ue<oe.length;ue++){var $=oe[ue];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(ie,$.key,$)}}function K(ie,oe,ue){return oe&&te(ie.prototype,oe),ue&&te(ie,ue),ie}function D(ie,oe){if(!ie)return;if(typeof ie=="string")return H(ie,oe);var ue=Object.prototype.toString.call(ie).slice(8,-1);if(ue==="Object"&&ie.constructor&&(ue=ie.constructor.name),ue==="Map"||ue==="Set")return Array.from(ie);if(ue==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ue))return H(ie,oe)}function H(ie,oe){(oe==null||oe>ie.length)&&(oe=ie.length);for(var ue=0,$=new Array(oe);ue<oe;ue++)$[ue]=ie[ue];return $}function M(ie,oe){var ue;if(typeof Symbol=="undefined"||ie[Symbol.iterator]==null){if(Array.isArray(ie)||(ue=D(ie))||oe&&ie&&typeof ie.length=="number"){ue&&(ie=ue);var $=0;return function(){return $>=ie.length?{done:!0}:{done:!1,value:ie[$++]}}}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 ue=ie[Symbol.iterator](),ue.next.bind(ue)}function P(ie,oe){return oe={exports:{}},ie(oe,oe.exports),oe.exports}var B=P(function(ie){function oe(){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 ue($){ie.exports.defaults=$}ie.exports={defaults:oe(),getDefaults:oe,changeDefaults:ue}}),k=B.defaults,O=B.getDefaults,L=B.changeDefaults,E=/[&<>"']/,C=/[&<>"']/g,R=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,w={"&":"&","<":"<",">":">",'"':""","'":"'"},b=function(oe){return w[oe]};function d(ie,oe){if(oe){if(E.test(ie))return ie.replace(C,b)}else if(R.test(ie))return ie.replace(A,b);return ie}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(ie){return ie.replace(o,function(oe,ue){return ue=ue.toLowerCase(),ue==="colon"?":":ue.charAt(0)==="#"?ue.charAt(1)==="x"?String.fromCharCode(parseInt(ue.substring(2),16)):String.fromCharCode(+ue.substring(1)):""})}var u=/(^|[^\[])\^/g;function x(ie,oe){ie=ie.source||ie,oe=oe||"";var ue={replace:function(Y,q){return q=q.source||q,q=q.replace(u,"$1"),ie=ie.replace(Y,q),ue},getRegex:function(){return new RegExp(ie,oe)}};return ue}var f=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _(ie,oe,ue){if(ie){var $;try{$=decodeURIComponent(s(ue)).replace(f,"").toLowerCase()}catch(Y){return null}if($.indexOf("javascript:")===0||$.indexOf("vbscript:")===0||$.indexOf("data:")===0)return null}oe&&!m.test(ue)&&(ue=a(oe,ue));try{ue=encodeURI(ue).replace(/%25/g,"%")}catch(Y){return null}return ue}var y={},h=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ie,oe){y[" "+ie]||(h.test(ie)?y[" "+ie]=ie+"/":y[" "+ie]=S(ie,"/",!0)),ie=y[" "+ie];var ue=ie.indexOf(":")===-1;return oe.substring(0,2)==="//"?ue?oe:ie.replace(c,"$1")+oe:oe.charAt(0)==="/"?ue?oe:ie.replace(l,"$1")+oe:ie+oe}var v={exec:function(){}};function p(ie){for(var oe=1,ue,$;oe<arguments.length;oe++){ue=arguments[oe];for($ in ue)Object.prototype.hasOwnProperty.call(ue,$)&&(ie[$]=ue[$])}return ie}function g(ie,oe){var ue=ie.replace(/\|/g,function(q,re,ge){for(var Se=!1,Me=re;--Me>=0&&ge[Me]==="\\";)Se=!Se;return Se?"|":" |"}),$=ue.split(/ \|/),Y=0;if($.length>oe)$.splice(oe);else for(;$.length<oe;)$.push("");for(;Y<$.length;Y++)$[Y]=$[Y].trim().replace(/\\\|/g,"|");return $}function S(ie,oe,ue){var $=ie.length;if($===0)return"";for(var Y=0;Y<$;){var q=ie.charAt($-Y-1);if(q===oe&&!ue)Y++;else if(q!==oe&&ue)Y++;else break}return ie.substr(0,$-Y)}function U(ie,oe){if(ie.indexOf(oe[1])===-1)return-1;for(var ue=ie.length,$=0,Y=0;Y<ue;Y++)if(ie[Y]==="\\")Y++;else if(ie[Y]===oe[0])$++;else if(ie[Y]===oe[1]&&($--,$<0))return Y;return-1}function j(ie){ie&&ie.sanitize&&!ie.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 G={escape:d,unescape:s,edit:x,cleanUrl:_,resolveUrl:a,noopTest:v,merge:p,splitCells:g,rtrim:S,findClosingBracket:U,checkSanitizeDeprecation:j},N=B.defaults,I=G.rtrim,V=G.splitCells,Q=G.escape,ne=G.findClosingBracket;function se(ie,oe,ue){var $=oe.href,Y=oe.title?Q(oe.title):null,q=ie[1].replace(/\\([\[\]])/g,"$1");return ie[0].charAt(0)!=="!"?{type:"link",raw:ue,href:$,title:Y,text:q}:{type:"image",raw:ue,href:$,title:Y,text:Q(q)}}function xe(ie,oe){var ue=ie.match(/^(\s+)(?:```)/);if(ue===null)return oe;var $=ue[1];return oe.split(`
|
|
`).map(function(Y){var q=Y.match(/^\s+/);if(q===null)return Y;var re=q[0];return re.length>=$.length?Y.slice($.length):Y}).join(`
|
|
`)}var me=function(){function ie(ue){this.options=ue||N}var oe=ie.prototype;return oe.space=function($){var Y=this.rules.block.newline.exec($);if(Y)return Y[0].length>1?{type:"space",raw:Y[0]}:{raw:`
|
|
`}},oe.code=function($,Y){var q=this.rules.block.code.exec($);if(q){var re=Y[Y.length-1];if(re&&re.type==="paragraph")return{raw:q[0],text:q[0].trimRight()};var ge=q[0].replace(/^ {4}/gm,"");return{type:"code",raw:q[0],codeBlockStyle:"indented",text:this.options.pedantic?ge:I(ge,`
|
|
`)}}},oe.fences=function($){var Y=this.rules.block.fences.exec($);if(Y){var q=Y[0],re=xe(q,Y[3]||"");return{type:"code",raw:q,lang:Y[2]?Y[2].trim():Y[2],text:re}}},oe.heading=function($){var Y=this.rules.block.heading.exec($);if(Y)return{type:"heading",raw:Y[0],depth:Y[1].length,text:Y[2]}},oe.nptable=function($){var Y=this.rules.block.nptable.exec($);if(Y){var q={type:"table",header:V(Y[1].replace(/^ *| *\| *$/g,"")),align:Y[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Y[3]?Y[3].replace(/\n$/,"").split(`
|
|
`):[],raw:Y[0]};if(q.header.length===q.align.length){var re=q.align.length,ge;for(ge=0;ge<re;ge++)/^ *-+: *$/.test(q.align[ge])?q.align[ge]="right":/^ *:-+: *$/.test(q.align[ge])?q.align[ge]="center":/^ *:-+ *$/.test(q.align[ge])?q.align[ge]="left":q.align[ge]=null;for(re=q.cells.length,ge=0;ge<re;ge++)q.cells[ge]=V(q.cells[ge],q.header.length);return q}}},oe.hr=function($){var Y=this.rules.block.hr.exec($);if(Y)return{type:"hr",raw:Y[0]}},oe.blockquote=function($){var Y=this.rules.block.blockquote.exec($);if(Y){var q=Y[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Y[0],text:q}}},oe.list=function($){var Y=this.rules.block.list.exec($);if(Y){for(var q=Y[0],re=Y[2],ge=re.length>1,Se=re[re.length-1]===")",Me={type:"list",raw:q,ordered:ge,start:ge?+re.slice(0,-1):"",loose:!1,items:[]},at=Y[0].match(this.rules.block.item),vt=!1,dt,Rt,wt,mt,$t,Pt,Ft,qt=at.length,Ct=0;Ct<qt;Ct++)dt=at[Ct],q=dt,Rt=dt.length,dt=dt.replace(/^ *([*+-]|\d+[.)]) */,""),~dt.indexOf(`
|
|
`)&&(Rt-=dt.length,dt=this.options.pedantic?dt.replace(/^ {1,4}/gm,""):dt.replace(new RegExp("^ {1,"+Rt+"}","gm"),"")),Ct!==qt-1&&(wt=this.rules.block.bullet.exec(at[Ct+1])[0],(ge?wt.length===1||!Se&&wt[wt.length-1]===")":wt.length>1||this.options.smartLists&&wt!==re)&&(mt=at.slice(Ct+1).join(`
|
|
`),Me.raw=Me.raw.substring(0,Me.raw.length-mt.length),Ct=qt-1)),$t=vt||/\n\n(?!\s*$)/.test(dt),Ct!==qt-1&&(vt=dt.charAt(dt.length-1)===`
|
|
`,$t||($t=vt)),$t&&(Me.loose=!0),Pt=/^\[[ xX]\] /.test(dt),Ft=void 0,Pt&&(Ft=dt[1]!==" ",dt=dt.replace(/^\[[ xX]\] +/,"")),Me.items.push({type:"list_item",raw:q,task:Pt,checked:Ft,loose:$t,text:dt});return Me}},oe.html=function($){var Y=this.rules.block.html.exec($);if(Y)return{type:this.options.sanitize?"paragraph":"html",raw:Y[0],pre:!this.options.sanitizer&&(Y[1]==="pre"||Y[1]==="script"||Y[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Y[0]):Q(Y[0]):Y[0]}},oe.def=function($){var Y=this.rules.block.def.exec($);if(Y){Y[3]&&(Y[3]=Y[3].substring(1,Y[3].length-1));var q=Y[1].toLowerCase().replace(/\s+/g," ");return{tag:q,raw:Y[0],href:Y[2],title:Y[3]}}},oe.table=function($){var Y=this.rules.block.table.exec($);if(Y){var q={type:"table",header:V(Y[1].replace(/^ *| *\| *$/g,"")),align:Y[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Y[3]?Y[3].replace(/\n$/,"").split(`
|
|
`):[]};if(q.header.length===q.align.length){q.raw=Y[0];var re=q.align.length,ge;for(ge=0;ge<re;ge++)/^ *-+: *$/.test(q.align[ge])?q.align[ge]="right":/^ *:-+: *$/.test(q.align[ge])?q.align[ge]="center":/^ *:-+ *$/.test(q.align[ge])?q.align[ge]="left":q.align[ge]=null;for(re=q.cells.length,ge=0;ge<re;ge++)q.cells[ge]=V(q.cells[ge].replace(/^ *\| *| *\| *$/g,""),q.header.length);return q}}},oe.lheading=function($){var Y=this.rules.block.lheading.exec($);if(Y)return{type:"heading",raw:Y[0],depth:Y[2].charAt(0)==="="?1:2,text:Y[1]}},oe.paragraph=function($){var Y=this.rules.block.paragraph.exec($);if(Y)return{type:"paragraph",raw:Y[0],text:Y[1].charAt(Y[1].length-1)===`
|
|
`?Y[1].slice(0,-1):Y[1]}},oe.text=function($,Y){var q=this.rules.block.text.exec($);if(q){var re=Y[Y.length-1];return re&&re.type==="text"?{raw:q[0],text:q[0]}:{type:"text",raw:q[0],text:q[0]}}},oe.escape=function($){var Y=this.rules.inline.escape.exec($);if(Y)return{type:"escape",raw:Y[0],text:Q(Y[1])}},oe.tag=function($,Y,q){var re=this.rules.inline.tag.exec($);if(re)return!Y&&/^<a /i.test(re[0])?Y=!0:Y&&/^<\/a>/i.test(re[0])&&(Y=!1),!q&&/^<(pre|code|kbd|script)(\s|>)/i.test(re[0])?q=!0:q&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(re[0])&&(q=!1),{type:this.options.sanitize?"text":"html",raw:re[0],inLink:Y,inRawBlock:q,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(re[0]):Q(re[0]):re[0]}},oe.link=function($){var Y=this.rules.inline.link.exec($);if(Y){var q=ne(Y[2],"()");if(q>-1){var re=Y[0].indexOf("!")===0?5:4,ge=re+Y[1].length+q;Y[2]=Y[2].substring(0,q),Y[0]=Y[0].substring(0,ge).trim(),Y[3]=""}var Se=Y[2],Me="";if(this.options.pedantic){var at=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Se);at?(Se=at[1],Me=at[3]):Me=""}else Me=Y[3]?Y[3].slice(1,-1):"";Se=Se.trim().replace(/^<([\s\S]*)>$/,"$1");var vt=se(Y,{href:Se&&Se.replace(this.rules.inline._escapes,"$1"),title:Me&&Me.replace(this.rules.inline._escapes,"$1")},Y[0]);return vt}},oe.reflink=function($,Y){var q;if((q=this.rules.inline.reflink.exec($))||(q=this.rules.inline.nolink.exec($))){var re=(q[2]||q[1]).replace(/\s+/g," ");if(re=Y[re.toLowerCase()],!re||!re.href){var ge=q[0].charAt(0);return{type:"text",raw:ge,text:ge}}var Se=se(q,re,q[0]);return Se}},oe.strong=function($,Y,q){q===void 0&&(q="");var re=this.rules.inline.strong.start.exec($);if(re&&(!re[1]||re[1]&&(q===""||this.rules.inline.punctuation.exec(q)))){Y=Y.slice(-1*$.length);var ge=re[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ge.lastIndex=0;for(var Se;(re=ge.exec(Y))!=null;)if(Se=this.rules.inline.strong.middle.exec(Y.slice(0,re.index+3)),Se)return{type:"strong",raw:$.slice(0,Se[0].length),text:$.slice(2,Se[0].length-2)}}},oe.em=function($,Y,q){q===void 0&&(q="");var re=this.rules.inline.em.start.exec($);if(re&&(!re[1]||re[1]&&(q===""||this.rules.inline.punctuation.exec(q)))){Y=Y.slice(-1*$.length);var ge=re[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ge.lastIndex=0;for(var Se;(re=ge.exec(Y))!=null;)if(Se=this.rules.inline.em.middle.exec(Y.slice(0,re.index+2)),Se)return{type:"em",raw:$.slice(0,Se[0].length),text:$.slice(1,Se[0].length-1)}}},oe.codespan=function($){var Y=this.rules.inline.code.exec($);if(Y){var q=Y[2].replace(/\n/g," "),re=/[^ ]/.test(q),ge=q.startsWith(" ")&&q.endsWith(" ");return re&&ge&&(q=q.substring(1,q.length-1)),q=Q(q,!0),{type:"codespan",raw:Y[0],text:q}}},oe.br=function($){var Y=this.rules.inline.br.exec($);if(Y)return{type:"br",raw:Y[0]}},oe.del=function($){var Y=this.rules.inline.del.exec($);if(Y)return{type:"del",raw:Y[0],text:Y[1]}},oe.autolink=function($,Y){var q=this.rules.inline.autolink.exec($);if(q){var re,ge;return q[2]==="@"?(re=Q(this.options.mangle?Y(q[1]):q[1]),ge="mailto:"+re):(re=Q(q[1]),ge=re),{type:"link",raw:q[0],text:re,href:ge,tokens:[{type:"text",raw:re,text:re}]}}},oe.url=function($,Y){var q;if(q=this.rules.inline.url.exec($)){var re,ge;if(q[2]==="@")re=Q(this.options.mangle?Y(q[0]):q[0]),ge="mailto:"+re;else{var Se;do Se=q[0],q[0]=this.rules.inline._backpedal.exec(q[0])[0];while(Se!==q[0]);re=Q(q[0]),q[1]==="www."?ge="http://"+re:ge=re}return{type:"link",raw:q[0],text:re,href:ge,tokens:[{type:"text",raw:re,text:re}]}}},oe.inlineText=function($,Y,q){var re=this.rules.inline.text.exec($);if(re){var ge;return Y?ge=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(re[0]):Q(re[0]):re[0]:ge=Q(this.options.smartypants?q(re[0]):re[0]),{type:"text",raw:re[0],text:ge}}},ie}(),Le=G.noopTest,Ee=G.edit,Te=G.merge,ce={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:Le,table:Le,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ce._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ce._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ce.def=Ee(ce.def).replace("label",ce._label).replace("title",ce._title).getRegex(),ce.bullet=/(?:[*+-]|\d{1,9}[.)])/,ce.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ce.item=Ee(ce.item,"gm").replace(/bull/g,ce.bullet).getRegex(),ce.list=Ee(ce.list).replace(/bull/g,ce.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ce.def.source+")").getRegex(),ce._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",ce._comment=/<!--(?!-?>)[\s\S]*?-->/,ce.html=Ee(ce.html,"i").replace("comment",ce._comment).replace("tag",ce._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ce.paragraph=Ee(ce._paragraph).replace("hr",ce.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",ce._tag).getRegex(),ce.blockquote=Ee(ce.blockquote).replace("paragraph",ce.paragraph).getRegex(),ce.normal=Te({},ce),ce.gfm=Te({},ce.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*|$)"}),ce.gfm.nptable=Ee(ce.gfm.nptable).replace("hr",ce.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",ce._tag).getRegex(),ce.gfm.table=Ee(ce.gfm.table).replace("hr",ce.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",ce._tag).getRegex(),ce.pedantic=Te({},ce.normal,{html:Ee(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ce._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:Le,paragraph:Ee(ce.normal._paragraph).replace("hr",ce.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ce.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var fe={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Le,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:Le,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};fe._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",fe.punctuation=Ee(fe.punctuation).replace(/punctuation/g,fe._punctuation).getRegex(),fe._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",fe._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",fe.em.start=Ee(fe.em.start).replace(/punctuation/g,fe._punctuation).getRegex(),fe.em.middle=Ee(fe.em.middle).replace(/punctuation/g,fe._punctuation).replace(/overlapSkip/g,fe._overlapSkip).getRegex(),fe.em.endAst=Ee(fe.em.endAst,"g").replace(/punctuation/g,fe._punctuation).getRegex(),fe.em.endUnd=Ee(fe.em.endUnd,"g").replace(/punctuation/g,fe._punctuation).getRegex(),fe.strong.start=Ee(fe.strong.start).replace(/punctuation/g,fe._punctuation).getRegex(),fe.strong.middle=Ee(fe.strong.middle).replace(/punctuation/g,fe._punctuation).replace(/blockSkip/g,fe._blockSkip).getRegex(),fe.strong.endAst=Ee(fe.strong.endAst,"g").replace(/punctuation/g,fe._punctuation).getRegex(),fe.strong.endUnd=Ee(fe.strong.endUnd,"g").replace(/punctuation/g,fe._punctuation).getRegex(),fe.blockSkip=Ee(fe._blockSkip,"g").getRegex(),fe.overlapSkip=Ee(fe._overlapSkip,"g").getRegex(),fe._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,fe._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,fe._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])?)+(?![-_])/,fe.autolink=Ee(fe.autolink).replace("scheme",fe._scheme).replace("email",fe._email).getRegex(),fe._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,fe.tag=Ee(fe.tag).replace("comment",ce._comment).replace("attribute",fe._attribute).getRegex(),fe._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,fe._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,fe._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,fe.link=Ee(fe.link).replace("label",fe._label).replace("href",fe._href).replace("title",fe._title).getRegex(),fe.reflink=Ee(fe.reflink).replace("label",fe._label).getRegex(),fe.reflinkSearch=Ee(fe.reflinkSearch,"g").replace("reflink",fe.reflink).replace("nolink",fe.nolink).getRegex(),fe.normal=Te({},fe),fe.pedantic=Te({},fe.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:Ee(/^!?\[(label)\]\((.*?)\)/).replace("label",fe._label).getRegex(),reflink:Ee(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",fe._label).getRegex()}),fe.gfm=Te({},fe.normal,{escape:Ee(fe.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),fe.gfm.url=Ee(fe.gfm.url,"i").replace("email",fe.gfm._extended_email).getRegex(),fe.breaks=Te({},fe.gfm,{br:Ee(fe.br).replace("{2,}","*").getRegex(),text:Ee(fe.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var J={block:ce,inline:fe},le=B.defaults,ee=J.block,pe=J.inline;function ye(ie){return ie.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 he(ie){var oe="",ue,$,Y=ie.length;for(ue=0;ue<Y;ue++)$=ie.charCodeAt(ue),Math.random()>.5&&($="x"+$.toString(16)),oe+="&#"+$+";";return oe}var we=function(){function ie(ue){this.tokens=[],this.tokens.links=Object.create(null),this.options=ue||le,this.options.tokenizer=this.options.tokenizer||new me,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var $={block:ee.normal,inline:pe.normal};this.options.pedantic?($.block=ee.pedantic,$.inline=pe.pedantic):this.options.gfm&&($.block=ee.gfm,this.options.breaks?$.inline=pe.breaks:$.inline=pe.gfm),this.tokenizer.rules=$}ie.lex=function($,Y){var q=new ie(Y);return q.lex($)};var oe=ie.prototype;return oe.lex=function($){return $=$.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens($,this.tokens,!0),this.inline(this.tokens),this.tokens},oe.blockTokens=function($,Y,q){Y===void 0&&(Y=[]),q===void 0&&(q=!0),$=$.replace(/^ +$/gm,"");for(var re,ge,Se,Me;$;){if(re=this.tokenizer.space($)){$=$.substring(re.raw.length),re.type&&Y.push(re);continue}if(re=this.tokenizer.code($,Y)){$=$.substring(re.raw.length),re.type?Y.push(re):(Me=Y[Y.length-1],Me.raw+=`
|
|
`+re.raw,Me.text+=`
|
|
`+re.text);continue}if(re=this.tokenizer.fences($)){$=$.substring(re.raw.length),Y.push(re);continue}if(re=this.tokenizer.heading($)){$=$.substring(re.raw.length),Y.push(re);continue}if(re=this.tokenizer.nptable($)){$=$.substring(re.raw.length),Y.push(re);continue}if(re=this.tokenizer.hr($)){$=$.substring(re.raw.length),Y.push(re);continue}if(re=this.tokenizer.blockquote($)){$=$.substring(re.raw.length),re.tokens=this.blockTokens(re.text,[],q),Y.push(re);continue}if(re=this.tokenizer.list($)){for($=$.substring(re.raw.length),Se=re.items.length,ge=0;ge<Se;ge++)re.items[ge].tokens=this.blockTokens(re.items[ge].text,[],!1);Y.push(re);continue}if(re=this.tokenizer.html($)){$=$.substring(re.raw.length),Y.push(re);continue}if(q&&(re=this.tokenizer.def($))){$=$.substring(re.raw.length),this.tokens.links[re.tag]||(this.tokens.links[re.tag]={href:re.href,title:re.title});continue}if(re=this.tokenizer.table($)){$=$.substring(re.raw.length),Y.push(re);continue}if(re=this.tokenizer.lheading($)){$=$.substring(re.raw.length),Y.push(re);continue}if(q&&(re=this.tokenizer.paragraph($))){$=$.substring(re.raw.length),Y.push(re);continue}if(re=this.tokenizer.text($,Y)){$=$.substring(re.raw.length),re.type?Y.push(re):(Me=Y[Y.length-1],Me.raw+=`
|
|
`+re.raw,Me.text+=`
|
|
`+re.text);continue}if($){var at="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(at);break}else throw new Error(at)}}return Y},oe.inline=function($){var Y,q,re,ge,Se,Me,at=$.length;for(Y=0;Y<at;Y++){Me=$[Y];switch(Me.type){case"paragraph":case"text":case"heading":{Me.tokens=[],this.inlineTokens(Me.text,Me.tokens);break}case"table":{for(Me.tokens={header:[],cells:[]},ge=Me.header.length,q=0;q<ge;q++)Me.tokens.header[q]=[],this.inlineTokens(Me.header[q],Me.tokens.header[q]);for(ge=Me.cells.length,q=0;q<ge;q++)for(Se=Me.cells[q],Me.tokens.cells[q]=[],re=0;re<Se.length;re++)Me.tokens.cells[q][re]=[],this.inlineTokens(Se[re],Me.tokens.cells[q][re]);break}case"blockquote":{this.inline(Me.tokens);break}case"list":{for(ge=Me.items.length,q=0;q<ge;q++)this.inline(Me.items[q].tokens);break}}}return $},oe.inlineTokens=function($,Y,q,re,ge){Y===void 0&&(Y=[]),q===void 0&&(q=!1),re===void 0&&(re=!1),ge===void 0&&(ge="");var Se,Me=$,at;if(this.tokens.links){var vt=Object.keys(this.tokens.links);if(vt.length>0)for(;(at=this.tokenizer.rules.inline.reflinkSearch.exec(Me))!=null;)vt.includes(at[0].slice(at[0].lastIndexOf("[")+1,-1))&&(Me=Me.slice(0,at.index)+"["+"a".repeat(at[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(at=this.tokenizer.rules.inline.blockSkip.exec(Me))!=null;)Me=Me.slice(0,at.index)+"["+"a".repeat(at[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;$;){if(Se=this.tokenizer.escape($)){$=$.substring(Se.raw.length),Y.push(Se);continue}if(Se=this.tokenizer.tag($,q,re)){$=$.substring(Se.raw.length),q=Se.inLink,re=Se.inRawBlock,Y.push(Se);continue}if(Se=this.tokenizer.link($)){$=$.substring(Se.raw.length),Se.type==="link"&&(Se.tokens=this.inlineTokens(Se.text,[],!0,re)),Y.push(Se);continue}if(Se=this.tokenizer.reflink($,this.tokens.links)){$=$.substring(Se.raw.length),Se.type==="link"&&(Se.tokens=this.inlineTokens(Se.text,[],!0,re)),Y.push(Se);continue}if(Se=this.tokenizer.strong($,Me,ge)){$=$.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],q,re),Y.push(Se);continue}if(Se=this.tokenizer.em($,Me,ge)){$=$.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],q,re),Y.push(Se);continue}if(Se=this.tokenizer.codespan($)){$=$.substring(Se.raw.length),Y.push(Se);continue}if(Se=this.tokenizer.br($)){$=$.substring(Se.raw.length),Y.push(Se);continue}if(Se=this.tokenizer.del($)){$=$.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],q,re),Y.push(Se);continue}if(Se=this.tokenizer.autolink($,he)){$=$.substring(Se.raw.length),Y.push(Se);continue}if(!q&&(Se=this.tokenizer.url($,he))){$=$.substring(Se.raw.length),Y.push(Se);continue}if(Se=this.tokenizer.inlineText($,re,ye)){$=$.substring(Se.raw.length),ge=Se.raw.slice(-1),Y.push(Se);continue}if($){var dt="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(dt);break}else throw new Error(dt)}}return Y},K(ie,null,[{key:"rules",get:function(){return{block:ee,inline:pe}}}]),ie}(),De=B.defaults,Re=G.cleanUrl,ke=G.escape,Ce=function(){function ie(ue){this.options=ue||De}var oe=ie.prototype;return oe.code=function($,Y,q){var re=(Y||"").match(/\S*/)[0];if(this.options.highlight){var ge=this.options.highlight($,re);ge!=null&&ge!==$&&(q=!0,$=ge)}return re?'<pre><code class="'+this.options.langPrefix+ke(re,!0)+'">'+(q?$:ke($,!0))+`</code></pre>
|
|
`:"<pre><code>"+(q?$:ke($,!0))+`</code></pre>
|
|
`},oe.blockquote=function($){return`<blockquote>
|
|
`+$+`</blockquote>
|
|
`},oe.html=function($){return $},oe.heading=function($,Y,q,re){return this.options.headerIds?"<h"+Y+' id="'+this.options.headerPrefix+re.slug(q)+'">'+$+"</h"+Y+`>
|
|
`:"<h"+Y+">"+$+"</h"+Y+`>
|
|
`},oe.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},oe.list=function($,Y,q){var re=Y?"ol":"ul",ge=Y&&q!==1?' start="'+q+'"':"";return"<"+re+ge+`>
|
|
`+$+"</"+re+`>
|
|
`},oe.listitem=function($){return"<li>"+$+`</li>
|
|
`},oe.checkbox=function($){return"<input "+($?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},oe.paragraph=function($){return"<p>"+$+`</p>
|
|
`},oe.table=function($,Y){return Y&&(Y="<tbody>"+Y+"</tbody>"),`<table>
|
|
<thead>
|
|
`+$+`</thead>
|
|
`+Y+`</table>
|
|
`},oe.tablerow=function($){return`<tr>
|
|
`+$+`</tr>
|
|
`},oe.tablecell=function($,Y){var q=Y.header?"th":"td",re=Y.align?"<"+q+' align="'+Y.align+'">':"<"+q+">";return re+$+"</"+q+`>
|
|
`},oe.strong=function($){return"<strong>"+$+"</strong>"},oe.em=function($){return"<em>"+$+"</em>"},oe.codespan=function($){return"<code>"+$+"</code>"},oe.br=function(){return this.options.xhtml?"<br/>":"<br>"},oe.del=function($){return"<del>"+$+"</del>"},oe.link=function($,Y,q){if($=Re(this.options.sanitize,this.options.baseUrl,$),$===null)return q;var re='<a href="'+ke($)+'"';return Y&&(re+=' title="'+Y+'"'),re+=">"+q+"</a>",re},oe.image=function($,Y,q){if($=Re(this.options.sanitize,this.options.baseUrl,$),$===null)return q;var re='<img src="'+$+'" alt="'+q+'"';return Y&&(re+=' title="'+Y+'"'),re+=this.options.xhtml?"/>":">",re},oe.text=function($){return $},ie}(),Ae=function(){function ie(){}var oe=ie.prototype;return oe.strong=function($){return $},oe.em=function($){return $},oe.codespan=function($){return $},oe.del=function($){return $},oe.html=function($){return $},oe.text=function($){return $},oe.link=function($,Y,q){return""+q},oe.image=function($,Y,q){return""+q},oe.br=function(){return""},ie}(),ze=function(){function ie(){this.seen={}}var oe=ie.prototype;return oe.slug=function($){var Y=$.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Y)){var q=Y;do this.seen[q]++,Y=q+"-"+this.seen[q];while(this.seen.hasOwnProperty(Y))}return this.seen[Y]=0,Y},ie}(),$e=B.defaults,je=G.unescape,Ve=function(){function ie(ue){this.options=ue||$e,this.options.renderer=this.options.renderer||new Ce,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ae,this.slugger=new ze}ie.parse=function($,Y){var q=new ie(Y);return q.parse($)};var oe=ie.prototype;return oe.parse=function($,Y){Y===void 0&&(Y=!0);var q="",re,ge,Se,Me,at,vt,dt,Rt,wt,mt,$t,Pt,Ft,qt,Ct,He,ir,Rr,Gr=$.length;for(re=0;re<Gr;re++){mt=$[re];switch(mt.type){case"space":continue;case"hr":{q+=this.renderer.hr();continue}case"heading":{q+=this.renderer.heading(this.parseInline(mt.tokens),mt.depth,je(this.parseInline(mt.tokens,this.textRenderer)),this.slugger);continue}case"code":{q+=this.renderer.code(mt.text,mt.lang,mt.escaped);continue}case"table":{for(Rt="",dt="",Me=mt.header.length,ge=0;ge<Me;ge++)dt+=this.renderer.tablecell(this.parseInline(mt.tokens.header[ge]),{header:!0,align:mt.align[ge]});for(Rt+=this.renderer.tablerow(dt),wt="",Me=mt.cells.length,ge=0;ge<Me;ge++){for(vt=mt.tokens.cells[ge],dt="",at=vt.length,Se=0;Se<at;Se++)dt+=this.renderer.tablecell(this.parseInline(vt[Se]),{header:!1,align:mt.align[Se]});wt+=this.renderer.tablerow(dt)}q+=this.renderer.table(Rt,wt);continue}case"blockquote":{wt=this.parse(mt.tokens),q+=this.renderer.blockquote(wt);continue}case"list":{for($t=mt.ordered,Pt=mt.start,Ft=mt.loose,Me=mt.items.length,wt="",ge=0;ge<Me;ge++)Ct=mt.items[ge],He=Ct.checked,ir=Ct.task,qt="",Ct.task&&(Rr=this.renderer.checkbox(He),Ft?Ct.tokens.length>0&&Ct.tokens[0].type==="text"?(Ct.tokens[0].text=Rr+" "+Ct.tokens[0].text,Ct.tokens[0].tokens&&Ct.tokens[0].tokens.length>0&&Ct.tokens[0].tokens[0].type==="text"&&(Ct.tokens[0].tokens[0].text=Rr+" "+Ct.tokens[0].tokens[0].text)):Ct.tokens.unshift({type:"text",text:Rr}):qt+=Rr),qt+=this.parse(Ct.tokens,Ft),wt+=this.renderer.listitem(qt,ir,He);q+=this.renderer.list(wt,$t,Pt);continue}case"html":{q+=this.renderer.html(mt.text);continue}case"paragraph":{q+=this.renderer.paragraph(this.parseInline(mt.tokens));continue}case"text":{for(wt=mt.tokens?this.parseInline(mt.tokens):mt.text;re+1<Gr&&$[re+1].type==="text";)mt=$[++re],wt+=`
|
|
`+(mt.tokens?this.parseInline(mt.tokens):mt.text);q+=Y?this.renderer.paragraph(wt):wt;continue}default:{var Er='Token with "'+mt.type+'" type was not found.';if(this.options.silent){console.error(Er);return}else throw new Error(Er)}}}return q},oe.parseInline=function($,Y){Y=Y||this.renderer;var q="",re,ge,Se=$.length;for(re=0;re<Se;re++){ge=$[re];switch(ge.type){case"escape":{q+=Y.text(ge.text);break}case"html":{q+=Y.html(ge.text);break}case"link":{q+=Y.link(ge.href,ge.title,this.parseInline(ge.tokens,Y));break}case"image":{q+=Y.image(ge.href,ge.title,ge.text);break}case"strong":{q+=Y.strong(this.parseInline(ge.tokens,Y));break}case"em":{q+=Y.em(this.parseInline(ge.tokens,Y));break}case"codespan":{q+=Y.codespan(ge.text);break}case"br":{q+=Y.br();break}case"del":{q+=Y.del(this.parseInline(ge.tokens,Y));break}case"text":{q+=Y.text(ge.text);break}default:{var Me='Token with "'+ge.type+'" type was not found.';if(this.options.silent){console.error(Me);return}else throw new Error(Me)}}}return q},ie}(),it=G.merge,rt=G.checkSanitizeDeprecation,Je=G.escape,Oe=B.getDefaults,Ze=B.changeDefaults,Ye=B.defaults;function Pe(ie,oe,ue){if(typeof ie=="undefined"||ie===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ie!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ie)+", string expected");if(typeof oe=="function"&&(ue=oe,oe=null),oe=it({},Pe.defaults,oe||{}),rt(oe),ue){var $=oe.highlight,Y;try{Y=we.lex(ie,oe)}catch(Se){return ue(Se)}var q=function(Me){var at;if(!Me)try{at=Ve.parse(Y,oe)}catch(vt){Me=vt}return oe.highlight=$,Me?ue(Me):ue(null,at)};if(!$||$.length<3)return q();if(delete oe.highlight,!Y.length)return q();var re=0;Pe.walkTokens(Y,function(Se){Se.type==="code"&&(re++,setTimeout(function(){$(Se.text,Se.lang,function(Me,at){if(Me)return q(Me);at!=null&&at!==Se.text&&(Se.text=at,Se.escaped=!0),re--,re===0&&q()})},0))}),re===0&&q();return}try{var ge=we.lex(ie,oe);return oe.walkTokens&&Pe.walkTokens(ge,oe.walkTokens),Ve.parse(ge,oe)}catch(Se){if(Se.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,oe.silent)return"<p>An error occurred:</p><pre>"+Je(Se.message+"",!0)+"</pre>";throw Se}}Pe.options=Pe.setOptions=function(ie){return it(Pe.defaults,ie),Ze(Pe.defaults),Pe},Pe.getDefaults=Oe,Pe.defaults=Ye,Pe.use=function(ie){var oe=it({},ie);if(ie.renderer&&function(){var $=Pe.defaults.renderer||new Ce,Y=function(ge){var Se=$[ge];$[ge]=function(){for(var Me=arguments.length,at=new Array(Me),vt=0;vt<Me;vt++)at[vt]=arguments[vt];var dt=ie.renderer[ge].apply($,at);return dt===!1&&(dt=Se.apply($,at)),dt}};for(var q in ie.renderer)Y(q);oe.renderer=$}(),ie.tokenizer&&function(){var $=Pe.defaults.tokenizer||new me,Y=function(ge){var Se=$[ge];$[ge]=function(){for(var Me=arguments.length,at=new Array(Me),vt=0;vt<Me;vt++)at[vt]=arguments[vt];var dt=ie.tokenizer[ge].apply($,at);return dt===!1&&(dt=Se.apply($,at)),dt}};for(var q in ie.tokenizer)Y(q);oe.tokenizer=$}(),ie.walkTokens){var ue=Pe.defaults.walkTokens;oe.walkTokens=function($){ie.walkTokens($),ue&&ue($)}}Pe.setOptions(oe)},Pe.walkTokens=function(ie,oe){for(var ue=M(ie),$;!($=ue()).done;){var Y=$.value;oe(Y);switch(Y.type){case"table":{for(var q=M(Y.tokens.header),re;!(re=q()).done;){var ge=re.value;Pe.walkTokens(ge,oe)}for(var Se=M(Y.tokens.cells),Me;!(Me=Se()).done;)for(var at=Me.value,vt=M(at),dt;!(dt=vt()).done;){var Rt=dt.value;Pe.walkTokens(Rt,oe)}break}case"list":{Pe.walkTokens(Y.items,oe);break}default:Y.tokens&&Pe.walkTokens(Y.tokens,oe)}}},Pe.Parser=Ve,Pe.parser=Ve.parse,Pe.Renderer=Ce,Pe.TextRenderer=Ae,Pe.Lexer=we,Pe.lexer=we.lex,Pe.Tokenizer=me,Pe.Slugger=ze,Pe.parse=Pe;var Fe=Pe;return Fe})},ELLl:function(gt,nt,Z){(function(te){te(Z("VrN/"))})(function(te){var K={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=te.Pos;te.defineOption("autoCloseBrackets",!1,function(w,b,d){d&&d!=te.Init&&(w.removeKeyMap(M),w.state.closeBrackets=null),b&&(P(H(b,"pairs")),w.state.closeBrackets=b,w.addKeyMap(M))});function H(w,b){return b=="pairs"&&typeof w=="string"?w:typeof w=="object"&&w[b]!=null?w[b]:K[b]}var M={Backspace:O,Enter:L};function P(w){for(var b=0;b<w.length;b++){var d=w.charAt(b),o="'"+d+"'";M[o]||(M[o]=B(d))}}P(K.pairs+"`");function B(w){return function(b){return C(b,w)}}function k(w){var b=w.state.closeBrackets;if(!b||b.override)return b;var d=w.getModeAt(w.getCursor());return d.closeBrackets||b}function O(w){var b=k(w);if(!b||w.getOption("disableInput"))return te.Pass;for(var d=H(b,"pairs"),o=w.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return te.Pass;var u=R(w,o[s].head);if(!u||d.indexOf(u)%2!=0)return te.Pass}for(var s=o.length-1;s>=0;s--){var x=o[s].head;w.replaceRange("",D(x.line,x.ch-1),D(x.line,x.ch+1),"+delete")}}function L(w){var b=k(w),d=b&&H(b,"explode");if(!d||w.getOption("disableInput"))return te.Pass;for(var o=w.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return te.Pass;var u=R(w,o[s].head);if(!u||d.indexOf(u)%2!=0)return te.Pass}w.operation(function(){var x=w.lineSeparator()||`
|
|
`;w.replaceSelection(x+x,null),w.execCommand("goCharLeft"),o=w.listSelections();for(var f=0;f<o.length;f++){var m=o[f].head.line;w.indentLine(m,null,!0),w.indentLine(m+1,null,!0)}})}function E(w){var b=te.cmpPos(w.anchor,w.head)>0;return{anchor:new D(w.anchor.line,w.anchor.ch+(b?-1:1)),head:new D(w.head.line,w.head.ch+(b?1:-1))}}function C(w,b){var d=k(w);if(!d||w.getOption("disableInput"))return te.Pass;var o=H(d,"pairs"),s=o.indexOf(b);if(s==-1)return te.Pass;for(var u=H(d,"closeBefore"),x=H(d,"triples"),f=o.charAt(s+1)==b,m=w.listSelections(),_=s%2==0,y,h=0;h<m.length;h++){var c=m[h],l=c.head,a,v=w.getRange(l,D(l.line,l.ch+1));if(_&&!c.empty())a="surround";else if((f||!_)&&v==b)f&&A(w,l)?a="both":x.indexOf(b)>=0&&w.getRange(l,D(l.line,l.ch+3))==b+b+b?a="skipThree":a="skip";else if(f&&l.ch>1&&x.indexOf(b)>=0&&w.getRange(D(l.line,l.ch-2),l)==b+b){if(l.ch>2&&/\bstring/.test(w.getTokenTypeAt(D(l.line,l.ch-2))))return te.Pass;a="addFour"}else if(f){var p=l.ch==0?" ":w.getRange(D(l.line,l.ch-1),l);if(!te.isWordChar(v)&&p!=b&&!te.isWordChar(p))a="both";else return te.Pass}else if(_&&(v.length===0||/\s/.test(v)||u.indexOf(v)>-1))a="both";else return te.Pass;if(!y)y=a;else if(y!=a)return te.Pass}var g=s%2?o.charAt(s-1):b,S=s%2?b:o.charAt(s+1);w.operation(function(){if(y=="skip")w.execCommand("goCharRight");else if(y=="skipThree")for(var U=0;U<3;U++)w.execCommand("goCharRight");else if(y=="surround"){for(var j=w.getSelections(),U=0;U<j.length;U++)j[U]=g+j[U]+S;w.replaceSelections(j,"around"),j=w.listSelections().slice();for(var U=0;U<j.length;U++)j[U]=E(j[U]);w.setSelections(j)}else y=="both"?(w.replaceSelection(g+S,null),w.triggerElectric(g+S),w.execCommand("goCharLeft")):y=="addFour"&&(w.replaceSelection(g+g+g+g,"before"),w.execCommand("goCharRight"))})}function R(w,b){var d=w.getRange(D(b.line,b.ch-1),D(b.line,b.ch+1));return d.length==2?d:null}function A(w,b){var d=w.getTokenAt(D(b.line,b.ch+1));return/\bstring/.test(d.type)&&d.start==b.ch&&(b.ch==0||!/\bstring/.test(w.getTokenTypeAt(b)))}})},Gytx:function(gt,nt){gt.exports=function(te,K,D,H){var M=D?D.call(H,te,K):void 0;if(M!==void 0)return!!M;if(te===K)return!0;if(typeof te!="object"||!te||typeof K!="object"||!K)return!1;var P=Object.keys(te),B=Object.keys(K);if(P.length!==B.length)return!1;for(var k=Object.prototype.hasOwnProperty.bind(K),O=0;O<P.length;O++){var L=P[O];if(!k(L))return!1;var E=te[L],C=K[L];if(M=D?D.call(H,E,C,L):void 0,M===!1||M===void 0&&E!==C)return!1}return!0}},HmJG:function(gt,nt,Z){},LdHM:function(gt,nt,Z){"use strict";Z.d(nt,"b",function(){return u}),Z.d(nt,"a",function(){return f});var te=Z("1OyB"),K=Z("vuIU"),D=Z("Ji7U"),H=Z("LK+K"),M=Z("q1tI"),P=Z("rePB"),B=Z("Ff2n"),k=Z("ODXe"),O=Z("4IlW"),L=Z("bX4T"),E=Z("YrtM"),C=Z("TSYQ"),R=Z.n(C),A=Z("+nKL"),w=Z("8OUc"),b=function(V,Q){var ne=V.prefixCls,se=V.id,xe=V.flattenOptions,me=V.childrenAsData,Le=V.values,Ee=V.searchValue,Te=V.multiple,ce=V.defaultActiveFirstOption,fe=V.height,J=V.itemHeight,le=V.notFoundContent,ee=V.open,pe=V.menuItemSelectedIcon,ye=V.virtual,he=V.onSelect,we=V.onToggleOpen,De=V.onActiveValue,Re=V.onScroll,ke=V.onMouseEnter,Ce="".concat(ne,"-item"),Ae=Object(E.a)(function(){return xe},[ee,xe],function(Fe,ie){return ie[0]&&Fe[1]!==ie[1]}),ze=M.useRef(null),$e=function(ie){ie.preventDefault()},je=function(ie){ze.current&&ze.current.scrollTo({index:ie})},Ve=function(ie){for(var oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ue=Ae.length,$=0;$<ue;$+=1){var Y=(ie+$*oe+ue)%ue,q=Ae[Y],re=q.group,ge=q.data;if(!re&&!ge.disabled)return Y}return-1},it=M.useState(function(){return Ve(0)}),rt=Object(k.a)(it,2),Je=rt[0],Oe=rt[1],Ze=function(ie){Oe(ie);var oe=Ae[ie];if(!oe){De(null,-1);return}De(oe.data.value,ie)};M.useEffect(function(){Ze(ce!==!1?Ve(0):-1)},[Ae.length,Ee]),M.useEffect(function(){var Fe=setTimeout(function(){if(!Te&&ee&&Le.size===1){var ie=Array.from(Le)[0],oe=Ae.findIndex(function(ue){var $=ue.data;return $.value===ie});Ze(oe),je(oe)}});return function(){return clearTimeout(Fe)}},[ee]);var Ye=function(ie){ie!==void 0&&he(ie,{selected:!Le.has(ie)}),Te||we(!1)};if(M.useImperativeHandle(Q,function(){return{onKeyDown:function(ie){var oe=ie.which;switch(oe){case O.a.UP:case O.a.DOWN:{var ue=0;if(oe===O.a.UP?ue=-1:oe===O.a.DOWN&&(ue=1),ue!==0){var $=Ve(Je+ue,ue);je($),Ze($)}break}case O.a.ENTER:{var Y=Ae[Je];Y&&!Y.data.disabled?Ye(Y.data.value):Ye(void 0),ee&&ie.preventDefault();break}case O.a.ESC:we(!1)}},onKeyUp:function(){},scrollTo:function(ie){je(ie)}}}),Ae.length===0)return M.createElement("div",{role:"listbox",id:"".concat(se,"_list"),className:"".concat(Ce,"-empty"),onMouseDown:$e},le);function Pe(Fe){var ie=Ae[Fe];if(!ie)return null;var oe=ie.data||{},ue=oe.value,$=oe.label,Y=oe.children,q=Object(L.a)(oe,!0),re=me?Y:$;return ie?M.createElement("div",Object.assign({"aria-label":typeof re=="string"?re:null},q,{key:Fe,role:"option",id:"".concat(se,"_list_").concat(Fe),"aria-selected":Le.has(ue)}),ue):null}return M.createElement(M.Fragment,null,M.createElement("div",{role:"listbox",id:"".concat(se,"_list"),style:{height:0,width:0,overflow:"hidden"}},Pe(Je-1),Pe(Je),Pe(Je+1)),M.createElement(A.a,{itemKey:"key",ref:ze,data:Ae,height:fe,itemHeight:J,fullHeight:!1,onMouseDown:$e,onScroll:Re,virtual:ye,onMouseEnter:ke},function(Fe,ie){var oe,ue=Fe.group,$=Fe.groupOption,Y=Fe.data,q=Y.label,re=Y.key;if(ue)return M.createElement("div",{className:R()(Ce,"".concat(Ce,"-group"))},q!==void 0?q:re);var ge=Y.disabled,Se=Y.value,Me=Y.title,at=Y.children,vt=Y.style,dt=Y.className,Rt=Object(B.a)(Y,["disabled","value","title","children","style","className"]),wt=Le.has(Se),mt="".concat(Ce,"-option"),$t=R()(Ce,mt,dt,(oe={},Object(P.a)(oe,"".concat(mt,"-grouped"),$),Object(P.a)(oe,"".concat(mt,"-active"),Je===ie&&!ge),Object(P.a)(oe,"".concat(mt,"-disabled"),ge),Object(P.a)(oe,"".concat(mt,"-selected"),wt),oe)),Pt=me?at:q,Ft=!pe||typeof pe=="function"||wt;return M.createElement("div",Object.assign({},Rt,{"aria-selected":wt,className:$t,title:Me,onMouseMove:function(){if(Je===ie||ge)return;Ze(ie)},onClick:function(){ge||Ye(Se)},style:vt}),M.createElement("div",{className:"".concat(mt,"-content")},Pt||Se),M.isValidElement(pe)||wt,Ft&&M.createElement(w.a,{className:"".concat(Ce,"-option-state"),customizeIcon:pe,customizeIconProps:{isSelected:wt}},wt?"\u2713":null))}))},d=M.forwardRef(b);d.displayName="OptionList";var o=d,s=function(){return null};s.isSelectOption=!0;var u=s,x=function(){return null};x.isSelectOptGroup=!0;var f=x,m=Z("VTBJ"),_=Z("Zm9Q");function y(I){var V=I.key,Q=I.props,ne=Q.children,se=Q.value,xe=Object(B.a)(Q,["children","value"]);return Object(m.a)({key:V,value:se!==void 0?se:V,children:ne},xe)}function h(I){var V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(_.a)(I).map(function(Q,ne){if(!M.isValidElement(Q)||!Q.type)return null;var se=Q.type.isSelectOptGroup,xe=Q.key,me=Q.props,Le=me.children,Ee=Object(B.a)(me,["children"]);return V||!se?y(Q):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(xe===null?ne:xe,"__"),label:xe},Ee),{},{options:h(Le)})}).filter(function(Q){return Q})}var c=Z("2Qr1"),l=Z("qNPg"),a=Z("U8pU"),v=Z("Kwbf"),p=Z("WKfj");function g(I){var V=I.mode,Q=I.options,ne=I.children,se=I.backfill,xe=I.allowClear,me=I.placeholder,Le=I.getInputElement,Ee=I.showSearch,Te=I.onSearch,ce=I.defaultOpen,fe=I.autoFocus,J=I.labelInValue,le=I.value,ee=I.inputValue,pe=I.optionLabelProp,ye=V==="multiple"||V==="tags",he=Ee!==void 0?Ee:ye||V==="combobox",we=Q||h(ne);if(Object(v.a)(V!=="tags"||we.every(function(Ce){return!Ce.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),V==="tags"||V==="combobox"){var De=we.some(function(Ce){return Ce.options?Ce.options.some(function(Ae){return typeof("value"in Ae?Ae.value:Ae.key)=="number"}):typeof("value"in Ce?Ce.value:Ce.key)=="number"});Object(v.a)(!De,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(v.a)(V!=="combobox"||!pe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(v.a)(V==="combobox"||!se,"`backfill` only works with `combobox` mode."),Object(v.a)(V==="combobox"||!Le,"`getInputElement` only work with `combobox` mode."),Object(v.b)(V!=="combobox"||!Le||!xe||!me,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Te&&!he&&V!=="combobox"&&V!=="tags"&&Object(v.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(v.b)(!ce||fe,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),le!=null){var Re=Object(p.d)(le);Object(v.a)(!J||Re.every(function(Ce){return Object(a.a)(Ce)==="object"&&("key"in Ce||"value"in Ce)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(v.a)(!ye||Array.isArray(le),"`value` should be array when `mode` is `multiple` or `tags`")}if(ne){var ke=null;Object(_.a)(ne).some(function(Ce){if(!M.isValidElement(Ce)||!Ce.type)return!1;var Ae=Ce.type;if(Ae.isSelectOption)return!1;if(Ae.isSelectOptGroup){var ze=Object(_.a)(Ce.props.children).every(function($e){return!M.isValidElement($e)||!Ce.type||$e.type.isSelectOption?!0:(ke=$e.type,!1)});return!ze}return ke=Ae,!0}),ke&&Object(v.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(ke.displayName||ke.name||ke,"`.")),Object(v.a)(ee===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var S=g,U=Object(l.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:h,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:S,fillOptionsWithMissingValue:c.a}),j=function(I){Object(D.a)(Q,I);var V=Object(H.a)(Q);function Q(){var ne;return Object(te.a)(this,Q),ne=V.apply(this,arguments),ne.selectRef=M.createRef(),ne.focus=function(){ne.selectRef.current.focus()},ne.blur=function(){ne.selectRef.current.blur()},ne}return Object(K.a)(Q,[{key:"render",value:function(){return M.createElement(U,Object.assign({ref:this.selectRef},this.props))}}]),Q}(M.Component);j.Option=u,j.OptGroup=f;var G=j,N=nt.c=G},M8RZ:function(gt,nt,Z){"use strict";Z.d(nt,"a",function(){return O});var te=Z("fWQN"),K=Z("mtLc"),D=Z("yKVA"),H=Z("879j"),M=Z("q1tI"),P=Z.n(M),B=Z("i8i4"),k=Z.n(B),O=function(L){Object(D.a)(C,L);var E=Object(H.a)(C);function C(R){var A;Object(te.a)(this,C),A=E.call(this,R);var w=window.document;return A.node=w.createElement("div"),w.body.appendChild(A.node),A}return Object(K.a)(C,[{key:"render",value:function(){var A=this.props.children;return Object(B.createPortal)(A,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),C}(P.a.Component)},OLES:function(gt,nt,Z){"use strict";var te=Z("U8pU"),K=Z("VTBJ"),D=Z("Ff2n"),H=Z("q1tI"),M=Z("uciX"),P=Z("7ixt"),B=function(R){var A=R.overlay,w=R.prefixCls,b=R.id,d=R.overlayInnerStyle;return H.createElement("div",{className:"".concat(w,"-inner"),id:b,role:"tooltip",style:d},typeof A=="function"?A():A)},k=B,O=function(R,A){var w=R.overlayClassName,b=R.trigger,d=b===void 0?["hover"]:b,o=R.mouseEnterDelay,s=o===void 0?0:o,u=R.mouseLeaveDelay,x=u===void 0?.1:u,f=R.overlayStyle,m=R.prefixCls,_=m===void 0?"rc-tooltip":m,y=R.children,h=R.onVisibleChange,c=R.afterVisibleChange,l=R.transitionName,a=R.animation,v=R.placement,p=v===void 0?"right":v,g=R.align,S=g===void 0?{}:g,U=R.destroyTooltipOnHide,j=U===void 0?!1:U,G=R.defaultVisible,N=R.getTooltipContainer,I=R.overlayInnerStyle,V=Object(D.a)(R,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),Q=Object(H.useRef)(null);Object(H.useImperativeHandle)(A,function(){return Q.current});var ne=Object(K.a)({},V);"visible"in R&&(ne.popupVisible=R.visible);var se=function(){var Te=R.arrowContent,ce=Te===void 0?null:Te,fe=R.overlay,J=R.id;return[H.createElement("div",{className:"".concat(_,"-arrow"),key:"arrow"},ce),H.createElement(k,{key:"content",prefixCls:_,id:J,overlay:fe,overlayInnerStyle:I})]},xe=!1,me=!1;if(typeof j=="boolean")xe=j;else if(j&&Object(te.a)(j)==="object"){var Le=j.keepParent;xe=Le===!0,me=Le===!1}return H.createElement(M.a,Object.assign({popupClassName:w,prefixCls:_,popup:se,action:d,builtinPlacements:P.a,popupPlacement:p,ref:Q,popupAlign:S,getPopupContainer:N,onPopupVisibleChange:h,afterPopupVisibleChange:c,popupTransitionName:l,popupAnimation:a,defaultPopupVisible:G,destroyPopupOnHide:xe,autoDestroy:me,mouseLeaveDelay:x,popupStyle:f,mouseEnterDelay:s},ne),y)},L=Object(H.forwardRef)(O),E=nt.a=L},Ot1p:function(gt,nt,Z){"use strict";var te=Z("2qtc"),K=Z("kLXV"),D=Z("rAM+"),H=Z("miYZ"),M=Z("tsqr"),P=Z("tJVT"),B=Z("jrin"),k=Z("q1tI"),O=Z.n(k),L=Z("VrN/"),E=Z.n(L),C=Z("bdgK"),R=Z("p77/"),A=Z("Bd2K"),w=Z("ELLl"),b=Z("19Vz"),d=Z("lZu9"),o=Z("+NIl"),s=Z("kSUc"),u=Z("9Bee"),x=function(ie){var oe=ie.value,ue=oe===void 0?"":oe,$=ie.className,Y=ie.showTextOnly,q=ie.showLines,re=ie.style,ge=re===void 0?{}:re,Se=Object(k.useMemo)(function(){return""},[ue]);return O.a.createElement(O.a.Fragment,null,O.a.createElement("div",{dangerouslySetInnerHTML:{__html:Se}}))},f=Z("0Owb"),m=Z("dejd"),_=Z("C+DQ"),y=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function h(ie){var oe=ie.onActionCallback,ue=ie.title,$=ie.icon,Y=ie.actionName,q=ie.className,re=q===void 0?"":q,ge=ie.children;function Se(){oe(Y)}return O.a.createElement("a",{title:ue,className:re,onClick:Se},O.a.createElement("i",{className:"md-iconfont ".concat($)}),ge)}var c=function(ie){var oe=ie.watch,ue=ie.showNullButton,$=ie.onActionCallback,Y=ie.fullScreen,q=ie.insertTemp,re=ie.hidetoolBar,ge=[].concat(y,[{title:"".concat(oe?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(oe?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return O.a.createElement("ul",{className:"markdown-toolbar-container"},!re&&ge.map(function(Se,Me){return O.a.createElement("li",{key:Me},Se.actionName?O.a.createElement(h,Object(f.a)({},Se,{onActionCallback:$})):O.a.createElement("span",{className:"v-line"}))}),ue?O.a.createElement("li",null,O.a.createElement(h,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:$},O.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,q&&O.a.createElement("li",null,O.a.createElement(h,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(q),onActionCallback:$},O.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),O.a.createElement("li",{className:"btn-full-screen"},O.a.createElement(h,{icon:"".concat(Y?"icon-shrink":"icon-enlarge"),title:Y?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:$})))},l=Z("M8RZ"),a=Z("+L6B"),v=Z("2/Rp"),p=Z("y8nQ"),g=Z("Vl3Y"),S=Z("5NDa"),U=Z("5rEg"),j={labelCol:{span:4},wrapperCol:{span:20}},G=function(ie){var oe=ie.callback,ue=ie.onCancel;function $(Y){oe(Y)}return O.a.createElement(g.a,Object(f.a)({},j,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:$}),O.a.createElement(g.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},O.a.createElement(U.a,null)),O.a.createElement(g.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},O.a.createElement(U.a,null)),O.a.createElement("div",{className:"flex-container flex-end"},O.a.createElement(v.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),O.a.createElement(v.a,{type:"ghost",onClick:ue},"\u53D6\u6D88")))},N=Z("7ahc"),I=Z("HmJG"),V=Z("BjJ7"),Q=g.a.useForm,ne={width:280,marginRight:10},se={labelCol:{span:5},wrapperCol:{span:19}},xe=function(ie){var oe=ie.callback,ue=ie.onCancel,$=Q(),Y=Object(P.a)($,1),q=Y[0];function re(Me){oe(Me)}function ge(Me,at){q.setFieldsValue({src:"/api/attachments/".concat(Me.id),type:at.type})}function Se(Me){var at=Me.target.files[0];Le(at,ge)}return O.a.createElement(g.a,Object(f.a)({form:q},se,{className:"upload-image-panel",onFinish:re}),O.a.createElement(g.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},O.a.createElement("div",{className:"flex-container"},O.a.createElement(g.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},O.a.createElement(U.a,{style:ne})),O.a.createElement(me,{onFileChange:Se}))),O.a.createElement(g.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u63CF\u8FF0"}]},O.a.createElement(U.a,{style:{width:264}})),O.a.createElement(g.a.Item,{style:{textAlign:"right"}},O.a.createElement(v.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),O.a.createElement(v.a,{type:"ghost",onClick:ue},"\u53D6\u6D88")))};function me(ie){var oe=ie.onFileChange;return O.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",O.a.createElement("input",{type:"file",onChange:oe}))}function Le(ie,oe){if(!ie)throw new String("\u6CA1\u6709\u6587\u4EF6");var ue=new FormData;ue.append("editormd-image-file",ie),ue.append("file_param_name","editormd-image-file"),ue.append("byxhr","true");var $=new window.XMLHttpRequest;$.withCredentials=!0,$.addEventListener("load",function(Y){oe(JSON.parse(Y.target.responseText),ie)},!1),$.addEventListener("error",function(Y){console.error(Y)},!1),$.open("POST","".concat(V.a,"/api/attachments.json")),$.send(ue)}var Ee=Z("giR+"),Te=Z("fyUT"),ce=Z("7Kak"),fe=Z("9yH6"),J=fe.a.Group,le={margin:"0 8px"},ee=function(ie){var oe=ie.callback,ue=ie.onCancel;function $(Y){oe(Y)}return O.a.createElement(g.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:$},O.a.createElement("div",{className:"flex-container"},O.a.createElement("span",{style:le},"\u5355\u5143\u683C\u6570\uFF1A"),O.a.createElement("span",{style:le},"\u884C\u6570"),O.a.createElement(g.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},O.a.createElement(Te.a,null)),O.a.createElement("span",{style:le},"\u5217\u6570"),O.a.createElement(g.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},O.a.createElement(Te.a,null))),O.a.createElement("div",{className:"flex-container",style:{marginTop:12}},O.a.createElement("span",{style:le},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),O.a.createElement(g.a.Item,{name:"align"},O.a.createElement(J,null,O.a.createElement(fe.a,{value:"default"},O.a.createElement("i",{className:"fa fa-align-justify"})),O.a.createElement(fe.a,{value:"left"},O.a.createElement("i",{className:"fa fa-align-left"})),O.a.createElement(fe.a,{value:"center"},O.a.createElement("i",{className:"fa fa-align-center"})),O.a.createElement(fe.a,{value:"right"},O.a.createElement("i",{className:"fa fa-align-right"}))))),O.a.createElement("div",{className:"flex-container flex-end"},O.a.createElement(v.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),O.a.createElement(v.a,{type:"ghost",onClick:ue},"\u53D6\u6D88")))},pe=Z("m3rI"),ye="link",he="upload-image",we="code-block",De="add-table",Re="------------",ke={default:Re,left:":".concat(Re),center:":".concat(Re,":"),right:"".concat(Re,":")},Ce=Z("9VGf"),Ae,ze;function $e(){}var je=0,Ve=1e4,it="\u2581",rt=`
|
|
**\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 Je(ie){return/^\d+$/.test(ie)?"".concat(ie,"px"):ie}var Oe=navigator.platform.toUpperCase().indexOf("MAC")>=0,Ze=Oe?"Cmd":"Ctrl",Ye=(Ae={},Object(B.a)(Ae,Ze+"-B","bold"),Object(B.a)(Ae,Ze+"-I","italic"),Ae),Pe=(ze={},Object(B.a)(ze,ye,"\u6DFB\u52A0\u94FE\u63A5"),Object(B.a)(ze,we,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(B.a)(ze,he,"\u6DFB\u52A0\u56FE\u7247"),Object(B.a)(ze,De,"\u6DFB\u52A0\u8868\u683C"),ze),Fe=nt.a=function(ie){var oe=ie.defaultValue,ue=oe===void 0?"":oe,$=ie.onChange,Y=ie.width,q=Y===void 0?"100%":Y,re=ie.height,ge=re===void 0?400:re,Se=ie.miniToolbar,Me=Se===void 0?!1:Se,at=ie.isFocus,vt=at===void 0?!1:at,dt=ie.watch,Rt=ie.insertTemp,wt=ie.mode,mt=wt===void 0?"markdown":wt,$t=ie.id,Pt=$t===void 0?"markdown-editor-id":$t,Ft=ie.showResizeBar,qt=Ft===void 0?!1:Ft,Ct=ie.noStorage,He=Ct===void 0?!1:Ct,ir=ie.showNullButton,Rr=ir===void 0?!1:ir,Gr=ie.hidetoolBar,Er=Gr===void 0?!1:Gr,Li=ie.fullScreen,Pr=Li===void 0?!1:Li,nn=ie.onBlur,Fr=ie.onCMBeforeChange,Vt=ie.onFullScreen,ut=ie.className,zr=ut===void 0?"":ut,Tn=ie.disablePaste,pr=Tn===void 0?!1:Tn,kt=ie.placeholder,Vr=kt===void 0?"":kt,kr=ie.values,hn=kr===void 0?"":kr,Ke=Object(k.useState)(null),Et=Object(P.a)(Ke,2),Qe=Et[0],Fn=Et[1],_n=Object(k.useState)(ue),an=Object(P.a)(_n,2),mn=an[0],bt=an[1],Di=Object(k.useState)(dt),Sn=Object(P.a)(Di,2),Nr=Sn[0],xr=Sn[1],ni=Object(k.useState)(Pr),wn=Object(P.a)(ni,2),Tr=wn[0],Nn=wn[1],ii=Object(k.useState)(""),pn=Object(P.a)(ii,2),$r=pn[0],Br=pn[1],ai=Object(k.useState)(0),Cn=Object(P.a)(ai,2),gn=Cn[0],vn=Cn[1],oi=Object(k.useState)(ge),_r=Object(P.a)(oi,2),Oi=_r[0],Ri=_r[1],An=Object(k.useState)(!1),Yr=Object(P.a)(An,2),na=Yr[0],si=Yr[1],on=Object(k.useRef)(),Bn=Object(k.useRef)(),Jr=Object(k.useRef)(),Nt=Object(k.useRef)();Object(k.useEffect)(function(){bt(hn),Qe==null||Qe.setValue(hn)},[hn]),Object(k.useEffect)(function(){Vt==null||Vt(Tr)},[Tr]),Object(k.useEffect)(function(){if(on.current){var ct=E.a.fromTextArea(on.current,{mode:mt,lineNumbers:!Me,lineWrapping:!0,value:ue,autoCloseTags:!0,autoCloseBrackets:!0});vt&&ct.focus();function St(_t,It){if(pr){It.preventDefault();return}var Bt=It.clipboardData;if(Bt){var jt=Bt.types.toString(),Yt=Bt.items,Kt=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"];if(jt==="Files"||Bt.types.indexOf("Files")>-1){if(It.preventDefault(),mt=="stex")return;try{var cr,jr=Yt[1];((cr=Yt[0])===null||cr===void 0?void 0:cr.kind)==="file"&&(jr=Yt[0]);var Gt=jr.getAsFile(),Qr=Gt.name.split(".").pop();Le(Gt,function(ar){if(ar.id){var Zr,ln,un;(Gt==null||((Zr=Gt.type)===null||Zr===void 0)?void 0:Zr.indexOf("image"))>-1?ct.replaceSelection(".concat(ar.content_type,")")):(Gt==null||((ln=Gt.type)===null||ln===void 0)?void 0:ln.indexOf("video"))>-1?ct.replaceSelection('<video width="100%" controls src="'.concat(pe.a.API_SERVER,"/api/attachments/").concat(ar.id,'"></video>')):(Gt==null||((un=Gt.type)===null||un===void 0)?void 0:un.indexOf("pdf"))>-1?ct.replaceSelection('<a href="'.concat(pe.a.API_SERVER,"/api/attachments/").concat(ar.id,"?type=").concat(Gt.type,'&disposition=inline" target="_blank">').concat(Gt.name,"</a>")):Kt.includes(Qr)?ct.replaceSelection('<a href="'.concat(pe.a.API_SERVER,"/api/attachments/").concat(ar.id,'?type=office&disposition=inline" target="_blank">').concat(Gt.name,"</a>")):ct.replaceSelection("[".concat(Gt.name,"](").concat(pe.a.API_SERVER,"/api/attachments/").concat(ar.id,"?type=").concat(ar.content_type,")"))}else(ar==null?void 0:ar.status)===401&&(document.location.href="/user/login")})}catch(ar){M.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return ct.on("paste",St),Fn(ct),function(){ct.off("paste",St)}}},[]);var yn=Object(k.useCallback)(function(){if(Bn.current)try{}catch(ct){console.log(ct,"---- to set md editor body height")}},[Oi,Bn,Tr]);Object(k.useEffect)(function(){function ct(){var _t=new C.default(function(It){var Bt=Object(D.a)(It),jt;try{for(Bt.s();!(jt=Bt.n()).done;){var Yt=jt.value;(Yt.target.offsetHeight>0||Yt.target.offsetWidth>0)&&(yn(),Qe.setSize("100%","100%"),Qe.refresh())}}catch(Kt){Bt.e(Kt)}finally{Bt.f()}});return _t.observe(on.current.parentElement),_t}if(Qe){var St=ct();return function(){St.unobserve(on.current.parentElement)}}},[Qe,yn]),Object(k.useEffect)(function(){if(Qe){for(var ct=[],St=function(){var Yt=It[_t];Bt=Object(P.a)(Yt,2);var Kt=Bt[0],cr=Bt[1],jr=Object(B.a)({},Kt,function(){jn(cr)});ct.push(jr),Qe.addKeyMap(jr)},_t=0,It=Object.entries(Ye);_t<It.length;_t++){var Bt;St()}return function(){var jt=Object(D.a)(ct),Yt;try{for(jt.s();!(Yt=jt.n()).done;){var Kt=Yt.value;Qe.removeKeyMap(Kt)}}catch(cr){jt.e(cr)}finally{jt.f()}}}},[Qe]),Object(k.useEffect)(function(){Pr!==Tr&&Nn(Pr)},[Pr]),Object(Ce.a)(function(){if(!He&&gn>0){var ct=new Date().getTime(),St=window.sessionStorage.getItem(Pt);ct>=gn+Ve&&(!St||St!==mn)&&(window.sessionStorage.setItem(Pt,mn),si(!0))}},Ve),Object(k.useEffect)(function(){xr(dt)},[Qe,dt]),Object(k.useEffect)(function(){Qe&&(vt&&Qe.focus())},[Qe,vt]),Object(k.useEffect)(function(){if(Nr&&Qe){var ct=Qe.getScrollerElement();function St(_t){var It=_t.target;if(Nt.current){var Bt=It.scrollTop/It.scrollHeight;Nt.current.scrollTop=Nt.current.scrollHeight*Bt}}return ct.addEventListener("scroll",St),function(){ct.removeEventListener("scroll",St)}}},[Qe,Nr]),Object(k.useEffect)(function(){if(Qe&&Fr){function ct(St,_t){Fr(St,_t)}return Qe.on("beforeChange",ct),function(){Qe.off("beforeChange",ct)}}},[Qe,Fr]),Object(k.useEffect)(function(){if(Qe&&nn){function ct(){nn(Qe.getValue())}return Qe.on("blur",ct),function(){Qe.off("blur",ct)}}},[Qe,nn]),Object(k.useEffect)(function(){if(Qe){function ct(St){var _t=St.getValue();bt(_t),vn(new Date().getTime()),St.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),$&&$(_t)}return Qe.on("change",ct),function(){Qe.off("change",ct)}}},[Qe,$]),Object(k.useEffect)(function(){Qe&&(ue==null?(Qe.setValue(""),bt("")):ue!==Qe.getValue()&&(Qe.setValue(ue),bt(ue),Qe.setCursor(Qe.lineCount(),0)))},[Qe,ue]);var jn=Object(k.useCallback)(function(ct){var St=Qe.getCursor(),_t=Qe.getSelection(),It=_t.split(`
|
|
`);switch(ct){case"bold":return Qe.replaceSelection("**"+_t+"**"),_t===""&&Qe.setCursor(St.line,St.ch+2),Qe.focus();case"italic":return Qe.replaceSelection("*"+_t+"*"),_t===""&&Qe.setCursor(St.line,St.ch+1),Qe.focus();case"code":return Qe.replaceSelection("`"+_t+"`"),_t===""&&Qe.setCursor(St.line,St.ch+1),Qe.focus();case"inline-latex":return Qe.replaceSelection("`$$"+_t+"$$`"),_t===""&&Qe.setCursor(St.line,St.ch+3),Qe.focus();case"latex":return Qe.replaceSelection("```latex\n"+_t+"\n```"),Qe.setCursor(St.line+1,_t.length+1),Qe.focus();case"line-break":return Qe.replaceSelection(`<br/>
|
|
`),Qe.focus();case"list-ul":return _t===""?Qe.replaceSelection("- "+_t):Qe.replaceSelection(It.map(function(Bt){return Bt===""?"":"- ".concat(Bt)}).join(`
|
|
`)),Qe.focus();case"list-ol":return _t===""?Qe.replaceSelection("1. "+_t):Qe.replaceSelection(It.map(function(Bt,jt){return Bt===""?"":"".concat(jt+1,". ").concat(Bt)}).join(`
|
|
`)),Qe.focus();case"add-null-ch":return _t===""&&Qe.setCursor(St.line,St.ch+1),Qe.replaceSelection(it),Qe.focus();case"inster-template-1":return _t===""&&Qe.setCursor(St.line,St.ch),Qe.replaceSelection(rt),Qe.focus();case"eraser":return Qe.setValue(""),Qe.focus();case"trigger-watch":return xr(!Nr),Qe.focus();case"trigger-full-screen":return Nn(!Tr),Qe.focus();case ye:Br(ye);return;case we:Br(we);return;case he:Br(he);return;case De:Br(De);return;default:throw new Error}},[Qe,Nr,Tr]),sn=Object(k.useCallback)(function(ct){Br("");switch($r){case ye:var St=ct.title,_t=ct.link;return Qe.replaceSelection("[".concat(St,"](").concat(_t,")")),Qe.focus();case we:var It=ct.language,Bt=ct.content;return Qe.replaceSelection(["```"+It,Bt,"```"].join(`
|
|
`)),Qe.focus();case he:var jt=ct.src,Yt=ct.alt;return Qe.replaceSelection(".concat(jt,' "').concat(Yt,'" )')),Qe.focus();case De:for(var Kt=ct.row,cr=ct.col,jr=ct.align,Gt=`
|
|
`,Qr=0;Qr<Kt;Qr++){for(var ar=[],Zr=[],ln=0;ln<cr;ln++)Qr===1&&Zr.push(ke[jr]),ar.push(" ");Qr===1&&(Gt+="| ".concat(Zr.join(" | "),` |
|
|
`)),Gt+="| ".concat(ar.join(cr===1?"":" | "),` |
|
|
`)}return Qe.replaceSelection(Gt+`
|
|
`),Qe.focus();default:throw new Error}},[Qe,$r]),Ht=Object(k.useMemo)(function(){switch($r){case ye:return O.a.createElement(G,{callback:sn,onCancel:Sr});case we:return O.a.createElement(N.b,{callback:sn,onCancel:Sr});case he:return O.a.createElement(xe,{callback:sn,onCancel:Sr});case De:return O.a.createElement(ee,{callback:sn,onCancel:Sr});default:return null}},[$r]);function Sr(){Br("")}Object(k.useEffect)(function(){if(Jr.current){var ct=Jr.current,St=!1,_t=0;function It(Yt){St=!0,_t=Yt.pageY}function Bt(){St=!1}function jt(Yt){if(St){var Kt=Yt.pageY-_t;Kt<0&&(Kt=0),Kt>300&&(Kt=300);var cr=ge+Kt+"px";Ri(cr)}}return ct.addEventListener("mousedown",It),document.addEventListener("mousemove",jt),document.addEventListener("mouseup",Bt),function(){ct.removeEventListener("mousedown",It),document.removeEventListener("mousemove",jt),document.removeEventListener("mouseup",Bt)}}},[Qe,Jr]),Object(k.useEffect)(function(){Ri(ge)},[ge]);var Wn=Je(q),Hn=Je(Oi),Pi={width:Wn,height:Hn},bn=Object(k.useMemo)(function(){if(gn){var ct=new Date(gn),St=ct.getHours(),_t=ct.getMinutes(),It=ct.getSeconds();return St=St<10?"0"+St:St,_t=_t<10?"0"+_t:_t,It=It<10?"0"+It:It,"".concat(St,":").concat(_t,":").concat(It)}return 0},[gn]);function ia(){window.sessionStorage.removeItem(Pt),si(!1),vn(0)}function li(){si(!1),vn(0),Qe.setValue(window.sessionStorage.getItem(Pt))}return O.a.createElement(k.Fragment,null,O.a.createElement("div",{className:"markdown-editor-wrapper",ref:Bn},O.a.createElement("div",{className:"markdown-editor-container ".concat(zr," ").concat(Nr?"on-preview":""," ").concat(Me?"mini":""," ").concat(Tr?"full-screen":""),style:Pi},O.a.createElement(c,{insertTemp:Rt,watch:Nr,fullScreen:Tr,showNullButton:Rr,onActionCallback:jn,hidetoolBar:Er}),O.a.createElement("div",{className:"markdown-editor-body"},O.a.createElement("div",{className:"codemirror-container"},O.a.createElement("textarea",{ref:on,placeholder:Vr})),Nr?O.a.createElement("div",{ref:Nt,className:"preview-container"},mt==="stex"&&O.a.createElement(x,{value:mn}),mt!=="stex"&&O.a.createElement(u.a,{value:mn})):null))),qt?O.a.createElement("a",{ref:Jr,className:"editor-resize"}):null,O.a.createElement(l.a,null,Pe[$r]?O.a.createElement(K.a,{centered:!0,title:Pe[$r],visible:!0,onCancel:Sr,footer:null},Ht):null))}},R8k3:function(gt,nt,Z){"use strict";Z.r(nt);var te=Z("T2oS"),K=Z("W9HT"),D=Z("jCWc"),H=Z("kPKH"),M=Z("5Dmo"),P=Z("3S7+"),B=Z("sRBo"),k=Z("kaz8"),O=Z("14J3"),L=Z("BMrR"),E=Z("+L6B"),C=Z("2/Rp"),R=Z("7Kak"),A=Z("9yH6"),w=Z("MXD1"),b=Z("CFYs"),d=Z("miYZ"),o=Z("tsqr"),s=Z("2qtc"),u=Z("kLXV"),x=Z("k1fw"),f=Z("rAM+"),m=Z("9og8"),_=Z("tJVT"),y=Z("PpiC"),h=Z("5NDa"),c=Z("5rEg"),l=Z("aHsQ"),a=Z("sGsY"),v=Z("WmNS"),p=Z.n(v),g=Z("q1tI"),S=Z.n(g),U=Z("Ty5D"),j=Z("55Ip"),G=Z("9kvl"),N=Z("gUdW"),I=Z("xGfz"),V=Z("jhfD"),Q=Z("BlwA"),ne=Z("bPs0"),se=Z("qmgf"),xe=Z.n(se),me=Z("1vsH"),Le=Z("xKgJ"),Ee=Z("bntm"),Te=Z("V0Rq"),ce=Z("HBuW"),fe=Z("9Bee"),J=Z("Ot1p"),le=function(Ze){var Ye,Pe,Fe,ie,oe,ue,$,Y=Ze.item,q=Ze.answerData,re=Ze.onBlur,ge=re===void 0?function(){}:re,Se=Object(g.useState)(),Me=Object(_.a)(Se,2),at=Me[0],vt=Me[1],dt=Object(g.useState)(),Rt=Object(_.a)(dt,2),wt=Rt[0],mt=Rt[1],$t=Object(g.useState)(),Pt=Object(_.a)($t,2),Ft=Pt[0],qt=Pt[1];return Object(g.useEffect)(function(){mt(Y==null?void 0:Y.a_flag)},[Y==null?void 0:Y.a_flag]),S.a.createElement("div",null,(q==null||((Ye=q.exercise)===null||Ye===void 0)?void 0:Ye.commit_status)===1?S.a.createElement("div",null,S.a.createElement("p",{className:"mt10 mb0"},"\u6211\u7684\u7B54\u6848\uFF1A"),S.a.createElement("div",{className:xe.a.simpleText},S.a.createElement(fe.a,{value:Y==null||((Pe=Y.user_answer)===null||Pe===void 0)?void 0:Pe[0]}))):S.a.createElement("div",{className:Y.user_score&&(Y.user_score===Y.question_score?"c-green":"c-red")},Ft?S.a.createElement(J.a,{height:150,isFocus:!0,defaultValue:Y==null||((Fe=Y.user_answer)===null||Fe===void 0)?void 0:Fe[0],id:Y==null?void 0:Y.question_id,onChange:function(He){return vt(He)}}):S.a.createElement("div",{onClick:function(){var He;if(!Y.repeat_answer&&(Y==null||((He=Y.user_answer)===null||He===void 0)?void 0:He.length)>0)return;qt(!0)}},S.a.createElement(c.a,{size:"large",className:"current",placeholder:(Y==null||((ie=Y.user_answer)===null||ie===void 0)?void 0:ie.length)>0?Y==null||((oe=Y.user_answer)===null||oe===void 0)?void 0:oe[0]:"\u70B9\u51FB\u5F00\u59CB\u4F5C\u7B54",readOnly:!0}))),S.a.createElement(L.a,{justify:"end",style:{marginBottom:10,marginTop:10}},S.a.createElement(C.a,{type:"primary",className:"font16 ml20",onClick:function(){ge(at)}},"\u63D0\u4EA4\u7B54\u6848")),(Y==null?void 0:Y.standard_answer)&&(Y==null||((ue=Y.user_answer)===null||ue===void 0)?void 0:ue.length)>0&&S.a.createElement("div",null,S.a.createElement("p",{className:"mt10 mb0"},"\u53C2\u8003\u7B54\u6848\uFF1A"),S.a.createElement("div",{style:{border:"1px solid #eee",background:"#f5f5f5",borderRadius:4,padding:5}},S.a.createElement(fe.a,{value:Y==null||(($=Y.standard_answer)===null||$===void 0)?void 0:$[0]}))))},ee=le,pe=Z("oBTY"),ye=c.a.TextArea,he=function(Ze){var Ye,Pe,Fe=Ze.item,ie=Ze.answerData,oe=Ze.onBlur,ue=oe===void 0?function(){}:oe,$=Object(g.useState)([]),Y=Object(_.a)($,2),q=Y[0],re=Y[1];Object(g.useEffect)(function(){for(var Se=[],Me=function(dt){var Rt,wt=(Fe==null||((Rt=Fe.user_answer)===null||Rt===void 0)?void 0:Rt.find(function(mt){return mt.choice_id===dt+1}))||{choice_id:dt+1,answer_text:""};Se.push(Object(x.a)({},wt))},at=0;at<(Fe==null?void 0:Fe.multi_count);at++)Me(at);re(Se)},[Fe==null?void 0:Fe.user_answer]);var ge=Object(g.useMemo)(function(){return q.every(function(Se){var Me,at;return((Me=Se.answer_text)===null||Me===void 0||((at=Me.trim())===null||at===void 0)?void 0:at.length)>0})},[q]);return S.a.createElement("div",null,q==null?void 0:q.map(function(Se,Me){return S.a.createElement("div",{className:"mt10",key:Me},S.a.createElement("span",null,"\u6211\u7684\u7B54\u6848\uFF08\u586B\u7A7A",Me+1,"\uFF09:"),S.a.createElement("div",null,S.a.createElement(ye,{autoSize:!0,rows:4,value:Se==null?void 0:Se.answer_text,onChange:function(vt){q[Me].answer_text=vt.target.value,re(Object(pe.a)(q))},onBlur:function(vt){return ue(Se==null?void 0:Se.answer_text,Me+1,q)},className:"overflow_hidden ".concat(Fe.user_score&&(Fe.user_score===Fe.question_score?"c-green":"c-red"))})))}),!!(Fe!=null&&(Ye=Fe.standard_answer)!==null&&Ye!==void 0&&Ye.length)&&ge&&S.a.createElement("div",null,Fe==null||((Pe=Fe.standard_answer)===null||Pe===void 0)?void 0:Pe.map(function(Se,Me){return S.a.createElement("div",{key:Me},S.a.createElement("span",null,"\u53C2\u8003\u7B54\u6848\uFF1A\uFF08\u586B\u7A7A",Me+1,"\uFF09:"),S.a.createElement("div",null,S.a.createElement(ye,{autoSize:!0,disabled:!0,value:Se==null?void 0:Se.answer_text[0]})))})))},we=he,De=Z("m3rI"),Re=Z("LvDl"),ke=a.a.Countdown,Ce=c.a.TextArea,Ae=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],ze={1:"\u672A\u53D1\u5E03",2:"\u5DF2\u53D1\u5E03",3:"\u5DF2\u622A\u6B62"},$e={1:xe.a.flagActive,2:xe.a.flagHalf},je={0:"c-red-ee4",1:"c-green"},Ve=["\u5355\u9009\u9898","\u591A\u9009\u9898","\u5224\u65AD\u9898","\u586B\u7A7A\u9898","\u7B80\u7B54\u9898","\u5B9E\u8BAD\u9898","\u7F16\u7A0B\u9898"],it=function(Ze,Ye,Pe){if(Ze.length!==Ye.length)return!1;for(var Fe=Ze.map(function(oe){var ue;return(ue=Pe.find(function($){return $.choice_id===oe}))===null||ue===void 0?void 0:ue.choice_position}),ie=0;ie<Ye.length;ie++)if(!Ye.includes(Fe[ie])||!Fe.includes(Ye[ie]))return!1;return!0},rt=function(Ze){var Ye,Pe,Fe,ie,oe,ue,$,Y,q,re,ge,Se,Me,at,vt,dt,Rt=Ze.globalSetting,wt=Ze.loading,mt=Ze.user,$t=Ze.dispatch,Pt=Object(y.a)(Ze,["globalSetting","loading","user","dispatch"]),Ft=Object(U.i)(),qt=Object(g.useState)({}),Ct=Object(_.a)(qt,2),He=Ct[0],ir=Ct[1],Rr=Object(g.useState)({}),Gr=Object(_.a)(Rr,2),Er=Gr[0],Li=Gr[1],Pr=Object(g.useState)({}),nn=Object(_.a)(Pr,2),Fr=nn[0],Vt=nn[1],ut=Object(g.useState)(!1),zr=Object(_.a)(ut,2),Tn=zr[0],pr=zr[1],kt=Object(g.useState)(!0),Vr=Object(_.a)(kt,2),kr=Vr[0],hn=Vr[1],Ke=Object(g.useState)(!1),Et=Object(_.a)(Ke,2),Qe=Et[0],Fn=Et[1],_n=Object(g.useState)(!1),an=Object(_.a)(_n,2),mn=an[0],bt=an[1],Di=Object(g.useState)(),Sn=Object(_.a)(Di,2),Nr=Sn[0],xr=Sn[1],ni=Object(g.useState)(0),wn=Object(_.a)(ni,2),Tr=wn[0],Nn=wn[1],ii=Object(g.useState)(""),pn=Object(_.a)(ii,2),$r=pn[0],Br=pn[1],ai=Object(g.useState)("none"),Cn=Object(_.a)(ai,2),gn=Cn[0],vn=Cn[1],oi=Object(g.useState)(""),_r=Object(_.a)(oi,2),Oi=_r[0],Ri=_r[1],An=Object(g.useState)({status:0}),Yr=Object(_.a)(An,2),na=Yr[0],si=Yr[1],on=Object(g.useRef)(),Bn=Object(g.useState)(0),Jr=Object(_.a)(Bn,2),Nt=Jr[0],yn=Jr[1],jn=Object(g.useState)(0),sn=Object(_.a)(jn,2),Ht=sn[0],Sr=sn[1],Wn=Object(g.useState)(!1),Hn=Object(_.a)(Wn,2),Pi=Hn[0],bn=Hn[1],ia=Object(g.useState)(!1),li=Object(_.a)(ia,2),ct=li[0],St=li[1],_t=Object(g.useState)(),It=Object(_.a)(_t,2),Bt=It[0],jt=It[1],Yt=Object(g.useState)(),Kt=Object(_.a)(Yt,2),cr=Kt[0],jr=Kt[1],Gt=Object(me.G)()||{},Qr=Gt.qid,ar=Object(g.useState)(Qr),Zr=Object(_.a)(ar,2),ln=Zr[0],un=Zr[1];Object(g.useEffect)(function(){return Object(m.a)(p.a.mark(function ft(){var ve,Ne,Ue,lt,We,Ge,pt,qe,xt,Tt,Lt,Jt,Mt,Dt,gr,qr;return p.a.wrap(function(Ot){for(;;)switch(Ot.prev=Ot.next){case 0:return Ot.next=2,Kn();case 2:ve=Ot.sent,Ne=ve||{},Ue=Ne.exercise_question_types,lt=Ue===void 0?[]:Ue,We=Object(f.a)(lt.entries()),Ot.prev=5,We.s();case 7:if((Ge=We.n()).done){Ot.next=36;break}pt=Ge.value,qe=Object(_.a)(pt,2),xt=qe[0],Tt=qe[1],Lt=Object(f.a)(Tt.items.entries()),Ot.prev=13,Lt.s();case 15:if((Jt=Lt.n()).done){Ot.next=26;break}if(Mt=Jt.value,Dt=Object(_.a)(Mt,2),gr=Dt[0],qr=Dt[1],!("".concat(qr.item_bank_id)===Qr)){Ot.next=24;break}return yn(xt),Sr(gr),Ot.abrupt("return");case 24:Ot.next=15;break;case 26:Ot.next=31;break;case 28:Ot.prev=28,Ot.t0=Ot.catch(13),Lt.e(Ot.t0);case 31:return Ot.prev=31,Lt.f(),Ot.finish(31);case 34:Ot.next=7;break;case 36:Ot.next=41;break;case 38:Ot.prev=38,Ot.t1=Ot.catch(5),We.e(Ot.t1);case 41:return Ot.prev=41,We.f(),Ot.finish(41);case 44:case"end":return Ot.stop()}},ft,null,[[5,38,41,44],[13,28,31,34]])}))(),window.addEventListener("message",ki),function(){window.removeEventListener("message",ki),window.removeEventListener("beforeunload",Ma),location.pathname.indexOf("/detail")>-1&&Object(Ee.b)()}},[Ft.categoryId]);var ki=function(ve){ve.data==="backExercise"&&(vn("none"),Br(""),Kn())},Ma=function(ve){var Ne="\u786E\u5B9A\u79BB\u5F00\u6B64\u9875\u9762\u5417?\u6B64\u9875\u6570\u636E\u53EF\u80FD\u4F1A\u4E22\u5931";return(ve||window.event).returnValue=Ne,Ne},Kn=function(){var ft=Object(m.a)(p.a.mark(function ve(){var Ne,Ue,lt,We,Ge;return p.a.wrap(function(qe){for(;;)switch(qe.prev=qe.next){case 0:return pr(!0),qe.next=3,Object(Te.Y)(Object(x.a)(Object(x.a)({},Ft),{},{login:Ft.login,exercise_id:Ft.categoryId})).catch(function(){return pr(!1)});case 3:if(Ue=qe.sent,((Ne=Ue)===null||Ne===void 0?void 0:Ne.exercise)&&(Ue.exercise.user_exercise_status=1),pr(!1),!Ue){qe.next=10;break}return Ue.exercise_types=((lt=Ue)===null||lt===void 0?void 0:lt.exercise_types)||((We=Ue)===null||We===void 0||((Ge=We.exercise_scores)===null||Ge===void 0)?void 0:Ge.exercise_types),ir(Ue),qe.abrupt("return",Ue);case 10:case"end":return qe.stop()}},ve)}));return function(){return ft.apply(this,arguments)}}();Object(g.useEffect)(function(){var ft,ve,Ne;((ft=He.exercise)===null||ft===void 0?void 0:ft.time)===0&&zn(),((ve=He.exercise)===null||ve===void 0?void 0:ve.time)&&xr(Date.now()+(He==null||((Ne=He.exercise)===null||Ne===void 0)?void 0:Ne.time)*1e3*60)},[(Ye=He.exercise)===null||Ye===void 0?void 0:Ye.time]);var xo=function(){var ve;(He==null||((ve=He.exercise)===null||ve===void 0)?void 0:ve.exercise_status)===3?u.a.confirm({width:530,title:"\u63D0\u793A",centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:S.a.createElement("div",{className:"tc font16"},"\u622A\u6B62\u65F6\u95F4\u5DF2\u5230\uFF0C\u65E0\u6CD5\u6253\u56DE\u8BD5\u5377",S.a.createElement("br",null),"\u8BF7\u5728\u4FEE\u6539\u622A\u6B62\u65F6\u95F4\u540E\u518D\u64CD\u4F5C")}):u.a.confirm({width:530,title:"\u63D0\u793A",centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:S.a.createElement("div",{className:"tc font16"},"\u5B66\u751F\u5C06\u5F97\u5230\u4E00\u6B21\u91CD\u65B0\u7B54\u9898\u7684\u673A\u4F1A\uFF0C\u73B0\u6709\u7684\u7B54\u9898\u60C5\u51B5\u5C06\u88AB\u6E05\u7A7A",S.a.createElement("br",null),"\u662F\u5426\u786E\u8BA4\u56DE\u9000TA\u7684\u8BD5\u5377\u7B54\u9898"),onOk:function(){var Ne=Object(m.a)(p.a.mark(function lt(){var We,Ge;return p.a.wrap(function(qe){for(;;)switch(qe.prev=qe.next){case 0:return qe.next=2,Object(Te.R)({categoryId:Ft.categoryId,user_ids:[He==null||((We=He.exercise_answer_user)===null||We===void 0)?void 0:We.user_id]});case 2:Ge=qe.sent,Ge&&(o.b.info(Ge==null?void 0:Ge.message),aa());case 4:case"end":return qe.stop()}},lt)}));function Ue(){return Ne.apply(this,arguments)}return Ue}()})},aa=function(){Kn()},ui=function(){var ft=Object(m.a)(p.a.mark(function ve(Ne){var Ue;return p.a.wrap(function(We){for(;;)switch(We.prev=We.next){case 0:return We.next=2,Object(ce.A)({id:Ne.shixun_identifier});case 2:Ue=We.sent,Ue!=null&&Ue.game_identifier&&(Br("/tasks/".concat(Ue.game_identifier,"?type=exercises&exercisesId=").concat(Ft.categoryId,"&coursesId=").concat(Ft.coursesId,"&login=").concat(Ft.login,"&questionId=").concat(Ne.question_id)),vn("block")),(Ue==null?void 0:Ue.status)===-3?Object(me.o)():(Ue==null?void 0:Ue.status)===2?Ia(Ue==null?void 0:Ue.message,Ne.question_id):(Ue==null?void 0:Ue.status)===3&&Mi(Ue==null?void 0:Ue.message);case 5:case"end":return We.stop()}},ve)}));return function(Ne){return ft.apply(this,arguments)}}(),Ia=function ft(ve,Ne){var Ue;ve=(Ue=ve)!==null&&Ue!==void 0&&Ue.includes(".json")?ve:"".concat(ve,".json"),u.a.confirm({centered:!0,title:"\u63D0\u793A",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:S.a.createElement("div",{className:"tc font16"},"\u5B9E\u8BAD\u5DF2\u7ECF\u66F4\u65B0\u4E86\uFF0C\u6B63\u5728\u4E3A\u60A8\u91CD\u7F6E!"),onOk:function(){var lt=Object(m.a)(p.a.mark(function Ge(){var pt,qe;return p.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:return Tt.next=2,Object(Te.S)({url:ve});case 2:if(pt=Tt.sent,pt){Tt.next=5;break}return Tt.abrupt("return");case 5:return o.b.success("\u91CD\u7F6E\u6210\u529F\uFF0C\u6B63\u5728\u8FDB\u5165\u5B9E\u8BAD\uFF01"),Tt.next=8,Object(ce.A)({id:pt.shixun_identifier});case 8:if(qe=Tt.sent,!(qe!=null&&qe.game_identifier)){Tt.next=12;break}return ui({shixun_identifier:qe==null?void 0:qe.game_identifier,question_id:Ne}),Tt.abrupt("return");case 12:(qe==null?void 0:qe.status)===2?ft(qe==null?void 0:qe.message,Ne):(qe==null?void 0:qe.status)===3&&Mi(qe==null?void 0:qe.message);case 13:case"end":return Tt.stop()}},Ge)}));function We(){return lt.apply(this,arguments)}return We}()})},Mi=function(ve){u.a.confirm({centered:!0,title:"\u63D0\u793A",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:S.a.createElement("div",{className:"tc font16"},"\u76EE\u524D\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5C1A\u5728\u5185\u6D4B\u4E2D\uFF0C\u5C06\u4E8E",ve,"\u4E4B\u540E\u5F00\u653E\uFF0C\u8C22\u8C22\uFF01")})},di=function(ve){ve.redo?u.a.info({width:530,title:"\u63D0\u793A",centered:!0,okText:"\u786E\u5B9A",content:S.a.createElement("div",{className:"tc font16"},"\u60A8\u4E4B\u524D\u5DF2\u7ECF\u6311\u6218\u8FC7\u8BE5\u5B9E\u8BAD\uFF0C\u8003\u8BD5\u8FC7\u7A0B\u4E2D\u9700\u8981\u91CD\u65B0\u6311\u6218"),onOk:function(){var Ne=Object(m.a)(p.a.mark(function lt(){var We,Ge,pt,qe;return p.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:return Tt.next=2,Object(Te.S)({id:ve.myshixun_identifier,url:ve.url});case 2:We=Tt.sent,We&&(Ge=Object(Re.cloneDeep)(He==null?void 0:He.exercise_question_types),pt=Ge==null?void 0:Ge.findIndex(function(Lt){return Lt.question_type===5}),Ge[pt].items.find(function(Lt){return Lt.question_id===ve.question_id}).redo=!1,Ge[pt].items.find(function(Lt){return Lt.question_id===ve.question_id}).shixun_identifier=We.shixun_identifier,He.exercise_question_types=Ge,ir(He),qe=Object(x.a)(Object(x.a)({},ve),{},{shixun_identifier:We.shixun_identifier}),ui(qe));case 4:case"end":return Tt.stop()}},lt)}));function Ue(){return Ne.apply(this,arguments)}return Ue}()}):ui(ve)},Ln=function(){var ft=Object(m.a)(p.a.mark(function ve(Ne){var Ue;return p.a.wrap(function(We){for(;;)switch(We.prev=We.next){case 0:if(!Ne.hack_identifier){We.next=5;break}return We.next=3,Object(Te.X)({id:Ne.hack_identifier});case 3:Ue=We.sent,(Ue==null?void 0:Ue.status)===0&&(Br("/myproblems/".concat(Ue.identifier,"?type=exercises&exercisesId=").concat(Ft.categoryId,"&coursesId=").concat(Ft.coursesId,"&login=").concat(Ft.login,"&questionId=").concat(Ne.question_id)),vn("block"));case 5:case"end":return We.stop()}},ve)}));return function(Ne){return ft.apply(this,arguments)}}(),Gn=function(){var ft=Object(m.a)(p.a.mark(function ve(Ne,Ue,lt,We){var Ge;return p.a.wrap(function(qe){for(;;)switch(qe.prev=qe.next){case 0:if(Ne){qe.next=3;break}return console.error("handleSave no questionId params"),qe.abrupt("return");case 3:return qe.next=5,Object(Te.cb)({questionId:Ne,exercise_choice_id:Ue,answer_text:lt});case 5:Ge=qe.sent,(Ge==null?void 0:Ge.status)===0&&(We&&We());case 7:case"end":return qe.stop()}},ve)}));return function(Ne,Ue,lt,We){return ft.apply(this,arguments)}}(),oa=function(ve){return S.a.createElement("div",null,S.a.createElement(b.a,{strokeColor:{from:"#108ee9",to:"#87d068"},status:"active",percent:ve}),S.a.createElement("div",{className:"c-grey-c tc mt10 mb20"},"\u6B63\u5728\u5224\u5206\u4E2D\u2026"))},Ua=function(){var ve=0,Ne=u.a.info({title:"\u4EA4\u5377\u4E2D",icon:null,className:"modal-footer-none",content:oa(ve)}),Ue=setInterval(function(){ve<=100?(ve+=2,Ne.update({content:oa(ve)})):(Ne.destroy(),clearInterval(Ue))},50)},zn=function(){var ft=Object(m.a)(p.a.mark(function ve(){var Ne;return p.a.wrap(function(lt){for(;;)switch(lt.prev=lt.next){case 0:return Ua(),lt.next=3,Object(Te.ab)({categoryId:Ft.categoryId,commit_method:1});case 3:Ne=lt.sent,Object(Ee.b)(),$t({type:"exercise/setActionTabs",payload:Object(x.a)({},{removeEventListenerExitScreen:!0})}),(Ne==null?void 0:Ne.status)===0&&(o.b.success(Ne==null?void 0:Ne.message),Fn(!1),setTimeout(function(){u.a.info({title:"\u4EA4\u5377\u6210\u529F\uFF01",okText:"\u786E\u5B9A",onOk:function(){aa()}})},3e3));case 7:case"end":return lt.stop()}},ve)}));return function(){return ft.apply(this,arguments)}}(),or=function(){var ft=Object(m.a)(p.a.mark(function ve(Ne,Ue,lt,We){return p.a.wrap(function(pt){for(;;)switch(pt.prev=pt.next){case 0:case"end":return pt.stop()}},ve)}));return function(Ne,Ue,lt,We){return ft.apply(this,arguments)}}(),Fa=function(){var ft=Object(m.a)(p.a.mark(function ve(Ne,Ue,lt,We,Ge){var pt,qe,xt,Tt;return p.a.wrap(function(Jt){for(;;)switch(Jt.prev=Jt.next){case 0:We.user_answer=[],We.user_answer.push(Ne),Tt=Ge==null||((pt=Ge.sub_exercise_questions)===null||pt===void 0)?void 0:pt.filter(function(Mt){var Dt;return((Dt=Mt.user_answer)===null||Dt===void 0?void 0:Dt.length)===0}),He.question_status.find(function(Mt){return Mt.ques_id===Ue}).ques_status=(Tt==null?void 0:Tt.length)===(Ge==null||((qe=Ge.sub_exercise_questions)===null||qe===void 0)?void 0:qe.length)?0:(Tt==null?void 0:Tt.length)>0&&(Tt==null?void 0:Tt.length)<(Ge==null||((xt=Ge.sub_exercise_questions)===null||xt===void 0)?void 0:xt.length)?2:1,ir(Object(x.a)({},He));case 5:case"end":return Jt.stop()}},ve)}));return function(Ne,Ue,lt,We,Ge){return ft.apply(this,arguments)}}(),sa=function(ve,Ne,Ue,lt,We){Gn(Ue,Ne,ve,function(){var Ge={choice_id:Ne,answer_text:ve};We.user_answer.sort(function(pt,qe){return pt.choice_id-qe.choice_id}),We.user_answer[Ne-1]=Ge,We.repeat_answer||(We.israp=!0),ir(Object(x.a)({},He))})},Vn=function(ve,Ne,Ue){Gn(Ne,null,ve,function(){He.question_status.find(function(lt){return lt.ques_id===Ne}).ques_status=ve?1:0,Ue.user_answer=[],Ue.user_answer.push(ve),Ue.repeat_answer||(Ue.israp=!0),ir(Object(x.a)({},He))})},la=function(ve){var Ne,Ue,lt,We=ve.item,Ge=Object(g.useState)(We==null||((Ne=We.user_answer)===null||Ne===void 0)?void 0:Ne[0]),pt=Object(_.a)(Ge,2),qe=pt[0],xt=pt[1],Tt=Object(g.useState)(!1),Lt=Object(_.a)(Tt,2),Jt=Lt[0],Mt=Lt[1];return S.a.createElement("div",null,S.a.createElement(A.a.Group,{defaultValue:We==null||((Ue=We.user_answer)===null||Ue===void 0)?void 0:Ue[0],onChange:function(gr){xt(gr.target.value)},className:We.user_score&&"edu-radio-".concat(We.user_score===We.question_score?"green":"red")},We==null||((lt=We.question_choices)===null||lt===void 0)?void 0:lt.map(function(Dt,gr){var qr=We.question_type==2,cn=qr?"":"".concat(Ae[gr],".");return S.a.createElement("div",{className:xe.a.answerWrap,key:gr},S.a.createElement(A.a,{value:Dt==null?void 0:Dt.choice_id},S.a.createElement("span",{className:"mr3"},cn),S.a.createElement(fe.a,{className:xe.a.renderHtml,value:Dt==null?void 0:Dt.choice_text})))})),S.a.createElement(L.a,{justify:"end",style:{marginBottom:10}},S.a.createElement(C.a,{type:"primary",className:"font16 ml20",loading:Jt,onClick:function(){if(!qe){o.b.info("\u8BF7\u52FF\u63D0\u4EA4\u7A7A\u7684\u7B54\u6848");return}Mt(!0),Gn(We==null?void 0:We.question_id,qe,null,function(){We.user_answer=[],We.user_answer.push(qe),We.repeat_answer||(We.israp=!0),ir(Object(x.a)({},He)),Mt(!1)})}},"\u63D0\u4EA4\u7B54\u6848")))},ua=function(ve){var Ne,Ue=ve.items,lt=ve.keys,We=ve.i;return S.a.createElement("div",null,Ue==null||((Ne=Ue.sub_exercise_questions)===null||Ne===void 0)?void 0:Ne.map(function(Ge,pt){var qe,xt,Tt,Lt=Object(g.useState)(Ge==null||((qe=Ge.user_answer)===null||qe===void 0)?void 0:qe[0]),Jt=Object(_.a)(Lt,2),Mt=Jt[0],Dt=Jt[1],gr=Object(g.useState)(!1),qr=Object(_.a)(gr,2),cn=qr[0],Ot=qr[1];return S.a.createElement("div",null,S.a.createElement("div",{style:{display:"flex",marginTop:20,userSelect:"none"}},S.a.createElement("span",{style:{flexShrink:0},className:"font18"},We+1+"."+(pt+1),"\uFF08\u5355\u9009\u9898\uFF09"),S.a.createElement(fe.a,{value:Ge==null?void 0:Ge.question_title}),S.a.createElement("span",{style:{flexShrink:0},className:"font16"},"\uFF08",Ge==null?void 0:Ge.question_score,"\u5206\uFF09")),S.a.createElement(A.a.Group,{defaultValue:Ge==null||((xt=Ge.user_answer)===null||xt===void 0)?void 0:xt[0],onChange:function(vr){Dt(vr.target.value),Fa(vr.target.value,Ue==null?void 0:Ue.question_id,pt,Ge,Ue)},className:Ge.user_score&&"edu-radio-".concat(Ge.user_score===Ge.question_score?"green":"red")},Ge==null||((Tt=Ge.question_choices)===null||Tt===void 0)?void 0:Tt.map(function(Mr,vr){var Xr=Ge.question_type==2,Wr=Xr?"":"".concat(Ae[vr],".");return S.a.createElement("div",{className:xe.a.answerWrap,key:vr},S.a.createElement(A.a,{value:Mr==null?void 0:Mr.choice_id},S.a.createElement("span",{className:"mr3"},Wr),S.a.createElement(fe.a,{className:xe.a.renderHtml,value:Mr==null?void 0:Mr.choice_text})))})),S.a.createElement(L.a,{justify:"end",style:{marginBottom:10}},S.a.createElement(C.a,{type:"primary",className:"font16 ml20",loading:cn,onClick:function(){if(!Mt){o.b.info("\u8BF7\u52FF\u63D0\u4EA4\u7A7A\u7684\u7B54\u6848");return}Ot(!0),Gn(Ge.question_id,Mt,null,function(){var vr,Xr,Wr;Ge.user_answer=[],Ge.user_answer.push(Mt);var wr=Ue==null||((vr=Ue.sub_exercise_questions)===null||vr===void 0)?void 0:vr.filter(function(ci){var Xn;return((Xn=ci.user_answer)===null||Xn===void 0?void 0:Xn.length)===0});He.question_status.find(function(ci){return ci.ques_id===Ue.question_id}).ques_status=(wr==null?void 0:wr.length)===(Ue==null||((Xr=Ue.sub_exercise_questions)===null||Xr===void 0)?void 0:Xr.length)?0:(wr==null?void 0:wr.length)>0&&(wr==null?void 0:wr.length)<(Ue==null||((Wr=Ue.sub_exercise_questions)===null||Wr===void 0)?void 0:Wr.length)?2:1,ir(Object(x.a)({},He)),Ot(!1)})}},"\u63D0\u4EA4\u7B54\u6848")))}))},Na=function(ve){var Ne,Ue=ve.item,lt=Object(g.useState)(Ue==null?void 0:Ue.user_answer),We=Object(_.a)(lt,2),Ge=We[0],pt=We[1],qe=Object(g.useState)(!1),xt=Object(_.a)(qe,2),Tt=xt[0],Lt=xt[1],Jt=Ue==null?void 0:Ue.question_id;return S.a.createElement("div",null,S.a.createElement(k.a.Group,{defaultValue:Ue==null?void 0:Ue.user_answer,onChange:function(Dt){pt(Dt)},className:Ue.user_score&&"edu-checkbox-".concat(Ue.user_score===Ue.question_score?"green":"red")},Ue==null||((Ne=Ue.question_choices)===null||Ne===void 0)?void 0:Ne.map(function(Mt,Dt){var gr="".concat(Ae[Dt],".");return S.a.createElement("div",{className:xe.a.answerWrap,key:Mt.choice_id},S.a.createElement(k.a,{value:Mt==null?void 0:Mt.choice_id},S.a.createElement("span",{className:"mr3"},gr),S.a.createElement(fe.a,{className:xe.a.renderHtml,value:Mt==null?void 0:Mt.choice_text})))})),S.a.createElement(L.a,{justify:"end",style:{marginBottom:10}},S.a.createElement(C.a,{type:"primary",className:"font16 ml20",loading:Tt,onClick:function(){if(!(Ge!=null&&Ge.length)){o.b.info("\u8BF7\u52FF\u63D0\u4EA4\u7A7A\u7684\u7B54\u6848");return}Lt(!0),Gn(Jt,Ge,null,function(){Ue.user_answer=Ge,Ue.repeat_answer||(Ue.israp=!0),He.question_status.find(function(Dt){return Dt.ques_id===Jt}).ques_status=Ge!=null&&Ge.length?1:0,ir(Object(x.a)({},He)),Lt(!1)})}},"\u63D0\u4EA4\u7B54\u6848")))},Ii=function(ve){var Ne=ve.item;return S.a.createElement(we,{item:Ne,answerData:He,onBlur:function(lt,We,Ge){return sa(lt,We,Ne==null?void 0:Ne.question_id,Ge,Ne)}})},da=function(ve){var Ne=ve.item;return S.a.createElement(ee,{item:Ne,answerData:He,onBlur:function(lt){return Vn(lt,Ne==null?void 0:Ne.question_id,Ne)}})},dn=function(ve,Ne,Ue){var lt,We,Ge=He==null||((lt=He.exercise_question_types)===null||lt===void 0)?void 0:lt.find(function(pt){return pt.question_type===Ne});return S.a.createElement(S.a.Fragment,null,S.a.createElement("h1",{className:"font14 current",onClick:function(){Fr[Ne]=!Fr[Ne],Vt(Object(x.a)({},Fr))}},!Fr[Ne]&&S.a.createElement(N.a,null),Fr[Ne]&&S.a.createElement(I.a,null),S.a.createElement("span",{className:"ml5 c-grey-666"},ve)),S.a.createElement("ul",{className:xe.a.answerSheet,key:Ne},!Fr[Ne]&&(Ge==null||((We=Ge.items)===null||We===void 0)?void 0:We.map(function(pt,qe){var xt=pt.question_type,Tt=pt.item_bank_id,Lt=pt.user_answer,Jt=pt.standard_answer,Mt=pt.question_choices,Dt=Mt===void 0?[]:Mt,gr=xt===3||xt===4||it(Lt,Jt,Dt)?xe.a.correct:xe.a.wrong;if(pt.question_type===Ne)return S.a.createElement("li",{onClick:function(){var cn;if(He.exercise_question_types[Nt].items[Ht].israp=!1,ir(Object(x.a)({},He)),!ct&&(He==null||((cn=He.exercise)===null||cn===void 0)?void 0:cn.user_exercise_status)===0&&Object(Le.r)()){var Ot,Mr,vr,Xr;if(!((Ot=He.exercise_question_types)!==null&&Ot!==void 0&&(Mr=Ot[Nt])!==null&&Mr!==void 0&&(vr=Mr.items)!==null&&vr!==void 0&&(Xr=vr[Ht])!==null&&Xr!==void 0&&Xr.repeat_answer)){bn(!0),jt(3),jr({oneindex:Ue,twoindex:qe});return}}un(Tt),yn(Ue),Sr(qe);var Wr="Anchor_".concat(Ne,"_").concat(qe),wr=document.getElementById(Wr);wr&&setTimeout(function(){return wr.scrollIntoView({block:"start",behavior:"smooth"})})},key:qe,className:"".concat(gr,`
|
|
`).concat(Lt.length===0?xe.a.abandon:"",`
|
|
`).concat("".concat(ln)==="".concat(Tt)?xe.a.active:"",`
|
|
|
|
`)},qe+1)}))))},Ba=function(ve,Ne){var Ue,lt,We,Ge,pt,qe;return S.a.createElement("div",{className:xe.a.questionItem,id:"Anchor_".concat(ve==null?void 0:ve.question_type,"_").concat(Ne)},S.a.createElement("div",{style:{display:"flex",marginTop:20,userSelect:"none"}},S.a.createElement("span",{style:{flexShrink:0},className:"font18"},Ne+1,"."),S.a.createElement(fe.a,{value:ve==null?void 0:ve.question_title}),S.a.createElement("span",{style:{flexShrink:0},className:"font16"},"\uFF08",(ve==null?void 0:ve.question_type)===7?"\u5171".concat(ve==null||((Ue=ve.sub_exercise_questions)===null||Ue===void 0)?void 0:Ue.length,"\u5C0F\u9898\uFF0C"):"",ve==null?void 0:ve.question_score,"\u5206\uFF09"),!(ve!=null&&ve.repeat_answer)&&S.a.createElement("span",{style:{color:"#FA6400 ",marginLeft:10,fontSize:16}},"\u6CE8\u610F\uFF1A\u8BE5\u9898\u4E0D\u5141\u8BB8\u91CD\u590D\u7B54\u9898"),!!(ve!=null&&(lt=ve.schools)!==null&<!==void 0&<.length)&&S.a.createElement(P.a,{title:"\u8BE5\u5B9E\u8BAD\u9898\u9762\u5411\u6307\u5B9A\u5355\u4F4D\u5F00\u653E"},S.a.createElement("i",{className:"iconfont icon-zhidinggongkai1 line24 font18 c-orange"}))),(ve==null?void 0:ve.question_type)==0&&S.a.createElement(la,{item:ve}),(ve==null?void 0:ve.question_type)==2&&S.a.createElement(la,{item:ve}),(ve==null?void 0:ve.question_type)==1&&S.a.createElement(Na,{item:ve}),(ve==null?void 0:ve.question_type)==3&&S.a.createElement(Ii,{item:ve}),(ve==null?void 0:ve.question_type)==4&&S.a.createElement(da,{item:ve}),(ve==null?void 0:ve.question_type)==7&&S.a.createElement(ua,{items:ve,keys:ve==null?void 0:ve.question_type,i:Ne}),!!(ve!=null&&(We=ve.answer_comments)!==null&&We!==void 0&&We.length)&&S.a.createElement("div",{className:"mt30"},ve==null||((Ge=ve.answer_comments)===null||Ge===void 0)?void 0:Ge.map(function(xt,Tt){var Lt,Jt;return S.a.createElement("div",null,S.a.createElement(L.a,{align:"middle",gutter:[0,10]},S.a.createElement(H.a,{flex:"50px"},S.a.createElement("img",{src:De.a.API_SERVER+"/images/"+((Lt=xt.user)===null||Lt===void 0?void 0:Lt.image_url),width:"40",style:{borderRadius:40}})),S.a.createElement(H.a,{flex:"1"},xt.updated_at,S.a.createElement("br",null),(Jt=xt.user)===null||Jt===void 0?void 0:Jt.name),S.a.createElement(H.a,{className:"c-grey-c"},xt.shixun_chanllge_position&&S.a.createElement("span",null,"\u7B2C",xt.shixun_chanllge_position,"\u5173"),ve.question_type!==4&&S.a.createElement("span",null,"\u539F\u59CB\u5F97\u5206",xt.origin_score,"\u5206 \uFF0C")," ","\u4FEE\u6B63\u4E3A",xt.score,"\u5206")),xt.comment&&S.a.createElement(L.a,{align:"middle",gutter:[0,10]},S.a.createElement(H.a,{flex:"50px"}),S.a.createElement(H.a,{flex:"1"},S.a.createElement(Ce,{autoSize:!0,value:xt.comment,disabled:!0}))))})),S.a.createElement("div",{className:xe.a.itemType},S.a.createElement(L.a,null,(ve==null?void 0:ve.question_type)==5&&!((pt=He.exercise)!==null&&pt!==void 0&&pt.commit_status)&&S.a.createElement(C.a,{type:"primary",className:"font16 ml20",onClick:function(){return di(ve)}},"\u8FDB\u5165\u7B54\u9898"),(ve==null?void 0:ve.question_type)==6&&!((qe=He.exercise)!==null&&qe!==void 0&&qe.commit_status)&&S.a.createElement(C.a,{type:"primary",className:"font16 ml20",onClick:function(){return Ln(ve)}},"\u8FDB\u5165\u7B54\u9898")),(ve==null?void 0:ve.question_type)<3&&(ve==null?void 0:ve.standard_answer_show)&&(ve==null?void 0:ve.user_answer.length)>0&&S.a.createElement(L.a,null,S.a.createElement(H.a,null,S.a.createElement("span",{className:"font16 ml20"},"\u6B63\u786E\u7B54\u6848\uFF1A",ve==null?void 0:ve.standard_answer_show),S.a.createElement(L.a,{style:{marginTop:20}},S.a.createElement(fe.a,{className:xe.a.analysis,value:"\u89E3\u6790:".concat(ve==null?void 0:ve.analysis)}))))))},ca=function(ve,Ne){return S.a.createElement(g.Fragment,null,ve.question_type===0&&dn("\u5355\u9009\u9898",0,Ne),ve.question_type===1&&dn("\u591A\u9009\u9898",1,Ne),ve.question_type===2&&dn("\u5224\u65AD\u9898",2,Ne),ve.question_type===3&&dn("\u586B\u7A7A\u9898",3,Ne),ve.question_type===4&&dn("\u7B80\u7B54\u9898",4,Ne),ve.question_type===5&&dn("\u5B9E\u8BAD\u9898",5,Ne),ve.question_type===6&&dn("\u7F16\u7A0B\u9898",6,Ne),ve.question_type===7&&dn("\u7EC4\u5408\u9898",7,Ne))},fa=function(ve){var Ne=["\u96F6","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u4E03","\u516B","\u4E5D"],Ue=["","\u5341","\u767E","\u5343","\u4E07"];ve=parseInt(ve);var lt=function(qe){for(var xt=qe.toString().split("").reverse(),Tt="",Lt=0;Lt<xt.length;Lt++)Tt=(Lt==0&&xt[Lt]==0||Lt>0&&xt[Lt]==0&&xt[Lt-1]==0?"":Ne[xt[Lt]]+(xt[Lt]==0?Ue[0]:Ue[Lt]))+Tt;return Tt},We=Math.floor(ve/1e4),Ge=ve%1e4;return Ge.toString().length<4&&(Ge="0"+Ge),We?lt(We)+"\u4E07"+lt(Ge):lt(ve)},ja=function(){var ve,Ne,Ue,lt,We;return S.a.createElement(g.Fragment,{key:Nt},S.a.createElement("div",{className:"pt20"},S.a.createElement("span",{className:"font16 c-light-primary"},fa(Nt+1),"\u3001",He==null||((ve=He.exercise_question_types)===null||ve===void 0||((Ne=ve[Nt])===null||Ne===void 0))?void 0:Ne.name)),S.a.createElement(g.Fragment,{key:Ht},Ba(He==null||((Ue=He.exercise_question_types)===null||Ue===void 0||((lt=Ue[Nt])===null||lt===void 0||((We=lt.items)===null||We===void 0)))?void 0:We[Ht],Ht)))};return S.a.createElement(K.a,{size:"large",spinning:Tn},mn&&S.a.createElement(ne.a,{iframe:on}),S.a.createElement("iframe",{style:{display:gn},id:"iframeShixuns",className:xe.a.iframe,src:$r,ref:on,frameBorder:"0"}),S.a.createElement("section",{className:"edu-container"},S.a.createElement("section",{className:"animated fadeIn"},S.a.createElement("aside",{className:[xe.a.title,"mt10"].join(" ")},S.a.createElement(L.a,{style:{width:"100%"},align:"middle"},S.a.createElement(H.a,{flex:"1"},S.a.createElement("div",{className:xe.a.title},(Rt==null?void 0:Rt.showHeaderFooter)&&S.a.createElement(j.a,{to:"/onlineexercise"},S.a.createElement(V.a,{className:"font16 c-black"})),S.a.createElement("strong",{className:"font24 ml5"},He==null||((Pe=He.exercise)===null||Pe===void 0)?void 0:Pe.exercise_name)))))),na.status===0&&S.a.createElement(L.a,{className:"mt10"},S.a.createElement(H.a,{flex:kr?"316px":"16px"},S.a.createElement("section",{style:{position:"sticky",top:0,zIndex:1}},Qe&&S.a.createElement(Q.a,{number:(He==null||((Fe=He.exercise)===null||Fe===void 0)?void 0:Fe.photo_count)-(He==null||((ie=He.exercise)===null||ie===void 0)?void 0:ie.take_photo),time:(oe=He.exercise)===null||oe===void 0?void 0:oe.left_time,update:Kn,supportCamera:function(ve){ve===2?(Kn(),bt(Er==null?void 0:Er.screen_open)):ve===1&&setTimeout(function(){return Pt.history.push("/")},3e3)}}),S.a.createElement("div",{className:"relative",style:{minHeight:236}},kr&&S.a.createElement("aside",{className:"bg-white p16"},S.a.createElement(L.a,{align:"middle"},S.a.createElement(H.a,{span:6},S.a.createElement("span",{className:"font16 blod"},"\u7B54\u9898\u5361")),S.a.createElement(H.a,{span:18},S.a.createElement("div",{className:"tr",style:{display:"flex",alignItems:"center",justifyContent:"end"}},S.a.createElement("span",{className:"".concat(xe.a.answerYes)}),"\u5F53\u524D",S.a.createElement("span",{className:"".concat(xe.a.answerYes," ").concat(xe.a.correct," ml10")}),"\u7B54\u5BF9",S.a.createElement("span",{style:{width:13,height:13,display:"flex",flexDirection:"column-reverse",background:"#d9011b"},className:"".concat(xe.a.answerNo," ml10")}),"\u7B54\u9519",S.a.createElement("span",{className:"".concat(xe.a.answerNo," ml10")}),"\u672A\u7B54"))),S.a.createElement("aside",{className:xe.a.answerInfo},S.a.createElement(L.a,null,S.a.createElement(S.a.Fragment,null,S.a.createElement(H.a,{span:12},"\u5237\u9898\u8FDB\u5EA6"),S.a.createElement(H.a,{span:12,className:"tr c-blue"},He==null||((ue=He.question_status)===null||ue===void 0||(($=ue.filter(function(ft){return(ft==null?void 0:ft.ques_status)===1}))===null||$===void 0))?void 0:$.length,"/ ",He==null||((Y=He.exercise_types)===null||Y===void 0)?void 0:Y.q_counts),S.a.createElement(H.a,{span:24},S.a.createElement(b.a,{trailColor:"#c3ced2",percent:(He==null||((q=He.question_status)===null||q===void 0||((re=q.filter(function(ft){return(ft==null?void 0:ft.ques_status)===1}))===null||re===void 0))?void 0:re.length)/(He==null||((ge=He.exercise_types)===null||ge===void 0)?void 0:ge.q_counts)*100,showInfo:!1}))))),S.a.createElement(L.a,null,S.a.createElement(H.a,{flex:"1"},S.a.createElement("aside",{className:xe.a.cardList},He==null||((Se=He.exercise_question_types)===null||Se===void 0)?void 0:Se.map(function(ft,ve){return S.a.createElement(g.Fragment,{key:ft.question_type},ca(ft,ve))}))))),S.a.createElement("div",{className:xe.a.fold,onClick:function(){return hn(!kr)}},kr&&S.a.createElement("span",{className:"icon-zuojiantou iconfont c-grey-c"}),!kr&&S.a.createElement("span",{className:"icon-youjiantou iconfont c-grey-c"}))))),S.a.createElement(H.a,{flex:"1"},S.a.createElement("section",{className:[xe.a.bg,"pl30","pr30","pb30","mb50","ml20"].join(" ")},S.a.createElement("div",{style:{maxHeight:600,overflow:"hidden auto"}},ja()),S.a.createElement("div",{style:{marginTop:60,textAlign:"center"}},(Nt!=0||Ht!=0)&&S.a.createElement(C.a,{className:"".concat(xe.a.submitButton," mr10"),type:"default",onClick:function(){var ve,Ne,Ue,lt,We;if(He.exercise_question_types[Nt].items[Ht].israp=!1,ir(Object(x.a)({},He)),!ct&&(He==null||((ve=He.exercise)===null||ve===void 0)?void 0:ve.user_exercise_status)===0&&Object(Le.r)()){var Ge,pt,qe,xt;if(!((Ge=He.exercise_question_types)!==null&&Ge!==void 0&&(pt=Ge[Nt])!==null&&pt!==void 0&&(qe=pt.items)!==null&&qe!==void 0&&(xt=qe[Ht])!==null&&xt!==void 0&&xt.repeat_answer)){bn(!0),jt(1);return}}Ht===0?(Nt-=1,Ht=He.exercise_question_types[Nt].items.length-1):Ht-=1,yn(Nt),Sr(Ht),un((Ne=He.exercise_question_types)===null||Ne===void 0||((Ue=Ne[Nt])===null||Ue===void 0||((lt=Ue.items)===null||lt===void 0||((We=lt[Ht])===null||We===void 0)))?void 0:We.item_bank_id)}},"\u4E0A\u4E00\u9898"),!(Nt===(He==null||((Me=He.exercise_question_types)===null||Me===void 0)?void 0:Me.length)-1&&Ht===(He==null||((at=He.exercise_question_types)===null||at===void 0||((vt=at[Nt])===null||vt===void 0||((dt=vt.items)===null||dt===void 0)))?void 0:dt.length)-1)&&S.a.createElement(C.a,{className:xe.a.submitButton,type:"primary",onClick:function(){var ve,Ne,Ue,lt,We;if(He.exercise_question_types[Nt].items[Ht].israp=!1,ir(Object(x.a)({},He)),!ct&&(He==null||((ve=He.exercise)===null||ve===void 0)?void 0:ve.user_exercise_status)===0&&Object(Le.r)()){var Ge,pt,qe,xt;if(!((Ge=He.exercise_question_types)!==null&&Ge!==void 0&&(pt=Ge[Nt])!==null&&pt!==void 0&&(qe=pt.items)!==null&&qe!==void 0&&(xt=qe[Ht])!==null&&xt!==void 0&&xt.repeat_answer)){bn(!0),jt(2);return}}He.exercise_question_types[Nt].items.length-1===Ht?(Nt=Nt+1,Ht=0):Ht=Ht+1,yn(Nt),Sr(Ht),un((Ne=He.exercise_question_types)===null||Ne===void 0||((Ue=Ne[Nt])===null||Ue===void 0||((lt=Ue.items)===null||lt===void 0||((We=lt[Ht])===null||We===void 0)))?void 0:We.item_bank_id)}},"\u4E0B\u4E00\u9898")))))))},Je=nt.default=Object(G.b)(function(Oe){var Ze=Oe.loading,Ye=Oe.user,Pe=Oe.globalSetting;return{globalSetting:Pe,user:Ye,loading:Ze.effects}})(rt)},SJMd:function(gt,nt){/**
|
|
* @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 Z,te,K,D=!1,H,M;window.PR_SHOULD_USE_CONTINUATION=!0;var P,B;(function(){var k=window,O=["break,continue,do,else,for,if,return,while"],L=[O,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],E=[L,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],C=[E,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],R=[E,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],A=[E,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],w="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",b=[E,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="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=[O,"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=[O,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],u=[O,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],x=[C,A,R,b,d,o,s,u],f=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,m="str",_="kwd",y="com",h="typ",c="lit",l="pun",a="pln",v="tag",p="dec",g="src",S="atn",U="atv",j="nocode",G="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function N(he){for(var we=0,De=!1,Re=!1,ke=0,Ce=he.length;ke<Ce;++ke){var Ae=he[ke];if(Ae.ignoreCase)Re=!0;else if(/[a-z]/i.test(Ae.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){De=!0,Re=!1;break}}var ze={b:8,t:9,n:10,v:11,f:12,r:13};function $e(Je){var Oe=Je.charCodeAt(0);if(Oe!==92)return Oe;var Ze=Je.charAt(1);return Oe=ze[Ze],Oe||("0"<=Ze&&Ze<="7"?parseInt(Je.substring(1),8):Ze==="u"||Ze==="x"?parseInt(Je.substring(2),16):Je.charCodeAt(1))}function je(Je){if(Je<32)return(Je<16?"\\x0":"\\x")+Je.toString(16);var Oe=String.fromCharCode(Je);return Oe==="\\"||Oe==="-"||Oe==="]"||Oe==="^"?"\\"+Oe:Oe}function Ve(Je){var Oe=Je.substring(1,Je.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=[],Ye=Oe[0]==="^",Pe=["["];Ye&&Pe.push("^");for(var Fe=Ye?1:0,ie=Oe.length;Fe<ie;++Fe){var oe=Oe[Fe];if(/\\[bdsw]/i.test(oe))Pe.push(oe);else{var ue=$e(oe),$;Fe+2<ie&&Oe[Fe+1]==="-"?($=$e(Oe[Fe+2]),Fe+=2):$=ue,Ze.push([ue,$]),$<65||ue>122||($<65||ue>90||Ze.push([Math.max(65,ue)|32,Math.min($,90)|32]),$<97||ue>122||Ze.push([Math.max(97,ue)&~32,Math.min($,122)&~32]))}}Ze.sort(function(ge,Se){return ge[0]-Se[0]||Se[1]-ge[1]});for(var Y=[],q=[],Fe=0;Fe<Ze.length;++Fe){var re=Ze[Fe];re[0]<=q[1]+1?q[1]=Math.max(q[1],re[1]):Y.push(q=re)}for(var Fe=0;Fe<Y.length;++Fe){var re=Y[Fe];Pe.push(je(re[0])),re[1]>re[0]&&(re[1]+1>re[0]&&Pe.push("-"),Pe.push(je(re[1])))}return Pe.push("]"),Pe.join("")}function it(Je){for(var Oe=Je.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=Oe.length,Ye=[],Pe=0,Fe=0;Pe<Ze;++Pe){var ie=Oe[Pe];if(ie==="(")++Fe;else if(ie.charAt(0)==="\\"){var oe=+ie.substring(1);oe&&(oe<=Fe?Ye[oe]=-1:Oe[Pe]=je(oe))}}for(var Pe=1;Pe<Ye.length;++Pe)Ye[Pe]===-1&&(Ye[Pe]=++we);for(var Pe=0,Fe=0;Pe<Ze;++Pe){var ie=Oe[Pe];if(ie==="(")++Fe,Ye[Fe]||(Oe[Pe]="(?:");else if(ie.charAt(0)==="\\"){var oe=+ie.substring(1);oe&&oe<=Fe&&(Oe[Pe]="\\"+Ye[oe])}}for(var Pe=0;Pe<Ze;++Pe)Oe[Pe]==="^"&&Oe[Pe+1]!=="^"&&(Oe[Pe]="");if(Je.ignoreCase&&De)for(var Pe=0;Pe<Ze;++Pe){var ie=Oe[Pe],ue=ie.charAt(0);ie.length>=2&&ue==="["?Oe[Pe]=Ve(ie):ue!=="\\"&&(Oe[Pe]=ie.replace(/[a-zA-Z]/g,function(q){var re=q.charCodeAt(0);return"["+String.fromCharCode(re&~32,re|32)+"]"}))}return Oe.join("")}for(var rt=[],ke=0,Ce=he.length;ke<Ce;++ke){var Ae=he[ke];if(Ae.global||Ae.multiline)throw new Error(""+Ae);rt.push("(?:"+it(Ae)+")")}return new RegExp(rt.join("|"),Re?"gi":"g")}function I(he,we){var De=/(?:^|\s)nocode(?:\s|$)/,Re=[],ke=0,Ce=[],Ae=0;function ze($e){var je=$e.nodeType;if(je==1){if(De.test($e.className))return;for(var Ve=$e.firstChild;Ve;Ve=Ve.nextSibling)ze(Ve);var it=$e.nodeName.toLowerCase();(it==="br"||it==="li")&&(Re[Ae]=`
|
|
`,Ce[Ae<<1]=ke++,Ce[Ae++<<1|1]=$e)}else if(je==3||je==4){var rt=$e.nodeValue;rt.length&&(we?rt=rt.replace(/\r\n?/g,`
|
|
`):rt=rt.replace(/[ \t\r\n]+/g," "),Re[Ae]=rt,Ce[Ae<<1]=ke,ke+=rt.length,Ce[Ae++<<1|1]=$e)}}return ze(he),{sourceCode:Re.join("").replace(/\n$/,""),spans:Ce}}function V(he,we,De,Re,ke){if(!De)return;var Ce={sourceNode:he,pre:1,langExtension:null,numberLines:null,sourceCode:De,spans:null,basePos:we,decorations:null};Re(Ce),ke.push.apply(ke,Ce.decorations)}var Q=/\S/;function ne(he){for(var we=void 0,De=he.firstChild;De;De=De.nextSibling){var Re=De.nodeType;we=Re===1?we?he:De:Re===3&&Q.test(De.nodeValue)?he:we}return we===he?void 0:we}function se(he,we){var De={},Re;(function(){for(var Ae=he.concat(we),ze=[],$e={},je=0,Ve=Ae.length;je<Ve;++je){var it=Ae[je],rt=it[3];if(rt)for(var Je=rt.length;--Je>=0;)De[rt.charAt(Je)]=it;var Oe=it[1],Ze=""+Oe;$e.hasOwnProperty(Ze)||(ze.push(Oe),$e[Ze]=null)}ze.push(/[\0-\uffff]/),Re=N(ze)})();var ke=we.length,Ce=function(Ae){for(var ze=Ae.sourceCode,$e=Ae.basePos,je=Ae.sourceNode,Ve=[$e,a],it=0,rt=ze.match(Re)||[],Je={},Oe=0,Ze=rt.length;Oe<Ze;++Oe){var Ye=rt[Oe],Pe=Je[Ye],Fe=void 0,ie;if(typeof Pe=="string")ie=!1;else{var oe=De[Ye.charAt(0)];if(oe)Fe=Ye.match(oe[1]),Pe=oe[0];else{for(var ue=0;ue<ke;++ue)if(oe=we[ue],Fe=Ye.match(oe[1]),Fe){Pe=oe[0];break}Fe||(Pe=a)}ie=Pe.length>=5&&Pe.substring(0,5)==="lang-",ie&&!(Fe&&typeof Fe[1]=="string")&&(ie=!1,Pe=g),ie||(Je[Ye]=Pe)}var $=it;if(it+=Ye.length,!ie)Ve.push($e+$,Pe);else{var Y=Fe[1],q=Ye.indexOf(Y),re=q+Y.length;Fe[2]&&(re=Ye.length-Fe[2].length,q=re-Y.length);var ge=Pe.substring(5);V(je,$e+$,Ye.substring(0,q),Ce,Ve),V(je,$e+$+q,Y,fe(ge,Y),Ve),V(je,$e+$+re,Ye.substring(re),Ce,Ve)}}Ae.decorations=Ve};return Ce}function xe(he){var we=[],De=[];he.tripleQuotedStrings?we.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):he.multiLineStrings?we.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):we.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),he.verbatimStrings&&De.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Re=he.hashComments;Re&&(he.cStyleComments?(Re>1?we.push([y,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):we.push([y,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),De.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):we.push([y,/^#[^\r\n]*/,null,"#"])),he.cStyleComments&&(De.push([y,/^\/\/[^\r\n]*/,null]),De.push([y,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ke=he.regexLiterals;if(ke){var Ce=ke>1?"":`
|
|
\r`,Ae=Ce?".":"[\\S\\s]",ze="/(?=[^/*"+Ce+"])(?:[^/\\x5B\\x5C"+Ce+"]|\\x5C"+Ae+"|\\x5B(?:[^\\x5C\\x5D"+Ce+"]|\\x5C"+Ae+")*(?:\\x5D|$))+/";De.push(["lang-regex",RegExp("^"+G+"("+ze+")")])}var $e=he.types;$e&&De.push([h,$e]);var je=(""+he.keywords).replace(/^ | $/g,"");je.length&&De.push([_,new RegExp("^(?:"+je.replace(/[\s,]+/g,"|")+")\\b"),null]),we.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var Ve="^.[^\\s\\w.$@'\"`/\\\\]*";return he.regexLiterals&&(Ve+="(?!s*/)"),De.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[h,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[l,new RegExp(Ve),null]),se(we,De)}var me=xe({keywords:x,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Le(he,we,De){for(var Re=/(?:^|\s)nocode(?:\s|$)/,ke=/\r\n?|\n/,Ce=he.ownerDocument,Ae=Ce.createElement("li");he.firstChild;)Ae.appendChild(he.firstChild);var ze=[Ae];function $e(Oe){var Ze=Oe.nodeType;if(Ze==1&&!Re.test(Oe.className))if(Oe.nodeName==="br")je(Oe),Oe.parentNode&&Oe.parentNode.removeChild(Oe);else for(var Ye=Oe.firstChild;Ye;Ye=Ye.nextSibling)$e(Ye);else if((Ze==3||Ze==4)&&De){var Pe=Oe.nodeValue,Fe=Pe.match(ke);if(Fe){var ie=Pe.substring(0,Fe.index);Oe.nodeValue=ie;var oe=Pe.substring(Fe.index+Fe[0].length);if(oe){var ue=Oe.parentNode;ue.insertBefore(Ce.createTextNode(oe),Oe.nextSibling)}je(Oe),ie||Oe.parentNode.removeChild(Oe)}}}function je(Oe){for(;!Oe.nextSibling;)if(Oe=Oe.parentNode,!Oe)return;function Ze(Fe,ie){var oe=ie?Fe.cloneNode(!1):Fe,ue=Fe.parentNode;if(ue){var $=Ze(ue,1),Y=Fe.nextSibling;$.appendChild(oe);for(var q=Y;q;q=Y)Y=q.nextSibling,$.appendChild(q)}return oe}for(var Ye=Ze(Oe.nextSibling,0),Pe;(Pe=Ye.parentNode)&&Pe.nodeType===1;)Ye=Pe;ze.push(Ye)}for(var Ve=0;Ve<ze.length;++Ve)$e(ze[Ve]);we===(we|0)&&ze[0].setAttribute("value",we);var it=Ce.createElement("ol");it.className="linenums";for(var rt=Math.max(0,we-1|0)||0,Ve=0,Je=ze.length;Ve<Je;++Ve)Ae=ze[Ve],Ae.className="L"+(Ve+rt)%10,Ae.firstChild||Ae.appendChild(Ce.createTextNode("\xA0")),it.appendChild(Ae);he.appendChild(it)}function Ee(he){var we=/\bMSIE\s(\d+)/.exec(navigator.userAgent);we=we&&+we[1]<=8;var De=/\n/g,Re=he.sourceCode,ke=Re.length,Ce=0,Ae=he.spans,ze=Ae.length,$e=0,je=he.decorations,Ve=je.length,it=0;je[Ve]=ke;var rt,Je;for(Je=rt=0;Je<Ve;)je[Je]!==je[Je+2]?(je[rt++]=je[Je++],je[rt++]=je[Je++]):Je+=2;for(Ve=rt,Je=rt=0;Je<Ve;){for(var Oe=je[Je],Ze=je[Je+1],Ye=Je+2;Ye+2<=Ve&&je[Ye+1]===Ze;)Ye+=2;je[rt++]=Oe,je[rt++]=Ze,Je=Ye}Ve=je.length=rt;var Pe=he.sourceNode,Fe="";Pe&&(Fe=Pe.style.display,Pe.style.display="none");try{for(var ie=null;$e<ze;){var oe=Ae[$e],ue=Ae[$e+2]||ke,$=je[it+2]||ke,Ye=Math.min(ue,$),Y=Ae[$e+1],q;if(Y.nodeType!==1&&(q=Re.substring(Ce,Ye))){we&&(q=q.replace(De,"\r")),Y.nodeValue=q;var re=Y.ownerDocument,ge=re.createElement("span");ge.className=je[it+1];var Se=Y.parentNode;Se.replaceChild(ge,Y),ge.appendChild(Y),Ce<ue&&(Ae[$e+1]=Y=re.createTextNode(Re.substring(Ye,ue)),Se.insertBefore(Y,ge.nextSibling))}Ce=Ye,Ce>=ue&&($e+=2),Ce>=$&&(it+=2)}}finally{Pe&&(Pe.style.display=Fe)}}var Te={};function ce(he,we){for(var De=we.length;--De>=0;){var Re=we[De];Te.hasOwnProperty(Re)?k.console&&console.warn("cannot override language handler %s",Re):Te[Re]=he}}function fe(he,we){return he&&Te.hasOwnProperty(he)||(he=/^\s*</.test(we)?"default-markup":"default-code"),Te[he]}ce(me,["default-code"]),ce(se([],[[a,/^[^<?]+/],[p,/^<!\w[^>]*(?:>|$)/],[y,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[l,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ce(se([[a,/^[\s]+/,null,` \r
|
|
`],[U,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[v,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[S,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[l,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ce(se([],[[U,/^[\s\S]+/]]),["uq.val"]),ce(xe({keywords:C,hashComments:!0,cStyleComments:!0,types:f}),["c","cc","cpp","cxx","cyc","m"]),ce(xe({keywords:"null,true,false"}),["json"]),ce(xe({keywords:A,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:f}),["cs"]),ce(xe({keywords:R,cStyleComments:!0}),["java"]),ce(xe({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ce(xe({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ce(xe({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ce(xe({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ce(xe({keywords:b,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ce(xe({keywords:w,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ce(se([],[[m,/^[\s\S]+/]]),["regex"]);function J(he){var we=he.langExtension;try{var De=I(he.sourceNode,he.pre),Re=De.sourceCode;he.sourceCode=Re,he.spans=De.spans,he.basePos=0,fe(we,Re)(he),Ee(he)}catch(ke){k.console&&console.log(ke&&ke.stack||ke)}}function le(he,we,De){var Re=De||!1,ke=we||null,Ce=document.createElement("div");Ce.innerHTML="<pre>"+he+"</pre>",Ce=Ce.firstChild,Re&&Le(Ce,Re,!0);var Ae={langExtension:ke,numberLines:Re,sourceNode:Ce,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return J(Ae),Ce.innerHTML}function ee(he,we){var De=we||document.body,Re=De.ownerDocument||document;function ke(oe){return De.getElementsByTagName(oe)}for(var Ce=[ke("pre"),ke("code"),ke("xmp")],Ae=[],ze=0;ze<Ce.length;++ze)for(var $e=0,je=Ce[ze].length;$e<je;++$e)Ae.push(Ce[ze][$e]);Ce=null;var Ve=Date;Ve.now||(Ve={now:function(){return+new Date}});var it=0,rt=/\blang(?:uage)?-([\w.]+)(?!\S)/,Je=/\bprettyprint\b/,Oe=/\bprettyprinted\b/,Ze=/pre|xmp/i,Ye=/^code$/i,Pe=/^(?:pre|code|xmp)$/i,Fe={};function ie(){for(var oe=k.PR_SHOULD_USE_CONTINUATION?Ve.now()+250:Infinity;it<Ae.length&&Ve.now()<oe;it++){for(var ue=Ae[it],$=Fe,Y=ue;Y=Y.previousSibling;){var q=Y.nodeType,re=(q===7||q===8)&&Y.nodeValue;if(re?!/^\??prettify\b/.test(re):q!==3||/\S/.test(Y.nodeValue))break;if(re){$={},re.replace(/\b(\w+)=([\w:.%+-]+)/g,function(qt,Ct,He){$[Ct]=He});break}}var ge=ue.className;if(($!==Fe||Je.test(ge))&&!Oe.test(ge)){for(var Se=!1,Me=ue.parentNode;Me;Me=Me.parentNode){var at=Me.tagName;if(Pe.test(at)&&Me.className&&Je.test(Me.className)){Se=!0;break}}if(!Se){ue.className+=" prettyprinted";var vt=$.lang;if(!vt){vt=ge.match(rt);var dt;!vt&&(dt=ne(ue))&&Ye.test(dt.tagName)&&(vt=dt.className.match(rt)),vt&&(vt=vt[1])}var Rt;if(Ze.test(ue.tagName))Rt=1;else{var wt=ue.currentStyle,mt=Re.defaultView,$t=wt?wt.whiteSpace:mt&&mt.getComputedStyle?mt.getComputedStyle(ue,null).getPropertyValue("white-space"):0;Rt=$t&&$t.substring(0,3)==="pre"}var Pt=$.linenums;(Pt=Pt==="true"||+Pt)||(Pt=ge.match(/\blinenums\b(?::(\d+))?/),Pt=Pt?Pt[1]&&Pt[1].length?+Pt[1]:!0:!1),Pt&&Le(ue,Pt,Rt);var Ft={langExtension:vt,sourceNode:ue,numberLines:Pt,pre:Rt,sourceCode:null,basePos:null,spans:null,decorations:null};J(Ft)}}}it<Ae.length?k.setTimeout(ie,250):typeof he=="function"&&he()}ie()}var pe=k.PR={createSimpleLexer:se,registerLangHandler:ce,sourceDecorator:xe,PR_ATTRIB_NAME:S,PR_ATTRIB_VALUE:U,PR_COMMENT:y,PR_DECLARATION:p,PR_KEYWORD:_,PR_LITERAL:c,PR_NOCODE:j,PR_PLAIN:a,PR_PUNCTUATION:l,PR_SOURCE:g,PR_STRING:m,PR_TAG:v,PR_TYPE:h,prettyPrintOne:D?k.prettyPrintOne=le:P=le,prettyPrint:B=D?k.prettyPrint=ee:B=ee},ye=k.define;typeof ye=="function"&&ye.amd&&ye("google-code-prettify",[],function(){return pe})})()},"VrN/":function(gt,nt,Z){(function(te,K){gt.exports=K()})(this,function(){"use strict";var te=navigator.userAgent,K=navigator.platform,D=/gecko\/\d/i.test(te),H=/MSIE \d/.test(te),M=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(te),P=/Edge\/(\d+)/.exec(te),B=H||M||P,k=B&&(H?document.documentMode||6:+(P||M)[1]),O=!P&&/WebKit\//.test(te),L=O&&/Qt\/\d+\.\d+/.test(te),E=!P&&/Chrome\//.test(te),C=/Opera\//.test(te),R=/Apple Computer/.test(navigator.vendor),A=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(te),w=/PhantomJS/.test(te),b=!P&&/AppleWebKit/.test(te)&&/Mobile\/\w+/.test(te),d=/Android/.test(te),o=b||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(te),s=b||/Mac/.test(K),u=/\bCrOS\b/.test(te),x=/win/i.test(K),f=C&&te.match(/Version\/(\d*\.\d*)/);f&&(f=Number(f[1])),f&&f>=15&&(C=!1,O=!0);var m=s&&(L||C&&(f==null||f<12.11)),_=D||B&&k>=9;function y(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var n=e.className,r=y(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function c(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function l(e,t){return c(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var T=0;T<t.length;++T)i.appendChild(t[T]);return i}function v(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var p;document.createRange?p=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:p=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function g(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 S(){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 U(e,t){var n=e.className;y(t).test(n)||(e.className+=(n?" ":"")+t)}function j(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!y(n[r]).test(t)&&(t+=" "+n[r]);return t}var G=function(e){e.select()};b?G=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:B&&(G=function(e){try{e.select()}catch(t){}});function N(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function I(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 V(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var T=r||0,F=i||0;;){var W=e.indexOf(" ",T);if(W<0||W>=t)return F+(t-T);F+=W-T,F+=n-F%n,T=W+1}}var Q=function(){this.id=null,this.f=null,this.time=0,this.handler=N(this.onTimeout,this)};Q.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Q.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 ne(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var se=50,xe={toString:function(){return"CodeMirror.Pass"}},me={scroll:!1},Le={origin:"*mouse"},Ee={origin:"+move"};function Te(e,t,n){for(var r=0,i=0;;){var T=e.indexOf(" ",r);T==-1&&(T=e.length);var F=T-r;if(T==e.length||i+F>=t)return r+Math.min(F,t-i);if(i+=T-r,i+=n-i%n,r=T+1,i>=t)return r}}var ce=[""];function fe(e){for(;ce.length<=e;)ce.push(J(ce)+" ");return ce[e]}function J(e){return e[e.length-1]}function le(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function ee(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function pe(){}function ye(e,t){var n;return Object.create?n=Object.create(e):(pe.prototype=e,n=new pe),t&&I(t,n),n}var he=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function we(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||he.test(e))}function De(e,t){return t?t.source.indexOf("\\w")>-1&&we(e)?!0:t.test(e):we(e)}function Re(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ke=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Ce(e){return e.charCodeAt(0)>=768&&ke.test(e)}function Ae(e,t,n){for(;(n<0?t>0:t<e.length)&&Ce(e.charAt(t));)t+=n;return t}function ze(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,T=r<0?Math.ceil(i):Math.floor(i);if(T==t)return e(T)?t:n;e(T)?n=T:t=T+r}}function $e(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,T=0;T<e.length;++T){var F=e[T];(F.from<n&&F.to>t||t==n&&F.to==t)&&(r(Math.max(F.from,t),Math.min(F.to,n),F.level==1?"rtl":"ltr",T),i=!0)}i||r(t,n,"ltr")}var je=null;function Ve(e,t,n){var r;je=null;for(var i=0;i<e.length;++i){var T=e[i];if(T.from<t&&T.to>t)return i;T.to==t&&(T.from!=T.to&&n=="before"?r=i:je=i),T.from==t&&(T.from!=T.to&&n!="before"?r=i:je=i)}return r!=null?r:je}var it=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(X){return X<=247?e.charAt(X):1424<=X&&X<=1524?"R":1536<=X&&X<=1785?t.charAt(X-1536):1774<=X&&X<=2220?"r":8192<=X&&X<=8203?"w":X==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,T=/[LRr]/,F=/[Lb1n]/,W=/[1n]/;function z(X,ae,de){this.level=X,this.from=ae,this.to=de}return function(X,ae){var de=ae=="ltr"?"L":"R";if(X.length==0||ae=="ltr"&&!r.test(X))return!1;for(var _e=X.length,be=[],Ie=0;Ie<_e;++Ie)be.push(n(X.charCodeAt(Ie)));for(var Be=0,Xe=de;Be<_e;++Be){var et=be[Be];et=="m"?be[Be]=Xe:Xe=et}for(var ot=0,tt=de;ot<_e;++ot){var st=be[ot];st=="1"&&tt=="r"?be[ot]="n":T.test(st)&&(tt=st,st=="r"&&(be[ot]="R"))}for(var yt=1,ht=be[0];yt<_e-1;++yt){var At=be[yt];At=="+"&&ht=="1"&&be[yt+1]=="1"?be[yt]="1":At==","&&ht==be[yt+1]&&(ht=="1"||ht=="n")&&(be[yt]=ht),ht=At}for(var zt=0;zt<_e;++zt){var ur=be[zt];if(ur==",")be[zt]="N";else if(ur=="%"){var Qt=void 0;for(Qt=zt+1;Qt<_e&&be[Qt]=="%";++Qt);for(var Ur=zt&&be[zt-1]=="!"||Qt<_e&&be[Qt]=="1"?"1":"N",Lr=zt;Lr<Qt;++Lr)be[Lr]=Ur;zt=Qt-1}}for(var tr=0,Dr=de;tr<_e;++tr){var fr=be[tr];Dr=="L"&&fr=="1"?be[tr]="L":T.test(fr)&&(Dr=fr)}for(var nr=0;nr<_e;++nr)if(i.test(be[nr])){var rr=void 0;for(rr=nr+1;rr<_e&&i.test(be[rr]);++rr);for(var Zt=(nr?be[nr-1]:de)=="L",Or=(rr<_e?be[rr]:de)=="L",Ci=Zt==Or?Zt?"L":"R":de,Un=nr;Un<rr;++Un)be[Un]=Ci;nr=rr-1}for(var mr=[],fn,dr=0;dr<_e;)if(F.test(be[dr])){var bo=dr;for(++dr;dr<_e&&F.test(be[dr]);++dr);mr.push(new z(0,bo,dr))}else{var xn=dr,ti=mr.length,ri=ae=="rtl"?1:0;for(++dr;dr<_e&&be[dr]!="L";++dr);for(var br=xn;br<dr;)if(W.test(be[br])){xn<br&&(mr.splice(ti,0,new z(1,xn,br)),ti+=ri);var Ai=br;for(++br;br<dr&&W.test(be[br]);++br);mr.splice(ti,0,new z(2,Ai,br)),ti+=ri,xn=br}else++br;xn<dr&&mr.splice(ti,0,new z(1,xn,dr))}return ae=="ltr"&&(mr[0].level==1&&(fn=X.match(/^\s+/))&&(mr[0].from=fn[0].length,mr.unshift(new z(0,0,fn[0].length))),J(mr).level==1&&(fn=X.match(/\s+$/))&&(J(mr).to-=fn[0].length,mr.push(new z(0,_e-fn[0].length,_e)))),ae=="rtl"?mr.reverse():mr}}();function rt(e,t){var n=e.order;return n==null&&(n=e.order=it(e.text,t)),n}var Je=[],Oe=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]||Je).concat(n)}};function Ze(e,t){return e._handlers&&e._handlers[t]||Je}function Ye(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 T=ne(i,n);T>-1&&(r[t]=i.slice(0,T).concat(i.slice(T+1)))}}}function Pe(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 Fe(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Pe(e,n||t.type,e,t),q(t)||t.codemirrorIgnore}function ie(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)ne(n,t[r])==-1&&n.push(t[r])}function oe(e,t){return Ze(e,t).length>0}function ue(e){e.prototype.on=function(t,n){Oe(this,t,n)},e.prototype.off=function(t,n){Ye(this,t,n)}}function $(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Y(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function q(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function re(e){$(e),Y(e)}function ge(e){return e.target||e.srcElement}function Se(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var Me=function(){if(B&&k<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),at;function vt(e){if(at==null){var t=a("span","\u200B");l(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(at=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&k<8))}var n=at?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var dt;function Rt(e){if(dt!=null)return dt;var t=l(e,document.createTextNode("A\u062EA")),n=p(t,0,1).getBoundingClientRect(),r=p(t,1,2).getBoundingClientRect();return c(e),!n||n.left==n.right?!1:dt=r.right-n.right<3}var wt=`
|
|
|
|
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 T=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),F=T.indexOf("\r");F!=-1?(n.push(T.slice(0,F)),t+=F+1):(n.push(T),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},mt=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},$t=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Pt=null;function Ft(e){if(Pt!=null)return Pt;var t=l(e,a("span","x")),n=t.getBoundingClientRect(),r=p(t,0,1).getBoundingClientRect();return Pt=Math.abs(n.left-r.left)>1}var qt={},Ct={};function He(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),qt[e]=t}function ir(e,t){Ct[e]=t}function Rr(e){if(typeof e=="string"&&Ct.hasOwnProperty(e))e=Ct[e];else if(e&&typeof e.name=="string"&&Ct.hasOwnProperty(e.name)){var t=Ct[e.name];typeof t=="string"&&(t={name:t}),e=ye(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Rr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Rr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Gr(e,t){t=Rr(t);var n=qt[t.name];if(!n)return Gr(e,"text/plain");var r=n(e,t);if(Er.hasOwnProperty(t.name)){var i=Er[t.name];for(var T in i){if(!i.hasOwnProperty(T))continue;r.hasOwnProperty(T)&&(r["_"+T]=r[T]),r[T]=i[T]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var F in t.modeProps)r[F]=t.modeProps[F];return r}var Er={};function Li(e,t){var n=Er.hasOwnProperty(e)?Er[e]:Er[e]={};I(t,n)}function Pr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function nn(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 Fr(e,t,n){return e.startState?e.startState(t,n):!0}var Vt=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Vt.prototype.eol=function(){return this.pos>=this.string.length},Vt.prototype.sol=function(){return this.pos==this.lineStart},Vt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Vt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Vt.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Vt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Vt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Vt.prototype.skipToEnd=function(){this.pos=this.string.length},Vt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Vt.prototype.backUp=function(e){this.pos-=e},Vt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=V(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?V(this.string,this.lineStart,this.tabSize):0)},Vt.prototype.indentation=function(){return V(this.string,null,this.tabSize)-(this.lineStart?V(this.string,this.lineStart,this.tabSize):0)},Vt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(F){return n?F.toLowerCase():F},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var T=this.string.slice(this.pos).match(e);return T&&T.index>0?null:(T&&t!==!1&&(this.pos+=T[0].length),T)}},Vt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Vt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Vt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Vt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ut(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],T=i.chunkSize();if(t<T){n=i;break}t-=T}return n.lines[t]}function zr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(T){var F=T.text;i==n.line&&(F=F.slice(0,n.ch)),i==t.line&&(F=F.slice(t.ch)),r.push(F),++i}),r}function Tn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function pr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function kt(e){if(e.parent==null)return null;for(var t=e.parent,n=ne(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 Vr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],T=i.height;if(t<T){e=i;continue e}t-=T,n+=i.chunkSize()}return n}while(!e.lines);for(var F=0;F<e.lines.length;++F){var W=e.lines[F],z=W.height;if(t<z)break;t-=z}return n+F}function kr(e,t){return t>=e.first&&t<e.first+e.size}function hn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ke(e,t,n){if(n===void 0&&(n=null),!(this instanceof Ke))return new Ke(e,t,n);this.line=e,this.ch=t,this.sticky=n}function Et(e,t){return e.line-t.line||e.ch-t.ch}function Qe(e,t){return e.sticky==t.sticky&&Et(e,t)==0}function Fn(e){return Ke(e.line,e.ch)}function _n(e,t){return Et(e,t)<0?t:e}function an(e,t){return Et(e,t)<0?e:t}function mn(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function bt(e,t){if(t.line<e.first)return Ke(e.first,0);var n=e.first+e.size-1;return t.line>n?Ke(n,ut(e,n).text.length):Di(t,ut(e,t.line).text.length)}function Di(e,t){var n=e.ch;return n==null||n>t?Ke(e.line,t):n<0?Ke(e.line,0):e}function Sn(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=bt(e,t[r]);return n}var Nr=function(e,t){this.state=e,this.lookAhead=t},xr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};xr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},xr.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}},xr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},xr.fromSaved=function(e,t,n){return t instanceof Nr?new xr(e,Pr(e.mode,t.state),n,t.lookAhead):new xr(e,Pr(e.mode,t),n)},xr.prototype.save=function(e){var t=e!==!1?Pr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Nr(t,this.maxLookAhead):t};function ni(e,t,n,r){var i=[e.state.modeGen],T={};Cn(e,t.text,e.doc.mode,n,function(X,ae){return i.push(X,ae)},T,r);for(var F=n.state,W=function(X){n.baseTokens=i;var ae=e.state.overlays[X],de=1,_e=0;n.state=!0,Cn(e,t.text,ae.mode,n,function(be,Ie){for(var Be=de;_e<be;){var Xe=i[de];Xe>be&&i.splice(de,1,be,i[de+1],Xe),de+=2,_e=Math.min(be,Xe)}if(!Ie)return;if(ae.opaque)i.splice(Be,de-Be,be,"overlay "+Ie),de=Be+2;else for(;Be<de;Be+=2){var et=i[Be+1];i[Be+1]=(et?et+" ":"")+"overlay "+Ie}},T),n.state=F,n.baseTokens=null,n.baseTokenPos=1},z=0;z<e.state.overlays.length;++z)W(z);return{styles:i,classes:T.bgClass||T.textClass?T:null}}function wn(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Tr(e,kt(t)),i=t.text.length>e.options.maxHighlightLength&&Pr(e.doc.mode,r.state),T=ni(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=T.styles,T.classes?t.styleClasses=T.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 Tr(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new xr(r,!0,t);var T=gn(e,t,n),F=T>r.first&&ut(r,T-1).stateAfter,W=F?xr.fromSaved(r,F,T):new xr(r,Fr(r.mode),T);return r.iter(T,t,function(z){Nn(e,z.text,W);var X=W.line;z.stateAfter=X==t-1||X%5==0||X>=i.viewFrom&&X<i.viewTo?W.save():null,W.nextLine()}),n&&(r.modeFrontier=W.line),W}function Nn(e,t,n,r){var i=e.doc.mode,T=new Vt(t,e.options.tabSize,n);for(T.start=T.pos=r||0,t==""&&ii(i,n.state);!T.eol();)pn(i,T,n.state),T.start=T.pos}function ii(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=nn(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function pn(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=nn(e,n).mode);var T=e.token(t,n);if(t.pos>t.start)return T}throw new Error("Mode "+e.name+" failed to advance stream.")}var $r=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Br(e,t,n,r){var i=e.doc,T=i.mode,F;t=bt(i,t);var W=ut(i,t.line),z=Tr(e,t.line,n),X=new Vt(W.text,e.options.tabSize,z),ae;for(r&&(ae=[]);(r||X.pos<t.ch)&&!X.eol();)X.start=X.pos,F=pn(T,X,z.state),r&&ae.push(new $r(X,F,Pr(i.mode,z.state)));return r?ae:new $r(X,F,z.state)}function ai(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 Cn(e,t,n,r,i,T,F){var W=n.flattenSpans;W==null&&(W=e.options.flattenSpans);var z=0,X=null,ae=new Vt(t,e.options.tabSize,r),de,_e=e.options.addModeClass&&[null];for(t==""&&ai(ii(n,r.state),T);!ae.eol();){if(ae.pos>e.options.maxHighlightLength?(W=!1,F&&Nn(e,t,r,ae.pos),ae.pos=t.length,de=null):de=ai(pn(n,ae,r.state,_e),T),_e){var be=_e[0].name;be&&(de="m-"+(de?be+" "+de:be))}if(!W||X!=de){for(;z<ae.start;)z=Math.min(ae.start,z+5e3),i(z,X);X=de}ae.start=ae.pos}for(;z<ae.pos;){var Ie=Math.min(ae.pos,z+5e3);i(Ie,X),z=Ie}}function gn(e,t,n){for(var r,i,T=e.doc,F=n?-1:t-(e.doc.mode.innerMode?1e3:100),W=t;W>F;--W){if(W<=T.first)return T.first;var z=ut(T,W-1),X=z.stateAfter;if(X&&(!n||W+(X instanceof Nr?X.lookAhead:0)<=T.modeFrontier))return W;var ae=V(z.text,null,e.options.tabSize);(i==null||r>ae)&&(i=W-1,r=ae)}return i}function vn(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=ut(e,r).stateAfter;if(i&&(!(i instanceof Nr)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var oi=!1,_r=!1;function Oi(){oi=!0}function Ri(){_r=!0}function An(e,t,n){this.marker=e,this.from=t,this.to=n}function Yr(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function na(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function si(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function on(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var T=e[i],F=T.marker,W=T.from==null||(F.inclusiveLeft?T.from<=t:T.from<t);if(W||T.from==t&&F.type=="bookmark"&&(!n||!T.marker.insertLeft)){var z=T.to==null||(F.inclusiveRight?T.to>=t:T.to>t);(r||(r=[])).push(new An(F,T.from,z?null:T.to))}}return r}function Bn(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var T=e[i],F=T.marker,W=T.to==null||(F.inclusiveRight?T.to>=t:T.to>t);if(W||T.from==t&&F.type=="bookmark"&&(!n||T.marker.insertLeft)){var z=T.from==null||(F.inclusiveLeft?T.from<=t:T.from<t);(r||(r=[])).push(new An(F,z?null:T.from-t,T.to==null?null:T.to-t))}}return r}function Jr(e,t){if(t.full)return null;var n=kr(e,t.from.line)&&ut(e,t.from.line).markedSpans,r=kr(e,t.to.line)&&ut(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,T=t.to.ch,F=Et(t.from,t.to)==0,W=on(n,i,F),z=Bn(r,T,F),X=t.text.length==1,ae=J(t.text).length+(X?i:0);if(W)for(var de=0;de<W.length;++de){var _e=W[de];if(_e.to==null){var be=Yr(z,_e.marker);be?X&&(_e.to=be.to==null?null:be.to+ae):_e.to=i}}if(z)for(var Ie=0;Ie<z.length;++Ie){var Be=z[Ie];if(Be.to!=null&&(Be.to+=ae),Be.from==null){var Xe=Yr(W,Be.marker);Xe||(Be.from=ae,X&&(W||(W=[])).push(Be))}else Be.from+=ae,X&&(W||(W=[])).push(Be)}W&&(W=Nt(W)),z&&z!=W&&(z=Nt(z));var et=[W];if(!X){var ot=t.text.length-2,tt;if(ot>0&&W)for(var st=0;st<W.length;++st)W[st].to==null&&(tt||(tt=[])).push(new An(W[st].marker,null,null));for(var yt=0;yt<ot;++yt)et.push(tt);et.push(z)}return et}function Nt(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 yn(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(be){if(be.markedSpans)for(var Ie=0;Ie<be.markedSpans.length;++Ie){var Be=be.markedSpans[Ie].marker;Be.readOnly&&(!r||ne(r,Be)==-1)&&(r||(r=[])).push(Be)}}),!r)return null;for(var i=[{from:t,to:n}],T=0;T<r.length;++T)for(var F=r[T],W=F.find(0),z=0;z<i.length;++z){var X=i[z];if(Et(X.to,W.from)<0||Et(X.from,W.to)>0)continue;var ae=[z,1],de=Et(X.from,W.from),_e=Et(X.to,W.to);(de<0||!F.inclusiveLeft&&!de)&&ae.push({from:X.from,to:W.from}),(_e>0||!F.inclusiveRight&&!_e)&&ae.push({from:W.to,to:X.to}),i.splice.apply(i,ae),z+=ae.length-3}return i}function jn(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function sn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function Ht(e){return e.inclusiveLeft?-1:0}function Sr(e){return e.inclusiveRight?1:0}function Wn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),T=Et(r.from,i.from)||Ht(e)-Ht(t);if(T)return-T;var F=Et(r.to,i.to)||Sr(e)-Sr(t);return F||t.id-e.id}function Hn(e,t){var n=_r&&e.markedSpans,r;if(n)for(var i=void 0,T=0;T<n.length;++T)i=n[T],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Wn(r,i.marker)<0)&&(r=i.marker);return r}function Pi(e){return Hn(e,!0)}function bn(e){return Hn(e,!1)}function ia(e,t){var n=_r&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var T=n[i];T.marker.collapsed&&(T.from==null||T.from<t)&&(T.to==null||T.to>t)&&(!r||Wn(r,T.marker)<0)&&(r=T.marker)}return r}function li(e,t,n,r,i){var T=ut(e,t),F=_r&&T.markedSpans;if(F)for(var W=0;W<F.length;++W){var z=F[W];if(!z.marker.collapsed)continue;var X=z.marker.find(0),ae=Et(X.from,n)||Ht(z.marker)-Ht(i),de=Et(X.to,r)||Sr(z.marker)-Sr(i);if(ae>=0&&de<=0||ae<=0&&de>=0)continue;if(ae<=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?Et(X.to,n)>=0:Et(X.to,n)>0)||ae>=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?Et(X.from,r)<=0:Et(X.from,r)<0))return!0}}function ct(e){for(var t;t=Pi(e);)e=t.find(-1,!0).line;return e}function St(e){for(var t;t=bn(e);)e=t.find(1,!0).line;return e}function _t(e){for(var t,n;t=bn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function It(e,t){var n=ut(e,t),r=ct(n);return n==r?t:kt(r)}function Bt(e,t){if(t>e.lastLine())return t;var n=ut(e,t),r;if(!jt(e,n))return t;for(;r=bn(n);)n=r.find(1,!0).line;return kt(n)+1}function jt(e,t){var n=_r&&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&&Yt(e,t,r))return!0}}function Yt(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Yt(e,r.line,Yr(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,T=0;T<t.markedSpans.length;++T)if(i=t.markedSpans[T],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Yt(e,t,i))return!0}function Kt(e){e=ct(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 T=n.parent;T;n=T,T=n.parent)for(var F=0;F<T.children.length;++F){var W=T.children[F];if(W==n)break;t+=W.height}return t}function cr(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Pi(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=bn(r);){var T=n.find(0,!0);t-=r.text.length-T.from.ch,r=T.to.line,t+=r.text.length-T.to.ch}return t}function jr(e){var t=e.display,n=e.doc;t.maxLine=ut(n,n.first),t.maxLineLength=cr(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=cr(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Gt=function(e,t,n){this.text=e,sn(this,t),this.height=n?n(this):1};Gt.prototype.lineNo=function(){return kt(this)},ue(Gt);function Qr(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),jn(e),sn(e,n);var i=r?r(e):1;i!=e.height&&pr(e,i)}function ar(e){e.parent=null,jn(e)}var Zr={},ln={};function un(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?ln:Zr;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function ki(e,t){var n=v("span",null,null,O?"padding-right: .1px":null),r={pre:v("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var T=i?t.rest[i-1]:t.line,F=void 0;r.pos=0,r.addToken=Kn,Rt(e.display.measure)&&(F=rt(T,e.doc.direction))&&(r.addToken=aa(r.addToken,F)),r.map=[];var W=t!=e.display.externalMeasured&&kt(T);Ia(T,r,wn(e,T,W)),T.styleClasses&&(T.styleClasses.bgClass&&(r.bgClass=j(T.styleClasses.bgClass,r.bgClass||"")),T.styleClasses.textClass&&(r.textClass=j(T.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(vt(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(O){var z=r.content.lastChild;(/\bcm-tab\b/.test(z.className)||z.querySelector&&z.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Pe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function Ma(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 Kn(e,t,n,r,i,T,F){if(!t)return;var W=e.splitSpaces?xo(t,e.trailingSpace):t,z=e.cm.state.specialChars,X=!1,ae;if(!z.test(t))e.col+=t.length,ae=document.createTextNode(W),e.map.push(e.pos,e.pos+t.length,ae),B&&k<9&&(X=!0),e.pos+=t.length;else{ae=document.createDocumentFragment();for(var de=0;;){z.lastIndex=de;var _e=z.exec(t),be=_e?_e.index-de:t.length-de;if(be){var Ie=document.createTextNode(W.slice(de,de+be));B&&k<9?ae.appendChild(a("span",[Ie])):ae.appendChild(Ie),e.map.push(e.pos,e.pos+be,Ie),e.col+=be,e.pos+=be}if(!_e)break;de+=be+1;var Be=void 0;if(_e[0]==" "){var Xe=e.cm.options.tabSize,et=Xe-e.col%Xe;Be=ae.appendChild(a("span",fe(et),"cm-tab")),Be.setAttribute("role","presentation"),Be.setAttribute("cm-text"," "),e.col+=et}else _e[0]=="\r"||_e[0]==`
|
|
`?(Be=ae.appendChild(a("span",_e[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Be.setAttribute("cm-text",_e[0]),e.col+=1):(Be=e.cm.options.specialCharPlaceholder(_e[0]),Be.setAttribute("cm-text",_e[0]),B&&k<9?ae.appendChild(a("span",[Be])):ae.appendChild(Be),e.col+=1);e.map.push(e.pos,e.pos+1,Be),e.pos++}}if(e.trailingSpace=W.charCodeAt(t.length-1)==32,n||r||i||X||T||F){var ot=n||"";r&&(ot+=r),i&&(ot+=i);var tt=a("span",[ae],ot,T);if(F)for(var st in F)F.hasOwnProperty(st)&&st!="style"&&st!="class"&&tt.setAttribute(st,F[st]);return e.content.appendChild(tt)}e.content.appendChild(ae)}function xo(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var T=e.charAt(i);T==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(T="\xA0"),r+=T,n=T==" "}return r}function aa(e,t){return function(n,r,i,T,F,W,z){i=i?i+" cm-force-border":"cm-force-border";for(var X=n.pos,ae=X+r.length;;){for(var de=void 0,_e=0;_e<t.length&&!(de=t[_e],de.to>X&&de.from<=X);_e++);if(de.to>=ae)return e(n,r,i,T,F,W,z);e(n,r.slice(0,de.to-X),i,T,null,W,z),T=null,r=r.slice(de.to-X),X=de.to}}}function ui(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 Ia(e,t,n){var r=e.markedSpans,i=e.text,T=0;if(!r){for(var F=1;F<n.length;F+=2)t.addToken(t,i.slice(T,T=n[F]),un(n[F+1],t.cm.options));return}for(var W=i.length,z=0,X=1,ae="",de,_e,be=0,Ie,Be,Xe,et,ot;;){if(be==z){Ie=Be=Xe=_e="",ot=null,et=null,be=Infinity;for(var tt=[],st=void 0,yt=0;yt<r.length;++yt){var ht=r[yt],At=ht.marker;if(At.type=="bookmark"&&ht.from==z&&At.widgetNode)tt.push(At);else if(ht.from<=z&&(ht.to==null||ht.to>z||At.collapsed&&ht.to==z&&ht.from==z)){if(ht.to!=null&&ht.to!=z&&be>ht.to&&(be=ht.to,Be=""),At.className&&(Ie+=" "+At.className),At.css&&(_e=(_e?_e+";":"")+At.css),At.startStyle&&ht.from==z&&(Xe+=" "+At.startStyle),At.endStyle&&ht.to==be&&(st||(st=[])).push(At.endStyle,ht.to),At.title&&((ot||(ot={})).title=At.title),At.attributes)for(var zt in At.attributes)(ot||(ot={}))[zt]=At.attributes[zt];At.collapsed&&(!et||Wn(et.marker,At)<0)&&(et=ht)}else ht.from>z&&be>ht.from&&(be=ht.from)}if(st)for(var ur=0;ur<st.length;ur+=2)st[ur+1]==be&&(Be+=" "+st[ur]);if(!et||et.from==z)for(var Qt=0;Qt<tt.length;++Qt)ui(t,0,tt[Qt]);if(et&&(et.from||0)==z){if(ui(t,(et.to==null?W+1:et.to)-z,et.marker,et.from==null),et.to==null)return;et.to==z&&(et=!1)}}if(z>=W)break;for(var Ur=Math.min(W,be);;){if(ae){var Lr=z+ae.length;if(!et){var tr=Lr>Ur?ae.slice(0,Ur-z):ae;t.addToken(t,tr,de?de+Ie:Ie,Xe,z+tr.length==be?Be:"",_e,ot)}if(Lr>=Ur){ae=ae.slice(Ur-z),z=Ur;break}z=Lr,Xe=""}ae=i.slice(T,T=n[X++]),de=un(n[X++],t.cm.options)}}}function Mi(e,t,n){this.line=t,this.rest=_t(t),this.size=this.rest?kt(J(this.rest))-n+1:1,this.node=this.text=null,this.hidden=jt(e,t)}function di(e,t,n){for(var r=[],i,T=t;T<n;T=i){var F=new Mi(e.doc,ut(e.doc,T),T);i=T+F.size,r.push(F)}return r}var Ln=null;function Gn(e){Ln?Ln.ops.push(e):e.ownsGroup=Ln={ops:[e],delayedCallbacks:[]}}function oa(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 Ua(e,t){var n=e.ownsGroup;if(!n)return;try{oa(n)}finally{Ln=null,t(n)}}var zn=null;function or(e,t){var n=Ze(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Ln?i=Ln.delayedCallbacks:zn?i=zn:(i=zn=[],setTimeout(Fa,0));for(var T=function(W){i.push(function(){return n[W].apply(null,r)})},F=0;F<n.length;++F)T(F)}function Fa(){var e=zn;zn=null;for(var t=0;t<e.length;++t)e[t]()}function sa(e,t,n,r){for(var i=0;i<t.changes.length;i++){var T=t.changes[i];T=="text"?Na(e,t):T=="gutter"?da(e,t,n,r):T=="class"?Ii(e,t):T=="widget"&&dn(e,t,r)}t.changes=null}function Vn(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),B&&k<8&&(e.node.style.zIndex=2)),e.node}function la(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=Vn(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function ua(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):ki(e,t)}function Na(e,t){var n=t.text.className,r=ua(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,Ii(e,t)):n&&(t.text.className=n)}function Ii(e,t){la(e,t),t.line.wrapClass?Vn(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 da(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=Vn(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 T=t.line.gutterMarkers;if(e.options.lineNumbers||T){var F=Vn(t),W=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(W),F.insertBefore(W,t.text),t.line.gutterClass&&(W.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!T||!T["CodeMirror-linenumbers"])&&(t.lineNumber=W.appendChild(a("div",hn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),T)for(var z=0;z<e.display.gutterSpecs.length;++z){var X=e.display.gutterSpecs[z].className,ae=T.hasOwnProperty(X)&&T[X];ae&&W.appendChild(a("div",[ae],"CodeMirror-gutter-elt","left: "+r.gutterLeft[X]+"px; width: "+r.gutterWidth[X]+"px"))}}}function dn(e,t,n){t.alignable&&(t.alignable=null);for(var r=y("CodeMirror-linewidget"),i=t.node.firstChild,T=void 0;i;i=T)T=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);ca(e,t,n)}function Ba(e,t,n,r){var i=ua(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),Ii(e,t),da(e,t,n,r),ca(e,t,r),t.node}function ca(e,t,n){if(fa(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)fa(e,t.rest[r],t,n,!1)}function fa(e,t,n,r,i){if(!t.widgets)return;for(var T=Vn(n),F=0,W=t.widgets;F<W.length;++F){var z=W[F],X=a("div",[z.node],"CodeMirror-linewidget"+(z.className?" "+z.className:""));z.handleMouseEvents||X.setAttribute("cm-ignore-events","true"),ja(z,X,n,r),e.display.input.setUneditable(X),i&&z.above?T.insertBefore(X,n.gutter||n.text):T.appendChild(X),or(z,"redraw")}}function ja(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 ft(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!g(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),l(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function ve(e,t){for(var n=ge(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 Ne(e){return e.lineSpace.offsetTop}function Ue(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function lt(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=l(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function We(e){return se-e.display.nativeBarWidth}function Ge(e){return e.display.scroller.clientWidth-We(e)-e.display.barWidth}function pt(e){return e.display.scroller.clientHeight-We(e)-e.display.barHeight}function qe(e,t,n){var r=e.options.lineWrapping,i=r&&Ge(e);if(!t.measure.heights||r&&t.measure.width!=i){var T=t.measure.heights=[];if(r){t.measure.width=i;for(var F=t.text.firstChild.getClientRects(),W=0;W<F.length-1;W++){var z=F[W],X=F[W+1];Math.abs(z.bottom-X.bottom)>2&&T.push((z.bottom+X.top)/2-n.top)}}T.push(n.bottom-n.top)}}function xt(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(kt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Tt(e,t){t=ct(t);var n=kt(t),r=e.display.externalMeasured=new Mi(e.doc,t,n);r.lineN=n;var i=r.built=ki(e,r);return r.text=i.pre,l(e.display.lineMeasure,i.pre),r}function Lt(e,t,n,r){return Dt(e,Mt(e,t),n,r)}function Jt(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Jn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Mt(e,t){var n=kt(t),r=Jt(e,n);r&&!r.text?r=null:r&&r.changes&&(sa(e,r,n,za(e)),e.curOp.forceUpdate=!0),r||(r=Tt(e,t));var i=xt(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Dt(e,t,n,r,i){t.before&&(n=-1);var T=n+(r||""),F;return t.cache.hasOwnProperty(T)?F=t.cache[T]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(qe(e,t.view,t.rect),t.hasHeights=!0),F=Ot(e,t,n,r),F.bogus||(t.cache[T]=F)),{left:F.left,right:F.right,top:i?F.rtop:F.top,bottom:i?F.rbottom:F.bottom}}var gr={left:0,right:0,top:0,bottom:0};function qr(e,t,n){for(var r,i,T,F,W,z,X=0;X<e.length;X+=3)if(W=e[X],z=e[X+1],t<W?(i=0,T=1,F="left"):t<z?(i=t-W,T=i+1):(X==e.length-3||t==z&&e[X+3]>t)&&(T=z-W,i=T-1,t>=z&&(F="right")),i!=null){if(r=e[X+2],W==z&&n==(r.insertLeft?"left":"right")&&(F=n),n=="left"&&i==0)for(;X&&e[X-2]==e[X-3]&&e[X-1].insertLeft;)r=e[(X-=3)+2],F="left";if(n=="right"&&i==z-W)for(;X<e.length-3&&e[X+3]==e[X+4]&&!e[X+5].insertLeft;)r=e[(X+=3)+2],F="right";break}return{node:r,start:i,end:T,collapse:F,coverStart:W,coverEnd:z}}function cn(e,t){var n=gr;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 Ot(e,t,n,r){var i=qr(t.map,n,r),T=i.node,F=i.start,W=i.end,z=i.collapse,X;if(T.nodeType==3){for(var ae=0;ae<4;ae++){for(;F&&Ce(t.line.text.charAt(i.coverStart+F));)--F;for(;i.coverStart+W<i.coverEnd&&Ce(t.line.text.charAt(i.coverStart+W));)++W;if(B&&k<9&&F==0&&W==i.coverEnd-i.coverStart?X=T.parentNode.getBoundingClientRect():X=cn(p(T,F,W).getClientRects(),r),X.left||X.right||F==0)break;W=F,F=F-1,z="right"}B&&k<11&&(X=Mr(e.display.measure,X))}else{F>0&&(z=r="right");var de;e.options.lineWrapping&&(de=T.getClientRects()).length>1?X=de[r=="right"?de.length-1:0]:X=T.getBoundingClientRect()}if(B&&k<9&&!F&&(!X||!X.left&&!X.right)){var _e=T.parentNode.getClientRects()[0];_e?X={left:_e.left,right:_e.left+hi(e.display),top:_e.top,bottom:_e.bottom}:X=gr}for(var be=X.top-t.rect.top,Ie=X.bottom-t.rect.top,Be=(be+Ie)/2,Xe=t.view.measure.heights,et=0;et<Xe.length-1&&!(Be<Xe[et]);et++);var ot=et?Xe[et-1]:0,tt=Xe[et],st={left:(z=="right"?X.right:X.left)-t.rect.left,right:(z=="left"?X.left:X.right)-t.rect.left,top:ot,bottom:tt};return!X.left&&!X.right&&(st.bogus=!0),e.options.singleCursorHeightPerLine||(st.rtop=be,st.rbottom=Ie),st}function Mr(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Ft(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function vr(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function Xr(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)vr(e.display.view[t])}function Wr(e){Xr(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function wr(){return E&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ci(){return E&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Xn(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=ft(e.widgets[n]));return t}function ha(e,t,n,r,i){if(!i){var T=Xn(t);n.top+=T,n.bottom+=T}if(r=="line")return n;r||(r="local");var F=Kt(t);if(r=="local"?F+=Ne(e.display):F-=e.display.viewOffset,r=="page"||r=="window"){var W=e.display.lineSpace.getBoundingClientRect();F+=W.top+(r=="window"?0:ci());var z=W.left+(r=="window"?0:wr());n.left+=z,n.right+=z}return n.top+=F,n.bottom+=F,n}function To(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=wr(),i-=ci();else if(n=="local"||!n){var T=e.display.sizer.getBoundingClientRect();r+=T.left,i+=T.top}var F=e.display.lineSpace.getBoundingClientRect();return{left:r-F.left,top:i-F.top}}function Wa(e,t,n,r,i){return r||(r=ut(e.doc,t.line)),ha(e,r,Lt(e,r,t.ch,i),n)}function en(e,t,n,r,i,T){r=r||ut(e.doc,t.line),i||(i=Mt(e,r));function F(Ie,Be){var Xe=Dt(e,i,Ie,Be?"right":"left",T);return Be?Xe.left=Xe.right:Xe.right=Xe.left,ha(e,r,Xe,n)}var W=rt(r,e.doc.direction),z=t.ch,X=t.sticky;if(z>=r.text.length?(z=r.text.length,X="before"):z<=0&&(z=0,X="after"),!W)return F(X=="before"?z-1:z,X=="before");function ae(Ie,Be,Xe){var et=W[Be],ot=et.level==1;return F(Xe?Ie-1:Ie,ot!=Xe)}var de=Ve(W,z,X),_e=je,be=ae(z,de,X=="before");return _e!=null&&(be.other=ae(z,_e,X!="before")),be}function _o(e,t){var n=0;t=bt(e.doc,t),e.options.lineWrapping||(n=hi(e.display)*t.ch);var r=ut(e.doc,t.line),i=Kt(r)+Ne(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Ha(e,t,n,r,i){var T=Ke(e,t,n);return T.xRel=i,r&&(T.outside=r),T}function Ka(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return Ha(r.first,0,null,-1,-1);var i=Vr(r,n),T=r.first+r.size-1;if(i>T)return Ha(r.first+r.size-1,ut(r,T).text.length,null,1,1);t<0&&(t=0);for(var F=ut(r,i);;){var W=Ks(e,F,i,t,n),z=ia(F,W.ch+(W.xRel>0||W.outside>0?1:0));if(!z)return W;var X=z.find(1);if(X.line==i)return X;F=ut(r,i=X.line)}}function So(e,t,n,r){r-=Xn(t);var i=t.text.length,T=ze(function(F){return Dt(e,n,F-1).bottom<=r},i,0);return i=ze(function(F){return Dt(e,n,F).top>r},T,i),{begin:T,end:i}}function wo(e,t,n,r){n||(n=Mt(e,t));var i=ha(e,t,Dt(e,n,r),"line").top;return So(e,t,n,i)}function Ga(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,i){i-=Kt(t);var T=Mt(e,t),F=Xn(t),W=0,z=t.text.length,X=!0,ae=rt(t,e.doc.direction);if(ae){var de=(e.options.lineWrapping?zs:Gs)(e,t,n,T,ae,r,i);X=de.level!=1,W=X?de.from:de.to-1,z=X?de.to:de.from-1}var _e=null,be=null,Ie=ze(function(yt){var ht=Dt(e,T,yt);return ht.top+=F,ht.bottom+=F,Ga(ht,r,i,!1)?(ht.top<=i&&ht.left<=r&&(_e=yt,be=ht),!0):!1},W,z),Be,Xe,et=!1;if(be){var ot=r-be.left<be.right-r,tt=ot==X;Ie=_e+(tt?0:1),Xe=tt?"after":"before",Be=ot?be.left:be.right}else{!X&&(Ie==z||Ie==W)&&Ie++,Xe=Ie==0?"after":Ie==t.text.length?"before":Dt(e,T,Ie-(X?1:0)).bottom+F<=i==X?"after":"before";var st=en(e,Ke(n,Ie,Xe),"line",t,T);Be=st.left,et=i<st.top?-1:i>=st.bottom?1:0}return Ie=Ae(t.text,Ie,1),Ha(n,Ie,Xe,et,r-Be)}function Gs(e,t,n,r,i,T,F){var W=ze(function(de){var _e=i[de],be=_e.level!=1;return Ga(en(e,Ke(n,be?_e.to:_e.from,be?"before":"after"),"line",t,r),T,F,!0)},0,i.length-1),z=i[W];if(W>0){var X=z.level!=1,ae=en(e,Ke(n,X?z.from:z.to,X?"after":"before"),"line",t,r);Ga(ae,T,F,!0)&&ae.top>F&&(z=i[W-1])}return z}function zs(e,t,n,r,i,T,F){var W=So(e,t,r,F),z=W.begin,X=W.end;/\s/.test(t.text.charAt(X-1))&&X--;for(var ae=null,de=null,_e=0;_e<i.length;_e++){var be=i[_e];if(be.from>=X||be.to<=z)continue;var Ie=be.level!=1,Be=Dt(e,r,Ie?Math.min(X,be.to)-1:Math.max(z,be.from)).right,Xe=Be<T?T-Be+1e9:Be-T;(!ae||de>Xe)&&(ae=be,de=Xe)}return ae||(ae=i[i.length-1]),ae.from<z&&(ae={from:z,to:ae.to,level:ae.level}),ae.to>X&&(ae={from:ae.from,to:X,level:ae.level}),ae}var $n;function fi(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if($n==null){$n=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)$n.appendChild(document.createTextNode("x")),$n.appendChild(a("br"));$n.appendChild(document.createTextNode("x"))}l(e.measure,$n);var n=$n.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function hi(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");l(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function za(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,T=t.gutters.firstChild,F=0;T;T=T.nextSibling,++F){var W=e.display.gutterSpecs[F].className;n[W]=T.offsetLeft+T.clientLeft+i,r[W]=T.clientWidth}return{fixedPos:Va(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Va(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Co(e){var t=fi(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/hi(e.display)-3);return function(i){if(jt(e.doc,i))return 0;var T=0;if(i.widgets)for(var F=0;F<i.widgets.length;F++)i.widgets[F].height&&(T+=i.widgets[F].height);return n?T+(Math.ceil(i.text.length/r)||1)*t:T+t}}function Xa(e){var t=e.doc,n=Co(e);t.iter(function(r){var i=n(r);i!=r.height&&pr(r,i)})}function Yn(e,t,n,r){var i=e.display;if(!n&&ge(t).getAttribute("cm-not-content")=="true")return null;var T,F,W=i.lineSpace.getBoundingClientRect();try{T=t.clientX-W.left,F=t.clientY-W.top}catch(de){return null}var z=Ka(e,T,F),X;if(r&&z.xRel>0&&(X=ut(e.doc,z.line).text).length==z.ch){var ae=V(X,X.length,e.options.tabSize)-X.length;z=Ke(z.line,Math.max(0,Math.round((T-lt(e.display).left)/hi(e.display))-ae))}return z}function Jn(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 Cr(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)_r&&It(e.doc,t)<i.viewTo&&On(e);else if(n<=i.viewFrom)_r&&Bt(e.doc,n+r)>i.viewFrom?On(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)On(e);else if(t<=i.viewFrom){var T=ma(e,n,n+r,1);T?(i.view=i.view.slice(T.index),i.viewFrom=T.lineN,i.viewTo+=r):On(e)}else if(n>=i.viewTo){var F=ma(e,t,t,-1);F?(i.view=i.view.slice(0,F.index),i.viewTo=F.lineN):On(e)}else{var W=ma(e,t,t,-1),z=ma(e,n,n+r,1);W&&z?(i.view=i.view.slice(0,W.index).concat(di(e,W.lineN,z.lineN)).concat(i.view.slice(z.index)),i.viewTo+=r):On(e)}var X=i.externalMeasured;X&&(n<X.lineN?X.lineN+=r:t<X.lineN+X.size&&(i.externalMeasured=null))}function Dn(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 T=r.view[Jn(e,t)];if(T.node==null)return;var F=T.changes||(T.changes=[]);ne(F,n)==-1&&F.push(n)}function On(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function ma(e,t,n,r){var i=Jn(e,t),T,F=e.display.view;if(!_r||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var W=e.display.viewFrom,z=0;z<i;z++)W+=F[z].size;if(W!=t){if(r>0){if(i==F.length-1)return null;T=W+F[i].size-t,i++}else T=W-t;t+=T,n+=T}for(;It(e.doc,n)!=n;){if(i==(r<0?0:F.length-1))return null;n+=r*F[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=di(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=di(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Jn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(di(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Jn(e,n)))),r.viewTo=n}function Ao(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 Ui(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Lo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),T=r.selection=document.createDocumentFragment(),F=0;F<n.sel.ranges.length;F++){if(!t&&F==n.sel.primIndex)continue;var W=n.sel.ranges[F];if(W.from().line>=e.display.viewTo||W.to().line<e.display.viewFrom)continue;var z=W.empty();(z||e.options.showCursorWhenSelecting)&&Do(e,W.head,i),z||Xs(e,W,T)}return r}function Do(e,t,n){var r=en(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 T=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));T.style.display="",T.style.left=r.other.left+"px",T.style.top=r.other.top+"px",T.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function pa(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,T=document.createDocumentFragment(),F=lt(e.display),W=F.left,z=Math.max(r.sizerWidth,Ge(e)-r.sizer.offsetLeft)-F.right,X=i.direction=="ltr";function ae(tt,st,yt,ht){st<0&&(st=0),st=Math.round(st),ht=Math.round(ht),T.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+tt+`px;
|
|
top: `+st+"px; width: "+(yt==null?z-tt:yt)+`px;
|
|
height: `+(ht-st)+"px"))}function de(tt,st,yt){var ht=ut(i,tt),At=ht.text.length,zt,ur;function Qt(tr,Dr){return Wa(e,Ke(tt,tr),"div",ht,Dr)}function Ur(tr,Dr,fr){var nr=wo(e,ht,null,tr),rr=Dr=="ltr"==(fr=="after")?"left":"right",Zt=fr=="after"?nr.begin:nr.end-(/\s/.test(ht.text.charAt(nr.end-1))?2:1);return Qt(Zt,rr)[rr]}var Lr=rt(ht,i.direction);return $e(Lr,st||0,yt==null?At:yt,function(tr,Dr,fr,nr){var rr=fr=="ltr",Zt=Qt(tr,rr?"left":"right"),Or=Qt(Dr-1,rr?"right":"left"),Ci=st==null&&tr==0,Un=yt==null&&Dr==At,mr=nr==0,fn=!Lr||nr==Lr.length-1;if(Or.top-Zt.top<=3){var dr=(X?Ci:Un)&&mr,bo=(X?Un:Ci)&&fn,xn=dr?W:(rr?Zt:Or).left,ti=bo?z:(rr?Or:Zt).right;ae(xn,Zt.top,ti-xn,Zt.bottom)}else{var ri,br,Ai,Eo;rr?(ri=X&&Ci&&mr?W:Zt.left,br=X?z:Ur(tr,fr,"before"),Ai=X?W:Ur(Dr,fr,"after"),Eo=X&&Un&&fn?z:Or.right):(ri=X?Ur(tr,fr,"before"):W,br=!X&&Ci&&mr?z:Zt.right,Ai=!X&&Un&&fn?W:Or.left,Eo=X?Ur(Dr,fr,"after"):z),ae(ri,Zt.top,br-ri,Zt.bottom),Zt.bottom<Or.top&&ae(W,Zt.bottom,null,Or.top),ae(Ai,Or.top,Eo-Ai,Or.bottom)}(!zt||pa(Zt,zt)<0)&&(zt=Zt),pa(Or,zt)<0&&(zt=Or),(!ur||pa(Zt,ur)<0)&&(ur=Zt),pa(Or,ur)<0&&(ur=Or)}),{start:zt,end:ur}}var _e=t.from(),be=t.to();if(_e.line==be.line)de(_e.line,_e.ch,be.ch);else{var Ie=ut(i,_e.line),Be=ut(i,be.line),Xe=ct(Ie)==ct(Be),et=de(_e.line,_e.ch,Xe?Ie.text.length+1:null).end,ot=de(be.line,Xe?0:null,be.ch).start;Xe&&(et.top<ot.top-2?(ae(et.right,et.top,null,et.bottom),ae(W,ot.top,ot.left,ot.bottom)):ae(et.right,et.top,ot.left-et.right,et.bottom)),et.bottom<ot.top&&ae(W,et.bottom,null,ot.top)}n.appendChild(T)}function $a(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()||mi(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Oo(e){e.state.focused||(e.display.input.focus(),Ya(e))}function Ro(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,mi(e))},100)}function Ya(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Pe(e,"focus",e,t),e.state.focused=!0,U(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),O&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),$a(e)}function mi(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Pe(e,"blur",e,t),e.state.focused=!1,h(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function ga(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],T=e.options.lineWrapping,F=void 0,W=0;if(i.hidden)continue;if(B&&k<8){var z=i.node.offsetTop+i.node.offsetHeight;F=z-n,n=z}else{var X=i.node.getBoundingClientRect();F=X.bottom-X.top,!T&&i.text.firstChild&&(W=i.text.firstChild.getBoundingClientRect().right-X.left-1)}var ae=i.line.height-F;if((ae>.005||ae<-.005)&&(pr(i.line,F),Po(i.line),i.rest))for(var de=0;de<i.rest.length;de++)Po(i.rest[de]);if(W>e.display.sizerWidth){var _e=Math.ceil(W/hi(e.display));_e>e.display.maxLineLength&&(e.display.maxLineLength=_e,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function Po(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 va(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Ne(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,T=Vr(t,r),F=Vr(t,i);if(n&&n.ensure){var W=n.ensure.from.line,z=n.ensure.to.line;W<T?(T=W,F=Vr(t,Kt(ut(t,W))+e.wrapper.clientHeight)):Math.min(z,t.lastLine())>=F&&(T=Vr(t,Kt(ut(t,z))-e.wrapper.clientHeight),F=z)}return{from:T,to:Math.max(F,T+1)}}function $s(e,t){if(Fe(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!w){var T=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Ne(e.display))+`px;
|
|
height: `+(t.bottom-t.top+We(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(T),T.scrollIntoView(i),e.display.lineSpace.removeChild(T)}}function Ys(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Ke(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Ke(t.line,t.ch+1,"before"):t);for(var T=0;T<5;T++){var F=!1,W=en(e,t),z=!n||n==t?W:en(e,n);i={left:Math.min(W.left,z.left),top:Math.min(W.top,z.top)-r,right:Math.max(W.left,z.left),bottom:Math.max(W.bottom,z.bottom)+r};var X=Ja(e,i),ae=e.doc.scrollTop,de=e.doc.scrollLeft;if(X.scrollTop!=null&&(Ni(e,X.scrollTop),Math.abs(e.doc.scrollTop-ae)>1&&(F=!0)),X.scrollLeft!=null&&(Qn(e,X.scrollLeft),Math.abs(e.doc.scrollLeft-de)>1&&(F=!0)),!F)break}return i}function Js(e,t){var n=Ja(e,t);n.scrollTop!=null&&Ni(e,n.scrollTop),n.scrollLeft!=null&&Qn(e,n.scrollLeft)}function Ja(e,t){var n=e.display,r=fi(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,T=pt(e),F={};t.bottom-t.top>T&&(t.bottom=t.top+T);var W=e.doc.height+Ue(n),z=t.top<r,X=t.bottom>W-r;if(t.top<i)F.scrollTop=z?0:t.top;else if(t.bottom>i+T){var ae=Math.min(t.top,(X?W:t.bottom)-T);ae!=i&&(F.scrollTop=ae)}var de=e.options.fixedGutter?0:n.gutters.offsetWidth,_e=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-de,be=Ge(e)-n.gutters.offsetWidth,Ie=t.right-t.left>be;return Ie&&(t.right=t.left+be),t.left<10?F.scrollLeft=0:t.left<_e?F.scrollLeft=Math.max(0,t.left+de-(Ie?0:10)):t.right>be+_e-3&&(F.scrollLeft=t.right+(Ie?0:10)-be),F}function Qa(e,t){if(t==null)return;ya(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function pi(e){ya(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Fi(e,t,n){(t!=null||n!=null)&&ya(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Qs(e,t){ya(e),e.curOp.scrollToPos=t}function ya(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=_o(e,t.from),r=_o(e,t.to);ko(e,n,r,t.margin)}}function ko(e,t,n,r){var i=Ja(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});Fi(e,i.scrollLeft,i.scrollTop)}function Ni(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||qa(e,{top:t}),Mo(e,t,!0),D&&qa(e),Wi(e,100)}function Mo(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 Qn(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,Bo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Bi(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Ue(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+We(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Zn=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),Oe(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Oe(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,B&&k<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Zn.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 T=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+T)+"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}},Zn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Zn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Zn.prototype.zeroWidthHack=function(){var e=s&&!A?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Q,this.disableVert=new Q},Zn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),T=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);T!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Zn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ji=function(){};ji.prototype.update=function(){return{bottom:0,right:0}},ji.prototype.setScrollLeft=function(){},ji.prototype.setScrollTop=function(){},ji.prototype.clear=function(){};function gi(e,t){t||(t=Bi(e));var n=e.display.barWidth,r=e.display.barHeight;Io(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&ga(e),Io(e,Bi(e)),n=e.display.barWidth,r=e.display.barHeight}function Io(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 Uo={native:Zn,null:ji};function Fo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&h(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Uo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Oe(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"?Qn(e,t):Ni(e,t)},e),e.display.scrollbars.addClass&&U(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function qn(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},Gn(e.curOp)}function ei(e){var t=e.curOp;t&&Ua(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 T=0;T<t.length;T++)nl(t[T]);for(var F=0;F<t.length;F++)il(t[F])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&jr(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 ba(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Za(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&ga(t),e.barMeasure=Bi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Lt(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+We(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Ge(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&&Qn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==S();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&gi(t,e.barMeasure),e.updatedDisplay&&to(t,e.barMeasure),e.selectionChanged&&$a(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Oo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&No(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&Mo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Qn(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=Ys(t,bt(r,e.scrollToPos.from),bt(r,e.scrollToPos.to),e.scrollToPos.margin);$s(t,i)}var T=e.maybeHiddenMarkers,F=e.maybeUnhiddenMarkers;if(T)for(var W=0;W<T.length;++W)T[W].lines.length||Pe(T[W],"hide");if(F)for(var z=0;z<F.length;++z)F[z].lines.length&&Pe(F[z],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Pe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Ir(e,t){if(e.curOp)return t();qn(e);try{return t()}finally{ei(e)}}function sr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);qn(e);try{return t.apply(e,arguments)}finally{ei(e)}}}function yr(e){return function(){if(this.curOp)return e.apply(this,arguments);qn(this);try{return e.apply(this,arguments)}finally{ei(this)}}}function lr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);qn(t);try{return e.apply(this,arguments)}finally{ei(t)}}}function Wi(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,N(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=Tr(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(T){if(r.line>=e.display.viewFrom){var F=T.styles,W=T.text.length>e.options.maxHighlightLength?Pr(t.mode,r.state):null,z=ni(e,T,r,!0);W&&(r.state=W),T.styles=z.styles;var X=T.styleClasses,ae=z.classes;ae?T.styleClasses=ae:X&&(T.styleClasses=null);for(var de=!F||F.length!=T.styles.length||X!=ae&&(!X||!ae||X.bgClass!=ae.bgClass||X.textClass!=ae.textClass),_e=0;!de&&_e<F.length;++_e)de=F[_e]!=T.styles[_e];de&&i.push(r.line),T.stateAfter=r.save(),r.nextLine()}else T.text.length<=e.options.maxHighlightLength&&Nn(e,T.text,r),T.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return Wi(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&Ir(e,function(){for(var T=0;T<i.length;T++)Dn(e,i[T],"text")})}var ba=function(e,t,n){var r=e.display;this.viewport=t,this.visible=va(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Ge(e),this.force=n,this.dims=za(e),this.events=[]};ba.prototype.signal=function(e,t){oe(e,t)&&this.events.push(arguments)},ba.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Pe.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=We(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=We(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=S();if(!t||!g(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&g(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==S())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&g(document.body,e.anchorNode)&&g(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 Za(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return On(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&&Ao(e)==0)return!1;jo(e)&&(On(e),t.dims=za(e));var i=r.first+r.size,T=Math.max(t.visible.from-e.options.viewportMargin,r.first),F=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<T&&T-n.viewFrom<20&&(T=Math.max(r.first,n.viewFrom)),n.viewTo>F&&n.viewTo-F<20&&(F=Math.min(i,n.viewTo)),_r&&(T=It(e.doc,T),F=Bt(e.doc,F));var W=T!=n.viewFrom||F!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,T,F),n.viewOffset=Kt(ut(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var z=Ao(e);if(!W&&z==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var X=sl(e);return z>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),z>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(X),c(n.cursorDiv),c(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,W&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Wi(e,400)),n.updateLineNumbers=null,!0}function No(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Ge(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+Ue(e.display)-pt(e),n.top)}),t.visible=va(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=va(e.display,e.doc,n));if(!Za(e,t))break;ga(e);var i=Bi(e);Ui(e),gi(e,i),to(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 qa(e,t){var n=new ba(e,t);if(Za(e,n)){ga(e),No(e,n);var r=Bi(e);Ui(e),gi(e,r),to(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,T=r.lineDiv,F=T.firstChild;function W(Ie){var Be=Ie.nextSibling;return O&&s&&e.display.currentWheelTarget==Ie?Ie.style.display="none":Ie.parentNode.removeChild(Ie),Be}for(var z=r.view,X=r.viewFrom,ae=0;ae<z.length;ae++){var de=z[ae];if(!de.hidden)if(!de.node||de.node.parentNode!=T){var _e=Ba(e,de,X,n);T.insertBefore(_e,F)}else{for(;F!=de.node;)F=W(F);var be=i&&t!=null&&t<=X&&de.lineNumber;de.changes&&(ne(de.changes,"gutter")>-1&&(be=!1),sa(e,de,X,n)),be&&(c(de.lineNumber),de.lineNumber.appendChild(document.createTextNode(hn(e.options,X)))),F=de.node.nextSibling}X+=de.size}for(;F;)F=W(F)}function eo(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function to(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+We(e)+"px"}function Bo(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Va(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,T=r+"px",F=0;F<n.length;F++)if(!n[F].hidden){e.options.fixedGutter&&(n[F].gutter&&(n[F].gutter.style.left=T),n[F].gutterBackground&&(n[F].gutterBackground.style.left=T));var W=n[F].alignable;if(W)for(var z=0;z<W.length;z++)W[z].style.left=T}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function jo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=hn(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")),T=i.firstChild.offsetWidth,F=i.offsetWidth-T;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(T,r.lineGutter.offsetWidth-F)+1,r.lineNumWidth=r.lineNumInnerWidth+F,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",eo(e.display),!0}return!1}function ro(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var T=e[i],F=null;if(typeof T!="string"&&(F=T.style,T=T.className),T=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:T,style:F})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Wo(e){var t=e.gutters,n=e.gutterSpecs;c(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],T=i.className,F=i.style,W=t.appendChild(a("div",null,"CodeMirror-gutter "+T));F&&(W.style.cssText=F),T=="CodeMirror-linenumbers"&&(e.lineGutter=W,W.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",eo(e)}function Hi(e){Wo(e.display),Cr(e),Bo(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=v("div",null,"CodeMirror-code"),i.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=a("div",null,"CodeMirror-cursors"),i.measure=a("div",null,"CodeMirror-measure"),i.lineMeasure=a("div",null,"CodeMirror-measure"),i.lineSpace=v("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var T=v("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[T],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+se+"px; width: 1px;"),i.gutters=a("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=a("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=a("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),B&&k<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!O&&!(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=ro(r.gutters,r.lineNumbers),Wo(i),n.init(i)}var Ea=0,Hr=null;B?Hr=-.53:D?Hr=15:E?Hr=-.7:R&&(Hr=-1/3);function Ho(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=Ho(e);return t.x*=Hr,t.y*=Hr,t}function Ko(e,t){var n=Ho(t),r=n.x,i=n.y,T=e.display,F=T.scroller,W=F.scrollWidth>F.clientWidth,z=F.scrollHeight>F.clientHeight;if(!(r&&W||i&&z))return;if(i&&s&&O){e:for(var X=t.target,ae=T.view;X!=F;X=X.parentNode)for(var de=0;de<ae.length;de++)if(ae[de].node==X){e.display.currentWheelTarget=X;break e}}if(r&&!D&&!C&&Hr!=null){i&&z&&Ni(e,Math.max(0,F.scrollTop+i*Hr)),Qn(e,Math.max(0,F.scrollLeft+r*Hr)),(!i||i&&z)&&$(t),T.wheelStartX=null;return}if(i&&Hr!=null){var _e=i*Hr,be=e.doc.scrollTop,Ie=be+T.wrapper.clientHeight;_e<0?be=Math.max(0,be+_e-50):Ie=Math.min(e.doc.height,Ie+_e+50),qa(e,{top:be,bottom:Ie})}Ea<20&&(T.wheelStartX==null?(T.wheelStartX=F.scrollLeft,T.wheelStartY=F.scrollTop,T.wheelDX=r,T.wheelDY=i,setTimeout(function(){if(T.wheelStartX==null)return;var Be=F.scrollLeft-T.wheelStartX,Xe=F.scrollTop-T.wheelStartY,et=Xe&&T.wheelDY&&Xe/T.wheelDY||Be&&T.wheelDX&&Be/T.wheelDX;if(T.wheelStartX=T.wheelStartY=null,!et)return;Hr=(Hr*Ea+et)/(Ea+1),++Ea},200)):(T.wheelDX+=r,T.wheelDY+=i))}var Kr=function(e,t){this.ranges=e,this.primIndex=t};Kr.prototype.primary=function(){return this.ranges[this.primIndex]},Kr.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(!Qe(n.anchor,r.anchor)||!Qe(n.head,r.head))return!1}return!0},Kr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Ut(Fn(this.ranges[t].anchor),Fn(this.ranges[t].head));return new Kr(e,this.primIndex)},Kr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Kr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(Et(t,r.from())>=0&&Et(e,r.to())<=0)return n}return-1};var Ut=function(e,t){this.anchor=e,this.head=t};Ut.prototype.from=function(){return an(this.anchor,this.head)},Ut.prototype.to=function(){return _n(this.anchor,this.head)},Ut.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function tn(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(_e,be){return Et(_e.from(),be.from())}),n=ne(t,i);for(var T=1;T<t.length;T++){var F=t[T],W=t[T-1],z=Et(W.to(),F.from());if(r&&!F.empty()?z>0:z>=0){var X=an(W.from(),F.from()),ae=_n(W.to(),F.to()),de=W.empty()?F.from()==F.head:W.from()==W.head;T<=n&&--n,t.splice(--T,2,new Ut(de?ae:X,de?X:ae))}}return new Kr(t,n)}function Rn(e,t){return new Kr([new Ut(e,t||e)],0)}function Pn(e){return e.text?Ke(e.from.line+e.text.length-1,J(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Go(e,t){if(Et(e,t.from)<0)return e;if(Et(e,t.to)<=0)return Pn(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+=Pn(t).ch-t.to.ch),Ke(n,r)}function no(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new Ut(Go(i.anchor,t),Go(i.head,t)))}return tn(e.cm,n,e.sel.primIndex)}function zo(e,t,n){return e.line==t.line?Ke(n.line,e.ch-t.ch+n.ch):Ke(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Ke(e.first,0),T=i,F=0;F<t.length;F++){var W=t[F],z=zo(W.from,i,T),X=zo(Pn(W),i,T);if(i=W.to,T=X,n=="around"){var ae=e.sel.ranges[F],de=Et(ae.head,ae.anchor)<0;r[F]=new Ut(de?X:z,de?z:X)}else r[F]=new Ut(z,z)}return new Kr(r,e.sel.primIndex)}function io(e){e.doc.mode=Gr(e.options,e.doc.modeOption),Ki(e)}function Ki(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,Wi(e,100),e.state.modeGen++,e.curOp&&Cr(e)}function Vo(e,t){return t.from.ch==0&&t.to.ch==0&&J(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ao(e,t,n,r){function i(ot){return n?n[ot]:null}function T(ot,tt,st){Qr(ot,tt,st,r),or(ot,"change",ot,t)}function F(ot,tt){for(var st=[],yt=ot;yt<tt;++yt)st.push(new Gt(X[yt],i(yt),r));return st}var W=t.from,z=t.to,X=t.text,ae=ut(e,W.line),de=ut(e,z.line),_e=J(X),be=i(X.length-1),Ie=z.line-W.line;if(t.full)e.insert(0,F(0,X.length)),e.remove(X.length,e.size-X.length);else if(Vo(e,t)){var Be=F(0,X.length-1);T(de,de.text,be),Ie&&e.remove(W.line,Ie),Be.length&&e.insert(W.line,Be)}else if(ae==de)if(X.length==1)T(ae,ae.text.slice(0,W.ch)+_e+ae.text.slice(z.ch),be);else{var Xe=F(1,X.length-1);Xe.push(new Gt(_e+ae.text.slice(z.ch),be,r)),T(ae,ae.text.slice(0,W.ch)+X[0],i(0)),e.insert(W.line+1,Xe)}else if(X.length==1)T(ae,ae.text.slice(0,W.ch)+X[0]+de.text.slice(z.ch),i(0)),e.remove(W.line+1,Ie);else{T(ae,ae.text.slice(0,W.ch)+X[0],i(0)),T(de,_e+de.text.slice(z.ch),be);var et=F(1,X.length-1);Ie>1&&e.remove(W.line+1,Ie-1),e.insert(W.line+1,et)}or(e,"change",e,t)}function kn(e,t,n){function r(i,T,F){if(i.linked)for(var W=0;W<i.linked.length;++W){var z=i.linked[W];if(z.doc==T)continue;var X=F&&z.sharedHist;if(n&&!X)continue;t(z.doc,X),r(z.doc,i,X)}}r(e,null,!0)}function Xo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Xa(e),io(e),$o(e),e.options.lineWrapping||jr(e),e.options.mode=t.modeOption,Cr(e)}function $o(e){(e.doc.direction=="rtl"?U:h)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){Ir(e,function(){$o(e),Cr(e)})}function xa(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 oo(e,t){var n={from:Fn(t.from),to:Pn(t),text:zr(e,t.from,t.to)};return Qo(e,n,t.from.line,t.to.line+1),kn(e,function(r){return Qo(r,n,t.from.line,t.to.line+1)},!0),n}function Yo(e){for(;e.length;){var t=J(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Yo(e.done),J(e.done);if(e.done.length&&!J(e.done).ranges)return J(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),J(e.done)}function Jo(e,t,n,r){var i=e.history;i.undone.length=0;var T=+new Date,F,W;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>T-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(F=ml(i,i.lastOp==r)))W=J(F.changes),Et(t.from,t.to)==0&&Et(t.from,W.to)==0?W.to=Pn(t):F.changes.push(oo(e,t));else{var z=J(i.done);for((!z||!z.ranges)&&Ta(e.sel,i.done),F={changes:[oo(e,t)],generation:i.generation},i.done.push(F);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=T,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,W||Pe(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,T=r&&r.origin;n==i.lastSelOp||T&&i.lastSelOrigin==T&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==T||pl(e,T,J(i.done),t))?i.done[i.done.length-1]=t:Ta(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=T,i.lastSelOp=n,r&&r.clearRedo!==!1&&Yo(i.undone)}function Ta(e,t){var n=J(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Qo(e,t,n,r){var i=t["spans_"+e.id],T=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(F){F.markedSpans&&((i||(i=t["spans_"+e.id]={}))[T]=F.markedSpans),++T})}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 Zo(e,t){var n=yl(e,t),r=Jr(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var T=n[i],F=r[i];if(T&&F){e:for(var W=0;W<F.length;++W){for(var z=F[W],X=0;X<T.length;++X)if(T[X].marker==z.marker)continue e;T.push(z)}}else F&&(n[i]=F)}return n}function vi(e,t,n){for(var r=[],i=0;i<e.length;++i){var T=e[i];if(T.ranges){r.push(n?Kr.prototype.deepCopy.call(T):T);continue}var F=T.changes,W=[];r.push({changes:W});for(var z=0;z<F.length;++z){var X=F[z],ae=void 0;if(W.push({from:X.from,to:X.to,text:X.text}),t)for(var de in X)(ae=de.match(/^spans_(\d+)$/))&&(ne(t,Number(ae[1]))>-1&&(J(W)[de]=X[de],delete X[de]))}}return r}function so(e,t,n,r){if(r){var i=e.anchor;if(n){var T=Et(t,i)<0;T!=Et(n,i)<0?(i=t,t=n):T!=Et(t,n)<0&&(t=n)}return new Ut(i,t)}else return new Ut(n||t,t)}function _a(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),hr(e,new Kr([so(e.sel.primary(),t,n,i)],0),r)}function qo(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),T=0;T<e.sel.ranges.length;T++)r[T]=so(e.sel.ranges[T],t[T],null,i);var F=tn(e.cm,r,e.sel.primIndex);hr(e,F,n)}function lo(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,hr(e,tn(e.cm,i,e.sel.primIndex),r)}function es(e,t,n,r){hr(e,Rn(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var T=0;T<i.length;T++)this.ranges[T]=new Ut(bt(e,i[T].anchor),bt(e,i[T].head))},origin:n&&n.origin};return Pe(e,"beforeSelectionChange",e,r),e.cm&&Pe(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?tn(e.cm,r.ranges,r.ranges.length-1):t}function ts(e,t,n){var r=e.history.done,i=J(r);i&&i.ranges?(r[r.length-1]=t,Sa(e,t,n)):hr(e,t,n)}function hr(e,t,n){Sa(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Sa(e,t,n){(oe(e,"beforeSelectionChange")||e.cm&&oe(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(Et(t.primary().head,e.sel.primary().head)<0?-1:1);rs(e,is(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&pi(e.cm)}function rs(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ie(e.cm)),or(e,"cursorActivity",e)}function ns(e){rs(e,is(e,e.sel,null,!1))}function is(e,t,n,r){for(var i,T=0;T<t.ranges.length;T++){var F=t.ranges[T],W=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[T],z=wa(e,F.anchor,W&&W.anchor,n,r),X=wa(e,F.head,W&&W.head,n,r);(i||z!=F.anchor||X!=F.head)&&(i||(i=t.ranges.slice(0,T)),i[T]=new Ut(z,X))}return i?tn(e.cm,i,t.primIndex):t}function yi(e,t,n,r,i){var T=ut(e,t.line);if(T.markedSpans)for(var F=0;F<T.markedSpans.length;++F){var W=T.markedSpans[F],z=W.marker,X="selectLeft"in z?!z.selectLeft:z.inclusiveLeft,ae="selectRight"in z?!z.selectRight:z.inclusiveRight;if((W.from==null||(X?W.from<=t.ch:W.from<t.ch))&&(W.to==null||(ae?W.to>=t.ch:W.to>t.ch))){if(i&&(Pe(z,"beforeCursorEnter"),z.explicitlyCleared))if(T.markedSpans){--F;continue}else break;if(!z.atomic)continue;if(n){var de=z.find(r<0?1:-1),_e=void 0;if((r<0?ae:X)&&(de=as(e,de,-r,de&&de.line==t.line?T:null)),de&&de.line==t.line&&(_e=Et(de,n))&&(r<0?_e<0:_e>0))return yi(e,de,t,r,i)}var be=z.find(r<0?-1:1);return(r<0?X:ae)&&(be=as(e,be,r,be.line==t.line?T:null)),be?yi(e,be,t,r,i):null}}return t}function wa(e,t,n,r,i){var T=r||1,F=yi(e,t,n,T,i)||!i&&yi(e,t,n,T,!0)||yi(e,t,n,-T,i)||!i&&yi(e,t,n,-T,!0);return F||(e.cantEdit=!0,Ke(e.first,0))}function as(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?bt(e,Ke(t.line-1)):null:n>0&&t.ch==(r||ut(e,t.line)).text.length?t.line<e.first+e.size-1?Ke(t.line+1,0):null:new Ke(t.line,t.ch+n)}function os(e){e.setSelection(Ke(e.firstLine(),0),Ke(e.lastLine()),me)}function ss(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,T,F,W){i&&(r.from=bt(e,i)),T&&(r.to=bt(e,T)),F&&(r.text=F),W!==void 0&&(r.origin=W)}),Pe(e,"beforeChange",e,r),e.cm&&Pe(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 bi(e,t,n){if(e.cm){if(!e.cm.curOp)return sr(e.cm,bi)(e,t,n);if(e.cm.state.suppressEdits)return}if((oe(e,"beforeChange")||e.cm&&oe(e.cm,"beforeChange"))&&(t=ss(e,t,!0),!t))return;var r=oi&&!n&&yn(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)ls(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else ls(e,t)}function ls(e,t){if(t.text.length==1&&t.text[0]==""&&Et(t.from,t.to)==0)return;var n=no(e,t);Jo(e,t,n,e.cm?e.cm.curOp.id:NaN),Gi(e,t,n,Jr(e,t));var r=[];kn(e,function(i,T){!T&&ne(r,i.history)==-1&&(fs(i.history,t),r.push(i.history)),Gi(i,t,null,Jr(i,t))})}function Ca(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,T,F=e.sel,W=t=="undo"?i.done:i.undone,z=t=="undo"?i.undone:i.done,X=0;X<W.length&&!(T=W[X],n?T.ranges&&!T.equals(e.sel):!T.ranges);X++);if(X==W.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(T=W.pop(),T.ranges){if(Ta(T,z),n&&!T.equals(e.sel)){hr(e,T,{clearRedo:!1});return}F=T}else if(r){W.push(T);return}else break;var ae=[];Ta(F,z),z.push({changes:ae,generation:i.generation}),i.generation=T.generation||++i.maxGeneration;for(var de=oe(e,"beforeChange")||e.cm&&oe(e.cm,"beforeChange"),_e=function(Be){var Xe=T.changes[Be];if(Xe.origin=t,de&&!ss(e,Xe,!1))return W.length=0,{};ae.push(oo(e,Xe));var et=Be?no(e,Xe):J(W);Gi(e,Xe,et,Zo(e,Xe)),!Be&&e.cm&&e.cm.scrollIntoView({from:Xe.from,to:Pn(Xe)});var ot=[];kn(e,function(tt,st){!st&&ne(ot,tt.history)==-1&&(fs(tt.history,Xe),ot.push(tt.history)),Gi(tt,Xe,null,Zo(tt,Xe))})},be=T.changes.length-1;be>=0;--be){var Ie=_e(be);if(Ie)return Ie.v}}function us(e,t){if(t==0)return;if(e.first+=t,e.sel=new Kr(le(e.sel.ranges,function(i){return new Ut(Ke(i.anchor.line+t,i.anchor.ch),Ke(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){Cr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Dn(e.cm,r,"gutter")}}function Gi(e,t,n,r){if(e.cm&&!e.cm.curOp)return sr(e.cm,Gi)(e,t,n,r);if(t.to.line<e.first){us(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);us(e,i),t={from:Ke(e.first,0),to:Ke(t.to.line+i,t.to.ch),text:[J(t.text)],origin:t.origin}}var T=e.lastLine();t.to.line>T&&(t={from:t.from,to:Ke(T,ut(e,T).text.length),text:[t.text[0]],origin:t.origin}),t.removed=zr(e,t.from,t.to),n||(n=no(e,t)),e.cm?El(e.cm,t,r):ao(e,t,r),Sa(e,n,me),e.cantEdit&&wa(e,Ke(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,T=t.from,F=t.to,W=!1,z=T.line;e.options.lineWrapping||(z=kt(ct(ut(r,T.line))),r.iter(z,F.line+1,function(be){if(be==i.maxLine)return W=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ie(e),ao(r,t,n,Co(e)),e.options.lineWrapping||(r.iter(z,T.line+t.text.length,function(be){var Ie=cr(be);Ie>i.maxLineLength&&(i.maxLine=be,i.maxLineLength=Ie,i.maxLineChanged=!0,W=!1)}),W&&(e.curOp.updateMaxLine=!0)),vn(r,T.line),Wi(e,400);var X=t.text.length-(F.line-T.line)-1;t.full?Cr(e):T.line==F.line&&t.text.length==1&&!Vo(e.doc,t)?Dn(e,T.line,"text"):Cr(e,T.line,F.line+1,X);var ae=oe(e,"changes"),de=oe(e,"change");if(de||ae){var _e={from:T,to:F,text:t.text,removed:t.removed,origin:t.origin};de&&or(e,"change",e,_e),ae&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(_e)}e.display.selForContextMenu=null}function Ei(e,t,n,r,i){var T;r||(r=n),Et(r,n)<0&&(T=[r,n],n=T[0],r=T[1]),typeof t=="string"&&(t=e.splitLines(t)),bi(e,{from:n,to:r,text:t,origin:i})}function ds(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function cs(e,t,n,r){for(var i=0;i<e.length;++i){var T=e[i],F=!0;if(T.ranges){T.copied||(T=e[i]=T.deepCopy(),T.copied=!0);for(var W=0;W<T.ranges.length;W++)ds(T.ranges[W].anchor,t,n,r),ds(T.ranges[W].head,t,n,r);continue}for(var z=0;z<T.changes.length;++z){var X=T.changes[z];if(n<X.from.line)X.from=Ke(X.from.line+r,X.from.ch),X.to=Ke(X.to.line+r,X.to.ch);else if(t<=X.to.line){F=!1;break}}F||(e.splice(0,i+1),i=0)}}function fs(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;cs(e.done,n,r,i),cs(e.undone,n,r,i)}function zi(e,t,n,r){var i=t,T=t;return typeof t=="number"?T=ut(e,mn(e,t)):i=kt(t),i==null?null:(r(T,i)&&e.cm&&Dn(e.cm,i,n),T)}function Vi(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}Vi.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,ar(i),or(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 Xi(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}Xi.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 T=Math.min(t,i-e),F=r.height;if(r.removeInner(e,T),this.height-=F-r.height,i==T&&(this.children.splice(n--,1),r.parent=null),(t-=T)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Vi))){var W=[];this.collapse(W),this.children=[new Vi(W)],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],T=i.chunkSize();if(e<=T){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var F=i.lines.length%25+25,W=F;W<i.lines.length;){var z=new Vi(i.lines.slice(W,W+=25));i.height-=z.height,this.children.splice(++r,0,z),z.parent=this}i.lines=i.lines.slice(0,F),this.maybeSpill()}break}e-=T}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Xi(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=ne(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new Xi(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],T=i.chunkSize();if(e<T){var F=Math.min(t,T-e);if(i.iterN(e,F,n))return!0;if((t-=F)==0)break;e=0}else e-=T}}};var $i=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};$i.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=kt(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var T=ft(this);pr(n,Math.max(0,n.height-T)),e&&(Ir(e,function(){hs(e,n,-T),Dn(e,r,"widget")}),or(e,"lineWidgetCleared",e,this,r))},$i.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ft(this)-t;if(!i)return;jt(this.doc,r)||pr(r,r.height+i),n&&Ir(n,function(){n.curOp.forceUpdate=!0,hs(n,r,i),or(n,"lineWidgetChanged",n,e,kt(r))})},ue($i);function hs(e,t,n){Kt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Qa(e,n)}function xl(e,t,n,r){var i=new $i(e,n,r),T=e.cm;return T&&i.noHScroll&&(T.display.alignWidgets=!0),zi(e,t,"widget",function(F){var W=F.widgets||(F.widgets=[]);if(i.insertAt==null?W.push(i):W.splice(Math.min(W.length-1,Math.max(0,i.insertAt)),0,i),i.line=F,T&&!jt(e,F)){var z=Kt(F)<e.scrollTop;pr(F,F.height+ft(i)),z&&Qa(T,i.height),T.curOp.forceUpdate=!0}return!0}),T&&or(T,"lineWidgetAdded",T,i,typeof t=="number"?t:kt(t)),i}var ms=0,Mn=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ms};Mn.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&qn(e),oe(this,"clear")){var n=this.find();n&&or(this,"clear",n.from,n.to)}for(var r=null,i=null,T=0;T<this.lines.length;++T){var F=this.lines[T],W=Yr(F.markedSpans,this);e&&!this.collapsed?Dn(e,kt(F),"text"):e&&(W.to!=null&&(i=kt(F)),W.from!=null&&(r=kt(F))),F.markedSpans=na(F.markedSpans,W),W.from==null&&this.collapsed&&!jt(this.doc,F)&&e&&pr(F,fi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var z=0;z<this.lines.length;++z){var X=ct(this.lines[z]),ae=cr(X);ae>e.display.maxLineLength&&(e.display.maxLine=X,e.display.maxLineLength=ae,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Cr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&ns(e.doc)),e&&or(e,"markerCleared",e,this,r,i),t&&ei(e),this.parent&&this.parent.clear()},Mn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var T=this.lines[i],F=Yr(T.markedSpans,this);if(F.from!=null&&(n=Ke(t?T:kt(T),F.from),e==-1))return n;if(F.to!=null&&(r=Ke(t?T:kt(T),F.to),e==1))return r}return n&&{from:n,to:r}},Mn.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;Ir(r,function(){var i=t.line,T=kt(t.line),F=Jt(r,T);if(F&&(vr(F),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!jt(n.doc,i)&&n.height!=null){var W=n.height;n.height=null;var z=ft(n)-W;z&&pr(i,i.height+z)}or(r,"markerChanged",r,e)})},Mn.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ne(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Mn.prototype.detachLine=function(e){if(this.lines.splice(ne(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ue(Mn);function xi(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return sr(e.cm,xi)(e,t,n,r,i);var T=new Mn(e,i),F=Et(t,n);if(r&&I(r,T,!1),F>0||F==0&&T.clearWhenEmpty!==!1)return T;if(T.replacedWith&&(T.collapsed=!0,T.widgetNode=v("span",[T.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||T.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(T.widgetNode.insertLeft=!0)),T.collapsed){if(li(e,t.line,t,n,T)||t.line!=n.line&&li(e,n.line,t,n,T))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ri()}T.addToHistory&&Jo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var W=t.line,z=e.cm,X;if(e.iter(W,n.line+1,function(de){z&&T.collapsed&&!z.options.lineWrapping&&ct(de)==z.display.maxLine&&(X=!0),T.collapsed&&W!=t.line&&pr(de,0),si(de,new An(T,W==t.line?t.ch:null,W==n.line?n.ch:null)),++W}),T.collapsed&&e.iter(t.line,n.line+1,function(de){jt(e,de)&&pr(de,0)}),T.clearOnEnter&&Oe(T,"beforeCursorEnter",function(){return T.clear()}),T.readOnly&&(Oi(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),T.collapsed&&(T.id=++ms,T.atomic=!0),z){if(X&&(z.curOp.updateMaxLine=!0),T.collapsed)Cr(z,t.line,n.line+1);else if(T.className||T.startStyle||T.endStyle||T.css||T.attributes||T.title)for(var ae=t.line;ae<=n.line;ae++)Dn(z,ae,"text");T.atomic&&ns(z.doc),or(z,"markerAdded",z,T)}return T}var Yi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};Yi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();or(this,"clear")},Yi.prototype.find=function(e,t){return this.primary.find(e,t)},ue(Yi);function Tl(e,t,n,r,i){r=I(r),r.shared=!1;var T=[xi(e,t,n,r,i)],F=T[0],W=r.widgetNode;return kn(e,function(z){W&&(r.widgetNode=W.cloneNode(!0)),T.push(xi(z,bt(z,t),bt(z,n),r,i));for(var X=0;X<z.linked.length;++X)if(z.linked[X].isParent)return;F=J(T)}),new Yi(T,F)}function ps(e){return e.findMarks(Ke(e.first,0),e.clipPos(Ke(e.lastLine())),function(t){return t.parent})}function _l(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),T=e.clipPos(i.from),F=e.clipPos(i.to);if(Et(T,F)){var W=xi(e,T,F,r.primary,r.primary.type);r.markers.push(W),W.parent=r}}}function Sl(e){for(var t=function(r){var i=e[r],T=[i.primary.doc];kn(i.primary.doc,function(z){return T.push(z)});for(var F=0;F<i.markers.length;F++){var W=i.markers[F];ne(T,W.doc)==-1&&(W.parent=null,i.markers.splice(F--,1))}},n=0;n<e.length;n++)t(n)}var wl=0,Ar=function(e,t,n,r,i){if(!(this instanceof Ar))return new Ar(e,t,n,r,i);n==null&&(n=0),Xi.call(this,[new Vi([new Gt("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var T=Ke(n,0);this.sel=Rn(T),this.history=new xa(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),ao(this,{from:T,to:T,text:e}),hr(this,Rn(T),me)};Ar.prototype=ye(Xi.prototype,{constructor:Ar,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=Tn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:lr(function(e){var t=Ke(this.first,0),n=this.first+this.size-1;bi(this,{from:t,to:Ke(n,ut(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Fi(this.cm,0,0),hr(this,Rn(t),me)}),replaceRange:function(e,t,n,r){t=bt(this,t),n=n?bt(this,n):t,Ei(this,e,t,n,r)},getRange:function(e,t,n){var r=zr(this,bt(this,e),bt(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 ut(this,e)},getLineNumber:function(e){return kt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ut(this,e)),ct(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return bt(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:lr(function(e,t,n){es(this,bt(this,typeof e=="number"?Ke(e,t||0):e),null,n)}),setSelection:lr(function(e,t,n){es(this,bt(this,e),bt(this,t||e),n)}),extendSelection:lr(function(e,t,n){_a(this,bt(this,e),t&&bt(this,t),n)}),extendSelections:lr(function(e,t){qo(this,Sn(this,e),t)}),extendSelectionsBy:lr(function(e,t){var n=le(this.sel.ranges,e);qo(this,Sn(this,n),t)}),setSelections:lr(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new Ut(bt(this,e[i].anchor),bt(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),hr(this,tn(this.cm,r,t),n)}),addSelection:lr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Ut(bt(this,e),bt(this,t||e))),hr(this,tn(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=zr(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=zr(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:lr(function(e,t,n){for(var r=[],i=this.sel,T=0;T<i.ranges.length;T++){var F=i.ranges[T];r[T]={from:F.from(),to:F.to(),text:this.splitLines(e[T]),origin:n}}for(var W=t&&t!="end"&&fl(this,r,t),z=r.length-1;z>=0;z--)bi(this,r[z]);W?ts(this,W):this.cm&&pi(this.cm)}),undo:lr(function(){Ca(this,"undo")}),redo:lr(function(){Ca(this,"redo")}),undoSelection:lr(function(){Ca(this,"undo",!0)}),redoSelection:lr(function(){Ca(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 xa(this.history.maxGeneration),kn(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:vi(this.history.done),undone:vi(this.history.undone)}},setHistory:function(e){var t=this.history=new xa(this.history.maxGeneration);t.done=vi(e.done.slice(0),null,!0),t.undone=vi(e.undone.slice(0),null,!0)},setGutterMarker:lr(function(e,t,n){return zi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Re(i)&&(r.gutterMarkers=null),!0})}),clearGutter:lr(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&zi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Re(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=ut(this,e),!e)return null}else if(t=kt(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:lr(function(e,t,n){return zi(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(y(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:lr(function(e,t,n){return zi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",T=r[i];if(T)if(n==null)r[i]=null;else{var F=T.match(y(n));if(!F)return!1;var W=F.index+F[0].length;r[i]=T.slice(0,F.index)+(!F.index||W==T.length?"":" ")+T.slice(W)||null}else return!1;return!0})}),addLineWidget:lr(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return xi(this,bt(this,e),bt(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=bt(this,e),xi(this,e,e,n,"bookmark")},findMarksAt:function(e){e=bt(this,e);var t=[],n=ut(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=bt(this,e),t=bt(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(T){var F=T.markedSpans;if(F)for(var W=0;W<F.length;W++){var z=F[W];!(z.to!=null&&i==e.line&&e.ch>=z.to||z.from==null&&i!=e.line||z.from!=null&&i==t.line&&z.from>=t.ch)&&(!n||n(z.marker))&&r.push(z.marker.parent||z.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 T=i.text.length+r;if(T>e)return t=e,!0;e-=T,++n}),bt(this,Ke(n,t))},indexFromPos:function(e){e=bt(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 Ar(Tn(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 Ar(Tn(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}],_l(r,ps(this)),r},unlinkDoc:function(e){if(e instanceof Xt&&(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),Sl(ps(this));break}if(e.history==this.history){var r=[e.id];kn(e,function(i){return r.push(i.id)},!0),e.history=new xa(null),e.history.done=vi(this.history.done,r),e.history.undone=vi(this.history.undone,r)}},iterLinkedDocs:function(e){kn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):wt(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:lr(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)})}),Ar.prototype.eachLine=Ar.prototype.iter;var gs=0;function Cl(e){var t=this;if(vs(t),Fe(t,e)||ve(t.display,e))return;$(e),B&&(gs=+new Date);var n=Yn(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,T=Array(i),F=0,W=function(){++F==i&&sr(t,function(){n=bt(t.doc,n);var be={from:n,to:n,text:t.doc.splitLines(T.filter(function(Ie){return Ie!=null}).join(t.doc.lineSeparator())),origin:"paste"};bi(t.doc,be),ts(t.doc,Rn(bt(t.doc,n),bt(t.doc,Pn(be))))})()},z=function(be,Ie){if(t.options.allowDropFileTypes&&ne(t.options.allowDropFileTypes,be.type)==-1){W();return}var Be=new FileReader;Be.onerror=function(){return W()},Be.onload=function(){var Xe=Be.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Xe)){W();return}T[Ie]=Xe,W()},Be.readAsText(be)},X=0;X<r.length;X++)z(r[X],X);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ae=e.dataTransfer.getData("Text");if(ae){var de;if(t.state.draggingText&&!t.state.draggingText.copy&&(de=t.listSelections()),Sa(t.doc,Rn(n,n)),de)for(var _e=0;_e<de.length;++_e)Ei(t.doc,"",de[_e].anchor,de[_e].head,"drag");t.replaceSelection(ae,"around","paste"),t.display.input.focus()}}catch(be){}}}function Al(e,t){if(B&&(!e.state.draggingText||+new Date-gs<100)){re(t);return}if(Fe(e,t)||ve(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!R){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",C&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),C&&n.parentNode.removeChild(n)}}function Ll(e,t){var n=Yn(e,t);if(!n)return;var r=document.createDocumentFragment();Do(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),l(e.display.dragCursor,r)}function vs(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ys(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 T=0;T<n.length;T++)e(n[T])})}var bs=!1;function Dl(){if(bs)return;Ol(),bs=!0}function Ol(){var e;Oe(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ys(Rl)},100))}),Oe(window,"blur",function(){return ys(mi)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var In={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"},Ji=0;Ji<10;Ji++)In[Ji+48]=In[Ji+96]=String(Ji);for(var Aa=65;Aa<=90;Aa++)In[Aa]=String.fromCharCode(Aa);for(var Qi=1;Qi<=12;Qi++)In[Qi+111]=In[Qi+63235]="F"+Qi;var En={};En.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"},En.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"},En.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"},En.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"]},En.default=s?En.macDefault:En.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,T,F=0;F<t.length-1;F++){var W=t[F];if(/^(cmd|meta|m)$/i.test(W))T=!0;else if(/^a(lt)?$/i.test(W))n=!0;else if(/^(c|ctrl|control)$/i.test(W))r=!0;else if(/^s(hift)?$/i.test(W))i=!0;else throw new Error("Unrecognized modifier name: "+W)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),T&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function kl(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=le(n.split(" "),Pl),T=0;T<i.length;T++){var F=void 0,W=void 0;T==i.length-1?(W=i.join(" "),F=r):(W=i.slice(0,T+1).join(" "),F="...");var z=t[W];if(!z)t[W]=F;else if(z!=F)throw new Error("Inconsistent bindings for "+W)}delete e[n]}for(var X in t)e[X]=t[X];return e}function Ti(e,t,n,r){t=La(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 Ti(e,t.fallthrough,n,r);for(var T=0;T<t.fallthrough.length;T++){var F=Ti(e,t.fallthrough[T],n,r);if(F)return F}}}function Es(e){var t=typeof e=="string"?e:In[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function xs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(m?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(m?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function Ts(e,t){if(C&&e.keyCode==34&&e.char)return!1;var n=In[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),xs(n,e,t))}function La(e){return typeof e=="string"?En[e]:e}function _i(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var T=t(n[i]);r.length&&Et(T.from,J(r).to)<=0;){var F=r.pop();if(Et(F.from,T.from)<0){T.from=F.from;break}}r.push(T)}Ir(e,function(){for(var W=r.length-1;W>=0;W--)Ei(e.doc,"",r[W].from,r[W].to,"+delete");pi(e)})}function uo(e,t,n){var r=Ae(e.text,t+n,n);return r<0||r>e.text.length?null:r}function co(e,t,n){var r=uo(e,t.ch,n);return r==null?null:new Ke(t.line,r,n<0?"after":"before")}function fo(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var T=rt(n,t.doc.direction);if(T){var F=i<0?J(T):T[0],W=i<0==(F.level==1),z=W?"after":"before",X;if(F.level>0||t.doc.direction=="rtl"){var ae=Mt(t,n);X=i<0?n.text.length-1:0;var de=Dt(t,ae,X).top;X=ze(function(_e){return Dt(t,ae,_e).top==de},i<0==(F.level==1)?F.from:F.to-1,X),z=="before"&&(X=uo(n,X,1))}else X=i<0?F.to:F.from;return new Ke(r,X,z)}}return new Ke(r,i<0?n.text.length:0,i<0?"before":"after")}function Ml(e,t,n,r){var i=rt(t,e.doc.direction);if(!i)return co(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 T=Ve(i,n.ch,n.sticky),F=i[T];if(e.doc.direction=="ltr"&&F.level%2==0&&(r>0?F.to>n.ch:F.from<n.ch))return co(t,n,r);var W=function(et,ot){return uo(t,et instanceof Ke?et.ch:et,ot)},z,X=function(et){return e.options.lineWrapping?(z=z||Mt(e,t),wo(e,t,z,et)):{begin:0,end:t.text.length}},ae=X(n.sticky=="before"?W(n,-1):n.ch);if(e.doc.direction=="rtl"||F.level==1){var de=F.level==1==r<0,_e=W(n,de?1:-1);if(_e!=null&&(de?_e<=F.to&&_e<=ae.end:_e>=F.from&&_e>=ae.begin)){var be=de?"before":"after";return new Ke(n.line,_e,be)}}var Ie=function(et,ot,tt){for(var st=function(zt,ur){return ur?new Ke(n.line,W(zt,1),"before"):new Ke(n.line,zt,"after")};et>=0&&et<i.length;et+=ot){var yt=i[et],ht=ot>0==(yt.level!=1),At=ht?tt.begin:W(tt.end,-1);if(yt.from<=At&&At<yt.to)return st(At,ht);if(At=ht?yt.from:W(yt.to,-1),tt.begin<=At&&At<tt.end)return st(At,ht)}},Be=Ie(T+r,r,ae);if(Be)return Be;var Xe=r>0?ae.end:W(ae.begin,-1);return Xe!=null&&!(r>0&&Xe==t.text.length)&&(Be=Ie(r>0?0:i.length-1,r,X(Xe)),Be)?Be:null}var Zi={selectAll:os,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),me)},killLine:function(e){return _i(e,function(t){if(t.empty()){var n=ut(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Ke(t.head.line+1,0)}:{from:t.head,to:Ke(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return _i(e,function(t){return{from:Ke(t.from().line,0),to:bt(e.doc,Ke(t.to().line+1,0))}})},delLineLeft:function(e){return _i(e,function(t){return{from:Ke(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return _i(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 _i(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(Ke(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ke(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return _s(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return Ss(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")},Ee)},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")},Ee)},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/)?Ss(e,t.head):r},Ee)},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 T=n[i].from(),F=V(e.getLine(T.line),T.ch,r);t.push(fe(r-F%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Ir(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,T=ut(e.doc,i.line).text;if(T){if(i.ch==T.length&&(i=new Ke(i.line,i.ch-1)),i.ch>0)i=new Ke(i.line,i.ch+1),e.replaceRange(T.charAt(i.ch-1)+T.charAt(i.ch-2),Ke(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var F=ut(e.doc,i.line-1).text;F&&(i=new Ke(i.line,1),e.replaceRange(T.charAt(0)+e.doc.lineSeparator()+F.charAt(F.length-1),Ke(i.line-1,F.length-1),i,"+transpose"))}}n.push(new Ut(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return Ir(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);pi(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function _s(e,t){var n=ut(e.doc,t),r=ct(n);return r!=n&&(t=kt(r)),fo(!0,e,r,t,1)}function Il(e,t){var n=ut(e.doc,t),r=St(n);return r!=n&&(t=kt(r)),fo(!0,e,n,t,-1)}function Ss(e,t){var n=_s(e,t.line),r=ut(e.doc,n.line),i=rt(r,e.doc.direction);if(!i||i[0].level==0){var T=Math.max(n.ch,r.text.search(/\S/)),F=t.line==n.line&&t.ch<=T&&t.ch;return Ke(n.line,F?0:T,n.sticky)}return n}function Da(e,t,n){if(typeof t=="string"&&(t=Zi[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)!=xe}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=Ti(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Ti(t,e.options.extraKeys,n,e)||Ti(t,e.options.keyMap,n,e)}var Fl=new Q;function qi(e,t,n,r){var i=e.state.keySeq;if(i){if(Es(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())}),ws(e,i+" "+t,n,r))return!0}return ws(e,t,n,r)}function ws(e,t,n,r){var i=Ul(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&or(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&($(n),$a(e)),!!i}function Cs(e,t){var n=Ts(t,!0);return n?t.shiftKey&&!e.state.keySeq?qi(e,"Shift-"+n,t,function(r){return Da(e,r,!0)})||qi(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Da(e,r)}):qi(e,n,t,function(r){return Da(e,r)}):!1}function Nl(e,t,n){return qi(e,"'"+n+"'",t,function(r){return Da(e,r,!0)})}var ho=null;function As(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=S(),Fe(t,e))return;B&&k<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=Cs(t,e);C&&(ho=r?n:null,!r&&n==88&&!$t&&(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;U(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(h(t,"CodeMirror-crosshair"),Ye(document,"keyup",n),Ye(document,"mouseover",n))}Oe(document,"keyup",n),Oe(document,"mouseover",n)}function Ls(e){e.keyCode==16&&(this.doc.sel.shift=!1),Fe(this,e)}function Ds(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(ve(t.display,e)||Fe(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(C&&n==ho){ho=null,$(e);return}if(C&&(!e.which||e.which<10)&&Cs(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,mo=function(e,t,n){this.time=e,this.pos=t,this.button=n};mo.prototype.compare=function(e,t,n){return this.time+jl>e&&Et(t,this.pos)==0&&n==this.button};var ea,ta;function Wl(e,t){var n=+new Date;return ta&&ta.compare(n,e,t)?(ea=ta=null,"triple"):ea&&ea.compare(n,e,t)?(ta=new mo(n,e,t),ea=null,"double"):(ea=new mo(n,e,t),ta=null,"single")}function Os(e){var t=this,n=t.display;if(Fe(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,ve(n,e)){O||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(po(t,e))return;var r=Yn(t,e),i=Se(e),T=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,T,e))return;i==1?r?Gl(t,r,T,e):ge(e)==n.scroller&&$(e):i==2?(r&&_a(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(_?t.display.input.onContextMenu(e):Ro(t))}function Hl(e,t,n,r,i){var T="Click";return r=="double"?T="Double"+T:r=="triple"&&(T="Triple"+T),T=(t==1?"Left":t==2?"Middle":"Right")+T,qi(e,xs(T,i),i,function(F){if(typeof F=="string"&&(F=Zi[F]),!F)return!1;var W=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),W=F(e,n)!=xe}finally{e.state.suppressEdits=!1}return W})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var T=u?n.shiftKey&&n.metaKey:n.altKey;i.unit=T?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=s?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(s?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){B?setTimeout(N(Oo,e),0):e.curOp.focus=S();var i=Kl(e,n,r),T=e.doc.sel,F;e.options.dragDrop&&Me&&!e.isReadOnly()&&n=="single"&&(F=T.contains(t))>-1&&(Et((F=T.ranges[F]).from(),t)<0||t.xRel>0)&&(Et(F.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,T=!1,F=sr(e,function(X){O&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ye(i.wrapper.ownerDocument,"mouseup",F),Ye(i.wrapper.ownerDocument,"mousemove",W),Ye(i.scroller,"dragstart",z),Ye(i.scroller,"drop",F),T||($(X),r.addNew||_a(e.doc,n,null,null,r.extend),O&&!R||B&&k==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),W=function(X){T=T||Math.abs(t.clientX-X.clientX)+Math.abs(t.clientY-X.clientY)>=10},z=function(){return T=!0};O&&(i.scroller.draggable=!0),e.state.draggingText=F,F.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Oe(i.wrapper.ownerDocument,"mouseup",F),Oe(i.wrapper.ownerDocument,"mousemove",W),Oe(i.scroller,"dragstart",z),Oe(i.scroller,"drop",F),Ro(e),setTimeout(function(){return i.input.focus()},20)}function Rs(e,t,n){if(n=="char")return new Ut(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Ut(Ke(t.line,0),bt(e.doc,Ke(t.line+1,0)));var r=n(e,t);return new Ut(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,T=e.doc;$(t);var F,W,z=T.sel,X=z.ranges;if(r.addNew&&!r.extend?(W=T.sel.contains(n),W>-1?F=X[W]:F=new Ut(n,n)):(F=T.sel.primary(),W=T.sel.primIndex),r.unit=="rectangle")r.addNew||(F=new Ut(n,n)),n=Yn(e,t,!0,!0),W=-1;else{var ae=Rs(e,n,r.unit);r.extend?F=so(F,ae.anchor,ae.head,r.extend):F=ae}r.addNew?W==-1?(W=X.length,hr(T,tn(e,X.concat([F]),W),{scroll:!1,origin:"*mouse"})):X.length>1&&X[W].empty()&&r.unit=="char"&&!r.extend?(hr(T,tn(e,X.slice(0,W).concat(X.slice(W+1)),0),{scroll:!1,origin:"*mouse"}),z=T.sel):lo(T,W,F,Le):(W=0,hr(T,new Kr([F],0),Le),z=T.sel);var de=n;function _e(tt){if(Et(de,tt)==0)return;if(de=tt,r.unit=="rectangle"){for(var st=[],yt=e.options.tabSize,ht=V(ut(T,n.line).text,n.ch,yt),At=V(ut(T,tt.line).text,tt.ch,yt),zt=Math.min(ht,At),ur=Math.max(ht,At),Qt=Math.min(n.line,tt.line),Ur=Math.min(e.lastLine(),Math.max(n.line,tt.line));Qt<=Ur;Qt++){var Lr=ut(T,Qt).text,tr=Te(Lr,zt,yt);zt==ur?st.push(new Ut(Ke(Qt,tr),Ke(Qt,tr))):Lr.length>tr&&st.push(new Ut(Ke(Qt,tr),Ke(Qt,Te(Lr,ur,yt))))}st.length||st.push(new Ut(n,n)),hr(T,tn(e,z.ranges.slice(0,W).concat(st),W),{origin:"*mouse",scroll:!1}),e.scrollIntoView(tt)}else{var Dr=F,fr=Rs(e,tt,r.unit),nr=Dr.anchor,rr;Et(fr.anchor,nr)>0?(rr=fr.head,nr=an(Dr.from(),fr.anchor)):(rr=fr.anchor,nr=_n(Dr.to(),fr.head));var Zt=z.ranges.slice(0);Zt[W]=Xl(e,new Ut(bt(T,nr),rr)),hr(T,tn(e,Zt,W),Le)}}var be=i.wrapper.getBoundingClientRect(),Ie=0;function Be(tt){var st=++Ie,yt=Yn(e,tt,!0,r.unit=="rectangle");if(!yt)return;if(Et(yt,de)!=0){e.curOp.focus=S(),_e(yt);var ht=va(i,T);(yt.line>=ht.to||yt.line<ht.from)&&setTimeout(sr(e,function(){Ie==st&&Be(tt)}),150)}else{var At=tt.clientY<be.top?-20:tt.clientY>be.bottom?20:0;At&&setTimeout(sr(e,function(){if(Ie!=st)return;i.scroller.scrollTop+=At,Be(tt)}),50)}}function Xe(tt){e.state.selectingText=!1,Ie=Infinity,tt&&($(tt),i.input.focus()),Ye(i.wrapper.ownerDocument,"mousemove",et),Ye(i.wrapper.ownerDocument,"mouseup",ot),T.history.lastSelOrigin=null}var et=sr(e,function(tt){tt.buttons===0||!Se(tt)?Xe(tt):Be(tt)}),ot=sr(e,Xe);e.state.selectingText=ot,Oe(i.wrapper.ownerDocument,"mousemove",et),Oe(i.wrapper.ownerDocument,"mouseup",ot)}function Xl(e,t){var n=t.anchor,r=t.head,i=ut(e.doc,n.line);if(Et(n,r)==0&&n.sticky==r.sticky)return t;var T=rt(i);if(!T)return t;var F=Ve(T,n.ch,n.sticky),W=T[F];if(W.from!=n.ch&&W.to!=n.ch)return t;var z=F+(W.from==n.ch==(W.level!=1)?0:1);if(z==0||z==T.length)return t;var X;if(r.line!=n.line)X=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ae=Ve(T,r.ch,r.sticky),de=ae-F||(r.ch-n.ch)*(W.level==1?-1:1);ae==z-1||ae==z?X=de<0:X=de>0}var _e=T[z+(X?-1:0)],be=X==(_e.level==1),Ie=be?_e.from:_e.to,Be=be?"after":"before";return n.ch==Ie&&n.sticky==Be?t:new Ut(new Ke(n.line,Ie,Be),r)}function Ps(e,t,n,r){var i,T;if(t.touches)i=t.touches[0].clientX,T=t.touches[0].clientY;else try{i=t.clientX,T=t.clientY}catch(_e){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&$(t);var F=e.display,W=F.lineDiv.getBoundingClientRect();if(T>W.bottom||!oe(e,n))return q(t);T-=W.top-F.viewOffset;for(var z=0;z<e.display.gutterSpecs.length;++z){var X=F.gutters.childNodes[z];if(X&&X.getBoundingClientRect().right>=i){var ae=Vr(e.doc,T),de=e.display.gutterSpecs[z];return Pe(e,n,e,ae,de.className,t),q(t)}}}function po(e,t){return Ps(e,t,"gutterClick",!0)}function ks(e,t){if(ve(e.display,t)||$l(e,t))return;if(Fe(e,t,"contextmenu"))return;_||e.display.input.onContextMenu(t)}function $l(e,t){return oe(e,"gutterContextMenu")?Ps(e,t,"gutterContextMenu",!1):!1}function Ms(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Wr(e)}var Si={toString:function(){return"CodeMirror.Init"}},Is={},Oa={};function Yl(e){var t=e.optionHandlers;function n(r,i,T,F){e.defaults[r]=i,T&&(t[r]=F?function(W,z,X){X!=Si&&T(W,z,X)}:T)}e.defineOption=n,e.Init=Si,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,io(r)},!0),n("indentUnit",2,io,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){Ki(r),Wr(r),Cr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var T=[],F=r.doc.first;r.doc.iter(function(z){for(var X=0;;){var ae=z.text.indexOf(i,X);if(ae==-1)break;X=ae+i.length,T.push(Ke(F,ae))}F++});for(var W=T.length-1;W>=0;W--)Ei(r.doc,i,T[W],Ke(T[W].line,T[W].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,T){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),T!=Si&&r.refresh()}),n("specialCharPlaceholder",Ma,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",!x),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){Ms(r),Hi(r)},!0),n("keyMap","default",function(r,i,T){var F=La(i),W=T!=Si&&La(T);W&&W.detach&&W.detach(r,F),F.attach&&F.attach(r,W||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ql,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=ro(i,r.options.lineNumbers),Hi(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Va(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return gi(r)},!0),n("scrollbarStyle","native",function(r){Fo(r),gi(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=ro(r.options.gutters,i),Hi(r)},!0),n("firstLineNumber",1,Hi,!0),n("lineNumberFormatter",function(r){return r},Hi,!0),n("showCursorWhenSelecting",!1,Ui,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(mi(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,Ui,!0),n("singleCursorHeightPerLine",!0,Ui,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Ki,!0),n("addModeClass",!1,Ki,!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,Ki,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Jl(e,t,n){var r=n&&n!=Si;if(!t!=!r){var i=e.display.dragFunctions,T=t?Oe:Ye;T(e.display.scroller,"dragstart",i.start),T(e.display.scroller,"dragenter",i.enter),T(e.display.scroller,"dragover",i.over),T(e.display.scroller,"dragleave",i.leave),T(e.display.scroller,"drop",i.drop)}}function Ql(e){e.options.lineWrapping?(U(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(h(e.display.wrapper,"CodeMirror-wrap"),jr(e)),Xa(e),Cr(e),Wr(e),setTimeout(function(){return gi(e)},100)}function Xt(e,t){var n=this;if(!(this instanceof Xt))return new Xt(e,t);this.options=t=t?I(t):{},I(Is,t,!1);var r=t.value;typeof r=="string"?r=new Ar(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Xt.inputStyles[t.inputStyle](this),T=this.display=new dl(e,r,i,t);T.wrapper.CodeMirror=this,Ms(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Fo(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 Q,keySeq:null,specialChars:null},t.autofocus&&!o&&T.input.focus(),B&&k<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Dl(),qn(this),this.curOp.forceUpdate=!0,Xo(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ya(n)},20):mi(this);for(var F in Oa)Oa.hasOwnProperty(F)&&Oa[F](this,t[F],Si);jo(this),t.finishInit&&t.finishInit(this);for(var W=0;W<go.length;++W)go[W](this);ei(this),O&&t.lineWrapping&&getComputedStyle(T.lineDiv).textRendering=="optimizelegibility"&&(T.lineDiv.style.textRendering="auto")}Xt.defaults=Is,Xt.optionHandlers=Oa;function Zl(e){var t=e.display;Oe(t.scroller,"mousedown",sr(e,Os)),B&&k<11?Oe(t.scroller,"dblclick",sr(e,function(z){if(Fe(e,z))return;var X=Yn(e,z);if(!X||po(e,z)||ve(e.display,z))return;$(z);var ae=e.findWordAt(X);_a(e.doc,ae.anchor,ae.head)})):Oe(t.scroller,"dblclick",function(z){return Fe(e,z)||$(z)}),Oe(t.scroller,"contextmenu",function(z){return ks(e,z)}),Oe(t.input.getField(),"contextmenu",function(z){t.scroller.contains(z.target)||ks(e,z)});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 T(z){if(z.touches.length!=1)return!1;var X=z.touches[0];return X.radiusX<=1&&X.radiusY<=1}function F(z,X){if(X.left==null)return!0;var ae=X.left-z.left,de=X.top-z.top;return ae*ae+de*de>20*20}Oe(t.scroller,"touchstart",function(z){if(!Fe(e,z)&&!T(z)&&!po(e,z)){t.input.ensurePolled(),clearTimeout(n);var X=+new Date;t.activeTouch={start:X,moved:!1,prev:X-r.end<=300?r:null},z.touches.length==1&&(t.activeTouch.left=z.touches[0].pageX,t.activeTouch.top=z.touches[0].pageY)}}),Oe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Oe(t.scroller,"touchend",function(z){var X=t.activeTouch;if(X&&!ve(t,z)&&X.left!=null&&!X.moved&&new Date-X.start<300){var ae=e.coordsChar(t.activeTouch,"page"),de;!X.prev||F(X,X.prev)?de=new Ut(ae,ae):!X.prev.prev||F(X,X.prev.prev)?de=e.findWordAt(ae):de=new Ut(Ke(ae.line,0),bt(e.doc,Ke(ae.line+1,0))),e.setSelection(de.anchor,de.head),e.focus(),$(z)}i()}),Oe(t.scroller,"touchcancel",i),Oe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Ni(e,t.scroller.scrollTop),Qn(e,t.scroller.scrollLeft,!0),Pe(e,"scroll",e))}),Oe(t.scroller,"mousewheel",function(z){return Ko(e,z)}),Oe(t.scroller,"DOMMouseScroll",function(z){return Ko(e,z)}),Oe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(z){Fe(e,z)||re(z)},over:function(z){Fe(e,z)||(Ll(e,z),re(z))},start:function(z){return Al(e,z)},drop:sr(e,Cl),leave:function(z){Fe(e,z)||vs(e)}};var W=t.input.getField();Oe(W,"keyup",function(z){return Ls.call(e,z)}),Oe(W,"keydown",sr(e,As)),Oe(W,"keypress",sr(e,Ds)),Oe(W,"focus",function(z){return Ya(e,z)}),Oe(W,"blur",function(z){return mi(e,z)})}var go=[];Xt.defineInitHook=function(e){return go.push(e)};function ra(e,t,n,r){var i=e.doc,T;n==null&&(n="add"),n=="smart"&&(i.mode.indent?T=Tr(e,t).state:n="prev");var F=e.options.tabSize,W=ut(i,t),z=V(W.text,null,F);W.stateAfter&&(W.stateAfter=null);var X=W.text.match(/^\s*/)[0],ae;if(!r&&!/\S/.test(W.text))ae=0,n="not";else if(n=="smart"&&(ae=i.mode.indent(T,W.text.slice(X.length),W.text),ae==xe||ae>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?ae=V(ut(i,t-1).text,null,F):ae=0:n=="add"?ae=z+e.options.indentUnit:n=="subtract"?ae=z-e.options.indentUnit:typeof n=="number"&&(ae=z+n),ae=Math.max(0,ae);var de="",_e=0;if(e.options.indentWithTabs)for(var be=Math.floor(ae/F);be;--be)_e+=F,de+=" ";if(_e<ae&&(de+=fe(ae-_e)),de!=X)return Ei(i,de,Ke(t,0),Ke(t,X.length),"+input"),W.stateAfter=null,!0;for(var Ie=0;Ie<i.sel.ranges.length;Ie++){var Be=i.sel.ranges[Ie];if(Be.head.line==t&&Be.head.ch<X.length){var Xe=Ke(t,X.length);lo(i,Ie,new Ut(Xe,Xe));break}}}var rn=null;function Ra(e){rn=e}function vo(e,t,n,r,i){var T=e.doc;e.display.shift=!1,r||(r=T.sel);var F=+new Date-200,W=i=="paste"||e.state.pasteIncoming>F,z=wt(t),X=null;if(W&&r.ranges.length>1)if(rn&&rn.text.join(`
|
|
`)==t){if(r.ranges.length%rn.text.length==0){X=[];for(var ae=0;ae<rn.text.length;ae++)X.push(T.splitLines(rn.text[ae]))}}else z.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(X=le(z,function(et){return[et]}));for(var de=e.curOp.updateInput,_e=r.ranges.length-1;_e>=0;_e--){var be=r.ranges[_e],Ie=be.from(),Be=be.to();be.empty()&&(n&&n>0?Ie=Ke(Ie.line,Ie.ch-n):e.state.overwrite&&!W?Be=Ke(Be.line,Math.min(ut(T,Be.line).text.length,Be.ch+J(z).length)):W&&rn&&rn.lineWise&&rn.text.join(`
|
|
`)==z.join(`
|
|
`)&&(Ie=Be=Ke(Ie.line,0)));var Xe={from:Ie,to:Be,text:X?X[_e%X.length]:z,origin:i||(W?"paste":e.state.cutIncoming>F?"cut":"+input")};bi(e.doc,Xe),or(e,"inputRead",e,Xe)}t&&!W&&Fs(e,t),pi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=de),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Us(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Ir(t,function(){return vo(t,n,0,null,"paste")}),!0}function Fs(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 T=e.getModeAt(i.head),F=!1;if(T.electricChars){for(var W=0;W<T.electricChars.length;W++)if(t.indexOf(T.electricChars.charAt(W))>-1){F=ra(e,i.head.line,"smart");break}}else T.electricInput&&(T.electricInput.test(ut(e.doc,i.head.line).text.slice(0,i.head.ch))&&(F=ra(e,i.head.line,"smart")));F&&or(e,"electricInput",e,i.head.line)}}function Ns(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,T={anchor:Ke(i,0),head:Ke(i+1,0)};n.push(T),t.push(e.getRange(T.anchor,T.head))}return{text:t,ranges:n}}function Bs(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function js(){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 O?e.style.width="1000px":e.setAttribute("wrap","off"),b&&(e.style.border="1px solid black"),Bs(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 T=this.options,F=T[r];if(T[r]==i&&r!="mode")return;T[r]=i,t.hasOwnProperty(r)&&sr(this,t[r])(this,i,F),Pe(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"](La(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,T=0;T<i.length;++T)if(i[T]==r||i[T].name==r)return i.splice(T,1),!0},addOverlay:yr(function(r,i){var T=r.token?r:e.getMode(this.options,r);if(T.startState)throw new Error("Overlays may not be stateful.");ee(this.state.overlays,{mode:T,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(F){return F.priority}),this.state.modeGen++,Cr(this)}),removeOverlay:yr(function(r){for(var i=this.state.overlays,T=0;T<i.length;++T){var F=i[T].modeSpec;if(F==r||typeof r=="string"&&F.name==r){i.splice(T,1),this.state.modeGen++,Cr(this);return}}}),indentLine:yr(function(r,i,T){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),kr(this.doc,r)&&ra(this,r,i,T)}),indentSelection:yr(function(r){for(var i=this.doc.sel.ranges,T=-1,F=0;F<i.length;F++){var W=i[F];if(W.empty())W.head.line>T&&(ra(this,W.head.line,r,!0),T=W.head.line,F==this.doc.sel.primIndex&&pi(this));else{var z=W.from(),X=W.to(),ae=Math.max(T,z.line);T=Math.min(this.lastLine(),X.line-(X.ch?0:1))+1;for(var de=ae;de<T;++de)ra(this,de,r);var _e=this.doc.sel.ranges;z.ch==0&&i.length==_e.length&&_e[F].from().ch>0&&lo(this.doc,F,new Ut(z,_e[F].to()),me)}}}),getTokenAt:function(r,i){return Br(this,r,i)},getLineTokens:function(r,i){return Br(this,Ke(r),i,!0)},getTokenTypeAt:function(r){r=bt(this.doc,r);var i=wn(this,ut(this.doc,r.line)),T=0,F=(i.length-1)/2,W=r.ch,z;if(W==0)z=i[2];else for(;;){var X=T+F>>1;if((X?i[X*2-1]:0)>=W)F=X;else if(i[X*2+1]<W)T=X+1;else{z=i[X*2+2];break}}var ae=z?z.indexOf("overlay "):-1;return ae<0?z:ae==0?null:z.slice(0,ae-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 T=[];if(!n.hasOwnProperty(i))return T;var F=n[i],W=this.getModeAt(r);if(typeof W[i]=="string")F[W[i]]&&T.push(F[W[i]]);else if(W[i])for(var z=0;z<W[i].length;z++){var X=F[W[i][z]];X&&T.push(X)}else W.helperType&&F[W.helperType]?T.push(F[W.helperType]):F[W.name]&&T.push(F[W.name]);for(var ae=0;ae<F._global.length;ae++){var de=F._global[ae];de.pred(W,this)&&ne(T,de.val)==-1&&T.push(de.val)}return T},getStateAfter:function(r,i){var T=this.doc;return r=mn(T,r==null?T.first+T.size-1:r),Tr(this,r+1,i).state},cursorCoords:function(r,i){var T,F=this.doc.sel.primary();return r==null?T=F.head:typeof r=="object"?T=bt(this.doc,r):T=r?F.from():F.to(),en(this,T,i||"page")},charCoords:function(r,i){return Wa(this,bt(this.doc,r),i||"page")},coordsChar:function(r,i){return r=To(this,r,i||"page"),Ka(this,r.left,r.top)},lineAtHeight:function(r,i){return r=To(this,{top:r,left:0},i||"page").top,Vr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,T){var F=!1,W;if(typeof r=="number"){var z=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>z&&(r=z,F=!0),W=ut(this.doc,r)}else W=r;return ha(this,W,{top:0,left:0},i||"page",T||F).top+(F?this.doc.height-Kt(W):0)},defaultTextHeight:function(){return fi(this.display)},defaultCharWidth:function(){return hi(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,T,F,W){var z=this.display;r=en(this,bt(this.doc,r));var X=r.bottom,ae=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),z.sizer.appendChild(i),F=="over")X=r.top;else if(F=="above"||F=="near"){var de=Math.max(z.wrapper.clientHeight,this.doc.height),_e=Math.max(z.sizer.clientWidth,z.lineSpace.clientWidth);(F=="above"||r.bottom+i.offsetHeight>de)&&r.top>i.offsetHeight?X=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=de&&(X=r.bottom),ae+i.offsetWidth>_e&&(ae=_e-i.offsetWidth)}i.style.top=X+"px",i.style.left=i.style.right="",W=="right"?(ae=z.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(W=="left"?ae=0:W=="middle"&&(ae=(z.sizer.clientWidth-i.offsetWidth)/2),i.style.left=ae+"px"),T&&Js(this,{left:ae,top:X,right:ae+i.offsetWidth,bottom:X+i.offsetHeight})},triggerOnKeyDown:yr(As),triggerOnKeyPress:yr(Ds),triggerOnKeyUp:Ls,triggerOnMouseDown:yr(Os),execCommand:function(r){if(Zi.hasOwnProperty(r))return Zi[r].call(null,this)},triggerElectric:yr(function(r){Fs(this,r)}),findPosH:function(r,i,T,F){var W=1;i<0&&(W=-1,i=-i);for(var z=bt(this.doc,r),X=0;X<i&&!(z=yo(this.doc,z,W,T,F),z.hitSide);++X);return z},moveH:yr(function(r,i){var T=this;this.extendSelectionsBy(function(F){return T.display.shift||T.doc.extend||F.empty()?yo(T.doc,F.head,r,i,T.options.rtlMoveVisually):r<0?F.from():F.to()},Ee)}),deleteH:yr(function(r,i){var T=this.doc.sel,F=this.doc;T.somethingSelected()?F.replaceSelection("",null,"+delete"):_i(this,function(W){var z=yo(F,W.head,r,i,!1);return r<0?{from:z,to:W.head}:{from:W.head,to:z}})}),findPosV:function(r,i,T,F){var W=1,z=F;i<0&&(W=-1,i=-i);for(var X=bt(this.doc,r),ae=0;ae<i;++ae){var de=en(this,X,"div");if(z==null?z=de.left:de.left=z,X=Ws(this,de,W,T),X.hitSide)break}return X},moveV:yr(function(r,i){var T=this,F=this.doc,W=[],z=!this.display.shift&&!F.extend&&F.sel.somethingSelected();if(F.extendSelectionsBy(function(ae){if(z)return r<0?ae.from():ae.to();var de=en(T,ae.head,"div");ae.goalColumn!=null&&(de.left=ae.goalColumn),W.push(de.left);var _e=Ws(T,de,r,i);return i=="page"&&ae==F.sel.primary()&&Qa(T,Wa(T,_e,"div").top-de.top),_e},Ee),W.length)for(var X=0;X<F.sel.ranges.length;X++)F.sel.ranges[X].goalColumn=W[X]}),findWordAt:function(r){var i=this.doc,T=ut(i,r.line).text,F=r.ch,W=r.ch;if(T){var z=this.getHelper(r,"wordChars");(r.sticky=="before"||W==T.length)&&F?--F:++W;for(var X=T.charAt(F),ae=De(X,z)?function(de){return De(de,z)}:/\s/.test(X)?function(de){return/\s/.test(de)}:function(de){return!/\s/.test(de)&&!De(de)};F>0&&ae(T.charAt(F-1));)--F;for(;W<T.length&&ae(T.charAt(W));)++W}return new Ut(Ke(r.line,F),Ke(r.line,W))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?U(this.display.cursorDiv,"CodeMirror-overwrite"):h(this.display.cursorDiv,"CodeMirror-overwrite"),Pe(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==S()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:yr(function(r,i){Fi(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-We(this)-this.display.barHeight,width:r.scrollWidth-We(this)-this.display.barWidth,clientHeight:pt(this),clientWidth:Ge(this)}},scrollIntoView:yr(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:Ke(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Qs(this,r):ko(this,r.from,r.to,r.margin)}),setSize:yr(function(r,i){var T=this,F=function(z){return typeof z=="number"||/^\d+$/.test(String(z))?z+"px":z};r!=null&&(this.display.wrapper.style.width=F(r)),i!=null&&(this.display.wrapper.style.height=F(i)),this.options.lineWrapping&&Xr(this);var W=this.display.viewFrom;this.doc.iter(W,this.display.viewTo,function(z){if(z.widgets){for(var X=0;X<z.widgets.length;X++)if(z.widgets[X].noHScroll){Dn(T,W,"widget");break}}++W}),this.curOp.forceUpdate=!0,Pe(this,"refresh",this)}),operation:function(r){return Ir(this,r)},startOperation:function(){return qn(this)},endOperation:function(){return ei(this)},refresh:yr(function(){var r=this.display.cachedTextHeight;Cr(this),this.curOp.forceUpdate=!0,Wr(this),Fi(this,this.doc.scrollLeft,this.doc.scrollTop),eo(this.display),(r==null||Math.abs(r-fi(this.display))>.5||this.options.lineWrapping)&&Xa(this),Pe(this,"refresh",this)}),swapDoc:yr(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Xo(this,r),Wr(this),this.display.input.reset(),Fi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,or(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}},ue(e),e.registerHelper=function(r,i,T){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=T},e.registerGlobalHelper=function(r,i,T,F){e.registerHelper(r,i,F),n[r]._global.push({pred:T,val:F})}}function yo(e,t,n,r,i){var T=t,F=n,W=ut(e,t.line),z=i&&e.direction=="rtl"?-n:n;function X(){var ot=t.line+z;return ot<e.first||ot>=e.first+e.size?!1:(t=new Ke(ot,t.ch,t.sticky),W=ut(e,ot))}function ae(ot){var tt;if(r=="codepoint"){var st=W.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(st)?tt=null:tt=new Ke(t.line,Math.max(0,Math.min(W.text.length,t.ch+n*(st>=55296&&st<56320?2:1))),-n)}else i?tt=Ml(e.cm,W,t,n):tt=co(W,t,n);if(tt==null)if(!ot&&X())t=fo(i,e.cm,W,t.line,z);else return!1;else t=tt;return!0}if(r=="char"||r=="codepoint")ae();else if(r=="column")ae(!0);else if(r=="word"||r=="group")for(var de=null,_e=r=="group",be=e.cm&&e.cm.getHelper(t,"wordChars"),Ie=!0;!(n<0&&!ae(!Ie));Ie=!1){var Be=W.text.charAt(t.ch)||`
|
|
`,Xe=De(Be,be)?"w":_e&&Be==`
|
|
`?"n":!_e||/\s/.test(Be)?null:"p";if(_e&&!Ie&&!Xe&&(Xe="s"),de&&de!=Xe){n<0&&(n=1,ae(),t.sticky="after");break}if(Xe&&(de=Xe),n>0&&!ae(!Ie))break}var et=wa(e,t,T,F,!0);return Qe(T,et)&&(et.hitSide=!0),et}function Ws(e,t,n,r){var i=e.doc,T=t.left,F;if(r=="page"){var W=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),z=Math.max(W-.5*fi(e.display),3);F=(n>0?t.bottom:t.top)+n*z}else r=="line"&&(F=n>0?t.bottom+3:t.top-3);for(var X;!(X=Ka(e,T,F),!X.outside);){if(n<0?F<=0:F>=i.height){X.hitSide=!0;break}F+=n*5}return X}var Wt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Q,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Wt.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;Bs(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function T(W){for(var z=W.target;z;z=z.parentNode){if(z==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(z.className))break}return!1}Oe(i,"paste",function(W){if(!T(W)||Fe(r,W)||Us(W,r))return;k<=11&&setTimeout(sr(r,function(){return t.updateFromDOM()}),20)}),Oe(i,"compositionstart",function(W){t.composing={data:W.data,done:!1}}),Oe(i,"compositionupdate",function(W){t.composing||(t.composing={data:W.data,done:!1})}),Oe(i,"compositionend",function(W){t.composing&&(W.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Oe(i,"touchstart",function(){return n.forceCompositionEnd()}),Oe(i,"input",function(){t.composing||t.readFromDOMSoon()});function F(W){if(!T(W)||Fe(r,W))return;if(r.somethingSelected())Ra({lineWise:!1,text:r.getSelections()}),W.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var z=Ns(r);Ra({lineWise:!0,text:z.text}),W.type=="cut"&&r.operation(function(){r.setSelections(z.ranges,0,me),r.replaceSelection("",null,"cut")})}else return;if(W.clipboardData){W.clipboardData.clearData();var X=rn.text.join(`
|
|
`);if(W.clipboardData.setData("Text",X),W.clipboardData.getData("Text")==X){W.preventDefault();return}}var ae=js(),de=ae.firstChild;r.display.lineSpace.insertBefore(ae,r.display.lineSpace.firstChild),de.value=rn.text.join(`
|
|
`);var _e=document.activeElement;G(de),setTimeout(function(){r.display.lineSpace.removeChild(ae),_e.focus(),_e==i&&n.showPrimarySelection()},50)}Oe(i,"copy",F),Oe(i,"cut",F)},Wt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Wt.prototype.prepareSelection=function(){var e=Lo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Wt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Wt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Wt.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 T=Pa(t,e.anchorNode,e.anchorOffset),F=Pa(t,e.focusNode,e.focusOffset);if(T&&!T.bad&&F&&!F.bad&&Et(an(T,F),r)==0&&Et(_n(T,F),i)==0)return;var W=t.display.view,z=r.line>=t.display.viewFrom&&Hs(t,r)||{node:W[0].measure.map[2],offset:0},X=i.line<t.display.viewTo&&Hs(t,i);if(!X){var ae=W[W.length-1].measure,de=ae.maps?ae.maps[ae.maps.length-1]:ae.map;X={node:de[de.length-1],offset:de[de.length-2]-de[de.length-3]}}if(!z||!X){e.removeAllRanges();return}var _e=e.rangeCount&&e.getRangeAt(0),be;try{be=p(z.node,z.offset,X.offset,X.node)}catch(Ie){}be&&(!D&&t.state.focused?(e.collapse(z.node,z.offset),be.collapsed||(e.removeAllRanges(),e.addRange(be))):(e.removeAllRanges(),e.addRange(be)),_e&&e.anchorNode==null?e.addRange(_e):D&&this.startGracePeriod()),this.rememberSelection()},Wt.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)},Wt.prototype.showMultipleSelections=function(e){l(this.cm.display.cursorDiv,e.cursors),l(this.cm.display.selectionDiv,e.selection)},Wt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Wt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return g(this.div,t)},Wt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Wt.prototype.blur=function(){this.div.blur()},Wt.prototype.getField=function(){return this.div},Wt.prototype.supportsTouch=function(){return!0},Wt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Ir(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)},Wt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Wt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&E&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=Pa(t,e.anchorNode,e.anchorOffset),r=Pa(t,e.focusNode,e.focusOffset);n&&r&&Ir(t,function(){hr(t.doc,Rn(n,r),me),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Wt.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=Ke(r.line-1,ut(e.doc,r.line-1).length)),i.ch==ut(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Ke(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var T,F,W;r.line==t.viewFrom||(T=Jn(e,r.line))==0?(F=kt(t.view[0].line),W=t.view[0].node):(F=kt(t.view[T].line),W=t.view[T-1].node.nextSibling);var z=Jn(e,i.line),X,ae;if(z==t.view.length-1?(X=t.viewTo-1,ae=t.lineDiv.lastChild):(X=kt(t.view[z+1].line)-1,ae=t.view[z+1].node.previousSibling),!W)return!1;for(var de=e.doc.splitLines(tu(e,W,ae,F,X)),_e=zr(e.doc,Ke(F,0),Ke(X,ut(e.doc,X).text.length));de.length>1&&_e.length>1;)if(J(de)==J(_e))de.pop(),_e.pop(),X--;else if(de[0]==_e[0])de.shift(),_e.shift(),F++;else break;for(var be=0,Ie=0,Be=de[0],Xe=_e[0],et=Math.min(Be.length,Xe.length);be<et&&Be.charCodeAt(be)==Xe.charCodeAt(be);)++be;for(var ot=J(de),tt=J(_e),st=Math.min(ot.length-(de.length==1?be:0),tt.length-(_e.length==1?be:0));Ie<st&&ot.charCodeAt(ot.length-Ie-1)==tt.charCodeAt(tt.length-Ie-1);)++Ie;if(de.length==1&&_e.length==1&&F==r.line)for(;be&&be>r.ch&&ot.charCodeAt(ot.length-Ie-1)==tt.charCodeAt(tt.length-Ie-1);)be--,Ie++;de[de.length-1]=ot.slice(0,ot.length-Ie).replace(/^\u200b+/,""),de[0]=de[0].slice(be).replace(/\u200b+$/,"");var yt=Ke(F,be),ht=Ke(X,_e.length?J(_e).length-Ie:0);if(de.length>1||de[0]||Et(yt,ht))return Ei(e.doc,de,yt,ht,"+input"),!0},Wt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Wt.prototype.reset=function(){this.forceCompositionEnd()},Wt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Wt.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)},Wt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Ir(this.cm,function(){return Cr(e.cm)})},Wt.prototype.setUneditable=function(e){e.contentEditable="false"},Wt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||sr(this.cm,vo)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Wt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Wt.prototype.onContextMenu=function(){},Wt.prototype.resetPosition=function(){},Wt.prototype.needsContentAttribute=!0;function Hs(e,t){var n=Jt(e,t.line);if(!n||n.hidden)return null;var r=ut(e.doc,t.line),i=xt(n,r,t.line),T=rt(r,e.doc.direction),F="left";if(T){var W=Ve(T,t.ch);F=W%2?"right":"left"}var z=qr(i.map,t.ch,F);return z.offset=z.collapse=="right"?z.end:z.start,z}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function wi(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var T="",F=!1,W=e.doc.lineSeparator(),z=!1;function X(be){return function(Ie){return Ie.id==be}}function ae(){F&&(T+=W,z&&(T+=W),F=z=!1)}function de(be){be&&(ae(),T+=be)}function _e(be){if(be.nodeType==1){var Ie=be.getAttribute("cm-text");if(Ie){de(Ie);return}var Be=be.getAttribute("cm-marker"),Xe;if(Be){var et=e.findMarks(Ke(r,0),Ke(i+1,0),X(+Be));et.length&&(Xe=et[0].find(0))&&de(zr(e.doc,Xe.from,Xe.to).join(W));return}if(be.getAttribute("contenteditable")=="false")return;var ot=/^(pre|div|p|li|table|br)$/i.test(be.nodeName);if(!/^br$/i.test(be.nodeName)&&be.textContent.length==0)return;ot&&ae();for(var tt=0;tt<be.childNodes.length;tt++)_e(be.childNodes[tt]);/^(pre|p)$/i.test(be.nodeName)&&(z=!0),ot&&(F=!0)}else be.nodeType==3&&de(be.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(_e(t),t==n);)t=t.nextSibling,z=!1;return T}function Pa(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return wi(e.clipPos(Ke(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 T=e.display.view[i];if(T.node==r)return ru(T,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!g(r,t))return wi(Ke(kt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var T=e.rest?J(e.rest):e.line;return wi(Ke(kt(T),T.text.length),i)}var F=t.nodeType==3?t:null,W=t;for(!F&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(F=t.firstChild,n&&(n=F.nodeValue.length));W.parentNode!=r;)W=W.parentNode;var z=e.measure,X=z.maps;function ae(Xe,et,ot){for(var tt=-1;tt<(X?X.length:0);tt++)for(var st=tt<0?z.map:X[tt],yt=0;yt<st.length;yt+=3){var ht=st[yt+2];if(ht==Xe||ht==et){var At=kt(tt<0?e.line:e.rest[tt]),zt=st[yt]+ot;return(ot<0||ht!=Xe)&&(zt=st[yt+(ot?1:0)]),Ke(At,zt)}}}var de=ae(F,W,n);if(de)return wi(de,i);for(var _e=W.nextSibling,be=F?F.nodeValue.length-n:0;_e;_e=_e.nextSibling){if(de=ae(_e,_e.firstChild,0),de)return wi(Ke(de.line,de.ch-be),i);be+=_e.textContent.length}for(var Ie=W.previousSibling,Be=n;Ie;Ie=Ie.previousSibling){if(de=ae(Ie,Ie.firstChild,-1),de)return wi(Ke(de.line,de.ch+Be),i);Be+=Ie.textContent.length}}var er=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Q,this.hasSelection=!1,this.composing=null};er.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),b&&(i.style.width="0px"),Oe(i,"input",function(){B&&k>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Oe(i,"paste",function(F){if(Fe(r,F)||Us(F,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function T(F){if(Fe(r,F))return;if(r.somethingSelected())Ra({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var W=Ns(r);Ra({lineWise:!0,text:W.text}),F.type=="cut"?r.setSelections(W.ranges,null,me):(n.prevInput="",i.value=W.text.join(`
|
|
`),G(i))}else return;F.type=="cut"&&(r.state.cutIncoming=+new Date)}Oe(i,"cut",T),Oe(i,"copy",T),Oe(e.scroller,"paste",function(F){if(ve(e,F)||Fe(r,F))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var W=new Event("paste");W.clipboardData=F.clipboardData,i.dispatchEvent(W)}),Oe(e.lineSpace,"selectstart",function(F){ve(e,F)||$(F)}),Oe(i,"compositionstart",function(){var F=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:F,range:r.markText(F,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Oe(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},er.prototype.createField=function(e){this.wrapper=js(),this.textarea=this.wrapper.firstChild},er.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},er.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=Lo(e);if(e.options.moveInputWithCursor){var i=en(e,n.sel.primary().head,"div"),T=t.wrapper.getBoundingClientRect(),F=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+F.top-T.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+F.left-T.left))}return r},er.prototype.showSelection=function(e){var t=this.cm,n=t.display;l(n.cursorDiv,e.cursors),l(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},er.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&&G(this.textarea),B&&k>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",B&&k>=9&&(this.hasSelection=null))},er.prototype.getField=function(){return this.textarea},er.prototype.supportsTouch=function(){return!1},er.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||S()!=this.textarea))try{this.textarea.focus()}catch(e){}},er.prototype.blur=function(){this.textarea.blur()},er.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},er.prototype.receivedFocus=function(){this.slowPoll()},er.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()})},er.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)},er.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||mt(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(B&&k>=9&&this.hasSelection===i||s&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var T=i.charCodeAt(0);if(T==8203&&!r&&(r="\u200B"),T==8666)return this.reset(),this.cm.execCommand("undo")}for(var F=0,W=Math.min(r.length,i.length);F<W&&r.charCodeAt(F)==i.charCodeAt(F);)++F;return Ir(t,function(){vo(t,i.slice(F),r.length-F,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},er.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},er.prototype.onKeyPress=function(){B&&k>=9&&(this.hasSelection=null),this.fastPoll()},er.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var T=Yn(n,e),F=r.scroller.scrollTop;if(!T||C)return;var W=n.options.resetSelectionOnContextMenu;W&&n.doc.sel.contains(T)==-1&&sr(n,hr)(n.doc,Rn(T),me);var z=i.style.cssText,X=t.wrapper.style.cssText,ae=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-ae.top-5)+"px; left: "+(e.clientX-ae.left-5)+`px;
|
|
z-index: 1000; background: `+(B?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var de;O&&(de=window.scrollY),r.input.focus(),O&&window.scrollTo(null,de),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=be,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function _e(){if(i.selectionStart!=null){var Be=n.somethingSelected(),Xe="\u200B"+(Be?i.value:"");i.value="\u21DA",i.value=Xe,t.prevInput=Be?"":"\u200B",i.selectionStart=1,i.selectionEnd=Xe.length,r.selForContextMenu=n.doc.sel}}function be(){if(t.contextMenuPending!=be)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=X,i.style.cssText=z,B&&k<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=F),i.selectionStart!=null){(!B||B&&k<9)&&_e();var Be=0,Xe=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?sr(n,os)(n):Be++<10?r.detectingSelectAll=setTimeout(Xe,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Xe,200)}}if(B&&k>=9&&_e(),_){re(e);var Ie=function(){Ye(window,"mouseup",Ie),setTimeout(be,20)};Oe(window,"mouseup",Ie)}else setTimeout(be,50)},er.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},er.prototype.setUneditable=function(){},er.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?I(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=S();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=W.getValue()}var i;if(e.form&&(Oe(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var T=e.form;i=T.submit;try{var F=T.submit=function(){r(),T.submit=i,T.submit(),T.submit=F}}catch(z){}}t.finishInit=function(z){z.save=r,z.getTextArea=function(){return e},z.toTextArea=function(){z.toTextArea=isNaN,r(),e.parentNode.removeChild(z.getWrapperElement()),e.style.display="",e.form&&(Ye(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var W=Xt(function(z){return e.parentNode.insertBefore(z,e.nextSibling)},t);return W}function iu(e){e.off=Ye,e.on=Oe,e.wheelEventPixels=cl,e.Doc=Ar,e.splitLines=wt,e.countColumn=V,e.findColumn=Te,e.isWordChar=we,e.Pass=xe,e.signal=Pe,e.Line=Gt,e.changeEnd=Pn,e.scrollbarModel=Uo,e.Pos=Ke,e.cmpPos=Et,e.modes=qt,e.mimeModes=Ct,e.resolveMode=Rr,e.getMode=Gr,e.modeExtensions=Er,e.extendMode=Li,e.copyState=Pr,e.startState=Fr,e.innerMode=nn,e.commands=Zi,e.keyMap=En,e.keyName=Ts,e.isModifierKey=Es,e.lookupKey=Ti,e.normalizeKeyMap=kl,e.StringStream=Vt,e.SharedTextMarker=Yi,e.TextMarker=Mn,e.LineWidget=$i,e.e_preventDefault=$,e.e_stopPropagation=Y,e.e_stop=re,e.addClass=U,e.contains=g,e.rmClass=h,e.keyNames=In}Yl(Xt),ql(Xt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ka in Ar.prototype)Ar.prototype.hasOwnProperty(ka)&&ne(au,ka)<0&&(Xt.prototype[ka]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ar.prototype[ka]));return ue(Ar),Xt.inputStyles={textarea:er,contenteditable:Wt},Xt.defineMode=function(e){!Xt.defaults.mode&&e!="null"&&(Xt.defaults.mode=e),He.apply(this,arguments)},Xt.defineMIME=ir,Xt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Xt.defineMIME("text/plain","null"),Xt.defineExtension=function(e,t){Xt.prototype[e]=t},Xt.defineDocExtension=function(e,t){Ar.prototype[e]=t},Xt.fromTextArea=nu,iu(Xt),Xt.version="5.58.2",Xt})},Y1PL:function(gt,nt,Z){"use strict";Z.r(nt),Z.d(nt,"ResizableTextArea",function(){return ne});var te=Z("wx14"),K=Z("1OyB"),D=Z("vuIU"),H=Z("Ji7U"),M=Z("LK+K"),P=Z("q1tI"),B=Z("VTBJ"),k=Z("rePB"),O=Z("Zm9Q"),L=Z("Kwbf"),E=Z("c+Xe"),C=Z("m+aA"),R=Z("bdgK"),A=new Map;function w(me){me.forEach(function(Le){var Ee,Te=Le.target;(Ee=A.get(Te))===null||Ee===void 0||Ee.forEach(function(ce){return ce(Te)})})}var b=new R.default(w),d=null,o=null;function s(me,Le){A.has(me)||(A.set(me,new Set),b.observe(me)),A.get(me).add(Le)}function u(me,Le){A.has(me)&&(A.get(me).delete(Le),A.get(me).size||(b.unobserve(me),A.delete(me)))}var x=function(me){Object(H.a)(Ee,me);var Le=Object(M.a)(Ee);function Ee(){return Object(K.a)(this,Ee),Le.apply(this,arguments)}return Object(D.a)(Ee,[{key:"render",value:function(){return this.props.children}}]),Ee}(P.Component),f=P.createContext(null);function m(me){var Le=me.children,Ee=me.onBatchResize,Te=P.useRef(0),ce=P.useRef([]),fe=P.useContext(f),J=P.useCallback(function(le,ee,pe){Te.current+=1;var ye=Te.current;ce.current.push({size:le,element:ee,data:pe}),Promise.resolve().then(function(){ye===Te.current&&(Ee==null||Ee(ce.current),ce.current=[])}),fe==null||fe(le,ee,pe)},[Ee,fe]);return P.createElement(f.Provider,{value:J},Le)}function _(me){var Le=me.children,Ee=me.disabled,Te=P.useRef(null),ce=P.useRef(null),fe=P.useContext(f),J=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),le=P.isValidElement(Le)&&Object(E.c)(Le),ee=le?Le.ref:null,pe=P.useMemo(function(){return Object(E.a)(ee,Te)},[ee,Te]),ye=P.useRef(me);ye.current=me;var he=P.useCallback(function(we){var De=ye.current,Re=De.onResize,ke=De.data,Ce=we.getBoundingClientRect(),Ae=Ce.width,ze=Ce.height,$e=we.offsetWidth,je=we.offsetHeight,Ve=Math.floor(Ae),it=Math.floor(ze);if(J.current.width!==Ve||J.current.height!==it||J.current.offsetWidth!==$e||J.current.offsetHeight!==je){var rt={width:Ve,height:it,offsetWidth:$e,offsetHeight:je};J.current=rt;var Je=$e===Math.round(Ae)?Ae:$e,Oe=je===Math.round(ze)?ze:je,Ze=Object(B.a)(Object(B.a)({},rt),{},{offsetWidth:Je,offsetHeight:Oe});fe==null||fe(Ze,we,ke),Re&&Promise.resolve().then(function(){Re(Ze,we)})}},[]);return P.useEffect(function(){var we=Object(C.a)(Te.current)||Object(C.a)(ce.current);return we&&!Ee&&s(we,he),function(){return u(we,he)}},[Te.current,Ee]),P.createElement(x,{ref:ce},le?P.cloneElement(Le,{ref:pe}):Le)}var y="rc-observer-key";function h(me){var Le=me.children,Ee=Object(O.a)(Le);return Ee.map(function(Te,ce){var fe=(Te==null?void 0:Te.key)||"".concat(y,"-").concat(ce);return P.createElement(_,Object(te.a)({},me,{key:fe}),Te)})}h.Collection=m;var c=h,l=Z("bT9E"),a=Z("TSYQ"),v=Z.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
|
|
`,g=["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"],S={},U;function j(me){var Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ee=me.getAttribute("id")||me.getAttribute("data-reactid")||me.getAttribute("name");if(Le&&S[Ee])return S[Ee];var Te=window.getComputedStyle(me),ce=Te.getPropertyValue("box-sizing")||Te.getPropertyValue("-moz-box-sizing")||Te.getPropertyValue("-webkit-box-sizing"),fe=parseFloat(Te.getPropertyValue("padding-bottom"))+parseFloat(Te.getPropertyValue("padding-top")),J=parseFloat(Te.getPropertyValue("border-bottom-width"))+parseFloat(Te.getPropertyValue("border-top-width")),le=g.map(function(pe){return"".concat(pe,":").concat(Te.getPropertyValue(pe))}).join(";"),ee={sizingStyle:le,paddingSize:fe,borderSize:J,boxSizing:ce};return Le&&Ee&&(S[Ee]=ee),ee}function G(me){var Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ee=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Te=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;U||(U=document.createElement("textarea"),U.setAttribute("tab-index","-1"),U.setAttribute("aria-hidden","true"),document.body.appendChild(U)),me.getAttribute("wrap")?U.setAttribute("wrap",me.getAttribute("wrap")):U.removeAttribute("wrap");var ce=j(me,Le),fe=ce.paddingSize,J=ce.borderSize,le=ce.boxSizing,ee=ce.sizingStyle;U.setAttribute("style","".concat(ee,";").concat(p)),U.value=me.value||me.placeholder||"";var pe=Number.MIN_SAFE_INTEGER,ye=Number.MAX_SAFE_INTEGER,he=U.scrollHeight,we;if(le==="border-box"?he+=J:le==="content-box"&&(he-=fe),Ee!==null||Te!==null){U.value=" ";var De=U.scrollHeight-fe;Ee!==null&&(pe=De*Ee,le==="border-box"&&(pe=pe+fe+J),he=Math.max(pe,he)),Te!==null&&(ye=De*Te,le==="border-box"&&(ye=ye+fe+J),we=he>ye?"":"hidden",he=Math.min(ye,he))}return{height:he,minHeight:pe,maxHeight:ye,overflowY:we,resize:"none"}}var N=Z("Gytx"),I=Z.n(N),V;(function(me){me[me.NONE=0]="NONE",me[me.RESIZING=1]="RESIZING",me[me.RESIZED=2]="RESIZED"})(V||(V={}));var Q=function(me){Object(H.a)(Ee,me);var Le=Object(M.a)(Ee);function Ee(Te){var ce;return Object(K.a)(this,Ee),ce=Le.call(this,Te),ce.nextFrameActionId=void 0,ce.resizeFrameId=void 0,ce.textArea=void 0,ce.saveTextArea=function(fe){ce.textArea=fe},ce.handleResize=function(fe){var J=ce.state.resizeStatus,le=ce.props,ee=le.autoSize,pe=le.onResize;if(J!==V.NONE)return;typeof pe=="function"&&pe(fe),ee&&ce.resizeOnNextFrame()},ce.resizeOnNextFrame=function(){cancelAnimationFrame(ce.nextFrameActionId),ce.nextFrameActionId=requestAnimationFrame(ce.resizeTextarea)},ce.resizeTextarea=function(){var fe=ce.props.autoSize;if(!fe||!ce.textArea)return;var J=fe.minRows,le=fe.maxRows,ee=G(ce.textArea,!1,J,le);ce.setState({textareaStyles:ee,resizeStatus:V.RESIZING},function(){cancelAnimationFrame(ce.resizeFrameId),ce.resizeFrameId=requestAnimationFrame(function(){ce.setState({resizeStatus:V.RESIZED},function(){ce.resizeFrameId=requestAnimationFrame(function(){ce.setState({resizeStatus:V.NONE}),ce.fixFirefoxAutoScroll()})})})})},ce.renderTextArea=function(){var fe=ce.props,J=fe.prefixCls,le=J===void 0?"rc-textarea":J,ee=fe.autoSize,pe=fe.onResize,ye=fe.className,he=fe.disabled,we=ce.state,De=we.textareaStyles,Re=we.resizeStatus,ke=Object(l.a)(ce.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ce=v()(le,ye,Object(k.a)({},"".concat(le,"-disabled"),he));"value"in ke&&(ke.value=ke.value||"");var Ae=Object(B.a)(Object(B.a)(Object(B.a)({},ce.props.style),De),Re===V.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(c,{onResize:ce.handleResize,disabled:!(ee||pe)},P.createElement("textarea",Object(te.a)({},ke,{className:Ce,style:Ae,ref:ce.saveTextArea})))},ce.state={textareaStyles:{},resizeStatus:V.NONE},ce}return Object(D.a)(Ee,[{key:"componentDidUpdate",value:function(ce){(ce.value!==this.props.value||!I()(ce.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 ce=this.textArea.selectionStart,fe=this.textArea.selectionEnd;this.textArea.setSelectionRange(ce,fe)}}catch(J){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Ee}(P.Component),ne=Q,se=function(me){Object(H.a)(Ee,me);var Le=Object(M.a)(Ee);function Ee(Te){var ce;Object(K.a)(this,Ee),ce=Le.call(this,Te),ce.resizableTextArea=void 0,ce.focus=function(){ce.resizableTextArea.textArea.focus()},ce.saveTextArea=function(J){ce.resizableTextArea=J},ce.handleChange=function(J){var le=ce.props.onChange;ce.setValue(J.target.value,function(){ce.resizableTextArea.resizeTextarea()}),le&&le(J)},ce.handleKeyDown=function(J){var le=ce.props,ee=le.onPressEnter,pe=le.onKeyDown;J.keyCode===13&&ee&&ee(J),pe&&pe(J)};var fe=typeof Te.value=="undefined"||Te.value===null?Te.defaultValue:Te.value;return ce.state={value:fe},ce}return Object(D.a)(Ee,[{key:"setValue",value:function(ce,fe){"value"in this.props||this.setState({value:ce},fe)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(ne,Object(te.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ce){return"value"in ce?{value:ce.value}:null}}]),Ee}(P.Component),xe=nt.default=se},ZW9T:function(gt,nt,Z){"use strict";Z.d(nt,"a",function(){return x});var te=Z("k1fw"),K=Z("miYZ"),D=Z("tsqr"),H=Z("rAM+"),M=Z("tJVT"),P=Z("PpiC"),B=Z("q1tI"),k=Z.n(B),O=Z("bdgK");function L(f,m,_,y,h){var c=m.getWordUntilPosition(_),l={startLineNumber:_.lineNumber,endLineNumber:_.lineNumber,startColumn:c.startColumn,endColumn:c.endColumn},a=y.map(function(v){return{label:v,kind:f.languages.CompletionItemKind.Keyword,insertText:v,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:l}});return h.map(function(v){a.push(Object(te.a)(Object(te.a)({},v),{},{range:l}))}),a}var E=function(f){var m={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},_=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];f.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(l,a){var v=L(f,l,a,_,[m]);return{suggestions:v}}});var y=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];f.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(l,a){var v=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],p=L(f,l,a,y,v);return{suggestions:p}}});var h=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];f.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(l,a){var v=[m,{label:"main",kind:f.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:f.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],p=L(f,l,a,h,v);return{suggestions:p}}})},C="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",R=Z("LvDl");function A(f){return/^\d+$/.test(f)?"".concat(f,"px"):f}function w(){}var b=!1,d={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function o(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],m=f;if(Array.isArray(f)){for(var _=0;_<f.length;_++){var y=d[f[_]];if(y)return y}return m[0]}return d[m]||m}var s=null,u=nt.b=function(f){var m=f.width,_=m===void 0?"100%":m,y=f.height,h=y===void 0?"100%":y,c=f.value,l=f.language,a=l===void 0?"javascript":l,v=f.style,p=v===void 0?{}:v,g=f.options,S=g===void 0?{}:g,U=f.overrideServices,j=U===void 0?{}:U,G=f.theme,N=G===void 0?"vs-dark":G,I=f.onEditBlur,V=f.onSave,Q=f.autoHeight,ne=Q===void 0?!1:Q,se=f.forbidCopy,xe=se===void 0?!1:se,me=f.onChange,Le=me===void 0?w:me,Ee=f.editorDidMount,Te=Ee===void 0?w:Ee,ce=f.onFocus,fe=ce===void 0?w:ce,J=f.filename,le=J===void 0?"educoder.txt":J,ee=Object(P.a)(f,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),pe=Object(B.useRef)(),ye=Object(B.useRef)({}),he=Object(B.useRef)(),we=Object(B.useRef)(!1),De=Object(B.useRef)(),Re=Object(B.useState)(!1),ke=Object(M.a)(Re,2),Ce=ke[0],Ae=ke[1];function ze(){var q;return pe.current&&(q=new O.default(function(re){var ge=Object(H.a)(re),Se;try{for(ge.s();!(Se=ge.n()).done;){var Me=Se.value;(Me.target.offsetHeight>0||Me.target.offsetWidth>0)&&ye.current.instance.layout()}}catch(at){ge.e(at)}finally{ge.f()}}),q.observe(pe.current)),q}function $e(){D.b.warn(decodeURIComponent(C))}var je=function(){var re=ye.current.instance;if(c!=null&&re&&Ce){var ge=re.getModel();ge&&c!==ge.getValue()&&(b=!0,ge.setValue(c),re.layout(),b=!1)}};Object(B.useEffect)(function(){he.current&&clearTimeout(he.current),he.current=setTimeout(function(){je()},500)},[c,Ce,ye.current]);function Ve(){var q=ye.current.instance;if(q){var re=q.getSelection(),ge=ye.current.pastePos||{},Se=new s.Range(ge.startLineNumber||re.endLineNumber,ge.startColumn||re.endColumn,ge.endLineNumber||re.endLineNumber,ge.endColumn||re.endColumn);setTimeout(function(){q.executeEdits("",[{range:Se,text:""}])},300)}}function it(q){(window.navigator.platform.match("Mac")?q.metaKey:q.ctrlKey)&&q.keyCode==83&&(q.preventDefault(),V())}var rt=function(){if(ne&&ye.current.instance){var re=ye.current.instance.getContentHeight();$(re<h?h:re)}else $(h)};function Je(q){var re=document.createEvent("MouseEvents");re.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),q.dispatchEvent(re)}function Oe(q,re){var ge=window.URL||window.webkitURL||window,Se=new Blob([re]),Me=document.createElementNS("http://www.w3.org/1999/xhtml","a");Me.href=ge.createObjectURL(Se),Me.download=q,Je(Me)}Object(B.useEffect)(function(){rt()},[rt]),Object(B.useEffect)(function(){pe.current&&!Ce&&Z.e(26).then(Z.t.bind(null,"M/lh",7)).then(function(q){try{s=q,ye.current.instance=s.editor.create(pe.current,{value:c,language:o(a),theme:N,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},j);var re=ye.current.instance;if(Te(re,s),setTimeout(function(){rt(),ye.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Oe(le||"educoder.txt",re.getValue())}})},500),ye.current.subscription=re.onDidChangeModelContent(function(Se){we.current?clearTimeout(De.current):(rt(),Le(re.getValue(),Se)),De.current=setTimeout(function(){we.current=!1},500)}),window.Monaco||E(s),xe&&(re.addCommand(s.KeyMod.CtrlCmd|s.KeyMod.Shift|s.KeyCode.KEY_V,function(){return $e(),null}),re.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_C,function(){return $e(),null})),window.Monaco=s,I&&re.onDidBlurEditorWidget(function(){I(re.getValue())}),fe&&re.onDidFocusEditorText(function(){fe(re.getValue())}),xe){re.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_V,function(){return $e(),null}),re.onDidPaste(function(Se){ye.current.pastePos=Se});try{window.addEventListener("paste",Ve)}catch(Se){}}var ge=ze();return Ae(!0),function(){var Se=ye.current.instance;Se.dispose();var Me=Se.getModel();Me&&Me.dispose(),ye.current.subscription&&ye.current.subscription.dispose(),xe&&window.removeEventListener("paste",Ve),ge.unobserve(pe.current)}}catch(Se){}})},[]),Object(B.useEffect)(function(){var q=ye.current.instance;if(q&&Ce)return document.addEventListener("keydown",it,!1),function(){document.removeEventListener("keydown",it)}},[V,Ce]),Object(B.useEffect)(function(){var q=ye.current.instance;if(q&&Ce){var re=o(a);s.editor.setModelLanguage(q.getModel(),re),console.log("language:",a,q.getModel(),re)}},[a,Ce]),Object(B.useEffect)(function(){var q=ye.current.instance;q&&Ce&&s.editor.setTheme(N)},[N,Ce]),Object(B.useEffect)(function(){var q=ye.current.instance;q&&Ce&&(q.updateOptions(Object(te.a)({},S)),setTimeout(function(){q.getModel().updateOptions(Object(te.a)({},S))},200))},[JSON.stringify(S),Ce]),Object(B.useEffect)(function(){var q=ye.current.instance;q&&Ce&&q.layout()},[_,h,Ce]);var Ze=Object(B.useState)(A(_)),Ye=Object(M.a)(Ze,2),Pe=Ye[0],Fe=Ye[1],ie=Object(B.useState)(A(h)),oe=Object(M.a)(ie,2),ue=oe[0],$=oe[1],Y=Object(te.a)(Object(te.a)({},p),{},{width:Pe,height:ue});return k.a.createElement("div",{className:"my-monaco-editor",ref:pe,style:Y})};function x(f){var m=f.width,_=m===void 0?"100%":m,y=f.height,h=y===void 0?"100%":y,c=f.original,l=f.modified,a=f.language,v=f.options,p=v===void 0?{}:v,g=Object(B.useRef)(),S=Object(B.useState)(null),U=Object(M.a)(S,2),j=U[0],G=U[1];function N(ne){var se;return g.current&&(se=new O.default(function(xe){var me=Object(H.a)(xe),Le;try{for(me.s();!(Le=me.n()).done;){var Ee=Le.value;(Ee.target.offsetHeight>0||Ee.target.offsetWidth>0)&&ne.layout()}}catch(Te){me.e(Te)}finally{me.f()}}),se.observe(g.current)),se}Object(B.useEffect)(function(){g.current&&Z.e(26).then(Z.t.bind(null,"M/lh",7)).then(function(ne){s=ne;var se=s.editor.createDiffEditor(g.current,Object(te.a)(Object(te.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},p),{},{wordWrap:!0}));G(se);var xe=N(se);return function(){se.dispose();var me=se.getModel();me&&me.dispose(),xe.unobserve(g.current)}})},[]),Object(B.useEffect)(function(){j&&j.setModel({original:s.editor.createModel(c,a),modified:s.editor.createModel(l,a)})},[c,l,a,j]);var I=A(_),V=A(h),Q={width:I,height:V};return k.a.createElement("div",{className:"my-diff-editor",ref:g,style:Q})}},ZpRC:function(gt,nt,Z){"use strict";function te(E){return typeof E=="object"&&E!=null&&E.nodeType===1}function K(E,C){return(!C||E!=="hidden")&&E!=="visible"&&E!=="clip"}function D(E,C){if(E.clientHeight<E.scrollHeight||E.clientWidth<E.scrollWidth){var R=getComputedStyle(E,null);return K(R.overflowY,C)||K(R.overflowX,C)||function(A){var w=function(b){if(!b.ownerDocument||!b.ownerDocument.defaultView)return null;try{return b.ownerDocument.defaultView.frameElement}catch(d){return null}}(A);return!!w&&(w.clientHeight<A.scrollHeight||w.clientWidth<A.scrollWidth)}(E)}return!1}function H(E,C,R,A,w,b,d,o){return b<E&&d>C||b>E&&d<C?0:b<=E&&o<=R||d>=C&&o>=R?b-E-A:d>C&&o<R||b<E&&o>R?d-C+w:0}var M=function(E,C){var R=window,A=C.scrollMode,w=C.block,b=C.inline,d=C.boundary,o=C.skipOverflowHiddenElements,s=typeof d=="function"?d:function(De){return De!==d};if(!te(E))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,x=[],f=E;te(f)&&s(f);){if((f=f.parentElement)===u){x.push(f);break}f!=null&&f===document.body&&D(f)&&!D(document.documentElement)||f!=null&&D(f,o)&&x.push(f)}for(var m=R.visualViewport?R.visualViewport.width:innerWidth,_=R.visualViewport?R.visualViewport.height:innerHeight,y=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,c=E.getBoundingClientRect(),l=c.height,a=c.width,v=c.top,p=c.right,g=c.bottom,S=c.left,U=w==="start"||w==="nearest"?v:w==="end"?g:v+l/2,j=b==="center"?S+a/2:b==="end"?p:S,G=[],N=0;N<x.length;N++){var I=x[N],V=I.getBoundingClientRect(),Q=V.height,ne=V.width,se=V.top,xe=V.right,me=V.bottom,Le=V.left;if(A==="if-needed"&&v>=0&&S>=0&&g<=_&&p<=m&&v>=se&&g<=me&&S>=Le&&p<=xe)return G;var Ee=getComputedStyle(I),Te=parseInt(Ee.borderLeftWidth,10),ce=parseInt(Ee.borderTopWidth,10),fe=parseInt(Ee.borderRightWidth,10),J=parseInt(Ee.borderBottomWidth,10),le=0,ee=0,pe="offsetWidth"in I?I.offsetWidth-I.clientWidth-Te-fe:0,ye="offsetHeight"in I?I.offsetHeight-I.clientHeight-ce-J:0;if(u===I)le=w==="start"?U:w==="end"?U-_:w==="nearest"?H(h,h+_,_,ce,J,h+U,h+U+l,l):U-_/2,ee=b==="start"?j:b==="center"?j-m/2:b==="end"?j-m:H(y,y+m,m,Te,fe,y+j,y+j+a,a),le=Math.max(0,le+h),ee=Math.max(0,ee+y);else{le=w==="start"?U-se-ce:w==="end"?U-me+J+ye:w==="nearest"?H(se,me,Q,ce,J+ye,U,U+l,l):U-(se+Q/2)+ye/2,ee=b==="start"?j-Le-Te:b==="center"?j-(Le+ne/2)+pe/2:b==="end"?j-xe+fe+pe:H(Le,xe,ne,Te,fe+pe,j,j+a,a);var he=I.scrollLeft,we=I.scrollTop;U+=we-(le=Math.max(0,Math.min(we+le,I.scrollHeight-Q+ye))),j+=he-(ee=Math.max(0,Math.min(he+ee,I.scrollWidth-ne+pe)))}G.push({el:I,top:le,left:ee})}return G};function P(E){return E===Object(E)&&Object.keys(E).length!==0}function B(E,C){C===void 0&&(C="auto");var R="scrollBehavior"in document.body.style;E.forEach(function(A){var w=A.el,b=A.top,d=A.left;w.scroll&&R?w.scroll({top:b,left:d,behavior:C}):(w.scrollTop=b,w.scrollLeft=d)})}function k(E){return E===!1?{block:"end",inline:"nearest"}:P(E)?E:{block:"start",inline:"nearest"}}function O(E,C){var R=!E.ownerDocument.documentElement.contains(E);if(P(C)&&typeof C.behavior=="function")return C.behavior(R?[]:M(E,C));if(R)return;var A=k(C);return B(M(E,A),A.behavior)}var L=nt.a=O},Zss7:function(gt,nt,Z){var te;(function(K){var D=/^\s+/,H=/\s+$/,M=0,P=K.round,B=K.min,k=K.max,O=K.random;function L(J,le){if(J=J||"",le=le||{},J instanceof L)return J;if(!(this instanceof L))return new L(J,le);var ee=E(J);this._originalInput=J,this._r=ee.r,this._g=ee.g,this._b=ee.b,this._a=ee.a,this._roundA=P(100*this._a)/100,this._format=le.format||ee.format,this._gradientType=le.gradientType,this._r<1&&(this._r=P(this._r)),this._g<1&&(this._g=P(this._g)),this._b<1&&(this._b=P(this._b)),this._ok=ee.ok,this._tc_id=M++}L.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var J=this.toRgb();return(J.r*299+J.g*587+J.b*114)/1e3},getLuminance:function(){var J=this.toRgb(),le,ee,pe,ye,he,we;return le=J.r/255,ee=J.g/255,pe=J.b/255,le<=.03928?ye=le/12.92:ye=K.pow((le+.055)/1.055,2.4),ee<=.03928?he=ee/12.92:he=K.pow((ee+.055)/1.055,2.4),pe<=.03928?we=pe/12.92:we=K.pow((pe+.055)/1.055,2.4),.2126*ye+.7152*he+.0722*we},setAlpha:function(J){return this._a=G(J),this._roundA=P(100*this._a)/100,this},toHsv:function(){var J=w(this._r,this._g,this._b);return{h:J.h*360,s:J.s,v:J.v,a:this._a}},toHsvString:function(){var J=w(this._r,this._g,this._b),le=P(J.h*360),ee=P(J.s*100),pe=P(J.v*100);return this._a==1?"hsv("+le+", "+ee+"%, "+pe+"%)":"hsva("+le+", "+ee+"%, "+pe+"%, "+this._roundA+")"},toHsl:function(){var J=R(this._r,this._g,this._b);return{h:J.h*360,s:J.s,l:J.l,a:this._a}},toHslString:function(){var J=R(this._r,this._g,this._b),le=P(J.h*360),ee=P(J.s*100),pe=P(J.l*100);return this._a==1?"hsl("+le+", "+ee+"%, "+pe+"%)":"hsla("+le+", "+ee+"%, "+pe+"%, "+this._roundA+")"},toHex:function(J){return d(this._r,this._g,this._b,J)},toHexString:function(J){return"#"+this.toHex(J)},toHex8:function(J){return o(this._r,this._g,this._b,this._a,J)},toHex8String:function(J){return"#"+this.toHex8(J)},toRgb:function(){return{r:P(this._r),g:P(this._g),b:P(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+P(this._r)+", "+P(this._g)+", "+P(this._b)+")":"rgba("+P(this._r)+", "+P(this._g)+", "+P(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:P(N(this._r,255)*100)+"%",g:P(N(this._g,255)*100)+"%",b:P(N(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+P(N(this._r,255)*100)+"%, "+P(N(this._g,255)*100)+"%, "+P(N(this._b,255)*100)+"%)":"rgba("+P(N(this._r,255)*100)+"%, "+P(N(this._g,255)*100)+"%, "+P(N(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:U[d(this._r,this._g,this._b,!0)]||!1},toFilter:function(J){var le="#"+s(this._r,this._g,this._b,this._a),ee=le,pe=this._gradientType?"GradientType = 1, ":"";if(J){var ye=L(J);ee="#"+s(ye._r,ye._g,ye._b,ye._a)}return"progid:DXImageTransform.Microsoft.gradient("+pe+"startColorstr="+le+",endColorstr="+ee+")"},toString:function(J){var le=!!J;J=J||this._format;var ee=!1,pe=this._a<1&&this._a>=0,ye=!le&&pe&&(J==="hex"||J==="hex6"||J==="hex3"||J==="hex4"||J==="hex8"||J==="name");return ye?J==="name"&&this._a===0?this.toName():this.toRgbString():(J==="rgb"&&(ee=this.toRgbString()),J==="prgb"&&(ee=this.toPercentageRgbString()),(J==="hex"||J==="hex6")&&(ee=this.toHexString()),J==="hex3"&&(ee=this.toHexString(!0)),J==="hex4"&&(ee=this.toHex8String(!0)),J==="hex8"&&(ee=this.toHex8String()),J==="name"&&(ee=this.toName()),J==="hsl"&&(ee=this.toHslString()),J==="hsv"&&(ee=this.toHsvString()),ee||this.toHexString())},clone:function(){return L(this.toString())},_applyModification:function(J,le){var ee=J.apply(null,[this].concat([].slice.call(le)));return this._r=ee._r,this._g=ee._g,this._b=ee._b,this.setAlpha(ee._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(_,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(u,arguments)},saturate:function(){return this._applyModification(x,arguments)},greyscale:function(){return this._applyModification(f,arguments)},spin:function(){return this._applyModification(h,arguments)},_applyCombination:function(J,le){return J.apply(null,[this].concat([].slice.call(le)))},analogous:function(){return this._applyCombination(p,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(g,arguments)},splitcomplement:function(){return this._applyCombination(v,arguments)},triad:function(){return this._applyCombination(l,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},L.fromRatio=function(J,le){if(typeof J=="object"){var ee={};for(var pe in J)J.hasOwnProperty(pe)&&(pe==="a"?ee[pe]=J[pe]:ee[pe]=xe(J[pe]));J=ee}return L(J,le)};function E(J){var le={r:0,g:0,b:0},ee=1,pe=null,ye=null,he=null,we=!1,De=!1;return typeof J=="string"&&(J=ce(J)),typeof J=="object"&&(Te(J.r)&&Te(J.g)&&Te(J.b)?(le=C(J.r,J.g,J.b),we=!0,De=String(J.r).substr(-1)==="%"?"prgb":"rgb"):Te(J.h)&&Te(J.s)&&Te(J.v)?(pe=xe(J.s),ye=xe(J.v),le=b(J.h,pe,ye),we=!0,De="hsv"):Te(J.h)&&Te(J.s)&&Te(J.l)&&(pe=xe(J.s),he=xe(J.l),le=A(J.h,pe,he),we=!0,De="hsl"),J.hasOwnProperty("a")&&(ee=J.a)),ee=G(ee),{ok:we,format:J.format||De,r:B(255,k(le.r,0)),g:B(255,k(le.g,0)),b:B(255,k(le.b,0)),a:ee}}function C(J,le,ee){return{r:N(J,255)*255,g:N(le,255)*255,b:N(ee,255)*255}}function R(J,le,ee){J=N(J,255),le=N(le,255),ee=N(ee,255);var pe=k(J,le,ee),ye=B(J,le,ee),he,we,De=(pe+ye)/2;if(pe==ye)he=we=0;else{var Re=pe-ye;we=De>.5?Re/(2-pe-ye):Re/(pe+ye);switch(pe){case J:he=(le-ee)/Re+(le<ee?6:0);break;case le:he=(ee-J)/Re+2;break;case ee:he=(J-le)/Re+4;break}he/=6}return{h:he,s:we,l:De}}function A(J,le,ee){var pe,ye,he;J=N(J,360),le=N(le,100),ee=N(ee,100);function we(ke,Ce,Ae){return Ae<0&&(Ae+=1),Ae>1&&(Ae-=1),Ae<1/6?ke+(Ce-ke)*6*Ae:Ae<1/2?Ce:Ae<2/3?ke+(Ce-ke)*(2/3-Ae)*6:ke}if(le===0)pe=ye=he=ee;else{var De=ee<.5?ee*(1+le):ee+le-ee*le,Re=2*ee-De;pe=we(Re,De,J+1/3),ye=we(Re,De,J),he=we(Re,De,J-1/3)}return{r:pe*255,g:ye*255,b:he*255}}function w(J,le,ee){J=N(J,255),le=N(le,255),ee=N(ee,255);var pe=k(J,le,ee),ye=B(J,le,ee),he,we,De=pe,Re=pe-ye;if(we=pe===0?0:Re/pe,pe==ye)he=0;else{switch(pe){case J:he=(le-ee)/Re+(le<ee?6:0);break;case le:he=(ee-J)/Re+2;break;case ee:he=(J-le)/Re+4;break}he/=6}return{h:he,s:we,v:De}}function b(J,le,ee){J=N(J,360)*6,le=N(le,100),ee=N(ee,100);var pe=K.floor(J),ye=J-pe,he=ee*(1-le),we=ee*(1-ye*le),De=ee*(1-(1-ye)*le),Re=pe%6,ke=[ee,we,he,he,De,ee][Re],Ce=[De,ee,ee,we,he,he][Re],Ae=[he,he,De,ee,ee,we][Re];return{r:ke*255,g:Ce*255,b:Ae*255}}function d(J,le,ee,pe){var ye=[se(P(J).toString(16)),se(P(le).toString(16)),se(P(ee).toString(16))];return pe&&ye[0].charAt(0)==ye[0].charAt(1)&&ye[1].charAt(0)==ye[1].charAt(1)&&ye[2].charAt(0)==ye[2].charAt(1)?ye[0].charAt(0)+ye[1].charAt(0)+ye[2].charAt(0):ye.join("")}function o(J,le,ee,pe,ye){var he=[se(P(J).toString(16)),se(P(le).toString(16)),se(P(ee).toString(16)),se(me(pe))];return ye&&he[0].charAt(0)==he[0].charAt(1)&&he[1].charAt(0)==he[1].charAt(1)&&he[2].charAt(0)==he[2].charAt(1)&&he[3].charAt(0)==he[3].charAt(1)?he[0].charAt(0)+he[1].charAt(0)+he[2].charAt(0)+he[3].charAt(0):he.join("")}function s(J,le,ee,pe){var ye=[se(me(pe)),se(P(J).toString(16)),se(P(le).toString(16)),se(P(ee).toString(16))];return ye.join("")}L.equals=function(J,le){return!J||!le?!1:L(J).toRgbString()==L(le).toRgbString()},L.random=function(){return L.fromRatio({r:O(),g:O(),b:O()})};function u(J,le){le=le===0?0:le||10;var ee=L(J).toHsl();return ee.s-=le/100,ee.s=I(ee.s),L(ee)}function x(J,le){le=le===0?0:le||10;var ee=L(J).toHsl();return ee.s+=le/100,ee.s=I(ee.s),L(ee)}function f(J){return L(J).desaturate(100)}function m(J,le){le=le===0?0:le||10;var ee=L(J).toHsl();return ee.l+=le/100,ee.l=I(ee.l),L(ee)}function _(J,le){le=le===0?0:le||10;var ee=L(J).toRgb();return ee.r=k(0,B(255,ee.r-P(255*-(le/100)))),ee.g=k(0,B(255,ee.g-P(255*-(le/100)))),ee.b=k(0,B(255,ee.b-P(255*-(le/100)))),L(ee)}function y(J,le){le=le===0?0:le||10;var ee=L(J).toHsl();return ee.l-=le/100,ee.l=I(ee.l),L(ee)}function h(J,le){var ee=L(J).toHsl(),pe=(ee.h+le)%360;return ee.h=pe<0?360+pe:pe,L(ee)}function c(J){var le=L(J).toHsl();return le.h=(le.h+180)%360,L(le)}function l(J){var le=L(J).toHsl(),ee=le.h;return[L(J),L({h:(ee+120)%360,s:le.s,l:le.l}),L({h:(ee+240)%360,s:le.s,l:le.l})]}function a(J){var le=L(J).toHsl(),ee=le.h;return[L(J),L({h:(ee+90)%360,s:le.s,l:le.l}),L({h:(ee+180)%360,s:le.s,l:le.l}),L({h:(ee+270)%360,s:le.s,l:le.l})]}function v(J){var le=L(J).toHsl(),ee=le.h;return[L(J),L({h:(ee+72)%360,s:le.s,l:le.l}),L({h:(ee+216)%360,s:le.s,l:le.l})]}function p(J,le,ee){le=le||6,ee=ee||30;var pe=L(J).toHsl(),ye=360/ee,he=[L(J)];for(pe.h=(pe.h-(ye*le>>1)+720)%360;--le;)pe.h=(pe.h+ye)%360,he.push(L(pe));return he}function g(J,le){le=le||6;for(var ee=L(J).toHsv(),pe=ee.h,ye=ee.s,he=ee.v,we=[],De=1/le;le--;)we.push(L({h:pe,s:ye,v:he})),he=(he+De)%1;return we}L.mix=function(J,le,ee){ee=ee===0?0:ee||50;var pe=L(J).toRgb(),ye=L(le).toRgb(),he=ee/100,we={r:(ye.r-pe.r)*he+pe.r,g:(ye.g-pe.g)*he+pe.g,b:(ye.b-pe.b)*he+pe.b,a:(ye.a-pe.a)*he+pe.a};return L(we)},L.readability=function(J,le){var ee=L(J),pe=L(le);return(K.max(ee.getLuminance(),pe.getLuminance())+.05)/(K.min(ee.getLuminance(),pe.getLuminance())+.05)},L.isReadable=function(J,le,ee){var pe=L.readability(J,le),ye,he;he=!1,ye=fe(ee);switch(ye.level+ye.size){case"AAsmall":case"AAAlarge":he=pe>=4.5;break;case"AAlarge":he=pe>=3;break;case"AAAsmall":he=pe>=7;break}return he},L.mostReadable=function(J,le,ee){var pe=null,ye=0,he,we,De,Re;ee=ee||{},we=ee.includeFallbackColors,De=ee.level,Re=ee.size;for(var ke=0;ke<le.length;ke++)he=L.readability(J,le[ke]),he>ye&&(ye=he,pe=L(le[ke]));return L.isReadable(J,pe,{level:De,size:Re})||!we?pe:(ee.includeFallbackColors=!1,L.mostReadable(J,["#fff","#000"],ee))};var S=L.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},U=L.hexNames=j(S);function j(J){var le={};for(var ee in J)J.hasOwnProperty(ee)&&(le[J[ee]]=ee);return le}function G(J){return J=parseFloat(J),(isNaN(J)||J<0||J>1)&&(J=1),J}function N(J,le){Q(J)&&(J="100%");var ee=ne(J);return J=B(le,k(0,parseFloat(J))),ee&&(J=parseInt(J*le,10)/100),K.abs(J-le)<1e-6?1:J%le/parseFloat(le)}function I(J){return B(1,k(0,J))}function V(J){return parseInt(J,16)}function Q(J){return typeof J=="string"&&J.indexOf(".")!=-1&&parseFloat(J)===1}function ne(J){return typeof J=="string"&&J.indexOf("%")!=-1}function se(J){return J.length==1?"0"+J:""+J}function xe(J){return J<=1&&(J=J*100+"%"),J}function me(J){return K.round(parseFloat(J)*255).toString(16)}function Le(J){return V(J)/255}var Ee=function(){var J="[-\\+]?\\d+%?",le="[-\\+]?\\d*\\.\\d+%?",ee="(?:"+le+")|(?:"+J+")",pe="[\\s|\\(]+("+ee+")[,|\\s]+("+ee+")[,|\\s]+("+ee+")\\s*\\)?",ye="[\\s|\\(]+("+ee+")[,|\\s]+("+ee+")[,|\\s]+("+ee+")[,|\\s]+("+ee+")\\s*\\)?";return{CSS_UNIT:new RegExp(ee),rgb:new RegExp("rgb"+pe),rgba:new RegExp("rgba"+ye),hsl:new RegExp("hsl"+pe),hsla:new RegExp("hsla"+ye),hsv:new RegExp("hsv"+pe),hsva:new RegExp("hsva"+ye),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Te(J){return!!Ee.CSS_UNIT.exec(J)}function ce(J){J=J.replace(D,"").replace(H,"").toLowerCase();var le=!1;if(S[J])J=S[J],le=!0;else if(J=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ee;return(ee=Ee.rgb.exec(J))?{r:ee[1],g:ee[2],b:ee[3]}:(ee=Ee.rgba.exec(J))?{r:ee[1],g:ee[2],b:ee[3],a:ee[4]}:(ee=Ee.hsl.exec(J))?{h:ee[1],s:ee[2],l:ee[3]}:(ee=Ee.hsla.exec(J))?{h:ee[1],s:ee[2],l:ee[3],a:ee[4]}:(ee=Ee.hsv.exec(J))?{h:ee[1],s:ee[2],v:ee[3]}:(ee=Ee.hsva.exec(J))?{h:ee[1],s:ee[2],v:ee[3],a:ee[4]}:(ee=Ee.hex8.exec(J))?{r:V(ee[1]),g:V(ee[2]),b:V(ee[3]),a:Le(ee[4]),format:le?"name":"hex8"}:(ee=Ee.hex6.exec(J))?{r:V(ee[1]),g:V(ee[2]),b:V(ee[3]),format:le?"name":"hex"}:(ee=Ee.hex4.exec(J))?{r:V(ee[1]+""+ee[1]),g:V(ee[2]+""+ee[2]),b:V(ee[3]+""+ee[3]),a:Le(ee[4]+""+ee[4]),format:le?"name":"hex8"}:(ee=Ee.hex3.exec(J))?{r:V(ee[1]+""+ee[1]),g:V(ee[2]+""+ee[2]),b:V(ee[3]+""+ee[3]),format:le?"name":"hex"}:!1}function fe(J){var le,ee;return J=J||{level:"AA",size:"small"},le=(J.level||"AA").toUpperCase(),ee=(J.size||"small").toLowerCase(),le!=="AA"&&le!=="AAA"&&(le="AA"),ee!=="small"&&ee!=="large"&&(ee="small"),{level:le,size:ee}}gt.exports?gt.exports=L:!(te=function(){return L}.call(nt,Z,nt,gt),te!==void 0&&(gt.exports=te))})(Math)},bPs0:function(gt,nt,Z){"use strict";Z.d(nt,"b",function(){return u});var te=Z("k1fw"),K=Z("9og8"),D=Z("2qtc"),H=Z("kLXV"),M=Z("tJVT"),P=Z("PpiC"),B=Z("aHsQ"),k=Z("sGsY"),O=Z("WmNS"),L=Z.n(O),E=Z("q1tI"),C=Z.n(E),R=Z("bntm"),A=Z("V0Rq"),w=Z("wd/R"),b=Z.n(w),d=Z("Ty5D"),o=Z("9kvl"),s=k.a.Countdown,u=["fullscreenchange","msfullscreenchange","webkitfullscreenchange","mozfullscreenchange"],x=function(m){var _=m.globalSetting,y=m.loading,h=m.user,c=m.exercise,l=m.dispatch,a=Object(P.a)(m,["globalSetting","loading","user","exercise","dispatch"]),v=Object(E.useState)({}),p=Object(M.a)(v,2),g=p[0],S=p[1],U=H.a.useModal(),j=Object(M.a)(U,2),G=j[0],N=j[1],I=Object(E.useRef)(),V=Object(E.useRef)(null),Q=Object(E.useRef)(null),ne=Object(E.useState)(!0),se=Object(M.a)(ne,2),xe=se[0],me=se[1],Le=Object(d.h)().query,Ee=Object(d.i)();Object(E.useEffect)(function(){var De,Re,ke,Ce,Ae;if(clearTimeout(V.current),document.addEventListener(Object(R.c)(),we,!1),window.addEventListener("blur",ye,!1),(De=c.exerciseUserInfo)!==null&&De!==void 0&&De.screen_open&&Object(R.a)()&&(l({type:"globalSetting/headerFooterToggle",payload:!1}),me(!1)),(Re=c.exerciseUserInfo)!==null&&Re!==void 0&&Re.screen_at&&b()().diff(b()((ke=c.exerciseUserInfo)===null||ke===void 0?void 0:ke.screen_at),"seconds")>0)Te();else if((Ce=c.exerciseUserInfo)!==null&&Ce!==void 0&&Ce.screen_open&&!Object(R.a)()){var ze=document.domain==="kepukehuan.educoder.net"?30:c.exerciseUserInfo.screen_sec+10+1;I.current=H.a.info({icon:null,content:C.a.createElement("div",{className:"tc font16"},"\u672C\u573A\u8003\u8BD5\u5DF2\u5F00\u542F\u9632\u5207\u5C4F\u9650\u5236\uFF0C",C.a.createElement("br",null),"\u5207\u6362\u9875\u9762 ",c.exerciseUserInfo.screen_num-c.exerciseUserInfo.used_screen_num," \u6B21\u540E\u5C06\u8FDB\u884C\u5F3A\u5236\u4EA4\u5377\uFF0C",C.a.createElement("br",null),"\u8BF7\u52FF\u5207\u5C4F\u53CA\u5237\u65B0\u9875\u9762"),okText:C.a.createElement("span",null,"\u5F00\u59CB\u8003\u8BD5\uFF08",C.a.createElement("span",{style:{display:"inline-block"}},C.a.createElement(s,{onFinish:function(){var je;Te(),(je=I.current)===null||je===void 0||je.destroy()},valueStyle:{fontSize:14,lineHeight:1.4,color:"#FFF",display:"inline-block"},format:"ss",value:Date.now()+ze*1e3})),"S\uFF09"),onOk:function(){var je;(je=I.current)===null||je===void 0||je.destroy(),me(!1),Object(R.d)(document.body),document.getElementById("root").addEventListener("click",ce,!1)}})}return(Ae=c.exerciseUserInfo)!==null&&Ae!==void 0&&Ae.screen_open&&!Object(R.a)()||document.getElementById("root").addEventListener("click",ce,!1),function(){document.getElementById("root").removeEventListener("click",ce,!1),document.removeEventListener(Object(R.c)(),we,!1),window.removeEventListener("blur",ye,!1),clearTimeout(V.current)}},[]),Object(E.useEffect)(function(){setTimeout(function(){c.actionTabs.removeEventListenerExitScreen&&(clearTimeout(V.current),document.getElementById("root").removeEventListener("click",ce,!1),document.removeEventListener(Object(R.c)(),we,!1))},500),fe()},[c.actionTabs]),Object(E.useEffect)(function(){setTimeout(function(){c.exerciseUserInfo.used_screen_num>c.exerciseUserInfo.screen_num?ee():!xe},500)},[c.exerciseUserInfo]);var Te=function(){var De=Object(K.a)(L.a.mark(function Re(){var ke;return L.a.wrap(function(Ae){for(;;)switch(Ae.prev=Ae.next){case 0:return Ae.next=2,he();case 2:ke=Ae.sent,setTimeout(function(){var ze,$e;(ze=I.current)===null||ze===void 0||ze.destroy(),I.current=H.a.info({okText:C.a.createElement("span",null,"\u56DE\u5230\u8003\u8BD5"),content:C.a.createElement("div",null,"\u60A8\u5DF2\u5207\u5C4F",C.a.createElement("span",{className:"c-red"},ke.used_screen_num),"\u6B21\uFF0C\u5207\u5C4F\u8D85\u8FC7",C.a.createElement("span",{className:"c-red"},($e=c.exerciseUserInfo)===null||$e===void 0?void 0:$e.screen_num),"\u6B21\u5C06\u5F3A\u5236\u4EA4\u5377"),onOk:function(){var je=Object(K.a)(L.a.mark(function it(){return L.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:Object(R.d)(document.body);case 1:case"end":return Je.stop()}},it)}));function Ve(){return je.apply(this,arguments)}return Ve}()})},1e3);case 4:case"end":return Ae.stop()}},Re)}));return function(){return De.apply(this,arguments)}}(),ce=function(Re){!Object(R.a)()&&Re.target.nodeName!=="A"&&Re.target.nodeName!=="BUTTON"&&Re.target.innerHTML!=="\u786E \u5B9A"&&(Object(R.d)(document.body),console.log("documentClick.full"))},fe=function(){var De=Object(K.a)(L.a.mark(function Re(){return L.a.wrap(function(Ce){for(;;)switch(Ce.prev=Ce.next){case 0:return Ce.abrupt("return",new Promise(function(){var Ae=Object(K.a)(L.a.mark(function ze($e){var je;return L.a.wrap(function(it){for(;;)switch(it.prev=it.next){case 0:return it.next=2,l({type:"exercise/getExerciseUserInfo",payload:Object(te.a)({},Ee)});case 2:return je=it.sent,$e(je==null?void 0:je.data),it.abrupt("return",je==null?void 0:je.data);case 5:case"end":return it.stop()}},ze)}));return function(ze){return Ae.apply(this,arguments)}}()));case 1:case"end":return Ce.stop()}},Re)}));return function(){return De.apply(this,arguments)}}(),J=function(){var De=Object(K.a)(L.a.mark(function Re(ke){var Ce,Ae,ze;return L.a.wrap(function(je){for(;;)switch(je.prev=je.next){case 0:(Ce=I.current)===null||Ce===void 0||((Ae=Ce.destroyAll)===null||Ae===void 0)||Ae.call(Ce),I.current=H.a.info({maskClosable:!1,keyboard:!1,okText:C.a.createElement("span",null,"\u56DE\u5230\u8003\u8BD5\uFF08",C.a.createElement("span",{style:{display:"inline-block"}},C.a.createElement(s,{onFinish:he,valueStyle:{fontSize:14,lineHeight:1.4,color:"#FFF",display:"inline-block"},format:"ss",value:Date.now()+(c.exerciseUserInfo.screen_sec+1)*1e3})),"S\uFF09"),content:C.a.createElement("div",null,"\u60A8\u5DF2\u5207\u5C4F",C.a.createElement("span",{className:"c-red"},ke),"\u6B21\uFF0C\u5207\u5C4F\u8D85\u8FC7",C.a.createElement("span",{className:"c-red"},(ze=c.exerciseUserInfo)===null||ze===void 0?void 0:ze.screen_num),"\u6B21\u5C06\u5F3A\u5236\u4EA4\u5377,",C.a.createElement("span",{className:"c-red"},c.exerciseUserInfo.screen_sec),"\u79D2\u5185\u56DE\u5230",C.a.createElement("br",null),C.a.createElement("span",{style:{marginLeft:38}},"\u8003\u8BD5\u4E0D\u8BA1\u5207\u5C4F\u6B21\u6570\u3002")),onOk:function(){var Ve=Object(K.a)(L.a.mark(function rt(){return L.a.wrap(function(Oe){for(;;)switch(Oe.prev=Oe.next){case 0:clearTimeout(Q.current),Object(R.d)(document.body),I.current.destroy();case 3:case"end":return Oe.stop()}},rt)}));function it(){return Ve.apply(this,arguments)}return it}()}),Q.current=setTimeout(function(){var Ve;I.current.update({okText:C.a.createElement("span",null,"\u56DE\u5230\u8003\u8BD5"),content:C.a.createElement("div",null,"\u60A8\u5DF2\u5207\u5C4F",C.a.createElement("span",{className:"c-red"},ke+1),"\u6B21\uFF0C\u5207\u5C4F\u8D85\u8FC7",C.a.createElement("span",{className:"c-red"},(Ve=c.exerciseUserInfo)===null||Ve===void 0?void 0:Ve.screen_num),"\u6B21\u5C06\u5F3A\u5236\u4EA4\u5377")})},(c.exerciseUserInfo.screen_sec+1)*1e3);case 3:case"end":return je.stop()}},Re)}));return function(ke){return De.apply(this,arguments)}}(),le=function(){location.href="/classrooms/".concat(Ee.coursesId,"/exercise/").concat(Ee.categoryId,"/detail")},ee=function(){var De=Object(K.a)(L.a.mark(function Re(){var ke,Ce,Ae;return L.a.wrap(function($e){for(;;)switch($e.prev=$e.next){case 0:return(ke=I.current)===null||ke===void 0||((Ce=ke.destroyAll)===null||Ce===void 0)||Ce.call(ke),$e.next=3,Object(A.Z)({categoryId:Ee.categoryId,commit_method:1});case 3:Ae=$e.sent,Ae&&pe();case 5:case"end":return $e.stop()}},Re)}));return function(){return De.apply(this,arguments)}}(),pe=function(){var Re,ke;document.removeEventListener(Object(R.c)(),we,!1),Object(R.b)(),(Re=I.current)===null||Re===void 0||((ke=Re.destroyAll)===null||ke===void 0)||ke.call(Re),G.info({content:C.a.createElement("div",{className:"tc font16"},"\u7B54\u9898\u7ED3\u675F\u4E86\uFF0C\u7CFB\u7EDF\u5DF2\u81EA\u52A8\u63D0\u4EA4\u8BD5\u5377",C.a.createElement("br",null),"\u4E0D\u80FD\u518D\u4FEE\u6539\u7B54\u9898"),onOk:function(){le()}})},ye=function(Re){Object(R.a)()&&document.getElementById("iframeShixuns").style.display=="none"&&Object(R.b)()},he=function(){var De=Object(K.a)(L.a.mark(function Re(){return L.a.wrap(function(Ce){for(;;)switch(Ce.prev=Ce.next){case 0:return Ce.abrupt("return",new Promise(function(){var Ae=Object(K.a)(L.a.mark(function ze($e){var je,Ve,it;return L.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:if(!((je=c.exerciseUserInfo)!==null&&je!==void 0&&je.screen_at)){Je.next=3;break}return Je.next=3,Object(A.g)(Object(te.a)(Object(te.a)({},Ee),{},{reset:!0}));case 3:return Je.next=5,Object(A.Q)({id:Ee.categoryId});case 5:if(Ve=Je.sent,!(Ve!=null&&Ve.is_commit)){Je.next=9;break}return pe(),Je.abrupt("return");case 9:return Je.next=11,fe();case 11:it=Je.sent,$e(it);case 13:case"end":return Je.stop()}},ze)}));return function(ze){return Ae.apply(this,arguments)}}()));case 1:case"end":return Ce.stop()}},Re)}));return function(){return De.apply(this,arguments)}}(),we=function(){var De=Object(K.a)(L.a.mark(function Re(){var ke,Ce,Ae,ze;return L.a.wrap(function(je){for(;;)switch(je.prev=je.next){case 0:if(ke=!1,console.log("fullscreen change"),!Object(R.a)()){je.next=7;break}(Ce=c.exerciseUserInfo)!==null&&Ce!==void 0&&Ce.screen_at&&Object(A.g)(Object(te.a)(Object(te.a)({},Ee),{},{reset:!0})),clearTimeout(V.current),je.next=17;break;case 7:return ke=!0,je.next=10,Object(A.g)(Object(te.a)({},Ee));case 10:return je.next=12,fe();case 12:Ae=je.sent,J(Ae.used_screen_num),ze=setTimeout(Object(K.a)(L.a.mark(function Ve(){return L.a.wrap(function(rt){for(;;)switch(rt.prev=rt.next){case 0:case"end":return rt.stop()}},Ve)})),c.exerciseUserInfo.screen_sec*1e3),window.frames.length!=parent.frames.length&&window.parent.postMessage("backExercise","*"),V.current=ze;case 17:l({type:"globalSetting/headerFooterToggle",payload:ke});case 18:case"end":return je.stop()}},Re)}));return function(){return De.apply(this,arguments)}}();return C.a.createElement("div",null,N)};nt.a=Object(o.b)(function(f){var m=f.loading,_=f.user,y=f.exercise,h=f.globalSetting;return{globalSetting:h,user:_,exercise:y,loading:m.effects}})(x)},bT9E:function(gt,nt,Z){"use strict";Z.d(nt,"a",function(){return K});var te=Z("VTBJ");function K(D,H){var M=Object(te.a)({},D);return Array.isArray(H)&&H.forEach(function(P){delete M[P]}),M}},c5Ni:function(gt,nt,Z){},dejd:function(gt,nt,Z){},dmUQ:function(gt,nt,Z){"use strict";var te=Z("Ff2n"),K=Z("rePB"),D=Z("1OyB"),H=Z("vuIU"),M=Z("Ji7U"),P=Z("md7G"),B=Z("foSv"),k=Z("q1tI"),O=Z.n(k),L=Z("TSYQ"),E=Z.n(L),C=Z("4IlW");function R(l,a){var v=Object.keys(l);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(l);a&&(p=p.filter(function(g){return Object.getOwnPropertyDescriptor(l,g).enumerable})),v.push.apply(v,p)}return v}function A(l){for(var a=1;a<arguments.length;a++){var v=arguments[a]!=null?arguments[a]:{};a%2?R(Object(v),!0).forEach(function(p){Object(K.a)(l,p,v[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(v)):R(Object(v)).forEach(function(p){Object.defineProperty(l,p,Object.getOwnPropertyDescriptor(v,p))})}return l}function w(l){var a=b();return function(){var p=Object(B.a)(l),g;if(a){var S=Object(B.a)(this).constructor;g=Reflect.construct(p,arguments,S)}else g=p.apply(this,arguments);return Object(P.a)(this,g)}}function b(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(l){return!1}}function d(){}function o(l){l.preventDefault()}var s=function(a){return a.replace(/[^\w.-]+/g,"")},u=200,x=600,f=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,m=function(a){return a!=null},_=function(a,v){return v===a||typeof v=="number"&&typeof a=="number"&&isNaN(v)&&isNaN(a)},y=function(l){Object(M.a)(v,l);var a=w(v);function v(p){var g;Object(D.a)(this,v),g=a.call(this,p),g.onKeyDown=function(j){var G=g.props,N=G.onKeyDown,I=G.onPressEnter;if(j.keyCode===C.a.UP){var V=g.getRatio(j);g.up(j,V,null),g.stop()}else if(j.keyCode===C.a.DOWN){var Q=g.getRatio(j);g.down(j,Q,null),g.stop()}else j.keyCode===C.a.ENTER&&I&&I(j);if(g.recordCursorPosition(),g.lastKeyCode=j.keyCode,N){for(var ne=arguments.length,se=new Array(ne>1?ne-1:0),xe=1;xe<ne;xe++)se[xe-1]=arguments[xe];N.apply(void 0,[j].concat(se))}},g.onKeyUp=function(j){var G=g.props.onKeyUp;if(g.stop(),g.recordCursorPosition(),G){for(var N=arguments.length,I=new Array(N>1?N-1:0),V=1;V<N;V++)I[V-1]=arguments[V];G.apply(void 0,[j].concat(I))}},g.onChange=function(j){var G=g.props.onChange;g.state.focused&&(g.inputting=!0),g.rawInput=g.props.parser(g.getValueFromEvent(j)),g.setState({inputValue:g.rawInput}),G(g.toNumber(g.rawInput))},g.onMouseUp=function(){var j=g.props.onMouseUp;g.recordCursorPosition(),j&&j.apply(void 0,arguments)},g.onFocus=function(){var j;g.setState({focused:!0}),(j=g.props).onFocus.apply(j,arguments)},g.onBlur=function(){var j=g.props.onBlur;g.inputting=!1,g.setState({focused:!1});var G=g.getCurrentValidValue(g.state.inputValue),N=g.setValue(G,d);if(j){var I=g.input.value,V=g.getInputDisplayValue({focus:!1,value:N});g.input.value=V&&Number(V),j.apply(void 0,arguments),g.input.value=I}},g.getRatio=function(j){var G=1;return j.metaKey||j.ctrlKey?G=.1:j.shiftKey&&(G=10),G},g.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},g.getPrecision=function(j){if(m(g.props.precision))return g.props.precision;var G=String(j);if(G.indexOf("e-")>=0)return parseInt(G.slice(G.indexOf("e-")+2),10);var N=0;return G.indexOf(".")>=0&&(N=G.length-G.indexOf(".")-1),N},g.getInputDisplayValue=function(j){var G=j||g.state,N=G.focused,I=G.inputValue,V=G.value,Q;N?Q=I:Q=g.toPrecisionAsStep(V),Q==null&&(Q="");var ne=g.formatWrapper(Q);return m(g.props.decimalSeparator)&&(ne=ne.toString().replace(".",g.props.decimalSeparator)),ne},g.recordCursorPosition=function(){try{g.cursorStart=g.input.selectionStart,g.cursorEnd=g.input.selectionEnd,g.currentValue=g.input.value,g.cursorBefore=g.input.value.substring(0,g.cursorStart),g.cursorAfter=g.input.value.substring(g.cursorEnd)}catch(j){}},g.restoreByAfter=function(j){if(j===void 0)return!1;var G=g.input.value,N=G.lastIndexOf(j);if(N===-1)return!1;var I=g.cursorBefore.length;return g.lastKeyCode===C.a.DELETE&&g.cursorBefore.charAt(I-1)===j[0]?(g.fixCaret(I,I),!0):N+j.length===G.length?(g.fixCaret(N,N),!0):!1},g.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(G,N){var I=j.substring(N);return g.restoreByAfter(I)})},g.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},g.stop=function(){g.autoStepTimer&&clearTimeout(g.autoStepTimer)},g.down=function(j,G,N){g.pressingUpOrDown=!0,g.step("down",j,G,N)},g.up=function(j,G,N){g.pressingUpOrDown=!0,g.step("up",j,G,N)},g.saveInput=function(j){g.input=j};var S=p.value;S===void 0&&(S=p.defaultValue),g.state={focused:p.autoFocus};var U=g.getValidValue(g.toNumber(S));return g.state=A(A({},g.state),{},{inputValue:g.toPrecisionAsStep(U),value:U}),g}return Object(H.a)(v,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(g){var S=this.props,U=S.value,j=S.onChange,G=S.max,N=S.min,I=this.state.focused;if(g){if(!_(g.value,U)||!_(g.max,G)||!_(g.min,N)){var V=I?U:this.getValidValue(U),Q;this.pressingUpOrDown?Q=V:this.inputting?Q=this.rawInput:Q=this.toPrecisionAsStep(V),this.setState({value:V,inputValue:Q})}var ne="value"in this.props?U:this.state.value;"max"in this.props&&g.max!==G&&typeof ne=="number"&&ne>G&&j&&j(G),"min"in this.props&&g.min!==N&&typeof ne=="number"&&ne<N&&j&&j(N)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var se=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===C.a.BACKSPACE?se=this.cursorStart-1:this.lastKeyCode===C.a.DELETE&&(se=this.cursorStart):se=this.input.value.length,this.fixCaret(se,se)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case C.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case C.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(xe){}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(g){var S=g;return S===""?S="":this.isNotCompleteNumber(parseFloat(S))?S=this.state.value:S=this.getValidValue(S),this.toNumber(S)}},{key:"getValueFromEvent",value:function(g){var S=g.target.value.trim().replace(/。/g,".");return m(this.props.decimalSeparator)&&(S=S.replace(this.props.decimalSeparator,".")),S}},{key:"getValidValue",value:function(g){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,j=parseFloat(g);return isNaN(j)?g:(j<S&&(j=S),j>U&&(j=U),j)}},{key:"setValue",value:function(g,S){var U=this.props.precision,j=this.isNotCompleteNumber(parseFloat(g))?null:parseFloat(g),G=this.state.value,N=G===void 0?null:G,I=this.state.inputValue,V=I===void 0?null:I,Q=typeof j=="number"?j.toFixed(U):"".concat(j),ne=j!==N||Q!=="".concat(V);return"value"in this.props?(V=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:V},S)):this.setState({value:j,inputValue:this.toPrecisionAsStep(g)},S),ne&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(g){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.props,j=U.precision,G=U.step;if(m(j))return j;var N=this.getPrecision(S),I=this.getPrecision(G),V=this.getPrecision(g);return g?Math.max(V,N+I):N+I}},{key:"getPrecisionFactor",value:function(g){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.getMaxPrecision(g,S);return Math.pow(10,U)}},{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(g){return this.props.formatter?this.props.formatter(g):g}},{key:"toPrecisionAsStep",value:function(g){if(this.isNotCompleteNumber(g)||g==="")return g;var S=Math.abs(this.getMaxPrecision(g));return isNaN(S)?g.toString():Number(g).toFixed(S)}},{key:"toNumber",value:function(g){var S=this.props.precision,U=this.state.focused,j=g&&g.length>16&&U;return this.isNotCompleteNumber(g)||j?g:m(S)?Math.round(g*Math.pow(10,S))/Math.pow(10,S):Number(g)}},{key:"upStep",value:function(g,S){var U=this.props.step,j=this.getPrecisionFactor(g,S),G=Math.abs(this.getMaxPrecision(g,S)),N=((j*g+j*U*S)/j).toFixed(G);return this.toNumber(N)}},{key:"downStep",value:function(g,S){var U=this.props.step,j=this.getPrecisionFactor(g,S),G=Math.abs(this.getMaxPrecision(g,S)),N=((j*g-j*U*S)/j).toFixed(G);return this.toNumber(N)}},{key:"step",value:function(g,S){var U=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,G=arguments.length>3?arguments[3]:void 0;this.stop(),S&&(S.persist(),S.preventDefault());var N=this.props;if(N.disabled)return;var I=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(I))return;var V=this["".concat(g,"Step")](I,j),Q=V>N.max||V<N.min;if(V>N.max?V=N.max:V<N.min&&(V=N.min),this.setValue(V,null),this.setState({focused:!0},function(){U.pressingUpOrDown=!1}),Q)return;this.autoStepTimer=setTimeout(function(){U[g](S,j,!0)},G?u:x)}},{key:"fixCaret",value:function(g,S){if(g===void 0||S===void 0||!this.input||!this.input.value)return;try{var U=this.input.selectionStart,j=this.input.selectionEnd;(g!==U||S!==j)&&this.input.setSelectionRange(g,S)}catch(G){}}},{key:"render",value:function(){var g,S=this.props,U=S.prefixCls,j=S.disabled,G=S.readOnly,N=S.useTouch,I=S.autoComplete,V=S.upHandler,Q=S.downHandler,ne=S.className,se=S.max,xe=S.min,me=S.style,Le=S.title,Ee=S.onMouseEnter,Te=S.onMouseLeave,ce=S.onMouseOver,fe=S.onMouseOut,J=S.required,le=S.onClick,ee=S.tabIndex,pe=S.type,ye=S.placeholder,he=S.id,we=S.inputMode,De=S.pattern,Re=S.step,ke=S.maxLength,Ce=S.autoFocus,Ae=S.name,ze=S.onPaste,$e=S.onInput,je=Object(te.a)(S,["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"]),Ve=this.state,it=Ve.value,rt=Ve.focused,Je=E()(U,(g={},Object(K.a)(g,ne,!!ne),Object(K.a)(g,"".concat(U,"-disabled"),j),Object(K.a)(g,"".concat(U,"-focused"),rt),g)),Oe={};Object.keys(je).forEach(function(re){(re.substr(0,5)==="data-"||re.substr(0,5)==="aria-"||re==="role")&&(Oe[re]=je[re])});var Ze=!G&&!j,Ye=this.getInputDisplayValue(null),Pe=(it||it===0)&&(isNaN(it)||Number(it)>=se),Fe=(it||it===0)&&(isNaN(it)||Number(it)<=xe),ie=Pe||j||G,oe=Fe||j||G,ue=E()("".concat(U,"-handler"),"".concat(U,"-handler-up"),Object(K.a)({},"".concat(U,"-handler-up-disabled"),ie)),$=E()("".concat(U,"-handler"),"".concat(U,"-handler-down"),Object(K.a)({},"".concat(U,"-handler-down-disabled"),oe)),Y=N?{onTouchStart:ie?d:this.up,onTouchEnd:this.stop}:{onMouseDown:ie?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},q=N?{onTouchStart:oe?d:this.down,onTouchEnd:this.stop}:{onMouseDown:oe?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return O.a.createElement("div",{className:Je,style:me,title:Le,onMouseEnter:Ee,onMouseLeave:Te,onMouseOver:ce,onMouseOut:fe,onFocus:function(){return null},onBlur:function(){return null}},O.a.createElement("div",{className:"".concat(U,"-handler-wrap")},O.a.createElement("span",Object.assign({unselectable:"on"},Y,{role:"button","aria-label":"Increase Value","aria-disabled":ie,className:ue}),V||O.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-up-inner"),onClick:o})),O.a.createElement("span",Object.assign({unselectable:"on"},q,{role:"button","aria-label":"Decrease Value","aria-disabled":oe,className:$}),Q||O.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-down-inner"),onClick:o}))),O.a.createElement("div",{className:"".concat(U,"-input-wrap")},O.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":xe,"aria-valuemax":se,"aria-valuenow":it,required:J,type:pe,placeholder:ye,onPaste:ze,onClick:le,onMouseUp:this.onMouseUp,className:"".concat(U,"-input"),tabIndex:ee,autoComplete:I,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Ze?this.onKeyDown:d,onKeyUp:Ze?this.onKeyUp:d,autoFocus:Ce,maxLength:ke,readOnly:G,disabled:j,max:se,min:xe,step:Re,name:Ae,title:Le,id:he,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ye),pattern:De,inputMode:we,onInput:$e},Oe))))}}]),v}(O.a.Component);y.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:f,min:-f,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:s,required:!1,autoComplete:"off"};var h=y,c=nt.a=h},h78n:function(gt,nt,Z){"use strict";Z.d(nt,"a",function(){return g});var te=Z("q1tI"),K=Z.n(te),D=Z("TSYQ"),H=Z.n(D),M={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},P=function(j){var G=j.map(function(){return Object(te.useRef)()}),N=Object(te.useRef)();return Object(te.useEffect)(function(){var I=Date.now(),V=!1;Object.keys(G).forEach(function(Q){var ne=G[Q].current;if(!ne)return;V=!0;var se=ne.style;se.transitionDuration=".3s, .3s, .3s, .06s",N.current&&I-N.current<100&&(se.transitionDuration="0s, 0s")}),V&&(N.current=Date.now())}),[G]};function B(){return B=Object.assign||function(U){for(var j=1;j<arguments.length;j++){var G=arguments[j];for(var N in G)Object.prototype.hasOwnProperty.call(G,N)&&(U[N]=G[N])}return U},B.apply(this,arguments)}function k(U,j){return R(U)||C(U,j)||L(U,j)||O()}function O(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function L(U,j){if(!U)return;if(typeof U=="string")return E(U,j);var G=Object.prototype.toString.call(U).slice(8,-1);if(G==="Object"&&U.constructor&&(G=U.constructor.name),G==="Map"||G==="Set")return Array.from(U);if(G==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(G))return E(U,j)}function E(U,j){(j==null||j>U.length)&&(j=U.length);for(var G=0,N=new Array(j);G<j;G++)N[G]=U[G];return N}function C(U,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var G=[],N=!0,I=!1,V=void 0;try{for(var Q=U[Symbol.iterator](),ne;!(N=(ne=Q.next()).done)&&!(G.push(ne.value),j&&G.length===j);N=!0);}catch(se){I=!0,V=se}finally{try{!N&&Q.return!=null&&Q.return()}finally{if(I)throw V}}return G}function R(U){if(Array.isArray(U))return U}function A(U,j){if(U==null)return{};var G=w(U,j),N,I;if(Object.getOwnPropertySymbols){var V=Object.getOwnPropertySymbols(U);for(I=0;I<V.length;I++){if(N=V[I],j.indexOf(N)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,N))continue;G[N]=U[N]}}return G}function w(U,j){if(U==null)return{};var G={},N=Object.keys(U),I,V;for(V=0;V<N.length;V++){if(I=N[V],j.indexOf(I)>=0)continue;G[I]=U[I]}return G}var b=function(j){var G=j.className,N=j.percent,I=j.prefixCls,V=j.strokeColor,Q=j.strokeLinecap,ne=j.strokeWidth,se=j.style,xe=j.trailColor,me=j.trailWidth,Le=j.transition,Ee=A(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Ee.gapPosition;var Te=Array.isArray(N)?N:[N],ce=Array.isArray(V)?V:[V],fe=P(Te),J=k(fe,1),le=J[0],ee=ne/2,pe=100-ne/2,ye="M ".concat(Q==="round"?ee:0,",").concat(ee,`
|
|
L `).concat(Q==="round"?pe:100,",").concat(ee),he="0 0 100 ".concat(ne),we=0;return K.a.createElement("svg",B({className:H()("".concat(I,"-line"),G),viewBox:he,preserveAspectRatio:"none",style:se},Ee),K.a.createElement("path",{className:"".concat(I,"-line-trail"),d:ye,strokeLinecap:Q,stroke:xe,strokeWidth:me||ne,fillOpacity:"0"}),Te.map(function(De,Re){var ke={strokeDasharray:"".concat(De,"px, 100px"),strokeDashoffset:"-".concat(we,"px"),transition:Le||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Ce=ce[Re]||ce[ce.length-1];return we+=De,K.a.createElement("path",{key:Re,className:"".concat(I,"-line-path"),d:ye,strokeLinecap:Q,stroke:Ce,strokeWidth:ne,fillOpacity:"0",ref:le[Re],style:ke})}))};b.defaultProps=M;var d=b;function o(){return o=Object.assign||function(U){for(var j=1;j<arguments.length;j++){var G=arguments[j];for(var N in G)Object.prototype.hasOwnProperty.call(G,N)&&(U[N]=G[N])}return U},o.apply(this,arguments)}function s(U,j){return _(U)||m(U,j)||x(U,j)||u()}function u(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function x(U,j){if(!U)return;if(typeof U=="string")return f(U,j);var G=Object.prototype.toString.call(U).slice(8,-1);if(G==="Object"&&U.constructor&&(G=U.constructor.name),G==="Map"||G==="Set")return Array.from(U);if(G==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(G))return f(U,j)}function f(U,j){(j==null||j>U.length)&&(j=U.length);for(var G=0,N=new Array(j);G<j;G++)N[G]=U[G];return N}function m(U,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var G=[],N=!0,I=!1,V=void 0;try{for(var Q=U[Symbol.iterator](),ne;!(N=(ne=Q.next()).done)&&!(G.push(ne.value),j&&G.length===j);N=!0);}catch(se){I=!0,V=se}finally{try{!N&&Q.return!=null&&Q.return()}finally{if(I)throw V}}return G}function _(U){if(Array.isArray(U))return U}function y(U,j){if(U==null)return{};var G=h(U,j),N,I;if(Object.getOwnPropertySymbols){var V=Object.getOwnPropertySymbols(U);for(I=0;I<V.length;I++){if(N=V[I],j.indexOf(N)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,N))continue;G[N]=U[N]}}return G}function h(U,j){if(U==null)return{};var G={},N=Object.keys(U),I,V;for(V=0;V<N.length;V++){if(I=N[V],j.indexOf(I)>=0)continue;G[I]=U[I]}return G}var c=0;function l(U){return+U.replace("%","")}function a(U){return Array.isArray(U)?U:[U]}function v(U,j,G,N){var I=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,V=arguments.length>5?arguments[5]:void 0,Q=50-N/2,ne=0,se=-Q,xe=0,me=-2*Q;switch(V){case"left":ne=-Q,se=0,xe=2*Q,me=0;break;case"right":ne=Q,se=0,xe=-2*Q,me=0;break;case"bottom":se=Q,me=2*Q;break;default:}var Le="M 50,50 m ".concat(ne,",").concat(se,`
|
|
a `).concat(Q,",").concat(Q," 0 1 1 ").concat(xe,",").concat(-me,`
|
|
a `).concat(Q,",").concat(Q," 0 1 1 ").concat(-xe,",").concat(me),Ee=Math.PI*2*Q,Te={stroke:G,strokeDasharray:"".concat(j/100*(Ee-I),"px ").concat(Ee,"px"),strokeDashoffset:"-".concat(I/2+U/100*(Ee-I),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Le,pathStyle:Te}}var p=function(j){var G=j.prefixCls,N=j.strokeWidth,I=j.trailWidth,V=j.gapDegree,Q=j.gapPosition,ne=j.trailColor,se=j.strokeLinecap,xe=j.style,me=j.className,Le=j.strokeColor,Ee=j.percent,Te=y(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ce=Object(te.useMemo)(function(){return c+=1,c},[]),fe=v(0,100,ne,N,V,Q),J=fe.pathString,le=fe.pathStyle,ee=a(Ee),pe=a(Le),ye=pe.find(function(ke){return Object.prototype.toString.call(ke)==="[object Object]"}),he=P(ee),we=s(he,1),De=we[0],Re=function(){var Ce=0;return ee.map(function(Ae,ze){var $e=pe[ze]||pe[pe.length-1],je=Object.prototype.toString.call($e)==="[object Object]"?"url(#".concat(G,"-gradient-").concat(ce,")"):"",Ve=v(Ce,Ae,$e,N,V,Q);return Ce+=Ae,K.a.createElement("path",{key:ze,className:"".concat(G,"-circle-path"),d:Ve.pathString,stroke:je,strokeLinecap:se,strokeWidth:N,opacity:Ae===0?0:1,fillOpacity:"0",style:Ve.pathStyle,ref:De[ze]})})};return K.a.createElement("svg",o({className:H()("".concat(G,"-circle"),me),viewBox:"0 0 100 100",style:xe},Te),ye&&K.a.createElement("defs",null,K.a.createElement("linearGradient",{id:"".concat(G,"-gradient-").concat(ce),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(ye).sort(function(ke,Ce){return l(ke)-l(Ce)}).map(function(ke,Ce){return K.a.createElement("stop",{key:Ce,offset:ke,stopColor:ye[ke]})}))),K.a.createElement("path",{className:"".concat(G,"-circle-trail"),d:J,stroke:ne,strokeLinecap:se,strokeWidth:I||N,fillOpacity:"0",style:le}),Re().reverse())};p.defaultProps=M;var g=p,S={Line:d,Circle:g}},kSUc:function(gt,nt,Z){},lZu9:function(gt,nt,Z){(function(te){te(Z("VrN/"),Z("1eCo"),Z("8EBN"))})(function(te){"use strict";te.defineMode("markdown",function(K,D){var H=te.getMode(K,"text/html"),M=H.name=="null";function P(N){if(te.findModeByName){var I=te.findModeByName(N);I&&(N=I.mime||I.mimes[0])}var V=te.getMode(K,N);return V.name=="null"?null:V}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 B={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var k in B)B.hasOwnProperty(k)&&D.tokenTypeOverrides[k]&&(B[k]=D.tokenTypeOverrides[k]);var O=/^([*\-_])(?:\s*\1){2,}\s*$/,L=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,E=/^\[(x| )\](?=\s)/i,C=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,R=/^ {0,3}(?:\={1,}|-{2,})\s*$/,A=/^[^#!\[\]*_\\<>` "'(~:]+/,w=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,b=/^\s*\[[^\]]+?\]:.*$/,d=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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(N,I,V){return I.f=I.inline=V,V(N,I)}function u(N,I,V){return I.f=I.block=V,V(N,I)}function x(N){return!N||!/\S/.test(N.string)}function f(N){if(N.linkTitle=!1,N.linkHref=!1,N.linkText=!1,N.em=!1,N.strong=!1,N.strikethrough=!1,N.quote=0,N.indentedCode=!1,N.f==_){var I=M;if(!I){var V=te.innerMode(H,N.htmlState);I=V.mode.name=="xml"&&V.state.tagStart===null&&!V.state.context&&V.state.tokenize.isInText}I&&(N.f=l,N.block=m,N.htmlState=null)}return N.trailingSpace=0,N.trailingSpaceNewLine=!1,N.prevLine=N.thisLine,N.thisLine={stream:null},null}function m(N,I){var V=N.column()===I.indentation,Q=x(I.prevLine.stream),ne=I.indentedCode,se=I.prevLine.hr,xe=I.list!==!1,me=(I.listStack[I.listStack.length-1]||0)+3;I.indentedCode=!1;var Le=I.indentation;if(I.indentationDiff===null&&(I.indentationDiff=I.indentation,xe)){for(I.list=null;Le<I.listStack[I.listStack.length-1];)I.listStack.pop(),I.listStack.length?I.indentation=I.listStack[I.listStack.length-1]:I.list=!1;I.list!==!1&&(I.indentationDiff=Le-I.listStack[I.listStack.length-1])}var Ee=!Q&&!se&&!I.prevLine.header&&(!xe||!ne)&&!I.prevLine.fencedCodeEnd,Te=(I.list===!1||se||Q)&&I.indentation<=me&&N.match(O),ce=null;if(I.indentationDiff>=4&&(ne||I.prevLine.fencedCodeEnd||I.prevLine.header||Q))return N.skipToEnd(),I.indentedCode=!0,B.code;if(N.eatSpace())return null;if(V&&I.indentation<=me&&(ce=N.match(C))&&ce[1].length<=6)return I.quote=0,I.header=ce[1].length,I.thisLine.header=!0,D.highlightFormatting&&(I.formatting="header"),I.f=I.inline,h(I);if(I.indentation<=me&&N.eat(">"))return I.quote=V?1:I.quote+1,D.highlightFormatting&&(I.formatting="quote"),N.eatSpace(),h(I);if(!Te&&!I.setext&&V&&I.indentation<=me&&(ce=N.match(L))){var fe=ce[1]?"ol":"ul";return I.indentation=Le+N.current().length,I.list=!0,I.quote=0,I.listStack.push(I.indentation),I.em=!1,I.strong=!1,I.code=!1,I.strikethrough=!1,D.taskLists&&N.match(E,!1)&&(I.taskList=!0),I.f=I.inline,D.highlightFormatting&&(I.formatting=["list","list-"+fe]),h(I)}else{if(V&&I.indentation<=me&&(ce=N.match(w,!0)))return I.quote=0,I.fencedEndRE=new RegExp(ce[1]+"+ *$"),I.localMode=D.fencedCodeBlockHighlighting&&P(ce[2]||D.fencedCodeBlockDefaultMode),I.localMode&&(I.localState=te.startState(I.localMode)),I.f=I.block=y,D.highlightFormatting&&(I.formatting="code-block"),I.code=-1,h(I);if(I.setext||(!Ee||!xe)&&!I.quote&&I.list===!1&&!I.code&&!Te&&!b.test(N.string)&&(ce=N.lookAhead(1))&&(ce=ce.match(R)))return I.setext?(I.header=I.setext,I.setext=0,N.skipToEnd(),D.highlightFormatting&&(I.formatting="header")):(I.header=ce[0].charAt(0)=="="?1:2,I.setext=I.header),I.thisLine.header=!0,I.f=I.inline,h(I);if(Te)return N.skipToEnd(),I.hr=!0,I.thisLine.hr=!0,B.hr;if(N.peek()==="[")return s(N,I,S)}return s(N,I,I.inline)}function _(N,I){var V=H.token(N,I.htmlState);if(!M){var Q=te.innerMode(H,I.htmlState);(Q.mode.name=="xml"&&Q.state.tagStart===null&&!Q.state.context&&Q.state.tokenize.isInText||I.md_inside&&N.current().indexOf(">")>-1)&&(I.f=l,I.block=m,I.htmlState=null)}return V}function y(N,I){var V=I.listStack[I.listStack.length-1]||0,Q=I.indentation<V,ne=V+3;if(I.fencedEndRE&&I.indentation<=ne&&(Q||N.match(I.fencedEndRE))){D.highlightFormatting&&(I.formatting="code-block");var se;return Q||(se=h(I)),I.localMode=I.localState=null,I.block=m,I.f=l,I.fencedEndRE=null,I.code=0,I.thisLine.fencedCodeEnd=!0,Q?u(N,I,I.block):se}else return I.localMode?I.localMode.token(N,I.localState):(N.skipToEnd(),B.code)}function h(N){var I=[];if(N.formatting){I.push(B.formatting),typeof N.formatting=="string"&&(N.formatting=[N.formatting]);for(var V=0;V<N.formatting.length;V++)I.push(B.formatting+"-"+N.formatting[V]),N.formatting[V]==="header"&&I.push(B.formatting+"-"+N.formatting[V]+"-"+N.header),N.formatting[V]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=N.quote?I.push(B.formatting+"-"+N.formatting[V]+"-"+N.quote):I.push("error"))}if(N.taskOpen)return I.push("meta"),I.length?I.join(" "):null;if(N.taskClosed)return I.push("property"),I.length?I.join(" "):null;if(N.linkHref?I.push(B.linkHref,"url"):(N.strong&&I.push(B.strong),N.em&&I.push(B.em),N.strikethrough&&I.push(B.strikethrough),N.emoji&&I.push(B.emoji),N.linkText&&I.push(B.linkText),N.code&&I.push(B.code),N.image&&I.push(B.image),N.imageAltText&&I.push(B.imageAltText,"link"),N.imageMarker&&I.push(B.imageMarker)),N.header&&I.push(B.header,B.header+"-"+N.header),N.quote&&(I.push(B.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=N.quote?I.push(B.quote+"-"+N.quote):I.push(B.quote+"-"+D.maxBlockquoteDepth)),N.list!==!1){var Q=(N.listStack.length-1)%3;Q?Q===1?I.push(B.list2):I.push(B.list3):I.push(B.list1)}return N.trailingSpaceNewLine?I.push("trailing-space-new-line"):N.trailingSpace&&I.push("trailing-space-"+(N.trailingSpace%2?"a":"b")),I.length?I.join(" "):null}function c(N,I){return N.match(A,!0)?h(I):void 0}function l(N,I){var V=I.text(N,I);if(typeof V!="undefined")return V;if(I.list)return I.list=null,h(I);if(I.taskList){var Q=N.match(E,!0)[1]===" ";return Q?I.taskOpen=!0:I.taskClosed=!0,D.highlightFormatting&&(I.formatting="task"),I.taskList=!1,h(I)}if(I.taskOpen=!1,I.taskClosed=!1,I.header&&N.match(/^#+$/,!0))return D.highlightFormatting&&(I.formatting="header"),h(I);var ne=N.next();if(I.linkTitle){I.linkTitle=!1;var se=ne;ne==="("&&(se=")"),se=(se+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var xe="^\\s*(?:[^"+se+"\\\\]+|\\\\\\\\|\\\\.)"+se;if(N.match(new RegExp(xe),!0))return B.linkHref}if(ne==="`"){var me=I.formatting;D.highlightFormatting&&(I.formatting="code"),N.eatWhile("`");var Le=N.current().length;if(I.code==0&&(!I.quote||Le==1))return I.code=Le,h(I);if(Le==I.code){var Ee=h(I);return I.code=0,Ee}else return I.formatting=me,h(I)}else if(I.code)return h(I);if(ne==="\\"&&(N.next(),D.highlightFormatting)){var Te=h(I),ce=B.formatting+"-escape";return Te?Te+" "+ce:ce}if(ne==="!"&&N.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return I.imageMarker=!0,I.image=!0,D.highlightFormatting&&(I.formatting="image"),h(I);if(ne==="["&&I.imageMarker&&N.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return I.imageMarker=!1,I.imageAltText=!0,D.highlightFormatting&&(I.formatting="image"),h(I);if(ne==="]"&&I.imageAltText){D.highlightFormatting&&(I.formatting="image");var Te=h(I);return I.imageAltText=!1,I.image=!1,I.inline=I.f=v,Te}if(ne==="["&&!I.image)return I.linkText&&N.match(/^.*?\]/)||(I.linkText=!0,D.highlightFormatting&&(I.formatting="link")),h(I);if(ne==="]"&&I.linkText){D.highlightFormatting&&(I.formatting="link");var Te=h(I);return I.linkText=!1,I.inline=I.f=N.match(/\(.*?\)| ?\[.*?\]/,!1)?v:l,Te}if(ne==="<"&&N.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=a,D.highlightFormatting&&(I.formatting="link");var Te=h(I);return Te?Te+=" ":Te="",Te+B.linkInline}if(ne==="<"&&N.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=a,D.highlightFormatting&&(I.formatting="link");var Te=h(I);return Te?Te+=" ":Te="",Te+B.linkEmail}if(D.xml&&ne==="<"&&N.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var fe=N.string.indexOf(">",N.pos);if(fe!=-1){var J=N.string.substring(N.start,fe);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(J)&&(I.md_inside=!0)}return N.backUp(1),I.htmlState=te.startState(H),u(N,I,_)}if(D.xml&&ne==="<"&&N.match(/^\/\w*?>/))return I.md_inside=!1,"tag";if(ne==="*"||ne==="_"){for(var le=1,ee=N.pos==1?" ":N.string.charAt(N.pos-2);le<3&&N.eat(ne);)le++;var pe=N.peek()||" ",ye=!/\s/.test(pe)&&(!d.test(pe)||/\s/.test(ee)||d.test(ee)),he=!/\s/.test(ee)&&(!d.test(ee)||/\s/.test(pe)||d.test(pe)),we=null,De=null;if(le%2&&(!I.em&&ye&&(ne==="*"||!he||d.test(ee))?we=!0:I.em==ne&&he&&(ne==="*"||!ye||d.test(pe))&&(we=!1)),le>1&&(!I.strong&&ye&&(ne==="*"||!he||d.test(ee))?De=!0:I.strong==ne&&he&&(ne==="*"||!ye||d.test(pe))&&(De=!1)),De!=null||we!=null){D.highlightFormatting&&(I.formatting=we==null?"strong":De==null?"em":"strong em"),we===!0&&(I.em=ne),De===!0&&(I.strong=ne);var Ee=h(I);return we===!1&&(I.em=!1),De===!1&&(I.strong=!1),Ee}}else if(ne===" "&&(N.eat("*")||N.eat("_"))){if(N.peek()===" ")return h(I);N.backUp(1)}if(D.strikethrough){if(ne==="~"&&N.eatWhile(ne)){if(I.strikethrough){D.highlightFormatting&&(I.formatting="strikethrough");var Ee=h(I);return I.strikethrough=!1,Ee}else if(N.match(/^[^\s]/,!1))return I.strikethrough=!0,D.highlightFormatting&&(I.formatting="strikethrough"),h(I)}else if(ne===" "&&N.match(/^~~/,!0)){if(N.peek()===" ")return h(I);N.backUp(2)}}if(D.emoji&&ne===":"&&N.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){I.emoji=!0,D.highlightFormatting&&(I.formatting="emoji");var Re=h(I);return I.emoji=!1,Re}return ne===" "&&(N.match(/^ +$/,!1)?I.trailingSpace++:I.trailingSpace&&(I.trailingSpaceNewLine=!0)),h(I)}function a(N,I){var V=N.next();if(V===">"){I.f=I.inline=l,D.highlightFormatting&&(I.formatting="link");var Q=h(I);return Q?Q+=" ":Q="",Q+B.linkInline}return N.match(/^[^>]+/,!0),B.linkInline}function v(N,I){if(N.eatSpace())return null;var V=N.next();return V==="("||V==="["?(I.f=I.inline=g(V==="("?")":"]"),D.highlightFormatting&&(I.formatting="link-string"),I.linkHref=!0,h(I)):"error"}var p={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function g(N){return function(I,V){var Q=I.next();if(Q===N){V.f=V.inline=l,D.highlightFormatting&&(V.formatting="link-string");var ne=h(V);return V.linkHref=!1,ne}return I.match(p[N]),V.linkHref=!0,h(V)}}function S(N,I){return N.match(/^([^\]\\]|\\.)*\]:/,!1)?(I.f=U,N.next(),D.highlightFormatting&&(I.formatting="link"),I.linkText=!0,h(I)):s(N,I,l)}function U(N,I){if(N.match(/^\]:/,!0)){I.f=I.inline=j,D.highlightFormatting&&(I.formatting="link");var V=h(I);return I.linkText=!1,V}return N.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function j(N,I){return N.eatSpace()?null:(N.match(/^[^\s]+/,!0),N.peek()===void 0?I.linkTitle=!0:N.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),I.f=I.inline=l,B.linkHref+" url")}var G={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:l,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(N){return{f:N.f,prevLine:N.prevLine,thisLine:N.thisLine,block:N.block,htmlState:N.htmlState&&te.copyState(H,N.htmlState),indentation:N.indentation,localMode:N.localMode,localState:N.localMode?te.copyState(N.localMode,N.localState):null,inline:N.inline,text:N.text,formatting:!1,linkText:N.linkText,linkTitle:N.linkTitle,linkHref:N.linkHref,code:N.code,em:N.em,strong:N.strong,strikethrough:N.strikethrough,emoji:N.emoji,header:N.header,setext:N.setext,hr:N.hr,taskList:N.taskList,list:N.list,listStack:N.listStack.slice(0),quote:N.quote,indentedCode:N.indentedCode,trailingSpace:N.trailingSpace,trailingSpaceNewLine:N.trailingSpaceNewLine,md_inside:N.md_inside,fencedEndRE:N.fencedEndRE}},token:function(N,I){if(I.formatting=!1,N!=I.thisLine.stream){if(I.header=0,I.hr=!1,N.match(/^\s*$/,!0))return f(I),null;if(I.prevLine=I.thisLine,I.thisLine={stream:N},I.taskList=!1,I.trailingSpace=0,I.trailingSpaceNewLine=!1,!I.localState&&(I.f=I.block,I.f!=_)){var V=N.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(I.indentation=V,I.indentationDiff=null,V>0)return null}}return I.f(N,I)},innerMode:function(N){return N.block==_?{state:N.htmlState,mode:H}:N.localState?{state:N.localState,mode:N.localMode}:{state:N,mode:G}},indent:function(N,I,V){return N.block==_&&H.indent?H.indent(N.htmlState,I,V):N.localState&&N.localMode.indent?N.localMode.indent(N.localState,I,V):te.Pass},blankLine:f,getType:h,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return G},"xml"),te.defineMIME("text/markdown","markdown"),te.defineMIME("text/x-markdown","markdown")})},osHv:function(gt,nt,Z){(function(te){te(Z("VrN/"))})(function(te){"use strict";var K=te.Pos;function D(d,o){return d.line-o.line||d.ch-o.ch}var H="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",M=H+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+H+"]["+M+"]*)","g");function B(d,o,s,u){this.line=o,this.ch=s,this.cm=d,this.text=d.getLine(o),this.min=u?Math.max(u.from,d.firstLine()):d.firstLine(),this.max=u?Math.min(u.to-1,d.lastLine()):d.lastLine()}function k(d,o){var s=d.cm.getTokenTypeAt(K(d.line,o));return s&&/\btag\b/.test(s)}function O(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function L(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function E(d){for(;;){var o=d.text.indexOf(">",d.ch);if(o==-1){if(O(d))continue;return}if(!k(d,o+1)){d.ch=o+1;continue}var s=d.text.lastIndexOf("/",o),u=s>-1&&!/\S/.test(d.text.slice(s+1,o));return d.ch=o+1,u?"selfClose":"regular"}}function C(d){for(;;){var o=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(o==-1){if(L(d))continue;return}if(!k(d,o+1)){d.ch=o;continue}P.lastIndex=o,d.ch=o;var s=P.exec(d.text);if(s&&s.index==o)return s}}function R(d){for(;;){P.lastIndex=d.ch;var o=P.exec(d.text);if(!o){if(O(d))continue;return}if(!k(d,o.index+1)){d.ch=o.index+1;continue}return d.ch=o.index+o[0].length,o}}function A(d){for(;;){var o=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(o==-1){if(L(d))continue;return}if(!k(d,o+1)){d.ch=o;continue}var s=d.text.lastIndexOf("/",o),u=s>-1&&!/\S/.test(d.text.slice(s+1,o));return d.ch=o+1,u?"selfClose":"regular"}}function w(d,o){for(var s=[];;){var u=R(d),x,f=d.line,m=d.ch-(u?u[0].length:0);if(!u||!(x=E(d)))return;if(x=="selfClose")continue;if(u[1]){for(var _=s.length-1;_>=0;--_)if(s[_]==u[2]){s.length=_;break}if(_<0&&(!o||o==u[2]))return{tag:u[2],from:K(f,m),to:K(d.line,d.ch)}}else s.push(u[2])}}function b(d,o){for(var s=[];;){var u=A(d);if(!u)return;if(u=="selfClose"){C(d);continue}var x=d.line,f=d.ch,m=C(d);if(!m)return;if(m[1])s.push(m[2]);else{for(var _=s.length-1;_>=0;--_)if(s[_]==m[2]){s.length=_;break}if(_<0&&(!o||o==m[2]))return{tag:m[2],from:K(d.line,d.ch),to:K(x,f)}}}}te.registerHelper("fold","xml",function(d,o){for(var s=new B(d,o.line,0);;){var u=R(s);if(!u||s.line!=o.line)return;var x=E(s);if(!x)return;if(!u[1]&&x!="selfClose"){var f=K(s.line,s.ch),m=w(s,u[2]);return m&&D(m.from,f)>0?{from:f,to:m.from}:null}}}),te.findMatchingTag=function(d,o,s){var u=new B(d,o.line,o.ch,s);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var x=E(u),f=x&&K(u.line,u.ch),m=x&&C(u);if(!x||!m||D(u,o)>0)return;var _={from:K(u.line,u.ch),to:f,tag:m[2]};return x=="selfClose"?{open:_,close:null,at:"open"}:m[1]?{open:b(u,m[2]),close:_,at:"close"}:(u=new B(d,f.line,f.ch,s),{open:_,close:w(u,m[2]),at:"open"})},te.findEnclosingTag=function(d,o,s,u){for(var x=new B(d,o.line,o.ch,s);;){var f=b(x,u);if(!f)break;var m=new B(d,o.line,o.ch,s),_=w(m,f.tag);if(_)return{open:f,close:_}}},te.scanForClosingTag=function(d,o,s,u){var x=new B(d,o.line,o.ch,u?{from:0,to:u}:null);return w(x,s)}})},p5ED:function(gt,nt,Z){"use strict";var te=Z("+L6B"),K=Z("2/Rp"),D=Z("5Dmo"),H=Z("3S7+"),M=Z("k1fw"),P=Z("tJVT"),B=Z("q1tI"),k=Z.n(B),O=Z("vHTk"),L=Z.n(O),E=Z("yEEn"),C=Z("ZW9T"),R=Z("1vsH");nt.a=function(A){var w=A.name,b=A.data,d=A.theme,o=A.type,s=A.filename,u=A.monacoEditor,x=A.className,f=A.style,m=A.close,_=A.onClose,y=A.hasMask,h=Object(B.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),c=Object(P.a)(h,2),l=c[0],a=c[1],v=Object(B.useState)(""),p=Object(P.a)(v,2),g=p[0],S=p[1],U=Object(B.useRef)();s&&(u.filename=s),Object(B.useEffect)(function(){var N,I,V=(N=document.cookie)===null||N===void 0||((I=N.replace(/\s/g,""))===null||I===void 0)?void 0:I.split(";");V==null||V.map(function(Q){var ne=Q.split("=");ne[0]==="_educoder_session"&&S(ne[1])})},[]);var j=function(){if(b.startsWith("http")||b.startsWith("/")){G();return}Object(R.x)(s||"educoder",b,s)},G=function(){Object(R.v)(s||w,b)};return k.a.createElement("div",{style:Object(M.a)({},f||{}),className:"".concat(y&&L.a.bgBlack," ").concat(o?L.a.wrp:"hide")},m&&k.a.createElement("div",{className:L.a.close,ref:U},k.a.createElement(H.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return U.current}},k.a.createElement("span",{onClick:G},k.a.createElement("i",{className:"icon-quxiaozhiding"}))),k.a.createElement(H.a,{title:"\u5173\u95ED",getPopupContainer:function(){return U.current}},k.a.createElement("span",{className:"",onClick:_},k.a.createElement("i",{className:"icon-guanbi1"})))),k.a.createElement("div",{className:"".concat(L.a[x]," ").concat(x," ").concat(L.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&k.a.createElement(C.b,u)),o==="audio"&&k.a.createElement("audio",{src:"".concat(b!=null&&b.startsWith("/")||(b==null?void 0:b.indexOf("https://"))>-1?b:"data:audio/mp3;base64,").concat(b),autoPlay:!0}),o==="video"&&k.a.createElement(k.a.Fragment,null,b!=null&&b.startsWith("/")?k.a.createElement("video",{controls:!0,src:"".concat(b),autoPlay:!0}):k.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(b),autoPlay:!0})),o==="pdf"&&k.a.createElement("embed",{className:L.a.embed,src:b}),o==="image"&&k.a.createElement(k.a.Fragment,null,k.a.createElement("img",{src:"".concat(b!=null&&b.startsWith("/")||(b==null?void 0:b.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(b)})),o==="other"&&k.a.createElement("div",null,k.a.createElement(K.a,{type:"primary",size:"large",onClick:j},k.a.createElement(E.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&k.a.createElement(K.a,{type:"primary",size:"large",onClick:j},k.a.createElement(E.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(gt,nt,Z){},qmgf:function(gt,nt,Z){gt.exports={flex_box_center:"flex_box_center___3lTsB",flex_space_between:"flex_space_between___2YefL",flex_box_vertical_center:"flex_box_vertical_center___3JbyE",flex_box_center_end:"flex_box_center_end___3f7kV",flex_box_column:"flex_box_column___XaEEq",bg:"bg___3fAD0",title:"title___GS3JP",questionIcons:"questionIcons___2Ywky",green:"green___2YTGN",orange:"orange___3Mo3j",greenTip:"greenTip___3pEXL",redTip:"redTip___42F30",orangeTip:"orangeTip___13u-h",pollDesc:"pollDesc___JHwT-",answered:"answered___3Btan",unanswer:"unanswer___xZxbz",anchor:"anchor___3SCrG",answerFlag:"answerFlag___1sA67",flagActive:"flagActive___3BHIE",flagHalf:"flagHalf___o6vfO",answerStudentFlag:"answerStudentFlag___1A6UX",answerStudentActive:"answerStudentActive___3YIps",questionItem:"questionItem___7oJpK",itemType:"itemType___3-sIA",itemFlag:"itemFlag___vTMRc",answerWrap:"answerWrap___1OmRN",answerSubjective:"answerSubjective___1mRXP",otherInput:"otherInput___3W3SW",submitButton:"submitButton___3eFdX",randomFlag:"randomFlag___3x2gx",answerTrue:"answerTrue___1rl8J",answerFalse:"answerFalse___1nRwk",answerHalf:"answerHalf___2E3ss",renderHtml:"renderHtml___l4hAy",simpleText:"simpleText___2skYC",answerYes:"answerYes___1_yO5",correct:"correct___3bxr3",answerNo:"answerNo___3O_Jc",answerInfo:"answerInfo___1X9Bt",answerSheet:"answerSheet___xCv84",wrong:"wrong___3u9yc",abandon:"abandon___3SQJD",active:"active___396rd",countDown:"countDown___1LFEZ",red:"red___1pkOZ",fold:"fold___B7EuZ",cardList:"cardList___2Frr1",iframe:"iframe___1SvH6",analysis:"analysis___1WADC"}},"rAM+":function(gt,nt,Z){"use strict";Z.d(nt,"a",function(){return K});var te=Z("Qw5x");function K(D,H){var M;if(typeof Symbol=="undefined"||D[Symbol.iterator]==null){if(Array.isArray(D)||(M=Object(te.a)(D))||H&&D&&typeof D.length=="number"){M&&(D=M);var P=0,B=function(){};return{s:B,n:function(){return P>=D.length?{done:!0}:{done:!1,value:D[P++]}},e:function(C){throw C},f:B}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var k=!0,O=!1,L;return{s:function(){M=D[Symbol.iterator]()},n:function(){var C=M.next();return k=C.done,C},e:function(C){O=!0,L=C},f:function(){try{!k&&M.return!=null&&M.return()}finally{if(O)throw L}}}}},rUJ1:function(gt,nt){const Z=/[&<>"']/,te=/[&<>"']/g,K=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,H={"&":"&","<":"<",">":">",'"':""","'":"'"},M=y=>H[y];function P(y,h){if(h){if(Z.test(y))return y.replace(te,M)}else if(K.test(y))return y.replace(D,M);return y}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function k(y){return y.replace(B,(h,c)=>(c=c.toLowerCase(),c==="colon"?":":c.charAt(0)==="#"?c.charAt(1)==="x"?String.fromCharCode(parseInt(c.substring(2),16)):String.fromCharCode(+c.substring(1)):""))}const O=/(^|[^\[])\^/g;function L(y,h){y=y.source||y,h=h||"";const c={replace:(l,a)=>(a=a.source||a,a=a.replace(O,"$1"),y=y.replace(l,a),c),getRegex:()=>new RegExp(y,h)};return c}const E=/[^\w:]/g,C=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function R(y,h,c){if(y){let l;try{l=decodeURIComponent(k(c)).replace(E,"").toLowerCase()}catch(a){return null}if(l.indexOf("javascript:")===0||l.indexOf("vbscript:")===0||l.indexOf("data:")===0)return null}h&&!C.test(c)&&(c=o(h,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(l){return null}return c}const A={},w=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(y,h){A[" "+y]||(w.test(y)?A[" "+y]=y+"/":A[" "+y]=f(y,"/",!0)),y=A[" "+y];const c=y.indexOf(":")===-1;return h.substring(0,2)==="//"?c?h:y.replace(b,"$1")+h:h.charAt(0)==="/"?c?h:y.replace(d,"$1")+h:y+h}const s={exec:function(){}};function u(y){let h=1,c,l;for(;h<arguments.length;h++){c=arguments[h];for(l in c)Object.prototype.hasOwnProperty.call(c,l)&&(y[l]=c[l])}return y}function x(y,h){const c=y.replace(/\|/g,(v,p,g)=>{let S=!1,U=p;for(;--U>=0&&g[U]==="\\";)S=!S;return S?"|":" |"}),l=c.split(/ \|/);let a=0;if(l.length>h)l.splice(h);else for(;l.length<h;)l.push("");for(;a<l.length;a++)l[a]=l[a].trim().replace(/\\\|/g,"|");return l}function f(y,h,c){const l=y.length;if(l===0)return"";let a=0;for(;a<l;){const v=y.charAt(l-a-1);if(v===h&&!c)a++;else if(v!==h&&c)a++;else break}return y.substr(0,l-a)}function m(y,h){if(y.indexOf(h[1])===-1)return-1;const c=y.length;let l=0,a=0;for(;a<c;a++)if(y[a]==="\\")a++;else if(y[a]===h[0])l++;else if(y[a]===h[1]&&(l--,l<0))return a;return-1}function _(y){y&&y.sanitize&&!y.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")}gt.exports={escape:P,unescape:k,edit:L,cleanUrl:R,resolveUrl:o,noopTest:s,merge:u,splitCells:x,rtrim:f,findClosingBracket:m,checkSanitizeDeprecation:_}},ulZh:function(gt,nt,Z){typeof window!="undefined"&&function(K,D){gt.exports=D()}(this,function(){return function(te){var K={};function D(H){if(K[H])return K[H].exports;var M=K[H]={i:H,l:!1,exports:{}};return te[H].call(M.exports,M,M.exports,D),M.l=!0,M.exports}return D.m=te,D.c=K,D.d=function(H,M,P){D.o(H,M)||Object.defineProperty(H,M,{enumerable:!0,get:P})},D.r=function(H){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(H,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(H,"__esModule",{value:!0})},D.t=function(H,M){if(M&1&&(H=D(H)),M&8)return H;if(M&4&&typeof H=="object"&&H&&H.__esModule)return H;var P=Object.create(null);if(D.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:H}),M&2&&typeof H!="string")for(var B in H)D.d(P,B,function(k){return H[k]}.bind(null,B));return P},D.n=function(H){var M=H&&H.__esModule?function(){return H.default}:function(){return H};return D.d(M,"a",M),M},D.o=function(H,M){return Object.prototype.hasOwnProperty.call(H,M)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(te,K,D){"use strict";var H=Object.prototype.hasOwnProperty,M="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(M=!1));function B(E,C,R){this.fn=E,this.context=C,this.once=R||!1}function k(E,C,R,A,w){if(typeof R!="function")throw new TypeError("The listener must be a function");var b=new B(R,A||E,w),d=M?M+C:C;return E._events[d]?E._events[d].fn?E._events[d]=[E._events[d],b]:E._events[d].push(b):(E._events[d]=b,E._eventsCount++),E}function O(E,C){--E._eventsCount===0?E._events=new P:delete E._events[C]}function L(){this._events=new P,this._eventsCount=0}L.prototype.eventNames=function(){var C=[],R,A;if(this._eventsCount===0)return C;for(A in R=this._events)H.call(R,A)&&C.push(M?A.slice(1):A);return Object.getOwnPropertySymbols?C.concat(Object.getOwnPropertySymbols(R)):C},L.prototype.listeners=function(C){var R=M?M+C:C,A=this._events[R];if(!A)return[];if(A.fn)return[A.fn];for(var w=0,b=A.length,d=new Array(b);w<b;w++)d[w]=A[w].fn;return d},L.prototype.listenerCount=function(C){var R=M?M+C:C,A=this._events[R];return A?A.fn?1:A.length:0},L.prototype.emit=function(C,R,A,w,b,d){var o=M?M+C:C;if(!this._events[o])return!1;var s=this._events[o],u=arguments.length,x,f;if(s.fn){s.once&&this.removeListener(C,s.fn,void 0,!0);switch(u){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,R),!0;case 3:return s.fn.call(s.context,R,A),!0;case 4:return s.fn.call(s.context,R,A,w),!0;case 5:return s.fn.call(s.context,R,A,w,b),!0;case 6:return s.fn.call(s.context,R,A,w,b,d),!0}for(f=1,x=new Array(u-1);f<u;f++)x[f-1]=arguments[f];s.fn.apply(s.context,x)}else{var m=s.length,_;for(f=0;f<m;f++){s[f].once&&this.removeListener(C,s[f].fn,void 0,!0);switch(u){case 1:s[f].fn.call(s[f].context);break;case 2:s[f].fn.call(s[f].context,R);break;case 3:s[f].fn.call(s[f].context,R,A);break;case 4:s[f].fn.call(s[f].context,R,A,w);break;default:if(!x)for(_=1,x=new Array(u-1);_<u;_++)x[_-1]=arguments[_];s[f].fn.apply(s[f].context,x)}}}return!0},L.prototype.on=function(C,R,A){return k(this,C,R,A,!1)},L.prototype.once=function(C,R,A){return k(this,C,R,A,!0)},L.prototype.removeListener=function(C,R,A,w){var b=M?M+C:C;if(!this._events[b])return this;if(!R)return O(this,b),this;var d=this._events[b];if(d.fn)d.fn===R&&(!w||d.once)&&(!A||d.context===A)&&O(this,b);else{for(var o=0,s=[],u=d.length;o<u;o++)(d[o].fn!==R||w&&!d[o].once||A&&d[o].context!==A)&&s.push(d[o]);s.length?this._events[b]=s.length===1?s[0]:s:O(this,b)}return this},L.prototype.removeAllListeners=function(C){var R;return C?(R=M?M+C:C,this._events[R]&&O(this,R)):(this._events=new P,this._eventsCount=0),this},L.prototype.off=L.prototype.removeListener,L.prototype.addListener=L.prototype.on,L.prefixed=M,L.EventEmitter=L,te.exports=L},"./node_modules/url-toolkit/src/url-toolkit.js":function(te,K,D){(function(H){var M=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,k=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,O={buildAbsoluteURL:function(L,E,C){if(C=C||{},L=L.trim(),E=E.trim(),!E){if(!C.alwaysNormalize)return L;var R=O.parseURL(L);if(!R)throw new Error("Error trying to parse base URL.");return R.path=O.normalizePath(R.path),O.buildURLFromParts(R)}var A=O.parseURL(E);if(!A)throw new Error("Error trying to parse relative URL.");if(A.scheme)return C.alwaysNormalize?(A.path=O.normalizePath(A.path),O.buildURLFromParts(A)):E;var w=O.parseURL(L);if(!w)throw new Error("Error trying to parse base URL.");if(!w.netLoc&&w.path&&w.path[0]!=="/"){var b=P.exec(w.path);w.netLoc=b[1],w.path=b[2]}w.netLoc&&!w.path&&(w.path="/");var d={scheme:w.scheme,netLoc:A.netLoc,path:null,params:A.params,query:A.query,fragment:A.fragment};if(!A.netLoc&&(d.netLoc=w.netLoc,A.path[0]!=="/"))if(!A.path)d.path=w.path,A.params||(d.params=w.params,A.query||(d.query=w.query));else{var o=w.path,s=o.substring(0,o.lastIndexOf("/")+1)+A.path;d.path=O.normalizePath(s)}return d.path===null&&(d.path=C.alwaysNormalize?O.normalizePath(A.path):A.path),O.buildURLFromParts(d)},parseURL:function(L){var E=M.exec(L);return E?{scheme:E[1]||"",netLoc:E[2]||"",path:E[3]||"",params:E[4]||"",query:E[5]||"",fragment:E[6]||""}:null},normalizePath:function(L){for(L=L.split("").reverse().join("").replace(B,"");L.length!==(L=L.replace(k,"")).length;);return L.split("").reverse().join("")},buildURLFromParts:function(L){return L.scheme+L.netLoc+L.path+L.params+L.query+L.fragment}};te.exports=O})(this)},"./node_modules/webworkify-webpack/index.js":function(te,K,D){function H(C){var R={};function A(b){if(R[b])return R[b].exports;var d=R[b]={i:b,l:!1,exports:{}};return C[b].call(d.exports,d,d.exports,A),d.l=!0,d.exports}A.m=C,A.c=R,A.i=function(b){return b},A.d=function(b,d,o){A.o(b,d)||Object.defineProperty(b,d,{configurable:!1,enumerable:!0,get:o})},A.r=function(b){Object.defineProperty(b,"__esModule",{value:!0})},A.n=function(b){var d=b&&b.__esModule?function(){return b.default}:function(){return b};return A.d(d,"a",d),d},A.o=function(b,d){return Object.prototype.hasOwnProperty.call(b,d)},A.p="/",A.oe=function(b){throw console.error(b),b};var w=A(A.s=ENTRY_MODULE);return w.default||w}var M="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+M+").*?\\)";function B(C){return(C+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function k(C){return!isNaN(1*C)}function O(C,R,A){var w={};w[A]=[];var b=R.toString(),d=b.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return w;for(var o=d[1],s=new RegExp("(\\\\n|\\W)"+B(o)+P,"g"),u;u=s.exec(b);){if(u[3]==="dll-reference")continue;w[A].push(u[3])}for(s=new RegExp("\\("+B(o)+'\\("(dll-reference\\s('+M+'))"\\)\\)'+P,"g");u=s.exec(b);)C[u[2]]||(w[A].push(u[1]),C[u[2]]=D(u[1]).m),w[u[2]]=w[u[2]]||[],w[u[2]].push(u[4]);for(var x=Object.keys(w),f=0;f<x.length;f++)for(var m=0;m<w[x[f]].length;m++)k(w[x[f]][m])&&(w[x[f]][m]=1*w[x[f]][m]);return w}function L(C){var R=Object.keys(C);return R.reduce(function(A,w){return A||C[w].length>0},!1)}function E(C,R){for(var A={main:[R]},w={main:[]},b={main:{}};L(A);)for(var d=Object.keys(A),o=0;o<d.length;o++){var s=d[o],u=A[s],x=u.pop();if(b[s]=b[s]||{},b[s][x]||!C[s][x])continue;b[s][x]=!0,w[s]=w[s]||[],w[s].push(x);for(var f=O(C,C[s][x],s),m=Object.keys(f),_=0;_<m.length;_++)A[m[_]]=A[m[_]]||[],A[m[_]]=A[m[_]].concat(f[m[_]])}return w}te.exports=function(C,R){R=R||{};var A={main:D.m},w=R.all?{main:Object.keys(A.main)}:E(A,C),b="";Object.keys(w).filter(function(x){return x!=="main"}).forEach(function(x){for(var f=0;w[x][f];)f++;w[x].push(f),A[x][f]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",b=b+"var "+x+" = ("+H.toString().replace("ENTRY_MODULE",JSON.stringify(f))+")({"+w[x].map(function(m){return""+JSON.stringify(m)+": "+A[x][m].toString()}).join(",")+`});
|
|
`}),b=b+"new (("+H.toString().replace("ENTRY_MODULE",JSON.stringify(C))+")({"+w.main.map(function(x){return""+JSON.stringify(x)+": "+A.main[x].toString()}).join(",")+"}))(self);";var d=new window.Blob([b],{type:"text/javascript"});if(R.bare)return d;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,s=o.createObjectURL(d),u=new window.Worker(s);return u.objectURL=s,u}},"./src/config.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"hlsDefaultConfig",function(){return _}),D.d(K,"mergeConfig",function(){return h}),D.d(K,"enableStreamingMode",function(){return c});var H=D("./src/controller/abr-controller.ts"),M=D("./src/controller/audio-stream-controller.ts"),P=D("./src/controller/audio-track-controller.ts"),B=D("./src/controller/subtitle-stream-controller.ts"),k=D("./src/controller/subtitle-track-controller.ts"),O=D("./src/controller/buffer-controller.ts"),L=D("./src/controller/timeline-controller.ts"),E=D("./src/controller/cap-level-controller.ts"),C=D("./src/controller/fps-controller.ts"),R=D("./src/controller/eme-controller.ts"),A=D("./src/controller/cmcd-controller.ts"),w=D("./src/utils/xhr-loader.ts"),b=D("./src/utils/fetch-loader.ts"),d=D("./src/utils/cues.ts"),o=D("./src/utils/mediakeys-helper.ts"),s=D("./src/utils/logger.ts");function u(){return u=Object.assign||function(l){for(var a=1;a<arguments.length;a++){var v=arguments[a];for(var p in v)Object.prototype.hasOwnProperty.call(v,p)&&(l[p]=v[p])}return l},u.apply(this,arguments)}function x(l,a){var v=Object.keys(l);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(l);a&&(p=p.filter(function(g){return Object.getOwnPropertyDescriptor(l,g).enumerable})),v.push.apply(v,p)}return v}function f(l){for(var a=1;a<arguments.length;a++){var v=arguments[a]!=null?arguments[a]:{};a%2?x(Object(v),!0).forEach(function(p){m(l,p,v[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(v)):x(Object(v)).forEach(function(p){Object.defineProperty(l,p,Object.getOwnPropertyDescriptor(v,p))})}return l}function m(l,a,v){return a in l?Object.defineProperty(l,a,{value:v,enumerable:!0,configurable:!0,writable:!0}):l[a]=v,l}var _=f(f({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:w.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:H.default,bufferController:O.default,capLevelController:E.default,fpsController:C.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},y()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:k.default,timelineController:L.TimelineController,audioStreamController:M.default,audioTrackController:P.default,emeController:R.default,cmcdController:A.default});function y(){return{cueHandler:d.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function h(l,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return u({},l,a)}function c(l){var a=l.loader;if(a!==b.default&&a!==w.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),l.progressive=!1;else{var v=Object(b.fetchSupported)();v&&(l.loader=b.default,l.progressive=!0,l.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(te,K,D){"use strict";D.r(K);var H=D("./src/polyfills/number.ts"),M=D("./src/utils/ewma-bandwidth-estimator.ts"),P=D("./src/events.ts"),B=D("./src/utils/buffer-helper.ts"),k=D("./src/errors.ts"),O=D("./src/types/loader.ts"),L=D("./src/utils/logger.ts");function E(A,w){for(var b=0;b<w.length;b++){var d=w[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(A,d.key,d)}}function C(A,w,b){return w&&E(A.prototype,w),b&&E(A,b),A}var R=function(){function A(b){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=b;var d=b.config;this.bwEstimator=new M.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var w=A.prototype;return w.registerListeners=function(){var d=this.hls;d.on(P.Events.FRAG_LOADING,this.onFragLoading,this),d.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(P.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var d=this.hls;d.off(P.Events.FRAG_LOADING,this.onFragLoading,this),d.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(P.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},w.onFragLoading=function(d,o){var s=o.frag;if(s.type===O.PlaylistLevelType.MAIN&&!this.timer){var u;this.fragCurrent=s,this.partCurrent=(u=o.part)!=null?u:null,this.timer=self.setInterval(this.onCheck,100)}},w.onLevelLoaded=function(d,o){var s=this.hls.config;o.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},w._abandonRulesCheck=function(){var d=this.fragCurrent,o=this.partCurrent,s=this.hls,u=s.autoLevelEnabled,x=s.config,f=s.media;if(!d||!f)return;var m=o?o.stats:d.stats,_=o?o.duration:d.duration;if(m.aborted){L.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!u||f.paused||!f.playbackRate||!f.readyState)return;var y=performance.now()-m.loading.start,h=Math.abs(f.playbackRate);if(y<=500*_/h)return;var c=s.levels,l=s.minAutoLevel,a=c[d.level],v=m.total||Math.max(m.loaded,Math.round(_*a.maxBitrate/8)),p=Math.max(1,m.bwEstimate?m.bwEstimate/8:m.loaded*1e3/y),g=(v-m.loaded)/p,S=f.currentTime,U=(B.BufferHelper.bufferInfo(f,S,x.maxBufferHole).end-S)/h;if(U>=2*_/h||g<=U)return;var j=Number.POSITIVE_INFINITY,G;for(G=d.level-1;G>l;G--){var N=c[G].maxBitrate;if(j=_*N/(8*.8*p),j<U)break}if(j>=g)return;var I=this.bwEstimator.getEstimate();L.logger.warn("Fragment "+d.sn+(o?" part "+o.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+G+`
|
|
Current BW estimate: `+(Object(H.isFiniteNumber)(I)?(I/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+g.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+j.toFixed(3)+` s
|
|
Time to underbuffer: `+U.toFixed(3)+" s"),s.nextLoadLevel=G,this.bwEstimator.sample(y,m.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),s.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:o,stats:m})},w.onFragLoaded=function(d,o){var s=o.frag,u=o.part;if(s.type===O.PlaylistLevelType.MAIN&&Object(H.isFiniteNumber)(s.sn)){var x=u?u.stats:s.stats,f=u?u.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var m=this.hls.levels[s.level],_=(m.loaded?m.loaded.bytes:0)+x.loaded,y=(m.loaded?m.loaded.duration:0)+f;m.loaded={bytes:_,duration:y},m.realBitrate=Math.round(8*_/y)}if(s.bitrateTest){var h={stats:x,frag:s,part:u,id:s.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,h),s.bitrateTest=!1}}},w.onFragBuffered=function(d,o){var s=o.frag,u=o.part,x=u?u.stats:s.stats;if(x.aborted)return;if(s.type!==O.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var f=x.parsing.end-x.loading.start;this.bwEstimator.sample(f,x.loaded),x.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=f/1e3:this.bitrateTestDelay=0},w.onError=function(d,o){switch(o.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},w.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},w.getNextABRAutoLevel=function(){var d=this.fragCurrent,o=this.partCurrent,s=this.hls,u=s.maxAutoLevel,x=s.config,f=s.minAutoLevel,m=s.media,_=o?o.duration:d?d.duration:0,y=m?m.currentTime:0,h=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():x.abrEwmaDefaultEstimate,l=(B.BufferHelper.bufferInfo(m,y,x.maxBufferHole).end-y)/h,a=this.findBestLevel(c,f,u,l,x.abrBandWidthFactor,x.abrBandWidthUpFactor);if(a>=0)return a;L.logger.trace((l?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var v=_?Math.min(_,x.maxStarvationDelay):x.maxStarvationDelay,p=x.abrBandWidthFactor,g=x.abrBandWidthUpFactor;if(!l){var S=this.bitrateTestDelay;if(S){var U=_?Math.min(_,x.maxLoadingDelay):x.maxLoadingDelay;v=U-S,L.logger.trace("bitrate test took "+Math.round(1e3*S)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*v)+" ms"),p=g=1}}return a=this.findBestLevel(c,f,u,l+v,p,g),Math.max(a,0)},w.findBestLevel=function(d,o,s,u,x,f){for(var m,_=this.fragCurrent,y=this.partCurrent,h=this.lastLoadedFragLevel,c=this.hls.levels,l=c[h],a=!!(l!=null&&(m=l.details)!==null&&m!==void 0&&m.live),v=l==null?void 0:l.codecSet,p=y?y.duration:_?_.duration:0,g=s;g>=o;g--){var S=c[g];if(!S||v&&S.codecSet!==v)continue;var U=S.details,j=(y?U==null?void 0:U.partTarget:U==null?void 0:U.averagetargetduration)||p,G=void 0;g<=h?G=x*d:G=f*d;var N=c[g].maxBitrate,I=N*j/G;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+g+"/"+Math.round(G)+"/"+N+"/"+j+"/"+u+"/"+I),G>N&&(!I||a&&!this.bitrateTestDelay||I<u))return g}return-1},C(A,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,o=this.bwEstimator;if(d!==-1&&(!o||!o.canEstimate()))return d;var s=this.getNextABRAutoLevel();return d!==-1&&(s=Math.min(d,s)),s},set:function(d){this._nextAutoLevel=d}}]),A}();K.default=R},"./src/controller/audio-stream-controller.ts":function(te,K,D){"use strict";D.r(K);var H=D("./src/polyfills/number.ts"),M=D("./src/controller/base-stream-controller.ts"),P=D("./src/events.ts"),B=D("./src/utils/buffer-helper.ts"),k=D("./src/controller/fragment-tracker.ts"),O=D("./src/types/level.ts"),L=D("./src/types/loader.ts"),E=D("./src/loader/fragment.ts"),C=D("./src/demux/chunk-cache.ts"),R=D("./src/demux/transmuxer-interface.ts"),A=D("./src/types/transmuxer.ts"),w=D("./src/controller/fragment-finders.ts"),b=D("./src/utils/discontinuities.ts"),d=D("./src/errors.ts"),o=D("./src/utils/logger.ts");function s(){return s=Object.assign||function(_){for(var y=1;y<arguments.length;y++){var h=arguments[y];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(_[c]=h[c])}return _},s.apply(this,arguments)}function u(_,y){_.prototype=Object.create(y.prototype),_.prototype.constructor=_,x(_,y)}function x(_,y){return x=Object.setPrototypeOf||function(c,l){return c.__proto__=l,c},x(_,y)}var f=100,m=function(_){u(y,_);function y(c,l){var a;return a=_.call(this,c,l,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var h=y.prototype;return h.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},h._registerListeners=function(){var l=this.hls;l.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(P.Events.ERROR,this.onError,this),l.on(P.Events.BUFFER_RESET,this.onBufferReset,this),l.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),l.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var l=this.hls;l.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(P.Events.ERROR,this.onError,this),l.off(P.Events.BUFFER_RESET,this.onBufferReset,this),l.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),l.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onInitPtsFound=function(l,a){var v=a.frag,p=a.id,g=a.initPTS;if(p==="main"){var S=v.cc;this.initPTS[v.cc]=g,this.log("InitPTS for cc: "+S+" found from main: "+g),this.videoTrackCC=S,this.state===M.State.WAITING_INIT_PTS&&this.tick()}},h.startLoad=function(l){if(!this.levels){this.startPosition=l,this.state=M.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(f),this.fragLoadError=0,a>0&&l===-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=l,this.tick()},h.doTick=function(){switch(this.state){case M.State.IDLE:this.doTickIdle();break;case M.State.WAITING_TRACK:{var l,a=this.levels,v=this.trackId,p=a==null||((l=a[v])===null||l===void 0)?void 0:l.details;if(p){if(this.waitForCdnTuneIn(p))break;this.state=M.State.WAITING_INIT_PTS}break}case M.State.FRAG_LOADING_WAITING_RETRY:{var g,S=performance.now(),U=this.retryDate;(!U||S>=U||(g=this.media)!==null&&g!==void 0&&g.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=M.State.IDLE);break}case M.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var G=j.frag,N=j.part,I=j.cache,V=j.complete;if(this.initPTS[G.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=M.State.FRAG_LOADING;var Q=I.flush(),ne={frag:G,part:N,payload:Q,networkDetails:null};this._handleFragmentLoadProgress(ne),V&&_.prototype._handleFragmentLoadComplete.call(this,ne)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+G.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var se=this.getLoadPosition(),xe=B.BufferHelper.bufferInfo(this.mediaBuffer,se,this.config.maxBufferHole),me=Object(w.fragmentWithinToleranceTest)(xe.end,this.config.maxFragLookUpTolerance,G);me<0&&(o.logger.log("Waiting fragment cc ("+G.cc+") @ "+G.start+" cancelled because another fragment at "+xe.end+" is needed"),this.clearWaitingFragment())}}else this.state=M.State.IDLE}}this.onTickEnd()},h.clearWaitingFragment=function(){var l=this.waitingData;l&&(this.fragmentTracker.removeFragment(l.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=M.State.IDLE)},h.onTickEnd=function(){var l=this.media;if(!l||!l.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:l,v=a.buffered;!this.loadedmetadata&&v.length&&(this.loadedmetadata=!0),this.lastCurrentTime=l.currentTime},h.doTickIdle=function(){var l,a,v=this.hls,p=this.levels,g=this.media,S=this.trackId,U=v.config;if(!p||!p[S])return;if(!g&&(this.startFragRequested||!U.startFragPrefetch))return;var j=p[S],G=j.details;if(!G||G.live&&this.levelLastLoaded!==S||this.waitForCdnTuneIn(G)){this.state=M.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,E.ElementaryStreamTypes.AUDIO,L.PlaylistLevelType.AUDIO));var N=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,L.PlaylistLevelType.AUDIO);if(N===null)return;var I=N.len,V=this.getMaxBufferLength(),Q=this.audioSwitch;if(I>=V&&!Q)return;if(!Q&&this._streamEnded(N,G)){v.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=M.State.ENDED;return}var ne=G.fragments,se=ne[0].start,xe=N.end;if(Q){var me=this.getLoadPosition();xe=me,G.PTSKnown&&me<se&&((N.end>se||N.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),g.currentTime=se+.05))}var Le=this.getNextFragment(xe,G);if(!Le){this.bufferFlushed=!0;return}((l=Le.decryptdata)===null||l===void 0?void 0:l.keyFormat)==="identity"&&!((a=Le.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Le,G):this.loadFragment(Le,G,xe)},h.getMaxBufferLength=function(){var l=_.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,L.PlaylistLevelType.MAIN);return a===null?l:Math.max(l,a.len)},h.onMediaDetaching=function(){this.videoBuffer=null,_.prototype.onMediaDetaching.call(this)},h.onAudioTracksUpdated=function(l,a){var v=a.audioTracks;this.resetTransmuxer(),this.levels=v.map(function(p){return new O.Level(p)})},h.onAudioTrackSwitching=function(l,a){var v=!!a.url;this.trackId=a.id;var p=this.fragCurrent;p!=null&&p.loader&&p.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),v?this.setInterval(f):this.resetTransmuxer(),v?(this.audioSwitch=!0,this.state=M.State.IDLE):this.state=M.State.STOPPED,this.tick()},h.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},h.onLevelLoaded=function(l,a){this.mainDetails=a.details},h.onAudioTrackLoaded=function(l,a){var v,p=this.levels,g=a.details,S=a.id;if(!p){this.warn("Audio tracks were reset while loading level "+S);return}this.log("Track "+S+" loaded ["+g.startSN+","+g.endSN+"],duration:"+g.totalduration);var U=p[S],j=0;if(g.live||(v=U.details)!==null&&v!==void 0&&v.live){var G=this.mainDetails;if(g.fragments[0]||(g.deltaUpdateFailed=!0),g.deltaUpdateFailed||!G)return;!U.details&&g.hasProgramDateTime&&G.hasProgramDateTime?(Object(b.alignMediaPlaylistByPDT)(g,G),j=g.fragments[0].start):j=this.alignPlaylists(g,U.details)}U.details=g,this.levelLastLoaded=S,!this.startFragRequested&&(this.mainDetails||!g.live)&&this.setStartPosition(U.details,j),this.state===M.State.WAITING_TRACK&&!this.waitForCdnTuneIn(g)&&(this.state=M.State.IDLE),this.tick()},h._handleFragmentLoadProgress=function(l){var a,v=l.frag,p=l.part,g=l.payload,S=this.config,U=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+v.sn+" of level "+v.level+" will not be buffered");return}var G=j[U];console.assert(G,"Audio track is defined on fragment load progress");var N=G.details;console.assert(N,"Audio track details are defined on fragment load progress");var I=S.defaultAudioCodec||G.audioCodec||"mp4a.40.2",V=this.transmuxer;V||(V=this.transmuxer=new R.default(this.hls,L.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Q=this.initPTS[v.cc],ne=(a=v.initSegment)===null||a===void 0?void 0:a.data;if(Q!==void 0){var se=!1,xe=p?p.index:-1,me=xe!==-1,Le=new A.ChunkMetadata(v.level,v.sn,v.stats.chunkCount,g.byteLength,xe,me);V.push(g,ne,I,"",v,p,N.totalduration,se,Le,Q)}else{o.logger.log("Unknown video PTS for cc "+v.cc+", waiting for video PTS before demuxing audio frag "+v.sn+" of ["+N.startSN+" ,"+N.endSN+"],track "+U);var Ee=this.waitingData=this.waitingData||{frag:v,part:p,cache:new C.default,complete:!1},Te=Ee.cache;Te.push(new Uint8Array(g)),this.waitingVideoCC=this.videoTrackCC,this.state=M.State.WAITING_INIT_PTS}},h._handleFragmentLoadComplete=function(l){if(this.waitingData){this.waitingData.complete=!0;return}_.prototype._handleFragmentLoadComplete.call(this,l)},h.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},h.onBufferCreated=function(l,a){var v=a.tracks.audio;v&&(this.mediaBuffer=v.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},h.onFragBuffered=function(l,a){var v=a.frag,p=a.part;if(v.type!==L.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(v)){this.warn("Fragment "+v.sn+(p?" p: "+p.index:"")+" of level "+v.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}v.sn!=="initSegment"&&(this.fragPrevious=v,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(v,p)},h.onError=function(l,a){switch(a.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.AUDIO,a);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.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 d.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===M.State.PARSING||this.state===M.State.PARSED)){var v=!0,p=this.getFwdBufferInfo(this.mediaBuffer,L.PlaylistLevelType.AUDIO);p&&p.len>.5&&(v=!this.reduceMaxBufferLength(p.len)),v&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,_.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},h.onBufferFlushed=function(l,a){var v=a.type;v===E.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(l){var a,v="audio",p=this.hls,g=l.remuxResult,S=l.chunkMeta,U=this.getCurrentContext(S);if(!U){this.warn("The loading context changed while buffering fragment "+S.sn+" of level "+S.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(S.level);return}var j=U.frag,G=U.part,N=g.audio,I=g.text,V=g.id3,Q=g.initSegment;if(this.fragContextChanged(j))return;if(this.state=M.State.PARSING,this.audioSwitch&&N&&this.completeAudioSwitch(),Q!=null&&Q.tracks&&(this._bufferInitSegment(Q.tracks,j,S),p.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:v,tracks:Q.tracks})),N){var ne=N.startPTS,se=N.endPTS,xe=N.startDTS,me=N.endDTS;G&&(G.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:ne,endPTS:se,startDTS:xe,endDTS:me}),j.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,ne,se,xe,me),this.bufferFragmentData(N,j,G,S)}if(V!=null&&(a=V.samples)!==null&&a!==void 0&&a.length){var Le=s({frag:j,id:v},V);p.trigger(P.Events.FRAG_PARSING_METADATA,Le)}if(I){var Ee=s({frag:j,id:v},I);p.trigger(P.Events.FRAG_PARSING_USERDATA,Ee)}},h._bufferInitSegment=function(l,a,v){if(this.state!==M.State.PARSING)return;l.video&&delete l.video;var p=l.audio;if(!p)return;p.levelCodec=p.codec,p.id="audio",this.log("Init audio buffer, container:"+p.container+", codecs[parsed]=["+p.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,l);var g=p.initSegment;if(g!=null&&g.byteLength){var S={type:"audio",frag:a,part:null,chunkMeta:v,parent:a.type,data:g};this.hls.trigger(P.Events.BUFFER_APPENDING,S)}this.tick()},h.loadFragment=function(l,a,v){var p=this.fragmentTracker.getState(l);this.fragCurrent=l,(this.audioSwitch||p===k.FragmentState.NOT_LOADED||p===k.FragmentState.PARTIAL)&&(l.sn==="initSegment"?this._loadInitSegment(l):a.live&&!Object(H.isFiniteNumber)(this.initPTS[l.cc])?(this.log("Waiting for video PTS in continuity counter "+l.cc+" of live stream before loading audio fragment "+l.sn+" of level "+this.trackId),this.state=M.State.WAITING_INIT_PTS):(this.startFragRequested=!0,_.prototype.loadFragment.call(this,l,a,v)))},h.completeAudioSwitch=function(){var l=this.hls,a=this.media,v=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),_.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,l.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:v})},y}(M.default);K.default=m},"./src/controller/audio-track-controller.ts":function(te,K,D){"use strict";D.r(K);var H=D("./src/events.ts"),M=D("./src/errors.ts"),P=D("./src/controller/base-playlist-controller.ts"),B=D("./src/types/loader.ts");function k(R,A){for(var w=0;w<A.length;w++){var b=A[w];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(R,b.key,b)}}function O(R,A,w){return A&&k(R.prototype,A),w&&k(R,w),R}function L(R,A){R.prototype=Object.create(A.prototype),R.prototype.constructor=R,E(R,A)}function E(R,A){return E=Object.setPrototypeOf||function(b,d){return b.__proto__=d,b},E(R,A)}var C=function(R){L(A,R);function A(b){var d;return d=R.call(this,b,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var w=A.prototype;return w.registerListeners=function(){var d=this.hls;d.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(H.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var d=this.hls;d.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(H.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,R.prototype.destroy.call(this)},w.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},w.onManifestParsed=function(d,o){this.tracks=o.audioTracks||[]},w.onAudioTrackLoaded=function(d,o){var s=o.id,u=o.details,x=this.tracksInGroup[s];if(!x){this.warn("Invalid audio track id "+s);return}var f=x.details;x.details=o.details,this.log("audioTrack "+s+" loaded ["+u.startSN+"-"+u.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,o,f))},w.onLevelLoading=function(d,o){this.switchLevel(o.level)},w.onLevelSwitching=function(d,o){this.switchLevel(o.level)},w.switchLevel=function(d){var o=this.hls.levels[d];if(!(o!=null&&o.audioGroupIds))return;var s=o.audioGroupIds[o.urlId];if(this.groupId!==s){this.groupId=s;var u=this.tracks.filter(function(f){return!s||f.groupId===s});this.selectDefaultTrack&&!u.some(function(f){return f.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var x={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(H.Events.AUDIO_TRACKS_UPDATED,x),this.selectInitialTrack()}},w.onError=function(d,o){if(R.prototype.onError.call(this,d,o),o.fatal||!o.context)return;o.context.type===B.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},w.setAudioTrack=function(d){var o=this.tracksInGroup;if(d<0||d>=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 "+d);var u=o[d],x=u.id,f=u.groupId,m=f===void 0?"":f,_=u.name,y=u.type,h=u.url;if(this.trackId=d,this.trackName=_,this.selectDefaultTrack=!1,this.hls.trigger(H.Events.AUDIO_TRACK_SWITCHING,{id:x,groupId:m,name:_,type:y,url:h}),u.details&&!u.details.live)return;var c=this.switchParams(u.url,s==null?void 0:s.details);this.loadPlaylist(c)},w.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,s=this.findTrackId(o)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},w.findTrackId=function(d){for(var o=this.tracksInGroup,s=0;s<o.length;s++){var u=o[s];if((!this.selectDefaultTrack||u.default)&&(!d||d===u.name))return u.id}return-1},w.loadPlaylist=function(d){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var s=o.id,u=o.groupId,x=o.url;if(d)try{x=d.addDirectives(x)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(H.Events.AUDIO_TRACK_LOADING,{url:x,id:s,groupId:u,deliveryDirectives:d||null})}},O(A,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),A}(P.default);K.default=C},"./src/controller/base-playlist-controller.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"default",function(){return O});var H=D("./src/polyfills/number.ts"),M=D("./src/types/level.ts"),P=D("./src/controller/level-helper.ts"),B=D("./src/utils/logger.ts"),k=D("./src/errors.ts"),O=function(){function L(C,R){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=B.logger.log.bind(B.logger,R+":"),this.warn=B.logger.warn.bind(B.logger,R+":"),this.hls=C}var E=L.prototype;return E.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},E.onError=function(R,A){A.fatal&&A.type===k.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},E.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},E.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},E.stopLoad=function(){this.canLoad=!1,this.clearTimer()},E.switchParams=function(R,A){var w=A==null?void 0:A.renditionReports;if(w)for(var b=0;b<w.length;b++){var d=w[b],o=""+d.URI;if(o===R.substr(-o.length)){var s=parseInt(d["LAST-MSN"]),u=parseInt(d["LAST-PART"]);if(A&&this.hls.config.lowLatencyMode){var x=Math.min(A.age-A.partTarget,A.targetduration);u!==void 0&&x>A.partTarget&&(u+=1)}if(Object(H.isFiniteNumber)(s))return new M.HlsUrlParameters(s,Object(H.isFiniteNumber)(u)?u:void 0,M.HlsSkip.No)}}},E.loadPlaylist=function(R){},E.shouldLoadTrack=function(R){return this.canLoad&&R&&!!R.url&&(!R.details||R.details.live)},E.playlistLoaded=function(R,A,w){var b=this,d=A.details,o=A.stats,s=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(d.advancedDateTime=Date.now()-s,d.live||w!=null&&w.live){if(d.reloaded(w),w&&this.log("live playlist "+R+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),w&&d.fragments.length>0&&Object(P.mergeDetails)(w,d),!this.canLoad||!d.live)return;var u,x=void 0,f=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var m=this.hls.config.lowLatencyMode,_=d.lastPartSn,y=d.endSN,h=d.lastPartIndex,c=h!==-1,l=_===y,a=m?0:h;c?(x=l?y+1:_,f=l?a:h+1):x=y+1;var v=d.age,p=v+d.ageHeader,g=Math.min(p-d.partTarget,d.targetduration*1.5);if(g>0){if(w&&g>w.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+w.tuneInGoal+" to: "+g+" with playlist age: "+d.age),g=0;else{var S=Math.floor(g/d.targetduration);if(x+=S,f!==void 0){var U=Math.round(g%d.targetduration/d.partTarget);f+=U}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+v.toFixed(2)+"s goal: "+g+" skip sn "+S+" to part "+f)}d.tuneInGoal=g}if(u=this.getDeliveryDirectives(d,A.deliveryDirectives,x,f),m||!l){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(d,A.deliveryDirectives,x,f);var j=Object(P.computeReloadInterval)(d,o);x!==void 0&&d.canBlockReload&&(j-=d.partTarget||1),this.log("reload live playlist "+R+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return b.loadPlaylist(u)},j)}else this.clearTimer()},E.getDeliveryDirectives=function(R,A,w,b){var d=Object(M.getSkipValue)(R,w);return A!=null&&A.skip&&R.deltaUpdateFailed&&(w=A.msn,b=A.part,d=M.HlsSkip.No),new M.HlsUrlParameters(w,b,d)},E.retryLoadingOrFail=function(R){var A=this,w=this.hls.config,b=this.retryCount<w.levelLoadingMaxRetry;if(b){var d;if(this.retryCount++,R.details.indexOf("LoadTimeOut")>-1&&(d=R.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+R.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*w.levelLoadingRetryDelay,w.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return A.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+R.details+'"')}}else this.warn('cannot recover from error "'+R.details+'"'),this.clearTimer(),R.fatal=!0;return b},L}()},"./src/controller/base-stream-controller.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"State",function(){return y}),D.d(K,"default",function(){return h});var H=D("./src/polyfills/number.ts"),M=D("./src/task-loop.ts"),P=D("./src/controller/fragment-tracker.ts"),B=D("./src/utils/buffer-helper.ts"),k=D("./src/utils/logger.ts"),O=D("./src/events.ts"),L=D("./src/errors.ts"),E=D("./src/types/transmuxer.ts"),C=D("./src/utils/mp4-tools.ts"),R=D("./src/utils/discontinuities.ts"),A=D("./src/controller/fragment-finders.ts"),w=D("./src/controller/level-helper.ts"),b=D("./src/loader/fragment-loader.ts"),d=D("./src/crypt/decrypter.ts"),o=D("./src/utils/time-ranges.ts"),s=D("./src/types/loader.ts");function u(c,l){for(var a=0;a<l.length;a++){var v=l[a];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(c,v.key,v)}}function x(c,l,a){return l&&u(c.prototype,l),a&&u(c,a),c}function f(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function m(c,l){c.prototype=Object.create(l.prototype),c.prototype.constructor=c,_(c,l)}function _(c,l){return _=Object.setPrototypeOf||function(v,p){return v.__proto__=p,v},_(c,l)}var y={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},h=function(c){m(l,c);function l(v,p,g){var S;return S=c.call(this)||this,S.hls=void 0,S.fragPrevious=null,S.fragCurrent=null,S.fragmentTracker=void 0,S.transmuxer=null,S._state=y.STOPPED,S.media=void 0,S.mediaBuffer=void 0,S.config=void 0,S.bitrateTest=!1,S.lastCurrentTime=0,S.nextLoadPosition=0,S.startPosition=0,S.loadedmetadata=!1,S.fragLoadError=0,S.retryDate=0,S.levels=null,S.fragmentLoader=void 0,S.levelLastLoaded=null,S.startFragRequested=!1,S.decrypter=void 0,S.initPTS=[],S.onvseeking=null,S.onvended=null,S.logPrefix="",S.log=void 0,S.warn=void 0,S.logPrefix=g,S.log=k.logger.log.bind(k.logger,g+":"),S.warn=k.logger.warn.bind(k.logger,g+":"),S.hls=v,S.fragmentLoader=new b.default(v.config),S.fragmentTracker=p,S.config=v.config,S.decrypter=new d.default(v,v.config),v.on(O.Events.KEY_LOADED,S.onKeyLoaded,f(S)),S}var a=l.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=y.STOPPED},a._streamEnded=function(p,g){var S=this.fragCurrent,U=this.fragmentTracker;if(!g.live&&S&&S.sn===g.endSN&&!p.nextStart){var j=U.getState(S);return j===P.FragmentState.PARTIAL||j===P.FragmentState.OK}return!1},a.onMediaAttached=function(p,g){var S=this.media=this.mediaBuffer=g.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),S.addEventListener("seeking",this.onvseeking),S.addEventListener("ended",this.onvended);var U=this.config;this.levels&&U.autoStartLoad&&this.state===y.STOPPED&&this.startLoad(U.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,g=this.fragCurrent,S=this.media,U=this.mediaBuffer,j=this.state,G=S?S.currentTime:0,N=B.BufferHelper.bufferInfo(U||S,G,p.maxBufferHole);if(this.log("media seeking to "+(Object(H.isFiniteNumber)(G)?G.toFixed(3):G)+", state: "+j),j===y.ENDED)this.resetLoadingState();else if(g&&!N.len){var I=p.maxFragLookUpTolerance,V=g.start-I,Q=g.start+g.duration+I,ne=G>Q;(G<V||ne)&&(ne&&g.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),g.loader.abort()),this.resetLoadingState())}S&&(this.lastCurrentTime=G),!this.loadedmetadata&&!N.len&&(this.nextLoadPosition=this.startPosition=G),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(p,g){if(this.state!==y.KEY_LOADING||g.frag!==this.fragCurrent||!this.levels)return;this.state=y.IDLE;var S=this.levels[g.frag.level].details;S&&this.loadFragment(g.frag,S,g.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=y.STOPPED,this.hls.off(O.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,c.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(p,g){this.log("Loading key for "+p.sn+" of ["+g.startSN+"-"+g.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level),this.state=y.KEY_LOADING,this.fragCurrent=p,this.hls.trigger(O.Events.KEY_LOADING,{frag:p})},a.loadFragment=function(p,g,S){this._loadFragForPlayback(p,g,S)},a._loadFragForPlayback=function(p,g,S){var U=this,j=function(N){if(U.fragContextChanged(p)){U.warn("Fragment "+p.sn+(N.part?" p: "+N.part.index:"")+" of level "+p.level+" was dropped during download."),U.fragmentTracker.removeFragment(p);return}p.stats.chunkCount++,U._handleFragmentLoadProgress(N)};this._doFragLoad(p,g,S,j).then(function(G){if(!G)return;U.fragLoadError=0;var N=U.state;if(U.fragContextChanged(p)){(N===y.FRAG_LOADING||N===y.BACKTRACKING||!U.fragCurrent&&N===y.PARSING)&&(U.fragmentTracker.removeFragment(p),U.state=y.IDLE);return}if("payload"in G&&(U.log("Loaded fragment "+p.sn+" of level "+p.level),U.hls.trigger(O.Events.FRAG_LOADED,G),U.state===y.BACKTRACKING)){U.fragmentTracker.backtrack(p,G),U.resetFragmentLoading(p);return}U._handleFragmentLoadComplete(G)}).catch(function(G){U.warn(G),U.resetFragmentLoading(p)})},a.flushMainBuffer=function(p,g,S){if(S===void 0&&(S=null),!(p-g))return;var U={startOffset:p,endOffset:g,type:S};this.fragLoadError=0,this.hls.trigger(O.Events.BUFFER_FLUSHING,U)},a._loadInitSegment=function(p){var g=this;this._doFragLoad(p).then(function(S){if(!S||g.fragContextChanged(p)||!g.levels)throw new Error("init load aborted");return S}).then(function(S){var U=g.hls,j=S.payload,G=p.decryptdata;if(j&&j.byteLength>0&&G&&G.key&&G.iv&&G.method==="AES-128"){var N=self.performance.now();return g.decrypter.webCryptoDecrypt(new Uint8Array(j),G.key.buffer,G.iv.buffer).then(function(I){var V=self.performance.now();return U.trigger(O.Events.FRAG_DECRYPTED,{frag:p,payload:I,stats:{tstart:N,tdecrypt:V}}),S.payload=I,S})}return S}).then(function(S){var U=g.fragCurrent,j=g.hls,G=g.levels;if(!G)throw new Error("init load aborted, missing levels");var N=G[p.level].details;console.assert(N,"Level details are defined when init segment is loaded");var I=p.stats;g.state=y.IDLE,g.fragLoadError=0,p.data=new Uint8Array(S.payload),I.parsing.start=I.buffering.start=self.performance.now(),I.parsing.end=I.buffering.end=self.performance.now(),S.frag===U&&j.trigger(O.Events.FRAG_BUFFERED,{stats:I,frag:U,part:null,id:p.type}),g.tick()}).catch(function(S){g.warn(S),g.resetFragmentLoading(p)})},a.fragContextChanged=function(p){var g=this.fragCurrent;return!p||!g||p.level!==g.level||p.sn!==g.sn||p.urlId!==g.urlId},a.fragBufferedComplete=function(p,g){var S=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+p.type+" sn: "+p.sn+(g?" part: "+g.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level+" "+o.default.toString(B.BufferHelper.getBuffered(S))),this.state=y.IDLE,this.tick()},a._handleFragmentLoadComplete=function(p){var g=this.transmuxer;if(!g)return;var S=p.frag,U=p.part,j=p.partsLoaded,G=!j||j.length===0||j.some(function(I){return!I}),N=new E.ChunkMetadata(S.level,S.sn,S.stats.chunkCount+1,0,U?U.index:-1,!G);g.flush(N)},a._handleFragmentLoadProgress=function(p){},a._doFragLoad=function(p,g,S,U){var j=this;if(S===void 0&&(S=null),!this.levels)throw new Error("frag load aborted, missing levels");if(S=Math.max(p.start,S||0),this.config.lowLatencyMode&&g){var G=g.partList;if(G&&U){S>p.end&&g.fragmentHint&&(p=g.fragmentHint);var N=this.getNextPart(G,p,S);if(N>-1){var I=G[N];return this.log("Loading part sn: "+p.sn+" p: "+I.index+" cc: "+p.cc+" of playlist ["+g.startSN+"-"+g.endSN+"] parts [0-"+N+"-"+(G.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(S.toFixed(3))),this.nextLoadPosition=I.start+I.duration,this.state=y.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:p,part:G[N],targetBufferTime:S}),this.doFragPartsLoad(p,G,N,U).catch(function(V){return j.handleFragLoadError(V)})}else if(!p.url||this.loadedEndOfParts(G,S))return Promise.resolve(null)}}return this.log("Loading fragment "+p.sn+" cc: "+p.cc+" "+(g?"of ["+g.startSN+"-"+g.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(S.toFixed(3))),Object(H.isFiniteNumber)(p.sn)&&!this.bitrateTest&&(this.nextLoadPosition=p.start+p.duration),this.state=y.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:p,targetBufferTime:S}),this.fragmentLoader.load(p,U).catch(function(V){return j.handleFragLoadError(V)})},a.doFragPartsLoad=function(p,g,S,U){var j=this;return new Promise(function(G,N){var I=[],V=function Q(ne){var se=g[ne];j.fragmentLoader.loadPart(p,se,U).then(function(xe){I[se.index]=xe;var me=xe.part;j.hls.trigger(O.Events.FRAG_LOADED,xe);var Le=g[ne+1];if(Le&&Le.fragment===p)Q(ne+1);else return G({frag:p,part:me,partsLoaded:I})}).catch(N)};V(S)})},a.handleFragLoadError=function(p){var g=p.data;return g&&g.details===L.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(g.frag,g.part):this.hls.trigger(O.Events.ERROR,g),null},a._handleTransmuxerFlush=function(p){var g=this.getCurrentContext(p);if(!g||this.state!==y.PARSING){this.fragCurrent||(this.state=y.IDLE);return}var S=g.frag,U=g.part,j=g.level,G=self.performance.now();S.stats.parsing.end=G,U&&(U.stats.parsing.end=G),this.updateLevelTiming(S,U,j,p.partial)},a.getCurrentContext=function(p){var g=this.levels,S=p.level,U=p.sn,j=p.part;if(!g||!g[S])return this.warn("Levels object was unset while buffering fragment "+U+" of level "+S+". The current chunk will not be buffered."),null;var G=g[S],N=j>-1?Object(w.getPartWith)(G,U,j):null,I=N?N.fragment:Object(w.getFragmentWithSN)(G,U,this.fragCurrent);return I?{frag:I,part:N,level:G}:null},a.bufferFragmentData=function(p,g,S,U){if(!p||this.state!==y.PARSING)return;var j=p.data1,G=p.data2,N=j;if(j&&G&&(N=Object(C.appendUint8Array)(j,G)),!N||!N.length)return;var I={type:p.type,frag:g,part:S,chunkMeta:U,parent:g.type,data:N};this.hls.trigger(O.Events.BUFFER_APPENDING,I),p.dropped&&p.independent&&!S&&this.flushBufferGap(g)},a.flushBufferGap=function(p){var g=this.media;if(!g)return;if(!B.BufferHelper.isBuffered(g,g.currentTime)){this.flushMainBuffer(0,p.start);return}var S=g.currentTime,U=B.BufferHelper.bufferInfo(g,S,0),j=p.duration,G=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),N=Math.max(Math.min(p.start-G,U.end-G),S+G);p.start-N>G&&this.flushMainBuffer(N,p.start)},a.getFwdBufferInfo=function(p,g){var S=this.config,U=this.getLoadPosition();if(!Object(H.isFiniteNumber)(U))return null;var j=B.BufferHelper.bufferInfo(p,U,S.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var G=this.fragmentTracker.getBufferedFrag(U,g);if(G&&j.nextStart<G.end)return B.BufferHelper.bufferInfo(p,U,Math.max(j.nextStart,S.maxBufferHole))}return j},a.getMaxBufferLength=function(p){var g=this.config,S;return p?S=Math.max(8*g.maxBufferSize/p,g.maxBufferLength):S=g.maxBufferLength,Math.min(S,g.maxMaxBufferLength)},a.reduceMaxBufferLength=function(p){var g=this.config,S=p||g.maxBufferLength;return g.maxMaxBufferLength>=S?(g.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+g.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(p,g){var S,U,j=g.fragments,G=j.length;if(!G)return null;var N=this.config,I=j[0].start,V;if(g.live){var Q=N.initialLiveManifestSize;if(G<Q)return this.warn("Not enough fragments to start playback (have: "+G+", need: "+Q+")"),null;!g.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(V=this.getInitialLiveFragment(g,j),this.startPosition=V?this.hls.liveSyncPosition||V.start:p)}else p<=I&&(V=j[0]);if(!V){var ne=N.lowLatencyMode?g.partEnd:g.fragmentEnd;V=this.getFragmentAtPosition(p,ne,g)}return(S=V)!==null&&S!==void 0&&S.initSegment&&!((U=V)!==null&&U!==void 0&&U.initSegment.data)&&!this.bitrateTest&&(V=V.initSegment),V},a.getNextPart=function(p,g,S){for(var U=-1,j=!1,G=!0,N=0,I=p.length;N<I;N++){var V=p[N];if(G=G&&!V.independent,U>-1&&S<V.start)break;var Q=V.loaded;!Q&&(j||V.independent||G)&&V.fragment===g&&(U=N),j=Q}return U},a.loadedEndOfParts=function(p,g){var S=p[p.length-1];return S&&g>S.start&&S.loaded},a.getInitialLiveFragment=function(p,g){var S=this.fragPrevious,U=null;if(S){if(p.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+S.programDateTime),U=Object(A.findFragmentByPDT)(g,S.endProgramDateTime,this.config.maxFragLookUpTolerance)),!U){var j=S.sn+1;if(j>=p.startSN&&j<=p.endSN){var G=g[j-p.startSN];S.cc===G.cc&&(U=G,this.log("Live playlist, switching playlist, load frag with next SN: "+U.sn))}U||(U=Object(A.findFragWithCC)(g,S.cc),U&&this.log("Live playlist, switching playlist, load frag with same CC: "+U.sn))}}else{var N=this.hls.liveSyncPosition;N!==null&&(U=this.getFragmentAtPosition(N,this.bitrateTest?p.fragmentEnd:p.edge,p))}return U},a.getFragmentAtPosition=function(p,g,S){var U=this.config,j=this.fragPrevious,G=S.fragments,N=S.endSN,I=S.fragmentHint,V=U.maxFragLookUpTolerance,Q=!!(U.lowLatencyMode&&S.partList&&I);Q&&I&&!this.bitrateTest&&(G=G.concat(I),N=I.sn);var ne;if(p<g){var se=p>g-V?0:V;ne=Object(A.findFragmentByPTS)(j,G,p,se)}else ne=G[G.length-1];if(ne){var xe=ne.sn-S.startSN,me=j&&ne.level===j.level,Le=G[xe+1],Ee=this.fragmentTracker.getState(ne);if(Ee===P.FragmentState.BACKTRACKED){ne=null;for(var Te=xe;G[Te]&&this.fragmentTracker.getState(G[Te])===P.FragmentState.BACKTRACKED;)j?ne=G[Te--]:ne=G[--Te];ne||(ne=Le)}else j&&ne.sn===j.sn&&!Q&&(me&&(ne.sn<N&&this.fragmentTracker.getState(Le)!==P.FragmentState.OK?(this.log("SN "+ne.sn+" just loaded, load next one: "+Le.sn),ne=Le):ne=null))}return ne},a.synchronizeToLiveEdge=function(p){var g=this.config,S=this.media;if(!S)return;var U=this.hls.liveSyncPosition,j=S.currentTime,G=p.fragments[0].start,N=p.edge,I=j>=G-g.maxFragLookUpTolerance&&j<=N;if(U!==null&&S.duration>U&&(j<U||!I)){var V=g.liveMaxLatencyDuration!==void 0?g.liveMaxLatencyDuration:g.liveMaxLatencyDurationCount*p.targetduration;(!I&&S.readyState<4||j<N-V)&&(this.loadedmetadata||(this.nextLoadPosition=U),S.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+N+", reset currentTime to : "+U.toFixed(3)),S.currentTime=U))}},a.alignPlaylists=function(p,g){var S=this.levels,U=this.levelLastLoaded,j=this.fragPrevious,G=U!==null?S[U]:null,N=p.fragments.length;if(!N)return this.warn("No fragments in live playlist"),0;var I=p.fragments[0].start,V=!g,Q=p.alignedSliding&&Object(H.isFiniteNumber)(I);if(V||!Q&&!I){Object(R.alignStream)(j,G,p);var ne=p.fragments[0].start;return this.log("Live playlist sliding: "+ne.toFixed(2)+" start-sn: "+(g?g.startSN:"na")+"->"+p.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+N),ne}return I},a.waitForCdnTuneIn=function(p){var g=3;return p.live&&p.canBlockReload&&p.tuneInGoal>Math.max(p.partHoldBack,p.partTarget*g)},a.setStartPosition=function(p,g){var S=this.startPosition;if(S<g&&(S=-1),S===-1||this.lastCurrentTime===-1){var U=p.startTimeOffset;Object(H.isFiniteNumber)(U)?(S=g+U,U<0&&(S+=p.totalduration),S=Math.min(Math.max(g,S),g+p.totalduration),this.log("Start time offset "+U+" found in playlist, adjust startPosition to "+S),this.startPosition=S):p.live?S=this.hls.liveSyncPosition||g:this.startPosition=S=0,this.lastCurrentTime=S}this.nextLoadPosition=S},a.getLoadPosition=function(){var p=this.media,g=0;return this.loadedmetadata&&p?g=p.currentTime:this.nextLoadPosition&&(g=this.nextLoadPosition),g},a.handleFragLoadAborted=function(p,g){this.transmuxer&&p.sn!=="initSegment"&&p.stats.aborted&&(this.warn("Fragment "+p.sn+(g?" part"+g.index:"")+" of level "+p.level+" was aborted"),this.resetFragmentLoading(p))},a.resetFragmentLoading=function(p){(!this.fragCurrent||!this.fragContextChanged(p))&&(this.state=y.IDLE)},a.onFragmentOrKeyLoadError=function(p,g){if(g.fatal)return;var S=g.frag;if(!S||S.type!==p)return;var U=this.fragCurrent;console.assert(U&&S.sn===U.sn&&S.level===U.level&&S.urlId===U.urlId,"Frag load error must match current frag to retry");var j=this.config;if(this.fragLoadError+1<=j.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(S.level))return;var G=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+S.sn+" of "+p+" "+S.level+" failed to load, retrying in "+G+"ms"),this.retryDate=self.performance.now()+G,this.fragLoadError++,this.state=y.FRAG_LOADING_WAITING_RETRY}else g.levelRetry?(p===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=y.IDLE):(k.logger.error(g.details+" reaches max retry, redispatch as fatal ..."),g.fatal=!0,this.hls.stopLoad(),this.state=y.ERROR)},a.afterBufferFlushed=function(p,g,S){if(!p)return;var U=B.BufferHelper.getBuffered(p);this.fragmentTracker.detectEvictedFragments(g,U,S),this.state===y.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=y.IDLE},a.resetLiveStartWhenNotLoaded=function(p){if(!this.loadedmetadata){this.startFragRequested=!1;var g=this.levels?this.levels[p].details:null;if(g!=null&&g.live)return this.startPosition=-1,this.setStartPosition(g,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(p,g,S,U){var j=this,G=S.details;console.assert(!!G,"level.details must be defined");var N=Object.keys(p.elementaryStreams).reduce(function(I,V){var Q=p.elementaryStreams[V];if(Q){var ne=Q.endPTS-Q.startPTS;if(ne<=0)return j.warn("Could not parse fragment "+p.sn+" "+V+" duration reliably ("+ne+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),I||!1;var se=U?0:Object(w.updateFragPTSDTS)(G,p,Q.startPTS,Q.endPTS,Q.startDTS,Q.endDTS);return j.hls.trigger(O.Events.LEVEL_PTS_UPDATED,{details:G,level:S,drift:se,type:V,frag:p,start:Q.startPTS,end:Q.endPTS}),!0}return I},!1);N?(this.state=y.PARSED,this.hls.trigger(O.Events.FRAG_PARSED,{frag:p,part:g})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},x(l,[{key:"state",get:function(){return this._state},set:function(p){var g=this._state;g!==p&&(this._state=p,this.log(g+"->"+p))}}]),l}(M.default)},"./src/controller/buffer-controller.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"default",function(){return A});var H=D("./src/polyfills/number.ts"),M=D("./src/events.ts"),P=D("./src/utils/logger.ts"),B=D("./src/errors.ts"),k=D("./src/utils/buffer-helper.ts"),O=D("./src/utils/mediasource-helper.ts"),L=D("./src/loader/fragment.ts"),E=D("./src/controller/buffer-operation-queue.ts"),C=Object(O.getMediaSource)(),R=/([ha]vc.)(?:\.[^.,]+)+/,A=function(){function w(d){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,u=o.media,x=o.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),u&&(o.updateMediaElementDuration(),s.trigger(M.Events.MEDIA_ATTACHED,{media:u})),x&&x.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var b=w.prototype;return b.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},b.destroy=function(){this.unregisterListeners(),this.details=null},b.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)},b.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)},b._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new E.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},b.onManifestParsed=function(o,s){var u=2;(s.audio&&!s.video||!s.altAudio)&&(u=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=u,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},b.onMediaAttaching=function(o,s){var u=this.media=s.media;if(u&&C){var x=this.mediaSource=new C;x.addEventListener("sourceopen",this._onMediaSourceOpen),x.addEventListener("sourceended",this._onMediaSourceEnded),x.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(x),this._objectUrl=u.src}},b.onMediaDetaching=function(){var o=this.media,s=this.mediaSource,u=this._objectUrl;if(s){if(P.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(x){P.logger.warn("[buffer-controller]: onMediaDetaching: "+x.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(u&&self.URL.revokeObjectURL(u),o.src===u?(o.removeAttribute("src"),o.load()):P.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(M.Events.MEDIA_DETACHED,void 0)},b.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(s){var u=o.sourceBuffer[s];try{u&&(o.removeBufferListeners(s),o.mediaSource&&o.mediaSource.removeSourceBuffer(u),o.sourceBuffer[s]=void 0)}catch(x){P.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",x)}}),this._initSourceBuffer()},b.onBufferCodecs=function(o,s){var u=this,x=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(f){if(x){var m=u.tracks[f];if(m&&typeof m.buffer.changeType=="function"){var _=s[f],y=_.codec,h=_.levelCodec,c=_.container,l=(m.levelCodec||m.codec).replace(R,"$1"),a=(h||y).replace(R,"$1");if(l!==a){var v=c+";codecs="+(h||y);u.appendChangeType(f,v)}}}else u.pendingTracks[f]=s[f]}),x)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},b.appendChangeType=function(o,s){var u=this,x=this.operationQueue,f={execute:function(){var _=u.sourceBuffer[o];_&&(P.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+s),_.changeType(s)),x.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(_){P.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",_)}};x.append(f,o)},b.onBufferAppending=function(o,s){var u=this,x=this.hls,f=this.operationQueue,m=this.tracks,_=s.data,y=s.type,h=s.frag,c=s.part,l=s.chunkMeta,a=l.buffering[y],v=self.performance.now();a.start=v;var p=h.stats.buffering,g=c?c.stats.buffering:null;p.start===0&&(p.start=v),g&&g.start===0&&(g.start=v);var S=m.audio,U=y==="audio"&&l.id===1&&(S==null?void 0:S.container)==="audio/mpeg",j={execute:function(){if(a.executeStart=self.performance.now(),U){var N=u.sourceBuffer[y];if(N){var I=h.start-N.timestampOffset;Math.abs(I)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+I+") sn: "+h.sn+")"),N.timestampOffset=h.start)}}u.appendExecutor(_,y)},onStart:function(){},onComplete:function(){var N=self.performance.now();a.executeEnd=a.end=N,p.first===0&&(p.first=N),g&&g.first===0&&(g.first=N);var I=u.sourceBuffer,V={};for(var Q in I)V[Q]=k.BufferHelper.getBuffered(I[Q]);u.appendError=0,u.hls.trigger(M.Events.BUFFER_APPENDED,{type:y,frag:h,part:c,chunkMeta:l,parent:h.type,timeRanges:V})},onError:function(N){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+y+" SourceBuffer",N);var I={type:B.ErrorTypes.MEDIA_ERROR,parent:h.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:N,fatal:!1};N.code===DOMException.QUOTA_EXCEEDED_ERR?I.details=B.ErrorDetails.BUFFER_FULL_ERROR:(u.appendError++,I.details=B.ErrorDetails.BUFFER_APPEND_ERROR,u.appendError>x.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+x.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),I.fatal=!0)),x.trigger(M.Events.ERROR,I)}};f.append(j,y)},b.onBufferFlushing=function(o,s){var u=this,x=this.operationQueue,f=function(_){return{execute:u.removeExecutor.bind(u,_,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(M.Events.BUFFER_FLUSHED,{type:_})},onError:function(h){P.logger.warn("[buffer-controller]: Failed to remove from "+_+" SourceBuffer",h)}}};s.type?x.append(f(s.type),s.type):this.getSourceBufferTypes().forEach(function(m){x.append(f(m),m)})},b.onFragParsed=function(o,s){var u=this,x=s.frag,f=s.part,m=[],_=f?f.elementaryStreams:x.elementaryStreams;_[L.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(_[L.ElementaryStreamTypes.AUDIO]&&m.push("audio"),_[L.ElementaryStreamTypes.VIDEO]&&m.push("video"));var y=function(){var c=self.performance.now();x.stats.buffering.end=c,f&&(f.stats.buffering.end=c);var l=f?f.stats:x.stats;u.hls.trigger(M.Events.FRAG_BUFFERED,{frag:x,part:f,stats:l,id:x.type})};m.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+x.type+" level: "+x.level+" sn: "+x.sn),this.blockBuffers(y,m)},b.onFragChanged=function(o,s){this.flushBackBuffer()},b.onBufferEos=function(o,s){var u=this,x=this.getSourceBufferTypes().reduce(function(f,m){var _=u.sourceBuffer[m];return(!s.type||s.type===m)&&(_&&!_.ended&&(_.ended=!0,P.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),f&&!!(!_||_.ended)},!0);x&&this.blockBuffers(function(){var f=u.mediaSource;if(!f||f.readyState!=="open")return;f.endOfStream()})},b.onLevelUpdated=function(o,s){var u=s.details;if(!u.fragments.length)return;this.details=u,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},b.flushBackBuffer=function(){var o=this.hls,s=this.details,u=this.media,x=this.sourceBuffer;if(!u||s===null)return;var f=this.getSourceBufferTypes();if(!f.length)return;var m=s.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(H.isFiniteNumber)(m)||m<0)return;var _=u.currentTime,y=s.levelTargetDuration,h=Math.max(m,y),c=Math.floor(_/y)*y-h;f.forEach(function(l){var a=x[l];if(a){var v=k.BufferHelper.getBuffered(a);v.length>0&&c>v.start(0)&&(o.trigger(M.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),s.live&&o.trigger(M.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(M.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:l}))}})},b.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,s=this.hls,u=this.media,x=this.mediaSource,f=o.fragments[0].start+o.totalduration,m=u.duration,_=Object(H.isFiniteNumber)(x.duration)?x.duration:0;o.live&&s.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),x.duration=Infinity,this.updateSeekableRange(o)):(f>_&&f>m||!Object(H.isFiniteNumber)(m))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+f.toFixed(3)),x.duration=f)},b.updateSeekableRange=function(o){var s=this.mediaSource,u=o.fragments,x=u.length;if(x&&o.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var f=Math.max(0,u[0].start),m=Math.max(f,f+o.totalduration);s.setLiveSeekableRange(f,m)}},b.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,s=this.operationQueue,u=this.pendingTracks,x=Object.keys(u).length;if(x&&!o||x===2){this.createSourceBuffers(u),this.pendingTracks={};var f=this.getSourceBufferTypes();if(f.length===0){this.hls.trigger(M.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}f.forEach(function(m){s.executeNext(m)})}},b.createSourceBuffers=function(o){var s=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var x=0;for(var f in o)if(!s[f]){var m=o[f];if(!m)throw Error("source buffer exists for track "+f+", however track does not");var _=m.levelCodec||m.codec,y=m.container+";codecs="+_;P.logger.log("[buffer-controller]: creating sourceBuffer("+y+")");try{var h=s[f]=u.addSourceBuffer(y),c=f;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[f]={buffer:h,codec:_,container:m.container,levelCodec:m.levelCodec,id:m.id},x++}catch(l){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+l.message),this.hls.trigger(M.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:l,mimeType:y})}}x&&this.hls.trigger(M.Events.BUFFER_CREATED,{tracks:this.tracks})},b._onSBUpdateStart=function(o){var s=this.operationQueue,u=s.current(o);u.onStart()},b._onSBUpdateEnd=function(o){var s=this.operationQueue,u=s.current(o);u.onComplete(),s.shiftAndExecuteNext(o)},b._onSBUpdateError=function(o,s){P.logger.error("[buffer-controller]: "+o+" SourceBuffer error",s),this.hls.trigger(M.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var u=this.operationQueue.current(o);u&&u.onError(s)},b.removeExecutor=function(o,s,u){var x=this.media,f=this.mediaSource,m=this.operationQueue,_=this.sourceBuffer,y=_[o];if(!x||!f||!y){P.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(o);return}var h=Object(H.isFiniteNumber)(x.duration)?x.duration:Infinity,c=Object(H.isFiniteNumber)(f.duration)?f.duration:Infinity,l=Math.max(0,s),a=Math.min(u,h,c);a>l?(P.logger.log("[buffer-controller]: Removing ["+l+","+a+"] from the "+o+" SourceBuffer"),console.assert(!y.updating,o+" sourceBuffer must not be updating"),y.remove(l,a)):m.shiftAndExecuteNext(o)},b.appendExecutor=function(o,s){var u=this.operationQueue,x=this.sourceBuffer,f=x[s];if(!f){P.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(s);return}f.ended=!1,console.assert(!f.updating,s+" sourceBuffer must not be updating"),f.appendBuffer(o)},b.blockBuffers=function(o,s){var u=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var x=this.operationQueue,f=s.map(function(m){return x.appendBlocker(m)});Promise.all(f).then(function(){o(),s.forEach(function(m){var _=u.sourceBuffer[m];(!_||!_.updating)&&x.shiftAndExecuteNext(m)})})},b.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},b.addBufferListener=function(o,s,u){var x=this.sourceBuffer[o];if(!x)return;var f=u.bind(this,o);this.listeners[o].push({event:s,listener:f}),x.addEventListener(s,f)},b.removeBufferListeners=function(o){var s=this.sourceBuffer[o];if(!s)return;this.listeners[o].forEach(function(u){s.removeEventListener(u.event,u.listener)})},w}()},"./src/controller/buffer-operation-queue.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"default",function(){return M});var H=D("./src/utils/logger.ts"),M=function(){function P(k){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=k}var B=P.prototype;return B.append=function(O,L){var E=this.queues[L];E.push(O),E.length===1&&this.buffers[L]&&this.executeNext(L)},B.insertAbort=function(O,L){var E=this.queues[L];E.unshift(O),this.executeNext(L)},B.appendBlocker=function(O){var L,E=new Promise(function(R){L=R}),C={execute:L,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(C,O),E},B.executeNext=function(O){var L=this.buffers,E=this.queues,C=L[O],R=E[O];if(R.length){var A=R[0];try{A.execute()}catch(w){H.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),A.onError(w),(!C||!C.updating)&&(R.shift(),this.executeNext(O))}}},B.shiftAndExecuteNext=function(O){this.queues[O].shift(),this.executeNext(O)},B.current=function(O){return this.queues[O][0]},P}()},"./src/controller/cap-level-controller.ts":function(te,K,D){"use strict";D.r(K);var H=D("./src/events.ts");function M(k,O){for(var L=0;L<O.length;L++){var E=O[L];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(k,E.key,E)}}function P(k,O,L){return O&&M(k.prototype,O),L&&M(k,L),k}var B=function(){function k(L){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=L,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var O=k.prototype;return O.setStreamController=function(E){this.streamController=E},O.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},O.registerListeners=function(){var E=this.hls;E.on(H.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.on(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.unregisterListener=function(){var E=this.hls;E.off(H.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.off(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.onFpsDropLevelCapping=function(E,C){k.isLevelAllowed(C.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(C.droppedLevel)},O.onMediaAttaching=function(E,C){this.media=C.media instanceof HTMLVideoElement?C.media:null},O.onManifestParsed=function(E,C){var R=this.hls;this.restrictedLevels=[],this.firstLevel=C.firstLevel,R.config.capLevelToPlayerSize&&C.video&&this.startCapping()},O.onBufferCodecs=function(E,C){var R=this.hls;R.config.capLevelToPlayerSize&&C.video&&this.startCapping()},O.onMediaDetaching=function(){this.stopCapping()},O.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var E=this.hls.levels;if(E.length){var C=this.hls;C.autoLevelCapping=this.getMaxLevel(E.length-1),C.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=C.autoLevelCapping}}},O.getMaxLevel=function(E){var C=this,R=this.hls.levels;if(!R.length)return-1;var A=R.filter(function(w,b){return k.isLevelAllowed(b,C.restrictedLevels)&&b<=E});return this.clientRect=null,k.getMaxLevelByMediaSize(A,this.mediaWidth,this.mediaHeight)},O.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()},O.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},O.getDimensions=function(){if(this.clientRect)return this.clientRect;var E=this.media,C={width:0,height:0};if(E){var R=E.getBoundingClientRect();C.width=R.width,C.height=R.height,!C.width&&!C.height&&(C.width=R.right-R.left||E.width||0,C.height=R.bottom-R.top||E.height||0)}return this.clientRect=C,C},k.isLevelAllowed=function(E,C){return C===void 0&&(C=[]),C.indexOf(E)===-1},k.getMaxLevelByMediaSize=function(E,C,R){if(!E||!E.length)return-1;for(var A=function(s,u){return u?s.width!==u.width||s.height!==u.height:!0},w=E.length-1,b=0;b<E.length;b+=1){var d=E[b];if((d.width>=C||d.height>=R)&&A(d,E[b+1])){w=b;break}}return w},P(k,[{key:"mediaWidth",get:function(){return this.getDimensions().width*k.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*k.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var E=1;try{E=self.devicePixelRatio}catch(C){}return E}}]),k}();K.default=B},"./src/controller/cmcd-controller.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"default",function(){return A});var H=D("./src/events.ts"),M=D("./src/types/cmcd.ts"),P=D("./src/utils/buffer-helper.ts"),B=D("./src/utils/logger.ts");function k(w,b){for(var d=0;d<b.length;d++){var o=b[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(w,o.key,o)}}function O(w,b,d){return b&&k(w.prototype,b),d&&k(w,d),w}function L(w,b){var d=typeof Symbol!="undefined"&&w[Symbol.iterator]||w["@@iterator"];if(d)return(d=d.call(w)).next.bind(d);if(Array.isArray(w)||(d=E(w))||b&&w&&typeof w.length=="number"){d&&(w=d);var o=0;return function(){return o>=w.length?{done:!0}:{done:!1,value:w[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E(w,b){if(!w)return;if(typeof w=="string")return C(w,b);var d=Object.prototype.toString.call(w).slice(8,-1);if(d==="Object"&&w.constructor&&(d=w.constructor.name),d==="Map"||d==="Set")return Array.from(w);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return C(w,b)}function C(w,b){(b==null||b>w.length)&&(b=w.length);for(var d=0,o=new Array(b);d<b;d++)o[d]=w[d];return o}function R(){return R=Object.assign||function(w){for(var b=1;b<arguments.length;b++){var d=arguments[b];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(w[o]=d[o])}return w},R.apply(this,arguments)}var A=function(){function w(d){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(x){try{o.apply(x,{ot:M.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(f){B.logger.warn("Could not generate manifest CMCD data.",f)}},this.applyFragmentData=function(x){try{var f=x.frag,m=o.hls.levels[f.level],_=o.getObjectType(f),y={d:f.duration*1e3,ot:_};(_===M.CMCDObjectType.VIDEO||_===M.CMCDObjectType.AUDIO||_==M.CMCDObjectType.MUXED)&&(y.br=m.bitrate/1e3,y.tb=o.getTopBandwidth(_),y.bl=o.getBufferLength(_)),o.apply(x,y)}catch(h){B.logger.warn("Could not generate segment CMCD data.",h)}},this.hls=d;var s=this.config=d.config,u=s.cmcd;u!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=u.sessionId||w.uuid(),this.cid=u.contentId,this.useHeaders=u.useHeaders===!0,this.registerListeners())}var b=w.prototype;return b.registerListeners=function(){var o=this.hls;o.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(H.Events.BUFFER_CREATED,this.onBufferCreated,this)},b.unregisterListeners=function(){var o=this.hls;o.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(H.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},b.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},b.onMediaAttached=function(o,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},b.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},b.onBufferCreated=function(o,s){var u,x;this.audioBuffer=(u=s.tracks.audio)===null||u===void 0?void 0:u.buffer,this.videoBuffer=(x=s.tracks.video)===null||x===void 0?void 0:x.buffer},b.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}},b.apply=function(o,s){s===void 0&&(s={}),R(s,this.createData());var u=s.ot===M.CMCDObjectType.INIT||s.ot===M.CMCDObjectType.VIDEO||s.ot===M.CMCDObjectType.MUXED;if(this.starved&&u&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var x=w.toHeaders(s);if(!Object.keys(x).length)return;o.headers||(o.headers={}),R(o.headers,x)}else{var f=w.toQuery(s);if(!f)return;o.url=w.appendQueryToUri(o.url,f)}},b.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},b.getTopBandwidth=function(o){for(var s=0,u=o===M.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,x=L(u),f;!(f=x()).done;){var m=f.value;m.bitrate>s&&(s=m.bitrate)}return s>0?s:NaN},b.getBufferLength=function(o){var s=this.hls.media,u=o===M.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!s)return NaN;var x=P.BufferHelper.bufferInfo(u,s.currentTime,this.config.maxBufferHole);return x.len*1e3},b.createPlaylistLoader=function(){var o=this.config.pLoader,s=this.applyPlaylistData,u=o||this.config.loader;return function(){function x(m){this.loader=void 0,this.loader=new u(m)}var f=x.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(_,y,h){s(_),this.loader.load(_,y,h)},O(x,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),x}()},b.createFragmentLoader=function(){var o=this.config.fLoader,s=this.applyFragmentData,u=o||this.config.loader;return function(){function x(m){this.loader=void 0,this.loader=new u(m)}var f=x.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(_,y,h){s(_),this.loader.load(_,y,h)},O(x,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),x}()},w.uuid=function(){var o=URL.createObjectURL(new Blob),s=o.toString();return URL.revokeObjectURL(o),s.substr(s.lastIndexOf("/")+1)},w.serialize=function(o){for(var s=[],u=function(U){return!Number.isNaN(U)&&U!=null&&U!==""&&U!==!1},x=function(U){return Math.round(U)},f=function(U){return x(U/100)*100},m=function(U){return encodeURIComponent(U)},_={br:x,d:x,bl:f,dl:f,mtp:f,nor:m,rtp:f,tb:x},y=Object.keys(o||{}).sort(),h=L(y),c;!(c=h()).done;){var l=c.value,a=o[l];if(!u(a))continue;if(l==="v"&&a===1)continue;if(l=="pr"&&a===1)continue;var v=_[l];v&&(a=v(a));var p=typeof a,g=void 0;l==="ot"||l==="sf"||l==="st"?g=l+"="+a:p==="boolean"?g=l:p==="number"?g=l+"="+a:g=l+"="+JSON.stringify(a),s.push(g)}return s.join(",")},w.toHeaders=function(o){for(var s=Object.keys(o),u={},x=["Object","Request","Session","Status"],f=[{},{},{},{}],m={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},_=0,y=s;_<y.length;_++){var h=y[_],c=m[h]!=null?m[h]:1;f[c][h]=o[h]}for(var l=0;l<f.length;l++){var a=w.serialize(f[l]);a&&(u["CMCD-"+x[l]]=a)}return u},w.toQuery=function(o){return"CMCD="+encodeURIComponent(w.serialize(o))},w.appendQueryToUri=function(o,s){if(!s)return o;var u=o.includes("?")?"&":"?";return""+o+u+s},w}()},"./src/controller/eme-controller.ts":function(te,K,D){"use strict";D.r(K);var H=D("./src/events.ts"),M=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),B=D("./src/utils/mediakeys-helper.ts");function k(A,w){for(var b=0;b<w.length;b++){var d=w[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(A,d.key,d)}}function O(A,w,b){return w&&k(A.prototype,w),b&&k(A,b),A}var L=3,E=function(w,b,d){var o={audioCapabilities:[],videoCapabilities:[]};return w.forEach(function(s){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:d.audioRobustness||""})}),b.forEach(function(s){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:d.videoRobustness||""})}),[o]},C=function(w,b,d,o){switch(w){case B.KeySystems.WIDEVINE:return E(b,d,o);default:throw new Error("Unknown key-system: "+w)}},R=function(){function A(b){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=b,this._config=b.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 w=A.prototype;return w.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},w._registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w._unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w.getLicenseServerUrl=function(d){switch(d){case B.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},w._attemptKeySystemAccess=function(d,o,s){var u=this,x=C(d,o,s,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var f=this.requestMediaKeySystemAccess(d,x);this.mediaKeysPromise=f.then(function(m){return u._onMediaKeySystemAccessObtained(d,m)}),f.catch(function(m){P.logger.error('Failed to obtain key-system "'+d+'" access:',m)})},w._onMediaKeySystemAccessObtained=function(d,o){var s=this;P.logger.log('Access for key-system "'+d+'" obtained');var u={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:d};this._mediaKeysList.push(u);var x=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(f){return u.mediaKeys=f,P.logger.log('Media-keys created for key-system "'+d+'"'),s._onMediaKeysCreated(),f});return x.catch(function(f){P.logger.error("Failed to create media-keys:",f)}),x},w._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),d._onNewMediaKeySession(o.mediaKeysSession))})},w._onNewMediaKeySession=function(d){var o=this;P.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(s){o._onKeySessionMessage(d,s.message)},!1)},w._onKeySessionMessage=function(d,o){P.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(s){P.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),d.update(s)})},w.onMediaEncrypted=function(d){var o=this;if(P.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(x){if(!o._media)return;o._attemptSetMediaKeys(x),o._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(s).catch(s)},w._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}P.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},w._generateRequestWithPreferredKeySession=function(d,o){var s=this,u=this._mediaKeysList[0];if(!u){P.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(u.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var x=u.mediaKeysSession;if(!x){P.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){P.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}P.logger.log('Generating key-session request for "'+d+'" init data type'),u.mediaKeysSessionInitialized=!0,x.generateRequest(d,o).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(f){P.logger.error("Error generating key-session request:",f),s.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},w._createLicenseXhr=function(d,o,s){var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,u,d,o,s);var x=this._licenseXhrSetup;if(x)try{x.call(this.hls,u,d),x=void 0}catch(f){P.logger.error(f)}try{u.readyState||u.open("POST",d,!0),x&&x.call(this.hls,u,d)}catch(f){throw new Error("issue setting up KeySystem license XHR "+f)}return u},w._onLicenseRequestReadyStageChange=function(d,o,s,u){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var x=d.response,f=this._licenseResponseCallback;if(f)try{x=f.call(this.hls,d,o)}catch(_){P.logger.error(_)}u(x)}else{if(P.logger.error("License Request XHR failed ("+o+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>L){this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=L-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(s,u)}break}},w._generateLicenseRequestChallenge=function(d,o){switch(d.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},w._requestLicense=function(d,o){P.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var u=this.getLicenseServerUrl(s.mediaKeySystemDomain),x=this._createLicenseXhr(u,d,o);P.logger.log("Sending license request to URL: "+u);var f=this._generateLicenseRequestChallenge(s,d);x.send(f)}catch(m){P.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},w.onMediaAttached=function(d,o){if(!this._emeEnabled)return;var s=o.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},w.onMediaDetached=function(){var d=this._media,o=this._mediaKeysList;if(!d)return;d.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 d.setMediaKeys(null)}).catch(function(){})},w.onManifestParsed=function(d,o){if(!this._emeEnabled)return;var s=o.levels.map(function(x){return x.audioCodec}).filter(function(x){return!!x}),u=o.levels.map(function(x){return x.videoCodec}).filter(function(x){return!!x});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,s,u)},O(A,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),A}();K.default=R},"./src/controller/fps-controller.ts":function(te,K,D){"use strict";D.r(K);var H=D("./src/events.ts"),M=D("./src/utils/logger.ts"),P=function(){function B(O){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=O,this.registerListeners()}var k=B.prototype;return k.setStreamController=function(L){this.streamController=L},k.registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},k.unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching)},k.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},k.onMediaAttaching=function(L,E){var C=this.hls.config;if(C.capLevelOnFPSDrop){var R=E.media instanceof self.HTMLVideoElement?E.media:null;this.media=R,R&&typeof R.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),C.fpsDroppedMonitoringPeriod)}},k.checkFPS=function(L,E,C){var R=performance.now();if(E){if(this.lastTime){var A=R-this.lastTime,w=C-this.lastDroppedFrames,b=E-this.lastDecodedFrames,d=1e3*w/A,o=this.hls;if(o.trigger(H.Events.FPS_DROP,{currentDropped:w,currentDecoded:b,totalDroppedFrames:C}),d>0&&w>o.config.fpsDroppedMonitoringThreshold*b){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(H.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:o.currentLevel}),o.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=R,this.lastDroppedFrames=C,this.lastDecodedFrames=E}},k.checkFPSInterval=function(){var L=this.media;if(L)if(this.isVideoPlaybackQualityAvailable){var E=L.getVideoPlaybackQuality();this.checkFPS(L,E.totalVideoFrames,E.droppedVideoFrames)}else this.checkFPS(L,L.webkitDecodedFrameCount,L.webkitDroppedFrameCount)},B}();K.default=P},"./src/controller/fragment-finders.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"findFragmentByPDT",function(){return P}),D.d(K,"findFragmentByPTS",function(){return B}),D.d(K,"fragmentWithinToleranceTest",function(){return k}),D.d(K,"pdtWithinToleranceTest",function(){return O}),D.d(K,"findFragWithCC",function(){return L});var H=D("./src/polyfills/number.ts"),M=D("./src/utils/binary-search.ts");function P(E,C,R){if(C===null||!Array.isArray(E)||!E.length||!Object(H.isFiniteNumber)(C))return null;var A=E[0].programDateTime;if(C<(A||0))return null;var w=E[E.length-1].endProgramDateTime;if(C>=(w||0))return null;R=R||0;for(var b=0;b<E.length;++b){var d=E[b];if(O(C,R,d))return d}return null}function B(E,C,R,A){R===void 0&&(R=0),A===void 0&&(A=0);var w=null;if(E?w=C[E.sn-C[0].sn+1]||null:R===0&&C[0].start===0&&(w=C[0]),w&&k(R,A,w)===0)return w;var b=M.default.search(C,k.bind(null,R,A));return b||w}function k(E,C,R){E===void 0&&(E=0),C===void 0&&(C=0);var A=Math.min(C,R.duration+(R.deltaPTS?R.deltaPTS:0));return R.start+R.duration-A<=E?1:R.start-A>E&&R.start?-1:0}function O(E,C,R){var A=Math.min(C,R.duration+(R.deltaPTS?R.deltaPTS:0))*1e3,w=R.endProgramDateTime||0;return w-A>E}function L(E,C){return M.default.search(E,function(R){return R.cc<C?1:R.cc>C?-1:0})}},"./src/controller/fragment-tracker.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"FragmentState",function(){return P}),D.d(K,"FragmentTracker",function(){return B});var H=D("./src/events.ts"),M=D("./src/types/loader.ts"),P;(function(L){L.NOT_LOADED="NOT_LOADED",L.BACKTRACKED="BACKTRACKED",L.APPENDING="APPENDING",L.PARTIAL="PARTIAL",L.OK="OK"})(P||(P={}));var B=function(){function L(C){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=C,this._registerListeners()}var E=L.prototype;return E._registerListeners=function(){var R=this.hls;R.on(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.on(H.Events.FRAG_LOADED,this.onFragLoaded,this)},E._unregisterListeners=function(){var R=this.hls;R.off(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.off(H.Events.FRAG_LOADED,this.onFragLoaded,this)},E.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},E.getAppendedFrag=function(R,A){if(A===M.PlaylistLevelType.MAIN){var w=this.activeFragment,b=this.activeParts;if(!w)return null;if(b)for(var d=b.length;d--;){var o=b[d],s=o?o.end:w.appendedPTS;if(o.start<=R&&s!==void 0&&R<=s)return d>9&&(this.activeParts=b.slice(d-9)),o}else if(w.start<=R&&w.appendedPTS!==void 0&&R<=w.appendedPTS)return w}return this.getBufferedFrag(R,A)},E.getBufferedFrag=function(R,A){for(var w=this.fragments,b=Object.keys(w),d=b.length;d--;){var o=w[b[d]];if((o==null?void 0:o.body.type)===A&&o.buffered){var s=o.body;if(s.start<=R&&R<=s.end)return s}}return null},E.detectEvictedFragments=function(R,A,w){var b=this;Object.keys(this.fragments).forEach(function(d){var o=b.fragments[d];if(!o)return;if(!o.buffered){o.body.type===w&&b.removeFragment(o.body);return}var s=o.range[R];if(!s)return;s.time.some(function(u){var x=!b.isTimeBuffered(u.startPTS,u.endPTS,A);return x&&b.removeFragment(o.body),x})})},E.detectPartialFragments=function(R){var A=this,w=this.timeRanges,b=R.frag,d=R.part;if(!w||b.sn==="initSegment")return;var o=O(b),s=this.fragments[o];if(!s)return;Object.keys(w).forEach(function(u){var x=b.elementaryStreams[u];if(!x)return;var f=w[u],m=d!==null||x.partial===!0;s.range[u]=A.getBufferedTimes(b,d,m,f)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},E.fragBuffered=function(R){var A=O(R),w=this.fragments[A];w&&(w.backtrack=w.loaded=null,w.buffered=!0)},E.getBufferedTimes=function(R,A,w,b){for(var d={time:[],partial:w},o=A?A.start:R.start,s=A?A.end:R.end,u=R.minEndPTS||s,x=R.maxStartPTS||o,f=0;f<b.length;f++){var m=b.start(f)-this.bufferPadding,_=b.end(f)+this.bufferPadding;if(x>=m&&u<=_){d.time.push({startPTS:Math.max(o,b.start(f)),endPTS:Math.min(s,b.end(f))});break}else if(o<_&&s>m)d.partial=!0,d.time.push({startPTS:Math.max(o,b.start(f)),endPTS:Math.min(s,b.end(f))});else if(s<=m)break}return d},E.getPartialFragment=function(R){var A=null,w,b,d,o=0,s=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(x){var f=u[x];if(!f)return;k(f)&&(b=f.body.start-s,d=f.body.end+s,R>=b&&R<=d&&(w=Math.min(R-b,d-R),o<=w&&(A=f.body,o=w)))}),A},E.getState=function(R){var A=O(R),w=this.fragments[A];return w?w.buffered?k(w)?P.PARTIAL:P.OK:w.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},E.backtrack=function(R,A){var w=O(R),b=this.fragments[w];if(!b||b.backtrack)return null;var d=b.backtrack=A||b.loaded;return b.loaded=null,d},E.getBacktrackData=function(R){var A=O(R),w=this.fragments[A];if(w){var b,d=w.backtrack;if(d!=null&&(b=d.payload)!==null&&b!==void 0&&b.byteLength)return d;this.removeFragment(R)}return null},E.isTimeBuffered=function(R,A,w){for(var b,d,o=0;o<w.length;o++){if(b=w.start(o)-this.bufferPadding,d=w.end(o)+this.bufferPadding,R>=b&&A<=d)return!0;if(A<=b)return!1}return!1},E.onFragLoaded=function(R,A){var w=A.frag,b=A.part;if(w.sn==="initSegment"||w.bitrateTest||b)return;var d=O(w);this.fragments[d]={body:w,loaded:A,backtrack:null,buffered:!1,range:Object.create(null)}},E.onBufferAppended=function(R,A){var w=this,b=A.frag,d=A.part,o=A.timeRanges;if(b.type===M.PlaylistLevelType.MAIN)if(this.activeFragment=b,d){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(d)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(u){var x=o[u];if(w.detectEvictedFragments(u,x),!d)for(var f=0;f<x.length;f++)b.appendedPTS=Math.max(x.end(f),b.appendedPTS||0)})},E.onFragBuffered=function(R,A){this.detectPartialFragments(A)},E.hasFragment=function(R){var A=O(R);return!!this.fragments[A]},E.removeFragmentsInRange=function(R,A,w){var b=this;Object.keys(this.fragments).forEach(function(d){var o=b.fragments[d];if(!o)return;if(o.buffered){var s=o.body;s.type===w&&s.start<A&&s.end>R&&b.removeFragment(s)}})},E.removeFragment=function(R){var A=O(R);R.stats.loaded=0,R.clearElementaryStreamInfo(),delete this.fragments[A]},E.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},L}();function k(L){var E,C;return L.buffered&&(((E=L.range.video)===null||E===void 0?void 0:E.partial)||((C=L.range.audio)===null||C===void 0?void 0:C.partial))}function O(L){return L.type+"_"+L.level+"_"+L.urlId+"_"+L.sn}},"./src/controller/gap-controller.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"STALL_MINIMUM_DURATION_MS",function(){return k}),D.d(K,"MAX_START_GAP_JUMP",function(){return O}),D.d(K,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return L}),D.d(K,"SKIP_BUFFER_RANGE_START",function(){return E}),D.d(K,"default",function(){return C});var H=D("./src/utils/buffer-helper.ts"),M=D("./src/errors.ts"),P=D("./src/events.ts"),B=D("./src/utils/logger.ts"),k=250,O=2,L=.1,E=.05,C=function(){function R(w,b,d,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=w,this.media=b,this.fragmentTracker=d,this.hls=o}var A=R.prototype;return A.destroy=function(){this.hls=this.fragmentTracker=this.media=null},A.poll=function(b){var d=this.config,o=this.media,s=this.stalled,u=o.currentTime,x=o.seeking,f=this.seeking&&!x,m=!this.seeking&&x;if(this.seeking=x,u!==b){if(this.moved=!0,s!==null){if(this.stallReported){var _=self.performance.now()-s;B.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(_)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||f)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!H.BufferHelper.getBuffered(o).length)return;var y=H.BufferHelper.bufferInfo(o,u,0),h=y.len>0,c=y.nextStart||0;if(!h&&!c)return;if(x){var l=y.len>O,a=!c||c-u>O&&!this.fragmentTracker.getPartialFragment(u);if(l||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var v,p=Math.max(c,y.start||0)-u,g=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,S=g==null||((v=g.details)===null||v===void 0)?void 0:v.live,U=S?g.details.targetduration*2:O;if(p>0&&p<=U){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(s===null){this.stalled=j;return}var G=j-s;!x&&G>=k&&this._reportStall(y.len);var N=H.BufferHelper.bufferInfo(o,u,d.maxBufferHole);this._tryFixBufferStall(N,G)},A._tryFixBufferStall=function(b,d){var o=this.config,s=this.fragmentTracker,u=this.media,x=u.currentTime,f=s.getPartialFragment(x);if(f){var m=this._trySkipBufferHole(f);if(m)return}b.len>o.maxBufferHole&&d>o.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},A._reportStall=function(b){var d=this.hls,o=this.media,s=this.stallReported;s||(this.stallReported=!0,B.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+b+")"),d.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:b}))},A._trySkipBufferHole=function(b){for(var d=this.config,o=this.hls,s=this.media,u=s.currentTime,x=0,f=H.BufferHelper.getBuffered(s),m=0;m<f.length;m++){var _=f.start(m);if(u+d.maxBufferHole>=x&&u<_){var y=Math.max(_+E,s.currentTime+L);return B.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+y),this.moved=!0,this.stalled=null,s.currentTime=y,b&&o.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+u+" to "+y,frag:b}),y}x=f.end(m)}return 0},A._tryNudgeBuffer=function(){var b=this.config,d=this.hls,o=this.media,s=o.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u<b.nudgeMaxRetry){var x=s+u*b.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+s+" to "+x),o.currentTime=x,d.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else B.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+b.nudgeMaxRetry+" nudges"),d.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},R}()},"./src/controller/id3-track-controller.ts":function(te,K,D){"use strict";D.r(K);var H=D("./src/events.ts"),M=D("./src/utils/texttrack-utils.ts"),P=D("./src/demux/id3.ts"),B=.25,k=function(){function O(E){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=E,this._registerListeners()}var L=O.prototype;return L.destroy=function(){this._unregisterListeners()},L._registerListeners=function(){var C=this.hls;C.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.on(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),C.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L._unregisterListeners=function(){var C=this.hls;C.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.off(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),C.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L.onMediaAttached=function(C,R){this.media=R.media},L.onMediaDetaching=function(){if(!this.id3Track)return;Object(M.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},L.getID3Track=function(C){if(!this.media)return;for(var R=0;R<C.length;R++){var A=C[R];if(A.kind==="metadata"&&A.label==="id3")return Object(M.sendAddTrackEvent)(A,this.media),A}return this.media.addTextTrack("metadata","id3")},L.onFragParsingMetadata=function(C,R){if(!this.media)return;var A=R.frag,w=R.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var b=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<w.length;d++){var o=P.getID3Frames(w[d].data);if(o){var s=w[d].pts,u=d<w.length-1?w[d+1].pts:A.end,x=u-s;x<=0&&(u=s+B);for(var f=0;f<o.length;f++){var m=o[f];if(!P.isTimeStampFrame(m)){var _=new b(s,u,"");_.value=m,this.id3Track.addCue(_)}}}}},L.onBufferFlushing=function(C,R){var A=R.startOffset,w=R.endOffset,b=R.type;if(!b||b==="audio"){var d=this.id3Track;d&&Object(M.removeCuesInRange)(d,A,w)}},O}();K.default=k},"./src/controller/latency-controller.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"default",function(){return O});var H=D("./src/errors.ts"),M=D("./src/events.ts"),P=D("./src/utils/logger.ts");function B(L,E){for(var C=0;C<E.length;C++){var R=E[C];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(L,R.key,R)}}function k(L,E,C){return E&&B(L.prototype,E),C&&B(L,C),L}var O=function(){function L(C){var R=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return R.timeupdate()},this.hls=C,this.config=C.config,this.registerListeners()}var E=L.prototype;return E.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},E.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)},E.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)},E.onMediaAttached=function(R,A){this.media=A.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},E.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},E.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},E.onLevelUpdated=function(R,A){var w=A.details;this.levelDetails=w,w.advanced&&this.timeupdate(),!w.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},E.onError=function(R,A){if(A.details!==H.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},E.timeupdate=function(){var R=this.media,A=this.levelDetails;if(!R||!A)return;this.currentTime=R.currentTime;var w=this.computeLatency();if(w===null)return;this._latency=w;var b=this.config,d=b.lowLatencyMode,o=b.maxLiveSyncPlaybackRate;if(!d||o===1)return;var s=this.targetLatency;if(s===null)return;var u=w-s,x=Math.min(this.maxLatency,s+A.targetduration),f=u<x;if(A.live&&f&&u>.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,o)),_=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;R.playbackRate=Math.min(m,Math.max(1,_))}else R.playbackRate!==1&&R.playbackRate!==0&&(R.playbackRate=1)},E.estimateLiveEdge=function(){var R=this.levelDetails;return R===null?null:R.edge+R.age},E.computeLatency=function(){var R=this.estimateLiveEdge();return R===null?null:R-this.currentTime},k(L,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var R=this.config,A=this.levelDetails;return R.liveMaxLatencyDuration!==void 0?R.liveMaxLatencyDuration:A?R.liveMaxLatencyDurationCount*A.targetduration:0}},{key:"targetLatency",get:function(){var R=this.levelDetails;if(R===null)return null;var A=R.holdBack,w=R.partHoldBack,b=R.targetduration,d=this.config,o=d.liveSyncDuration,s=d.liveSyncDurationCount,u=d.lowLatencyMode,x=this.hls.userConfig,f=u&&w||A;(x.liveSyncDuration||x.liveSyncDurationCount||f===0)&&(f=o!==void 0?o:s*b);var m=b,_=1;return f+Math.min(this.stallCount*_,m)}},{key:"liveSyncPosition",get:function(){var R=this.estimateLiveEdge(),A=this.targetLatency,w=this.levelDetails;if(R===null||A===null||w===null)return null;var b=w.edge,d=R-A-this.edgeStalled,o=b-w.totalduration,s=b-(this.config.lowLatencyMode&&w.partTarget||w.targetduration);return Math.min(Math.max(o,d),s)}},{key:"drift",get:function(){var R=this.levelDetails;return R===null?1:R.drift}},{key:"edgeStalled",get:function(){var R=this.levelDetails;if(R===null)return 0;var A=(this.config.lowLatencyMode&&R.partTarget||R.targetduration)*3;return Math.max(R.age-A,0)}},{key:"forwardBufferLength",get:function(){var R=this.media,A=this.levelDetails;if(!R||!A)return 0;var w=R.buffered.length;return w?R.buffered.end(w-1):A.edge-this.currentTime}}]),L}()},"./src/controller/level-controller.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"default",function(){return d});var H=D("./src/types/level.ts"),M=D("./src/events.ts"),P=D("./src/errors.ts"),B=D("./src/utils/codecs.ts"),k=D("./src/controller/level-helper.ts"),O=D("./src/controller/base-playlist-controller.ts"),L=D("./src/types/loader.ts");function E(){return E=Object.assign||function(o){for(var s=1;s<arguments.length;s++){var u=arguments[s];for(var x in u)Object.prototype.hasOwnProperty.call(u,x)&&(o[x]=u[x])}return o},E.apply(this,arguments)}function C(o,s){for(var u=0;u<s.length;u++){var x=s[u];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(o,x.key,x)}}function R(o,s,u){return s&&C(o.prototype,s),u&&C(o,u),o}function A(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,w(o,s)}function w(o,s){return w=Object.setPrototypeOf||function(x,f){return x.__proto__=f,x},w(o,s)}var b=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(o){A(s,o);function s(x){var f;return f=o.call(this,x,"[level-controller]")||this,f._levels=[],f._firstLevel=-1,f._startLevel=void 0,f.currentLevelIndex=-1,f.manualLevelIndex=-1,f.onParsedComplete=void 0,f._registerListeners(),f}var u=s.prototype;return u._registerListeners=function(){var f=this.hls;f.on(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),f.on(M.Events.ERROR,this.onError,this)},u._unregisterListeners=function(){var f=this.hls;f.off(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),f.off(M.Events.ERROR,this.onError,this)},u.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},u.startLoad=function(){var f=this._levels;f.forEach(function(m){m.loadError=0}),o.prototype.startLoad.call(this)},u.onManifestLoaded=function(f,m){var _=[],y=[],h=[],c,l={},a,v=!1,p=!1,g=!1;if(m.levels.forEach(function(G){var N=G.attrs;v=v||!!(G.width&&G.height),p=p||!!G.videoCodec,g=g||!!G.audioCodec,b&&G.audioCodec&&G.audioCodec.indexOf("mp4a.40.34")!==-1&&(G.audioCodec=void 0);var I=G.bitrate+"-"+G.attrs.RESOLUTION+"-"+G.attrs.CODECS;a=l[I],a?a.url.push(G.url):(a=new H.Level(G),l[I]=a,_.push(a)),N&&(N.AUDIO&&Object(k.addGroupId)(a,"audio",N.AUDIO),N.SUBTITLES&&Object(k.addGroupId)(a,"text",N.SUBTITLES))}),(v||p)&&g&&(_=_.filter(function(G){var N=G.videoCodec,I=G.width,V=G.height;return!!N||!!(I&&V)})),_=_.filter(function(G){var N=G.audioCodec,I=G.videoCodec;return(!N||Object(B.isCodecSupportedInMp4)(N,"audio"))&&(!I||Object(B.isCodecSupportedInMp4)(I,"video"))}),m.audioTracks&&(y=m.audioTracks.filter(function(G){return!G.audioCodec||Object(B.isCodecSupportedInMp4)(G.audioCodec,"audio")}),Object(k.assignTrackIdsByGroup)(y)),m.subtitles&&(h=m.subtitles,Object(k.assignTrackIdsByGroup)(h)),_.length>0){c=_[0].bitrate,_.sort(function(G,N){return G.bitrate-N.bitrate}),this._levels=_;for(var S=0;S<_.length;S++)if(_[S].bitrate===c){this._firstLevel=S,this.log("manifest loaded, "+_.length+" level(s) found, first bitrate: "+c);break}var U=g&&!p,j={levels:_,audioTracks:y,subtitleTracks:h,firstLevel:this._firstLevel,stats:m.stats,audio:g,video:p,altAudio:!U&&y.some(function(G){return!!G.url})};this.hls.trigger(M.Events.MANIFEST_PARSED,j),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(M.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:m.url,reason:"no level with compatible codecs found in manifest"})},u.onError=function(f,m){if(o.prototype.onError.call(this,f,m),m.fatal)return;var _=m.context,y=this._levels[this.currentLevelIndex];if(_&&(_.type===L.PlaylistContextType.AUDIO_TRACK&&y.audioGroupIds&&_.groupId===y.audioGroupIds[y.urlId]||_.type===L.PlaylistContextType.SUBTITLE_TRACK&&y.textGroupIds&&_.groupId===y.textGroupIds[y.urlId])){this.redundantFailover(this.currentLevelIndex);return}var h=!1,c=!0,l;switch(m.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(m.frag){var a=this._levels[m.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(l=m.frag.level)):l=m.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:_&&(_.deliveryDirectives&&(c=!1),l=_.level),h=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:l=m.level,h=!0;break}l!==void 0&&this.recoverLevel(m,l,h,c)},u.recoverLevel=function(f,m,_,y){var h=f.details,c=this._levels[m];if(c.loadError++,_){var l=this.retryLoadingOrFail(f);if(l)f.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(y){var a=c.url.length;if(a>1&&c.loadError<a)f.levelRetry=!0,this.redundantFailover(m);else if(this.manualLevelIndex===-1){var v=m===0?this._levels.length-1:m-1;this.currentLevelIndex!==v&&this._levels[v].loadError===0&&(this.warn(h+": switch to "+v),f.levelRetry=!0,this.hls.nextAutoLevel=v)}}},u.redundantFailover=function(f){var m=this._levels[f],_=m.url.length;if(_>1){var y=(m.urlId+1)%_;this.warn("Switching to redundant URL-id "+y),this._levels.forEach(function(h){h.urlId=y}),this.level=f}},u.onFragLoaded=function(f,m){var _=m.frag;if(_!==void 0&&_.type===L.PlaylistLevelType.MAIN){var y=this._levels[_.level];y!==void 0&&(y.fragmentError=0,y.loadError=0)}},u.onLevelLoaded=function(f,m){var _,y=m.level,h=m.details,c=this._levels[y];if(!c){var l;this.warn("Invalid level index "+y),(l=m.deliveryDirectives)!==null&&l!==void 0&&l.skip&&(h.deltaUpdateFailed=!0);return}y===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(y,m,c.details)):(_=m.deliveryDirectives)!==null&&_!==void 0&&_.skip&&(h.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(f,m){var _=this.hls.levels[this.currentLevelIndex];if(!_)return;if(_.audioGroupIds){for(var y=-1,h=this.hls.audioTracks[m.id].groupId,c=0;c<_.audioGroupIds.length;c++)if(_.audioGroupIds[c]===h){y=c;break}y!==_.urlId&&(_.urlId=y,this.startLoad())}},u.loadPlaylist=function(f){var m=this.currentLevelIndex,_=this._levels[m];if(this.canLoad&&_&&_.url.length>0){var y=_.urlId,h=_.url[y];if(f)try{h=f.addDirectives(h)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+m+(f?" at sn "+f.msn+" part "+f.part:"")+" with URL-id "+y+" "+h),this.clearTimer(),this.hls.trigger(M.Events.LEVEL_LOADING,{url:h,level:m,id:y,deliveryDirectives:f||null})}},u.removeLevel=function(f,m){var _=function(c,l){return l!==m},y=this._levels.filter(function(h,c){return c!==f?!0:h.url.length>1&&m!==void 0?(h.url=h.url.filter(_),h.audioGroupIds&&(h.audioGroupIds=h.audioGroupIds.filter(_)),h.textGroupIds&&(h.textGroupIds=h.textGroupIds.filter(_)),h.urlId=0,!0):!1}).map(function(h,c){var l=h.details;return l!=null&&l.fragments&&l.fragments.forEach(function(a){a.level=c}),h});this._levels=y,this.hls.trigger(M.Events.LEVELS_UPDATED,{levels:y})},R(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(f){var m,_=this._levels;if(_.length===0)return;if(this.currentLevelIndex===f&&(m=_[f])!==null&&m!==void 0&&m.details)return;if(f<0||f>=_.length){var y=f<0;if(this.hls.trigger(M.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:f,fatal:y,reason:"invalid level idx"}),y)return;f=Math.min(f,_.length-1)}this.clearTimer();var h=this.currentLevelIndex,c=_[h],l=_[f];this.log("switching to level "+f+" from "+h),this.currentLevelIndex=f;var a=E({},l,{level:f,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete a._urlId,this.hls.trigger(M.Events.LEVEL_SWITCHING,a);var v=l.details;if(!v||v.live){var p=this.switchParams(l.uri,c==null?void 0:c.details);this.loadPlaylist(p)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(f){this.manualLevelIndex=f,this._startLevel===void 0&&(this._startLevel=f),f!==-1&&(this.level=f)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(f){this._firstLevel=f}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var f=this.hls.config.startLevel;return f!==void 0?f:this._firstLevel}else return this._startLevel},set:function(f){this._startLevel=f}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(f){this.level=f,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=f)}}]),s}(O.default)},"./src/controller/level-helper.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"addGroupId",function(){return P}),D.d(K,"assignTrackIdsByGroup",function(){return B}),D.d(K,"updatePTS",function(){return k}),D.d(K,"updateFragPTSDTS",function(){return L}),D.d(K,"mergeDetails",function(){return E}),D.d(K,"mapPartIntersection",function(){return C}),D.d(K,"mapFragmentIntersection",function(){return R}),D.d(K,"adjustSliding",function(){return A}),D.d(K,"addSliding",function(){return w}),D.d(K,"computeReloadInterval",function(){return b}),D.d(K,"getFragmentWithSN",function(){return d}),D.d(K,"getPartWith",function(){return o});var H=D("./src/polyfills/number.ts"),M=D("./src/utils/logger.ts");function P(s,u,x){switch(u){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(x);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(x);break}}function B(s){var u={};s.forEach(function(x){var f=x.groupId||"";x.id=u[f]=u[f]||0,u[f]++})}function k(s,u,x){var f=s[u],m=s[x];O(f,m)}function O(s,u){var x=u.startPTS;if(Object(H.isFiniteNumber)(x)){var f=0,m;u.sn>s.sn?(f=x-s.start,m=s):(f=s.start-x,m=u),m.duration!==f&&(m.duration=f)}else if(u.sn>s.sn){var _=s.cc===u.cc;_&&s.minEndPTS?u.start=s.start+(s.minEndPTS-s.start):u.start=s.start+s.duration}else u.start=Math.max(s.start-u.duration,0)}function L(s,u,x,f,m,_){var y=f-x;y<=0&&(M.logger.warn("Fragment should have a positive duration",u),f=x+u.duration,_=m+u.duration);var h=x,c=f,l=u.startPTS,a=u.endPTS;if(Object(H.isFiniteNumber)(l)){var v=Math.abs(l-x);Object(H.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(v,u.deltaPTS):u.deltaPTS=v,h=Math.max(x,l),x=Math.min(x,l),m=Math.min(m,u.startDTS),c=Math.min(f,a),f=Math.max(f,a),_=Math.max(_,u.endDTS)}u.duration=f-x;var p=x-u.start;u.appendedPTS=f,u.start=u.startPTS=x,u.maxStartPTS=h,u.startDTS=m,u.endPTS=f,u.minEndPTS=c,u.endDTS=_;var g=u.sn;if(!s||g<s.startSN||g>s.endSN)return 0;var S,U=g-s.startSN,j=s.fragments;for(j[U]=u,S=U;S>0;S--)O(j[S],j[S-1]);for(S=U;S<j.length-1;S++)O(j[S],j[S+1]);return s.fragmentHint&&O(j[j.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,p}function E(s,u){for(var x=null,f=s.fragments,m=f.length-1;m>=0;m--){var _=f[m].initSegment;if(_){x=_;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var y=0,h;if(R(s,u,function(S,U){S.relurl&&(y=S.cc-U.cc),Object(H.isFiniteNumber)(S.startPTS)&&Object(H.isFiniteNumber)(S.endPTS)&&(U.start=U.startPTS=S.startPTS,U.startDTS=S.startDTS,U.appendedPTS=S.appendedPTS,U.maxStartPTS=S.maxStartPTS,U.endPTS=S.endPTS,U.endDTS=S.endDTS,U.minEndPTS=S.minEndPTS,U.duration=S.endPTS-S.startPTS,U.duration&&(h=U),u.PTSKnown=u.alignedSliding=!0),U.elementaryStreams=S.elementaryStreams,U.loader=S.loader,U.stats=S.stats,U.urlId=S.urlId,S.initSegment&&(U.initSegment=S.initSegment,x=S.initSegment)}),x){var c=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;c.forEach(function(S){var U;(!S.initSegment||S.initSegment.relurl===((U=x)===null||U===void 0?void 0:U.relurl))&&(S.initSegment=x)})}if(u.skippedSegments&&(u.deltaUpdateFailed=u.fragments.some(function(S){return!S}),u.deltaUpdateFailed)){M.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var l=u.skippedSegments;l--;)u.fragments.shift();u.startSN=u.fragments[0].sn,u.startCC=u.fragments[0].cc}var a=u.fragments;if(y){M.logger.warn("discontinuity sliding from playlist, take drift into account");for(var v=0;v<a.length;v++)a[v].cc+=y}u.skippedSegments&&(u.startCC=u.fragments[0].cc),C(s.partList,u.partList,function(S,U){U.elementaryStreams=S.elementaryStreams,U.stats=S.stats}),h?L(u,h,h.startPTS,h.endPTS,h.startDTS,h.endDTS):A(s,u),a.length&&(u.totalduration=u.edge-a[0].start),u.driftStartTime=s.driftStartTime,u.driftStart=s.driftStart;var p=u.advancedDateTime;if(u.advanced&&p){var g=u.edge;u.driftStart||(u.driftStartTime=p,u.driftStart=g),u.driftEndTime=p,u.driftEnd=g}else u.driftEndTime=s.driftEndTime,u.driftEnd=s.driftEnd,u.advancedDateTime=s.advancedDateTime}function C(s,u,x){if(s&&u)for(var f=0,m=0,_=s.length;m<=_;m++){var y=s[m],h=u[m+f];y&&h&&y.index===h.index&&y.fragment.sn===h.fragment.sn?x(y,h):f--}}function R(s,u,x){for(var f=u.skippedSegments,m=Math.max(s.startSN,u.startSN)-u.startSN,_=(s.fragmentHint?1:0)+(f?u.endSN:Math.min(s.endSN,u.endSN))-u.startSN,y=u.startSN-s.startSN,h=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,c=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,l=m;l<=_;l++){var a=c[y+l],v=h[l];f&&!v&&l<f&&(v=u.fragments[l]=a),a&&v&&x(a,v)}}function A(s,u){var x=u.startSN+u.skippedSegments-s.startSN,f=s.fragments;if(x<0||x>=f.length)return;w(u,f[x].start)}function w(s,u){if(u){for(var x=s.fragments,f=s.skippedSegments;f<x.length;f++)x[f].start+=u;s.fragmentHint&&(s.fragmentHint.start+=u)}}function b(s,u){var x=1e3*s.levelTargetDuration,f=x/2,m=s.age,_=m>0&&m<x*3,y=u.loading.end-u.loading.start,h,c=s.availabilityDelay;if(s.updated===!1)if(_){var l=333*s.misses;h=Math.max(Math.min(f,y*2),l),s.availabilityDelay=(s.availabilityDelay||0)+h}else h=f;else _?(c=Math.min(c||x/2,m),s.availabilityDelay=c,h=c+x-m):h=x-y;return Math.round(h)}function d(s,u,x){if(!s||!s.details)return null;var f=s.details,m=f.fragments[u-f.startSN];return m||(m=f.fragmentHint,m&&m.sn===u?m:u<f.startSN&&x&&x.sn===u?x:null)}function o(s,u,x){if(!s||!s.details)return null;var f=s.details.partList;if(f)for(var m=f.length;m--;){var _=f[m];if(_.index===x&&_.fragment.sn===u)return _}return null}},"./src/controller/stream-controller.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"default",function(){return f});var H=D("./src/polyfills/number.ts"),M=D("./src/controller/base-stream-controller.ts"),P=D("./src/is-supported.ts"),B=D("./src/events.ts"),k=D("./src/utils/buffer-helper.ts"),O=D("./src/controller/fragment-tracker.ts"),L=D("./src/types/loader.ts"),E=D("./src/loader/fragment.ts"),C=D("./src/demux/transmuxer-interface.ts"),R=D("./src/types/transmuxer.ts"),A=D("./src/controller/gap-controller.ts"),w=D("./src/errors.ts"),b=D("./src/utils/logger.ts");function d(m,_){for(var y=0;y<_.length;y++){var h=_[y];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(m,h.key,h)}}function o(m,_,y){return _&&d(m.prototype,_),y&&d(m,y),m}function s(m,_){m.prototype=Object.create(_.prototype),m.prototype.constructor=m,u(m,_)}function u(m,_){return u=Object.setPrototypeOf||function(h,c){return h.__proto__=c,h},u(m,_)}var x=100,f=function(m){s(_,m);function _(h,c){var l;return l=m.call(this,h,c,"[stream-controller]")||this,l.audioCodecSwap=!1,l.gapController=null,l.level=-1,l._forceStartLoad=!1,l.altAudio=!1,l.audioOnly=!1,l.fragPlaying=null,l.onvplaying=null,l.onvseeked=null,l.fragLastKbps=0,l.stalled=!1,l.couldBacktrack=!1,l.audioCodecSwitch=!1,l.videoBuffer=null,l._registerListeners(),l}var y=_.prototype;return y._registerListeners=function(){var c=this.hls;c.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(B.Events.ERROR,this.onError,this),c.on(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(B.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y._unregisterListeners=function(){var c=this.hls;c.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(B.Events.ERROR,this.onError,this),c.off(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(B.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},y.startLoad=function(c){if(this.levels){var l=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(x),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var v=a.startLevel;v===-1&&(a.config.testBandwidth?(v=0,this.bitrateTest=!0):v=a.nextAutoLevel),this.level=a.nextLoadLevel=v,this.loadedmetadata=!1}l>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+l.toFixed(3)),c=l),this.state=M.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=M.State.STOPPED},y.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},y.doTick=function(){switch(this.state){case M.State.IDLE:this.doTickIdle();break;case M.State.WAITING_LEVEL:{var c,l=this.levels,a=this.level,v=l==null||((c=l[a])===null||c===void 0)?void 0:c.details;if(v&&(!v.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(v))break;this.state=M.State.IDLE;break}break}case M.State.FRAG_LOADING_WAITING_RETRY:{var p,g=self.performance.now(),S=this.retryDate;(!S||g>=S||(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()},y.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},y.doTickIdle=function(){var c,l,a=this.hls,v=this.levelLastLoaded,p=this.levels,g=this.media,S=a.config,U=a.nextLoadLevel;if(v===null||!g&&(this.startFragRequested||!S.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!p||!p[U])return;var j=p[U];this.level=a.nextLoadLevel=U;var G=j.details;if(!G||this.state===M.State.WAITING_LEVEL||G.live&&this.levelLastLoaded!==U){this.state=M.State.WAITING_LEVEL;return}var N=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:g,L.PlaylistLevelType.MAIN);if(N===null)return;var I=N.len,V=this.getMaxBufferLength(j.maxBitrate);if(I>=V)return;if(this._streamEnded(N,G)){var Q={};this.altAudio&&(Q.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,Q),this.state=M.State.ENDED;return}var ne=N.end,se=this.getNextFragment(ne,G);if(this.couldBacktrack&&!this.fragPrevious&&se&&se.sn!=="initSegment"){var xe=se.sn-G.startSN;xe>1&&(se=G.fragments[xe-1],this.fragmentTracker.removeFragment(se))}if(se&&this.fragmentTracker.getState(se)===O.FragmentState.OK&&this.nextLoadPosition>ne){var me=this.audioOnly&&!this.altAudio?E.ElementaryStreamTypes.AUDIO:E.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(g,me,L.PlaylistLevelType.MAIN),se=this.getNextFragment(this.nextLoadPosition,G)}if(!se)return;se.initSegment&&!se.initSegment.data&&!this.bitrateTest&&(se=se.initSegment),((c=se.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((l=se.decryptdata)!==null&&l!==void 0&&l.key)?this.loadKey(se,G):this.loadFragment(se,G,ne)},y.loadFragment=function(c,l,a){var v,p=this.fragmentTracker.getState(c);if(this.fragCurrent=c,p===O.FragmentState.BACKTRACKED){var g=this.fragmentTracker.getBacktrackData(c);if(g){this._handleFragmentLoadProgress(g),this._handleFragmentLoadComplete(g);return}else p=O.FragmentState.NOT_LOADED}p===O.FragmentState.NOT_LOADED||p===O.FragmentState.PARTIAL?c.sn==="initSegment"?this._loadInitSegment(c):this.bitrateTest?(c.bitrateTest=!0,this.log("Fragment "+c.sn+" of level "+c.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(c)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,c,l,a)):p===O.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((v=this.media)===null||v===void 0?void 0:v.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},y.getAppendedFrag=function(c){var l=this.fragmentTracker.getAppendedFrag(c,L.PlaylistLevelType.MAIN);return l&&"fragment"in l?l.fragment:l},y.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,L.PlaylistLevelType.MAIN)},y.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},y.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},y.nextLevelSwitch=function(){var c=this.levels,l=this.media;if(l!=null&&l.readyState){var a,v=this.getAppendedFrag(l.currentTime);if(v&&v.start>1&&this.flushMainBuffer(0,v.start-1),!l.paused&&c){var p=this.hls.nextLoadLevel,g=c[p],S=this.fragLastKbps;S&&this.fragCurrent?a=this.fragCurrent.duration*g.maxBitrate/(1e3*S)+1:a=0}else a=0;var U=this.getBufferedFrag(l.currentTime+a);if(U){var j=this.followingBufferedFrag(U);if(j){this.abortCurrentFrag();var G=j.maxStartPTS?j.maxStartPTS:j.start,N=j.duration,I=Math.max(U.end,G+Math.min(Math.max(N-this.config.maxFragLookUpTolerance,N*.5),N*.75));this.flushMainBuffer(I,Number.POSITIVE_INFINITY)}}}},y.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===M.State.KEY_LOADING&&(this.state=M.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},y.flushMainBuffer=function(c,l){m.prototype.flushMainBuffer.call(this,c,l,this.altAudio?"video":null)},y.onMediaAttached=function(c,l){m.prototype.onMediaAttached.call(this,c,l);var a=l.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new A.default(this.config,a,this.fragmentTracker,this.hls)},y.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),m.prototype.onMediaDetaching.call(this)},y.onMediaPlaying=function(){this.tick()},y.onMediaSeeked=function(){var c=this.media,l=c?c.currentTime:null;Object(H.isFiniteNumber)(l)&&this.log("Media seeked to "+l.toFixed(3)),this.tick()},y.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(B.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},y.onManifestParsed=function(c,l){var a=!1,v=!1,p;l.levels.forEach(function(g){p=g.audioCodec,p&&(p.indexOf("mp4a.40.2")!==-1&&(a=!0),p.indexOf("mp4a.40.5")!==-1&&(v=!0))}),this.audioCodecSwitch=a&&v&&!Object(P.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=l.levels,this.startFragRequested=!1},y.onLevelLoading=function(c,l){var a=this.levels;if(!a||this.state!==M.State.IDLE)return;var v=a[l.level];(!v.details||v.details.live&&this.levelLastLoaded!==l.level||this.waitForCdnTuneIn(v.details))&&(this.state=M.State.WAITING_LEVEL)},y.onLevelLoaded=function(c,l){var a,v=this.levels,p=l.level,g=l.details,S=g.totalduration;if(!v){this.warn("Levels were reset while loading level "+p);return}this.log("Level "+p+" loaded ["+g.startSN+","+g.endSN+"], cc ["+g.startCC+", "+g.endCC+"] duration:"+S);var U=this.fragCurrent;U&&(this.state===M.State.FRAG_LOADING||this.state===M.State.FRAG_LOADING_WAITING_RETRY)&&(U.level!==l.level&&U.loader&&(this.state=M.State.IDLE,U.loader.abort()));var j=v[p],G=0;if(g.live||(a=j.details)!==null&&a!==void 0&&a.live){if(g.fragments[0]||(g.deltaUpdateFailed=!0),g.deltaUpdateFailed)return;G=this.alignPlaylists(g,j.details)}if(j.details=g,this.levelLastLoaded=p,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:g,level:p}),this.state===M.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(g))return;this.state=M.State.IDLE}this.startFragRequested?g.live&&this.synchronizeToLiveEdge(g):this.setStartPosition(g,G),this.tick()},y._handleFragmentLoadProgress=function(c){var l,a=c.frag,v=c.part,p=c.payload,g=this.levels;if(!g){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var S=g[a.level],U=S.details;if(!U){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var j=S.videoCodec,G=U.PTSKnown||!U.live,N=(l=a.initSegment)===null||l===void 0?void 0:l.data,I=this._getAudioCodec(S),V=this.transmuxer=this.transmuxer||new C.default(this.hls,L.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Q=v?v.index:-1,ne=Q!==-1,se=new R.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,p.byteLength,Q,ne),xe=this.initPTS[a.cc];V.push(p,N,I,j,a,v,U.totalduration,G,se,xe)},y.onAudioTrackSwitching=function(c,l){var a=this.altAudio,v=!!l.url,p=l.id;if(!v){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var g=this.fragCurrent;g!=null&&g.loader&&(this.log("Switching to main audio track, cancel main fragment load"),g.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var S=this.hls;a&&S.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),S.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:p})}},y.onAudioTrackSwitched=function(c,l){var a=l.id,v=!!this.hls.audioTracks[a].url;if(v){var p=this.videoBuffer;p&&this.mediaBuffer!==p&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=p)}this.altAudio=v,this.tick()},y.onBufferCreated=function(c,l){var a=l.tracks,v,p,g=!1;for(var S in a){var U=a[S];if(U.id==="main"){if(p=S,v=U,S==="video"){var j=a[S];j&&(this.videoBuffer=j.buffer)}}else g=!0}g&&v?(this.log("Alternate track found, use "+p+".buffered to schedule main fragment loading"),this.mediaBuffer=v.buffer):this.mediaBuffer=this.media},y.onFragBuffered=function(c,l){var a=l.frag,v=l.part;if(a&&a.type!==L.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(v?" p: "+v.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===M.State.PARSED&&(this.state=M.State.IDLE);return}var p=v?v.stats:a.stats;this.fragLastKbps=Math.round(8*p.total/(p.buffering.end-p.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,v)},y.onError=function(c,l){switch(l.details){case w.ErrorDetails.FRAG_LOAD_ERROR:case w.ErrorDetails.FRAG_LOAD_TIMEOUT:case w.ErrorDetails.KEY_LOAD_ERROR:case w.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.MAIN,l);break;case w.ErrorDetails.LEVEL_LOAD_ERROR:case w.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==M.State.ERROR&&(l.fatal?(this.warn(""+l.details),this.state=M.State.ERROR):!l.levelRetry&&this.state===M.State.WAITING_LEVEL&&(this.state=M.State.IDLE));break;case w.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="main"&&(this.state===M.State.PARSING||this.state===M.State.PARSED)){var a=!0,v=this.getFwdBufferInfo(this.media,L.PlaylistLevelType.MAIN);v&&v.len>.5&&(a=!this.reduceMaxBufferLength(v.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},y.checkBuffer=function(){var c=this.media,l=this.gapController;if(!c||!l||!c.readyState)return;var a=k.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):l.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},y.onFragLoadEmergencyAborted=function(){this.state=M.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},y.onBufferFlushed=function(c,l){var a=l.type;if(a!==E.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var v=(a===E.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(v,a,L.PlaylistLevelType.MAIN)}},y.onLevelsUpdated=function(c,l){this.levels=l.levels},y.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},y.seekToStartPos=function(){var c=this.media,l=c.currentTime,a=this.startPosition;if(a>=0&&l<a){if(c.seeking){b.logger.log("could not seek to "+a+", already seeking at "+l);return}var v=k.BufferHelper.getBuffered(c),p=v.length?v.start(0):0,g=p-a;g>0&&(g<this.config.maxBufferHole||g<this.config.maxFragLookUpTolerance)&&(b.logger.log("adjusting start position by "+g+" to match buffer start"),a+=g,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+l),c.currentTime=a}},y._getAudioCodec=function(c){var l=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&l&&(this.log("Swapping audio codec"),l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5"),l},y._loadBitrateTestFrag=function(c){var l=this;this._doFragLoad(c).then(function(a){var v=l.hls;if(!a||v.nextLoadLevel||l.fragContextChanged(c))return;l.fragLoadError=0,l.state=M.State.IDLE,l.startFragRequested=!1,l.bitrateTest=!1;var p=c.stats;p.parsing.start=p.parsing.end=p.buffering.start=p.buffering.end=self.performance.now(),v.trigger(B.Events.FRAG_LOADED,a)})},y._handleTransmuxComplete=function(c){var l,a="main",v=this.hls,p=c.remuxResult,g=c.chunkMeta,S=this.getCurrentContext(g);if(!S){this.warn("The loading context changed while buffering fragment "+g.sn+" of level "+g.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(g.level);return}var U=S.frag,j=S.part,G=S.level,N=p.video,I=p.text,V=p.id3,Q=p.initSegment,ne=this.altAudio?void 0:p.audio;if(this.fragContextChanged(U))return;if(this.state=M.State.PARSING,Q){Q.tracks&&(this._bufferInitSegment(G,Q.tracks,U,g),v.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:a,tracks:Q.tracks}));var se=Q.initPTS,xe=Q.timescale;Object(H.isFiniteNumber)(se)&&(this.initPTS[U.cc]=se,v.trigger(B.Events.INIT_PTS_FOUND,{frag:U,id:a,initPTS:se,timescale:xe}))}if(N&&p.independent!==!1){if(G.details){var me=N.startPTS,Le=N.endPTS,Ee=N.startDTS,Te=N.endDTS;if(j)j.elementaryStreams[N.type]={startPTS:me,endPTS:Le,startDTS:Ee,endDTS:Te};else if(N.firstKeyFrame&&N.independent&&(this.couldBacktrack=!0),N.dropped&&N.independent){var ce=this.getLoadPosition()+this.config.maxBufferHole;if(ce<me){this.backtrack(U);return}U.setElementaryStreamInfo(N.type,U.start,Le,U.start,Te,!0)}U.setElementaryStreamInfo(N.type,me,Le,Ee,Te),this.bufferFragmentData(N,U,j,g)}}else if(p.independent===!1){this.backtrack(U);return}if(ne){var fe=ne.startPTS,J=ne.endPTS,le=ne.startDTS,ee=ne.endDTS;j&&(j.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:fe,endPTS:J,startDTS:le,endDTS:ee}),U.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,fe,J,le,ee),this.bufferFragmentData(ne,U,j,g)}if(V!=null&&(l=V.samples)!==null&&l!==void 0&&l.length){var pe={frag:U,id:a,samples:V.samples};v.trigger(B.Events.FRAG_PARSING_METADATA,pe)}if(I){var ye={frag:U,id:a,samples:I.samples};v.trigger(B.Events.FRAG_PARSING_USERDATA,ye)}},y._bufferInitSegment=function(c,l,a,v){var p=this;if(this.state!==M.State.PARSING)return;this.audioOnly=!!l.audio&&!l.video,this.altAudio&&!this.audioOnly&&delete l.audio;var g=l.audio,S=l.video,U=l.audiovideo;if(g){var j=c.audioCodec,G=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),g.metadata.channelCount!==1&&G.indexOf("firefox")===-1&&(j="mp4a.40.5")),G.indexOf("android")!==-1&&g.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),c.audioCodec&&c.audioCodec!==j&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+j+'"'),g.levelCodec=j,g.id="main",this.log("Init audio buffer, container:"+g.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(c.audioCodec||"")+"/"+g.codec+"]")}S&&(S.levelCodec=c.videoCodec,S.id="main",this.log("Init video buffer, container:"+S.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+S.codec+"]")),U&&this.log("Init audiovideo buffer, container:"+U.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+U.codec+"]"),this.hls.trigger(B.Events.BUFFER_CODECS,l),Object.keys(l).forEach(function(N){var I=l[N],V=I.initSegment;V!=null&&V.byteLength&&p.hls.trigger(B.Events.BUFFER_APPENDING,{type:N,data:V,frag:a,part:null,chunkMeta:v,parent:a.type})}),this.tick()},y.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var l=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,l?this.resetFragmentLoading(c):this.state=M.State.BACKTRACKING},y.checkFragmentChanged=function(){var c=this.media,l=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(k.BufferHelper.isBuffered(c,a)?l=this.getAppendedFrag(a):k.BufferHelper.isBuffered(c,a+.1)&&(l=this.getAppendedFrag(a+.1)),l){var v=this.fragPlaying,p=l.level;(!v||l.sn!==v.sn||v.level!==p||l.urlId!==v.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:l}),(!v||v.level!==p)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:p}),this.fragPlaying=l)}}},o(_,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);if(l)return l.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(l)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),_}(M.default)},"./src/controller/subtitle-stream-controller.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"SubtitleStreamController",function(){return s});var H=D("./src/events.ts"),M=D("./src/utils/logger.ts"),P=D("./src/utils/buffer-helper.ts"),B=D("./src/controller/fragment-finders.ts"),k=D("./src/utils/discontinuities.ts"),O=D("./src/controller/level-helper.ts"),L=D("./src/controller/fragment-tracker.ts"),E=D("./src/controller/base-stream-controller.ts"),C=D("./src/types/loader.ts"),R=D("./src/types/level.ts");function A(u,x){for(var f=0;f<x.length;f++){var m=x[f];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(u,m.key,m)}}function w(u,x,f){return x&&A(u.prototype,x),f&&A(u,f),u}function b(u,x){u.prototype=Object.create(x.prototype),u.prototype.constructor=u,d(u,x)}function d(u,x){return d=Object.setPrototypeOf||function(m,_){return m.__proto__=_,m},d(u,x)}var o=500,s=function(u){b(x,u);function x(m,_){var y;return y=u.call(this,m,_,"[subtitle-stream-controller]")||this,y.levels=[],y.currentTrackId=-1,y.tracksBuffered=[],y.mainDetails=null,y._registerListeners(),y}var f=x.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var _=this.hls;_.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.on(H.Events.ERROR,this.onError,this),_.on(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),_.on(H.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),_.on(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),_.on(H.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),_.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f._unregisterListeners=function(){var _=this.hls;_.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.off(H.Events.ERROR,this.onError,this),_.off(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),_.off(H.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),_.off(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),_.off(H.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),_.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f.startLoad=function(){this.stopLoad(),this.state=E.State.IDLE,this.setInterval(o),this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},f.onLevelLoaded=function(_,y){this.mainDetails=y.details},f.onSubtitleFragProcessed=function(_,y){var h=y.frag,c=y.success;if(this.fragPrevious=h,this.state=E.State.IDLE,!c)return;var l=this.tracksBuffered[this.currentTrackId];if(!l)return;for(var a,v=h.start,p=0;p<l.length;p++)if(v>=l[p].start&&v<=l[p].end){a=l[p];break}var g=h.start+h.duration;a?a.end=g:(a={start:v,end:g},l.push(a)),this.fragmentTracker.fragBuffered(h)},f.onBufferFlushing=function(_,y){var h=y.startOffset,c=y.endOffset;if(h===0&&c!==Number.POSITIVE_INFINITY){var l=this.currentTrackId,a=this.levels;if(!a.length||!a[l]||!a[l].details)return;var v=a[l].details,p=v.targetduration,g=c-p;if(g<=0)return;y.endOffsetSubtitles=Math.max(0,g),this.tracksBuffered.forEach(function(S){for(var U=0;U<S.length;){if(S[U].end<=g){S.shift();continue}else if(S[U].start<g)S[U].start=g;else break;U++}}),this.fragmentTracker.removeFragmentsInRange(h,g,C.PlaylistLevelType.SUBTITLE)}},f.onError=function(_,y){var h,c=y.frag;if(!c||c.type!==C.PlaylistLevelType.SUBTITLE)return;(h=this.fragCurrent)!==null&&h!==void 0&&h.loader&&this.fragCurrent.loader.abort(),this.state=E.State.IDLE},f.onSubtitleTracksUpdated=function(_,y){var h=this,c=y.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(l){return new R.Level(l)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(l){h.tracksBuffered[l.id]=[]}),this.mediaBuffer=null},f.onSubtitleTrackSwitch=function(_,y){if(this.currentTrackId=y.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var h=this.levels[this.currentTrackId];h!=null&&h.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,h&&this.setInterval(o)},f.onSubtitleTrackLoaded=function(_,y){var h,c=y.details,l=y.id,a=this.currentTrackId,v=this.levels;if(!v.length)return;var p=v[a];if(l>=v.length||l!==a||!p)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(h=p.details)!==null&&h!==void 0&&h.live){var g=this.mainDetails;if(c.deltaUpdateFailed||!g)return;var S=g.fragments[0];if(!p.details)c.hasProgramDateTime&&g.hasProgramDateTime?Object(k.alignMediaPlaylistByPDT)(c,g):S&&Object(O.addSliding)(c,S.start);else{var U=this.alignPlaylists(c,p.details);U===0&&S&&Object(O.addSliding)(c,S.start)}}if(p.details=c,this.levelLastLoaded=l,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===E.State.IDLE){var j=Object(B.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),p.details=void 0)}},f._handleFragmentLoadComplete=function(_){var y=_.frag,h=_.payload,c=y.decryptdata,l=this.hls;if(this.fragContextChanged(y))return;if(h&&h.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(h),c.key.buffer,c.iv.buffer).then(function(v){var p=performance.now();l.trigger(H.Events.FRAG_DECRYPTED,{frag:y,payload:v,stats:{tstart:a,tdecrypt:p}})})}},f.doTick=function(){if(!this.media){this.state=E.State.IDLE;return}if(this.state===E.State.IDLE){var _,y=this.currentTrackId,h=this.levels;if(!h.length||!h[y]||!h[y].details)return;var c=h[y].details,l=c.targetduration,a=this.config,v=this.media,p=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,v.currentTime-l,a.maxBufferHole),g=p.end,S=p.len,U=this.getMaxBufferLength()+l;if(S>U)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var j=c.fragments,G=j.length,N=c.edge,I,V=this.fragPrevious;if(g<N){var Q=a.maxFragLookUpTolerance;V&&c.hasProgramDateTime&&(I=Object(B.findFragmentByPDT)(j,V.endProgramDateTime,Q)),I||(I=Object(B.findFragmentByPTS)(V,j,g,Q),!I&&V&&V.start<j[0].start&&(I=j[0]))}else I=j[G-1];(_=I)!==null&&_!==void 0&&_.encrypted?(M.logger.log("Loading key for "+I.sn),this.state=E.State.KEY_LOADING,this.hls.trigger(H.Events.KEY_LOADING,{frag:I})):I&&this.fragmentTracker.getState(I)===L.FragmentState.NOT_LOADED&&this.loadFragment(I,c,g)}},f.loadFragment=function(_,y,h){this.fragCurrent=_,u.prototype.loadFragment.call(this,_,y,h)},w(x,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),x}(E.default)},"./src/controller/subtitle-track-controller.ts":function(te,K,D){"use strict";D.r(K);var H=D("./src/events.ts"),M=D("./src/utils/texttrack-utils.ts"),P=D("./src/controller/base-playlist-controller.ts"),B=D("./src/types/loader.ts");function k(A,w){for(var b=0;b<w.length;b++){var d=w[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(A,d.key,d)}}function O(A,w,b){return w&&k(A.prototype,w),b&&k(A,b),A}function L(A,w){A.prototype=Object.create(w.prototype),A.prototype.constructor=A,E(A,w)}function E(A,w){return E=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},E(A,w)}var C=function(A){L(w,A);function w(d){var o;return o=A.call(this,d,"[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 b=w.prototype;return b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,A.prototype.destroy.call(this)},b.registerListeners=function(){var o=this.hls;o.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(H.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var o=this.hls;o.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(H.Events.ERROR,this.onError,this)},b.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)},b.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},b.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=R(this.media.textTracks);o.forEach(function(s){Object(M.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},b.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},b.onManifestParsed=function(o,s){this.tracks=s.subtitleTracks},b.onSubtitleTrackLoaded=function(o,s){var u=s.id,x=s.details,f=this.trackId,m=this.tracksInGroup[f];if(!m){this.warn("Invalid subtitle track id "+u);return}var _=m.details;m.details=s.details,this.log("subtitle track "+u+" loaded ["+x.startSN+"-"+x.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,s,_))},b.onLevelLoading=function(o,s){this.switchLevel(s.level)},b.onLevelSwitching=function(o,s){this.switchLevel(s.level)},b.switchLevel=function(o){var s=this.hls.levels[o];if(!(s!=null&&s.textGroupIds))return;var u=s.textGroupIds[s.urlId];if(this.groupId!==u){var x=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,f=this.tracks.filter(function(y){return!u||y.groupId===u});this.tracksInGroup=f;var m=this.findTrackId(x==null?void 0:x.name)||this.findTrackId();this.groupId=u;var _={subtitleTracks:f};this.log("Updating subtitle tracks, "+f.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(H.Events.SUBTITLE_TRACKS_UPDATED,_),m!==-1&&this.setSubtitleTrack(m,x)}},b.findTrackId=function(o){for(var s=this.tracksInGroup,u=0;u<s.length;u++){var x=s[u];if((!this.selectDefaultTrack||x.default)&&(!o||o===x.name))return x.id}return-1},b.onError=function(o,s){if(A.prototype.onError.call(this,o,s),s.fatal||!s.context)return;s.context.type===B.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},b.loadPlaylist=function(o){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var u=s.id,x=s.groupId,f=s.url;if(o)try{f=o.addDirectives(f)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("Loading subtitle playlist for id "+u),this.hls.trigger(H.Events.SUBTITLE_TRACK_LOADING,{url:f,id:u,groupId:x,deliveryDirectives:o||null})}},b.toggleTrackModes=function(o){var s=this,u=this.media,x=this.subtitleDisplay,f=this.trackId;if(!u)return;var m=R(u.textTracks),_=m.filter(function(c){return c.groupId===s.groupId});if(o===-1)[].slice.call(m).forEach(function(c){c.mode="disabled"});else{var y=_[f];y&&(y.mode="disabled")}var h=_[o];h&&(h.mode=x?"showing":"hidden")},b.setSubtitleTrack=function(o,s){var u,x=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(u=x[o])!==null&&u!==void 0&&u.details)||o<-1||o>=x.length)return;this.clearTimer();var f=x[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,f){var m=f.id,_=f.groupId,y=_===void 0?"":_,h=f.name,c=f.type,l=f.url;this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:y,name:h,type:c,url:l});var a=this.switchParams(f.url,s==null?void 0:s.details);this.loadPlaylist(a)}else this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:o})},b.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,s=R(this.media.textTracks),u=0;u<s.length;u++)if(s[u].mode==="hidden")o=u;else if(s[u].mode==="showing"){o=u;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},O(w,[{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)}}]),w}(P.default);function R(A){for(var w=[],b=0;b<A.length;b++){var d=A[b];d.kind==="subtitles"&&d.label&&w.push(A[b])}return w}K.default=C},"./src/controller/timeline-controller.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"TimelineController",function(){return R});var H=D("./src/polyfills/number.ts"),M=D("./src/events.ts"),P=D("./src/utils/cea-608-parser.ts"),B=D("./src/utils/output-filter.ts"),k=D("./src/utils/webvtt-parser.ts"),O=D("./src/utils/texttrack-utils.ts"),L=D("./src/utils/imsc1-ttml-parser.ts"),E=D("./src/types/loader.ts"),C=D("./src/utils/logger.ts"),R=function(){function d(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=b(),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 u=new B.default(this,"textTrack1"),x=new B.default(this,"textTrack2"),f=new B.default(this,"textTrack3"),m=new B.default(this,"textTrack4");this.cea608Parser1=new P.default(1,u,x),this.cea608Parser2=new P.default(3,f,m)}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=d.prototype;return o.destroy=function(){var u=this.hls;u.off(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.off(M.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(M.Events.FRAG_LOADING,this.onFragLoading,this),u.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(M.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.off(M.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(M.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.off(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(u,x,f,m,_){for(var y=!1,h=_.length;h--;){var c=_[h],l=w(c[0],c[1],x,f);if(l>=0&&(c[0]=Math.min(c[0],x),c[1]=Math.max(c[1],f),y=!0,l/(f-x)>.5))return}if(y||_.push([x,f]),this.config.renderTextTracksNatively){var a=this.captionsTracks[u];this.Cues.newCue(a,x,f,m)}else{var v=this.Cues.newCue(null,x,f,m);this.hls.trigger(M.Events.CUES_PARSED,{type:"captions",cues:v,track:u})}},o.onInitPtsFound=function(u,x){var f=this,m=x.frag,_=x.id,y=x.initPTS,h=x.timescale,c=this.unparsedVttFrags;_==="main"&&(this.initPTS[m.cc]=y,this.timescale[m.cc]=h),c.length&&(this.unparsedVttFrags=[],c.forEach(function(l){f.onFragLoaded(M.Events.FRAG_LOADED,l)}))},o.getExistingTrack=function(u){var x=this.media;if(x)for(var f=0;f<x.textTracks.length;f++){var m=x.textTracks[f];if(m[u])return m}return null},o.createCaptionsTrack=function(u){this.config.renderTextTracksNatively?this.createNativeTrack(u):this.createNonNativeTrack(u)},o.createNativeTrack=function(u){if(this.captionsTracks[u])return;var x=this.captionsProperties,f=this.captionsTracks,m=this.media,_=x[u],y=_.label,h=_.languageCode,c=this.getExistingTrack(u);if(c)f[u]=c,Object(O.clearCurrentCues)(f[u]),Object(O.sendAddTrackEvent)(f[u],m);else{var l=this.createTextTrack("captions",y,h);l&&(l[u]=!0,f[u]=l)}},o.createNonNativeTrack=function(u){if(this.nonNativeCaptionsTracks[u])return;var x=this.captionsProperties[u];if(!x)return;var f=x.label,m={_id:u,label:f,kind:"captions",default:x.media?!!x.media.default:!1,closedCaptions:x.media};this.nonNativeCaptionsTracks[u]=m,this.hls.trigger(M.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[m]})},o.createTextTrack=function(u,x,f){var m=this.media;return m?m.addTextTrack(u,x,f):void 0},o.onMediaAttaching=function(u,x){this.media=x.media,this._cleanTracks()},o.onMediaDetaching=function(){var u=this.captionsTracks;Object.keys(u).forEach(function(x){Object(O.clearCurrentCues)(u[x]),delete u[x]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=b(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var u=this.media;if(!u)return;var x=u.textTracks;if(x)for(var f=0;f<x.length;f++)Object(O.clearCurrentCues)(x[f])},o.onSubtitleTracksUpdated=function(u,x){var f=this;this.textTracks=[];var m=x.subtitleTracks||[],_=m.some(function(l){return l.textCodec===L.IMSC1_CODEC});if(this.config.enableWebVTT||_&&this.config.enableIMSC1){var y=this.tracks&&m&&this.tracks.length===m.length;if(this.tracks=m||[],this.config.renderTextTracksNatively){var h=this.media?this.media.textTracks:[];this.tracks.forEach(function(l,a){var v;if(a<h.length){for(var p=null,g=0;g<h.length;g++)if(A(h[g],l)){p=h[g];break}p&&(v=p)}v?Object(O.clearCurrentCues)(v):(v=f.createTextTrack("subtitles",l.name,l.lang),v&&(v.mode="disabled")),v&&(v.groupId=l.groupId,f.textTracks.push(v))})}else if(!y&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(l){return{label:l.name,kind:l.type.toLowerCase(),default:l.default,subtitleTrack:l}});this.hls.trigger(M.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(u,x){var f=this;this.config.enableCEA708Captions&&x.captions&&x.captions.forEach(function(m){var _=/(?:CC|SERVICE)([1-4])/.exec(m.instreamId);if(!_)return;var y="textTrack"+_[1],h=f.captionsProperties[y];if(!h)return;h.label=m.name,m.lang&&(h.languageCode=m.lang),h.media=m})},o.onFragLoading=function(u,x){var f=this.cea608Parser1,m=this.cea608Parser2,_=this.lastSn,y=this.lastPartIndex;if(!this.enabled||!(f&&m))return;if(x.frag.type===E.PlaylistLevelType.MAIN){var h,c,l=x.frag.sn,a=(h=x==null||((c=x.part)===null||c===void 0)?void 0:c.index)!=null?h:-1;l===_+1||l===_&&a===y+1||(f.reset(),m.reset()),this.lastSn=l,this.lastPartIndex=a}},o.onFragLoaded=function(u,x){var f=x.frag,m=x.payload,_=this.initPTS,y=this.unparsedVttFrags;if(f.type===E.PlaylistLevelType.SUBTITLE)if(m.byteLength){if(!Object(H.isFiniteNumber)(_[f.cc])){y.push(x),_.length&&this.hls.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Missing initial subtitle PTS")});return}var h=f.decryptdata;if(h==null||h.key==null||h.method!=="AES-128"){var c=this.tracks[f.level],l=this.vttCCs;l[f.cc]||(l[f.cc]={start:f.start,prevCC:this.prevCC,new:!0},this.prevCC=f.cc),c&&c.textCodec===L.IMSC1_CODEC?this._parseIMSC1(f,m):this._parseVTTs(f,m,l)}}else this.hls.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(u,x){var f=this,m=this.hls;Object(L.parseIMSC1)(x,this.initPTS[u.cc],this.timescale[u.cc],function(_){f._appendCues(_,u.level),m.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(_){C.logger.log("Failed to parse IMSC1: "+_),m.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:_})})},o._parseVTTs=function(u,x,f){var m=this,_=this.hls;Object(k.parseWebVTT)(x,this.initPTS[u.cc],this.timescale[u.cc],f,u.cc,u.start,function(y){m._appendCues(y,u.level),_.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(y){m._fallbackToIMSC1(u,x),C.logger.log("Failed to parse VTT cue: "+y),_.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:y})})},o._fallbackToIMSC1=function(u,x){var f=this,m=this.tracks[u.level];m.textCodec||Object(L.parseIMSC1)(x,this.initPTS[u.cc],this.timescale[u.cc],function(){m.textCodec=L.IMSC1_CODEC,f._parseIMSC1(u,x)},function(){m.textCodec="wvtt"})},o._appendCues=function(u,x){var f=this.hls;if(this.config.renderTextTracksNatively){var m=this.textTracks[x];if(m.mode==="disabled")return;u.forEach(function(h){return Object(O.addCueToTrack)(m,h)})}else{var _=this.tracks[x],y=_.default?"default":"subtitles"+x;f.trigger(M.Events.CUES_PARSED,{type:"subtitles",cues:u,track:y})}},o.onFragDecrypted=function(u,x){var f=x.frag;if(f.type===E.PlaylistLevelType.SUBTITLE){if(!Object(H.isFiniteNumber)(this.initPTS[f.cc])){this.unparsedVttFrags.push(x);return}this.onFragLoaded(M.Events.FRAG_LOADED,x)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(u,x){var f=this.cea608Parser1,m=this.cea608Parser2;if(!this.enabled||!(f&&m))return;for(var _=0;_<x.samples.length;_++){var y=x.samples[_].bytes;if(y){var h=this.extractCea608Data(y);f.addData(x.samples[_].pts,h[0]),m.addData(x.samples[_].pts,h[1])}}},o.onBufferFlushing=function(u,x){var f=x.startOffset,m=x.endOffset,_=x.endOffsetSubtitles,y=x.type,h=this.media;if(!h||h.currentTime<m)return;if(!y||y==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(O.removeCuesInRange)(c[a],f,m)})}if(this.config.renderTextTracksNatively&&(f===0&&_!==void 0)){var l=this.textTracks;Object.keys(l).forEach(function(a){return Object(O.removeCuesInRange)(l[a],f,_)})}},o.extractCea608Data=function(u){for(var x=u[0]&31,f=2,m=[[],[]],_=0;_<x;_++){var y=u[f++],h=127&u[f++],c=127&u[f++],l=(4&y)!==0,a=3&y;if(h===0&&c===0)continue;l&&((a===0||a===1)&&(m[a].push(h),m[a].push(c)))}return m},d}();function A(d,o){return d&&d.label===o.name&&!(d.textTrack1||d.textTrack2)}function w(d,o,s,u){return Math.min(o,u)-Math.max(d,s)}function b(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"default",function(){return H});var H=function(){function M(B,k){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=k}var P=M.prototype;return P.decrypt=function(k,O){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},O,k)},M}()},"./src/crypt/aes-decryptor.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"removePadding",function(){return M}),D.d(K,"default",function(){return P});var H=D("./src/utils/typed-array.ts");function M(B){var k=B.byteLength,O=k&&new DataView(B.buffer).getUint8(k-1);return O?Object(H.sliceUint8)(B,0,k-O):B}var P=function(){function B(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var k=B.prototype;return k.uint8ArrayToUint32Array_=function(L){for(var E=new DataView(L),C=new Uint32Array(4),R=0;R<4;R++)C[R]=E.getUint32(R*4);return C},k.initTable=function(){var L=this.sBox,E=this.invSBox,C=this.subMix,R=C[0],A=C[1],w=C[2],b=C[3],d=this.invSubMix,o=d[0],s=d[1],u=d[2],x=d[3],f=new Uint32Array(256),m=0,_=0,y=0;for(y=0;y<256;y++)y<128?f[y]=y<<1:f[y]=y<<1^283;for(y=0;y<256;y++){var h=_^_<<1^_<<2^_<<3^_<<4;h=h>>>8^h&255^99,L[m]=h,E[h]=m;var c=f[m],l=f[c],a=f[l],v=f[h]*257^h*16843008;R[m]=v<<24|v>>>8,A[m]=v<<16|v>>>16,w[m]=v<<8|v>>>24,b[m]=v,v=a*16843009^l*65537^c*257^m*16843008,o[h]=v<<24|v>>>8,s[h]=v<<16|v>>>16,u[h]=v<<8|v>>>24,x[h]=v,m?(m=c^f[f[f[a^c]]],_^=f[f[_]]):m=_=1}},k.expandKey=function(L){for(var E=this.uint8ArrayToUint32Array_(L),C=!0,R=0;R<E.length&&C;)C=E[R]===this.key[R],R++;if(C)return;this.key=E;var A=this.keySize=E.length;if(A!==4&&A!==6&&A!==8)throw new Error("Invalid aes key size="+A);var w=this.ksRows=(A+6+1)*4,b,d,o=this.keySchedule=new Uint32Array(w),s=this.invKeySchedule=new Uint32Array(w),u=this.sBox,x=this.rcon,f=this.invSubMix,m=f[0],_=f[1],y=f[2],h=f[3],c,l;for(b=0;b<w;b++){if(b<A){c=o[b]=E[b];continue}l=c,b%A===0?(l=l<<8|l>>>24,l=u[l>>>24]<<24|u[l>>>16&255]<<16|u[l>>>8&255]<<8|u[l&255],l^=x[b/A|0]<<24):A>6&&b%A===4&&(l=u[l>>>24]<<24|u[l>>>16&255]<<16|u[l>>>8&255]<<8|u[l&255]),o[b]=c=(o[b-A]^l)>>>0}for(d=0;d<w;d++)b=w-d,d&3?l=o[b]:l=o[b-4],d<4||b<=4?s[d]=l:s[d]=m[u[l>>>24]]^_[u[l>>>16&255]]^y[u[l>>>8&255]]^h[u[l&255]],s[d]=s[d]>>>0},k.networkToHostOrderSwap=function(L){return L<<24|(L&65280)<<8|(L&16711680)>>8|L>>>24},k.decrypt=function(L,E,C){for(var R=this.keySize+6,A=this.invKeySchedule,w=this.invSBox,b=this.invSubMix,d=b[0],o=b[1],s=b[2],u=b[3],x=this.uint8ArrayToUint32Array_(C),f=x[0],m=x[1],_=x[2],y=x[3],h=new Int32Array(L),c=new Int32Array(h.length),l,a,v,p,g,S,U,j,G,N,I,V,Q,ne,se=this.networkToHostOrderSwap;E<h.length;){for(G=se(h[E]),N=se(h[E+1]),I=se(h[E+2]),V=se(h[E+3]),g=G^A[0],S=V^A[1],U=I^A[2],j=N^A[3],Q=4,ne=1;ne<R;ne++)l=d[g>>>24]^o[S>>16&255]^s[U>>8&255]^u[j&255]^A[Q],a=d[S>>>24]^o[U>>16&255]^s[j>>8&255]^u[g&255]^A[Q+1],v=d[U>>>24]^o[j>>16&255]^s[g>>8&255]^u[S&255]^A[Q+2],p=d[j>>>24]^o[g>>16&255]^s[S>>8&255]^u[U&255]^A[Q+3],g=l,S=a,U=v,j=p,Q=Q+4;l=w[g>>>24]<<24^w[S>>16&255]<<16^w[U>>8&255]<<8^w[j&255]^A[Q],a=w[S>>>24]<<24^w[U>>16&255]<<16^w[j>>8&255]<<8^w[g&255]^A[Q+1],v=w[U>>>24]<<24^w[j>>16&255]<<16^w[g>>8&255]<<8^w[S&255]^A[Q+2],p=w[j>>>24]<<24^w[g>>16&255]<<16^w[S>>8&255]<<8^w[U&255]^A[Q+3],c[E]=se(l^f),c[E+1]=se(p^m),c[E+2]=se(v^_),c[E+3]=se(a^y),f=G,m=N,_=I,y=V,E=E+4}return c.buffer},B}()},"./src/crypt/decrypter.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"default",function(){return E});var H=D("./src/crypt/aes-crypto.ts"),M=D("./src/crypt/fast-aes-key.ts"),P=D("./src/crypt/aes-decryptor.ts"),B=D("./src/utils/logger.ts"),k=D("./src/utils/mp4-tools.ts"),O=D("./src/utils/typed-array.ts"),L=16,E=function(){function C(A,w,b){var d=b===void 0?{}:b,o=d.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=A,this.config=w,this.removePKCS7Padding=s,s)try{var u=self.crypto;u&&(this.subtle=u.subtle||u.webkitSubtle)}catch(x){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var R=C.prototype;return R.destroy=function(){this.observer=null},R.isSync=function(){return this.config.enableSoftwareAES},R.flush=function(){var w=this.currentResult;if(!w){this.reset();return}var b=new Uint8Array(w);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(b):b},R.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},R.decrypt=function(w,b,d,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(w),b,d);var s=this.flush();s&&o(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(w),b,d).then(o)},R.softwareDecrypt=function(w,b,d){var o=this.currentIV,s=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(w=Object(k.appendUint8Array)(u,w),this.remainderData=null);var x=this.getValidChunk(w);if(!x.length)return null;o&&(d=o);var f=this.softwareDecrypter;f||(f=this.softwareDecrypter=new P.default),f.expandKey(b);var m=s;return this.currentResult=f.decrypt(x.buffer,0,d),this.currentIV=Object(O.sliceUint8)(x,-16).buffer,m||null},R.webCryptoDecrypt=function(w,b,d){var o=this,s=this.subtle;return(this.key!==b||!this.fastAesKey)&&(this.key=b,this.fastAesKey=new M.default(s,b)),this.fastAesKey.expandKey().then(function(u){if(!s)return Promise.reject(new Error("web crypto not initialized"));var x=new H.default(s,d);return x.decrypt(w.buffer,u)}).catch(function(u){return o.onWebCryptoError(u,w,b,d)})},R.onWebCryptoError=function(w,b,d,o){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",w),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(b,d,o)},R.getValidChunk=function(w){var b=w,d=w.length-w.length%L;return d!==w.length&&(b=Object(O.sliceUint8)(w,0,d),this.remainderData=Object(O.sliceUint8)(w,d)),b},R.logOnce=function(w){if(!this.logEnabled)return;B.logger.log("[decrypter.ts]: "+w),this.logEnabled=!1},C}()},"./src/crypt/fast-aes-key.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"default",function(){return H});var H=function(){function M(B,k){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=k}var P=M.prototype;return P.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},M}()},"./src/demux/aacdemuxer.ts":function(te,K,D){"use strict";D.r(K);var H=D("./src/demux/base-audio-demuxer.ts"),M=D("./src/demux/adts.ts"),P=D("./src/utils/logger.ts"),B=D("./src/demux/id3.ts");function k(E,C){E.prototype=Object.create(C.prototype),E.prototype.constructor=E,O(E,C)}function O(E,C){return O=Object.setPrototypeOf||function(A,w){return A.__proto__=w,A},O(E,C)}var L=function(E){k(C,E);function C(A,w){var b;return b=E.call(this)||this,b.observer=void 0,b.config=void 0,b.observer=A,b.config=w,b}var R=C.prototype;return R.resetInitSegment=function(w,b,d){E.prototype.resetInitSegment.call(this,w,b,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:w,duration:d,inputTimeScale:9e4,dropped:0}},C.probe=function(w){if(!w)return!1;for(var b=B.getID3Data(w,0)||[],d=b.length,o=w.length;d<o;d++)if(M.probe(w,d))return P.logger.log("ADTS sync word found !"),!0;return!1},R.canParse=function(w,b){return M.canParse(w,b)},R.appendFrame=function(w,b,d){M.initTrackConfig(w,this.observer,b,d,w.manifestCodec);var o=M.appendFrame(w,b,d,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},C}(H.default);L.minProbeByteLength=9,K.default=L},"./src/demux/adts.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"getAudioConfig",function(){return B}),D.d(K,"isHeaderPattern",function(){return k}),D.d(K,"getHeaderLength",function(){return O}),D.d(K,"getFullFrameLength",function(){return L}),D.d(K,"canGetFrameLength",function(){return E}),D.d(K,"isHeader",function(){return C}),D.d(K,"canParse",function(){return R}),D.d(K,"probe",function(){return A}),D.d(K,"initTrackConfig",function(){return w}),D.d(K,"getFrameDuration",function(){return b}),D.d(K,"parseFrameHeader",function(){return d}),D.d(K,"appendFrame",function(){return o});var H=D("./src/utils/logger.ts"),M=D("./src/errors.ts"),P=D("./src/events.ts");function B(s,u,x,f){var m,_,y,h,c=navigator.userAgent.toLowerCase(),l=f,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];m=((u[x+2]&192)>>>6)+1;var v=(u[x+2]&60)>>>2;if(v>a.length-1){s.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+v});return}return y=(u[x+2]&1)<<2,y|=(u[x+3]&192)>>>6,H.logger.log("manifest codec:"+f+", ADTS type:"+m+", samplingIndex:"+v),/firefox/i.test(c)?v>=6?(m=5,h=new Array(4),_=v-3):(m=2,h=new Array(2),_=v):c.indexOf("android")!==-1?(m=2,h=new Array(2),_=v):(m=5,h=new Array(4),f&&(f.indexOf("mp4a.40.29")!==-1||f.indexOf("mp4a.40.5")!==-1)||!f&&v>=6?_=v-3:((f&&f.indexOf("mp4a.40.2")!==-1&&(v>=6&&y===1||/vivaldi/i.test(c))||!f&&y===1)&&(m=2,h=new Array(2)),_=v)),h[0]=m<<3,h[0]|=(v&14)>>1,h[1]|=(v&1)<<7,h[1]|=y<<3,m===5&&(h[1]|=(_&14)>>1,h[2]=(_&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:a[v],channelCount:y,codec:"mp4a.40."+m,manifestCodec:l}}function k(s,u){return s[u]===255&&(s[u+1]&246)===240}function O(s,u){return s[u+1]&1?7:9}function L(s,u){return(s[u+3]&3)<<11|s[u+4]<<3|(s[u+5]&224)>>>5}function E(s,u){return u+5<s.length}function C(s,u){return u+1<s.length&&k(s,u)}function R(s,u){return E(s,u)&&k(s,u)&&L(s,u)<=s.length-u}function A(s,u){if(C(s,u)){var x=O(s,u);if(u+x>=s.length)return!1;var f=L(s,u);if(f<=x)return!1;var m=u+f;return m===s.length||C(s,m)}return!1}function w(s,u,x,f,m){if(!s.samplerate){var _=B(u,x,f,m);if(!_)return;s.config=_.config,s.samplerate=_.samplerate,s.channelCount=_.channelCount,s.codec=_.codec,s.manifestCodec=_.manifestCodec,H.logger.log("parsed codec:"+s.codec+", rate:"+_.samplerate+", channels:"+_.channelCount)}}function b(s){return 1024*9e4/s}function d(s,u,x,f,m){var _=O(s,u),y=L(s,u);if(y-=_,y>0){var h=x+f*m;return{headerLength:_,frameLength:y,stamp:h}}}function o(s,u,x,f,m){var _=b(s.samplerate),y=d(u,x,f,m,_);if(y){var h=y.frameLength,c=y.headerLength,l=y.stamp,a=c+h,v=Math.max(0,x+a-u.length),p;v?(p=new Uint8Array(a-c),p.set(u.subarray(x+c,u.length),0)):p=u.subarray(x+c,x+a);var g={unit:p,pts:l};return v||s.samples.push(g),{sample:g,length:a,missing:v}}}},"./src/demux/base-audio-demuxer.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"initPTSFn",function(){return L});var H=D("./src/polyfills/number.ts"),M=D("./src/demux/id3.ts"),P=D("./src/demux/dummy-demuxed-track.ts"),B=D("./src/utils/mp4-tools.ts"),k=D("./src/utils/typed-array.ts"),O=function(){function E(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var C=E.prototype;return C.resetInitSegment=function(A,w,b){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},C.resetTimeStamp=function(){},C.resetContiguity=function(){},C.canParse=function(A,w){return!1},C.appendFrame=function(A,w,b){},C.demux=function(A,w){this.cachedData&&(A=Object(B.appendUint8Array)(this.cachedData,A),this.cachedData=null);var b=M.getID3Data(A,0),d=b?b.length:0,o,s,u=this._audioTrack,x=this._id3Track,f=b?M.getTimeStamp(b):void 0,m=A.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=L(f,w)),b&&b.length>0&&x.samples.push({pts:this.initPTS,dts:this.initPTS,data:b}),s=this.initPTS;d<m;){if(this.canParse(A,d)){var _=this.appendFrame(u,A,d);_?(this.frameIndex++,s=_.sample.pts,d+=_.length,o=d):d=m}else M.canParse(A,d)?(b=M.getID3Data(A,d),x.samples.push({pts:s,dts:s,data:b}),d+=b.length,o=d):d++;if(d===m&&o!==m){var y=Object(k.sliceUint8)(A,o);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,y):this.cachedData=y}}return{audioTrack:u,avcTrack:Object(P.dummyTrack)(),id3Track:x,textTrack:Object(P.dummyTrack)()}},C.demuxSampleAes=function(A,w,b){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},C.flush=function(A){var w=this.cachedData;return w&&(this.cachedData=null,this.demux(w,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},C.destroy=function(){},E}(),L=function(C,R){return Object(H.isFiniteNumber)(C)?C*90:R*9e4};K.default=O},"./src/demux/chunk-cache.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"default",function(){return H});var H=function(){function P(){this.chunks=[],this.dataLength=0}var B=P.prototype;return B.push=function(O){this.chunks.push(O),this.dataLength+=O.length},B.flush=function(){var O=this.chunks,L=this.dataLength,E;if(O.length)O.length===1?E=O[0]:E=M(O,L);else return new Uint8Array(0);return this.reset(),E},B.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function M(P,B){for(var k=new Uint8Array(B),O=0,L=0;L<P.length;L++){var E=P[L];k.set(E,O),O+=E.length}return k}},"./src/demux/dummy-demuxed-track.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"dummyTrack",function(){return H});function H(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(te,K,D){"use strict";D.r(K);var H=D("./src/utils/logger.ts"),M=function(){function P(k){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=k,this.bytesAvailable=k.byteLength,this.word=0,this.bitsAvailable=0}var B=P.prototype;return B.loadWord=function(){var O=this.data,L=this.bytesAvailable,E=O.byteLength-L,C=new Uint8Array(4),R=Math.min(4,L);if(R===0)throw new Error("no bytes available");C.set(O.subarray(E,E+R)),this.word=new DataView(C.buffer).getUint32(0),this.bitsAvailable=R*8,this.bytesAvailable-=R},B.skipBits=function(O){var L;this.bitsAvailable>O?(this.word<<=O,this.bitsAvailable-=O):(O-=this.bitsAvailable,L=O>>3,O-=L>>3,this.bytesAvailable-=L,this.loadWord(),this.word<<=O,this.bitsAvailable-=O)},B.readBits=function(O){var L=Math.min(this.bitsAvailable,O),E=this.word>>>32-L;return O>32&&H.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=L,this.bitsAvailable>0?this.word<<=L:this.bytesAvailable>0&&this.loadWord(),L=O-L,L>0&&this.bitsAvailable?E<<L|this.readBits(L):E},B.skipLZ=function(){var O;for(O=0;O<this.bitsAvailable;++O)if((this.word&2147483648>>>O)!==0)return this.word<<=O,this.bitsAvailable-=O,O;return this.loadWord(),O+this.skipLZ()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var O=this.skipLZ();return this.readBits(O+1)-1},B.readEG=function(){var O=this.readUEG();return 1&O?1+O>>>1:-1*(O>>>1)},B.readBoolean=function(){return this.readBits(1)===1},B.readUByte=function(){return this.readBits(8)},B.readUShort=function(){return this.readBits(16)},B.readUInt=function(){return this.readBits(32)},B.skipScalingList=function(O){for(var L=8,E=8,C,R=0;R<O;R++)E!==0&&(C=this.readEG(),E=(L+C+256)%256),L=E===0?L:E},B.readSPS=function(){var O=0,L=0,E=0,C=0,R,A,w,b=this.readUByte.bind(this),d=this.readBits.bind(this),o=this.readUEG.bind(this),s=this.readBoolean.bind(this),u=this.skipBits.bind(this),x=this.skipEG.bind(this),f=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);b();var _=b();if(d(5),u(3),b(),f(),_===100||_===110||_===122||_===244||_===44||_===83||_===86||_===118||_===128){var y=o();if(y===3&&u(1),f(),f(),u(1),s())for(A=y!==3?8:12,w=0;w<A;w++)s()&&(w<6?m(16):m(64))}f();var h=o();if(h===0)o();else if(h===1)for(u(1),x(),x(),R=o(),w=0;w<R;w++)x();f(),u(1);var c=o(),l=o(),a=d(1);a===0&&u(1),u(1),s()&&(O=o(),L=o(),E=o(),C=o());var v=[1,1];if(s()&&s()){var p=b();switch(p){case 1:v=[1,1];break;case 2:v=[12,11];break;case 3:v=[10,11];break;case 4:v=[16,11];break;case 5:v=[40,33];break;case 6:v=[24,11];break;case 7:v=[20,11];break;case 8:v=[32,11];break;case 9:v=[80,33];break;case 10:v=[18,11];break;case 11:v=[15,11];break;case 12:v=[64,33];break;case 13:v=[160,99];break;case 14:v=[4,3];break;case 15:v=[3,2];break;case 16:v=[2,1];break;case 255:{v=[b()<<8|b(),b()<<8|b()];break}}}return{width:Math.ceil((c+1)*16-O*2-L*2),height:(2-a)*(l+1)*16-(a?2:4)*(E+C),pixelRatio:v}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();K.default=M},"./src/demux/id3.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"isHeader",function(){return H}),D.d(K,"isFooter",function(){return M}),D.d(K,"getID3Data",function(){return P}),D.d(K,"canParse",function(){return k}),D.d(K,"getTimeStamp",function(){return O}),D.d(K,"isTimeStampFrame",function(){return L}),D.d(K,"getID3Frames",function(){return C}),D.d(K,"decodeFrame",function(){return R}),D.d(K,"utf8ArrayToStr",function(){return o}),D.d(K,"testables",function(){return s});var H=function(m,_){return _+10<=m.length&&(m[_]===73&&m[_+1]===68&&m[_+2]===51&&(m[_+3]<255&&m[_+4]<255&&(m[_+6]<128&&m[_+7]<128&&m[_+8]<128&&m[_+9]<128)))},M=function(m,_){return _+10<=m.length&&(m[_]===51&&m[_+1]===68&&m[_+2]===73&&(m[_+3]<255&&m[_+4]<255&&(m[_+6]<128&&m[_+7]<128&&m[_+8]<128&&m[_+9]<128)))},P=function(m,_){for(var y=_,h=0;H(m,_);){h+=10;var c=B(m,_+6);h+=c,M(m,_+10)&&(h+=10),_+=h}return h>0?m.subarray(y,y+h):void 0},B=function(m,_){var y=0;return y=(m[_]&127)<<21,y|=(m[_+1]&127)<<14,y|=(m[_+2]&127)<<7,y|=m[_+3]&127,y},k=function(m,_){return H(m,_)&&B(m,_+6)+10<=m.length-_},O=function(m){for(var _=C(m),y=0;y<_.length;y++){var h=_[y];if(L(h))return d(h)}return},L=function(m){return m&&m.key==="PRIV"&&m.info==="com.apple.streaming.transportStreamTimestamp"},E=function(m){var _=String.fromCharCode(m[0],m[1],m[2],m[3]),y=B(m,4),h=10;return{type:_,size:y,data:m.subarray(h,h+y)}},C=function(m){for(var _=0,y=[];H(m,_);){var h=B(m,_+6);_+=10;for(var c=_+h;_+8<c;){var l=E(m.subarray(_)),a=R(l);a&&y.push(a),_+=l.size+10}M(m,_)&&(_+=10)}return y},R=function(m){return m.type==="PRIV"?A(m):m.type[0]==="W"?b(m):w(m)},A=function(m){if(m.size<2)return;var _=o(m.data,!0),y=new Uint8Array(m.data.subarray(_.length+1));return{key:m.type,info:_,data:y.buffer}},w=function(m){if(m.size<2)return;if(m.type==="TXXX"){var _=1,y=o(m.data.subarray(_),!0);_+=y.length+1;var h=o(m.data.subarray(_));return{key:m.type,info:y,data:h}}var c=o(m.data.subarray(1));return{key:m.type,data:c}},b=function(m){if(m.type==="WXXX"){if(m.size<2)return;var _=1,y=o(m.data.subarray(_),!0);_+=y.length+1;var h=o(m.data.subarray(_));return{key:m.type,info:y,data:h}}var c=o(m.data);return{key:m.type,data:c}},d=function(m){if(m.data.byteLength===8){var _=new Uint8Array(m.data),y=_[3]&1,h=(_[4]<<23)+(_[5]<<15)+(_[6]<<7)+_[7];return h/=45,y&&(h+=4772185884e-2),Math.round(h)}return},o=function(m,_){_===void 0&&(_=!1);var y=x();if(y){var h=y.decode(m);if(_){var c=h.indexOf("\0");return c!==-1?h.substring(0,c):h}return h.replace(/\0/g,"")}for(var l=m.length,a,v,p,g="",S=0;S<l;){if(a=m[S++],a===0&&_)return g;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:g+=String.fromCharCode(a);break;case 12:case 13:v=m[S++],g+=String.fromCharCode((a&31)<<6|v&63);break;case 14:v=m[S++],p=m[S++],g+=String.fromCharCode((a&15)<<12|(v&63)<<6|(p&63)<<0);break;default:}}return g},s={decodeTextFrame:w},u;function x(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(te,K,D){"use strict";D.r(K);var H=D("./src/demux/base-audio-demuxer.ts"),M=D("./src/demux/id3.ts"),P=D("./src/utils/logger.ts"),B=D("./src/demux/mpegaudio.ts");function k(E,C){E.prototype=Object.create(C.prototype),E.prototype.constructor=E,O(E,C)}function O(E,C){return O=Object.setPrototypeOf||function(A,w){return A.__proto__=w,A},O(E,C)}var L=function(E){k(C,E);function C(){return E.apply(this,arguments)||this}var R=C.prototype;return R.resetInitSegment=function(w,b,d){E.prototype.resetInitSegment.call(this,w,b,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:w,duration:d,inputTimeScale:9e4,dropped:0}},C.probe=function(w){if(!w)return!1;for(var b=M.getID3Data(w,0)||[],d=b.length,o=w.length;d<o;d++)if(B.probe(w,d))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},R.canParse=function(w,b){return B.canParse(w,b)},R.appendFrame=function(w,b,d){return this.initPTS===null?void 0:B.appendFrame(w,b,d,this.initPTS,this.frameIndex)},C}(H.default);L.minProbeByteLength=4,K.default=L},"./src/demux/mp4demuxer.ts":function(te,K,D){"use strict";D.r(K);var H=D("./src/utils/mp4-tools.ts"),M=D("./src/demux/dummy-demuxed-track.ts"),P=function(){function B(O,L){this.remainderData=null,this.config=void 0,this.config=L}var k=B.prototype;return k.resetTimeStamp=function(){},k.resetInitSegment=function(){},k.resetContiguity=function(){},B.probe=function(L){return Object(H.findBox)({data:L,start:0,end:Math.min(L.length,16384)},["moof"]).length>0},k.demux=function(L){var E=L,C=Object(M.dummyTrack)();if(this.config.progressive){this.remainderData&&(E=Object(H.appendUint8Array)(this.remainderData,L));var R=Object(H.segmentValidRange)(E);this.remainderData=R.remainder,C.samples=R.valid||new Uint8Array}else C.samples=E;return{audioTrack:Object(M.dummyTrack)(),avcTrack:C,id3Track:Object(M.dummyTrack)(),textTrack:Object(M.dummyTrack)()}},k.flush=function(){var L=Object(M.dummyTrack)();return L.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(M.dummyTrack)(),avcTrack:L,id3Track:Object(M.dummyTrack)(),textTrack:Object(M.dummyTrack)()}},k.demuxSampleAes=function(L,E,C){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},k.destroy=function(){},B}();P.minProbeByteLength=1024,K.default=P},"./src/demux/mpegaudio.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"appendFrame",function(){return O}),D.d(K,"parseHeader",function(){return L}),D.d(K,"isHeaderPattern",function(){return E}),D.d(K,"isHeader",function(){return C}),D.d(K,"canParse",function(){return R}),D.d(K,"probe",function(){return A});var H=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],P=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],B=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],k=[0,1,1,4];function O(w,b,d,o,s){if(d+24>b.length)return;var u=L(b,d);if(u&&d+u.frameLength<=b.length){var x=u.samplesPerFrame*9e4/u.sampleRate,f=o+s*x,m={unit:b.subarray(d,d+u.frameLength),pts:f,dts:f};return w.config=[],w.channelCount=u.channelCount,w.samplerate=u.sampleRate,w.samples.push(m),{sample:m,length:u.frameLength,missing:0}}}function L(w,b){var d=w[b+1]>>3&3,o=w[b+1]>>1&3,s=w[b+2]>>4&15,u=w[b+2]>>2&3;if(d!==1&&s!==0&&s!==15&&u!==3){var x=w[b+2]>>1&1,f=w[b+3]>>6,m=d===3?3-o:o===3?3:4,_=M[m*14+s-1]*1e3,y=d===3?0:d===2?1:2,h=P[y*3+u],c=f===3?1:2,l=B[d][o],a=k[o],v=l*8*a,p=Math.floor(l*_/h+x)*a;if(H===null){var g=navigator.userAgent||"",S=g.match(/Chrome\/(\d+)/i);H=S?parseInt(S[1]):0}var U=!!H&&H<=87;return U&&o===2&&_>=224e3&&f===0&&(w[b+3]=w[b+3]|128),{sampleRate:h,channelCount:c,frameLength:p,samplesPerFrame:v}}}function E(w,b){return w[b]===255&&(w[b+1]&224)===224&&(w[b+1]&6)!==0}function C(w,b){return b+1<w.length&&E(w,b)}function R(w,b){var d=4;return E(w,b)&&d<=w.length-b}function A(w,b){if(b+1<w.length&&E(w,b)){var d=4,o=L(w,b),s=d;o!=null&&o.frameLength&&(s=o.frameLength);var u=b+s;return u===w.length||C(w,u)}return!1}},"./src/demux/sample-aes.ts":function(te,K,D){"use strict";D.r(K);var H=D("./src/crypt/decrypter.ts"),M=D("./src/demux/tsdemuxer.ts"),P=function(){function B(O,L,E){this.keyData=void 0,this.decrypter=void 0,this.keyData=E,this.decrypter=new H.default(O,L,{removePKCS7Padding:!1})}var k=B.prototype;return k.decryptBuffer=function(L,E){this.decrypter.decrypt(L,this.keyData.key.buffer,this.keyData.iv.buffer,E)},k.decryptAacSample=function(L,E,C,R){var A=L[E].unit,w=A.subarray(16,A.length-A.length%16),b=w.buffer.slice(w.byteOffset,w.byteOffset+w.length),d=this;this.decryptBuffer(b,function(o){var s=new Uint8Array(o);A.set(s,16),R||d.decryptAacSamples(L,E+1,C)})},k.decryptAacSamples=function(L,E,C){for(;;E++){if(E>=L.length){C();return}if(L[E].unit.length<32)continue;var R=this.decrypter.isSync();if(this.decryptAacSample(L,E,C,R),!R)return}},k.getAvcEncryptedData=function(L){for(var E=Math.floor((L.length-48)/160)*16+16,C=new Int8Array(E),R=0,A=32;A<=L.length-16;A+=160,R+=16)C.set(L.subarray(A,A+16),R);return C},k.getAvcDecryptedUnit=function(L,E){for(var C=new Uint8Array(E),R=0,A=32;A<=L.length-16;A+=160,R+=16)L.set(C.subarray(R,R+16),A);return L},k.decryptAvcSample=function(L,E,C,R,A,w){var b=Object(M.discardEPB)(A.data),d=this.getAvcEncryptedData(b),o=this;this.decryptBuffer(d.buffer,function(s){A.data=o.getAvcDecryptedUnit(b,s),w||o.decryptAvcSamples(L,E,C+1,R)})},k.decryptAvcSamples=function(L,E,C,R){if(L instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;E++,C=0){if(E>=L.length){R();return}for(var A=L[E].units;!(C>=A.length);C++){var w=A[C];if(w.data.length<=48||w.type!==1&&w.type!==5)continue;var b=this.decrypter.isSync();if(this.decryptAvcSample(L,E,C,R,w,b),!b)return}}},B}();K.default=P},"./src/demux/transmuxer-interface.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"default",function(){return A});var H=D("./node_modules/webworkify-webpack/index.js"),M=D.n(H),P=D("./src/events.ts"),B=D("./src/demux/transmuxer.ts"),k=D("./src/utils/logger.ts"),O=D("./src/errors.ts"),L=D("./src/utils/mediasource-helper.ts"),E=D("./node_modules/eventemitter3/index.js"),C=D.n(E),R=Object(L.getMediaSource)()||{isTypeSupported:function(){return!1}},A=function(){function w(d,o,s,u){var x=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=d,this.id=o,this.onTransmuxComplete=s,this.onFlush=u;var f=d.config,m=function(l,a){a=a||{},a.frag=x.frag,a.id=x.id,d.trigger(l,a)};this.observer=new E.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,m),this.observer.on(P.Events.ERROR,m);var _={mp4:R.isTypeSupported("video/mp4"),mpeg:R.isTypeSupported("audio/mpeg"),mp3:R.isTypeSupported('audio/mp4; codecs="mp3"')},y=navigator.vendor;if(f.enableWorker&&typeof Worker!="undefined"){k.logger.log("demuxing in webworker");var h;try{h=this.worker=H("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(c){d.trigger(P.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},h.postMessage({cmd:"init",typeSupported:_,vendor:y,id:o,config:JSON.stringify(f)})}catch(c){k.logger.warn("Error in worker:",c),k.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new B.default(this.observer,_,f,y,o),this.worker=null}}else this.transmuxer=new B.default(this.observer,_,f,y,o)}var b=w.prototype;return b.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 u=this.observer;u&&u.removeAllListeners(),this.observer=null},b.push=function(o,s,u,x,f,m,_,y,h,c){var l=this;h.transmuxing.start=self.performance.now();var a=this.transmuxer,v=this.worker,p=m?m.start:f.start,g=f.decryptdata,S=this.frag,U=!(S&&f.cc===S.cc),j=!(S&&h.level===S.level),G=S?h.sn-S.sn:-1,N=this.part?h.part-this.part.index:1,I=!j&&(G===1||G===0&&N===1),V=self.performance.now();(j||G||f.stats.parsing.start===0)&&(f.stats.parsing.start=V),m&&(N||!I)&&(m.stats.parsing.start=V);var Q=new B.TransmuxState(U,I,y,j,p);if(!I||U){k.logger.log("[transmuxer-interface, "+f.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
|
|
discontinuity: `+U+`
|
|
trackSwitch: `+j+`
|
|
contiguous: `+I+`
|
|
accurateTimeOffset: `+y+`
|
|
timeOffset: `+p);var ne=new B.TransmuxConfig(u,x,s,_,c);this.configureTransmuxer(ne)}if(this.frag=f,this.part=m,v)v.postMessage({cmd:"demux",data:o,decryptdata:g,chunkMeta:h,state:Q},o instanceof ArrayBuffer?[o]:[]);else if(a){var se=a.push(o,g,h,Q);Object(B.isPromise)(se)?se.then(function(xe){l.handleTransmuxComplete(xe)}):this.handleTransmuxComplete(se)}},b.flush=function(o){var s=this;o.transmuxing.start=self.performance.now();var u=this.transmuxer,x=this.worker;if(x)x.postMessage({cmd:"flush",chunkMeta:o});else if(u){var f=u.flush(o);Object(B.isPromise)(f)?f.then(function(m){s.handleFlushResult(m,o)}):this.handleFlushResult(f,o)}},b.handleFlushResult=function(o,s){var u=this;o.forEach(function(x){u.handleTransmuxComplete(x)}),this.onFlush(s)},b.onWorkerMessage=function(o){var s=o.data,u=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,u.trigger(s.event,s.data);break}}},b.configureTransmuxer=function(o){var s=this.worker,u=this.transmuxer;s?s.postMessage({cmd:"configure",config:o}):u&&u.configure(o)},b.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},w}()},"./src/demux/transmuxer-worker.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"default",function(){return O});var H=D("./src/demux/transmuxer.ts"),M=D("./src/events.ts"),P=D("./src/utils/logger.ts"),B=D("./node_modules/eventemitter3/index.js"),k=D.n(B);function O(A){var w=new B.EventEmitter,b=function(o,s){A.postMessage({event:o,data:s})};w.on(M.Events.FRAG_DECRYPTED,b),w.on(M.Events.ERROR,b),A.addEventListener("message",function(d){var o=d.data;switch(o.cmd){case"init":{var s=JSON.parse(o.config);A.transmuxer=new H.default(w,o.typeSupported,s,o.vendor,o.id),Object(P.enableLogs)(s.debug),b("init",null);break}case"configure":{A.transmuxer.configure(o.config);break}case"demux":{var u=A.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(H.isPromise)(u)?u.then(function(m){L(A,m)}):L(A,u);break}case"flush":{var x=o.chunkMeta,f=A.transmuxer.flush(x);Object(H.isPromise)(f)?f.then(function(m){C(A,m,x)}):C(A,f,x);break}default:break}})}function L(A,w){if(R(w.remuxResult))return;var b=[],d=w.remuxResult,o=d.audio,s=d.video;o&&E(b,o),s&&E(b,s),A.postMessage({event:"transmuxComplete",data:w},b)}function E(A,w){w.data1&&A.push(w.data1.buffer),w.data2&&A.push(w.data2.buffer)}function C(A,w,b){w.forEach(function(d){L(A,d)}),A.postMessage({event:"flush",data:b})}function R(A){return!A.audio&&!A.video&&!A.text&&!A.id3&&!A.initSegment}},"./src/demux/transmuxer.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"default",function(){return s}),D.d(K,"isPromise",function(){return f}),D.d(K,"TransmuxConfig",function(){return m}),D.d(K,"TransmuxState",function(){return _});var H=D("./src/events.ts"),M=D("./src/errors.ts"),P=D("./src/crypt/decrypter.ts"),B=D("./src/demux/aacdemuxer.ts"),k=D("./src/demux/mp4demuxer.ts"),O=D("./src/demux/tsdemuxer.ts"),L=D("./src/demux/mp3demuxer.ts"),E=D("./src/remux/mp4-remuxer.ts"),C=D("./src/remux/passthrough-remuxer.ts"),R=D("./src/demux/chunk-cache.ts"),A=D("./src/utils/mp4-tools.ts"),w=D("./src/utils/logger.ts"),b;try{b=self.performance.now.bind(self.performance)}catch(y){w.logger.debug("Unable to use Performance API on this environment"),b=self.Date.now}var d=[{demux:O.default,remux:E.default},{demux:k.default,remux:C.default},{demux:B.default,remux:E.default},{demux:L.default,remux:E.default}],o=1024;d.forEach(function(y){var h=y.demux;o=Math.max(o,h.minProbeByteLength)});var s=function(){function y(c,l,a,v,p){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new R.default,this.observer=c,this.typeSupported=l,this.config=a,this.vendor=v,this.id=p}var h=y.prototype;return h.configure=function(l){this.transmuxConfig=l,this.decrypter&&this.decrypter.reset()},h.push=function(l,a,v,p){var g=this,S=v.transmuxing;S.executeStart=b();var U=new Uint8Array(l),j=this.cache,G=this.config,N=this.currentTransmuxState,I=this.transmuxConfig;p&&(this.currentTransmuxState=p);var V=u(U,a);if(V&&V.method==="AES-128"){var Q=this.getDecrypter();if(G.enableSoftwareAES){var ne=Q.softwareDecrypt(U,V.key.buffer,V.iv.buffer);if(!ne)return S.executeEnd=b(),x(v);U=new Uint8Array(ne)}else return this.decryptionPromise=Q.webCryptoDecrypt(U,V.key.buffer,V.iv.buffer).then(function(we){var De=g.push(we,null,v);return g.decryptionPromise=null,De}),this.decryptionPromise}var se=p||N,xe=se.contiguous,me=se.discontinuity,Le=se.trackSwitch,Ee=se.accurateTimeOffset,Te=se.timeOffset,ce=I.audioCodec,fe=I.videoCodec,J=I.defaultInitPts,le=I.duration,ee=I.initSegmentData;if((me||Le)&&this.resetInitSegment(ee,ce,fe,le),me&&this.resetInitialTimestamp(J),xe||this.resetContiguity(),this.needsProbing(U,me,Le)){if(j.dataLength){var pe=j.flush();U=Object(A.appendUint8Array)(pe,U)}this.configureTransmuxer(U,I)}var ye=this.transmux(U,V,Te,Ee,v),he=this.currentTransmuxState;return he.contiguous=!0,he.discontinuity=!1,he.trackSwitch=!1,S.executeEnd=b(),ye},h.flush=function(l){var a=this,v=l.transmuxing;v.executeStart=b();var p=this.decrypter,g=this.cache,S=this.currentTransmuxState,U=this.decryptionPromise;if(U)return U.then(function(){return a.flush(l)});var j=[],G=S.timeOffset;if(p){var N=p.flush();N&&j.push(this.push(N,null,l))}var I=g.dataLength;g.reset();var V=this.demuxer,Q=this.remuxer;if(!V||!Q)return I>=o&&this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),v.executeEnd=b(),[x(l)];var ne=V.flush(G);return f(ne)?ne.then(function(se){return a.flushRemux(j,se,l),j}):(this.flushRemux(j,ne,l),j)},h.flushRemux=function(l,a,v){var p=a.audioTrack,g=a.avcTrack,S=a.id3Track,U=a.textTrack,j=this.currentTransmuxState,G=j.accurateTimeOffset,N=j.timeOffset;w.logger.log("[transmuxer.ts]: Flushed fragment "+v.sn+(v.part>-1?" p: "+v.part:"")+" of level "+v.level);var I=this.remuxer.remux(p,g,S,U,N,G,!0,this.id);l.push({remuxResult:I,chunkMeta:v}),v.transmuxing.executeEnd=b()},h.resetInitialTimestamp=function(l){var a=this.demuxer,v=this.remuxer;if(!a||!v)return;a.resetTimeStamp(l),v.resetTimeStamp(l)},h.resetContiguity=function(){var l=this.demuxer,a=this.remuxer;if(!l||!a)return;l.resetContiguity(),a.resetNextTimestamp()},h.resetInitSegment=function(l,a,v,p){var g=this.demuxer,S=this.remuxer;if(!g||!S)return;g.resetInitSegment(a,v,p),S.resetInitSegment(l,a,v)},h.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},h.transmux=function(l,a,v,p,g){var S;return a&&a.method==="SAMPLE-AES"?S=this.transmuxSampleAes(l,a,v,p,g):S=this.transmuxUnencrypted(l,v,p,g),S},h.transmuxUnencrypted=function(l,a,v,p){var g=this.demuxer.demux(l,a,!1,!this.config.progressive),S=g.audioTrack,U=g.avcTrack,j=g.id3Track,G=g.textTrack,N=this.remuxer.remux(S,U,j,G,a,v,!1,this.id);return{remuxResult:N,chunkMeta:p}},h.transmuxSampleAes=function(l,a,v,p,g){var S=this;return this.demuxer.demuxSampleAes(l,a,v).then(function(U){var j=S.remuxer.remux(U.audioTrack,U.avcTrack,U.id3Track,U.textTrack,v,p,!1,S.id);return{remuxResult:j,chunkMeta:g}})},h.configureTransmuxer=function(l,a){for(var v=this.config,p=this.observer,g=this.typeSupported,S=this.vendor,U=a.audioCodec,j=a.defaultInitPts,G=a.duration,N=a.initSegmentData,I=a.videoCodec,V,Q=0,ne=d.length;Q<ne;Q++)if(d[Q].demux.probe(l)){V=d[Q];break}V||(w.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),V={demux:k.default,remux:C.default});var se=this.demuxer,xe=this.remuxer,me=V.remux,Le=V.demux;(!xe||!(xe instanceof me))&&(this.remuxer=new me(p,v,g,S)),(!se||!(se instanceof Le))&&(this.demuxer=new Le(p,v,g),this.probe=Le.probe),this.resetInitSegment(N,U,I,G),this.resetInitialTimestamp(j)},h.needsProbing=function(l,a,v){return!this.demuxer||!this.remuxer||a||v},h.getDecrypter=function(){var l=this.decrypter;return l||(l=this.decrypter=new P.default(this.observer,this.config)),l},y}();function u(y,h){var c=null;return y.byteLength>0&&h!=null&&h.key!=null&&h.iv!==null&&h.method!=null&&(c=h),c}var x=function(h){return{remuxResult:{},chunkMeta:h}};function f(y){return"then"in y&&y.then instanceof Function}var m=function(h,c,l,a,v){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=h,this.videoCodec=c,this.initSegmentData=l,this.duration=a,this.defaultInitPts=v},_=function(h,c,l,a,v){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=h,this.contiguous=c,this.accurateTimeOffset=l,this.trackSwitch=a,this.timeOffset=v}},"./src/demux/tsdemuxer.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"discardEPB",function(){return x});var H=D("./src/demux/adts.ts"),M=D("./src/demux/mpegaudio.ts"),P=D("./src/demux/exp-golomb.ts"),B=D("./src/demux/id3.ts"),k=D("./src/demux/sample-aes.ts"),O=D("./src/events.ts"),L=D("./src/utils/mp4-tools.ts"),E=D("./src/utils/logger.ts"),C=D("./src/errors.ts"),R={video:1,audio:2,id3:3,text:4},A=function(){function f(_,y,h){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=_,this.config=y,this.typeSupported=h}f.probe=function(y){var h=f.syncOffset(y);return h<0?!1:(h&&E.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},f.syncOffset=function(y){for(var h=Math.min(1e3,y.length-3*188),c=0;c<h;){if(y[c]===71&&y[c+188]===71&&y[c+2*188]===71)return c;c++}return-1},f.createTrack=function(y,h){return{container:y==="video"||y==="audio"?"video/mp2t":void 0,type:y,id:R[y],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:y==="audio"?h:void 0}};var m=f.prototype;return m.resetInitSegment=function(y,h,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=f.createTrack("video",c),this._audioTrack=f.createTrack("audio",c),this._id3Track=f.createTrack("id3",c),this._txtTrack=f.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=y,this.videoCodec=h,this._duration=c},m.resetTimeStamp=function(){},m.resetContiguity=function(){var y=this._audioTrack,h=this._avcTrack,c=this._id3Track;y&&(y.pesData=null),h&&(h.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},m.demux=function(y,h,c,l){c===void 0&&(c=!1),l===void 0&&(l=!1),c||(this.sampleAes=null);var a,v=this._avcTrack,p=this._audioTrack,g=this._id3Track,S=v.pid,U=v.pesData,j=p.pid,G=g.pid,N=p.pesData,I=g.pesData,V=!1,Q=this.pmtParsed,ne=this._pmtId,se=y.length;if(this.remainderData&&(y=Object(L.appendUint8Array)(this.remainderData,y),se=y.length,this.remainderData=null),se<188&&!l)return this.remainderData=y,{audioTrack:p,avcTrack:v,id3Track:g,textTrack:this._txtTrack};var xe=Math.max(0,f.syncOffset(y));se-=(se+xe)%188,se<y.byteLength&&!l&&(this.remainderData=new Uint8Array(y.buffer,se,y.buffer.byteLength-se));for(var me=xe;me<se;me+=188)if(y[me]===71){var Le=!!(y[me+1]&64),Ee=((y[me+1]&31)<<8)+y[me+2],Te=(y[me+3]&48)>>4,ce=void 0;if(Te>1){if(ce=me+5+y[me+4],ce===me+188)continue}else ce=me+4;switch(Ee){case S:Le&&(U&&(a=o(U))&&this.parseAVCPES(a,!1),U={data:[],size:0}),U&&(U.data.push(y.subarray(ce,me+188)),U.size+=me+188-ce);break;case j:Le&&(N&&(a=o(N))&&(p.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),N={data:[],size:0}),N&&(N.data.push(y.subarray(ce,me+188)),N.size+=me+188-ce);break;case G:Le&&(I&&(a=o(I))&&this.parseID3PES(a),I={data:[],size:0}),I&&(I.data.push(y.subarray(ce,me+188)),I.size+=me+188-ce);break;case 0:Le&&(ce+=y[ce]+1),ne=this._pmtId=b(y,ce);break;case ne:{Le&&(ce+=y[ce]+1);var fe=d(y,ce,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);S=fe.avc,S>0&&(v.pid=S),j=fe.audio,j>0&&(p.pid=j,p.isAAC=fe.isAAC),G=fe.id3,G>0&&(g.pid=G),V&&!Q&&(E.logger.log("reparse from beginning"),V=!1,me=xe-188),Q=this.pmtParsed=!0;break}case 17:case 8191:break;default:V=!0;break}}else this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});v.pesData=U,p.pesData=N,g.pesData=I;var J={audioTrack:p,avcTrack:v,id3Track:g,textTrack:this._txtTrack};return l&&this.extractRemainingSamples(J),J},m.flush=function(){var y=this.remainderData;this.remainderData=null;var h;return y?h=this.demux(y,-1,!1,!0):h={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(h),this.sampleAes?this.decrypt(h,this.sampleAes):h},m.extractRemainingSamples=function(y){var h=y.audioTrack,c=y.avcTrack,l=y.id3Track,a=c.pesData,v=h.pesData,p=l.pesData,g;a&&(g=o(a))?(this.parseAVCPES(g,!0),c.pesData=null):c.pesData=a,v&&(g=o(v))?(h.isAAC?this.parseAACPES(g):this.parseMPEGPES(g),h.pesData=null):(v!=null&&v.size&&E.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=v),p&&(g=o(p))?(this.parseID3PES(g),l.pesData=null):l.pesData=p},m.demuxSampleAes=function(y,h,c){var l=this.demux(y,c,!0,!this.config.progressive),a=this.sampleAes=new k.default(this.observer,this.config,h);return this.decrypt(l,a)},m.decrypt=function(y,h){return new Promise(function(c){var l=y.audioTrack,a=y.avcTrack;l.samples&&l.isAAC?h.decryptAacSamples(l.samples,0,function(){a.samples?h.decryptAvcSamples(a.samples,0,0,function(){c(y)}):c(y)}):a.samples&&h.decryptAvcSamples(a.samples,0,0,function(){c(y)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(y,h){var c=this,l=this._avcTrack,a=this.parseAVCNALu(y.data),v=!1,p=this.avcSample,g,S=!1;y.data=null,p&&a.length&&!l.audFound&&(s(p,l),p=this.avcSample=w(!1,y.pts,y.dts,"")),a.forEach(function(U){switch(U.type){case 1:{g=!0,p||(p=c.avcSample=w(!0,y.pts,y.dts,"")),v&&(p.debug+="NDR "),p.frame=!0;var j=U.data;if(S&&j.length>4){var G=new P.default(j).readSliceType();(G===2||G===4||G===7||G===9)&&(p.key=!0)}break}case 5:g=!0,p||(p=c.avcSample=w(!0,y.pts,y.dts,"")),v&&(p.debug+="IDR "),p.key=!0,p.frame=!0;break;case 6:{g=!0,v&&p&&(p.debug+="SEI ");var N=new P.default(x(U.data));N.readUByte();for(var I=0,V=0,Q=!1,ne=0;!Q&&N.bytesAvailable>1;){I=0;do ne=N.readUByte(),I+=ne;while(ne===255);V=0;do ne=N.readUByte(),V+=ne;while(ne===255);if(I===4&&N.bytesAvailable!==0){Q=!0;var se=N.readUByte();if(se===181){var xe=N.readUShort();if(xe===49){var me=N.readUInt();if(me===1195456820){var Le=N.readUByte();if(Le===3){for(var Ee=N.readUByte(),Te=N.readUByte(),ce=31&Ee,fe=[Ee,Te],J=0;J<ce;J++)fe.push(N.readUByte()),fe.push(N.readUByte()),fe.push(N.readUByte());u(c._txtTrack.samples,{type:3,pts:y.pts,bytes:fe})}}}}}else if(I===5&&N.bytesAvailable!==0){if(Q=!0,V>16){for(var le=[],ee=0;ee<16;ee++)le.push(N.readUByte().toString(16)),(ee===3||ee===5||ee===7||ee===9)&&le.push("-");for(var pe=V-16,ye=new Uint8Array(pe),he=0;he<pe;he++)ye[he]=N.readUByte();u(c._txtTrack.samples,{pts:y.pts,payloadType:I,uuid:le.join(""),userData:Object(B.utf8ArrayToStr)(ye),userDataBytes:ye})}}else if(V<N.bytesAvailable)for(var we=0;we<V;we++)N.readUByte()}break}case 7:if(g=!0,S=!0,v&&p&&(p.debug+="SPS "),!l.sps){var De=new P.default(U.data),Re=De.readSPS();l.width=Re.width,l.height=Re.height,l.pixelRatio=Re.pixelRatio,l.sps=[U.data],l.duration=c._duration;for(var ke=U.data.subarray(1,4),Ce="avc1.",Ae=0;Ae<3;Ae++){var ze=ke[Ae].toString(16);ze.length<2&&(ze="0"+ze),Ce+=ze}l.codec=Ce}break;case 8:g=!0,v&&p&&(p.debug+="PPS "),l.pps||(l.pps=[U.data]);break;case 9:g=!1,l.audFound=!0,p&&s(p,l),p=c.avcSample=w(!1,y.pts,y.dts,v?"AUD ":"");break;case 12:g=!1;break;default:g=!1,p&&(p.debug+="unknown NAL "+U.type+" ");break}if(p&&g){var $e=p.units;$e.push(U)}}),h&&p&&(s(p,l),this.avcSample=null)},m.getLastNalUnit=function(){var y,h=this.avcSample,c;if(!h||h.units.length===0){var l=this._avcTrack.samples;h=l[l.length-1]}if((y=h)!==null&&y!==void 0&&y.units){var a=h.units;c=a[a.length-1]}return c},m.parseAVCNALu=function(y){var h=y.byteLength,c=this._avcTrack,l=c.naluState||0,a=l,v=[],p=0,g,S,U,j=-1,G=0;for(l===-1&&(j=0,G=y[0]&31,l=0,p=1);p<h;){if(g=y[p++],!l){l=g?0:1;continue}if(l===1){l=g?0:2;continue}if(!g)l=3;else if(g===1){if(j>=0){var N={data:y.subarray(j,p-l-1),type:G};v.push(N)}else{var I=this.getLastNalUnit();if(I&&(a&&p<=4-a&&(I.state&&(I.data=I.data.subarray(0,I.data.byteLength-a))),S=p-l-1,S>0)){var V=new Uint8Array(I.data.byteLength+S);V.set(I.data,0),V.set(y.subarray(0,S),I.data.byteLength),I.data=V,I.state=0}}p<h?(U=y[p]&31,j=p,G=U,l=0):l=-1}else l=0}if(j>=0&&l>=0){var Q={data:y.subarray(j,h),type:G,state:l};v.push(Q)}if(v.length===0){var ne=this.getLastNalUnit();if(ne){var se=new Uint8Array(ne.data.byteLength+y.byteLength);se.set(ne.data,0),se.set(y,ne.data.byteLength),ne.data=se}}return c.naluState=l,v},m.parseAACPES=function(y){var h=0,c=this._audioTrack,l=this.aacOverFlow,a=y.data;if(l){this.aacOverFlow=null;var v=l.sample.unit.byteLength,p=Math.min(l.missing,v),g=v-p;l.sample.unit.set(a.subarray(0,p),g),c.samples.push(l.sample),h=l.missing}var S,U;for(S=h,U=a.length;S<U-1&&!H.isHeader(a,S);S++);if(S!==h){var j,G;if(S<U-1?(j="AAC PES did not start with ADTS header,offset:"+S,G=!1):(j="no ADTS header found in AAC PES",G=!0),E.logger.warn("parsing error:"+j),this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.FRAG_PARSING_ERROR,fatal:G,reason:j}),G)return}H.initTrackConfig(c,this.observer,a,S,this.audioCodec);var N;if(y.pts!==void 0)N=y.pts;else if(l){var I=H.getFrameDuration(c.samplerate);N=l.sample.pts+I}else{E.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var V=0;S<U;)if(H.isHeader(a,S)){if(S+5<U){var Q=H.appendFrame(c,a,S,N,V);if(Q)if(Q.missing)this.aacOverFlow=Q;else{S+=Q.length,V++;continue}}break}else S++},m.parseMPEGPES=function(y){var h=y.data,c=h.length,l=0,a=0,v=y.pts;if(v===void 0){E.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(M.isHeader(h,a)){var p=M.appendFrame(this._audioTrack,h,a,v,l);if(p)a+=p.length,l++;else break}else a++},m.parseID3PES=function(y){if(y.pts===void 0){E.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(y)},f}();A.minProbeByteLength=188;function w(f,m,_,y){return{key:f,frame:!1,pts:m,dts:_,units:[],debug:y,length:0}}function b(f,m){return(f[m+10]&31)<<8|f[m+11]}function d(f,m,_,y){var h={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(f[m+1]&15)<<8|f[m+2],l=m+3+c-4,a=(f[m+10]&15)<<8|f[m+11];for(m+=12+a;m<l;){var v=(f[m+1]&31)<<8|f[m+2];switch(f[m]){case 207:if(!y){E.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:h.audio===-1&&(h.audio=v);break;case 21:h.id3===-1&&(h.id3=v);break;case 219:if(!y){E.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:h.avc===-1&&(h.avc=v);break;case 3:case 4:_?h.audio===-1&&(h.audio=v,h.isAAC=!1):E.logger.log("MPEG audio found, not supported in this browser");break;case 36:E.logger.warn("Unsupported HEVC stream type found");break;default:break}m+=((f[m+3]&15)<<8|f[m+4])+5}return h}function o(f){var m=0,_,y,h,c,l,a=f.data;if(!f||f.size===0)return null;for(;a[0].length<19&&a.length>1;){var v=new Uint8Array(a[0].length+a[1].length);v.set(a[0]),v.set(a[1],a[0].length),a[0]=v,a.splice(1,1)}_=a[0];var p=(_[0]<<16)+(_[1]<<8)+_[2];if(p===1){if(y=(_[4]<<8)+_[5],y&&y>f.size-6)return null;var g=_[7];g&192&&(c=(_[9]&14)*536870912+(_[10]&255)*4194304+(_[11]&254)*16384+(_[12]&255)*128+(_[13]&254)/2,g&64?(l=(_[14]&14)*536870912+(_[15]&255)*4194304+(_[16]&254)*16384+(_[17]&255)*128+(_[18]&254)/2,c-l>60*9e4&&(E.logger.warn(Math.round((c-l)/9e4)+"s delta between PTS and DTS, align them"),c=l)):l=c),h=_[8];var S=h+9;if(f.size<=S)return null;f.size-=S;for(var U=new Uint8Array(f.size),j=0,G=a.length;j<G;j++){_=a[j];var N=_.byteLength;if(S)if(S>N){S-=N;continue}else _=_.subarray(S),N-=S,S=0;U.set(_,m),m+=N}return y&&(y-=h+3),{data:U,pts:c,dts:l,len:y}}return null}function s(f,m){if(f.units.length&&f.frame){if(f.pts===void 0){var _=m.samples,y=_.length;if(y){var h=_[y-1];f.pts=h.pts,f.dts=h.dts}else{m.dropped++;return}}m.samples.push(f)}f.debug.length&&E.logger.log(f.pts+"/"+f.dts+":"+f.debug)}function u(f,m){var _=f.length;if(_>0){if(m.pts>=f[_-1].pts)f.push(m);else for(var y=_-1;y>=0;y--)if(m.pts<f[y].pts){f.splice(y,0,m);break}}else f.push(m)}function x(f){for(var m=f.byteLength,_=[],y=1;y<m-2;)f[y]===0&&f[y+1]===0&&f[y+2]===3?(_.push(y+2),y+=2):y++;if(_.length===0)return f;var h=m-_.length,c=new Uint8Array(h),l=0;for(y=0;y<h;l++,y++)l===_[0]&&(l++,_.shift()),c[y]=f[l];return c}K.default=A},"./src/errors.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"ErrorTypes",function(){return H}),D.d(K,"ErrorDetails",function(){return M});var H;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(H||(H={}));var M;(function(P){P.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",P.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",P.KEY_SYSTEM_NO_SESSION="keySystemNoSession",P.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",P.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",P.MANIFEST_LOAD_ERROR="manifestLoadError",P.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",P.MANIFEST_PARSING_ERROR="manifestParsingError",P.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",P.LEVEL_EMPTY_ERROR="levelEmptyError",P.LEVEL_LOAD_ERROR="levelLoadError",P.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",P.LEVEL_SWITCH_ERROR="levelSwitchError",P.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",P.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",P.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",P.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",P.FRAG_LOAD_ERROR="fragLoadError",P.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",P.FRAG_DECRYPT_ERROR="fragDecryptError",P.FRAG_PARSING_ERROR="fragParsingError",P.REMUX_ALLOC_ERROR="remuxAllocError",P.KEY_LOAD_ERROR="keyLoadError",P.KEY_LOAD_TIMEOUT="keyLoadTimeOut",P.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",P.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",P.BUFFER_APPEND_ERROR="bufferAppendError",P.BUFFER_APPENDING_ERROR="bufferAppendingError",P.BUFFER_STALLED_ERROR="bufferStalledError",P.BUFFER_FULL_ERROR="bufferFullError",P.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",P.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",P.INTERNAL_EXCEPTION="internalException",P.INTERNAL_ABORTED="aborted",P.UNKNOWN="unknown"})(M||(M={}))},"./src/events.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"Events",function(){return H});var H;(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"})(H||(H={}))},"./src/hls.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"default",function(){return f});var H=D("./node_modules/url-toolkit/src/url-toolkit.js"),M=D.n(H),P=D("./src/loader/playlist-loader.ts"),B=D("./src/loader/key-loader.ts"),k=D("./src/controller/id3-track-controller.ts"),O=D("./src/controller/latency-controller.ts"),L=D("./src/controller/level-controller.ts"),E=D("./src/controller/fragment-tracker.ts"),C=D("./src/controller/stream-controller.ts"),R=D("./src/is-supported.ts"),A=D("./src/utils/logger.ts"),w=D("./src/config.ts"),b=D("./node_modules/eventemitter3/index.js"),d=D.n(b),o=D("./src/events.ts"),s=D("./src/errors.ts");function u(m,_){for(var y=0;y<_.length;y++){var h=_[y];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(m,h.key,h)}}function x(m,_,y){return _&&u(m.prototype,_),y&&u(m,y),m}var f=function(){m.isSupported=function(){return Object(R.isSupported)()};function m(y){y===void 0&&(y={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new b.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var h=this.config=Object(w.mergeConfig)(m.DefaultConfig,y);this.userConfig=y,Object(A.enableLogs)(h.debug),this._autoLevelCapping=-1,h.progressive&&Object(w.enableStreamingMode)(h);var c=h.abrController,l=h.bufferController,a=h.capLevelController,v=h.fpsController,p=this.abrController=new c(this),g=this.bufferController=new l(this),S=this.capLevelController=new a(this),U=new v(this),j=new P.default(this),G=new B.default(this),N=new k.default(this),I=this.levelController=new L.default(this),V=new E.FragmentTracker(this),Q=this.streamController=new C.default(this,V);S.setStreamController(Q),U.setStreamController(Q);var ne=[I,Q];this.networkControllers=ne;var se=[j,G,p,g,S,U,N,V];this.audioTrackController=this.createController(h.audioTrackController,null,ne),this.createController(h.audioStreamController,V,ne),this.subtitleTrackController=this.createController(h.subtitleTrackController,null,ne),this.createController(h.subtitleStreamController,V,ne),this.createController(h.timelineController,null,se),this.emeController=this.createController(h.emeController,null,se),this.cmcdController=this.createController(h.cmcdController,null,se),this.latencyController=this.createController(O.default,null,se),this.coreComponents=se}var _=m.prototype;return _.createController=function(h,c,l){if(h){var a=c?new h(this,c):new h(this);return l&&l.push(a),a}return null},_.on=function(h,c,l){l===void 0&&(l=this),this._emitter.on(h,c,l)},_.once=function(h,c,l){l===void 0&&(l=this),this._emitter.once(h,c,l)},_.removeAllListeners=function(h){this._emitter.removeAllListeners(h)},_.off=function(h,c,l,a){l===void 0&&(l=this),this._emitter.off(h,c,l,a)},_.listeners=function(h){return this._emitter.listeners(h)},_.emit=function(h,c,l){return this._emitter.emit(h,c,l)},_.trigger=function(h,c){if(this.config.debug)return this.emit(h,h,c);try{return this.emit(h,h,c)}catch(l){A.logger.error("An internal error happened while handling event "+h+'. Error message: "'+l.message+'". Here is a stacktrace:',l),this.trigger(o.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:h,error:l})}return!1},_.listenerCount=function(h){return this._emitter.listenerCount(h)},_.destroy=function(){A.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(h){return h.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(h){return h.destroy()}),this.coreComponents.length=0},_.attachMedia=function(h){A.logger.log("attachMedia"),this._media=h,this.trigger(o.Events.MEDIA_ATTACHING,{media:h})},_.detachMedia=function(){A.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},_.loadSource=function(h){this.stopLoad();var c=this.media,l=this.url,a=this.url=H.buildAbsoluteURL(self.location.href,h,{alwaysNormalize:!0});A.logger.log("loadSource:"+a),c&&l&&l!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:h})},_.startLoad=function(h){h===void 0&&(h=-1),A.logger.log("startLoad("+h+")"),this.networkControllers.forEach(function(c){c.startLoad(h)})},_.stopLoad=function(){A.logger.log("stopLoad"),this.networkControllers.forEach(function(h){h.stopLoad()})},_.swapAudioCodec=function(){A.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},_.recoverMediaError=function(){A.logger.log("recoverMediaError");var h=this._media;this.detachMedia(),h&&this.attachMedia(h)},_.removeLevel=function(h,c){c===void 0&&(c=0),this.levelController.removeLevel(h,c)},x(m,[{key:"levels",get:function(){var h=this.levelController.levels;return h||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(h){A.logger.log("set currentLevel:"+h),this.loadLevel=h,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(h){A.logger.log("set nextLevel:"+h),this.levelController.manualLevel=h,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(h){A.logger.log("set loadLevel:"+h),this.levelController.manualLevel=h}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(h){this.levelController.nextLoadLevel=h}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(h){A.logger.log("set firstLevel:"+h),this.levelController.firstLevel=h}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(h){A.logger.log("set startLevel:"+h),h!==-1&&(h=Math.max(h,this.minAutoLevel)),this.levelController.startLevel=h}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(h){var c=!!h;c!==this.config.capLevelToPlayerSize&&(c?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=c)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(h){this._autoLevelCapping!==h&&(A.logger.log("set autoLevelCapping:"+h),this._autoLevelCapping=h)}},{key:"bandwidthEstimate",get:function(){var h=this.abrController.bwEstimator;return h?h.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var h=this.levels,c=this.config.minAutoBitrate;if(!h)return 0;for(var l=h.length,a=0;a<l;a++)if(h[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var h=this.levels,c=this.autoLevelCapping,l;return c===-1&&h&&h.length?l=h.length-1:l=c,l}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(h){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,h)}},{key:"audioTracks",get:function(){var h=this.audioTrackController;return h?h.audioTracks:[]}},{key:"audioTrack",get:function(){var h=this.audioTrackController;return h?h.audioTrack:-1},set:function(h){var c=this.audioTrackController;c&&(c.audioTrack=h)}},{key:"subtitleTracks",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTrack:-1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleTrack=h)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var h=this.subtitleTrackController;return h?h.subtitleDisplay:!1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=h)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(h){this.config.lowLatencyMode=h}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return m.defaultConfig?m.defaultConfig:w.hlsDefaultConfig},set:function(h){m.defaultConfig=h}}]),m}();f.defaultConfig=void 0},"./src/is-supported.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"isSupported",function(){return P}),D.d(K,"changeTypeSupported",function(){return B});var H=D("./src/utils/mediasource-helper.ts");function M(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var k=Object(H.getMediaSource)();if(!k)return!1;var O=M(),L=k&&typeof k.isTypeSupported=="function"&&k.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),E=!O||O.prototype&&typeof O.prototype.appendBuffer=="function"&&typeof O.prototype.remove=="function";return!!L&&!!E}function B(){var k,O=M();return typeof(O==null||((k=O.prototype)===null||k===void 0)?void 0:k.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"default",function(){return A}),D.d(K,"LoadError",function(){return b});var H=D("./src/polyfills/number.ts"),M=D("./src/errors.ts");function P(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,E(d,o)}function B(d){var o=typeof Map=="function"?new Map:void 0;return B=function(u){if(u===null||!L(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(u))return o.get(u);o.set(u,x)}function x(){return k(u,arguments,C(this).constructor)}return x.prototype=Object.create(u.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),E(x,u)},B(d)}function k(d,o,s){return O()?k=Reflect.construct:k=function(x,f,m){var _=[null];_.push.apply(_,f);var y=Function.bind.apply(x,_),h=new y;return m&&E(h,m.prototype),h},k.apply(null,arguments)}function O(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function L(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function E(d,o){return E=Object.setPrototypeOf||function(u,x){return u.__proto__=x,u},E(d,o)}function C(d){return C=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},C(d)}var R=Math.pow(2,17),A=function(){function d(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var o=d.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(u,x){var f=this,m=u.url;if(!m)return Promise.reject(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var _=this.config,y=_.fLoader,h=_.loader;return new Promise(function(c,l){f.loader&&f.loader.destroy();var a=f.loader=u.loader=y?new y(_):new h(_),v=w(u),p={timeout:_.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:_.fragLoadingMaxRetryTimeout,highWaterMark:R};u.stats=a.stats,a.load(v,p,{onSuccess:function(S,U,j,G){f.resetLoader(u,a),c({frag:u,part:null,payload:S.data,networkDetails:G})},onError:function(S,U,j){f.resetLoader(u,a),l(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:S,networkDetails:j}))},onAbort:function(S,U,j){f.resetLoader(u,a),l(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:j}))},onTimeout:function(S,U,j){f.resetLoader(u,a),l(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:j}))},onProgress:function(S,U,j,G){x&&x({frag:u,part:null,payload:j,networkDetails:G})}})})},o.loadPart=function(u,x,f){var m=this;this.abort();var _=this.config,y=_.fLoader,h=_.loader;return new Promise(function(c,l){m.loader&&m.loader.destroy();var a=m.loader=u.loader=y?new y(_):new h(_),v=w(u,x),p={timeout:_.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:_.fragLoadingMaxRetryTimeout,highWaterMark:R};x.stats=a.stats,a.load(v,p,{onSuccess:function(S,U,j,G){m.resetLoader(u,a),m.updateStatsFromPart(u,x);var N={frag:u,part:x,payload:S.data,networkDetails:G};f(N),c(N)},onError:function(S,U,j){m.resetLoader(u,a),l(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:x,response:S,networkDetails:j}))},onAbort:function(S,U,j){u.stats.aborted=x.stats.aborted,m.resetLoader(u,a),l(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:x,networkDetails:j}))},onTimeout:function(S,U,j){m.resetLoader(u,a),l(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:x,networkDetails:j}))}})})},o.updateStatsFromPart=function(u,x){var f=u.stats,m=x.stats,_=m.total;if(f.loaded+=m.loaded,_){var y=Math.round(u.duration/x.duration),h=Math.min(Math.round(f.loaded/_),y),c=y-h,l=c*Math.round(f.loaded/h);f.total=f.loaded+l}else f.total=Math.max(f.loaded,f.total);var a=f.loading,v=m.loading;a.start?a.first+=v.first-v.start:(a.start=v.start,a.first=v.first),a.end=v.end},o.resetLoader=function(u,x){u.loader=null,this.loader===x&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),x.destroy()},d}();function w(d,o){o===void 0&&(o=null);var s=o||d,u={frag:d,part:o,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},x=s.byteRangeStartOffset,f=s.byteRangeEndOffset;return Object(H.isFiniteNumber)(x)&&Object(H.isFiniteNumber)(f)&&(u.rangeStart=x,u.rangeEnd=f),u}var b=function(d){P(o,d);function o(s){for(var u,x=arguments.length,f=new Array(x>1?x-1:0),m=1;m<x;m++)f[m-1]=arguments[m];return u=d.call.apply(d,[this].concat(f))||this,u.data=void 0,u.data=s,u}return o}(B(Error))},"./src/loader/fragment.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"ElementaryStreamTypes",function(){return A}),D.d(K,"BaseSegment",function(){return w}),D.d(K,"Fragment",function(){return b}),D.d(K,"Part",function(){return d});var H=D("./src/polyfills/number.ts"),M=D("./node_modules/url-toolkit/src/url-toolkit.js"),P=D.n(M),B=D("./src/utils/logger.ts"),k=D("./src/loader/level-key.ts"),O=D("./src/loader/load-stats.ts");function L(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,E(o,s)}function E(o,s){return E=Object.setPrototypeOf||function(x,f){return x.__proto__=f,x},E(o,s)}function C(o,s){for(var u=0;u<s.length;u++){var x=s[u];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(o,x.key,x)}}function R(o,s,u){return s&&C(o.prototype,s),u&&C(o,u),o}var A;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(A||(A={}));var w=function(){function o(u){var x;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(x={},x[A.AUDIO]=null,x[A.VIDEO]=null,x[A.AUDIOVIDEO]=null,x),this.baseurl=u}var s=o.prototype;return s.setByteRange=function(x,f){var m=x.split("@",2),_=[];m.length===1?_[0]=f?f.byteRangeEndOffset:0:_[0]=parseInt(m[1]),_[1]=parseInt(m[0])+_[0],this._byteRange=_},R(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(M.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(x){this._url=x}}]),o}(),b=function(o){L(s,o);function s(x,f){var m;return m=o.call(this,f)||this,m._decryptdata=null,m.rawProgramDateTime=null,m.programDateTime=null,m.tagList=[],m.duration=0,m.sn=0,m.levelkey=void 0,m.type=void 0,m.loader=null,m.level=-1,m.cc=0,m.startPTS=void 0,m.endPTS=void 0,m.appendedPTS=void 0,m.startDTS=void 0,m.endDTS=void 0,m.start=0,m.deltaPTS=void 0,m.maxStartPTS=void 0,m.minEndPTS=void 0,m.stats=new O.LoadStats,m.urlId=0,m.data=void 0,m.bitrateTest=!1,m.title=null,m.initSegment=null,m.type=x,m}var u=s.prototype;return u.createInitializationVector=function(f){for(var m=new Uint8Array(16),_=12;_<16;_++)m[_]=f>>8*(15-_)&255;return m},u.setDecryptDataFromLevelKey=function(f,m){var _=f;return(f==null?void 0:f.method)==="AES-128"&&f.uri&&!f.iv&&(_=k.LevelKey.fromURI(f.uri),_.method=f.method,_.iv=this.createInitializationVector(m),_.keyFormat="identity"),_},u.setElementaryStreamInfo=function(f,m,_,y,h,c){c===void 0&&(c=!1);var l=this.elementaryStreams,a=l[f];if(!a){l[f]={startPTS:m,endPTS:_,startDTS:y,endDTS:h,partial:c};return}a.startPTS=Math.min(a.startPTS,m),a.endPTS=Math.max(a.endPTS,_),a.startDTS=Math.min(a.startDTS,y),a.endDTS=Math.max(a.endDTS,h)},u.clearElementaryStreamInfo=function(){var f=this.elementaryStreams;f[A.AUDIO]=null,f[A.VIDEO]=null,f[A.AUDIOVIDEO]=null},R(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var f=this.sn;typeof f!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&B.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),f=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,f)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(H.isFiniteNumber)(this.programDateTime))return null;var f=Object(H.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+f*1e3}},{key:"encrypted",get:function(){var f;return!!((f=this.decryptdata)!==null&&f!==void 0&&f.keyFormat&&this.decryptdata.uri)}}]),s}(w),d=function(o){L(s,o);function s(u,x,f,m,_){var y;y=o.call(this,f)||this,y.fragOffset=0,y.duration=0,y.gap=!1,y.independent=!1,y.relurl=void 0,y.fragment=void 0,y.index=void 0,y.stats=new O.LoadStats,y.duration=u.decimalFloatingPoint("DURATION"),y.gap=u.bool("GAP"),y.independent=u.bool("INDEPENDENT"),y.relurl=u.enumeratedString("URI"),y.fragment=x,y.index=m;var h=u.enumeratedString("BYTERANGE");return h&&y.setByteRange(h,_),_&&(y.fragOffset=_.fragOffset+_.duration),y}return R(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var x=this.elementaryStreams;return!!(x.audio||x.video||x.audiovideo)}}]),s}(w)},"./src/loader/key-loader.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"default",function(){return B});var H=D("./src/events.ts"),M=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),B=function(){function k(L){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=L,this._registerListeners()}var O=k.prototype;return O._registerListeners=function(){this.hls.on(H.Events.KEY_LOADING,this.onKeyLoading,this)},O._unregisterListeners=function(){this.hls.off(H.Events.KEY_LOADING,this.onKeyLoading)},O.destroy=function(){this._unregisterListeners();for(var E in this.loaders){var C=this.loaders[E];C&&C.destroy()}this.loaders={}},O.onKeyLoading=function(E,C){var R=C.frag,A=R.type,w=this.loaders[A];if(!R.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var b=R.decryptdata.uri;if(b!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(w&&(P.logger.warn("abort previous key loader for type:"+A),w.abort()),!b){P.logger.warn("key uri is falsy");return}var o=d.loader,s=R.loader=this.loaders[A]=new o(d);this.decrypturl=b,this.decryptkey=null;var u={url:b,frag:R,responseType:"arraybuffer"},x={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(u,x,f)}else this.decryptkey&&(R.decryptdata.key=this.decryptkey,this.hls.trigger(H.Events.KEY_LOADED,{frag:R}))},O.loadsuccess=function(E,C,R){var A=R.frag;if(!A.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=A.decryptdata.key=new Uint8Array(E.data),A.loader=null,delete this.loaders[A.type],this.hls.trigger(H.Events.KEY_LOADED,{frag:A})},O.loaderror=function(E,C){var R=C.frag,A=R.loader;A&&A.abort(),delete this.loaders[R.type],this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:R,response:E})},O.loadtimeout=function(E,C){var R=C.frag,A=R.loader;A&&A.abort(),delete this.loaders[R.type],this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:R})},k}()},"./src/loader/level-details.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"LevelDetails",function(){return k});var H=D("./src/polyfills/number.ts");function M(O,L){for(var E=0;E<L.length;E++){var C=L[E];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(O,C.key,C)}}function P(O,L,E){return L&&M(O.prototype,L),E&&M(O,E),O}var B=10,k=function(){function O(E){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=E}var L=O.prototype;return L.reloaded=function(C){if(!C){this.advanced=!0,this.updated=!0;return}var R=this.lastPartSn-C.lastPartSn,A=this.lastPartIndex-C.lastPartIndex;this.updated=this.endSN!==C.endSN||!!A||!!R,this.advanced=this.endSN>C.endSN||R>0||R===0&&A>0,this.updated||this.advanced?this.misses=Math.floor(C.misses*.6):this.misses=C.misses+1,this.availabilityDelay=C.availabilityDelay},P(O,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(H.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var C=this.driftEndTime-this.driftStartTime;if(C>0){var R=this.driftEnd-this.driftStart;return R*1e3/C}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var C;return(C=this.partList)!==null&&C!==void 0&&C.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var C;return(C=this.fragments)!==null&&C!==void 0&&C.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 C;return(C=this.partList)!==null&&C!==void 0&&C.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var C;return(C=this.partList)!==null&&C!==void 0&&C.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),O}()},"./src/loader/level-key.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"LevelKey",function(){return k});var H=D("./node_modules/url-toolkit/src/url-toolkit.js"),M=D.n(H);function P(O,L){for(var E=0;E<L.length;E++){var C=L[E];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(O,C.key,C)}}function B(O,L,E){return L&&P(O.prototype,L),E&&P(O,E),O}var k=function(){O.fromURL=function(E,C){return new O(E,C)},O.fromURI=function(E){return new O(E)};function O(L,E){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,E?this._uri=Object(H.buildAbsoluteURL)(L,E,{alwaysNormalize:!0}):this._uri=L}return B(O,[{key:"uri",get:function(){return this._uri}}]),O}()},"./src/loader/load-stats.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"LoadStats",function(){return H});var H=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"default",function(){return s});var H=D("./src/polyfills/number.ts"),M=D("./node_modules/url-toolkit/src/url-toolkit.js"),P=D.n(M),B=D("./src/loader/fragment.ts"),k=D("./src/loader/level-details.ts"),O=D("./src/loader/level-key.ts"),L=D("./src/utils/attr-list.ts"),E=D("./src/utils/logger.ts"),C=D("./src/utils/codecs.ts"),R=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,A=/#EXT-X-MEDIA:(.*)/g,w=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),b=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("|")),d=/\.(mp4|m4s|m4v|m4a)$/i;function o(_){var y,h;return d.test((y=(h=M.parseURL(_))===null||h===void 0?void 0:h.path)!=null?y:"")}var s=function(){function _(){}return _.findGroup=function(h,c){for(var l=0;l<h.length;l++){var a=h[l];if(a.id===c)return a}},_.convertAVC1ToAVCOTI=function(h){var c=h.split(".");if(c.length>2){var l=c.shift()+".";return l+=parseInt(c.shift()).toString(16),l+=("000"+parseInt(c.shift()).toString(16)).substr(-4),l}return h},_.resolve=function(h,c){return M.buildAbsoluteURL(c,h,{alwaysNormalize:!0})},_.parseMasterPlaylist=function(h,c){var l=[],a={},v=!1;R.lastIndex=0;for(var p;(p=R.exec(h))!=null;)if(p[1]){var g=new L.AttrList(p[1]),S={attrs:g,bitrate:g.decimalInteger("AVERAGE-BANDWIDTH")||g.decimalInteger("BANDWIDTH"),name:g.NAME,url:_.resolve(p[2],c)},U=g.decimalResolution("RESOLUTION");U&&(S.width=U.width,S.height=U.height),u((g.CODECS||"").split(/[ ,]+/).filter(function(G){return G}),S),S.videoCodec&&S.videoCodec.indexOf("avc1")!==-1&&(S.videoCodec=_.convertAVC1ToAVCOTI(S.videoCodec)),l.push(S)}else if(p[3]){var j=new L.AttrList(p[3]);j["DATA-ID"]&&(v=!0,a[j["DATA-ID"]]=j)}return{levels:l,sessionData:v?a:null}},_.parseMasterPlaylistMedia=function(h,c,l,a){a===void 0&&(a=[]);var v,p=[],g=0;for(A.lastIndex=0;(v=A.exec(h))!==null;){var S=new L.AttrList(v[1]);if(S.TYPE===l){var U={attrs:S,bitrate:0,id:g++,groupId:S["GROUP-ID"],instreamId:S["INSTREAM-ID"],name:S.NAME||S.LANGUAGE||"",type:l,default:S.bool("DEFAULT"),autoselect:S.bool("AUTOSELECT"),forced:S.bool("FORCED"),lang:S.LANGUAGE,url:S.URI?_.resolve(S.URI,c):""};if(a.length){var j=_.findGroup(a,U.groupId)||a[0];x(U,j,"audioCodec"),x(U,j,"textCodec")}p.push(U)}}return p},_.parseLevelPlaylist=function(h,c,l,a,v){var p=new k.LevelDetails(c),g=p.fragments,S=null,U=0,j=0,G=0,N=0,I=null,V=new B.Fragment(a,c),Q,ne,se,xe=-1,me=!1;for(w.lastIndex=0,p.m3u8=h;(Q=w.exec(h))!==null;){me&&(me=!1,V=new B.Fragment(a,c),V.start=G,V.sn=U,V.cc=N,V.level=l,S&&(V.initSegment=S,V.rawProgramDateTime=S.rawProgramDateTime));var Le=Q[1];if(Le){V.duration=parseFloat(Le);var Ee=(" "+Q[2]).slice(1);V.title=Ee||null,V.tagList.push(Ee?["INF",Le,Ee]:["INF",Le])}else if(Q[3])Object(H.isFiniteNumber)(V.duration)&&(V.start=G,se&&(V.levelkey=se),V.sn=U,V.level=l,V.cc=N,V.urlId=v,g.push(V),V.relurl=(" "+Q[3]).slice(1),m(V,I),I=V,G+=V.duration,U++,j=0,me=!0);else if(Q[4]){var Te=(" "+Q[4]).slice(1);I?V.setByteRange(Te,I):V.setByteRange(Te)}else if(Q[5])V.rawProgramDateTime=(" "+Q[5]).slice(1),V.tagList.push(["PROGRAM-DATE-TIME",V.rawProgramDateTime]),xe===-1&&(xe=g.length);else{if(Q=Q[0].match(b),!Q){E.logger.warn("No matches on slow regex match for level playlist!");continue}for(ne=1;ne<Q.length&&!(typeof Q[ne]!="undefined");ne++);var ce=(" "+Q[ne]).slice(1),fe=(" "+Q[ne+1]).slice(1),J=Q[ne+2]?(" "+Q[ne+2]).slice(1):"";switch(ce){case"PLAYLIST-TYPE":p.type=fe.toUpperCase();break;case"MEDIA-SEQUENCE":U=p.startSN=parseInt(fe);break;case"SKIP":{var le=new L.AttrList(fe),ee=le.decimalInteger("SKIPPED-SEGMENTS");if(Object(H.isFiniteNumber)(ee)){p.skippedSegments=ee;for(var pe=ee;pe--;)g.unshift(null);U+=ee}var ye=le.enumeratedString("RECENTLY-REMOVED-DATERANGES");ye&&(p.recentlyRemovedDateranges=ye.split(" "));break}case"TARGETDURATION":p.targetduration=parseFloat(fe);break;case"VERSION":p.version=parseInt(fe);break;case"EXTM3U":break;case"ENDLIST":p.live=!1;break;case"#":(fe||J)&&V.tagList.push(J?[fe,J]:[fe]);break;case"DIS":N++;case"GAP":V.tagList.push([ce]);break;case"BITRATE":V.tagList.push([ce,fe]);break;case"DISCONTINUITY-SEQ":N=parseInt(fe);break;case"KEY":{var he,we=new L.AttrList(fe),De=we.enumeratedString("METHOD"),Re=we.URI,ke=we.hexadecimalInteger("IV"),Ce=we.enumeratedString("KEYFORMATVERSIONS"),Ae=we.enumeratedString("KEYID"),ze=(he=we.enumeratedString("KEYFORMAT"))!=null?he:"identity",$e=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if($e.indexOf(ze)>-1){E.logger.warn("Keyformat "+ze+" is not supported from the manifest");continue}else if(ze!=="identity")continue;De&&(se=O.LevelKey.fromURL(c,Re),Re&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(De)>=0&&(se.method=De,se.keyFormat=ze,Ae&&(se.keyID=Ae),Ce&&(se.keyFormatVersions=Ce),se.iv=ke));break}case"START":{var je=new L.AttrList(fe),Ve=je.decimalFloatingPoint("TIME-OFFSET");Object(H.isFiniteNumber)(Ve)&&(p.startTimeOffset=Ve);break}case"MAP":{var it=new L.AttrList(fe);V.relurl=it.URI,it.BYTERANGE&&V.setByteRange(it.BYTERANGE),V.level=l,V.sn="initSegment",se&&(V.levelkey=se),V.initSegment=null,S=V,me=!0;break}case"SERVER-CONTROL":{var rt=new L.AttrList(fe);p.canBlockReload=rt.bool("CAN-BLOCK-RELOAD"),p.canSkipUntil=rt.optionalFloat("CAN-SKIP-UNTIL",0),p.canSkipDateRanges=p.canSkipUntil>0&&rt.bool("CAN-SKIP-DATERANGES"),p.partHoldBack=rt.optionalFloat("PART-HOLD-BACK",0),p.holdBack=rt.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Je=new L.AttrList(fe);p.partTarget=Je.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Oe=p.partList;Oe||(Oe=p.partList=[]);var Ze=j>0?Oe[Oe.length-1]:void 0,Ye=j++,Pe=new B.Part(new L.AttrList(fe),V,c,Ye,Ze);Oe.push(Pe),V.duration+=Pe.duration;break}case"PRELOAD-HINT":{var Fe=new L.AttrList(fe);p.preloadHint=Fe;break}case"RENDITION-REPORT":{var ie=new L.AttrList(fe);p.renditionReports=p.renditionReports||[],p.renditionReports.push(ie);break}default:E.logger.warn("line parsed but not handled: "+Q);break}}}I&&!I.relurl?(g.pop(),G-=I.duration,p.partList&&(p.fragmentHint=I)):p.partList&&(m(V,I),V.cc=N,p.fragmentHint=V);var oe=g.length,ue=g[0],$=g[oe-1];if(G+=p.skippedSegments*p.targetduration,G>0&&oe&&$){p.averagetargetduration=G/oe;var Y=$.sn;p.endSN=Y!=="initSegment"?Y:0,ue&&(p.startCC=ue.cc,ue.initSegment||p.fragments.every(function(q){return q.relurl&&o(q.relurl)})&&(E.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),V=new B.Fragment(a,c),V.relurl=$.relurl,V.level=l,V.sn="initSegment",ue.initSegment=V,p.needSidxRanges=!0))}else p.endSN=0,p.startCC=0;return p.fragmentHint&&(G+=p.fragmentHint.duration),p.totalduration=G,p.endCC=N,xe>0&&f(g,xe),p},_}();function u(_,y){["video","audio","text"].forEach(function(h){var c=_.filter(function(a){return Object(C.isCodecType)(a,h)});if(c.length){var l=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});y[h+"Codec"]=l.length>0?l[0]:c[0],_=_.filter(function(a){return c.indexOf(a)===-1})}}),y.unknownCodecs=_}function x(_,y,h){var c=y[h];c&&(_[h]=c)}function f(_,y){for(var h=_[y],c=y;c--;){var l=_[c];if(!l)return;l.programDateTime=h.programDateTime-l.duration*1e3,h=l}}function m(_,y){_.rawProgramDateTime?_.programDateTime=Date.parse(_.rawProgramDateTime):y!=null&&y.programDateTime&&(_.programDateTime=y.endProgramDateTime),Object(H.isFiniteNumber)(_.programDateTime)||(_.programDateTime=null,_.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(te,K,D){"use strict";D.r(K);var H=D("./src/polyfills/number.ts"),M=D("./src/events.ts"),P=D("./src/errors.ts"),B=D("./src/utils/logger.ts"),k=D("./src/utils/mp4-tools.ts"),O=D("./src/loader/m3u8-parser.ts"),L=D("./src/types/loader.ts"),E=D("./src/utils/attr-list.ts");function C(w){var b=w.type;switch(b){case L.PlaylistContextType.AUDIO_TRACK:return L.PlaylistLevelType.AUDIO;case L.PlaylistContextType.SUBTITLE_TRACK:return L.PlaylistLevelType.SUBTITLE;default:return L.PlaylistLevelType.MAIN}}function R(w,b){var d=w.url;return(d===void 0||d.indexOf("data:")===0)&&(d=b.url),d}var A=function(){function w(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var b=w.prototype;return b.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)},b.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)},b.createInternalLoader=function(o){var s=this.hls.config,u=s.pLoader,x=s.loader,f=u||x,m=new f(s);return o.loader=m,this.loaders[o.type]=m,m},b.getInternalLoader=function(o){return this.loaders[o.type]},b.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},b.destroyInternalLoaders=function(){for(var o in this.loaders){var s=this.loaders[o];s&&s.destroy(),this.resetInternalLoader(o)}},b.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},b.onManifestLoading=function(o,s){var u=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:L.PlaylistContextType.MANIFEST,url:u,deliveryDirectives:null})},b.onLevelLoading=function(o,s){var u=s.id,x=s.level,f=s.url,m=s.deliveryDirectives;this.load({id:u,groupId:null,level:x,responseType:"text",type:L.PlaylistContextType.LEVEL,url:f,deliveryDirectives:m})},b.onAudioTrackLoading=function(o,s){var u=s.id,x=s.groupId,f=s.url,m=s.deliveryDirectives;this.load({id:u,groupId:x,level:null,responseType:"text",type:L.PlaylistContextType.AUDIO_TRACK,url:f,deliveryDirectives:m})},b.onSubtitleTrackLoading=function(o,s){var u=s.id,x=s.groupId,f=s.url,m=s.deliveryDirectives;this.load({id:u,groupId:x,level:null,responseType:"text",type:L.PlaylistContextType.SUBTITLE_TRACK,url:f,deliveryDirectives:m})},b.load=function(o){var s,u=this.hls.config,x=this.getInternalLoader(o);if(x){var f=x.context;if(f&&f.url===o.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),x.abort()}var m,_,y,h;switch(o.type){case L.PlaylistContextType.MANIFEST:m=u.manifestLoadingMaxRetry,_=u.manifestLoadingTimeOut,y=u.manifestLoadingRetryDelay,h=u.manifestLoadingMaxRetryTimeout;break;case L.PlaylistContextType.LEVEL:case L.PlaylistContextType.AUDIO_TRACK:case L.PlaylistContextType.SUBTITLE_TRACK:m=0,_=u.levelLoadingTimeOut;break;default:m=u.levelLoadingMaxRetry,_=u.levelLoadingTimeOut,y=u.levelLoadingRetryDelay,h=u.levelLoadingMaxRetryTimeout;break}if(x=this.createInternalLoader(o),(s=o.deliveryDirectives)!==null&&s!==void 0&&s.part){var c;if(o.type===L.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===L.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===L.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var l=c.partTarget,a=c.targetduration;l&&a&&(_=Math.min(Math.max(l*3,a*.8)*1e3,_))}}var v={timeout:_,maxRetry:m,retryDelay:y,maxRetryDelay:h,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};x.load(o,v,p)},b.loadsuccess=function(o,s,u,x){if(x===void 0&&(x=null),u.isSidxRequest){this.handleSidxRequest(o,u),this.handlePlaylistLoaded(o,s,u,x);return}this.resetInternalLoader(u.type);var f=o.data;if(f.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,u,"no EXTM3U delimiter",x);return}s.parsing.start=performance.now(),f.indexOf("#EXTINF:")>0||f.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,s,u,x):this.handleMasterPlaylist(o,s,u,x)},b.loaderror=function(o,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!1,o)},b.loadtimeout=function(o,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!0)},b.handleMasterPlaylist=function(o,s,u,x){var f=this.hls,m=o.data,_=R(o,u),y=O.default.parseMasterPlaylist(m,_),h=y.levels,c=y.sessionData;if(!h.length){this.handleManifestParsingError(o,u,"no level found in manifest",x);return}var l=h.map(function(U){return{id:U.attrs.AUDIO,audioCodec:U.audioCodec}}),a=h.map(function(U){return{id:U.attrs.SUBTITLES,textCodec:U.textCodec}}),v=O.default.parseMasterPlaylistMedia(m,_,"AUDIO",l),p=O.default.parseMasterPlaylistMedia(m,_,"SUBTITLES",a),g=O.default.parseMasterPlaylistMedia(m,_,"CLOSED-CAPTIONS");if(v.length){var S=v.some(function(U){return!U.url});!S&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(B.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),v.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new E.AttrList({}),bitrate:0,url:""}))}f.trigger(M.Events.MANIFEST_LOADED,{levels:h,audioTracks:v,subtitles:p,captions:g,url:_,stats:s,networkDetails:x,sessionData:c})},b.handleTrackOrLevelPlaylist=function(o,s,u,x){var f=this.hls,m=u.id,_=u.level,y=u.type,h=R(o,u),c=Object(H.isFiniteNumber)(m)?m:0,l=Object(H.isFiniteNumber)(_)?_:c,a=C(u),v=O.default.parseLevelPlaylist(o.data,h,l,a,c);if(!v.fragments.length){f.trigger(M.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:h,reason:"no fragments found in level",level:typeof u.level=="number"?u.level:void 0});return}if(y===L.PlaylistContextType.MANIFEST){var p={attrs:new E.AttrList({}),bitrate:0,details:v,name:"",url:h};f.trigger(M.Events.MANIFEST_LOADED,{levels:[p],audioTracks:[],url:h,stats:s,networkDetails:x,sessionData:null})}if(s.parsing.end=performance.now(),v.needSidxRanges){var g,S=(g=v.fragments[0].initSegment)===null||g===void 0?void 0:g.url;this.load({url:S,isSidxRequest:!0,type:y,level:_,levelDetails:v,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=v,this.handlePlaylistLoaded(o,s,u,x)},b.handleSidxRequest=function(o,s){var u=Object(k.parseSegmentIndex)(new Uint8Array(o.data));if(!u)return;var x=u.references,f=s.levelDetails;x.forEach(function(m,_){var y=m.info,h=f.fragments[_];h.byteRange.length===0&&h.setByteRange(String(1+y.end-y.start)+"@"+String(y.start)),h.initSegment&&h.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},b.handleManifestParsingError=function(o,s,u,x){this.hls.trigger(M.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===L.PlaylistContextType.MANIFEST,url:o.url,reason:u,response:o,context:s,networkDetails:x})},b.handleNetworkError=function(o,s,u,x){u===void 0&&(u=!1),B.logger.warn("[playlist-loader]: A network "+(u?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var f=P.ErrorDetails.UNKNOWN,m=!1,_=this.getInternalLoader(o);switch(o.type){case L.PlaylistContextType.MANIFEST:f=u?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case L.PlaylistContextType.LEVEL:f=u?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case L.PlaylistContextType.AUDIO_TRACK:f=u?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case L.PlaylistContextType.SUBTITLE_TRACK:f=u?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}_&&this.resetInternalLoader(o.type);var y={type:P.ErrorTypes.NETWORK_ERROR,details:f,fatal:m,url:o.url,loader:_,context:o,networkDetails:s};x&&(y.response=x),this.hls.trigger(M.Events.ERROR,y)},b.handlePlaylistLoaded=function(o,s,u,x){var f=u.type,m=u.level,_=u.id,y=u.groupId,h=u.loader,c=u.levelDetails,l=u.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,u,"invalid target duration",x);return}if(!h)return;c.live&&(h.getCacheAge&&(c.ageHeader=h.getCacheAge()||0),(!h.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(f){case L.PlaylistContextType.MANIFEST:case L.PlaylistContextType.LEVEL:this.hls.trigger(M.Events.LEVEL_LOADED,{details:c,level:m||0,id:_||0,stats:s,networkDetails:x,deliveryDirectives:l});break;case L.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(M.Events.AUDIO_TRACK_LOADED,{details:c,id:_||0,groupId:y||"",stats:s,networkDetails:x,deliveryDirectives:l});break;case L.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(M.Events.SUBTITLE_TRACK_LOADED,{details:c,id:_||0,groupId:y||"",stats:s,networkDetails:x,deliveryDirectives:l});break}},w}();K.default=A},"./src/polyfills/number.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"isFiniteNumber",function(){return H}),D.d(K,"MAX_SAFE_INTEGER",function(){return M});var H=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},M=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(te,K,D){"use strict";D.r(K);var H=function(){function M(){}return M.getSilentFrame=function(B,k){switch(B){case"mp4a.40.2":if(k===1)return new Uint8Array([0,200,0,128,35,128]);if(k===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(k===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(k===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(k===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(k===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(k===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(k===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(k===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},M}();K.default=H},"./src/remux/mp4-generator.ts":function(te,K,D){"use strict";D.r(K);var H=Math.pow(2,32)-1,M=function(){function P(){}return P.init=function(){P.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var k;for(k in P.types)P.types.hasOwnProperty(k)&&(P.types[k]=[k.charCodeAt(0),k.charCodeAt(1),k.charCodeAt(2),k.charCodeAt(3)]);var O=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]),L=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);P.HDLR_TYPES={video:O,audio:L};var E=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),C=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=C,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var R=new Uint8Array([105,115,111,109]),A=new Uint8Array([97,118,99,49]),w=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,R,w,R,A),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,E))},P.box=function(k){for(var O=8,L=arguments.length,E=new Array(L>1?L-1:0),C=1;C<L;C++)E[C-1]=arguments[C];for(var R=E.length,A=R;R--;)O+=E[R].byteLength;var w=new Uint8Array(O);for(w[0]=O>>24&255,w[1]=O>>16&255,w[2]=O>>8&255,w[3]=O&255,w.set(k,4),R=0,O=8;R<A;R++)w.set(E[R],O),O+=E[R].byteLength;return w},P.hdlr=function(k){return P.box(P.types.hdlr,P.HDLR_TYPES[k])},P.mdat=function(k){return P.box(P.types.mdat,k)},P.mdhd=function(k,O){O*=k;var L=Math.floor(O/(H+1)),E=Math.floor(O%(H+1));return P.box(P.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,L>>24,L>>16&255,L>>8&255,L&255,E>>24,E>>16&255,E>>8&255,E&255,85,196,0,0]))},P.mdia=function(k){return P.box(P.types.mdia,P.mdhd(k.timescale,k.duration),P.hdlr(k.type),P.minf(k))},P.mfhd=function(k){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255]))},P.minf=function(k){return k.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(k)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(k))},P.moof=function(k,O,L){return P.box(P.types.moof,P.mfhd(k),P.traf(L,O))},P.moov=function(k){for(var O=k.length,L=[];O--;)L[O]=P.trak(k[O]);return P.box.apply(null,[P.types.moov,P.mvhd(k[0].timescale,k[0].duration)].concat(L).concat(P.mvex(k)))},P.mvex=function(k){for(var O=k.length,L=[];O--;)L[O]=P.trex(k[O]);return P.box.apply(null,[P.types.mvex].concat(L))},P.mvhd=function(k,O){O*=k;var L=Math.floor(O/(H+1)),E=Math.floor(O%(H+1)),C=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,L>>24,L>>16&255,L>>8&255,L&255,E>>24,E>>16&255,E>>8&255,E&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return P.box(P.types.mvhd,C)},P.sdtp=function(k){var O=k.samples||[],L=new Uint8Array(4+O.length),E,C;for(E=0;E<O.length;E++)C=O[E].flags,L[E+4]=C.dependsOn<<4|C.isDependedOn<<2|C.hasRedundancy;return P.box(P.types.sdtp,L)},P.stbl=function(k){return P.box(P.types.stbl,P.stsd(k),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))},P.avc1=function(k){var O=[],L=[],E,C,R;for(E=0;E<k.sps.length;E++)C=k.sps[E],R=C.byteLength,O.push(R>>>8&255),O.push(R&255),O=O.concat(Array.prototype.slice.call(C));for(E=0;E<k.pps.length;E++)C=k.pps[E],R=C.byteLength,L.push(R>>>8&255),L.push(R&255),L=L.concat(Array.prototype.slice.call(C));var A=P.box(P.types.avcC,new Uint8Array([1,O[3],O[4],O[5],252|3,224|k.sps.length].concat(O).concat([k.pps.length]).concat(L))),w=k.width,b=k.height,d=k.pixelRatio[0],o=k.pixelRatio[1];return P.box(P.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,w>>8&255,w&255,b>>8&255,b&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]),A,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,o>>24,o>>16&255,o>>8&255,o&255])))},P.esds=function(k){var O=k.config.length;return new Uint8Array([0,0,0,0,3,23+O,0,1,0,4,15+O,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([O]).concat(k.config).concat([6,1,2]))},P.mp4a=function(k){var O=k.samplerate;return P.box(P.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,k.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]),P.box(P.types.esds,P.esds(k)))},P.mp3=function(k){var O=k.samplerate;return P.box(P.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,k.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]))},P.stsd=function(k){return k.type==="audio"?!k.isAAC&&k.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(k)):P.box(P.types.stsd,P.STSD,P.mp4a(k)):P.box(P.types.stsd,P.STSD,P.avc1(k))},P.tkhd=function(k){var O=k.id,L=k.duration*k.timescale,E=k.width,C=k.height,R=Math.floor(L/(H+1)),A=Math.floor(L%(H+1));return P.box(P.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,O>>24&255,O>>16&255,O>>8&255,O&255,0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,A>>24,A>>16&255,A>>8&255,A&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,E>>8&255,E&255,0,0,C>>8&255,C&255,0,0]))},P.traf=function(k,O){var L=P.sdtp(k),E=k.id,C=Math.floor(O/(H+1)),R=Math.floor(O%(H+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,E>>24,E>>16&255,E>>8&255,E&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,C>>24,C>>16&255,C>>8&255,C&255,R>>24,R>>16&255,R>>8&255,R&255])),P.trun(k,L.length+16+20+8+16+8+8),L)},P.trak=function(k){return k.duration=k.duration||4294967295,P.box(P.types.trak,P.tkhd(k),P.mdia(k))},P.trex=function(k){var O=k.id;return P.box(P.types.trex,new Uint8Array([0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},P.trun=function(k,O){var L=k.samples||[],E=L.length,C=12+16*E,R=new Uint8Array(C),A,w,b,d,o,s;for(O+=8+C,R.set([0,0,15,1,E>>>24&255,E>>>16&255,E>>>8&255,E&255,O>>>24&255,O>>>16&255,O>>>8&255,O&255],0),A=0;A<E;A++)w=L[A],b=w.duration,d=w.size,o=w.flags,s=w.cts,R.set([b>>>24&255,b>>>16&255,b>>>8&255,b&255,d>>>24&255,d>>>16&255,d>>>8&255,d&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*A);return P.box(P.types.trun,R)},P.initSegment=function(k){P.types||P.init();var O=P.moov(k),L=new Uint8Array(P.FTYP.byteLength+O.byteLength);return L.set(P.FTYP),L.set(O,P.FTYP.byteLength),L},P}();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,K.default=M},"./src/remux/mp4-remuxer.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"default",function(){return s}),D.d(K,"normalizePts",function(){return u});var H=D("./src/polyfills/number.ts"),M=D("./src/remux/aac-helper.ts"),P=D("./src/remux/mp4-generator.ts"),B=D("./src/events.ts"),k=D("./src/errors.ts"),O=D("./src/utils/logger.ts"),L=D("./src/types/loader.ts"),E=D("./src/utils/timescale-conversion.ts");function C(){return C=Object.assign||function(_){for(var y=1;y<arguments.length;y++){var h=arguments[y];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(_[c]=h[c])}return _},C.apply(this,arguments)}var R=10*1e3,A=1024,w=1152,b=null,d=null,o=!1,s=function(){function _(h,c,l,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=h,this.config=c,this.typeSupported=l,this.ISGenerated=!1,b===null){var v=navigator.userAgent||"",p=v.match(/Chrome\/(\d+)/i);b=p?parseInt(p[1]):0}if(d===null){var g=navigator.userAgent.match(/Safari\/(\d+)/i);d=g?parseInt(g[1]):0}o=!!b&&b<75||!!d&&d<600}var y=_.prototype;return y.destroy=function(){},y.resetTimeStamp=function(c){O.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},y.resetNextTimestamp=function(){O.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},y.resetInitSegment=function(){O.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},y.getVideoStartPts=function(c){var l=!1,a=c.reduce(function(v,p){var g=p.pts-v;return g<-4294967296?(l=!0,u(v,p.pts)):g>0?v:p.pts},c[0].pts);return l&&O.logger.debug("PTS rollover detected"),a},y.remux=function(c,l,a,v,p,g,S,U){var j,G,N,I,V,Q,ne=p,se=p,xe=c.pid>-1,me=l.pid>-1,Le=l.samples.length,Ee=c.samples.length>0,Te=Le>1,ce=(!xe||Ee)&&(!me||Te)||this.ISGenerated||S;if(ce){this.ISGenerated||(N=this.generateIS(c,l,p));var fe=this.isVideoContiguous,J=-1;if(Te&&(J=x(l.samples),!fe&&this.config.forceKeyFrameOnDiscontinuity))if(Q=!0,J>0){O.logger.warn("[mp4-remuxer]: Dropped "+J+" out of "+Le+" video samples due to a missing keyframe");var le=this.getVideoStartPts(l.samples);l.samples=l.samples.slice(J),l.dropped+=J,se+=(l.samples[0].pts-le)/(l.timescale||9e4)}else J===-1&&(O.logger.warn("[mp4-remuxer]: No keyframe found out of "+Le+" video samples"),Q=!1);if(this.ISGenerated){if(Ee&&Te){var ee=this.getVideoStartPts(l.samples),pe=u(c.samples[0].pts,ee)-ee,ye=pe/l.inputTimeScale;ne+=Math.max(0,ye),se+=Math.max(0,-ye)}if(Ee){if(c.samplerate||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),N=this.generateIS(c,l,p)),G=this.remuxAudio(c,ne,this.isAudioContiguous,g,me||Te||U===L.PlaylistLevelType.AUDIO?se:void 0),Te){var he=G?G.endPTS-G.startPTS:0;l.inputTimeScale||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),N=this.generateIS(c,l,p)),j=this.remuxVideo(l,se,fe,he)}}else Te&&(j=this.remuxVideo(l,se,fe,0));j&&(j.firstKeyFrame=J,j.independent=J!==-1)}}return this.ISGenerated&&(a.samples.length&&(V=this.remuxID3(a,p)),v.samples.length&&(I=this.remuxText(v,p))),{audio:G,video:j,initSegment:N,independent:Q,text:I,id3:V}},y.generateIS=function(c,l,a){var v=c.samples,p=l.samples,g=this.typeSupported,S={},U=!Object(H.isFiniteNumber)(this._initPTS),j="audio/mp4",G,N,I;if(U&&(G=N=Infinity),c.config&&v.length&&(c.timescale=c.samplerate,c.isAAC||(g.mpeg?(j="audio/mpeg",c.codec=""):g.mp3&&(c.codec="mp3")),S.audio={id:"audio",container:j,codec:c.codec,initSegment:!c.isAAC&&g.mpeg?new Uint8Array(0):P.default.initSegment([c]),metadata:{channelCount:c.channelCount}},U&&(I=c.inputTimeScale,G=N=v[0].pts-Math.round(I*a))),l.sps&&l.pps&&p.length&&(l.timescale=l.inputTimeScale,S.video={id:"main",container:"video/mp4",codec:l.codec,initSegment:P.default.initSegment([l]),metadata:{width:l.width,height:l.height}},U)){I=l.inputTimeScale;var V=this.getVideoStartPts(p),Q=Math.round(I*a);N=Math.min(N,u(p[0].dts,V)-Q),G=Math.min(G,V-Q)}if(Object.keys(S).length)return this.ISGenerated=!0,U&&(this._initPTS=G,this._initDTS=N),{tracks:S,initPTS:G,timescale:I}},y.remuxVideo=function(c,l,a,v){var p=c.inputTimeScale,g=c.samples,S=[],U=g.length,j=this._initPTS,G=this.nextAvcDts,N=8,I,V,Q,ne=Number.POSITIVE_INFINITY,se=Number.NEGATIVE_INFINITY,xe=0,me=!1;if(!a||G===null){var Le=l*p,Ee=g[0].pts-u(g[0].dts,g[0].pts);G=Le-Ee}for(var Te=0;Te<U;Te++){var ce=g[Te];if(ce.pts=u(ce.pts-j,G),ce.dts=u(ce.dts-j,G),ce.dts>ce.pts){var fe=9e4*.2;xe=Math.max(Math.min(xe,ce.pts-ce.dts),-1*fe)}ce.dts<g[Te>0?Te-1:Te].dts&&(me=!0)}me&&g.sort(function(Rt,wt){var mt=Rt.dts-wt.dts,$t=Rt.pts-wt.pts;return mt||$t}),V=g[0].dts,Q=g[g.length-1].dts;var J=Math.round((Q-V)/(U-1));if(xe<0){if(xe<J*-2){O.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(E.toMsFromMpegTsClock)(-J,!0)+" ms");for(var le=xe,ee=0;ee<U;ee++)g[ee].dts=le=Math.max(le,g[ee].pts-J),g[ee].pts=Math.max(le,g[ee].pts)}else{O.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(E.toMsFromMpegTsClock)(xe,!0)+" ms to overcome this issue");for(var pe=0;pe<U;pe++)g[pe].dts=g[pe].dts+xe}V=g[0].dts}if(a){var ye=V-G,he=ye>J,we=ye<-1;if(he||we){he?O.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(ye,!0)+" ms ("+ye+"dts) hole between fragments detected, filling it"):O.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(-ye,!0)+" ms ("+ye+"dts) overlapping between fragments detected"),V=G;var De=g[0].pts-ye;g[0].dts=V,g[0].pts=De,O.logger.log("Video: First PTS/DTS adjusted: "+Object(E.toMsFromMpegTsClock)(De,!0)+"/"+Object(E.toMsFromMpegTsClock)(V,!0)+", delta: "+Object(E.toMsFromMpegTsClock)(ye,!0)+" ms")}}o&&(V=Math.max(0,V));for(var Re=0,ke=0,Ce=0;Ce<U;Ce++){for(var Ae=g[Ce],ze=Ae.units,$e=ze.length,je=0,Ve=0;Ve<$e;Ve++)je+=ze[Ve].data.length;ke+=je,Re+=$e,Ae.length=je,Ae.dts=Math.max(Ae.dts,V),Ae.pts=Math.max(Ae.pts,Ae.dts,0),ne=Math.min(Ae.pts,ne),se=Math.max(Ae.pts,se)}Q=g[U-1].dts;var it=ke+4*Re+8,rt;try{rt=new Uint8Array(it)}catch(Rt){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:it,reason:"fail allocating video mdat "+it});return}var Je=new DataView(rt.buffer);Je.setUint32(0,it),rt.set(P.default.types.mdat,4);for(var Oe=0;Oe<U;Oe++){for(var Ze=g[Oe],Ye=Ze.units,Pe=0,Fe=0,ie=Ye.length;Fe<ie;Fe++){var oe=Ye[Fe],ue=oe.data,$=oe.data.byteLength;Je.setUint32(N,$),N+=4,rt.set(ue,N),N+=$,Pe+=4+$}if(Oe<U-1)I=g[Oe+1].dts-Ze.dts;else{var Y=this.config,q=Ze.dts-g[Oe>0?Oe-1:Oe].dts;if(Y.stretchShortVideoTrack&&this.nextAudioPts!==null){var re=Math.floor(Y.maxBufferHole*p),ge=(v?ne+v*p:this.nextAudioPts)-Ze.pts;ge>re?(I=ge-q,I<0&&(I=q),O.logger.log("[mp4-remuxer]: It is approximately "+ge/90+" ms to the next segment; using duration "+I/90+" ms for the last video frame.")):I=q}else I=q}var Se=Math.round(Ze.pts-Ze.dts);S.push(new f(Ze.key,I,Pe,Se))}if(S.length&&b&&b<70){var Me=S[0].flags;Me.dependsOn=2,Me.isNonSync=0}console.assert(I!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=G=Q+I,this.isVideoContiguous=!0;var at=P.default.moof(c.sequenceNumber++,V,C({},c,{samples:S})),vt="video",dt={data1:at,data2:rt,startPTS:ne/p,endPTS:(se+I)/p,startDTS:V/p,endDTS:G/p,type:vt,hasAudio:!1,hasVideo:!0,nb:S.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(rt.length,"MDAT length must not be zero"),dt},y.remuxAudio=function(c,l,a,v,p){var g=c.inputTimeScale,S=c.samplerate?c.samplerate:g,U=g/S,j=c.isAAC?A:w,G=j*U,N=this._initPTS,I=!c.isAAC&&this.typeSupported.mpeg,V=[],Q=c.samples,ne=I?0:8,se=this.nextAudioPts||-1,xe=l*g;if(this.isAudioContiguous=a=a||Q.length&&se>0&&(v&&Math.abs(xe-se)<9e3||Math.abs(u(Q[0].pts-N,xe)-se)<20*G),Q.forEach(function(ue){ue.pts=u(ue.pts-N,xe)}),!a||se<0){if(Q=Q.filter(function(ue){return ue.pts>=0}),!Q.length)return;p===0?se=0:v?se=Math.max(0,xe):se=Q[0].pts}if(c.isAAC)for(var me=p!==void 0,Le=this.config.maxAudioFramesDrift,Ee=0,Te=se;Ee<Q.length;Ee++){var ce=Q[Ee],fe=ce.pts,J=fe-Te,le=Math.abs(1e3*J/g);if(J<=-Le*G&&me)Ee===0&&(O.logger.warn("Audio frame @ "+(fe/g).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*J/g)+" ms."),this.nextAudioPts=se=Te=fe);else if(J>=Le*G&&le<R&&me){var ee=Math.round(J/G);Te=fe-ee*G,Te<0&&(ee--,Te+=G),Ee===0&&(this.nextAudioPts=se=Te),O.logger.warn("[mp4-remuxer]: Injecting "+ee+" audio frame @ "+(Te/g).toFixed(3)+"s due to "+Math.round(1e3*J/g)+" ms gap.");for(var pe=0;pe<ee;pe++){var ye=Math.max(Te,0),he=M.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);he||(O.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),he=ce.unit.subarray()),Q.splice(Ee,0,{unit:he,pts:ye}),Te+=G,Ee++}}ce.pts=Te,Te+=G}for(var we=null,De=null,Re,ke=0,Ce=Q.length;Ce--;)ke+=Q[Ce].unit.byteLength;for(var Ae=0,ze=Q.length;Ae<ze;Ae++){var $e=Q[Ae],je=$e.unit,Ve=$e.pts;if(De!==null){var it=V[Ae-1];it.duration=Math.round((Ve-De)/U)}else if(a&&c.isAAC&&(Ve=se),we=Ve,ke>0){ke+=ne;try{Re=new Uint8Array(ke)}catch(ue){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ke,reason:"fail allocating audio mdat "+ke});return}if(!I){var rt=new DataView(Re.buffer);rt.setUint32(0,ke),Re.set(P.default.types.mdat,4)}}else return;Re.set(je,ne);var Je=je.byteLength;ne+=Je,V.push(new f(!0,j,Je,0)),De=Ve}var Oe=V.length;if(!Oe)return;var Ze=V[V.length-1];this.nextAudioPts=se=De+U*Ze.duration;var Ye=I?new Uint8Array(0):P.default.moof(c.sequenceNumber++,we/U,C({},c,{samples:V}));c.samples=[];var Pe=we/g,Fe=se/g,ie="audio",oe={data1:Ye,data2:Re,startPTS:Pe,endPTS:Fe,startDTS:Pe,endDTS:Fe,type:ie,hasAudio:!0,hasVideo:!1,nb:Oe};return this.isAudioContiguous=!0,console.assert(Re.length,"MDAT length must not be zero"),oe},y.remuxEmptyAudio=function(c,l,a,v){var p=c.inputTimeScale,g=c.samplerate?c.samplerate:p,S=p/g,U=this.nextAudioPts,j=(U!==null?U:v.startDTS*p)+this._initDTS,G=v.endDTS*p+this._initDTS,N=S*A,I=Math.ceil((G-j)/N),V=M.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(O.logger.warn("[mp4-remuxer]: remux empty Audio"),!V){O.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Q=[],ne=0;ne<I;ne++){var se=j+ne*N;Q.push({unit:V,pts:se,dts:se})}return c.samples=Q,this.remuxAudio(c,l,a,!1)},y.remuxID3=function(c,l){var a=c.samples.length;if(!a)return;for(var v=c.inputTimeScale,p=this._initPTS,g=this._initDTS,S=0;S<a;S++){var U=c.samples[S];U.pts=u(U.pts-p,l*v)/v,U.dts=u(U.dts-g,l*v)/v}var j=c.samples;return c.samples=[],{samples:j}},y.remuxText=function(c,l){var a=c.samples.length;if(!a)return;for(var v=c.inputTimeScale,p=this._initPTS,g=0;g<a;g++){var S=c.samples[g];S.pts=u(S.pts-p,l*v)/v}c.samples.sort(function(j,G){return j.pts-G.pts});var U=c.samples;return c.samples=[],{samples:U}},_}();function u(_,y){var h;if(y===null)return _;for(y<_?h=-8589934592:h=8589934592;Math.abs(_-y)>4294967296;)_+=h;return _}function x(_){for(var y=0;y<_.length;y++)if(_[y].key)return y;return-1}var f=function(y,h,c,l){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=h,this.size=c,this.cts=l,this.flags=new m(y)},m=function(y){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=y?2:1,this.isNonSync=y?0:1}},"./src/remux/passthrough-remuxer.ts":function(te,K,D){"use strict";D.r(K);var H=D("./src/polyfills/number.ts"),M=D("./src/utils/mp4-tools.ts"),P=D("./src/loader/fragment.ts"),B=D("./src/utils/logger.ts"),k=function(){function E(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var C=E.prototype;return C.destroy=function(){},C.resetTimeStamp=function(A){this.initPTS=A,this.lastEndDTS=null},C.resetNextTimestamp=function(){this.lastEndDTS=null},C.resetInitSegment=function(A,w,b){this.audioCodec=w,this.videoCodec=b,this.generateInitSegment(A),this.emitInitSegment=!0},C.generateInitSegment=function(A){var w=this.audioCodec,b=this.videoCodec;if(!A||!A.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(M.parseInitSegment)(A);w||(w=L(d.audio,P.ElementaryStreamTypes.AUDIO)),b||(b=L(d.video,P.ElementaryStreamTypes.VIDEO));var o={};d.audio&&d.video?o.audiovideo={container:"video/mp4",codec:w+","+b,initSegment:A,id:"main"}:d.audio?o.audio={container:"audio/mp4",codec:w,initSegment:A,id:"audio"}:d.video?o.video={container:"video/mp4",codec:b,initSegment:A,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},C.remux=function(A,w,b,d,o){var s=this.initPTS,u=this.lastEndDTS,x={audio:void 0,video:void 0,text:d,id3:b,initSegment:void 0};Object(H.isFiniteNumber)(u)||(u=this.lastEndDTS=o||0);var f=w.samples;if(!f||!f.length)return x;var m={initPTS:void 0,timescale:1},_=this.initData;if((!_||!_.length)&&(this.generateInitSegment(f),_=this.initData),!_||!_.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),x;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1),Object(H.isFiniteNumber)(s)||(this.initPTS=m.initPTS=s=O(_,f,u));var y=Object(M.getDuration)(f,_),h=u,c=y+h;Object(M.offsetStartDTS)(_,f,s),y>0?this.lastEndDTS=c:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var l=!!_.audio,a=!!_.video,v="";l&&(v+="audio"),a&&(v+="video");var p={data1:f,startPTS:h,startDTS:h,endPTS:c,endDTS:c,type:v,hasAudio:l,hasVideo:a,nb:1,dropped:0};return x.audio=p.type==="audio"?p:void 0,x.video=p.type!=="audio"?p:void 0,x.text=d,x.id3=b,x.initSegment=m,x},E}(),O=function(C,R,A){return Object(M.getStartDTS)(C,R)-A};function L(E,C){var R=E==null?void 0:E.codec;return R&&R.length>4?R:R==="hvc1"?"hvc1.1.c.L120.90":R==="av01"?"av01.0.04M.08":R==="avc1"||C===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}K.default=k},"./src/task-loop.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"default",function(){return H});var H=function(){function M(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var P=M.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(k){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,k),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},M}()},"./src/types/cmcd.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"CMCDVersion",function(){return H}),D.d(K,"CMCDObjectType",function(){return M}),D.d(K,"CMCDStreamingFormat",function(){return P}),D.d(K,"CMCDStreamType",function(){return B});var H=1,M;(function(k){k.MANIFEST="m",k.AUDIO="a",k.VIDEO="v",k.MUXED="av",k.INIT="i",k.CAPTION="c",k.TIMED_TEXT="tt",k.KEY="k",k.OTHER="o"})(M||(M={}));var P;(function(k){k.DASH="d",k.HLS="h",k.SMOOTH="s",k.OTHER="o"})(P||(P={}));var B;(function(k){k.VOD="v",k.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"HlsSkip",function(){return P}),D.d(K,"getSkipValue",function(){return B}),D.d(K,"HlsUrlParameters",function(){return k}),D.d(K,"Level",function(){return O});function H(L,E){for(var C=0;C<E.length;C++){var R=E[C];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(L,R.key,R)}}function M(L,E,C){return E&&H(L.prototype,E),C&&H(L,C),L}var P;(function(L){L.No="",L.Yes="YES",L.v2="v2"})(P||(P={}));function B(L,E){var C=L.canSkipUntil,R=L.canSkipDateRanges,A=L.endSN,w=E!==void 0?E-A:0;return C&&w<C?R?P.v2:P.Yes:P.No}var k=function(){function L(C,R,A){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=C,this.part=R,this.skip=A}var E=L.prototype;return E.addDirectives=function(R){var A=new self.URL(R);return this.msn!==void 0&&A.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&A.searchParams.set("_HLS_part",this.part.toString()),this.skip&&A.searchParams.set("_HLS_skip",this.skip),A.toString()},L}(),O=function(){function L(E){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[E.url],this.attrs=E.attrs,this.bitrate=E.bitrate,E.details&&(this.details=E.details),this.id=E.id||0,this.name=E.name,this.width=E.width||0,this.height=E.height||0,this.audioCodec=E.audioCodec,this.videoCodec=E.videoCodec,this.unknownCodecs=E.unknownCodecs,this.codecSet=[E.videoCodec,E.audioCodec].filter(function(C){return C}).join(",").replace(/\.[^.,]+/g,"")}return M(L,[{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(C){var R=C%this.url.length;this._urlId!==R&&(this.details=void 0,this._urlId=R)}}]),L}()},"./src/types/loader.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"PlaylistContextType",function(){return H}),D.d(K,"PlaylistLevelType",function(){return M});var H;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(H||(H={}));var M;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(M||(M={}))},"./src/types/transmuxer.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"ChunkMetadata",function(){return H});var H=function(B,k,O,L,E,C){L===void 0&&(L=0),E===void 0&&(E=-1),C===void 0&&(C=!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=B,this.sn=k,this.id=O,this.size=L,this.part=E,this.partial=C};function M(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"AttrList",function(){return P});var H=/^(\d+)x(\d+)$/,M=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=function(){function B(O){typeof O=="string"&&(O=B.parseAttrList(O));for(var L in O)O.hasOwnProperty(L)&&(this[L]=O[L])}var k=B.prototype;return k.decimalInteger=function(L){var E=parseInt(this[L],10);return E>Number.MAX_SAFE_INTEGER?Infinity:E},k.hexadecimalInteger=function(L){if(this[L]){var E=(this[L]||"0x").slice(2);E=(E.length&1?"0":"")+E;for(var C=new Uint8Array(E.length/2),R=0;R<E.length/2;R++)C[R]=parseInt(E.slice(R*2,R*2+2),16);return C}else return null},k.hexadecimalIntegerAsNumber=function(L){var E=parseInt(this[L],16);return E>Number.MAX_SAFE_INTEGER?Infinity:E},k.decimalFloatingPoint=function(L){return parseFloat(this[L])},k.optionalFloat=function(L,E){var C=this[L];return C?parseFloat(C):E},k.enumeratedString=function(L){return this[L]},k.bool=function(L){return this[L]==="YES"},k.decimalResolution=function(L){var E=H.exec(this[L]);return E===null?void 0:{width:parseInt(E[1],10),height:parseInt(E[2],10)}},B.parseAttrList=function(L){var E,C={},R='"';for(M.lastIndex=0;(E=M.exec(L))!==null;){var A=E[2];A.indexOf(R)===0&&A.lastIndexOf(R)===A.length-1&&(A=A.slice(1,-1)),C[E[1]]=A}return C},B}()},"./src/utils/binary-search.ts":function(te,K,D){"use strict";D.r(K);var H={search:function(P,B){for(var k=0,O=P.length-1,L=null,E=null;k<=O;){L=(k+O)/2|0,E=P[L];var C=B(E);if(C>0)k=L+1;else if(C<0)O=L-1;else return E}return null}};K.default=H},"./src/utils/buffer-helper.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"BufferHelper",function(){return P});var H=D("./src/utils/logger.ts"),M={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function B(){}return B.isBuffered=function(O,L){try{if(O){for(var E=B.getBuffered(O),C=0;C<E.length;C++)if(L>=E.start(C)&&L<=E.end(C))return!0}}catch(R){}return!1},B.bufferInfo=function(O,L,E){try{if(O){var C=B.getBuffered(O),R=[],A;for(A=0;A<C.length;A++)R.push({start:C.start(A),end:C.end(A)});return this.bufferedInfo(R,L,E)}}catch(w){}return{len:0,start:L,end:L,nextStart:void 0}},B.bufferedInfo=function(O,L,E){L=Math.max(0,L),O.sort(function(m,_){var y=m.start-_.start;return y||_.end-m.end});var C=[];if(E)for(var R=0;R<O.length;R++){var A=C.length;if(A){var w=C[A-1].end;O[R].start-w<E?O[R].end>w&&(C[A-1].end=O[R].end):C.push(O[R])}else C.push(O[R])}else C=O;for(var b=0,d,o=L,s=L,u=0;u<C.length;u++){var x=C[u].start,f=C[u].end;if(L+E>=x&&L<f)o=x,s=f,b=s-L;else if(L+E<x){d=x;break}}return{len:b,start:o||0,end:s||0,nextStart:d}},B.getBuffered=function(O){try{return O.buffered}catch(L){return H.logger.log("failed to get media.buffered",L),M}},B}()},"./src/utils/cea-608-parser.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"Row",function(){return s}),D.d(K,"CaptionScreen",function(){return u});var H=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},P=function(c){var l=c;return M.hasOwnProperty(c)&&(l=M[c]),String.fromCharCode(l)},B=15,k=100,O={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},L={17:2,18:4,21:6,22:8,23:10,19:13,20:15},E={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},C={25:2,26:4,29:6,30:8,31:10,27:13,28:15},R=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],A;(function(h){h[h.ERROR=0]="ERROR",h[h.TEXT=1]="TEXT",h[h.WARNING=2]="WARNING",h[h.INFO=2]="INFO",h[h.DEBUG=3]="DEBUG",h[h.DATA=3]="DATA"})(A||(A={}));var w=function(){function h(){this.time=null,this.verboseLevel=A.ERROR}var c=h.prototype;return c.log=function(a,v){this.verboseLevel>=a&&H.logger.log(this.time+" ["+a+"] "+v)},h}(),b=function(c){for(var l=[],a=0;a<c.length;a++)l.push(c[a].toString(16));return l},d=function(){function h(l,a,v,p,g){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=l||"white",this.underline=a||!1,this.italics=v||!1,this.background=p||"black",this.flash=g||!1}var c=h.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(a){for(var v=["foreground","underline","italics","background","flash"],p=0;p<v.length;p++){var g=v[p];a.hasOwnProperty(g)&&(this[g]=a[g])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},c.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},h}(),o=function(){function h(l,a,v,p,g,S){this.uchar=void 0,this.penState=void 0,this.uchar=l||" ",this.penState=new d(a,v,p,g,S)}var c=h.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,v){this.uchar=a,this.penState.copy(v)},c.setPenState=function(a){this.penState.copy(a)},c.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},c.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},h}(),s=function(){function h(l){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<k;a++)this.chars.push(new o);this.logger=l,this.pos=0,this.currPenState=new d}var c=h.prototype;return c.equals=function(a){for(var v=!0,p=0;p<k;p++)if(!this.chars[p].equals(a.chars[p])){v=!1;break}return v},c.copy=function(a){for(var v=0;v<k;v++)this.chars[v].copy(a.chars[v])},c.isEmpty=function(){for(var a=!0,v=0;v<k;v++)if(!this.chars[v].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(A.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>k&&(this.logger.log(A.DEBUG,"Too large cursor position "+this.pos),this.pos=k)},c.moveCursor=function(a){var v=this.pos+a;if(a>1)for(var p=this.pos+1;p<v+1;p++)this.chars[p].setPenState(this.currPenState);this.setCursor(v)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var v=P(a);if(this.pos>=k){this.logger.log(A.ERROR,"Cannot insert "+a.toString(16)+" ("+v+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(v,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var v;for(v=a;v<k;v++)this.chars[v].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var a=[],v=!0,p=0;p<k;p++){var g=this.chars[p].uchar;g!==" "&&(v=!1),a.push(g)}return v?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var v=this.chars[this.pos];v.setPenState(this.currPenState)},h}(),u=function(){function h(l){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<B;a++)this.rows.push(new s(l));this.logger=l,this.currRow=B-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=h.prototype;return c.reset=function(){for(var a=0;a<B;a++)this.rows[a].clear();this.currRow=B-1},c.equals=function(a){for(var v=!0,p=0;p<B;p++)if(!this.rows[p].equals(a.rows[p])){v=!1;break}return v},c.copy=function(a){for(var v=0;v<B;v++)this.rows[v].copy(a.rows[v])},c.isEmpty=function(){for(var a=!0,v=0;v<B;v++)if(!this.rows[v].isEmpty()){a=!1;break}return a},c.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},c.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},c.insertChar=function(a){var v=this.rows[this.currRow];v.insertChar(a)},c.setPen=function(a){var v=this.rows[this.currRow];v.setPenStyles(a)},c.moveCursor=function(a){var v=this.rows[this.currRow];v.moveCursor(a)},c.setCursor=function(a){this.logger.log(A.INFO,"setCursor: "+a);var v=this.rows[this.currRow];v.setCursor(a)},c.setPAC=function(a){this.logger.log(A.INFO,"pacData = "+JSON.stringify(a));var v=a.row-1;if(this.nrRollUpRows&&v<this.nrRollUpRows-1&&(v=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==v){for(var p=0;p<B;p++)this.rows[p].clear();var g=this.currRow+1-this.nrRollUpRows,S=this.lastOutputScreen;if(S){var U=S.rows[g].cueStartTime,j=this.logger.time;if(U&&j!==null&&U<j)for(var G=0;G<this.nrRollUpRows;G++)this.rows[v-this.nrRollUpRows+G+1].copy(S.rows[g+G])}}this.currRow=v;var N=this.rows[this.currRow];if(a.indent!==null){var I=a.indent,V=Math.max(I-1,0);N.setCursor(a.indent),a.color=N.chars[V].penState.foreground}var Q={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(Q)},c.setBkgData=function(a){this.logger.log(A.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},c.setRollUpRows=function(a){this.nrRollUpRows=a},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(A.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(A.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,v=this.rows.splice(a,1)[0];v.clear(),this.rows.splice(this.currRow,0,v),this.logger.log(A.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var v=[],p="",g=-1,S=0;S<B;S++){var U=this.rows[S].getTextString();U&&(g=S+1,a?v.push("Row "+g+": '"+U+"'"):v.push(U.trim()))}return v.length>0&&(a?p="["+v.join(" | ")+"]":p=v.join(`
|
|
`)),p},c.getTextAndFormat=function(){return this.rows},h}(),x=function(){function h(l,a,v){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=l,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new u(v),this.nonDisplayedMemory=new u(v),this.lastOutputScreen=new u(v),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=v}var c=h.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(a){this.outputFilter=a},c.setPAC=function(a){this.writeScreen.setPAC(a)},c.setBkgData=function(a){this.writeScreen.setBkgData(a)},c.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(A.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},c.insertChars=function(a){for(var v=0;v<a.length;v++)this.writeScreen.insertChar(a[v]);var p=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(A.INFO,p+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(A.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(A.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(A.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},c.ccAOF=function(){},c.ccAON=function(){},c.ccDER=function(){this.logger.log(A.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(A.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(A.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(A.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(A.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(A.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(A.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(A.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(A.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(A.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(A.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(A.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var v={flash:!1};if(v.underline=a%2===1,v.italics=a>=46,v.italics)v.foreground="white";else{var p=Math.floor(a/2)-16,g=["white","green","blue","cyan","red","yellow","magenta"];v.foreground=g[p]}this.logger.log(A.INFO,"MIDROW: "+JSON.stringify(v)),this.writeScreen.setPen(v)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var v=this.logger.time;if(v===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=v:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,v,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:v),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},h}(),f=function(){function h(l,a,v){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var p=new w;this.channels=[null,new x(l,a,p),new x(l+1,v,p)],this.cmdHistory=y(),this.logger=p}var c=h.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,v){this.channels[a].setHandler(v)},c.addData=function(a,v){var p,g,S,U=!1;this.logger.time=a;for(var j=0;j<v.length;j+=2){if(g=v[j]&127,S=v[j+1]&127,g===0&&S===0)continue;if(this.logger.log(A.DATA,"["+b([v[j],v[j+1]])+"] -> ("+b([g,S])+")"),p=this.parseCmd(g,S),p||(p=this.parseMidrow(g,S)),p||(p=this.parsePAC(g,S)),p||(p=this.parseBackgroundAttributes(g,S)),!p&&(U=this.parseChars(g,S),U)){var G=this.currentChannel;if(G&&G>0){var N=this.channels[G];N.insertChars(U)}else this.logger.log(A.WARNING,"No channel found yet. TEXT-MODE?")}!p&&!U&&this.logger.log(A.WARNING,"Couldn't parse cleaned data "+b([g,S])+" orig: "+b([v[j],v[j+1]]))}},c.parseCmd=function(a,v){var p=this.cmdHistory,g=(a===20||a===28||a===21||a===29)&&v>=32&&v<=47,S=(a===23||a===31)&&v>=33&&v<=35;if(!(g||S))return!1;if(_(a,v,p))return m(null,null,p),this.logger.log(A.DEBUG,"Repeated command ("+b([a,v])+") is dropped"),!0;var U=a===20||a===21||a===23?1:2,j=this.channels[U];return a===20||a===21||a===28||a===29?v===32?j.ccRCL():v===33?j.ccBS():v===34?j.ccAOF():v===35?j.ccAON():v===36?j.ccDER():v===37?j.ccRU(2):v===38?j.ccRU(3):v===39?j.ccRU(4):v===40?j.ccFON():v===41?j.ccRDC():v===42?j.ccTR():v===43?j.ccRTD():v===44?j.ccEDM():v===45?j.ccCR():v===46?j.ccENM():v===47&&j.ccEOC():j.ccTO(v-32),m(a,v,p),this.currentChannel=U,!0},c.parseMidrow=function(a,v){var p=0;if((a===17||a===25)&&v>=32&&v<=47){if(a===17?p=1:p=2,p!==this.currentChannel)return this.logger.log(A.ERROR,"Mismatch channel in midrow parsing"),!1;var g=this.channels[p];return g?(g.ccMIDROW(v),this.logger.log(A.DEBUG,"MIDROW ("+b([a,v])+")"),!0):!1}return!1},c.parsePAC=function(a,v){var p,g=this.cmdHistory,S=(a>=17&&a<=23||a>=25&&a<=31)&&v>=64&&v<=127,U=(a===16||a===24)&&v>=64&&v<=95;if(!(S||U))return!1;if(_(a,v,g))return m(null,null,g),!0;var j=a<=23?1:2;v>=64&&v<=95?p=j===1?O[a]:E[a]:p=j===1?L[a]:C[a];var G=this.channels[j];return G?(G.setPAC(this.interpretPAC(p,v)),m(a,v,g),this.currentChannel=j,!0):!1},c.interpretPAC=function(a,v){var p,g={color:null,italics:!1,indent:null,underline:!1,row:a};return v>95?p=v-96:p=v-64,g.underline=(p&1)===1,p<=13?g.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(p/2)]:p<=15?(g.italics=!0,g.color="white"):g.indent=Math.floor((p-16)/2)*4,g},c.parseChars=function(a,v){var p,g=null,S=null;if(a>=25?(p=2,S=a-8):(p=1,S=a),S>=17&&S<=19){var U;S===17?U=v+80:S===18?U=v+112:U=v+144,this.logger.log(A.INFO,"Special char '"+P(U)+"' in channel "+p),g=[U]}else a>=32&&a<=127&&(g=v===0?[a]:[a,v]);if(g){var j=b(g);this.logger.log(A.DEBUG,"Char codes = "+j.join(",")),m(a,v,this.cmdHistory)}return g},c.parseBackgroundAttributes=function(a,v){var p=(a===16||a===24)&&v>=32&&v<=47,g=(a===23||a===31)&&v>=45&&v<=47;if(!(p||g))return!1;var S,U={};a===16||a===24?(S=Math.floor((v-32)/2),U.background=R[S],v%2===1&&(U.background=U.background+"_semi")):v===45?U.background="transparent":(U.foreground="black",v===47&&(U.underline=!0));var j=a<=23?1:2,G=this.channels[j];return G.setBkgData(U),m(a,v,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var v=this.channels[a];v&&v.reset()}this.cmdHistory=y()},c.cueSplitAtTime=function(a){for(var v=0;v<this.channels.length;v++){var p=this.channels[v];p&&p.cueSplitAtTime(a)}},h}();function m(h,c,l){l.a=h,l.b=c}function _(h,c,l){return l.a===h&&l.b===c}function y(){return{a:null,b:null}}K.default=f},"./src/utils/codecs.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"isCodecType",function(){return M}),D.d(K,"isCodecSupportedInMp4",function(){return P});var H={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function M(B,k){var O=H[k];return!!O&&O[B.slice(0,4)]===!0}function P(B,k){return MediaSource.isTypeSupported((k||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(te,K,D){"use strict";D.r(K);var H=D("./src/utils/vttparser.ts"),M=D("./src/utils/webvtt-parser.ts"),P=D("./src/utils/texttrack-utils.ts"),B=/\s/,k={newCue:function(L,E,C,R){for(var A=[],w,b,d,o,s,u=self.VTTCue||self.TextTrackCue,x=0;x<R.rows.length;x++)if(w=R.rows[x],d=!0,o=0,s="",!w.isEmpty()){for(var f=0;f<w.chars.length;f++)B.test(w.chars[f].uchar)&&d?o++:(s+=w.chars[f].uchar,d=!1);w.cueStartTime=E,E===C&&(C+=1e-4),o>=16?o--:o++;var m=Object(H.fixLineBreaks)(s.trim()),_=Object(M.generateCueId)(E,C,m);(!L||!L.cues||!L.cues.getCueById(_))&&(b=new u(E,C,m),b.id=_,b.line=x+1,b.align="left",b.position=10+Math.min(80,Math.floor(o*8/32)*10),A.push(b))}return L&&A.length&&(A.sort(function(y,h){return y.line==="auto"||h.line==="auto"?0:y.line>8&&h.line>8?h.line-y.line:y.line-h.line}),A.forEach(function(y){return Object(P.addCueToTrack)(L,y)})),A}};K.default=k},"./src/utils/discontinuities.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"findFirstFragWithCC",function(){return B}),D.d(K,"shouldAlignOnDiscontinuities",function(){return k}),D.d(K,"findDiscontinuousReferenceFrag",function(){return O}),D.d(K,"adjustSlidingStart",function(){return E}),D.d(K,"alignStream",function(){return C}),D.d(K,"alignPDT",function(){return A}),D.d(K,"alignFragmentByPDTDelta",function(){return w}),D.d(K,"alignMediaPlaylistByPDT",function(){return b});var H=D("./src/polyfills/number.ts"),M=D("./src/utils/logger.ts"),P=D("./src/controller/level-helper.ts");function B(d,o){for(var s=null,u=0,x=d.length;u<x;u++){var f=d[u];if(f&&f.cc===o){s=f;break}}return s}function k(d,o,s){return!!(o.details&&(s.endCC>s.startCC||d&&d.cc<s.startCC))}function O(d,o){var s=d.fragments,u=o.fragments;if(!u.length||!s.length){M.logger.log("No fragments to align");return}var x=B(s,u[0].cc);if(!x||x&&!x.startPTS){M.logger.log("No frag in previous level to align on");return}return x}function L(d,o){if(d){var s=d.start+o;d.start=d.startPTS=s,d.endPTS=s+d.duration}}function E(d,o){for(var s=o.fragments,u=0,x=s.length;u<x;u++)L(s[u],d);o.fragmentHint&&L(o.fragmentHint,d),o.alignedSliding=!0}function C(d,o,s){if(!o)return;R(d,s,o),!s.alignedSliding&&o.details&&A(s,o.details),!s.alignedSliding&&o.details&&!s.skippedSegments&&Object(P.adjustSliding)(o.details,s)}function R(d,o,s){if(k(d,s,o)){var u=O(s.details,o);u&&Object(H.isFiniteNumber)(u.start)&&(M.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),E(u.start,o))}}function A(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,u=d.fragments[0].programDateTime,x=(u-s)/1e3+o.fragments[0].start;x&&Object(H.isFiniteNumber)(x)&&(M.logger.log("Adjusting PTS using programDateTime delta "+(u-s)+"ms, sliding:"+x.toFixed(3)+" "+d.url+" "),E(x,d))}function w(d,o){var s=d.programDateTime;if(!s)return;var u=(s-o)/1e3;d.start=d.startPTS=u,d.endPTS=u+d.duration}function b(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,u=o.fragments[0].start,x=s-u*1e3;d.fragments.forEach(function(f){w(f,x)}),d.fragmentHint&&w(d.fragmentHint,x),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(te,K,D){"use strict";D.r(K);var H=D("./src/utils/ewma.ts"),M=function(){function P(k,O,L){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=L,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new H.default(k),this.fast_=new H.default(O)}var B=P.prototype;return B.update=function(O,L){var E=this.slow_,C=this.fast_;this.slow_.halfLife!==O&&(this.slow_=new H.default(O,E.getEstimate(),E.getTotalWeight())),this.fast_.halfLife!==L&&(this.fast_=new H.default(L,C.getEstimate(),C.getTotalWeight()))},B.sample=function(O,L){O=Math.max(O,this.minDelayMs_);var E=8*L,C=O/1e3,R=E/C;this.fast_.sample(C,R),this.slow_.sample(C,R)},B.canEstimate=function(){var O=this.fast_;return O&&O.getTotalWeight()>=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},P}();K.default=M},"./src/utils/ewma.ts":function(te,K,D){"use strict";D.r(K);var H=function(){function M(B,k,O){k===void 0&&(k=0),O===void 0&&(O=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=B,this.alpha_=B?Math.exp(Math.log(.5)/B):0,this.estimate_=k,this.totalWeight_=O}var P=M.prototype;return P.sample=function(k,O){var L=Math.pow(this.alpha_,k);this.estimate_=O*(1-L)+L*this.estimate_,this.totalWeight_+=k},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var k=1-Math.pow(this.alpha_,this.totalWeight_);if(k)return this.estimate_/k}return this.estimate_},M}();K.default=H},"./src/utils/fetch-loader.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"fetchSupported",function(){return w});var H=D("./src/polyfills/number.ts"),M=D("./src/loader/load-stats.ts"),P=D("./src/demux/chunk-cache.ts");function B(u,x){u.prototype=Object.create(x.prototype),u.prototype.constructor=u,C(u,x)}function k(u){var x=typeof Map=="function"?new Map:void 0;return k=function(m){if(m===null||!E(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(typeof x!="undefined"){if(x.has(m))return x.get(m);x.set(m,_)}function _(){return O(m,arguments,R(this).constructor)}return _.prototype=Object.create(m.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),C(_,m)},k(u)}function O(u,x,f){return L()?O=Reflect.construct:O=function(_,y,h){var c=[null];c.push.apply(c,y);var l=Function.bind.apply(_,c),a=new l;return h&&C(a,h.prototype),a},O.apply(null,arguments)}function L(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function E(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function C(u,x){return C=Object.setPrototypeOf||function(m,_){return m.__proto__=_,m},C(u,x)}function R(u){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(f){return f.__proto__||Object.getPrototypeOf(f)},R(u)}function A(){return A=Object.assign||function(u){for(var x=1;x<arguments.length;x++){var f=arguments[x];for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&(u[m]=f[m])}return u},A.apply(this,arguments)}function w(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(u){}return!1}var b=function(){function u(f){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=f.fetchSetup||o,this.controller=new self.AbortController,this.stats=new M.LoadStats}var x=u.prototype;return x.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},x.abortInternal=function(){var m=this.response;(!m||!m.ok)&&(this.stats.aborted=!0,this.controller.abort())},x.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},x.load=function(m,_,y){var h=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var l=d(m,this.controller.signal),a=y.onProgress,v=m.responseType==="arraybuffer",p=v?"byteLength":"length";this.context=m,this.config=_,this.callbacks=y,this.request=this.fetchSetup(m,l),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){h.abortInternal(),y.onTimeout(c,m,h.response)},_.timeout),self.fetch(this.request).then(function(g){if(h.response=h.loader=g,!g.ok){var S=g.status,U=g.statusText;throw new s(U||"fetch, bad network response",S,g)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(g.headers.get("Content-Length")||"0"),a&&Object(H.isFiniteNumber)(_.highWaterMark)?h.loadProgressively(g,c,m,_.highWaterMark,a):v?g.arrayBuffer():g.text()}).then(function(g){var S=h.response;self.clearTimeout(h.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=g[p];var U={url:S.url,data:g};a&&!Object(H.isFiniteNumber)(_.highWaterMark)&&a(c,m,g,S),y.onSuccess(U,c,m,S)}).catch(function(g){if(self.clearTimeout(h.requestTimeout),c.aborted)return;var S=g.code||0;y.onError({code:S,text:g.message},m,g.details)})},x.getCacheAge=function(){var m=null;if(this.response){var _=this.response.headers.get("age");m=_?parseFloat(_):null}return m},x.loadProgressively=function(m,_,y,h,c){h===void 0&&(h=0);var l=new P.default,a=m.body.getReader(),v=function p(){return a.read().then(function(g){if(g.done)return l.dataLength&&c(_,y,l.flush(),m),Promise.resolve(new ArrayBuffer(0));var S=g.value,U=S.length;return _.loaded+=U,U<h||l.dataLength?(l.push(S),l.dataLength>=h&&c(_,y,l.flush(),m)):c(_,y,S,m),p()}).catch(function(){return Promise.reject()})};return v()},u}();function d(u,x){var f={method:"GET",mode:"cors",credentials:"same-origin",signal:x,headers:new self.Headers(A({},u.headers))};return u.rangeEnd&&f.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),f}function o(u,x){return new self.Request(u.url,x)}var s=function(u){B(x,u);function x(f,m,_){var y;return y=u.call(this,f)||this,y.code=void 0,y.details=void 0,y.code=m,y.details=_,y}return x}(k(Error));K.default=b},"./src/utils/imsc1-ttml-parser.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"IMSC1_CODEC",function(){return E}),D.d(K,"parseIMSC1",function(){return w});var H=D("./src/utils/mp4-tools.ts"),M=D("./src/utils/vttparser.ts"),P=D("./src/utils/vttcue.ts"),B=D("./src/demux/id3.ts"),k=D("./src/utils/timescale-conversion.ts"),O=D("./src/utils/webvtt-parser.ts");function L(){return L=Object.assign||function(h){for(var c=1;c<arguments.length;c++){var l=arguments[c];for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&(h[a]=l[a])}return h},L.apply(this,arguments)}var E="stpp.ttml.im1t",C=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,R=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,A={left:"start",center:"center",right:"end",start:"start",end:"end"};function w(h,c,l,a,v){var p=Object(H.findBox)(new Uint8Array(h),["mdat"]);if(p.length===0){v(new Error("Could not parse IMSC1 mdat"));return}var g=p[0],S=Object(B.utf8ArrayToStr)(new Uint8Array(h,g.start,g.end-g.start)),U=Object(k.toTimescaleFromScale)(c,1,l);try{a(b(S,U))}catch(j){v(j)}}function b(h,c){var l=new DOMParser,a=l.parseFromString(h,"text/xml"),v=a.getElementsByTagName("tt")[0];if(!v)throw new Error("Invalid ttml");var p={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},g=Object.keys(p).reduce(function(N,I){return N[I]=v.getAttribute("ttp:"+I)||p[I],N},{}),S=v.getAttribute("xml:space")!=="preserve",U=o(d(v,"styling","style")),j=o(d(v,"layout","region")),G=d(v,"body","[begin]");return[].map.call(G,function(N){var I=s(N,S);if(!I||!N.hasAttribute("begin"))return null;var V=m(N.getAttribute("begin"),g),Q=m(N.getAttribute("dur"),g),ne=m(N.getAttribute("end"),g);if(V===null)throw f(N);if(ne===null){if(Q===null)throw f(N);ne=V+Q}var se=new P.default(V-c,ne-c,I);se.id=Object(O.generateCueId)(se.startTime,se.endTime,se.text);var xe=j[N.getAttribute("region")],me=U[N.getAttribute("style")];se.position=10,se.size=80;var Le=u(xe,me),Ee=Le.textAlign;if(Ee){var Te=A[Ee];Te&&(se.lineAlign=Te),se.align=Ee}return L(se,Le),se}).filter(function(N){return N!==null})}function d(h,c,l){var a=h.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(l)):[]}function o(h){return h.reduce(function(c,l){var a=l.getAttribute("xml:id");return a&&(c[a]=l),c},{})}function s(h,c){return[].slice.call(h.childNodes).reduce(function(l,a,v){var p;return a.nodeName==="br"&&v?l+`
|
|
`:(p=a.childNodes)!==null&&p!==void 0&&p.length?s(a,c):c?l+a.textContent.trim().replace(/\s+/g," "):l+a.textContent},"")}function u(h,c){var l="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(v,p){var g=x(c,l,p)||x(h,l,p);return g&&(v[p]=g),v},{})}function x(h,c,l){return h.hasAttributeNS(c,l)?h.getAttributeNS(c,l):null}function f(h){return new Error("Could not parse ttml timestamp "+h)}function m(h,c){if(!h)return null;var l=Object(M.parseTimeStamp)(h);return l===null&&(C.test(h)?l=_(h,c):R.test(h)&&(l=y(h,c))),l}function _(h,c){var l=C.exec(h),a=(l[4]|0)+(l[5]|0)/c.subFrameRate;return(l[1]|0)*3600+(l[2]|0)*60+(l[3]|0)+a/c.frameRate}function y(h,c){var l=R.exec(h),a=Number(l[1]),v=l[2];switch(v){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/c.frameRate;case"t":return a/c.tickRate}return a}},"./src/utils/logger.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"enableLogs",function(){return O}),D.d(K,"logger",function(){return L});var H=function(){},M={trace:H,debug:H,log:H,warn:H,info:H,error:H},P=M;function B(E){var C=self.console[E];return C?C.bind(self.console,"["+E+"] >"):H}function k(E){for(var C=arguments.length,R=new Array(C>1?C-1:0),A=1;A<C;A++)R[A-1]=arguments[A];R.forEach(function(w){P[w]=E[w]?E[w].bind(E):B(w)})}function O(E){if(self.console&&E===!0||typeof E=="object"){k(E,"debug","log","info","warn","error");try{P.log()}catch(C){P=M}}else P=M}var L=P},"./src/utils/mediakeys-helper.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"KeySystems",function(){return H}),D.d(K,"requestMediaKeySystemAccess",function(){return M});var H;(function(P){P.WIDEVINE="com.widevine.alpha",P.PLAYREADY="com.microsoft.playready"})(H||(H={}));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(te,K,D){"use strict";D.r(K),D.d(K,"getMediaSource",function(){return H});function H(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"bin2str",function(){return k}),D.d(K,"readUint16",function(){return O}),D.d(K,"readUint32",function(){return L}),D.d(K,"writeUint32",function(){return E}),D.d(K,"findBox",function(){return C}),D.d(K,"parseSegmentIndex",function(){return R}),D.d(K,"parseInitSegment",function(){return A}),D.d(K,"getStartDTS",function(){return w}),D.d(K,"getDuration",function(){return b}),D.d(K,"computeRawDurationFromSamples",function(){return d}),D.d(K,"offsetStartDTS",function(){return o}),D.d(K,"segmentValidRange",function(){return s}),D.d(K,"appendUint8Array",function(){return u});var H=D("./src/utils/typed-array.ts"),M=D("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,B=[].push;function k(x){return String.fromCharCode.apply(null,x)}function O(x,f){"data"in x&&(f+=x.start,x=x.data);var m=x[f]<<8|x[f+1];return m<0?65536+m:m}function L(x,f){"data"in x&&(f+=x.start,x=x.data);var m=x[f]<<24|x[f+1]<<16|x[f+2]<<8|x[f+3];return m<0?4294967296+m:m}function E(x,f,m){"data"in x&&(f+=x.start,x=x.data),x[f]=m>>24,x[f+1]=m>>16&255,x[f+2]=m>>8&255,x[f+3]=m&255}function C(x,f){var m=[];if(!f.length)return m;var _,y,h;"data"in x?(_=x.data,y=x.start,h=x.end):(_=x,y=0,h=_.byteLength);for(var c=y;c<h;){var l=L(_,c),a=k(_.subarray(c+4,c+8)),v=l>1?c+l:h;if(a===f[0])if(f.length===1)m.push({data:_,start:c+8,end:v});else{var p=C({data:_,start:c+8,end:v},f.slice(1));p.length&&B.apply(m,p)}c=v}return m}function R(x){var f=C(x,["moov"]),m=f[0],_=m?m.end:null,y=C(x,["sidx"]);if(!y||!y[0])return null;var h=[],c=y[0],l=c.data[0],a=l===0?8:16,v=L(c,a);a+=4;var p=0,g=0;l===0?a+=8:a+=16,a+=2;var S=c.end+g,U=O(c,a);a+=2;for(var j=0;j<U;j++){var G=a,N=L(c,G);G+=4;var I=N&2147483647,V=(N&2147483648)>>>31;if(V===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Q=L(c,G);G+=4,h.push({referenceSize:I,subsegmentDuration:Q,info:{duration:Q/v,start:S,end:S+I-1}}),S+=I,G+=4,a=G}return{earliestPresentationTime:p,timescale:v,version:l,referencesCount:U,references:h,moovEndOffset:_}}function A(x){for(var f=[],m=C(x,["moov","trak"]),_=0;_<m.length;_++){var y=m[_],h=C(y,["tkhd"])[0];if(h){var c=h.data[h.start],l=c===0?12:20,a=L(h,l),v=C(y,["mdia","mdhd"])[0];if(v){c=v.data[v.start],l=c===0?12:20;var p=L(v,l),g=C(y,["mdia","hdlr"])[0];if(g){var S=k(g.data.subarray(g.start+8,g.start+12)),U={soun:M.ElementaryStreamTypes.AUDIO,vide:M.ElementaryStreamTypes.VIDEO}[S];if(U){var j=C(y,["mdia","minf","stbl","stsd"])[0],G=void 0;j&&(G=k(j.data.subarray(j.start+12,j.start+16))),f[a]={timescale:p,type:U},f[U]={timescale:p,id:a,codec:G}}}}}}var N=C(x,["moov","mvex","trex"]);return N.forEach(function(I){var V=L(I,4),Q=f[V];Q&&(Q.default={duration:L(I,12),flags:L(I,20)})}),f}function w(x,f){return C(f,["moof","traf"]).reduce(function(m,_){var y=C(_,["tfdt"])[0],h=y.data[y.start],c=C(_,["tfhd"]).reduce(function(l,a){var v=L(a,4),p=x[v];if(p){var g=L(y,4);h===1&&(g*=Math.pow(2,32),g+=L(y,8));var S=p.timescale||9e4,U=g/S;if(isFinite(U)&&(l===null||U<l))return U}return l},null);return c!==null&&isFinite(c)&&(m===null||c<m)?c:m},null)||0}function b(x,f){for(var m=0,_=0,y=0,h=C(x,["moof","traf"]),c=0;c<h.length;c++){var l=h[c],a=C(l,["tfhd"])[0],v=L(a,4),p=f[v];if(!p)continue;var g=p.default,S=L(a,0)|(g==null?void 0:g.flags),U=g==null?void 0:g.duration;S&8&&(S&2?U=L(a,12):U=L(a,8));for(var j=p.timescale||9e4,G=C(l,["trun"]),N=0;N<G.length;N++){if(U){var I=L(G[N],4);m=U*I}else m=d(G[N]);p.type===M.ElementaryStreamTypes.VIDEO?_+=m/j:p.type===M.ElementaryStreamTypes.AUDIO&&(y+=m/j)}}if(_===0&&y===0){var V=R(x);if(V!=null&&V.references)return V.references.reduce(function(Q,ne){return Q+ne.info.duration||0},0)}return _||y}function d(x){var f=L(x,0),m=8;f&1&&(m+=4),f&4&&(m+=4);for(var _=0,y=L(x,4),h=0;h<y;h++){if(f&256){var c=L(x,m);_+=c,m+=4}f&512&&(m+=4),f&1024&&(m+=4),f&2048&&(m+=4)}return _}function o(x,f,m){C(f,["moof","traf"]).forEach(function(_){C(_,["tfhd"]).forEach(function(y){var h=L(y,4),c=x[h];if(!c)return;var l=c.timescale||9e4;C(_,["tfdt"]).forEach(function(a){var v=a.data[a.start],p=L(a,4);if(v===0)E(a,4,p-m*l);else{p*=Math.pow(2,32),p+=L(a,8),p-=m*l,p=Math.max(p,0);var g=Math.floor(p/(P+1)),S=Math.floor(p%(P+1));E(a,4,g),E(a,8,S)}})})})}function s(x){var f={valid:null,remainder:null},m=C(x,["moof"]);if(m){if(m.length<2)return f.remainder=x,f}else return f;var _=m[m.length-1];return f.valid=Object(H.sliceUint8)(x,0,_.start-8),f.remainder=Object(H.sliceUint8)(x,_.start-8),f}function u(x,f){var m=new Uint8Array(x.length+f.length);return m.set(x),m.set(f,x.length),m}},"./src/utils/output-filter.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"default",function(){return H});var H=function(){function M(B,k){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=B,this.trackName=k}var P=M.prototype;return P.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},P.newCue=function(k,O,L){(this.startTime===null||this.startTime>k)&&(this.startTime=k),this.endTime=O,this.screen=L,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},M}()},"./src/utils/texttrack-utils.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"sendAddTrackEvent",function(){return M}),D.d(K,"addCueToTrack",function(){return P}),D.d(K,"clearCurrentCues",function(){return B}),D.d(K,"removeCuesInRange",function(){return k}),D.d(K,"getCuesInRange",function(){return L});var H=D("./src/utils/logger.ts");function M(E,C){var R;try{R=new Event("addtrack")}catch(A){R=document.createEvent("Event"),R.initEvent("addtrack",!1,!1)}R.track=E,C.dispatchEvent(R)}function P(E,C){var R=E.mode;if(R==="disabled"&&(E.mode="hidden"),E.cues&&!E.cues.getCueById(C.id))try{if(E.addCue(C),!E.cues.getCueById(C.id))throw new Error("addCue is failed for: "+C)}catch(w){H.logger.debug("[texttrack-utils]: "+w);var A=new self.TextTrackCue(C.startTime,C.endTime,C.text);A.id=C.id,E.addCue(A)}R==="disabled"&&(E.mode=R)}function B(E){var C=E.mode;if(C==="disabled"&&(E.mode="hidden"),E.cues)for(var R=E.cues.length;R--;)E.removeCue(E.cues[R]);C==="disabled"&&(E.mode=C)}function k(E,C,R){var A=E.mode;if(A==="disabled"&&(E.mode="hidden"),E.cues&&E.cues.length>0)for(var w=L(E.cues,C,R),b=0;b<w.length;b++)E.removeCue(w[b]);A==="disabled"&&(E.mode=A)}function O(E,C){if(C<E[0].startTime)return 0;var R=E.length-1;if(C>E[R].endTime)return-1;for(var A=0,w=R;A<=w;){var b=Math.floor((w+A)/2);if(C<E[b].startTime)w=b-1;else if(C>E[b].startTime&&A<R)A=b+1;else return b}return E[A].startTime-C<C-E[w].startTime?A:w}function L(E,C,R){var A=[],w=O(E,C);if(w>-1)for(var b=w,d=E.length;b<d;b++){var o=E[b];if(o.startTime>=C&&o.endTime<=R)A.push(o);else if(o.startTime>R)return A}return A}},"./src/utils/time-ranges.ts":function(te,K,D){"use strict";D.r(K);var H={toString:function(P){for(var B="",k=P.length,O=0;O<k;O++)B+="["+P.start(O).toFixed(3)+","+P.end(O).toFixed(3)+"]";return B}};K.default=H},"./src/utils/timescale-conversion.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"toTimescaleFromBase",function(){return M}),D.d(K,"toTimescaleFromScale",function(){return P}),D.d(K,"toMsFromMpegTsClock",function(){return B}),D.d(K,"toMpegTsClockFromTimescale",function(){return k});var H=9e4;function M(O,L,E,C){E===void 0&&(E=1),C===void 0&&(C=!1);var R=O*L*E;return C?Math.round(R):R}function P(O,L,E,C){return E===void 0&&(E=1),C===void 0&&(C=!1),M(O,L,1/E,C)}function B(O,L){return L===void 0&&(L=!1),M(O,1e3,1/H,L)}function k(O,L){return L===void 0&&(L=1),M(O,H,1/L)}},"./src/utils/typed-array.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"sliceUint8",function(){return H});function H(M,P,B){return Uint8Array.prototype.slice?M.slice(P,B):new Uint8Array(Array.prototype.slice.call(M,P,B))}},"./src/utils/vttcue.ts":function(te,K,D){"use strict";D.r(K),K.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var H=["","lr","rl"],M=["start","middle","end","left","right"];function P(E,C){if(typeof C!="string")return!1;if(!Array.isArray(E))return!1;var R=C.toLowerCase();return~E.indexOf(R)?R:!1}function B(E){return P(H,E)}function k(E){return P(M,E)}function O(E){for(var C=arguments.length,R=new Array(C>1?C-1:0),A=1;A<C;A++)R[A-1]=arguments[A];for(var w=1;w<arguments.length;w++){var b=arguments[w];for(var d in b)E[d]=b[d]}return E}function L(E,C,R){var A=this,w={enumerable:!0};A.hasBeenReset=!1;var b="",d=!1,o=E,s=C,u=R,x=null,f="",m=!0,_="auto",y="start",h=50,c="middle",l=50,a="middle";Object.defineProperty(A,"id",O({},w,{get:function(){return b},set:function(p){b=""+p}})),Object.defineProperty(A,"pauseOnExit",O({},w,{get:function(){return d},set:function(p){d=!!p}})),Object.defineProperty(A,"startTime",O({},w,{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(A,"endTime",O({},w,{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(A,"text",O({},w,{get:function(){return u},set:function(p){u=""+p,this.hasBeenReset=!0}})),Object.defineProperty(A,"region",O({},w,{get:function(){return x},set:function(p){x=p,this.hasBeenReset=!0}})),Object.defineProperty(A,"vertical",O({},w,{get:function(){return f},set:function(p){var g=B(p);if(g===!1)throw new SyntaxError("An invalid or illegal string was specified.");f=g,this.hasBeenReset=!0}})),Object.defineProperty(A,"snapToLines",O({},w,{get:function(){return m},set:function(p){m=!!p,this.hasBeenReset=!0}})),Object.defineProperty(A,"line",O({},w,{get:function(){return _},set:function(p){if(typeof p!="number"&&p!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");_=p,this.hasBeenReset=!0}})),Object.defineProperty(A,"lineAlign",O({},w,{get:function(){return y},set:function(p){var g=k(p);if(!g)throw new SyntaxError("An invalid or illegal string was specified.");y=g,this.hasBeenReset=!0}})),Object.defineProperty(A,"position",O({},w,{get:function(){return h},set:function(p){if(p<0||p>100)throw new Error("Position must be between 0 and 100.");h=p,this.hasBeenReset=!0}})),Object.defineProperty(A,"positionAlign",O({},w,{get:function(){return c},set:function(p){var g=k(p);if(!g)throw new SyntaxError("An invalid or illegal string was specified.");c=g,this.hasBeenReset=!0}})),Object.defineProperty(A,"size",O({},w,{get:function(){return l},set:function(p){if(p<0||p>100)throw new Error("Size must be between 0 and 100.");l=p,this.hasBeenReset=!0}})),Object.defineProperty(A,"align",O({},w,{get:function(){return a},set:function(p){var g=k(p);if(!g)throw new SyntaxError("An invalid or illegal string was specified.");a=g,this.hasBeenReset=!0}})),A.displayState=void 0}return L.prototype.getCueAsHTML=function(){var E=self.WebVTT;return E.convertCueToDOMTree(self,this.text)},L}()},"./src/utils/vttparser.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"parseTimeStamp",function(){return P}),D.d(K,"fixLineBreaks",function(){return C}),D.d(K,"VTTParser",function(){return R});var H=D("./src/utils/vttcue.ts"),M=function(){function A(){}var w=A.prototype;return w.decode=function(d,o){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},A}();function P(A){function w(d,o,s,u){return(d|0)*3600+(o|0)*60+(s|0)+parseFloat(u||0)}var b=A.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return b?parseFloat(b[2])>59?w(b[2],b[3],0,b[4]):w(b[1],b[2],b[3],b[4]):null}var B=function(){function A(){this.values=Object.create(null)}var w=A.prototype;return w.set=function(d,o){!this.get(d)&&o!==""&&(this.values[d]=o)},w.get=function(d,o,s){return s?this.has(d)?this.values[d]:o[s]:this.has(d)?this.values[d]:o},w.has=function(d){return d in this.values},w.alt=function(d,o,s){for(var u=0;u<s.length;++u)if(o===s[u]){this.set(d,o);break}},w.integer=function(d,o){/^-?\d+$/.test(o)&&this.set(d,parseInt(o,10))},w.percent=function(d,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var s=parseFloat(o);if(s>=0&&s<=100)return this.set(d,s),!0}return!1},A}();function k(A,w,b,d){var o=d?A.split(d):[A];for(var s in o){if(typeof o[s]!="string")continue;var u=o[s].split(b);if(u.length!==2)continue;var x=u[0],f=u[1];w(x,f)}}var O=new H.default(0,0,""),L=O.align==="middle"?"middle":"center";function E(A,w,b){var d=A;function o(){var x=P(A);if(x===null)throw new Error("Malformed timestamp: "+d);return A=A.replace(/^[^\sa-zA-Z-]+/,""),x}function s(x,f){var m=new B;k(x,function(h,c){var l;switch(h){case"region":for(var a=b.length-1;a>=0;a--)if(b[a].id===c){m.set(h,b[a].region);break}break;case"vertical":m.alt(h,c,["rl","lr"]);break;case"line":l=c.split(","),m.integer(h,l[0]),m.percent(h,l[0])&&m.set("snapToLines",!1),m.alt(h,l[0],["auto"]),l.length===2&&m.alt("lineAlign",l[1],["start",L,"end"]);break;case"position":l=c.split(","),m.percent(h,l[0]),l.length===2&&m.alt("positionAlign",l[1],["start",L,"end","line-left","line-right","auto"]);break;case"size":m.percent(h,c);break;case"align":m.alt(h,c,["start",L,"end","left","right"]);break}},/:/,/\s/),f.region=m.get("region",null),f.vertical=m.get("vertical","");var _=m.get("line","auto");_==="auto"&&O.line===-1&&(_=-1),f.line=_,f.lineAlign=m.get("lineAlign","start"),f.snapToLines=m.get("snapToLines",!0),f.size=m.get("size",100),f.align=m.get("align",L);var y=m.get("position","auto");y==="auto"&&O.position===50&&(y=f.align==="start"||f.align==="left"?0:f.align==="end"||f.align==="right"?100:50),f.position=y}function u(){A=A.replace(/^\s+/,"")}if(u(),w.startTime=o(),u(),A.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);A=A.substr(3),u(),w.endTime=o(),u(),s(A,w)}function C(A){return A.replace(/<br(?: \/)?>/gi,`
|
|
`)}var R=function(){function A(){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 w=A.prototype;return w.parse=function(d){var o=this;d&&(o.buffer+=o.decoder.decode(d,{stream:!0}));function s(){var y=o.buffer,h=0;for(y=C(y);h<y.length&&y[h]!=="\r"&&y[h]!==`
|
|
`;)++h;var c=y.substr(0,h);return y[h]==="\r"&&++h,y[h]===`
|
|
`&&++h,o.buffer=y.substr(h),c}function u(y){k(y,function(h,c){},/:/)}try{var x="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;x=s();var f=x.match(/^()?WEBVTT([ \t].*)?$/);if(!f||!f[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var m=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;m?m=!1:x=s();switch(o.state){case"HEADER":/:/.test(x)?u(x):x||(o.state="ID");continue;case"NOTE":x||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(x)){o.state="NOTE";break}if(!x)continue;if(o.cue=new H.default(0,0,""),o.state="CUE",x.indexOf("-->")===-1){o.cue.id=x;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{E(x,o.cue,o.regionList)}catch(y){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var _=x.indexOf("-->")!==-1;if(!x||_&&(m=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
|
|
`),o.cue.text+=x}continue;case"BADCUE":x||(o.state="ID")}}}catch(y){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},w.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=`
|
|
|
|
`,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){d.onparsingerror&&d.onparsingerror(o)}return d.onflush&&d.onflush(),this},A}()},"./src/utils/webvtt-parser.ts":function(te,K,D){"use strict";D.r(K),D.d(K,"generateCueId",function(){return R}),D.d(K,"parseWebVTT",function(){return w});var H=D("./src/polyfills/number.ts"),M=D("./src/utils/vttparser.ts"),P=D("./src/demux/id3.ts"),B=D("./src/utils/timescale-conversion.ts"),k=D("./src/remux/mp4-remuxer.ts"),O=/\r\n|\n\r|\n|\r/g,L=function(d,o,s){return s===void 0&&(s=0),d.substr(s,o.length)===o},E=function(d){var o=parseInt(d.substr(-3)),s=parseInt(d.substr(-6,2)),u=parseInt(d.substr(-9,2)),x=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(H.isFiniteNumber)(o)||!Object(H.isFiniteNumber)(s)||!Object(H.isFiniteNumber)(u)||!Object(H.isFiniteNumber)(x))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*s,o+=60*1e3*u,o+=60*60*1e3*x,o},C=function(d){for(var o=5381,s=d.length;s;)o=o*33^d.charCodeAt(--s);return(o>>>0).toString()};function R(b,d,o){return C(b.toString())+C(d.toString())+C(o)}var A=function(d,o,s){var u=d[o],x=d[u.prevCC];if(!x||!x.new&&u.new){d.ccOffset=d.presentationOffset=u.start,u.new=!1;return}for(;(f=x)!==null&&f!==void 0&&f.new;){var f;d.ccOffset+=u.start-x.start,u.new=!1,u=x,x=d[u.prevCC]}d.presentationOffset=s};function w(b,d,o,s,u,x,f,m){var _=new M.VTTParser,y=Object(P.utf8ArrayToStr)(new Uint8Array(b)).trim().replace(O,`
|
|
`).split(`
|
|
`),h=[],c=Object(B.toMpegTsClockFromTimescale)(d,o),l="00:00.000",a=0,v=0,p,g=!0,S=!1;_.oncue=function(U){var j=s[u],G=s.ccOffset,N=(a-c)/9e4;if(j!=null&&j.new&&(v!==void 0?G=s.ccOffset=j.start:A(s,u,N)),N&&(G=N-s.presentationOffset),S){var I=U.endTime-U.startTime,V=Object(k.normalizePts)((U.startTime+G-v)*9e4,x*9e4)/9e4;U.startTime=V,U.endTime=V+I}var Q=U.text.trim();U.text=decodeURIComponent(encodeURIComponent(Q)),U.id||(U.id=R(U.startTime,U.endTime,Q)),U.endTime>0&&h.push(U)},_.onparsingerror=function(U){p=U},_.onflush=function(){if(p){m(p);return}f(h)},y.forEach(function(U){if(g)if(L(U,"X-TIMESTAMP-MAP=")){g=!1,S=!0,U.substr(16).split(",").forEach(function(j){L(j,"LOCAL:")?l=j.substr(6):L(j,"MPEGTS:")&&(a=parseInt(j.substr(7)))});try{v=E(l)/1e3}catch(j){S=!1,p=j}return}else U===""&&(g=!1);_.parse(U+`
|
|
`)}),_.flush()}},"./src/utils/xhr-loader.ts":function(te,K,D){"use strict";D.r(K);var H=D("./src/utils/logger.ts"),M=D("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,B=function(){function k(L){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=L?L.xhrSetup:null,this.stats=new M.LoadStats,this.retryDelay=0}var O=k.prototype;return O.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},O.abortInternal=function(){var E=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),E&&(E.onreadystatechange=null,E.onprogress=null,E.readyState!==4&&(this.stats.aborted=!0,E.abort()))},O.abort=function(){var E;this.abortInternal(),(E=this.callbacks)!==null&&E!==void 0&&E.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},O.load=function(E,C,R){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=E,this.config=C,this.callbacks=R,this.retryDelay=C.retryDelay,this.loadInternal()},O.loadInternal=function(){var E=this.config,C=this.context;if(!E)return;var R=this.loader=new self.XMLHttpRequest,A=this.stats;A.loading.first=0,A.loaded=0;var w=this.xhrSetup;try{if(w)try{w(R,C.url)}catch(o){R.open("GET",C.url,!0),w(R,C.url)}R.readyState||R.open("GET",C.url,!0);var b=this.context.headers;if(b)for(var d in b)R.setRequestHeader(d,b[d])}catch(o){this.callbacks.onError({code:R.status,text:o.message},C,R);return}C.rangeEnd&&R.setRequestHeader("Range","bytes="+C.rangeStart+"-"+(C.rangeEnd-1)),R.onreadystatechange=this.readystatechange.bind(this),R.onprogress=this.loadprogress.bind(this),R.responseType=C.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),E.timeout),R.send()},O.readystatechange=function(){var E=this.context,C=this.loader,R=this.stats;if(!E||!C)return;var A=C.readyState,w=this.config;if(R.aborted)return;if(A>=2)if(self.clearTimeout(this.requestTimeout),R.loading.first===0&&(R.loading.first=Math.max(self.performance.now(),R.loading.start)),A===4){C.onreadystatechange=null,C.onprogress=null;var b=C.status;if(b>=200&&b<300){R.loading.end=Math.max(self.performance.now(),R.loading.first);var d,o;if(E.responseType==="arraybuffer"?(d=C.response,o=d.byteLength):(d=C.responseText,o=d.length),R.loaded=R.total=o,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(R,E,d,C),!this.callbacks)return;var u={url:C.responseURL,data:d};this.callbacks.onSuccess(u,R,E,C)}else R.retry>=w.maxRetry||b>=400&&b<499?(H.logger.error(b+" while loading "+E.url),this.callbacks.onError({code:b,text:C.statusText},E,C)):(H.logger.warn(b+" while loading "+E.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,w.maxRetryDelay),R.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),w.timeout)},O.loadtimeout=function(){H.logger.warn("timeout while loading "+this.context.url);var E=this.callbacks;E&&(this.abortInternal(),E.onTimeout(this.stats,this.context,this.loader))},O.loadprogress=function(E){var C=this.stats;C.loaded=E.loaded,E.lengthComputable&&(C.total=E.total)},O.getCacheAge=function(){var E=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var C=this.loader.getResponseHeader("age");E=C?parseFloat(C):null}return E},k}();K.default=B}}).default})},vHTk:function(gt,nt,Z){gt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|