You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
138 lines
736 KiB
138 lines
736 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[169,6,7],{"+NIl":function(ut,et,oe){(function(te){te(oe("VrN/"))})(function(te){"use strict";te.defineMode("stex",function(G,L){"use strict";function z(C,w){C.cmdState.push(w)}function I(C){return C.cmdState.length>0?C.cmdState[C.cmdState.length-1]:null}function _(C){var w=C.cmdState.pop();w&&w.closeBracket()}function B(C){for(var w=C.cmdState,v=w.length-1;v>=0;v--){var u=w[v];if(u.name=="DEFAULT")continue;return u}return{styleIdentifier:function(){return null}}}function F(C,w,v){return function(){this.name=C,this.bracketNo=0,this.style=w,this.styles=v,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var M={};M.importmodule=F("importmodule","tag",["string","builtin"]),M.documentclass=F("documentclass","tag",["","atom"]),M.usepackage=F("usepackage","tag",["atom"]),M.begin=F("begin","tag",["atom"]),M.end=F("end","tag",["atom"]),M.label=F("label","tag",["atom"]),M.ref=F("ref","tag",["atom"]),M.eqref=F("eqref","tag",["atom"]),M.cite=F("cite","tag",["atom"]),M.bibitem=F("bibitem","tag",["atom"]),M.Bibitem=F("Bibitem","tag",["atom"]),M.RBibitem=F("RBibitem","tag",["atom"]),M.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function D(C,w){C.f=w}function g(C,w){var v;if(C.match(/^\\[a-zA-Z@]+/)){var u=C.current().slice(1);return v=M.hasOwnProperty(u)?M[u]:M.DEFAULT,v=new v,z(w,v),D(w,R),v.style}if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/\\]/))return"tag";if(C.match("\\["))return D(w,function(s,l){return T(s,l,"\\]")}),"keyword";if(C.match("\\("))return D(w,function(s,l){return T(s,l,"\\)")}),"keyword";if(C.match("$$"))return D(w,function(s,l){return T(s,l,"$$")}),"keyword";if(C.match("$"))return D(w,function(s,l){return T(s,l,"$")}),"keyword";var o=C.next();if(o=="%")return C.skipToEnd(),"comment";if(o=="}"||o=="]"){if(v=I(w),v)v.closeBracket(o),D(w,R);else return"error";return"bracket"}else return o=="{"||o=="["?(v=M.DEFAULT,v=new v,z(w,v),"bracket"):/\d/.test(o)?(C.eatWhile(/[\w.%]/),"atom"):(C.eatWhile(/[\w\-_]/),v=B(w),v.name=="begin"&&(v.argument=C.current()),v.styleIdentifier())}function T(C,w,v){if(C.eatSpace())return null;if(v&&C.match(v))return D(w,g),"keyword";if(C.match(/^\\[a-zA-Z@]+/))return"tag";if(C.match(/^[a-zA-Z]+/))return"variable-2";if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/]/))return"tag";if(C.match(/^[\^_&]/))return"tag";if(C.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(C.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var u=C.next();return u=="{"||u=="}"||u=="["||u=="]"||u=="("||u==")"?"bracket":u=="%"?(C.skipToEnd(),"comment"):"error"}function R(C,w){var v=C.peek(),u;return v=="{"||v=="["?(u=I(w),u.openBracket(v),C.eat(v),D(w,g),"bracket"):/[ \t\r]/.test(v)?(C.eat(v),null):(D(w,g),_(w),g(C,w))}return{startState:function(){var C=L.inMathMode?function(w,v){return T(w,v)}:g;return{cmdState:[],f:C}},copyState:function(C){return{cmdState:C.cmdState.slice(),f:C.f}},token:function(C,w){return w.f(C,w)},blankLine:function(C){C.f=g,C.cmdState.length=0},lineComment:"%"}}),te.defineMIME("text/x-stex","stex"),te.defineMIME("text/x-latex","stex")})},"19Vz":function(ut,et,oe){(function(te){te(oe("VrN/"))})(function(te){te.defineOption("placeholder","",function(F,M,D){var g=D&&D!=te.Init;if(M&&!g)F.on("blur",I),F.on("change",_),F.on("swapDoc",_),te.on(F.getInputField(),"compositionupdate",F.state.placeholderCompose=function(){z(F)}),_(F);else if(!M&&g){F.off("blur",I),F.off("change",_),F.off("swapDoc",_),te.off(F.getInputField(),"compositionupdate",F.state.placeholderCompose),G(F);var T=F.getWrapperElement();T.className=T.className.replace(" CodeMirror-empty","")}M&&!F.hasFocus()&&I(F)});function G(F){F.state.placeholder&&(F.state.placeholder.parentNode.removeChild(F.state.placeholder),F.state.placeholder=null)}function L(F){G(F);var M=F.state.placeholder=document.createElement("pre");M.style.cssText="height: 0; overflow: visible",M.style.direction=F.getOption("direction"),M.className="CodeMirror-placeholder CodeMirror-line-like";var D=F.getOption("placeholder");typeof D=="string"&&(D=document.createTextNode(D)),M.appendChild(D),F.display.lineSpace.insertBefore(M,F.display.lineSpace.firstChild)}function z(F){setTimeout(function(){var M=!1,D=F.getInputField();D.nodeName=="TEXTAREA"?M=!D.value:F.lineCount()==1&&(M=!/[^\u200b]/.test(D.querySelector(".CodeMirror-line").textContent)),M?L(F):G(F)},20)}function I(F){B(F)&&L(F)}function _(F){var M=F.getWrapperElement(),D=B(F);M.className=M.className.replace(" CodeMirror-empty","")+(D?" CodeMirror-empty":""),D?L(F):G(F)}function B(F){return F.lineCount()===1&&F.getLine(0)===""}})},"1eCo":function(ut,et,oe){(function(te){te(oe("VrN/"))})(function(te){"use strict";var G={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},L={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};te.defineMode("xml",function(z,I){var _=z.indentUnit,B={},F=I.htmlMode?G:L;for(var M in F)B[M]=F[M];for(var M in I)B[M]=I[M];var D,g;function T(a,y){function m(U){return y.tokenize=U,U(a,y)}var x=a.next();if(x=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?m(w("atom","]]>")):null:a.match("--")?m(w("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),m(v(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),y.tokenize=w("meta","?>"),"meta"):(D=a.eat("/")?"closeTag":"openTag",y.tokenize=R,"tag bracket");if(x=="&"){var P;return a.eat("#")?a.eat("x")?P=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):P=a.eatWhile(/[\d]/)&&a.eat(";"):P=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),P?"atom":"error"}else return a.eatWhile(/[^&<]/),null}T.isInText=!0;function R(a,y){var m=a.next();if(m==">"||m=="/"&&a.eat(">"))return y.tokenize=T,D=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return D="equals",null;if(m=="<"){y.tokenize=T,y.state=l,y.tagName=y.tagStart=null;var x=y.tokenize(a,y);return x?x+" tag error":"tag error"}else return/[\'\"]/.test(m)?(y.tokenize=C(m),y.stringStartCol=a.column(),y.tokenize(a,y)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function C(a){var y=function(m,x){for(;!m.eol();)if(m.next()==a){x.tokenize=R;break}return"string"};return y.isInAttribute=!0,y}function w(a,y){return function(m,x){for(;!m.eol();){if(m.match(y)){x.tokenize=T;break}m.next()}return a}}function v(a){return function(y,m){for(var x;(x=y.next())!=null;){if(x=="<")return m.tokenize=v(a+1),m.tokenize(y,m);if(x==">")if(a==1){m.tokenize=T;break}else return m.tokenize=v(a-1),m.tokenize(y,m)}return"meta"}}function u(a,y,m){this.prev=a.context,this.tagName=y,this.indent=a.indented,this.startOfLine=m,(B.doNotIndent.hasOwnProperty(y)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function s(a,y){for(var m;;){if(!a.context)return;if(m=a.context.tagName,!B.contextGrabbers.hasOwnProperty(m)||!B.contextGrabbers[m].hasOwnProperty(y))return;o(a)}}function l(a,y,m){return a=="openTag"?(m.tagStart=y.column(),S):a=="closeTag"?p:l}function S(a,y,m){return a=="word"?(m.tagName=y.current(),g="tag",b):B.allowMissingTagName&&a=="endTag"?(g="tag bracket",b(a,y,m)):(g="error",S)}function p(a,y,m){if(a=="word"){var x=y.current();return m.context&&m.context.tagName!=x&&B.implicitlyClosed.hasOwnProperty(m.context.tagName)&&o(m),m.context&&m.context.tagName==x||B.matchClosing===!1?(g="tag",h):(g="tag error",A)}else return B.allowMissingTagName&&a=="endTag"?(g="tag bracket",h(a,y,m)):(g="error",A)}function h(a,y,m){return a!="endTag"?(g="error",h):(o(m),l)}function A(a,y,m){return g="error",h(a,y,m)}function b(a,y,m){if(a=="word")return g="attribute",c;if(a=="endTag"||a=="selfcloseTag"){var x=m.tagName,P=m.tagStart;return m.tagName=m.tagStart=null,a=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(x)?s(m,x):(s(m,x),m.context=new u(m,x,P==m.indented)),l}return g="error",b}function c(a,y,m){return a=="equals"?f:(B.allowMissing||(g="error"),b(a,y,m))}function f(a,y,m){return a=="string"?d:a=="word"&&B.allowUnquoted?(g="string",b):(g="error",b(a,y,m))}function d(a,y,m){return a=="string"?d:b(a,y,m)}return{startState:function(a){var y={tokenize:T,state:l,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(y.baseIndent=a),y},token:function(a,y){if(!y.tagName&&a.sol()&&(y.indented=a.indentation()),a.eatSpace())return null;D=null;var m=y.tokenize(a,y);return(m||D)&&m!="comment"&&(g=null,y.state=y.state(D||m,a,y),g&&(m=g=="error"?m+" error":g)),m},indent:function(a,y,m){var x=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+_;if(x&&x.noIndent)return te.Pass;if(a.tokenize!=R&&a.tokenize!=T)return m?m.match(/^(\s*)/)[0].length:0;if(a.tagName)return B.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+_*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/<!\[CDATA\[/.test(y))return 0;var P=y&&/^<(\/)?([\w_:\.-]*)/.exec(y);if(P&&P[1])for(;x;)if(x.tagName==P[2]){x=x.prev;break}else if(B.implicitlyClosed.hasOwnProperty(x.tagName))x=x.prev;else break;else if(P)for(;x;){var U=B.contextGrabbers[x.tagName];if(U&&U.hasOwnProperty(P[2]))x=x.prev;else break}for(;x&&x.prev&&!x.startOfLine;)x=x.prev;return x?x.indent+_:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:B.htmlMode?"html":"xml",helperType:B.htmlMode?"html":"xml",skipAttribute:function(a){a.state==f&&(a.state=b)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var y=[],m=a.context;m;m=m.prev)m.tagName&&y.push(m.tagName);return y.reverse()}}}),te.defineMIME("text/xml","xml"),te.defineMIME("application/xml","xml"),te.mimeModes.hasOwnProperty("text/html")||te.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"7Cbv":function(ut,et,oe){"use strict";var te=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),G=new Uint8Array(16);function L(){if(!te)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return te(G)}var z=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function I(R){return typeof R=="string"&&z.test(R)}for(var _=I,B=[],F=0;F<256;++F)B.push((F+256).toString(16).substr(1));function M(R){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,w=(B[R[C+0]]+B[R[C+1]]+B[R[C+2]]+B[R[C+3]]+"-"+B[R[C+4]]+B[R[C+5]]+"-"+B[R[C+6]]+B[R[C+7]]+"-"+B[R[C+8]]+B[R[C+9]]+"-"+B[R[C+10]]+B[R[C+11]]+B[R[C+12]]+B[R[C+13]]+B[R[C+14]]+B[R[C+15]]).toLowerCase();if(!_(w))throw TypeError("Stringified UUID is invalid");return w}var D=M;function g(R,C,w){R=R||{};var v=R.random||(R.rng||L)();if(v[6]=v[6]&15|64,v[8]=v[8]&63|128,C){w=w||0;for(var u=0;u<16;++u)C[w+u]=v[u];return C}return D(v)}var T=et.a=g},"7ahc":function(ut,et,oe){"use strict";oe.d(et,"a",function(){return S});var te=oe("k1fw"),G=oe("0Owb"),L=oe("+L6B"),z=oe("2/Rp"),I=oe("y8nQ"),_=oe("Vl3Y"),B=oe("tJVT"),F=oe("OaEy"),M=oe("2fM7"),D=oe("cDcd"),g=oe.n(D),T=oe("VrN/"),R=oe.n(T),C=oe("p77/"),w=oe.n(C),v=oe("c5Ni"),u=oe.n(v),o=M.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},l={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};et.b=function(p){var h=p.callback,A=p.onCancel,b=Object(D.useState)("python"),c=Object(B.a)(b,2),f=c[0],d=c[1];function a(m){d(l[m][1])}function y(m){h(m)}return g.a.createElement(_.a,Object(G.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:y}),g.a.createElement(_.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},g.a.createElement(M.a,{onChange:a},Object.keys(l).map(function(m){return g.a.createElement(o,{key:m,value:m},l[m][0])}))),g.a.createElement(_.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},g.a.createElement(S,{mode:f})),g.a.createElement("div",{className:"flex-container flex-end"},g.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),g.a.createElement(z.a,{type:"ghost",onClick:A},"\u53D6\u6D88")))};function S(p){var h=p.value,A=p.onChange,b=p.mode,c=p.options,f=c===void 0?{}:c,d=Object(D.useRef)(),a=Object(D.useState)(),y=Object(B.a)(a,2),m=y[0],x=y[1];return Object(D.useEffect)(function(){if(m){function P(U){var j=U.getValue();A&&A(j)}return m.on("change",P),function(){m.off("change",P)}}},[m,A]),Object(D.useEffect)(function(){m&&m.setOption("mode",b)},[m,b]),Object(D.useEffect)(function(){m&&((h!==m.getValue()||h==="")&&setTimeout(function(){m.setValue(h||" ")},300))},[m,h]),Object(D.useEffect)(function(){if(d.current&&!m){var P=R.a.fromTextArea(d.current,Object(te.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},f));x(P)}},[d.current,m]),g.a.createElement("div",{className:"my-codemirror-container"},g.a.createElement("textarea",{ref:d}))}},"7ixt":function(ut,et,oe){"use strict";oe.d(et,"a",function(){return L});var te={adjustX:1,adjustY:1},G=[0,0],L={left:{points:["cr","cl"],overflow:te,offset:[-4,0],targetOffset:G},right:{points:["cl","cr"],overflow:te,offset:[4,0],targetOffset:G},top:{points:["bc","tc"],overflow:te,offset:[0,-4],targetOffset:G},bottom:{points:["tc","bc"],overflow:te,offset:[0,4],targetOffset:G},topLeft:{points:["bl","tl"],overflow:te,offset:[0,-4],targetOffset:G},leftTop:{points:["tr","tl"],overflow:te,offset:[-4,0],targetOffset:G},topRight:{points:["br","tr"],overflow:te,offset:[0,-4],targetOffset:G},rightTop:{points:["tl","tr"],overflow:te,offset:[4,0],targetOffset:G},bottomRight:{points:["tr","br"],overflow:te,offset:[0,4],targetOffset:G},rightBottom:{points:["bl","br"],overflow:te,offset:[4,0],targetOffset:G},bottomLeft:{points:["tl","bl"],overflow:te,offset:[0,4],targetOffset:G},leftBottom:{points:["br","bl"],overflow:te,offset:[-4,0],targetOffset:G}},z=L},"8EBN":function(ut,et,oe){(function(te){te(oe("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 G=0;G<te.modeInfo.length;G++){var L=te.modeInfo[G];L.mimes&&(L.mime=L.mimes[0])}te.findModeByMIME=function(z){z=z.toLowerCase();for(var I=0;I<te.modeInfo.length;I++){var _=te.modeInfo[I];if(_.mime==z)return _;if(_.mimes){for(var B=0;B<_.mimes.length;B++)if(_.mimes[B]==z)return _}}if(/\+xml$/.test(z))return te.findModeByMIME("application/xml");if(/\+json$/.test(z))return te.findModeByMIME("application/json")},te.findModeByExtension=function(z){z=z.toLowerCase();for(var I=0;I<te.modeInfo.length;I++){var _=te.modeInfo[I];if(_.ext){for(var B=0;B<_.ext.length;B++)if(_.ext[B]==z)return _}}},te.findModeByFileName=function(z){for(var I=0;I<te.modeInfo.length;I++){var _=te.modeInfo[I];if(_.file&&_.file.test(z))return _}var B=z.lastIndexOf("."),F=B>-1&&z.substring(B+1,z.length);if(F)return te.findModeByExtension(F)},te.findModeByName=function(z){z=z.toLowerCase();for(var I=0;I<te.modeInfo.length;I++){var _=te.modeInfo[I];if(_.name.toLowerCase()==z)return _;if(_.alias){for(var B=0;B<_.alias.length;B++)if(_.alias[B].toLowerCase()==z)return _}}}})},"8hTe":function(ut,et,oe){ut.exports={button:"button___1wy9m"}},"9Bee":function(ut,et,oe){"use strict";var te=oe("DYRE"),G=oe("zeV3"),L=oe("+L6B"),z=oe("2/Rp"),I=oe("k1fw"),_=oe("tJVT"),B=oe("cDcd"),F=oe.n(B),M=oe("vg9a"),D=oe("DlQD"),g=oe.n(D),T=oe("rUJ1");function R(ge,he){var ce=ge.match(/^(\s+)(?:```)/);if(ce===null)return he;var ae=ce[1];return he.split(`
|
|
`).map(function(me){var J=me.match(/^\s+/);if(J===null)return me;var ne=Object(_.a)(J,1),Z=ne[0];return Z.length>=ae.length?me.slice(ae.length):me}).join(`
|
|
`)}var C=[],w=["<ul>"],v=new g.a.Renderer,u=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function o(){C.length=0,w=["<ul>"]}var s={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function l(ge,he,ce,ae){if(he>=ge.length||ge[he].level<=ce)return he;var me=ge[he];ae.push("<li><a href='#"+me.anchor+"'>"+me.text+"</a>"),he++;var J=[];return he=l(ge,he,me.level,J),J.length>0&&(ae.push("<ul>"),J.forEach(function(ne){ae.push(ne)}),ae.push("</ul>")),ae.push("</li>"),he=l(ge,he,ce,ae),he}function S(){return l(C,0,0,w),w.push("</ul>"),w.join("")}var p={heading:function(he){var ce=u.exec(he);if(ce)return{type:"heading",raw:ce[0],depth:ce[1].length,text:ce[2]}},fences:function(he){var ce=this.rules.block.fences.exec(he);if(ce){var ae=ce[0],me=R(ae,ce[3]||""),J=ce[2]?ce[2].trim():ce[2];if(["latex","katex","math"].indexOf(J)>=0){var ne=b(),Z=me;me=ne,c[ne]={type:"block",expression:Z}}return{type:"code",raw:ae,lang:J,text:me}}}},h=/(?:\${2})([^\n`]+?)(?:\${2})/gi,A=0,b=function(){return"__special_katext_id_".concat(A++,"__")},c={};function f(){return c}function d(){A=0,c={}}function a(ge){return ge=ge.replace(h,function(he,ce){var ae=b();return c[ae]={type:"inline",expression:ce},ae}),ge}var y=v.listitem;v.listitem=function(ge){return y(a(ge))};var m=v.paragraph;v.paragraph=function(ge){return m(a(ge))};var x=v.tablecell;v.tablecell=function(ge,he){return x(a(ge),he)},v.code=function(ge,he,ce){var ae=(he||"").match(/\S*/)[0];return ae?["latex","katex","math"].indexOf(ae)>=0?"<p class='editormd-tex'>".concat(ge,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(he,'">').concat(ce?ge:Object(T.escape)(ge,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(ce?ge:Object(T.escape)(ge,!0))+"</code></pre>"},v.heading=function(ge,he,ce){var ae=this.options.headerPrefix+ce.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return C.push({anchor:ae,level:he,text:ge}),"<h"+he+' id="'+ae+'">'+ge+"</h"+he+">"},g.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),g.a.use({tokenizer:p,renderer:v});var P=g.a,U=oe("SJMd"),j=oe("ulZh"),W=oe.n(j),k=oe("m3rI"),O=oe("Oy/b"),K=oe("p5ED"),Y=oe("8hTe"),q=oe.n(Y),ie=/<pre[^>]*>/g;function Te(ge){var he=document.createElement("div");return he.innerHTML=ge,he.childNodes.length===0?"":he.childNodes[0].nodeValue}var ve=et.a=function(ge){var he=ge.value,ce=he===void 0?"":he,ae=ge.edit,me=ae===void 0?!1:ae,J=ge.className,ne=ge.showTextOnly,Z=ge.showLines,Ee=ge.replaces,Ae=ge.zoomImg,be=ge.hasMask,Se=ge.style,Re=Se===void 0?{}:Se,Ue=ge.stylesPrev,Ie=Ue===void 0?{}:Ue,ke=String(ce),Oe=Object(B.useRef)(),$e=Object(B.useRef)(),ze=Object(B.useState)(""),Ve=Object(_.a)(ze,2),Ge=Ve[0],rt=Ve[1],Je=Object(B.useState)("office"),Ye=Object(_.a)(Je,2),Ce=Ye[0],qe=Ye[1],Xe=Object(B.useMemo)(function(){try{var de=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,$=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Q=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;ke=ke.replace(de,"("+k.a.API_SERVER+"/api/attachments/").replace($,'"'+k.a.API_SERVER+"/api/attachments/").replace(Q,'"'+k.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`)}catch(we){}var ee=P(ke),se=f();if(ke.match(/\[TOC\]/)&&(ee=ee.replace("<p>[TOC]</p>",S()),o()),ee=ee.replace(/(__special_katext_id_\d+__)/g,function(we,_e){var je=se[_e],Ze=je.type,We=je.expression;return Object(O.renderToString)(Te(We)||"",{displayMode:Ze==="block",throwOnError:!1,output:"html"})}),ee=ee.replace(/▁/g,"\u2581\u2581\u2581"),d(),ne){var fe=document.createElement("div");return fe.innerHTML=ee,fe.innerText}return setTimeout(function(){return pe()},500),ee},[ke]),Le=Object(B.useRef)();s.WebkitLineClamp=Z,Z&&(Re=Object(I.a)(Object(I.a)({},Re),s));function Me(de){var $=de.target;if($.tagName.toUpperCase()==="IMG"){if(Ae){var Q=$.getAttribute("src");rt(Q),qe("image")}}else if($.tagName.toUpperCase()==="A"){var ee=$.getAttribute("href");if(ee.indexOf("office")>-1)de.preventDefault(),rt(ee),qe("office");else if(ee.indexOf("application/pdf")>-1)de.preventDefault(),rt(ee),qe("pdf");else if(ee.indexOf("text/html")>-1)de.preventDefault(),rt(ee),qe("html");else if(ee.startsWith("#")){de.preventDefault();var se=document.getElementById(ee.replace("#",""));se&&se.scrollIntoView(!0)}}}var pe=function(){var $,Q=($=Le.current)===null||$===void 0?void 0:$.querySelectorAll("video");Q==null||Q.forEach(function(ee){if(ee.oncontextmenu=function(){return!1},ee.src.indexOf(".m3u8")>-1&&!ee.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var se=new W.a;se.loadSource(ee.src),se.attachMedia(ee)}}})};Object(B.useEffect)(function(){if(Le.current&&Xe&&(Xe.match(ie)&&window.PR.prettyPrint()),Le.current)return Le.current.addEventListener("click",Me),function(){Le.current.removeEventListener("click",Me),d(),o()}},[Xe,Le.current,Me]);var ue=function($){if(!me)return;$.target.nodeName==="IMG"?(Oe.current.style.display="flex",Oe.current.style.width=$.target.clientWidth+"px",Oe.current.style.height=$.target.clientHeight+"px",Oe.current.style.top=$.target.offsetTop+"px",Oe.current.style.left=$.target.offsetLeft+"px",$e.current.src=$.target.getAttribute("src")):Oe.current.style.display="none"};return F.a.createElement("div",{style:{position:"relative"}},F.a.createElement("div",{ref:Le,style:Object(I.a)({},Re),className:"".concat(J||""," markdown-body ").concat(q.a.mdBody),onMouseOver:ue,dangerouslySetInnerHTML:{__html:Xe}}),F.a.createElement("div",{ref:Oe,className:q.a.button},F.a.createElement(G.a,null,F.a.createElement(z.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),F.a.createElement(z.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),F.a.createElement("img",{ref:$e,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),F.a.createElement(K.a,{close:!0,data:Ge,type:Ge!=null&&Ge.length?Ce:"",style:Object(I.a)({},Ie),onClose:function(){return rt("")}}))}},"9VGf":function(ut,et,oe){"use strict";oe.d(et,"a",function(){return L});var te=oe("cDcd"),G=oe.n(te);function L(z,I){var _=Object(te.useRef)();Object(te.useEffect)(function(){_.current=z}),Object(te.useEffect)(function(){function B(){_.current()}if(I!==null){var F=setInterval(B,I);return function(){return clearInterval(F)}}},[I])}},"9ivq":function(ut,et,oe){},Bd2K:function(ut,et,oe){(function(te){te(oe("VrN/"),oe("osHv"))})(function(te){te.defineOption("autoCloseTags",!1,function(M,D,g){if(g!=te.Init&&g&&M.removeKeyMap("autoCloseTags"),!D)return;var T={name:"autoCloseTags"};(typeof D!="object"||D.whenClosing!==!1)&&(T["'/'"]=function(R){return _(R)}),(typeof D!="object"||D.whenOpening!==!1)&&(T["'>'"]=function(R){return z(R)}),M.addKeyMap(T)});var G=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],L=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function z(M){if(M.getOption("disableInput"))return te.Pass;for(var D=M.listSelections(),g=[],T=M.getOption("autoCloseTags"),R=0;R<D.length;R++){if(!D[R].empty())return te.Pass;var C=D[R].head,w=M.getTokenAt(C),v=te.innerMode(M.getMode(),w.state),u=v.state,o=v.mode.xmlCurrentTag&&v.mode.xmlCurrentTag(u),s=o&&o.name;if(!s)return te.Pass;var l=v.mode.configuration=="html",S=typeof T=="object"&&T.dontCloseTags||l&&G,p=typeof T=="object"&&T.indentTags||l&&L;w.end>C.ch&&(s=s.slice(0,s.length-w.end+C.ch));var h=s.toLowerCase();if(!s||w.type=="string"&&(w.end!=C.ch||!/[\"\']/.test(w.string.charAt(w.string.length-1))||w.string.length==1)||w.type=="tag"&&o.close||w.string.indexOf("/")==C.ch-w.start-1||S&&B(S,h)>-1||F(M,v.mode.xmlCurrentContext&&v.mode.xmlCurrentContext(u)||[],s,C,!0))return te.Pass;var A=typeof T=="object"&&T.emptyTags;if(A&&B(A,s)>-1){g[R]={text:"/>",newPos:te.Pos(C.line,C.ch+2)};continue}var b=p&&B(p,h)>-1;g[R]={indent:b,text:">"+(b?`
|
|
|
|
`:"")+"</"+s+">",newPos:b?te.Pos(C.line+1,0):te.Pos(C.line,C.ch+1)}}for(var c=typeof T=="object"&&T.dontIndentOnAutoClose,R=D.length-1;R>=0;R--){var f=g[R];M.replaceRange(f.text,D[R].head,D[R].anchor,"+insert");var d=M.listSelections().slice(0);d[R]={head:f.newPos,anchor:f.newPos},M.setSelections(d),!c&&f.indent&&(M.indentLine(f.newPos.line,null,!0),M.indentLine(f.newPos.line+1,null,!0))}}function I(M,D){for(var g=M.listSelections(),T=[],R=D?"/":"</",C=M.getOption("autoCloseTags"),w=typeof C=="object"&&C.dontIndentOnSlash,v=0;v<g.length;v++){if(!g[v].empty())return te.Pass;var u=g[v].head,o=M.getTokenAt(u),s=te.innerMode(M.getMode(),o.state),l=s.state;if(D&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=u.ch-1))return te.Pass;var S,p=s.mode.name!="xml"&&M.getMode().name=="htmlmixed";if(p&&s.mode.name=="javascript")S=R+"script";else if(p&&s.mode.name=="css")S=R+"style";else{var h=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(l);if(!h||h.length&&F(M,h,h[h.length-1],u))return te.Pass;S=R+h[h.length-1]}M.getLine(u.line).charAt(o.end)!=">"&&(S+=">"),T[v]=S}if(M.replaceSelections(T),g=M.listSelections(),!w)for(var v=0;v<g.length;v++)(v==g.length-1||g[v].head.line<g[v+1].head.line)&&M.indentLine(g[v].head.line)}function _(M){return M.getOption("disableInput")?te.Pass:I(M,!0)}te.commands.closeTag=function(M){return I(M)};function B(M,D){if(M.indexOf)return M.indexOf(D);for(var g=0,T=M.length;g<T;++g)if(M[g]==D)return g;return-1}function F(M,D,g,T,R){if(!te.scanForClosingTag)return!1;var C=Math.min(M.lastLine()+1,T.line+500),w=te.scanForClosingTag(M,T,null,C);if(!w||w.tag!=g)return!1;for(var v=R?1:0,u=D.length-1;u>=0&&D[u]==g;u--)++v;T=w.to;for(var u=1;u<v;u++){var o=te.scanForClosingTag(M,T,null,C);if(!o||o.tag!=g)return!1;T=o.to}return!0}})},BjJ7:function(ut,et,oe){"use strict";oe.d(et,"d",function(){return G}),oe.d(et,"c",function(){return L}),oe.d(et,"e",function(){return z}),oe.d(et,"b",function(){return I}),oe.d(et,"a",function(){return B});var te=oe("m3rI");function G(F){var M=!0;if(F.length>0){for(var D=0;D<F.length;D++)if(F[D].compile_success==0||!F[D].compile_success){M=!1;break}}else M=!1;return M}function L(F){for(var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",D=[],g=0;g<F.length;g++){var T=F[g],R=M?"".concat(M,"/").concat(T.name):"".concat(T.name);D.push({title:T.name,isLeaf:!(T.type==="tree"),key:R})}return D}function z(F,M,D){for(var g=0;g<F.length;g++){var T=F[g];if(T.key===M){T.children=D;break}T.children&&z(T.children,M,D)}return F}function I(F,M,D){var g;return function(){var T=this,R=arguments,C=function(){g=null,D||F.apply(T,R)},w=D&&!g;clearTimeout(g),g=setTimeout(C,M),w&&F.apply(T,R)}}var _=!0,B=te.a.API_SERVER},"C+DQ":function(ut,et,oe){},DlQD:function(ut,et,oe){(function(te,G){ut.exports=G()})(this,function(){"use strict";function te(pe,ue){for(var de=0;de<ue.length;de++){var $=ue[de];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(pe,$.key,$)}}function G(pe,ue,de){return ue&&te(pe.prototype,ue),de&&te(pe,de),pe}function L(pe,ue){if(!pe)return;if(typeof pe=="string")return z(pe,ue);var de=Object.prototype.toString.call(pe).slice(8,-1);if(de==="Object"&&pe.constructor&&(de=pe.constructor.name),de==="Map"||de==="Set")return Array.from(pe);if(de==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(de))return z(pe,ue)}function z(pe,ue){(ue==null||ue>pe.length)&&(ue=pe.length);for(var de=0,$=new Array(ue);de<ue;de++)$[de]=pe[de];return $}function I(pe,ue){var de;if(typeof Symbol=="undefined"||pe[Symbol.iterator]==null){if(Array.isArray(pe)||(de=L(pe))||ue&&pe&&typeof pe.length=="number"){de&&(pe=de);var $=0;return function(){return $>=pe.length?{done:!0}:{done:!1,value:pe[$++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return de=pe[Symbol.iterator](),de.next.bind(de)}function _(pe,ue){return ue={exports:{}},pe(ue,ue.exports),ue.exports}var B=_(function(pe){function ue(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function de($){pe.exports.defaults=$}pe.exports={defaults:ue(),getDefaults:ue,changeDefaults:de}}),F=B.defaults,M=B.getDefaults,D=B.changeDefaults,g=/[&<>"']/,T=/[&<>"']/g,R=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,w={"&":"&","<":"<",">":">",'"':""","'":"'"},v=function(ue){return w[ue]};function u(pe,ue){if(ue){if(g.test(pe))return pe.replace(T,v)}else if(R.test(pe))return pe.replace(C,v);return pe}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(pe){return pe.replace(o,function(ue,de){return de=de.toLowerCase(),de==="colon"?":":de.charAt(0)==="#"?de.charAt(1)==="x"?String.fromCharCode(parseInt(de.substring(2),16)):String.fromCharCode(+de.substring(1)):""})}var l=/(^|[^\[])\^/g;function S(pe,ue){pe=pe.source||pe,ue=ue||"";var de={replace:function(Q,ee){return ee=ee.source||ee,ee=ee.replace(l,"$1"),pe=pe.replace(Q,ee),de},getRegex:function(){return new RegExp(pe,ue)}};return de}var p=/[^\w:]/g,h=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function A(pe,ue,de){if(pe){var $;try{$=decodeURIComponent(s(de)).replace(p,"").toLowerCase()}catch(Q){return null}if($.indexOf("javascript:")===0||$.indexOf("vbscript:")===0||$.indexOf("data:")===0)return null}ue&&!h.test(de)&&(de=a(ue,de));try{de=encodeURI(de).replace(/%25/g,"%")}catch(Q){return null}return de}var b={},c=/^[^:]+:\/*[^/]*$/,f=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(pe,ue){b[" "+pe]||(c.test(pe)?b[" "+pe]=pe+"/":b[" "+pe]=P(pe,"/",!0)),pe=b[" "+pe];var de=pe.indexOf(":")===-1;return ue.substring(0,2)==="//"?de?ue:pe.replace(f,"$1")+ue:ue.charAt(0)==="/"?de?ue:pe.replace(d,"$1")+ue:pe+ue}var y={exec:function(){}};function m(pe){for(var ue=1,de,$;ue<arguments.length;ue++){de=arguments[ue];for($ in de)Object.prototype.hasOwnProperty.call(de,$)&&(pe[$]=de[$])}return pe}function x(pe,ue){var de=pe.replace(/\|/g,function(ee,se,fe){for(var we=!1,_e=se;--_e>=0&&fe[_e]==="\\";)we=!we;return we?"|":" |"}),$=de.split(/ \|/),Q=0;if($.length>ue)$.splice(ue);else for(;$.length<ue;)$.push("");for(;Q<$.length;Q++)$[Q]=$[Q].trim().replace(/\\\|/g,"|");return $}function P(pe,ue,de){var $=pe.length;if($===0)return"";for(var Q=0;Q<$;){var ee=pe.charAt($-Q-1);if(ee===ue&&!de)Q++;else if(ee!==ue&&de)Q++;else break}return pe.substr(0,$-Q)}function U(pe,ue){if(pe.indexOf(ue[1])===-1)return-1;for(var de=pe.length,$=0,Q=0;Q<de;Q++)if(pe[Q]==="\\")Q++;else if(pe[Q]===ue[0])$++;else if(pe[Q]===ue[1]&&($--,$<0))return Q;return-1}function j(pe){pe&&pe.sanitize&&!pe.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var W={escape:u,unescape:s,edit:S,cleanUrl:A,resolveUrl:a,noopTest:y,merge:m,splitCells:x,rtrim:P,findClosingBracket:U,checkSanitizeDeprecation:j},k=B.defaults,O=W.rtrim,K=W.splitCells,Y=W.escape,q=W.findClosingBracket;function ie(pe,ue,de){var $=ue.href,Q=ue.title?Y(ue.title):null,ee=pe[1].replace(/\\([\[\]])/g,"$1");return pe[0].charAt(0)!=="!"?{type:"link",raw:de,href:$,title:Q,text:ee}:{type:"image",raw:de,href:$,title:Q,text:Y(ee)}}function Te(pe,ue){var de=pe.match(/^(\s+)(?:```)/);if(de===null)return ue;var $=de[1];return ue.split(`
|
|
`).map(function(Q){var ee=Q.match(/^\s+/);if(ee===null)return Q;var se=ee[0];return se.length>=$.length?Q.slice($.length):Q}).join(`
|
|
`)}var ve=function(){function pe(de){this.options=de||k}var ue=pe.prototype;return ue.space=function($){var Q=this.rules.block.newline.exec($);if(Q)return Q[0].length>1?{type:"space",raw:Q[0]}:{raw:`
|
|
`}},ue.code=function($,Q){var ee=this.rules.block.code.exec($);if(ee){var se=Q[Q.length-1];if(se&&se.type==="paragraph")return{raw:ee[0],text:ee[0].trimRight()};var fe=ee[0].replace(/^ {4}/gm,"");return{type:"code",raw:ee[0],codeBlockStyle:"indented",text:this.options.pedantic?fe:O(fe,`
|
|
`)}}},ue.fences=function($){var Q=this.rules.block.fences.exec($);if(Q){var ee=Q[0],se=Te(ee,Q[3]||"");return{type:"code",raw:ee,lang:Q[2]?Q[2].trim():Q[2],text:se}}},ue.heading=function($){var Q=this.rules.block.heading.exec($);if(Q)return{type:"heading",raw:Q[0],depth:Q[1].length,text:Q[2]}},ue.nptable=function($){var Q=this.rules.block.nptable.exec($);if(Q){var ee={type:"table",header:K(Q[1].replace(/^ *| *\| *$/g,"")),align:Q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Q[3]?Q[3].replace(/\n$/,"").split(`
|
|
`):[],raw:Q[0]};if(ee.header.length===ee.align.length){var se=ee.align.length,fe;for(fe=0;fe<se;fe++)/^ *-+: *$/.test(ee.align[fe])?ee.align[fe]="right":/^ *:-+: *$/.test(ee.align[fe])?ee.align[fe]="center":/^ *:-+ *$/.test(ee.align[fe])?ee.align[fe]="left":ee.align[fe]=null;for(se=ee.cells.length,fe=0;fe<se;fe++)ee.cells[fe]=K(ee.cells[fe],ee.header.length);return ee}}},ue.hr=function($){var Q=this.rules.block.hr.exec($);if(Q)return{type:"hr",raw:Q[0]}},ue.blockquote=function($){var Q=this.rules.block.blockquote.exec($);if(Q){var ee=Q[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Q[0],text:ee}}},ue.list=function($){var Q=this.rules.block.list.exec($);if(Q){for(var ee=Q[0],se=Q[2],fe=se.length>1,we=se[se.length-1]===")",_e={type:"list",raw:ee,ordered:fe,start:fe?+se.slice(0,-1):"",loose:!1,items:[]},je=Q[0].match(this.rules.block.item),Ze=!1,We,mt,dt,at,Et,xt,St,Dt=je.length,yt=0;yt<Dt;yt++)We=je[yt],ee=We,mt=We.length,We=We.replace(/^ *([*+-]|\d+[.)]) */,""),~We.indexOf(`
|
|
`)&&(mt-=We.length,We=this.options.pedantic?We.replace(/^ {1,4}/gm,""):We.replace(new RegExp("^ {1,"+mt+"}","gm"),"")),yt!==Dt-1&&(dt=this.rules.block.bullet.exec(je[yt+1])[0],(fe?dt.length===1||!we&&dt[dt.length-1]===")":dt.length>1||this.options.smartLists&&dt!==se)&&(at=je.slice(yt+1).join(`
|
|
`),_e.raw=_e.raw.substring(0,_e.raw.length-at.length),yt=Dt-1)),Et=Ze||/\n\n(?!\s*$)/.test(We),yt!==Dt-1&&(Ze=We.charAt(We.length-1)===`
|
|
`,Et||(Et=Ze)),Et&&(_e.loose=!0),xt=/^\[[ xX]\] /.test(We),St=void 0,xt&&(St=We[1]!==" ",We=We.replace(/^\[[ xX]\] +/,"")),_e.items.push({type:"list_item",raw:ee,task:xt,checked:St,loose:Et,text:We});return _e}},ue.html=function($){var Q=this.rules.block.html.exec($);if(Q)return{type:this.options.sanitize?"paragraph":"html",raw:Q[0],pre:!this.options.sanitizer&&(Q[1]==="pre"||Q[1]==="script"||Q[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Q[0]):Y(Q[0]):Q[0]}},ue.def=function($){var Q=this.rules.block.def.exec($);if(Q){Q[3]&&(Q[3]=Q[3].substring(1,Q[3].length-1));var ee=Q[1].toLowerCase().replace(/\s+/g," ");return{tag:ee,raw:Q[0],href:Q[2],title:Q[3]}}},ue.table=function($){var Q=this.rules.block.table.exec($);if(Q){var ee={type:"table",header:K(Q[1].replace(/^ *| *\| *$/g,"")),align:Q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Q[3]?Q[3].replace(/\n$/,"").split(`
|
|
`):[]};if(ee.header.length===ee.align.length){ee.raw=Q[0];var se=ee.align.length,fe;for(fe=0;fe<se;fe++)/^ *-+: *$/.test(ee.align[fe])?ee.align[fe]="right":/^ *:-+: *$/.test(ee.align[fe])?ee.align[fe]="center":/^ *:-+ *$/.test(ee.align[fe])?ee.align[fe]="left":ee.align[fe]=null;for(se=ee.cells.length,fe=0;fe<se;fe++)ee.cells[fe]=K(ee.cells[fe].replace(/^ *\| *| *\| *$/g,""),ee.header.length);return ee}}},ue.lheading=function($){var Q=this.rules.block.lheading.exec($);if(Q)return{type:"heading",raw:Q[0],depth:Q[2].charAt(0)==="="?1:2,text:Q[1]}},ue.paragraph=function($){var Q=this.rules.block.paragraph.exec($);if(Q)return{type:"paragraph",raw:Q[0],text:Q[1].charAt(Q[1].length-1)===`
|
|
`?Q[1].slice(0,-1):Q[1]}},ue.text=function($,Q){var ee=this.rules.block.text.exec($);if(ee){var se=Q[Q.length-1];return se&&se.type==="text"?{raw:ee[0],text:ee[0]}:{type:"text",raw:ee[0],text:ee[0]}}},ue.escape=function($){var Q=this.rules.inline.escape.exec($);if(Q)return{type:"escape",raw:Q[0],text:Y(Q[1])}},ue.tag=function($,Q,ee){var se=this.rules.inline.tag.exec($);if(se)return!Q&&/^<a /i.test(se[0])?Q=!0:Q&&/^<\/a>/i.test(se[0])&&(Q=!1),!ee&&/^<(pre|code|kbd|script)(\s|>)/i.test(se[0])?ee=!0:ee&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(se[0])&&(ee=!1),{type:this.options.sanitize?"text":"html",raw:se[0],inLink:Q,inRawBlock:ee,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):Y(se[0]):se[0]}},ue.link=function($){var Q=this.rules.inline.link.exec($);if(Q){var ee=q(Q[2],"()");if(ee>-1){var se=Q[0].indexOf("!")===0?5:4,fe=se+Q[1].length+ee;Q[2]=Q[2].substring(0,ee),Q[0]=Q[0].substring(0,fe).trim(),Q[3]=""}var we=Q[2],_e="";if(this.options.pedantic){var je=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(we);je?(we=je[1],_e=je[3]):_e=""}else _e=Q[3]?Q[3].slice(1,-1):"";we=we.trim().replace(/^<([\s\S]*)>$/,"$1");var Ze=ie(Q,{href:we&&we.replace(this.rules.inline._escapes,"$1"),title:_e&&_e.replace(this.rules.inline._escapes,"$1")},Q[0]);return Ze}},ue.reflink=function($,Q){var ee;if((ee=this.rules.inline.reflink.exec($))||(ee=this.rules.inline.nolink.exec($))){var se=(ee[2]||ee[1]).replace(/\s+/g," ");if(se=Q[se.toLowerCase()],!se||!se.href){var fe=ee[0].charAt(0);return{type:"text",raw:fe,text:fe}}var we=ie(ee,se,ee[0]);return we}},ue.strong=function($,Q,ee){ee===void 0&&(ee="");var se=this.rules.inline.strong.start.exec($);if(se&&(!se[1]||se[1]&&(ee===""||this.rules.inline.punctuation.exec(ee)))){Q=Q.slice(-1*$.length);var fe=se[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;fe.lastIndex=0;for(var we;(se=fe.exec(Q))!=null;)if(we=this.rules.inline.strong.middle.exec(Q.slice(0,se.index+3)),we)return{type:"strong",raw:$.slice(0,we[0].length),text:$.slice(2,we[0].length-2)}}},ue.em=function($,Q,ee){ee===void 0&&(ee="");var se=this.rules.inline.em.start.exec($);if(se&&(!se[1]||se[1]&&(ee===""||this.rules.inline.punctuation.exec(ee)))){Q=Q.slice(-1*$.length);var fe=se[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;fe.lastIndex=0;for(var we;(se=fe.exec(Q))!=null;)if(we=this.rules.inline.em.middle.exec(Q.slice(0,se.index+2)),we)return{type:"em",raw:$.slice(0,we[0].length),text:$.slice(1,we[0].length-1)}}},ue.codespan=function($){var Q=this.rules.inline.code.exec($);if(Q){var ee=Q[2].replace(/\n/g," "),se=/[^ ]/.test(ee),fe=ee.startsWith(" ")&&ee.endsWith(" ");return se&&fe&&(ee=ee.substring(1,ee.length-1)),ee=Y(ee,!0),{type:"codespan",raw:Q[0],text:ee}}},ue.br=function($){var Q=this.rules.inline.br.exec($);if(Q)return{type:"br",raw:Q[0]}},ue.del=function($){var Q=this.rules.inline.del.exec($);if(Q)return{type:"del",raw:Q[0],text:Q[1]}},ue.autolink=function($,Q){var ee=this.rules.inline.autolink.exec($);if(ee){var se,fe;return ee[2]==="@"?(se=Y(this.options.mangle?Q(ee[1]):ee[1]),fe="mailto:"+se):(se=Y(ee[1]),fe=se),{type:"link",raw:ee[0],text:se,href:fe,tokens:[{type:"text",raw:se,text:se}]}}},ue.url=function($,Q){var ee;if(ee=this.rules.inline.url.exec($)){var se,fe;if(ee[2]==="@")se=Y(this.options.mangle?Q(ee[0]):ee[0]),fe="mailto:"+se;else{var we;do we=ee[0],ee[0]=this.rules.inline._backpedal.exec(ee[0])[0];while(we!==ee[0]);se=Y(ee[0]),ee[1]==="www."?fe="http://"+se:fe=se}return{type:"link",raw:ee[0],text:se,href:fe,tokens:[{type:"text",raw:se,text:se}]}}},ue.inlineText=function($,Q,ee){var se=this.rules.inline.text.exec($);if(se){var fe;return Q?fe=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):Y(se[0]):se[0]:fe=Y(this.options.smartypants?ee(se[0]):se[0]),{type:"text",raw:se[0],text:fe}}},pe}(),ge=W.noopTest,he=W.edit,ce=W.merge,ae={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:ge,table:ge,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ae._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ae._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ae.def=he(ae.def).replace("label",ae._label).replace("title",ae._title).getRegex(),ae.bullet=/(?:[*+-]|\d{1,9}[.)])/,ae.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ae.item=he(ae.item,"gm").replace(/bull/g,ae.bullet).getRegex(),ae.list=he(ae.list).replace(/bull/g,ae.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ae.def.source+")").getRegex(),ae._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ae._comment=/<!--(?!-?>)[\s\S]*?-->/,ae.html=he(ae.html,"i").replace("comment",ae._comment).replace("tag",ae._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ae.paragraph=he(ae._paragraph).replace("hr",ae.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ae._tag).getRegex(),ae.blockquote=he(ae.blockquote).replace("paragraph",ae.paragraph).getRegex(),ae.normal=ce({},ae),ae.gfm=ce({},ae.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),ae.gfm.nptable=he(ae.gfm.nptable).replace("hr",ae.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ae._tag).getRegex(),ae.gfm.table=he(ae.gfm.table).replace("hr",ae.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ae._tag).getRegex(),ae.pedantic=ce({},ae.normal,{html:he(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ae._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:ge,paragraph:he(ae.normal._paragraph).replace("hr",ae.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ae.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var me={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ge,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:ge,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};me._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",me.punctuation=he(me.punctuation).replace(/punctuation/g,me._punctuation).getRegex(),me._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",me._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",me.em.start=he(me.em.start).replace(/punctuation/g,me._punctuation).getRegex(),me.em.middle=he(me.em.middle).replace(/punctuation/g,me._punctuation).replace(/overlapSkip/g,me._overlapSkip).getRegex(),me.em.endAst=he(me.em.endAst,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.em.endUnd=he(me.em.endUnd,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.strong.start=he(me.strong.start).replace(/punctuation/g,me._punctuation).getRegex(),me.strong.middle=he(me.strong.middle).replace(/punctuation/g,me._punctuation).replace(/blockSkip/g,me._blockSkip).getRegex(),me.strong.endAst=he(me.strong.endAst,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.strong.endUnd=he(me.strong.endUnd,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.blockSkip=he(me._blockSkip,"g").getRegex(),me.overlapSkip=he(me._overlapSkip,"g").getRegex(),me._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,me._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,me._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])?)+(?![-_])/,me.autolink=he(me.autolink).replace("scheme",me._scheme).replace("email",me._email).getRegex(),me._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,me.tag=he(me.tag).replace("comment",ae._comment).replace("attribute",me._attribute).getRegex(),me._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,me._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,me._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,me.link=he(me.link).replace("label",me._label).replace("href",me._href).replace("title",me._title).getRegex(),me.reflink=he(me.reflink).replace("label",me._label).getRegex(),me.reflinkSearch=he(me.reflinkSearch,"g").replace("reflink",me.reflink).replace("nolink",me.nolink).getRegex(),me.normal=ce({},me),me.pedantic=ce({},me.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:he(/^!?\[(label)\]\((.*?)\)/).replace("label",me._label).getRegex(),reflink:he(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",me._label).getRegex()}),me.gfm=ce({},me.normal,{escape:he(me.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),me.gfm.url=he(me.gfm.url,"i").replace("email",me.gfm._extended_email).getRegex(),me.breaks=ce({},me.gfm,{br:he(me.br).replace("{2,}","*").getRegex(),text:he(me.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var J={block:ae,inline:me},ne=B.defaults,Z=J.block,Ee=J.inline;function Ae(pe){return pe.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 be(pe){var ue="",de,$,Q=pe.length;for(de=0;de<Q;de++)$=pe.charCodeAt(de),Math.random()>.5&&($="x"+$.toString(16)),ue+="&#"+$+";";return ue}var Se=function(){function pe(de){this.tokens=[],this.tokens.links=Object.create(null),this.options=de||ne,this.options.tokenizer=this.options.tokenizer||new ve,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var $={block:Z.normal,inline:Ee.normal};this.options.pedantic?($.block=Z.pedantic,$.inline=Ee.pedantic):this.options.gfm&&($.block=Z.gfm,this.options.breaks?$.inline=Ee.breaks:$.inline=Ee.gfm),this.tokenizer.rules=$}pe.lex=function($,Q){var ee=new pe(Q);return ee.lex($)};var ue=pe.prototype;return ue.lex=function($){return $=$.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens($,this.tokens,!0),this.inline(this.tokens),this.tokens},ue.blockTokens=function($,Q,ee){Q===void 0&&(Q=[]),ee===void 0&&(ee=!0),$=$.replace(/^ +$/gm,"");for(var se,fe,we,_e;$;){if(se=this.tokenizer.space($)){$=$.substring(se.raw.length),se.type&&Q.push(se);continue}if(se=this.tokenizer.code($,Q)){$=$.substring(se.raw.length),se.type?Q.push(se):(_e=Q[Q.length-1],_e.raw+=`
|
|
`+se.raw,_e.text+=`
|
|
`+se.text);continue}if(se=this.tokenizer.fences($)){$=$.substring(se.raw.length),Q.push(se);continue}if(se=this.tokenizer.heading($)){$=$.substring(se.raw.length),Q.push(se);continue}if(se=this.tokenizer.nptable($)){$=$.substring(se.raw.length),Q.push(se);continue}if(se=this.tokenizer.hr($)){$=$.substring(se.raw.length),Q.push(se);continue}if(se=this.tokenizer.blockquote($)){$=$.substring(se.raw.length),se.tokens=this.blockTokens(se.text,[],ee),Q.push(se);continue}if(se=this.tokenizer.list($)){for($=$.substring(se.raw.length),we=se.items.length,fe=0;fe<we;fe++)se.items[fe].tokens=this.blockTokens(se.items[fe].text,[],!1);Q.push(se);continue}if(se=this.tokenizer.html($)){$=$.substring(se.raw.length),Q.push(se);continue}if(ee&&(se=this.tokenizer.def($))){$=$.substring(se.raw.length),this.tokens.links[se.tag]||(this.tokens.links[se.tag]={href:se.href,title:se.title});continue}if(se=this.tokenizer.table($)){$=$.substring(se.raw.length),Q.push(se);continue}if(se=this.tokenizer.lheading($)){$=$.substring(se.raw.length),Q.push(se);continue}if(ee&&(se=this.tokenizer.paragraph($))){$=$.substring(se.raw.length),Q.push(se);continue}if(se=this.tokenizer.text($,Q)){$=$.substring(se.raw.length),se.type?Q.push(se):(_e=Q[Q.length-1],_e.raw+=`
|
|
`+se.raw,_e.text+=`
|
|
`+se.text);continue}if($){var je="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(je);break}else throw new Error(je)}}return Q},ue.inline=function($){var Q,ee,se,fe,we,_e,je=$.length;for(Q=0;Q<je;Q++){_e=$[Q];switch(_e.type){case"paragraph":case"text":case"heading":{_e.tokens=[],this.inlineTokens(_e.text,_e.tokens);break}case"table":{for(_e.tokens={header:[],cells:[]},fe=_e.header.length,ee=0;ee<fe;ee++)_e.tokens.header[ee]=[],this.inlineTokens(_e.header[ee],_e.tokens.header[ee]);for(fe=_e.cells.length,ee=0;ee<fe;ee++)for(we=_e.cells[ee],_e.tokens.cells[ee]=[],se=0;se<we.length;se++)_e.tokens.cells[ee][se]=[],this.inlineTokens(we[se],_e.tokens.cells[ee][se]);break}case"blockquote":{this.inline(_e.tokens);break}case"list":{for(fe=_e.items.length,ee=0;ee<fe;ee++)this.inline(_e.items[ee].tokens);break}}}return $},ue.inlineTokens=function($,Q,ee,se,fe){Q===void 0&&(Q=[]),ee===void 0&&(ee=!1),se===void 0&&(se=!1),fe===void 0&&(fe="");var we,_e=$,je;if(this.tokens.links){var Ze=Object.keys(this.tokens.links);if(Ze.length>0)for(;(je=this.tokenizer.rules.inline.reflinkSearch.exec(_e))!=null;)Ze.includes(je[0].slice(je[0].lastIndexOf("[")+1,-1))&&(_e=_e.slice(0,je.index)+"["+"a".repeat(je[0].length-2)+"]"+_e.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(je=this.tokenizer.rules.inline.blockSkip.exec(_e))!=null;)_e=_e.slice(0,je.index)+"["+"a".repeat(je[0].length-2)+"]"+_e.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;$;){if(we=this.tokenizer.escape($)){$=$.substring(we.raw.length),Q.push(we);continue}if(we=this.tokenizer.tag($,ee,se)){$=$.substring(we.raw.length),ee=we.inLink,se=we.inRawBlock,Q.push(we);continue}if(we=this.tokenizer.link($)){$=$.substring(we.raw.length),we.type==="link"&&(we.tokens=this.inlineTokens(we.text,[],!0,se)),Q.push(we);continue}if(we=this.tokenizer.reflink($,this.tokens.links)){$=$.substring(we.raw.length),we.type==="link"&&(we.tokens=this.inlineTokens(we.text,[],!0,se)),Q.push(we);continue}if(we=this.tokenizer.strong($,_e,fe)){$=$.substring(we.raw.length),we.tokens=this.inlineTokens(we.text,[],ee,se),Q.push(we);continue}if(we=this.tokenizer.em($,_e,fe)){$=$.substring(we.raw.length),we.tokens=this.inlineTokens(we.text,[],ee,se),Q.push(we);continue}if(we=this.tokenizer.codespan($)){$=$.substring(we.raw.length),Q.push(we);continue}if(we=this.tokenizer.br($)){$=$.substring(we.raw.length),Q.push(we);continue}if(we=this.tokenizer.del($)){$=$.substring(we.raw.length),we.tokens=this.inlineTokens(we.text,[],ee,se),Q.push(we);continue}if(we=this.tokenizer.autolink($,be)){$=$.substring(we.raw.length),Q.push(we);continue}if(!ee&&(we=this.tokenizer.url($,be))){$=$.substring(we.raw.length),Q.push(we);continue}if(we=this.tokenizer.inlineText($,se,Ae)){$=$.substring(we.raw.length),fe=we.raw.slice(-1),Q.push(we);continue}if($){var We="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(We);break}else throw new Error(We)}}return Q},G(pe,null,[{key:"rules",get:function(){return{block:Z,inline:Ee}}}]),pe}(),Re=B.defaults,Ue=W.cleanUrl,Ie=W.escape,ke=function(){function pe(de){this.options=de||Re}var ue=pe.prototype;return ue.code=function($,Q,ee){var se=(Q||"").match(/\S*/)[0];if(this.options.highlight){var fe=this.options.highlight($,se);fe!=null&&fe!==$&&(ee=!0,$=fe)}return se?'<pre><code class="'+this.options.langPrefix+Ie(se,!0)+'">'+(ee?$:Ie($,!0))+`</code></pre>
|
|
`:"<pre><code>"+(ee?$:Ie($,!0))+`</code></pre>
|
|
`},ue.blockquote=function($){return`<blockquote>
|
|
`+$+`</blockquote>
|
|
`},ue.html=function($){return $},ue.heading=function($,Q,ee,se){return this.options.headerIds?"<h"+Q+' id="'+this.options.headerPrefix+se.slug(ee)+'">'+$+"</h"+Q+`>
|
|
`:"<h"+Q+">"+$+"</h"+Q+`>
|
|
`},ue.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ue.list=function($,Q,ee){var se=Q?"ol":"ul",fe=Q&&ee!==1?' start="'+ee+'"':"";return"<"+se+fe+`>
|
|
`+$+"</"+se+`>
|
|
`},ue.listitem=function($){return"<li>"+$+`</li>
|
|
`},ue.checkbox=function($){return"<input "+($?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ue.paragraph=function($){return"<p>"+$+`</p>
|
|
`},ue.table=function($,Q){return Q&&(Q="<tbody>"+Q+"</tbody>"),`<table>
|
|
<thead>
|
|
`+$+`</thead>
|
|
`+Q+`</table>
|
|
`},ue.tablerow=function($){return`<tr>
|
|
`+$+`</tr>
|
|
`},ue.tablecell=function($,Q){var ee=Q.header?"th":"td",se=Q.align?"<"+ee+' align="'+Q.align+'">':"<"+ee+">";return se+$+"</"+ee+`>
|
|
`},ue.strong=function($){return"<strong>"+$+"</strong>"},ue.em=function($){return"<em>"+$+"</em>"},ue.codespan=function($){return"<code>"+$+"</code>"},ue.br=function(){return this.options.xhtml?"<br/>":"<br>"},ue.del=function($){return"<del>"+$+"</del>"},ue.link=function($,Q,ee){if($=Ue(this.options.sanitize,this.options.baseUrl,$),$===null)return ee;var se='<a href="'+Ie($)+'"';return Q&&(se+=' title="'+Q+'"'),se+=">"+ee+"</a>",se},ue.image=function($,Q,ee){if($=Ue(this.options.sanitize,this.options.baseUrl,$),$===null)return ee;var se='<img src="'+$+'" alt="'+ee+'"';return Q&&(se+=' title="'+Q+'"'),se+=this.options.xhtml?"/>":">",se},ue.text=function($){return $},pe}(),Oe=function(){function pe(){}var ue=pe.prototype;return ue.strong=function($){return $},ue.em=function($){return $},ue.codespan=function($){return $},ue.del=function($){return $},ue.html=function($){return $},ue.text=function($){return $},ue.link=function($,Q,ee){return""+ee},ue.image=function($,Q,ee){return""+ee},ue.br=function(){return""},pe}(),$e=function(){function pe(){this.seen={}}var ue=pe.prototype;return ue.slug=function($){var Q=$.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Q)){var ee=Q;do this.seen[ee]++,Q=ee+"-"+this.seen[ee];while(this.seen.hasOwnProperty(Q))}return this.seen[Q]=0,Q},pe}(),ze=B.defaults,Ve=W.unescape,Ge=function(){function pe(de){this.options=de||ze,this.options.renderer=this.options.renderer||new ke,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Oe,this.slugger=new $e}pe.parse=function($,Q){var ee=new pe(Q);return ee.parse($)};var ue=pe.prototype;return ue.parse=function($,Q){Q===void 0&&(Q=!0);var ee="",se,fe,we,_e,je,Ze,We,mt,dt,at,Et,xt,St,Dt,yt,or,kr,ur,gr=$.length;for(se=0;se<gr;se++){at=$[se];switch(at.type){case"space":continue;case"hr":{ee+=this.renderer.hr();continue}case"heading":{ee+=this.renderer.heading(this.parseInline(at.tokens),at.depth,Ve(this.parseInline(at.tokens,this.textRenderer)),this.slugger);continue}case"code":{ee+=this.renderer.code(at.text,at.lang,at.escaped);continue}case"table":{for(mt="",We="",_e=at.header.length,fe=0;fe<_e;fe++)We+=this.renderer.tablecell(this.parseInline(at.tokens.header[fe]),{header:!0,align:at.align[fe]});for(mt+=this.renderer.tablerow(We),dt="",_e=at.cells.length,fe=0;fe<_e;fe++){for(Ze=at.tokens.cells[fe],We="",je=Ze.length,we=0;we<je;we++)We+=this.renderer.tablecell(this.parseInline(Ze[we]),{header:!1,align:at.align[we]});dt+=this.renderer.tablerow(We)}ee+=this.renderer.table(mt,dt);continue}case"blockquote":{dt=this.parse(at.tokens),ee+=this.renderer.blockquote(dt);continue}case"list":{for(Et=at.ordered,xt=at.start,St=at.loose,_e=at.items.length,dt="",fe=0;fe<_e;fe++)yt=at.items[fe],or=yt.checked,kr=yt.task,Dt="",yt.task&&(ur=this.renderer.checkbox(or),St?yt.tokens.length>0&&yt.tokens[0].type==="text"?(yt.tokens[0].text=ur+" "+yt.tokens[0].text,yt.tokens[0].tokens&&yt.tokens[0].tokens.length>0&&yt.tokens[0].tokens[0].type==="text"&&(yt.tokens[0].tokens[0].text=ur+" "+yt.tokens[0].tokens[0].text)):yt.tokens.unshift({type:"text",text:ur}):Dt+=ur),Dt+=this.parse(yt.tokens,St),dt+=this.renderer.listitem(Dt,kr,or);ee+=this.renderer.list(dt,Et,xt);continue}case"html":{ee+=this.renderer.html(at.text);continue}case"paragraph":{ee+=this.renderer.paragraph(this.parseInline(at.tokens));continue}case"text":{for(dt=at.tokens?this.parseInline(at.tokens):at.text;se+1<gr&&$[se+1].type==="text";)at=$[++se],dt+=`
|
|
`+(at.tokens?this.parseInline(at.tokens):at.text);ee+=Q?this.renderer.paragraph(dt):dt;continue}default:{var hr='Token with "'+at.type+'" type was not found.';if(this.options.silent){console.error(hr);return}else throw new Error(hr)}}}return ee},ue.parseInline=function($,Q){Q=Q||this.renderer;var ee="",se,fe,we=$.length;for(se=0;se<we;se++){fe=$[se];switch(fe.type){case"escape":{ee+=Q.text(fe.text);break}case"html":{ee+=Q.html(fe.text);break}case"link":{ee+=Q.link(fe.href,fe.title,this.parseInline(fe.tokens,Q));break}case"image":{ee+=Q.image(fe.href,fe.title,fe.text);break}case"strong":{ee+=Q.strong(this.parseInline(fe.tokens,Q));break}case"em":{ee+=Q.em(this.parseInline(fe.tokens,Q));break}case"codespan":{ee+=Q.codespan(fe.text);break}case"br":{ee+=Q.br();break}case"del":{ee+=Q.del(this.parseInline(fe.tokens,Q));break}case"text":{ee+=Q.text(fe.text);break}default:{var _e='Token with "'+fe.type+'" type was not found.';if(this.options.silent){console.error(_e);return}else throw new Error(_e)}}}return ee},pe}(),rt=W.merge,Je=W.checkSanitizeDeprecation,Ye=W.escape,Ce=B.getDefaults,qe=B.changeDefaults,Xe=B.defaults;function Le(pe,ue,de){if(typeof pe=="undefined"||pe===null)throw new Error("marked(): input parameter is undefined or null");if(typeof pe!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(pe)+", string expected");if(typeof ue=="function"&&(de=ue,ue=null),ue=rt({},Le.defaults,ue||{}),Je(ue),de){var $=ue.highlight,Q;try{Q=Se.lex(pe,ue)}catch(we){return de(we)}var ee=function(_e){var je;if(!_e)try{je=Ge.parse(Q,ue)}catch(Ze){_e=Ze}return ue.highlight=$,_e?de(_e):de(null,je)};if(!$||$.length<3)return ee();if(delete ue.highlight,!Q.length)return ee();var se=0;Le.walkTokens(Q,function(we){we.type==="code"&&(se++,setTimeout(function(){$(we.text,we.lang,function(_e,je){if(_e)return ee(_e);je!=null&&je!==we.text&&(we.text=je,we.escaped=!0),se--,se===0&&ee()})},0))}),se===0&&ee();return}try{var fe=Se.lex(pe,ue);return ue.walkTokens&&Le.walkTokens(fe,ue.walkTokens),Ge.parse(fe,ue)}catch(we){if(we.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ue.silent)return"<p>An error occurred:</p><pre>"+Ye(we.message+"",!0)+"</pre>";throw we}}Le.options=Le.setOptions=function(pe){return rt(Le.defaults,pe),qe(Le.defaults),Le},Le.getDefaults=Ce,Le.defaults=Xe,Le.use=function(pe){var ue=rt({},pe);if(pe.renderer&&function(){var $=Le.defaults.renderer||new ke,Q=function(fe){var we=$[fe];$[fe]=function(){for(var _e=arguments.length,je=new Array(_e),Ze=0;Ze<_e;Ze++)je[Ze]=arguments[Ze];var We=pe.renderer[fe].apply($,je);return We===!1&&(We=we.apply($,je)),We}};for(var ee in pe.renderer)Q(ee);ue.renderer=$}(),pe.tokenizer&&function(){var $=Le.defaults.tokenizer||new ve,Q=function(fe){var we=$[fe];$[fe]=function(){for(var _e=arguments.length,je=new Array(_e),Ze=0;Ze<_e;Ze++)je[Ze]=arguments[Ze];var We=pe.tokenizer[fe].apply($,je);return We===!1&&(We=we.apply($,je)),We}};for(var ee in pe.tokenizer)Q(ee);ue.tokenizer=$}(),pe.walkTokens){var de=Le.defaults.walkTokens;ue.walkTokens=function($){pe.walkTokens($),de&&de($)}}Le.setOptions(ue)},Le.walkTokens=function(pe,ue){for(var de=I(pe),$;!($=de()).done;){var Q=$.value;ue(Q);switch(Q.type){case"table":{for(var ee=I(Q.tokens.header),se;!(se=ee()).done;){var fe=se.value;Le.walkTokens(fe,ue)}for(var we=I(Q.tokens.cells),_e;!(_e=we()).done;)for(var je=_e.value,Ze=I(je),We;!(We=Ze()).done;){var mt=We.value;Le.walkTokens(mt,ue)}break}case"list":{Le.walkTokens(Q.items,ue);break}default:Q.tokens&&Le.walkTokens(Q.tokens,ue)}}},Le.Parser=Ge,Le.parser=Ge.parse,Le.Renderer=ke,Le.TextRenderer=Oe,Le.Lexer=Se,Le.lexer=Se.lex,Le.Tokenizer=ve,Le.Slugger=$e,Le.parse=Le;var Me=Le;return Me})},ELLl:function(ut,et,oe){(function(te){te(oe("VrN/"))})(function(te){var G={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},L=te.Pos;te.defineOption("autoCloseBrackets",!1,function(w,v,u){u&&u!=te.Init&&(w.removeKeyMap(I),w.state.closeBrackets=null),v&&(_(z(v,"pairs")),w.state.closeBrackets=v,w.addKeyMap(I))});function z(w,v){return v=="pairs"&&typeof w=="string"?w:typeof w=="object"&&w[v]!=null?w[v]:G[v]}var I={Backspace:M,Enter:D};function _(w){for(var v=0;v<w.length;v++){var u=w.charAt(v),o="'"+u+"'";I[o]||(I[o]=B(u))}}_(G.pairs+"`");function B(w){return function(v){return T(v,w)}}function F(w){var v=w.state.closeBrackets;if(!v||v.override)return v;var u=w.getModeAt(w.getCursor());return u.closeBrackets||v}function M(w){var v=F(w);if(!v||w.getOption("disableInput"))return te.Pass;for(var u=z(v,"pairs"),o=w.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return te.Pass;var l=R(w,o[s].head);if(!l||u.indexOf(l)%2!=0)return te.Pass}for(var s=o.length-1;s>=0;s--){var S=o[s].head;w.replaceRange("",L(S.line,S.ch-1),L(S.line,S.ch+1),"+delete")}}function D(w){var v=F(w),u=v&&z(v,"explode");if(!u||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 l=R(w,o[s].head);if(!l||u.indexOf(l)%2!=0)return te.Pass}w.operation(function(){var S=w.lineSeparator()||`
|
|
`;w.replaceSelection(S+S,null),w.execCommand("goCharLeft"),o=w.listSelections();for(var p=0;p<o.length;p++){var h=o[p].head.line;w.indentLine(h,null,!0),w.indentLine(h+1,null,!0)}})}function g(w){var v=te.cmpPos(w.anchor,w.head)>0;return{anchor:new L(w.anchor.line,w.anchor.ch+(v?-1:1)),head:new L(w.head.line,w.head.ch+(v?1:-1))}}function T(w,v){var u=F(w);if(!u||w.getOption("disableInput"))return te.Pass;var o=z(u,"pairs"),s=o.indexOf(v);if(s==-1)return te.Pass;for(var l=z(u,"closeBefore"),S=z(u,"triples"),p=o.charAt(s+1)==v,h=w.listSelections(),A=s%2==0,b,c=0;c<h.length;c++){var f=h[c],d=f.head,a,y=w.getRange(d,L(d.line,d.ch+1));if(A&&!f.empty())a="surround";else if((p||!A)&&y==v)p&&C(w,d)?a="both":S.indexOf(v)>=0&&w.getRange(d,L(d.line,d.ch+3))==v+v+v?a="skipThree":a="skip";else if(p&&d.ch>1&&S.indexOf(v)>=0&&w.getRange(L(d.line,d.ch-2),d)==v+v){if(d.ch>2&&/\bstring/.test(w.getTokenTypeAt(L(d.line,d.ch-2))))return te.Pass;a="addFour"}else if(p){var m=d.ch==0?" ":w.getRange(L(d.line,d.ch-1),d);if(!te.isWordChar(y)&&m!=v&&!te.isWordChar(m))a="both";else return te.Pass}else if(A&&(y.length===0||/\s/.test(y)||l.indexOf(y)>-1))a="both";else return te.Pass;if(!b)b=a;else if(b!=a)return te.Pass}var x=s%2?o.charAt(s-1):v,P=s%2?v:o.charAt(s+1);w.operation(function(){if(b=="skip")w.execCommand("goCharRight");else if(b=="skipThree")for(var U=0;U<3;U++)w.execCommand("goCharRight");else if(b=="surround"){for(var j=w.getSelections(),U=0;U<j.length;U++)j[U]=x+j[U]+P;w.replaceSelections(j,"around"),j=w.listSelections().slice();for(var U=0;U<j.length;U++)j[U]=g(j[U]);w.setSelections(j)}else b=="both"?(w.replaceSelection(x+P,null),w.triggerElectric(x+P),w.execCommand("goCharLeft")):b=="addFour"&&(w.replaceSelection(x+x+x+x,"before"),w.execCommand("goCharRight"))})}function R(w,v){var u=w.getRange(L(v.line,v.ch-1),L(v.line,v.ch+1));return u.length==2?u:null}function C(w,v){var u=w.getTokenAt(L(v.line,v.ch+1));return/\bstring/.test(u.type)&&u.start==v.ch&&(v.ch==0||!/\bstring/.test(w.getTokenTypeAt(v)))}})},GfqC:function(ut,et,oe){"use strict";var te=oe("cDcd"),G=oe.n(te),L=oe("TSYQ"),z=oe.n(L);function I(W,k){var O="cannot "+W.method+" "+W.action+" "+k.status+"'",K=new Error(O);return K.status=k.status,K.method=W.method,K.url=W.action,K}function _(W){var k=W.responseText||W.response;if(!k)return k;try{return JSON.parse(k)}catch(O){return k}}function B(W){var k=new XMLHttpRequest;W.onProgress&&k.upload&&(k.upload.onprogress=function(q){q.total>0&&(q.percent=q.loaded/q.total*100),W.onProgress(q)});var O=new FormData;W.data&&Object.keys(W.data).forEach(function(Y){var q=W.data[Y];if(Array.isArray(q)){q.forEach(function(ie){O.append(Y+"[]",ie)});return}O.append(Y,W.data[Y])}),W.file instanceof Blob?O.append(W.filename,W.file,W.file.name):O.append(W.filename,W.file),k.onerror=function(q){W.onError(q)},k.onload=function(){return k.status<200||k.status>=300?W.onError(I(W,k),_(k)):W.onSuccess(_(k),k)},k.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in k&&(k.withCredentials=!0);var K=W.headers||{};return K["X-Requested-With"]!==null&&k.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(K).forEach(function(Y){K[Y]!==null&&k.setRequestHeader(Y,K[Y])}),k.send(O),{abort:function(){k.abort()}}}var F=+new Date,M=0;function D(){return"rc-upload-"+F+"-"+ ++M}function g(W,k){return W.indexOf(k,W.length-k.length)!==-1}var T=function(W,k){if(W&&k){var O=Array.isArray(k)?k:k.split(","),K=W.name||"",Y=W.type||"",q=Y.replace(/\/.*$/,"");return O.some(function(ie){var Te=ie.trim();return Te.charAt(0)==="."?g(K.toLowerCase(),Te.toLowerCase()):/\/\*$/.test(Te)?q===Te.replace(/\/.*$/,""):Y===Te})}return!0};function R(W,k){var O=W.createReader(),K=[];function Y(){O.readEntries(function(q){var ie=Array.prototype.slice.apply(q);K=K.concat(ie);var Te=!ie.length;Te?k(K):Y()})}Y()}var C=function(k,O,K){var Y=function q(ie,Te){Te=Te||"",ie.isFile?ie.file(function(ve){K(ve)&&(ie.fullPath&&!ve.webkitRelativePath&&(Object.defineProperties(ve,{webkitRelativePath:{writable:!0}}),ve.webkitRelativePath=ie.fullPath.replace(/^\//,""),Object.defineProperties(ve,{webkitRelativePath:{writable:!1}})),O([ve]))}):ie.isDirectory&&R(ie,function(ve){ve.forEach(function(ge){q(ge,""+Te+ie.name+"/")})})};k.forEach(function(q){Y(q.webkitGetAsEntry())})},w=C,v=Object.assign||function(W){for(var k=1;k<arguments.length;k++){var O=arguments[k];for(var K in O)Object.prototype.hasOwnProperty.call(O,K)&&(W[K]=O[K])}return W},u=function(){function W(k,O){var K=[],Y=!0,q=!1,ie=void 0;try{for(var Te=k[Symbol.iterator](),ve;!(Y=(ve=Te.next()).done)&&!(K.push(ve.value),O&&K.length===O);Y=!0);}catch(ge){q=!0,ie=ge}finally{try{!Y&&Te.return&&Te.return()}finally{if(q)throw ie}}return K}return function(k,O){if(Array.isArray(k))return k;if(Symbol.iterator in Object(k))return W(k,O);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function W(k,O){for(var K=0;K<O.length;K++){var Y=O[K];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(k,Y.key,Y)}}return function(k,O,K){return O&&W(k.prototype,O),K&&W(k,K),k}}();function s(W,k,O){return k in W?Object.defineProperty(W,k,{value:O,enumerable:!0,configurable:!0,writable:!0}):W[k]=O,W}function l(W,k){var O={};for(var K in W){if(k.indexOf(K)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,K))continue;O[K]=W[K]}return O}function S(W,k){if(!(W instanceof k))throw new TypeError("Cannot call a class as a function")}function p(W,k){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k&&(typeof k=="object"||typeof k=="function")?k:W}function h(W,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof k);W.prototype=Object.create(k&&k.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),k&&(Object.setPrototypeOf?Object.setPrototypeOf(W,k):W.__proto__=k)}var A=function(k){return Object.keys(k).reduce(function(O,K){return(K.substr(0,5)==="data-"||K.substr(0,5)==="aria-"||K==="role")&&(O[K]=k[K]),O},{})},b=function(W){h(k,W);function k(){var O,K,Y,q;S(this,k);for(var ie=arguments.length,Te=Array(ie),ve=0;ve<ie;ve++)Te[ve]=arguments[ve];return q=(K=(Y=p(this,(O=k.__proto__||Object.getPrototypeOf(k)).call.apply(O,[this].concat(Te))),Y),Y.state={uid:D()},Y.reqs={},Y.onChange=function(ge){var he=ge.target.files;Y.uploadFiles(he),Y.reset()},Y.onClick=function(ge){var he=Y.fileInput;if(!he)return;var ce=Y.props,ae=ce.children,me=ce.onClick;ae&&ae.type==="button"&&(he.parentNode.focus(),he.parentNode.querySelector("button").blur()),he.click(),me&&me(ge)},Y.onKeyDown=function(ge){ge.key==="Enter"&&Y.onClick()},Y.onFileDrop=function(ge){var he=Y.props.multiple;if(ge.preventDefault(),ge.type==="dragover")return;if(Y.props.directory)w(Array.prototype.slice.call(ge.dataTransfer.items),Y.uploadFiles,function(ae){return T(ae,Y.props.accept)});else{var ce=Array.prototype.slice.call(ge.dataTransfer.files).filter(function(ae){return T(ae,Y.props.accept)});he===!1&&(ce=ce.slice(0,1)),Y.uploadFiles(ce)}},Y.uploadFiles=function(ge){var he=Array.prototype.slice.call(ge);he.map(function(ce){return ce.uid=D(),ce}).forEach(function(ce){Y.upload(ce,he)})},Y.saveFileInput=function(ge){Y.fileInput=ge},K),p(Y,q)}return o(k,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(K,Y){var q=this,ie=this.props;if(!ie.beforeUpload)return setTimeout(function(){return q.post(K)},0);var Te=ie.beforeUpload(K,Y);Te&&Te.then?Te.then(function(ve){var ge=Object.prototype.toString.call(ve);return ge==="[object File]"||ge==="[object Blob]"?q.post(ve):q.post(K)}).catch(function(ve){console.log(ve)}):Te!==!1&&setTimeout(function(){return q.post(K)},0);return}},{key:"post",value:function(K){var Y=this;if(!this._isMounted)return;var q=this.props,ie=q.onStart,Te=q.onProgress,ve=q.transformFile,ge=ve===void 0?function(he){return he}:ve;new Promise(function(he){var ce=q.action;return typeof ce=="function"&&(ce=ce(K)),he(ce)}).then(function(he){var ce=K.uid,ae=q.customRequest||B,me=Promise.resolve(ge(K)).then(function(J){var ne=q.data;return typeof ne=="function"&&(ne=ne(J)),Promise.all([J,ne])}).catch(function(J){console.error(J)});me.then(function(J){var ne=u(J,2),Z=ne[0],Ee=ne[1],Ae={action:he,filename:q.name,data:Ee,file:Z,headers:q.headers,withCredentials:q.withCredentials,method:q.method||"post",onProgress:Te?function(be){Te(be,K)}:null,onSuccess:function(Se,Re){delete Y.reqs[ce],q.onSuccess(Se,K,Re)},onError:function(Se,Re){delete Y.reqs[ce],q.onError(Se,Re,K)}};ie(K),Y.reqs[ce]=ae(Ae)})})}},{key:"reset",value:function(){this.setState({uid:D()})}},{key:"abort",value:function(K){var Y=this.reqs;if(K){var q=K;K&&K.uid&&(q=K.uid),Y[q]&&Y[q].abort&&Y[q].abort(),delete Y[q]}else Object.keys(Y).forEach(function(ie){Y[ie]&&Y[ie].abort&&Y[ie].abort(),delete Y[ie]})}},{key:"render",value:function(){var K,Y=this.props,q=Y.component,ie=Y.prefixCls,Te=Y.className,ve=Y.disabled,ge=Y.id,he=Y.style,ce=Y.multiple,ae=Y.accept,me=Y.children,J=Y.directory,ne=Y.openFileDialogOnClick,Z=Y.onMouseEnter,Ee=Y.onMouseLeave,Ae=l(Y,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),be=z()((K={},s(K,ie,!0),s(K,ie+"-disabled",ve),s(K,Te,Te),K)),Se=ve?{}:{onClick:ne?this.onClick:function(){},onKeyDown:ne?this.onKeyDown:function(){},onMouseEnter:Z,onMouseLeave:Ee,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return G.a.createElement(q,v({},Se,{className:be,role:"button",style:he}),G.a.createElement("input",v({},A(Ae),{id:ge,type:"file",ref:this.saveFileInput,onClick:function(Ue){return Ue.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ae,directory:J?"directory":null,webkitdirectory:J?"webkitdirectory":null,multiple:ce,onChange:this.onChange})),me)}}]),k}(te.Component),c=b,f=Object.assign||function(W){for(var k=1;k<arguments.length;k++){var O=arguments[k];for(var K in O)Object.prototype.hasOwnProperty.call(O,K)&&(W[K]=O[K])}return W},d=function(){function W(k,O){for(var K=0;K<O.length;K++){var Y=O[K];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(k,Y.key,Y)}}return function(k,O,K){return O&&W(k.prototype,O),K&&W(k,K),k}}();function a(W,k){if(!(W instanceof k))throw new TypeError("Cannot call a class as a function")}function y(W,k){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k&&(typeof k=="object"||typeof k=="function")?k:W}function m(W,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof k);W.prototype=Object.create(k&&k.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),k&&(Object.setPrototypeOf?Object.setPrototypeOf(W,k):W.__proto__=k)}function x(){}var P=function(W){m(k,W);function k(){var O,K,Y,q;a(this,k);for(var ie=arguments.length,Te=Array(ie),ve=0;ve<ie;ve++)Te[ve]=arguments[ve];return q=(K=(Y=y(this,(O=k.__proto__||Object.getPrototypeOf(k)).call.apply(O,[this].concat(Te))),Y),Y.saveUploader=function(ge){Y.uploader=ge},K),y(Y,q)}return d(k,[{key:"abort",value:function(K){this.uploader.abort(K)}},{key:"render",value:function(){return G.a.createElement(c,f({},this.props,{ref:this.saveUploader}))}}]),k}(te.Component);P.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:x,onError:x,onSuccess:x,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var U=P,j=et.a=U},Gytx:function(ut,et){ut.exports=function(te,G,L,z){var I=L?L.call(z,te,G):void 0;if(I!==void 0)return!!I;if(te===G)return!0;if(typeof te!="object"||!te||typeof G!="object"||!G)return!1;var _=Object.keys(te),B=Object.keys(G);if(_.length!==B.length)return!1;for(var F=Object.prototype.hasOwnProperty.bind(G),M=0;M<_.length;M++){var D=_[M];if(!F(D))return!1;var g=te[D],T=G[D];if(I=L?L.call(z,g,T,D):void 0,I===!1||I===void 0&&g!==T)return!1}return!0}},HmJG:function(ut,et,oe){},LdHM:function(ut,et,oe){"use strict";oe.d(et,"b",function(){return l}),oe.d(et,"a",function(){return p});var te=oe("1OyB"),G=oe("vuIU"),L=oe("Ji7U"),z=oe("LK+K"),I=oe("cDcd"),_=oe("rePB"),B=oe("Ff2n"),F=oe("ODXe"),M=oe("4IlW"),D=oe("bX4T"),g=oe("YrtM"),T=oe("TSYQ"),R=oe.n(T),C=oe("+nKL"),w=oe("8OUc"),v=function(K,Y){var q=K.prefixCls,ie=K.id,Te=K.flattenOptions,ve=K.childrenAsData,ge=K.values,he=K.searchValue,ce=K.multiple,ae=K.defaultActiveFirstOption,me=K.height,J=K.itemHeight,ne=K.notFoundContent,Z=K.open,Ee=K.menuItemSelectedIcon,Ae=K.virtual,be=K.onSelect,Se=K.onToggleOpen,Re=K.onActiveValue,Ue=K.onScroll,Ie=K.onMouseEnter,ke="".concat(q,"-item"),Oe=Object(g.a)(function(){return Te},[Z,Te],function(Me,pe){return pe[0]&&Me[1]!==pe[1]}),$e=I.useRef(null),ze=function(pe){pe.preventDefault()},Ve=function(pe){$e.current&&$e.current.scrollTo({index:pe})},Ge=function(pe){for(var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,de=Oe.length,$=0;$<de;$+=1){var Q=(pe+$*ue+de)%de,ee=Oe[Q],se=ee.group,fe=ee.data;if(!se&&!fe.disabled)return Q}return-1},rt=I.useState(function(){return Ge(0)}),Je=Object(F.a)(rt,2),Ye=Je[0],Ce=Je[1],qe=function(pe){Ce(pe);var ue=Oe[pe];if(!ue){Re(null,-1);return}Re(ue.data.value,pe)};I.useEffect(function(){qe(ae!==!1?Ge(0):-1)},[Oe.length,he]),I.useEffect(function(){var Me=setTimeout(function(){if(!ce&&Z&&ge.size===1){var pe=Array.from(ge)[0],ue=Oe.findIndex(function(de){var $=de.data;return $.value===pe});qe(ue),Ve(ue)}});return function(){return clearTimeout(Me)}},[Z]);var Xe=function(pe){pe!==void 0&&be(pe,{selected:!ge.has(pe)}),ce||Se(!1)};if(I.useImperativeHandle(Y,function(){return{onKeyDown:function(pe){var ue=pe.which;switch(ue){case M.a.UP:case M.a.DOWN:{var de=0;if(ue===M.a.UP?de=-1:ue===M.a.DOWN&&(de=1),de!==0){var $=Ge(Ye+de,de);Ve($),qe($)}break}case M.a.ENTER:{var Q=Oe[Ye];Q&&!Q.data.disabled?Xe(Q.data.value):Xe(void 0),Z&&pe.preventDefault();break}case M.a.ESC:Se(!1)}},onKeyUp:function(){},scrollTo:function(pe){Ve(pe)}}}),Oe.length===0)return I.createElement("div",{role:"listbox",id:"".concat(ie,"_list"),className:"".concat(ke,"-empty"),onMouseDown:ze},ne);function Le(Me){var pe=Oe[Me];if(!pe)return null;var ue=pe.data||{},de=ue.value,$=ue.label,Q=ue.children,ee=Object(D.a)(ue,!0),se=ve?Q:$;return pe?I.createElement("div",Object.assign({"aria-label":typeof se=="string"?se:null},ee,{key:Me,role:"option",id:"".concat(ie,"_list_").concat(Me),"aria-selected":ge.has(de)}),de):null}return I.createElement(I.Fragment,null,I.createElement("div",{role:"listbox",id:"".concat(ie,"_list"),style:{height:0,width:0,overflow:"hidden"}},Le(Ye-1),Le(Ye),Le(Ye+1)),I.createElement(C.a,{itemKey:"key",ref:$e,data:Oe,height:me,itemHeight:J,fullHeight:!1,onMouseDown:ze,onScroll:Ue,virtual:Ae,onMouseEnter:Ie},function(Me,pe){var ue,de=Me.group,$=Me.groupOption,Q=Me.data,ee=Q.label,se=Q.key;if(de)return I.createElement("div",{className:R()(ke,"".concat(ke,"-group"))},ee!==void 0?ee:se);var fe=Q.disabled,we=Q.value,_e=Q.title,je=Q.children,Ze=Q.style,We=Q.className,mt=Object(B.a)(Q,["disabled","value","title","children","style","className"]),dt=ge.has(we),at="".concat(ke,"-option"),Et=R()(ke,at,We,(ue={},Object(_.a)(ue,"".concat(at,"-grouped"),$),Object(_.a)(ue,"".concat(at,"-active"),Ye===pe&&!fe),Object(_.a)(ue,"".concat(at,"-disabled"),fe),Object(_.a)(ue,"".concat(at,"-selected"),dt),ue)),xt=ve?je:ee,St=!Ee||typeof Ee=="function"||dt;return I.createElement("div",Object.assign({},mt,{"aria-selected":dt,className:Et,title:_e,onMouseMove:function(){if(Ye===pe||fe)return;qe(pe)},onClick:function(){fe||Xe(we)},style:Ze}),I.createElement("div",{className:"".concat(at,"-content")},xt||we),I.isValidElement(Ee)||dt,St&&I.createElement(w.a,{className:"".concat(ke,"-option-state"),customizeIcon:Ee,customizeIconProps:{isSelected:dt}},dt?"\u2713":null))}))},u=I.forwardRef(v);u.displayName="OptionList";var o=u,s=function(){return null};s.isSelectOption=!0;var l=s,S=function(){return null};S.isSelectOptGroup=!0;var p=S,h=oe("VTBJ"),A=oe("Zm9Q");function b(O){var K=O.key,Y=O.props,q=Y.children,ie=Y.value,Te=Object(B.a)(Y,["children","value"]);return Object(h.a)({key:K,value:ie!==void 0?ie:K,children:q},Te)}function c(O){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(A.a)(O).map(function(Y,q){if(!I.isValidElement(Y)||!Y.type)return null;var ie=Y.type.isSelectOptGroup,Te=Y.key,ve=Y.props,ge=ve.children,he=Object(B.a)(ve,["children"]);return K||!ie?b(Y):Object(h.a)(Object(h.a)({key:"__RC_SELECT_GRP__".concat(Te===null?q:Te,"__"),label:Te},he),{},{options:c(ge)})}).filter(function(Y){return Y})}var f=oe("2Qr1"),d=oe("qNPg"),a=oe("U8pU"),y=oe("Kwbf"),m=oe("WKfj");function x(O){var K=O.mode,Y=O.options,q=O.children,ie=O.backfill,Te=O.allowClear,ve=O.placeholder,ge=O.getInputElement,he=O.showSearch,ce=O.onSearch,ae=O.defaultOpen,me=O.autoFocus,J=O.labelInValue,ne=O.value,Z=O.inputValue,Ee=O.optionLabelProp,Ae=K==="multiple"||K==="tags",be=he!==void 0?he:Ae||K==="combobox",Se=Y||c(q);if(Object(y.a)(K!=="tags"||Se.every(function(ke){return!ke.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),K==="tags"||K==="combobox"){var Re=Se.some(function(ke){return ke.options?ke.options.some(function(Oe){return typeof("value"in Oe?Oe.value:Oe.key)=="number"}):typeof("value"in ke?ke.value:ke.key)=="number"});Object(y.a)(!Re,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(y.a)(K!=="combobox"||!Ee,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(y.a)(K==="combobox"||!ie,"`backfill` only works with `combobox` mode."),Object(y.a)(K==="combobox"||!ge,"`getInputElement` only work with `combobox` mode."),Object(y.b)(K!=="combobox"||!ge||!Te||!ve,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),ce&&!be&&K!=="combobox"&&K!=="tags"&&Object(y.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(y.b)(!ae||me,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ne!=null){var Ue=Object(m.d)(ne);Object(y.a)(!J||Ue.every(function(ke){return Object(a.a)(ke)==="object"&&("key"in ke||"value"in ke)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(y.a)(!Ae||Array.isArray(ne),"`value` should be array when `mode` is `multiple` or `tags`")}if(q){var Ie=null;Object(A.a)(q).some(function(ke){if(!I.isValidElement(ke)||!ke.type)return!1;var Oe=ke.type;if(Oe.isSelectOption)return!1;if(Oe.isSelectOptGroup){var $e=Object(A.a)(ke.props.children).every(function(ze){return!I.isValidElement(ze)||!ke.type||ze.type.isSelectOption?!0:(Ie=ze.type,!1)});return!$e}return Ie=Oe,!0}),Ie&&Object(y.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ie.displayName||Ie.name||Ie,"`.")),Object(y.a)(Z===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var P=x,U=Object(d.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:c,flattenOptions:f.d,getLabeledValue:f.e,filterOptions:f.b,isValueDisabled:f.g,findValueOption:f.c,warningProps:P,fillOptionsWithMissingValue:f.a}),j=function(O){Object(L.a)(Y,O);var K=Object(z.a)(Y);function Y(){var q;return Object(te.a)(this,Y),q=K.apply(this,arguments),q.selectRef=I.createRef(),q.focus=function(){q.selectRef.current.focus()},q.blur=function(){q.selectRef.current.blur()},q}return Object(G.a)(Y,[{key:"render",value:function(){return I.createElement(U,Object.assign({ref:this.selectRef},this.props))}}]),Y}(I.Component);j.Option=l,j.OptGroup=p;var W=j,k=et.c=W},M8RZ:function(ut,et,oe){"use strict";oe.d(et,"a",function(){return M});var te=oe("fWQN"),G=oe("mtLc"),L=oe("yKVA"),z=oe("879j"),I=oe("cDcd"),_=oe.n(I),B=oe("faye"),F=oe.n(B),M=function(D){Object(L.a)(T,D);var g=Object(z.a)(T);function T(R){var C;Object(te.a)(this,T),C=g.call(this,R);var w=window.document;return C.node=w.createElement("div"),w.body.appendChild(C.node),C}return Object(G.a)(T,[{key:"render",value:function(){var C=this.props.children;return Object(B.createPortal)(C,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),T}(_.a.Component)},OLES:function(ut,et,oe){"use strict";var te=oe("U8pU"),G=oe("VTBJ"),L=oe("Ff2n"),z=oe("cDcd"),I=oe("uciX"),_=oe("7ixt"),B=function(R){var C=R.overlay,w=R.prefixCls,v=R.id,u=R.overlayInnerStyle;return z.createElement("div",{className:"".concat(w,"-inner"),id:v,role:"tooltip",style:u},typeof C=="function"?C():C)},F=B,M=function(R,C){var w=R.overlayClassName,v=R.trigger,u=v===void 0?["hover"]:v,o=R.mouseEnterDelay,s=o===void 0?0:o,l=R.mouseLeaveDelay,S=l===void 0?.1:l,p=R.overlayStyle,h=R.prefixCls,A=h===void 0?"rc-tooltip":h,b=R.children,c=R.onVisibleChange,f=R.afterVisibleChange,d=R.transitionName,a=R.animation,y=R.placement,m=y===void 0?"right":y,x=R.align,P=x===void 0?{}:x,U=R.destroyTooltipOnHide,j=U===void 0?!1:U,W=R.defaultVisible,k=R.getTooltipContainer,O=R.overlayInnerStyle,K=Object(L.a)(R,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),Y=Object(z.useRef)(null);Object(z.useImperativeHandle)(C,function(){return Y.current});var q=Object(G.a)({},K);"visible"in R&&(q.popupVisible=R.visible);var ie=function(){var ce=R.arrowContent,ae=ce===void 0?null:ce,me=R.overlay,J=R.id;return[z.createElement("div",{className:"".concat(A,"-arrow"),key:"arrow"},ae),z.createElement(F,{key:"content",prefixCls:A,id:J,overlay:me,overlayInnerStyle:O})]},Te=!1,ve=!1;if(typeof j=="boolean")Te=j;else if(j&&Object(te.a)(j)==="object"){var ge=j.keepParent;Te=ge===!0,ve=ge===!1}return z.createElement(I.a,Object.assign({popupClassName:w,prefixCls:A,popup:ie,action:u,builtinPlacements:_.a,popupPlacement:m,ref:Y,popupAlign:P,getPopupContainer:k,onPopupVisibleChange:c,afterPopupVisibleChange:f,popupTransitionName:d,popupAnimation:a,defaultPopupVisible:W,destroyPopupOnHide:Te,autoDestroy:ve,mouseLeaveDelay:S,popupStyle:p,mouseEnterDelay:s},q),b)},D=Object(z.forwardRef)(M),g=et.a=D},Ot1p:function(ut,et,oe){"use strict";var te=oe("2qtc"),G=oe("kLXV"),L=oe("rAM+"),z=oe("miYZ"),I=oe("tsqr"),_=oe("9og8"),B=oe("tJVT"),F=oe("jrin"),M=oe("WmNS"),D=oe.n(M),g=oe("cDcd"),T=oe.n(g),R=oe("VrN/"),C=oe.n(R),w=oe("bdgK"),v=oe("p77/"),u=oe("Bd2K"),o=oe("ELLl"),s=oe("19Vz"),l=oe("lZu9"),S=oe("+NIl"),p=oe("kSUc"),h=oe("9Bee"),A=function(fe){var we=fe.value,_e=we===void 0?"":we,je=fe.className,Ze=fe.showTextOnly,We=fe.showLines,mt=fe.style,dt=mt===void 0?{}:mt,at=Object(g.useMemo)(function(){return""},[_e]);return T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{dangerouslySetInnerHTML:{__html:at}}))},b=oe("0Owb"),c=oe("dejd"),f=oe("C+DQ"),d=oe("1vsH"),a=oe("m3rI"),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 m(fe){var we=fe.onActionCallback,_e=fe.title,je=fe.icon,Ze=fe.actionName,We=fe.className,mt=We===void 0?"":We,dt=fe.children;function at(){we(Ze)}return T.a.createElement("a",{title:_e,className:mt,onClick:at},T.a.createElement("i",{className:"md-iconfont ".concat(je)}),dt)}var x=function(fe){var we=fe.watch,_e=fe.showNullButton,je=fe.onActionCallback,Ze=fe.fullScreen,We=fe.insertTemp,mt=fe.hidetoolBar,dt=fe.uuid,at=fe.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(d.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(d.G)("_educoder_session"),"&key=").concat(dt,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Et=[].concat(y,[{title:"".concat(we?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(we?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return T.a.createElement("ul",{className:"markdown-toolbar-container"},!mt&&Et.map(function(xt,St){return T.a.createElement("li",{key:St},xt.actionName?T.a.createElement(m,Object(b.a)({},xt,{onActionCallback:je})):T.a.createElement("span",{className:"v-line"}))}),_e?T.a.createElement("li",null,T.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:je},T.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,We&&T.a.createElement("li",null,T.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(We),onActionCallback:je},T.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),T.a.createElement("li",{className:"btn-full-screen"},T.a.createElement(m,{icon:"".concat(Ze?"icon-shrink":"icon-enlarge"),title:Ze?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:je})))},P=oe("M8RZ"),U=oe("+L6B"),j=oe("2/Rp"),W=oe("y8nQ"),k=oe("Vl3Y"),O=oe("5NDa"),K=oe("5rEg"),Y={labelCol:{span:4},wrapperCol:{span:20}},q=function(fe){var we=fe.callback,_e=fe.onCancel;function je(Ze){we(Ze)}return T.a.createElement(k.a,Object(b.a)({},Y,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:je}),T.a.createElement(k.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},T.a.createElement(K.a,null)),T.a.createElement(k.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},T.a.createElement(K.a,null)),T.a.createElement("div",{className:"flex-container flex-end"},T.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(j.a,{type:"ghost",onClick:_e},"\u53D6\u6D88")))},ie=oe("7ahc"),Te=oe("HmJG"),ve=oe("BjJ7"),ge=k.a.useForm,he={width:280,marginRight:10},ce={labelCol:{span:5},wrapperCol:{span:19}},ae=function(fe){var we=fe.callback,_e=fe.onCancel,je=ge(),Ze=Object(B.a)(je,1),We=Ze[0];function mt(Et){we(Et)}function dt(Et,xt){if(Et.status===-1){I.b.error(Et.message);return}We.setFieldsValue({src:"/api/attachments/".concat(Et.id),type:xt.type})}function at(Et){var xt=Et.target.files[0];J(xt,dt)}return T.a.createElement(k.a,Object(b.a)({form:We},ce,{className:"upload-image-panel",onFinish:mt}),T.a.createElement(k.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},T.a.createElement("div",{className:"flex-container"},T.a.createElement(k.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},T.a.createElement(K.a,{style:he})),T.a.createElement(me,{onFileChange:at}))),T.a.createElement(k.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},T.a.createElement(K.a,{style:{width:264}})),T.a.createElement(k.a.Item,{style:{textAlign:"right"}},T.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(j.a,{type:"ghost",onClick:_e},"\u53D6\u6D88")))};function me(fe){var we=fe.onFileChange;return T.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",T.a.createElement("input",{type:"file",onChange:we}))}function J(fe,we){if(!fe)throw new String("\u6CA1\u6709\u6587\u4EF6");var _e=new FormData;_e.append("editormd-image-file",fe),_e.append("file_param_name","editormd-image-file"),_e.append("byxhr","true");var je=new window.XMLHttpRequest;je.withCredentials=!0,je.addEventListener("load",function(Ze){we(JSON.parse(Ze.target.responseText),fe)},!1),je.addEventListener("error",function(Ze){console.error(Ze)},!1),je.open("POST","".concat(ve.a,"/api/attachments.json")),je.send(_e)}var ne=oe("giR+"),Z=oe("fyUT"),Ee=oe("7Kak"),Ae=oe("9yH6"),be=Ae.a.Group,Se={margin:"0 8px"},Re=function(fe){var we=fe.callback,_e=fe.onCancel;function je(Ze){we(Ze)}return T.a.createElement(k.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:je},T.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},T.a.createElement("span",{style:Se},"\u5355\u5143\u683C\u6570\uFF1A"),T.a.createElement("span",{style:Se},"\u884C\u6570"),T.a.createElement(k.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},T.a.createElement(Z.a,null)),T.a.createElement("span",{style:Se},"\u5217\u6570"),T.a.createElement(k.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},T.a.createElement(Z.a,null))),T.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},T.a.createElement("span",{style:Se},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),T.a.createElement(k.a.Item,{name:"align"},T.a.createElement(be,null,T.a.createElement(Ae.a,{value:"default"},T.a.createElement("i",{className:"fa fa-align-justify"})),T.a.createElement(Ae.a,{value:"left"},T.a.createElement("i",{className:"fa fa-align-left"})),T.a.createElement(Ae.a,{value:"center"},T.a.createElement("i",{className:"fa fa-align-center"})),T.a.createElement(Ae.a,{value:"right"},T.a.createElement("i",{className:"fa fa-align-right"}))))),T.a.createElement("div",{className:"flex-container flex-end"},T.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(j.a,{type:"ghost",onClick:_e},"\u53D6\u6D88")))},Ue=oe("ErOA"),Ie=oe("7Cbv"),ke="link",Oe="upload-image",$e="code-block",ze="add-table",Ve="------------",Ge={default:Ve,left:":".concat(Ve),center:":".concat(Ve,":"),right:"".concat(Ve,":")},rt=oe("9VGf"),Je,Ye;function Ce(){}var qe=0,Xe=1e4,Le="\u2581",Me=`
|
|
**\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 pe(fe){return/^\d+$/.test(fe)?"".concat(fe,"px"):fe}var ue=navigator.platform.toUpperCase().indexOf("MAC")>=0,de=ue?"Cmd":"Ctrl",$=["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"],Q=(Je={},Object(F.a)(Je,de+"-B","bold"),Object(F.a)(Je,de+"-I","italic"),Je),ee=(Ye={},Object(F.a)(Ye,ke,"\u6DFB\u52A0\u94FE\u63A5"),Object(F.a)(Ye,$e,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(F.a)(Ye,Oe,"\u6DFB\u52A0\u6587\u4EF6"),Object(F.a)(Ye,ze,"\u6DFB\u52A0\u8868\u683C"),Ye),se=et.a=function(fe){var we=fe.defaultValue,_e=we===void 0?"":we,je=fe.onChange,Ze=fe.width,We=Ze===void 0?"100%":Ze,mt=fe.height,dt=mt===void 0?400:mt,at=fe.miniToolbar,Et=at===void 0?!1:at,xt=fe.isFocus,St=xt===void 0?!1:xt,Dt=fe.watch,yt=fe.insertTemp,or=fe.mode,kr=or===void 0?"markdown":or,ur=fe.id,gr=ur===void 0?"markdown-editor-id":ur,hr=fe.showResizeBar,ia=hr===void 0?!1:hr,Ar=fe.noStorage,Hn=Ar===void 0?!1:Ar,Kn=fe.showNullButton,Pt=Kn===void 0?!1:Kn,nt=fe.hidetoolBar,_r=nt===void 0?!1:nt,pn=fe.fullScreen,Zt=pn===void 0?!1:pn,wt=fe.onBlur,vr=fe.onCMBeforeChange,Pr=fe.onFullScreen,mn=fe.className,Fe=mn===void 0?"":mn,ct=fe.disablePaste,Gn=ct===void 0?!1:ct,gn=fe.placeholder,vn=gn===void 0?"":gn,Qr=fe.values,yn=Qr===void 0?"":Qr,ht=Object(g.useState)(null),Ai=Object(B.a)(ht,2),Ne=Ai[0],bn=Ai[1],pr=Object(g.useState)(_e),zn=Object(B.a)(pr,2),Zr=zn[0],yr=zn[1],Vn=Object(g.useState)(Dt),Xn=Object(B.a)(Vn,2),br=Xn[0],Yn=Xn[1],Li=Object(g.useState)(Zt),$n=Object(B.a)(Li,2),xr=$n[0],Di=$n[1],aa=Object(g.useState)(""),Jn=Object(B.a)(aa,2),$t=Jn[0],Wr=Jn[1],oa=Object(g.useState)(0),qr=Object(B.a)(oa,2),Er=qr[0],Qn=qr[1],sa=Object(g.useState)(dt),Oi=Object(B.a)(sa,2),Ri=Oi[0],xn=Oi[1],ki=Object(g.useState)(!1),_i=Object(B.a)(ki,2),la=_i[0],En=_i[1],en=Object(g.useRef)(Object(Ie.a)()),tn=Object(g.useRef)(!1),Tn=Object(g.useRef)(),Mr=Object(g.useRef)(),Ir=Object(g.useRef)(),Ur=Object(g.useRef)(),Sn=Object(g.useRef)(),Pi=function(){var it=Object(_.a)(D.a.mark(function ft(){var st,gt;return D.a.wrap(function(Ot){for(;;)switch(Ot.prev=Ot.next){case 0:return Ot.next=2,Object(Ue.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:en.current}});case 2:gt=Ot.sent,gt!=null&&(st=gt.attachments)!==null&&st!==void 0&&st.length&&(console.log("cm:",Ne,Mr),gt.attachments.map(function(bt){bt.content_type.indexOf("image")>-1?Ne.replaceSelection(".concat(bt.content_type,")")):bt.content_type.indexOf("video")>-1?Ne.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):bt.content_type.indexOf("pdf")>-1?Ne.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(bt.id,"?type=").concat(bt.content_type,'&disposition=inline" target="_blank">').concat(bt.name,"</a>")):Ne.replaceSelection("[".concat(bt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(bt.id,"?type=").concat(bt.content_type,")"))}));case 4:case"end":return Ot.stop()}},ft)}));return function(){return it.apply(this,arguments)}}();Object(g.useEffect)(function(){yr(yn),Ne==null||Ne.setValue(yn)},[yn]),Object(g.useEffect)(function(){Pr==null||Pr(xr)},[xr]),Object(g.useEffect)(function(){if(Mr.current){var it=C.a.fromTextArea(Mr.current,{mode:kr,lineNumbers:!Et,lineWrapping:!0,value:_e,autoCloseTags:!0,autoCloseBrackets:!0});St&&it.focus();function ft(st,gt){if(Gn){gt.preventDefault();return}var Tt=gt.clipboardData;if(Tt){var Ot=Tt.types.toString(),bt=Tt.items;if(Ot==="Files"||Tt.types.indexOf("Files")>-1){if(gt.preventDefault(),kr=="stex")return;try{var Nt,qt=bt[1];((Nt=bt[0])===null||Nt===void 0?void 0:Nt.kind)==="file"&&(qt=bt[0]);var vt=qt.getAsFile(),Fr=vt.name.split(".").pop();J(vt,function(Ct){if(Ct.id){var er,Vt,mr;(vt==null||((er=vt.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?it.replaceSelection(".concat(Ct.content_type,")")):(vt==null||((Vt=vt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?it.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ct.id,'"></video>')):(vt==null||((mr=vt.type)===null||mr===void 0)?void 0:mr.indexOf("pdf"))>-1?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(vt.type,'&disposition=inline" target="_blank">').concat(vt.name,"</a>")):$.includes(Fr)?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ct.id,'?type=office&disposition=inline" target="_blank">').concat(vt.name,"</a>")):it.replaceSelection("[".concat(vt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Ct.content_type,")"))}else(Ct==null?void 0:Ct.status)===401&&(document.location.href="/user/login")})}catch(Ct){I.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return it.on("paste",ft),it.on("dragleave",function(st,gt){Ir.current.classList.remove("mouse-hover-md")}),it.on("dragover",function(st,gt){Ir.current.classList.add("mouse-hover-md")}),it.on("drop",function(st,gt){Ir.current.classList.add("mouse-hover-md");var Tt;if(Tt=gt.dataTransfer.files,Tt.length>0){gt.preventDefault(),gt.stopPropagation();for(var Ot=function(qt){var vt=Tt[qt],Fr=vt.name.split(".").pop();J(vt,function(Ct){if(Ct.id){var er,Vt,mr;(vt==null||((er=vt.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?it.replaceSelection(".concat(Ct.content_type,")")):(vt==null||((Vt=vt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?it.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ct.id,'"></video>')):(vt==null||((mr=vt.type)===null||mr===void 0)?void 0:mr.indexOf("pdf"))>-1?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(vt.type,'&disposition=inline" target="_blank">').concat(vt.name,"</a>")):$.includes(Fr)?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ct.id,'?type=office&disposition=inline" target="_blank">').concat(vt.name,"</a>")):it.replaceSelection("[".concat(vt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Ct.content_type,")"))}else(Ct==null?void 0:Ct.status)===401&&(document.location.href="/user/login")})},bt=0;bt<Tt.length;bt++)Ot(bt)}}),bn(it),function(){it.off("paste",ft)}}},[]);var dr=Object(g.useCallback)(function(){if(Ir.current)try{}catch(it){console.log(it,"---- to set md editor body height")}},[Ri,Ir,xr]);Object(g.useEffect)(function(){function it(){var st=new w.default(function(gt){var Tt=Object(L.a)(gt),Ot;try{for(Tt.s();!(Ot=Tt.n()).done;){var bt=Ot.value;(bt.target.offsetHeight>0||bt.target.offsetWidth>0)&&(dr(),Ne.setSize("100%","100%"),Ne.refresh())}}catch(Nt){Tt.e(Nt)}finally{Tt.f()}});return st.observe(Mr.current.parentElement),st}if(Ne){var ft=it();return function(){ft.unobserve(Mr.current.parentElement)}}},[Ne,dr]),Object(g.useEffect)(function(){if(Ne){for(var it=[],ft=function(){var bt=gt[st];Tt=Object(B.a)(bt,2);var Nt=Tt[0],qt=Tt[1],vt=Object(F.a)({},Nt,function(){Mi(qt)});it.push(vt),Ne.addKeyMap(vt)},st=0,gt=Object.entries(Q);st<gt.length;st++){var Tt;ft()}return Tn.current=setInterval(function(){tn.current&&Pi()},4e3),function(){clearInterval(Tn.current);var Ot=Object(L.a)(it),bt;try{for(Ot.s();!(bt=Ot.n()).done;){var Nt=bt.value;Ne.removeKeyMap(Nt)}}catch(qt){Ot.e(qt)}finally{Ot.f()}}}},[Ne]),Object(g.useEffect)(function(){Zt!==xr&&Di(Zt)},[Zt]),Object(rt.a)(function(){if(!Hn&&Er>0){var it=new Date().getTime(),ft=window.sessionStorage.getItem(gr);it>=Er+Xe&&(!ft||ft!==Zr)&&(window.sessionStorage.setItem(gr,Zr),En(!0))}},Xe),Object(g.useEffect)(function(){Yn(Dt)},[Ne,Dt]),Object(g.useEffect)(function(){Ne&&(St&&Ne.focus())},[Ne,St]),Object(g.useEffect)(function(){if(br&&Ne){var it=Ne.getScrollerElement();function ft(st){var gt=st.target;if(Sn.current){var Tt=gt.scrollTop/gt.scrollHeight;Sn.current.scrollTop=Sn.current.scrollHeight*Tt}}return it.addEventListener("scroll",ft),function(){it.removeEventListener("scroll",ft)}}},[Ne,br]),Object(g.useEffect)(function(){if(Ne&&vr){function it(ft,st){vr(ft,st)}return Ne.on("beforeChange",it),function(){Ne.off("beforeChange",it)}}},[Ne,vr]),Object(g.useEffect)(function(){if(Ne&&wt){function it(){wt(Ne.getValue())}return Ne.on("blur",it),function(){Ne.off("blur",it)}}},[Ne,wt]),Object(g.useEffect)(function(){if(Ne){function it(ft){var st=ft.getValue();yr(st),Qn(new Date().getTime()),ft.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),je&&je(st)}return Ne.on("change",it),function(){Ne.off("change",it)}}},[Ne,je]),Object(g.useEffect)(function(){Ne&&(_e==null?(Ne.setValue(""),yr("")):_e!==Ne.getValue()&&(Ne.setValue(_e),yr(_e),Ne.setCursor(Ne.lineCount(),0)))},[Ne,_e]);var Mi=Object(g.useCallback)(function(it){var ft=Ne.getCursor(),st=Ne.getSelection(),gt=st.split(`
|
|
`);switch(it){case"bold":return Ne.replaceSelection("**"+st+"**"),st===""&&Ne.setCursor(ft.line,ft.ch+2),Ne.focus();case"italic":return Ne.replaceSelection("*"+st+"*"),st===""&&Ne.setCursor(ft.line,ft.ch+1),Ne.focus();case"code":return Ne.replaceSelection("`"+st+"`"),st===""&&Ne.setCursor(ft.line,ft.ch+1),Ne.focus();case"inline-latex":return Ne.replaceSelection("`$$"+st+"$$`"),st===""&&Ne.setCursor(ft.line,ft.ch+3),Ne.focus();case"latex":return Ne.replaceSelection("```latex\n"+st+"\n```"),Ne.setCursor(ft.line+1,st.length+1),Ne.focus();case"line-break":return Ne.replaceSelection(`<br/>
|
|
`),Ne.focus();case"list-ul":return st===""?Ne.replaceSelection("- "+st):Ne.replaceSelection(gt.map(function(Tt){return Tt===""?"":"- ".concat(Tt)}).join(`
|
|
`)),Ne.focus();case"list-ol":return st===""?Ne.replaceSelection("1. "+st):Ne.replaceSelection(gt.map(function(Tt,Ot){return Tt===""?"":"".concat(Ot+1,". ").concat(Tt)}).join(`
|
|
`)),Ne.focus();case"add-null-ch":return st===""&&Ne.setCursor(ft.line,ft.ch+1),Ne.replaceSelection(Le),Ne.focus();case"inster-template-1":return st===""&&Ne.setCursor(ft.line,ft.ch),Ne.replaceSelection(Me),Ne.focus();case"eraser":return Ne.setValue(""),Ne.focus();case"trigger-watch":return Yn(!br),Ne.focus();case"trigger-full-screen":return Di(!xr),Ne.focus();case ke:Wr(ke);return;case $e:Wr($e);return;case Oe:Wr(Oe);return;case ze:Wr(ze);return;default:throw new Error}},[Ne,br,xr]),wn=Object(g.useCallback)(function(it){Wr("");switch($t){case ke:var ft=it.title,st=it.link;return Ne.replaceSelection("[".concat(ft,"](").concat(st,")")),Ne.focus();case $e:var gt=it.language,Tt=it.content;return Ne.replaceSelection(["```"+gt,Tt,"```"].join(`
|
|
`)),Ne.focus();case Oe:var Ot=it.src,bt=it.alt;return bt?Ne.replaceSelection(".concat(Ot,' "').concat(bt,'" )')):Ne.replaceSelection("")),Ne.focus();case ze:for(var Nt=it.row,qt=it.col,vt=it.align,Fr=`
|
|
`,Ct=0;Ct<Nt;Ct++){for(var er=[],Vt=[],mr=0;mr<qt;mr++)Ct===1&&Vt.push(Ge[vt]),er.push(" ");Ct===1&&(Fr+="| ".concat(Vt.join(" | "),` |
|
|
`)),Fr+="| ".concat(er.join(qt===1?"":" | "),` |
|
|
`)}return Ne.replaceSelection(Fr+`
|
|
`),Ne.focus();default:throw new Error}},[Ne,$t]),Zn=Object(g.useMemo)(function(){switch($t){case ke:return T.a.createElement(q,{callback:wn,onCancel:Hr});case $e:return T.a.createElement(ie.b,{callback:wn,onCancel:Hr});case Oe:return T.a.createElement(ae,{callback:wn,onCancel:Hr});case ze:return T.a.createElement(Re,{callback:wn,onCancel:Hr});default:return null}},[$t]);function Hr(){Wr("")}Object(g.useEffect)(function(){if(Ur.current){var it=Ur.current,ft=!1,st=0;function gt(bt){ft=!0,st=bt.pageY}function Tt(){ft=!1}function Ot(bt){if(ft){var Nt=bt.pageY-st;Nt<0&&(Nt=0),Nt>300&&(Nt=300);var qt=dt+Nt+"px";xn(qt)}}return it.addEventListener("mousedown",gt),document.addEventListener("mousemove",Ot),document.addEventListener("mouseup",Tt),function(){it.removeEventListener("mousedown",gt),document.removeEventListener("mousemove",Ot),document.removeEventListener("mouseup",Tt)}}},[Ne,Ur]),Object(g.useEffect)(function(){xn(dt)},[dt]);var Lr=pe(We),qn=pe(Ri),Tr={width:Lr,height:qn},ei=Object(g.useMemo)(function(){if(Er){var it=new Date(Er),ft=it.getHours(),st=it.getMinutes(),gt=it.getSeconds();return ft=ft<10?"0"+ft:ft,st=st<10?"0"+st:st,gt=gt<10?"0"+gt:gt,"".concat(ft,":").concat(st,":").concat(gt)}return 0},[Er]);function Ii(){window.sessionStorage.removeItem(gr),En(!1),Qn(0)}function rn(){En(!1),Qn(0),Ne.setValue(window.sessionStorage.getItem(gr))}function ua(it,ft){var st=Ne.getValue();st=st.replace(it,ft),yr(st),Ne==null||Ne.setValue(st)}return T.a.createElement(g.Fragment,null,T.a.createElement("div",{className:"markdown-editor-wrapper",ref:Ir},T.a.createElement("div",{className:"markdown-editor-container ".concat(Fe," ").concat(br?"on-preview":""," ").concat(Et?"mini":""," ").concat(xr?"full-screen":""),style:Tr},T.a.createElement(x,{insertTemp:yt,watch:br,fullScreen:xr,showNullButton:Pt,onActionCallback:Mi,hidetoolBar:_r,uuid:en.current,setOpenPhones:function(){tn.current=!0}}),T.a.createElement("div",{className:"markdown-editor-body"},T.a.createElement("div",{className:"codemirror-container"},T.a.createElement("textarea",{ref:Mr,placeholder:vn})),br?T.a.createElement("div",{ref:Sn,className:"preview-container"},kr==="stex"&&T.a.createElement(A,{value:Zr}),kr!=="stex"&&T.a.createElement(h.a,{edit:!0,value:Zr,replaces:ua})):null))),ia?T.a.createElement("a",{ref:Ur,className:"editor-resize"}):null,T.a.createElement(P.a,null,ee[$t]?T.a.createElement(G.a,{centered:!0,title:ee[$t],visible:!0,onCancel:Hr,footer:null,className:"markdown-popup-form"},Zn):null))}},SJMd:function(ut,et){/**
|
|
* @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 oe,te,G,L=!1,z,I;window.PR_SHOULD_USE_CONTINUATION=!0;var _,B;(function(){var F=window,M=["break,continue,do,else,for,if,return,while"],D=[M,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],g=[D,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],T=[g,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],R=[g,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],C=[g,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],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",v=[g,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],u="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[M,"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=[M,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],l=[M,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],S=[T,C,R,v,u,o,s,l],p=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,h="str",A="kwd",b="com",c="typ",f="lit",d="pun",a="pln",y="tag",m="dec",x="src",P="atn",U="atv",j="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(be){for(var Se=0,Re=!1,Ue=!1,Ie=0,ke=be.length;Ie<ke;++Ie){var Oe=be[Ie];if(Oe.ignoreCase)Ue=!0;else if(/[a-z]/i.test(Oe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Re=!0,Ue=!1;break}}var $e={b:8,t:9,n:10,v:11,f:12,r:13};function ze(Ye){var Ce=Ye.charCodeAt(0);if(Ce!==92)return Ce;var qe=Ye.charAt(1);return Ce=$e[qe],Ce||("0"<=qe&&qe<="7"?parseInt(Ye.substring(1),8):qe==="u"||qe==="x"?parseInt(Ye.substring(2),16):Ye.charCodeAt(1))}function Ve(Ye){if(Ye<32)return(Ye<16?"\\x0":"\\x")+Ye.toString(16);var Ce=String.fromCharCode(Ye);return Ce==="\\"||Ce==="-"||Ce==="]"||Ce==="^"?"\\"+Ce:Ce}function Ge(Ye){var Ce=Ye.substring(1,Ye.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),qe=[],Xe=Ce[0]==="^",Le=["["];Xe&&Le.push("^");for(var Me=Xe?1:0,pe=Ce.length;Me<pe;++Me){var ue=Ce[Me];if(/\\[bdsw]/i.test(ue))Le.push(ue);else{var de=ze(ue),$;Me+2<pe&&Ce[Me+1]==="-"?($=ze(Ce[Me+2]),Me+=2):$=de,qe.push([de,$]),$<65||de>122||($<65||de>90||qe.push([Math.max(65,de)|32,Math.min($,90)|32]),$<97||de>122||qe.push([Math.max(97,de)&~32,Math.min($,122)&~32]))}}qe.sort(function(fe,we){return fe[0]-we[0]||we[1]-fe[1]});for(var Q=[],ee=[],Me=0;Me<qe.length;++Me){var se=qe[Me];se[0]<=ee[1]+1?ee[1]=Math.max(ee[1],se[1]):Q.push(ee=se)}for(var Me=0;Me<Q.length;++Me){var se=Q[Me];Le.push(Ve(se[0])),se[1]>se[0]&&(se[1]+1>se[0]&&Le.push("-"),Le.push(Ve(se[1])))}return Le.push("]"),Le.join("")}function rt(Ye){for(var Ce=Ye.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),qe=Ce.length,Xe=[],Le=0,Me=0;Le<qe;++Le){var pe=Ce[Le];if(pe==="(")++Me;else if(pe.charAt(0)==="\\"){var ue=+pe.substring(1);ue&&(ue<=Me?Xe[ue]=-1:Ce[Le]=Ve(ue))}}for(var Le=1;Le<Xe.length;++Le)Xe[Le]===-1&&(Xe[Le]=++Se);for(var Le=0,Me=0;Le<qe;++Le){var pe=Ce[Le];if(pe==="(")++Me,Xe[Me]||(Ce[Le]="(?:");else if(pe.charAt(0)==="\\"){var ue=+pe.substring(1);ue&&ue<=Me&&(Ce[Le]="\\"+Xe[ue])}}for(var Le=0;Le<qe;++Le)Ce[Le]==="^"&&Ce[Le+1]!=="^"&&(Ce[Le]="");if(Ye.ignoreCase&&Re)for(var Le=0;Le<qe;++Le){var pe=Ce[Le],de=pe.charAt(0);pe.length>=2&&de==="["?Ce[Le]=Ge(pe):de!=="\\"&&(Ce[Le]=pe.replace(/[a-zA-Z]/g,function(ee){var se=ee.charCodeAt(0);return"["+String.fromCharCode(se&~32,se|32)+"]"}))}return Ce.join("")}for(var Je=[],Ie=0,ke=be.length;Ie<ke;++Ie){var Oe=be[Ie];if(Oe.global||Oe.multiline)throw new Error(""+Oe);Je.push("(?:"+rt(Oe)+")")}return new RegExp(Je.join("|"),Ue?"gi":"g")}function O(be,Se){var Re=/(?:^|\s)nocode(?:\s|$)/,Ue=[],Ie=0,ke=[],Oe=0;function $e(ze){var Ve=ze.nodeType;if(Ve==1){if(Re.test(ze.className))return;for(var Ge=ze.firstChild;Ge;Ge=Ge.nextSibling)$e(Ge);var rt=ze.nodeName.toLowerCase();(rt==="br"||rt==="li")&&(Ue[Oe]=`
|
|
`,ke[Oe<<1]=Ie++,ke[Oe++<<1|1]=ze)}else if(Ve==3||Ve==4){var Je=ze.nodeValue;Je.length&&(Se?Je=Je.replace(/\r\n?/g,`
|
|
`):Je=Je.replace(/[ \t\r\n]+/g," "),Ue[Oe]=Je,ke[Oe<<1]=Ie,Ie+=Je.length,ke[Oe++<<1|1]=ze)}}return $e(be),{sourceCode:Ue.join("").replace(/\n$/,""),spans:ke}}function K(be,Se,Re,Ue,Ie){if(!Re)return;var ke={sourceNode:be,pre:1,langExtension:null,numberLines:null,sourceCode:Re,spans:null,basePos:Se,decorations:null};Ue(ke),Ie.push.apply(Ie,ke.decorations)}var Y=/\S/;function q(be){for(var Se=void 0,Re=be.firstChild;Re;Re=Re.nextSibling){var Ue=Re.nodeType;Se=Ue===1?Se?be:Re:Ue===3&&Y.test(Re.nodeValue)?be:Se}return Se===be?void 0:Se}function ie(be,Se){var Re={},Ue;(function(){for(var Oe=be.concat(Se),$e=[],ze={},Ve=0,Ge=Oe.length;Ve<Ge;++Ve){var rt=Oe[Ve],Je=rt[3];if(Je)for(var Ye=Je.length;--Ye>=0;)Re[Je.charAt(Ye)]=rt;var Ce=rt[1],qe=""+Ce;ze.hasOwnProperty(qe)||($e.push(Ce),ze[qe]=null)}$e.push(/[\0-\uffff]/),Ue=k($e)})();var Ie=Se.length,ke=function(Oe){for(var $e=Oe.sourceCode,ze=Oe.basePos,Ve=Oe.sourceNode,Ge=[ze,a],rt=0,Je=$e.match(Ue)||[],Ye={},Ce=0,qe=Je.length;Ce<qe;++Ce){var Xe=Je[Ce],Le=Ye[Xe],Me=void 0,pe;if(typeof Le=="string")pe=!1;else{var ue=Re[Xe.charAt(0)];if(ue)Me=Xe.match(ue[1]),Le=ue[0];else{for(var de=0;de<Ie;++de)if(ue=Se[de],Me=Xe.match(ue[1]),Me){Le=ue[0];break}Me||(Le=a)}pe=Le.length>=5&&Le.substring(0,5)==="lang-",pe&&!(Me&&typeof Me[1]=="string")&&(pe=!1,Le=x),pe||(Ye[Xe]=Le)}var $=rt;if(rt+=Xe.length,!pe)Ge.push(ze+$,Le);else{var Q=Me[1],ee=Xe.indexOf(Q),se=ee+Q.length;Me[2]&&(se=Xe.length-Me[2].length,ee=se-Q.length);var fe=Le.substring(5);K(Ve,ze+$,Xe.substring(0,ee),ke,Ge),K(Ve,ze+$+ee,Q,me(fe,Q),Ge),K(Ve,ze+$+se,Xe.substring(se),ke,Ge)}}Oe.decorations=Ge};return ke}function Te(be){var Se=[],Re=[];be.tripleQuotedStrings?Se.push([h,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):be.multiLineStrings?Se.push([h,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Se.push([h,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),be.verbatimStrings&&Re.push([h,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ue=be.hashComments;Ue&&(be.cStyleComments?(Ue>1?Se.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Se.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Re.push([h,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Se.push([b,/^#[^\r\n]*/,null,"#"])),be.cStyleComments&&(Re.push([b,/^\/\/[^\r\n]*/,null]),Re.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ie=be.regexLiterals;if(Ie){var ke=Ie>1?"":`
|
|
\r`,Oe=ke?".":"[\\S\\s]",$e="/(?=[^/*"+ke+"])(?:[^/\\x5B\\x5C"+ke+"]|\\x5C"+Oe+"|\\x5B(?:[^\\x5C\\x5D"+ke+"]|\\x5C"+Oe+")*(?:\\x5D|$))+/";Re.push(["lang-regex",RegExp("^"+W+"("+$e+")")])}var ze=be.types;ze&&Re.push([c,ze]);var Ve=(""+be.keywords).replace(/^ | $/g,"");Ve.length&&Re.push([A,new RegExp("^(?:"+Ve.replace(/[\s,]+/g,"|")+")\\b"),null]),Se.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var Ge="^.[^\\s\\w.$@'\"`/\\\\]*";return be.regexLiterals&&(Ge+="(?!s*/)"),Re.push([f,/^@[a-z_$][a-z_$@0-9]*/i,null],[c,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[f,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[d,new RegExp(Ge),null]),ie(Se,Re)}var ve=Te({keywords:S,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ge(be,Se,Re){for(var Ue=/(?:^|\s)nocode(?:\s|$)/,Ie=/\r\n?|\n/,ke=be.ownerDocument,Oe=ke.createElement("li");be.firstChild;)Oe.appendChild(be.firstChild);var $e=[Oe];function ze(Ce){var qe=Ce.nodeType;if(qe==1&&!Ue.test(Ce.className))if(Ce.nodeName==="br")Ve(Ce),Ce.parentNode&&Ce.parentNode.removeChild(Ce);else for(var Xe=Ce.firstChild;Xe;Xe=Xe.nextSibling)ze(Xe);else if((qe==3||qe==4)&&Re){var Le=Ce.nodeValue,Me=Le.match(Ie);if(Me){var pe=Le.substring(0,Me.index);Ce.nodeValue=pe;var ue=Le.substring(Me.index+Me[0].length);if(ue){var de=Ce.parentNode;de.insertBefore(ke.createTextNode(ue),Ce.nextSibling)}Ve(Ce),pe||Ce.parentNode.removeChild(Ce)}}}function Ve(Ce){for(;!Ce.nextSibling;)if(Ce=Ce.parentNode,!Ce)return;function qe(Me,pe){var ue=pe?Me.cloneNode(!1):Me,de=Me.parentNode;if(de){var $=qe(de,1),Q=Me.nextSibling;$.appendChild(ue);for(var ee=Q;ee;ee=Q)Q=ee.nextSibling,$.appendChild(ee)}return ue}for(var Xe=qe(Ce.nextSibling,0),Le;(Le=Xe.parentNode)&&Le.nodeType===1;)Xe=Le;$e.push(Xe)}for(var Ge=0;Ge<$e.length;++Ge)ze($e[Ge]);Se===(Se|0)&&$e[0].setAttribute("value",Se);var rt=ke.createElement("ol");rt.className="linenums";for(var Je=Math.max(0,Se-1|0)||0,Ge=0,Ye=$e.length;Ge<Ye;++Ge)Oe=$e[Ge],Oe.className="L"+(Ge+Je)%10,Oe.firstChild||Oe.appendChild(ke.createTextNode("\xA0")),rt.appendChild(Oe);be.appendChild(rt)}function he(be){var Se=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Se=Se&&+Se[1]<=8;var Re=/\n/g,Ue=be.sourceCode,Ie=Ue.length,ke=0,Oe=be.spans,$e=Oe.length,ze=0,Ve=be.decorations,Ge=Ve.length,rt=0;Ve[Ge]=Ie;var Je,Ye;for(Ye=Je=0;Ye<Ge;)Ve[Ye]!==Ve[Ye+2]?(Ve[Je++]=Ve[Ye++],Ve[Je++]=Ve[Ye++]):Ye+=2;for(Ge=Je,Ye=Je=0;Ye<Ge;){for(var Ce=Ve[Ye],qe=Ve[Ye+1],Xe=Ye+2;Xe+2<=Ge&&Ve[Xe+1]===qe;)Xe+=2;Ve[Je++]=Ce,Ve[Je++]=qe,Ye=Xe}Ge=Ve.length=Je;var Le=be.sourceNode,Me="";Le&&(Me=Le.style.display,Le.style.display="none");try{for(var pe=null;ze<$e;){var ue=Oe[ze],de=Oe[ze+2]||Ie,$=Ve[rt+2]||Ie,Xe=Math.min(de,$),Q=Oe[ze+1],ee;if(Q.nodeType!==1&&(ee=Ue.substring(ke,Xe))){Se&&(ee=ee.replace(Re,"\r")),Q.nodeValue=ee;var se=Q.ownerDocument,fe=se.createElement("span");fe.className=Ve[rt+1];var we=Q.parentNode;we.replaceChild(fe,Q),fe.appendChild(Q),ke<de&&(Oe[ze+1]=Q=se.createTextNode(Ue.substring(Xe,de)),we.insertBefore(Q,fe.nextSibling))}ke=Xe,ke>=de&&(ze+=2),ke>=$&&(rt+=2)}}finally{Le&&(Le.style.display=Me)}}var ce={};function ae(be,Se){for(var Re=Se.length;--Re>=0;){var Ue=Se[Re];ce.hasOwnProperty(Ue)?F.console&&console.warn("cannot override language handler %s",Ue):ce[Ue]=be}}function me(be,Se){return be&&ce.hasOwnProperty(be)||(be=/^\s*</.test(Se)?"default-markup":"default-code"),ce[be]}ae(ve,["default-code"]),ae(ie([],[[a,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[d,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ae(ie([[a,/^[\s]+/,null,` \r
|
|
`],[U,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[y,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[d,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ae(ie([],[[U,/^[\s\S]+/]]),["uq.val"]),ae(Te({keywords:T,hashComments:!0,cStyleComments:!0,types:p}),["c","cc","cpp","cxx","cyc","m"]),ae(Te({keywords:"null,true,false"}),["json"]),ae(Te({keywords:C,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:p}),["cs"]),ae(Te({keywords:R,cStyleComments:!0}),["java"]),ae(Te({keywords:l,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ae(Te({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ae(Te({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ae(Te({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ae(Te({keywords:v,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ae(Te({keywords:w,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ae(ie([],[[h,/^[\s\S]+/]]),["regex"]);function J(be){var Se=be.langExtension;try{var Re=O(be.sourceNode,be.pre),Ue=Re.sourceCode;be.sourceCode=Ue,be.spans=Re.spans,be.basePos=0,me(Se,Ue)(be),he(be)}catch(Ie){F.console&&console.log(Ie&&Ie.stack||Ie)}}function ne(be,Se,Re){var Ue=Re||!1,Ie=Se||null,ke=document.createElement("div");ke.innerHTML="<pre>"+be+"</pre>",ke=ke.firstChild,Ue&&ge(ke,Ue,!0);var Oe={langExtension:Ie,numberLines:Ue,sourceNode:ke,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return J(Oe),ke.innerHTML}function Z(be,Se){var Re=Se||document.body,Ue=Re.ownerDocument||document;function Ie(ue){return Re.getElementsByTagName(ue)}for(var ke=[Ie("pre"),Ie("code"),Ie("xmp")],Oe=[],$e=0;$e<ke.length;++$e)for(var ze=0,Ve=ke[$e].length;ze<Ve;++ze)Oe.push(ke[$e][ze]);ke=null;var Ge=Date;Ge.now||(Ge={now:function(){return+new Date}});var rt=0,Je=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ye=/\bprettyprint\b/,Ce=/\bprettyprinted\b/,qe=/pre|xmp/i,Xe=/^code$/i,Le=/^(?:pre|code|xmp)$/i,Me={};function pe(){for(var ue=F.PR_SHOULD_USE_CONTINUATION?Ge.now()+250:Infinity;rt<Oe.length&&Ge.now()<ue;rt++){for(var de=Oe[rt],$=Me,Q=de;Q=Q.previousSibling;){var ee=Q.nodeType,se=(ee===7||ee===8)&&Q.nodeValue;if(se?!/^\??prettify\b/.test(se):ee!==3||/\S/.test(Q.nodeValue))break;if(se){$={},se.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Dt,yt,or){$[yt]=or});break}}var fe=de.className;if(($!==Me||Ye.test(fe))&&!Ce.test(fe)){for(var we=!1,_e=de.parentNode;_e;_e=_e.parentNode){var je=_e.tagName;if(Le.test(je)&&_e.className&&Ye.test(_e.className)){we=!0;break}}if(!we){de.className+=" prettyprinted";var Ze=$.lang;if(!Ze){Ze=fe.match(Je);var We;!Ze&&(We=q(de))&&Xe.test(We.tagName)&&(Ze=We.className.match(Je)),Ze&&(Ze=Ze[1])}var mt;if(qe.test(de.tagName))mt=1;else{var dt=de.currentStyle,at=Ue.defaultView,Et=dt?dt.whiteSpace:at&&at.getComputedStyle?at.getComputedStyle(de,null).getPropertyValue("white-space"):0;mt=Et&&Et.substring(0,3)==="pre"}var xt=$.linenums;(xt=xt==="true"||+xt)||(xt=fe.match(/\blinenums\b(?::(\d+))?/),xt=xt?xt[1]&&xt[1].length?+xt[1]:!0:!1),xt&&ge(de,xt,mt);var St={langExtension:Ze,sourceNode:de,numberLines:xt,pre:mt,sourceCode:null,basePos:null,spans:null,decorations:null};J(St)}}}rt<Oe.length?F.setTimeout(pe,250):typeof be=="function"&&be()}pe()}var Ee=F.PR={createSimpleLexer:ie,registerLangHandler:ae,sourceDecorator:Te,PR_ATTRIB_NAME:P,PR_ATTRIB_VALUE:U,PR_COMMENT:b,PR_DECLARATION:m,PR_KEYWORD:A,PR_LITERAL:f,PR_NOCODE:j,PR_PLAIN:a,PR_PUNCTUATION:d,PR_SOURCE:x,PR_STRING:h,PR_TAG:y,PR_TYPE:c,prettyPrintOne:L?F.prettyPrintOne=ne:_=ne,prettyPrint:B=L?F.prettyPrint=Z:B=Z},Ae=F.define;typeof Ae=="function"&&Ae.amd&&Ae("google-code-prettify",[],function(){return Ee})})()},"VrN/":function(ut,et,oe){(function(te,G){ut.exports=G()})(this,function(){"use strict";var te=navigator.userAgent,G=navigator.platform,L=/gecko\/\d/i.test(te),z=/MSIE \d/.test(te),I=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(te),_=/Edge\/(\d+)/.exec(te),B=z||I||_,F=B&&(z?document.documentMode||6:+(_||I)[1]),M=!_&&/WebKit\//.test(te),D=M&&/Qt\/\d+\.\d+/.test(te),g=!_&&/Chrome\//.test(te),T=/Opera\//.test(te),R=/Apple Computer/.test(navigator.vendor),C=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(te),w=/PhantomJS/.test(te),v=!_&&/AppleWebKit/.test(te)&&/Mobile\/\w+/.test(te),u=/Android/.test(te),o=v||u||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(te),s=v||/Mac/.test(G),l=/\bCrOS\b/.test(te),S=/win/i.test(G),p=T&&te.match(/Version\/(\d*\.\d*)/);p&&(p=Number(p[1])),p&&p>=15&&(T=!1,M=!0);var h=s&&(D||T&&(p==null||p<12.11)),A=L||B&&F>=9;function b(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var c=function(e,t){var n=e.className,r=b(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function f(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function d(e,t){return f(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var E=0;E<t.length;++E)i.appendChild(t[E]);return i}function y(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var m;document.createRange?m=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:m=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function x(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function P(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function U(e,t){var n=e.className;b(t).test(n)||(e.className+=(n?" ":"")+t)}function j(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!b(n[r]).test(t)&&(t+=" "+n[r]);return t}var W=function(e){e.select()};v?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:B&&(W=function(e){try{e.select()}catch(t){}});function k(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function O(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function K(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var E=r||0,N=i||0;;){var H=e.indexOf(" ",E);if(H<0||H>=t)return N+(t-E);N+=H-E,N+=n-N%n,E=H+1}}var Y=function(){this.id=null,this.f=null,this.time=0,this.handler=k(this.onTimeout,this)};Y.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Y.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function q(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var ie=50,Te={toString:function(){return"CodeMirror.Pass"}},ve={scroll:!1},ge={origin:"*mouse"},he={origin:"+move"};function ce(e,t,n){for(var r=0,i=0;;){var E=e.indexOf(" ",r);E==-1&&(E=e.length);var N=E-r;if(E==e.length||i+N>=t)return r+Math.min(N,t-i);if(i+=E-r,i+=n-i%n,r=E+1,i>=t)return r}}var ae=[""];function me(e){for(;ae.length<=e;)ae.push(J(ae)+" ");return ae[e]}function J(e){return e[e.length-1]}function ne(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Z(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function Ee(){}function Ae(e,t){var n;return Object.create?n=Object.create(e):(Ee.prototype=e,n=new Ee),t&&O(t,n),n}var be=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Se(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||be.test(e))}function Re(e,t){return t?t.source.indexOf("\\w")>-1&&Se(e)?!0:t.test(e):Se(e)}function Ue(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ie=/[\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 ke(e){return e.charCodeAt(0)>=768&&Ie.test(e)}function Oe(e,t,n){for(;(n<0?t>0:t<e.length)&&ke(e.charAt(t));)t+=n;return t}function $e(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,E=r<0?Math.ceil(i):Math.floor(i);if(E==t)return e(E)?t:n;e(E)?n=E:t=E+r}}function ze(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,E=0;E<e.length;++E){var N=e[E];(N.from<n&&N.to>t||t==n&&N.to==t)&&(r(Math.max(N.from,t),Math.min(N.to,n),N.level==1?"rtl":"ltr",E),i=!0)}i||r(t,n,"ltr")}var Ve=null;function Ge(e,t,n){var r;Ve=null;for(var i=0;i<e.length;++i){var E=e[i];if(E.from<t&&E.to>t)return i;E.to==t&&(E.from!=E.to&&n=="before"?r=i:Ve=i),E.from==t&&(E.from!=E.to&&n!="before"?r=i:Ve=i)}return r!=null?r:Ve}var rt=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]/,E=/[LRr]/,N=/[Lb1n]/,H=/[1n]/;function V(X,re,le){this.level=X,this.from=re,this.to=le}return function(X,re){var le=re=="ltr"?"L":"R";if(X.length==0||re=="ltr"&&!r.test(X))return!1;for(var xe=X.length,ye=[],De=0;De<xe;++De)ye.push(n(X.charCodeAt(De)));for(var Pe=0,Be=le;Pe<xe;++Pe){var He=ye[Pe];He=="m"?ye[Pe]=Be:Be=He}for(var Qe=0,Ke=le;Qe<xe;++Qe){var tt=ye[Qe];tt=="1"&&Ke=="r"?ye[Qe]="n":E.test(tt)&&(Ke=tt,tt=="r"&&(ye[Qe]="R"))}for(var lt=1,ot=ye[0];lt<xe-1;++lt){var pt=ye[lt];pt=="+"&&ot=="1"&&ye[lt+1]=="1"?ye[lt]="1":pt==","&&ot==ye[lt+1]&&(ot=="1"||ot=="n")&&(ye[lt]=ot),ot=pt}for(var Rt=0;Rt<xe;++Rt){var Ht=ye[Rt];if(Ht==",")ye[Rt]="N";else if(Ht=="%"){var _t=void 0;for(_t=Rt+1;_t<xe&&ye[_t]=="%";++_t);for(var lr=Rt&&ye[Rt-1]=="!"||_t<xe&&ye[_t]=="1"?"1":"N",nr=Rt;nr<_t;++nr)ye[nr]=lr;Rt=_t-1}}for(var Ut=0,ir=le;Ut<xe;++Ut){var zt=ye[Ut];ir=="L"&&zt=="1"?ye[Ut]="L":E.test(zt)&&(ir=zt)}for(var Bt=0;Bt<xe;++Bt)if(i.test(ye[Bt])){var Ft=void 0;for(Ft=Bt+1;Ft<xe&&i.test(ye[Ft]);++Ft);for(var Mt=(Bt?ye[Bt-1]:le)=="L",ar=(Ft<xe?ye[Ft]:le)=="L",jn=Mt==ar?Mt?"L":"R":le,Jr=Bt;Jr<Ft;++Jr)ye[Jr]=jn;Bt=Ft-1}for(var Yt=[],Rr,Kt=0;Kt<xe;)if(N.test(ye[Kt])){var Va=Kt;for(++Kt;Kt<xe&&N.test(ye[Kt]);++Kt);Yt.push(new V(0,Va,Kt))}else{var jr=Kt,fn=Yt.length,hn=re=="rtl"?1:0;for(++Kt;Kt<xe&&ye[Kt]!="L";++Kt);for(var Qt=jr;Qt<Kt;)if(H.test(ye[Qt])){jr<Qt&&(Yt.splice(fn,0,new V(1,jr,Qt)),fn+=hn);var Wn=Qt;for(++Qt;Qt<Kt&&H.test(ye[Qt]);++Qt);Yt.splice(fn,0,new V(2,Wn,Qt)),fn+=hn,jr=Qt}else++Qt;jr<Kt&&Yt.splice(fn,0,new V(1,jr,Kt))}return re=="ltr"&&(Yt[0].level==1&&(Rr=X.match(/^\s+/))&&(Yt[0].from=Rr[0].length,Yt.unshift(new V(0,0,Rr[0].length))),J(Yt).level==1&&(Rr=X.match(/\s+$/))&&(J(Yt).to-=Rr[0].length,Yt.push(new V(0,xe-Rr[0].length,xe)))),re=="rtl"?Yt.reverse():Yt}}();function Je(e,t){var n=e.order;return n==null&&(n=e.order=rt(e.text,t)),n}var Ye=[],Ce=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Ye).concat(n)}};function qe(e,t){return e._handlers&&e._handlers[t]||Ye}function Xe(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var E=q(i,n);E>-1&&(r[t]=i.slice(0,E).concat(i.slice(E+1)))}}}function Le(e,t){var n=qe(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Me(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Le(e,n||t.type,e,t),ee(t)||t.codemirrorIgnore}function pe(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)q(n,t[r])==-1&&n.push(t[r])}function ue(e,t){return qe(e,t).length>0}function de(e){e.prototype.on=function(t,n){Ce(this,t,n)},e.prototype.off=function(t,n){Xe(this,t,n)}}function $(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Q(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ee(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function se(e){$(e),Q(e)}function fe(e){return e.target||e.srcElement}function we(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 _e=function(){if(B&&F<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),je;function Ze(e){if(je==null){var t=a("span","\u200B");d(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(je=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&F<8))}var n=je?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var We;function mt(e){if(We!=null)return We;var t=d(e,document.createTextNode("A\u062EA")),n=m(t,0,1).getBoundingClientRect(),r=m(t,1,2).getBoundingClientRect();return f(e),!n||n.left==n.right?!1:We=r.right-n.right<3}var dt=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
|
|
`,t);i==-1&&(i=e.length);var E=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),N=E.indexOf("\r");N!=-1?(n.push(E.slice(0,N)),t+=N+1):(n.push(E),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},at=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},Et=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),xt=null;function St(e){if(xt!=null)return xt;var t=d(e,a("span","x")),n=t.getBoundingClientRect(),r=m(t,0,1).getBoundingClientRect();return xt=Math.abs(n.left-r.left)>1}var Dt={},yt={};function or(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Dt[e]=t}function kr(e,t){yt[e]=t}function ur(e){if(typeof e=="string"&&yt.hasOwnProperty(e))e=yt[e];else if(e&&typeof e.name=="string"&&yt.hasOwnProperty(e.name)){var t=yt[e.name];typeof t=="string"&&(t={name:t}),e=Ae(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return ur("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return ur("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function gr(e,t){t=ur(t);var n=Dt[t.name];if(!n)return gr(e,"text/plain");var r=n(e,t);if(hr.hasOwnProperty(t.name)){var i=hr[t.name];for(var E in i){if(!i.hasOwnProperty(E))continue;r.hasOwnProperty(E)&&(r["_"+E]=r[E]),r[E]=i[E]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var N in t.modeProps)r[N]=t.modeProps[N];return r}var hr={};function ia(e,t){var n=hr.hasOwnProperty(e)?hr[e]:hr[e]={};O(t,n)}function Ar(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Hn(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Kn(e,t,n){return e.startState?e.startState(t,n):!0}var Pt=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};Pt.prototype.eol=function(){return this.pos>=this.string.length},Pt.prototype.sol=function(){return this.pos==this.lineStart},Pt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Pt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Pt.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},Pt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Pt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Pt.prototype.skipToEnd=function(){this.pos=this.string.length},Pt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Pt.prototype.backUp=function(e){this.pos-=e},Pt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=K(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?K(this.string,this.lineStart,this.tabSize):0)},Pt.prototype.indentation=function(){return K(this.string,null,this.tabSize)-(this.lineStart?K(this.string,this.lineStart,this.tabSize):0)},Pt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(N){return n?N.toLowerCase():N},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var E=this.string.slice(this.pos).match(e);return E&&E.index>0?null:(E&&t!==!1&&(this.pos+=E[0].length),E)}},Pt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Pt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Pt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Pt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function nt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],E=i.chunkSize();if(t<E){n=i;break}t-=E}return n.lines[t]}function _r(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(E){var N=E.text;i==n.line&&(N=N.slice(0,n.ch)),i==t.line&&(N=N.slice(t.ch)),r.push(N),++i}),r}function pn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function Zt(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function wt(e){if(e.parent==null)return null;for(var t=e.parent,n=q(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function vr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],E=i.height;if(t<E){e=i;continue e}t-=E,n+=i.chunkSize()}return n}while(!e.lines);for(var N=0;N<e.lines.length;++N){var H=e.lines[N],V=H.height;if(t<V)break;t-=V}return n+N}function Pr(e,t){return t>=e.first&&t<e.first+e.size}function mn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Fe(e,t,n){if(n===void 0&&(n=null),!(this instanceof Fe))return new Fe(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ct(e,t){return e.line-t.line||e.ch-t.ch}function Gn(e,t){return e.sticky==t.sticky&&ct(e,t)==0}function gn(e){return Fe(e.line,e.ch)}function vn(e,t){return ct(e,t)<0?t:e}function Qr(e,t){return ct(e,t)<0?e:t}function yn(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ht(e,t){if(t.line<e.first)return Fe(e.first,0);var n=e.first+e.size-1;return t.line>n?Fe(n,nt(e,n).text.length):Ai(t,nt(e,t.line).text.length)}function Ai(e,t){var n=e.ch;return n==null||n>t?Fe(e.line,t):n<0?Fe(e.line,0):e}function Ne(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ht(e,t[r]);return n}var bn=function(e,t){this.state=e,this.lookAhead=t},pr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};pr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},pr.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}},pr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},pr.fromSaved=function(e,t,n){return t instanceof bn?new pr(e,Ar(e.mode,t.state),n,t.lookAhead):new pr(e,Ar(e.mode,t),n)},pr.prototype.save=function(e){var t=e!==!1?Ar(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new bn(t,this.maxLookAhead):t};function zn(e,t,n,r){var i=[e.state.modeGen],E={};xr(e,t.text,e.doc.mode,n,function(X,re){return i.push(X,re)},E,r);for(var N=n.state,H=function(X){n.baseTokens=i;var re=e.state.overlays[X],le=1,xe=0;n.state=!0,xr(e,t.text,re.mode,n,function(ye,De){for(var Pe=le;xe<ye;){var Be=i[le];Be>ye&&i.splice(le,1,ye,i[le+1],Be),le+=2,xe=Math.min(ye,Be)}if(!De)return;if(re.opaque)i.splice(Pe,le-Pe,ye,"overlay "+De),le=Pe+2;else for(;Pe<le;Pe+=2){var He=i[Pe+1];i[Pe+1]=(He?He+" ":"")+"overlay "+De}},E),n.state=N,n.baseTokens=null,n.baseTokenPos=1},V=0;V<e.state.overlays.length;++V)H(V);return{styles:i,classes:E.bgClass||E.textClass?E:null}}function Zr(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=yr(e,wt(t)),i=t.text.length>e.options.maxHighlightLength&&Ar(e.doc.mode,r.state),E=zn(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=E.styles,E.classes?t.styleClasses=E.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function yr(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new pr(r,!0,t);var E=Di(e,t,n),N=E>r.first&&nt(r,E-1).stateAfter,H=N?pr.fromSaved(r,N,E):new pr(r,Kn(r.mode),E);return r.iter(E,t,function(V){Vn(e,V.text,H);var X=H.line;V.stateAfter=X==t-1||X%5==0||X>=i.viewFrom&&X<i.viewTo?H.save():null,H.nextLine()}),n&&(r.modeFrontier=H.line),H}function Vn(e,t,n,r){var i=e.doc.mode,E=new Pt(t,e.options.tabSize,n);for(E.start=E.pos=r||0,t==""&&Xn(i,n.state);!E.eol();)br(i,E,n.state),E.start=E.pos}function Xn(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Hn(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function br(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Hn(e,n).mode);var E=e.token(t,n);if(t.pos>t.start)return E}throw new Error("Mode "+e.name+" failed to advance stream.")}var Yn=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Li(e,t,n,r){var i=e.doc,E=i.mode,N;t=ht(i,t);var H=nt(i,t.line),V=yr(e,t.line,n),X=new Pt(H.text,e.options.tabSize,V),re;for(r&&(re=[]);(r||X.pos<t.ch)&&!X.eol();)X.start=X.pos,N=br(E,X,V.state),r&&re.push(new Yn(X,N,Ar(i.mode,V.state)));return r?re:new Yn(X,N,V.state)}function $n(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function xr(e,t,n,r,i,E,N){var H=n.flattenSpans;H==null&&(H=e.options.flattenSpans);var V=0,X=null,re=new Pt(t,e.options.tabSize,r),le,xe=e.options.addModeClass&&[null];for(t==""&&$n(Xn(n,r.state),E);!re.eol();){if(re.pos>e.options.maxHighlightLength?(H=!1,N&&Vn(e,t,r,re.pos),re.pos=t.length,le=null):le=$n(br(n,re,r.state,xe),E),xe){var ye=xe[0].name;ye&&(le="m-"+(le?ye+" "+le:ye))}if(!H||X!=le){for(;V<re.start;)V=Math.min(re.start,V+5e3),i(V,X);X=le}re.start=re.pos}for(;V<re.pos;){var De=Math.min(re.pos,V+5e3);i(De,X),V=De}}function Di(e,t,n){for(var r,i,E=e.doc,N=n?-1:t-(e.doc.mode.innerMode?1e3:100),H=t;H>N;--H){if(H<=E.first)return E.first;var V=nt(E,H-1),X=V.stateAfter;if(X&&(!n||H+(X instanceof bn?X.lookAhead:0)<=E.modeFrontier))return H;var re=K(V.text,null,e.options.tabSize);(i==null||r>re)&&(i=H-1,r=re)}return i}function aa(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var i=nt(e,r).stateAfter;if(i&&(!(i instanceof bn)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Jn=!1,$t=!1;function Wr(){Jn=!0}function oa(){$t=!0}function qr(e,t,n){this.marker=e,this.from=t,this.to=n}function Er(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Qn(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function sa(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Oi(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var E=e[i],N=E.marker,H=E.from==null||(N.inclusiveLeft?E.from<=t:E.from<t);if(H||E.from==t&&N.type=="bookmark"&&(!n||!E.marker.insertLeft)){var V=E.to==null||(N.inclusiveRight?E.to>=t:E.to>t);(r||(r=[])).push(new qr(N,E.from,V?null:E.to))}}return r}function Ri(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var E=e[i],N=E.marker,H=E.to==null||(N.inclusiveRight?E.to>=t:E.to>t);if(H||E.from==t&&N.type=="bookmark"&&(!n||E.marker.insertLeft)){var V=E.from==null||(N.inclusiveLeft?E.from<=t:E.from<t);(r||(r=[])).push(new qr(N,V?null:E.from-t,E.to==null?null:E.to-t))}}return r}function xn(e,t){if(t.full)return null;var n=Pr(e,t.from.line)&&nt(e,t.from.line).markedSpans,r=Pr(e,t.to.line)&&nt(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,E=t.to.ch,N=ct(t.from,t.to)==0,H=Oi(n,i,N),V=Ri(r,E,N),X=t.text.length==1,re=J(t.text).length+(X?i:0);if(H)for(var le=0;le<H.length;++le){var xe=H[le];if(xe.to==null){var ye=Er(V,xe.marker);ye?X&&(xe.to=ye.to==null?null:ye.to+re):xe.to=i}}if(V)for(var De=0;De<V.length;++De){var Pe=V[De];if(Pe.to!=null&&(Pe.to+=re),Pe.from==null){var Be=Er(H,Pe.marker);Be||(Pe.from=re,X&&(H||(H=[])).push(Pe))}else Pe.from+=re,X&&(H||(H=[])).push(Pe)}H&&(H=ki(H)),V&&V!=H&&(V=ki(V));var He=[H];if(!X){var Qe=t.text.length-2,Ke;if(Qe>0&&H)for(var tt=0;tt<H.length;++tt)H[tt].to==null&&(Ke||(Ke=[])).push(new qr(H[tt].marker,null,null));for(var lt=0;lt<Qe;++lt)He.push(Ke);He.push(V)}return He}function ki(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function _i(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(ye){if(ye.markedSpans)for(var De=0;De<ye.markedSpans.length;++De){var Pe=ye.markedSpans[De].marker;Pe.readOnly&&(!r||q(r,Pe)==-1)&&(r||(r=[])).push(Pe)}}),!r)return null;for(var i=[{from:t,to:n}],E=0;E<r.length;++E)for(var N=r[E],H=N.find(0),V=0;V<i.length;++V){var X=i[V];if(ct(X.to,H.from)<0||ct(X.from,H.to)>0)continue;var re=[V,1],le=ct(X.from,H.from),xe=ct(X.to,H.to);(le<0||!N.inclusiveLeft&&!le)&&re.push({from:X.from,to:H.from}),(xe>0||!N.inclusiveRight&&!xe)&&re.push({from:H.to,to:X.to}),i.splice.apply(i,re),V+=re.length-3}return i}function la(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function En(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function en(e){return e.inclusiveLeft?-1:0}function tn(e){return e.inclusiveRight?1:0}function Tn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),E=ct(r.from,i.from)||en(e)-en(t);if(E)return-E;var N=ct(r.to,i.to)||tn(e)-tn(t);return N||t.id-e.id}function Mr(e,t){var n=$t&&e.markedSpans,r;if(n)for(var i=void 0,E=0;E<n.length;++E)i=n[E],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Tn(r,i.marker)<0)&&(r=i.marker);return r}function Ir(e){return Mr(e,!0)}function Ur(e){return Mr(e,!1)}function Sn(e,t){var n=$t&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var E=n[i];E.marker.collapsed&&(E.from==null||E.from<t)&&(E.to==null||E.to>t)&&(!r||Tn(r,E.marker)<0)&&(r=E.marker)}return r}function Pi(e,t,n,r,i){var E=nt(e,t),N=$t&&E.markedSpans;if(N)for(var H=0;H<N.length;++H){var V=N[H];if(!V.marker.collapsed)continue;var X=V.marker.find(0),re=ct(X.from,n)||en(V.marker)-en(i),le=ct(X.to,r)||tn(V.marker)-tn(i);if(re>=0&&le<=0||re<=0&&le>=0)continue;if(re<=0&&(V.marker.inclusiveRight&&i.inclusiveLeft?ct(X.to,n)>=0:ct(X.to,n)>0)||re>=0&&(V.marker.inclusiveRight&&i.inclusiveLeft?ct(X.from,r)<=0:ct(X.from,r)<0))return!0}}function dr(e){for(var t;t=Ir(e);)e=t.find(-1,!0).line;return e}function Mi(e){for(var t;t=Ur(e);)e=t.find(1,!0).line;return e}function wn(e){for(var t,n;t=Ur(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Zn(e,t){var n=nt(e,t),r=dr(n);return n==r?t:wt(r)}function Hr(e,t){if(t>e.lastLine())return t;var n=nt(e,t),r;if(!Lr(e,n))return t;for(;r=Ur(n);)n=r.find(1,!0).line;return wt(n)+1}function Lr(e,t){var n=$t&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i){if(r=n[i],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&qn(e,t,r))return!0}}function qn(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return qn(e,r.line,Er(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,E=0;E<t.markedSpans.length;++E)if(i=t.markedSpans[E],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&qn(e,t,i))return!0}function Tr(e){e=dr(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var E=n.parent;E;n=E,E=n.parent)for(var N=0;N<E.children.length;++N){var H=E.children[N];if(H==n)break;t+=H.height}return t}function ei(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Ir(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Ur(r);){var E=n.find(0,!0);t-=r.text.length-E.from.ch,r=E.to.line,t+=r.text.length-E.to.ch}return t}function Ii(e){var t=e.display,n=e.doc;t.maxLine=nt(n,n.first),t.maxLineLength=ei(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=ei(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var rn=function(e,t,n){this.text=e,En(this,t),this.height=n?n(this):1};rn.prototype.lineNo=function(){return wt(this)},de(rn);function ua(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),la(e),En(e,n);var i=r?r(e):1;i!=e.height&&Zt(e,i)}function it(e){e.parent=null,la(e)}var ft={},st={};function gt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?st:ft;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Tt(e,t){var n=y("span",null,null,M?"padding-right: .1px":null),r={pre:y("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var E=i?t.rest[i-1]:t.line,N=void 0;r.pos=0,r.addToken=bt,mt(e.display.measure)&&(N=Je(E,e.doc.direction))&&(r.addToken=qt(r.addToken,N)),r.map=[];var H=t!=e.display.externalMeasured&&wt(E);Fr(E,r,Zr(e,E,H)),E.styleClasses&&(E.styleClasses.bgClass&&(r.bgClass=j(E.styleClasses.bgClass,r.bgClass||"")),E.styleClasses.textClass&&(r.textClass=j(E.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Ze(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(M){var V=r.content.lastChild;(/\bcm-tab\b/.test(V.className)||V.querySelector&&V.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Le(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function Ot(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 bt(e,t,n,r,i,E,N){if(!t)return;var H=e.splitSpaces?Nt(t,e.trailingSpace):t,V=e.cm.state.specialChars,X=!1,re;if(!V.test(t))e.col+=t.length,re=document.createTextNode(H),e.map.push(e.pos,e.pos+t.length,re),B&&F<9&&(X=!0),e.pos+=t.length;else{re=document.createDocumentFragment();for(var le=0;;){V.lastIndex=le;var xe=V.exec(t),ye=xe?xe.index-le:t.length-le;if(ye){var De=document.createTextNode(H.slice(le,le+ye));B&&F<9?re.appendChild(a("span",[De])):re.appendChild(De),e.map.push(e.pos,e.pos+ye,De),e.col+=ye,e.pos+=ye}if(!xe)break;le+=ye+1;var Pe=void 0;if(xe[0]==" "){var Be=e.cm.options.tabSize,He=Be-e.col%Be;Pe=re.appendChild(a("span",me(He),"cm-tab")),Pe.setAttribute("role","presentation"),Pe.setAttribute("cm-text"," "),e.col+=He}else xe[0]=="\r"||xe[0]==`
|
|
`?(Pe=re.appendChild(a("span",xe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Pe.setAttribute("cm-text",xe[0]),e.col+=1):(Pe=e.cm.options.specialCharPlaceholder(xe[0]),Pe.setAttribute("cm-text",xe[0]),B&&F<9?re.appendChild(a("span",[Pe])):re.appendChild(Pe),e.col+=1);e.map.push(e.pos,e.pos+1,Pe),e.pos++}}if(e.trailingSpace=H.charCodeAt(t.length-1)==32,n||r||i||X||E||N){var Qe=n||"";r&&(Qe+=r),i&&(Qe+=i);var Ke=a("span",[re],Qe,E);if(N)for(var tt in N)N.hasOwnProperty(tt)&&tt!="style"&&tt!="class"&&Ke.setAttribute(tt,N[tt]);return e.content.appendChild(Ke)}e.content.appendChild(re)}function Nt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var E=e.charAt(i);E==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(E="\xA0"),r+=E,n=E==" "}return r}function qt(e,t){return function(n,r,i,E,N,H,V){i=i?i+" cm-force-border":"cm-force-border";for(var X=n.pos,re=X+r.length;;){for(var le=void 0,xe=0;xe<t.length&&!(le=t[xe],le.to>X&&le.from<=X);xe++);if(le.to>=re)return e(n,r,i,E,N,H,V);e(n,r.slice(0,le.to-X),i,E,null,H,V),E=null,r=r.slice(le.to-X),X=le.to}}}function vt(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 Fr(e,t,n){var r=e.markedSpans,i=e.text,E=0;if(!r){for(var N=1;N<n.length;N+=2)t.addToken(t,i.slice(E,E=n[N]),gt(n[N+1],t.cm.options));return}for(var H=i.length,V=0,X=1,re="",le,xe,ye=0,De,Pe,Be,He,Qe;;){if(ye==V){De=Pe=Be=xe="",Qe=null,He=null,ye=Infinity;for(var Ke=[],tt=void 0,lt=0;lt<r.length;++lt){var ot=r[lt],pt=ot.marker;if(pt.type=="bookmark"&&ot.from==V&&pt.widgetNode)Ke.push(pt);else if(ot.from<=V&&(ot.to==null||ot.to>V||pt.collapsed&&ot.to==V&&ot.from==V)){if(ot.to!=null&&ot.to!=V&&ye>ot.to&&(ye=ot.to,Pe=""),pt.className&&(De+=" "+pt.className),pt.css&&(xe=(xe?xe+";":"")+pt.css),pt.startStyle&&ot.from==V&&(Be+=" "+pt.startStyle),pt.endStyle&&ot.to==ye&&(tt||(tt=[])).push(pt.endStyle,ot.to),pt.title&&((Qe||(Qe={})).title=pt.title),pt.attributes)for(var Rt in pt.attributes)(Qe||(Qe={}))[Rt]=pt.attributes[Rt];pt.collapsed&&(!He||Tn(He.marker,pt)<0)&&(He=ot)}else ot.from>V&&ye>ot.from&&(ye=ot.from)}if(tt)for(var Ht=0;Ht<tt.length;Ht+=2)tt[Ht+1]==ye&&(Pe+=" "+tt[Ht]);if(!He||He.from==V)for(var _t=0;_t<Ke.length;++_t)vt(t,0,Ke[_t]);if(He&&(He.from||0)==V){if(vt(t,(He.to==null?H+1:He.to)-V,He.marker,He.from==null),He.to==null)return;He.to==V&&(He=!1)}}if(V>=H)break;for(var lr=Math.min(H,ye);;){if(re){var nr=V+re.length;if(!He){var Ut=nr>lr?re.slice(0,lr-V):re;t.addToken(t,Ut,le?le+De:De,Be,V+Ut.length==ye?Pe:"",xe,Qe)}if(nr>=lr){re=re.slice(lr-V),V=lr;break}V=nr,Be=""}re=i.slice(E,E=n[X++]),le=gt(n[X++],t.cm.options)}}}function Ct(e,t,n){this.line=t,this.rest=wn(t),this.size=this.rest?wt(J(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Lr(e,t)}function er(e,t,n){for(var r=[],i,E=t;E<n;E=i){var N=new Ct(e.doc,nt(e.doc,E),E);i=E+N.size,r.push(N)}return r}var Vt=null;function mr(e){Vt?Vt.ops.push(e):e.ownsGroup=Vt={ops:[e],delayedCallbacks:[]}}function Rs(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function ks(e,t){var n=e.ownsGroup;if(!n)return;try{Rs(n)}finally{Vt=null,t(n)}}var ti=null;function Gt(e,t){var n=qe(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Vt?i=Vt.delayedCallbacks:ti?i=ti:(i=ti=[],setTimeout(_s,0));for(var E=function(H){i.push(function(){return n[H].apply(null,r)})},N=0;N<n.length;++N)E(N)}function _s(){var e=ti;ti=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,n,r){for(var i=0;i<t.changes.length;i++){var E=t.changes[i];E=="text"?Ms(e,t):E=="gutter"?Ja(e,t,n,r):E=="class"?da(e,t):E=="widget"&&Is(e,t,r)}t.changes=null}function ri(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),B&&F<8&&(e.node.style.zIndex=2)),e.node}function Ps(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=ri(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Tt(e,t)}function Ms(e,t){var n=t.text.className,r=$a(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,da(e,t)):n&&(t.text.className=n)}function da(e,t){Ps(e,t),t.line.wrapClass?ri(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Ja(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=ri(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var E=t.line.gutterMarkers;if(e.options.lineNumbers||E){var N=ri(t),H=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(H),N.insertBefore(H,t.text),t.line.gutterClass&&(H.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!E||!E["CodeMirror-linenumbers"])&&(t.lineNumber=H.appendChild(a("div",mn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),E)for(var V=0;V<e.display.gutterSpecs.length;++V){var X=e.display.gutterSpecs[V].className,re=E.hasOwnProperty(X)&&E[X];re&&H.appendChild(a("div",[re],"CodeMirror-gutter-elt","left: "+r.gutterLeft[X]+"px; width: "+r.gutterWidth[X]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=b("CodeMirror-linewidget"),i=t.node.firstChild,E=void 0;i;i=E)E=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Qa(e,t,n)}function Us(e,t,n,r){var i=$a(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),da(e,t),Ja(e,t,n,r),Qa(e,t,r),t.node}function Qa(e,t,n){if(Za(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Za(e,t.rest[r],t,n,!1)}function Za(e,t,n,r,i){if(!t.widgets)return;for(var E=ri(n),N=0,H=t.widgets;N<H.length;++N){var V=H[N],X=a("div",[V.node],"CodeMirror-linewidget"+(V.className?" "+V.className:""));V.handleMouseEvents||X.setAttribute("cm-ignore-events","true"),Fs(V,X,n,r),e.display.input.setUneditable(X),i&&V.above?E.insertBefore(X,n.gutter||n.text):E.appendChild(X),Gt(V,"redraw")}}function Fs(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function ni(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!x(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),d(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Nr(e,t){for(var n=fe(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Ui(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=d(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Dr(e){return ie-e.display.nativeBarWidth}function nn(e){return e.display.scroller.clientWidth-Dr(e)-e.display.barWidth}function fa(e){return e.display.scroller.clientHeight-Dr(e)-e.display.barHeight}function Ns(e,t,n){var r=e.options.lineWrapping,i=r&&nn(e);if(!t.measure.heights||r&&t.measure.width!=i){var E=t.measure.heights=[];if(r){t.measure.width=i;for(var N=t.text.firstChild.getClientRects(),H=0;H<N.length-1;H++){var V=N[H],X=N[H+1];Math.abs(V.bottom-X.bottom)>2&&E.push((V.bottom+X.top)/2-n.top)}}E.push(n.bottom-n.top)}}function eo(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(wt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=dr(t);var n=wt(t),r=e.display.externalMeasured=new Ct(e.doc,t,n);r.lineN=n;var i=r.built=Tt(e,r);return r.text=i.pre,d(e.display.lineMeasure,i.pre),r}function to(e,t,n,r){return Or(e,Cn(e,t),n,r)}function ha(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[sn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Cn(e,t){var n=wt(t),r=ha(e,n);r&&!r.text?r=null:r&&r.changes&&(Ya(e,r,n,ba(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=eo(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Or(e,t,n,r,i){t.before&&(n=-1);var E=n+(r||""),N;return t.cache.hasOwnProperty(E)?N=t.cache[E]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ns(e,t.view,t.rect),t.hasHeights=!0),N=Ws(e,t,n,r),N.bogus||(t.cache[E]=N)),{left:N.left,right:N.right,top:i?N.rtop:N.top,bottom:i?N.rbottom:N.bottom}}var ro={left:0,right:0,top:0,bottom:0};function no(e,t,n){for(var r,i,E,N,H,V,X=0;X<e.length;X+=3)if(H=e[X],V=e[X+1],t<H?(i=0,E=1,N="left"):t<V?(i=t-H,E=i+1):(X==e.length-3||t==V&&e[X+3]>t)&&(E=V-H,i=E-1,t>=V&&(N="right")),i!=null){if(r=e[X+2],H==V&&n==(r.insertLeft?"left":"right")&&(N=n),n=="left"&&i==0)for(;X&&e[X-2]==e[X-3]&&e[X-1].insertLeft;)r=e[(X-=3)+2],N="left";if(n=="right"&&i==V-H)for(;X<e.length-3&&e[X+3]==e[X+4]&&!e[X+5].insertLeft;)r=e[(X+=3)+2],N="right";break}return{node:r,start:i,end:E,collapse:N,coverStart:H,coverEnd:V}}function js(e,t){var n=ro;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=no(t.map,n,r),E=i.node,N=i.start,H=i.end,V=i.collapse,X;if(E.nodeType==3){for(var re=0;re<4;re++){for(;N&&ke(t.line.text.charAt(i.coverStart+N));)--N;for(;i.coverStart+H<i.coverEnd&&ke(t.line.text.charAt(i.coverStart+H));)++H;if(B&&F<9&&N==0&&H==i.coverEnd-i.coverStart?X=E.parentNode.getBoundingClientRect():X=js(m(E,N,H).getClientRects(),r),X.left||X.right||N==0)break;H=N,N=N-1,V="right"}B&&F<11&&(X=Hs(e.display.measure,X))}else{N>0&&(V=r="right");var le;e.options.lineWrapping&&(le=E.getClientRects()).length>1?X=le[r=="right"?le.length-1:0]:X=E.getBoundingClientRect()}if(B&&F<9&&!N&&(!X||!X.left&&!X.right)){var xe=E.parentNode.getClientRects()[0];xe?X={left:xe.left,right:xe.left+Ln(e.display),top:xe.top,bottom:xe.bottom}:X=ro}for(var ye=X.top-t.rect.top,De=X.bottom-t.rect.top,Pe=(ye+De)/2,Be=t.view.measure.heights,He=0;He<Be.length-1&&!(Pe<Be[He]);He++);var Qe=He?Be[He-1]:0,Ke=Be[He],tt={left:(V=="right"?X.right:X.left)-t.rect.left,right:(V=="left"?X.left:X.right)-t.rect.left,top:Qe,bottom:Ke};return!X.left&&!X.right&&(tt.bogus=!0),e.options.singleCursorHeightPerLine||(tt.rtop=ye,tt.rbottom=De),tt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!St(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function io(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function ao(e){e.display.externalMeasure=null,f(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)io(e.display.view[t])}function ii(e){ao(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function oo(){return g&&u?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return g&&u?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=ni(e.widgets[n]));return t}function Fi(e,t,n,r,i){if(!i){var E=pa(t);n.top+=E,n.bottom+=E}if(r=="line")return n;r||(r="local");var N=Tr(t);if(r=="local"?N+=Ui(e.display):N-=e.display.viewOffset,r=="page"||r=="window"){var H=e.display.lineSpace.getBoundingClientRect();N+=H.top+(r=="window"?0:so());var V=H.left+(r=="window"?0:oo());n.left+=V,n.right+=V}return n.top+=N,n.bottom+=N,n}function lo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=oo(),i-=so();else if(n=="local"||!n){var E=e.display.sizer.getBoundingClientRect();r+=E.left,i+=E.top}var N=e.display.lineSpace.getBoundingClientRect();return{left:r-N.left,top:i-N.top}}function ma(e,t,n,r,i){return r||(r=nt(e.doc,t.line)),Fi(e,r,to(e,r,t.ch,i),n)}function Sr(e,t,n,r,i,E){r=r||nt(e.doc,t.line),i||(i=Cn(e,r));function N(De,Pe){var Be=Or(e,i,De,Pe?"right":"left",E);return Pe?Be.left=Be.right:Be.right=Be.left,Fi(e,r,Be,n)}var H=Je(r,e.doc.direction),V=t.ch,X=t.sticky;if(V>=r.text.length?(V=r.text.length,X="before"):V<=0&&(V=0,X="after"),!H)return N(X=="before"?V-1:V,X=="before");function re(De,Pe,Be){var He=H[Pe],Qe=He.level==1;return N(Be?De-1:De,Qe!=Be)}var le=Ge(H,V,X),xe=Ve,ye=re(V,le,X=="before");return xe!=null&&(ye.other=re(V,xe,X!="before")),ye}function uo(e,t){var n=0;t=ht(e.doc,t),e.options.lineWrapping||(n=Ln(e.display)*t.ch);var r=nt(e.doc,t.line),i=Tr(r)+Ui(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function ga(e,t,n,r,i){var E=Fe(e,t,n);return E.xRel=i,r&&(E.outside=r),E}function va(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return ga(r.first,0,null,-1,-1);var i=vr(r,n),E=r.first+r.size-1;if(i>E)return ga(r.first+r.size-1,nt(r,E).text.length,null,1,1);t<0&&(t=0);for(var N=nt(r,i);;){var H=Ks(e,N,i,t,n),V=Sn(N,H.ch+(H.xRel>0||H.outside>0?1:0));if(!V)return H;var X=V.find(1);if(X.line==i)return X;N=nt(r,i=X.line)}}function co(e,t,n,r){r-=pa(t);var i=t.text.length,E=$e(function(N){return Or(e,n,N-1).bottom<=r},i,0);return i=$e(function(N){return Or(e,n,N).top>r},E,i),{begin:E,end:i}}function fo(e,t,n,r){n||(n=Cn(e,t));var i=Fi(e,t,Or(e,n,r),"line").top;return co(e,t,n,i)}function ya(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,i){i-=Tr(t);var E=Cn(e,t),N=pa(t),H=0,V=t.text.length,X=!0,re=Je(t,e.doc.direction);if(re){var le=(e.options.lineWrapping?zs:Gs)(e,t,n,E,re,r,i);X=le.level!=1,H=X?le.from:le.to-1,V=X?le.to:le.from-1}var xe=null,ye=null,De=$e(function(lt){var ot=Or(e,E,lt);return ot.top+=N,ot.bottom+=N,ya(ot,r,i,!1)?(ot.top<=i&&ot.left<=r&&(xe=lt,ye=ot),!0):!1},H,V),Pe,Be,He=!1;if(ye){var Qe=r-ye.left<ye.right-r,Ke=Qe==X;De=xe+(Ke?0:1),Be=Ke?"after":"before",Pe=Qe?ye.left:ye.right}else{!X&&(De==V||De==H)&&De++,Be=De==0?"after":De==t.text.length?"before":Or(e,E,De-(X?1:0)).bottom+N<=i==X?"after":"before";var tt=Sr(e,Fe(n,De,Be),"line",t,E);Pe=tt.left,He=i<tt.top?-1:i>=tt.bottom?1:0}return De=Oe(t.text,De,1),ga(n,De,Be,He,r-Pe)}function Gs(e,t,n,r,i,E,N){var H=$e(function(le){var xe=i[le],ye=xe.level!=1;return ya(Sr(e,Fe(n,ye?xe.to:xe.from,ye?"before":"after"),"line",t,r),E,N,!0)},0,i.length-1),V=i[H];if(H>0){var X=V.level!=1,re=Sr(e,Fe(n,X?V.from:V.to,X?"after":"before"),"line",t,r);ya(re,E,N,!0)&&re.top>N&&(V=i[H-1])}return V}function zs(e,t,n,r,i,E,N){var H=co(e,t,r,N),V=H.begin,X=H.end;/\s/.test(t.text.charAt(X-1))&&X--;for(var re=null,le=null,xe=0;xe<i.length;xe++){var ye=i[xe];if(ye.from>=X||ye.to<=V)continue;var De=ye.level!=1,Pe=Or(e,r,De?Math.min(X,ye.to)-1:Math.max(V,ye.from)).right,Be=Pe<E?E-Pe+1e9:Pe-E;(!re||le>Be)&&(re=ye,le=Be)}return re||(re=i[i.length-1]),re.from<V&&(re={from:V,to:re.to,level:re.level}),re.to>X&&(re={from:re.from,to:X,level:re.level}),re}var an;function An(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(an==null){an=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)an.appendChild(document.createTextNode("x")),an.appendChild(a("br"));an.appendChild(document.createTextNode("x"))}d(e.measure,an);var n=an.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),f(e.measure),n||1}function Ln(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");d(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function ba(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,E=t.gutters.firstChild,N=0;E;E=E.nextSibling,++N){var H=e.display.gutterSpecs[N].className;n[H]=E.offsetLeft+E.clientLeft+i,r[H]=E.clientWidth}return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function xa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ho(e){var t=An(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Ln(e.display)-3);return function(i){if(Lr(e.doc,i))return 0;var E=0;if(i.widgets)for(var N=0;N<i.widgets.length;N++)i.widgets[N].height&&(E+=i.widgets[N].height);return n?E+(Math.ceil(i.text.length/r)||1)*t:E+t}}function Ea(e){var t=e.doc,n=ho(e);t.iter(function(r){var i=n(r);i!=r.height&&Zt(r,i)})}function on(e,t,n,r){var i=e.display;if(!n&&fe(t).getAttribute("cm-not-content")=="true")return null;var E,N,H=i.lineSpace.getBoundingClientRect();try{E=t.clientX-H.left,N=t.clientY-H.top}catch(le){return null}var V=va(e,E,N),X;if(r&&V.xRel>0&&(X=nt(e.doc,V.line).text).length==V.ch){var re=K(X,X.length,e.options.tabSize)-X.length;V=Fe(V.line,Math.max(0,Math.round((E-qa(e.display).left)/Ln(e.display))-re))}return V}function sn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function tr(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)$t&&Zn(e.doc,t)<i.viewTo&&Gr(e);else if(n<=i.viewFrom)$t&&Hr(e.doc,n+r)>i.viewFrom?Gr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Gr(e);else if(t<=i.viewFrom){var E=Ni(e,n,n+r,1);E?(i.view=i.view.slice(E.index),i.viewFrom=E.lineN,i.viewTo+=r):Gr(e)}else if(n>=i.viewTo){var N=Ni(e,t,t,-1);N?(i.view=i.view.slice(0,N.index),i.viewTo=N.lineN):Gr(e)}else{var H=Ni(e,t,t,-1),V=Ni(e,n,n+r,1);H&&V?(i.view=i.view.slice(0,H.index).concat(er(e,H.lineN,V.lineN)).concat(i.view.slice(V.index)),i.viewTo+=r):Gr(e)}var X=i.externalMeasured;X&&(n<X.lineN?X.lineN+=r:t<X.lineN+X.size&&(i.externalMeasured=null))}function Kr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var E=r.view[sn(e,t)];if(E.node==null)return;var N=E.changes||(E.changes=[]);q(N,n)==-1&&N.push(n)}function Gr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ni(e,t,n,r){var i=sn(e,t),E,N=e.display.view;if(!$t||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var H=e.display.viewFrom,V=0;V<i;V++)H+=N[V].size;if(H!=t){if(r>0){if(i==N.length-1)return null;E=H+N[i].size-t,i++}else E=H-t;t+=E,n+=E}for(;Zn(e.doc,n)!=n;){if(i==(r<0?0:N.length-1))return null;n+=r*N[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=er(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=er(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(sn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(er(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,sn(e,n)))),r.viewTo=n}function po(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function ai(e){e.display.input.showSelection(e.display.input.prepareSelection())}function mo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),E=r.selection=document.createDocumentFragment(),N=0;N<n.sel.ranges.length;N++){if(!t&&N==n.sel.primIndex)continue;var H=n.sel.ranges[N];if(H.from().line>=e.display.viewTo||H.to().line<e.display.viewFrom)continue;var V=H.empty();(V||e.options.showCursorWhenSelecting)&&go(e,H.head,i),V||Xs(e,H,E)}return r}function go(e,t,n){var r=Sr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(a("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var E=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));E.style.display="",E.style.left=r.other.left+"px",E.style.top=r.other.top+"px",E.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Bi(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,E=document.createDocumentFragment(),N=qa(e.display),H=N.left,V=Math.max(r.sizerWidth,nn(e)-r.sizer.offsetLeft)-N.right,X=i.direction=="ltr";function re(Ke,tt,lt,ot){tt<0&&(tt=0),tt=Math.round(tt),ot=Math.round(ot),E.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Ke+`px;
|
|
top: `+tt+"px; width: "+(lt==null?V-Ke:lt)+`px;
|
|
height: `+(ot-tt)+"px"))}function le(Ke,tt,lt){var ot=nt(i,Ke),pt=ot.text.length,Rt,Ht;function _t(Ut,ir){return ma(e,Fe(Ke,Ut),"div",ot,ir)}function lr(Ut,ir,zt){var Bt=fo(e,ot,null,Ut),Ft=ir=="ltr"==(zt=="after")?"left":"right",Mt=zt=="after"?Bt.begin:Bt.end-(/\s/.test(ot.text.charAt(Bt.end-1))?2:1);return _t(Mt,Ft)[Ft]}var nr=Je(ot,i.direction);return ze(nr,tt||0,lt==null?pt:lt,function(Ut,ir,zt,Bt){var Ft=zt=="ltr",Mt=_t(Ut,Ft?"left":"right"),ar=_t(ir-1,Ft?"right":"left"),jn=tt==null&&Ut==0,Jr=lt==null&&ir==pt,Yt=Bt==0,Rr=!nr||Bt==nr.length-1;if(ar.top-Mt.top<=3){var Kt=(X?jn:Jr)&&Yt,Va=(X?Jr:jn)&&Rr,jr=Kt?H:(Ft?Mt:ar).left,fn=Va?V:(Ft?ar:Mt).right;re(jr,Mt.top,fn-jr,Mt.bottom)}else{var hn,Qt,Wn,Xa;Ft?(hn=X&&jn&&Yt?H:Mt.left,Qt=X?V:lr(Ut,zt,"before"),Wn=X?H:lr(ir,zt,"after"),Xa=X&&Jr&&Rr?V:ar.right):(hn=X?lr(Ut,zt,"before"):H,Qt=!X&&jn&&Yt?V:Mt.right,Wn=!X&&Jr&&Rr?H:ar.left,Xa=X?lr(ir,zt,"after"):V),re(hn,Mt.top,Qt-hn,Mt.bottom),Mt.bottom<ar.top&&re(H,Mt.bottom,null,ar.top),re(Wn,ar.top,Xa-Wn,ar.bottom)}(!Rt||Bi(Mt,Rt)<0)&&(Rt=Mt),Bi(ar,Rt)<0&&(Rt=ar),(!Ht||Bi(Mt,Ht)<0)&&(Ht=Mt),Bi(ar,Ht)<0&&(Ht=ar)}),{start:Rt,end:Ht}}var xe=t.from(),ye=t.to();if(xe.line==ye.line)le(xe.line,xe.ch,ye.ch);else{var De=nt(i,xe.line),Pe=nt(i,ye.line),Be=dr(De)==dr(Pe),He=le(xe.line,xe.ch,Be?De.text.length+1:null).end,Qe=le(ye.line,Be?0:null,ye.ch).start;Be&&(He.top<Qe.top-2?(re(He.right,He.top,null,He.bottom),re(H,Qe.top,Qe.left,Qe.bottom)):re(He.right,He.top,Qe.left-He.right,He.bottom)),He.bottom<Qe.top&&re(H,He.bottom,null,Qe.top)}n.appendChild(E)}function Ta(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Dn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function vo(e){e.state.focused||(e.display.input.focus(),Sa(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Dn(e))},100)}function Sa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Le(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(),M&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ta(e)}function Dn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Le(e,"blur",e,t),e.state.focused=!1,c(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function ji(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],E=e.options.lineWrapping,N=void 0,H=0;if(i.hidden)continue;if(B&&F<8){var V=i.node.offsetTop+i.node.offsetHeight;N=V-n,n=V}else{var X=i.node.getBoundingClientRect();N=X.bottom-X.top,!E&&i.text.firstChild&&(H=i.text.firstChild.getBoundingClientRect().right-X.left-1)}var re=i.line.height-N;if((re>.005||re<-.005)&&(Zt(i.line,N),bo(i.line),i.rest))for(var le=0;le<i.rest.length;le++)bo(i.rest[le]);if(H>e.display.sizerWidth){var xe=Math.ceil(H/Ln(e.display));xe>e.display.maxLineLength&&(e.display.maxLineLength=xe,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function bo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Wi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Ui(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,E=vr(t,r),N=vr(t,i);if(n&&n.ensure){var H=n.ensure.from.line,V=n.ensure.to.line;H<E?(E=H,N=vr(t,Tr(nt(t,H))+e.wrapper.clientHeight)):Math.min(V,t.lastLine())>=N&&(E=vr(t,Tr(nt(t,V))-e.wrapper.clientHeight),N=V)}return{from:E,to:Math.max(N,E+1)}}function Ys(e,t){if(Me(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 E=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Ui(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Dr(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(E),E.scrollIntoView(i),e.display.lineSpace.removeChild(E)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Fe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Fe(t.line,t.ch+1,"before"):t);for(var E=0;E<5;E++){var N=!1,H=Sr(e,t),V=!n||n==t?H:Sr(e,n);i={left:Math.min(H.left,V.left),top:Math.min(H.top,V.top)-r,right:Math.max(H.left,V.left),bottom:Math.max(H.bottom,V.bottom)+r};var X=wa(e,i),re=e.doc.scrollTop,le=e.doc.scrollLeft;if(X.scrollTop!=null&&(si(e,X.scrollTop),Math.abs(e.doc.scrollTop-re)>1&&(N=!0)),X.scrollLeft!=null&&(ln(e,X.scrollLeft),Math.abs(e.doc.scrollLeft-le)>1&&(N=!0)),!N)break}return i}function Js(e,t){var n=wa(e,t);n.scrollTop!=null&&si(e,n.scrollTop),n.scrollLeft!=null&&ln(e,n.scrollLeft)}function wa(e,t){var n=e.display,r=An(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,E=fa(e),N={};t.bottom-t.top>E&&(t.bottom=t.top+E);var H=e.doc.height+ca(n),V=t.top<r,X=t.bottom>H-r;if(t.top<i)N.scrollTop=V?0:t.top;else if(t.bottom>i+E){var re=Math.min(t.top,(X?H:t.bottom)-E);re!=i&&(N.scrollTop=re)}var le=e.options.fixedGutter?0:n.gutters.offsetWidth,xe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-le,ye=nn(e)-n.gutters.offsetWidth,De=t.right-t.left>ye;return De&&(t.right=t.left+ye),t.left<10?N.scrollLeft=0:t.left<xe?N.scrollLeft=Math.max(0,t.left+le-(De?0:10)):t.right>ye+xe-3&&(N.scrollLeft=t.right+(De?0:10)-ye),N}function Ca(e,t){if(t==null)return;Hi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function On(e){Hi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function oi(e,t,n){(t!=null||n!=null)&&Hi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Qs(e,t){Hi(e),e.curOp.scrollToPos=t}function Hi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=uo(e,t.from),r=uo(e,t.to);xo(e,n,r,t.margin)}}function xo(e,t,n,r){var i=wa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});oi(e,i.scrollLeft,i.scrollTop)}function si(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;L||La(e,{top:t}),Eo(e,t,!0),L&&La(e),di(e,100)}function Eo(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function ln(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Ao(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function li(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ca(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Dr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var un=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Ce(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ce(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,B&&F<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};un.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var E=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+E)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},un.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},un.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},un.prototype.zeroWidthHack=function(){var e=s&&!C?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Y,this.disableVert=new Y},un.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),E=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);E!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},un.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ui=function(){};ui.prototype.update=function(){return{bottom:0,right:0}},ui.prototype.setScrollLeft=function(){},ui.prototype.setScrollTop=function(){},ui.prototype.clear=function(){};function Rn(e,t){t||(t=li(e));var n=e.display.barWidth,r=e.display.barHeight;To(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&ji(e),To(e,li(e)),n=e.display.barWidth,r=e.display.barHeight}function To(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var So={native:un,null:ui};function wo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&c(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new So[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ce(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?ln(e,t):si(e,t)},e),e.display.scrollbars.addClass&&U(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function dn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs},mr(e.curOp)}function cn(e){var t=e.curOp;t&&ks(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var i=0;i<t.length;i++)rl(t[i]);for(var E=0;E<t.length;E++)nl(t[E]);for(var N=0;N<t.length;N++)il(t[N])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&Ii(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Ki(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Aa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&ji(t),e.barMeasure=li(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=to(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Dr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-nn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&ln(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==P();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Rn(t,e.barMeasure),e.updatedDisplay&&Oa(t,e.barMeasure),e.selectionChanged&&Ta(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&vo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Co(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&Eo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&ln(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,ht(r,e.scrollToPos.from),ht(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var E=e.maybeHiddenMarkers,N=e.maybeUnhiddenMarkers;if(E)for(var H=0;H<E.length;++H)E[H].lines.length||Le(E[H],"hide");if(N)for(var V=0;V<N.length;++V)N[V].lines.length&&Le(N[V],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Le(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function sr(e,t){if(e.curOp)return t();dn(e);try{return t()}finally{cn(e)}}function jt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);dn(e);try{return t.apply(e,arguments)}finally{cn(e)}}}function Jt(e){return function(){if(this.curOp)return e.apply(this,arguments);dn(this);try{return e.apply(this,arguments)}finally{cn(this)}}}function Wt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);dn(t);try{return e.apply(this,arguments)}finally{cn(t)}}}function di(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,k(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=yr(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(E){if(r.line>=e.display.viewFrom){var N=E.styles,H=E.text.length>e.options.maxHighlightLength?Ar(t.mode,r.state):null,V=zn(e,E,r,!0);H&&(r.state=H),E.styles=V.styles;var X=E.styleClasses,re=V.classes;re?E.styleClasses=re:X&&(E.styleClasses=null);for(var le=!N||N.length!=E.styles.length||X!=re&&(!X||!re||X.bgClass!=re.bgClass||X.textClass!=re.textClass),xe=0;!le&&xe<N.length;++xe)le=N[xe]!=E.styles[xe];le&&i.push(r.line),E.stateAfter=r.save(),r.nextLine()}else E.text.length<=e.options.maxHighlightLength&&Vn(e,E.text,r),E.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return di(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&sr(e,function(){for(var E=0;E<i.length;E++)Kr(e,i[E],"text")})}var Ki=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Wi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=nn(e),this.force=n,this.dims=ba(e),this.events=[]};Ki.prototype.signal=function(e,t){ue(e,t)&&this.events.push(arguments)},Ki.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Le.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Dr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Dr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=P();if(!t||!x(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&x(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==P())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&x(document.body,e.anchorNode)&&x(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function Aa(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Gr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&po(e)==0)return!1;Lo(e)&&(Gr(e),t.dims=ba(e));var i=r.first+r.size,E=Math.max(t.visible.from-e.options.viewportMargin,r.first),N=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<E&&E-n.viewFrom<20&&(E=Math.max(r.first,n.viewFrom)),n.viewTo>N&&n.viewTo-N<20&&(N=Math.min(i,n.viewTo)),$t&&(E=Zn(e.doc,E),N=Hr(e.doc,N));var H=E!=n.viewFrom||N!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,E,N),n.viewOffset=Tr(nt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var V=po(e);if(!H&&V==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var X=sl(e);return V>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),V>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(X),f(n.cursorDiv),f(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,H&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,di(e,400)),n.updateLineNumbers=null,!0}function Co(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==nn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ca(e.display)-fa(e),n.top)}),t.visible=Wi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Wi(e.display,e.doc,n));if(!Aa(e,t))break;ji(e);var i=li(e);ai(e),Rn(e,i),Oa(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function La(e,t){var n=new Ki(e,t);if(Aa(e,n)){ji(e),Co(e,n);var r=li(e);ai(e),Rn(e,r),Oa(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,E=r.lineDiv,N=E.firstChild;function H(De){var Pe=De.nextSibling;return M&&s&&e.display.currentWheelTarget==De?De.style.display="none":De.parentNode.removeChild(De),Pe}for(var V=r.view,X=r.viewFrom,re=0;re<V.length;re++){var le=V[re];if(!le.hidden)if(!le.node||le.node.parentNode!=E){var xe=Us(e,le,X,n);E.insertBefore(xe,N)}else{for(;N!=le.node;)N=H(N);var ye=i&&t!=null&&t<=X&&le.lineNumber;le.changes&&(q(le.changes,"gutter")>-1&&(ye=!1),Ya(e,le,X,n)),ye&&(f(le.lineNumber),le.lineNumber.appendChild(document.createTextNode(mn(e.options,X)))),N=le.node.nextSibling}X+=le.size}for(;N;)N=H(N)}function Da(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Oa(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Dr(e)+"px"}function Ao(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=xa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,E=r+"px",N=0;N<n.length;N++)if(!n[N].hidden){e.options.fixedGutter&&(n[N].gutter&&(n[N].gutter.style.left=E),n[N].gutterBackground&&(n[N].gutterBackground.style.left=E));var H=n[N].alignable;if(H)for(var V=0;V<H.length;V++)H[V].style.left=E}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Lo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=mn(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(a("div",[a("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),E=i.firstChild.offsetWidth,N=i.offsetWidth-E;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(E,r.lineGutter.offsetWidth-N)+1,r.lineNumWidth=r.lineNumInnerWidth+N,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Da(e.display),!0}return!1}function Ra(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var E=e[i],N=null;if(typeof E!="string"&&(N=E.style,E=E.className),E=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:E,style:N})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Do(e){var t=e.gutters,n=e.gutterSpecs;f(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],E=i.className,N=i.style,H=t.appendChild(a("div",null,"CodeMirror-gutter "+E));N&&(H.style.cssText=N),E=="CodeMirror-linenumbers"&&(e.lineGutter=H,H.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Da(e)}function ci(e){Do(e.display),tr(e),Ao(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=y("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=y("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var E=y("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[E],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+ie+"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&&F<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!M&&!(L&&o)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=Ra(r.gutters,r.lineNumbers),Do(i),n.init(i)}var Gi=0,cr=null;B?cr=-.53:L?cr=15:g?cr=-.7:R&&(cr=-1/3);function Oo(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=Oo(e);return t.x*=cr,t.y*=cr,t}function Ro(e,t){var n=Oo(t),r=n.x,i=n.y,E=e.display,N=E.scroller,H=N.scrollWidth>N.clientWidth,V=N.scrollHeight>N.clientHeight;if(!(r&&H||i&&V))return;if(i&&s&&M){e:for(var X=t.target,re=E.view;X!=N;X=X.parentNode)for(var le=0;le<re.length;le++)if(re[le].node==X){e.display.currentWheelTarget=X;break e}}if(r&&!L&&!T&&cr!=null){i&&V&&si(e,Math.max(0,N.scrollTop+i*cr)),ln(e,Math.max(0,N.scrollLeft+r*cr)),(!i||i&&V)&&$(t),E.wheelStartX=null;return}if(i&&cr!=null){var xe=i*cr,ye=e.doc.scrollTop,De=ye+E.wrapper.clientHeight;xe<0?ye=Math.max(0,ye+xe-50):De=Math.min(e.doc.height,De+xe+50),La(e,{top:ye,bottom:De})}Gi<20&&(E.wheelStartX==null?(E.wheelStartX=N.scrollLeft,E.wheelStartY=N.scrollTop,E.wheelDX=r,E.wheelDY=i,setTimeout(function(){if(E.wheelStartX==null)return;var Pe=N.scrollLeft-E.wheelStartX,Be=N.scrollTop-E.wheelStartY,He=Be&&E.wheelDY&&Be/E.wheelDY||Pe&&E.wheelDX&&Pe/E.wheelDX;if(E.wheelStartX=E.wheelStartY=null,!He)return;cr=(cr*Gi+He)/(Gi+1),++Gi},200)):(E.wheelDX+=r,E.wheelDY+=i))}var fr=function(e,t){this.ranges=e,this.primIndex=t};fr.prototype.primary=function(){return this.ranges[this.primIndex]},fr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!Gn(n.anchor,r.anchor)||!Gn(n.head,r.head))return!1}return!0},fr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new At(gn(this.ranges[t].anchor),gn(this.ranges[t].head));return new fr(e,this.primIndex)},fr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},fr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ct(t,r.from())>=0&&ct(e,r.to())<=0)return n}return-1};var At=function(e,t){this.anchor=e,this.head=t};At.prototype.from=function(){return Qr(this.anchor,this.head)},At.prototype.to=function(){return vn(this.anchor,this.head)},At.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function wr(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(xe,ye){return ct(xe.from(),ye.from())}),n=q(t,i);for(var E=1;E<t.length;E++){var N=t[E],H=t[E-1],V=ct(H.to(),N.from());if(r&&!N.empty()?V>0:V>=0){var X=Qr(H.from(),N.from()),re=vn(H.to(),N.to()),le=H.empty()?N.from()==N.head:H.from()==H.head;E<=n&&--n,t.splice(--E,2,new At(le?re:X,le?X:re))}}return new fr(t,n)}function zr(e,t){return new fr([new At(e,t||e)],0)}function Vr(e){return e.text?Fe(e.from.line+e.text.length-1,J(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function ko(e,t){if(ct(e,t.from)<0)return e;if(ct(e,t.to)<=0)return Vr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Vr(t).ch-t.to.ch),Fe(n,r)}function ka(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new At(ko(i.anchor,t),ko(i.head,t)))}return wr(e.cm,n,e.sel.primIndex)}function _o(e,t,n){return e.line==t.line?Fe(n.line,e.ch-t.ch+n.ch):Fe(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Fe(e.first,0),E=i,N=0;N<t.length;N++){var H=t[N],V=_o(H.from,i,E),X=_o(Vr(H),i,E);if(i=H.to,E=X,n=="around"){var re=e.sel.ranges[N],le=ct(re.head,re.anchor)<0;r[N]=new At(le?X:V,le?V:X)}else r[N]=new At(V,V)}return new fr(r,e.sel.primIndex)}function _a(e){e.doc.mode=gr(e.options,e.doc.modeOption),fi(e)}function fi(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,di(e,100),e.state.modeGen++,e.curOp&&tr(e)}function Po(e,t){return t.from.ch==0&&t.to.ch==0&&J(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Pa(e,t,n,r){function i(Qe){return n?n[Qe]:null}function E(Qe,Ke,tt){ua(Qe,Ke,tt,r),Gt(Qe,"change",Qe,t)}function N(Qe,Ke){for(var tt=[],lt=Qe;lt<Ke;++lt)tt.push(new rn(X[lt],i(lt),r));return tt}var H=t.from,V=t.to,X=t.text,re=nt(e,H.line),le=nt(e,V.line),xe=J(X),ye=i(X.length-1),De=V.line-H.line;if(t.full)e.insert(0,N(0,X.length)),e.remove(X.length,e.size-X.length);else if(Po(e,t)){var Pe=N(0,X.length-1);E(le,le.text,ye),De&&e.remove(H.line,De),Pe.length&&e.insert(H.line,Pe)}else if(re==le)if(X.length==1)E(re,re.text.slice(0,H.ch)+xe+re.text.slice(V.ch),ye);else{var Be=N(1,X.length-1);Be.push(new rn(xe+re.text.slice(V.ch),ye,r)),E(re,re.text.slice(0,H.ch)+X[0],i(0)),e.insert(H.line+1,Be)}else if(X.length==1)E(re,re.text.slice(0,H.ch)+X[0]+le.text.slice(V.ch),i(0)),e.remove(H.line+1,De);else{E(re,re.text.slice(0,H.ch)+X[0],i(0)),E(le,xe+le.text.slice(V.ch),ye);var He=N(1,X.length-1);De>1&&e.remove(H.line+1,De-1),e.insert(H.line+1,He)}Gt(e,"change",e,t)}function Xr(e,t,n){function r(i,E,N){if(i.linked)for(var H=0;H<i.linked.length;++H){var V=i.linked[H];if(V.doc==E)continue;var X=N&&V.sharedHist;if(n&&!X)continue;t(V.doc,X),r(V.doc,i,X)}}r(e,null,!0)}function Mo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ea(e),_a(e),Io(e),e.options.lineWrapping||Ii(e),e.options.mode=t.modeOption,tr(e)}function Io(e){(e.doc.direction=="rtl"?U:c)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){sr(e,function(){Io(e),tr(e)})}function zi(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ma(e,t){var n={from:gn(t.from),to:Vr(t),text:_r(e,t.from,t.to)};return No(e,n,t.from.line,t.to.line+1),Xr(e,function(r){return No(r,n,t.from.line,t.to.line+1)},!0),n}function Uo(e){for(;e.length;){var t=J(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Uo(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 Fo(e,t,n,r){var i=e.history;i.undone.length=0;var E=+new Date,N,H;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>E-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(N=pl(i,i.lastOp==r)))H=J(N.changes),ct(t.from,t.to)==0&&ct(t.from,H.to)==0?H.to=Vr(t):N.changes.push(Ma(e,t));else{var V=J(i.done);for((!V||!V.ranges)&&Vi(e.sel,i.done),N={changes:[Ma(e,t)],generation:i.generation},i.done.push(N);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=E,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,H||Le(e,"historyAdded")}function ml(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,E=r&&r.origin;n==i.lastSelOp||E&&i.lastSelOrigin==E&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==E||ml(e,E,J(i.done),t))?i.done[i.done.length-1]=t:Vi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=E,i.lastSelOp=n,r&&r.clearRedo!==!1&&Uo(i.undone)}function Vi(e,t){var n=J(t);n&&n.ranges&&n.equals(e)||t.push(e)}function No(e,t,n,r){var i=t["spans_"+e.id],E=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(N){N.markedSpans&&((i||(i=t["spans_"+e.id]={}))[E]=N.markedSpans),++E})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function Bo(e,t){var n=yl(e,t),r=xn(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var E=n[i],N=r[i];if(E&&N){e:for(var H=0;H<N.length;++H){for(var V=N[H],X=0;X<E.length;++X)if(E[X].marker==V.marker)continue e;E.push(V)}}else N&&(n[i]=N)}return n}function kn(e,t,n){for(var r=[],i=0;i<e.length;++i){var E=e[i];if(E.ranges){r.push(n?fr.prototype.deepCopy.call(E):E);continue}var N=E.changes,H=[];r.push({changes:H});for(var V=0;V<N.length;++V){var X=N[V],re=void 0;if(H.push({from:X.from,to:X.to,text:X.text}),t)for(var le in X)(re=le.match(/^spans_(\d+)$/))&&(q(t,Number(re[1]))>-1&&(J(H)[le]=X[le],delete X[le]))}}return r}function Ia(e,t,n,r){if(r){var i=e.anchor;if(n){var E=ct(t,i)<0;E!=ct(n,i)<0?(i=t,t=n):E!=ct(t,n)<0&&(t=n)}return new At(i,t)}else return new At(n||t,t)}function Xi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Xt(e,new fr([Ia(e.sel.primary(),t,n,i)],0),r)}function jo(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),E=0;E<e.sel.ranges.length;E++)r[E]=Ia(e.sel.ranges[E],t[E],null,i);var N=wr(e.cm,r,e.sel.primIndex);Xt(e,N,n)}function Ua(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Xt(e,wr(e.cm,i,e.sel.primIndex),r)}function Wo(e,t,n,r){Xt(e,zr(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var E=0;E<i.length;E++)this.ranges[E]=new At(ht(e,i[E].anchor),ht(e,i[E].head))},origin:n&&n.origin};return Le(e,"beforeSelectionChange",e,r),e.cm&&Le(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?wr(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,n){var r=e.history.done,i=J(r);i&&i.ranges?(r[r.length-1]=t,Yi(e,t,n)):Xt(e,t,n)}function Xt(e,t,n){Yi(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Yi(e,t,n){(ue(e,"beforeSelectionChange")||e.cm&&ue(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(ct(t.primary().head,e.sel.primary().head)<0?-1:1);Ko(e,zo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&On(e.cm)}function Ko(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,pe(e.cm)),Gt(e,"cursorActivity",e)}function Go(e){Ko(e,zo(e,e.sel,null,!1))}function zo(e,t,n,r){for(var i,E=0;E<t.ranges.length;E++){var N=t.ranges[E],H=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[E],V=$i(e,N.anchor,H&&H.anchor,n,r),X=$i(e,N.head,H&&H.head,n,r);(i||V!=N.anchor||X!=N.head)&&(i||(i=t.ranges.slice(0,E)),i[E]=new At(V,X))}return i?wr(e.cm,i,t.primIndex):t}function _n(e,t,n,r,i){var E=nt(e,t.line);if(E.markedSpans)for(var N=0;N<E.markedSpans.length;++N){var H=E.markedSpans[N],V=H.marker,X="selectLeft"in V?!V.selectLeft:V.inclusiveLeft,re="selectRight"in V?!V.selectRight:V.inclusiveRight;if((H.from==null||(X?H.from<=t.ch:H.from<t.ch))&&(H.to==null||(re?H.to>=t.ch:H.to>t.ch))){if(i&&(Le(V,"beforeCursorEnter"),V.explicitlyCleared))if(E.markedSpans){--N;continue}else break;if(!V.atomic)continue;if(n){var le=V.find(r<0?1:-1),xe=void 0;if((r<0?re:X)&&(le=Vo(e,le,-r,le&&le.line==t.line?E:null)),le&&le.line==t.line&&(xe=ct(le,n))&&(r<0?xe<0:xe>0))return _n(e,le,t,r,i)}var ye=V.find(r<0?-1:1);return(r<0?X:re)&&(ye=Vo(e,ye,r,ye.line==t.line?E:null)),ye?_n(e,ye,t,r,i):null}}return t}function $i(e,t,n,r,i){var E=r||1,N=_n(e,t,n,E,i)||!i&&_n(e,t,n,E,!0)||_n(e,t,n,-E,i)||!i&&_n(e,t,n,-E,!0);return N||(e.cantEdit=!0,Fe(e.first,0))}function Vo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ht(e,Fe(t.line-1)):null:n>0&&t.ch==(r||nt(e,t.line)).text.length?t.line<e.first+e.size-1?Fe(t.line+1,0):null:new Fe(t.line,t.ch+n)}function Xo(e){e.setSelection(Fe(e.firstLine(),0),Fe(e.lastLine()),ve)}function Yo(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,E,N,H){i&&(r.from=ht(e,i)),E&&(r.to=ht(e,E)),N&&(r.text=N),H!==void 0&&(r.origin=H)}),Le(e,"beforeChange",e,r),e.cm&&Le(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Pn(e,t,n){if(e.cm){if(!e.cm.curOp)return jt(e.cm,Pn)(e,t,n);if(e.cm.state.suppressEdits)return}if((ue(e,"beforeChange")||e.cm&&ue(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=Jn&&!n&&_i(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)$o(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else $o(e,t)}function $o(e,t){if(t.text.length==1&&t.text[0]==""&&ct(t.from,t.to)==0)return;var n=ka(e,t);Fo(e,t,n,e.cm?e.cm.curOp.id:NaN),hi(e,t,n,xn(e,t));var r=[];Xr(e,function(i,E){!E&&q(r,i.history)==-1&&(qo(i.history,t),r.push(i.history)),hi(i,t,null,xn(i,t))})}function Ji(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,E,N=e.sel,H=t=="undo"?i.done:i.undone,V=t=="undo"?i.undone:i.done,X=0;X<H.length&&!(E=H[X],n?E.ranges&&!E.equals(e.sel):!E.ranges);X++);if(X==H.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(E=H.pop(),E.ranges){if(Vi(E,V),n&&!E.equals(e.sel)){Xt(e,E,{clearRedo:!1});return}N=E}else if(r){H.push(E);return}else break;var re=[];Vi(N,V),V.push({changes:re,generation:i.generation}),i.generation=E.generation||++i.maxGeneration;for(var le=ue(e,"beforeChange")||e.cm&&ue(e.cm,"beforeChange"),xe=function(Pe){var Be=E.changes[Pe];if(Be.origin=t,le&&!Yo(e,Be,!1))return H.length=0,{};re.push(Ma(e,Be));var He=Pe?ka(e,Be):J(H);hi(e,Be,He,Bo(e,Be)),!Pe&&e.cm&&e.cm.scrollIntoView({from:Be.from,to:Vr(Be)});var Qe=[];Xr(e,function(Ke,tt){!tt&&q(Qe,Ke.history)==-1&&(qo(Ke.history,Be),Qe.push(Ke.history)),hi(Ke,Be,null,Bo(Ke,Be))})},ye=E.changes.length-1;ye>=0;--ye){var De=xe(ye);if(De)return De.v}}function Jo(e,t){if(t==0)return;if(e.first+=t,e.sel=new fr(ne(e.sel.ranges,function(i){return new At(Fe(i.anchor.line+t,i.anchor.ch),Fe(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){tr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Kr(e.cm,r,"gutter")}}function hi(e,t,n,r){if(e.cm&&!e.cm.curOp)return jt(e.cm,hi)(e,t,n,r);if(t.to.line<e.first){Jo(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);Jo(e,i),t={from:Fe(e.first,0),to:Fe(t.to.line+i,t.to.ch),text:[J(t.text)],origin:t.origin}}var E=e.lastLine();t.to.line>E&&(t={from:t.from,to:Fe(E,nt(e,E).text.length),text:[t.text[0]],origin:t.origin}),t.removed=_r(e,t.from,t.to),n||(n=ka(e,t)),e.cm?xl(e.cm,t,r):Pa(e,t,r),Yi(e,n,ve),e.cantEdit&&$i(e,Fe(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,n){var r=e.doc,i=e.display,E=t.from,N=t.to,H=!1,V=E.line;e.options.lineWrapping||(V=wt(dr(nt(r,E.line))),r.iter(V,N.line+1,function(ye){if(ye==i.maxLine)return H=!0,!0})),r.sel.contains(t.from,t.to)>-1&&pe(e),Pa(r,t,n,ho(e)),e.options.lineWrapping||(r.iter(V,E.line+t.text.length,function(ye){var De=ei(ye);De>i.maxLineLength&&(i.maxLine=ye,i.maxLineLength=De,i.maxLineChanged=!0,H=!1)}),H&&(e.curOp.updateMaxLine=!0)),aa(r,E.line),di(e,400);var X=t.text.length-(N.line-E.line)-1;t.full?tr(e):E.line==N.line&&t.text.length==1&&!Po(e.doc,t)?Kr(e,E.line,"text"):tr(e,E.line,N.line+1,X);var re=ue(e,"changes"),le=ue(e,"change");if(le||re){var xe={from:E,to:N,text:t.text,removed:t.removed,origin:t.origin};le&&Gt(e,"change",e,xe),re&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(xe)}e.display.selForContextMenu=null}function Mn(e,t,n,r,i){var E;r||(r=n),ct(r,n)<0&&(E=[r,n],n=E[0],r=E[1]),typeof t=="string"&&(t=e.splitLines(t)),Pn(e,{from:n,to:r,text:t,origin:i})}function Qo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Zo(e,t,n,r){for(var i=0;i<e.length;++i){var E=e[i],N=!0;if(E.ranges){E.copied||(E=e[i]=E.deepCopy(),E.copied=!0);for(var H=0;H<E.ranges.length;H++)Qo(E.ranges[H].anchor,t,n,r),Qo(E.ranges[H].head,t,n,r);continue}for(var V=0;V<E.changes.length;++V){var X=E.changes[V];if(n<X.from.line)X.from=Fe(X.from.line+r,X.from.ch),X.to=Fe(X.to.line+r,X.to.ch);else if(t<=X.to.line){N=!1;break}}N||(e.splice(0,i+1),i=0)}}function qo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Zo(e.done,n,r,i),Zo(e.undone,n,r,i)}function pi(e,t,n,r){var i=t,E=t;return typeof t=="number"?E=nt(e,yn(e,t)):i=wt(t),i==null?null:(r(E,i)&&e.cm&&Kr(e.cm,i,n),E)}function mi(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}mi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,it(i),Gt(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function gi(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}gi.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var E=Math.min(t,i-e),N=r.height;if(r.removeInner(e,E),this.height-=N-r.height,i==E&&(this.children.splice(n--,1),r.parent=null),(t-=E)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof mi))){var H=[];this.collapse(H),this.children=[new mi(H)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],E=i.chunkSize();if(e<=E){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var N=i.lines.length%25+25,H=N;H<i.lines.length;){var V=new mi(i.lines.slice(H,H+=25));i.height-=V.height,this.children.splice(++r,0,V),V.parent=this}i.lines=i.lines.slice(0,N),this.maybeSpill()}break}e-=E}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new gi(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=q(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new gi(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],E=i.chunkSize();if(e<E){var N=Math.min(t,E-e);if(i.iterN(e,N,n))return!0;if((t-=N)==0)break;e=0}else e-=E}}};var vi=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};vi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=wt(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var E=ni(this);Zt(n,Math.max(0,n.height-E)),e&&(sr(e,function(){es(e,n,-E),Kr(e,r,"widget")}),Gt(e,"lineWidgetCleared",e,this,r))},vi.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ni(this)-t;if(!i)return;Lr(this.doc,r)||Zt(r,r.height+i),n&&sr(n,function(){n.curOp.forceUpdate=!0,es(n,r,i),Gt(n,"lineWidgetChanged",n,e,wt(r))})},de(vi);function es(e,t,n){Tr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ca(e,n)}function El(e,t,n,r){var i=new vi(e,n,r),E=e.cm;return E&&i.noHScroll&&(E.display.alignWidgets=!0),pi(e,t,"widget",function(N){var H=N.widgets||(N.widgets=[]);if(i.insertAt==null?H.push(i):H.splice(Math.min(H.length-1,Math.max(0,i.insertAt)),0,i),i.line=N,E&&!Lr(e,N)){var V=Tr(N)<e.scrollTop;Zt(N,N.height+ni(i)),V&&Ca(E,i.height),E.curOp.forceUpdate=!0}return!0}),E&&Gt(E,"lineWidgetAdded",E,i,typeof t=="number"?t:wt(t)),i}var ts=0,Yr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};Yr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&dn(e),ue(this,"clear")){var n=this.find();n&&Gt(this,"clear",n.from,n.to)}for(var r=null,i=null,E=0;E<this.lines.length;++E){var N=this.lines[E],H=Er(N.markedSpans,this);e&&!this.collapsed?Kr(e,wt(N),"text"):e&&(H.to!=null&&(i=wt(N)),H.from!=null&&(r=wt(N))),N.markedSpans=Qn(N.markedSpans,H),H.from==null&&this.collapsed&&!Lr(this.doc,N)&&e&&Zt(N,An(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var V=0;V<this.lines.length;++V){var X=dr(this.lines[V]),re=ei(X);re>e.display.maxLineLength&&(e.display.maxLine=X,e.display.maxLineLength=re,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&tr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Go(e.doc)),e&&Gt(e,"markerCleared",e,this,r,i),t&&cn(e),this.parent&&this.parent.clear()},Yr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var E=this.lines[i],N=Er(E.markedSpans,this);if(N.from!=null&&(n=Fe(t?E:wt(E),N.from),e==-1))return n;if(N.to!=null&&(r=Fe(t?E:wt(E),N.to),e==1))return r}return n&&{from:n,to:r}},Yr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;sr(r,function(){var i=t.line,E=wt(t.line),N=ha(r,E);if(N&&(io(N),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Lr(n.doc,i)&&n.height!=null){var H=n.height;n.height=null;var V=ni(n)-H;V&&Zt(i,i.height+V)}Gt(r,"markerChanged",r,e)})},Yr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||q(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Yr.prototype.detachLine=function(e){if(this.lines.splice(q(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},de(Yr);function In(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return jt(e.cm,In)(e,t,n,r,i);var E=new Yr(e,i),N=ct(t,n);if(r&&O(r,E,!1),N>0||N==0&&E.clearWhenEmpty!==!1)return E;if(E.replacedWith&&(E.collapsed=!0,E.widgetNode=y("span",[E.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||E.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(E.widgetNode.insertLeft=!0)),E.collapsed){if(Pi(e,t.line,t,n,E)||t.line!=n.line&&Pi(e,n.line,t,n,E))throw new Error("Inserting collapsed marker partially overlapping an existing one");oa()}E.addToHistory&&Fo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var H=t.line,V=e.cm,X;if(e.iter(H,n.line+1,function(le){V&&E.collapsed&&!V.options.lineWrapping&&dr(le)==V.display.maxLine&&(X=!0),E.collapsed&&H!=t.line&&Zt(le,0),sa(le,new qr(E,H==t.line?t.ch:null,H==n.line?n.ch:null)),++H}),E.collapsed&&e.iter(t.line,n.line+1,function(le){Lr(e,le)&&Zt(le,0)}),E.clearOnEnter&&Ce(E,"beforeCursorEnter",function(){return E.clear()}),E.readOnly&&(Wr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),E.collapsed&&(E.id=++ts,E.atomic=!0),V){if(X&&(V.curOp.updateMaxLine=!0),E.collapsed)tr(V,t.line,n.line+1);else if(E.className||E.startStyle||E.endStyle||E.css||E.attributes||E.title)for(var re=t.line;re<=n.line;re++)Kr(V,re,"text");E.atomic&&Go(V.doc),Gt(V,"markerAdded",V,E)}return E}var yi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};yi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Gt(this,"clear")},yi.prototype.find=function(e,t){return this.primary.find(e,t)},de(yi);function Tl(e,t,n,r,i){r=O(r),r.shared=!1;var E=[In(e,t,n,r,i)],N=E[0],H=r.widgetNode;return Xr(e,function(V){H&&(r.widgetNode=H.cloneNode(!0)),E.push(In(V,ht(V,t),ht(V,n),r,i));for(var X=0;X<V.linked.length;++X)if(V.linked[X].isParent)return;N=J(E)}),new yi(E,N)}function rs(e){return e.findMarks(Fe(e.first,0),e.clipPos(Fe(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),E=e.clipPos(i.from),N=e.clipPos(i.to);if(ct(E,N)){var H=In(e,E,N,r.primary,r.primary.type);r.markers.push(H),H.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],E=[i.primary.doc];Xr(i.primary.doc,function(V){return E.push(V)});for(var N=0;N<i.markers.length;N++){var H=i.markers[N];q(E,H.doc)==-1&&(H.parent=null,i.markers.splice(N--,1))}},n=0;n<e.length;n++)t(n)}var Cl=0,rr=function(e,t,n,r,i){if(!(this instanceof rr))return new rr(e,t,n,r,i);n==null&&(n=0),gi.call(this,[new mi([new rn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var E=Fe(n,0);this.sel=zr(E),this.history=new zi(null),this.id=++Cl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Pa(this,{from:E,to:E,text:e}),Xt(this,zr(E),ve)};rr.prototype=Ae(gi.prototype,{constructor:rr,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=pn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Wt(function(e){var t=Fe(this.first,0),n=this.first+this.size-1;Pn(this,{from:t,to:Fe(n,nt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&oi(this.cm,0,0),Xt(this,zr(t),ve)}),replaceRange:function(e,t,n,r){t=ht(this,t),n=n?ht(this,n):t,Mn(this,e,t,n,r)},getRange:function(e,t,n){var r=_r(this,ht(this,e),ht(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(Pr(this,e))return nt(this,e)},getLineNumber:function(e){return wt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=nt(this,e)),dr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ht(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Wt(function(e,t,n){Wo(this,ht(this,typeof e=="number"?Fe(e,t||0):e),null,n)}),setSelection:Wt(function(e,t,n){Wo(this,ht(this,e),ht(this,t||e),n)}),extendSelection:Wt(function(e,t,n){Xi(this,ht(this,e),t&&ht(this,t),n)}),extendSelections:Wt(function(e,t){jo(this,Ne(this,e),t)}),extendSelectionsBy:Wt(function(e,t){var n=ne(this.sel.ranges,e);jo(this,Ne(this,n),t)}),setSelections:Wt(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new At(ht(this,e[i].anchor),ht(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Xt(this,wr(this.cm,r,t),n)}),addSelection:Wt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new At(ht(this,e),ht(this,t||e))),Xt(this,wr(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=_r(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=_r(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Wt(function(e,t,n){for(var r=[],i=this.sel,E=0;E<i.ranges.length;E++){var N=i.ranges[E];r[E]={from:N.from(),to:N.to(),text:this.splitLines(e[E]),origin:n}}for(var H=t&&t!="end"&&fl(this,r,t),V=r.length-1;V>=0;V--)Pn(this,r[V]);H?Ho(this,H):this.cm&&On(this.cm)}),undo:Wt(function(){Ji(this,"undo")}),redo:Wt(function(){Ji(this,"redo")}),undoSelection:Wt(function(){Ji(this,"undo",!0)}),redoSelection:Wt(function(){Ji(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new zi(this.history.maxGeneration),Xr(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:kn(this.history.done),undone:kn(this.history.undone)}},setHistory:function(e){var t=this.history=new zi(this.history.maxGeneration);t.done=kn(e.done.slice(0),null,!0),t.undone=kn(e.undone.slice(0),null,!0)},setGutterMarker:Wt(function(e,t,n){return pi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Ue(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Wt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&pi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Ue(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Pr(this,e))return null;if(t=e,e=nt(this,e),!e)return null}else if(t=wt(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Wt(function(e,t,n){return pi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(b(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Wt(function(e,t,n){return pi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",E=r[i];if(E)if(n==null)r[i]=null;else{var N=E.match(b(n));if(!N)return!1;var H=N.index+N[0].length;r[i]=E.slice(0,N.index)+(!N.index||H==E.length?"":" ")+E.slice(H)||null}else return!1;return!0})}),addLineWidget:Wt(function(e,t,n){return El(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return In(this,ht(this,e),ht(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=ht(this,e),In(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ht(this,e);var t=[],n=nt(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ht(this,e),t=ht(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(E){var N=E.markedSpans;if(N)for(var H=0;H<N.length;H++){var V=N[H];!(V.to!=null&&i==e.line&&e.ch>=V.to||V.from==null&&i!=e.line||V.from!=null&&i==t.line&&V.from>=t.ch)&&(!n||n(V.marker))&&r.push(V.marker.parent||V.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var E=i.text.length+r;if(E>e)return t=e,!0;e-=E,++n}),ht(this,Fe(n,t))},indexFromPos:function(e){e=ht(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new rr(pn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new rr(pn(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(r,rs(this)),r},unlinkDoc:function(e){if(e instanceof kt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(rs(this));break}if(e.history==this.history){var r=[e.id];Xr(e,function(i){return r.push(i.id)},!0),e.history=new zi(null),e.history.done=kn(this.history.done,r),e.history.undone=kn(this.history.undone,r)}},iterLinkedDocs:function(e){Xr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):dt(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Wt(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&hl(this.cm)})}),rr.prototype.eachLine=rr.prototype.iter;var ns=0;function Al(e){var t=this;if(is(t),Me(t,e)||Nr(t.display,e))return;$(e),B&&(ns=+new Date);var n=on(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,E=Array(i),N=0,H=function(){++N==i&&jt(t,function(){n=ht(t.doc,n);var ye={from:n,to:n,text:t.doc.splitLines(E.filter(function(De){return De!=null}).join(t.doc.lineSeparator())),origin:"paste"};Pn(t.doc,ye),Ho(t.doc,zr(ht(t.doc,n),ht(t.doc,Vr(ye))))})()},V=function(ye,De){if(t.options.allowDropFileTypes&&q(t.options.allowDropFileTypes,ye.type)==-1){H();return}var Pe=new FileReader;Pe.onerror=function(){return H()},Pe.onload=function(){var Be=Pe.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Be)){H();return}E[De]=Be,H()},Pe.readAsText(ye)},X=0;X<r.length;X++)V(r[X],X);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var re=e.dataTransfer.getData("Text");if(re){var le;if(t.state.draggingText&&!t.state.draggingText.copy&&(le=t.listSelections()),Yi(t.doc,zr(n,n)),le)for(var xe=0;xe<le.length;++xe)Mn(t.doc,"",le[xe].anchor,le[xe].head,"drag");t.replaceSelection(re,"around","paste"),t.display.input.focus()}}catch(ye){}}}function Ll(e,t){if(B&&(!e.state.draggingText||+new Date-ns<100)){se(t);return}if(Me(e,t)||Nr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!R){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",T&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),T&&n.parentNode.removeChild(n)}}function Dl(e,t){var n=on(e,t);if(!n)return;var r=document.createDocumentFragment();go(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),d(e.display.dragCursor,r)}function is(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function as(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var E=0;E<n.length;E++)e(n[E])})}var os=!1;function Ol(){if(os)return;Rl(),os=!0}function Rl(){var e;Ce(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(kl)},100))}),Ce(window,"blur",function(){return as(Dn)})}function kl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var $r={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},bi=0;bi<10;bi++)$r[bi+48]=$r[bi+96]=String(bi);for(var Qi=65;Qi<=90;Qi++)$r[Qi]=String.fromCharCode(Qi);for(var xi=1;xi<=12;xi++)$r[xi+111]=$r[xi+63235]="F"+xi;var Br={};Br.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Br.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Br.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Br.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Br.default=s?Br.macDefault:Br.pcDefault;function _l(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,E,N=0;N<t.length-1;N++){var H=t[N];if(/^(cmd|meta|m)$/i.test(H))E=!0;else if(/^a(lt)?$/i.test(H))n=!0;else if(/^(c|ctrl|control)$/i.test(H))r=!0;else if(/^s(hift)?$/i.test(H))i=!0;else throw new Error("Unrecognized modifier name: "+H)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),E&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Pl(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=ne(n.split(" "),_l),E=0;E<i.length;E++){var N=void 0,H=void 0;E==i.length-1?(H=i.join(" "),N=r):(H=i.slice(0,E+1).join(" "),N="...");var V=t[H];if(!V)t[H]=N;else if(V!=N)throw new Error("Inconsistent bindings for "+H)}delete e[n]}for(var X in t)e[X]=t[X];return e}function Un(e,t,n,r){t=Zi(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Un(e,t.fallthrough,n,r);for(var E=0;E<t.fallthrough.length;E++){var N=Un(e,t.fallthrough[E],n,r);if(N)return N}}}function ss(e){var t=typeof e=="string"?e:$r[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ls(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(h?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(h?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function us(e,t){if(T&&e.keyCode==34&&e.char)return!1;var n=$r[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),ls(n,e,t))}function Zi(e){return typeof e=="string"?Br[e]:e}function Fn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var E=t(n[i]);r.length&&ct(E.from,J(r).to)<=0;){var N=r.pop();if(ct(N.from,E.from)<0){E.from=N.from;break}}r.push(E)}sr(e,function(){for(var H=r.length-1;H>=0;H--)Mn(e.doc,"",r[H].from,r[H].to,"+delete");On(e)})}function Fa(e,t,n){var r=Oe(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Na(e,t,n){var r=Fa(e,t.ch,n);return r==null?null:new Fe(t.line,r,n<0?"after":"before")}function Ba(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var E=Je(n,t.doc.direction);if(E){var N=i<0?J(E):E[0],H=i<0==(N.level==1),V=H?"after":"before",X;if(N.level>0||t.doc.direction=="rtl"){var re=Cn(t,n);X=i<0?n.text.length-1:0;var le=Or(t,re,X).top;X=$e(function(xe){return Or(t,re,xe).top==le},i<0==(N.level==1)?N.from:N.to-1,X),V=="before"&&(X=Fa(n,X,1))}else X=i<0?N.to:N.from;return new Fe(r,X,V)}}return new Fe(r,i<0?n.text.length:0,i<0?"before":"after")}function Ml(e,t,n,r){var i=Je(t,e.doc.direction);if(!i)return Na(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var E=Ge(i,n.ch,n.sticky),N=i[E];if(e.doc.direction=="ltr"&&N.level%2==0&&(r>0?N.to>n.ch:N.from<n.ch))return Na(t,n,r);var H=function(He,Qe){return Fa(t,He instanceof Fe?He.ch:He,Qe)},V,X=function(He){return e.options.lineWrapping?(V=V||Cn(e,t),fo(e,t,V,He)):{begin:0,end:t.text.length}},re=X(n.sticky=="before"?H(n,-1):n.ch);if(e.doc.direction=="rtl"||N.level==1){var le=N.level==1==r<0,xe=H(n,le?1:-1);if(xe!=null&&(le?xe<=N.to&&xe<=re.end:xe>=N.from&&xe>=re.begin)){var ye=le?"before":"after";return new Fe(n.line,xe,ye)}}var De=function(He,Qe,Ke){for(var tt=function(Rt,Ht){return Ht?new Fe(n.line,H(Rt,1),"before"):new Fe(n.line,Rt,"after")};He>=0&&He<i.length;He+=Qe){var lt=i[He],ot=Qe>0==(lt.level!=1),pt=ot?Ke.begin:H(Ke.end,-1);if(lt.from<=pt&&pt<lt.to)return tt(pt,ot);if(pt=ot?lt.from:H(lt.to,-1),Ke.begin<=pt&&pt<Ke.end)return tt(pt,ot)}},Pe=De(E+r,r,re);if(Pe)return Pe;var Be=r>0?re.end:H(re.begin,-1);return Be!=null&&!(r>0&&Be==t.text.length)&&(Pe=De(r>0?0:i.length-1,r,X(Be)),Pe)?Pe:null}var Ei={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ve)},killLine:function(e){return Fn(e,function(t){if(t.empty()){var n=nt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Fe(t.head.line+1,0)}:{from:t.head,to:Fe(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Fn(e,function(t){return{from:Fe(t.from().line,0),to:ht(e.doc,Fe(t.to().line+1,0))}})},delLineLeft:function(e){return Fn(e,function(t){return{from:Fe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Fn(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 Fn(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(Fe(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Fe(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ds(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return cs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},he)},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")},he)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?cs(e,t.head):r},he)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var E=n[i].from(),N=K(e.getLine(E.line),E.ch,r);t.push(me(r-N%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return sr(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,E=nt(e.doc,i.line).text;if(E){if(i.ch==E.length&&(i=new Fe(i.line,i.ch-1)),i.ch>0)i=new Fe(i.line,i.ch+1),e.replaceRange(E.charAt(i.ch-1)+E.charAt(i.ch-2),Fe(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var N=nt(e.doc,i.line-1).text;N&&(i=new Fe(i.line,1),e.replaceRange(E.charAt(0)+e.doc.lineSeparator()+N.charAt(N.length-1),Fe(i.line-1,N.length-1),i,"+transpose"))}}n.push(new At(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return sr(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);On(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ds(e,t){var n=nt(e.doc,t),r=dr(n);return r!=n&&(t=wt(r)),Ba(!0,e,r,t,1)}function Il(e,t){var n=nt(e.doc,t),r=Mi(n);return r!=n&&(t=wt(r)),Ba(!0,e,n,t,-1)}function cs(e,t){var n=ds(e,t.line),r=nt(e.doc,n.line),i=Je(r,e.doc.direction);if(!i||i[0].level==0){var E=Math.max(n.ch,r.text.search(/\S/)),N=t.line==n.line&&t.ch<=E&&t.ch;return Fe(n.line,N?0:E,n.sticky)}return n}function qi(e,t,n){if(typeof t=="string"&&(t=Ei[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Te}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Ul(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Un(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Un(t,e.options.extraKeys,n,e)||Un(t,e.options.keyMap,n,e)}var Fl=new Y;function Ti(e,t,n,r){var i=e.state.keySeq;if(i){if(ss(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),fs(e,i+" "+t,n,r))return!0}return fs(e,t,n,r)}function fs(e,t,n,r){var i=Ul(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Gt(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&($(n),Ta(e)),!!i}function hs(e,t){var n=us(t,!0);return n?t.shiftKey&&!e.state.keySeq?Ti(e,"Shift-"+n,t,function(r){return qi(e,r,!0)})||Ti(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return qi(e,r)}):Ti(e,n,t,function(r){return qi(e,r)}):!1}function Nl(e,t,n){return Ti(e,"'"+n+"'",t,function(r){return qi(e,r,!0)})}var ja=null;function ps(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=P(),Me(t,e))return;B&&F<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=hs(t,e);T&&(ja=r?n:null,!r&&n==88&&!Et&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),L&&!s&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;U(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(c(t,"CodeMirror-crosshair"),Xe(document,"keyup",n),Xe(document,"mouseover",n))}Ce(document,"keyup",n),Ce(document,"mouseover",n)}function ms(e){e.keyCode==16&&(this.doc.sel.shift=!1),Me(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Nr(t.display,e)||Me(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(T&&n==ja){ja=null,$(e);return}if(T&&(!e.which||e.which<10)&&hs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Nl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Wa=function(e,t,n){this.time=e,this.pos=t,this.button=n};Wa.prototype.compare=function(e,t,n){return this.time+jl>e&&ct(t,this.pos)==0&&n==this.button};var Si,wi;function Wl(e,t){var n=+new Date;return wi&&wi.compare(n,e,t)?(Si=wi=null,"triple"):Si&&Si.compare(n,e,t)?(wi=new Wa(n,e,t),Si=null,"double"):(Si=new Wa(n,e,t),wi=null,"single")}function vs(e){var t=this,n=t.display;if(Me(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Nr(n,e)){M||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=on(t,e),i=we(e),E=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,E,e))return;i==1?r?Gl(t,r,E,e):fe(e)==n.scroller&&$(e):i==2?(r&&Xi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(A?t.display.input.onContextMenu(e):yo(t))}function Hl(e,t,n,r,i){var E="Click";return r=="double"?E="Double"+E:r=="triple"&&(E="Triple"+E),E=(t==1?"Left":t==2?"Middle":"Right")+E,Ti(e,ls(E,i),i,function(N){if(typeof N=="string"&&(N=Ei[N]),!N)return!1;var H=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),H=N(e,n)!=Te}finally{e.state.suppressEdits=!1}return H})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var E=l?n.shiftKey&&n.metaKey:n.altKey;i.unit=E?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=s?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(s?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){B?setTimeout(k(vo,e),0):e.curOp.focus=P();var i=Kl(e,n,r),E=e.doc.sel,N;e.options.dragDrop&&_e&&!e.isReadOnly()&&n=="single"&&(N=E.contains(t))>-1&&(ct((N=E.ranges[N]).from(),t)<0||t.xRel>0)&&(ct(N.to(),t)>0||t.xRel<0)?zl(e,r,t,i):Vl(e,r,t,i)}function zl(e,t,n,r){var i=e.display,E=!1,N=jt(e,function(X){M&&(i.scroller.draggable=!1),e.state.draggingText=!1,Xe(i.wrapper.ownerDocument,"mouseup",N),Xe(i.wrapper.ownerDocument,"mousemove",H),Xe(i.scroller,"dragstart",V),Xe(i.scroller,"drop",N),E||($(X),r.addNew||Xi(e.doc,n,null,null,r.extend),M&&!R||B&&F==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),H=function(X){E=E||Math.abs(t.clientX-X.clientX)+Math.abs(t.clientY-X.clientY)>=10},V=function(){return E=!0};M&&(i.scroller.draggable=!0),e.state.draggingText=N,N.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Ce(i.wrapper.ownerDocument,"mouseup",N),Ce(i.wrapper.ownerDocument,"mousemove",H),Ce(i.scroller,"dragstart",V),Ce(i.scroller,"drop",N),yo(e),setTimeout(function(){return i.input.focus()},20)}function ys(e,t,n){if(n=="char")return new At(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new At(Fe(t.line,0),ht(e.doc,Fe(t.line+1,0)));var r=n(e,t);return new At(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,E=e.doc;$(t);var N,H,V=E.sel,X=V.ranges;if(r.addNew&&!r.extend?(H=E.sel.contains(n),H>-1?N=X[H]:N=new At(n,n)):(N=E.sel.primary(),H=E.sel.primIndex),r.unit=="rectangle")r.addNew||(N=new At(n,n)),n=on(e,t,!0,!0),H=-1;else{var re=ys(e,n,r.unit);r.extend?N=Ia(N,re.anchor,re.head,r.extend):N=re}r.addNew?H==-1?(H=X.length,Xt(E,wr(e,X.concat([N]),H),{scroll:!1,origin:"*mouse"})):X.length>1&&X[H].empty()&&r.unit=="char"&&!r.extend?(Xt(E,wr(e,X.slice(0,H).concat(X.slice(H+1)),0),{scroll:!1,origin:"*mouse"}),V=E.sel):Ua(E,H,N,ge):(H=0,Xt(E,new fr([N],0),ge),V=E.sel);var le=n;function xe(Ke){if(ct(le,Ke)==0)return;if(le=Ke,r.unit=="rectangle"){for(var tt=[],lt=e.options.tabSize,ot=K(nt(E,n.line).text,n.ch,lt),pt=K(nt(E,Ke.line).text,Ke.ch,lt),Rt=Math.min(ot,pt),Ht=Math.max(ot,pt),_t=Math.min(n.line,Ke.line),lr=Math.min(e.lastLine(),Math.max(n.line,Ke.line));_t<=lr;_t++){var nr=nt(E,_t).text,Ut=ce(nr,Rt,lt);Rt==Ht?tt.push(new At(Fe(_t,Ut),Fe(_t,Ut))):nr.length>Ut&&tt.push(new At(Fe(_t,Ut),Fe(_t,ce(nr,Ht,lt))))}tt.length||tt.push(new At(n,n)),Xt(E,wr(e,V.ranges.slice(0,H).concat(tt),H),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ke)}else{var ir=N,zt=ys(e,Ke,r.unit),Bt=ir.anchor,Ft;ct(zt.anchor,Bt)>0?(Ft=zt.head,Bt=Qr(ir.from(),zt.anchor)):(Ft=zt.anchor,Bt=vn(ir.to(),zt.head));var Mt=V.ranges.slice(0);Mt[H]=Xl(e,new At(ht(E,Bt),Ft)),Xt(E,wr(e,Mt,H),ge)}}var ye=i.wrapper.getBoundingClientRect(),De=0;function Pe(Ke){var tt=++De,lt=on(e,Ke,!0,r.unit=="rectangle");if(!lt)return;if(ct(lt,le)!=0){e.curOp.focus=P(),xe(lt);var ot=Wi(i,E);(lt.line>=ot.to||lt.line<ot.from)&&setTimeout(jt(e,function(){De==tt&&Pe(Ke)}),150)}else{var pt=Ke.clientY<ye.top?-20:Ke.clientY>ye.bottom?20:0;pt&&setTimeout(jt(e,function(){if(De!=tt)return;i.scroller.scrollTop+=pt,Pe(Ke)}),50)}}function Be(Ke){e.state.selectingText=!1,De=Infinity,Ke&&($(Ke),i.input.focus()),Xe(i.wrapper.ownerDocument,"mousemove",He),Xe(i.wrapper.ownerDocument,"mouseup",Qe),E.history.lastSelOrigin=null}var He=jt(e,function(Ke){Ke.buttons===0||!we(Ke)?Be(Ke):Pe(Ke)}),Qe=jt(e,Be);e.state.selectingText=Qe,Ce(i.wrapper.ownerDocument,"mousemove",He),Ce(i.wrapper.ownerDocument,"mouseup",Qe)}function Xl(e,t){var n=t.anchor,r=t.head,i=nt(e.doc,n.line);if(ct(n,r)==0&&n.sticky==r.sticky)return t;var E=Je(i);if(!E)return t;var N=Ge(E,n.ch,n.sticky),H=E[N];if(H.from!=n.ch&&H.to!=n.ch)return t;var V=N+(H.from==n.ch==(H.level!=1)?0:1);if(V==0||V==E.length)return t;var X;if(r.line!=n.line)X=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var re=Ge(E,r.ch,r.sticky),le=re-N||(r.ch-n.ch)*(H.level==1?-1:1);re==V-1||re==V?X=le<0:X=le>0}var xe=E[V+(X?-1:0)],ye=X==(xe.level==1),De=ye?xe.from:xe.to,Pe=ye?"after":"before";return n.ch==De&&n.sticky==Pe?t:new At(new Fe(n.line,De,Pe),r)}function bs(e,t,n,r){var i,E;if(t.touches)i=t.touches[0].clientX,E=t.touches[0].clientY;else try{i=t.clientX,E=t.clientY}catch(xe){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&$(t);var N=e.display,H=N.lineDiv.getBoundingClientRect();if(E>H.bottom||!ue(e,n))return ee(t);E-=H.top-N.viewOffset;for(var V=0;V<e.display.gutterSpecs.length;++V){var X=N.gutters.childNodes[V];if(X&&X.getBoundingClientRect().right>=i){var re=vr(e.doc,E),le=e.display.gutterSpecs[V];return Le(e,n,e,re,le.className,t),ee(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function xs(e,t){if(Nr(e.display,t)||Yl(e,t))return;if(Me(e,t,"contextmenu"))return;A||e.display.input.onContextMenu(t)}function Yl(e,t){return ue(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function Es(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ii(e)}var Nn={toString:function(){return"CodeMirror.Init"}},Ts={},ea={};function $l(e){var t=e.optionHandlers;function n(r,i,E,N){e.defaults[r]=i,E&&(t[r]=N?function(H,V,X){X!=Nn&&E(H,V,X)}:E)}e.defineOption=n,e.Init=Nn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,_a(r)},!0),n("indentUnit",2,_a,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){fi(r),ii(r),tr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var E=[],N=r.doc.first;r.doc.iter(function(V){for(var X=0;;){var re=V.text.indexOf(i,X);if(re==-1)break;X=re+i.length,E.push(Fe(N,re))}N++});for(var H=E.length-1;H>=0;H--)Mn(r.doc,i,E[H],Fe(E[H].line,E[H].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,E){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),E!=Nn&&r.refresh()}),n("specialCharPlaceholder",Ot,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!S),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){Es(r),ci(r)},!0),n("keyMap","default",function(r,i,E){var N=Zi(i),H=E!=Nn&&Zi(E);H&&H.detach&&H.detach(r,N),N.attach&&N.attach(r,H||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ql,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Ra(i,r.options.lineNumbers),ci(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?xa(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Rn(r)},!0),n("scrollbarStyle","native",function(r){wo(r),Rn(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Ra(r.options.gutters,i),ci(r)},!0),n("firstLineNumber",1,ci,!0),n("lineNumberFormatter",function(r){return r},ci,!0),n("showCursorWhenSelecting",!1,ai,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Dn(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,ai,!0),n("singleCursorHeightPerLine",!0,ai,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,fi,!0),n("addModeClass",!1,fi,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,fi,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Jl(e,t,n){var r=n&&n!=Nn;if(!t!=!r){var i=e.display.dragFunctions,E=t?Ce:Xe;E(e.display.scroller,"dragstart",i.start),E(e.display.scroller,"dragenter",i.enter),E(e.display.scroller,"dragover",i.over),E(e.display.scroller,"dragleave",i.leave),E(e.display.scroller,"drop",i.drop)}}function Ql(e){e.options.lineWrapping?(U(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(c(e.display.wrapper,"CodeMirror-wrap"),Ii(e)),Ea(e),tr(e),ii(e),setTimeout(function(){return Rn(e)},100)}function kt(e,t){var n=this;if(!(this instanceof kt))return new kt(e,t);this.options=t=t?O(t):{},O(Ts,t,!1);var r=t.value;typeof r=="string"?r=new rr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new kt.inputStyles[t.inputStyle](this),E=this.display=new dl(e,r,i,t);E.wrapper.CodeMirror=this,Es(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),wo(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new Y,keySeq:null,specialChars:null},t.autofocus&&!o&&E.input.focus(),B&&F<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Ol(),dn(this),this.curOp.forceUpdate=!0,Mo(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Sa(n)},20):Dn(this);for(var N in ea)ea.hasOwnProperty(N)&&ea[N](this,t[N],Nn);Lo(this),t.finishInit&&t.finishInit(this);for(var H=0;H<Ka.length;++H)Ka[H](this);cn(this),M&&t.lineWrapping&&getComputedStyle(E.lineDiv).textRendering=="optimizelegibility"&&(E.lineDiv.style.textRendering="auto")}kt.defaults=Ts,kt.optionHandlers=ea;function Zl(e){var t=e.display;Ce(t.scroller,"mousedown",jt(e,vs)),B&&F<11?Ce(t.scroller,"dblclick",jt(e,function(V){if(Me(e,V))return;var X=on(e,V);if(!X||Ha(e,V)||Nr(e.display,V))return;$(V);var re=e.findWordAt(X);Xi(e.doc,re.anchor,re.head)})):Ce(t.scroller,"dblclick",function(V){return Me(e,V)||$(V)}),Ce(t.scroller,"contextmenu",function(V){return xs(e,V)}),Ce(t.input.getField(),"contextmenu",function(V){t.scroller.contains(V.target)||xs(e,V)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function E(V){if(V.touches.length!=1)return!1;var X=V.touches[0];return X.radiusX<=1&&X.radiusY<=1}function N(V,X){if(X.left==null)return!0;var re=X.left-V.left,le=X.top-V.top;return re*re+le*le>20*20}Ce(t.scroller,"touchstart",function(V){if(!Me(e,V)&&!E(V)&&!Ha(e,V)){t.input.ensurePolled(),clearTimeout(n);var X=+new Date;t.activeTouch={start:X,moved:!1,prev:X-r.end<=300?r:null},V.touches.length==1&&(t.activeTouch.left=V.touches[0].pageX,t.activeTouch.top=V.touches[0].pageY)}}),Ce(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ce(t.scroller,"touchend",function(V){var X=t.activeTouch;if(X&&!Nr(t,V)&&X.left!=null&&!X.moved&&new Date-X.start<300){var re=e.coordsChar(t.activeTouch,"page"),le;!X.prev||N(X,X.prev)?le=new At(re,re):!X.prev.prev||N(X,X.prev.prev)?le=e.findWordAt(re):le=new At(Fe(re.line,0),ht(e.doc,Fe(re.line+1,0))),e.setSelection(le.anchor,le.head),e.focus(),$(V)}i()}),Ce(t.scroller,"touchcancel",i),Ce(t.scroller,"scroll",function(){t.scroller.clientHeight&&(si(e,t.scroller.scrollTop),ln(e,t.scroller.scrollLeft,!0),Le(e,"scroll",e))}),Ce(t.scroller,"mousewheel",function(V){return Ro(e,V)}),Ce(t.scroller,"DOMMouseScroll",function(V){return Ro(e,V)}),Ce(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(V){Me(e,V)||se(V)},over:function(V){Me(e,V)||(Dl(e,V),se(V))},start:function(V){return Ll(e,V)},drop:jt(e,Al),leave:function(V){Me(e,V)||is(e)}};var H=t.input.getField();Ce(H,"keyup",function(V){return ms.call(e,V)}),Ce(H,"keydown",jt(e,ps)),Ce(H,"keypress",jt(e,gs)),Ce(H,"focus",function(V){return Sa(e,V)}),Ce(H,"blur",function(V){return Dn(e,V)})}var Ka=[];kt.defineInitHook=function(e){return Ka.push(e)};function Ci(e,t,n,r){var i=e.doc,E;n==null&&(n="add"),n=="smart"&&(i.mode.indent?E=yr(e,t).state:n="prev");var N=e.options.tabSize,H=nt(i,t),V=K(H.text,null,N);H.stateAfter&&(H.stateAfter=null);var X=H.text.match(/^\s*/)[0],re;if(!r&&!/\S/.test(H.text))re=0,n="not";else if(n=="smart"&&(re=i.mode.indent(E,H.text.slice(X.length),H.text),re==Te||re>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?re=K(nt(i,t-1).text,null,N):re=0:n=="add"?re=V+e.options.indentUnit:n=="subtract"?re=V-e.options.indentUnit:typeof n=="number"&&(re=V+n),re=Math.max(0,re);var le="",xe=0;if(e.options.indentWithTabs)for(var ye=Math.floor(re/N);ye;--ye)xe+=N,le+=" ";if(xe<re&&(le+=me(re-xe)),le!=X)return Mn(i,le,Fe(t,0),Fe(t,X.length),"+input"),H.stateAfter=null,!0;for(var De=0;De<i.sel.ranges.length;De++){var Pe=i.sel.ranges[De];if(Pe.head.line==t&&Pe.head.ch<X.length){var Be=Fe(t,X.length);Ua(i,De,new At(Be,Be));break}}}var Cr=null;function ta(e){Cr=e}function Ga(e,t,n,r,i){var E=e.doc;e.display.shift=!1,r||(r=E.sel);var N=+new Date-200,H=i=="paste"||e.state.pasteIncoming>N,V=dt(t),X=null;if(H&&r.ranges.length>1)if(Cr&&Cr.text.join(`
|
|
`)==t){if(r.ranges.length%Cr.text.length==0){X=[];for(var re=0;re<Cr.text.length;re++)X.push(E.splitLines(Cr.text[re]))}}else V.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(X=ne(V,function(He){return[He]}));for(var le=e.curOp.updateInput,xe=r.ranges.length-1;xe>=0;xe--){var ye=r.ranges[xe],De=ye.from(),Pe=ye.to();ye.empty()&&(n&&n>0?De=Fe(De.line,De.ch-n):e.state.overwrite&&!H?Pe=Fe(Pe.line,Math.min(nt(E,Pe.line).text.length,Pe.ch+J(V).length)):H&&Cr&&Cr.lineWise&&Cr.text.join(`
|
|
`)==V.join(`
|
|
`)&&(De=Pe=Fe(De.line,0)));var Be={from:De,to:Pe,text:X?X[xe%X.length]:V,origin:i||(H?"paste":e.state.cutIncoming>N?"cut":"+input")};Pn(e.doc,Be),Gt(e,"inputRead",e,Be)}t&&!H&&ws(e,t),On(e),e.curOp.updateInput<2&&(e.curOp.updateInput=le),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ss(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&sr(t,function(){return Ga(t,n,0,null,"paste")}),!0}function ws(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var E=e.getModeAt(i.head),N=!1;if(E.electricChars){for(var H=0;H<E.electricChars.length;H++)if(t.indexOf(E.electricChars.charAt(H))>-1){N=Ci(e,i.head.line,"smart");break}}else E.electricInput&&(E.electricInput.test(nt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(N=Ci(e,i.head.line,"smart")));N&&Gt(e,"electricInput",e,i.head.line)}}function Cs(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,E={anchor:Fe(i,0),head:Fe(i+1,0)};n.push(E),t.push(e.getRange(E.anchor,E.head))}return{text:t,ranges:n}}function As(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Ls(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return M?e.style.width="1000px":e.setAttribute("wrap","off"),v&&(e.style.border="1px solid black"),As(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var E=this.options,N=E[r];if(E[r]==i&&r!="mode")return;E[r]=i,t.hasOwnProperty(r)&&jt(this,t[r])(this,i,N),Le(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](Zi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,E=0;E<i.length;++E)if(i[E]==r||i[E].name==r)return i.splice(E,1),!0},addOverlay:Jt(function(r,i){var E=r.token?r:e.getMode(this.options,r);if(E.startState)throw new Error("Overlays may not be stateful.");Z(this.state.overlays,{mode:E,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(N){return N.priority}),this.state.modeGen++,tr(this)}),removeOverlay:Jt(function(r){for(var i=this.state.overlays,E=0;E<i.length;++E){var N=i[E].modeSpec;if(N==r||typeof r=="string"&&N.name==r){i.splice(E,1),this.state.modeGen++,tr(this);return}}}),indentLine:Jt(function(r,i,E){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Pr(this.doc,r)&&Ci(this,r,i,E)}),indentSelection:Jt(function(r){for(var i=this.doc.sel.ranges,E=-1,N=0;N<i.length;N++){var H=i[N];if(H.empty())H.head.line>E&&(Ci(this,H.head.line,r,!0),E=H.head.line,N==this.doc.sel.primIndex&&On(this));else{var V=H.from(),X=H.to(),re=Math.max(E,V.line);E=Math.min(this.lastLine(),X.line-(X.ch?0:1))+1;for(var le=re;le<E;++le)Ci(this,le,r);var xe=this.doc.sel.ranges;V.ch==0&&i.length==xe.length&&xe[N].from().ch>0&&Ua(this.doc,N,new At(V,xe[N].to()),ve)}}}),getTokenAt:function(r,i){return Li(this,r,i)},getLineTokens:function(r,i){return Li(this,Fe(r),i,!0)},getTokenTypeAt:function(r){r=ht(this.doc,r);var i=Zr(this,nt(this.doc,r.line)),E=0,N=(i.length-1)/2,H=r.ch,V;if(H==0)V=i[2];else for(;;){var X=E+N>>1;if((X?i[X*2-1]:0)>=H)N=X;else if(i[X*2+1]<H)E=X+1;else{V=i[X*2+2];break}}var re=V?V.indexOf("overlay "):-1;return re<0?V:re==0?null:V.slice(0,re-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var E=[];if(!n.hasOwnProperty(i))return E;var N=n[i],H=this.getModeAt(r);if(typeof H[i]=="string")N[H[i]]&&E.push(N[H[i]]);else if(H[i])for(var V=0;V<H[i].length;V++){var X=N[H[i][V]];X&&E.push(X)}else H.helperType&&N[H.helperType]?E.push(N[H.helperType]):N[H.name]&&E.push(N[H.name]);for(var re=0;re<N._global.length;re++){var le=N._global[re];le.pred(H,this)&&q(E,le.val)==-1&&E.push(le.val)}return E},getStateAfter:function(r,i){var E=this.doc;return r=yn(E,r==null?E.first+E.size-1:r),yr(this,r+1,i).state},cursorCoords:function(r,i){var E,N=this.doc.sel.primary();return r==null?E=N.head:typeof r=="object"?E=ht(this.doc,r):E=r?N.from():N.to(),Sr(this,E,i||"page")},charCoords:function(r,i){return ma(this,ht(this.doc,r),i||"page")},coordsChar:function(r,i){return r=lo(this,r,i||"page"),va(this,r.left,r.top)},lineAtHeight:function(r,i){return r=lo(this,{top:r,left:0},i||"page").top,vr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,E){var N=!1,H;if(typeof r=="number"){var V=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>V&&(r=V,N=!0),H=nt(this.doc,r)}else H=r;return Fi(this,H,{top:0,left:0},i||"page",E||N).top+(N?this.doc.height-Tr(H):0)},defaultTextHeight:function(){return An(this.display)},defaultCharWidth:function(){return Ln(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,E,N,H){var V=this.display;r=Sr(this,ht(this.doc,r));var X=r.bottom,re=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),V.sizer.appendChild(i),N=="over")X=r.top;else if(N=="above"||N=="near"){var le=Math.max(V.wrapper.clientHeight,this.doc.height),xe=Math.max(V.sizer.clientWidth,V.lineSpace.clientWidth);(N=="above"||r.bottom+i.offsetHeight>le)&&r.top>i.offsetHeight?X=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=le&&(X=r.bottom),re+i.offsetWidth>xe&&(re=xe-i.offsetWidth)}i.style.top=X+"px",i.style.left=i.style.right="",H=="right"?(re=V.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(H=="left"?re=0:H=="middle"&&(re=(V.sizer.clientWidth-i.offsetWidth)/2),i.style.left=re+"px"),E&&Js(this,{left:re,top:X,right:re+i.offsetWidth,bottom:X+i.offsetHeight})},triggerOnKeyDown:Jt(ps),triggerOnKeyPress:Jt(gs),triggerOnKeyUp:ms,triggerOnMouseDown:Jt(vs),execCommand:function(r){if(Ei.hasOwnProperty(r))return Ei[r].call(null,this)},triggerElectric:Jt(function(r){ws(this,r)}),findPosH:function(r,i,E,N){var H=1;i<0&&(H=-1,i=-i);for(var V=ht(this.doc,r),X=0;X<i&&!(V=za(this.doc,V,H,E,N),V.hitSide);++X);return V},moveH:Jt(function(r,i){var E=this;this.extendSelectionsBy(function(N){return E.display.shift||E.doc.extend||N.empty()?za(E.doc,N.head,r,i,E.options.rtlMoveVisually):r<0?N.from():N.to()},he)}),deleteH:Jt(function(r,i){var E=this.doc.sel,N=this.doc;E.somethingSelected()?N.replaceSelection("",null,"+delete"):Fn(this,function(H){var V=za(N,H.head,r,i,!1);return r<0?{from:V,to:H.head}:{from:H.head,to:V}})}),findPosV:function(r,i,E,N){var H=1,V=N;i<0&&(H=-1,i=-i);for(var X=ht(this.doc,r),re=0;re<i;++re){var le=Sr(this,X,"div");if(V==null?V=le.left:le.left=V,X=Ds(this,le,H,E),X.hitSide)break}return X},moveV:Jt(function(r,i){var E=this,N=this.doc,H=[],V=!this.display.shift&&!N.extend&&N.sel.somethingSelected();if(N.extendSelectionsBy(function(re){if(V)return r<0?re.from():re.to();var le=Sr(E,re.head,"div");re.goalColumn!=null&&(le.left=re.goalColumn),H.push(le.left);var xe=Ds(E,le,r,i);return i=="page"&&re==N.sel.primary()&&Ca(E,ma(E,xe,"div").top-le.top),xe},he),H.length)for(var X=0;X<N.sel.ranges.length;X++)N.sel.ranges[X].goalColumn=H[X]}),findWordAt:function(r){var i=this.doc,E=nt(i,r.line).text,N=r.ch,H=r.ch;if(E){var V=this.getHelper(r,"wordChars");(r.sticky=="before"||H==E.length)&&N?--N:++H;for(var X=E.charAt(N),re=Re(X,V)?function(le){return Re(le,V)}:/\s/.test(X)?function(le){return/\s/.test(le)}:function(le){return!/\s/.test(le)&&!Re(le)};N>0&&re(E.charAt(N-1));)--N;for(;H<E.length&&re(E.charAt(H));)++H}return new At(Fe(r.line,N),Fe(r.line,H))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?U(this.display.cursorDiv,"CodeMirror-overwrite"):c(this.display.cursorDiv,"CodeMirror-overwrite"),Le(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==P()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Jt(function(r,i){oi(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Dr(this)-this.display.barHeight,width:r.scrollWidth-Dr(this)-this.display.barWidth,clientHeight:fa(this),clientWidth:nn(this)}},scrollIntoView:Jt(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:Fe(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):xo(this,r.from,r.to,r.margin)}),setSize:Jt(function(r,i){var E=this,N=function(V){return typeof V=="number"||/^\d+$/.test(String(V))?V+"px":V};r!=null&&(this.display.wrapper.style.width=N(r)),i!=null&&(this.display.wrapper.style.height=N(i)),this.options.lineWrapping&&ao(this);var H=this.display.viewFrom;this.doc.iter(H,this.display.viewTo,function(V){if(V.widgets){for(var X=0;X<V.widgets.length;X++)if(V.widgets[X].noHScroll){Kr(E,H,"widget");break}}++H}),this.curOp.forceUpdate=!0,Le(this,"refresh",this)}),operation:function(r){return sr(this,r)},startOperation:function(){return dn(this)},endOperation:function(){return cn(this)},refresh:Jt(function(){var r=this.display.cachedTextHeight;tr(this),this.curOp.forceUpdate=!0,ii(this),oi(this,this.doc.scrollLeft,this.doc.scrollTop),Da(this.display),(r==null||Math.abs(r-An(this.display))>.5||this.options.lineWrapping)&&Ea(this),Le(this,"refresh",this)}),swapDoc:Jt(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Mo(this,r),ii(this),this.display.input.reset(),oi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Gt(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},de(e),e.registerHelper=function(r,i,E){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=E},e.registerGlobalHelper=function(r,i,E,N){e.registerHelper(r,i,N),n[r]._global.push({pred:E,val:N})}}function za(e,t,n,r,i){var E=t,N=n,H=nt(e,t.line),V=i&&e.direction=="rtl"?-n:n;function X(){var Qe=t.line+V;return Qe<e.first||Qe>=e.first+e.size?!1:(t=new Fe(Qe,t.ch,t.sticky),H=nt(e,Qe))}function re(Qe){var Ke;if(r=="codepoint"){var tt=H.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(tt)?Ke=null:Ke=new Fe(t.line,Math.max(0,Math.min(H.text.length,t.ch+n*(tt>=55296&&tt<56320?2:1))),-n)}else i?Ke=Ml(e.cm,H,t,n):Ke=Na(H,t,n);if(Ke==null)if(!Qe&&X())t=Ba(i,e.cm,H,t.line,V);else return!1;else t=Ke;return!0}if(r=="char"||r=="codepoint")re();else if(r=="column")re(!0);else if(r=="word"||r=="group")for(var le=null,xe=r=="group",ye=e.cm&&e.cm.getHelper(t,"wordChars"),De=!0;!(n<0&&!re(!De));De=!1){var Pe=H.text.charAt(t.ch)||`
|
|
`,Be=Re(Pe,ye)?"w":xe&&Pe==`
|
|
`?"n":!xe||/\s/.test(Pe)?null:"p";if(xe&&!De&&!Be&&(Be="s"),le&&le!=Be){n<0&&(n=1,re(),t.sticky="after");break}if(Be&&(le=Be),n>0&&!re(!De))break}var He=$i(e,t,E,N,!0);return Gn(E,He)&&(He.hitSide=!0),He}function Ds(e,t,n,r){var i=e.doc,E=t.left,N;if(r=="page"){var H=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),V=Math.max(H-.5*An(e.display),3);N=(n>0?t.bottom:t.top)+n*V}else r=="line"&&(N=n>0?t.bottom+3:t.top-3);for(var X;!(X=va(e,E,N),!X.outside);){if(n<0?N<=0:N>=i.height){X.hitSide=!0;break}N+=n*5}return X}var Lt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Y,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Lt.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;As(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function E(H){for(var V=H.target;V;V=V.parentNode){if(V==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(V.className))break}return!1}Ce(i,"paste",function(H){if(!E(H)||Me(r,H)||Ss(H,r))return;F<=11&&setTimeout(jt(r,function(){return t.updateFromDOM()}),20)}),Ce(i,"compositionstart",function(H){t.composing={data:H.data,done:!1}}),Ce(i,"compositionupdate",function(H){t.composing||(t.composing={data:H.data,done:!1})}),Ce(i,"compositionend",function(H){t.composing&&(H.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ce(i,"touchstart",function(){return n.forceCompositionEnd()}),Ce(i,"input",function(){t.composing||t.readFromDOMSoon()});function N(H){if(!E(H)||Me(r,H))return;if(r.somethingSelected())ta({lineWise:!1,text:r.getSelections()}),H.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var V=Cs(r);ta({lineWise:!0,text:V.text}),H.type=="cut"&&r.operation(function(){r.setSelections(V.ranges,0,ve),r.replaceSelection("",null,"cut")})}else return;if(H.clipboardData){H.clipboardData.clearData();var X=Cr.text.join(`
|
|
`);if(H.clipboardData.setData("Text",X),H.clipboardData.getData("Text")==X){H.preventDefault();return}}var re=Ls(),le=re.firstChild;r.display.lineSpace.insertBefore(re,r.display.lineSpace.firstChild),le.value=Cr.text.join(`
|
|
`);var xe=document.activeElement;W(le),setTimeout(function(){r.display.lineSpace.removeChild(re),xe.focus(),xe==i&&n.showPrimarySelection()},50)}Ce(i,"copy",N),Ce(i,"cut",N)},Lt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Lt.prototype.prepareSelection=function(){var e=mo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Lt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Lt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Lt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var E=ra(t,e.anchorNode,e.anchorOffset),N=ra(t,e.focusNode,e.focusOffset);if(E&&!E.bad&&N&&!N.bad&&ct(Qr(E,N),r)==0&&ct(vn(E,N),i)==0)return;var H=t.display.view,V=r.line>=t.display.viewFrom&&Os(t,r)||{node:H[0].measure.map[2],offset:0},X=i.line<t.display.viewTo&&Os(t,i);if(!X){var re=H[H.length-1].measure,le=re.maps?re.maps[re.maps.length-1]:re.map;X={node:le[le.length-1],offset:le[le.length-2]-le[le.length-3]}}if(!V||!X){e.removeAllRanges();return}var xe=e.rangeCount&&e.getRangeAt(0),ye;try{ye=m(V.node,V.offset,X.offset,X.node)}catch(De){}ye&&(!L&&t.state.focused?(e.collapse(V.node,V.offset),ye.collapsed||(e.removeAllRanges(),e.addRange(ye))):(e.removeAllRanges(),e.addRange(ye)),xe&&e.anchorNode==null?e.addRange(xe):L&&this.startGracePeriod()),this.rememberSelection()},Lt.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)},Lt.prototype.showMultipleSelections=function(e){d(this.cm.display.cursorDiv,e.cursors),d(this.cm.display.selectionDiv,e.selection)},Lt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Lt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return x(this.div,t)},Lt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Lt.prototype.blur=function(){this.div.blur()},Lt.prototype.getField=function(){return this.div},Lt.prototype.supportsTouch=function(){return!0},Lt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():sr(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)},Lt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Lt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(u&&g&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=ra(t,e.anchorNode,e.anchorOffset),r=ra(t,e.focusNode,e.focusOffset);n&&r&&sr(t,function(){Xt(t.doc,zr(n,r),ve),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Lt.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=Fe(r.line-1,nt(e.doc,r.line-1).length)),i.ch==nt(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Fe(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var E,N,H;r.line==t.viewFrom||(E=sn(e,r.line))==0?(N=wt(t.view[0].line),H=t.view[0].node):(N=wt(t.view[E].line),H=t.view[E-1].node.nextSibling);var V=sn(e,i.line),X,re;if(V==t.view.length-1?(X=t.viewTo-1,re=t.lineDiv.lastChild):(X=wt(t.view[V+1].line)-1,re=t.view[V+1].node.previousSibling),!H)return!1;for(var le=e.doc.splitLines(tu(e,H,re,N,X)),xe=_r(e.doc,Fe(N,0),Fe(X,nt(e.doc,X).text.length));le.length>1&&xe.length>1;)if(J(le)==J(xe))le.pop(),xe.pop(),X--;else if(le[0]==xe[0])le.shift(),xe.shift(),N++;else break;for(var ye=0,De=0,Pe=le[0],Be=xe[0],He=Math.min(Pe.length,Be.length);ye<He&&Pe.charCodeAt(ye)==Be.charCodeAt(ye);)++ye;for(var Qe=J(le),Ke=J(xe),tt=Math.min(Qe.length-(le.length==1?ye:0),Ke.length-(xe.length==1?ye:0));De<tt&&Qe.charCodeAt(Qe.length-De-1)==Ke.charCodeAt(Ke.length-De-1);)++De;if(le.length==1&&xe.length==1&&N==r.line)for(;ye&&ye>r.ch&&Qe.charCodeAt(Qe.length-De-1)==Ke.charCodeAt(Ke.length-De-1);)ye--,De++;le[le.length-1]=Qe.slice(0,Qe.length-De).replace(/^\u200b+/,""),le[0]=le[0].slice(ye).replace(/\u200b+$/,"");var lt=Fe(N,ye),ot=Fe(X,xe.length?J(xe).length-De:0);if(le.length>1||le[0]||ct(lt,ot))return Mn(e.doc,le,lt,ot,"+input"),!0},Lt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Lt.prototype.reset=function(){this.forceCompositionEnd()},Lt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Lt.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)},Lt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&sr(this.cm,function(){return tr(e.cm)})},Lt.prototype.setUneditable=function(e){e.contentEditable="false"},Lt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||jt(this.cm,Ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Lt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Lt.prototype.onContextMenu=function(){},Lt.prototype.resetPosition=function(){},Lt.prototype.needsContentAttribute=!0;function Os(e,t){var n=ha(e,t.line);if(!n||n.hidden)return null;var r=nt(e.doc,t.line),i=eo(n,r,t.line),E=Je(r,e.doc.direction),N="left";if(E){var H=Ge(E,t.ch);N=H%2?"right":"left"}var V=no(i.map,t.ch,N);return V.offset=V.collapse=="right"?V.end:V.start,V}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Bn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var E="",N=!1,H=e.doc.lineSeparator(),V=!1;function X(ye){return function(De){return De.id==ye}}function re(){N&&(E+=H,V&&(E+=H),N=V=!1)}function le(ye){ye&&(re(),E+=ye)}function xe(ye){if(ye.nodeType==1){var De=ye.getAttribute("cm-text");if(De){le(De);return}var Pe=ye.getAttribute("cm-marker"),Be;if(Pe){var He=e.findMarks(Fe(r,0),Fe(i+1,0),X(+Pe));He.length&&(Be=He[0].find(0))&&le(_r(e.doc,Be.from,Be.to).join(H));return}if(ye.getAttribute("contenteditable")=="false")return;var Qe=/^(pre|div|p|li|table|br)$/i.test(ye.nodeName);if(!/^br$/i.test(ye.nodeName)&&ye.textContent.length==0)return;Qe&&re();for(var Ke=0;Ke<ye.childNodes.length;Ke++)xe(ye.childNodes[Ke]);/^(pre|p)$/i.test(ye.nodeName)&&(V=!0),Qe&&(N=!0)}else ye.nodeType==3&&le(ye.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(xe(t),t==n);)t=t.nextSibling,V=!1;return E}function ra(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Bn(e.clipPos(Fe(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var E=e.display.view[i];if(E.node==r)return ru(E,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!x(r,t))return Bn(Fe(wt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var E=e.rest?J(e.rest):e.line;return Bn(Fe(wt(E),E.text.length),i)}var N=t.nodeType==3?t:null,H=t;for(!N&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(N=t.firstChild,n&&(n=N.nodeValue.length));H.parentNode!=r;)H=H.parentNode;var V=e.measure,X=V.maps;function re(Be,He,Qe){for(var Ke=-1;Ke<(X?X.length:0);Ke++)for(var tt=Ke<0?V.map:X[Ke],lt=0;lt<tt.length;lt+=3){var ot=tt[lt+2];if(ot==Be||ot==He){var pt=wt(Ke<0?e.line:e.rest[Ke]),Rt=tt[lt]+Qe;return(Qe<0||ot!=Be)&&(Rt=tt[lt+(Qe?1:0)]),Fe(pt,Rt)}}}var le=re(N,H,n);if(le)return Bn(le,i);for(var xe=H.nextSibling,ye=N?N.nodeValue.length-n:0;xe;xe=xe.nextSibling){if(le=re(xe,xe.firstChild,0),le)return Bn(Fe(le.line,le.ch-ye),i);ye+=xe.textContent.length}for(var De=H.previousSibling,Pe=n;De;De=De.previousSibling){if(le=re(De,De.firstChild,-1),le)return Bn(Fe(le.line,le.ch+Pe),i);Pe+=De.textContent.length}}var It=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Y,this.hasSelection=!1,this.composing=null};It.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),v&&(i.style.width="0px"),Ce(i,"input",function(){B&&F>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ce(i,"paste",function(N){if(Me(r,N)||Ss(N,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function E(N){if(Me(r,N))return;if(r.somethingSelected())ta({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var H=Cs(r);ta({lineWise:!0,text:H.text}),N.type=="cut"?r.setSelections(H.ranges,null,ve):(n.prevInput="",i.value=H.text.join(`
|
|
`),W(i))}else return;N.type=="cut"&&(r.state.cutIncoming=+new Date)}Ce(i,"cut",E),Ce(i,"copy",E),Ce(e.scroller,"paste",function(N){if(Nr(e,N)||Me(r,N))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var H=new Event("paste");H.clipboardData=N.clipboardData,i.dispatchEvent(H)}),Ce(e.lineSpace,"selectstart",function(N){Nr(e,N)||$(N)}),Ce(i,"compositionstart",function(){var N=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:N,range:r.markText(N,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ce(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},It.prototype.createField=function(e){this.wrapper=Ls(),this.textarea=this.wrapper.firstChild},It.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},It.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=mo(e);if(e.options.moveInputWithCursor){var i=Sr(e,n.sel.primary().head,"div"),E=t.wrapper.getBoundingClientRect(),N=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+N.top-E.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+N.left-E.left))}return r},It.prototype.showSelection=function(e){var t=this.cm,n=t.display;d(n.cursorDiv,e.cursors),d(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},It.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&W(this.textarea),B&&F>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",B&&F>=9&&(this.hasSelection=null))},It.prototype.getField=function(){return this.textarea},It.prototype.supportsTouch=function(){return!1},It.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||P()!=this.textarea))try{this.textarea.focus()}catch(e){}},It.prototype.blur=function(){this.textarea.blur()},It.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},It.prototype.receivedFocus=function(){this.slowPoll()},It.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},It.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},It.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||at(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&&F>=9&&this.hasSelection===i||s&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var E=i.charCodeAt(0);if(E==8203&&!r&&(r="\u200B"),E==8666)return this.reset(),this.cm.execCommand("undo")}for(var N=0,H=Math.min(r.length,i.length);N<H&&r.charCodeAt(N)==i.charCodeAt(N);)++N;return sr(t,function(){Ga(t,i.slice(N),r.length-N,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},It.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},It.prototype.onKeyPress=function(){B&&F>=9&&(this.hasSelection=null),this.fastPoll()},It.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var E=on(n,e),N=r.scroller.scrollTop;if(!E||T)return;var H=n.options.resetSelectionOnContextMenu;H&&n.doc.sel.contains(E)==-1&&jt(n,Xt)(n.doc,zr(E),ve);var V=i.style.cssText,X=t.wrapper.style.cssText,re=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-re.top-5)+"px; left: "+(e.clientX-re.left-5)+`px;
|
|
z-index: 1000; background: `+(B?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var le;M&&(le=window.scrollY),r.input.focus(),M&&window.scrollTo(null,le),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=ye,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function xe(){if(i.selectionStart!=null){var Pe=n.somethingSelected(),Be="\u200B"+(Pe?i.value:"");i.value="\u21DA",i.value=Be,t.prevInput=Pe?"":"\u200B",i.selectionStart=1,i.selectionEnd=Be.length,r.selForContextMenu=n.doc.sel}}function ye(){if(t.contextMenuPending!=ye)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=X,i.style.cssText=V,B&&F<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=N),i.selectionStart!=null){(!B||B&&F<9)&&xe();var Pe=0,Be=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?jt(n,Xo)(n):Pe++<10?r.detectingSelectAll=setTimeout(Be,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Be,200)}}if(B&&F>=9&&xe(),A){se(e);var De=function(){Xe(window,"mouseup",De),setTimeout(ye,20)};Ce(window,"mouseup",De)}else setTimeout(ye,50)},It.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},It.prototype.setUneditable=function(){},It.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?O(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=P();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=H.getValue()}var i;if(e.form&&(Ce(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var E=e.form;i=E.submit;try{var N=E.submit=function(){r(),E.submit=i,E.submit(),E.submit=N}}catch(V){}}t.finishInit=function(V){V.save=r,V.getTextArea=function(){return e},V.toTextArea=function(){V.toTextArea=isNaN,r(),e.parentNode.removeChild(V.getWrapperElement()),e.style.display="",e.form&&(Xe(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var H=kt(function(V){return e.parentNode.insertBefore(V,e.nextSibling)},t);return H}function iu(e){e.off=Xe,e.on=Ce,e.wheelEventPixels=cl,e.Doc=rr,e.splitLines=dt,e.countColumn=K,e.findColumn=ce,e.isWordChar=Se,e.Pass=Te,e.signal=Le,e.Line=rn,e.changeEnd=Vr,e.scrollbarModel=So,e.Pos=Fe,e.cmpPos=ct,e.modes=Dt,e.mimeModes=yt,e.resolveMode=ur,e.getMode=gr,e.modeExtensions=hr,e.extendMode=ia,e.copyState=Ar,e.startState=Kn,e.innerMode=Hn,e.commands=Ei,e.keyMap=Br,e.keyName=us,e.isModifierKey=ss,e.lookupKey=Un,e.normalizeKeyMap=Pl,e.StringStream=Pt,e.SharedTextMarker=yi,e.TextMarker=Yr,e.LineWidget=vi,e.e_preventDefault=$,e.e_stopPropagation=Q,e.e_stop=se,e.addClass=U,e.contains=x,e.rmClass=c,e.keyNames=$r}$l(kt),ql(kt);var au="iter insert remove copy getEditor constructor".split(" ");for(var na in rr.prototype)rr.prototype.hasOwnProperty(na)&&q(au,na)<0&&(kt.prototype[na]=function(e){return function(){return e.apply(this.doc,arguments)}}(rr.prototype[na]));return de(rr),kt.inputStyles={textarea:It,contenteditable:Lt},kt.defineMode=function(e){!kt.defaults.mode&&e!="null"&&(kt.defaults.mode=e),or.apply(this,arguments)},kt.defineMIME=kr,kt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),kt.defineMIME("text/plain","null"),kt.defineExtension=function(e,t){kt.prototype[e]=t},kt.defineDocExtension=function(e,t){rr.prototype[e]=t},kt.fromTextArea=nu,iu(kt),kt.version="5.58.2",kt})},Y1PL:function(ut,et,oe){"use strict";oe.r(et),oe.d(et,"ResizableTextArea",function(){return q});var te=oe("wx14"),G=oe("1OyB"),L=oe("vuIU"),z=oe("Ji7U"),I=oe("LK+K"),_=oe("cDcd"),B=oe("VTBJ"),F=oe("rePB"),M=oe("Zm9Q"),D=oe("Kwbf"),g=oe("c+Xe"),T=oe("m+aA"),R=oe("bdgK"),C=new Map;function w(ve){ve.forEach(function(ge){var he,ce=ge.target;(he=C.get(ce))===null||he===void 0||he.forEach(function(ae){return ae(ce)})})}var v=new R.default(w),u=null,o=null;function s(ve,ge){C.has(ve)||(C.set(ve,new Set),v.observe(ve)),C.get(ve).add(ge)}function l(ve,ge){C.has(ve)&&(C.get(ve).delete(ge),C.get(ve).size||(v.unobserve(ve),C.delete(ve)))}var S=function(ve){Object(z.a)(he,ve);var ge=Object(I.a)(he);function he(){return Object(G.a)(this,he),ge.apply(this,arguments)}return Object(L.a)(he,[{key:"render",value:function(){return this.props.children}}]),he}(_.Component),p=_.createContext(null);function h(ve){var ge=ve.children,he=ve.onBatchResize,ce=_.useRef(0),ae=_.useRef([]),me=_.useContext(p),J=_.useCallback(function(ne,Z,Ee){ce.current+=1;var Ae=ce.current;ae.current.push({size:ne,element:Z,data:Ee}),Promise.resolve().then(function(){Ae===ce.current&&(he==null||he(ae.current),ae.current=[])}),me==null||me(ne,Z,Ee)},[he,me]);return _.createElement(p.Provider,{value:J},ge)}function A(ve){var ge=ve.children,he=ve.disabled,ce=_.useRef(null),ae=_.useRef(null),me=_.useContext(p),J=_.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ne=_.isValidElement(ge)&&Object(g.c)(ge),Z=ne?ge.ref:null,Ee=_.useMemo(function(){return Object(g.a)(Z,ce)},[Z,ce]),Ae=_.useRef(ve);Ae.current=ve;var be=_.useCallback(function(Se){var Re=Ae.current,Ue=Re.onResize,Ie=Re.data,ke=Se.getBoundingClientRect(),Oe=ke.width,$e=ke.height,ze=Se.offsetWidth,Ve=Se.offsetHeight,Ge=Math.floor(Oe),rt=Math.floor($e);if(J.current.width!==Ge||J.current.height!==rt||J.current.offsetWidth!==ze||J.current.offsetHeight!==Ve){var Je={width:Ge,height:rt,offsetWidth:ze,offsetHeight:Ve};J.current=Je;var Ye=ze===Math.round(Oe)?Oe:ze,Ce=Ve===Math.round($e)?$e:Ve,qe=Object(B.a)(Object(B.a)({},Je),{},{offsetWidth:Ye,offsetHeight:Ce});me==null||me(qe,Se,Ie),Ue&&Promise.resolve().then(function(){Ue(qe,Se)})}},[]);return _.useEffect(function(){var Se=Object(T.a)(ce.current)||Object(T.a)(ae.current);return Se&&!he&&s(Se,be),function(){return l(Se,be)}},[ce.current,he]),_.createElement(S,{ref:ae},ne?_.cloneElement(ge,{ref:Ee}):ge)}var b="rc-observer-key";function c(ve){var ge=ve.children,he=Object(M.a)(ge);return he.map(function(ce,ae){var me=(ce==null?void 0:ce.key)||"".concat(b,"-").concat(ae);return _.createElement(A,Object(te.a)({},ve,{key:me}),ce)})}c.Collection=h;var f=c,d=oe("bT9E"),a=oe("TSYQ"),y=oe.n(a),m=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,x=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],P={},U;function j(ve){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,he=ve.getAttribute("id")||ve.getAttribute("data-reactid")||ve.getAttribute("name");if(ge&&P[he])return P[he];var ce=window.getComputedStyle(ve),ae=ce.getPropertyValue("box-sizing")||ce.getPropertyValue("-moz-box-sizing")||ce.getPropertyValue("-webkit-box-sizing"),me=parseFloat(ce.getPropertyValue("padding-bottom"))+parseFloat(ce.getPropertyValue("padding-top")),J=parseFloat(ce.getPropertyValue("border-bottom-width"))+parseFloat(ce.getPropertyValue("border-top-width")),ne=x.map(function(Ee){return"".concat(Ee,":").concat(ce.getPropertyValue(Ee))}).join(";"),Z={sizingStyle:ne,paddingSize:me,borderSize:J,boxSizing:ae};return ge&&he&&(P[he]=Z),Z}function W(ve){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,he=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,ce=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)),ve.getAttribute("wrap")?U.setAttribute("wrap",ve.getAttribute("wrap")):U.removeAttribute("wrap");var ae=j(ve,ge),me=ae.paddingSize,J=ae.borderSize,ne=ae.boxSizing,Z=ae.sizingStyle;U.setAttribute("style","".concat(Z,";").concat(m)),U.value=ve.value||ve.placeholder||"";var Ee=Number.MIN_SAFE_INTEGER,Ae=Number.MAX_SAFE_INTEGER,be=U.scrollHeight,Se;if(ne==="border-box"?be+=J:ne==="content-box"&&(be-=me),he!==null||ce!==null){U.value=" ";var Re=U.scrollHeight-me;he!==null&&(Ee=Re*he,ne==="border-box"&&(Ee=Ee+me+J),be=Math.max(Ee,be)),ce!==null&&(Ae=Re*ce,ne==="border-box"&&(Ae=Ae+me+J),Se=be>Ae?"":"hidden",be=Math.min(Ae,be))}return{height:be,minHeight:Ee,maxHeight:Ae,overflowY:Se,resize:"none"}}var k=oe("Gytx"),O=oe.n(k),K;(function(ve){ve[ve.NONE=0]="NONE",ve[ve.RESIZING=1]="RESIZING",ve[ve.RESIZED=2]="RESIZED"})(K||(K={}));var Y=function(ve){Object(z.a)(he,ve);var ge=Object(I.a)(he);function he(ce){var ae;return Object(G.a)(this,he),ae=ge.call(this,ce),ae.nextFrameActionId=void 0,ae.resizeFrameId=void 0,ae.textArea=void 0,ae.saveTextArea=function(me){ae.textArea=me},ae.handleResize=function(me){var J=ae.state.resizeStatus,ne=ae.props,Z=ne.autoSize,Ee=ne.onResize;if(J!==K.NONE)return;typeof Ee=="function"&&Ee(me),Z&&ae.resizeOnNextFrame()},ae.resizeOnNextFrame=function(){cancelAnimationFrame(ae.nextFrameActionId),ae.nextFrameActionId=requestAnimationFrame(ae.resizeTextarea)},ae.resizeTextarea=function(){var me=ae.props.autoSize;if(!me||!ae.textArea)return;var J=me.minRows,ne=me.maxRows,Z=W(ae.textArea,!1,J,ne);ae.setState({textareaStyles:Z,resizeStatus:K.RESIZING},function(){cancelAnimationFrame(ae.resizeFrameId),ae.resizeFrameId=requestAnimationFrame(function(){ae.setState({resizeStatus:K.RESIZED},function(){ae.resizeFrameId=requestAnimationFrame(function(){ae.setState({resizeStatus:K.NONE}),ae.fixFirefoxAutoScroll()})})})})},ae.renderTextArea=function(){var me=ae.props,J=me.prefixCls,ne=J===void 0?"rc-textarea":J,Z=me.autoSize,Ee=me.onResize,Ae=me.className,be=me.disabled,Se=ae.state,Re=Se.textareaStyles,Ue=Se.resizeStatus,Ie=Object(d.a)(ae.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),ke=y()(ne,Ae,Object(F.a)({},"".concat(ne,"-disabled"),be));"value"in Ie&&(Ie.value=Ie.value||"");var Oe=Object(B.a)(Object(B.a)(Object(B.a)({},ae.props.style),Re),Ue===K.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return _.createElement(f,{onResize:ae.handleResize,disabled:!(Z||Ee)},_.createElement("textarea",Object(te.a)({},Ie,{className:ke,style:Oe,ref:ae.saveTextArea})))},ae.state={textareaStyles:{},resizeStatus:K.NONE},ae}return Object(L.a)(he,[{key:"componentDidUpdate",value:function(ae){(ae.value!==this.props.value||!O()(ae.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var ae=this.textArea.selectionStart,me=this.textArea.selectionEnd;this.textArea.setSelectionRange(ae,me)}}catch(J){}}},{key:"render",value:function(){return this.renderTextArea()}}]),he}(_.Component),q=Y,ie=function(ve){Object(z.a)(he,ve);var ge=Object(I.a)(he);function he(ce){var ae;Object(G.a)(this,he),ae=ge.call(this,ce),ae.resizableTextArea=void 0,ae.focus=function(){ae.resizableTextArea.textArea.focus()},ae.saveTextArea=function(J){ae.resizableTextArea=J},ae.handleChange=function(J){var ne=ae.props.onChange;ae.setValue(J.target.value,function(){ae.resizableTextArea.resizeTextarea()}),ne&&ne(J)},ae.handleKeyDown=function(J){var ne=ae.props,Z=ne.onPressEnter,Ee=ne.onKeyDown;J.keyCode===13&&Z&&Z(J),Ee&&Ee(J)};var me=typeof ce.value=="undefined"||ce.value===null?ce.defaultValue:ce.value;return ae.state={value:me},ae}return Object(L.a)(he,[{key:"setValue",value:function(ae,me){"value"in this.props||this.setState({value:ae},me)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return _.createElement(q,Object(te.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ae){return"value"in ae?{value:ae.value}:null}}]),he}(_.Component),Te=et.default=ie},ZpRC:function(ut,et,oe){"use strict";function te(g){return typeof g=="object"&&g!=null&&g.nodeType===1}function G(g,T){return(!T||g!=="hidden")&&g!=="visible"&&g!=="clip"}function L(g,T){if(g.clientHeight<g.scrollHeight||g.clientWidth<g.scrollWidth){var R=getComputedStyle(g,null);return G(R.overflowY,T)||G(R.overflowX,T)||function(C){var w=function(v){if(!v.ownerDocument||!v.ownerDocument.defaultView)return null;try{return v.ownerDocument.defaultView.frameElement}catch(u){return null}}(C);return!!w&&(w.clientHeight<C.scrollHeight||w.clientWidth<C.scrollWidth)}(g)}return!1}function z(g,T,R,C,w,v,u,o){return v<g&&u>T||v>g&&u<T?0:v<=g&&o<=R||u>=T&&o>=R?v-g-C:u>T&&o<R||v<g&&o>R?u-T+w:0}var I=function(g,T){var R=window,C=T.scrollMode,w=T.block,v=T.inline,u=T.boundary,o=T.skipOverflowHiddenElements,s=typeof u=="function"?u:function(Re){return Re!==u};if(!te(g))throw new TypeError("Invalid target");for(var l=document.scrollingElement||document.documentElement,S=[],p=g;te(p)&&s(p);){if((p=p.parentElement)===l){S.push(p);break}p!=null&&p===document.body&&L(p)&&!L(document.documentElement)||p!=null&&L(p,o)&&S.push(p)}for(var h=R.visualViewport?R.visualViewport.width:innerWidth,A=R.visualViewport?R.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,c=window.scrollY||pageYOffset,f=g.getBoundingClientRect(),d=f.height,a=f.width,y=f.top,m=f.right,x=f.bottom,P=f.left,U=w==="start"||w==="nearest"?y:w==="end"?x:y+d/2,j=v==="center"?P+a/2:v==="end"?m:P,W=[],k=0;k<S.length;k++){var O=S[k],K=O.getBoundingClientRect(),Y=K.height,q=K.width,ie=K.top,Te=K.right,ve=K.bottom,ge=K.left;if(C==="if-needed"&&y>=0&&P>=0&&x<=A&&m<=h&&y>=ie&&x<=ve&&P>=ge&&m<=Te)return W;var he=getComputedStyle(O),ce=parseInt(he.borderLeftWidth,10),ae=parseInt(he.borderTopWidth,10),me=parseInt(he.borderRightWidth,10),J=parseInt(he.borderBottomWidth,10),ne=0,Z=0,Ee="offsetWidth"in O?O.offsetWidth-O.clientWidth-ce-me:0,Ae="offsetHeight"in O?O.offsetHeight-O.clientHeight-ae-J:0;if(l===O)ne=w==="start"?U:w==="end"?U-A:w==="nearest"?z(c,c+A,A,ae,J,c+U,c+U+d,d):U-A/2,Z=v==="start"?j:v==="center"?j-h/2:v==="end"?j-h:z(b,b+h,h,ce,me,b+j,b+j+a,a),ne=Math.max(0,ne+c),Z=Math.max(0,Z+b);else{ne=w==="start"?U-ie-ae:w==="end"?U-ve+J+Ae:w==="nearest"?z(ie,ve,Y,ae,J+Ae,U,U+d,d):U-(ie+Y/2)+Ae/2,Z=v==="start"?j-ge-ce:v==="center"?j-(ge+q/2)+Ee/2:v==="end"?j-Te+me+Ee:z(ge,Te,q,ce,me+Ee,j,j+a,a);var be=O.scrollLeft,Se=O.scrollTop;U+=Se-(ne=Math.max(0,Math.min(Se+ne,O.scrollHeight-Y+Ae))),j+=be-(Z=Math.max(0,Math.min(be+Z,O.scrollWidth-q+Ee)))}W.push({el:O,top:ne,left:Z})}return W};function _(g){return g===Object(g)&&Object.keys(g).length!==0}function B(g,T){T===void 0&&(T="auto");var R="scrollBehavior"in document.body.style;g.forEach(function(C){var w=C.el,v=C.top,u=C.left;w.scroll&&R?w.scroll({top:v,left:u,behavior:T}):(w.scrollTop=v,w.scrollLeft=u)})}function F(g){return g===!1?{block:"end",inline:"nearest"}:_(g)?g:{block:"start",inline:"nearest"}}function M(g,T){var R=!g.ownerDocument.documentElement.contains(g);if(_(T)&&typeof T.behavior=="function")return T.behavior(R?[]:I(g,T));if(R)return;var C=F(T);return B(I(g,C),C.behavior)}var D=et.a=M},Zss7:function(ut,et,oe){var te;(function(G){var L=/^\s+/,z=/\s+$/,I=0,_=G.round,B=G.min,F=G.max,M=G.random;function D(J,ne){if(J=J||"",ne=ne||{},J instanceof D)return J;if(!(this instanceof D))return new D(J,ne);var Z=g(J);this._originalInput=J,this._r=Z.r,this._g=Z.g,this._b=Z.b,this._a=Z.a,this._roundA=_(100*this._a)/100,this._format=ne.format||Z.format,this._gradientType=ne.gradientType,this._r<1&&(this._r=_(this._r)),this._g<1&&(this._g=_(this._g)),this._b<1&&(this._b=_(this._b)),this._ok=Z.ok,this._tc_id=I++}D.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var J=this.toRgb();return(J.r*299+J.g*587+J.b*114)/1e3},getLuminance:function(){var J=this.toRgb(),ne,Z,Ee,Ae,be,Se;return ne=J.r/255,Z=J.g/255,Ee=J.b/255,ne<=.03928?Ae=ne/12.92:Ae=G.pow((ne+.055)/1.055,2.4),Z<=.03928?be=Z/12.92:be=G.pow((Z+.055)/1.055,2.4),Ee<=.03928?Se=Ee/12.92:Se=G.pow((Ee+.055)/1.055,2.4),.2126*Ae+.7152*be+.0722*Se},setAlpha:function(J){return this._a=W(J),this._roundA=_(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),ne=_(J.h*360),Z=_(J.s*100),Ee=_(J.v*100);return this._a==1?"hsv("+ne+", "+Z+"%, "+Ee+"%)":"hsva("+ne+", "+Z+"%, "+Ee+"%, "+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),ne=_(J.h*360),Z=_(J.s*100),Ee=_(J.l*100);return this._a==1?"hsl("+ne+", "+Z+"%, "+Ee+"%)":"hsla("+ne+", "+Z+"%, "+Ee+"%, "+this._roundA+")"},toHex:function(J){return u(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:_(this._r),g:_(this._g),b:_(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+_(this._r)+", "+_(this._g)+", "+_(this._b)+")":"rgba("+_(this._r)+", "+_(this._g)+", "+_(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:_(k(this._r,255)*100)+"%",g:_(k(this._g,255)*100)+"%",b:_(k(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+_(k(this._r,255)*100)+"%, "+_(k(this._g,255)*100)+"%, "+_(k(this._b,255)*100)+"%)":"rgba("+_(k(this._r,255)*100)+"%, "+_(k(this._g,255)*100)+"%, "+_(k(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:U[u(this._r,this._g,this._b,!0)]||!1},toFilter:function(J){var ne="#"+s(this._r,this._g,this._b,this._a),Z=ne,Ee=this._gradientType?"GradientType = 1, ":"";if(J){var Ae=D(J);Z="#"+s(Ae._r,Ae._g,Ae._b,Ae._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ee+"startColorstr="+ne+",endColorstr="+Z+")"},toString:function(J){var ne=!!J;J=J||this._format;var Z=!1,Ee=this._a<1&&this._a>=0,Ae=!ne&&Ee&&(J==="hex"||J==="hex6"||J==="hex3"||J==="hex4"||J==="hex8"||J==="name");return Ae?J==="name"&&this._a===0?this.toName():this.toRgbString():(J==="rgb"&&(Z=this.toRgbString()),J==="prgb"&&(Z=this.toPercentageRgbString()),(J==="hex"||J==="hex6")&&(Z=this.toHexString()),J==="hex3"&&(Z=this.toHexString(!0)),J==="hex4"&&(Z=this.toHex8String(!0)),J==="hex8"&&(Z=this.toHex8String()),J==="name"&&(Z=this.toName()),J==="hsl"&&(Z=this.toHslString()),J==="hsv"&&(Z=this.toHsvString()),Z||this.toHexString())},clone:function(){return D(this.toString())},_applyModification:function(J,ne){var Z=J.apply(null,[this].concat([].slice.call(ne)));return this._r=Z._r,this._g=Z._g,this._b=Z._b,this.setAlpha(Z._a),this},lighten:function(){return this._applyModification(h,arguments)},brighten:function(){return this._applyModification(A,arguments)},darken:function(){return this._applyModification(b,arguments)},desaturate:function(){return this._applyModification(l,arguments)},saturate:function(){return this._applyModification(S,arguments)},greyscale:function(){return this._applyModification(p,arguments)},spin:function(){return this._applyModification(c,arguments)},_applyCombination:function(J,ne){return J.apply(null,[this].concat([].slice.call(ne)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(f,arguments)},monochromatic:function(){return this._applyCombination(x,arguments)},splitcomplement:function(){return this._applyCombination(y,arguments)},triad:function(){return this._applyCombination(d,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},D.fromRatio=function(J,ne){if(typeof J=="object"){var Z={};for(var Ee in J)J.hasOwnProperty(Ee)&&(Ee==="a"?Z[Ee]=J[Ee]:Z[Ee]=Te(J[Ee]));J=Z}return D(J,ne)};function g(J){var ne={r:0,g:0,b:0},Z=1,Ee=null,Ae=null,be=null,Se=!1,Re=!1;return typeof J=="string"&&(J=ae(J)),typeof J=="object"&&(ce(J.r)&&ce(J.g)&&ce(J.b)?(ne=T(J.r,J.g,J.b),Se=!0,Re=String(J.r).substr(-1)==="%"?"prgb":"rgb"):ce(J.h)&&ce(J.s)&&ce(J.v)?(Ee=Te(J.s),Ae=Te(J.v),ne=v(J.h,Ee,Ae),Se=!0,Re="hsv"):ce(J.h)&&ce(J.s)&&ce(J.l)&&(Ee=Te(J.s),be=Te(J.l),ne=C(J.h,Ee,be),Se=!0,Re="hsl"),J.hasOwnProperty("a")&&(Z=J.a)),Z=W(Z),{ok:Se,format:J.format||Re,r:B(255,F(ne.r,0)),g:B(255,F(ne.g,0)),b:B(255,F(ne.b,0)),a:Z}}function T(J,ne,Z){return{r:k(J,255)*255,g:k(ne,255)*255,b:k(Z,255)*255}}function R(J,ne,Z){J=k(J,255),ne=k(ne,255),Z=k(Z,255);var Ee=F(J,ne,Z),Ae=B(J,ne,Z),be,Se,Re=(Ee+Ae)/2;if(Ee==Ae)be=Se=0;else{var Ue=Ee-Ae;Se=Re>.5?Ue/(2-Ee-Ae):Ue/(Ee+Ae);switch(Ee){case J:be=(ne-Z)/Ue+(ne<Z?6:0);break;case ne:be=(Z-J)/Ue+2;break;case Z:be=(J-ne)/Ue+4;break}be/=6}return{h:be,s:Se,l:Re}}function C(J,ne,Z){var Ee,Ae,be;J=k(J,360),ne=k(ne,100),Z=k(Z,100);function Se(Ie,ke,Oe){return Oe<0&&(Oe+=1),Oe>1&&(Oe-=1),Oe<1/6?Ie+(ke-Ie)*6*Oe:Oe<1/2?ke:Oe<2/3?Ie+(ke-Ie)*(2/3-Oe)*6:Ie}if(ne===0)Ee=Ae=be=Z;else{var Re=Z<.5?Z*(1+ne):Z+ne-Z*ne,Ue=2*Z-Re;Ee=Se(Ue,Re,J+1/3),Ae=Se(Ue,Re,J),be=Se(Ue,Re,J-1/3)}return{r:Ee*255,g:Ae*255,b:be*255}}function w(J,ne,Z){J=k(J,255),ne=k(ne,255),Z=k(Z,255);var Ee=F(J,ne,Z),Ae=B(J,ne,Z),be,Se,Re=Ee,Ue=Ee-Ae;if(Se=Ee===0?0:Ue/Ee,Ee==Ae)be=0;else{switch(Ee){case J:be=(ne-Z)/Ue+(ne<Z?6:0);break;case ne:be=(Z-J)/Ue+2;break;case Z:be=(J-ne)/Ue+4;break}be/=6}return{h:be,s:Se,v:Re}}function v(J,ne,Z){J=k(J,360)*6,ne=k(ne,100),Z=k(Z,100);var Ee=G.floor(J),Ae=J-Ee,be=Z*(1-ne),Se=Z*(1-Ae*ne),Re=Z*(1-(1-Ae)*ne),Ue=Ee%6,Ie=[Z,Se,be,be,Re,Z][Ue],ke=[Re,Z,Z,Se,be,be][Ue],Oe=[be,be,Re,Z,Z,Se][Ue];return{r:Ie*255,g:ke*255,b:Oe*255}}function u(J,ne,Z,Ee){var Ae=[ie(_(J).toString(16)),ie(_(ne).toString(16)),ie(_(Z).toString(16))];return Ee&&Ae[0].charAt(0)==Ae[0].charAt(1)&&Ae[1].charAt(0)==Ae[1].charAt(1)&&Ae[2].charAt(0)==Ae[2].charAt(1)?Ae[0].charAt(0)+Ae[1].charAt(0)+Ae[2].charAt(0):Ae.join("")}function o(J,ne,Z,Ee,Ae){var be=[ie(_(J).toString(16)),ie(_(ne).toString(16)),ie(_(Z).toString(16)),ie(ve(Ee))];return Ae&&be[0].charAt(0)==be[0].charAt(1)&&be[1].charAt(0)==be[1].charAt(1)&&be[2].charAt(0)==be[2].charAt(1)&&be[3].charAt(0)==be[3].charAt(1)?be[0].charAt(0)+be[1].charAt(0)+be[2].charAt(0)+be[3].charAt(0):be.join("")}function s(J,ne,Z,Ee){var Ae=[ie(ve(Ee)),ie(_(J).toString(16)),ie(_(ne).toString(16)),ie(_(Z).toString(16))];return Ae.join("")}D.equals=function(J,ne){return!J||!ne?!1:D(J).toRgbString()==D(ne).toRgbString()},D.random=function(){return D.fromRatio({r:M(),g:M(),b:M()})};function l(J,ne){ne=ne===0?0:ne||10;var Z=D(J).toHsl();return Z.s-=ne/100,Z.s=O(Z.s),D(Z)}function S(J,ne){ne=ne===0?0:ne||10;var Z=D(J).toHsl();return Z.s+=ne/100,Z.s=O(Z.s),D(Z)}function p(J){return D(J).desaturate(100)}function h(J,ne){ne=ne===0?0:ne||10;var Z=D(J).toHsl();return Z.l+=ne/100,Z.l=O(Z.l),D(Z)}function A(J,ne){ne=ne===0?0:ne||10;var Z=D(J).toRgb();return Z.r=F(0,B(255,Z.r-_(255*-(ne/100)))),Z.g=F(0,B(255,Z.g-_(255*-(ne/100)))),Z.b=F(0,B(255,Z.b-_(255*-(ne/100)))),D(Z)}function b(J,ne){ne=ne===0?0:ne||10;var Z=D(J).toHsl();return Z.l-=ne/100,Z.l=O(Z.l),D(Z)}function c(J,ne){var Z=D(J).toHsl(),Ee=(Z.h+ne)%360;return Z.h=Ee<0?360+Ee:Ee,D(Z)}function f(J){var ne=D(J).toHsl();return ne.h=(ne.h+180)%360,D(ne)}function d(J){var ne=D(J).toHsl(),Z=ne.h;return[D(J),D({h:(Z+120)%360,s:ne.s,l:ne.l}),D({h:(Z+240)%360,s:ne.s,l:ne.l})]}function a(J){var ne=D(J).toHsl(),Z=ne.h;return[D(J),D({h:(Z+90)%360,s:ne.s,l:ne.l}),D({h:(Z+180)%360,s:ne.s,l:ne.l}),D({h:(Z+270)%360,s:ne.s,l:ne.l})]}function y(J){var ne=D(J).toHsl(),Z=ne.h;return[D(J),D({h:(Z+72)%360,s:ne.s,l:ne.l}),D({h:(Z+216)%360,s:ne.s,l:ne.l})]}function m(J,ne,Z){ne=ne||6,Z=Z||30;var Ee=D(J).toHsl(),Ae=360/Z,be=[D(J)];for(Ee.h=(Ee.h-(Ae*ne>>1)+720)%360;--ne;)Ee.h=(Ee.h+Ae)%360,be.push(D(Ee));return be}function x(J,ne){ne=ne||6;for(var Z=D(J).toHsv(),Ee=Z.h,Ae=Z.s,be=Z.v,Se=[],Re=1/ne;ne--;)Se.push(D({h:Ee,s:Ae,v:be})),be=(be+Re)%1;return Se}D.mix=function(J,ne,Z){Z=Z===0?0:Z||50;var Ee=D(J).toRgb(),Ae=D(ne).toRgb(),be=Z/100,Se={r:(Ae.r-Ee.r)*be+Ee.r,g:(Ae.g-Ee.g)*be+Ee.g,b:(Ae.b-Ee.b)*be+Ee.b,a:(Ae.a-Ee.a)*be+Ee.a};return D(Se)},D.readability=function(J,ne){var Z=D(J),Ee=D(ne);return(G.max(Z.getLuminance(),Ee.getLuminance())+.05)/(G.min(Z.getLuminance(),Ee.getLuminance())+.05)},D.isReadable=function(J,ne,Z){var Ee=D.readability(J,ne),Ae,be;be=!1,Ae=me(Z);switch(Ae.level+Ae.size){case"AAsmall":case"AAAlarge":be=Ee>=4.5;break;case"AAlarge":be=Ee>=3;break;case"AAAsmall":be=Ee>=7;break}return be},D.mostReadable=function(J,ne,Z){var Ee=null,Ae=0,be,Se,Re,Ue;Z=Z||{},Se=Z.includeFallbackColors,Re=Z.level,Ue=Z.size;for(var Ie=0;Ie<ne.length;Ie++)be=D.readability(J,ne[Ie]),be>Ae&&(Ae=be,Ee=D(ne[Ie]));return D.isReadable(J,Ee,{level:Re,size:Ue})||!Se?Ee:(Z.includeFallbackColors=!1,D.mostReadable(J,["#fff","#000"],Z))};var P=D.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},U=D.hexNames=j(P);function j(J){var ne={};for(var Z in J)J.hasOwnProperty(Z)&&(ne[J[Z]]=Z);return ne}function W(J){return J=parseFloat(J),(isNaN(J)||J<0||J>1)&&(J=1),J}function k(J,ne){Y(J)&&(J="100%");var Z=q(J);return J=B(ne,F(0,parseFloat(J))),Z&&(J=parseInt(J*ne,10)/100),G.abs(J-ne)<1e-6?1:J%ne/parseFloat(ne)}function O(J){return B(1,F(0,J))}function K(J){return parseInt(J,16)}function Y(J){return typeof J=="string"&&J.indexOf(".")!=-1&&parseFloat(J)===1}function q(J){return typeof J=="string"&&J.indexOf("%")!=-1}function ie(J){return J.length==1?"0"+J:""+J}function Te(J){return J<=1&&(J=J*100+"%"),J}function ve(J){return G.round(parseFloat(J)*255).toString(16)}function ge(J){return K(J)/255}var he=function(){var J="[-\\+]?\\d+%?",ne="[-\\+]?\\d*\\.\\d+%?",Z="(?:"+ne+")|(?:"+J+")",Ee="[\\s|\\(]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")\\s*\\)?",Ae="[\\s|\\(]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")\\s*\\)?";return{CSS_UNIT:new RegExp(Z),rgb:new RegExp("rgb"+Ee),rgba:new RegExp("rgba"+Ae),hsl:new RegExp("hsl"+Ee),hsla:new RegExp("hsla"+Ae),hsv:new RegExp("hsv"+Ee),hsva:new RegExp("hsva"+Ae),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 ce(J){return!!he.CSS_UNIT.exec(J)}function ae(J){J=J.replace(L,"").replace(z,"").toLowerCase();var ne=!1;if(P[J])J=P[J],ne=!0;else if(J=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var Z;return(Z=he.rgb.exec(J))?{r:Z[1],g:Z[2],b:Z[3]}:(Z=he.rgba.exec(J))?{r:Z[1],g:Z[2],b:Z[3],a:Z[4]}:(Z=he.hsl.exec(J))?{h:Z[1],s:Z[2],l:Z[3]}:(Z=he.hsla.exec(J))?{h:Z[1],s:Z[2],l:Z[3],a:Z[4]}:(Z=he.hsv.exec(J))?{h:Z[1],s:Z[2],v:Z[3]}:(Z=he.hsva.exec(J))?{h:Z[1],s:Z[2],v:Z[3],a:Z[4]}:(Z=he.hex8.exec(J))?{r:K(Z[1]),g:K(Z[2]),b:K(Z[3]),a:ge(Z[4]),format:ne?"name":"hex8"}:(Z=he.hex6.exec(J))?{r:K(Z[1]),g:K(Z[2]),b:K(Z[3]),format:ne?"name":"hex"}:(Z=he.hex4.exec(J))?{r:K(Z[1]+""+Z[1]),g:K(Z[2]+""+Z[2]),b:K(Z[3]+""+Z[3]),a:ge(Z[4]+""+Z[4]),format:ne?"name":"hex8"}:(Z=he.hex3.exec(J))?{r:K(Z[1]+""+Z[1]),g:K(Z[2]+""+Z[2]),b:K(Z[3]+""+Z[3]),format:ne?"name":"hex"}:!1}function me(J){var ne,Z;return J=J||{level:"AA",size:"small"},ne=(J.level||"AA").toUpperCase(),Z=(J.size||"small").toLowerCase(),ne!=="AA"&&ne!=="AAA"&&(ne="AA"),Z!=="small"&&Z!=="large"&&(Z="small"),{level:ne,size:Z}}ut.exports?ut.exports=D:!(te=function(){return D}.call(et,oe,et,ut),te!==void 0&&(ut.exports=te))})(Math)},bT9E:function(ut,et,oe){"use strict";oe.d(et,"a",function(){return G});var te=oe("VTBJ");function G(L,z){var I=Object(te.a)({},L);return Array.isArray(z)&&z.forEach(function(_){delete I[_]}),I}},c5Ni:function(ut,et,oe){},dejd:function(ut,et,oe){},dmUQ:function(ut,et,oe){"use strict";var te=oe("Ff2n"),G=oe("rePB"),L=oe("1OyB"),z=oe("vuIU"),I=oe("Ji7U"),_=oe("md7G"),B=oe("foSv"),F=oe("cDcd"),M=oe.n(F),D=oe("TSYQ"),g=oe.n(D),T=oe("4IlW");function R(d,a){var y=Object.keys(d);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(d);a&&(m=m.filter(function(x){return Object.getOwnPropertyDescriptor(d,x).enumerable})),y.push.apply(y,m)}return y}function C(d){for(var a=1;a<arguments.length;a++){var y=arguments[a]!=null?arguments[a]:{};a%2?R(Object(y),!0).forEach(function(m){Object(G.a)(d,m,y[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(y)):R(Object(y)).forEach(function(m){Object.defineProperty(d,m,Object.getOwnPropertyDescriptor(y,m))})}return d}function w(d){var a=v();return function(){var m=Object(B.a)(d),x;if(a){var P=Object(B.a)(this).constructor;x=Reflect.construct(m,arguments,P)}else x=m.apply(this,arguments);return Object(_.a)(this,x)}}function v(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(d){return!1}}function u(){}function o(d){d.preventDefault()}var s=function(a){return a.replace(/[^\w.-]+/g,"")},l=200,S=600,p=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,h=function(a){return a!=null},A=function(a,y){return y===a||typeof y=="number"&&typeof a=="number"&&isNaN(y)&&isNaN(a)},b=function(d){Object(I.a)(y,d);var a=w(y);function y(m){var x;Object(L.a)(this,y),x=a.call(this,m),x.onKeyDown=function(j){var W=x.props,k=W.onKeyDown,O=W.onPressEnter;if(j.keyCode===T.a.UP){var K=x.getRatio(j);x.up(j,K,null),x.stop()}else if(j.keyCode===T.a.DOWN){var Y=x.getRatio(j);x.down(j,Y,null),x.stop()}else j.keyCode===T.a.ENTER&&O&&O(j);if(x.recordCursorPosition(),x.lastKeyCode=j.keyCode,k){for(var q=arguments.length,ie=new Array(q>1?q-1:0),Te=1;Te<q;Te++)ie[Te-1]=arguments[Te];k.apply(void 0,[j].concat(ie))}},x.onKeyUp=function(j){var W=x.props.onKeyUp;if(x.stop(),x.recordCursorPosition(),W){for(var k=arguments.length,O=new Array(k>1?k-1:0),K=1;K<k;K++)O[K-1]=arguments[K];W.apply(void 0,[j].concat(O))}},x.onChange=function(j){var W=x.props.onChange;x.state.focused&&(x.inputting=!0),x.rawInput=x.props.parser(x.getValueFromEvent(j)),x.setState({inputValue:x.rawInput}),W(x.toNumber(x.rawInput))},x.onMouseUp=function(){var j=x.props.onMouseUp;x.recordCursorPosition(),j&&j.apply(void 0,arguments)},x.onFocus=function(){var j;x.setState({focused:!0}),(j=x.props).onFocus.apply(j,arguments)},x.onBlur=function(){var j=x.props.onBlur;x.inputting=!1,x.setState({focused:!1});var W=x.getCurrentValidValue(x.state.inputValue),k=x.setValue(W,u);if(j){var O=x.input.value,K=x.getInputDisplayValue({focus:!1,value:k});x.input.value=K&&Number(K),j.apply(void 0,arguments),x.input.value=O}},x.getRatio=function(j){var W=1;return j.metaKey||j.ctrlKey?W=.1:j.shiftKey&&(W=10),W},x.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},x.getPrecision=function(j){if(h(x.props.precision))return x.props.precision;var W=String(j);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var k=0;return W.indexOf(".")>=0&&(k=W.length-W.indexOf(".")-1),k},x.getInputDisplayValue=function(j){var W=j||x.state,k=W.focused,O=W.inputValue,K=W.value,Y;k?Y=O:Y=x.toPrecisionAsStep(K),Y==null&&(Y="");var q=x.formatWrapper(Y);return h(x.props.decimalSeparator)&&(q=q.toString().replace(".",x.props.decimalSeparator)),q},x.recordCursorPosition=function(){try{x.cursorStart=x.input.selectionStart,x.cursorEnd=x.input.selectionEnd,x.currentValue=x.input.value,x.cursorBefore=x.input.value.substring(0,x.cursorStart),x.cursorAfter=x.input.value.substring(x.cursorEnd)}catch(j){}},x.restoreByAfter=function(j){if(j===void 0)return!1;var W=x.input.value,k=W.lastIndexOf(j);if(k===-1)return!1;var O=x.cursorBefore.length;return x.lastKeyCode===T.a.DELETE&&x.cursorBefore.charAt(O-1)===j[0]?(x.fixCaret(O,O),!0):k+j.length===W.length?(x.fixCaret(k,k),!0):!1},x.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(W,k){var O=j.substring(k);return x.restoreByAfter(O)})},x.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},x.stop=function(){x.autoStepTimer&&clearTimeout(x.autoStepTimer)},x.down=function(j,W,k){x.pressingUpOrDown=!0,x.step("down",j,W,k)},x.up=function(j,W,k){x.pressingUpOrDown=!0,x.step("up",j,W,k)},x.saveInput=function(j){x.input=j};var P=m.value;P===void 0&&(P=m.defaultValue),x.state={focused:m.autoFocus};var U=x.getValidValue(x.toNumber(P));return x.state=C(C({},x.state),{},{inputValue:x.toPrecisionAsStep(U),value:U}),x}return Object(z.a)(y,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(x){var P=this.props,U=P.value,j=P.onChange,W=P.max,k=P.min,O=this.state.focused;if(x){if(!A(x.value,U)||!A(x.max,W)||!A(x.min,k)){var K=O?U:this.getValidValue(U),Y;this.pressingUpOrDown?Y=K:this.inputting?Y=this.rawInput:Y=this.toPrecisionAsStep(K),this.setState({value:K,inputValue:Y})}var q="value"in this.props?U:this.state.value;"max"in this.props&&x.max!==W&&typeof q=="number"&&q>W&&j&&j(W),"min"in this.props&&x.min!==k&&typeof q=="number"&&q<k&&j&&j(k)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ie=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===T.a.BACKSPACE?ie=this.cursorStart-1:this.lastKeyCode===T.a.DELETE&&(ie=this.cursorStart):ie=this.input.value.length,this.fixCaret(ie,ie)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case T.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case T.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Te){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(x){var P=x;return P===""?P="":this.isNotCompleteNumber(parseFloat(P))?P=this.state.value:P=this.getValidValue(P),this.toNumber(P)}},{key:"getValueFromEvent",value:function(x){var P=x.target.value.trim().replace(/。/g,".");return h(this.props.decimalSeparator)&&(P=P.replace(this.props.decimalSeparator,".")),P}},{key:"getValidValue",value:function(x){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,j=parseFloat(x);return isNaN(j)?x:(j<P&&(j=P),j>U&&(j=U),j)}},{key:"setValue",value:function(x,P){var U=this.props.precision,j=this.isNotCompleteNumber(parseFloat(x))?null:parseFloat(x),W=this.state.value,k=W===void 0?null:W,O=this.state.inputValue,K=O===void 0?null:O,Y=typeof j=="number"?j.toFixed(U):"".concat(j),q=j!==k||Y!=="".concat(K);return"value"in this.props?(K=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:K},P)):this.setState({value:j,inputValue:this.toPrecisionAsStep(x)},P),q&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(x){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.props,j=U.precision,W=U.step;if(h(j))return j;var k=this.getPrecision(P),O=this.getPrecision(W),K=this.getPrecision(x);return x?Math.max(K,k+O):k+O}},{key:"getPrecisionFactor",value:function(x){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.getMaxPrecision(x,P);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(x){return this.props.formatter?this.props.formatter(x):x}},{key:"toPrecisionAsStep",value:function(x){if(this.isNotCompleteNumber(x)||x==="")return x;var P=Math.abs(this.getMaxPrecision(x));return isNaN(P)?x.toString():Number(x).toFixed(P)}},{key:"toNumber",value:function(x){var P=this.props.precision,U=this.state.focused,j=x&&x.length>16&&U;return this.isNotCompleteNumber(x)||j?x:h(P)?Math.round(x*Math.pow(10,P))/Math.pow(10,P):Number(x)}},{key:"upStep",value:function(x,P){var U=this.props.step,j=this.getPrecisionFactor(x,P),W=Math.abs(this.getMaxPrecision(x,P)),k=((j*x+j*U*P)/j).toFixed(W);return this.toNumber(k)}},{key:"downStep",value:function(x,P){var U=this.props.step,j=this.getPrecisionFactor(x,P),W=Math.abs(this.getMaxPrecision(x,P)),k=((j*x-j*U*P)/j).toFixed(W);return this.toNumber(k)}},{key:"step",value:function(x,P){var U=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),P&&(P.persist(),P.preventDefault());var k=this.props;if(k.disabled)return;var O=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(O))return;var K=this["".concat(x,"Step")](O,j),Y=K>k.max||K<k.min;if(K>k.max?K=k.max:K<k.min&&(K=k.min),this.setValue(K,null),this.setState({focused:!0},function(){U.pressingUpOrDown=!1}),Y)return;this.autoStepTimer=setTimeout(function(){U[x](P,j,!0)},W?l:S)}},{key:"fixCaret",value:function(x,P){if(x===void 0||P===void 0||!this.input||!this.input.value)return;try{var U=this.input.selectionStart,j=this.input.selectionEnd;(x!==U||P!==j)&&this.input.setSelectionRange(x,P)}catch(W){}}},{key:"render",value:function(){var x,P=this.props,U=P.prefixCls,j=P.disabled,W=P.readOnly,k=P.useTouch,O=P.autoComplete,K=P.upHandler,Y=P.downHandler,q=P.className,ie=P.max,Te=P.min,ve=P.style,ge=P.title,he=P.onMouseEnter,ce=P.onMouseLeave,ae=P.onMouseOver,me=P.onMouseOut,J=P.required,ne=P.onClick,Z=P.tabIndex,Ee=P.type,Ae=P.placeholder,be=P.id,Se=P.inputMode,Re=P.pattern,Ue=P.step,Ie=P.maxLength,ke=P.autoFocus,Oe=P.name,$e=P.onPaste,ze=P.onInput,Ve=Object(te.a)(P,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Ge=this.state,rt=Ge.value,Je=Ge.focused,Ye=g()(U,(x={},Object(G.a)(x,q,!!q),Object(G.a)(x,"".concat(U,"-disabled"),j),Object(G.a)(x,"".concat(U,"-focused"),Je),x)),Ce={};Object.keys(Ve).forEach(function(se){(se.substr(0,5)==="data-"||se.substr(0,5)==="aria-"||se==="role")&&(Ce[se]=Ve[se])});var qe=!W&&!j,Xe=this.getInputDisplayValue(null),Le=(rt||rt===0)&&(isNaN(rt)||Number(rt)>=ie),Me=(rt||rt===0)&&(isNaN(rt)||Number(rt)<=Te),pe=Le||j||W,ue=Me||j||W,de=g()("".concat(U,"-handler"),"".concat(U,"-handler-up"),Object(G.a)({},"".concat(U,"-handler-up-disabled"),pe)),$=g()("".concat(U,"-handler"),"".concat(U,"-handler-down"),Object(G.a)({},"".concat(U,"-handler-down-disabled"),ue)),Q=k?{onTouchStart:pe?u:this.up,onTouchEnd:this.stop}:{onMouseDown:pe?u:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ee=k?{onTouchStart:ue?u:this.down,onTouchEnd:this.stop}:{onMouseDown:ue?u:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return M.a.createElement("div",{className:Ye,style:ve,title:ge,onMouseEnter:he,onMouseLeave:ce,onMouseOver:ae,onMouseOut:me,onFocus:function(){return null},onBlur:function(){return null}},M.a.createElement("div",{className:"".concat(U,"-handler-wrap")},M.a.createElement("span",Object.assign({unselectable:"on"},Q,{role:"button","aria-label":"Increase Value","aria-disabled":pe,className:de}),K||M.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-up-inner"),onClick:o})),M.a.createElement("span",Object.assign({unselectable:"on"},ee,{role:"button","aria-label":"Decrease Value","aria-disabled":ue,className:$}),Y||M.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-down-inner"),onClick:o}))),M.a.createElement("div",{className:"".concat(U,"-input-wrap")},M.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Te,"aria-valuemax":ie,"aria-valuenow":rt,required:J,type:Ee,placeholder:Ae,onPaste:$e,onClick:ne,onMouseUp:this.onMouseUp,className:"".concat(U,"-input"),tabIndex:Z,autoComplete:O,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:qe?this.onKeyDown:u,onKeyUp:qe?this.onKeyUp:u,autoFocus:ke,maxLength:Ie,readOnly:W,disabled:j,max:ie,min:Te,step:Ue,name:Oe,title:ge,id:be,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Xe),pattern:Re,inputMode:Se,onInput:ze},Ce))))}}]),y}(M.a.Component);b.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:p,min:-p,step:1,style:{},onChange:u,onKeyDown:u,onPressEnter:u,onFocus:u,onBlur:u,parser:s,required:!1,autoComplete:"off"};var c=b,f=et.a=c},gkVt:function(ut,et,oe){"use strict";oe.r(et);var te=oe("DZo9"),G=oe("8z0m"),L=oe("+L6B"),z=oe("2/Rp"),I=oe("miYZ"),_=oe("tsqr"),B=oe("9og8"),F=oe("tJVT"),M=oe("WmNS"),D=oe.n(M),g=oe("cDcd"),T=oe.n(g),R=oe("5NDa"),C=oe("5rEg"),w=oe("Ot1p"),v=oe("ErOA");function u(d){var a=d.setIscreate,y=d.init,m=d.UpdateItem,x=Object(g.useState)(""),P=Object(F.a)(x,2),U=P[0],j=P[1],W=Object(g.useState)(""),k=Object(F.a)(W,2),O=k[0],K=k[1];Object(g.useEffect)(function(){if(!m)return;j(m&&m.name),K(m&&m.description)},[m]);function Y(){return q.apply(this,arguments)}function q(){return q=Object(B.a)(D.a.mark(function ve(){var ge;return D.a.wrap(function(ce){for(;;)switch(ce.prev=ce.next){case 0:if(U){ce.next=3;break}return _.b.info("\u6807\u9898\u4E0D\u80FD\u4E3A\u7A7A"),ce.abrupt("return");case 3:if(O){ce.next=6;break}return _.b.info("\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7A7A"),ce.abrupt("return");case 6:if(!m){ce.next=9;break}return ie(),ce.abrupt("return");case 9:return ce.next=11,Object(v.a)("/api/hpc_courses.json",{method:"post",body:{name:U,description:O,container_type:window.location.pathname.split("/")[1]}});case 11:ge=ce.sent,ge&&(_.b.info("\u521B\u5EFA\u6210\u529F"),a(!1),y("add"));case 13:case"end":return ce.stop()}},ve)})),q.apply(this,arguments)}function ie(){return Te.apply(this,arguments)}function Te(){return Te=Object(B.a)(D.a.mark(function ve(){var ge;return D.a.wrap(function(ce){for(;;)switch(ce.prev=ce.next){case 0:return ce.next=2,Object(v.a)("/api/hpc_courses/".concat(m.id,".json"),{method:"put",body:{name:U,description:O,container_type:window.location.pathname.split("/")[1]}});case 2:ge=ce.sent,ge&&(_.b.info("\u7F16\u8F91\u6210\u529F"),a(!1),y(""));case 4:case"end":return ce.stop()}},ve)})),Te.apply(this,arguments)}return T.a.createElement("div",null,T.a.createElement(C.a,{style:{marginBottom:"20px"},placeholder:"\u8BF7\u8F93\u5165\u6807\u9898",value:U,maxLength:60,addonAfter:String(U.length)+"/60",onChange:function(ge){return j(ge.target.value)}}),T.a.createElement(w.a,{id:"courseContentMD",defaultValue:O,onChange:function(ge){return K(ge)}}),T.a.createElement("div",{className:"clearfix mt30 mb30"},T.a.createElement(z.a,{type:"primary",onClick:function(){return Y()},className:"defalutSubmitbtn fl mr20"},"\u63D0\u4EA4"),T.a.createElement("a",{className:"defalutCancelbtn fl",onClick:function(){return a(!1)}},"\u53D6\u6D88")))}var o=u,s=oe("9Bee");function l(d){var a=d.CourseItem,y=d.userId,m=d.init,x=d.ItemUpdate,P=d.setSee,U=d.UserInfo;function j(){return W.apply(this,arguments)}function W(){return W=Object(B.a)(D.a.mark(function O(){var K;return D.a.wrap(function(q){for(;;)switch(q.prev=q.next){case 0:return q.next=2,Object(v.a)("/api/hpc_courses/".concat(a.id,".json"),{method:"delete"});case 2:K=q.sent,K&&(_.b.info("\u5220\u9664\u6210\u529F"),m("delete"),P(!1));case 4:case"end":return q.stop()}},O)})),W.apply(this,arguments)}function k(){x(a)}return T.a.createElement("div",null,y===299635||y===301458||U!=null&&U.admin||U!=null&&U.business?T.a.createElement("div",{style:{textAlign:"right"}},T.a.createElement(z.a,{onClick:function(){return k()}},"\u7F16\u8F91"),T.a.createElement(z.a,{onClick:function(){return j()},style:{marginLeft:"30px"}},"\u5220\u9664")):null,T.a.createElement("h1",null,a==null?void 0:a.name),T.a.createElement(s.a,{value:a==null?void 0:a.description}))}var S=l,p=oe("9ivq"),h=oe("m3rI"),A=oe("Ty5D"),b=oe("9kvl");function c(d){var a,y,m,x,P,U,j,W,k,O=d.user,K=d.dispatch,Y=Object(g.useState)(1),q=Object(F.a)(Y,2),ie=q[0],Te=q[1],ve=Object(g.useState)(100),ge=Object(F.a)(ve,2),he=ge[0],ce=ge[1],ae=Object(g.useState)([]),me=Object(F.a)(ae,2),J=me[0],ne=me[1],Z=Object(g.useState)(!1),Ee=Object(F.a)(Z,2),Ae=Ee[0],be=Ee[1],Se=Object(g.useState)(!1),Re=Object(F.a)(Se,2),Ue=Re[0],Ie=Re[1],ke=Object(g.useState)(""),Oe=Object(F.a)(ke,2),$e=Oe[0],ze=Oe[1],Ve=Object(g.useState)(""),Ge=Object(F.a)(Ve,2),rt=Ge[0],Je=Ge[1],Ye=Object(g.useState)(""),Ce=Object(F.a)(Ye,2),qe=Ce[0],Xe=Ce[1],Le=Object(A.i)(),Me=Le.itemname,pe=Object(g.useState)(""),ue=Object(F.a)(pe,2),de=ue[0],$=ue[1];Object(g.useEffect)(function(){K({type:"globalSetting/headerToggle",payload:!1}),ie&&Q("")},[ie]);function Q(je){return ee.apply(this,arguments)}function ee(){return ee=Object(B.a)(D.a.mark(function je(Ze){var We,mt,dt,at,Et;return D.a.wrap(function(St){for(;;)switch(St.prev=St.next){case 0:return St.next=2,Object(v.a)("/api/hpc_courses.json",{method:"get",params:{page:ie,per_page:he,container_type:window.location.pathname.split("/")[1]}});case 2:if(We=St.sent,!We){St.next=24;break}if(mt=We.data.hpc_courses.length,ne(We.data.hpc_courses),Xe(We.data.file_url),Je(""),mt){St.next=10;break}return St.abrupt("return");case 10:if(de){St.next=14;break}Me?(Et=0,We==null||((dt=We.data)===null||dt===void 0||((at=dt.hpc_courses)===null||at===void 0))||at.map(function(Dt,yt){var or;(Me==null?void 0:Me.toLocaleLowerCase())===(Dt==null||((or=Dt.name)===null||or===void 0)?void 0:or.toLocaleLowerCase())&&(Et=yt)}),ze(We.data.hpc_courses[Et]),Ie(!0),$(We.data.hpc_courses[Et].id),(Me==null?void 0:Me.toLocaleLowerCase())==="resources"&&(ze(We.data.hpc_courses.filter(function(Dt){return Dt.id===15})[0]),Ie(!0),$(15))):(ze(We.data.hpc_courses[0]),Ie(!0),$(We.data.hpc_courses[0].id)),St.next=24;break;case 14:if(!(Ze==="delete")){St.next=23;break}if(!(mt===0)){St.next=18;break}return Ie(!1),St.abrupt("return");case 18:ze(We.data.hpc_courses[0]),Ie(!0),$(We.data.hpc_courses[0].id),St.next=24;break;case 23:Ze==="add"?(ze(We.data.hpc_courses[mt-1]),Ie(!0),$(We.data.hpc_courses[mt-1].id)):(ze(We.data.hpc_courses.filter(function(Dt){return Dt.id===de})[0]),Ie(!0),$(de));case 24:case"end":return St.stop()}},je)})),ee.apply(this,arguments)}function se(je){be(!1),Ie(!0),ze(je),$(je.id)}function fe(je){Je(je),be(!0),Ie(!1)}function we(){Je(""),be(!0),Ie(!1)}var _e={name:"file",multiple:!0,action:"https://www.educoder.net/api/hpc_courses/upload_file.json",data:{container_type:window.location.pathname.split("/")[1]},onChange:function(Ze){var We=Ze.file.status;We!=="uploading",We==="done"?(_.b.success("".concat(Ze.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F")),Q("")):We==="error"&&_.b.error("".concat(Ze.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))},beforeUpload:function(Ze){var We=Ze.size/1024/1024<150;return We||_.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E150MB"),We}};return T.a.createElement("div",{style:{marginBottom:"40px"}},T.a.createElement("div",{className:"bannterdiv",style:{background:"url(".concat(h.a.IMG_SERVER+"/".concat(qe),")")}}),T.a.createElement("img",{style:{width:"100%"},src:h.a.IMG_SERVER+"/".concat(qe)}),T.a.createElement("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"}},T.a.createElement("div",{style:{flex:"1",marginTop:"17px"}},J&&J.map(function(je,Ze){return T.a.createElement("p",{key:Ze,onClick:function(){return se(je)},className:de===je.id?"menuitemselect":"menuitem task-hide"},je.name)}),(O==null||((a=O.userInfo)===null||a===void 0)?void 0:a.user_id)===299635||(O==null||((y=O.userInfo)===null||y===void 0)?void 0:y.user_id)===301458||O!=null&&(m=O.userInfo)!==null&&m!==void 0&&m.admin||O!=null&&(x=O.userInfo)!==null&&x!==void 0&&x.business?T.a.createElement("p",{onClick:function(){return we()},className:"menuadd",style:{fontSize:"24px",paddingLeft:"10px"}},T.a.createElement("span",{style:{fontSize:"16px",marginLeft:"5px"}},"Last updated")):null),T.a.createElement("div",{className:"rightcount",style:{flex:"6",background:"#ffffff",padding:"20px",marginLeft:"30px",marginTop:"24px"}},Ae?T.a.createElement(o,{UpdateItem:rt,setIscreate:be,init:Q}):null,Ue?T.a.createElement(S,{UserInfo:O==null?void 0:O.userInfo,setSee:Ie,userId:O==null||((P=O.userInfo)===null||P===void 0)?void 0:P.user_id,ItemUpdate:fe,CourseItem:$e,init:Q}):null)),(O==null||((U=O.userInfo)===null||U===void 0)?void 0:U.user_id)===299635||(O==null||((j=O.userInfo)===null||j===void 0)?void 0:j.user_id)===301458||O!=null&&(W=O.userInfo)!==null&&W!==void 0&&W.admin||O!=null&&(k=O.userInfo)!==null&&k!==void 0&&k.business?T.a.createElement(G.a,_e,T.a.createElement(z.a,{className:"menuadd",style:{paddingLeft:"10px",marginLeft:"20px"}},"\u4E0A\u4F20\u9996\u9875\u56FE\u7247")):null)}var f=et.default=Object(b.a)(function(d){var a=d.user;return{user:a}})(c)},h78n:function(ut,et,oe){"use strict";oe.d(et,"a",function(){return x});var te=oe("cDcd"),G=oe.n(te),L=oe("TSYQ"),z=oe.n(L),I={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},_=function(j){var W=j.map(function(){return Object(te.useRef)()}),k=Object(te.useRef)();return Object(te.useEffect)(function(){var O=Date.now(),K=!1;Object.keys(W).forEach(function(Y){var q=W[Y].current;if(!q)return;K=!0;var ie=q.style;ie.transitionDuration=".3s, .3s, .3s, .06s",k.current&&O-k.current<100&&(ie.transitionDuration="0s, 0s")}),K&&(k.current=Date.now())}),[W]};function B(){return B=Object.assign||function(U){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var k in W)Object.prototype.hasOwnProperty.call(W,k)&&(U[k]=W[k])}return U},B.apply(this,arguments)}function F(U,j){return R(U)||T(U,j)||D(U,j)||M()}function M(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function D(U,j){if(!U)return;if(typeof U=="string")return g(U,j);var W=Object.prototype.toString.call(U).slice(8,-1);if(W==="Object"&&U.constructor&&(W=U.constructor.name),W==="Map"||W==="Set")return Array.from(U);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return g(U,j)}function g(U,j){(j==null||j>U.length)&&(j=U.length);for(var W=0,k=new Array(j);W<j;W++)k[W]=U[W];return k}function T(U,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var W=[],k=!0,O=!1,K=void 0;try{for(var Y=U[Symbol.iterator](),q;!(k=(q=Y.next()).done)&&!(W.push(q.value),j&&W.length===j);k=!0);}catch(ie){O=!0,K=ie}finally{try{!k&&Y.return!=null&&Y.return()}finally{if(O)throw K}}return W}function R(U){if(Array.isArray(U))return U}function C(U,j){if(U==null)return{};var W=w(U,j),k,O;if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(U);for(O=0;O<K.length;O++){if(k=K[O],j.indexOf(k)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,k))continue;W[k]=U[k]}}return W}function w(U,j){if(U==null)return{};var W={},k=Object.keys(U),O,K;for(K=0;K<k.length;K++){if(O=k[K],j.indexOf(O)>=0)continue;W[O]=U[O]}return W}var v=function(j){var W=j.className,k=j.percent,O=j.prefixCls,K=j.strokeColor,Y=j.strokeLinecap,q=j.strokeWidth,ie=j.style,Te=j.trailColor,ve=j.trailWidth,ge=j.transition,he=C(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete he.gapPosition;var ce=Array.isArray(k)?k:[k],ae=Array.isArray(K)?K:[K],me=_(ce),J=F(me,1),ne=J[0],Z=q/2,Ee=100-q/2,Ae="M ".concat(Y==="round"?Z:0,",").concat(Z,`
|
|
L `).concat(Y==="round"?Ee:100,",").concat(Z),be="0 0 100 ".concat(q),Se=0;return G.a.createElement("svg",B({className:z()("".concat(O,"-line"),W),viewBox:be,preserveAspectRatio:"none",style:ie},he),G.a.createElement("path",{className:"".concat(O,"-line-trail"),d:Ae,strokeLinecap:Y,stroke:Te,strokeWidth:ve||q,fillOpacity:"0"}),ce.map(function(Re,Ue){var Ie={strokeDasharray:"".concat(Re,"px, 100px"),strokeDashoffset:"-".concat(Se,"px"),transition:ge||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},ke=ae[Ue]||ae[ae.length-1];return Se+=Re,G.a.createElement("path",{key:Ue,className:"".concat(O,"-line-path"),d:Ae,strokeLinecap:Y,stroke:ke,strokeWidth:q,fillOpacity:"0",ref:ne[Ue],style:Ie})}))};v.defaultProps=I;var u=v;function o(){return o=Object.assign||function(U){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var k in W)Object.prototype.hasOwnProperty.call(W,k)&&(U[k]=W[k])}return U},o.apply(this,arguments)}function s(U,j){return A(U)||h(U,j)||S(U,j)||l()}function l(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function S(U,j){if(!U)return;if(typeof U=="string")return p(U,j);var W=Object.prototype.toString.call(U).slice(8,-1);if(W==="Object"&&U.constructor&&(W=U.constructor.name),W==="Map"||W==="Set")return Array.from(U);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return p(U,j)}function p(U,j){(j==null||j>U.length)&&(j=U.length);for(var W=0,k=new Array(j);W<j;W++)k[W]=U[W];return k}function h(U,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var W=[],k=!0,O=!1,K=void 0;try{for(var Y=U[Symbol.iterator](),q;!(k=(q=Y.next()).done)&&!(W.push(q.value),j&&W.length===j);k=!0);}catch(ie){O=!0,K=ie}finally{try{!k&&Y.return!=null&&Y.return()}finally{if(O)throw K}}return W}function A(U){if(Array.isArray(U))return U}function b(U,j){if(U==null)return{};var W=c(U,j),k,O;if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(U);for(O=0;O<K.length;O++){if(k=K[O],j.indexOf(k)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,k))continue;W[k]=U[k]}}return W}function c(U,j){if(U==null)return{};var W={},k=Object.keys(U),O,K;for(K=0;K<k.length;K++){if(O=k[K],j.indexOf(O)>=0)continue;W[O]=U[O]}return W}var f=0;function d(U){return+U.replace("%","")}function a(U){return Array.isArray(U)?U:[U]}function y(U,j,W,k){var O=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,K=arguments.length>5?arguments[5]:void 0,Y=50-k/2,q=0,ie=-Y,Te=0,ve=-2*Y;switch(K){case"left":q=-Y,ie=0,Te=2*Y,ve=0;break;case"right":q=Y,ie=0,Te=-2*Y,ve=0;break;case"bottom":ie=Y,ve=2*Y;break;default:}var ge="M 50,50 m ".concat(q,",").concat(ie,`
|
|
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(Te,",").concat(-ve,`
|
|
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(-Te,",").concat(ve),he=Math.PI*2*Y,ce={stroke:W,strokeDasharray:"".concat(j/100*(he-O),"px ").concat(he,"px"),strokeDashoffset:"-".concat(O/2+U/100*(he-O),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:ge,pathStyle:ce}}var m=function(j){var W=j.prefixCls,k=j.strokeWidth,O=j.trailWidth,K=j.gapDegree,Y=j.gapPosition,q=j.trailColor,ie=j.strokeLinecap,Te=j.style,ve=j.className,ge=j.strokeColor,he=j.percent,ce=b(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ae=Object(te.useMemo)(function(){return f+=1,f},[]),me=y(0,100,q,k,K,Y),J=me.pathString,ne=me.pathStyle,Z=a(he),Ee=a(ge),Ae=Ee.find(function(Ie){return Object.prototype.toString.call(Ie)==="[object Object]"}),be=_(Z),Se=s(be,1),Re=Se[0],Ue=function(){var ke=0;return Z.map(function(Oe,$e){var ze=Ee[$e]||Ee[Ee.length-1],Ve=Object.prototype.toString.call(ze)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ae,")"):"",Ge=y(ke,Oe,ze,k,K,Y);return ke+=Oe,G.a.createElement("path",{key:$e,className:"".concat(W,"-circle-path"),d:Ge.pathString,stroke:Ve,strokeLinecap:ie,strokeWidth:k,opacity:Oe===0?0:1,fillOpacity:"0",style:Ge.pathStyle,ref:Re[$e]})})};return G.a.createElement("svg",o({className:z()("".concat(W,"-circle"),ve),viewBox:"0 0 100 100",style:Te},ce),Ae&&G.a.createElement("defs",null,G.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ae),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Ae).sort(function(Ie,ke){return d(Ie)-d(ke)}).map(function(Ie,ke){return G.a.createElement("stop",{key:ke,offset:Ie,stopColor:Ae[Ie]})}))),G.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:J,stroke:q,strokeLinecap:ie,strokeWidth:O||k,fillOpacity:"0",style:ne}),Ue().reverse())};m.defaultProps=I;var x=m,P={Line:u,Circle:x}},kSUc:function(ut,et,oe){},lZu9:function(ut,et,oe){(function(te){te(oe("VrN/"),oe("1eCo"),oe("8EBN"))})(function(te){"use strict";te.defineMode("markdown",function(G,L){var z=te.getMode(G,"text/html"),I=z.name=="null";function _(k){if(te.findModeByName){var O=te.findModeByName(k);O&&(k=O.mime||O.mimes[0])}var K=te.getMode(G,k);return K.name=="null"?null:K}L.highlightFormatting===void 0&&(L.highlightFormatting=!1),L.maxBlockquoteDepth===void 0&&(L.maxBlockquoteDepth=0),L.taskLists===void 0&&(L.taskLists=!1),L.strikethrough===void 0&&(L.strikethrough=!1),L.emoji===void 0&&(L.emoji=!1),L.fencedCodeBlockHighlighting===void 0&&(L.fencedCodeBlockHighlighting=!0),L.fencedCodeBlockDefaultMode===void 0&&(L.fencedCodeBlockDefaultMode="text/plain"),L.xml===void 0&&(L.xml=!0),L.tokenTypeOverrides===void 0&&(L.tokenTypeOverrides={});var B={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var F in B)B.hasOwnProperty(F)&&L.tokenTypeOverrides[F]&&(B[F]=L.tokenTypeOverrides[F]);var M=/^([*\-_])(?:\s*\1){2,}\s*$/,D=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,g=/^\[(x| )\](?=\s)/i,T=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,R=/^ {0,3}(?:\={1,}|-{2,})\s*$/,C=/^[^#!\[\]*_\\<>` "'(~:]+/,w=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,v=/^\s*\[[^\]]+?\]:.*$/,u=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function s(k,O,K){return O.f=O.inline=K,K(k,O)}function l(k,O,K){return O.f=O.block=K,K(k,O)}function S(k){return!k||!/\S/.test(k.string)}function p(k){if(k.linkTitle=!1,k.linkHref=!1,k.linkText=!1,k.em=!1,k.strong=!1,k.strikethrough=!1,k.quote=0,k.indentedCode=!1,k.f==A){var O=I;if(!O){var K=te.innerMode(z,k.htmlState);O=K.mode.name=="xml"&&K.state.tagStart===null&&!K.state.context&&K.state.tokenize.isInText}O&&(k.f=d,k.block=h,k.htmlState=null)}return k.trailingSpace=0,k.trailingSpaceNewLine=!1,k.prevLine=k.thisLine,k.thisLine={stream:null},null}function h(k,O){var K=k.column()===O.indentation,Y=S(O.prevLine.stream),q=O.indentedCode,ie=O.prevLine.hr,Te=O.list!==!1,ve=(O.listStack[O.listStack.length-1]||0)+3;O.indentedCode=!1;var ge=O.indentation;if(O.indentationDiff===null&&(O.indentationDiff=O.indentation,Te)){for(O.list=null;ge<O.listStack[O.listStack.length-1];)O.listStack.pop(),O.listStack.length?O.indentation=O.listStack[O.listStack.length-1]:O.list=!1;O.list!==!1&&(O.indentationDiff=ge-O.listStack[O.listStack.length-1])}var he=!Y&&!ie&&!O.prevLine.header&&(!Te||!q)&&!O.prevLine.fencedCodeEnd,ce=(O.list===!1||ie||Y)&&O.indentation<=ve&&k.match(M),ae=null;if(O.indentationDiff>=4&&(q||O.prevLine.fencedCodeEnd||O.prevLine.header||Y))return k.skipToEnd(),O.indentedCode=!0,B.code;if(k.eatSpace())return null;if(K&&O.indentation<=ve&&(ae=k.match(T))&&ae[1].length<=6)return O.quote=0,O.header=ae[1].length,O.thisLine.header=!0,L.highlightFormatting&&(O.formatting="header"),O.f=O.inline,c(O);if(O.indentation<=ve&&k.eat(">"))return O.quote=K?1:O.quote+1,L.highlightFormatting&&(O.formatting="quote"),k.eatSpace(),c(O);if(!ce&&!O.setext&&K&&O.indentation<=ve&&(ae=k.match(D))){var me=ae[1]?"ol":"ul";return O.indentation=ge+k.current().length,O.list=!0,O.quote=0,O.listStack.push(O.indentation),O.em=!1,O.strong=!1,O.code=!1,O.strikethrough=!1,L.taskLists&&k.match(g,!1)&&(O.taskList=!0),O.f=O.inline,L.highlightFormatting&&(O.formatting=["list","list-"+me]),c(O)}else{if(K&&O.indentation<=ve&&(ae=k.match(w,!0)))return O.quote=0,O.fencedEndRE=new RegExp(ae[1]+"+ *$"),O.localMode=L.fencedCodeBlockHighlighting&&_(ae[2]||L.fencedCodeBlockDefaultMode),O.localMode&&(O.localState=te.startState(O.localMode)),O.f=O.block=b,L.highlightFormatting&&(O.formatting="code-block"),O.code=-1,c(O);if(O.setext||(!he||!Te)&&!O.quote&&O.list===!1&&!O.code&&!ce&&!v.test(k.string)&&(ae=k.lookAhead(1))&&(ae=ae.match(R)))return O.setext?(O.header=O.setext,O.setext=0,k.skipToEnd(),L.highlightFormatting&&(O.formatting="header")):(O.header=ae[0].charAt(0)=="="?1:2,O.setext=O.header),O.thisLine.header=!0,O.f=O.inline,c(O);if(ce)return k.skipToEnd(),O.hr=!0,O.thisLine.hr=!0,B.hr;if(k.peek()==="[")return s(k,O,P)}return s(k,O,O.inline)}function A(k,O){var K=z.token(k,O.htmlState);if(!I){var Y=te.innerMode(z,O.htmlState);(Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText||O.md_inside&&k.current().indexOf(">")>-1)&&(O.f=d,O.block=h,O.htmlState=null)}return K}function b(k,O){var K=O.listStack[O.listStack.length-1]||0,Y=O.indentation<K,q=K+3;if(O.fencedEndRE&&O.indentation<=q&&(Y||k.match(O.fencedEndRE))){L.highlightFormatting&&(O.formatting="code-block");var ie;return Y||(ie=c(O)),O.localMode=O.localState=null,O.block=h,O.f=d,O.fencedEndRE=null,O.code=0,O.thisLine.fencedCodeEnd=!0,Y?l(k,O,O.block):ie}else return O.localMode?O.localMode.token(k,O.localState):(k.skipToEnd(),B.code)}function c(k){var O=[];if(k.formatting){O.push(B.formatting),typeof k.formatting=="string"&&(k.formatting=[k.formatting]);for(var K=0;K<k.formatting.length;K++)O.push(B.formatting+"-"+k.formatting[K]),k.formatting[K]==="header"&&O.push(B.formatting+"-"+k.formatting[K]+"-"+k.header),k.formatting[K]==="quote"&&(!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=k.quote?O.push(B.formatting+"-"+k.formatting[K]+"-"+k.quote):O.push("error"))}if(k.taskOpen)return O.push("meta"),O.length?O.join(" "):null;if(k.taskClosed)return O.push("property"),O.length?O.join(" "):null;if(k.linkHref?O.push(B.linkHref,"url"):(k.strong&&O.push(B.strong),k.em&&O.push(B.em),k.strikethrough&&O.push(B.strikethrough),k.emoji&&O.push(B.emoji),k.linkText&&O.push(B.linkText),k.code&&O.push(B.code),k.image&&O.push(B.image),k.imageAltText&&O.push(B.imageAltText,"link"),k.imageMarker&&O.push(B.imageMarker)),k.header&&O.push(B.header,B.header+"-"+k.header),k.quote&&(O.push(B.quote),!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=k.quote?O.push(B.quote+"-"+k.quote):O.push(B.quote+"-"+L.maxBlockquoteDepth)),k.list!==!1){var Y=(k.listStack.length-1)%3;Y?Y===1?O.push(B.list2):O.push(B.list3):O.push(B.list1)}return k.trailingSpaceNewLine?O.push("trailing-space-new-line"):k.trailingSpace&&O.push("trailing-space-"+(k.trailingSpace%2?"a":"b")),O.length?O.join(" "):null}function f(k,O){return k.match(C,!0)?c(O):void 0}function d(k,O){var K=O.text(k,O);if(typeof K!="undefined")return K;if(O.list)return O.list=null,c(O);if(O.taskList){var Y=k.match(g,!0)[1]===" ";return Y?O.taskOpen=!0:O.taskClosed=!0,L.highlightFormatting&&(O.formatting="task"),O.taskList=!1,c(O)}if(O.taskOpen=!1,O.taskClosed=!1,O.header&&k.match(/^#+$/,!0))return L.highlightFormatting&&(O.formatting="header"),c(O);var q=k.next();if(O.linkTitle){O.linkTitle=!1;var ie=q;q==="("&&(ie=")"),ie=(ie+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Te="^\\s*(?:[^"+ie+"\\\\]+|\\\\\\\\|\\\\.)"+ie;if(k.match(new RegExp(Te),!0))return B.linkHref}if(q==="`"){var ve=O.formatting;L.highlightFormatting&&(O.formatting="code"),k.eatWhile("`");var ge=k.current().length;if(O.code==0&&(!O.quote||ge==1))return O.code=ge,c(O);if(ge==O.code){var he=c(O);return O.code=0,he}else return O.formatting=ve,c(O)}else if(O.code)return c(O);if(q==="\\"&&(k.next(),L.highlightFormatting)){var ce=c(O),ae=B.formatting+"-escape";return ce?ce+" "+ae:ae}if(q==="!"&&k.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return O.imageMarker=!0,O.image=!0,L.highlightFormatting&&(O.formatting="image"),c(O);if(q==="["&&O.imageMarker&&k.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return O.imageMarker=!1,O.imageAltText=!0,L.highlightFormatting&&(O.formatting="image"),c(O);if(q==="]"&&O.imageAltText){L.highlightFormatting&&(O.formatting="image");var ce=c(O);return O.imageAltText=!1,O.image=!1,O.inline=O.f=y,ce}if(q==="["&&!O.image)return O.linkText&&k.match(/^.*?\]/)||(O.linkText=!0,L.highlightFormatting&&(O.formatting="link")),c(O);if(q==="]"&&O.linkText){L.highlightFormatting&&(O.formatting="link");var ce=c(O);return O.linkText=!1,O.inline=O.f=k.match(/\(.*?\)| ?\[.*?\]/,!1)?y:d,ce}if(q==="<"&&k.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){O.f=O.inline=a,L.highlightFormatting&&(O.formatting="link");var ce=c(O);return ce?ce+=" ":ce="",ce+B.linkInline}if(q==="<"&&k.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){O.f=O.inline=a,L.highlightFormatting&&(O.formatting="link");var ce=c(O);return ce?ce+=" ":ce="",ce+B.linkEmail}if(L.xml&&q==="<"&&k.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var me=k.string.indexOf(">",k.pos);if(me!=-1){var J=k.string.substring(k.start,me);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(J)&&(O.md_inside=!0)}return k.backUp(1),O.htmlState=te.startState(z),l(k,O,A)}if(L.xml&&q==="<"&&k.match(/^\/\w*?>/))return O.md_inside=!1,"tag";if(q==="*"||q==="_"){for(var ne=1,Z=k.pos==1?" ":k.string.charAt(k.pos-2);ne<3&&k.eat(q);)ne++;var Ee=k.peek()||" ",Ae=!/\s/.test(Ee)&&(!u.test(Ee)||/\s/.test(Z)||u.test(Z)),be=!/\s/.test(Z)&&(!u.test(Z)||/\s/.test(Ee)||u.test(Ee)),Se=null,Re=null;if(ne%2&&(!O.em&&Ae&&(q==="*"||!be||u.test(Z))?Se=!0:O.em==q&&be&&(q==="*"||!Ae||u.test(Ee))&&(Se=!1)),ne>1&&(!O.strong&&Ae&&(q==="*"||!be||u.test(Z))?Re=!0:O.strong==q&&be&&(q==="*"||!Ae||u.test(Ee))&&(Re=!1)),Re!=null||Se!=null){L.highlightFormatting&&(O.formatting=Se==null?"strong":Re==null?"em":"strong em"),Se===!0&&(O.em=q),Re===!0&&(O.strong=q);var he=c(O);return Se===!1&&(O.em=!1),Re===!1&&(O.strong=!1),he}}else if(q===" "&&(k.eat("*")||k.eat("_"))){if(k.peek()===" ")return c(O);k.backUp(1)}if(L.strikethrough){if(q==="~"&&k.eatWhile(q)){if(O.strikethrough){L.highlightFormatting&&(O.formatting="strikethrough");var he=c(O);return O.strikethrough=!1,he}else if(k.match(/^[^\s]/,!1))return O.strikethrough=!0,L.highlightFormatting&&(O.formatting="strikethrough"),c(O)}else if(q===" "&&k.match(/^~~/,!0)){if(k.peek()===" ")return c(O);k.backUp(2)}}if(L.emoji&&q===":"&&k.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){O.emoji=!0,L.highlightFormatting&&(O.formatting="emoji");var Ue=c(O);return O.emoji=!1,Ue}return q===" "&&(k.match(/^ +$/,!1)?O.trailingSpace++:O.trailingSpace&&(O.trailingSpaceNewLine=!0)),c(O)}function a(k,O){var K=k.next();if(K===">"){O.f=O.inline=d,L.highlightFormatting&&(O.formatting="link");var Y=c(O);return Y?Y+=" ":Y="",Y+B.linkInline}return k.match(/^[^>]+/,!0),B.linkInline}function y(k,O){if(k.eatSpace())return null;var K=k.next();return K==="("||K==="["?(O.f=O.inline=x(K==="("?")":"]"),L.highlightFormatting&&(O.formatting="link-string"),O.linkHref=!0,c(O)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function x(k){return function(O,K){var Y=O.next();if(Y===k){K.f=K.inline=d,L.highlightFormatting&&(K.formatting="link-string");var q=c(K);return K.linkHref=!1,q}return O.match(m[k]),K.linkHref=!0,c(K)}}function P(k,O){return k.match(/^([^\]\\]|\\.)*\]:/,!1)?(O.f=U,k.next(),L.highlightFormatting&&(O.formatting="link"),O.linkText=!0,c(O)):s(k,O,d)}function U(k,O){if(k.match(/^\]:/,!0)){O.f=O.inline=j,L.highlightFormatting&&(O.formatting="link");var K=c(O);return O.linkText=!1,K}return k.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function j(k,O){return k.eatSpace()?null:(k.match(/^[^\s]+/,!0),k.peek()===void 0?O.linkTitle=!0:k.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),O.f=O.inline=d,B.linkHref+" url")}var W={startState:function(){return{f:h,prevLine:{stream:null},thisLine:{stream:null},block:h,htmlState:null,indentation:0,inline:d,text:f,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(k){return{f:k.f,prevLine:k.prevLine,thisLine:k.thisLine,block:k.block,htmlState:k.htmlState&&te.copyState(z,k.htmlState),indentation:k.indentation,localMode:k.localMode,localState:k.localMode?te.copyState(k.localMode,k.localState):null,inline:k.inline,text:k.text,formatting:!1,linkText:k.linkText,linkTitle:k.linkTitle,linkHref:k.linkHref,code:k.code,em:k.em,strong:k.strong,strikethrough:k.strikethrough,emoji:k.emoji,header:k.header,setext:k.setext,hr:k.hr,taskList:k.taskList,list:k.list,listStack:k.listStack.slice(0),quote:k.quote,indentedCode:k.indentedCode,trailingSpace:k.trailingSpace,trailingSpaceNewLine:k.trailingSpaceNewLine,md_inside:k.md_inside,fencedEndRE:k.fencedEndRE}},token:function(k,O){if(O.formatting=!1,k!=O.thisLine.stream){if(O.header=0,O.hr=!1,k.match(/^\s*$/,!0))return p(O),null;if(O.prevLine=O.thisLine,O.thisLine={stream:k},O.taskList=!1,O.trailingSpace=0,O.trailingSpaceNewLine=!1,!O.localState&&(O.f=O.block,O.f!=A)){var K=k.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(O.indentation=K,O.indentationDiff=null,K>0)return null}}return O.f(k,O)},innerMode:function(k){return k.block==A?{state:k.htmlState,mode:z}:k.localState?{state:k.localState,mode:k.localMode}:{state:k,mode:W}},indent:function(k,O,K){return k.block==A&&z.indent?z.indent(k.htmlState,O,K):k.localState&&k.localMode.indent?k.localMode.indent(k.localState,O,K):te.Pass},blankLine:p,getType:c,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),te.defineMIME("text/markdown","markdown"),te.defineMIME("text/x-markdown","markdown")})},osHv:function(ut,et,oe){(function(te){te(oe("VrN/"))})(function(te){"use strict";var G=te.Pos;function L(u,o){return u.line-o.line||u.ch-o.ch}var z="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",I=z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",_=new RegExp("<(/?)(["+z+"]["+I+"]*)","g");function B(u,o,s,l){this.line=o,this.ch=s,this.cm=u,this.text=u.getLine(o),this.min=l?Math.max(l.from,u.firstLine()):u.firstLine(),this.max=l?Math.min(l.to-1,u.lastLine()):u.lastLine()}function F(u,o){var s=u.cm.getTokenTypeAt(G(u.line,o));return s&&/\btag\b/.test(s)}function M(u){return u.line>=u.max?void 0:(u.ch=0,u.text=u.cm.getLine(++u.line),!0)}function D(u){return u.line<=u.min?void 0:(u.text=u.cm.getLine(--u.line),u.ch=u.text.length,!0)}function g(u){for(;;){var o=u.text.indexOf(">",u.ch);if(o==-1){if(M(u))continue;return}if(!F(u,o+1)){u.ch=o+1;continue}var s=u.text.lastIndexOf("/",o),l=s>-1&&!/\S/.test(u.text.slice(s+1,o));return u.ch=o+1,l?"selfClose":"regular"}}function T(u){for(;;){var o=u.ch?u.text.lastIndexOf("<",u.ch-1):-1;if(o==-1){if(D(u))continue;return}if(!F(u,o+1)){u.ch=o;continue}_.lastIndex=o,u.ch=o;var s=_.exec(u.text);if(s&&s.index==o)return s}}function R(u){for(;;){_.lastIndex=u.ch;var o=_.exec(u.text);if(!o){if(M(u))continue;return}if(!F(u,o.index+1)){u.ch=o.index+1;continue}return u.ch=o.index+o[0].length,o}}function C(u){for(;;){var o=u.ch?u.text.lastIndexOf(">",u.ch-1):-1;if(o==-1){if(D(u))continue;return}if(!F(u,o+1)){u.ch=o;continue}var s=u.text.lastIndexOf("/",o),l=s>-1&&!/\S/.test(u.text.slice(s+1,o));return u.ch=o+1,l?"selfClose":"regular"}}function w(u,o){for(var s=[];;){var l=R(u),S,p=u.line,h=u.ch-(l?l[0].length:0);if(!l||!(S=g(u)))return;if(S=="selfClose")continue;if(l[1]){for(var A=s.length-1;A>=0;--A)if(s[A]==l[2]){s.length=A;break}if(A<0&&(!o||o==l[2]))return{tag:l[2],from:G(p,h),to:G(u.line,u.ch)}}else s.push(l[2])}}function v(u,o){for(var s=[];;){var l=C(u);if(!l)return;if(l=="selfClose"){T(u);continue}var S=u.line,p=u.ch,h=T(u);if(!h)return;if(h[1])s.push(h[2]);else{for(var A=s.length-1;A>=0;--A)if(s[A]==h[2]){s.length=A;break}if(A<0&&(!o||o==h[2]))return{tag:h[2],from:G(u.line,u.ch),to:G(S,p)}}}}te.registerHelper("fold","xml",function(u,o){for(var s=new B(u,o.line,0);;){var l=R(s);if(!l||s.line!=o.line)return;var S=g(s);if(!S)return;if(!l[1]&&S!="selfClose"){var p=G(s.line,s.ch),h=w(s,l[2]);return h&&L(h.from,p)>0?{from:p,to:h.from}:null}}}),te.findMatchingTag=function(u,o,s){var l=new B(u,o.line,o.ch,s);if(l.text.indexOf(">")==-1&&l.text.indexOf("<")==-1)return;var S=g(l),p=S&&G(l.line,l.ch),h=S&&T(l);if(!S||!h||L(l,o)>0)return;var A={from:G(l.line,l.ch),to:p,tag:h[2]};return S=="selfClose"?{open:A,close:null,at:"open"}:h[1]?{open:v(l,h[2]),close:A,at:"close"}:(l=new B(u,p.line,p.ch,s),{open:A,close:w(l,h[2]),at:"open"})},te.findEnclosingTag=function(u,o,s,l){for(var S=new B(u,o.line,o.ch,s);;){var p=v(S,l);if(!p)break;var h=new B(u,o.line,o.ch,s),A=w(h,p.tag);if(A)return{open:p,close:A}}},te.scanForClosingTag=function(u,o,s,l){var S=new B(u,o.line,o.ch,l?{from:0,to:l}:null);return w(S,s)}})},p5ED:function(ut,et,oe){"use strict";var te=oe("+L6B"),G=oe("2/Rp"),L=oe("5Dmo"),z=oe("3S7+"),I=oe("k1fw"),_=oe("tJVT"),B=oe("cDcd"),F=oe.n(B),M=oe("vHTk"),D=oe.n(M),g=oe("yEEn"),T=oe("ZW9T"),R=oe("1vsH");et.a=function(C){var w=C.name,v=C.data,u=C.theme,o=C.type,s=C.filename,l=C.monacoEditor,S=C.className,p=C.style,h=C.close,A=C.onClose,b=C.hasMask,c=Object(B.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),f=Object(_.a)(c,2),d=f[0],a=f[1],y=Object(B.useState)(""),m=Object(_.a)(y,2),x=m[0],P=m[1],U,j=1024*1024,W=10*j,k=Object(B.useRef)();o==="office"&&(U=Object(R.V)(v).filesize,U>W&&(o="other")),s&&(l.filename=s),Object(B.useEffect)(function(){var Y,q,ie=(Y=document.cookie)===null||Y===void 0||((q=Y.replace(/\s/g,""))===null||q===void 0)?void 0:q.split(";");ie==null||ie.map(function(Te){var ve=Te.split("=");ve[0]==="_educoder_session"&&P(ve[1])})},[]);var O=function(){if(v.startsWith("http")||v.startsWith("/")){K();return}Object(R.z)(s||"educoder",v,s)},K=function(){Object(R.x)(s||w,v)};return console.log("data:",v,"fileanme:",s," name:",w),F.a.createElement("div",{style:Object(I.a)({},p||{}),className:"".concat(b&&D.a.bgBlack," ").concat(o?D.a.wrp:"hide")},h&&F.a.createElement("div",{className:D.a.close,ref:k},F.a.createElement(z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return k.current}},F.a.createElement("span",{onClick:K},F.a.createElement("i",{className:"icon-quxiaozhiding"}))),F.a.createElement(z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return k.current}},F.a.createElement("span",{className:"",onClick:A},F.a.createElement("i",{className:"icon-guanbi1"})))),F.a.createElement("div",{className:"".concat(D.a[S]," ").concat(S," ").concat(D.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&F.a.createElement(T.b,l)),o==="audio"&&F.a.createElement("audio",{src:"".concat(v!=null&&v.startsWith("/")||(v==null?void 0:v.indexOf("https://"))>-1?v:"data:audio/mp3;base64,").concat(v),autoPlay:!0}),o==="video"&&F.a.createElement(F.a.Fragment,null,v!=null&&v.startsWith("/")?F.a.createElement("video",{controls:!0,src:"".concat(v),autoPlay:!0}):F.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(v),autoPlay:!0})),o==="html"&&F.a.createElement("iframe",{src:v+"&disposition=inline"}),o==="pdf"&&F.a.createElement("embed",{className:D.a.embed,src:v}),o==="image"&&F.a.createElement(F.a.Fragment,null,F.a.createElement("img",{src:"".concat(v!=null&&v.startsWith("/")||(v==null?void 0:v.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(v)})),o==="other"&&F.a.createElement("div",null,F.a.createElement(G.a,{type:"primary",size:"large",onClick:O},F.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&F.a.createElement(G.a,{type:"primary",size:"large",onClick:O},F.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(ut,et,oe){},rUJ1:function(ut,et){const oe=/[&<>"']/,te=/[&<>"']/g,G=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,z={"&":"&","<":"<",">":">",'"':""","'":"'"},I=b=>z[b];function _(b,c){if(c){if(oe.test(b))return b.replace(te,I)}else if(G.test(b))return b.replace(L,I);return b}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function F(b){return b.replace(B,(c,f)=>(f=f.toLowerCase(),f==="colon"?":":f.charAt(0)==="#"?f.charAt(1)==="x"?String.fromCharCode(parseInt(f.substring(2),16)):String.fromCharCode(+f.substring(1)):""))}const M=/(^|[^\[])\^/g;function D(b,c){b=b.source||b,c=c||"";const f={replace:(d,a)=>(a=a.source||a,a=a.replace(M,"$1"),b=b.replace(d,a),f),getRegex:()=>new RegExp(b,c)};return f}const g=/[^\w:]/g,T=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function R(b,c,f){if(b){let d;try{d=decodeURIComponent(F(f)).replace(g,"").toLowerCase()}catch(a){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}c&&!T.test(f)&&(f=o(c,f));try{f=encodeURI(f).replace(/%25/g,"%")}catch(d){return null}return f}const C={},w=/^[^:]+:\/*[^/]*$/,v=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(b,c){C[" "+b]||(w.test(b)?C[" "+b]=b+"/":C[" "+b]=p(b,"/",!0)),b=C[" "+b];const f=b.indexOf(":")===-1;return c.substring(0,2)==="//"?f?c:b.replace(v,"$1")+c:c.charAt(0)==="/"?f?c:b.replace(u,"$1")+c:b+c}const s={exec:function(){}};function l(b){let c=1,f,d;for(;c<arguments.length;c++){f=arguments[c];for(d in f)Object.prototype.hasOwnProperty.call(f,d)&&(b[d]=f[d])}return b}function S(b,c){const f=b.replace(/\|/g,(y,m,x)=>{let P=!1,U=m;for(;--U>=0&&x[U]==="\\";)P=!P;return P?"|":" |"}),d=f.split(/ \|/);let a=0;if(d.length>c)d.splice(c);else for(;d.length<c;)d.push("");for(;a<d.length;a++)d[a]=d[a].trim().replace(/\\\|/g,"|");return d}function p(b,c,f){const d=b.length;if(d===0)return"";let a=0;for(;a<d;){const y=b.charAt(d-a-1);if(y===c&&!f)a++;else if(y!==c&&f)a++;else break}return b.substr(0,d-a)}function h(b,c){if(b.indexOf(c[1])===-1)return-1;const f=b.length;let d=0,a=0;for(;a<f;a++)if(b[a]==="\\")a++;else if(b[a]===c[0])d++;else if(b[a]===c[1]&&(d--,d<0))return a;return-1}function A(b){b&&b.sanitize&&!b.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}ut.exports={escape:_,unescape:F,edit:D,cleanUrl:R,resolveUrl:o,noopTest:s,merge:l,splitCells:S,rtrim:p,findClosingBracket:h,checkSanitizeDeprecation:A}},ulZh:function(ut,et,oe){typeof window!="undefined"&&function(G,L){ut.exports=L()}(this,function(){return function(te){var G={};function L(z){if(G[z])return G[z].exports;var I=G[z]={i:z,l:!1,exports:{}};return te[z].call(I.exports,I,I.exports,L),I.l=!0,I.exports}return L.m=te,L.c=G,L.d=function(z,I,_){L.o(z,I)||Object.defineProperty(z,I,{enumerable:!0,get:_})},L.r=function(z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(z,"__esModule",{value:!0})},L.t=function(z,I){if(I&1&&(z=L(z)),I&8)return z;if(I&4&&typeof z=="object"&&z&&z.__esModule)return z;var _=Object.create(null);if(L.r(_),Object.defineProperty(_,"default",{enumerable:!0,value:z}),I&2&&typeof z!="string")for(var B in z)L.d(_,B,function(F){return z[F]}.bind(null,B));return _},L.n=function(z){var I=z&&z.__esModule?function(){return z.default}:function(){return z};return L.d(I,"a",I),I},L.o=function(z,I){return Object.prototype.hasOwnProperty.call(z,I)},L.p="/dist/",L(L.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(te,G,L){"use strict";var z=Object.prototype.hasOwnProperty,I="~";function _(){}Object.create&&(_.prototype=Object.create(null),new _().__proto__||(I=!1));function B(g,T,R){this.fn=g,this.context=T,this.once=R||!1}function F(g,T,R,C,w){if(typeof R!="function")throw new TypeError("The listener must be a function");var v=new B(R,C||g,w),u=I?I+T:T;return g._events[u]?g._events[u].fn?g._events[u]=[g._events[u],v]:g._events[u].push(v):(g._events[u]=v,g._eventsCount++),g}function M(g,T){--g._eventsCount===0?g._events=new _:delete g._events[T]}function D(){this._events=new _,this._eventsCount=0}D.prototype.eventNames=function(){var T=[],R,C;if(this._eventsCount===0)return T;for(C in R=this._events)z.call(R,C)&&T.push(I?C.slice(1):C);return Object.getOwnPropertySymbols?T.concat(Object.getOwnPropertySymbols(R)):T},D.prototype.listeners=function(T){var R=I?I+T:T,C=this._events[R];if(!C)return[];if(C.fn)return[C.fn];for(var w=0,v=C.length,u=new Array(v);w<v;w++)u[w]=C[w].fn;return u},D.prototype.listenerCount=function(T){var R=I?I+T:T,C=this._events[R];return C?C.fn?1:C.length:0},D.prototype.emit=function(T,R,C,w,v,u){var o=I?I+T:T;if(!this._events[o])return!1;var s=this._events[o],l=arguments.length,S,p;if(s.fn){s.once&&this.removeListener(T,s.fn,void 0,!0);switch(l){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,R),!0;case 3:return s.fn.call(s.context,R,C),!0;case 4:return s.fn.call(s.context,R,C,w),!0;case 5:return s.fn.call(s.context,R,C,w,v),!0;case 6:return s.fn.call(s.context,R,C,w,v,u),!0}for(p=1,S=new Array(l-1);p<l;p++)S[p-1]=arguments[p];s.fn.apply(s.context,S)}else{var h=s.length,A;for(p=0;p<h;p++){s[p].once&&this.removeListener(T,s[p].fn,void 0,!0);switch(l){case 1:s[p].fn.call(s[p].context);break;case 2:s[p].fn.call(s[p].context,R);break;case 3:s[p].fn.call(s[p].context,R,C);break;case 4:s[p].fn.call(s[p].context,R,C,w);break;default:if(!S)for(A=1,S=new Array(l-1);A<l;A++)S[A-1]=arguments[A];s[p].fn.apply(s[p].context,S)}}}return!0},D.prototype.on=function(T,R,C){return F(this,T,R,C,!1)},D.prototype.once=function(T,R,C){return F(this,T,R,C,!0)},D.prototype.removeListener=function(T,R,C,w){var v=I?I+T:T;if(!this._events[v])return this;if(!R)return M(this,v),this;var u=this._events[v];if(u.fn)u.fn===R&&(!w||u.once)&&(!C||u.context===C)&&M(this,v);else{for(var o=0,s=[],l=u.length;o<l;o++)(u[o].fn!==R||w&&!u[o].once||C&&u[o].context!==C)&&s.push(u[o]);s.length?this._events[v]=s.length===1?s[0]:s:M(this,v)}return this},D.prototype.removeAllListeners=function(T){var R;return T?(R=I?I+T:T,this._events[R]&&M(this,R)):(this._events=new _,this._eventsCount=0),this},D.prototype.off=D.prototype.removeListener,D.prototype.addListener=D.prototype.on,D.prefixed=I,D.EventEmitter=D,te.exports=D},"./node_modules/url-toolkit/src/url-toolkit.js":function(te,G,L){(function(z){var I=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,_=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,F=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,M={buildAbsoluteURL:function(D,g,T){if(T=T||{},D=D.trim(),g=g.trim(),!g){if(!T.alwaysNormalize)return D;var R=M.parseURL(D);if(!R)throw new Error("Error trying to parse base URL.");return R.path=M.normalizePath(R.path),M.buildURLFromParts(R)}var C=M.parseURL(g);if(!C)throw new Error("Error trying to parse relative URL.");if(C.scheme)return T.alwaysNormalize?(C.path=M.normalizePath(C.path),M.buildURLFromParts(C)):g;var w=M.parseURL(D);if(!w)throw new Error("Error trying to parse base URL.");if(!w.netLoc&&w.path&&w.path[0]!=="/"){var v=_.exec(w.path);w.netLoc=v[1],w.path=v[2]}w.netLoc&&!w.path&&(w.path="/");var u={scheme:w.scheme,netLoc:C.netLoc,path:null,params:C.params,query:C.query,fragment:C.fragment};if(!C.netLoc&&(u.netLoc=w.netLoc,C.path[0]!=="/"))if(!C.path)u.path=w.path,C.params||(u.params=w.params,C.query||(u.query=w.query));else{var o=w.path,s=o.substring(0,o.lastIndexOf("/")+1)+C.path;u.path=M.normalizePath(s)}return u.path===null&&(u.path=T.alwaysNormalize?M.normalizePath(C.path):C.path),M.buildURLFromParts(u)},parseURL:function(D){var g=I.exec(D);return g?{scheme:g[1]||"",netLoc:g[2]||"",path:g[3]||"",params:g[4]||"",query:g[5]||"",fragment:g[6]||""}:null},normalizePath:function(D){for(D=D.split("").reverse().join("").replace(B,"");D.length!==(D=D.replace(F,"")).length;);return D.split("").reverse().join("")},buildURLFromParts:function(D){return D.scheme+D.netLoc+D.path+D.params+D.query+D.fragment}};te.exports=M})(this)},"./node_modules/webworkify-webpack/index.js":function(te,G,L){function z(T){var R={};function C(v){if(R[v])return R[v].exports;var u=R[v]={i:v,l:!1,exports:{}};return T[v].call(u.exports,u,u.exports,C),u.l=!0,u.exports}C.m=T,C.c=R,C.i=function(v){return v},C.d=function(v,u,o){C.o(v,u)||Object.defineProperty(v,u,{configurable:!1,enumerable:!0,get:o})},C.r=function(v){Object.defineProperty(v,"__esModule",{value:!0})},C.n=function(v){var u=v&&v.__esModule?function(){return v.default}:function(){return v};return C.d(u,"a",u),u},C.o=function(v,u){return Object.prototype.hasOwnProperty.call(v,u)},C.p="/",C.oe=function(v){throw console.error(v),v};var w=C(C.s=ENTRY_MODULE);return w.default||w}var I="[\\.|\\-|\\+|\\w|/|@]+",_="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+I+").*?\\)";function B(T){return(T+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function F(T){return!isNaN(1*T)}function M(T,R,C){var w={};w[C]=[];var v=R.toString(),u=v.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return w;for(var o=u[1],s=new RegExp("(\\\\n|\\W)"+B(o)+_,"g"),l;l=s.exec(v);){if(l[3]==="dll-reference")continue;w[C].push(l[3])}for(s=new RegExp("\\("+B(o)+'\\("(dll-reference\\s('+I+'))"\\)\\)'+_,"g");l=s.exec(v);)T[l[2]]||(w[C].push(l[1]),T[l[2]]=L(l[1]).m),w[l[2]]=w[l[2]]||[],w[l[2]].push(l[4]);for(var S=Object.keys(w),p=0;p<S.length;p++)for(var h=0;h<w[S[p]].length;h++)F(w[S[p]][h])&&(w[S[p]][h]=1*w[S[p]][h]);return w}function D(T){var R=Object.keys(T);return R.reduce(function(C,w){return C||T[w].length>0},!1)}function g(T,R){for(var C={main:[R]},w={main:[]},v={main:{}};D(C);)for(var u=Object.keys(C),o=0;o<u.length;o++){var s=u[o],l=C[s],S=l.pop();if(v[s]=v[s]||{},v[s][S]||!T[s][S])continue;v[s][S]=!0,w[s]=w[s]||[],w[s].push(S);for(var p=M(T,T[s][S],s),h=Object.keys(p),A=0;A<h.length;A++)C[h[A]]=C[h[A]]||[],C[h[A]]=C[h[A]].concat(p[h[A]])}return w}te.exports=function(T,R){R=R||{};var C={main:L.m},w=R.all?{main:Object.keys(C.main)}:g(C,T),v="";Object.keys(w).filter(function(S){return S!=="main"}).forEach(function(S){for(var p=0;w[S][p];)p++;w[S].push(p),C[S][p]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",v=v+"var "+S+" = ("+z.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+w[S].map(function(h){return""+JSON.stringify(h)+": "+C[S][h].toString()}).join(",")+`});
|
|
`}),v=v+"new (("+z.toString().replace("ENTRY_MODULE",JSON.stringify(T))+")({"+w.main.map(function(S){return""+JSON.stringify(S)+": "+C.main[S].toString()}).join(",")+"}))(self);";var u=new window.Blob([v],{type:"text/javascript"});if(R.bare)return u;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,s=o.createObjectURL(u),l=new window.Worker(s);return l.objectURL=s,l}},"./src/config.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"hlsDefaultConfig",function(){return A}),L.d(G,"mergeConfig",function(){return c}),L.d(G,"enableStreamingMode",function(){return f});var z=L("./src/controller/abr-controller.ts"),I=L("./src/controller/audio-stream-controller.ts"),_=L("./src/controller/audio-track-controller.ts"),B=L("./src/controller/subtitle-stream-controller.ts"),F=L("./src/controller/subtitle-track-controller.ts"),M=L("./src/controller/buffer-controller.ts"),D=L("./src/controller/timeline-controller.ts"),g=L("./src/controller/cap-level-controller.ts"),T=L("./src/controller/fps-controller.ts"),R=L("./src/controller/eme-controller.ts"),C=L("./src/controller/cmcd-controller.ts"),w=L("./src/utils/xhr-loader.ts"),v=L("./src/utils/fetch-loader.ts"),u=L("./src/utils/cues.ts"),o=L("./src/utils/mediakeys-helper.ts"),s=L("./src/utils/logger.ts");function l(){return l=Object.assign||function(d){for(var a=1;a<arguments.length;a++){var y=arguments[a];for(var m in y)Object.prototype.hasOwnProperty.call(y,m)&&(d[m]=y[m])}return d},l.apply(this,arguments)}function S(d,a){var y=Object.keys(d);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(d);a&&(m=m.filter(function(x){return Object.getOwnPropertyDescriptor(d,x).enumerable})),y.push.apply(y,m)}return y}function p(d){for(var a=1;a<arguments.length;a++){var y=arguments[a]!=null?arguments[a]:{};a%2?S(Object(y),!0).forEach(function(m){h(d,m,y[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(y)):S(Object(y)).forEach(function(m){Object.defineProperty(d,m,Object.getOwnPropertyDescriptor(y,m))})}return d}function h(d,a,y){return a in d?Object.defineProperty(d,a,{value:y,enumerable:!0,configurable:!0,writable:!0}):d[a]=y,d}var A=p(p({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:w.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:z.default,bufferController:M.default,capLevelController:g.default,fpsController:T.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},b()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:F.default,timelineController:D.TimelineController,audioStreamController:I.default,audioTrackController:_.default,emeController:R.default,cmcdController:C.default});function b(){return{cueHandler:u.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function c(d,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return l({},d,a)}function f(d){var a=d.loader;if(a!==v.default&&a!==w.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var y=Object(v.fetchSupported)();y&&(d.loader=v.default,d.progressive=!0,d.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(te,G,L){"use strict";L.r(G);var z=L("./src/polyfills/number.ts"),I=L("./src/utils/ewma-bandwidth-estimator.ts"),_=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),F=L("./src/errors.ts"),M=L("./src/types/loader.ts"),D=L("./src/utils/logger.ts");function g(C,w){for(var v=0;v<w.length;v++){var u=w[v];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(C,u.key,u)}}function T(C,w,v){return w&&g(C.prototype,w),v&&g(C,v),C}var R=function(){function C(v){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=v;var u=v.config;this.bwEstimator=new I.default(u.abrEwmaSlowVoD,u.abrEwmaFastVoD,u.abrEwmaDefaultEstimate),this.registerListeners()}var w=C.prototype;return w.registerListeners=function(){var u=this.hls;u.on(_.Events.FRAG_LOADING,this.onFragLoading,this),u.on(_.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(_.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.on(_.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(_.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var u=this.hls;u.off(_.Events.FRAG_LOADING,this.onFragLoading,this),u.off(_.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(_.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.off(_.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(_.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(u,o){var s=o.frag;if(s.type===M.PlaylistLevelType.MAIN&&!this.timer){var l;this.fragCurrent=s,this.partCurrent=(l=o.part)!=null?l:null,this.timer=self.setInterval(this.onCheck,100)}},w.onLevelLoaded=function(u,o){var s=this.hls.config;o.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},w._abandonRulesCheck=function(){var u=this.fragCurrent,o=this.partCurrent,s=this.hls,l=s.autoLevelEnabled,S=s.config,p=s.media;if(!u||!p)return;var h=o?o.stats:u.stats,A=o?o.duration:u.duration;if(h.aborted){D.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!l||p.paused||!p.playbackRate||!p.readyState)return;var b=performance.now()-h.loading.start,c=Math.abs(p.playbackRate);if(b<=500*A/c)return;var f=s.levels,d=s.minAutoLevel,a=f[u.level],y=h.total||Math.max(h.loaded,Math.round(A*a.maxBitrate/8)),m=Math.max(1,h.bwEstimate?h.bwEstimate/8:h.loaded*1e3/b),x=(y-h.loaded)/m,P=p.currentTime,U=(B.BufferHelper.bufferInfo(p,P,S.maxBufferHole).end-P)/c;if(U>=2*A/c||x<=U)return;var j=Number.POSITIVE_INFINITY,W;for(W=u.level-1;W>d;W--){var k=f[W].maxBitrate;if(j=A*k/(8*.8*m),j<U)break}if(j>=x)return;var O=this.bwEstimator.getEstimate();D.logger.warn("Fragment "+u.sn+(o?" part "+o.index:"")+" of level "+u.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+`
|
|
Current BW estimate: `+(Object(z.isFiniteNumber)(O)?(O/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+x.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+j.toFixed(3)+` s
|
|
Time to underbuffer: `+U.toFixed(3)+" s"),s.nextLoadLevel=W,this.bwEstimator.sample(b,h.loaded),this.clearTimer(),u.loader&&(this.fragCurrent=this.partCurrent=null,u.loader.abort()),s.trigger(_.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:u,part:o,stats:h})},w.onFragLoaded=function(u,o){var s=o.frag,l=o.part;if(s.type===M.PlaylistLevelType.MAIN&&Object(z.isFiniteNumber)(s.sn)){var S=l?l.stats:s.stats,p=l?l.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var h=this.hls.levels[s.level],A=(h.loaded?h.loaded.bytes:0)+S.loaded,b=(h.loaded?h.loaded.duration:0)+p;h.loaded={bytes:A,duration:b},h.realBitrate=Math.round(8*A/b)}if(s.bitrateTest){var c={stats:S,frag:s,part:l,id:s.type};this.onFragBuffered(_.Events.FRAG_BUFFERED,c),s.bitrateTest=!1}}},w.onFragBuffered=function(u,o){var s=o.frag,l=o.part,S=l?l.stats:s.stats;if(S.aborted)return;if(s.type!==M.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var p=S.parsing.end-S.loading.start;this.bwEstimator.sample(p,S.loaded),S.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=p/1e3:this.bitrateTestDelay=0},w.onError=function(u,o){switch(o.details){case F.ErrorDetails.FRAG_LOAD_ERROR:case F.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},w.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},w.getNextABRAutoLevel=function(){var u=this.fragCurrent,o=this.partCurrent,s=this.hls,l=s.maxAutoLevel,S=s.config,p=s.minAutoLevel,h=s.media,A=o?o.duration:u?u.duration:0,b=h?h.currentTime:0,c=h&&h.playbackRate!==0?Math.abs(h.playbackRate):1,f=this.bwEstimator?this.bwEstimator.getEstimate():S.abrEwmaDefaultEstimate,d=(B.BufferHelper.bufferInfo(h,b,S.maxBufferHole).end-b)/c,a=this.findBestLevel(f,p,l,d,S.abrBandWidthFactor,S.abrBandWidthUpFactor);if(a>=0)return a;D.logger.trace((d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var y=A?Math.min(A,S.maxStarvationDelay):S.maxStarvationDelay,m=S.abrBandWidthFactor,x=S.abrBandWidthUpFactor;if(!d){var P=this.bitrateTestDelay;if(P){var U=A?Math.min(A,S.maxLoadingDelay):S.maxLoadingDelay;y=U-P,D.logger.trace("bitrate test took "+Math.round(1e3*P)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*y)+" ms"),m=x=1}}return a=this.findBestLevel(f,p,l,d+y,m,x),Math.max(a,0)},w.findBestLevel=function(u,o,s,l,S,p){for(var h,A=this.fragCurrent,b=this.partCurrent,c=this.lastLoadedFragLevel,f=this.hls.levels,d=f[c],a=!!(d!=null&&(h=d.details)!==null&&h!==void 0&&h.live),y=d==null?void 0:d.codecSet,m=b?b.duration:A?A.duration:0,x=s;x>=o;x--){var P=f[x];if(!P||y&&P.codecSet!==y)continue;var U=P.details,j=(b?U==null?void 0:U.partTarget:U==null?void 0:U.averagetargetduration)||m,W=void 0;x<=c?W=S*u:W=p*u;var k=f[x].maxBitrate,O=k*j/W;if(D.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+x+"/"+Math.round(W)+"/"+k+"/"+j+"/"+l+"/"+O),W>k&&(!O||a&&!this.bitrateTestDelay||O<l))return x}return-1},T(C,[{key:"nextAutoLevel",get:function(){var u=this._nextAutoLevel,o=this.bwEstimator;if(u!==-1&&(!o||!o.canEstimate()))return u;var s=this.getNextABRAutoLevel();return u!==-1&&(s=Math.min(u,s)),s},set:function(u){this._nextAutoLevel=u}}]),C}();G.default=R},"./src/controller/audio-stream-controller.ts":function(te,G,L){"use strict";L.r(G);var z=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),_=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),F=L("./src/controller/fragment-tracker.ts"),M=L("./src/types/level.ts"),D=L("./src/types/loader.ts"),g=L("./src/loader/fragment.ts"),T=L("./src/demux/chunk-cache.ts"),R=L("./src/demux/transmuxer-interface.ts"),C=L("./src/types/transmuxer.ts"),w=L("./src/controller/fragment-finders.ts"),v=L("./src/utils/discontinuities.ts"),u=L("./src/errors.ts"),o=L("./src/utils/logger.ts");function s(){return s=Object.assign||function(A){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(A[f]=c[f])}return A},s.apply(this,arguments)}function l(A,b){A.prototype=Object.create(b.prototype),A.prototype.constructor=A,S(A,b)}function S(A,b){return S=Object.setPrototypeOf||function(f,d){return f.__proto__=d,f},S(A,b)}var p=100,h=function(A){l(b,A);function b(f,d){var a;return a=A.call(this,f,d,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var c=b.prototype;return c.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},c._registerListeners=function(){var d=this.hls;d.on(_.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(_.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(_.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(_.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(_.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.on(_.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(_.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(_.Events.ERROR,this.onError,this),d.on(_.Events.BUFFER_RESET,this.onBufferReset,this),d.on(_.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(_.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(_.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(_.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c._unregisterListeners=function(){var d=this.hls;d.off(_.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(_.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(_.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(_.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(_.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.off(_.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(_.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(_.Events.ERROR,this.onError,this),d.off(_.Events.BUFFER_RESET,this.onBufferReset,this),d.off(_.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(_.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(_.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(_.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c.onInitPtsFound=function(d,a){var y=a.frag,m=a.id,x=a.initPTS;if(m==="main"){var P=y.cc;this.initPTS[y.cc]=x,this.log("InitPTS for cc: "+P+" found from main: "+x),this.videoTrackCC=P,this.state===I.State.WAITING_INIT_PTS&&this.tick()}},c.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=I.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(p),this.fragLoadError=0,a>0&&d===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=I.State.IDLE):(this.loadedmetadata=!1,this.state=I.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()},c.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_TRACK:{var d,a=this.levels,y=this.trackId,m=a==null||((d=a[y])===null||d===void 0)?void 0:d.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=I.State.WAITING_INIT_PTS}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var x,P=performance.now(),U=this.retryDate;(!U||P>=U||(x=this.media)!==null&&x!==void 0&&x.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=I.State.IDLE);break}case I.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var W=j.frag,k=j.part,O=j.cache,K=j.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.FRAG_LOADING;var Y=O.flush(),q={frag:W,part:k,payload:Y,networkDetails:null};this._handleFragmentLoadProgress(q),K&&A.prototype._handleFragmentLoadComplete.call(this,q)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+W.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ie=this.getLoadPosition(),Te=B.BufferHelper.bufferInfo(this.mediaBuffer,ie,this.config.maxBufferHole),ve=Object(w.fragmentWithinToleranceTest)(Te.end,this.config.maxFragLookUpTolerance,W);ve<0&&(o.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+Te.end+" is needed"),this.clearWaitingFragment())}}else this.state=I.State.IDLE}}this.onTickEnd()},c.clearWaitingFragment=function(){var d=this.waitingData;d&&(this.fragmentTracker.removeFragment(d.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.IDLE)},c.onTickEnd=function(){var d=this.media;if(!d||!d.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:d,y=a.buffered;!this.loadedmetadata&&y.length&&(this.loadedmetadata=!0),this.lastCurrentTime=d.currentTime},c.doTickIdle=function(){var d,a,y=this.hls,m=this.levels,x=this.media,P=this.trackId,U=y.config;if(!m||!m[P])return;if(!x&&(this.startFragRequested||!U.startFragPrefetch))return;var j=m[P],W=j.details;if(!W||W.live&&this.levelLastLoaded!==P||this.waitForCdnTuneIn(W)){this.state=I.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,g.ElementaryStreamTypes.AUDIO,D.PlaylistLevelType.AUDIO));var k=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,D.PlaylistLevelType.AUDIO);if(k===null)return;var O=k.len,K=this.getMaxBufferLength(),Y=this.audioSwitch;if(O>=K&&!Y)return;if(!Y&&this._streamEnded(k,W)){y.trigger(_.Events.BUFFER_EOS,{type:"audio"}),this.state=I.State.ENDED;return}var q=W.fragments,ie=q[0].start,Te=k.end;if(Y){var ve=this.getLoadPosition();Te=ve,W.PTSKnown&&ve<ie&&((k.end>ie||k.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),x.currentTime=ie+.05))}var ge=this.getNextFragment(Te,W);if(!ge){this.bufferFlushed=!0;return}((d=ge.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((a=ge.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(ge,W):this.loadFragment(ge,W,Te)},c.getMaxBufferLength=function(){var d=A.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,D.PlaylistLevelType.MAIN);return a===null?d:Math.max(d,a.len)},c.onMediaDetaching=function(){this.videoBuffer=null,A.prototype.onMediaDetaching.call(this)},c.onAudioTracksUpdated=function(d,a){var y=a.audioTracks;this.resetTransmuxer(),this.levels=y.map(function(m){return new M.Level(m)})},c.onAudioTrackSwitching=function(d,a){var y=!!a.url;this.trackId=a.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),y?this.setInterval(p):this.resetTransmuxer(),y?(this.audioSwitch=!0,this.state=I.State.IDLE):this.state=I.State.STOPPED,this.tick()},c.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},c.onLevelLoaded=function(d,a){this.mainDetails=a.details},c.onAudioTrackLoaded=function(d,a){var y,m=this.levels,x=a.details,P=a.id;if(!m){this.warn("Audio tracks were reset while loading level "+P);return}this.log("Track "+P+" loaded ["+x.startSN+","+x.endSN+"],duration:"+x.totalduration);var U=m[P],j=0;if(x.live||(y=U.details)!==null&&y!==void 0&&y.live){var W=this.mainDetails;if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed||!W)return;!U.details&&x.hasProgramDateTime&&W.hasProgramDateTime?(Object(v.alignMediaPlaylistByPDT)(x,W),j=x.fragments[0].start):j=this.alignPlaylists(x,U.details)}U.details=x,this.levelLastLoaded=P,!this.startFragRequested&&(this.mainDetails||!x.live)&&this.setStartPosition(U.details,j),this.state===I.State.WAITING_TRACK&&!this.waitForCdnTuneIn(x)&&(this.state=I.State.IDLE),this.tick()},c._handleFragmentLoadProgress=function(d){var a,y=d.frag,m=d.part,x=d.payload,P=this.config,U=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+y.sn+" of level "+y.level+" will not be buffered");return}var W=j[U];console.assert(W,"Audio track is defined on fragment load progress");var k=W.details;console.assert(k,"Audio track details are defined on fragment load progress");var O=P.defaultAudioCodec||W.audioCodec||"mp4a.40.2",K=this.transmuxer;K||(K=this.transmuxer=new R.default(this.hls,D.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Y=this.initPTS[y.cc],q=(a=y.initSegment)===null||a===void 0?void 0:a.data;if(Y!==void 0){var ie=!1,Te=m?m.index:-1,ve=Te!==-1,ge=new C.ChunkMetadata(y.level,y.sn,y.stats.chunkCount,x.byteLength,Te,ve);K.push(x,q,O,"",y,m,k.totalduration,ie,ge,Y)}else{o.logger.log("Unknown video PTS for cc "+y.cc+", waiting for video PTS before demuxing audio frag "+y.sn+" of ["+k.startSN+" ,"+k.endSN+"],track "+U);var he=this.waitingData=this.waitingData||{frag:y,part:m,cache:new T.default,complete:!1},ce=he.cache;ce.push(new Uint8Array(x)),this.waitingVideoCC=this.videoTrackCC,this.state=I.State.WAITING_INIT_PTS}},c._handleFragmentLoadComplete=function(d){if(this.waitingData){this.waitingData.complete=!0;return}A.prototype._handleFragmentLoadComplete.call(this,d)},c.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},c.onBufferCreated=function(d,a){var y=a.tracks.audio;y&&(this.mediaBuffer=y.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},c.onFragBuffered=function(d,a){var y=a.frag,m=a.part;if(y.type!==D.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(y)){this.warn("Fragment "+y.sn+(m?" p: "+m.index:"")+" of level "+y.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}y.sn!=="initSegment"&&(this.fragPrevious=y,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(_.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(y,m)},c.onError=function(d,a){switch(a.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.AUDIO,a);break;case u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case u.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==I.State.ERROR&&this.state!==I.State.STOPPED&&(this.state=a.fatal?I.State.ERROR:I.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case u.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var y=!0,m=this.getFwdBufferInfo(this.mediaBuffer,D.PlaylistLevelType.AUDIO);m&&m.len>.5&&(y=!this.reduceMaxBufferLength(m.len)),y&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},c.onBufferFlushed=function(d,a){var y=a.type;y===g.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},c._handleTransmuxComplete=function(d){var a,y="audio",m=this.hls,x=d.remuxResult,P=d.chunkMeta,U=this.getCurrentContext(P);if(!U){this.warn("The loading context changed while buffering fragment "+P.sn+" of level "+P.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(P.level);return}var j=U.frag,W=U.part,k=x.audio,O=x.text,K=x.id3,Y=x.initSegment;if(this.fragContextChanged(j))return;if(this.state=I.State.PARSING,this.audioSwitch&&k&&this.completeAudioSwitch(),Y!=null&&Y.tracks&&(this._bufferInitSegment(Y.tracks,j,P),m.trigger(_.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:y,tracks:Y.tracks})),k){var q=k.startPTS,ie=k.endPTS,Te=k.startDTS,ve=k.endDTS;W&&(W.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:q,endPTS:ie,startDTS:Te,endDTS:ve}),j.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,q,ie,Te,ve),this.bufferFragmentData(k,j,W,P)}if(K!=null&&(a=K.samples)!==null&&a!==void 0&&a.length){var ge=s({frag:j,id:y},K);m.trigger(_.Events.FRAG_PARSING_METADATA,ge)}if(O){var he=s({frag:j,id:y},O);m.trigger(_.Events.FRAG_PARSING_USERDATA,he)}},c._bufferInitSegment=function(d,a,y){if(this.state!==I.State.PARSING)return;d.video&&delete d.video;var m=d.audio;if(!m)return;m.levelCodec=m.codec,m.id="audio",this.log("Init audio buffer, container:"+m.container+", codecs[parsed]=["+m.codec+"]"),this.hls.trigger(_.Events.BUFFER_CODECS,d);var x=m.initSegment;if(x!=null&&x.byteLength){var P={type:"audio",frag:a,part:null,chunkMeta:y,parent:a.type,data:x};this.hls.trigger(_.Events.BUFFER_APPENDING,P)}this.tick()},c.loadFragment=function(d,a,y){var m=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||m===F.FragmentState.NOT_LOADED||m===F.FragmentState.PARTIAL)&&(d.sn==="initSegment"?this._loadInitSegment(d):a.live&&!Object(z.isFiniteNumber)(this.initPTS[d.cc])?(this.log("Waiting for video PTS in continuity counter "+d.cc+" of live stream before loading audio fragment "+d.sn+" of level "+this.trackId),this.state=I.State.WAITING_INIT_PTS):(this.startFragRequested=!0,A.prototype.loadFragment.call(this,d,a,y)))},c.completeAudioSwitch=function(){var d=this.hls,a=this.media,y=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,d.trigger(_.Events.AUDIO_TRACK_SWITCHED,{id:y})},b}(I.default);G.default=h},"./src/controller/audio-track-controller.ts":function(te,G,L){"use strict";L.r(G);var z=L("./src/events.ts"),I=L("./src/errors.ts"),_=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function F(R,C){for(var w=0;w<C.length;w++){var v=C[w];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(R,v.key,v)}}function M(R,C,w){return C&&F(R.prototype,C),w&&F(R,w),R}function D(R,C){R.prototype=Object.create(C.prototype),R.prototype.constructor=R,g(R,C)}function g(R,C){return g=Object.setPrototypeOf||function(v,u){return v.__proto__=u,v},g(R,C)}var T=function(R){D(C,R);function C(v){var u;return u=R.call(this,v,"[audio-track-controller]")||this,u.tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.trackName="",u.selectDefaultTrack=!0,u.registerListeners(),u}var w=C.prototype;return w.registerListeners=function(){var u=this.hls;u.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),u.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.on(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(z.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var u=this.hls;u.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),u.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.off(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(z.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(u,o){this.tracks=o.audioTracks||[]},w.onAudioTrackLoaded=function(u,o){var s=o.id,l=o.details,S=this.tracksInGroup[s];if(!S){this.warn("Invalid audio track id "+s);return}var p=S.details;S.details=o.details,this.log("audioTrack "+s+" loaded ["+l.startSN+"-"+l.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,o,p))},w.onLevelLoading=function(u,o){this.switchLevel(o.level)},w.onLevelSwitching=function(u,o){this.switchLevel(o.level)},w.switchLevel=function(u){var o=this.hls.levels[u];if(!(o!=null&&o.audioGroupIds))return;var s=o.audioGroupIds[o.urlId];if(this.groupId!==s){this.groupId=s;var l=this.tracks.filter(function(p){return!s||p.groupId===s});this.selectDefaultTrack&&!l.some(function(p){return p.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=l;var S={audioTracks:l};this.log("Updating audio tracks, "+l.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(z.Events.AUDIO_TRACKS_UPDATED,S),this.selectInitialTrack()}},w.onError=function(u,o){if(R.prototype.onError.call(this,u,o),o.fatal||!o.context)return;o.context.type===B.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},w.setAudioTrack=function(u){var o=this.tracksInGroup;if(u<0||u>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=o[this.trackId];this.log("Now switching to audio-track index "+u);var l=o[u],S=l.id,p=l.groupId,h=p===void 0?"":p,A=l.name,b=l.type,c=l.url;if(this.trackId=u,this.trackName=A,this.selectDefaultTrack=!1,this.hls.trigger(z.Events.AUDIO_TRACK_SWITCHING,{id:S,groupId:h,name:A,type:b,url:c}),l.details&&!l.details.live)return;var f=this.switchParams(l.url,s==null?void 0:s.details);this.loadPlaylist(f)},w.selectInitialTrack=function(){var u=this.tracksInGroup;console.assert(u.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,s=this.findTrackId(o)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},w.findTrackId=function(u){for(var o=this.tracksInGroup,s=0;s<o.length;s++){var l=o[s];if((!this.selectDefaultTrack||l.default)&&(!u||u===l.name))return l.id}return-1},w.loadPlaylist=function(u){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var s=o.id,l=o.groupId,S=o.url;if(u)try{S=u.addDirectives(S)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(z.Events.AUDIO_TRACK_LOADING,{url:S,id:s,groupId:l,deliveryDirectives:u||null})}},M(C,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(u){this.selectDefaultTrack=!1,this.setAudioTrack(u)}}]),C}(_.default);G.default=T},"./src/controller/base-playlist-controller.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return M});var z=L("./src/polyfills/number.ts"),I=L("./src/types/level.ts"),_=L("./src/controller/level-helper.ts"),B=L("./src/utils/logger.ts"),F=L("./src/errors.ts"),M=function(){function D(T,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=T}var g=D.prototype;return g.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},g.onError=function(R,C){C.fatal&&C.type===F.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},g.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},g.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},g.stopLoad=function(){this.canLoad=!1,this.clearTimer()},g.switchParams=function(R,C){var w=C==null?void 0:C.renditionReports;if(w)for(var v=0;v<w.length;v++){var u=w[v],o=""+u.URI;if(o===R.substr(-o.length)){var s=parseInt(u["LAST-MSN"]),l=parseInt(u["LAST-PART"]);if(C&&this.hls.config.lowLatencyMode){var S=Math.min(C.age-C.partTarget,C.targetduration);l!==void 0&&S>C.partTarget&&(l+=1)}if(Object(z.isFiniteNumber)(s))return new I.HlsUrlParameters(s,Object(z.isFiniteNumber)(l)?l:void 0,I.HlsSkip.No)}}},g.loadPlaylist=function(R){},g.shouldLoadTrack=function(R){return this.canLoad&&R&&!!R.url&&(!R.details||R.details.live)},g.playlistLoaded=function(R,C,w){var v=this,u=C.details,o=C.stats,s=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(u.advancedDateTime=Date.now()-s,u.live||w!=null&&w.live){if(u.reloaded(w),w&&this.log("live playlist "+R+" "+(u.advanced?"REFRESHED "+u.lastPartSn+"-"+u.lastPartIndex:"MISSED")),w&&u.fragments.length>0&&Object(_.mergeDetails)(w,u),!this.canLoad||!u.live)return;var l,S=void 0,p=void 0;if(u.canBlockReload&&u.endSN&&u.advanced){var h=this.hls.config.lowLatencyMode,A=u.lastPartSn,b=u.endSN,c=u.lastPartIndex,f=c!==-1,d=A===b,a=h?0:c;f?(S=d?b+1:A,p=d?a:c+1):S=b+1;var y=u.age,m=y+u.ageHeader,x=Math.min(m-u.partTarget,u.targetduration*1.5);if(x>0){if(w&&x>w.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+w.tuneInGoal+" to: "+x+" with playlist age: "+u.age),x=0;else{var P=Math.floor(x/u.targetduration);if(S+=P,p!==void 0){var U=Math.round(x%u.targetduration/u.partTarget);p+=U}this.log("CDN Tune-in age: "+u.ageHeader+"s last advanced "+y.toFixed(2)+"s goal: "+x+" skip sn "+P+" to part "+p)}u.tuneInGoal=x}if(l=this.getDeliveryDirectives(u,C.deliveryDirectives,S,p),h||!d){this.loadPlaylist(l);return}}else l=this.getDeliveryDirectives(u,C.deliveryDirectives,S,p);var j=Object(_.computeReloadInterval)(u,o);S!==void 0&&u.canBlockReload&&(j-=u.partTarget||1),this.log("reload live playlist "+R+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return v.loadPlaylist(l)},j)}else this.clearTimer()},g.getDeliveryDirectives=function(R,C,w,v){var u=Object(I.getSkipValue)(R,w);return C!=null&&C.skip&&R.deltaUpdateFailed&&(w=C.msn,v=C.part,u=I.HlsSkip.No),new I.HlsUrlParameters(w,v,u)},g.retryLoadingOrFail=function(R){var C=this,w=this.hls.config,v=this.retryCount<w.levelLoadingMaxRetry;if(v){var u;if(this.retryCount++,R.details.indexOf("LoadTimeOut")>-1&&(u=R.context)!==null&&u!==void 0&&u.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+R.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*w.levelLoadingRetryDelay,w.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return C.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+R.details+'"')}}else this.warn('cannot recover from error "'+R.details+'"'),this.clearTimer(),R.fatal=!0;return v},D}()},"./src/controller/base-stream-controller.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"State",function(){return b}),L.d(G,"default",function(){return c});var z=L("./src/polyfills/number.ts"),I=L("./src/task-loop.ts"),_=L("./src/controller/fragment-tracker.ts"),B=L("./src/utils/buffer-helper.ts"),F=L("./src/utils/logger.ts"),M=L("./src/events.ts"),D=L("./src/errors.ts"),g=L("./src/types/transmuxer.ts"),T=L("./src/utils/mp4-tools.ts"),R=L("./src/utils/discontinuities.ts"),C=L("./src/controller/fragment-finders.ts"),w=L("./src/controller/level-helper.ts"),v=L("./src/loader/fragment-loader.ts"),u=L("./src/crypt/decrypter.ts"),o=L("./src/utils/time-ranges.ts"),s=L("./src/types/loader.ts");function l(f,d){for(var a=0;a<d.length;a++){var y=d[a];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(f,y.key,y)}}function S(f,d,a){return d&&l(f.prototype,d),a&&l(f,a),f}function p(f){if(f===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f}function h(f,d){f.prototype=Object.create(d.prototype),f.prototype.constructor=f,A(f,d)}function A(f,d){return A=Object.setPrototypeOf||function(y,m){return y.__proto__=m,y},A(f,d)}var b={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},c=function(f){h(d,f);function d(y,m,x){var P;return P=f.call(this)||this,P.hls=void 0,P.fragPrevious=null,P.fragCurrent=null,P.fragmentTracker=void 0,P.transmuxer=null,P._state=b.STOPPED,P.media=void 0,P.mediaBuffer=void 0,P.config=void 0,P.bitrateTest=!1,P.lastCurrentTime=0,P.nextLoadPosition=0,P.startPosition=0,P.loadedmetadata=!1,P.fragLoadError=0,P.retryDate=0,P.levels=null,P.fragmentLoader=void 0,P.levelLastLoaded=null,P.startFragRequested=!1,P.decrypter=void 0,P.initPTS=[],P.onvseeking=null,P.onvended=null,P.logPrefix="",P.log=void 0,P.warn=void 0,P.logPrefix=x,P.log=F.logger.log.bind(F.logger,x+":"),P.warn=F.logger.warn.bind(F.logger,x+":"),P.hls=y,P.fragmentLoader=new v.default(y.config),P.fragmentTracker=m,P.config=y.config,P.decrypter=new u.default(y,y.config),y.on(M.Events.KEY_LOADED,P.onKeyLoaded,p(P)),P}var a=d.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(m){},a.stopLoad=function(){this.fragmentLoader.abort();var m=this.fragCurrent;m&&this.fragmentTracker.removeFragment(m),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=b.STOPPED},a._streamEnded=function(m,x){var P=this.fragCurrent,U=this.fragmentTracker;if(!x.live&&P&&P.sn===x.endSN&&!m.nextStart){var j=U.getState(P);return j===_.FragmentState.PARTIAL||j===_.FragmentState.OK}return!1},a.onMediaAttached=function(m,x){var P=this.media=this.mediaBuffer=x.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),P.addEventListener("seeking",this.onvseeking),P.addEventListener("ended",this.onvended);var U=this.config;this.levels&&U.autoStartLoad&&this.state===b.STOPPED&&this.startLoad(U.startPosition)},a.onMediaDetaching=function(){var m=this.media;m!=null&&m.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),m&&(m.removeEventListener("seeking",this.onvseeking),m.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var m=this.config,x=this.fragCurrent,P=this.media,U=this.mediaBuffer,j=this.state,W=P?P.currentTime:0,k=B.BufferHelper.bufferInfo(U||P,W,m.maxBufferHole);if(this.log("media seeking to "+(Object(z.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+j),j===b.ENDED)this.resetLoadingState();else if(x&&!k.len){var O=m.maxFragLookUpTolerance,K=x.start-O,Y=x.start+x.duration+O,q=W>Y;(W<K||q)&&(q&&x.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),x.loader.abort()),this.resetLoadingState())}P&&(this.lastCurrentTime=W),!this.loadedmetadata&&!k.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(m,x){if(this.state!==b.KEY_LOADING||x.frag!==this.fragCurrent||!this.levels)return;this.state=b.IDLE;var P=this.levels[x.frag.level].details;P&&this.loadFragment(x.frag,P,x.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),f.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=b.STOPPED,this.hls.off(M.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,f.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(m,x){this.log("Loading key for "+m.sn+" of ["+x.startSN+"-"+x.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=b.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(M.Events.KEY_LOADING,{frag:m})},a.loadFragment=function(m,x,P){this._loadFragForPlayback(m,x,P)},a._loadFragForPlayback=function(m,x,P){var U=this,j=function(k){if(U.fragContextChanged(m)){U.warn("Fragment "+m.sn+(k.part?" p: "+k.part.index:"")+" of level "+m.level+" was dropped during download."),U.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,U._handleFragmentLoadProgress(k)};this._doFragLoad(m,x,P,j).then(function(W){if(!W)return;U.fragLoadError=0;var k=U.state;if(U.fragContextChanged(m)){(k===b.FRAG_LOADING||k===b.BACKTRACKING||!U.fragCurrent&&k===b.PARSING)&&(U.fragmentTracker.removeFragment(m),U.state=b.IDLE);return}if("payload"in W&&(U.log("Loaded fragment "+m.sn+" of level "+m.level),U.hls.trigger(M.Events.FRAG_LOADED,W),U.state===b.BACKTRACKING)){U.fragmentTracker.backtrack(m,W),U.resetFragmentLoading(m);return}U._handleFragmentLoadComplete(W)}).catch(function(W){U.warn(W),U.resetFragmentLoading(m)})},a.flushMainBuffer=function(m,x,P){if(P===void 0&&(P=null),!(m-x))return;var U={startOffset:m,endOffset:x,type:P};this.fragLoadError=0,this.hls.trigger(M.Events.BUFFER_FLUSHING,U)},a._loadInitSegment=function(m){var x=this;this._doFragLoad(m).then(function(P){if(!P||x.fragContextChanged(m)||!x.levels)throw new Error("init load aborted");return P}).then(function(P){var U=x.hls,j=P.payload,W=m.decryptdata;if(j&&j.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var k=self.performance.now();return x.decrypter.webCryptoDecrypt(new Uint8Array(j),W.key.buffer,W.iv.buffer).then(function(O){var K=self.performance.now();return U.trigger(M.Events.FRAG_DECRYPTED,{frag:m,payload:O,stats:{tstart:k,tdecrypt:K}}),P.payload=O,P})}return P}).then(function(P){var U=x.fragCurrent,j=x.hls,W=x.levels;if(!W)throw new Error("init load aborted, missing levels");var k=W[m.level].details;console.assert(k,"Level details are defined when init segment is loaded");var O=m.stats;x.state=b.IDLE,x.fragLoadError=0,m.data=new Uint8Array(P.payload),O.parsing.start=O.buffering.start=self.performance.now(),O.parsing.end=O.buffering.end=self.performance.now(),P.frag===U&&j.trigger(M.Events.FRAG_BUFFERED,{stats:O,frag:U,part:null,id:m.type}),x.tick()}).catch(function(P){x.warn(P),x.resetFragmentLoading(m)})},a.fragContextChanged=function(m){var x=this.fragCurrent;return!m||!x||m.level!==x.level||m.sn!==x.sn||m.urlId!==x.urlId},a.fragBufferedComplete=function(m,x){var P=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(x?" part: "+x.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+o.default.toString(B.BufferHelper.getBuffered(P))),this.state=b.IDLE,this.tick()},a._handleFragmentLoadComplete=function(m){var x=this.transmuxer;if(!x)return;var P=m.frag,U=m.part,j=m.partsLoaded,W=!j||j.length===0||j.some(function(O){return!O}),k=new g.ChunkMetadata(P.level,P.sn,P.stats.chunkCount+1,0,U?U.index:-1,!W);x.flush(k)},a._handleFragmentLoadProgress=function(m){},a._doFragLoad=function(m,x,P,U){var j=this;if(P===void 0&&(P=null),!this.levels)throw new Error("frag load aborted, missing levels");if(P=Math.max(m.start,P||0),this.config.lowLatencyMode&&x){var W=x.partList;if(W&&U){P>m.end&&x.fragmentHint&&(m=x.fragmentHint);var k=this.getNextPart(W,m,P);if(k>-1){var O=W[k];return this.log("Loading part sn: "+m.sn+" p: "+O.index+" cc: "+m.cc+" of playlist ["+x.startSN+"-"+x.endSN+"] parts [0-"+k+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(P.toFixed(3))),this.nextLoadPosition=O.start+O.duration,this.state=b.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:m,part:W[k],targetBufferTime:P}),this.doFragPartsLoad(m,W,k,U).catch(function(K){return j.handleFragLoadError(K)})}else if(!m.url||this.loadedEndOfParts(W,P))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(x?"of ["+x.startSN+"-"+x.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(P.toFixed(3))),Object(z.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=b.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:m,targetBufferTime:P}),this.fragmentLoader.load(m,U).catch(function(K){return j.handleFragLoadError(K)})},a.doFragPartsLoad=function(m,x,P,U){var j=this;return new Promise(function(W,k){var O=[],K=function Y(q){var ie=x[q];j.fragmentLoader.loadPart(m,ie,U).then(function(Te){O[ie.index]=Te;var ve=Te.part;j.hls.trigger(M.Events.FRAG_LOADED,Te);var ge=x[q+1];if(ge&&ge.fragment===m)Y(q+1);else return W({frag:m,part:ve,partsLoaded:O})}).catch(k)};K(P)})},a.handleFragLoadError=function(m){var x=m.data;return x&&x.details===D.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(x.frag,x.part):this.hls.trigger(M.Events.ERROR,x),null},a._handleTransmuxerFlush=function(m){var x=this.getCurrentContext(m);if(!x||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var P=x.frag,U=x.part,j=x.level,W=self.performance.now();P.stats.parsing.end=W,U&&(U.stats.parsing.end=W),this.updateLevelTiming(P,U,j,m.partial)},a.getCurrentContext=function(m){var x=this.levels,P=m.level,U=m.sn,j=m.part;if(!x||!x[P])return this.warn("Levels object was unset while buffering fragment "+U+" of level "+P+". The current chunk will not be buffered."),null;var W=x[P],k=j>-1?Object(w.getPartWith)(W,U,j):null,O=k?k.fragment:Object(w.getFragmentWithSN)(W,U,this.fragCurrent);return O?{frag:O,part:k,level:W}:null},a.bufferFragmentData=function(m,x,P,U){if(!m||this.state!==b.PARSING)return;var j=m.data1,W=m.data2,k=j;if(j&&W&&(k=Object(T.appendUint8Array)(j,W)),!k||!k.length)return;var O={type:m.type,frag:x,part:P,chunkMeta:U,parent:x.type,data:k};this.hls.trigger(M.Events.BUFFER_APPENDING,O),m.dropped&&m.independent&&!P&&this.flushBufferGap(x)},a.flushBufferGap=function(m){var x=this.media;if(!x)return;if(!B.BufferHelper.isBuffered(x,x.currentTime)){this.flushMainBuffer(0,m.start);return}var P=x.currentTime,U=B.BufferHelper.bufferInfo(x,P,0),j=m.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),k=Math.max(Math.min(m.start-W,U.end-W),P+W);m.start-k>W&&this.flushMainBuffer(k,m.start)},a.getFwdBufferInfo=function(m,x){var P=this.config,U=this.getLoadPosition();if(!Object(z.isFiniteNumber)(U))return null;var j=B.BufferHelper.bufferInfo(m,U,P.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(U,x);if(W&&j.nextStart<W.end)return B.BufferHelper.bufferInfo(m,U,Math.max(j.nextStart,P.maxBufferHole))}return j},a.getMaxBufferLength=function(m){var x=this.config,P;return m?P=Math.max(8*x.maxBufferSize/m,x.maxBufferLength):P=x.maxBufferLength,Math.min(P,x.maxMaxBufferLength)},a.reduceMaxBufferLength=function(m){var x=this.config,P=m||x.maxBufferLength;return x.maxMaxBufferLength>=P?(x.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+x.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(m,x){var P,U,j=x.fragments,W=j.length;if(!W)return null;var k=this.config,O=j[0].start,K;if(x.live){var Y=k.initialLiveManifestSize;if(W<Y)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+Y+")"),null;!x.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(K=this.getInitialLiveFragment(x,j),this.startPosition=K?this.hls.liveSyncPosition||K.start:m)}else m<=O&&(K=j[0]);if(!K){var q=k.lowLatencyMode?x.partEnd:x.fragmentEnd;K=this.getFragmentAtPosition(m,q,x)}return(P=K)!==null&&P!==void 0&&P.initSegment&&!((U=K)!==null&&U!==void 0&&U.initSegment.data)&&!this.bitrateTest&&(K=K.initSegment),K},a.getNextPart=function(m,x,P){for(var U=-1,j=!1,W=!0,k=0,O=m.length;k<O;k++){var K=m[k];if(W=W&&!K.independent,U>-1&&P<K.start)break;var Y=K.loaded;!Y&&(j||K.independent||W)&&K.fragment===x&&(U=k),j=Y}return U},a.loadedEndOfParts=function(m,x){var P=m[m.length-1];return P&&x>P.start&&P.loaded},a.getInitialLiveFragment=function(m,x){var P=this.fragPrevious,U=null;if(P){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+P.programDateTime),U=Object(C.findFragmentByPDT)(x,P.endProgramDateTime,this.config.maxFragLookUpTolerance)),!U){var j=P.sn+1;if(j>=m.startSN&&j<=m.endSN){var W=x[j-m.startSN];P.cc===W.cc&&(U=W,this.log("Live playlist, switching playlist, load frag with next SN: "+U.sn))}U||(U=Object(C.findFragWithCC)(x,P.cc),U&&this.log("Live playlist, switching playlist, load frag with same CC: "+U.sn))}}else{var k=this.hls.liveSyncPosition;k!==null&&(U=this.getFragmentAtPosition(k,this.bitrateTest?m.fragmentEnd:m.edge,m))}return U},a.getFragmentAtPosition=function(m,x,P){var U=this.config,j=this.fragPrevious,W=P.fragments,k=P.endSN,O=P.fragmentHint,K=U.maxFragLookUpTolerance,Y=!!(U.lowLatencyMode&&P.partList&&O);Y&&O&&!this.bitrateTest&&(W=W.concat(O),k=O.sn);var q;if(m<x){var ie=m>x-K?0:K;q=Object(C.findFragmentByPTS)(j,W,m,ie)}else q=W[W.length-1];if(q){var Te=q.sn-P.startSN,ve=j&&q.level===j.level,ge=W[Te+1],he=this.fragmentTracker.getState(q);if(he===_.FragmentState.BACKTRACKED){q=null;for(var ce=Te;W[ce]&&this.fragmentTracker.getState(W[ce])===_.FragmentState.BACKTRACKED;)j?q=W[ce--]:q=W[--ce];q||(q=ge)}else j&&q.sn===j.sn&&!Y&&(ve&&(q.sn<k&&this.fragmentTracker.getState(ge)!==_.FragmentState.OK?(this.log("SN "+q.sn+" just loaded, load next one: "+ge.sn),q=ge):q=null))}return q},a.synchronizeToLiveEdge=function(m){var x=this.config,P=this.media;if(!P)return;var U=this.hls.liveSyncPosition,j=P.currentTime,W=m.fragments[0].start,k=m.edge,O=j>=W-x.maxFragLookUpTolerance&&j<=k;if(U!==null&&P.duration>U&&(j<U||!O)){var K=x.liveMaxLatencyDuration!==void 0?x.liveMaxLatencyDuration:x.liveMaxLatencyDurationCount*m.targetduration;(!O&&P.readyState<4||j<k-K)&&(this.loadedmetadata||(this.nextLoadPosition=U),P.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+k+", reset currentTime to : "+U.toFixed(3)),P.currentTime=U))}},a.alignPlaylists=function(m,x){var P=this.levels,U=this.levelLastLoaded,j=this.fragPrevious,W=U!==null?P[U]:null,k=m.fragments.length;if(!k)return this.warn("No fragments in live playlist"),0;var O=m.fragments[0].start,K=!x,Y=m.alignedSliding&&Object(z.isFiniteNumber)(O);if(K||!Y&&!O){Object(R.alignStream)(j,W,m);var q=m.fragments[0].start;return this.log("Live playlist sliding: "+q.toFixed(2)+" start-sn: "+(x?x.startSN:"na")+"->"+m.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+k),q}return O},a.waitForCdnTuneIn=function(m){var x=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*x)},a.setStartPosition=function(m,x){var P=this.startPosition;if(P<x&&(P=-1),P===-1||this.lastCurrentTime===-1){var U=m.startTimeOffset;Object(z.isFiniteNumber)(U)?(P=x+U,U<0&&(P+=m.totalduration),P=Math.min(Math.max(x,P),x+m.totalduration),this.log("Start time offset "+U+" found in playlist, adjust startPosition to "+P),this.startPosition=P):m.live?P=this.hls.liveSyncPosition||x:this.startPosition=P=0,this.lastCurrentTime=P}this.nextLoadPosition=P},a.getLoadPosition=function(){var m=this.media,x=0;return this.loadedmetadata&&m?x=m.currentTime:this.nextLoadPosition&&(x=this.nextLoadPosition),x},a.handleFragLoadAborted=function(m,x){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(x?" part"+x.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},a.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=b.IDLE)},a.onFragmentOrKeyLoadError=function(m,x){if(x.fatal)return;var P=x.frag;if(!P||P.type!==m)return;var U=this.fragCurrent;console.assert(U&&P.sn===U.sn&&P.level===U.level&&P.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(P.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+P.sn+" of "+m+" "+P.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=b.FRAG_LOADING_WAITING_RETRY}else x.levelRetry?(m===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=b.IDLE):(F.logger.error(x.details+" reaches max retry, redispatch as fatal ..."),x.fatal=!0,this.hls.stopLoad(),this.state=b.ERROR)},a.afterBufferFlushed=function(m,x,P){if(!m)return;var U=B.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(x,U,P),this.state===b.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=b.IDLE},a.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var x=this.levels?this.levels[m].details:null;if(x!=null&&x.live)return this.startPosition=-1,this.setStartPosition(x,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(m,x,P,U){var j=this,W=P.details;console.assert(!!W,"level.details must be defined");var k=Object.keys(m.elementaryStreams).reduce(function(O,K){var Y=m.elementaryStreams[K];if(Y){var q=Y.endPTS-Y.startPTS;if(q<=0)return j.warn("Could not parse fragment "+m.sn+" "+K+" duration reliably ("+q+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),O||!1;var ie=U?0:Object(w.updateFragPTSDTS)(W,m,Y.startPTS,Y.endPTS,Y.startDTS,Y.endDTS);return j.hls.trigger(M.Events.LEVEL_PTS_UPDATED,{details:W,level:P,drift:ie,type:K,frag:m,start:Y.startPTS,end:Y.endPTS}),!0}return O},!1);k?(this.state=b.PARSED,this.hls.trigger(M.Events.FRAG_PARSED,{frag:m,part:x})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},S(d,[{key:"state",get:function(){return this._state},set:function(m){var x=this._state;x!==m&&(this._state=m,this.log(x+"->"+m))}}]),d}(I.default)},"./src/controller/buffer-controller.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return C});var z=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),_=L("./src/utils/logger.ts"),B=L("./src/errors.ts"),F=L("./src/utils/buffer-helper.ts"),M=L("./src/utils/mediasource-helper.ts"),D=L("./src/loader/fragment.ts"),g=L("./src/controller/buffer-operation-queue.ts"),T=Object(M.getMediaSource)(),R=/([ha]vc.)(?:\.[^.,]+)+/,C=function(){function w(u){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=o.hls,l=o.media,S=o.mediaSource;_.logger.log("[buffer-controller]: Media source opened"),l&&(o.updateMediaElementDuration(),s.trigger(I.Events.MEDIA_ATTACHED,{media:l})),S&&S.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){_.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){_.logger.log("[buffer-controller]: Media source ended")},this.hls=u,this._initSourceBuffer(),this.registerListeners()}var v=w.prototype;return v.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},v.destroy=function(){this.unregisterListeners(),this.details=null},v.registerListeners=function(){var o=this.hls;o.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(I.Events.BUFFER_RESET,this.onBufferReset,this),o.on(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(I.Events.BUFFER_EOS,this.onBufferEos,this),o.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(I.Events.FRAG_PARSED,this.onFragParsed,this),o.on(I.Events.FRAG_CHANGED,this.onFragChanged,this)},v.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(I.Events.BUFFER_RESET,this.onBufferReset,this),o.off(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(I.Events.BUFFER_EOS,this.onBufferEos,this),o.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(I.Events.FRAG_PARSED,this.onFragParsed,this),o.off(I.Events.FRAG_CHANGED,this.onFragChanged,this)},v._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new g.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},v.onManifestParsed=function(o,s){var l=2;(s.audio&&!s.video||!s.altAudio)&&(l=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=l,this.details=null,_.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},v.onMediaAttaching=function(o,s){var l=this.media=s.media;if(l&&T){var S=this.mediaSource=new T;S.addEventListener("sourceopen",this._onMediaSourceOpen),S.addEventListener("sourceended",this._onMediaSourceEnded),S.addEventListener("sourceclose",this._onMediaSourceClose),l.src=self.URL.createObjectURL(S),this._objectUrl=l.src}},v.onMediaDetaching=function(){var o=this.media,s=this.mediaSource,l=this._objectUrl;if(s){if(_.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(S){_.logger.warn("[buffer-controller]: onMediaDetaching: "+S.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(l&&self.URL.revokeObjectURL(l),o.src===l?(o.removeAttribute("src"),o.load()):_.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(I.Events.MEDIA_DETACHED,void 0)},v.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(s){var l=o.sourceBuffer[s];try{l&&(o.removeBufferListeners(s),o.mediaSource&&o.mediaSource.removeSourceBuffer(l),o.sourceBuffer[s]=void 0)}catch(S){_.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",S)}}),this._initSourceBuffer()},v.onBufferCodecs=function(o,s){var l=this,S=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(p){if(S){var h=l.tracks[p];if(h&&typeof h.buffer.changeType=="function"){var A=s[p],b=A.codec,c=A.levelCodec,f=A.container,d=(h.levelCodec||h.codec).replace(R,"$1"),a=(c||b).replace(R,"$1");if(d!==a){var y=f+";codecs="+(c||b);l.appendChangeType(p,y)}}}else l.pendingTracks[p]=s[p]}),S)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},v.appendChangeType=function(o,s){var l=this,S=this.operationQueue,p={execute:function(){var A=l.sourceBuffer[o];A&&(_.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+s),A.changeType(s)),S.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(A){_.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",A)}};S.append(p,o)},v.onBufferAppending=function(o,s){var l=this,S=this.hls,p=this.operationQueue,h=this.tracks,A=s.data,b=s.type,c=s.frag,f=s.part,d=s.chunkMeta,a=d.buffering[b],y=self.performance.now();a.start=y;var m=c.stats.buffering,x=f?f.stats.buffering:null;m.start===0&&(m.start=y),x&&x.start===0&&(x.start=y);var P=h.audio,U=b==="audio"&&d.id===1&&(P==null?void 0:P.container)==="audio/mpeg",j={execute:function(){if(a.executeStart=self.performance.now(),U){var k=l.sourceBuffer[b];if(k){var O=c.start-k.timestampOffset;Math.abs(O)>=.1&&(_.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+c.start+" (delta: "+O+") sn: "+c.sn+")"),k.timestampOffset=c.start)}}l.appendExecutor(A,b)},onStart:function(){},onComplete:function(){var k=self.performance.now();a.executeEnd=a.end=k,m.first===0&&(m.first=k),x&&x.first===0&&(x.first=k);var O=l.sourceBuffer,K={};for(var Y in O)K[Y]=F.BufferHelper.getBuffered(O[Y]);l.appendError=0,l.hls.trigger(I.Events.BUFFER_APPENDED,{type:b,frag:c,part:f,chunkMeta:d,parent:c.type,timeRanges:K})},onError:function(k){_.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",k);var O={type:B.ErrorTypes.MEDIA_ERROR,parent:c.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:k,fatal:!1};k.code===DOMException.QUOTA_EXCEEDED_ERR?O.details=B.ErrorDetails.BUFFER_FULL_ERROR:(l.appendError++,O.details=B.ErrorDetails.BUFFER_APPEND_ERROR,l.appendError>S.config.appendErrorMaxRetry&&(_.logger.error("[buffer-controller]: Failed "+S.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),O.fatal=!0)),S.trigger(I.Events.ERROR,O)}};p.append(j,b)},v.onBufferFlushing=function(o,s){var l=this,S=this.operationQueue,p=function(A){return{execute:l.removeExecutor.bind(l,A,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){l.hls.trigger(I.Events.BUFFER_FLUSHED,{type:A})},onError:function(c){_.logger.warn("[buffer-controller]: Failed to remove from "+A+" SourceBuffer",c)}}};s.type?S.append(p(s.type),s.type):this.getSourceBufferTypes().forEach(function(h){S.append(p(h),h)})},v.onFragParsed=function(o,s){var l=this,S=s.frag,p=s.part,h=[],A=p?p.elementaryStreams:S.elementaryStreams;A[D.ElementaryStreamTypes.AUDIOVIDEO]?h.push("audiovideo"):(A[D.ElementaryStreamTypes.AUDIO]&&h.push("audio"),A[D.ElementaryStreamTypes.VIDEO]&&h.push("video"));var b=function(){var f=self.performance.now();S.stats.buffering.end=f,p&&(p.stats.buffering.end=f);var d=p?p.stats:S.stats;l.hls.trigger(I.Events.FRAG_BUFFERED,{frag:S,part:p,stats:d,id:S.type})};h.length===0&&_.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+S.type+" level: "+S.level+" sn: "+S.sn),this.blockBuffers(b,h)},v.onFragChanged=function(o,s){this.flushBackBuffer()},v.onBufferEos=function(o,s){var l=this,S=this.getSourceBufferTypes().reduce(function(p,h){var A=l.sourceBuffer[h];return(!s.type||s.type===h)&&(A&&!A.ended&&(A.ended=!0,_.logger.log("[buffer-controller]: "+h+" sourceBuffer now EOS"))),p&&!!(!A||A.ended)},!0);S&&this.blockBuffers(function(){var p=l.mediaSource;if(!p||p.readyState!=="open")return;p.endOfStream()})},v.onLevelUpdated=function(o,s){var l=s.details;if(!l.fragments.length)return;this.details=l,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},v.flushBackBuffer=function(){var o=this.hls,s=this.details,l=this.media,S=this.sourceBuffer;if(!l||s===null)return;var p=this.getSourceBufferTypes();if(!p.length)return;var h=s.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(z.isFiniteNumber)(h)||h<0)return;var A=l.currentTime,b=s.levelTargetDuration,c=Math.max(h,b),f=Math.floor(A/b)*b-c;p.forEach(function(d){var a=S[d];if(a){var y=F.BufferHelper.getBuffered(a);y.length>0&&f>y.start(0)&&(o.trigger(I.Events.BACK_BUFFER_REACHED,{bufferEnd:f}),s.live&&o.trigger(I.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:f}),o.trigger(I.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:f,type:d}))}})},v.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,s=this.hls,l=this.media,S=this.mediaSource,p=o.fragments[0].start+o.totalduration,h=l.duration,A=Object(z.isFiniteNumber)(S.duration)?S.duration:0;o.live&&s.config.liveDurationInfinity?(_.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),S.duration=Infinity,this.updateSeekableRange(o)):(p>A&&p>h||!Object(z.isFiniteNumber)(h))&&(_.logger.log("[buffer-controller]: Updating Media Source duration to "+p.toFixed(3)),S.duration=p)},v.updateSeekableRange=function(o){var s=this.mediaSource,l=o.fragments,S=l.length;if(S&&o.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var p=Math.max(0,l[0].start),h=Math.max(p,p+o.totalduration);s.setLiveSeekableRange(p,h)}},v.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,s=this.operationQueue,l=this.pendingTracks,S=Object.keys(l).length;if(S&&!o||S===2){this.createSourceBuffers(l),this.pendingTracks={};var p=this.getSourceBufferTypes();if(p.length===0){this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}p.forEach(function(h){s.executeNext(h)})}},v.createSourceBuffers=function(o){var s=this.sourceBuffer,l=this.mediaSource;if(!l)throw Error("createSourceBuffers called when mediaSource was null");var S=0;for(var p in o)if(!s[p]){var h=o[p];if(!h)throw Error("source buffer exists for track "+p+", however track does not");var A=h.levelCodec||h.codec,b=h.container+";codecs="+A;_.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var c=s[p]=l.addSourceBuffer(b),f=p;this.addBufferListener(f,"updatestart",this._onSBUpdateStart),this.addBufferListener(f,"updateend",this._onSBUpdateEnd),this.addBufferListener(f,"error",this._onSBUpdateError),this.tracks[p]={buffer:c,codec:A,container:h.container,levelCodec:h.levelCodec,id:h.id},S++}catch(d){_.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+d.message),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,mimeType:b})}}S&&this.hls.trigger(I.Events.BUFFER_CREATED,{tracks:this.tracks})},v._onSBUpdateStart=function(o){var s=this.operationQueue,l=s.current(o);l.onStart()},v._onSBUpdateEnd=function(o){var s=this.operationQueue,l=s.current(o);l.onComplete(),s.shiftAndExecuteNext(o)},v._onSBUpdateError=function(o,s){_.logger.error("[buffer-controller]: "+o+" SourceBuffer error",s),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var l=this.operationQueue.current(o);l&&l.onError(s)},v.removeExecutor=function(o,s,l){var S=this.media,p=this.mediaSource,h=this.operationQueue,A=this.sourceBuffer,b=A[o];if(!S||!p||!b){_.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(o);return}var c=Object(z.isFiniteNumber)(S.duration)?S.duration:Infinity,f=Object(z.isFiniteNumber)(p.duration)?p.duration:Infinity,d=Math.max(0,s),a=Math.min(l,c,f);a>d?(_.logger.log("[buffer-controller]: Removing ["+d+","+a+"] from the "+o+" SourceBuffer"),console.assert(!b.updating,o+" sourceBuffer must not be updating"),b.remove(d,a)):h.shiftAndExecuteNext(o)},v.appendExecutor=function(o,s){var l=this.operationQueue,S=this.sourceBuffer,p=S[s];if(!p){_.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),l.shiftAndExecuteNext(s);return}p.ended=!1,console.assert(!p.updating,s+" sourceBuffer must not be updating"),p.appendBuffer(o)},v.blockBuffers=function(o,s){var l=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){_.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var S=this.operationQueue,p=s.map(function(h){return S.appendBlocker(h)});Promise.all(p).then(function(){o(),s.forEach(function(h){var A=l.sourceBuffer[h];(!A||!A.updating)&&S.shiftAndExecuteNext(h)})})},v.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},v.addBufferListener=function(o,s,l){var S=this.sourceBuffer[o];if(!S)return;var p=l.bind(this,o);this.listeners[o].push({event:s,listener:p}),S.addEventListener(s,p)},v.removeBufferListeners=function(o){var s=this.sourceBuffer[o];if(!s)return;this.listeners[o].forEach(function(l){s.removeEventListener(l.event,l.listener)})},w}()},"./src/controller/buffer-operation-queue.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return I});var z=L("./src/utils/logger.ts"),I=function(){function _(F){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=F}var B=_.prototype;return B.append=function(M,D){var g=this.queues[D];g.push(M),g.length===1&&this.buffers[D]&&this.executeNext(D)},B.insertAbort=function(M,D){var g=this.queues[D];g.unshift(M),this.executeNext(D)},B.appendBlocker=function(M){var D,g=new Promise(function(R){D=R}),T={execute:D,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(T,M),g},B.executeNext=function(M){var D=this.buffers,g=this.queues,T=D[M],R=g[M];if(R.length){var C=R[0];try{C.execute()}catch(w){z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),C.onError(w),(!T||!T.updating)&&(R.shift(),this.executeNext(M))}}},B.shiftAndExecuteNext=function(M){this.queues[M].shift(),this.executeNext(M)},B.current=function(M){return this.queues[M][0]},_}()},"./src/controller/cap-level-controller.ts":function(te,G,L){"use strict";L.r(G);var z=L("./src/events.ts");function I(F,M){for(var D=0;D<M.length;D++){var g=M[D];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(F,g.key,g)}}function _(F,M,D){return M&&I(F.prototype,M),D&&I(F,D),F}var B=function(){function F(D){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=D,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var M=F.prototype;return M.setStreamController=function(g){this.streamController=g},M.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},M.registerListeners=function(){var g=this.hls;g.on(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.on(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},M.unregisterListener=function(){var g=this.hls;g.off(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.off(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},M.onFpsDropLevelCapping=function(g,T){F.isLevelAllowed(T.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(T.droppedLevel)},M.onMediaAttaching=function(g,T){this.media=T.media instanceof HTMLVideoElement?T.media:null},M.onManifestParsed=function(g,T){var R=this.hls;this.restrictedLevels=[],this.firstLevel=T.firstLevel,R.config.capLevelToPlayerSize&&T.video&&this.startCapping()},M.onBufferCodecs=function(g,T){var R=this.hls;R.config.capLevelToPlayerSize&&T.video&&this.startCapping()},M.onMediaDetaching=function(){this.stopCapping()},M.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var g=this.hls.levels;if(g.length){var T=this.hls;T.autoLevelCapping=this.getMaxLevel(g.length-1),T.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=T.autoLevelCapping}}},M.getMaxLevel=function(g){var T=this,R=this.hls.levels;if(!R.length)return-1;var C=R.filter(function(w,v){return F.isLevelAllowed(v,T.restrictedLevels)&&v<=g});return this.clientRect=null,F.getMaxLevelByMediaSize(C,this.mediaWidth,this.mediaHeight)},M.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()},M.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},M.getDimensions=function(){if(this.clientRect)return this.clientRect;var g=this.media,T={width:0,height:0};if(g){var R=g.getBoundingClientRect();T.width=R.width,T.height=R.height,!T.width&&!T.height&&(T.width=R.right-R.left||g.width||0,T.height=R.bottom-R.top||g.height||0)}return this.clientRect=T,T},F.isLevelAllowed=function(g,T){return T===void 0&&(T=[]),T.indexOf(g)===-1},F.getMaxLevelByMediaSize=function(g,T,R){if(!g||!g.length)return-1;for(var C=function(s,l){return l?s.width!==l.width||s.height!==l.height:!0},w=g.length-1,v=0;v<g.length;v+=1){var u=g[v];if((u.width>=T||u.height>=R)&&C(u,g[v+1])){w=v;break}}return w},_(F,[{key:"mediaWidth",get:function(){return this.getDimensions().width*F.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*F.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var g=1;try{g=self.devicePixelRatio}catch(T){}return g}}]),F}();G.default=B},"./src/controller/cmcd-controller.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return C});var z=L("./src/events.ts"),I=L("./src/types/cmcd.ts"),_=L("./src/utils/buffer-helper.ts"),B=L("./src/utils/logger.ts");function F(w,v){for(var u=0;u<v.length;u++){var o=v[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(w,o.key,o)}}function M(w,v,u){return v&&F(w.prototype,v),u&&F(w,u),w}function D(w,v){var u=typeof Symbol!="undefined"&&w[Symbol.iterator]||w["@@iterator"];if(u)return(u=u.call(w)).next.bind(u);if(Array.isArray(w)||(u=g(w))||v&&w&&typeof w.length=="number"){u&&(w=u);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 g(w,v){if(!w)return;if(typeof w=="string")return T(w,v);var u=Object.prototype.toString.call(w).slice(8,-1);if(u==="Object"&&w.constructor&&(u=w.constructor.name),u==="Map"||u==="Set")return Array.from(w);if(u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return T(w,v)}function T(w,v){(v==null||v>w.length)&&(v=w.length);for(var u=0,o=new Array(v);u<v;u++)o[u]=w[u];return o}function R(){return R=Object.assign||function(w){for(var v=1;v<arguments.length;v++){var u=arguments[v];for(var o in u)Object.prototype.hasOwnProperty.call(u,o)&&(w[o]=u[o])}return w},R.apply(this,arguments)}var C=function(){function w(u){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(S){try{o.apply(S,{ot:I.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(p){B.logger.warn("Could not generate manifest CMCD data.",p)}},this.applyFragmentData=function(S){try{var p=S.frag,h=o.hls.levels[p.level],A=o.getObjectType(p),b={d:p.duration*1e3,ot:A};(A===I.CMCDObjectType.VIDEO||A===I.CMCDObjectType.AUDIO||A==I.CMCDObjectType.MUXED)&&(b.br=h.bitrate/1e3,b.tb=o.getTopBandwidth(A),b.bl=o.getBufferLength(A)),o.apply(S,b)}catch(c){B.logger.warn("Could not generate segment CMCD data.",c)}},this.hls=u;var s=this.config=u.config,l=s.cmcd;l!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=l.sessionId||w.uuid(),this.cid=l.contentId,this.useHeaders=l.useHeaders===!0,this.registerListeners())}var v=w.prototype;return v.registerListeners=function(){var o=this.hls;o.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(z.Events.BUFFER_CREATED,this.onBufferCreated,this)},v.unregisterListeners=function(){var o=this.hls;o.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(z.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},v.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},v.onMediaAttached=function(o,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},v.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},v.onBufferCreated=function(o,s){var l,S;this.audioBuffer=(l=s.tracks.audio)===null||l===void 0?void 0:l.buffer,this.videoBuffer=(S=s.tracks.video)===null||S===void 0?void 0:S.buffer},v.createData=function(){var o;return{v:I.CMCDVersion,sf:I.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},v.apply=function(o,s){s===void 0&&(s={}),R(s,this.createData());var l=s.ot===I.CMCDObjectType.INIT||s.ot===I.CMCDObjectType.VIDEO||s.ot===I.CMCDObjectType.MUXED;if(this.starved&&l&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var S=w.toHeaders(s);if(!Object.keys(S).length)return;o.headers||(o.headers={}),R(o.headers,S)}else{var p=w.toQuery(s);if(!p)return;o.url=w.appendQueryToUri(o.url,p)}},v.getObjectType=function(o){var s=o.type;return s==="subtitle"?I.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?I.CMCDObjectType.INIT:s==="audio"?I.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?I.CMCDObjectType.VIDEO:I.CMCDObjectType.MUXED:void 0},v.getTopBandwidth=function(o){for(var s=0,l=o===I.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,S=D(l),p;!(p=S()).done;){var h=p.value;h.bitrate>s&&(s=h.bitrate)}return s>0?s:NaN},v.getBufferLength=function(o){var s=this.hls.media,l=o===I.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!l||!s)return NaN;var S=_.BufferHelper.bufferInfo(l,s.currentTime,this.config.maxBufferHole);return S.len*1e3},v.createPlaylistLoader=function(){var o=this.config.pLoader,s=this.applyPlaylistData,l=o||this.config.loader;return function(){function S(h){this.loader=void 0,this.loader=new l(h)}var p=S.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(A,b,c){s(A),this.loader.load(A,b,c)},M(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},v.createFragmentLoader=function(){var o=this.config.fLoader,s=this.applyFragmentData,l=o||this.config.loader;return function(){function S(h){this.loader=void 0,this.loader=new l(h)}var p=S.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(A,b,c){s(A),this.loader.load(A,b,c)},M(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},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=[],l=function(U){return!Number.isNaN(U)&&U!=null&&U!==""&&U!==!1},S=function(U){return Math.round(U)},p=function(U){return S(U/100)*100},h=function(U){return encodeURIComponent(U)},A={br:S,d:S,bl:p,dl:p,mtp:p,nor:h,rtp:p,tb:S},b=Object.keys(o||{}).sort(),c=D(b),f;!(f=c()).done;){var d=f.value,a=o[d];if(!l(a))continue;if(d==="v"&&a===1)continue;if(d=="pr"&&a===1)continue;var y=A[d];y&&(a=y(a));var m=typeof a,x=void 0;d==="ot"||d==="sf"||d==="st"?x=d+"="+a:m==="boolean"?x=d:m==="number"?x=d+"="+a:x=d+"="+JSON.stringify(a),s.push(x)}return s.join(",")},w.toHeaders=function(o){for(var s=Object.keys(o),l={},S=["Object","Request","Session","Status"],p=[{},{},{},{}],h={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},A=0,b=s;A<b.length;A++){var c=b[A],f=h[c]!=null?h[c]:1;p[f][c]=o[c]}for(var d=0;d<p.length;d++){var a=w.serialize(p[d]);a&&(l["CMCD-"+S[d]]=a)}return l},w.toQuery=function(o){return"CMCD="+encodeURIComponent(w.serialize(o))},w.appendQueryToUri=function(o,s){if(!s)return o;var l=o.includes("?")?"&":"?";return""+o+l+s},w}()},"./src/controller/eme-controller.ts":function(te,G,L){"use strict";L.r(G);var z=L("./src/events.ts"),I=L("./src/errors.ts"),_=L("./src/utils/logger.ts"),B=L("./src/utils/mediakeys-helper.ts");function F(C,w){for(var v=0;v<w.length;v++){var u=w[v];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(C,u.key,u)}}function M(C,w,v){return w&&F(C.prototype,w),v&&F(C,v),C}var D=3,g=function(w,v,u){var o={audioCapabilities:[],videoCapabilities:[]};return w.forEach(function(s){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:u.audioRobustness||""})}),v.forEach(function(s){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:u.videoRobustness||""})}),[o]},T=function(w,v,u,o){switch(w){case B.KeySystems.WIDEVINE:return g(v,u,o);default:throw new Error("Unknown key-system: "+w)}},R=function(){function C(v){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=v,this._config=v.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=C.prototype;return w.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},w._registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w._unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w.getLicenseServerUrl=function(u){switch(u){case B.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+u+'"')},w._attemptKeySystemAccess=function(u,o,s){var l=this,S=T(u,o,s,this._drmSystemOptions);_.logger.log("Requesting encrypted media key-system access");var p=this.requestMediaKeySystemAccess(u,S);this.mediaKeysPromise=p.then(function(h){return l._onMediaKeySystemAccessObtained(u,h)}),p.catch(function(h){_.logger.error('Failed to obtain key-system "'+u+'" access:',h)})},w._onMediaKeySystemAccessObtained=function(u,o){var s=this;_.logger.log('Access for key-system "'+u+'" obtained');var l={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:u};this._mediaKeysList.push(l);var S=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(p){return l.mediaKeys=p,_.logger.log('Media-keys created for key-system "'+u+'"'),s._onMediaKeysCreated(),p});return S.catch(function(p){_.logger.error("Failed to create media-keys:",p)}),S},w._onMediaKeysCreated=function(){var u=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),u._onNewMediaKeySession(o.mediaKeysSession))})},w._onNewMediaKeySession=function(u){var o=this;_.logger.log("New key-system session "+u.sessionId),u.addEventListener("message",function(s){o._onKeySessionMessage(u,s.message)},!1)},w._onKeySessionMessage=function(u,o){_.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(s){_.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),u.update(s)})},w.onMediaEncrypted=function(u){var o=this;if(_.logger.log('Media is encrypted using "'+u.initDataType+'" init data type'),!this.mediaKeysPromise){_.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(S){if(!o._media)return;o._attemptSetMediaKeys(S),o._generateRequestWithPreferredKeySession(u.initDataType,u.initData)};this.mediaKeysPromise.then(s).catch(s)},w._attemptSetMediaKeys=function(u){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){_.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}_.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},w._generateRequestWithPreferredKeySession=function(u,o){var s=this,l=this._mediaKeysList[0];if(!l){_.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(l.mediaKeysSessionInitialized){_.logger.warn("Key-Session already initialized but requested again");return}var S=l.mediaKeysSession;if(!S){_.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){_.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}_.logger.log('Generating key-session request for "'+u+'" init data type'),l.mediaKeysSessionInitialized=!0,S.generateRequest(u,o).then(function(){_.logger.debug("Key-session generation succeeded")}).catch(function(p){_.logger.error("Error generating key-session request:",p),s.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},w._createLicenseXhr=function(u,o,s){var l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,l,u,o,s);var S=this._licenseXhrSetup;if(S)try{S.call(this.hls,l,u),S=void 0}catch(p){_.logger.error(p)}try{l.readyState||l.open("POST",u,!0),S&&S.call(this.hls,l,u)}catch(p){throw new Error("issue setting up KeySystem license XHR "+p)}return l},w._onLicenseRequestReadyStageChange=function(u,o,s,l){switch(u.readyState){case 4:if(u.status===200){this._requestLicenseFailureCount=0,_.logger.log("License request succeeded");var S=u.response,p=this._licenseResponseCallback;if(p)try{S=p.call(this.hls,u,o)}catch(A){_.logger.error(A)}l(S)}else{if(_.logger.error("License Request XHR failed ("+o+"). Status: "+u.status+" ("+u.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>D){this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var h=D-this._requestLicenseFailureCount+1;_.logger.warn("Retrying license request, "+h+" attempts left"),this._requestLicense(s,l)}break}},w._generateLicenseRequestChallenge=function(u,o){switch(u.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+u.mediaKeySystemDomain)},w._requestLicense=function(u,o){_.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){_.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var l=this.getLicenseServerUrl(s.mediaKeySystemDomain),S=this._createLicenseXhr(l,u,o);_.logger.log("Sending license request to URL: "+l);var p=this._generateLicenseRequestChallenge(s,u);S.send(p)}catch(h){_.logger.error("Failure requesting DRM license: "+h),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},w.onMediaAttached=function(u,o){if(!this._emeEnabled)return;var s=o.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},w.onMediaDetached=function(){var u=this._media,o=this._mediaKeysList;if(!u)return;u.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return u.setMediaKeys(null)}).catch(function(){})},w.onManifestParsed=function(u,o){if(!this._emeEnabled)return;var s=o.levels.map(function(S){return S.audioCodec}).filter(function(S){return!!S}),l=o.levels.map(function(S){return S.videoCodec}).filter(function(S){return!!S});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,s,l)},M(C,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),C}();G.default=R},"./src/controller/fps-controller.ts":function(te,G,L){"use strict";L.r(G);var z=L("./src/events.ts"),I=L("./src/utils/logger.ts"),_=function(){function B(M){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=M,this.registerListeners()}var F=B.prototype;return F.setStreamController=function(D){this.streamController=D},F.registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},F.unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},F.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},F.onMediaAttaching=function(D,g){var T=this.hls.config;if(T.capLevelOnFPSDrop){var R=g.media instanceof self.HTMLVideoElement?g.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),T.fpsDroppedMonitoringPeriod)}},F.checkFPS=function(D,g,T){var R=performance.now();if(g){if(this.lastTime){var C=R-this.lastTime,w=T-this.lastDroppedFrames,v=g-this.lastDecodedFrames,u=1e3*w/C,o=this.hls;if(o.trigger(z.Events.FPS_DROP,{currentDropped:w,currentDecoded:v,totalDroppedFrames:T}),u>0&&w>o.config.fpsDroppedMonitoringThreshold*v){var s=o.currentLevel;I.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=s)&&(s=s-1,o.trigger(z.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:o.currentLevel}),o.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=R,this.lastDroppedFrames=T,this.lastDecodedFrames=g}},F.checkFPSInterval=function(){var D=this.media;if(D)if(this.isVideoPlaybackQualityAvailable){var g=D.getVideoPlaybackQuality();this.checkFPS(D,g.totalVideoFrames,g.droppedVideoFrames)}else this.checkFPS(D,D.webkitDecodedFrameCount,D.webkitDroppedFrameCount)},B}();G.default=_},"./src/controller/fragment-finders.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"findFragmentByPDT",function(){return _}),L.d(G,"findFragmentByPTS",function(){return B}),L.d(G,"fragmentWithinToleranceTest",function(){return F}),L.d(G,"pdtWithinToleranceTest",function(){return M}),L.d(G,"findFragWithCC",function(){return D});var z=L("./src/polyfills/number.ts"),I=L("./src/utils/binary-search.ts");function _(g,T,R){if(T===null||!Array.isArray(g)||!g.length||!Object(z.isFiniteNumber)(T))return null;var C=g[0].programDateTime;if(T<(C||0))return null;var w=g[g.length-1].endProgramDateTime;if(T>=(w||0))return null;R=R||0;for(var v=0;v<g.length;++v){var u=g[v];if(M(T,R,u))return u}return null}function B(g,T,R,C){R===void 0&&(R=0),C===void 0&&(C=0);var w=null;if(g?w=T[g.sn-T[0].sn+1]||null:R===0&&T[0].start===0&&(w=T[0]),w&&F(R,C,w)===0)return w;var v=I.default.search(T,F.bind(null,R,C));return v||w}function F(g,T,R){g===void 0&&(g=0),T===void 0&&(T=0);var C=Math.min(T,R.duration+(R.deltaPTS?R.deltaPTS:0));return R.start+R.duration-C<=g?1:R.start-C>g&&R.start?-1:0}function M(g,T,R){var C=Math.min(T,R.duration+(R.deltaPTS?R.deltaPTS:0))*1e3,w=R.endProgramDateTime||0;return w-C>g}function D(g,T){return I.default.search(g,function(R){return R.cc<T?1:R.cc>T?-1:0})}},"./src/controller/fragment-tracker.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"FragmentState",function(){return _}),L.d(G,"FragmentTracker",function(){return B});var z=L("./src/events.ts"),I=L("./src/types/loader.ts"),_;(function(D){D.NOT_LOADED="NOT_LOADED",D.BACKTRACKED="BACKTRACKED",D.APPENDING="APPENDING",D.PARTIAL="PARTIAL",D.OK="OK"})(_||(_={}));var B=function(){function D(T){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=T,this._registerListeners()}var g=D.prototype;return g._registerListeners=function(){var R=this.hls;R.on(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.on(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.on(z.Events.FRAG_LOADED,this.onFragLoaded,this)},g._unregisterListeners=function(){var R=this.hls;R.off(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.off(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.off(z.Events.FRAG_LOADED,this.onFragLoaded,this)},g.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},g.getAppendedFrag=function(R,C){if(C===I.PlaylistLevelType.MAIN){var w=this.activeFragment,v=this.activeParts;if(!w)return null;if(v)for(var u=v.length;u--;){var o=v[u],s=o?o.end:w.appendedPTS;if(o.start<=R&&s!==void 0&&R<=s)return u>9&&(this.activeParts=v.slice(u-9)),o}else if(w.start<=R&&w.appendedPTS!==void 0&&R<=w.appendedPTS)return w}return this.getBufferedFrag(R,C)},g.getBufferedFrag=function(R,C){for(var w=this.fragments,v=Object.keys(w),u=v.length;u--;){var o=w[v[u]];if((o==null?void 0:o.body.type)===C&&o.buffered){var s=o.body;if(s.start<=R&&R<=s.end)return s}}return null},g.detectEvictedFragments=function(R,C,w){var v=this;Object.keys(this.fragments).forEach(function(u){var o=v.fragments[u];if(!o)return;if(!o.buffered){o.body.type===w&&v.removeFragment(o.body);return}var s=o.range[R];if(!s)return;s.time.some(function(l){var S=!v.isTimeBuffered(l.startPTS,l.endPTS,C);return S&&v.removeFragment(o.body),S})})},g.detectPartialFragments=function(R){var C=this,w=this.timeRanges,v=R.frag,u=R.part;if(!w||v.sn==="initSegment")return;var o=M(v),s=this.fragments[o];if(!s)return;Object.keys(w).forEach(function(l){var S=v.elementaryStreams[l];if(!S)return;var p=w[l],h=u!==null||S.partial===!0;s.range[l]=C.getBufferedTimes(v,u,h,p)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},g.fragBuffered=function(R){var C=M(R),w=this.fragments[C];w&&(w.backtrack=w.loaded=null,w.buffered=!0)},g.getBufferedTimes=function(R,C,w,v){for(var u={time:[],partial:w},o=C?C.start:R.start,s=C?C.end:R.end,l=R.minEndPTS||s,S=R.maxStartPTS||o,p=0;p<v.length;p++){var h=v.start(p)-this.bufferPadding,A=v.end(p)+this.bufferPadding;if(S>=h&&l<=A){u.time.push({startPTS:Math.max(o,v.start(p)),endPTS:Math.min(s,v.end(p))});break}else if(o<A&&s>h)u.partial=!0,u.time.push({startPTS:Math.max(o,v.start(p)),endPTS:Math.min(s,v.end(p))});else if(s<=h)break}return u},g.getPartialFragment=function(R){var C=null,w,v,u,o=0,s=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach(function(S){var p=l[S];if(!p)return;F(p)&&(v=p.body.start-s,u=p.body.end+s,R>=v&&R<=u&&(w=Math.min(R-v,u-R),o<=w&&(C=p.body,o=w)))}),C},g.getState=function(R){var C=M(R),w=this.fragments[C];return w?w.buffered?F(w)?_.PARTIAL:_.OK:w.backtrack?_.BACKTRACKED:_.APPENDING:_.NOT_LOADED},g.backtrack=function(R,C){var w=M(R),v=this.fragments[w];if(!v||v.backtrack)return null;var u=v.backtrack=C||v.loaded;return v.loaded=null,u},g.getBacktrackData=function(R){var C=M(R),w=this.fragments[C];if(w){var v,u=w.backtrack;if(u!=null&&(v=u.payload)!==null&&v!==void 0&&v.byteLength)return u;this.removeFragment(R)}return null},g.isTimeBuffered=function(R,C,w){for(var v,u,o=0;o<w.length;o++){if(v=w.start(o)-this.bufferPadding,u=w.end(o)+this.bufferPadding,R>=v&&C<=u)return!0;if(C<=v)return!1}return!1},g.onFragLoaded=function(R,C){var w=C.frag,v=C.part;if(w.sn==="initSegment"||w.bitrateTest||v)return;var u=M(w);this.fragments[u]={body:w,loaded:C,backtrack:null,buffered:!1,range:Object.create(null)}},g.onBufferAppended=function(R,C){var w=this,v=C.frag,u=C.part,o=C.timeRanges;if(v.type===I.PlaylistLevelType.MAIN)if(this.activeFragment=v,u){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(u)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(l){var S=o[l];if(w.detectEvictedFragments(l,S),!u)for(var p=0;p<S.length;p++)v.appendedPTS=Math.max(S.end(p),v.appendedPTS||0)})},g.onFragBuffered=function(R,C){this.detectPartialFragments(C)},g.hasFragment=function(R){var C=M(R);return!!this.fragments[C]},g.removeFragmentsInRange=function(R,C,w){var v=this;Object.keys(this.fragments).forEach(function(u){var o=v.fragments[u];if(!o)return;if(o.buffered){var s=o.body;s.type===w&&s.start<C&&s.end>R&&v.removeFragment(s)}})},g.removeFragment=function(R){var C=M(R);R.stats.loaded=0,R.clearElementaryStreamInfo(),delete this.fragments[C]},g.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},D}();function F(D){var g,T;return D.buffered&&(((g=D.range.video)===null||g===void 0?void 0:g.partial)||((T=D.range.audio)===null||T===void 0?void 0:T.partial))}function M(D){return D.type+"_"+D.level+"_"+D.urlId+"_"+D.sn}},"./src/controller/gap-controller.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"STALL_MINIMUM_DURATION_MS",function(){return F}),L.d(G,"MAX_START_GAP_JUMP",function(){return M}),L.d(G,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return D}),L.d(G,"SKIP_BUFFER_RANGE_START",function(){return g}),L.d(G,"default",function(){return T});var z=L("./src/utils/buffer-helper.ts"),I=L("./src/errors.ts"),_=L("./src/events.ts"),B=L("./src/utils/logger.ts"),F=250,M=2,D=.1,g=.05,T=function(){function R(w,v,u,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=w,this.media=v,this.fragmentTracker=u,this.hls=o}var C=R.prototype;return C.destroy=function(){this.hls=this.fragmentTracker=this.media=null},C.poll=function(v){var u=this.config,o=this.media,s=this.stalled,l=o.currentTime,S=o.seeking,p=this.seeking&&!S,h=!this.seeking&&S;if(this.seeking=S,l!==v){if(this.moved=!0,s!==null){if(this.stallReported){var A=self.performance.now()-s;B.logger.warn("playback not stuck anymore @"+l+", after "+Math.round(A)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((h||p)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!z.BufferHelper.getBuffered(o).length)return;var b=z.BufferHelper.bufferInfo(o,l,0),c=b.len>0,f=b.nextStart||0;if(!c&&!f)return;if(S){var d=b.len>M,a=!f||f-l>M&&!this.fragmentTracker.getPartialFragment(l);if(d||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var y,m=Math.max(f,b.start||0)-l,x=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,P=x==null||((y=x.details)===null||y===void 0)?void 0:y.live,U=P?x.details.targetduration*2:M;if(m>0&&m<=U){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(s===null){this.stalled=j;return}var W=j-s;!S&&W>=F&&this._reportStall(b.len);var k=z.BufferHelper.bufferInfo(o,l,u.maxBufferHole);this._tryFixBufferStall(k,W)},C._tryFixBufferStall=function(v,u){var o=this.config,s=this.fragmentTracker,l=this.media,S=l.currentTime,p=s.getPartialFragment(S);if(p){var h=this._trySkipBufferHole(p);if(h)return}v.len>o.maxBufferHole&&u>o.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},C._reportStall=function(v){var u=this.hls,o=this.media,s=this.stallReported;s||(this.stallReported=!0,B.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+v+")"),u.trigger(_.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:v}))},C._trySkipBufferHole=function(v){for(var u=this.config,o=this.hls,s=this.media,l=s.currentTime,S=0,p=z.BufferHelper.getBuffered(s),h=0;h<p.length;h++){var A=p.start(h);if(l+u.maxBufferHole>=S&&l<A){var b=Math.max(A+g,s.currentTime+D);return B.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+b),this.moved=!0,this.stalled=null,s.currentTime=b,v&&o.trigger(_.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+l+" to "+b,frag:v}),b}S=p.end(h)}return 0},C._tryNudgeBuffer=function(){var v=this.config,u=this.hls,o=this.media,s=o.currentTime,l=(this.nudgeRetry||0)+1;if(this.nudgeRetry=l,l<v.nudgeMaxRetry){var S=s+l*v.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+s+" to "+S),o.currentTime=S,u.trigger(_.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else B.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+v.nudgeMaxRetry+" nudges"),u.trigger(_.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},R}()},"./src/controller/id3-track-controller.ts":function(te,G,L){"use strict";L.r(G);var z=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),_=L("./src/demux/id3.ts"),B=.25,F=function(){function M(g){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=g,this._registerListeners()}var D=M.prototype;return D.destroy=function(){this._unregisterListeners()},D._registerListeners=function(){var T=this.hls;T.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.on(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D._unregisterListeners=function(){var T=this.hls;T.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.off(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D.onMediaAttached=function(T,R){this.media=R.media},D.onMediaDetaching=function(){if(!this.id3Track)return;Object(I.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},D.getID3Track=function(T){if(!this.media)return;for(var R=0;R<T.length;R++){var C=T[R];if(C.kind==="metadata"&&C.label==="id3")return Object(I.sendAddTrackEvent)(C,this.media),C}return this.media.addTextTrack("metadata","id3")},D.onFragParsingMetadata=function(T,R){if(!this.media)return;var C=R.frag,w=R.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var v=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,u=0;u<w.length;u++){var o=_.getID3Frames(w[u].data);if(o){var s=w[u].pts,l=u<w.length-1?w[u+1].pts:C.end,S=l-s;S<=0&&(l=s+B);for(var p=0;p<o.length;p++){var h=o[p];if(!_.isTimeStampFrame(h)){var A=new v(s,l,"");A.value=h,this.id3Track.addCue(A)}}}}},D.onBufferFlushing=function(T,R){var C=R.startOffset,w=R.endOffset,v=R.type;if(!v||v==="audio"){var u=this.id3Track;u&&Object(I.removeCuesInRange)(u,C,w)}},M}();G.default=F},"./src/controller/latency-controller.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return M});var z=L("./src/errors.ts"),I=L("./src/events.ts"),_=L("./src/utils/logger.ts");function B(D,g){for(var T=0;T<g.length;T++){var R=g[T];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(D,R.key,R)}}function F(D,g,T){return g&&B(D.prototype,g),T&&B(D,T),D}var M=function(){function D(T){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=T,this.config=T.config,this.registerListeners()}var g=D.prototype;return g.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},g.registerListeners=function(){this.hls.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(I.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){this.hls.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(I.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(I.Events.ERROR,this.onError)},g.onMediaAttached=function(R,C){this.media=C.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},g.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},g.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},g.onLevelUpdated=function(R,C){var w=C.details;this.levelDetails=w,w.advanced&&this.timeupdate(),!w.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},g.onError=function(R,C){if(C.details!==z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,_.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},g.timeupdate=function(){var R=this.media,C=this.levelDetails;if(!R||!C)return;this.currentTime=R.currentTime;var w=this.computeLatency();if(w===null)return;this._latency=w;var v=this.config,u=v.lowLatencyMode,o=v.maxLiveSyncPlaybackRate;if(!u||o===1)return;var s=this.targetLatency;if(s===null)return;var l=w-s,S=Math.min(this.maxLatency,s+C.targetduration),p=l<S;if(C.live&&p&&l>.05&&this.forwardBufferLength>1){var h=Math.min(2,Math.max(1,o)),A=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20;R.playbackRate=Math.min(h,Math.max(1,A))}else R.playbackRate!==1&&R.playbackRate!==0&&(R.playbackRate=1)},g.estimateLiveEdge=function(){var R=this.levelDetails;return R===null?null:R.edge+R.age},g.computeLatency=function(){var R=this.estimateLiveEdge();return R===null?null:R-this.currentTime},F(D,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var R=this.config,C=this.levelDetails;return R.liveMaxLatencyDuration!==void 0?R.liveMaxLatencyDuration:C?R.liveMaxLatencyDurationCount*C.targetduration:0}},{key:"targetLatency",get:function(){var R=this.levelDetails;if(R===null)return null;var C=R.holdBack,w=R.partHoldBack,v=R.targetduration,u=this.config,o=u.liveSyncDuration,s=u.liveSyncDurationCount,l=u.lowLatencyMode,S=this.hls.userConfig,p=l&&w||C;(S.liveSyncDuration||S.liveSyncDurationCount||p===0)&&(p=o!==void 0?o:s*v);var h=v,A=1;return p+Math.min(this.stallCount*A,h)}},{key:"liveSyncPosition",get:function(){var R=this.estimateLiveEdge(),C=this.targetLatency,w=this.levelDetails;if(R===null||C===null||w===null)return null;var v=w.edge,u=R-C-this.edgeStalled,o=v-w.totalduration,s=v-(this.config.lowLatencyMode&&w.partTarget||w.targetduration);return Math.min(Math.max(o,u),s)}},{key:"drift",get:function(){var R=this.levelDetails;return R===null?1:R.drift}},{key:"edgeStalled",get:function(){var R=this.levelDetails;if(R===null)return 0;var C=(this.config.lowLatencyMode&&R.partTarget||R.targetduration)*3;return Math.max(R.age-C,0)}},{key:"forwardBufferLength",get:function(){var R=this.media,C=this.levelDetails;if(!R||!C)return 0;var w=R.buffered.length;return w?R.buffered.end(w-1):C.edge-this.currentTime}}]),D}()},"./src/controller/level-controller.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return u});var z=L("./src/types/level.ts"),I=L("./src/events.ts"),_=L("./src/errors.ts"),B=L("./src/utils/codecs.ts"),F=L("./src/controller/level-helper.ts"),M=L("./src/controller/base-playlist-controller.ts"),D=L("./src/types/loader.ts");function g(){return g=Object.assign||function(o){for(var s=1;s<arguments.length;s++){var l=arguments[s];for(var S in l)Object.prototype.hasOwnProperty.call(l,S)&&(o[S]=l[S])}return o},g.apply(this,arguments)}function T(o,s){for(var l=0;l<s.length;l++){var S=s[l];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function R(o,s,l){return s&&T(o.prototype,s),l&&T(o,l),o}function C(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,w(o,s)}function w(o,s){return w=Object.setPrototypeOf||function(S,p){return S.__proto__=p,S},w(o,s)}var v=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),u=function(o){C(s,o);function s(S){var p;return p=o.call(this,S,"[level-controller]")||this,p._levels=[],p._firstLevel=-1,p._startLevel=void 0,p.currentLevelIndex=-1,p.manualLevelIndex=-1,p.onParsedComplete=void 0,p._registerListeners(),p}var l=s.prototype;return l._registerListeners=function(){var p=this.hls;p.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),p.on(I.Events.ERROR,this.onError,this)},l._unregisterListeners=function(){var p=this.hls;p.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),p.off(I.Events.ERROR,this.onError,this)},l.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},l.startLoad=function(){var p=this._levels;p.forEach(function(h){h.loadError=0}),o.prototype.startLoad.call(this)},l.onManifestLoaded=function(p,h){var A=[],b=[],c=[],f,d={},a,y=!1,m=!1,x=!1;if(h.levels.forEach(function(W){var k=W.attrs;y=y||!!(W.width&&W.height),m=m||!!W.videoCodec,x=x||!!W.audioCodec,v&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var O=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;a=d[O],a?a.url.push(W.url):(a=new z.Level(W),d[O]=a,A.push(a)),k&&(k.AUDIO&&Object(F.addGroupId)(a,"audio",k.AUDIO),k.SUBTITLES&&Object(F.addGroupId)(a,"text",k.SUBTITLES))}),(y||m)&&x&&(A=A.filter(function(W){var k=W.videoCodec,O=W.width,K=W.height;return!!k||!!(O&&K)})),A=A.filter(function(W){var k=W.audioCodec,O=W.videoCodec;return(!k||Object(B.isCodecSupportedInMp4)(k,"audio"))&&(!O||Object(B.isCodecSupportedInMp4)(O,"video"))}),h.audioTracks&&(b=h.audioTracks.filter(function(W){return!W.audioCodec||Object(B.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(F.assignTrackIdsByGroup)(b)),h.subtitles&&(c=h.subtitles,Object(F.assignTrackIdsByGroup)(c)),A.length>0){f=A[0].bitrate,A.sort(function(W,k){return W.bitrate-k.bitrate}),this._levels=A;for(var P=0;P<A.length;P++)if(A[P].bitrate===f){this._firstLevel=P,this.log("manifest loaded, "+A.length+" level(s) found, first bitrate: "+f);break}var U=x&&!m,j={levels:A,audioTracks:b,subtitleTracks:c,firstLevel:this._firstLevel,stats:h.stats,audio:x,video:m,altAudio:!U&&b.some(function(W){return!!W.url})};this.hls.trigger(I.Events.MANIFEST_PARSED,j),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(I.Events.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:h.url,reason:"no level with compatible codecs found in manifest"})},l.onError=function(p,h){if(o.prototype.onError.call(this,p,h),h.fatal)return;var A=h.context,b=this._levels[this.currentLevelIndex];if(A&&(A.type===D.PlaylistContextType.AUDIO_TRACK&&b.audioGroupIds&&A.groupId===b.audioGroupIds[b.urlId]||A.type===D.PlaylistContextType.SUBTITLE_TRACK&&b.textGroupIds&&A.groupId===b.textGroupIds[b.urlId])){this.redundantFailover(this.currentLevelIndex);return}var c=!1,f=!0,d;switch(h.details){case _.ErrorDetails.FRAG_LOAD_ERROR:case _.ErrorDetails.FRAG_LOAD_TIMEOUT:case _.ErrorDetails.KEY_LOAD_ERROR:case _.ErrorDetails.KEY_LOAD_TIMEOUT:if(h.frag){var a=this._levels[h.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(d=h.frag.level)):d=h.frag.level}break;case _.ErrorDetails.LEVEL_LOAD_ERROR:case _.ErrorDetails.LEVEL_LOAD_TIMEOUT:A&&(A.deliveryDirectives&&(f=!1),d=A.level),c=!0;break;case _.ErrorDetails.REMUX_ALLOC_ERROR:d=h.level,c=!0;break}d!==void 0&&this.recoverLevel(h,d,c,f)},l.recoverLevel=function(p,h,A,b){var c=p.details,f=this._levels[h];if(f.loadError++,A){var d=this.retryLoadingOrFail(p);if(d)p.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var a=f.url.length;if(a>1&&f.loadError<a)p.levelRetry=!0,this.redundantFailover(h);else if(this.manualLevelIndex===-1){var y=h===0?this._levels.length-1:h-1;this.currentLevelIndex!==y&&this._levels[y].loadError===0&&(this.warn(c+": switch to "+y),p.levelRetry=!0,this.hls.nextAutoLevel=y)}}},l.redundantFailover=function(p){var h=this._levels[p],A=h.url.length;if(A>1){var b=(h.urlId+1)%A;this.warn("Switching to redundant URL-id "+b),this._levels.forEach(function(c){c.urlId=b}),this.level=p}},l.onFragLoaded=function(p,h){var A=h.frag;if(A!==void 0&&A.type===D.PlaylistLevelType.MAIN){var b=this._levels[A.level];b!==void 0&&(b.fragmentError=0,b.loadError=0)}},l.onLevelLoaded=function(p,h){var A,b=h.level,c=h.details,f=this._levels[b];if(!f){var d;this.warn("Invalid level index "+b),(d=h.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(c.deltaUpdateFailed=!0);return}b===this.currentLevelIndex?(f.fragmentError===0&&(f.loadError=0,this.retryCount=0),this.playlistLoaded(b,h,f.details)):(A=h.deliveryDirectives)!==null&&A!==void 0&&A.skip&&(c.deltaUpdateFailed=!0)},l.onAudioTrackSwitched=function(p,h){var A=this.hls.levels[this.currentLevelIndex];if(!A)return;if(A.audioGroupIds){for(var b=-1,c=this.hls.audioTracks[h.id].groupId,f=0;f<A.audioGroupIds.length;f++)if(A.audioGroupIds[f]===c){b=f;break}b!==A.urlId&&(A.urlId=b,this.startLoad())}},l.loadPlaylist=function(p){var h=this.currentLevelIndex,A=this._levels[h];if(this.canLoad&&A&&A.url.length>0){var b=A.urlId,c=A.url[b];if(p)try{c=p.addDirectives(c)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Attempt loading level index "+h+(p?" at sn "+p.msn+" part "+p.part:"")+" with URL-id "+b+" "+c),this.clearTimer(),this.hls.trigger(I.Events.LEVEL_LOADING,{url:c,level:h,id:b,deliveryDirectives:p||null})}},l.removeLevel=function(p,h){var A=function(f,d){return d!==h},b=this._levels.filter(function(c,f){return f!==p?!0:c.url.length>1&&h!==void 0?(c.url=c.url.filter(A),c.audioGroupIds&&(c.audioGroupIds=c.audioGroupIds.filter(A)),c.textGroupIds&&(c.textGroupIds=c.textGroupIds.filter(A)),c.urlId=0,!0):!1}).map(function(c,f){var d=c.details;return d!=null&&d.fragments&&d.fragments.forEach(function(a){a.level=f}),c});this._levels=b,this.hls.trigger(I.Events.LEVELS_UPDATED,{levels:b})},R(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(p){var h,A=this._levels;if(A.length===0)return;if(this.currentLevelIndex===p&&(h=A[p])!==null&&h!==void 0&&h.details)return;if(p<0||p>=A.length){var b=p<0;if(this.hls.trigger(I.Events.ERROR,{type:_.ErrorTypes.OTHER_ERROR,details:_.ErrorDetails.LEVEL_SWITCH_ERROR,level:p,fatal:b,reason:"invalid level idx"}),b)return;p=Math.min(p,A.length-1)}this.clearTimer();var c=this.currentLevelIndex,f=A[c],d=A[p];this.log("switching to level "+p+" from "+c),this.currentLevelIndex=p;var a=g({},d,{level:p,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete a._urlId,this.hls.trigger(I.Events.LEVEL_SWITCHING,a);var y=d.details;if(!y||y.live){var m=this.switchParams(d.uri,f==null?void 0:f.details);this.loadPlaylist(m)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(p){this.manualLevelIndex=p,this._startLevel===void 0&&(this._startLevel=p),p!==-1&&(this.level=p)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(p){this._firstLevel=p}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var p=this.hls.config.startLevel;return p!==void 0?p:this._firstLevel}else return this._startLevel},set:function(p){this._startLevel=p}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(p){this.level=p,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=p)}}]),s}(M.default)},"./src/controller/level-helper.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"addGroupId",function(){return _}),L.d(G,"assignTrackIdsByGroup",function(){return B}),L.d(G,"updatePTS",function(){return F}),L.d(G,"updateFragPTSDTS",function(){return D}),L.d(G,"mergeDetails",function(){return g}),L.d(G,"mapPartIntersection",function(){return T}),L.d(G,"mapFragmentIntersection",function(){return R}),L.d(G,"adjustSliding",function(){return C}),L.d(G,"addSliding",function(){return w}),L.d(G,"computeReloadInterval",function(){return v}),L.d(G,"getFragmentWithSN",function(){return u}),L.d(G,"getPartWith",function(){return o});var z=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts");function _(s,l,S){switch(l){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(S);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(S);break}}function B(s){var l={};s.forEach(function(S){var p=S.groupId||"";S.id=l[p]=l[p]||0,l[p]++})}function F(s,l,S){var p=s[l],h=s[S];M(p,h)}function M(s,l){var S=l.startPTS;if(Object(z.isFiniteNumber)(S)){var p=0,h;l.sn>s.sn?(p=S-s.start,h=s):(p=s.start-S,h=l),h.duration!==p&&(h.duration=p)}else if(l.sn>s.sn){var A=s.cc===l.cc;A&&s.minEndPTS?l.start=s.start+(s.minEndPTS-s.start):l.start=s.start+s.duration}else l.start=Math.max(s.start-l.duration,0)}function D(s,l,S,p,h,A){var b=p-S;b<=0&&(I.logger.warn("Fragment should have a positive duration",l),p=S+l.duration,A=h+l.duration);var c=S,f=p,d=l.startPTS,a=l.endPTS;if(Object(z.isFiniteNumber)(d)){var y=Math.abs(d-S);Object(z.isFiniteNumber)(l.deltaPTS)?l.deltaPTS=Math.max(y,l.deltaPTS):l.deltaPTS=y,c=Math.max(S,d),S=Math.min(S,d),h=Math.min(h,l.startDTS),f=Math.min(p,a),p=Math.max(p,a),A=Math.max(A,l.endDTS)}l.duration=p-S;var m=S-l.start;l.appendedPTS=p,l.start=l.startPTS=S,l.maxStartPTS=c,l.startDTS=h,l.endPTS=p,l.minEndPTS=f,l.endDTS=A;var x=l.sn;if(!s||x<s.startSN||x>s.endSN)return 0;var P,U=x-s.startSN,j=s.fragments;for(j[U]=l,P=U;P>0;P--)M(j[P],j[P-1]);for(P=U;P<j.length-1;P++)M(j[P],j[P+1]);return s.fragmentHint&&M(j[j.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,m}function g(s,l){for(var S=null,p=s.fragments,h=p.length-1;h>=0;h--){var A=p[h].initSegment;if(A){S=A;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var b=0,c;if(R(s,l,function(P,U){P.relurl&&(b=P.cc-U.cc),Object(z.isFiniteNumber)(P.startPTS)&&Object(z.isFiniteNumber)(P.endPTS)&&(U.start=U.startPTS=P.startPTS,U.startDTS=P.startDTS,U.appendedPTS=P.appendedPTS,U.maxStartPTS=P.maxStartPTS,U.endPTS=P.endPTS,U.endDTS=P.endDTS,U.minEndPTS=P.minEndPTS,U.duration=P.endPTS-P.startPTS,U.duration&&(c=U),l.PTSKnown=l.alignedSliding=!0),U.elementaryStreams=P.elementaryStreams,U.loader=P.loader,U.stats=P.stats,U.urlId=P.urlId,P.initSegment&&(U.initSegment=P.initSegment,S=P.initSegment)}),S){var f=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments;f.forEach(function(P){var U;(!P.initSegment||P.initSegment.relurl===((U=S)===null||U===void 0?void 0:U.relurl))&&(P.initSegment=S)})}if(l.skippedSegments&&(l.deltaUpdateFailed=l.fragments.some(function(P){return!P}),l.deltaUpdateFailed)){I.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var d=l.skippedSegments;d--;)l.fragments.shift();l.startSN=l.fragments[0].sn,l.startCC=l.fragments[0].cc}var a=l.fragments;if(b){I.logger.warn("discontinuity sliding from playlist, take drift into account");for(var y=0;y<a.length;y++)a[y].cc+=b}l.skippedSegments&&(l.startCC=l.fragments[0].cc),T(s.partList,l.partList,function(P,U){U.elementaryStreams=P.elementaryStreams,U.stats=P.stats}),c?D(l,c,c.startPTS,c.endPTS,c.startDTS,c.endDTS):C(s,l),a.length&&(l.totalduration=l.edge-a[0].start),l.driftStartTime=s.driftStartTime,l.driftStart=s.driftStart;var m=l.advancedDateTime;if(l.advanced&&m){var x=l.edge;l.driftStart||(l.driftStartTime=m,l.driftStart=x),l.driftEndTime=m,l.driftEnd=x}else l.driftEndTime=s.driftEndTime,l.driftEnd=s.driftEnd,l.advancedDateTime=s.advancedDateTime}function T(s,l,S){if(s&&l)for(var p=0,h=0,A=s.length;h<=A;h++){var b=s[h],c=l[h+p];b&&c&&b.index===c.index&&b.fragment.sn===c.fragment.sn?S(b,c):p--}}function R(s,l,S){for(var p=l.skippedSegments,h=Math.max(s.startSN,l.startSN)-l.startSN,A=(s.fragmentHint?1:0)+(p?l.endSN:Math.min(s.endSN,l.endSN))-l.startSN,b=l.startSN-s.startSN,c=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,f=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,d=h;d<=A;d++){var a=f[b+d],y=c[d];p&&!y&&d<p&&(y=l.fragments[d]=a),a&&y&&S(a,y)}}function C(s,l){var S=l.startSN+l.skippedSegments-s.startSN,p=s.fragments;if(S<0||S>=p.length)return;w(l,p[S].start)}function w(s,l){if(l){for(var S=s.fragments,p=s.skippedSegments;p<S.length;p++)S[p].start+=l;s.fragmentHint&&(s.fragmentHint.start+=l)}}function v(s,l){var S=1e3*s.levelTargetDuration,p=S/2,h=s.age,A=h>0&&h<S*3,b=l.loading.end-l.loading.start,c,f=s.availabilityDelay;if(s.updated===!1)if(A){var d=333*s.misses;c=Math.max(Math.min(p,b*2),d),s.availabilityDelay=(s.availabilityDelay||0)+c}else c=p;else A?(f=Math.min(f||S/2,h),s.availabilityDelay=f,c=f+S-h):c=S-b;return Math.round(c)}function u(s,l,S){if(!s||!s.details)return null;var p=s.details,h=p.fragments[l-p.startSN];return h||(h=p.fragmentHint,h&&h.sn===l?h:l<p.startSN&&S&&S.sn===l?S:null)}function o(s,l,S){if(!s||!s.details)return null;var p=s.details.partList;if(p)for(var h=p.length;h--;){var A=p[h];if(A.index===S&&A.fragment.sn===l)return A}return null}},"./src/controller/stream-controller.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return p});var z=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),_=L("./src/is-supported.ts"),B=L("./src/events.ts"),F=L("./src/utils/buffer-helper.ts"),M=L("./src/controller/fragment-tracker.ts"),D=L("./src/types/loader.ts"),g=L("./src/loader/fragment.ts"),T=L("./src/demux/transmuxer-interface.ts"),R=L("./src/types/transmuxer.ts"),C=L("./src/controller/gap-controller.ts"),w=L("./src/errors.ts"),v=L("./src/utils/logger.ts");function u(h,A){for(var b=0;b<A.length;b++){var c=A[b];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(h,c.key,c)}}function o(h,A,b){return A&&u(h.prototype,A),b&&u(h,b),h}function s(h,A){h.prototype=Object.create(A.prototype),h.prototype.constructor=h,l(h,A)}function l(h,A){return l=Object.setPrototypeOf||function(c,f){return c.__proto__=f,c},l(h,A)}var S=100,p=function(h){s(A,h);function A(c,f){var d;return d=h.call(this,c,f,"[stream-controller]")||this,d.audioCodecSwap=!1,d.gapController=null,d.level=-1,d._forceStartLoad=!1,d.altAudio=!1,d.audioOnly=!1,d.fragPlaying=null,d.onvplaying=null,d.onvseeked=null,d.fragLastKbps=0,d.stalled=!1,d.couldBacktrack=!1,d.audioCodecSwitch=!1,d.videoBuffer=null,d._registerListeners(),d}var b=A.prototype;return b._registerListeners=function(){var f=this.hls;f.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),f.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.on(B.Events.ERROR,this.onError,this),f.on(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(B.Events.BUFFER_CREATED,this.onBufferCreated,this),f.on(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.on(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var f=this.hls;f.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.off(B.Events.ERROR,this.onError,this),f.off(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(B.Events.BUFFER_CREATED,this.onBufferCreated,this),f.off(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.off(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(f){if(this.levels){var d=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(S),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var y=a.startLevel;y===-1&&(a.config.testBandwidth?(y=0,this.bitrateTest=!0):y=a.nextAutoLevel),this.level=a.nextLoadLevel=y,this.loadedmetadata=!1}d>0&&f===-1&&(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),f=d),this.state=I.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=f,this.tick()}else this._forceStartLoad=!0,this.state=I.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,h.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_LEVEL:{var f,d=this.levels,a=this.level,y=d==null||((f=d[a])===null||f===void 0)?void 0:f.details;if(y&&(!y.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(y))break;this.state=I.State.IDLE;break}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var m,x=self.performance.now(),P=this.retryDate;(!P||x>=P||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=I.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){h.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var f,d,a=this.hls,y=this.levelLastLoaded,m=this.levels,x=this.media,P=a.config,U=a.nextLoadLevel;if(y===null||!x&&(this.startFragRequested||!P.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[U])return;var j=m[U];this.level=a.nextLoadLevel=U;var W=j.details;if(!W||this.state===I.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==U){this.state=I.State.WAITING_LEVEL;return}var k=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:x,D.PlaylistLevelType.MAIN);if(k===null)return;var O=k.len,K=this.getMaxBufferLength(j.maxBitrate);if(O>=K)return;if(this._streamEnded(k,W)){var Y={};this.altAudio&&(Y.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,Y),this.state=I.State.ENDED;return}var q=k.end,ie=this.getNextFragment(q,W);if(this.couldBacktrack&&!this.fragPrevious&&ie&&ie.sn!=="initSegment"){var Te=ie.sn-W.startSN;Te>1&&(ie=W.fragments[Te-1],this.fragmentTracker.removeFragment(ie))}if(ie&&this.fragmentTracker.getState(ie)===M.FragmentState.OK&&this.nextLoadPosition>q){var ve=this.audioOnly&&!this.altAudio?g.ElementaryStreamTypes.AUDIO:g.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(x,ve,D.PlaylistLevelType.MAIN),ie=this.getNextFragment(this.nextLoadPosition,W)}if(!ie)return;ie.initSegment&&!ie.initSegment.data&&!this.bitrateTest&&(ie=ie.initSegment),((f=ie.decryptdata)===null||f===void 0?void 0:f.keyFormat)==="identity"&&!((d=ie.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(ie,W):this.loadFragment(ie,W,q)},b.loadFragment=function(f,d,a){var y,m=this.fragmentTracker.getState(f);if(this.fragCurrent=f,m===M.FragmentState.BACKTRACKED){var x=this.fragmentTracker.getBacktrackData(f);if(x){this._handleFragmentLoadProgress(x),this._handleFragmentLoadComplete(x);return}else m=M.FragmentState.NOT_LOADED}m===M.FragmentState.NOT_LOADED||m===M.FragmentState.PARTIAL?f.sn==="initSegment"?this._loadInitSegment(f):this.bitrateTest?(f.bitrateTest=!0,this.log("Fragment "+f.sn+" of level "+f.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(f)):(this.startFragRequested=!0,h.prototype.loadFragment.call(this,f,d,a)):m===M.FragmentState.APPENDING?this.reduceMaxBufferLength(f.duration)&&this.fragmentTracker.removeFragment(f):((y=this.media)===null||y===void 0?void 0:y.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(f){var d=this.fragmentTracker.getAppendedFrag(f,D.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},b.getBufferedFrag=function(f){return this.fragmentTracker.getBufferedFrag(f,D.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(f){return f?this.getBufferedFrag(f.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var f=this.levels,d=this.media;if(d!=null&&d.readyState){var a,y=this.getAppendedFrag(d.currentTime);if(y&&y.start>1&&this.flushMainBuffer(0,y.start-1),!d.paused&&f){var m=this.hls.nextLoadLevel,x=f[m],P=this.fragLastKbps;P&&this.fragCurrent?a=this.fragCurrent.duration*x.maxBitrate/(1e3*P)+1:a=0}else a=0;var U=this.getBufferedFrag(d.currentTime+a);if(U){var j=this.followingBufferedFrag(U);if(j){this.abortCurrentFrag();var W=j.maxStartPTS?j.maxStartPTS:j.start,k=j.duration,O=Math.max(U.end,W+Math.min(Math.max(k-this.config.maxFragLookUpTolerance,k*.5),k*.75));this.flushMainBuffer(O,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var f=this.fragCurrent;this.fragCurrent=null,f!=null&&f.loader&&f.loader.abort(),this.state===I.State.KEY_LOADING&&(this.state=I.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(f,d){h.prototype.flushMainBuffer.call(this,f,d,this.altAudio?"video":null)},b.onMediaAttached=function(f,d){h.prototype.onMediaAttached.call(this,f,d);var a=d.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new C.default(this.config,a,this.fragmentTracker,this.hls)},b.onMediaDetaching=function(){var f=this.media;f&&(f.removeEventListener("playing",this.onvplaying),f.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),h.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var f=this.media,d=f?f.currentTime:null;Object(z.isFiniteNumber)(d)&&this.log("Media seeked to "+d.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(B.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(f,d){var a=!1,y=!1,m;d.levels.forEach(function(x){m=x.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(a=!0),m.indexOf("mp4a.40.5")!==-1&&(y=!0))}),this.audioCodecSwitch=a&&y&&!Object(_.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=d.levels,this.startFragRequested=!1},b.onLevelLoading=function(f,d){var a=this.levels;if(!a||this.state!==I.State.IDLE)return;var y=a[d.level];(!y.details||y.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(y.details))&&(this.state=I.State.WAITING_LEVEL)},b.onLevelLoaded=function(f,d){var a,y=this.levels,m=d.level,x=d.details,P=x.totalduration;if(!y){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+x.startSN+","+x.endSN+"], cc ["+x.startCC+", "+x.endCC+"] duration:"+P);var U=this.fragCurrent;U&&(this.state===I.State.FRAG_LOADING||this.state===I.State.FRAG_LOADING_WAITING_RETRY)&&(U.level!==d.level&&U.loader&&(this.state=I.State.IDLE,U.loader.abort()));var j=y[m],W=0;if(x.live||(a=j.details)!==null&&a!==void 0&&a.live){if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed)return;W=this.alignPlaylists(x,j.details)}if(j.details=x,this.levelLastLoaded=m,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:x,level:m}),this.state===I.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(x))return;this.state=I.State.IDLE}this.startFragRequested?x.live&&this.synchronizeToLiveEdge(x):this.setStartPosition(x,W),this.tick()},b._handleFragmentLoadProgress=function(f){var d,a=f.frag,y=f.part,m=f.payload,x=this.levels;if(!x){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var P=x[a.level],U=P.details;if(!U){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var j=P.videoCodec,W=U.PTSKnown||!U.live,k=(d=a.initSegment)===null||d===void 0?void 0:d.data,O=this._getAudioCodec(P),K=this.transmuxer=this.transmuxer||new T.default(this.hls,D.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Y=y?y.index:-1,q=Y!==-1,ie=new R.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,m.byteLength,Y,q),Te=this.initPTS[a.cc];K.push(m,k,O,j,a,y,U.totalduration,W,ie,Te)},b.onAudioTrackSwitching=function(f,d){var a=this.altAudio,y=!!d.url,m=d.id;if(!y){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var x=this.fragCurrent;x!=null&&x.loader&&(this.log("Switching to main audio track, cancel main fragment load"),x.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var P=this.hls;a&&P.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),P.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:m})}},b.onAudioTrackSwitched=function(f,d){var a=d.id,y=!!this.hls.audioTracks[a].url;if(y){var m=this.videoBuffer;m&&this.mediaBuffer!==m&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=m)}this.altAudio=y,this.tick()},b.onBufferCreated=function(f,d){var a=d.tracks,y,m,x=!1;for(var P in a){var U=a[P];if(U.id==="main"){if(m=P,y=U,P==="video"){var j=a[P];j&&(this.videoBuffer=j.buffer)}}else x=!0}x&&y?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=y.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(f,d){var a=d.frag,y=d.part;if(a&&a.type!==D.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(y?" p: "+y.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===I.State.PARSED&&(this.state=I.State.IDLE);return}var m=y?y.stats:a.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,y)},b.onError=function(f,d){switch(d.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(D.PlaylistLevelType.MAIN,d);break;case w.ErrorDetails.LEVEL_LOAD_ERROR:case w.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==I.State.ERROR&&(d.fatal?(this.warn(""+d.details),this.state=I.State.ERROR):!d.levelRetry&&this.state===I.State.WAITING_LEVEL&&(this.state=I.State.IDLE));break;case w.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="main"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var a=!0,y=this.getFwdBufferInfo(this.media,D.PlaylistLevelType.MAIN);y&&y.len>.5&&(a=!this.reduceMaxBufferLength(y.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},b.checkBuffer=function(){var f=this.media,d=this.gapController;if(!f||!d||!f.readyState)return;var a=F.BufferHelper.getBuffered(f);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.poll(this.lastCurrentTime),this.lastCurrentTime=f.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=I.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(f,d){var a=d.type;if(a!==g.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var y=(a===g.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(y,a,D.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(f,d){this.levels=d.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var f=this.media,d=f.currentTime,a=this.startPosition;if(a>=0&&d<a){if(f.seeking){v.logger.log("could not seek to "+a+", already seeking at "+d);return}var y=F.BufferHelper.getBuffered(f),m=y.length?y.start(0):0,x=m-a;x>0&&(x<this.config.maxBufferHole||x<this.config.maxFragLookUpTolerance)&&(v.logger.log("adjusting start position by "+x+" to match buffer start"),a+=x,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+d),f.currentTime=a}},b._getAudioCodec=function(f){var d=this.config.defaultAudioCodec||f.audioCodec;return this.audioCodecSwap&&d&&(this.log("Swapping audio codec"),d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5"),d},b._loadBitrateTestFrag=function(f){var d=this;this._doFragLoad(f).then(function(a){var y=d.hls;if(!a||y.nextLoadLevel||d.fragContextChanged(f))return;d.fragLoadError=0,d.state=I.State.IDLE,d.startFragRequested=!1,d.bitrateTest=!1;var m=f.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),y.trigger(B.Events.FRAG_LOADED,a)})},b._handleTransmuxComplete=function(f){var d,a="main",y=this.hls,m=f.remuxResult,x=f.chunkMeta,P=this.getCurrentContext(x);if(!P){this.warn("The loading context changed while buffering fragment "+x.sn+" of level "+x.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(x.level);return}var U=P.frag,j=P.part,W=P.level,k=m.video,O=m.text,K=m.id3,Y=m.initSegment,q=this.altAudio?void 0:m.audio;if(this.fragContextChanged(U))return;if(this.state=I.State.PARSING,Y){Y.tracks&&(this._bufferInitSegment(W,Y.tracks,U,x),y.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:a,tracks:Y.tracks}));var ie=Y.initPTS,Te=Y.timescale;Object(z.isFiniteNumber)(ie)&&(this.initPTS[U.cc]=ie,y.trigger(B.Events.INIT_PTS_FOUND,{frag:U,id:a,initPTS:ie,timescale:Te}))}if(k&&m.independent!==!1){if(W.details){var ve=k.startPTS,ge=k.endPTS,he=k.startDTS,ce=k.endDTS;if(j)j.elementaryStreams[k.type]={startPTS:ve,endPTS:ge,startDTS:he,endDTS:ce};else if(k.firstKeyFrame&&k.independent&&(this.couldBacktrack=!0),k.dropped&&k.independent){var ae=this.getLoadPosition()+this.config.maxBufferHole;if(ae<ve){this.backtrack(U);return}U.setElementaryStreamInfo(k.type,U.start,ge,U.start,ce,!0)}U.setElementaryStreamInfo(k.type,ve,ge,he,ce),this.bufferFragmentData(k,U,j,x)}}else if(m.independent===!1){this.backtrack(U);return}if(q){var me=q.startPTS,J=q.endPTS,ne=q.startDTS,Z=q.endDTS;j&&(j.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:me,endPTS:J,startDTS:ne,endDTS:Z}),U.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,me,J,ne,Z),this.bufferFragmentData(q,U,j,x)}if(K!=null&&(d=K.samples)!==null&&d!==void 0&&d.length){var Ee={frag:U,id:a,samples:K.samples};y.trigger(B.Events.FRAG_PARSING_METADATA,Ee)}if(O){var Ae={frag:U,id:a,samples:O.samples};y.trigger(B.Events.FRAG_PARSING_USERDATA,Ae)}},b._bufferInitSegment=function(f,d,a,y){var m=this;if(this.state!==I.State.PARSING)return;this.audioOnly=!!d.audio&&!d.video,this.altAudio&&!this.audioOnly&&delete d.audio;var x=d.audio,P=d.video,U=d.audiovideo;if(x){var j=f.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),x.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(j="mp4a.40.5")),W.indexOf("android")!==-1&&x.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),f.audioCodec&&f.audioCodec!==j&&this.log('Swapping manifest audio codec "'+f.audioCodec+'" for "'+j+'"'),x.levelCodec=j,x.id="main",this.log("Init audio buffer, container:"+x.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(f.audioCodec||"")+"/"+x.codec+"]")}P&&(P.levelCodec=f.videoCodec,P.id="main",this.log("Init video buffer, container:"+P.container+", codecs[level/parsed]=["+(f.videoCodec||"")+"/"+P.codec+"]")),U&&this.log("Init audiovideo buffer, container:"+U.container+", codecs[level/parsed]=["+(f.attrs.CODECS||"")+"/"+U.codec+"]"),this.hls.trigger(B.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(k){var O=d[k],K=O.initSegment;K!=null&&K.byteLength&&m.hls.trigger(B.Events.BUFFER_APPENDING,{type:k,data:K,frag:a,part:null,chunkMeta:y,parent:a.type})}),this.tick()},b.backtrack=function(f){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(f);var d=this.fragmentTracker.backtrack(f);this.fragPrevious=null,this.nextLoadPosition=f.start,d?this.resetFragmentLoading(f):this.state=I.State.BACKTRACKING},b.checkFragmentChanged=function(){var f=this.media,d=null;if(f&&f.readyState>1&&f.seeking===!1){var a=f.currentTime;if(F.BufferHelper.isBuffered(f,a)?d=this.getAppendedFrag(a):F.BufferHelper.isBuffered(f,a+.1)&&(d=this.getAppendedFrag(a+.1)),d){var y=this.fragPlaying,m=d.level;(!y||d.sn!==y.sn||y.level!==m||d.urlId!==y.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:d}),(!y||y.level!==m)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=d)}}},o(A,[{key:"nextLevel",get:function(){var f=this.nextBufferedFrag;return f?f.level:-1}},{key:"currentLevel",get:function(){var f=this.media;if(f){var d=this.getAppendedFrag(f.currentTime);if(d)return d.level}return-1}},{key:"nextBufferedFrag",get:function(){var f=this.media;if(f){var d=this.getAppendedFrag(f.currentTime);return this.followingBufferedFrag(d)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),A}(I.default)},"./src/controller/subtitle-stream-controller.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"SubtitleStreamController",function(){return s});var z=L("./src/events.ts"),I=L("./src/utils/logger.ts"),_=L("./src/utils/buffer-helper.ts"),B=L("./src/controller/fragment-finders.ts"),F=L("./src/utils/discontinuities.ts"),M=L("./src/controller/level-helper.ts"),D=L("./src/controller/fragment-tracker.ts"),g=L("./src/controller/base-stream-controller.ts"),T=L("./src/types/loader.ts"),R=L("./src/types/level.ts");function C(l,S){for(var p=0;p<S.length;p++){var h=S[p];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(l,h.key,h)}}function w(l,S,p){return S&&C(l.prototype,S),p&&C(l,p),l}function v(l,S){l.prototype=Object.create(S.prototype),l.prototype.constructor=l,u(l,S)}function u(l,S){return u=Object.setPrototypeOf||function(h,A){return h.__proto__=A,h},u(l,S)}var o=500,s=function(l){v(S,l);function S(h,A){var b;return b=l.call(this,h,A,"[subtitle-stream-controller]")||this,b.levels=[],b.currentTrackId=-1,b.tracksBuffered=[],b.mainDetails=null,b._registerListeners(),b}var p=S.prototype;return p.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},p._registerListeners=function(){var A=this.hls;A.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.on(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.on(z.Events.ERROR,this.onError,this),A.on(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.on(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.on(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p._unregisterListeners=function(){var A=this.hls;A.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.off(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.off(z.Events.ERROR,this.onError,this),A.off(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.off(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.off(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p.startLoad=function(){this.stopLoad(),this.state=g.State.IDLE,this.setInterval(o),this.tick()},p.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},p.onLevelLoaded=function(A,b){this.mainDetails=b.details},p.onSubtitleFragProcessed=function(A,b){var c=b.frag,f=b.success;if(this.fragPrevious=c,this.state=g.State.IDLE,!f)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var a,y=c.start,m=0;m<d.length;m++)if(y>=d[m].start&&y<=d[m].end){a=d[m];break}var x=c.start+c.duration;a?a.end=x:(a={start:y,end:x},d.push(a)),this.fragmentTracker.fragBuffered(c)},p.onBufferFlushing=function(A,b){var c=b.startOffset,f=b.endOffset;if(c===0&&f!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,a=this.levels;if(!a.length||!a[d]||!a[d].details)return;var y=a[d].details,m=y.targetduration,x=f-m;if(x<=0)return;b.endOffsetSubtitles=Math.max(0,x),this.tracksBuffered.forEach(function(P){for(var U=0;U<P.length;){if(P[U].end<=x){P.shift();continue}else if(P[U].start<x)P[U].start=x;else break;U++}}),this.fragmentTracker.removeFragmentsInRange(c,x,T.PlaylistLevelType.SUBTITLE)}},p.onError=function(A,b){var c,f=b.frag;if(!f||f.type!==T.PlaylistLevelType.SUBTITLE)return;(c=this.fragCurrent)!==null&&c!==void 0&&c.loader&&this.fragCurrent.loader.abort(),this.state=g.State.IDLE},p.onSubtitleTracksUpdated=function(A,b){var c=this,f=b.subtitleTracks;this.tracksBuffered=[],this.levels=f.map(function(d){return new R.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){c.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},p.onSubtitleTrackSwitch=function(A,b){if(this.currentTrackId=b.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var c=this.levels[this.currentTrackId];c!=null&&c.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,c&&this.setInterval(o)},p.onSubtitleTrackLoaded=function(A,b){var c,f=b.details,d=b.id,a=this.currentTrackId,y=this.levels;if(!y.length)return;var m=y[a];if(d>=y.length||d!==a||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,f.live||(c=m.details)!==null&&c!==void 0&&c.live){var x=this.mainDetails;if(f.deltaUpdateFailed||!x)return;var P=x.fragments[0];if(!m.details)f.hasProgramDateTime&&x.hasProgramDateTime?Object(F.alignMediaPlaylistByPDT)(f,x):P&&Object(M.addSliding)(f,P.start);else{var U=this.alignPlaylists(f,m.details);U===0&&P&&Object(M.addSliding)(f,P.start)}}if(m.details=f,this.levelLastLoaded=d,this.tick(),f.live&&!this.fragCurrent&&this.media&&this.state===g.State.IDLE){var j=Object(B.findFragmentByPTS)(null,f.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},p._handleFragmentLoadComplete=function(A){var b=A.frag,c=A.payload,f=b.decryptdata,d=this.hls;if(this.fragContextChanged(b))return;if(c&&c.byteLength>0&&f&&f.key&&f.iv&&f.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(c),f.key.buffer,f.iv.buffer).then(function(y){var m=performance.now();d.trigger(z.Events.FRAG_DECRYPTED,{frag:b,payload:y,stats:{tstart:a,tdecrypt:m}})})}},p.doTick=function(){if(!this.media){this.state=g.State.IDLE;return}if(this.state===g.State.IDLE){var A,b=this.currentTrackId,c=this.levels;if(!c.length||!c[b]||!c[b].details)return;var f=c[b].details,d=f.targetduration,a=this.config,y=this.media,m=_.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,y.currentTime-d,a.maxBufferHole),x=m.end,P=m.len,U=this.getMaxBufferLength()+d;if(P>U)return;console.assert(f,"Subtitle track details are defined on idle subtitle stream controller tick");var j=f.fragments,W=j.length,k=f.edge,O,K=this.fragPrevious;if(x<k){var Y=a.maxFragLookUpTolerance;K&&f.hasProgramDateTime&&(O=Object(B.findFragmentByPDT)(j,K.endProgramDateTime,Y)),O||(O=Object(B.findFragmentByPTS)(K,j,x,Y),!O&&K&&K.start<j[0].start&&(O=j[0]))}else O=j[W-1];(A=O)!==null&&A!==void 0&&A.encrypted?(I.logger.log("Loading key for "+O.sn),this.state=g.State.KEY_LOADING,this.hls.trigger(z.Events.KEY_LOADING,{frag:O})):O&&this.fragmentTracker.getState(O)===D.FragmentState.NOT_LOADED&&this.loadFragment(O,f,x)}},p.loadFragment=function(A,b,c){this.fragCurrent=A,l.prototype.loadFragment.call(this,A,b,c)},w(S,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),S}(g.default)},"./src/controller/subtitle-track-controller.ts":function(te,G,L){"use strict";L.r(G);var z=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),_=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function F(C,w){for(var v=0;v<w.length;v++){var u=w[v];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(C,u.key,u)}}function M(C,w,v){return w&&F(C.prototype,w),v&&F(C,v),C}function D(C,w){C.prototype=Object.create(w.prototype),C.prototype.constructor=C,g(C,w)}function g(C,w){return g=Object.setPrototypeOf||function(u,o){return u.__proto__=o,u},g(C,w)}var T=function(C){D(w,C);function w(u){var o;return o=C.call(this,u,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var v=w.prototype;return v.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,C.prototype.destroy.call(this)},v.registerListeners=function(){var o=this.hls;o.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(z.Events.ERROR,this.onError,this)},v.unregisterListeners=function(){var o=this.hls;o.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(z.Events.ERROR,this.onError,this)},v.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)},v.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},v.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=R(this.media.textTracks);o.forEach(function(s){Object(I.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},v.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},v.onManifestParsed=function(o,s){this.tracks=s.subtitleTracks},v.onSubtitleTrackLoaded=function(o,s){var l=s.id,S=s.details,p=this.trackId,h=this.tracksInGroup[p];if(!h){this.warn("Invalid subtitle track id "+l);return}var A=h.details;h.details=s.details,this.log("subtitle track "+l+" loaded ["+S.startSN+"-"+S.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,s,A))},v.onLevelLoading=function(o,s){this.switchLevel(s.level)},v.onLevelSwitching=function(o,s){this.switchLevel(s.level)},v.switchLevel=function(o){var s=this.hls.levels[o];if(!(s!=null&&s.textGroupIds))return;var l=s.textGroupIds[s.urlId];if(this.groupId!==l){var S=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,p=this.tracks.filter(function(b){return!l||b.groupId===l});this.tracksInGroup=p;var h=this.findTrackId(S==null?void 0:S.name)||this.findTrackId();this.groupId=l;var A={subtitleTracks:p};this.log("Updating subtitle tracks, "+p.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(z.Events.SUBTITLE_TRACKS_UPDATED,A),h!==-1&&this.setSubtitleTrack(h,S)}},v.findTrackId=function(o){for(var s=this.tracksInGroup,l=0;l<s.length;l++){var S=s[l];if((!this.selectDefaultTrack||S.default)&&(!o||o===S.name))return S.id}return-1},v.onError=function(o,s){if(C.prototype.onError.call(this,o,s),s.fatal||!s.context)return;s.context.type===B.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},v.loadPlaylist=function(o){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var l=s.id,S=s.groupId,p=s.url;if(o)try{p=o.addDirectives(p)}catch(h){this.warn("Could not construct new URL with HLS Delivery Directives: "+h)}this.log("Loading subtitle playlist for id "+l),this.hls.trigger(z.Events.SUBTITLE_TRACK_LOADING,{url:p,id:l,groupId:S,deliveryDirectives:o||null})}},v.toggleTrackModes=function(o){var s=this,l=this.media,S=this.subtitleDisplay,p=this.trackId;if(!l)return;var h=R(l.textTracks),A=h.filter(function(f){return f.groupId===s.groupId});if(o===-1)[].slice.call(h).forEach(function(f){f.mode="disabled"});else{var b=A[p];b&&(b.mode="disabled")}var c=A[o];c&&(c.mode=S?"showing":"hidden")},v.setSubtitleTrack=function(o,s){var l,S=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(l=S[o])!==null&&l!==void 0&&l.details)||o<-1||o>=S.length)return;this.clearTimer();var p=S[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,p){var h=p.id,A=p.groupId,b=A===void 0?"":A,c=p.name,f=p.type,d=p.url;this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:h,groupId:b,name:c,type:f,url:d});var a=this.switchParams(p.url,s==null?void 0:s.details);this.loadPlaylist(a)}else this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:o})},v.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),l=0;l<s.length;l++)if(s[l].mode==="hidden")o=l;else if(s[l].mode==="showing"){o=l;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},M(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}(_.default);function R(C){for(var w=[],v=0;v<C.length;v++){var u=C[v];u.kind==="subtitles"&&u.label&&w.push(C[v])}return w}G.default=T},"./src/controller/timeline-controller.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"TimelineController",function(){return R});var z=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),_=L("./src/utils/cea-608-parser.ts"),B=L("./src/utils/output-filter.ts"),F=L("./src/utils/webvtt-parser.ts"),M=L("./src/utils/texttrack-utils.ts"),D=L("./src/utils/imsc1-ttml-parser.ts"),g=L("./src/types/loader.ts"),T=L("./src/utils/logger.ts"),R=function(){function u(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=v(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var l=new B.default(this,"textTrack1"),S=new B.default(this,"textTrack2"),p=new B.default(this,"textTrack3"),h=new B.default(this,"textTrack4");this.cea608Parser1=new _.default(1,l,S),this.cea608Parser2=new _.default(3,p,h)}s.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(I.Events.FRAG_LOADING,this.onFragLoading,this),s.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=u.prototype;return o.destroy=function(){var l=this.hls;l.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.off(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.off(I.Events.FRAG_LOADING,this.onFragLoading,this),l.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.off(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.off(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(l,S,p,h,A){for(var b=!1,c=A.length;c--;){var f=A[c],d=w(f[0],f[1],S,p);if(d>=0&&(f[0]=Math.min(f[0],S),f[1]=Math.max(f[1],p),b=!0,d/(p-S)>.5))return}if(b||A.push([S,p]),this.config.renderTextTracksNatively){var a=this.captionsTracks[l];this.Cues.newCue(a,S,p,h)}else{var y=this.Cues.newCue(null,S,p,h);this.hls.trigger(I.Events.CUES_PARSED,{type:"captions",cues:y,track:l})}},o.onInitPtsFound=function(l,S){var p=this,h=S.frag,A=S.id,b=S.initPTS,c=S.timescale,f=this.unparsedVttFrags;A==="main"&&(this.initPTS[h.cc]=b,this.timescale[h.cc]=c),f.length&&(this.unparsedVttFrags=[],f.forEach(function(d){p.onFragLoaded(I.Events.FRAG_LOADED,d)}))},o.getExistingTrack=function(l){var S=this.media;if(S)for(var p=0;p<S.textTracks.length;p++){var h=S.textTracks[p];if(h[l])return h}return null},o.createCaptionsTrack=function(l){this.config.renderTextTracksNatively?this.createNativeTrack(l):this.createNonNativeTrack(l)},o.createNativeTrack=function(l){if(this.captionsTracks[l])return;var S=this.captionsProperties,p=this.captionsTracks,h=this.media,A=S[l],b=A.label,c=A.languageCode,f=this.getExistingTrack(l);if(f)p[l]=f,Object(M.clearCurrentCues)(p[l]),Object(M.sendAddTrackEvent)(p[l],h);else{var d=this.createTextTrack("captions",b,c);d&&(d[l]=!0,p[l]=d)}},o.createNonNativeTrack=function(l){if(this.nonNativeCaptionsTracks[l])return;var S=this.captionsProperties[l];if(!S)return;var p=S.label,h={_id:l,label:p,kind:"captions",default:S.media?!!S.media.default:!1,closedCaptions:S.media};this.nonNativeCaptionsTracks[l]=h,this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[h]})},o.createTextTrack=function(l,S,p){var h=this.media;return h?h.addTextTrack(l,S,p):void 0},o.onMediaAttaching=function(l,S){this.media=S.media,this._cleanTracks()},o.onMediaDetaching=function(){var l=this.captionsTracks;Object.keys(l).forEach(function(S){Object(M.clearCurrentCues)(l[S]),delete l[S]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=v(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var l=this.media;if(!l)return;var S=l.textTracks;if(S)for(var p=0;p<S.length;p++)Object(M.clearCurrentCues)(S[p])},o.onSubtitleTracksUpdated=function(l,S){var p=this;this.textTracks=[];var h=S.subtitleTracks||[],A=h.some(function(d){return d.textCodec===D.IMSC1_CODEC});if(this.config.enableWebVTT||A&&this.config.enableIMSC1){var b=this.tracks&&h&&this.tracks.length===h.length;if(this.tracks=h||[],this.config.renderTextTracksNatively){var c=this.media?this.media.textTracks:[];this.tracks.forEach(function(d,a){var y;if(a<c.length){for(var m=null,x=0;x<c.length;x++)if(C(c[x],d)){m=c[x];break}m&&(y=m)}y?Object(M.clearCurrentCues)(y):(y=p.createTextTrack("subtitles",d.name,d.lang),y&&(y.mode="disabled")),y&&(y.groupId=d.groupId,p.textTracks.push(y))})}else if(!b&&this.tracks&&this.tracks.length){var f=this.tracks.map(function(d){return{label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}});this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:f})}}},o.onManifestLoaded=function(l,S){var p=this;this.config.enableCEA708Captions&&S.captions&&S.captions.forEach(function(h){var A=/(?:CC|SERVICE)([1-4])/.exec(h.instreamId);if(!A)return;var b="textTrack"+A[1],c=p.captionsProperties[b];if(!c)return;c.label=h.name,h.lang&&(c.languageCode=h.lang),c.media=h})},o.onFragLoading=function(l,S){var p=this.cea608Parser1,h=this.cea608Parser2,A=this.lastSn,b=this.lastPartIndex;if(!this.enabled||!(p&&h))return;if(S.frag.type===g.PlaylistLevelType.MAIN){var c,f,d=S.frag.sn,a=(c=S==null||((f=S.part)===null||f===void 0)?void 0:f.index)!=null?c:-1;d===A+1||d===A&&a===b+1||(p.reset(),h.reset()),this.lastSn=d,this.lastPartIndex=a}},o.onFragLoaded=function(l,S){var p=S.frag,h=S.payload,A=this.initPTS,b=this.unparsedVttFrags;if(p.type===g.PlaylistLevelType.SUBTITLE)if(h.byteLength){if(!Object(z.isFiniteNumber)(A[p.cc])){b.push(S),A.length&&this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Missing initial subtitle PTS")});return}var c=p.decryptdata;if(c==null||c.key==null||c.method!=="AES-128"){var f=this.tracks[p.level],d=this.vttCCs;d[p.cc]||(d[p.cc]={start:p.start,prevCC:this.prevCC,new:!0},this.prevCC=p.cc),f&&f.textCodec===D.IMSC1_CODEC?this._parseIMSC1(p,h):this._parseVTTs(p,h,d)}}else this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(l,S){var p=this,h=this.hls;Object(D.parseIMSC1)(S,this.initPTS[l.cc],this.timescale[l.cc],function(A){p._appendCues(A,l.level),h.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(A){T.logger.log("Failed to parse IMSC1: "+A),h.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:A})})},o._parseVTTs=function(l,S,p){var h=this,A=this.hls;Object(F.parseWebVTT)(S,this.initPTS[l.cc],this.timescale[l.cc],p,l.cc,l.start,function(b){h._appendCues(b,l.level),A.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(b){h._fallbackToIMSC1(l,S),T.logger.log("Failed to parse VTT cue: "+b),A.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:b})})},o._fallbackToIMSC1=function(l,S){var p=this,h=this.tracks[l.level];h.textCodec||Object(D.parseIMSC1)(S,this.initPTS[l.cc],this.timescale[l.cc],function(){h.textCodec=D.IMSC1_CODEC,p._parseIMSC1(l,S)},function(){h.textCodec="wvtt"})},o._appendCues=function(l,S){var p=this.hls;if(this.config.renderTextTracksNatively){var h=this.textTracks[S];if(h.mode==="disabled")return;l.forEach(function(c){return Object(M.addCueToTrack)(h,c)})}else{var A=this.tracks[S],b=A.default?"default":"subtitles"+S;p.trigger(I.Events.CUES_PARSED,{type:"subtitles",cues:l,track:b})}},o.onFragDecrypted=function(l,S){var p=S.frag;if(p.type===g.PlaylistLevelType.SUBTITLE){if(!Object(z.isFiniteNumber)(this.initPTS[p.cc])){this.unparsedVttFrags.push(S);return}this.onFragLoaded(I.Events.FRAG_LOADED,S)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(l,S){var p=this.cea608Parser1,h=this.cea608Parser2;if(!this.enabled||!(p&&h))return;for(var A=0;A<S.samples.length;A++){var b=S.samples[A].bytes;if(b){var c=this.extractCea608Data(b);p.addData(S.samples[A].pts,c[0]),h.addData(S.samples[A].pts,c[1])}}},o.onBufferFlushing=function(l,S){var p=S.startOffset,h=S.endOffset,A=S.endOffsetSubtitles,b=S.type,c=this.media;if(!c||c.currentTime<h)return;if(!b||b==="video"){var f=this.captionsTracks;Object.keys(f).forEach(function(a){return Object(M.removeCuesInRange)(f[a],p,h)})}if(this.config.renderTextTracksNatively&&(p===0&&A!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(a){return Object(M.removeCuesInRange)(d[a],p,A)})}},o.extractCea608Data=function(l){for(var S=l[0]&31,p=2,h=[[],[]],A=0;A<S;A++){var b=l[p++],c=127&l[p++],f=127&l[p++],d=(4&b)!==0,a=3&b;if(c===0&&f===0)continue;d&&((a===0||a===1)&&(h[a].push(c),h[a].push(f)))}return h},u}();function C(u,o){return u&&u.label===o.name&&!(u.textTrack1||u.textTrack2)}function w(u,o,s,l){return Math.min(o,l)-Math.max(u,s)}function v(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return z});var z=function(){function I(B,F){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=F}var _=I.prototype;return _.decrypt=function(F,M){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},M,F)},I}()},"./src/crypt/aes-decryptor.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"removePadding",function(){return I}),L.d(G,"default",function(){return _});var z=L("./src/utils/typed-array.ts");function I(B){var F=B.byteLength,M=F&&new DataView(B.buffer).getUint8(F-1);return M?Object(z.sliceUint8)(B,0,F-M):B}var _=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 F=B.prototype;return F.uint8ArrayToUint32Array_=function(D){for(var g=new DataView(D),T=new Uint32Array(4),R=0;R<4;R++)T[R]=g.getUint32(R*4);return T},F.initTable=function(){var D=this.sBox,g=this.invSBox,T=this.subMix,R=T[0],C=T[1],w=T[2],v=T[3],u=this.invSubMix,o=u[0],s=u[1],l=u[2],S=u[3],p=new Uint32Array(256),h=0,A=0,b=0;for(b=0;b<256;b++)b<128?p[b]=b<<1:p[b]=b<<1^283;for(b=0;b<256;b++){var c=A^A<<1^A<<2^A<<3^A<<4;c=c>>>8^c&255^99,D[h]=c,g[c]=h;var f=p[h],d=p[f],a=p[d],y=p[c]*257^c*16843008;R[h]=y<<24|y>>>8,C[h]=y<<16|y>>>16,w[h]=y<<8|y>>>24,v[h]=y,y=a*16843009^d*65537^f*257^h*16843008,o[c]=y<<24|y>>>8,s[c]=y<<16|y>>>16,l[c]=y<<8|y>>>24,S[c]=y,h?(h=f^p[p[p[a^f]]],A^=p[p[A]]):h=A=1}},F.expandKey=function(D){for(var g=this.uint8ArrayToUint32Array_(D),T=!0,R=0;R<g.length&&T;)T=g[R]===this.key[R],R++;if(T)return;this.key=g;var C=this.keySize=g.length;if(C!==4&&C!==6&&C!==8)throw new Error("Invalid aes key size="+C);var w=this.ksRows=(C+6+1)*4,v,u,o=this.keySchedule=new Uint32Array(w),s=this.invKeySchedule=new Uint32Array(w),l=this.sBox,S=this.rcon,p=this.invSubMix,h=p[0],A=p[1],b=p[2],c=p[3],f,d;for(v=0;v<w;v++){if(v<C){f=o[v]=g[v];continue}d=f,v%C===0?(d=d<<8|d>>>24,d=l[d>>>24]<<24|l[d>>>16&255]<<16|l[d>>>8&255]<<8|l[d&255],d^=S[v/C|0]<<24):C>6&&v%C===4&&(d=l[d>>>24]<<24|l[d>>>16&255]<<16|l[d>>>8&255]<<8|l[d&255]),o[v]=f=(o[v-C]^d)>>>0}for(u=0;u<w;u++)v=w-u,u&3?d=o[v]:d=o[v-4],u<4||v<=4?s[u]=d:s[u]=h[l[d>>>24]]^A[l[d>>>16&255]]^b[l[d>>>8&255]]^c[l[d&255]],s[u]=s[u]>>>0},F.networkToHostOrderSwap=function(D){return D<<24|(D&65280)<<8|(D&16711680)>>8|D>>>24},F.decrypt=function(D,g,T){for(var R=this.keySize+6,C=this.invKeySchedule,w=this.invSBox,v=this.invSubMix,u=v[0],o=v[1],s=v[2],l=v[3],S=this.uint8ArrayToUint32Array_(T),p=S[0],h=S[1],A=S[2],b=S[3],c=new Int32Array(D),f=new Int32Array(c.length),d,a,y,m,x,P,U,j,W,k,O,K,Y,q,ie=this.networkToHostOrderSwap;g<c.length;){for(W=ie(c[g]),k=ie(c[g+1]),O=ie(c[g+2]),K=ie(c[g+3]),x=W^C[0],P=K^C[1],U=O^C[2],j=k^C[3],Y=4,q=1;q<R;q++)d=u[x>>>24]^o[P>>16&255]^s[U>>8&255]^l[j&255]^C[Y],a=u[P>>>24]^o[U>>16&255]^s[j>>8&255]^l[x&255]^C[Y+1],y=u[U>>>24]^o[j>>16&255]^s[x>>8&255]^l[P&255]^C[Y+2],m=u[j>>>24]^o[x>>16&255]^s[P>>8&255]^l[U&255]^C[Y+3],x=d,P=a,U=y,j=m,Y=Y+4;d=w[x>>>24]<<24^w[P>>16&255]<<16^w[U>>8&255]<<8^w[j&255]^C[Y],a=w[P>>>24]<<24^w[U>>16&255]<<16^w[j>>8&255]<<8^w[x&255]^C[Y+1],y=w[U>>>24]<<24^w[j>>16&255]<<16^w[x>>8&255]<<8^w[P&255]^C[Y+2],m=w[j>>>24]<<24^w[x>>16&255]<<16^w[P>>8&255]<<8^w[U&255]^C[Y+3],f[g]=ie(d^p),f[g+1]=ie(m^h),f[g+2]=ie(y^A),f[g+3]=ie(a^b),p=W,h=k,A=O,b=K,g=g+4}return f.buffer},B}()},"./src/crypt/decrypter.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return g});var z=L("./src/crypt/aes-crypto.ts"),I=L("./src/crypt/fast-aes-key.ts"),_=L("./src/crypt/aes-decryptor.ts"),B=L("./src/utils/logger.ts"),F=L("./src/utils/mp4-tools.ts"),M=L("./src/utils/typed-array.ts"),D=16,g=function(){function T(C,w,v){var u=v===void 0?{}:v,o=u.removePKCS7Padding,s=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=C,this.config=w,this.removePKCS7Padding=s,s)try{var l=self.crypto;l&&(this.subtle=l.subtle||l.webkitSubtle)}catch(S){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var R=T.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 v=new Uint8Array(w);return this.reset(),this.removePKCS7Padding?Object(_.removePadding)(v):v},R.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},R.decrypt=function(w,v,u,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(w),v,u);var s=this.flush();s&&o(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(w),v,u).then(o)},R.softwareDecrypt=function(w,v,u){var o=this.currentIV,s=this.currentResult,l=this.remainderData;this.logOnce("JS AES decrypt"),l&&(w=Object(F.appendUint8Array)(l,w),this.remainderData=null);var S=this.getValidChunk(w);if(!S.length)return null;o&&(u=o);var p=this.softwareDecrypter;p||(p=this.softwareDecrypter=new _.default),p.expandKey(v);var h=s;return this.currentResult=p.decrypt(S.buffer,0,u),this.currentIV=Object(M.sliceUint8)(S,-16).buffer,h||null},R.webCryptoDecrypt=function(w,v,u){var o=this,s=this.subtle;return(this.key!==v||!this.fastAesKey)&&(this.key=v,this.fastAesKey=new I.default(s,v)),this.fastAesKey.expandKey().then(function(l){if(!s)return Promise.reject(new Error("web crypto not initialized"));var S=new z.default(s,u);return S.decrypt(w.buffer,l)}).catch(function(l){return o.onWebCryptoError(l,w,v,u)})},R.onWebCryptoError=function(w,v,u,o){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",w),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(v,u,o)},R.getValidChunk=function(w){var v=w,u=w.length-w.length%D;return u!==w.length&&(v=Object(M.sliceUint8)(w,0,u),this.remainderData=Object(M.sliceUint8)(w,u)),v},R.logOnce=function(w){if(!this.logEnabled)return;B.logger.log("[decrypter.ts]: "+w),this.logEnabled=!1},T}()},"./src/crypt/fast-aes-key.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return z});var z=function(){function I(B,F){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=F}var _=I.prototype;return _.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},I}()},"./src/demux/aacdemuxer.ts":function(te,G,L){"use strict";L.r(G);var z=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/adts.ts"),_=L("./src/utils/logger.ts"),B=L("./src/demux/id3.ts");function F(g,T){g.prototype=Object.create(T.prototype),g.prototype.constructor=g,M(g,T)}function M(g,T){return M=Object.setPrototypeOf||function(C,w){return C.__proto__=w,C},M(g,T)}var D=function(g){F(T,g);function T(C,w){var v;return v=g.call(this)||this,v.observer=void 0,v.config=void 0,v.observer=C,v.config=w,v}var R=T.prototype;return R.resetInitSegment=function(w,v,u){g.prototype.resetInitSegment.call(this,w,v,u),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:w,duration:u,inputTimeScale:9e4,dropped:0}},T.probe=function(w){if(!w)return!1;for(var v=B.getID3Data(w,0)||[],u=v.length,o=w.length;u<o;u++)if(I.probe(w,u))return _.logger.log("ADTS sync word found !"),!0;return!1},R.canParse=function(w,v){return I.canParse(w,v)},R.appendFrame=function(w,v,u){I.initTrackConfig(w,this.observer,v,u,w.manifestCodec);var o=I.appendFrame(w,v,u,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},T}(z.default);D.minProbeByteLength=9,G.default=D},"./src/demux/adts.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"getAudioConfig",function(){return B}),L.d(G,"isHeaderPattern",function(){return F}),L.d(G,"getHeaderLength",function(){return M}),L.d(G,"getFullFrameLength",function(){return D}),L.d(G,"canGetFrameLength",function(){return g}),L.d(G,"isHeader",function(){return T}),L.d(G,"canParse",function(){return R}),L.d(G,"probe",function(){return C}),L.d(G,"initTrackConfig",function(){return w}),L.d(G,"getFrameDuration",function(){return v}),L.d(G,"parseFrameHeader",function(){return u}),L.d(G,"appendFrame",function(){return o});var z=L("./src/utils/logger.ts"),I=L("./src/errors.ts"),_=L("./src/events.ts");function B(s,l,S,p){var h,A,b,c,f=navigator.userAgent.toLowerCase(),d=p,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];h=((l[S+2]&192)>>>6)+1;var y=(l[S+2]&60)>>>2;if(y>a.length-1){s.trigger(_.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+y});return}return b=(l[S+2]&1)<<2,b|=(l[S+3]&192)>>>6,z.logger.log("manifest codec:"+p+", ADTS type:"+h+", samplingIndex:"+y),/firefox/i.test(f)?y>=6?(h=5,c=new Array(4),A=y-3):(h=2,c=new Array(2),A=y):f.indexOf("android")!==-1?(h=2,c=new Array(2),A=y):(h=5,c=new Array(4),p&&(p.indexOf("mp4a.40.29")!==-1||p.indexOf("mp4a.40.5")!==-1)||!p&&y>=6?A=y-3:((p&&p.indexOf("mp4a.40.2")!==-1&&(y>=6&&b===1||/vivaldi/i.test(f))||!p&&b===1)&&(h=2,c=new Array(2)),A=y)),c[0]=h<<3,c[0]|=(y&14)>>1,c[1]|=(y&1)<<7,c[1]|=b<<3,h===5&&(c[1]|=(A&14)>>1,c[2]=(A&1)<<7,c[2]|=2<<2,c[3]=0),{config:c,samplerate:a[y],channelCount:b,codec:"mp4a.40."+h,manifestCodec:d}}function F(s,l){return s[l]===255&&(s[l+1]&246)===240}function M(s,l){return s[l+1]&1?7:9}function D(s,l){return(s[l+3]&3)<<11|s[l+4]<<3|(s[l+5]&224)>>>5}function g(s,l){return l+5<s.length}function T(s,l){return l+1<s.length&&F(s,l)}function R(s,l){return g(s,l)&&F(s,l)&&D(s,l)<=s.length-l}function C(s,l){if(T(s,l)){var S=M(s,l);if(l+S>=s.length)return!1;var p=D(s,l);if(p<=S)return!1;var h=l+p;return h===s.length||T(s,h)}return!1}function w(s,l,S,p,h){if(!s.samplerate){var A=B(l,S,p,h);if(!A)return;s.config=A.config,s.samplerate=A.samplerate,s.channelCount=A.channelCount,s.codec=A.codec,s.manifestCodec=A.manifestCodec,z.logger.log("parsed codec:"+s.codec+", rate:"+A.samplerate+", channels:"+A.channelCount)}}function v(s){return 1024*9e4/s}function u(s,l,S,p,h){var A=M(s,l),b=D(s,l);if(b-=A,b>0){var c=S+p*h;return{headerLength:A,frameLength:b,stamp:c}}}function o(s,l,S,p,h){var A=v(s.samplerate),b=u(l,S,p,h,A);if(b){var c=b.frameLength,f=b.headerLength,d=b.stamp,a=f+c,y=Math.max(0,S+a-l.length),m;y?(m=new Uint8Array(a-f),m.set(l.subarray(S+f,l.length),0)):m=l.subarray(S+f,S+a);var x={unit:m,pts:d};return y||s.samples.push(x),{sample:x,length:a,missing:y}}}},"./src/demux/base-audio-demuxer.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"initPTSFn",function(){return D});var z=L("./src/polyfills/number.ts"),I=L("./src/demux/id3.ts"),_=L("./src/demux/dummy-demuxed-track.ts"),B=L("./src/utils/mp4-tools.ts"),F=L("./src/utils/typed-array.ts"),M=function(){function g(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var T=g.prototype;return T.resetInitSegment=function(C,w,v){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},T.resetTimeStamp=function(){},T.resetContiguity=function(){},T.canParse=function(C,w){return!1},T.appendFrame=function(C,w,v){},T.demux=function(C,w){this.cachedData&&(C=Object(B.appendUint8Array)(this.cachedData,C),this.cachedData=null);var v=I.getID3Data(C,0),u=v?v.length:0,o,s,l=this._audioTrack,S=this._id3Track,p=v?I.getTimeStamp(v):void 0,h=C.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=D(p,w)),v&&v.length>0&&S.samples.push({pts:this.initPTS,dts:this.initPTS,data:v}),s=this.initPTS;u<h;){if(this.canParse(C,u)){var A=this.appendFrame(l,C,u);A?(this.frameIndex++,s=A.sample.pts,u+=A.length,o=u):u=h}else I.canParse(C,u)?(v=I.getID3Data(C,u),S.samples.push({pts:s,dts:s,data:v}),u+=v.length,o=u):u++;if(u===h&&o!==h){var b=Object(F.sliceUint8)(C,o);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,b):this.cachedData=b}}return{audioTrack:l,avcTrack:Object(_.dummyTrack)(),id3Track:S,textTrack:Object(_.dummyTrack)()}},T.demuxSampleAes=function(C,w,v){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},T.flush=function(C){var w=this.cachedData;return w&&(this.cachedData=null,this.demux(w,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(_.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(_.dummyTrack)()}},T.destroy=function(){},g}(),D=function(T,R){return Object(z.isFiniteNumber)(T)?T*90:R*9e4};G.default=M},"./src/demux/chunk-cache.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return z});var z=function(){function _(){this.chunks=[],this.dataLength=0}var B=_.prototype;return B.push=function(M){this.chunks.push(M),this.dataLength+=M.length},B.flush=function(){var M=this.chunks,D=this.dataLength,g;if(M.length)M.length===1?g=M[0]:g=I(M,D);else return new Uint8Array(0);return this.reset(),g},B.reset=function(){this.chunks.length=0,this.dataLength=0},_}();function I(_,B){for(var F=new Uint8Array(B),M=0,D=0;D<_.length;D++){var g=_[D];F.set(g,M),M+=g.length}return F}},"./src/demux/dummy-demuxed-track.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"dummyTrack",function(){return z});function z(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(te,G,L){"use strict";L.r(G);var z=L("./src/utils/logger.ts"),I=function(){function _(F){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=F,this.bytesAvailable=F.byteLength,this.word=0,this.bitsAvailable=0}var B=_.prototype;return B.loadWord=function(){var M=this.data,D=this.bytesAvailable,g=M.byteLength-D,T=new Uint8Array(4),R=Math.min(4,D);if(R===0)throw new Error("no bytes available");T.set(M.subarray(g,g+R)),this.word=new DataView(T.buffer).getUint32(0),this.bitsAvailable=R*8,this.bytesAvailable-=R},B.skipBits=function(M){var D;this.bitsAvailable>M?(this.word<<=M,this.bitsAvailable-=M):(M-=this.bitsAvailable,D=M>>3,M-=D>>3,this.bytesAvailable-=D,this.loadWord(),this.word<<=M,this.bitsAvailable-=M)},B.readBits=function(M){var D=Math.min(this.bitsAvailable,M),g=this.word>>>32-D;return M>32&&z.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=D,this.bitsAvailable>0?this.word<<=D:this.bytesAvailable>0&&this.loadWord(),D=M-D,D>0&&this.bitsAvailable?g<<D|this.readBits(D):g},B.skipLZ=function(){var M;for(M=0;M<this.bitsAvailable;++M)if((this.word&2147483648>>>M)!==0)return this.word<<=M,this.bitsAvailable-=M,M;return this.loadWord(),M+this.skipLZ()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var M=this.skipLZ();return this.readBits(M+1)-1},B.readEG=function(){var M=this.readUEG();return 1&M?1+M>>>1:-1*(M>>>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(M){for(var D=8,g=8,T,R=0;R<M;R++)g!==0&&(T=this.readEG(),g=(D+T+256)%256),D=g===0?D:g},B.readSPS=function(){var M=0,D=0,g=0,T=0,R,C,w,v=this.readUByte.bind(this),u=this.readBits.bind(this),o=this.readUEG.bind(this),s=this.readBoolean.bind(this),l=this.skipBits.bind(this),S=this.skipEG.bind(this),p=this.skipUEG.bind(this),h=this.skipScalingList.bind(this);v();var A=v();if(u(5),l(3),v(),p(),A===100||A===110||A===122||A===244||A===44||A===83||A===86||A===118||A===128){var b=o();if(b===3&&l(1),p(),p(),l(1),s())for(C=b!==3?8:12,w=0;w<C;w++)s()&&(w<6?h(16):h(64))}p();var c=o();if(c===0)o();else if(c===1)for(l(1),S(),S(),R=o(),w=0;w<R;w++)S();p(),l(1);var f=o(),d=o(),a=u(1);a===0&&l(1),l(1),s()&&(M=o(),D=o(),g=o(),T=o());var y=[1,1];if(s()&&s()){var m=v();switch(m){case 1:y=[1,1];break;case 2:y=[12,11];break;case 3:y=[10,11];break;case 4:y=[16,11];break;case 5:y=[40,33];break;case 6:y=[24,11];break;case 7:y=[20,11];break;case 8:y=[32,11];break;case 9:y=[80,33];break;case 10:y=[18,11];break;case 11:y=[15,11];break;case 12:y=[64,33];break;case 13:y=[160,99];break;case 14:y=[4,3];break;case 15:y=[3,2];break;case 16:y=[2,1];break;case 255:{y=[v()<<8|v(),v()<<8|v()];break}}}return{width:Math.ceil((f+1)*16-M*2-D*2),height:(2-a)*(d+1)*16-(a?2:4)*(g+T),pixelRatio:y}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},_}();G.default=I},"./src/demux/id3.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"isHeader",function(){return z}),L.d(G,"isFooter",function(){return I}),L.d(G,"getID3Data",function(){return _}),L.d(G,"canParse",function(){return F}),L.d(G,"getTimeStamp",function(){return M}),L.d(G,"isTimeStampFrame",function(){return D}),L.d(G,"getID3Frames",function(){return T}),L.d(G,"decodeFrame",function(){return R}),L.d(G,"utf8ArrayToStr",function(){return o}),L.d(G,"testables",function(){return s});var z=function(h,A){return A+10<=h.length&&(h[A]===73&&h[A+1]===68&&h[A+2]===51&&(h[A+3]<255&&h[A+4]<255&&(h[A+6]<128&&h[A+7]<128&&h[A+8]<128&&h[A+9]<128)))},I=function(h,A){return A+10<=h.length&&(h[A]===51&&h[A+1]===68&&h[A+2]===73&&(h[A+3]<255&&h[A+4]<255&&(h[A+6]<128&&h[A+7]<128&&h[A+8]<128&&h[A+9]<128)))},_=function(h,A){for(var b=A,c=0;z(h,A);){c+=10;var f=B(h,A+6);c+=f,I(h,A+10)&&(c+=10),A+=c}return c>0?h.subarray(b,b+c):void 0},B=function(h,A){var b=0;return b=(h[A]&127)<<21,b|=(h[A+1]&127)<<14,b|=(h[A+2]&127)<<7,b|=h[A+3]&127,b},F=function(h,A){return z(h,A)&&B(h,A+6)+10<=h.length-A},M=function(h){for(var A=T(h),b=0;b<A.length;b++){var c=A[b];if(D(c))return u(c)}return},D=function(h){return h&&h.key==="PRIV"&&h.info==="com.apple.streaming.transportStreamTimestamp"},g=function(h){var A=String.fromCharCode(h[0],h[1],h[2],h[3]),b=B(h,4),c=10;return{type:A,size:b,data:h.subarray(c,c+b)}},T=function(h){for(var A=0,b=[];z(h,A);){var c=B(h,A+6);A+=10;for(var f=A+c;A+8<f;){var d=g(h.subarray(A)),a=R(d);a&&b.push(a),A+=d.size+10}I(h,A)&&(A+=10)}return b},R=function(h){return h.type==="PRIV"?C(h):h.type[0]==="W"?v(h):w(h)},C=function(h){if(h.size<2)return;var A=o(h.data,!0),b=new Uint8Array(h.data.subarray(A.length+1));return{key:h.type,info:A,data:b.buffer}},w=function(h){if(h.size<2)return;if(h.type==="TXXX"){var A=1,b=o(h.data.subarray(A),!0);A+=b.length+1;var c=o(h.data.subarray(A));return{key:h.type,info:b,data:c}}var f=o(h.data.subarray(1));return{key:h.type,data:f}},v=function(h){if(h.type==="WXXX"){if(h.size<2)return;var A=1,b=o(h.data.subarray(A),!0);A+=b.length+1;var c=o(h.data.subarray(A));return{key:h.type,info:b,data:c}}var f=o(h.data);return{key:h.type,data:f}},u=function(h){if(h.data.byteLength===8){var A=new Uint8Array(h.data),b=A[3]&1,c=(A[4]<<23)+(A[5]<<15)+(A[6]<<7)+A[7];return c/=45,b&&(c+=4772185884e-2),Math.round(c)}return},o=function(h,A){A===void 0&&(A=!1);var b=S();if(b){var c=b.decode(h);if(A){var f=c.indexOf("\0");return f!==-1?c.substring(0,f):c}return c.replace(/\0/g,"")}for(var d=h.length,a,y,m,x="",P=0;P<d;){if(a=h[P++],a===0&&A)return x;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:x+=String.fromCharCode(a);break;case 12:case 13:y=h[P++],x+=String.fromCharCode((a&31)<<6|y&63);break;case 14:y=h[P++],m=h[P++],x+=String.fromCharCode((a&15)<<12|(y&63)<<6|(m&63)<<0);break;default:}}return x},s={decodeTextFrame:w},l;function S(){return!l&&typeof self.TextDecoder!="undefined"&&(l=new self.TextDecoder("utf-8")),l}},"./src/demux/mp3demuxer.ts":function(te,G,L){"use strict";L.r(G);var z=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/id3.ts"),_=L("./src/utils/logger.ts"),B=L("./src/demux/mpegaudio.ts");function F(g,T){g.prototype=Object.create(T.prototype),g.prototype.constructor=g,M(g,T)}function M(g,T){return M=Object.setPrototypeOf||function(C,w){return C.__proto__=w,C},M(g,T)}var D=function(g){F(T,g);function T(){return g.apply(this,arguments)||this}var R=T.prototype;return R.resetInitSegment=function(w,v,u){g.prototype.resetInitSegment.call(this,w,v,u),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:w,duration:u,inputTimeScale:9e4,dropped:0}},T.probe=function(w){if(!w)return!1;for(var v=I.getID3Data(w,0)||[],u=v.length,o=w.length;u<o;u++)if(B.probe(w,u))return _.logger.log("MPEG Audio sync word found !"),!0;return!1},R.canParse=function(w,v){return B.canParse(w,v)},R.appendFrame=function(w,v,u){return this.initPTS===null?void 0:B.appendFrame(w,v,u,this.initPTS,this.frameIndex)},T}(z.default);D.minProbeByteLength=4,G.default=D},"./src/demux/mp4demuxer.ts":function(te,G,L){"use strict";L.r(G);var z=L("./src/utils/mp4-tools.ts"),I=L("./src/demux/dummy-demuxed-track.ts"),_=function(){function B(M,D){this.remainderData=null,this.config=void 0,this.config=D}var F=B.prototype;return F.resetTimeStamp=function(){},F.resetInitSegment=function(){},F.resetContiguity=function(){},B.probe=function(D){return Object(z.findBox)({data:D,start:0,end:Math.min(D.length,16384)},["moof"]).length>0},F.demux=function(D){var g=D,T=Object(I.dummyTrack)();if(this.config.progressive){this.remainderData&&(g=Object(z.appendUint8Array)(this.remainderData,D));var R=Object(z.segmentValidRange)(g);this.remainderData=R.remainder,T.samples=R.valid||new Uint8Array}else T.samples=g;return{audioTrack:Object(I.dummyTrack)(),avcTrack:T,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},F.flush=function(){var D=Object(I.dummyTrack)();return D.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(I.dummyTrack)(),avcTrack:D,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},F.demuxSampleAes=function(D,g,T){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},F.destroy=function(){},B}();_.minProbeByteLength=1024,G.default=_},"./src/demux/mpegaudio.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"appendFrame",function(){return M}),L.d(G,"parseHeader",function(){return D}),L.d(G,"isHeaderPattern",function(){return g}),L.d(G,"isHeader",function(){return T}),L.d(G,"canParse",function(){return R}),L.d(G,"probe",function(){return C});var z=null,I=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],_=[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]],F=[0,1,1,4];function M(w,v,u,o,s){if(u+24>v.length)return;var l=D(v,u);if(l&&u+l.frameLength<=v.length){var S=l.samplesPerFrame*9e4/l.sampleRate,p=o+s*S,h={unit:v.subarray(u,u+l.frameLength),pts:p,dts:p};return w.config=[],w.channelCount=l.channelCount,w.samplerate=l.sampleRate,w.samples.push(h),{sample:h,length:l.frameLength,missing:0}}}function D(w,v){var u=w[v+1]>>3&3,o=w[v+1]>>1&3,s=w[v+2]>>4&15,l=w[v+2]>>2&3;if(u!==1&&s!==0&&s!==15&&l!==3){var S=w[v+2]>>1&1,p=w[v+3]>>6,h=u===3?3-o:o===3?3:4,A=I[h*14+s-1]*1e3,b=u===3?0:u===2?1:2,c=_[b*3+l],f=p===3?1:2,d=B[u][o],a=F[o],y=d*8*a,m=Math.floor(d*A/c+S)*a;if(z===null){var x=navigator.userAgent||"",P=x.match(/Chrome\/(\d+)/i);z=P?parseInt(P[1]):0}var U=!!z&&z<=87;return U&&o===2&&A>=224e3&&p===0&&(w[v+3]=w[v+3]|128),{sampleRate:c,channelCount:f,frameLength:m,samplesPerFrame:y}}}function g(w,v){return w[v]===255&&(w[v+1]&224)===224&&(w[v+1]&6)!==0}function T(w,v){return v+1<w.length&&g(w,v)}function R(w,v){var u=4;return g(w,v)&&u<=w.length-v}function C(w,v){if(v+1<w.length&&g(w,v)){var u=4,o=D(w,v),s=u;o!=null&&o.frameLength&&(s=o.frameLength);var l=v+s;return l===w.length||T(w,l)}return!1}},"./src/demux/sample-aes.ts":function(te,G,L){"use strict";L.r(G);var z=L("./src/crypt/decrypter.ts"),I=L("./src/demux/tsdemuxer.ts"),_=function(){function B(M,D,g){this.keyData=void 0,this.decrypter=void 0,this.keyData=g,this.decrypter=new z.default(M,D,{removePKCS7Padding:!1})}var F=B.prototype;return F.decryptBuffer=function(D,g){this.decrypter.decrypt(D,this.keyData.key.buffer,this.keyData.iv.buffer,g)},F.decryptAacSample=function(D,g,T,R){var C=D[g].unit,w=C.subarray(16,C.length-C.length%16),v=w.buffer.slice(w.byteOffset,w.byteOffset+w.length),u=this;this.decryptBuffer(v,function(o){var s=new Uint8Array(o);C.set(s,16),R||u.decryptAacSamples(D,g+1,T)})},F.decryptAacSamples=function(D,g,T){for(;;g++){if(g>=D.length){T();return}if(D[g].unit.length<32)continue;var R=this.decrypter.isSync();if(this.decryptAacSample(D,g,T,R),!R)return}},F.getAvcEncryptedData=function(D){for(var g=Math.floor((D.length-48)/160)*16+16,T=new Int8Array(g),R=0,C=32;C<=D.length-16;C+=160,R+=16)T.set(D.subarray(C,C+16),R);return T},F.getAvcDecryptedUnit=function(D,g){for(var T=new Uint8Array(g),R=0,C=32;C<=D.length-16;C+=160,R+=16)D.set(T.subarray(R,R+16),C);return D},F.decryptAvcSample=function(D,g,T,R,C,w){var v=Object(I.discardEPB)(C.data),u=this.getAvcEncryptedData(v),o=this;this.decryptBuffer(u.buffer,function(s){C.data=o.getAvcDecryptedUnit(v,s),w||o.decryptAvcSamples(D,g,T+1,R)})},F.decryptAvcSamples=function(D,g,T,R){if(D instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;g++,T=0){if(g>=D.length){R();return}for(var C=D[g].units;!(T>=C.length);T++){var w=C[T];if(w.data.length<=48||w.type!==1&&w.type!==5)continue;var v=this.decrypter.isSync();if(this.decryptAvcSample(D,g,T,R,w,v),!v)return}}},B}();G.default=_},"./src/demux/transmuxer-interface.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return C});var z=L("./node_modules/webworkify-webpack/index.js"),I=L.n(z),_=L("./src/events.ts"),B=L("./src/demux/transmuxer.ts"),F=L("./src/utils/logger.ts"),M=L("./src/errors.ts"),D=L("./src/utils/mediasource-helper.ts"),g=L("./node_modules/eventemitter3/index.js"),T=L.n(g),R=Object(D.getMediaSource)()||{isTypeSupported:function(){return!1}},C=function(){function w(u,o,s,l){var S=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=u,this.id=o,this.onTransmuxComplete=s,this.onFlush=l;var p=u.config,h=function(d,a){a=a||{},a.frag=S.frag,a.id=S.id,u.trigger(d,a)};this.observer=new g.EventEmitter,this.observer.on(_.Events.FRAG_DECRYPTED,h),this.observer.on(_.Events.ERROR,h);var A={mp4:R.isTypeSupported("video/mp4"),mpeg:R.isTypeSupported("audio/mpeg"),mp3:R.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(p.enableWorker&&typeof Worker!="undefined"){F.logger.log("demuxing in webworker");var c;try{c=this.worker=z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),c.addEventListener("message",this.onwmsg),c.onerror=function(f){u.trigger(_.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(f.message+" ("+f.filename+":"+f.lineno+")")})},c.postMessage({cmd:"init",typeSupported:A,vendor:b,id:o,config:JSON.stringify(p)})}catch(f){F.logger.warn("Error in worker:",f),F.logger.error("Error while initializing DemuxerWorker, fallback to inline"),c&&self.URL.revokeObjectURL(c.objectURL),this.transmuxer=new B.default(this.observer,A,p,b,o),this.worker=null}}else this.transmuxer=new B.default(this.observer,A,p,b,o)}var v=w.prototype;return v.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var l=this.observer;l&&l.removeAllListeners(),this.observer=null},v.push=function(o,s,l,S,p,h,A,b,c,f){var d=this;c.transmuxing.start=self.performance.now();var a=this.transmuxer,y=this.worker,m=h?h.start:p.start,x=p.decryptdata,P=this.frag,U=!(P&&p.cc===P.cc),j=!(P&&c.level===P.level),W=P?c.sn-P.sn:-1,k=this.part?c.part-this.part.index:1,O=!j&&(W===1||W===0&&k===1),K=self.performance.now();(j||W||p.stats.parsing.start===0)&&(p.stats.parsing.start=K),h&&(k||!O)&&(h.stats.parsing.start=K);var Y=new B.TransmuxState(U,O,b,j,m);if(!O||U){F.logger.log("[transmuxer-interface, "+p.type+"]: Starting new transmux session for sn: "+c.sn+" p: "+c.part+" level: "+c.level+" id: "+c.id+`
|
|
discontinuity: `+U+`
|
|
trackSwitch: `+j+`
|
|
contiguous: `+O+`
|
|
accurateTimeOffset: `+b+`
|
|
timeOffset: `+m);var q=new B.TransmuxConfig(l,S,s,A,f);this.configureTransmuxer(q)}if(this.frag=p,this.part=h,y)y.postMessage({cmd:"demux",data:o,decryptdata:x,chunkMeta:c,state:Y},o instanceof ArrayBuffer?[o]:[]);else if(a){var ie=a.push(o,x,c,Y);Object(B.isPromise)(ie)?ie.then(function(Te){d.handleTransmuxComplete(Te)}):this.handleTransmuxComplete(ie)}},v.flush=function(o){var s=this;o.transmuxing.start=self.performance.now();var l=this.transmuxer,S=this.worker;if(S)S.postMessage({cmd:"flush",chunkMeta:o});else if(l){var p=l.flush(o);Object(B.isPromise)(p)?p.then(function(h){s.handleFlushResult(h,o)}):this.handleFlushResult(p,o)}},v.handleFlushResult=function(o,s){var l=this;o.forEach(function(S){l.handleTransmuxComplete(S)}),this.onFlush(s)},v.onWorkerMessage=function(o){var s=o.data,l=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,l.trigger(s.event,s.data);break}}},v.configureTransmuxer=function(o){var s=this.worker,l=this.transmuxer;s?s.postMessage({cmd:"configure",config:o}):l&&l.configure(o)},v.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},w}()},"./src/demux/transmuxer-worker.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return M});var z=L("./src/demux/transmuxer.ts"),I=L("./src/events.ts"),_=L("./src/utils/logger.ts"),B=L("./node_modules/eventemitter3/index.js"),F=L.n(B);function M(C){var w=new B.EventEmitter,v=function(o,s){C.postMessage({event:o,data:s})};w.on(I.Events.FRAG_DECRYPTED,v),w.on(I.Events.ERROR,v),C.addEventListener("message",function(u){var o=u.data;switch(o.cmd){case"init":{var s=JSON.parse(o.config);C.transmuxer=new z.default(w,o.typeSupported,s,o.vendor,o.id),Object(_.enableLogs)(s.debug),v("init",null);break}case"configure":{C.transmuxer.configure(o.config);break}case"demux":{var l=C.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(z.isPromise)(l)?l.then(function(h){D(C,h)}):D(C,l);break}case"flush":{var S=o.chunkMeta,p=C.transmuxer.flush(S);Object(z.isPromise)(p)?p.then(function(h){T(C,h,S)}):T(C,p,S);break}default:break}})}function D(C,w){if(R(w.remuxResult))return;var v=[],u=w.remuxResult,o=u.audio,s=u.video;o&&g(v,o),s&&g(v,s),C.postMessage({event:"transmuxComplete",data:w},v)}function g(C,w){w.data1&&C.push(w.data1.buffer),w.data2&&C.push(w.data2.buffer)}function T(C,w,v){w.forEach(function(u){D(C,u)}),C.postMessage({event:"flush",data:v})}function R(C){return!C.audio&&!C.video&&!C.text&&!C.id3&&!C.initSegment}},"./src/demux/transmuxer.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return s}),L.d(G,"isPromise",function(){return p}),L.d(G,"TransmuxConfig",function(){return h}),L.d(G,"TransmuxState",function(){return A});var z=L("./src/events.ts"),I=L("./src/errors.ts"),_=L("./src/crypt/decrypter.ts"),B=L("./src/demux/aacdemuxer.ts"),F=L("./src/demux/mp4demuxer.ts"),M=L("./src/demux/tsdemuxer.ts"),D=L("./src/demux/mp3demuxer.ts"),g=L("./src/remux/mp4-remuxer.ts"),T=L("./src/remux/passthrough-remuxer.ts"),R=L("./src/demux/chunk-cache.ts"),C=L("./src/utils/mp4-tools.ts"),w=L("./src/utils/logger.ts"),v;try{v=self.performance.now.bind(self.performance)}catch(b){w.logger.debug("Unable to use Performance API on this environment"),v=self.Date.now}var u=[{demux:M.default,remux:g.default},{demux:F.default,remux:T.default},{demux:B.default,remux:g.default},{demux:D.default,remux:g.default}],o=1024;u.forEach(function(b){var c=b.demux;o=Math.max(o,c.minProbeByteLength)});var s=function(){function b(f,d,a,y,m){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new R.default,this.observer=f,this.typeSupported=d,this.config=a,this.vendor=y,this.id=m}var c=b.prototype;return c.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},c.push=function(d,a,y,m){var x=this,P=y.transmuxing;P.executeStart=v();var U=new Uint8Array(d),j=this.cache,W=this.config,k=this.currentTransmuxState,O=this.transmuxConfig;m&&(this.currentTransmuxState=m);var K=l(U,a);if(K&&K.method==="AES-128"){var Y=this.getDecrypter();if(W.enableSoftwareAES){var q=Y.softwareDecrypt(U,K.key.buffer,K.iv.buffer);if(!q)return P.executeEnd=v(),S(y);U=new Uint8Array(q)}else return this.decryptionPromise=Y.webCryptoDecrypt(U,K.key.buffer,K.iv.buffer).then(function(Se){var Re=x.push(Se,null,y);return x.decryptionPromise=null,Re}),this.decryptionPromise}var ie=m||k,Te=ie.contiguous,ve=ie.discontinuity,ge=ie.trackSwitch,he=ie.accurateTimeOffset,ce=ie.timeOffset,ae=O.audioCodec,me=O.videoCodec,J=O.defaultInitPts,ne=O.duration,Z=O.initSegmentData;if((ve||ge)&&this.resetInitSegment(Z,ae,me,ne),ve&&this.resetInitialTimestamp(J),Te||this.resetContiguity(),this.needsProbing(U,ve,ge)){if(j.dataLength){var Ee=j.flush();U=Object(C.appendUint8Array)(Ee,U)}this.configureTransmuxer(U,O)}var Ae=this.transmux(U,K,ce,he,y),be=this.currentTransmuxState;return be.contiguous=!0,be.discontinuity=!1,be.trackSwitch=!1,P.executeEnd=v(),Ae},c.flush=function(d){var a=this,y=d.transmuxing;y.executeStart=v();var m=this.decrypter,x=this.cache,P=this.currentTransmuxState,U=this.decryptionPromise;if(U)return U.then(function(){return a.flush(d)});var j=[],W=P.timeOffset;if(m){var k=m.flush();k&&j.push(this.push(k,null,d))}var O=x.dataLength;x.reset();var K=this.demuxer,Y=this.remuxer;if(!K||!Y)return O>=o&&this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),y.executeEnd=v(),[S(d)];var q=K.flush(W);return p(q)?q.then(function(ie){return a.flushRemux(j,ie,d),j}):(this.flushRemux(j,q,d),j)},c.flushRemux=function(d,a,y){var m=a.audioTrack,x=a.avcTrack,P=a.id3Track,U=a.textTrack,j=this.currentTransmuxState,W=j.accurateTimeOffset,k=j.timeOffset;w.logger.log("[transmuxer.ts]: Flushed fragment "+y.sn+(y.part>-1?" p: "+y.part:"")+" of level "+y.level);var O=this.remuxer.remux(m,x,P,U,k,W,!0,this.id);d.push({remuxResult:O,chunkMeta:y}),y.transmuxing.executeEnd=v()},c.resetInitialTimestamp=function(d){var a=this.demuxer,y=this.remuxer;if(!a||!y)return;a.resetTimeStamp(d),y.resetTimeStamp(d)},c.resetContiguity=function(){var d=this.demuxer,a=this.remuxer;if(!d||!a)return;d.resetContiguity(),a.resetNextTimestamp()},c.resetInitSegment=function(d,a,y,m){var x=this.demuxer,P=this.remuxer;if(!x||!P)return;x.resetInitSegment(a,y,m),P.resetInitSegment(d,a,y)},c.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},c.transmux=function(d,a,y,m,x){var P;return a&&a.method==="SAMPLE-AES"?P=this.transmuxSampleAes(d,a,y,m,x):P=this.transmuxUnencrypted(d,y,m,x),P},c.transmuxUnencrypted=function(d,a,y,m){var x=this.demuxer.demux(d,a,!1,!this.config.progressive),P=x.audioTrack,U=x.avcTrack,j=x.id3Track,W=x.textTrack,k=this.remuxer.remux(P,U,j,W,a,y,!1,this.id);return{remuxResult:k,chunkMeta:m}},c.transmuxSampleAes=function(d,a,y,m,x){var P=this;return this.demuxer.demuxSampleAes(d,a,y).then(function(U){var j=P.remuxer.remux(U.audioTrack,U.avcTrack,U.id3Track,U.textTrack,y,m,!1,P.id);return{remuxResult:j,chunkMeta:x}})},c.configureTransmuxer=function(d,a){for(var y=this.config,m=this.observer,x=this.typeSupported,P=this.vendor,U=a.audioCodec,j=a.defaultInitPts,W=a.duration,k=a.initSegmentData,O=a.videoCodec,K,Y=0,q=u.length;Y<q;Y++)if(u[Y].demux.probe(d)){K=u[Y];break}K||(w.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),K={demux:F.default,remux:T.default});var ie=this.demuxer,Te=this.remuxer,ve=K.remux,ge=K.demux;(!Te||!(Te instanceof ve))&&(this.remuxer=new ve(m,y,x,P)),(!ie||!(ie instanceof ge))&&(this.demuxer=new ge(m,y,x),this.probe=ge.probe),this.resetInitSegment(k,U,O,W),this.resetInitialTimestamp(j)},c.needsProbing=function(d,a,y){return!this.demuxer||!this.remuxer||a||y},c.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new _.default(this.observer,this.config)),d},b}();function l(b,c){var f=null;return b.byteLength>0&&c!=null&&c.key!=null&&c.iv!==null&&c.method!=null&&(f=c),f}var S=function(c){return{remuxResult:{},chunkMeta:c}};function p(b){return"then"in b&&b.then instanceof Function}var h=function(c,f,d,a,y){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=c,this.videoCodec=f,this.initSegmentData=d,this.duration=a,this.defaultInitPts=y},A=function(c,f,d,a,y){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=c,this.contiguous=f,this.accurateTimeOffset=d,this.trackSwitch=a,this.timeOffset=y}},"./src/demux/tsdemuxer.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"discardEPB",function(){return S});var z=L("./src/demux/adts.ts"),I=L("./src/demux/mpegaudio.ts"),_=L("./src/demux/exp-golomb.ts"),B=L("./src/demux/id3.ts"),F=L("./src/demux/sample-aes.ts"),M=L("./src/events.ts"),D=L("./src/utils/mp4-tools.ts"),g=L("./src/utils/logger.ts"),T=L("./src/errors.ts"),R={video:1,audio:2,id3:3,text:4},C=function(){function p(A,b,c){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=A,this.config=b,this.typeSupported=c}p.probe=function(b){var c=p.syncOffset(b);return c<0?!1:(c&&g.logger.warn("MPEG2-TS detected but first sync word found @ offset "+c+", junk ahead ?"),!0)},p.syncOffset=function(b){for(var c=Math.min(1e3,b.length-3*188),f=0;f<c;){if(b[f]===71&&b[f+188]===71&&b[f+2*188]===71)return f;f++}return-1},p.createTrack=function(b,c){return{container:b==="video"||b==="audio"?"video/mp2t":void 0,type:b,id:R[b],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:b==="audio"?c:void 0}};var h=p.prototype;return h.resetInitSegment=function(b,c,f){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=p.createTrack("video",f),this._audioTrack=p.createTrack("audio",f),this._id3Track=p.createTrack("id3",f),this._txtTrack=p.createTrack("text",f),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=b,this.videoCodec=c,this._duration=f},h.resetTimeStamp=function(){},h.resetContiguity=function(){var b=this._audioTrack,c=this._avcTrack,f=this._id3Track;b&&(b.pesData=null),c&&(c.pesData=null),f&&(f.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},h.demux=function(b,c,f,d){f===void 0&&(f=!1),d===void 0&&(d=!1),f||(this.sampleAes=null);var a,y=this._avcTrack,m=this._audioTrack,x=this._id3Track,P=y.pid,U=y.pesData,j=m.pid,W=x.pid,k=m.pesData,O=x.pesData,K=!1,Y=this.pmtParsed,q=this._pmtId,ie=b.length;if(this.remainderData&&(b=Object(D.appendUint8Array)(this.remainderData,b),ie=b.length,this.remainderData=null),ie<188&&!d)return this.remainderData=b,{audioTrack:m,avcTrack:y,id3Track:x,textTrack:this._txtTrack};var Te=Math.max(0,p.syncOffset(b));ie-=(ie+Te)%188,ie<b.byteLength&&!d&&(this.remainderData=new Uint8Array(b.buffer,ie,b.buffer.byteLength-ie));for(var ve=Te;ve<ie;ve+=188)if(b[ve]===71){var ge=!!(b[ve+1]&64),he=((b[ve+1]&31)<<8)+b[ve+2],ce=(b[ve+3]&48)>>4,ae=void 0;if(ce>1){if(ae=ve+5+b[ve+4],ae===ve+188)continue}else ae=ve+4;switch(he){case P:ge&&(U&&(a=o(U))&&this.parseAVCPES(a,!1),U={data:[],size:0}),U&&(U.data.push(b.subarray(ae,ve+188)),U.size+=ve+188-ae);break;case j:ge&&(k&&(a=o(k))&&(m.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),k={data:[],size:0}),k&&(k.data.push(b.subarray(ae,ve+188)),k.size+=ve+188-ae);break;case W:ge&&(O&&(a=o(O))&&this.parseID3PES(a),O={data:[],size:0}),O&&(O.data.push(b.subarray(ae,ve+188)),O.size+=ve+188-ae);break;case 0:ge&&(ae+=b[ae]+1),q=this._pmtId=v(b,ae);break;case q:{ge&&(ae+=b[ae]+1);var me=u(b,ae,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,f);P=me.avc,P>0&&(y.pid=P),j=me.audio,j>0&&(m.pid=j,m.isAAC=me.isAAC),W=me.id3,W>0&&(x.pid=W),K&&!Y&&(g.logger.log("reparse from beginning"),K=!1,ve=Te-188),Y=this.pmtParsed=!0;break}case 17:case 8191:break;default:K=!0;break}}else this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});y.pesData=U,m.pesData=k,x.pesData=O;var J={audioTrack:m,avcTrack:y,id3Track:x,textTrack:this._txtTrack};return d&&this.extractRemainingSamples(J),J},h.flush=function(){var b=this.remainderData;this.remainderData=null;var c;return b?c=this.demux(b,-1,!1,!0):c={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(c),this.sampleAes?this.decrypt(c,this.sampleAes):c},h.extractRemainingSamples=function(b){var c=b.audioTrack,f=b.avcTrack,d=b.id3Track,a=f.pesData,y=c.pesData,m=d.pesData,x;a&&(x=o(a))?(this.parseAVCPES(x,!0),f.pesData=null):f.pesData=a,y&&(x=o(y))?(c.isAAC?this.parseAACPES(x):this.parseMPEGPES(x),c.pesData=null):(y!=null&&y.size&&g.logger.log("last AAC PES packet truncated,might overlap between fragments"),c.pesData=y),m&&(x=o(m))?(this.parseID3PES(x),d.pesData=null):d.pesData=m},h.demuxSampleAes=function(b,c,f){var d=this.demux(b,f,!0,!this.config.progressive),a=this.sampleAes=new F.default(this.observer,this.config,c);return this.decrypt(d,a)},h.decrypt=function(b,c){return new Promise(function(f){var d=b.audioTrack,a=b.avcTrack;d.samples&&d.isAAC?c.decryptAacSamples(d.samples,0,function(){a.samples?c.decryptAvcSamples(a.samples,0,0,function(){f(b)}):f(b)}):a.samples&&c.decryptAvcSamples(a.samples,0,0,function(){f(b)})})},h.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},h.parseAVCPES=function(b,c){var f=this,d=this._avcTrack,a=this.parseAVCNALu(b.data),y=!1,m=this.avcSample,x,P=!1;b.data=null,m&&a.length&&!d.audFound&&(s(m,d),m=this.avcSample=w(!1,b.pts,b.dts,"")),a.forEach(function(U){switch(U.type){case 1:{x=!0,m||(m=f.avcSample=w(!0,b.pts,b.dts,"")),y&&(m.debug+="NDR "),m.frame=!0;var j=U.data;if(P&&j.length>4){var W=new _.default(j).readSliceType();(W===2||W===4||W===7||W===9)&&(m.key=!0)}break}case 5:x=!0,m||(m=f.avcSample=w(!0,b.pts,b.dts,"")),y&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{x=!0,y&&m&&(m.debug+="SEI ");var k=new _.default(S(U.data));k.readUByte();for(var O=0,K=0,Y=!1,q=0;!Y&&k.bytesAvailable>1;){O=0;do q=k.readUByte(),O+=q;while(q===255);K=0;do q=k.readUByte(),K+=q;while(q===255);if(O===4&&k.bytesAvailable!==0){Y=!0;var ie=k.readUByte();if(ie===181){var Te=k.readUShort();if(Te===49){var ve=k.readUInt();if(ve===1195456820){var ge=k.readUByte();if(ge===3){for(var he=k.readUByte(),ce=k.readUByte(),ae=31&he,me=[he,ce],J=0;J<ae;J++)me.push(k.readUByte()),me.push(k.readUByte()),me.push(k.readUByte());l(f._txtTrack.samples,{type:3,pts:b.pts,bytes:me})}}}}}else if(O===5&&k.bytesAvailable!==0){if(Y=!0,K>16){for(var ne=[],Z=0;Z<16;Z++)ne.push(k.readUByte().toString(16)),(Z===3||Z===5||Z===7||Z===9)&&ne.push("-");for(var Ee=K-16,Ae=new Uint8Array(Ee),be=0;be<Ee;be++)Ae[be]=k.readUByte();l(f._txtTrack.samples,{pts:b.pts,payloadType:O,uuid:ne.join(""),userData:Object(B.utf8ArrayToStr)(Ae),userDataBytes:Ae})}}else if(K<k.bytesAvailable)for(var Se=0;Se<K;Se++)k.readUByte()}break}case 7:if(x=!0,P=!0,y&&m&&(m.debug+="SPS "),!d.sps){var Re=new _.default(U.data),Ue=Re.readSPS();d.width=Ue.width,d.height=Ue.height,d.pixelRatio=Ue.pixelRatio,d.sps=[U.data],d.duration=f._duration;for(var Ie=U.data.subarray(1,4),ke="avc1.",Oe=0;Oe<3;Oe++){var $e=Ie[Oe].toString(16);$e.length<2&&($e="0"+$e),ke+=$e}d.codec=ke}break;case 8:x=!0,y&&m&&(m.debug+="PPS "),d.pps||(d.pps=[U.data]);break;case 9:x=!1,d.audFound=!0,m&&s(m,d),m=f.avcSample=w(!1,b.pts,b.dts,y?"AUD ":"");break;case 12:x=!1;break;default:x=!1,m&&(m.debug+="unknown NAL "+U.type+" ");break}if(m&&x){var ze=m.units;ze.push(U)}}),c&&m&&(s(m,d),this.avcSample=null)},h.getLastNalUnit=function(){var b,c=this.avcSample,f;if(!c||c.units.length===0){var d=this._avcTrack.samples;c=d[d.length-1]}if((b=c)!==null&&b!==void 0&&b.units){var a=c.units;f=a[a.length-1]}return f},h.parseAVCNALu=function(b){var c=b.byteLength,f=this._avcTrack,d=f.naluState||0,a=d,y=[],m=0,x,P,U,j=-1,W=0;for(d===-1&&(j=0,W=b[0]&31,d=0,m=1);m<c;){if(x=b[m++],!d){d=x?0:1;continue}if(d===1){d=x?0:2;continue}if(!x)d=3;else if(x===1){if(j>=0){var k={data:b.subarray(j,m-d-1),type:W};y.push(k)}else{var O=this.getLastNalUnit();if(O&&(a&&m<=4-a&&(O.state&&(O.data=O.data.subarray(0,O.data.byteLength-a))),P=m-d-1,P>0)){var K=new Uint8Array(O.data.byteLength+P);K.set(O.data,0),K.set(b.subarray(0,P),O.data.byteLength),O.data=K,O.state=0}}m<c?(U=b[m]&31,j=m,W=U,d=0):d=-1}else d=0}if(j>=0&&d>=0){var Y={data:b.subarray(j,c),type:W,state:d};y.push(Y)}if(y.length===0){var q=this.getLastNalUnit();if(q){var ie=new Uint8Array(q.data.byteLength+b.byteLength);ie.set(q.data,0),ie.set(b,q.data.byteLength),q.data=ie}}return f.naluState=d,y},h.parseAACPES=function(b){var c=0,f=this._audioTrack,d=this.aacOverFlow,a=b.data;if(d){this.aacOverFlow=null;var y=d.sample.unit.byteLength,m=Math.min(d.missing,y),x=y-m;d.sample.unit.set(a.subarray(0,m),x),f.samples.push(d.sample),c=d.missing}var P,U;for(P=c,U=a.length;P<U-1&&!z.isHeader(a,P);P++);if(P!==c){var j,W;if(P<U-1?(j="AAC PES did not start with ADTS header,offset:"+P,W=!1):(j="no ADTS header found in AAC PES",W=!0),g.logger.warn("parsing error:"+j),this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:j}),W)return}z.initTrackConfig(f,this.observer,a,P,this.audioCodec);var k;if(b.pts!==void 0)k=b.pts;else if(d){var O=z.getFrameDuration(f.samplerate);k=d.sample.pts+O}else{g.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var K=0;P<U;)if(z.isHeader(a,P)){if(P+5<U){var Y=z.appendFrame(f,a,P,k,K);if(Y)if(Y.missing)this.aacOverFlow=Y;else{P+=Y.length,K++;continue}}break}else P++},h.parseMPEGPES=function(b){var c=b.data,f=c.length,d=0,a=0,y=b.pts;if(y===void 0){g.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<f;)if(I.isHeader(c,a)){var m=I.appendFrame(this._audioTrack,c,a,y,d);if(m)a+=m.length,d++;else break}else a++},h.parseID3PES=function(b){if(b.pts===void 0){g.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(b)},p}();C.minProbeByteLength=188;function w(p,h,A,b){return{key:p,frame:!1,pts:h,dts:A,units:[],debug:b,length:0}}function v(p,h){return(p[h+10]&31)<<8|p[h+11]}function u(p,h,A,b){var c={audio:-1,avc:-1,id3:-1,isAAC:!0},f=(p[h+1]&15)<<8|p[h+2],d=h+3+f-4,a=(p[h+10]&15)<<8|p[h+11];for(h+=12+a;h<d;){var y=(p[h+1]&31)<<8|p[h+2];switch(p[h]){case 207:if(!b){g.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:c.audio===-1&&(c.audio=y);break;case 21:c.id3===-1&&(c.id3=y);break;case 219:if(!b){g.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:c.avc===-1&&(c.avc=y);break;case 3:case 4:A?c.audio===-1&&(c.audio=y,c.isAAC=!1):g.logger.log("MPEG audio found, not supported in this browser");break;case 36:g.logger.warn("Unsupported HEVC stream type found");break;default:break}h+=((p[h+3]&15)<<8|p[h+4])+5}return c}function o(p){var h=0,A,b,c,f,d,a=p.data;if(!p||p.size===0)return null;for(;a[0].length<19&&a.length>1;){var y=new Uint8Array(a[0].length+a[1].length);y.set(a[0]),y.set(a[1],a[0].length),a[0]=y,a.splice(1,1)}A=a[0];var m=(A[0]<<16)+(A[1]<<8)+A[2];if(m===1){if(b=(A[4]<<8)+A[5],b&&b>p.size-6)return null;var x=A[7];x&192&&(f=(A[9]&14)*536870912+(A[10]&255)*4194304+(A[11]&254)*16384+(A[12]&255)*128+(A[13]&254)/2,x&64?(d=(A[14]&14)*536870912+(A[15]&255)*4194304+(A[16]&254)*16384+(A[17]&255)*128+(A[18]&254)/2,f-d>60*9e4&&(g.logger.warn(Math.round((f-d)/9e4)+"s delta between PTS and DTS, align them"),f=d)):d=f),c=A[8];var P=c+9;if(p.size<=P)return null;p.size-=P;for(var U=new Uint8Array(p.size),j=0,W=a.length;j<W;j++){A=a[j];var k=A.byteLength;if(P)if(P>k){P-=k;continue}else A=A.subarray(P),k-=P,P=0;U.set(A,h),h+=k}return b&&(b-=c+3),{data:U,pts:f,dts:d,len:b}}return null}function s(p,h){if(p.units.length&&p.frame){if(p.pts===void 0){var A=h.samples,b=A.length;if(b){var c=A[b-1];p.pts=c.pts,p.dts=c.dts}else{h.dropped++;return}}h.samples.push(p)}p.debug.length&&g.logger.log(p.pts+"/"+p.dts+":"+p.debug)}function l(p,h){var A=p.length;if(A>0){if(h.pts>=p[A-1].pts)p.push(h);else for(var b=A-1;b>=0;b--)if(h.pts<p[b].pts){p.splice(b,0,h);break}}else p.push(h)}function S(p){for(var h=p.byteLength,A=[],b=1;b<h-2;)p[b]===0&&p[b+1]===0&&p[b+2]===3?(A.push(b+2),b+=2):b++;if(A.length===0)return p;var c=h-A.length,f=new Uint8Array(c),d=0;for(b=0;b<c;d++,b++)d===A[0]&&(d++,A.shift()),f[b]=p[d];return f}G.default=C},"./src/errors.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"ErrorTypes",function(){return z}),L.d(G,"ErrorDetails",function(){return I});var z;(function(_){_.NETWORK_ERROR="networkError",_.MEDIA_ERROR="mediaError",_.KEY_SYSTEM_ERROR="keySystemError",_.MUX_ERROR="muxError",_.OTHER_ERROR="otherError"})(z||(z={}));var I;(function(_){_.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",_.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",_.KEY_SYSTEM_NO_SESSION="keySystemNoSession",_.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",_.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",_.MANIFEST_LOAD_ERROR="manifestLoadError",_.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",_.MANIFEST_PARSING_ERROR="manifestParsingError",_.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",_.LEVEL_EMPTY_ERROR="levelEmptyError",_.LEVEL_LOAD_ERROR="levelLoadError",_.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",_.LEVEL_SWITCH_ERROR="levelSwitchError",_.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",_.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",_.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",_.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",_.FRAG_LOAD_ERROR="fragLoadError",_.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",_.FRAG_DECRYPT_ERROR="fragDecryptError",_.FRAG_PARSING_ERROR="fragParsingError",_.REMUX_ALLOC_ERROR="remuxAllocError",_.KEY_LOAD_ERROR="keyLoadError",_.KEY_LOAD_TIMEOUT="keyLoadTimeOut",_.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",_.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",_.BUFFER_APPEND_ERROR="bufferAppendError",_.BUFFER_APPENDING_ERROR="bufferAppendingError",_.BUFFER_STALLED_ERROR="bufferStalledError",_.BUFFER_FULL_ERROR="bufferFullError",_.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",_.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",_.INTERNAL_EXCEPTION="internalException",_.INTERNAL_ABORTED="aborted",_.UNKNOWN="unknown"})(I||(I={}))},"./src/events.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"Events",function(){return z});var z;(function(I){I.MEDIA_ATTACHING="hlsMediaAttaching",I.MEDIA_ATTACHED="hlsMediaAttached",I.MEDIA_DETACHING="hlsMediaDetaching",I.MEDIA_DETACHED="hlsMediaDetached",I.BUFFER_RESET="hlsBufferReset",I.BUFFER_CODECS="hlsBufferCodecs",I.BUFFER_CREATED="hlsBufferCreated",I.BUFFER_APPENDING="hlsBufferAppending",I.BUFFER_APPENDED="hlsBufferAppended",I.BUFFER_EOS="hlsBufferEos",I.BUFFER_FLUSHING="hlsBufferFlushing",I.BUFFER_FLUSHED="hlsBufferFlushed",I.MANIFEST_LOADING="hlsManifestLoading",I.MANIFEST_LOADED="hlsManifestLoaded",I.MANIFEST_PARSED="hlsManifestParsed",I.LEVEL_SWITCHING="hlsLevelSwitching",I.LEVEL_SWITCHED="hlsLevelSwitched",I.LEVEL_LOADING="hlsLevelLoading",I.LEVEL_LOADED="hlsLevelLoaded",I.LEVEL_UPDATED="hlsLevelUpdated",I.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",I.LEVELS_UPDATED="hlsLevelsUpdated",I.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",I.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",I.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",I.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",I.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",I.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",I.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",I.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",I.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",I.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",I.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",I.CUES_PARSED="hlsCuesParsed",I.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",I.INIT_PTS_FOUND="hlsInitPtsFound",I.FRAG_LOADING="hlsFragLoading",I.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",I.FRAG_LOADED="hlsFragLoaded",I.FRAG_DECRYPTED="hlsFragDecrypted",I.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",I.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",I.FRAG_PARSING_METADATA="hlsFragParsingMetadata",I.FRAG_PARSED="hlsFragParsed",I.FRAG_BUFFERED="hlsFragBuffered",I.FRAG_CHANGED="hlsFragChanged",I.FPS_DROP="hlsFpsDrop",I.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",I.ERROR="hlsError",I.DESTROYING="hlsDestroying",I.KEY_LOADING="hlsKeyLoading",I.KEY_LOADED="hlsKeyLoaded",I.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",I.BACK_BUFFER_REACHED="hlsBackBufferReached"})(z||(z={}))},"./src/hls.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return p});var z=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(z),_=L("./src/loader/playlist-loader.ts"),B=L("./src/loader/key-loader.ts"),F=L("./src/controller/id3-track-controller.ts"),M=L("./src/controller/latency-controller.ts"),D=L("./src/controller/level-controller.ts"),g=L("./src/controller/fragment-tracker.ts"),T=L("./src/controller/stream-controller.ts"),R=L("./src/is-supported.ts"),C=L("./src/utils/logger.ts"),w=L("./src/config.ts"),v=L("./node_modules/eventemitter3/index.js"),u=L.n(v),o=L("./src/events.ts"),s=L("./src/errors.ts");function l(h,A){for(var b=0;b<A.length;b++){var c=A[b];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(h,c.key,c)}}function S(h,A,b){return A&&l(h.prototype,A),b&&l(h,b),h}var p=function(){h.isSupported=function(){return Object(R.isSupported)()};function h(b){b===void 0&&(b={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new v.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var c=this.config=Object(w.mergeConfig)(h.DefaultConfig,b);this.userConfig=b,Object(C.enableLogs)(c.debug),this._autoLevelCapping=-1,c.progressive&&Object(w.enableStreamingMode)(c);var f=c.abrController,d=c.bufferController,a=c.capLevelController,y=c.fpsController,m=this.abrController=new f(this),x=this.bufferController=new d(this),P=this.capLevelController=new a(this),U=new y(this),j=new _.default(this),W=new B.default(this),k=new F.default(this),O=this.levelController=new D.default(this),K=new g.FragmentTracker(this),Y=this.streamController=new T.default(this,K);P.setStreamController(Y),U.setStreamController(Y);var q=[O,Y];this.networkControllers=q;var ie=[j,W,m,x,P,U,k,K];this.audioTrackController=this.createController(c.audioTrackController,null,q),this.createController(c.audioStreamController,K,q),this.subtitleTrackController=this.createController(c.subtitleTrackController,null,q),this.createController(c.subtitleStreamController,K,q),this.createController(c.timelineController,null,ie),this.emeController=this.createController(c.emeController,null,ie),this.cmcdController=this.createController(c.cmcdController,null,ie),this.latencyController=this.createController(M.default,null,ie),this.coreComponents=ie}var A=h.prototype;return A.createController=function(c,f,d){if(c){var a=f?new c(this,f):new c(this);return d&&d.push(a),a}return null},A.on=function(c,f,d){d===void 0&&(d=this),this._emitter.on(c,f,d)},A.once=function(c,f,d){d===void 0&&(d=this),this._emitter.once(c,f,d)},A.removeAllListeners=function(c){this._emitter.removeAllListeners(c)},A.off=function(c,f,d,a){d===void 0&&(d=this),this._emitter.off(c,f,d,a)},A.listeners=function(c){return this._emitter.listeners(c)},A.emit=function(c,f,d){return this._emitter.emit(c,f,d)},A.trigger=function(c,f){if(this.config.debug)return this.emit(c,c,f);try{return this.emit(c,c,f)}catch(d){C.logger.error("An internal error happened while handling event "+c+'. Error message: "'+d.message+'". Here is a stacktrace:',d),this.trigger(o.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:c,error:d})}return!1},A.listenerCount=function(c){return this._emitter.listenerCount(c)},A.destroy=function(){C.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(c){return c.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(c){return c.destroy()}),this.coreComponents.length=0},A.attachMedia=function(c){C.logger.log("attachMedia"),this._media=c,this.trigger(o.Events.MEDIA_ATTACHING,{media:c})},A.detachMedia=function(){C.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},A.loadSource=function(c){this.stopLoad();var f=this.media,d=this.url,a=this.url=z.buildAbsoluteURL(self.location.href,c,{alwaysNormalize:!0});C.logger.log("loadSource:"+a),f&&d&&d!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(f)),this.trigger(o.Events.MANIFEST_LOADING,{url:c})},A.startLoad=function(c){c===void 0&&(c=-1),C.logger.log("startLoad("+c+")"),this.networkControllers.forEach(function(f){f.startLoad(c)})},A.stopLoad=function(){C.logger.log("stopLoad"),this.networkControllers.forEach(function(c){c.stopLoad()})},A.swapAudioCodec=function(){C.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},A.recoverMediaError=function(){C.logger.log("recoverMediaError");var c=this._media;this.detachMedia(),c&&this.attachMedia(c)},A.removeLevel=function(c,f){f===void 0&&(f=0),this.levelController.removeLevel(c,f)},S(h,[{key:"levels",get:function(){var c=this.levelController.levels;return c||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(c){C.logger.log("set currentLevel:"+c),this.loadLevel=c,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(c){C.logger.log("set nextLevel:"+c),this.levelController.manualLevel=c,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(c){C.logger.log("set loadLevel:"+c),this.levelController.manualLevel=c}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(c){this.levelController.nextLoadLevel=c}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(c){C.logger.log("set firstLevel:"+c),this.levelController.firstLevel=c}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(c){C.logger.log("set startLevel:"+c),c!==-1&&(c=Math.max(c,this.minAutoLevel)),this.levelController.startLevel=c}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(c){var f=!!c;f!==this.config.capLevelToPlayerSize&&(f?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=f)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(c){this._autoLevelCapping!==c&&(C.logger.log("set autoLevelCapping:"+c),this._autoLevelCapping=c)}},{key:"bandwidthEstimate",get:function(){var c=this.abrController.bwEstimator;return c?c.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var c=this.levels,f=this.config.minAutoBitrate;if(!c)return 0;for(var d=c.length,a=0;a<d;a++)if(c[a].maxBitrate>f)return a;return 0}},{key:"maxAutoLevel",get:function(){var c=this.levels,f=this.autoLevelCapping,d;return f===-1&&c&&c.length?d=c.length-1:d=f,d}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(c){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,c)}},{key:"audioTracks",get:function(){var c=this.audioTrackController;return c?c.audioTracks:[]}},{key:"audioTrack",get:function(){var c=this.audioTrackController;return c?c.audioTrack:-1},set:function(c){var f=this.audioTrackController;f&&(f.audioTrack=c)}},{key:"subtitleTracks",get:function(){var c=this.subtitleTrackController;return c?c.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var c=this.subtitleTrackController;return c?c.subtitleTrack:-1},set:function(c){var f=this.subtitleTrackController;f&&(f.subtitleTrack=c)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var c=this.subtitleTrackController;return c?c.subtitleDisplay:!1},set:function(c){var f=this.subtitleTrackController;f&&(f.subtitleDisplay=c)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(c){this.config.lowLatencyMode=c}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return h.defaultConfig?h.defaultConfig:w.hlsDefaultConfig},set:function(c){h.defaultConfig=c}}]),h}();p.defaultConfig=void 0},"./src/is-supported.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"isSupported",function(){return _}),L.d(G,"changeTypeSupported",function(){return B});var z=L("./src/utils/mediasource-helper.ts");function I(){return self.SourceBuffer||self.WebKitSourceBuffer}function _(){var F=Object(z.getMediaSource)();if(!F)return!1;var M=I(),D=F&&typeof F.isTypeSupported=="function"&&F.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),g=!M||M.prototype&&typeof M.prototype.appendBuffer=="function"&&typeof M.prototype.remove=="function";return!!D&&!!g}function B(){var F,M=I();return typeof(M==null||((F=M.prototype)===null||F===void 0)?void 0:F.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return C}),L.d(G,"LoadError",function(){return v});var z=L("./src/polyfills/number.ts"),I=L("./src/errors.ts");function _(u,o){u.prototype=Object.create(o.prototype),u.prototype.constructor=u,g(u,o)}function B(u){var o=typeof Map=="function"?new Map:void 0;return B=function(l){if(l===null||!D(l))return l;if(typeof l!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(l))return o.get(l);o.set(l,S)}function S(){return F(l,arguments,T(this).constructor)}return S.prototype=Object.create(l.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),g(S,l)},B(u)}function F(u,o,s){return M()?F=Reflect.construct:F=function(S,p,h){var A=[null];A.push.apply(A,p);var b=Function.bind.apply(S,A),c=new b;return h&&g(c,h.prototype),c},F.apply(null,arguments)}function M(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function D(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function g(u,o){return g=Object.setPrototypeOf||function(l,S){return l.__proto__=S,l},g(u,o)}function T(u){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},T(u)}var R=Math.pow(2,17),C=function(){function u(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var o=u.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(l,S){var p=this,h=l.url;if(!h)return Promise.reject(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,networkDetails:null},"Fragment does not have a "+(h?"part list":"url")));this.abort();var A=this.config,b=A.fLoader,c=A.loader;return new Promise(function(f,d){p.loader&&p.loader.destroy();var a=p.loader=l.loader=b?new b(A):new c(A),y=w(l),m={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:R};l.stats=a.stats,a.load(y,m,{onSuccess:function(P,U,j,W){p.resetLoader(l,a),f({frag:l,part:null,payload:P.data,networkDetails:W})},onError:function(P,U,j){p.resetLoader(l,a),d(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,response:P,networkDetails:j}))},onAbort:function(P,U,j){p.resetLoader(l,a),d(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,networkDetails:j}))},onTimeout:function(P,U,j){p.resetLoader(l,a),d(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,networkDetails:j}))},onProgress:function(P,U,j,W){S&&S({frag:l,part:null,payload:j,networkDetails:W})}})})},o.loadPart=function(l,S,p){var h=this;this.abort();var A=this.config,b=A.fLoader,c=A.loader;return new Promise(function(f,d){h.loader&&h.loader.destroy();var a=h.loader=l.loader=b?new b(A):new c(A),y=w(l,S),m={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:R};S.stats=a.stats,a.load(y,m,{onSuccess:function(P,U,j,W){h.resetLoader(l,a),h.updateStatsFromPart(l,S);var k={frag:l,part:S,payload:P.data,networkDetails:W};p(k),f(k)},onError:function(P,U,j){h.resetLoader(l,a),d(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,part:S,response:P,networkDetails:j}))},onAbort:function(P,U,j){l.stats.aborted=S.stats.aborted,h.resetLoader(l,a),d(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,part:S,networkDetails:j}))},onTimeout:function(P,U,j){h.resetLoader(l,a),d(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,part:S,networkDetails:j}))}})})},o.updateStatsFromPart=function(l,S){var p=l.stats,h=S.stats,A=h.total;if(p.loaded+=h.loaded,A){var b=Math.round(l.duration/S.duration),c=Math.min(Math.round(p.loaded/A),b),f=b-c,d=f*Math.round(p.loaded/c);p.total=p.loaded+d}else p.total=Math.max(p.loaded,p.total);var a=p.loading,y=h.loading;a.start?a.first+=y.first-y.start:(a.start=y.start,a.first=y.first),a.end=y.end},o.resetLoader=function(l,S){l.loader=null,this.loader===S&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),S.destroy()},u}();function w(u,o){o===void 0&&(o=null);var s=o||u,l={frag:u,part:o,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},S=s.byteRangeStartOffset,p=s.byteRangeEndOffset;return Object(z.isFiniteNumber)(S)&&Object(z.isFiniteNumber)(p)&&(l.rangeStart=S,l.rangeEnd=p),l}var v=function(u){_(o,u);function o(s){for(var l,S=arguments.length,p=new Array(S>1?S-1:0),h=1;h<S;h++)p[h-1]=arguments[h];return l=u.call.apply(u,[this].concat(p))||this,l.data=void 0,l.data=s,l}return o}(B(Error))},"./src/loader/fragment.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"ElementaryStreamTypes",function(){return C}),L.d(G,"BaseSegment",function(){return w}),L.d(G,"Fragment",function(){return v}),L.d(G,"Part",function(){return u});var z=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),_=L.n(I),B=L("./src/utils/logger.ts"),F=L("./src/loader/level-key.ts"),M=L("./src/loader/load-stats.ts");function D(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,g(o,s)}function g(o,s){return g=Object.setPrototypeOf||function(S,p){return S.__proto__=p,S},g(o,s)}function T(o,s){for(var l=0;l<s.length;l++){var S=s[l];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function R(o,s,l){return s&&T(o.prototype,s),l&&T(o,l),o}var C;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(C||(C={}));var w=function(){function o(l){var S;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(S={},S[C.AUDIO]=null,S[C.VIDEO]=null,S[C.AUDIOVIDEO]=null,S),this.baseurl=l}var s=o.prototype;return s.setByteRange=function(S,p){var h=S.split("@",2),A=[];h.length===1?A[0]=p?p.byteRangeEndOffset:0:A[0]=parseInt(h[1]),A[1]=parseInt(h[0])+A[0],this._byteRange=A},R(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(I.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(S){this._url=S}}]),o}(),v=function(o){D(s,o);function s(S,p){var h;return h=o.call(this,p)||this,h._decryptdata=null,h.rawProgramDateTime=null,h.programDateTime=null,h.tagList=[],h.duration=0,h.sn=0,h.levelkey=void 0,h.type=void 0,h.loader=null,h.level=-1,h.cc=0,h.startPTS=void 0,h.endPTS=void 0,h.appendedPTS=void 0,h.startDTS=void 0,h.endDTS=void 0,h.start=0,h.deltaPTS=void 0,h.maxStartPTS=void 0,h.minEndPTS=void 0,h.stats=new M.LoadStats,h.urlId=0,h.data=void 0,h.bitrateTest=!1,h.title=null,h.initSegment=null,h.type=S,h}var l=s.prototype;return l.createInitializationVector=function(p){for(var h=new Uint8Array(16),A=12;A<16;A++)h[A]=p>>8*(15-A)&255;return h},l.setDecryptDataFromLevelKey=function(p,h){var A=p;return(p==null?void 0:p.method)==="AES-128"&&p.uri&&!p.iv&&(A=F.LevelKey.fromURI(p.uri),A.method=p.method,A.iv=this.createInitializationVector(h),A.keyFormat="identity"),A},l.setElementaryStreamInfo=function(p,h,A,b,c,f){f===void 0&&(f=!1);var d=this.elementaryStreams,a=d[p];if(!a){d[p]={startPTS:h,endPTS:A,startDTS:b,endDTS:c,partial:f};return}a.startPTS=Math.min(a.startPTS,h),a.endPTS=Math.max(a.endPTS,A),a.startDTS=Math.min(a.startDTS,b),a.endDTS=Math.max(a.endDTS,c)},l.clearElementaryStreamInfo=function(){var p=this.elementaryStreams;p[C.AUDIO]=null,p[C.VIDEO]=null,p[C.AUDIOVIDEO]=null},R(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var p=this.sn;typeof p!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&B.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),p=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,p)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(z.isFiniteNumber)(this.programDateTime))return null;var p=Object(z.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+p*1e3}},{key:"encrypted",get:function(){var p;return!!((p=this.decryptdata)!==null&&p!==void 0&&p.keyFormat&&this.decryptdata.uri)}}]),s}(w),u=function(o){D(s,o);function s(l,S,p,h,A){var b;b=o.call(this,p)||this,b.fragOffset=0,b.duration=0,b.gap=!1,b.independent=!1,b.relurl=void 0,b.fragment=void 0,b.index=void 0,b.stats=new M.LoadStats,b.duration=l.decimalFloatingPoint("DURATION"),b.gap=l.bool("GAP"),b.independent=l.bool("INDEPENDENT"),b.relurl=l.enumeratedString("URI"),b.fragment=S,b.index=h;var c=l.enumeratedString("BYTERANGE");return c&&b.setByteRange(c,A),A&&(b.fragOffset=A.fragOffset+A.duration),b}return R(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var S=this.elementaryStreams;return!!(S.audio||S.video||S.audiovideo)}}]),s}(w)},"./src/loader/key-loader.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return B});var z=L("./src/events.ts"),I=L("./src/errors.ts"),_=L("./src/utils/logger.ts"),B=function(){function F(D){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=D,this._registerListeners()}var M=F.prototype;return M._registerListeners=function(){this.hls.on(z.Events.KEY_LOADING,this.onKeyLoading,this)},M._unregisterListeners=function(){this.hls.off(z.Events.KEY_LOADING,this.onKeyLoading)},M.destroy=function(){this._unregisterListeners();for(var g in this.loaders){var T=this.loaders[g];T&&T.destroy()}this.loaders={}},M.onKeyLoading=function(g,T){var R=T.frag,C=R.type,w=this.loaders[C];if(!R.decryptdata){_.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var v=R.decryptdata.uri;if(v!==this.decrypturl||this.decryptkey===null){var u=this.hls.config;if(w&&(_.logger.warn("abort previous key loader for type:"+C),w.abort()),!v){_.logger.warn("key uri is falsy");return}var o=u.loader,s=R.loader=this.loaders[C]=new o(u);this.decrypturl=v,this.decryptkey=null;var l={url:v,frag:R,responseType:"arraybuffer"},S={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(l,S,p)}else this.decryptkey&&(R.decryptdata.key=this.decryptkey,this.hls.trigger(z.Events.KEY_LOADED,{frag:R}))},M.loadsuccess=function(g,T,R){var C=R.frag;if(!C.decryptdata){_.logger.error("after key load, decryptdata unset");return}this.decryptkey=C.decryptdata.key=new Uint8Array(g.data),C.loader=null,delete this.loaders[C.type],this.hls.trigger(z.Events.KEY_LOADED,{frag:C})},M.loaderror=function(g,T){var R=T.frag,C=R.loader;C&&C.abort(),delete this.loaders[R.type],this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:R,response:g})},M.loadtimeout=function(g,T){var R=T.frag,C=R.loader;C&&C.abort(),delete this.loaders[R.type],this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:R})},F}()},"./src/loader/level-details.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"LevelDetails",function(){return F});var z=L("./src/polyfills/number.ts");function I(M,D){for(var g=0;g<D.length;g++){var T=D[g];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(M,T.key,T)}}function _(M,D,g){return D&&I(M.prototype,D),g&&I(M,g),M}var B=10,F=function(){function M(g){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=g}var D=M.prototype;return D.reloaded=function(T){if(!T){this.advanced=!0,this.updated=!0;return}var R=this.lastPartSn-T.lastPartSn,C=this.lastPartIndex-T.lastPartIndex;this.updated=this.endSN!==T.endSN||!!C||!!R,this.advanced=this.endSN>T.endSN||R>0||R===0&&C>0,this.updated||this.advanced?this.misses=Math.floor(T.misses*.6):this.misses=T.misses+1,this.availabilityDelay=T.availabilityDelay},_(M,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(z.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var T=this.driftEndTime-this.driftStartTime;if(T>0){var R=this.driftEnd-this.driftStart;return R*1e3/T}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var T;return(T=this.fragments)!==null&&T!==void 0&&T.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),M}()},"./src/loader/level-key.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"LevelKey",function(){return F});var z=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(z);function _(M,D){for(var g=0;g<D.length;g++){var T=D[g];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(M,T.key,T)}}function B(M,D,g){return D&&_(M.prototype,D),g&&_(M,g),M}var F=function(){M.fromURL=function(g,T){return new M(g,T)},M.fromURI=function(g){return new M(g)};function M(D,g){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,g?this._uri=Object(z.buildAbsoluteURL)(D,g,{alwaysNormalize:!0}):this._uri=D}return B(M,[{key:"uri",get:function(){return this._uri}}]),M}()},"./src/loader/load-stats.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"LoadStats",function(){return z});var z=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,G,L){"use strict";L.r(G),L.d(G,"default",function(){return s});var z=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),_=L.n(I),B=L("./src/loader/fragment.ts"),F=L("./src/loader/level-details.ts"),M=L("./src/loader/level-key.ts"),D=L("./src/utils/attr-list.ts"),g=L("./src/utils/logger.ts"),T=L("./src/utils/codecs.ts"),R=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,C=/#EXT-X-MEDIA:(.*)/g,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"),v=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),u=/\.(mp4|m4s|m4v|m4a)$/i;function o(A){var b,c;return u.test((b=(c=I.parseURL(A))===null||c===void 0?void 0:c.path)!=null?b:"")}var s=function(){function A(){}return A.findGroup=function(c,f){for(var d=0;d<c.length;d++){var a=c[d];if(a.id===f)return a}},A.convertAVC1ToAVCOTI=function(c){var f=c.split(".");if(f.length>2){var d=f.shift()+".";return d+=parseInt(f.shift()).toString(16),d+=("000"+parseInt(f.shift()).toString(16)).substr(-4),d}return c},A.resolve=function(c,f){return I.buildAbsoluteURL(f,c,{alwaysNormalize:!0})},A.parseMasterPlaylist=function(c,f){var d=[],a={},y=!1;R.lastIndex=0;for(var m;(m=R.exec(c))!=null;)if(m[1]){var x=new D.AttrList(m[1]),P={attrs:x,bitrate:x.decimalInteger("AVERAGE-BANDWIDTH")||x.decimalInteger("BANDWIDTH"),name:x.NAME,url:A.resolve(m[2],f)},U=x.decimalResolution("RESOLUTION");U&&(P.width=U.width,P.height=U.height),l((x.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),P),P.videoCodec&&P.videoCodec.indexOf("avc1")!==-1&&(P.videoCodec=A.convertAVC1ToAVCOTI(P.videoCodec)),d.push(P)}else if(m[3]){var j=new D.AttrList(m[3]);j["DATA-ID"]&&(y=!0,a[j["DATA-ID"]]=j)}return{levels:d,sessionData:y?a:null}},A.parseMasterPlaylistMedia=function(c,f,d,a){a===void 0&&(a=[]);var y,m=[],x=0;for(C.lastIndex=0;(y=C.exec(c))!==null;){var P=new D.AttrList(y[1]);if(P.TYPE===d){var U={attrs:P,bitrate:0,id:x++,groupId:P["GROUP-ID"],instreamId:P["INSTREAM-ID"],name:P.NAME||P.LANGUAGE||"",type:d,default:P.bool("DEFAULT"),autoselect:P.bool("AUTOSELECT"),forced:P.bool("FORCED"),lang:P.LANGUAGE,url:P.URI?A.resolve(P.URI,f):""};if(a.length){var j=A.findGroup(a,U.groupId)||a[0];S(U,j,"audioCodec"),S(U,j,"textCodec")}m.push(U)}}return m},A.parseLevelPlaylist=function(c,f,d,a,y){var m=new F.LevelDetails(f),x=m.fragments,P=null,U=0,j=0,W=0,k=0,O=null,K=new B.Fragment(a,f),Y,q,ie,Te=-1,ve=!1;for(w.lastIndex=0,m.m3u8=c;(Y=w.exec(c))!==null;){ve&&(ve=!1,K=new B.Fragment(a,f),K.start=W,K.sn=U,K.cc=k,K.level=d,P&&(K.initSegment=P,K.rawProgramDateTime=P.rawProgramDateTime));var ge=Y[1];if(ge){K.duration=parseFloat(ge);var he=(" "+Y[2]).slice(1);K.title=he||null,K.tagList.push(he?["INF",ge,he]:["INF",ge])}else if(Y[3])Object(z.isFiniteNumber)(K.duration)&&(K.start=W,ie&&(K.levelkey=ie),K.sn=U,K.level=d,K.cc=k,K.urlId=y,x.push(K),K.relurl=(" "+Y[3]).slice(1),h(K,O),O=K,W+=K.duration,U++,j=0,ve=!0);else if(Y[4]){var ce=(" "+Y[4]).slice(1);O?K.setByteRange(ce,O):K.setByteRange(ce)}else if(Y[5])K.rawProgramDateTime=(" "+Y[5]).slice(1),K.tagList.push(["PROGRAM-DATE-TIME",K.rawProgramDateTime]),Te===-1&&(Te=x.length);else{if(Y=Y[0].match(v),!Y){g.logger.warn("No matches on slow regex match for level playlist!");continue}for(q=1;q<Y.length&&!(typeof Y[q]!="undefined");q++);var ae=(" "+Y[q]).slice(1),me=(" "+Y[q+1]).slice(1),J=Y[q+2]?(" "+Y[q+2]).slice(1):"";switch(ae){case"PLAYLIST-TYPE":m.type=me.toUpperCase();break;case"MEDIA-SEQUENCE":U=m.startSN=parseInt(me);break;case"SKIP":{var ne=new D.AttrList(me),Z=ne.decimalInteger("SKIPPED-SEGMENTS");if(Object(z.isFiniteNumber)(Z)){m.skippedSegments=Z;for(var Ee=Z;Ee--;)x.unshift(null);U+=Z}var Ae=ne.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ae&&(m.recentlyRemovedDateranges=Ae.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(me);break;case"VERSION":m.version=parseInt(me);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(me||J)&&K.tagList.push(J?[me,J]:[me]);break;case"DIS":k++;case"GAP":K.tagList.push([ae]);break;case"BITRATE":K.tagList.push([ae,me]);break;case"DISCONTINUITY-SEQ":k=parseInt(me);break;case"KEY":{var be,Se=new D.AttrList(me),Re=Se.enumeratedString("METHOD"),Ue=Se.URI,Ie=Se.hexadecimalInteger("IV"),ke=Se.enumeratedString("KEYFORMATVERSIONS"),Oe=Se.enumeratedString("KEYID"),$e=(be=Se.enumeratedString("KEYFORMAT"))!=null?be:"identity",ze=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(ze.indexOf($e)>-1){g.logger.warn("Keyformat "+$e+" is not supported from the manifest");continue}else if($e!=="identity")continue;Re&&(ie=M.LevelKey.fromURL(f,Ue),Ue&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Re)>=0&&(ie.method=Re,ie.keyFormat=$e,Oe&&(ie.keyID=Oe),ke&&(ie.keyFormatVersions=ke),ie.iv=Ie));break}case"START":{var Ve=new D.AttrList(me),Ge=Ve.decimalFloatingPoint("TIME-OFFSET");Object(z.isFiniteNumber)(Ge)&&(m.startTimeOffset=Ge);break}case"MAP":{var rt=new D.AttrList(me);K.relurl=rt.URI,rt.BYTERANGE&&K.setByteRange(rt.BYTERANGE),K.level=d,K.sn="initSegment",ie&&(K.levelkey=ie),K.initSegment=null,P=K,ve=!0;break}case"SERVER-CONTROL":{var Je=new D.AttrList(me);m.canBlockReload=Je.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=Je.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&Je.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=Je.optionalFloat("PART-HOLD-BACK",0),m.holdBack=Je.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ye=new D.AttrList(me);m.partTarget=Ye.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ce=m.partList;Ce||(Ce=m.partList=[]);var qe=j>0?Ce[Ce.length-1]:void 0,Xe=j++,Le=new B.Part(new D.AttrList(me),K,f,Xe,qe);Ce.push(Le),K.duration+=Le.duration;break}case"PRELOAD-HINT":{var Me=new D.AttrList(me);m.preloadHint=Me;break}case"RENDITION-REPORT":{var pe=new D.AttrList(me);m.renditionReports=m.renditionReports||[],m.renditionReports.push(pe);break}default:g.logger.warn("line parsed but not handled: "+Y);break}}}O&&!O.relurl?(x.pop(),W-=O.duration,m.partList&&(m.fragmentHint=O)):m.partList&&(h(K,O),K.cc=k,m.fragmentHint=K);var ue=x.length,de=x[0],$=x[ue-1];if(W+=m.skippedSegments*m.targetduration,W>0&&ue&&$){m.averagetargetduration=W/ue;var Q=$.sn;m.endSN=Q!=="initSegment"?Q:0,de&&(m.startCC=de.cc,de.initSegment||m.fragments.every(function(ee){return ee.relurl&&o(ee.relurl)})&&(g.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),K=new B.Fragment(a,f),K.relurl=$.relurl,K.level=d,K.sn="initSegment",de.initSegment=K,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(W+=m.fragmentHint.duration),m.totalduration=W,m.endCC=k,Te>0&&p(x,Te),m},A}();function l(A,b){["video","audio","text"].forEach(function(c){var f=A.filter(function(a){return Object(T.isCodecType)(a,c)});if(f.length){var d=f.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});b[c+"Codec"]=d.length>0?d[0]:f[0],A=A.filter(function(a){return f.indexOf(a)===-1})}}),b.unknownCodecs=A}function S(A,b,c){var f=b[c];f&&(A[c]=f)}function p(A,b){for(var c=A[b],f=b;f--;){var d=A[f];if(!d)return;d.programDateTime=c.programDateTime-d.duration*1e3,c=d}}function h(A,b){A.rawProgramDateTime?A.programDateTime=Date.parse(A.rawProgramDateTime):b!=null&&b.programDateTime&&(A.programDateTime=b.endProgramDateTime),Object(z.isFiniteNumber)(A.programDateTime)||(A.programDateTime=null,A.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(te,G,L){"use strict";L.r(G);var z=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),_=L("./src/errors.ts"),B=L("./src/utils/logger.ts"),F=L("./src/utils/mp4-tools.ts"),M=L("./src/loader/m3u8-parser.ts"),D=L("./src/types/loader.ts"),g=L("./src/utils/attr-list.ts");function T(w){var v=w.type;switch(v){case D.PlaylistContextType.AUDIO_TRACK:return D.PlaylistLevelType.AUDIO;case D.PlaylistContextType.SUBTITLE_TRACK:return D.PlaylistLevelType.SUBTITLE;default:return D.PlaylistLevelType.MAIN}}function R(w,v){var u=w.url;return(u===void 0||u.indexOf("data:")===0)&&(u=v.url),u}var C=function(){function w(u){this.hls=void 0,this.loaders=Object.create(null),this.hls=u,this.registerListeners()}var v=w.prototype;return v.registerListeners=function(){var o=this.hls;o.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.createInternalLoader=function(o){var s=this.hls.config,l=s.pLoader,S=s.loader,p=l||S,h=new p(s);return o.loader=h,this.loaders[o.type]=h,h},v.getInternalLoader=function(o){return this.loaders[o.type]},v.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},v.destroyInternalLoaders=function(){for(var o in this.loaders){var s=this.loaders[o];s&&s.destroy(),this.resetInternalLoader(o)}},v.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},v.onManifestLoading=function(o,s){var l=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:D.PlaylistContextType.MANIFEST,url:l,deliveryDirectives:null})},v.onLevelLoading=function(o,s){var l=s.id,S=s.level,p=s.url,h=s.deliveryDirectives;this.load({id:l,groupId:null,level:S,responseType:"text",type:D.PlaylistContextType.LEVEL,url:p,deliveryDirectives:h})},v.onAudioTrackLoading=function(o,s){var l=s.id,S=s.groupId,p=s.url,h=s.deliveryDirectives;this.load({id:l,groupId:S,level:null,responseType:"text",type:D.PlaylistContextType.AUDIO_TRACK,url:p,deliveryDirectives:h})},v.onSubtitleTrackLoading=function(o,s){var l=s.id,S=s.groupId,p=s.url,h=s.deliveryDirectives;this.load({id:l,groupId:S,level:null,responseType:"text",type:D.PlaylistContextType.SUBTITLE_TRACK,url:p,deliveryDirectives:h})},v.load=function(o){var s,l=this.hls.config,S=this.getInternalLoader(o);if(S){var p=S.context;if(p&&p.url===o.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),S.abort()}var h,A,b,c;switch(o.type){case D.PlaylistContextType.MANIFEST:h=l.manifestLoadingMaxRetry,A=l.manifestLoadingTimeOut,b=l.manifestLoadingRetryDelay,c=l.manifestLoadingMaxRetryTimeout;break;case D.PlaylistContextType.LEVEL:case D.PlaylistContextType.AUDIO_TRACK:case D.PlaylistContextType.SUBTITLE_TRACK:h=0,A=l.levelLoadingTimeOut;break;default:h=l.levelLoadingMaxRetry,A=l.levelLoadingTimeOut,b=l.levelLoadingRetryDelay,c=l.levelLoadingMaxRetryTimeout;break}if(S=this.createInternalLoader(o),(s=o.deliveryDirectives)!==null&&s!==void 0&&s.part){var f;if(o.type===D.PlaylistContextType.LEVEL&&o.level!==null?f=this.hls.levels[o.level].details:o.type===D.PlaylistContextType.AUDIO_TRACK&&o.id!==null?f=this.hls.audioTracks[o.id].details:o.type===D.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(f=this.hls.subtitleTracks[o.id].details),f){var d=f.partTarget,a=f.targetduration;d&&a&&(A=Math.min(Math.max(d*3,a*.8)*1e3,A))}}var y={timeout:A,maxRetry:h,retryDelay:b,maxRetryDelay:c,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};S.load(o,y,m)},v.loadsuccess=function(o,s,l,S){if(S===void 0&&(S=null),l.isSidxRequest){this.handleSidxRequest(o,l),this.handlePlaylistLoaded(o,s,l,S);return}this.resetInternalLoader(l.type);var p=o.data;if(p.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,l,"no EXTM3U delimiter",S);return}s.parsing.start=performance.now(),p.indexOf("#EXTINF:")>0||p.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,s,l,S):this.handleMasterPlaylist(o,s,l,S)},v.loaderror=function(o,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!1,o)},v.loadtimeout=function(o,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!0)},v.handleMasterPlaylist=function(o,s,l,S){var p=this.hls,h=o.data,A=R(o,l),b=M.default.parseMasterPlaylist(h,A),c=b.levels,f=b.sessionData;if(!c.length){this.handleManifestParsingError(o,l,"no level found in manifest",S);return}var d=c.map(function(U){return{id:U.attrs.AUDIO,audioCodec:U.audioCodec}}),a=c.map(function(U){return{id:U.attrs.SUBTITLES,textCodec:U.textCodec}}),y=M.default.parseMasterPlaylistMedia(h,A,"AUDIO",d),m=M.default.parseMasterPlaylistMedia(h,A,"SUBTITLES",a),x=M.default.parseMasterPlaylistMedia(h,A,"CLOSED-CAPTIONS");if(y.length){var P=y.some(function(U){return!U.url});!P&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(B.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),y.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new g.AttrList({}),bitrate:0,url:""}))}p.trigger(I.Events.MANIFEST_LOADED,{levels:c,audioTracks:y,subtitles:m,captions:x,url:A,stats:s,networkDetails:S,sessionData:f})},v.handleTrackOrLevelPlaylist=function(o,s,l,S){var p=this.hls,h=l.id,A=l.level,b=l.type,c=R(o,l),f=Object(z.isFiniteNumber)(h)?h:0,d=Object(z.isFiniteNumber)(A)?A:f,a=T(l),y=M.default.parseLevelPlaylist(o.data,c,d,a,f);if(!y.fragments.length){p.trigger(I.Events.ERROR,{type:_.ErrorTypes.NETWORK_ERROR,details:_.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:c,reason:"no fragments found in level",level:typeof l.level=="number"?l.level:void 0});return}if(b===D.PlaylistContextType.MANIFEST){var m={attrs:new g.AttrList({}),bitrate:0,details:y,name:"",url:c};p.trigger(I.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:c,stats:s,networkDetails:S,sessionData:null})}if(s.parsing.end=performance.now(),y.needSidxRanges){var x,P=(x=y.fragments[0].initSegment)===null||x===void 0?void 0:x.url;this.load({url:P,isSidxRequest:!0,type:b,level:A,levelDetails:y,id:h,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}l.levelDetails=y,this.handlePlaylistLoaded(o,s,l,S)},v.handleSidxRequest=function(o,s){var l=Object(F.parseSegmentIndex)(new Uint8Array(o.data));if(!l)return;var S=l.references,p=s.levelDetails;S.forEach(function(h,A){var b=h.info,c=p.fragments[A];c.byteRange.length===0&&c.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),c.initSegment&&c.initSegment.setByteRange(String(l.moovEndOffset)+"@0")})},v.handleManifestParsingError=function(o,s,l,S){this.hls.trigger(I.Events.ERROR,{type:_.ErrorTypes.NETWORK_ERROR,details:_.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===D.PlaylistContextType.MANIFEST,url:o.url,reason:l,response:o,context:s,networkDetails:S})},v.handleNetworkError=function(o,s,l,S){l===void 0&&(l=!1),B.logger.warn("[playlist-loader]: A network "+(l?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var p=_.ErrorDetails.UNKNOWN,h=!1,A=this.getInternalLoader(o);switch(o.type){case D.PlaylistContextType.MANIFEST:p=l?_.ErrorDetails.MANIFEST_LOAD_TIMEOUT:_.ErrorDetails.MANIFEST_LOAD_ERROR,h=!0;break;case D.PlaylistContextType.LEVEL:p=l?_.ErrorDetails.LEVEL_LOAD_TIMEOUT:_.ErrorDetails.LEVEL_LOAD_ERROR,h=!1;break;case D.PlaylistContextType.AUDIO_TRACK:p=l?_.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:_.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,h=!1;break;case D.PlaylistContextType.SUBTITLE_TRACK:p=l?_.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:_.ErrorDetails.SUBTITLE_LOAD_ERROR,h=!1;break}A&&this.resetInternalLoader(o.type);var b={type:_.ErrorTypes.NETWORK_ERROR,details:p,fatal:h,url:o.url,loader:A,context:o,networkDetails:s};S&&(b.response=S),this.hls.trigger(I.Events.ERROR,b)},v.handlePlaylistLoaded=function(o,s,l,S){var p=l.type,h=l.level,A=l.id,b=l.groupId,c=l.loader,f=l.levelDetails,d=l.deliveryDirectives;if(!(f!=null&&f.targetduration)){this.handleManifestParsingError(o,l,"invalid target duration",S);return}if(!c)return;f.live&&(c.getCacheAge&&(f.ageHeader=c.getCacheAge()||0),(!c.getCacheAge||isNaN(f.ageHeader))&&(f.ageHeader=0));switch(p){case D.PlaylistContextType.MANIFEST:case D.PlaylistContextType.LEVEL:this.hls.trigger(I.Events.LEVEL_LOADED,{details:f,level:h||0,id:A||0,stats:s,networkDetails:S,deliveryDirectives:d});break;case D.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(I.Events.AUDIO_TRACK_LOADED,{details:f,id:A||0,groupId:b||"",stats:s,networkDetails:S,deliveryDirectives:d});break;case D.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADED,{details:f,id:A||0,groupId:b||"",stats:s,networkDetails:S,deliveryDirectives:d});break}},w}();G.default=C},"./src/polyfills/number.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"isFiniteNumber",function(){return z}),L.d(G,"MAX_SAFE_INTEGER",function(){return I});var z=Number.isFinite||function(_){return typeof _=="number"&&isFinite(_)},I=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(te,G,L){"use strict";L.r(G);var z=function(){function I(){}return I.getSilentFrame=function(B,F){switch(B){case"mp4a.40.2":if(F===1)return new Uint8Array([0,200,0,128,35,128]);if(F===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(F===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(F===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(F===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(F===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(F===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(F===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(F===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},I}();G.default=z},"./src/remux/mp4-generator.ts":function(te,G,L){"use strict";L.r(G);var z=Math.pow(2,32)-1,I=function(){function _(){}return _.init=function(){_.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 F;for(F in _.types)_.types.hasOwnProperty(F)&&(_.types[F]=[F.charCodeAt(0),F.charCodeAt(1),F.charCodeAt(2),F.charCodeAt(3)]);var M=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),D=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);_.HDLR_TYPES={video:M,audio:D};var g=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),T=new Uint8Array([0,0,0,0,0,0,0,0]);_.STTS=_.STSC=_.STCO=T,_.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),_.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),_.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),_.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var R=new Uint8Array([105,115,111,109]),C=new Uint8Array([97,118,99,49]),w=new Uint8Array([0,0,0,1]);_.FTYP=_.box(_.types.ftyp,R,w,R,C),_.DINF=_.box(_.types.dinf,_.box(_.types.dref,g))},_.box=function(F){for(var M=8,D=arguments.length,g=new Array(D>1?D-1:0),T=1;T<D;T++)g[T-1]=arguments[T];for(var R=g.length,C=R;R--;)M+=g[R].byteLength;var w=new Uint8Array(M);for(w[0]=M>>24&255,w[1]=M>>16&255,w[2]=M>>8&255,w[3]=M&255,w.set(F,4),R=0,M=8;R<C;R++)w.set(g[R],M),M+=g[R].byteLength;return w},_.hdlr=function(F){return _.box(_.types.hdlr,_.HDLR_TYPES[F])},_.mdat=function(F){return _.box(_.types.mdat,F)},_.mdhd=function(F,M){M*=F;var D=Math.floor(M/(z+1)),g=Math.floor(M%(z+1));return _.box(_.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,F>>24&255,F>>16&255,F>>8&255,F&255,D>>24,D>>16&255,D>>8&255,D&255,g>>24,g>>16&255,g>>8&255,g&255,85,196,0,0]))},_.mdia=function(F){return _.box(_.types.mdia,_.mdhd(F.timescale,F.duration),_.hdlr(F.type),_.minf(F))},_.mfhd=function(F){return _.box(_.types.mfhd,new Uint8Array([0,0,0,0,F>>24,F>>16&255,F>>8&255,F&255]))},_.minf=function(F){return F.type==="audio"?_.box(_.types.minf,_.box(_.types.smhd,_.SMHD),_.DINF,_.stbl(F)):_.box(_.types.minf,_.box(_.types.vmhd,_.VMHD),_.DINF,_.stbl(F))},_.moof=function(F,M,D){return _.box(_.types.moof,_.mfhd(F),_.traf(D,M))},_.moov=function(F){for(var M=F.length,D=[];M--;)D[M]=_.trak(F[M]);return _.box.apply(null,[_.types.moov,_.mvhd(F[0].timescale,F[0].duration)].concat(D).concat(_.mvex(F)))},_.mvex=function(F){for(var M=F.length,D=[];M--;)D[M]=_.trex(F[M]);return _.box.apply(null,[_.types.mvex].concat(D))},_.mvhd=function(F,M){M*=F;var D=Math.floor(M/(z+1)),g=Math.floor(M%(z+1)),T=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,F>>24&255,F>>16&255,F>>8&255,F&255,D>>24,D>>16&255,D>>8&255,D&255,g>>24,g>>16&255,g>>8&255,g&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return _.box(_.types.mvhd,T)},_.sdtp=function(F){var M=F.samples||[],D=new Uint8Array(4+M.length),g,T;for(g=0;g<M.length;g++)T=M[g].flags,D[g+4]=T.dependsOn<<4|T.isDependedOn<<2|T.hasRedundancy;return _.box(_.types.sdtp,D)},_.stbl=function(F){return _.box(_.types.stbl,_.stsd(F),_.box(_.types.stts,_.STTS),_.box(_.types.stsc,_.STSC),_.box(_.types.stsz,_.STSZ),_.box(_.types.stco,_.STCO))},_.avc1=function(F){var M=[],D=[],g,T,R;for(g=0;g<F.sps.length;g++)T=F.sps[g],R=T.byteLength,M.push(R>>>8&255),M.push(R&255),M=M.concat(Array.prototype.slice.call(T));for(g=0;g<F.pps.length;g++)T=F.pps[g],R=T.byteLength,D.push(R>>>8&255),D.push(R&255),D=D.concat(Array.prototype.slice.call(T));var C=_.box(_.types.avcC,new Uint8Array([1,M[3],M[4],M[5],252|3,224|F.sps.length].concat(M).concat([F.pps.length]).concat(D))),w=F.width,v=F.height,u=F.pixelRatio[0],o=F.pixelRatio[1];return _.box(_.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,v>>8&255,v&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),C,_.box(_.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),_.box(_.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,o>>24,o>>16&255,o>>8&255,o&255])))},_.esds=function(F){var M=F.config.length;return new Uint8Array([0,0,0,0,3,23+M,0,1,0,4,15+M,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([M]).concat(F.config).concat([6,1,2]))},_.mp4a=function(F){var M=F.samplerate;return _.box(_.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,F.channelCount,0,16,0,0,0,0,M>>8&255,M&255,0,0]),_.box(_.types.esds,_.esds(F)))},_.mp3=function(F){var M=F.samplerate;return _.box(_.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,F.channelCount,0,16,0,0,0,0,M>>8&255,M&255,0,0]))},_.stsd=function(F){return F.type==="audio"?!F.isAAC&&F.codec==="mp3"?_.box(_.types.stsd,_.STSD,_.mp3(F)):_.box(_.types.stsd,_.STSD,_.mp4a(F)):_.box(_.types.stsd,_.STSD,_.avc1(F))},_.tkhd=function(F){var M=F.id,D=F.duration*F.timescale,g=F.width,T=F.height,R=Math.floor(D/(z+1)),C=Math.floor(D%(z+1));return _.box(_.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,C>>24,C>>16&255,C>>8&255,C&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,g>>8&255,g&255,0,0,T>>8&255,T&255,0,0]))},_.traf=function(F,M){var D=_.sdtp(F),g=F.id,T=Math.floor(M/(z+1)),R=Math.floor(M%(z+1));return _.box(_.types.traf,_.box(_.types.tfhd,new Uint8Array([0,0,0,0,g>>24,g>>16&255,g>>8&255,g&255])),_.box(_.types.tfdt,new Uint8Array([1,0,0,0,T>>24,T>>16&255,T>>8&255,T&255,R>>24,R>>16&255,R>>8&255,R&255])),_.trun(F,D.length+16+20+8+16+8+8),D)},_.trak=function(F){return F.duration=F.duration||4294967295,_.box(_.types.trak,_.tkhd(F),_.mdia(F))},_.trex=function(F){var M=F.id;return _.box(_.types.trex,new Uint8Array([0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},_.trun=function(F,M){var D=F.samples||[],g=D.length,T=12+16*g,R=new Uint8Array(T),C,w,v,u,o,s;for(M+=8+T,R.set([0,0,15,1,g>>>24&255,g>>>16&255,g>>>8&255,g&255,M>>>24&255,M>>>16&255,M>>>8&255,M&255],0),C=0;C<g;C++)w=D[C],v=w.duration,u=w.size,o=w.flags,s=w.cts,R.set([v>>>24&255,v>>>16&255,v>>>8&255,v&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*C);return _.box(_.types.trun,R)},_.initSegment=function(F){_.types||_.init();var M=_.moov(F),D=new Uint8Array(_.FTYP.byteLength+M.byteLength);return D.set(_.FTYP),D.set(M,_.FTYP.byteLength),D},_}();I.types=void 0,I.HDLR_TYPES=void 0,I.STTS=void 0,I.STSC=void 0,I.STCO=void 0,I.STSZ=void 0,I.VMHD=void 0,I.SMHD=void 0,I.STSD=void 0,I.FTYP=void 0,I.DINF=void 0,G.default=I},"./src/remux/mp4-remuxer.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return s}),L.d(G,"normalizePts",function(){return l});var z=L("./src/polyfills/number.ts"),I=L("./src/remux/aac-helper.ts"),_=L("./src/remux/mp4-generator.ts"),B=L("./src/events.ts"),F=L("./src/errors.ts"),M=L("./src/utils/logger.ts"),D=L("./src/types/loader.ts"),g=L("./src/utils/timescale-conversion.ts");function T(){return T=Object.assign||function(A){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(A[f]=c[f])}return A},T.apply(this,arguments)}var R=10*1e3,C=1024,w=1152,v=null,u=null,o=!1,s=function(){function A(c,f,d,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=c,this.config=f,this.typeSupported=d,this.ISGenerated=!1,v===null){var y=navigator.userAgent||"",m=y.match(/Chrome\/(\d+)/i);v=m?parseInt(m[1]):0}if(u===null){var x=navigator.userAgent.match(/Safari\/(\d+)/i);u=x?parseInt(x[1]):0}o=!!v&&v<75||!!u&&u<600}var b=A.prototype;return b.destroy=function(){},b.resetTimeStamp=function(f){M.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=f},b.resetNextTimestamp=function(){M.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},b.resetInitSegment=function(){M.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},b.getVideoStartPts=function(f){var d=!1,a=f.reduce(function(y,m){var x=m.pts-y;return x<-4294967296?(d=!0,l(y,m.pts)):x>0?y:m.pts},f[0].pts);return d&&M.logger.debug("PTS rollover detected"),a},b.remux=function(f,d,a,y,m,x,P,U){var j,W,k,O,K,Y,q=m,ie=m,Te=f.pid>-1,ve=d.pid>-1,ge=d.samples.length,he=f.samples.length>0,ce=ge>1,ae=(!Te||he)&&(!ve||ce)||this.ISGenerated||P;if(ae){this.ISGenerated||(k=this.generateIS(f,d,m));var me=this.isVideoContiguous,J=-1;if(ce&&(J=S(d.samples),!me&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,J>0){M.logger.warn("[mp4-remuxer]: Dropped "+J+" out of "+ge+" video samples due to a missing keyframe");var ne=this.getVideoStartPts(d.samples);d.samples=d.samples.slice(J),d.dropped+=J,ie+=(d.samples[0].pts-ne)/(d.timescale||9e4)}else J===-1&&(M.logger.warn("[mp4-remuxer]: No keyframe found out of "+ge+" video samples"),Y=!1);if(this.ISGenerated){if(he&&ce){var Z=this.getVideoStartPts(d.samples),Ee=l(f.samples[0].pts,Z)-Z,Ae=Ee/d.inputTimeScale;q+=Math.max(0,Ae),ie+=Math.max(0,-Ae)}if(he){if(f.samplerate||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),k=this.generateIS(f,d,m)),W=this.remuxAudio(f,q,this.isAudioContiguous,x,ve||ce||U===D.PlaylistLevelType.AUDIO?ie:void 0),ce){var be=W?W.endPTS-W.startPTS:0;d.inputTimeScale||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),k=this.generateIS(f,d,m)),j=this.remuxVideo(d,ie,me,be)}}else ce&&(j=this.remuxVideo(d,ie,me,0));j&&(j.firstKeyFrame=J,j.independent=J!==-1)}}return this.ISGenerated&&(a.samples.length&&(K=this.remuxID3(a,m)),y.samples.length&&(O=this.remuxText(y,m))),{audio:W,video:j,initSegment:k,independent:Y,text:O,id3:K}},b.generateIS=function(f,d,a){var y=f.samples,m=d.samples,x=this.typeSupported,P={},U=!Object(z.isFiniteNumber)(this._initPTS),j="audio/mp4",W,k,O;if(U&&(W=k=Infinity),f.config&&y.length&&(f.timescale=f.samplerate,f.isAAC||(x.mpeg?(j="audio/mpeg",f.codec=""):x.mp3&&(f.codec="mp3")),P.audio={id:"audio",container:j,codec:f.codec,initSegment:!f.isAAC&&x.mpeg?new Uint8Array(0):_.default.initSegment([f]),metadata:{channelCount:f.channelCount}},U&&(O=f.inputTimeScale,W=k=y[0].pts-Math.round(O*a))),d.sps&&d.pps&&m.length&&(d.timescale=d.inputTimeScale,P.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:_.default.initSegment([d]),metadata:{width:d.width,height:d.height}},U)){O=d.inputTimeScale;var K=this.getVideoStartPts(m),Y=Math.round(O*a);k=Math.min(k,l(m[0].dts,K)-Y),W=Math.min(W,K-Y)}if(Object.keys(P).length)return this.ISGenerated=!0,U&&(this._initPTS=W,this._initDTS=k),{tracks:P,initPTS:W,timescale:O}},b.remuxVideo=function(f,d,a,y){var m=f.inputTimeScale,x=f.samples,P=[],U=x.length,j=this._initPTS,W=this.nextAvcDts,k=8,O,K,Y,q=Number.POSITIVE_INFINITY,ie=Number.NEGATIVE_INFINITY,Te=0,ve=!1;if(!a||W===null){var ge=d*m,he=x[0].pts-l(x[0].dts,x[0].pts);W=ge-he}for(var ce=0;ce<U;ce++){var ae=x[ce];if(ae.pts=l(ae.pts-j,W),ae.dts=l(ae.dts-j,W),ae.dts>ae.pts){var me=9e4*.2;Te=Math.max(Math.min(Te,ae.pts-ae.dts),-1*me)}ae.dts<x[ce>0?ce-1:ce].dts&&(ve=!0)}ve&&x.sort(function(mt,dt){var at=mt.dts-dt.dts,Et=mt.pts-dt.pts;return at||Et}),K=x[0].dts,Y=x[x.length-1].dts;var J=Math.round((Y-K)/(U-1));if(Te<0){if(Te<J*-2){M.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(g.toMsFromMpegTsClock)(-J,!0)+" ms");for(var ne=Te,Z=0;Z<U;Z++)x[Z].dts=ne=Math.max(ne,x[Z].pts-J),x[Z].pts=Math.max(ne,x[Z].pts)}else{M.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(g.toMsFromMpegTsClock)(Te,!0)+" ms to overcome this issue");for(var Ee=0;Ee<U;Ee++)x[Ee].dts=x[Ee].dts+Te}K=x[0].dts}if(a){var Ae=K-W,be=Ae>J,Se=Ae<-1;if(be||Se){be?M.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(Ae,!0)+" ms ("+Ae+"dts) hole between fragments detected, filling it"):M.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(-Ae,!0)+" ms ("+Ae+"dts) overlapping between fragments detected"),K=W;var Re=x[0].pts-Ae;x[0].dts=K,x[0].pts=Re,M.logger.log("Video: First PTS/DTS adjusted: "+Object(g.toMsFromMpegTsClock)(Re,!0)+"/"+Object(g.toMsFromMpegTsClock)(K,!0)+", delta: "+Object(g.toMsFromMpegTsClock)(Ae,!0)+" ms")}}o&&(K=Math.max(0,K));for(var Ue=0,Ie=0,ke=0;ke<U;ke++){for(var Oe=x[ke],$e=Oe.units,ze=$e.length,Ve=0,Ge=0;Ge<ze;Ge++)Ve+=$e[Ge].data.length;Ie+=Ve,Ue+=ze,Oe.length=Ve,Oe.dts=Math.max(Oe.dts,K),Oe.pts=Math.max(Oe.pts,Oe.dts,0),q=Math.min(Oe.pts,q),ie=Math.max(Oe.pts,ie)}Y=x[U-1].dts;var rt=Ie+4*Ue+8,Je;try{Je=new Uint8Array(rt)}catch(mt){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:F.ErrorTypes.MUX_ERROR,details:F.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:rt,reason:"fail allocating video mdat "+rt});return}var Ye=new DataView(Je.buffer);Ye.setUint32(0,rt),Je.set(_.default.types.mdat,4);for(var Ce=0;Ce<U;Ce++){for(var qe=x[Ce],Xe=qe.units,Le=0,Me=0,pe=Xe.length;Me<pe;Me++){var ue=Xe[Me],de=ue.data,$=ue.data.byteLength;Ye.setUint32(k,$),k+=4,Je.set(de,k),k+=$,Le+=4+$}if(Ce<U-1)O=x[Ce+1].dts-qe.dts;else{var Q=this.config,ee=qe.dts-x[Ce>0?Ce-1:Ce].dts;if(Q.stretchShortVideoTrack&&this.nextAudioPts!==null){var se=Math.floor(Q.maxBufferHole*m),fe=(y?q+y*m:this.nextAudioPts)-qe.pts;fe>se?(O=fe-ee,O<0&&(O=ee),M.logger.log("[mp4-remuxer]: It is approximately "+fe/90+" ms to the next segment; using duration "+O/90+" ms for the last video frame.")):O=ee}else O=ee}var we=Math.round(qe.pts-qe.dts);P.push(new p(qe.key,O,Le,we))}if(P.length&&v&&v<70){var _e=P[0].flags;_e.dependsOn=2,_e.isNonSync=0}console.assert(O!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=Y+O,this.isVideoContiguous=!0;var je=_.default.moof(f.sequenceNumber++,K,T({},f,{samples:P})),Ze="video",We={data1:je,data2:Je,startPTS:q/m,endPTS:(ie+O)/m,startDTS:K/m,endDTS:W/m,type:Ze,hasAudio:!1,hasVideo:!0,nb:P.length,dropped:f.dropped};return f.samples=[],f.dropped=0,console.assert(Je.length,"MDAT length must not be zero"),We},b.remuxAudio=function(f,d,a,y,m){var x=f.inputTimeScale,P=f.samplerate?f.samplerate:x,U=x/P,j=f.isAAC?C:w,W=j*U,k=this._initPTS,O=!f.isAAC&&this.typeSupported.mpeg,K=[],Y=f.samples,q=O?0:8,ie=this.nextAudioPts||-1,Te=d*x;if(this.isAudioContiguous=a=a||Y.length&&ie>0&&(y&&Math.abs(Te-ie)<9e3||Math.abs(l(Y[0].pts-k,Te)-ie)<20*W),Y.forEach(function(de){de.pts=l(de.pts-k,Te)}),!a||ie<0){if(Y=Y.filter(function(de){return de.pts>=0}),!Y.length)return;m===0?ie=0:y?ie=Math.max(0,Te):ie=Y[0].pts}if(f.isAAC)for(var ve=m!==void 0,ge=this.config.maxAudioFramesDrift,he=0,ce=ie;he<Y.length;he++){var ae=Y[he],me=ae.pts,J=me-ce,ne=Math.abs(1e3*J/x);if(J<=-ge*W&&ve)he===0&&(M.logger.warn("Audio frame @ "+(me/x).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*J/x)+" ms."),this.nextAudioPts=ie=ce=me);else if(J>=ge*W&&ne<R&&ve){var Z=Math.round(J/W);ce=me-Z*W,ce<0&&(Z--,ce+=W),he===0&&(this.nextAudioPts=ie=ce),M.logger.warn("[mp4-remuxer]: Injecting "+Z+" audio frame @ "+(ce/x).toFixed(3)+"s due to "+Math.round(1e3*J/x)+" ms gap.");for(var Ee=0;Ee<Z;Ee++){var Ae=Math.max(ce,0),be=I.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);be||(M.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),be=ae.unit.subarray()),Y.splice(he,0,{unit:be,pts:Ae}),ce+=W,he++}}ae.pts=ce,ce+=W}for(var Se=null,Re=null,Ue,Ie=0,ke=Y.length;ke--;)Ie+=Y[ke].unit.byteLength;for(var Oe=0,$e=Y.length;Oe<$e;Oe++){var ze=Y[Oe],Ve=ze.unit,Ge=ze.pts;if(Re!==null){var rt=K[Oe-1];rt.duration=Math.round((Ge-Re)/U)}else if(a&&f.isAAC&&(Ge=ie),Se=Ge,Ie>0){Ie+=q;try{Ue=new Uint8Array(Ie)}catch(de){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:F.ErrorTypes.MUX_ERROR,details:F.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ie,reason:"fail allocating audio mdat "+Ie});return}if(!O){var Je=new DataView(Ue.buffer);Je.setUint32(0,Ie),Ue.set(_.default.types.mdat,4)}}else return;Ue.set(Ve,q);var Ye=Ve.byteLength;q+=Ye,K.push(new p(!0,j,Ye,0)),Re=Ge}var Ce=K.length;if(!Ce)return;var qe=K[K.length-1];this.nextAudioPts=ie=Re+U*qe.duration;var Xe=O?new Uint8Array(0):_.default.moof(f.sequenceNumber++,Se/U,T({},f,{samples:K}));f.samples=[];var Le=Se/x,Me=ie/x,pe="audio",ue={data1:Xe,data2:Ue,startPTS:Le,endPTS:Me,startDTS:Le,endDTS:Me,type:pe,hasAudio:!0,hasVideo:!1,nb:Ce};return this.isAudioContiguous=!0,console.assert(Ue.length,"MDAT length must not be zero"),ue},b.remuxEmptyAudio=function(f,d,a,y){var m=f.inputTimeScale,x=f.samplerate?f.samplerate:m,P=m/x,U=this.nextAudioPts,j=(U!==null?U:y.startDTS*m)+this._initDTS,W=y.endDTS*m+this._initDTS,k=P*C,O=Math.ceil((W-j)/k),K=I.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);if(M.logger.warn("[mp4-remuxer]: remux empty Audio"),!K){M.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Y=[],q=0;q<O;q++){var ie=j+q*k;Y.push({unit:K,pts:ie,dts:ie})}return f.samples=Y,this.remuxAudio(f,d,a,!1)},b.remuxID3=function(f,d){var a=f.samples.length;if(!a)return;for(var y=f.inputTimeScale,m=this._initPTS,x=this._initDTS,P=0;P<a;P++){var U=f.samples[P];U.pts=l(U.pts-m,d*y)/y,U.dts=l(U.dts-x,d*y)/y}var j=f.samples;return f.samples=[],{samples:j}},b.remuxText=function(f,d){var a=f.samples.length;if(!a)return;for(var y=f.inputTimeScale,m=this._initPTS,x=0;x<a;x++){var P=f.samples[x];P.pts=l(P.pts-m,d*y)/y}f.samples.sort(function(j,W){return j.pts-W.pts});var U=f.samples;return f.samples=[],{samples:U}},A}();function l(A,b){var c;if(b===null)return A;for(b<A?c=-8589934592:c=8589934592;Math.abs(A-b)>4294967296;)A+=c;return A}function S(A){for(var b=0;b<A.length;b++)if(A[b].key)return b;return-1}var p=function(b,c,f,d){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=c,this.size=f,this.cts=d,this.flags=new h(b)},h=function(b){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=b?2:1,this.isNonSync=b?0:1}},"./src/remux/passthrough-remuxer.ts":function(te,G,L){"use strict";L.r(G);var z=L("./src/polyfills/number.ts"),I=L("./src/utils/mp4-tools.ts"),_=L("./src/loader/fragment.ts"),B=L("./src/utils/logger.ts"),F=function(){function g(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var T=g.prototype;return T.destroy=function(){},T.resetTimeStamp=function(C){this.initPTS=C,this.lastEndDTS=null},T.resetNextTimestamp=function(){this.lastEndDTS=null},T.resetInitSegment=function(C,w,v){this.audioCodec=w,this.videoCodec=v,this.generateInitSegment(C),this.emitInitSegment=!0},T.generateInitSegment=function(C){var w=this.audioCodec,v=this.videoCodec;if(!C||!C.byteLength){this.initTracks=void 0,this.initData=void 0;return}var u=this.initData=Object(I.parseInitSegment)(C);w||(w=D(u.audio,_.ElementaryStreamTypes.AUDIO)),v||(v=D(u.video,_.ElementaryStreamTypes.VIDEO));var o={};u.audio&&u.video?o.audiovideo={container:"video/mp4",codec:w+","+v,initSegment:C,id:"main"}:u.audio?o.audio={container:"audio/mp4",codec:w,initSegment:C,id:"audio"}:u.video?o.video={container:"video/mp4",codec:v,initSegment:C,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},T.remux=function(C,w,v,u,o){var s=this.initPTS,l=this.lastEndDTS,S={audio:void 0,video:void 0,text:u,id3:v,initSegment:void 0};Object(z.isFiniteNumber)(l)||(l=this.lastEndDTS=o||0);var p=w.samples;if(!p||!p.length)return S;var h={initPTS:void 0,timescale:1},A=this.initData;if((!A||!A.length)&&(this.generateInitSegment(p),A=this.initData),!A||!A.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),S;this.emitInitSegment&&(h.tracks=this.initTracks,this.emitInitSegment=!1),Object(z.isFiniteNumber)(s)||(this.initPTS=h.initPTS=s=M(A,p,l));var b=Object(I.getDuration)(p,A),c=l,f=b+c;Object(I.offsetStartDTS)(A,p,s),b>0?this.lastEndDTS=f:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!A.audio,a=!!A.video,y="";d&&(y+="audio"),a&&(y+="video");var m={data1:p,startPTS:c,startDTS:c,endPTS:f,endDTS:f,type:y,hasAudio:d,hasVideo:a,nb:1,dropped:0};return S.audio=m.type==="audio"?m:void 0,S.video=m.type!=="audio"?m:void 0,S.text=u,S.id3=v,S.initSegment=h,S},g}(),M=function(T,R,C){return Object(I.getStartDTS)(T,R)-C};function D(g,T){var R=g==null?void 0:g.codec;return R&&R.length>4?R:R==="hvc1"?"hvc1.1.c.L120.90":R==="av01"?"av01.0.04M.08":R==="avc1"||T===_.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}G.default=F},"./src/task-loop.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return z});var z=function(){function I(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var _=I.prototype;return _.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},_.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},_.onHandlerDestroyed=function(){},_.hasInterval=function(){return!!this._tickInterval},_.hasNextTick=function(){return!!this._tickTimer},_.setInterval=function(F){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,F),!0)},_.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},_.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},_.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},_.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},_.doTick=function(){},I}()},"./src/types/cmcd.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"CMCDVersion",function(){return z}),L.d(G,"CMCDObjectType",function(){return I}),L.d(G,"CMCDStreamingFormat",function(){return _}),L.d(G,"CMCDStreamType",function(){return B});var z=1,I;(function(F){F.MANIFEST="m",F.AUDIO="a",F.VIDEO="v",F.MUXED="av",F.INIT="i",F.CAPTION="c",F.TIMED_TEXT="tt",F.KEY="k",F.OTHER="o"})(I||(I={}));var _;(function(F){F.DASH="d",F.HLS="h",F.SMOOTH="s",F.OTHER="o"})(_||(_={}));var B;(function(F){F.VOD="v",F.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"HlsSkip",function(){return _}),L.d(G,"getSkipValue",function(){return B}),L.d(G,"HlsUrlParameters",function(){return F}),L.d(G,"Level",function(){return M});function z(D,g){for(var T=0;T<g.length;T++){var R=g[T];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(D,R.key,R)}}function I(D,g,T){return g&&z(D.prototype,g),T&&z(D,T),D}var _;(function(D){D.No="",D.Yes="YES",D.v2="v2"})(_||(_={}));function B(D,g){var T=D.canSkipUntil,R=D.canSkipDateRanges,C=D.endSN,w=g!==void 0?g-C:0;return T&&w<T?R?_.v2:_.Yes:_.No}var F=function(){function D(T,R,C){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=T,this.part=R,this.skip=C}var g=D.prototype;return g.addDirectives=function(R){var C=new self.URL(R);return this.msn!==void 0&&C.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&C.searchParams.set("_HLS_part",this.part.toString()),this.skip&&C.searchParams.set("_HLS_skip",this.skip),C.toString()},D}(),M=function(){function D(g){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[g.url],this.attrs=g.attrs,this.bitrate=g.bitrate,g.details&&(this.details=g.details),this.id=g.id||0,this.name=g.name,this.width=g.width||0,this.height=g.height||0,this.audioCodec=g.audioCodec,this.videoCodec=g.videoCodec,this.unknownCodecs=g.unknownCodecs,this.codecSet=[g.videoCodec,g.audioCodec].filter(function(T){return T}).join(",").replace(/\.[^.,]+/g,"")}return I(D,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(T){var R=T%this.url.length;this._urlId!==R&&(this.details=void 0,this._urlId=R)}}]),D}()},"./src/types/loader.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"PlaylistContextType",function(){return z}),L.d(G,"PlaylistLevelType",function(){return I});var z;(function(_){_.MANIFEST="manifest",_.LEVEL="level",_.AUDIO_TRACK="audioTrack",_.SUBTITLE_TRACK="subtitleTrack"})(z||(z={}));var I;(function(_){_.MAIN="main",_.AUDIO="audio",_.SUBTITLE="subtitle"})(I||(I={}))},"./src/types/transmuxer.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"ChunkMetadata",function(){return z});var z=function(B,F,M,D,g,T){D===void 0&&(D=0),g===void 0&&(g=-1),T===void 0&&(T=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=I(),this.buffering={audio:I(),video:I(),audiovideo:I()},this.level=B,this.sn=F,this.id=M,this.size=D,this.part=g,this.partial=T};function I(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"AttrList",function(){return _});var z=/^(\d+)x(\d+)$/,I=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,_=function(){function B(M){typeof M=="string"&&(M=B.parseAttrList(M));for(var D in M)M.hasOwnProperty(D)&&(this[D]=M[D])}var F=B.prototype;return F.decimalInteger=function(D){var g=parseInt(this[D],10);return g>Number.MAX_SAFE_INTEGER?Infinity:g},F.hexadecimalInteger=function(D){if(this[D]){var g=(this[D]||"0x").slice(2);g=(g.length&1?"0":"")+g;for(var T=new Uint8Array(g.length/2),R=0;R<g.length/2;R++)T[R]=parseInt(g.slice(R*2,R*2+2),16);return T}else return null},F.hexadecimalIntegerAsNumber=function(D){var g=parseInt(this[D],16);return g>Number.MAX_SAFE_INTEGER?Infinity:g},F.decimalFloatingPoint=function(D){return parseFloat(this[D])},F.optionalFloat=function(D,g){var T=this[D];return T?parseFloat(T):g},F.enumeratedString=function(D){return this[D]},F.bool=function(D){return this[D]==="YES"},F.decimalResolution=function(D){var g=z.exec(this[D]);return g===null?void 0:{width:parseInt(g[1],10),height:parseInt(g[2],10)}},B.parseAttrList=function(D){var g,T={},R='"';for(I.lastIndex=0;(g=I.exec(D))!==null;){var C=g[2];C.indexOf(R)===0&&C.lastIndexOf(R)===C.length-1&&(C=C.slice(1,-1)),T[g[1]]=C}return T},B}()},"./src/utils/binary-search.ts":function(te,G,L){"use strict";L.r(G);var z={search:function(_,B){for(var F=0,M=_.length-1,D=null,g=null;F<=M;){D=(F+M)/2|0,g=_[D];var T=B(g);if(T>0)F=D+1;else if(T<0)M=D-1;else return g}return null}};G.default=z},"./src/utils/buffer-helper.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"BufferHelper",function(){return _});var z=L("./src/utils/logger.ts"),I={length:0,start:function(){return 0},end:function(){return 0}},_=function(){function B(){}return B.isBuffered=function(M,D){try{if(M){for(var g=B.getBuffered(M),T=0;T<g.length;T++)if(D>=g.start(T)&&D<=g.end(T))return!0}}catch(R){}return!1},B.bufferInfo=function(M,D,g){try{if(M){var T=B.getBuffered(M),R=[],C;for(C=0;C<T.length;C++)R.push({start:T.start(C),end:T.end(C)});return this.bufferedInfo(R,D,g)}}catch(w){}return{len:0,start:D,end:D,nextStart:void 0}},B.bufferedInfo=function(M,D,g){D=Math.max(0,D),M.sort(function(h,A){var b=h.start-A.start;return b||A.end-h.end});var T=[];if(g)for(var R=0;R<M.length;R++){var C=T.length;if(C){var w=T[C-1].end;M[R].start-w<g?M[R].end>w&&(T[C-1].end=M[R].end):T.push(M[R])}else T.push(M[R])}else T=M;for(var v=0,u,o=D,s=D,l=0;l<T.length;l++){var S=T[l].start,p=T[l].end;if(D+g>=S&&D<p)o=S,s=p,v=s-D;else if(D+g<S){u=S;break}}return{len:v,start:o||0,end:s||0,nextStart:u}},B.getBuffered=function(M){try{return M.buffered}catch(D){return z.logger.log("failed to get media.buffered",D),I}},B}()},"./src/utils/cea-608-parser.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"Row",function(){return s}),L.d(G,"CaptionScreen",function(){return l});var z=L("./src/utils/logger.ts"),I={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},_=function(f){var d=f;return I.hasOwnProperty(f)&&(d=I[f]),String.fromCharCode(d)},B=15,F=100,M={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},D={17:2,18:4,21:6,22:8,23:10,19:13,20:15},g={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},T={25:2,26:4,29:6,30:8,31:10,27:13,28:15},R=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],C;(function(c){c[c.ERROR=0]="ERROR",c[c.TEXT=1]="TEXT",c[c.WARNING=2]="WARNING",c[c.INFO=2]="INFO",c[c.DEBUG=3]="DEBUG",c[c.DATA=3]="DATA"})(C||(C={}));var w=function(){function c(){this.time=null,this.verboseLevel=C.ERROR}var f=c.prototype;return f.log=function(a,y){this.verboseLevel>=a&&z.logger.log(this.time+" ["+a+"] "+y)},c}(),v=function(f){for(var d=[],a=0;a<f.length;a++)d.push(f[a].toString(16));return d},u=function(){function c(d,a,y,m,x){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=d||"white",this.underline=a||!1,this.italics=y||!1,this.background=m||"black",this.flash=x||!1}var f=c.prototype;return f.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},f.setStyles=function(a){for(var y=["foreground","underline","italics","background","flash"],m=0;m<y.length;m++){var x=y[m];a.hasOwnProperty(x)&&(this[x]=a[x])}},f.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},f.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},f.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},f.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},c}(),o=function(){function c(d,a,y,m,x,P){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new u(a,y,m,x,P)}var f=c.prototype;return f.reset=function(){this.uchar=" ",this.penState.reset()},f.setChar=function(a,y){this.uchar=a,this.penState.copy(y)},f.setPenState=function(a){this.penState.copy(a)},f.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},f.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},f.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},c}(),s=function(){function c(d){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<F;a++)this.chars.push(new o);this.logger=d,this.pos=0,this.currPenState=new u}var f=c.prototype;return f.equals=function(a){for(var y=!0,m=0;m<F;m++)if(!this.chars[m].equals(a.chars[m])){y=!1;break}return y},f.copy=function(a){for(var y=0;y<F;y++)this.chars[y].copy(a.chars[y])},f.isEmpty=function(){for(var a=!0,y=0;y<F;y++)if(!this.chars[y].isEmpty()){a=!1;break}return a},f.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(C.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>F&&(this.logger.log(C.DEBUG,"Too large cursor position "+this.pos),this.pos=F)},f.moveCursor=function(a){var y=this.pos+a;if(a>1)for(var m=this.pos+1;m<y+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(y)},f.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},f.insertChar=function(a){a>=144&&this.backSpace();var y=_(a);if(this.pos>=F){this.logger.log(C.ERROR,"Cannot insert "+a.toString(16)+" ("+y+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(y,this.currPenState),this.moveCursor(1)},f.clearFromPos=function(a){var y;for(y=a;y<F;y++)this.chars[y].reset()},f.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},f.clearToEndOfRow=function(){this.clearFromPos(this.pos)},f.getTextString=function(){for(var a=[],y=!0,m=0;m<F;m++){var x=this.chars[m].uchar;x!==" "&&(y=!1),a.push(x)}return y?"":a.join("")},f.setPenStyles=function(a){this.currPenState.setStyles(a);var y=this.chars[this.pos];y.setPenState(this.currPenState)},c}(),l=function(){function c(d){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<B;a++)this.rows.push(new s(d));this.logger=d,this.currRow=B-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var f=c.prototype;return f.reset=function(){for(var a=0;a<B;a++)this.rows[a].clear();this.currRow=B-1},f.equals=function(a){for(var y=!0,m=0;m<B;m++)if(!this.rows[m].equals(a.rows[m])){y=!1;break}return y},f.copy=function(a){for(var y=0;y<B;y++)this.rows[y].copy(a.rows[y])},f.isEmpty=function(){for(var a=!0,y=0;y<B;y++)if(!this.rows[y].isEmpty()){a=!1;break}return a},f.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},f.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},f.insertChar=function(a){var y=this.rows[this.currRow];y.insertChar(a)},f.setPen=function(a){var y=this.rows[this.currRow];y.setPenStyles(a)},f.moveCursor=function(a){var y=this.rows[this.currRow];y.moveCursor(a)},f.setCursor=function(a){this.logger.log(C.INFO,"setCursor: "+a);var y=this.rows[this.currRow];y.setCursor(a)},f.setPAC=function(a){this.logger.log(C.INFO,"pacData = "+JSON.stringify(a));var y=a.row-1;if(this.nrRollUpRows&&y<this.nrRollUpRows-1&&(y=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==y){for(var m=0;m<B;m++)this.rows[m].clear();var x=this.currRow+1-this.nrRollUpRows,P=this.lastOutputScreen;if(P){var U=P.rows[x].cueStartTime,j=this.logger.time;if(U&&j!==null&&U<j)for(var W=0;W<this.nrRollUpRows;W++)this.rows[y-this.nrRollUpRows+W+1].copy(P.rows[x+W])}}this.currRow=y;var k=this.rows[this.currRow];if(a.indent!==null){var O=a.indent,K=Math.max(O-1,0);k.setCursor(a.indent),a.color=k.chars[K].penState.foreground}var Y={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(Y)},f.setBkgData=function(a){this.logger.log(C.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},f.setRollUpRows=function(a){this.nrRollUpRows=a},f.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(C.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(C.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,y=this.rows.splice(a,1)[0];y.clear(),this.rows.splice(this.currRow,0,y),this.logger.log(C.INFO,"Rolling up")},f.getDisplayText=function(a){a=a||!1;for(var y=[],m="",x=-1,P=0;P<B;P++){var U=this.rows[P].getTextString();U&&(x=P+1,a?y.push("Row "+x+": '"+U+"'"):y.push(U.trim()))}return y.length>0&&(a?m="["+y.join(" | ")+"]":m=y.join(`
|
|
`)),m},f.getTextAndFormat=function(){return this.rows},c}(),S=function(){function c(d,a,y){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=d,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new l(y),this.nonDisplayedMemory=new l(y),this.lastOutputScreen=new l(y),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=y}var f=c.prototype;return f.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},f.getHandler=function(){return this.outputFilter},f.setHandler=function(a){this.outputFilter=a},f.setPAC=function(a){this.writeScreen.setPAC(a)},f.setBkgData=function(a){this.writeScreen.setBkgData(a)},f.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(C.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},f.insertChars=function(a){for(var y=0;y<a.length;y++)this.writeScreen.insertChar(a[y]);var m=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(C.INFO,m+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(C.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},f.ccRCL=function(){this.logger.log(C.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},f.ccBS=function(){if(this.logger.log(C.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},f.ccAOF=function(){},f.ccAON=function(){},f.ccDER=function(){this.logger.log(C.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},f.ccRU=function(a){this.logger.log(C.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},f.ccFON=function(){this.logger.log(C.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},f.ccRDC=function(){this.logger.log(C.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},f.ccTR=function(){this.logger.log(C.INFO,"TR"),this.setMode("MODE_TEXT")},f.ccRTD=function(){this.logger.log(C.INFO,"RTD"),this.setMode("MODE_TEXT")},f.ccEDM=function(){this.logger.log(C.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},f.ccCR=function(){this.logger.log(C.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},f.ccENM=function(){this.logger.log(C.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},f.ccEOC=function(){if(this.logger.log(C.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(C.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},f.ccTO=function(a){this.logger.log(C.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},f.ccMIDROW=function(a){var y={flash:!1};if(y.underline=a%2===1,y.italics=a>=46,y.italics)y.foreground="white";else{var m=Math.floor(a/2)-16,x=["white","green","blue","cyan","red","yellow","magenta"];y.foreground=x[m]}this.logger.log(C.INFO,"MIDROW: "+JSON.stringify(y)),this.writeScreen.setPen(y)},f.outputDataUpdate=function(a){a===void 0&&(a=!1);var y=this.logger.time;if(y===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=y:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,y,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:y),this.lastOutputScreen.copy(this.displayedMemory))},f.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},c}(),p=function(){function c(d,a,y){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new w;this.channels=[null,new S(d,a,m),new S(d+1,y,m)],this.cmdHistory=b(),this.logger=m}var f=c.prototype;return f.getHandler=function(a){return this.channels[a].getHandler()},f.setHandler=function(a,y){this.channels[a].setHandler(y)},f.addData=function(a,y){var m,x,P,U=!1;this.logger.time=a;for(var j=0;j<y.length;j+=2){if(x=y[j]&127,P=y[j+1]&127,x===0&&P===0)continue;if(this.logger.log(C.DATA,"["+v([y[j],y[j+1]])+"] -> ("+v([x,P])+")"),m=this.parseCmd(x,P),m||(m=this.parseMidrow(x,P)),m||(m=this.parsePAC(x,P)),m||(m=this.parseBackgroundAttributes(x,P)),!m&&(U=this.parseChars(x,P),U)){var W=this.currentChannel;if(W&&W>0){var k=this.channels[W];k.insertChars(U)}else this.logger.log(C.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!U&&this.logger.log(C.WARNING,"Couldn't parse cleaned data "+v([x,P])+" orig: "+v([y[j],y[j+1]]))}},f.parseCmd=function(a,y){var m=this.cmdHistory,x=(a===20||a===28||a===21||a===29)&&y>=32&&y<=47,P=(a===23||a===31)&&y>=33&&y<=35;if(!(x||P))return!1;if(A(a,y,m))return h(null,null,m),this.logger.log(C.DEBUG,"Repeated command ("+v([a,y])+") 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?y===32?j.ccRCL():y===33?j.ccBS():y===34?j.ccAOF():y===35?j.ccAON():y===36?j.ccDER():y===37?j.ccRU(2):y===38?j.ccRU(3):y===39?j.ccRU(4):y===40?j.ccFON():y===41?j.ccRDC():y===42?j.ccTR():y===43?j.ccRTD():y===44?j.ccEDM():y===45?j.ccCR():y===46?j.ccENM():y===47&&j.ccEOC():j.ccTO(y-32),h(a,y,m),this.currentChannel=U,!0},f.parseMidrow=function(a,y){var m=0;if((a===17||a===25)&&y>=32&&y<=47){if(a===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(C.ERROR,"Mismatch channel in midrow parsing"),!1;var x=this.channels[m];return x?(x.ccMIDROW(y),this.logger.log(C.DEBUG,"MIDROW ("+v([a,y])+")"),!0):!1}return!1},f.parsePAC=function(a,y){var m,x=this.cmdHistory,P=(a>=17&&a<=23||a>=25&&a<=31)&&y>=64&&y<=127,U=(a===16||a===24)&&y>=64&&y<=95;if(!(P||U))return!1;if(A(a,y,x))return h(null,null,x),!0;var j=a<=23?1:2;y>=64&&y<=95?m=j===1?M[a]:g[a]:m=j===1?D[a]:T[a];var W=this.channels[j];return W?(W.setPAC(this.interpretPAC(m,y)),h(a,y,x),this.currentChannel=j,!0):!1},f.interpretPAC=function(a,y){var m,x={color:null,italics:!1,indent:null,underline:!1,row:a};return y>95?m=y-96:m=y-64,x.underline=(m&1)===1,m<=13?x.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(x.italics=!0,x.color="white"):x.indent=Math.floor((m-16)/2)*4,x},f.parseChars=function(a,y){var m,x=null,P=null;if(a>=25?(m=2,P=a-8):(m=1,P=a),P>=17&&P<=19){var U;P===17?U=y+80:P===18?U=y+112:U=y+144,this.logger.log(C.INFO,"Special char '"+_(U)+"' in channel "+m),x=[U]}else a>=32&&a<=127&&(x=y===0?[a]:[a,y]);if(x){var j=v(x);this.logger.log(C.DEBUG,"Char codes = "+j.join(",")),h(a,y,this.cmdHistory)}return x},f.parseBackgroundAttributes=function(a,y){var m=(a===16||a===24)&&y>=32&&y<=47,x=(a===23||a===31)&&y>=45&&y<=47;if(!(m||x))return!1;var P,U={};a===16||a===24?(P=Math.floor((y-32)/2),U.background=R[P],y%2===1&&(U.background=U.background+"_semi")):y===45?U.background="transparent":(U.foreground="black",y===47&&(U.underline=!0));var j=a<=23?1:2,W=this.channels[j];return W.setBkgData(U),h(a,y,this.cmdHistory),!0},f.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var y=this.channels[a];y&&y.reset()}this.cmdHistory=b()},f.cueSplitAtTime=function(a){for(var y=0;y<this.channels.length;y++){var m=this.channels[y];m&&m.cueSplitAtTime(a)}},c}();function h(c,f,d){d.a=c,d.b=f}function A(c,f,d){return d.a===c&&d.b===f}function b(){return{a:null,b:null}}G.default=p},"./src/utils/codecs.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"isCodecType",function(){return I}),L.d(G,"isCodecSupportedInMp4",function(){return _});var z={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function I(B,F){var M=z[F];return!!M&&M[B.slice(0,4)]===!0}function _(B,F){return MediaSource.isTypeSupported((F||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(te,G,L){"use strict";L.r(G);var z=L("./src/utils/vttparser.ts"),I=L("./src/utils/webvtt-parser.ts"),_=L("./src/utils/texttrack-utils.ts"),B=/\s/,F={newCue:function(D,g,T,R){for(var C=[],w,v,u,o,s,l=self.VTTCue||self.TextTrackCue,S=0;S<R.rows.length;S++)if(w=R.rows[S],u=!0,o=0,s="",!w.isEmpty()){for(var p=0;p<w.chars.length;p++)B.test(w.chars[p].uchar)&&u?o++:(s+=w.chars[p].uchar,u=!1);w.cueStartTime=g,g===T&&(T+=1e-4),o>=16?o--:o++;var h=Object(z.fixLineBreaks)(s.trim()),A=Object(I.generateCueId)(g,T,h);(!D||!D.cues||!D.cues.getCueById(A))&&(v=new l(g,T,h),v.id=A,v.line=S+1,v.align="left",v.position=10+Math.min(80,Math.floor(o*8/32)*10),C.push(v))}return D&&C.length&&(C.sort(function(b,c){return b.line==="auto"||c.line==="auto"?0:b.line>8&&c.line>8?c.line-b.line:b.line-c.line}),C.forEach(function(b){return Object(_.addCueToTrack)(D,b)})),C}};G.default=F},"./src/utils/discontinuities.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"findFirstFragWithCC",function(){return B}),L.d(G,"shouldAlignOnDiscontinuities",function(){return F}),L.d(G,"findDiscontinuousReferenceFrag",function(){return M}),L.d(G,"adjustSlidingStart",function(){return g}),L.d(G,"alignStream",function(){return T}),L.d(G,"alignPDT",function(){return C}),L.d(G,"alignFragmentByPDTDelta",function(){return w}),L.d(G,"alignMediaPlaylistByPDT",function(){return v});var z=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts"),_=L("./src/controller/level-helper.ts");function B(u,o){for(var s=null,l=0,S=u.length;l<S;l++){var p=u[l];if(p&&p.cc===o){s=p;break}}return s}function F(u,o,s){return!!(o.details&&(s.endCC>s.startCC||u&&u.cc<s.startCC))}function M(u,o){var s=u.fragments,l=o.fragments;if(!l.length||!s.length){I.logger.log("No fragments to align");return}var S=B(s,l[0].cc);if(!S||S&&!S.startPTS){I.logger.log("No frag in previous level to align on");return}return S}function D(u,o){if(u){var s=u.start+o;u.start=u.startPTS=s,u.endPTS=s+u.duration}}function g(u,o){for(var s=o.fragments,l=0,S=s.length;l<S;l++)D(s[l],u);o.fragmentHint&&D(o.fragmentHint,u),o.alignedSliding=!0}function T(u,o,s){if(!o)return;R(u,s,o),!s.alignedSliding&&o.details&&C(s,o.details),!s.alignedSliding&&o.details&&!s.skippedSegments&&Object(_.adjustSliding)(o.details,s)}function R(u,o,s){if(F(u,s,o)){var l=M(s.details,o);l&&Object(z.isFiniteNumber)(l.start)&&(I.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),g(l.start,o))}}function C(u,o){if(!o.fragments.length||!u.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,l=u.fragments[0].programDateTime,S=(l-s)/1e3+o.fragments[0].start;S&&Object(z.isFiniteNumber)(S)&&(I.logger.log("Adjusting PTS using programDateTime delta "+(l-s)+"ms, sliding:"+S.toFixed(3)+" "+u.url+" "),g(S,u))}function w(u,o){var s=u.programDateTime;if(!s)return;var l=(s-o)/1e3;u.start=u.startPTS=l,u.endPTS=l+u.duration}function v(u,o){if(!o.fragments.length||!u.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,l=o.fragments[0].start,S=s-l*1e3;u.fragments.forEach(function(p){w(p,S)}),u.fragmentHint&&w(u.fragmentHint,S),u.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(te,G,L){"use strict";L.r(G);var z=L("./src/utils/ewma.ts"),I=function(){function _(F,M,D){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=D,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new z.default(F),this.fast_=new z.default(M)}var B=_.prototype;return B.update=function(M,D){var g=this.slow_,T=this.fast_;this.slow_.halfLife!==M&&(this.slow_=new z.default(M,g.getEstimate(),g.getTotalWeight())),this.fast_.halfLife!==D&&(this.fast_=new z.default(D,T.getEstimate(),T.getTotalWeight()))},B.sample=function(M,D){M=Math.max(M,this.minDelayMs_);var g=8*D,T=M/1e3,R=g/T;this.fast_.sample(T,R),this.slow_.sample(T,R)},B.canEstimate=function(){var M=this.fast_;return M&&M.getTotalWeight()>=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},_}();G.default=I},"./src/utils/ewma.ts":function(te,G,L){"use strict";L.r(G);var z=function(){function I(B,F,M){F===void 0&&(F=0),M===void 0&&(M=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_=F,this.totalWeight_=M}var _=I.prototype;return _.sample=function(F,M){var D=Math.pow(this.alpha_,F);this.estimate_=M*(1-D)+D*this.estimate_,this.totalWeight_+=F},_.getTotalWeight=function(){return this.totalWeight_},_.getEstimate=function(){if(this.alpha_){var F=1-Math.pow(this.alpha_,this.totalWeight_);if(F)return this.estimate_/F}return this.estimate_},I}();G.default=z},"./src/utils/fetch-loader.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"fetchSupported",function(){return w});var z=L("./src/polyfills/number.ts"),I=L("./src/loader/load-stats.ts"),_=L("./src/demux/chunk-cache.ts");function B(l,S){l.prototype=Object.create(S.prototype),l.prototype.constructor=l,T(l,S)}function F(l){var S=typeof Map=="function"?new Map:void 0;return F=function(h){if(h===null||!g(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof S!="undefined"){if(S.has(h))return S.get(h);S.set(h,A)}function A(){return M(h,arguments,R(this).constructor)}return A.prototype=Object.create(h.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),T(A,h)},F(l)}function M(l,S,p){return D()?M=Reflect.construct:M=function(A,b,c){var f=[null];f.push.apply(f,b);var d=Function.bind.apply(A,f),a=new d;return c&&T(a,c.prototype),a},M.apply(null,arguments)}function D(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function g(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function T(l,S){return T=Object.setPrototypeOf||function(h,A){return h.__proto__=A,h},T(l,S)}function R(l){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(p){return p.__proto__||Object.getPrototypeOf(p)},R(l)}function C(){return C=Object.assign||function(l){for(var S=1;S<arguments.length;S++){var p=arguments[S];for(var h in p)Object.prototype.hasOwnProperty.call(p,h)&&(l[h]=p[h])}return l},C.apply(this,arguments)}function w(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(l){}return!1}var v=function(){function l(p){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=p.fetchSetup||o,this.controller=new self.AbortController,this.stats=new I.LoadStats}var S=l.prototype;return S.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},S.abortInternal=function(){var h=this.response;(!h||!h.ok)&&(this.stats.aborted=!0,this.controller.abort())},S.abort=function(){var h;this.abortInternal(),(h=this.callbacks)!==null&&h!==void 0&&h.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},S.load=function(h,A,b){var c=this,f=this.stats;if(f.loading.start)throw new Error("Loader can only be used once.");f.loading.start=self.performance.now();var d=u(h,this.controller.signal),a=b.onProgress,y=h.responseType==="arraybuffer",m=y?"byteLength":"length";this.context=h,this.config=A,this.callbacks=b,this.request=this.fetchSetup(h,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){c.abortInternal(),b.onTimeout(f,h,c.response)},A.timeout),self.fetch(this.request).then(function(x){if(c.response=c.loader=x,!x.ok){var P=x.status,U=x.statusText;throw new s(U||"fetch, bad network response",P,x)}return f.loading.first=Math.max(self.performance.now(),f.loading.start),f.total=parseInt(x.headers.get("Content-Length")||"0"),a&&Object(z.isFiniteNumber)(A.highWaterMark)?c.loadProgressively(x,f,h,A.highWaterMark,a):y?x.arrayBuffer():x.text()}).then(function(x){var P=c.response;self.clearTimeout(c.requestTimeout),f.loading.end=Math.max(self.performance.now(),f.loading.first),f.loaded=f.total=x[m];var U={url:P.url,data:x};a&&!Object(z.isFiniteNumber)(A.highWaterMark)&&a(f,h,x,P),b.onSuccess(U,f,h,P)}).catch(function(x){if(self.clearTimeout(c.requestTimeout),f.aborted)return;var P=x.code||0;b.onError({code:P,text:x.message},h,x.details)})},S.getCacheAge=function(){var h=null;if(this.response){var A=this.response.headers.get("age");h=A?parseFloat(A):null}return h},S.loadProgressively=function(h,A,b,c,f){c===void 0&&(c=0);var d=new _.default,a=h.body.getReader(),y=function m(){return a.read().then(function(x){if(x.done)return d.dataLength&&f(A,b,d.flush(),h),Promise.resolve(new ArrayBuffer(0));var P=x.value,U=P.length;return A.loaded+=U,U<c||d.dataLength?(d.push(P),d.dataLength>=c&&f(A,b,d.flush(),h)):f(A,b,P,h),m()}).catch(function(){return Promise.reject()})};return y()},l}();function u(l,S){var p={method:"GET",mode:"cors",credentials:"same-origin",signal:S,headers:new self.Headers(C({},l.headers))};return l.rangeEnd&&p.headers.set("Range","bytes="+l.rangeStart+"-"+String(l.rangeEnd-1)),p}function o(l,S){return new self.Request(l.url,S)}var s=function(l){B(S,l);function S(p,h,A){var b;return b=l.call(this,p)||this,b.code=void 0,b.details=void 0,b.code=h,b.details=A,b}return S}(F(Error));G.default=v},"./src/utils/imsc1-ttml-parser.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"IMSC1_CODEC",function(){return g}),L.d(G,"parseIMSC1",function(){return w});var z=L("./src/utils/mp4-tools.ts"),I=L("./src/utils/vttparser.ts"),_=L("./src/utils/vttcue.ts"),B=L("./src/demux/id3.ts"),F=L("./src/utils/timescale-conversion.ts"),M=L("./src/utils/webvtt-parser.ts");function D(){return D=Object.assign||function(c){for(var f=1;f<arguments.length;f++){var d=arguments[f];for(var a in d)Object.prototype.hasOwnProperty.call(d,a)&&(c[a]=d[a])}return c},D.apply(this,arguments)}var g="stpp.ttml.im1t",T=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,R=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,C={left:"start",center:"center",right:"end",start:"start",end:"end"};function w(c,f,d,a,y){var m=Object(z.findBox)(new Uint8Array(c),["mdat"]);if(m.length===0){y(new Error("Could not parse IMSC1 mdat"));return}var x=m[0],P=Object(B.utf8ArrayToStr)(new Uint8Array(c,x.start,x.end-x.start)),U=Object(F.toTimescaleFromScale)(f,1,d);try{a(v(P,U))}catch(j){y(j)}}function v(c,f){var d=new DOMParser,a=d.parseFromString(c,"text/xml"),y=a.getElementsByTagName("tt")[0];if(!y)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},x=Object.keys(m).reduce(function(k,O){return k[O]=y.getAttribute("ttp:"+O)||m[O],k},{}),P=y.getAttribute("xml:space")!=="preserve",U=o(u(y,"styling","style")),j=o(u(y,"layout","region")),W=u(y,"body","[begin]");return[].map.call(W,function(k){var O=s(k,P);if(!O||!k.hasAttribute("begin"))return null;var K=h(k.getAttribute("begin"),x),Y=h(k.getAttribute("dur"),x),q=h(k.getAttribute("end"),x);if(K===null)throw p(k);if(q===null){if(Y===null)throw p(k);q=K+Y}var ie=new _.default(K-f,q-f,O);ie.id=Object(M.generateCueId)(ie.startTime,ie.endTime,ie.text);var Te=j[k.getAttribute("region")],ve=U[k.getAttribute("style")];ie.position=10,ie.size=80;var ge=l(Te,ve),he=ge.textAlign;if(he){var ce=C[he];ce&&(ie.lineAlign=ce),ie.align=he}return D(ie,ge),ie}).filter(function(k){return k!==null})}function u(c,f,d){var a=c.getElementsByTagName(f)[0];return a?[].slice.call(a.querySelectorAll(d)):[]}function o(c){return c.reduce(function(f,d){var a=d.getAttribute("xml:id");return a&&(f[a]=d),f},{})}function s(c,f){return[].slice.call(c.childNodes).reduce(function(d,a,y){var m;return a.nodeName==="br"&&y?d+`
|
|
`:(m=a.childNodes)!==null&&m!==void 0&&m.length?s(a,f):f?d+a.textContent.trim().replace(/\s+/g," "):d+a.textContent},"")}function l(c,f){var d="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(y,m){var x=S(f,d,m)||S(c,d,m);return x&&(y[m]=x),y},{})}function S(c,f,d){return c.hasAttributeNS(f,d)?c.getAttributeNS(f,d):null}function p(c){return new Error("Could not parse ttml timestamp "+c)}function h(c,f){if(!c)return null;var d=Object(I.parseTimeStamp)(c);return d===null&&(T.test(c)?d=A(c,f):R.test(c)&&(d=b(c,f))),d}function A(c,f){var d=T.exec(c),a=(d[4]|0)+(d[5]|0)/f.subFrameRate;return(d[1]|0)*3600+(d[2]|0)*60+(d[3]|0)+a/f.frameRate}function b(c,f){var d=R.exec(c),a=Number(d[1]),y=d[2];switch(y){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/f.frameRate;case"t":return a/f.tickRate}return a}},"./src/utils/logger.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"enableLogs",function(){return M}),L.d(G,"logger",function(){return D});var z=function(){},I={trace:z,debug:z,log:z,warn:z,info:z,error:z},_=I;function B(g){var T=self.console[g];return T?T.bind(self.console,"["+g+"] >"):z}function F(g){for(var T=arguments.length,R=new Array(T>1?T-1:0),C=1;C<T;C++)R[C-1]=arguments[C];R.forEach(function(w){_[w]=g[w]?g[w].bind(g):B(w)})}function M(g){if(self.console&&g===!0||typeof g=="object"){F(g,"debug","log","info","warn","error");try{_.log()}catch(T){_=I}}else _=I}var D=_},"./src/utils/mediakeys-helper.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"KeySystems",function(){return z}),L.d(G,"requestMediaKeySystemAccess",function(){return I});var z;(function(_){_.WIDEVINE="com.widevine.alpha",_.PLAYREADY="com.microsoft.playready"})(z||(z={}));var I=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"getMediaSource",function(){return z});function z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"bin2str",function(){return F}),L.d(G,"readUint16",function(){return M}),L.d(G,"readUint32",function(){return D}),L.d(G,"writeUint32",function(){return g}),L.d(G,"findBox",function(){return T}),L.d(G,"parseSegmentIndex",function(){return R}),L.d(G,"parseInitSegment",function(){return C}),L.d(G,"getStartDTS",function(){return w}),L.d(G,"getDuration",function(){return v}),L.d(G,"computeRawDurationFromSamples",function(){return u}),L.d(G,"offsetStartDTS",function(){return o}),L.d(G,"segmentValidRange",function(){return s}),L.d(G,"appendUint8Array",function(){return l});var z=L("./src/utils/typed-array.ts"),I=L("./src/loader/fragment.ts"),_=Math.pow(2,32)-1,B=[].push;function F(S){return String.fromCharCode.apply(null,S)}function M(S,p){"data"in S&&(p+=S.start,S=S.data);var h=S[p]<<8|S[p+1];return h<0?65536+h:h}function D(S,p){"data"in S&&(p+=S.start,S=S.data);var h=S[p]<<24|S[p+1]<<16|S[p+2]<<8|S[p+3];return h<0?4294967296+h:h}function g(S,p,h){"data"in S&&(p+=S.start,S=S.data),S[p]=h>>24,S[p+1]=h>>16&255,S[p+2]=h>>8&255,S[p+3]=h&255}function T(S,p){var h=[];if(!p.length)return h;var A,b,c;"data"in S?(A=S.data,b=S.start,c=S.end):(A=S,b=0,c=A.byteLength);for(var f=b;f<c;){var d=D(A,f),a=F(A.subarray(f+4,f+8)),y=d>1?f+d:c;if(a===p[0])if(p.length===1)h.push({data:A,start:f+8,end:y});else{var m=T({data:A,start:f+8,end:y},p.slice(1));m.length&&B.apply(h,m)}f=y}return h}function R(S){var p=T(S,["moov"]),h=p[0],A=h?h.end:null,b=T(S,["sidx"]);if(!b||!b[0])return null;var c=[],f=b[0],d=f.data[0],a=d===0?8:16,y=D(f,a);a+=4;var m=0,x=0;d===0?a+=8:a+=16,a+=2;var P=f.end+x,U=M(f,a);a+=2;for(var j=0;j<U;j++){var W=a,k=D(f,W);W+=4;var O=k&2147483647,K=(k&2147483648)>>>31;if(K===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Y=D(f,W);W+=4,c.push({referenceSize:O,subsegmentDuration:Y,info:{duration:Y/y,start:P,end:P+O-1}}),P+=O,W+=4,a=W}return{earliestPresentationTime:m,timescale:y,version:d,referencesCount:U,references:c,moovEndOffset:A}}function C(S){for(var p=[],h=T(S,["moov","trak"]),A=0;A<h.length;A++){var b=h[A],c=T(b,["tkhd"])[0];if(c){var f=c.data[c.start],d=f===0?12:20,a=D(c,d),y=T(b,["mdia","mdhd"])[0];if(y){f=y.data[y.start],d=f===0?12:20;var m=D(y,d),x=T(b,["mdia","hdlr"])[0];if(x){var P=F(x.data.subarray(x.start+8,x.start+12)),U={soun:I.ElementaryStreamTypes.AUDIO,vide:I.ElementaryStreamTypes.VIDEO}[P];if(U){var j=T(b,["mdia","minf","stbl","stsd"])[0],W=void 0;j&&(W=F(j.data.subarray(j.start+12,j.start+16))),p[a]={timescale:m,type:U},p[U]={timescale:m,id:a,codec:W}}}}}}var k=T(S,["moov","mvex","trex"]);return k.forEach(function(O){var K=D(O,4),Y=p[K];Y&&(Y.default={duration:D(O,12),flags:D(O,20)})}),p}function w(S,p){return T(p,["moof","traf"]).reduce(function(h,A){var b=T(A,["tfdt"])[0],c=b.data[b.start],f=T(A,["tfhd"]).reduce(function(d,a){var y=D(a,4),m=S[y];if(m){var x=D(b,4);c===1&&(x*=Math.pow(2,32),x+=D(b,8));var P=m.timescale||9e4,U=x/P;if(isFinite(U)&&(d===null||U<d))return U}return d},null);return f!==null&&isFinite(f)&&(h===null||f<h)?f:h},null)||0}function v(S,p){for(var h=0,A=0,b=0,c=T(S,["moof","traf"]),f=0;f<c.length;f++){var d=c[f],a=T(d,["tfhd"])[0],y=D(a,4),m=p[y];if(!m)continue;var x=m.default,P=D(a,0)|(x==null?void 0:x.flags),U=x==null?void 0:x.duration;P&8&&(P&2?U=D(a,12):U=D(a,8));for(var j=m.timescale||9e4,W=T(d,["trun"]),k=0;k<W.length;k++){if(U){var O=D(W[k],4);h=U*O}else h=u(W[k]);m.type===I.ElementaryStreamTypes.VIDEO?A+=h/j:m.type===I.ElementaryStreamTypes.AUDIO&&(b+=h/j)}}if(A===0&&b===0){var K=R(S);if(K!=null&&K.references)return K.references.reduce(function(Y,q){return Y+q.info.duration||0},0)}return A||b}function u(S){var p=D(S,0),h=8;p&1&&(h+=4),p&4&&(h+=4);for(var A=0,b=D(S,4),c=0;c<b;c++){if(p&256){var f=D(S,h);A+=f,h+=4}p&512&&(h+=4),p&1024&&(h+=4),p&2048&&(h+=4)}return A}function o(S,p,h){T(p,["moof","traf"]).forEach(function(A){T(A,["tfhd"]).forEach(function(b){var c=D(b,4),f=S[c];if(!f)return;var d=f.timescale||9e4;T(A,["tfdt"]).forEach(function(a){var y=a.data[a.start],m=D(a,4);if(y===0)g(a,4,m-h*d);else{m*=Math.pow(2,32),m+=D(a,8),m-=h*d,m=Math.max(m,0);var x=Math.floor(m/(_+1)),P=Math.floor(m%(_+1));g(a,4,x),g(a,8,P)}})})})}function s(S){var p={valid:null,remainder:null},h=T(S,["moof"]);if(h){if(h.length<2)return p.remainder=S,p}else return p;var A=h[h.length-1];return p.valid=Object(z.sliceUint8)(S,0,A.start-8),p.remainder=Object(z.sliceUint8)(S,A.start-8),p}function l(S,p){var h=new Uint8Array(S.length+p.length);return h.set(S),h.set(p,S.length),h}},"./src/utils/output-filter.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return z});var z=function(){function I(B,F){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=B,this.trackName=F}var _=I.prototype;return _.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},_.newCue=function(F,M,D){(this.startTime===null||this.startTime>F)&&(this.startTime=F),this.endTime=M,this.screen=D,this.timelineController.createCaptionsTrack(this.trackName)},_.reset=function(){this.cueRanges=[]},I}()},"./src/utils/texttrack-utils.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"sendAddTrackEvent",function(){return I}),L.d(G,"addCueToTrack",function(){return _}),L.d(G,"clearCurrentCues",function(){return B}),L.d(G,"removeCuesInRange",function(){return F}),L.d(G,"getCuesInRange",function(){return D});var z=L("./src/utils/logger.ts");function I(g,T){var R;try{R=new Event("addtrack")}catch(C){R=document.createEvent("Event"),R.initEvent("addtrack",!1,!1)}R.track=g,T.dispatchEvent(R)}function _(g,T){var R=g.mode;if(R==="disabled"&&(g.mode="hidden"),g.cues&&!g.cues.getCueById(T.id))try{if(g.addCue(T),!g.cues.getCueById(T.id))throw new Error("addCue is failed for: "+T)}catch(w){z.logger.debug("[texttrack-utils]: "+w);var C=new self.TextTrackCue(T.startTime,T.endTime,T.text);C.id=T.id,g.addCue(C)}R==="disabled"&&(g.mode=R)}function B(g){var T=g.mode;if(T==="disabled"&&(g.mode="hidden"),g.cues)for(var R=g.cues.length;R--;)g.removeCue(g.cues[R]);T==="disabled"&&(g.mode=T)}function F(g,T,R){var C=g.mode;if(C==="disabled"&&(g.mode="hidden"),g.cues&&g.cues.length>0)for(var w=D(g.cues,T,R),v=0;v<w.length;v++)g.removeCue(w[v]);C==="disabled"&&(g.mode=C)}function M(g,T){if(T<g[0].startTime)return 0;var R=g.length-1;if(T>g[R].endTime)return-1;for(var C=0,w=R;C<=w;){var v=Math.floor((w+C)/2);if(T<g[v].startTime)w=v-1;else if(T>g[v].startTime&&C<R)C=v+1;else return v}return g[C].startTime-T<T-g[w].startTime?C:w}function D(g,T,R){var C=[],w=M(g,T);if(w>-1)for(var v=w,u=g.length;v<u;v++){var o=g[v];if(o.startTime>=T&&o.endTime<=R)C.push(o);else if(o.startTime>R)return C}return C}},"./src/utils/time-ranges.ts":function(te,G,L){"use strict";L.r(G);var z={toString:function(_){for(var B="",F=_.length,M=0;M<F;M++)B+="["+_.start(M).toFixed(3)+","+_.end(M).toFixed(3)+"]";return B}};G.default=z},"./src/utils/timescale-conversion.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"toTimescaleFromBase",function(){return I}),L.d(G,"toTimescaleFromScale",function(){return _}),L.d(G,"toMsFromMpegTsClock",function(){return B}),L.d(G,"toMpegTsClockFromTimescale",function(){return F});var z=9e4;function I(M,D,g,T){g===void 0&&(g=1),T===void 0&&(T=!1);var R=M*D*g;return T?Math.round(R):R}function _(M,D,g,T){return g===void 0&&(g=1),T===void 0&&(T=!1),I(M,D,1/g,T)}function B(M,D){return D===void 0&&(D=!1),I(M,1e3,1/z,D)}function F(M,D){return D===void 0&&(D=1),I(M,z,1/D)}},"./src/utils/typed-array.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"sliceUint8",function(){return z});function z(I,_,B){return Uint8Array.prototype.slice?I.slice(_,B):new Uint8Array(Array.prototype.slice.call(I,_,B))}},"./src/utils/vttcue.ts":function(te,G,L){"use strict";L.r(G),G.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var z=["","lr","rl"],I=["start","middle","end","left","right"];function _(g,T){if(typeof T!="string")return!1;if(!Array.isArray(g))return!1;var R=T.toLowerCase();return~g.indexOf(R)?R:!1}function B(g){return _(z,g)}function F(g){return _(I,g)}function M(g){for(var T=arguments.length,R=new Array(T>1?T-1:0),C=1;C<T;C++)R[C-1]=arguments[C];for(var w=1;w<arguments.length;w++){var v=arguments[w];for(var u in v)g[u]=v[u]}return g}function D(g,T,R){var C=this,w={enumerable:!0};C.hasBeenReset=!1;var v="",u=!1,o=g,s=T,l=R,S=null,p="",h=!0,A="auto",b="start",c=50,f="middle",d=50,a="middle";Object.defineProperty(C,"id",M({},w,{get:function(){return v},set:function(m){v=""+m}})),Object.defineProperty(C,"pauseOnExit",M({},w,{get:function(){return u},set:function(m){u=!!m}})),Object.defineProperty(C,"startTime",M({},w,{get:function(){return o},set:function(m){if(typeof m!="number")throw new TypeError("Start time must be set to a number.");o=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"endTime",M({},w,{get:function(){return s},set:function(m){if(typeof m!="number")throw new TypeError("End time must be set to a number.");s=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"text",M({},w,{get:function(){return l},set:function(m){l=""+m,this.hasBeenReset=!0}})),Object.defineProperty(C,"region",M({},w,{get:function(){return S},set:function(m){S=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"vertical",M({},w,{get:function(){return p},set:function(m){var x=B(m);if(x===!1)throw new SyntaxError("An invalid or illegal string was specified.");p=x,this.hasBeenReset=!0}})),Object.defineProperty(C,"snapToLines",M({},w,{get:function(){return h},set:function(m){h=!!m,this.hasBeenReset=!0}})),Object.defineProperty(C,"line",M({},w,{get:function(){return A},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");A=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"lineAlign",M({},w,{get:function(){return b},set:function(m){var x=F(m);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");b=x,this.hasBeenReset=!0}})),Object.defineProperty(C,"position",M({},w,{get:function(){return c},set:function(m){if(m<0||m>100)throw new Error("Position must be between 0 and 100.");c=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"positionAlign",M({},w,{get:function(){return f},set:function(m){var x=F(m);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");f=x,this.hasBeenReset=!0}})),Object.defineProperty(C,"size",M({},w,{get:function(){return d},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");d=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"align",M({},w,{get:function(){return a},set:function(m){var x=F(m);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");a=x,this.hasBeenReset=!0}})),C.displayState=void 0}return D.prototype.getCueAsHTML=function(){var g=self.WebVTT;return g.convertCueToDOMTree(self,this.text)},D}()},"./src/utils/vttparser.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"parseTimeStamp",function(){return _}),L.d(G,"fixLineBreaks",function(){return T}),L.d(G,"VTTParser",function(){return R});var z=L("./src/utils/vttcue.ts"),I=function(){function C(){}var w=C.prototype;return w.decode=function(u,o){if(!u)return"";if(typeof u!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(u))},C}();function _(C){function w(u,o,s,l){return(u|0)*3600+(o|0)*60+(s|0)+parseFloat(l||0)}var v=C.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return v?parseFloat(v[2])>59?w(v[2],v[3],0,v[4]):w(v[1],v[2],v[3],v[4]):null}var B=function(){function C(){this.values=Object.create(null)}var w=C.prototype;return w.set=function(u,o){!this.get(u)&&o!==""&&(this.values[u]=o)},w.get=function(u,o,s){return s?this.has(u)?this.values[u]:o[s]:this.has(u)?this.values[u]:o},w.has=function(u){return u in this.values},w.alt=function(u,o,s){for(var l=0;l<s.length;++l)if(o===s[l]){this.set(u,o);break}},w.integer=function(u,o){/^-?\d+$/.test(o)&&this.set(u,parseInt(o,10))},w.percent=function(u,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var s=parseFloat(o);if(s>=0&&s<=100)return this.set(u,s),!0}return!1},C}();function F(C,w,v,u){var o=u?C.split(u):[C];for(var s in o){if(typeof o[s]!="string")continue;var l=o[s].split(v);if(l.length!==2)continue;var S=l[0],p=l[1];w(S,p)}}var M=new z.default(0,0,""),D=M.align==="middle"?"middle":"center";function g(C,w,v){var u=C;function o(){var S=_(C);if(S===null)throw new Error("Malformed timestamp: "+u);return C=C.replace(/^[^\sa-zA-Z-]+/,""),S}function s(S,p){var h=new B;F(S,function(c,f){var d;switch(c){case"region":for(var a=v.length-1;a>=0;a--)if(v[a].id===f){h.set(c,v[a].region);break}break;case"vertical":h.alt(c,f,["rl","lr"]);break;case"line":d=f.split(","),h.integer(c,d[0]),h.percent(c,d[0])&&h.set("snapToLines",!1),h.alt(c,d[0],["auto"]),d.length===2&&h.alt("lineAlign",d[1],["start",D,"end"]);break;case"position":d=f.split(","),h.percent(c,d[0]),d.length===2&&h.alt("positionAlign",d[1],["start",D,"end","line-left","line-right","auto"]);break;case"size":h.percent(c,f);break;case"align":h.alt(c,f,["start",D,"end","left","right"]);break}},/:/,/\s/),p.region=h.get("region",null),p.vertical=h.get("vertical","");var A=h.get("line","auto");A==="auto"&&M.line===-1&&(A=-1),p.line=A,p.lineAlign=h.get("lineAlign","start"),p.snapToLines=h.get("snapToLines",!0),p.size=h.get("size",100),p.align=h.get("align",D);var b=h.get("position","auto");b==="auto"&&M.position===50&&(b=p.align==="start"||p.align==="left"?0:p.align==="end"||p.align==="right"?100:50),p.position=b}function l(){C=C.replace(/^\s+/,"")}if(l(),w.startTime=o(),l(),C.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+u);C=C.substr(3),l(),w.endTime=o(),l(),s(C,w)}function T(C){return C.replace(/<br(?: \/)?>/gi,`
|
|
`)}var R=function(){function C(){this.state="INITIAL",this.buffer="",this.decoder=new I,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var w=C.prototype;return w.parse=function(u){var o=this;u&&(o.buffer+=o.decoder.decode(u,{stream:!0}));function s(){var b=o.buffer,c=0;for(b=T(b);c<b.length&&b[c]!=="\r"&&b[c]!==`
|
|
`;)++c;var f=b.substr(0,c);return b[c]==="\r"&&++c,b[c]===`
|
|
`&&++c,o.buffer=b.substr(c),f}function l(b){F(b,function(c,f){},/:/)}try{var S="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;S=s();var p=S.match(/^()?WEBVTT([ \t].*)?$/);if(!p||!p[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var h=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;h?h=!1:S=s();switch(o.state){case"HEADER":/:/.test(S)?l(S):S||(o.state="ID");continue;case"NOTE":S||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(S)){o.state="NOTE";break}if(!S)continue;if(o.cue=new z.default(0,0,""),o.state="CUE",S.indexOf("-->")===-1){o.cue.id=S;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{g(S,o.cue,o.regionList)}catch(b){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var A=S.indexOf("-->")!==-1;if(!S||A&&(h=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
|
|
`),o.cue.text+=S}continue;case"BADCUE":S||(o.state="ID")}}}catch(b){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},w.flush=function(){var u=this;try{if((u.cue||u.state==="HEADER")&&(u.buffer+=`
|
|
|
|
`,u.parse()),u.state==="INITIAL"||u.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){u.onparsingerror&&u.onparsingerror(o)}return u.onflush&&u.onflush(),this},C}()},"./src/utils/webvtt-parser.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"generateCueId",function(){return R}),L.d(G,"parseWebVTT",function(){return w});var z=L("./src/polyfills/number.ts"),I=L("./src/utils/vttparser.ts"),_=L("./src/demux/id3.ts"),B=L("./src/utils/timescale-conversion.ts"),F=L("./src/remux/mp4-remuxer.ts"),M=/\r\n|\n\r|\n|\r/g,D=function(u,o,s){return s===void 0&&(s=0),u.substr(s,o.length)===o},g=function(u){var o=parseInt(u.substr(-3)),s=parseInt(u.substr(-6,2)),l=parseInt(u.substr(-9,2)),S=u.length>9?parseInt(u.substr(0,u.indexOf(":"))):0;if(!Object(z.isFiniteNumber)(o)||!Object(z.isFiniteNumber)(s)||!Object(z.isFiniteNumber)(l)||!Object(z.isFiniteNumber)(S))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+u);return o+=1e3*s,o+=60*1e3*l,o+=60*60*1e3*S,o},T=function(u){for(var o=5381,s=u.length;s;)o=o*33^u.charCodeAt(--s);return(o>>>0).toString()};function R(v,u,o){return T(v.toString())+T(u.toString())+T(o)}var C=function(u,o,s){var l=u[o],S=u[l.prevCC];if(!S||!S.new&&l.new){u.ccOffset=u.presentationOffset=l.start,l.new=!1;return}for(;(p=S)!==null&&p!==void 0&&p.new;){var p;u.ccOffset+=l.start-S.start,l.new=!1,l=S,S=u[l.prevCC]}u.presentationOffset=s};function w(v,u,o,s,l,S,p,h){var A=new I.VTTParser,b=Object(_.utf8ArrayToStr)(new Uint8Array(v)).trim().replace(M,`
|
|
`).split(`
|
|
`),c=[],f=Object(B.toMpegTsClockFromTimescale)(u,o),d="00:00.000",a=0,y=0,m,x=!0,P=!1;A.oncue=function(U){var j=s[l],W=s.ccOffset,k=(a-f)/9e4;if(j!=null&&j.new&&(y!==void 0?W=s.ccOffset=j.start:C(s,l,k)),k&&(W=k-s.presentationOffset),P){var O=U.endTime-U.startTime,K=Object(F.normalizePts)((U.startTime+W-y)*9e4,S*9e4)/9e4;U.startTime=K,U.endTime=K+O}var Y=U.text.trim();U.text=decodeURIComponent(encodeURIComponent(Y)),U.id||(U.id=R(U.startTime,U.endTime,Y)),U.endTime>0&&c.push(U)},A.onparsingerror=function(U){m=U},A.onflush=function(){if(m){h(m);return}p(c)},b.forEach(function(U){if(x)if(D(U,"X-TIMESTAMP-MAP=")){x=!1,P=!0,U.substr(16).split(",").forEach(function(j){D(j,"LOCAL:")?d=j.substr(6):D(j,"MPEGTS:")&&(a=parseInt(j.substr(7)))});try{y=g(d)/1e3}catch(j){P=!1,m=j}return}else U===""&&(x=!1);A.parse(U+`
|
|
`)}),A.flush()}},"./src/utils/xhr-loader.ts":function(te,G,L){"use strict";L.r(G);var z=L("./src/utils/logger.ts"),I=L("./src/loader/load-stats.ts"),_=/^age:\s*[\d.]+\s*$/m,B=function(){function F(D){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=D?D.xhrSetup:null,this.stats=new I.LoadStats,this.retryDelay=0}var M=F.prototype;return M.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},M.abortInternal=function(){var g=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),g&&(g.onreadystatechange=null,g.onprogress=null,g.readyState!==4&&(this.stats.aborted=!0,g.abort()))},M.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},M.load=function(g,T,R){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=g,this.config=T,this.callbacks=R,this.retryDelay=T.retryDelay,this.loadInternal()},M.loadInternal=function(){var g=this.config,T=this.context;if(!g)return;var R=this.loader=new self.XMLHttpRequest,C=this.stats;C.loading.first=0,C.loaded=0;var w=this.xhrSetup;try{if(w)try{w(R,T.url)}catch(o){R.open("GET",T.url,!0),w(R,T.url)}R.readyState||R.open("GET",T.url,!0);var v=this.context.headers;if(v)for(var u in v)R.setRequestHeader(u,v[u])}catch(o){this.callbacks.onError({code:R.status,text:o.message},T,R);return}T.rangeEnd&&R.setRequestHeader("Range","bytes="+T.rangeStart+"-"+(T.rangeEnd-1)),R.onreadystatechange=this.readystatechange.bind(this),R.onprogress=this.loadprogress.bind(this),R.responseType=T.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),g.timeout),R.send()},M.readystatechange=function(){var g=this.context,T=this.loader,R=this.stats;if(!g||!T)return;var C=T.readyState,w=this.config;if(R.aborted)return;if(C>=2)if(self.clearTimeout(this.requestTimeout),R.loading.first===0&&(R.loading.first=Math.max(self.performance.now(),R.loading.start)),C===4){T.onreadystatechange=null,T.onprogress=null;var v=T.status;if(v>=200&&v<300){R.loading.end=Math.max(self.performance.now(),R.loading.first);var u,o;if(g.responseType==="arraybuffer"?(u=T.response,o=u.byteLength):(u=T.responseText,o=u.length),R.loaded=R.total=o,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(R,g,u,T),!this.callbacks)return;var l={url:T.responseURL,data:u};this.callbacks.onSuccess(l,R,g,T)}else R.retry>=w.maxRetry||v>=400&&v<499?(z.logger.error(v+" while loading "+g.url),this.callbacks.onError({code:v,text:T.statusText},g,T)):(z.logger.warn(v+" while loading "+g.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,w.maxRetryDelay),R.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),w.timeout)},M.loadtimeout=function(){z.logger.warn("timeout while loading "+this.context.url);var g=this.callbacks;g&&(this.abortInternal(),g.onTimeout(this.stats,this.context,this.loader))},M.loadprogress=function(g){var T=this.stats;T.loaded=g.loaded,g.lengthComputable&&(T.total=g.total)},M.getCacheAge=function(){var g=null;if(this.loader&&_.test(this.loader.getAllResponseHeaders())){var T=this.loader.getResponseHeader("age");g=T?parseFloat(T):null}return g},F}();G.default=B}}).default})},vHTk:function(ut,et,oe){ut.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|