(window.webpackJsonp=window.webpackJsonp||[]).push([[186,6,7,16],{"+NIl":function(Ze,Ke,te){(function(J){J(te("VrN/"))})(function(J){"use strict";J.defineMode("stex",function(K,L){"use strict";function H(w,b){w.cmdState.push(b)}function I(w){return w.cmdState.length>0?w.cmdState[w.cmdState.length-1]:null}function O(w){var b=w.cmdState.pop();b&&b.closeBracket()}function B(w){for(var b=w.cmdState,E=b.length-1;E>=0;E--){var l=b[E];if(l.name=="DEFAULT")continue;return l}return{styleIdentifier:function(){return null}}}function N(w,b,E){return function(){this.name=w,this.bracketNo=0,this.style=b,this.styles=E,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var R={};R.importmodule=N("importmodule","tag",["string","builtin"]),R.documentclass=N("documentclass","tag",["","atom"]),R.usepackage=N("usepackage","tag",["atom"]),R.begin=N("begin","tag",["atom"]),R.end=N("end","tag",["atom"]),R.label=N("label","tag",["atom"]),R.ref=N("ref","tag",["atom"]),R.eqref=N("eqref","tag",["atom"]),R.cite=N("cite","tag",["atom"]),R.bibitem=N("bibitem","tag",["atom"]),R.Bibitem=N("Bibitem","tag",["atom"]),R.RBibitem=N("RBibitem","tag",["atom"]),R.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function A(w,b){w.f=b}function f(w,b){var E;if(w.match(/^\\[a-zA-Z@]+/)){var l=w.current().slice(1);return E=R.hasOwnProperty(l)?R[l]:R.DEFAULT,E=new E,H(b,E),A(b,P),E.style}if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/\\]/))return"tag";if(w.match("\\["))return A(b,function(s,d){return v(s,d,"\\]")}),"keyword";if(w.match("\\("))return A(b,function(s,d){return v(s,d,"\\)")}),"keyword";if(w.match("$$"))return A(b,function(s,d){return v(s,d,"$$")}),"keyword";if(w.match("$"))return A(b,function(s,d){return v(s,d,"$")}),"keyword";var o=w.next();if(o=="%")return w.skipToEnd(),"comment";if(o=="}"||o=="]"){if(E=I(b),E)E.closeBracket(o),A(b,P);else return"error";return"bracket"}else return o=="{"||o=="["?(E=R.DEFAULT,E=new E,H(b,E),"bracket"):/\d/.test(o)?(w.eatWhile(/[\w.%]/),"atom"):(w.eatWhile(/[\w\-_]/),E=B(b),E.name=="begin"&&(E.argument=w.current()),E.styleIdentifier())}function v(w,b,E){if(w.eatSpace())return null;if(E&&w.match(E))return A(b,f),"keyword";if(w.match(/^\\[a-zA-Z@]+/))return"tag";if(w.match(/^[a-zA-Z]+/))return"variable-2";if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/]/))return"tag";if(w.match(/^[\^_&]/))return"tag";if(w.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(w.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var l=w.next();return l=="{"||l=="}"||l=="["||l=="]"||l=="("||l==")"?"bracket":l=="%"?(w.skipToEnd(),"comment"):"error"}function P(w,b){var E=w.peek(),l;return E=="{"||E=="["?(l=I(b),l.openBracket(E),w.eat(E),A(b,f),"bracket"):/[ \t\r]/.test(E)?(w.eat(E),null):(A(b,f),O(b),f(w,b))}return{startState:function(){var w=L.inMathMode?function(b,E){return v(b,E)}:f;return{cmdState:[],f:w}},copyState:function(w){return{cmdState:w.cmdState.slice(),f:w.f}},token:function(w,b){return b.f(w,b)},blankLine:function(w){w.f=f,w.cmdState.length=0},lineComment:"%"}}),J.defineMIME("text/x-stex","stex"),J.defineMIME("text/x-latex","stex")})},"19Vz":function(Ze,Ke,te){(function(J){J(te("VrN/"))})(function(J){J.defineOption("placeholder","",function(N,R,A){var f=A&&A!=J.Init;if(R&&!f)N.on("blur",I),N.on("change",O),N.on("swapDoc",O),J.on(N.getInputField(),"compositionupdate",N.state.placeholderCompose=function(){H(N)}),O(N);else if(!R&&f){N.off("blur",I),N.off("change",O),N.off("swapDoc",O),J.off(N.getInputField(),"compositionupdate",N.state.placeholderCompose),K(N);var v=N.getWrapperElement();v.className=v.className.replace(" CodeMirror-empty","")}R&&!N.hasFocus()&&I(N)});function K(N){N.state.placeholder&&(N.state.placeholder.parentNode.removeChild(N.state.placeholder),N.state.placeholder=null)}function L(N){K(N);var R=N.state.placeholder=document.createElement("pre");R.style.cssText="height: 0; overflow: visible",R.style.direction=N.getOption("direction"),R.className="CodeMirror-placeholder CodeMirror-line-like";var A=N.getOption("placeholder");typeof A=="string"&&(A=document.createTextNode(A)),R.appendChild(A),N.display.lineSpace.insertBefore(R,N.display.lineSpace.firstChild)}function H(N){setTimeout(function(){var R=!1,A=N.getInputField();A.nodeName=="TEXTAREA"?R=!A.value:N.lineCount()==1&&(R=!/[^\u200b]/.test(A.querySelector(".CodeMirror-line").textContent)),R?L(N):K(N)},20)}function I(N){B(N)&&L(N)}function O(N){var R=N.getWrapperElement(),A=B(N);R.className=R.className.replace(" CodeMirror-empty","")+(A?" CodeMirror-empty":""),A?L(N):K(N)}function B(N){return N.lineCount()===1&&N.getLine(0)===""}})},"1eCo":function(Ze,Ke,te){(function(J){J(te("VrN/"))})(function(J){"use strict";var K={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},L={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};J.defineMode("xml",function(H,I){var O=H.indentUnit,B={},N=I.htmlMode?K:L;for(var R in N)B[R]=N[R];for(var R in I)B[R]=I[R];var A,f;function v(a,x){function y(F){return x.tokenize=F,F(a,x)}var p=a.next();if(p=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?y(b("atom","]]>")):null:a.match("--")?y(b("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),y(E(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),x.tokenize=b("meta","?>"),"meta"):(A=a.eat("/")?"closeTag":"openTag",x.tokenize=P,"tag bracket");if(p=="&"){var k;return a.eat("#")?a.eat("x")?k=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):k=a.eatWhile(/[\d]/)&&a.eat(";"):k=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),k?"atom":"error"}else return a.eatWhile(/[^&<]/),null}v.isInText=!0;function P(a,x){var y=a.next();if(y==">"||y=="/"&&a.eat(">"))return x.tokenize=v,A=y==">"?"endTag":"selfcloseTag","tag bracket";if(y=="=")return A="equals",null;if(y=="<"){x.tokenize=v,x.state=d,x.tagName=x.tagStart=null;var p=x.tokenize(a,x);return p?p+" tag error":"tag error"}else return/[\'\"]/.test(y)?(x.tokenize=w(y),x.stringStartCol=a.column(),x.tokenize(a,x)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function w(a){var x=function(y,p){for(;!y.eol();)if(y.next()==a){p.tokenize=P;break}return"string"};return x.isInAttribute=!0,x}function b(a,x){return function(y,p){for(;!y.eol();){if(y.match(x)){p.tokenize=v;break}y.next()}return a}}function E(a){return function(x,y){for(var p;(p=x.next())!=null;){if(p=="<")return y.tokenize=E(a+1),y.tokenize(x,y);if(p==">")if(a==1){y.tokenize=v;break}else return y.tokenize=E(a-1),y.tokenize(x,y)}return"meta"}}function l(a,x,y){this.prev=a.context,this.tagName=x,this.indent=a.indented,this.startOfLine=y,(B.doNotIndent.hasOwnProperty(x)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function s(a,x){for(var y;;){if(!a.context)return;if(y=a.context.tagName,!B.contextGrabbers.hasOwnProperty(y)||!B.contextGrabbers[y].hasOwnProperty(x))return;o(a)}}function d(a,x,y){return a=="openTag"?(y.tagStart=x.column(),C):a=="closeTag"?g:d}function C(a,x,y){return a=="word"?(y.tagName=x.current(),f="tag",T):B.allowMissingTagName&&a=="endTag"?(f="tag bracket",T(a,x,y)):(f="error",C)}function g(a,x,y){if(a=="word"){var p=x.current();return y.context&&y.context.tagName!=p&&B.implicitlyClosed.hasOwnProperty(y.context.tagName)&&o(y),y.context&&y.context.tagName==p||B.matchClosing===!1?(f="tag",m):(f="tag error",D)}else return B.allowMissingTagName&&a=="endTag"?(f="tag bracket",m(a,x,y)):(f="error",D)}function m(a,x,y){return a!="endTag"?(f="error",m):(o(y),d)}function D(a,x,y){return f="error",m(a,x,y)}function T(a,x,y){if(a=="word")return f="attribute",h;if(a=="endTag"||a=="selfcloseTag"){var p=y.tagName,k=y.tagStart;return y.tagName=y.tagStart=null,a=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(p)?s(y,p):(s(y,p),y.context=new l(y,p,k==y.indented)),d}return f="error",T}function h(a,x,y){return a=="equals"?c:(B.allowMissing||(f="error"),T(a,x,y))}function c(a,x,y){return a=="string"?u:a=="word"&&B.allowUnquoted?(f="string",T):(f="error",T(a,x,y))}function u(a,x,y){return a=="string"?u:T(a,x,y)}return{startState:function(a){var x={tokenize:v,state:d,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(x.baseIndent=a),x},token:function(a,x){if(!x.tagName&&a.sol()&&(x.indented=a.indentation()),a.eatSpace())return null;A=null;var y=x.tokenize(a,x);return(y||A)&&y!="comment"&&(f=null,x.state=x.state(A||y,a,x),f&&(y=f=="error"?y+" error":f)),y},indent:function(a,x,y){var p=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+O;if(p&&p.noIndent)return J.Pass;if(a.tokenize!=P&&a.tokenize!=v)return y?y.match(/^(\s*)/)[0].length:0;if(a.tagName)return B.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+O*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/$/,blockCommentStart:"",configuration:B.htmlMode?"html":"xml",helperType:B.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=T)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var x=[],y=a.context;y;y=y.prev)y.tagName&&x.push(y.tagName);return x.reverse()}}}),J.defineMIME("text/xml","xml"),J.defineMIME("application/xml","xml"),J.mimeModes.hasOwnProperty("text/html")||J.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"55Ip":function(Ze,Ke,te){"use strict";te.d(Ke,"a",function(){return s});var J=te("Ty5D"),K=te("dI71"),L=te("cDcd"),H=te.n(L),I=te("YS25"),O=te("17x9"),B=te.n(O),N=te("wx14"),R=te("zLVn"),A=te("9R94"),f=function(c){Object(K.a)(u,c);function u(){for(var x,y=arguments.length,p=new Array(y),k=0;k1&&arguments[1]!==void 0?arguments[1]:0,b=(B[P[w+0]]+B[P[w+1]]+B[P[w+2]]+B[P[w+3]]+"-"+B[P[w+4]]+B[P[w+5]]+"-"+B[P[w+6]]+B[P[w+7]]+"-"+B[P[w+8]]+B[P[w+9]]+"-"+B[P[w+10]]+B[P[w+11]]+B[P[w+12]]+B[P[w+13]]+B[P[w+14]]+B[P[w+15]]).toLowerCase();if(!O(b))throw TypeError("Stringified UUID is invalid");return b}var A=R;function f(P,w,b){P=P||{};var E=P.random||(P.rng||L)();if(E[6]=E[6]&15|64,E[8]=E[8]&63|128,w){b=b||0;for(var l=0;l<16;++l)w[b+l]=E[l];return w}return A(E)}var v=Ke.a=f},"7ahc":function(Ze,Ke,te){"use strict";te.d(Ke,"a",function(){return C});var J=te("k1fw"),K=te("0Owb"),L=te("+L6B"),H=te("2/Rp"),I=te("y8nQ"),O=te("Vl3Y"),B=te("tJVT"),N=te("OaEy"),R=te("2fM7"),A=te("cDcd"),f=te.n(A),v=te("VrN/"),P=te.n(v),w=te("p77/"),b=te.n(w),E=te("c5Ni"),l=te.n(E),o=R.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},d={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};Ke.b=function(g){var m=g.callback,D=g.onCancel,T=Object(A.useState)("python"),h=Object(B.a)(T,2),c=h[0],u=h[1];function a(y){u(d[y][1])}function x(y){m(y)}return f.a.createElement(O.a,Object(K.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:x}),f.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},f.a.createElement(R.a,{onChange:a},Object.keys(d).map(function(y){return f.a.createElement(o,{key:y,value:y},d[y][0])}))),f.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},f.a.createElement(C,{mode:c})),f.a.createElement("div",{className:"flex-container flex-end"},f.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(H.a,{type:"ghost",onClick:D},"\u53D6\u6D88")))};function C(g){var m=g.value,D=g.onChange,T=g.mode,h=g.options,c=h===void 0?{}:h,u=Object(A.useRef)(),a=Object(A.useState)(),x=Object(B.a)(a,2),y=x[0],p=x[1];return Object(A.useEffect)(function(){if(y){function k(F){var U=F.getValue();D&&D(U)}return y.on("change",k),function(){y.off("change",k)}}},[y,D]),Object(A.useEffect)(function(){y&&y.setOption("mode",T)},[y,T]),Object(A.useEffect)(function(){y&&((m!==y.getValue()||m==="")&&setTimeout(function(){y.setValue(m||" ")},300))},[y,m]),Object(A.useEffect)(function(){if(u.current&&!y){var k=P.a.fromTextArea(u.current,Object(J.a)({mode:T,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));p(k)}},[u.current,y]),f.a.createElement("div",{className:"my-codemirror-container"},f.a.createElement("textarea",{ref:u}))}},"7ixt":function(Ze,Ke,te){"use strict";te.d(Ke,"a",function(){return L});var J={adjustX:1,adjustY:1},K=[0,0],L={left:{points:["cr","cl"],overflow:J,offset:[-4,0],targetOffset:K},right:{points:["cl","cr"],overflow:J,offset:[4,0],targetOffset:K},top:{points:["bc","tc"],overflow:J,offset:[0,-4],targetOffset:K},bottom:{points:["tc","bc"],overflow:J,offset:[0,4],targetOffset:K},topLeft:{points:["bl","tl"],overflow:J,offset:[0,-4],targetOffset:K},leftTop:{points:["tr","tl"],overflow:J,offset:[-4,0],targetOffset:K},topRight:{points:["br","tr"],overflow:J,offset:[0,-4],targetOffset:K},rightTop:{points:["tl","tr"],overflow:J,offset:[4,0],targetOffset:K},bottomRight:{points:["tr","br"],overflow:J,offset:[0,4],targetOffset:K},rightBottom:{points:["bl","br"],overflow:J,offset:[4,0],targetOffset:K},bottomLeft:{points:["tl","bl"],overflow:J,offset:[0,4],targetOffset:K},leftBottom:{points:["br","bl"],overflow:J,offset:[-4,0],targetOffset:K}},H=L},"8EBN":function(Ze,Ke,te){(function(J){J(te("VrN/"))})(function(J){"use strict";J.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var K=0;K-1&&H.substring(B+1,H.length);if(N)return J.findModeByExtension(N)},J.findModeByName=function(H){H=H.toLowerCase();for(var I=0;I=ie.length?he.slice(ie.length):he}).join(` `)}var w=[],b=["
    "],E=new f.a.Renderer,l=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function o(){w.length=0,b=["
      "]}var s={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function d(pe,ue,fe,ie){if(ue>=pe.length||pe[ue].level<=fe)return ue;var he=pe[ue];ie.push("
    • "+he.text+""),ue++;var $=[];return ue=d(pe,ue,he.level,$),$.length>0&&(ie.push("
        "),$.forEach(function(ae){ie.push(ae)}),ie.push("
      ")),ie.push("
    • "),ue=d(pe,ue,fe,ie),ue}function C(){return d(w,0,0,b),b.push("
    "),b.join("")}var g={heading:function(ue){var fe=l.exec(ue);if(fe)return{type:"heading",raw:fe[0],depth:fe[1].length,text:fe[2]}},fences:function(ue){var fe=this.rules.block.fences.exec(ue);if(fe){var ie=fe[0],he=P(ie,fe[3]||""),$=fe[2]?fe[2].trim():fe[2];if(["latex","katex","math"].indexOf($)>=0){var ae=T(),ee=he;he=ae,h[ae]={type:"block",expression:ee}}return{type:"code",raw:ie,lang:$,text:he}}}},m=/(?:\${2})([^\n`]+?)(?:\${2})/gi,D=0,T=function(){return"__special_katext_id_".concat(D++,"__")},h={};function c(){return h}function u(){D=0,h={}}function a(pe){return pe=pe.replace(m,function(ue,fe){var ie=T();return h[ie]={type:"inline",expression:fe},ie}),pe}var x=E.listitem;E.listitem=function(pe){return x(a(pe))};var y=E.paragraph;E.paragraph=function(pe){return y(a(pe))};var p=E.tablecell;E.tablecell=function(pe,ue){return p(a(pe),ue)},E.code=function(pe,ue,fe){var ie=(ue||"").match(/\S*/)[0];return ie?["latex","katex","math"].indexOf(ie)>=0?"

    ".concat(pe,"

    "):'
    ').concat(fe?pe:Object(v.escape)(pe,!0),`
    `):'
    '+(fe?pe:Object(v.escape)(pe,!0))+"
    "},E.heading=function(pe,ue,fe){var ie=this.options.headerPrefix+fe.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return w.push({anchor:ie,level:ue,text:pe}),"'+pe+""},f.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),f.a.use({tokenizer:g,renderer:E});var k=f.a,F=te("SJMd"),U=te("ulZh"),W=te.n(U),_=te("m3rI"),M=te("Oy/b"),G=te("p5ED"),Y=te("8hTe"),Z=te.n(Y),ne=/]*>/g;function be(pe){var ue=document.createElement("div");return ue.innerHTML=pe,ue.childNodes.length===0?"":ue.childNodes[0].nodeValue}var me=Ke.a=function(pe){var ue=pe.value,fe=ue===void 0?"":ue,ie=pe.edit,he=ie===void 0?!1:ie,$=pe.className,ae=pe.showTextOnly,ee=pe.showLines,Ee=pe.replaces,Ce=pe.zoomImg,ve=pe.hasMask,Se=pe.style,De=Se===void 0?{}:Se,_e=pe.stylesPrev,ke=_e===void 0?{}:_e,Re=String(fe),Ae=Object(B.useRef)(),Ue=Object(B.useRef)(),Ye=Object(B.useState)(""),Ge=Object(O.a)(Ye,2),He=Ge[0],et=Ge[1],Je=Object(B.useState)("office"),Xe=Object(O.a)(Je,2),we=Xe[0],rt=Xe[1],$e=Object(B.useMemo)(function(){try{var ce=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Q=/\"\/api\/attachments\/|\"\/attachments\/download\//g,q=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Re=Re.replace(ce,"("+_.a.API_SERVER+"/api/attachments/").replace(Q,'"'+_.a.API_SERVER+"/api/attachments/").replace(q,'"'+_.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,` `)}catch(Oe){}var re=k(Re),se=c();if(Re.match(/\[TOC\]/)&&(re=re.replace("

    [TOC]

    ",C()),o()),re=re.replace(/(__special_katext_id_\d+__)/g,function(Oe,je){var st=se[je],ht=st.type,Me=st.expression;return Object(M.renderToString)(be(Me)||"",{displayMode:ht==="block",throwOnError:!1,output:"html"})}),re=re.replace(/▁/g,"\u2581\u2581\u2581"),u(),ae){var Te=document.createElement("div");return Te.innerHTML=re,Te.innerText}return setTimeout(function(){return ge()},500),re},[Re]),Le=Object(B.useRef)();s.WebkitLineClamp=ee,ee&&(De=Object(I.a)(Object(I.a)({},De),s));function Fe(ce){var Q=ce.target;if(Q.tagName.toUpperCase()==="IMG"){if(Ce){var q=Q.getAttribute("src");et(q),rt("image")}}else if(Q.tagName.toUpperCase()==="A"){var re=Q.getAttribute("href");if(re.indexOf("office")>-1)ce.preventDefault(),et(re),rt("office");else if(re.indexOf("application/pdf")>-1)ce.preventDefault(),et(re),rt("pdf");else if(re.indexOf("text/html")>-1)ce.preventDefault(),et(re),rt("html");else if(re.startsWith("#")){ce.preventDefault();var se=document.getElementById(re.replace("#",""));se&&se.scrollIntoView(!0)}}}var ge=function(){var Q,q=(Q=Le.current)===null||Q===void 0?void 0:Q.querySelectorAll("video");q==null||q.forEach(function(re){if(re.oncontextmenu=function(){return!1},re.src.indexOf(".m3u8")>-1&&!re.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var se=new W.a;se.loadSource(re.src),se.attachMedia(re)}}})};Object(B.useEffect)(function(){if(Le.current&&$e&&($e.match(ne)&&window.PR.prettyPrint()),Le.current)return Le.current.addEventListener("click",Fe),function(){Le.current.removeEventListener("click",Fe),u(),o()}},[$e,Le.current,Fe]);var de=function(Q){if(!he)return;Q.target.nodeName==="IMG"?(Ae.current.style.display="flex",Ae.current.style.width=Q.target.clientWidth+"px",Ae.current.style.height=Q.target.clientHeight+"px",Ae.current.style.top=Q.target.offsetTop+"px",Ae.current.style.left=Q.target.offsetLeft+"px",Ue.current.src=Q.target.getAttribute("src")):Ae.current.style.display="none"};return N.a.createElement("div",{style:{position:"relative"}},N.a.createElement("div",{ref:Le,style:Object(I.a)({},De),className:"".concat($||""," markdown-body ").concat(Z.a.mdBody),onMouseOver:de,dangerouslySetInnerHTML:{__html:$e}}),N.a.createElement("div",{ref:Ae,className:Z.a.button},N.a.createElement(K.a,null,N.a.createElement(H.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),N.a.createElement(H.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),N.a.createElement("img",{ref:Ue,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),N.a.createElement(G.a,{close:!0,data:He,type:He!=null&&He.length?we:"",style:Object(I.a)({},ke),onClose:function(){return et("")}}))}},"9VGf":function(Ze,Ke,te){"use strict";te.d(Ke,"a",function(){return L});var J=te("cDcd"),K=te.n(J);function L(H,I){var O=Object(J.useRef)();Object(J.useEffect)(function(){O.current=H}),Object(J.useEffect)(function(){function B(){O.current()}if(I!==null){var N=setInterval(B,I);return function(){return clearInterval(N)}}},[I])}},Bd2K:function(Ze,Ke,te){(function(J){J(te("VrN/"),te("osHv"))})(function(J){J.defineOption("autoCloseTags",!1,function(R,A,f){if(f!=J.Init&&f&&R.removeKeyMap("autoCloseTags"),!A)return;var v={name:"autoCloseTags"};(typeof A!="object"||A.whenClosing!==!1)&&(v["'/'"]=function(P){return O(P)}),(typeof A!="object"||A.whenOpening!==!1)&&(v["'>'"]=function(P){return H(P)}),R.addKeyMap(v)});var K=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],L=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function H(R){if(R.getOption("disableInput"))return J.Pass;for(var A=R.listSelections(),f=[],v=R.getOption("autoCloseTags"),P=0;Pw.ch&&(s=s.slice(0,s.length-b.end+w.ch));var m=s.toLowerCase();if(!s||b.type=="string"&&(b.end!=w.ch||!/[\"\']/.test(b.string.charAt(b.string.length-1))||b.string.length==1)||b.type=="tag"&&o.close||b.string.indexOf("/")==w.ch-b.start-1||C&&B(C,m)>-1||N(R,E.mode.xmlCurrentContext&&E.mode.xmlCurrentContext(l)||[],s,w,!0))return J.Pass;var D=typeof v=="object"&&v.emptyTags;if(D&&B(D,s)>-1){f[P]={text:"/>",newPos:J.Pos(w.line,w.ch+2)};continue}var T=g&&B(g,m)>-1;f[P]={indent:T,text:">"+(T?` `:"")+"",newPos:T?J.Pos(w.line+1,0):J.Pos(w.line,w.ch+1)}}for(var h=typeof v=="object"&&v.dontIndentOnAutoClose,P=A.length-1;P>=0;P--){var c=f[P];R.replaceRange(c.text,A[P].head,A[P].anchor,"+insert");var u=R.listSelections().slice(0);u[P]={head:c.newPos,anchor:c.newPos},R.setSelections(u),!h&&c.indent&&(R.indentLine(c.newPos.line,null,!0),R.indentLine(c.newPos.line+1,null,!0))}}function I(R,A){for(var f=R.listSelections(),v=[],P=A?"/":""&&(C+=">"),v[E]=C}if(R.replaceSelections(v),f=R.listSelections(),!b)for(var E=0;E=0&&A[l]==f;l--)++E;v=b.to;for(var l=1;l0){for(var A=0;A1&&arguments[1]!==void 0?arguments[1]:"",A=[],f=0;f=0)continue;if(!Object.prototype.propertyIsEnumerable.call(p,U))continue;F[U]=p[U]}}return F}function O(p,k){if(p==null)return{};var F={},U=Object.keys(p),W,_;for(_=0;_=0)continue;F[W]=p[W]}return F}function B(p,k){if(!(p instanceof k))throw new TypeError("Cannot call a class as a function")}function N(p,k){for(var F=0;F>6),k+=String.fromCharCode(128|U&63)):U<55296||U>=57344?(k+=String.fromCharCode(224|U>>12),k+=String.fromCharCode(128|U>>6&63),k+=String.fromCharCode(128|U&63)):(F++,U=65536+((U&1023)<<10|p.charCodeAt(F)&1023),k+=String.fromCharCode(240|U>>18),k+=String.fromCharCode(128|U>>12&63),k+=String.fromCharCode(128|U>>6&63),k+=String.fromCharCode(128|U&63))}return k}var C={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},g={},m=4,D=.1;function T(p){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,F=[];return p.forEach(function(U,W){var _=null;U.forEach(function(M,G){if(!M&&_!==null){F.push("M".concat(_+k," ").concat(W+k,"h").concat(G-_,"v1H").concat(_+k,"z")),_=null;return}if(G===U.length-1){if(!M)return;_===null?F.push("M".concat(G+k,",").concat(W+k," h1v1H").concat(G+k,"z")):F.push("M".concat(_+k,",").concat(W+k," h").concat(G+1-_,"v1H").concat(_+k,"z"));return}M&&_===null&&(_=G)})}),F.join("")}function h(p,k){return p.slice().map(function(F,U){return U=k.y+k.h?F:F.map(function(W,_){return _=k.x+k.w?W:!1})})}function c(p,k){var F=p.imageSettings,U=p.size,W=p.includeMargin;if(F==null)return null;var _=W?m:0,M=k.length+_*2,G=Math.floor(U*D),Y=M/U,Z=(F.width||G)*Y,ne=(F.height||G)*Y,be=F.x==null?k.length/2-Z/2:F.x*Y,me=F.y==null?k.length/2-ne/2:F.y*Y,pe=null;if(F.excavate){var ue=Math.floor(be),fe=Math.floor(me),ie=Math.ceil(Z+be-ue),he=Math.ceil(ne+me-fe);pe={x:ue,y:fe,w:ie,h:he}}return{x:be,y:me,h:ne,w:Z,excavation:pe}}var u=function(){try{new Path2D().addPath(new Path2D)}catch(p){return!1}return!0}(),a=function(p){P(k,p);function k(){var F,U;B(this,k);for(var W=arguments.length,_=new Array(W),M=0;Mge.length)&&(de=ge.length);for(var ce=0,Q=new Array(de);ce=ge.length?{done:!0}:{done:!1,value:ge[Q++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return ce=ge[Symbol.iterator](),ce.next.bind(ce)}function O(ge,de){return de={exports:{}},ge(de,de.exports),de.exports}var B=O(function(ge){function de(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function ce(Q){ge.exports.defaults=Q}ge.exports={defaults:de(),getDefaults:de,changeDefaults:ce}}),N=B.defaults,R=B.getDefaults,A=B.changeDefaults,f=/[&<>"']/,v=/[&<>"']/g,P=/[<>"']|&(?!#?\w+;)/,w=/[<>"']|&(?!#?\w+;)/g,b={"&":"&","<":"<",">":">",'"':""","'":"'"},E=function(de){return b[de]};function l(ge,de){if(de){if(f.test(ge))return ge.replace(v,E)}else if(P.test(ge))return ge.replace(w,E);return ge}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(ge){return ge.replace(o,function(de,ce){return ce=ce.toLowerCase(),ce==="colon"?":":ce.charAt(0)==="#"?ce.charAt(1)==="x"?String.fromCharCode(parseInt(ce.substring(2),16)):String.fromCharCode(+ce.substring(1)):""})}var d=/(^|[^\[])\^/g;function C(ge,de){ge=ge.source||ge,de=de||"";var ce={replace:function(q,re){return re=re.source||re,re=re.replace(d,"$1"),ge=ge.replace(q,re),ce},getRegex:function(){return new RegExp(ge,de)}};return ce}var g=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function D(ge,de,ce){if(ge){var Q;try{Q=decodeURIComponent(s(ce)).replace(g,"").toLowerCase()}catch(q){return null}if(Q.indexOf("javascript:")===0||Q.indexOf("vbscript:")===0||Q.indexOf("data:")===0)return null}de&&!m.test(ce)&&(ce=a(de,ce));try{ce=encodeURI(ce).replace(/%25/g,"%")}catch(q){return null}return ce}var T={},h=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ge,de){T[" "+ge]||(h.test(ge)?T[" "+ge]=ge+"/":T[" "+ge]=k(ge,"/",!0)),ge=T[" "+ge];var ce=ge.indexOf(":")===-1;return de.substring(0,2)==="//"?ce?de:ge.replace(c,"$1")+de:de.charAt(0)==="/"?ce?de:ge.replace(u,"$1")+de:ge+de}var x={exec:function(){}};function y(ge){for(var de=1,ce,Q;de=0&&Te[je]==="\\";)Oe=!Oe;return Oe?"|":" |"}),Q=ce.split(/ \|/),q=0;if(Q.length>de)Q.splice(de);else for(;Q.length=Q.length?q.slice(Q.length):q}).join(` `)}var me=function(){function ge(ce){this.options=ce||_}var de=ge.prototype;return de.space=function(Q){var q=this.rules.block.newline.exec(Q);if(q)return q[0].length>1?{type:"space",raw:q[0]}:{raw:` `}},de.code=function(Q,q){var re=this.rules.block.code.exec(Q);if(re){var se=q[q.length-1];if(se&&se.type==="paragraph")return{raw:re[0],text:re[0].trimRight()};var Te=re[0].replace(/^ {4}/gm,"");return{type:"code",raw:re[0],codeBlockStyle:"indented",text:this.options.pedantic?Te:M(Te,` `)}}},de.fences=function(Q){var q=this.rules.block.fences.exec(Q);if(q){var re=q[0],se=be(re,q[3]||"");return{type:"code",raw:re,lang:q[2]?q[2].trim():q[2],text:se}}},de.heading=function(Q){var q=this.rules.block.heading.exec(Q);if(q)return{type:"heading",raw:q[0],depth:q[1].length,text:q[2]}},de.nptable=function(Q){var q=this.rules.block.nptable.exec(Q);if(q){var re={type:"table",header:G(q[1].replace(/^ *| *\| *$/g,"")),align:q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:q[3]?q[3].replace(/\n$/,"").split(` `):[],raw:q[0]};if(re.header.length===re.align.length){var se=re.align.length,Te;for(Te=0;Te ?/gm,"");return{type:"blockquote",raw:q[0],text:re}}},de.list=function(Q){var q=this.rules.block.list.exec(Q);if(q){for(var re=q[0],se=q[2],Te=se.length>1,Oe=se[se.length-1]===")",je={type:"list",raw:re,ordered:Te,start:Te?+se.slice(0,-1):"",loose:!1,items:[]},st=q[0].match(this.rules.block.item),ht=!1,Me,mt,at,qe,xt,Et,Pt,Lt=st.length,pt=0;pt1||this.options.smartLists&&at!==se)&&(qe=st.slice(pt+1).join(` `),je.raw=je.raw.substring(0,je.raw.length-qe.length),pt=Lt-1)),xt=ht||/\n\n(?!\s*$)/.test(Me),pt!==Lt-1&&(ht=Me.charAt(Me.length-1)===` `,xt||(xt=ht)),xt&&(je.loose=!0),Et=/^\[[ xX]\] /.test(Me),Pt=void 0,Et&&(Pt=Me[1]!==" ",Me=Me.replace(/^\[[ xX]\] +/,"")),je.items.push({type:"list_item",raw:re,task:Et,checked:Pt,loose:xt,text:Me});return je}},de.html=function(Q){var q=this.rules.block.html.exec(Q);if(q)return{type:this.options.sanitize?"paragraph":"html",raw:q[0],pre:!this.options.sanitizer&&(q[1]==="pre"||q[1]==="script"||q[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(q[0]):Y(q[0]):q[0]}},de.def=function(Q){var q=this.rules.block.def.exec(Q);if(q){q[3]&&(q[3]=q[3].substring(1,q[3].length-1));var re=q[1].toLowerCase().replace(/\s+/g," ");return{tag:re,raw:q[0],href:q[2],title:q[3]}}},de.table=function(Q){var q=this.rules.block.table.exec(Q);if(q){var re={type:"table",header:G(q[1].replace(/^ *| *\| *$/g,"")),align:q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:q[3]?q[3].replace(/\n$/,"").split(` `):[]};if(re.header.length===re.align.length){re.raw=q[0];var se=re.align.length,Te;for(Te=0;Te/i.test(se[0])&&(q=!1),!re&&/^<(pre|code|kbd|script)(\s|>)/i.test(se[0])?re=!0:re&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(se[0])&&(re=!1),{type:this.options.sanitize?"text":"html",raw:se[0],inLink:q,inRawBlock:re,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):Y(se[0]):se[0]}},de.link=function(Q){var q=this.rules.inline.link.exec(Q);if(q){var re=Z(q[2],"()");if(re>-1){var se=q[0].indexOf("!")===0?5:4,Te=se+q[1].length+re;q[2]=q[2].substring(0,re),q[0]=q[0].substring(0,Te).trim(),q[3]=""}var Oe=q[2],je="";if(this.options.pedantic){var st=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Oe);st?(Oe=st[1],je=st[3]):je=""}else je=q[3]?q[3].slice(1,-1):"";Oe=Oe.trim().replace(/^<([\s\S]*)>$/,"$1");var ht=ne(q,{href:Oe&&Oe.replace(this.rules.inline._escapes,"$1"),title:je&&je.replace(this.rules.inline._escapes,"$1")},q[0]);return ht}},de.reflink=function(Q,q){var re;if((re=this.rules.inline.reflink.exec(Q))||(re=this.rules.inline.nolink.exec(Q))){var se=(re[2]||re[1]).replace(/\s+/g," ");if(se=q[se.toLowerCase()],!se||!se.href){var Te=re[0].charAt(0);return{type:"text",raw:Te,text:Te}}var Oe=ne(re,se,re[0]);return Oe}},de.strong=function(Q,q,re){re===void 0&&(re="");var se=this.rules.inline.strong.start.exec(Q);if(se&&(!se[1]||se[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){q=q.slice(-1*Q.length);var Te=se[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Te.lastIndex=0;for(var Oe;(se=Te.exec(q))!=null;)if(Oe=this.rules.inline.strong.middle.exec(q.slice(0,se.index+3)),Oe)return{type:"strong",raw:Q.slice(0,Oe[0].length),text:Q.slice(2,Oe[0].length-2)}}},de.em=function(Q,q,re){re===void 0&&(re="");var se=this.rules.inline.em.start.exec(Q);if(se&&(!se[1]||se[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){q=q.slice(-1*Q.length);var Te=se[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Te.lastIndex=0;for(var Oe;(se=Te.exec(q))!=null;)if(Oe=this.rules.inline.em.middle.exec(q.slice(0,se.index+2)),Oe)return{type:"em",raw:Q.slice(0,Oe[0].length),text:Q.slice(1,Oe[0].length-1)}}},de.codespan=function(Q){var q=this.rules.inline.code.exec(Q);if(q){var re=q[2].replace(/\n/g," "),se=/[^ ]/.test(re),Te=re.startsWith(" ")&&re.endsWith(" ");return se&&Te&&(re=re.substring(1,re.length-1)),re=Y(re,!0),{type:"codespan",raw:q[0],text:re}}},de.br=function(Q){var q=this.rules.inline.br.exec(Q);if(q)return{type:"br",raw:q[0]}},de.del=function(Q){var q=this.rules.inline.del.exec(Q);if(q)return{type:"del",raw:q[0],text:q[1]}},de.autolink=function(Q,q){var re=this.rules.inline.autolink.exec(Q);if(re){var se,Te;return re[2]==="@"?(se=Y(this.options.mangle?q(re[1]):re[1]),Te="mailto:"+se):(se=Y(re[1]),Te=se),{type:"link",raw:re[0],text:se,href:Te,tokens:[{type:"text",raw:se,text:se}]}}},de.url=function(Q,q){var re;if(re=this.rules.inline.url.exec(Q)){var se,Te;if(re[2]==="@")se=Y(this.options.mangle?q(re[0]):re[0]),Te="mailto:"+se;else{var Oe;do Oe=re[0],re[0]=this.rules.inline._backpedal.exec(re[0])[0];while(Oe!==re[0]);se=Y(re[0]),re[1]==="www."?Te="http://"+se:Te=se}return{type:"link",raw:re[0],text:se,href:Te,tokens:[{type:"text",raw:se,text:se}]}}},de.inlineText=function(Q,q,re){var se=this.rules.inline.text.exec(Q);if(se){var Te;return q?Te=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):Y(se[0]):se[0]:Te=Y(this.options.smartypants?re(se[0]):se[0]),{type:"text",raw:se[0],text:Te}}},ge}(),pe=W.noopTest,ue=W.edit,fe=W.merge,ie={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:pe,table:pe,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ie._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ie._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ie.def=ue(ie.def).replace("label",ie._label).replace("title",ie._title).getRegex(),ie.bullet=/(?:[*+-]|\d{1,9}[.)])/,ie.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ie.item=ue(ie.item,"gm").replace(/bull/g,ie.bullet).getRegex(),ie.list=ue(ie.list).replace(/bull/g,ie.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ie.def.source+")").getRegex(),ie._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ie._comment=//,ie.html=ue(ie.html,"i").replace("comment",ie._comment).replace("tag",ie._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ie.paragraph=ue(ie._paragraph).replace("hr",ie.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|!--)").replace("tag",ie._tag).getRegex(),ie.blockquote=ue(ie.blockquote).replace("paragraph",ie.paragraph).getRegex(),ie.normal=fe({},ie),ie.gfm=fe({},ie.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),ie.gfm.nptable=ue(ie.gfm.nptable).replace("hr",ie.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|!--)").replace("tag",ie._tag).getRegex(),ie.gfm.table=ue(ie.gfm.table).replace("hr",ie.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|!--)").replace("tag",ie._tag).getRegex(),ie.pedantic=fe({},ie.normal,{html:ue(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ie._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:pe,paragraph:ue(ie.normal._paragraph).replace("hr",ie.hr).replace("heading",` *#{1,6} *[^ ]`).replace("lheading",ie.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var he={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:pe,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:pe,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",he.punctuation=ue(he.punctuation).replace(/punctuation/g,he._punctuation).getRegex(),he._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",he._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",he.em.start=ue(he.em.start).replace(/punctuation/g,he._punctuation).getRegex(),he.em.middle=ue(he.em.middle).replace(/punctuation/g,he._punctuation).replace(/overlapSkip/g,he._overlapSkip).getRegex(),he.em.endAst=ue(he.em.endAst,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.em.endUnd=ue(he.em.endUnd,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.strong.start=ue(he.strong.start).replace(/punctuation/g,he._punctuation).getRegex(),he.strong.middle=ue(he.strong.middle).replace(/punctuation/g,he._punctuation).replace(/blockSkip/g,he._blockSkip).getRegex(),he.strong.endAst=ue(he.strong.endAst,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.strong.endUnd=ue(he.strong.endUnd,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.blockSkip=ue(he._blockSkip,"g").getRegex(),he.overlapSkip=ue(he._overlapSkip,"g").getRegex(),he._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,he._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,he._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,he.autolink=ue(he.autolink).replace("scheme",he._scheme).replace("email",he._email).getRegex(),he._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,he.tag=ue(he.tag).replace("comment",ie._comment).replace("attribute",he._attribute).getRegex(),he._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,he._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,he._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,he.link=ue(he.link).replace("label",he._label).replace("href",he._href).replace("title",he._title).getRegex(),he.reflink=ue(he.reflink).replace("label",he._label).getRegex(),he.reflinkSearch=ue(he.reflinkSearch,"g").replace("reflink",he.reflink).replace("nolink",he.nolink).getRegex(),he.normal=fe({},he),he.pedantic=fe({},he.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:ue(/^!?\[(label)\]\((.*?)\)/).replace("label",he._label).getRegex(),reflink:ue(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",he._label).getRegex()}),he.gfm=fe({},he.normal,{escape:ue(he.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\.5&&(Q="x"+Q.toString(16)),de+="&#"+Q+";";return de}var Se=function(){function ge(ce){this.tokens=[],this.tokens.links=Object.create(null),this.options=ce||ae,this.options.tokenizer=this.options.tokenizer||new me,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Q={block:ee.normal,inline:Ee.normal};this.options.pedantic?(Q.block=ee.pedantic,Q.inline=Ee.pedantic):this.options.gfm&&(Q.block=ee.gfm,this.options.breaks?Q.inline=Ee.breaks:Q.inline=Ee.gfm),this.tokenizer.rules=Q}ge.lex=function(Q,q){var re=new ge(q);return re.lex(Q)};var de=ge.prototype;return de.lex=function(Q){return Q=Q.replace(/\r\n|\r/g,` `).replace(/\t/g," "),this.blockTokens(Q,this.tokens,!0),this.inline(this.tokens),this.tokens},de.blockTokens=function(Q,q,re){q===void 0&&(q=[]),re===void 0&&(re=!0),Q=Q.replace(/^ +$/gm,"");for(var se,Te,Oe,je;Q;){if(se=this.tokenizer.space(Q)){Q=Q.substring(se.raw.length),se.type&&q.push(se);continue}if(se=this.tokenizer.code(Q,q)){Q=Q.substring(se.raw.length),se.type?q.push(se):(je=q[q.length-1],je.raw+=` `+se.raw,je.text+=` `+se.text);continue}if(se=this.tokenizer.fences(Q)){Q=Q.substring(se.raw.length),q.push(se);continue}if(se=this.tokenizer.heading(Q)){Q=Q.substring(se.raw.length),q.push(se);continue}if(se=this.tokenizer.nptable(Q)){Q=Q.substring(se.raw.length),q.push(se);continue}if(se=this.tokenizer.hr(Q)){Q=Q.substring(se.raw.length),q.push(se);continue}if(se=this.tokenizer.blockquote(Q)){Q=Q.substring(se.raw.length),se.tokens=this.blockTokens(se.text,[],re),q.push(se);continue}if(se=this.tokenizer.list(Q)){for(Q=Q.substring(se.raw.length),Oe=se.items.length,Te=0;Te0)for(;(st=this.tokenizer.rules.inline.reflinkSearch.exec(je))!=null;)ht.includes(st[0].slice(st[0].lastIndexOf("[")+1,-1))&&(je=je.slice(0,st.index)+"["+"a".repeat(st[0].length-2)+"]"+je.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(st=this.tokenizer.rules.inline.blockSkip.exec(je))!=null;)je=je.slice(0,st.index)+"["+"a".repeat(st[0].length-2)+"]"+je.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Q;){if(Oe=this.tokenizer.escape(Q)){Q=Q.substring(Oe.raw.length),q.push(Oe);continue}if(Oe=this.tokenizer.tag(Q,re,se)){Q=Q.substring(Oe.raw.length),re=Oe.inLink,se=Oe.inRawBlock,q.push(Oe);continue}if(Oe=this.tokenizer.link(Q)){Q=Q.substring(Oe.raw.length),Oe.type==="link"&&(Oe.tokens=this.inlineTokens(Oe.text,[],!0,se)),q.push(Oe);continue}if(Oe=this.tokenizer.reflink(Q,this.tokens.links)){Q=Q.substring(Oe.raw.length),Oe.type==="link"&&(Oe.tokens=this.inlineTokens(Oe.text,[],!0,se)),q.push(Oe);continue}if(Oe=this.tokenizer.strong(Q,je,Te)){Q=Q.substring(Oe.raw.length),Oe.tokens=this.inlineTokens(Oe.text,[],re,se),q.push(Oe);continue}if(Oe=this.tokenizer.em(Q,je,Te)){Q=Q.substring(Oe.raw.length),Oe.tokens=this.inlineTokens(Oe.text,[],re,se),q.push(Oe);continue}if(Oe=this.tokenizer.codespan(Q)){Q=Q.substring(Oe.raw.length),q.push(Oe);continue}if(Oe=this.tokenizer.br(Q)){Q=Q.substring(Oe.raw.length),q.push(Oe);continue}if(Oe=this.tokenizer.del(Q)){Q=Q.substring(Oe.raw.length),Oe.tokens=this.inlineTokens(Oe.text,[],re,se),q.push(Oe);continue}if(Oe=this.tokenizer.autolink(Q,ve)){Q=Q.substring(Oe.raw.length),q.push(Oe);continue}if(!re&&(Oe=this.tokenizer.url(Q,ve))){Q=Q.substring(Oe.raw.length),q.push(Oe);continue}if(Oe=this.tokenizer.inlineText(Q,se,Ce)){Q=Q.substring(Oe.raw.length),Te=Oe.raw.slice(-1),q.push(Oe);continue}if(Q){var Me="Infinite loop on byte: "+Q.charCodeAt(0);if(this.options.silent){console.error(Me);break}else throw new Error(Me)}}return q},K(ge,null,[{key:"rules",get:function(){return{block:ee,inline:Ee}}}]),ge}(),De=B.defaults,_e=W.cleanUrl,ke=W.escape,Re=function(){function ge(ce){this.options=ce||De}var de=ge.prototype;return de.code=function(Q,q,re){var se=(q||"").match(/\S*/)[0];if(this.options.highlight){var Te=this.options.highlight(Q,se);Te!=null&&Te!==Q&&(re=!0,Q=Te)}return se?'
    '+(re?Q:ke(Q,!0))+`
    `:"
    "+(re?Q:ke(Q,!0))+`
    `},de.blockquote=function(Q){return`
    `+Q+`
    `},de.html=function(Q){return Q},de.heading=function(Q,q,re,se){return this.options.headerIds?"'+Q+" `:""+Q+" `},de.hr=function(){return this.options.xhtml?`
    `:`
    `},de.list=function(Q,q,re){var se=q?"ol":"ul",Te=q&&re!==1?' start="'+re+'"':"";return"<"+se+Te+`> `+Q+" `},de.listitem=function(Q){return"
  • "+Q+`
  • `},de.checkbox=function(Q){return" "},de.paragraph=function(Q){return"

    "+Q+`

    `},de.table=function(Q,q){return q&&(q=""+q+""),` `+Q+` `+q+`
    `},de.tablerow=function(Q){return` `+Q+` `},de.tablecell=function(Q,q){var re=q.header?"th":"td",se=q.align?"<"+re+' align="'+q.align+'">':"<"+re+">";return se+Q+" `},de.strong=function(Q){return""+Q+""},de.em=function(Q){return""+Q+""},de.codespan=function(Q){return""+Q+""},de.br=function(){return this.options.xhtml?"
    ":"
    "},de.del=function(Q){return""+Q+""},de.link=function(Q,q,re){if(Q=_e(this.options.sanitize,this.options.baseUrl,Q),Q===null)return re;var se='",se},de.image=function(Q,q,re){if(Q=_e(this.options.sanitize,this.options.baseUrl,Q),Q===null)return re;var se=''+re+'":">",se},de.text=function(Q){return Q},ge}(),Ae=function(){function ge(){}var de=ge.prototype;return de.strong=function(Q){return Q},de.em=function(Q){return Q},de.codespan=function(Q){return Q},de.del=function(Q){return Q},de.html=function(Q){return Q},de.text=function(Q){return Q},de.link=function(Q,q,re){return""+re},de.image=function(Q,q,re){return""+re},de.br=function(){return""},ge}(),Ue=function(){function ge(){this.seen={}}var de=ge.prototype;return de.slug=function(Q){var q=Q.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(q)){var re=q;do this.seen[re]++,q=re+"-"+this.seen[re];while(this.seen.hasOwnProperty(q))}return this.seen[q]=0,q},ge}(),Ye=B.defaults,Ge=W.unescape,He=function(){function ge(ce){this.options=ce||Ye,this.options.renderer=this.options.renderer||new Re,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ae,this.slugger=new Ue}ge.parse=function(Q,q){var re=new ge(q);return re.parse(Q)};var de=ge.prototype;return de.parse=function(Q,q){q===void 0&&(q=!0);var re="",se,Te,Oe,je,st,ht,Me,mt,at,qe,xt,Et,Pt,Lt,pt,or,Kt,Ut,Tr=Q.length;for(se=0;se0&&pt.tokens[0].type==="text"?(pt.tokens[0].text=Ut+" "+pt.tokens[0].text,pt.tokens[0].tokens&&pt.tokens[0].tokens.length>0&&pt.tokens[0].tokens[0].type==="text"&&(pt.tokens[0].tokens[0].text=Ut+" "+pt.tokens[0].tokens[0].text)):pt.tokens.unshift({type:"text",text:Ut}):Lt+=Ut),Lt+=this.parse(pt.tokens,Pt),at+=this.renderer.listitem(Lt,Kt,or);re+=this.renderer.list(at,xt,Et);continue}case"html":{re+=this.renderer.html(qe.text);continue}case"paragraph":{re+=this.renderer.paragraph(this.parseInline(qe.tokens));continue}case"text":{for(at=qe.tokens?this.parseInline(qe.tokens):qe.text;se+1An error occurred:

    "+Xe(Oe.message+"",!0)+"
    ";throw Oe}}Le.options=Le.setOptions=function(ge){return et(Le.defaults,ge),rt(Le.defaults),Le},Le.getDefaults=we,Le.defaults=$e,Le.use=function(ge){var de=et({},ge);if(ge.renderer&&function(){var Q=Le.defaults.renderer||new Re,q=function(Te){var Oe=Q[Te];Q[Te]=function(){for(var je=arguments.length,st=new Array(je),ht=0;ht`,triples:"",explode:"[]{}"},L=J.Pos;J.defineOption("autoCloseBrackets",!1,function(b,E,l){l&&l!=J.Init&&(b.removeKeyMap(I),b.state.closeBrackets=null),E&&(O(H(E,"pairs")),b.state.closeBrackets=E,b.addKeyMap(I))});function H(b,E){return E=="pairs"&&typeof b=="string"?b:typeof b=="object"&&b[E]!=null?b[E]:K[E]}var I={Backspace:R,Enter:A};function O(b){for(var E=0;E=0;s--){var C=o[s].head;b.replaceRange("",L(C.line,C.ch-1),L(C.line,C.ch+1),"+delete")}}function A(b){var E=N(b),l=E&&H(E,"explode");if(!l||b.getOption("disableInput"))return J.Pass;for(var o=b.listSelections(),s=0;s0;return{anchor:new L(b.anchor.line,b.anchor.ch+(E?-1:1)),head:new L(b.head.line,b.head.ch+(E?1:-1))}}function v(b,E){var l=N(b);if(!l||b.getOption("disableInput"))return J.Pass;var o=H(l,"pairs"),s=o.indexOf(E);if(s==-1)return J.Pass;for(var d=H(l,"closeBefore"),C=H(l,"triples"),g=o.charAt(s+1)==E,m=b.listSelections(),D=s%2==0,T,h=0;h=0&&b.getRange(u,L(u.line,u.ch+3))==E+E+E?a="skipThree":a="skip";else if(g&&u.ch>1&&C.indexOf(E)>=0&&b.getRange(L(u.line,u.ch-2),u)==E+E){if(u.ch>2&&/\bstring/.test(b.getTokenTypeAt(L(u.line,u.ch-2))))return J.Pass;a="addFour"}else if(g){var y=u.ch==0?" ":b.getRange(L(u.line,u.ch-1),u);if(!J.isWordChar(x)&&y!=E&&!J.isWordChar(y))a="both";else return J.Pass}else if(D&&(x.length===0||/\s/.test(x)||d.indexOf(x)>-1))a="both";else return J.Pass;if(!T)T=a;else if(T!=a)return J.Pass}var p=s%2?o.charAt(s-1):E,k=s%2?E:o.charAt(s+1);b.operation(function(){if(T=="skip")b.execCommand("goCharRight");else if(T=="skipThree")for(var F=0;F<3;F++)b.execCommand("goCharRight");else if(T=="surround"){for(var U=b.getSelections(),F=0;F0&&(Z.percent=Z.loaded/Z.total*100),W.onProgress(Z)});var M=new FormData;W.data&&Object.keys(W.data).forEach(function(Y){var Z=W.data[Y];if(Array.isArray(Z)){Z.forEach(function(ne){M.append(Y+"[]",ne)});return}M.append(Y,W.data[Y])}),W.file instanceof Blob?M.append(W.filename,W.file,W.file.name):M.append(W.filename,W.file),_.onerror=function(Z){W.onError(Z)},_.onload=function(){return _.status<200||_.status>=300?W.onError(I(W,_),O(_)):W.onSuccess(O(_),_)},_.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in _&&(_.withCredentials=!0);var G=W.headers||{};return G["X-Requested-With"]!==null&&_.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(G).forEach(function(Y){G[Y]!==null&&_.setRequestHeader(Y,G[Y])}),_.send(M),{abort:function(){_.abort()}}}var N=+new Date,R=0;function A(){return"rc-upload-"+N+"-"+ ++R}function f(W,_){return W.indexOf(_,W.length-_.length)!==-1}var v=function(W,_){if(W&&_){var M=Array.isArray(_)?_:_.split(","),G=W.name||"",Y=W.type||"",Z=Y.replace(/\/.*$/,"");return M.some(function(ne){var be=ne.trim();return be.charAt(0)==="."?f(G.toLowerCase(),be.toLowerCase()):/\/\*$/.test(be)?Z===be.replace(/\/.*$/,""):Y===be})}return!0};function P(W,_){var M=W.createReader(),G=[];function Y(){M.readEntries(function(Z){var ne=Array.prototype.slice.apply(Z);G=G.concat(ne);var be=!ne.length;be?_(G):Y()})}Y()}var w=function(_,M,G){var Y=function Z(ne,be){be=be||"",ne.isFile?ne.file(function(me){G(me)&&(ne.fullPath&&!me.webkitRelativePath&&(Object.defineProperties(me,{webkitRelativePath:{writable:!0}}),me.webkitRelativePath=ne.fullPath.replace(/^\//,""),Object.defineProperties(me,{webkitRelativePath:{writable:!1}})),M([me]))}):ne.isDirectory&&P(ne,function(me){me.forEach(function(pe){Z(pe,""+be+ne.name+"/")})})};_.forEach(function(Z){Y(Z.webkitGetAsEntry())})},b=w,E=Object.assign||function(W){for(var _=1;_=0)continue;if(!Object.prototype.hasOwnProperty.call(W,G))continue;M[G]=W[G]}return M}function C(W,_){if(!(W instanceof _))throw new TypeError("Cannot call a class as a function")}function g(W,_){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:W}function m(W,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);W.prototype=Object.create(_&&_.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(W,_):W.__proto__=_)}var D=function(_){return Object.keys(_).reduce(function(M,G){return(G.substr(0,5)==="data-"||G.substr(0,5)==="aria-"||G==="role")&&(M[G]=_[G]),M},{})},T=function(W){m(_,W);function _(){var M,G,Y,Z;C(this,_);for(var ne=arguments.length,be=Array(ne),me=0;me=7&&this.setupTypeNumber(N),this.dataCache==null&&(this.dataCache=O.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,R)},B.setupPositionProbePattern=function(N,R){for(var A=-1;A<=7;A++){if(N+A<=-1||this.moduleCount<=N+A)continue;for(var f=-1;f<=7;f++){if(R+f<=-1||this.moduleCount<=R+f)continue;0<=A&&A<=6&&(f==0||f==6)||0<=f&&f<=6&&(A==0||A==6)||2<=A&&A<=4&&2<=f&&f<=4?this.modules[N+A][R+f]=!0:this.modules[N+A][R+f]=!1}}},B.getBestMaskPattern=function(){for(var N=0,R=0,A=0;A<8;A++){this.makeImpl(!0,A);var f=H.getLostPoint(this);(A==0||N>f)&&(N=f,R=A)}return R},B.createMovieClip=function(N,R,A){var f=N.createEmptyMovieClip(R,A),v=1;this.make();for(var P=0;P>A&1)==1;this.modules[Math.floor(A/3)][A%3+this.moduleCount-8-3]=f}for(var A=0;A<18;A++){var f=!N&&(R>>A&1)==1;this.modules[A%3+this.moduleCount-8-3][Math.floor(A/3)]=f}},B.setupTypeInfo=function(N,R){for(var A=this.errorCorrectLevel<<3|R,f=H.getBCHTypeInfo(A),v=0;v<15;v++){var P=!N&&(f>>v&1)==1;v<6?this.modules[v][8]=P:v<8?this.modules[v+1][8]=P:this.modules[this.moduleCount-15+v][8]=P}for(var v=0;v<15;v++){var P=!N&&(f>>v&1)==1;v<8?this.modules[8][this.moduleCount-v-1]=P:v<9?this.modules[8][15-v-1+1]=P:this.modules[8][15-v-1]=P}this.modules[this.moduleCount-8][8]=!N},B.mapData=function(N,R){for(var A=-1,f=this.moduleCount-1,v=7,P=0,w=this.moduleCount-1;w>0;w-=2)for(w==6&&w--;;){for(var b=0;b<2;b++)if(this.modules[f][w-b]==null){var E=!1;P>>v&1)==1);var l=H.getMask(R,f,w-b);l&&(E=!E),this.modules[f][w-b]=E,v--,v==-1&&(P++,v=7)}if(f+=A,f<0||this.moduleCount<=f){f-=A,A=-A;break}}},O.PAD0=236,O.PAD1=17,O.createData=function(N,R,A){for(var f=K.getRSBlocks(N,R),v=new L,P=0;Pb*8)throw new Error("code length overflow. ("+v.getLengthInBits()+">"+b*8+")");for(v.getLengthInBits()+4<=b*8&&v.put(0,4);v.getLengthInBits()%8!=0;)v.putBit(!1);for(;!(v.getLengthInBits()>=b*8);){if(v.put(O.PAD0,8),v.getLengthInBits()>=b*8)break;v.put(O.PAD1,8)}return O.createBytes(v,f)},O.createBytes=function(N,R){for(var A=0,f=0,v=0,P=new Array(R.length),w=new Array(R.length),b=0;b=0?C.get(g):0}}for(var m=0,o=0;o=0;)B^=I.G15<=0;)B^=I.G18<>>=1;return B},getPatternPosition:function(O){return I.PATTERN_POSITION_TABLE[O-1]},getMask:function(O,B,N){switch(O){case H.PATTERN000:return(B+N)%2==0;case H.PATTERN001:return B%2==0;case H.PATTERN010:return N%3==0;case H.PATTERN011:return(B+N)%3==0;case H.PATTERN100:return(Math.floor(B/2)+Math.floor(N/3))%2==0;case H.PATTERN101:return B*N%2+B*N%3==0;case H.PATTERN110:return(B*N%2+B*N%3)%2==0;case H.PATTERN111:return(B*N%3+(B+N)%2)%2==0;default:throw new Error("bad maskPattern:"+O)}},getErrorCorrectPolynomial:function(O){for(var B=new K([1],0),N=0;N5&&(N+=3+f-5)}for(var R=0;R1&&arguments[1]!==void 0?arguments[1]:1,ce=Ae.length,Q=0;Q1&&arguments[1]!==void 0?arguments[1]:!1;return Object(D.a)(M).map(function(Y,Z){if(!I.isValidElement(Y)||!Y.type)return null;var ne=Y.type.isSelectOptGroup,be=Y.key,me=Y.props,pe=me.children,ue=Object(B.a)(me,["children"]);return G||!ne?T(Y):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(be===null?Z:be,"__"),label:be},ue),{},{options:h(pe)})}).filter(function(Y){return Y})}var c=te("2Qr1"),u=te("qNPg"),a=te("U8pU"),x=te("Kwbf"),y=te("WKfj");function p(M){var G=M.mode,Y=M.options,Z=M.children,ne=M.backfill,be=M.allowClear,me=M.placeholder,pe=M.getInputElement,ue=M.showSearch,fe=M.onSearch,ie=M.defaultOpen,he=M.autoFocus,$=M.labelInValue,ae=M.value,ee=M.inputValue,Ee=M.optionLabelProp,Ce=G==="multiple"||G==="tags",ve=ue!==void 0?ue:Ce||G==="combobox",Se=Y||h(Z);if(Object(x.a)(G!=="tags"||Se.every(function(Re){return!Re.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),G==="tags"||G==="combobox"){var De=Se.some(function(Re){return Re.options?Re.options.some(function(Ae){return typeof("value"in Ae?Ae.value:Ae.key)=="number"}):typeof("value"in Re?Re.value:Re.key)=="number"});Object(x.a)(!De,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(x.a)(G!=="combobox"||!Ee,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(x.a)(G==="combobox"||!ne,"`backfill` only works with `combobox` mode."),Object(x.a)(G==="combobox"||!pe,"`getInputElement` only work with `combobox` mode."),Object(x.b)(G!=="combobox"||!pe||!be||!me,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),fe&&!ve&&G!=="combobox"&&G!=="tags"&&Object(x.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(x.b)(!ie||he,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ae!=null){var _e=Object(y.d)(ae);Object(x.a)(!$||_e.every(function(Re){return Object(a.a)(Re)==="object"&&("key"in Re||"value"in Re)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(x.a)(!Ce||Array.isArray(ae),"`value` should be array when `mode` is `multiple` or `tags`")}if(Z){var ke=null;Object(D.a)(Z).some(function(Re){if(!I.isValidElement(Re)||!Re.type)return!1;var Ae=Re.type;if(Ae.isSelectOption)return!1;if(Ae.isSelectOptGroup){var Ue=Object(D.a)(Re.props.children).every(function(Ye){return!I.isValidElement(Ye)||!Re.type||Ye.type.isSelectOption?!0:(ke=Ye.type,!1)});return!Ue}return ke=Ae,!0}),ke&&Object(x.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(ke.displayName||ke.name||ke,"`.")),Object(x.a)(ee===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var k=p,F=Object(u.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:h,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:k,fillOptionsWithMissingValue:c.a}),U=function(M){Object(L.a)(Y,M);var G=Object(H.a)(Y);function Y(){var Z;return Object(J.a)(this,Y),Z=G.apply(this,arguments),Z.selectRef=I.createRef(),Z.focus=function(){Z.selectRef.current.focus()},Z.blur=function(){Z.selectRef.current.blur()},Z}return Object(K.a)(Y,[{key:"render",value:function(){return I.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),Y}(I.Component);U.Option=d,U.OptGroup=g;var W=U,_=Ke.c=W},M8RZ:function(Ze,Ke,te){"use strict";te.d(Ke,"a",function(){return R});var J=te("fWQN"),K=te("mtLc"),L=te("yKVA"),H=te("879j"),I=te("cDcd"),O=te.n(I),B=te("faye"),N=te.n(B),R=function(A){Object(L.a)(v,A);var f=Object(H.a)(v);function v(P){var w;Object(J.a)(this,v),w=f.call(this,P);var b=window.document;return w.node=b.createElement("div"),b.body.appendChild(w.node),w}return Object(K.a)(v,[{key:"render",value:function(){var w=this.props.children;return Object(B.createPortal)(w,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),v}(O.a.Component)},OLES:function(Ze,Ke,te){"use strict";var J=te("U8pU"),K=te("VTBJ"),L=te("Ff2n"),H=te("cDcd"),I=te("uciX"),O=te("7ixt"),B=function(P){var w=P.overlay,b=P.prefixCls,E=P.id,l=P.overlayInnerStyle;return H.createElement("div",{className:"".concat(b,"-inner"),id:E,role:"tooltip",style:l},typeof w=="function"?w():w)},N=B,R=function(P,w){var b=P.overlayClassName,E=P.trigger,l=E===void 0?["hover"]:E,o=P.mouseEnterDelay,s=o===void 0?0:o,d=P.mouseLeaveDelay,C=d===void 0?.1:d,g=P.overlayStyle,m=P.prefixCls,D=m===void 0?"rc-tooltip":m,T=P.children,h=P.onVisibleChange,c=P.afterVisibleChange,u=P.transitionName,a=P.animation,x=P.placement,y=x===void 0?"right":x,p=P.align,k=p===void 0?{}:p,F=P.destroyTooltipOnHide,U=F===void 0?!1:F,W=P.defaultVisible,_=P.getTooltipContainer,M=P.overlayInnerStyle,G=Object(L.a)(P,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),Y=Object(H.useRef)(null);Object(H.useImperativeHandle)(w,function(){return Y.current});var Z=Object(K.a)({},G);"visible"in P&&(Z.popupVisible=P.visible);var ne=function(){var fe=P.arrowContent,ie=fe===void 0?null:fe,he=P.overlay,$=P.id;return[H.createElement("div",{className:"".concat(D,"-arrow"),key:"arrow"},ie),H.createElement(N,{key:"content",prefixCls:D,id:$,overlay:he,overlayInnerStyle:M})]},be=!1,me=!1;if(typeof U=="boolean")be=U;else if(U&&Object(J.a)(U)==="object"){var pe=U.keepParent;be=pe===!0,me=pe===!1}return H.createElement(I.a,Object.assign({popupClassName:b,prefixCls:D,popup:ne,action:l,builtinPlacements:O.a,popupPlacement:y,ref:Y,popupAlign:k,getPopupContainer:_,onPopupVisibleChange:h,afterPopupVisibleChange:c,popupTransitionName:u,popupAnimation:a,defaultPopupVisible:W,destroyPopupOnHide:be,autoDestroy:me,mouseLeaveDelay:C,popupStyle:g,mouseEnterDelay:s},Z),T)},A=Object(H.forwardRef)(R),f=Ke.a=A},Ot1p:function(Ze,Ke,te){"use strict";var J=te("2qtc"),K=te("kLXV"),L=te("rAM+"),H=te("miYZ"),I=te("tsqr"),O=te("9og8"),B=te("tJVT"),N=te("jrin"),R=te("WmNS"),A=te.n(R),f=te("cDcd"),v=te.n(f),P=te("VrN/"),w=te.n(P),b=te("bdgK"),E=te("p77/"),l=te("Bd2K"),o=te("ELLl"),s=te("19Vz"),d=te("lZu9"),C=te("+NIl"),g=te("kSUc"),m=te("9Bee"),D=function(Me){var mt=Me.value,at=mt===void 0?"":mt,qe=Me.className,xt=Me.showTextOnly,Et=Me.showLines,Pt=Me.style,Lt=Pt===void 0?{}:Pt,pt=Object(f.useMemo)(function(){return""},[at]);return v.a.createElement(v.a.Fragment,null,v.a.createElement("div",{dangerouslySetInnerHTML:{__html:pt}}))},T=te("Q9mQ"),h=te("diRs"),c=te("0Owb"),u=te("dejd"),a=te("C+DQ"),x=te("D1Df"),y=te.n(x),p=te("1vsH"),k=te("m3rI"),F=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function U(Me){var mt=Me.onActionCallback,at=Me.title,qe=Me.icon,xt=Me.actionName,Et=Me.className,Pt=Et===void 0?"":Et,Lt=Me.children;function pt(){mt(xt)}return v.a.createElement("a",{title:at,className:Pt,onClick:pt},v.a.createElement("i",{className:"md-iconfont ".concat(qe)}),Lt)}var W=function(Me){var mt=Me.watch,at=Me.showNullButton,qe=Me.onActionCallback,xt=Me.fullScreen,Et=Me.insertTemp,Pt=Me.hidetoolBar,Lt=Me.uuid,pt=Me.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(p.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(p.G)("_educoder_session"),"&key=").concat(Lt,"&api=").concat(encodeURIComponent(k.a.PROXY_SERVER)));var or=[].concat(F,[{title:"".concat(mt?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(mt?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return v.a.createElement("ul",{className:"markdown-toolbar-container"},!Pt&&or.map(function(Kt,Ut){return v.a.createElement("li",{key:Ut},Kt.actionName?v.a.createElement(U,Object(c.a)({},Kt,{onActionCallback:qe})):v.a.createElement("span",{className:"v-line"}))}),at?v.a.createElement("li",null,v.a.createElement(U,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:qe},v.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Et&&v.a.createElement("li",null,v.a.createElement(U,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Et),onActionCallback:qe},v.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),v.a.createElement("li",null,v.a.createElement(h.a,{title:"\u6253\u5F00\u624B\u673A\u626B\u4E00\u626B",content:v.a.createElement("div",null,v.a.createElement(y.a,{size:150,fgColor:"#000",value:"https://test2.educoder.net/upload.html?_educoder_session_login=".concat(Object(p.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(p.G)("_educoder_session"),"&key=").concat(Lt,"&api=").concat(encodeURIComponent(k.a.PROXY_SERVER))}))},v.a.createElement("span",{className:"fill-tip",onMouseOver:function(){return pt(!0)}},"\u624B\u673A\u4E0A\u4F20\u6587\u4EF6"))),v.a.createElement("li",{className:"btn-full-screen"},v.a.createElement(U,{icon:"".concat(xt?"icon-shrink":"icon-enlarge"),title:xt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:qe})))},_=te("M8RZ"),M=te("+L6B"),G=te("2/Rp"),Y=te("y8nQ"),Z=te("Vl3Y"),ne=te("5NDa"),be=te("5rEg"),me={labelCol:{span:4},wrapperCol:{span:20}},pe=function(Me){var mt=Me.callback,at=Me.onCancel;function qe(xt){mt(xt)}return v.a.createElement(Z.a,Object(c.a)({},me,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:qe}),v.a.createElement(Z.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},v.a.createElement(be.a,null)),v.a.createElement(Z.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},v.a.createElement(be.a,null)),v.a.createElement("div",{className:"flex-container flex-end"},v.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(G.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))},ue=te("7ahc"),fe=te("k1fw"),ie=te("HmJG"),he=te("BjJ7"),$=Z.a.useForm,ae={width:280,marginRight:10},ee={labelCol:{span:5},wrapperCol:{span:19}},Ee=function(Me){var mt=Me.callback,at=Me.onCancel,qe=$(),xt=Object(B.a)(qe,1),Et=xt[0],Pt=useRef();function Lt(Kt){mt(Object(fe.a)(Object(fe.a)({},Kt),{},{name:Pt.current}))}function pt(Kt,Ut){if(Kt.status===-1){I.b.error(Kt.message);return}Et.setFieldsValue({src:"/api/attachments/".concat(Kt.id),type:Ut.type})}function or(Kt){var Ut=Kt.target.files[0];Pt.current=Ut.name,ve(Ut,pt)}return v.a.createElement(Z.a,Object(c.a)({form:Et},ee,{className:"upload-image-panel",onFinish:Lt}),v.a.createElement(Z.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},v.a.createElement("div",{className:"flex-container"},v.a.createElement(Z.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},v.a.createElement(be.a,{style:ae})),v.a.createElement(Ce,{onFileChange:or}))),v.a.createElement(Z.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},v.a.createElement(be.a,{style:{width:264}})),v.a.createElement(Z.a.Item,{style:{textAlign:"right"}},v.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(G.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))};function Ce(Me){var mt=Me.onFileChange;return v.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",v.a.createElement("input",{type:"file",onChange:mt}))}function ve(Me,mt){if(!Me)throw new String("\u6CA1\u6709\u6587\u4EF6");var at=new FormData;at.append("editormd-image-file",Me),at.append("file_param_name","editormd-image-file"),at.append("byxhr","true");var qe=new window.XMLHttpRequest;qe.withCredentials=!0,qe.addEventListener("load",function(xt){mt(JSON.parse(xt.target.responseText),Me)},!1),qe.addEventListener("error",function(xt){console.error(xt)},!1),qe.open("POST","".concat(he.a,"/api/attachments.json")),qe.send(at)}var Se=te("giR+"),De=te("fyUT"),_e=te("7Kak"),ke=te("9yH6"),Re=ke.a.Group,Ae={margin:"0 8px"},Ue=function(Me){var mt=Me.callback,at=Me.onCancel;function qe(xt){mt(xt)}return v.a.createElement(Z.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:qe},v.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},v.a.createElement("span",{style:Ae},"\u5355\u5143\u683C\u6570\uFF1A"),v.a.createElement("span",{style:Ae},"\u884C\u6570"),v.a.createElement(Z.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},v.a.createElement(De.a,null)),v.a.createElement("span",{style:Ae},"\u5217\u6570"),v.a.createElement(Z.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},v.a.createElement(De.a,null))),v.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},v.a.createElement("span",{style:Ae},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),v.a.createElement(Z.a.Item,{name:"align"},v.a.createElement(Re,null,v.a.createElement(ke.a,{value:"default"},v.a.createElement("i",{className:"fa fa-align-justify"})),v.a.createElement(ke.a,{value:"left"},v.a.createElement("i",{className:"fa fa-align-left"})),v.a.createElement(ke.a,{value:"center"},v.a.createElement("i",{className:"fa fa-align-center"})),v.a.createElement(ke.a,{value:"right"},v.a.createElement("i",{className:"fa fa-align-right"}))))),v.a.createElement("div",{className:"flex-container flex-end"},v.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(G.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))},Ye=te("ErOA"),Ge=te("7Cbv"),He="link",et="upload-image",Je="code-block",Xe="add-table",we="------------",rt={default:we,left:":".concat(we),center:":".concat(we,":"),right:"".concat(we,":")},$e=te("9VGf"),Le,Fe;function ge(){}var de=0,ce=1e4,Q="\u2581",q=` **\u6A21\u677F\u6807\u9898** \u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function re(Me){return/^\d+$/.test(Me)?"".concat(Me,"px"):Me}var se=navigator.platform.toUpperCase().indexOf("MAC")>=0,Te=se?"Cmd":"Ctrl",Oe=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],je=(Le={},Object(N.a)(Le,Te+"-B","bold"),Object(N.a)(Le,Te+"-I","italic"),Le),st=(Fe={},Object(N.a)(Fe,He,"\u6DFB\u52A0\u94FE\u63A5"),Object(N.a)(Fe,Je,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(N.a)(Fe,et,"\u6DFB\u52A0\u6587\u4EF6"),Object(N.a)(Fe,Xe,"\u6DFB\u52A0\u8868\u683C"),Fe),ht=Ke.a=function(Me){var mt=Me.defaultValue,at=mt===void 0?"":mt,qe=Me.onChange,xt=Me.width,Et=xt===void 0?"100%":xt,Pt=Me.height,Lt=Pt===void 0?400:Pt,pt=Me.miniToolbar,or=pt===void 0?!1:pt,Kt=Me.isFocus,Ut=Kt===void 0?!1:Kt,Tr=Me.watch,vr=Me.insertTemp,wi=Me.mode,pr=wi===void 0?"markdown":wi,vn=Me.id,Jr=vn===void 0?"markdown-editor-id":vn,_t=Me.showResizeBar,it=_t===void 0?!1:_t,Sr=Me.noStorage,Vn=Sr===void 0?!1:Sr,cr=Me.showNullButton,St=cr===void 0?!1:cr,wr=Me.hidetoolBar,Zr=wr===void 0?!1:wr,yn=Me.fullScreen,Ne=yn===void 0?!1:yn,dt=Me.onBlur,qr=Me.onCMBeforeChange,en=Me.onFullScreen,tn=Me.className,bn=tn===void 0?"":tn,Xn=Me.disablePaste,ft=Xn===void 0?!1:Xn,Ci=Me.placeholder,Ai=Ci===void 0?"":Ci,rn=Me.values,sr=rn===void 0?"":rn,Li=Object(f.useState)(null),Yn=Object(B.a)(Li,2),Be=Yn[0],$n=Yn[1],Di=Object(f.useState)(at),En=Object(B.a)(Di,2),nn=En[0],Fr=En[1],Ri=Object(f.useState)(Tr),Qn=Object(B.a)(Ri,2),Rr=Qn[0],Oi=Qn[1],Pi=Object(f.useState)(Ne),mr=Object(B.a)(Pi,2),Cr=mr[0],ki=mr[1],xn=Object(f.useState)(""),Nr=Object(B.a)(xn,2),Ur=Nr[0],Br=Nr[1],aa=Object(f.useState)(0),_i=Object(B.a)(aa,2),Or=_i[0],Tn=_i[1],oa=Object(f.useState)(Lt),Jn=Object(B.a)(oa,2),Zn=Jn[0],an=Jn[1],Sn=Object(f.useState)(!1),wn=Object(B.a)(Sn,2),sa=wn[0],Cn=wn[1],on=Object(f.useRef)(Object(Ge.a)()),Mi=Object(f.useRef)(!1),qn=Object(f.useRef)(),$t=Object(f.useRef)(),jr=Object(f.useRef)(),An=Object(f.useRef)(),Wr=Object(f.useRef)(),Ii=function(){var nt=Object(O.a)(A.a.mark(function ct(){var lt,vt;return A.a.wrap(function(Rt){for(;;)switch(Rt.prev=Rt.next){case 0:return Rt.next=2,Object(Ye.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:on.current}});case 2:vt=Rt.sent,vt!=null&&(lt=vt.attachments)!==null&<!==void 0&<.length&&(console.log("cm:",Be,$t),vt.attachments.map(function(yt){yt.content_type.indexOf("image")>-1?Be.replaceSelection("![,](/api/attachments/".concat(yt.id,"?type=").concat(yt.content_type,")")):yt.content_type.indexOf("video")>-1?Be.replaceSelection('')):yt.content_type.indexOf("pdf")>-1?Be.replaceSelection('
    ').concat(yt.name,"")):Be.replaceSelection("[".concat(yt.name,"](").concat(k.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,")"))}));case 4:case"end":return Rt.stop()}},ct)}));return function(){return nt.apply(this,arguments)}}();Object(f.useEffect)(function(){Fr(sr),Be==null||Be.setValue(sr)},[sr]),Object(f.useEffect)(function(){en==null||en(Cr)},[Cr]),Object(f.useEffect)(function(){if($t.current){var nt=w.a.fromTextArea($t.current,{mode:pr,lineNumbers:!or,lineWrapping:!0,value:at,autoCloseTags:!0,autoCloseBrackets:!0});Ut&&nt.focus();function ct(lt,vt){if(ft){vt.preventDefault();return}var Tt=vt.clipboardData;if(Tt){var Rt=Tt.types.toString(),yt=Tt.items;if(Rt==="Files"||Tt.types.indexOf("Files")>-1){if(vt.preventDefault(),pr=="stex")return;try{var It,Wt=yt[1];((It=yt[0])===null||It===void 0?void 0:It.kind)==="file"&&(Wt=yt[0]);var bt=Wt.getAsFile(),kr=bt.name.split(".").pop();ve(bt,function(Ct){if(Ct.id){var Zt,Dt,gr;(bt==null||((Zt=bt.type)===null||Zt===void 0)?void 0:Zt.indexOf("image"))>-1?nt.replaceSelection("![,](/api/attachments/".concat(Ct.id,"?type=").concat(Ct.content_type,")")):(bt==null||((Dt=bt.type)===null||Dt===void 0)?void 0:Dt.indexOf("video"))>-1?nt.replaceSelection('')):(bt==null||((gr=bt.type)===null||gr===void 0)?void 0:gr.indexOf("pdf"))>-1?nt.replaceSelection('').concat(bt.name,"")):Oe.includes(kr)?nt.replaceSelection('').concat(bt.name,"")):nt.replaceSelection("[".concat(bt.name,"](").concat(k.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Ct.content_type,")"))}else(Ct==null?void 0:Ct.status)===401&&(document.location.href="/user/login")})}catch(Ct){I.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return nt.on("paste",ct),nt.on("dragleave",function(lt,vt){jr.current.classList.remove("mouse-hover-md")}),nt.on("dragover",function(lt,vt){jr.current.classList.add("mouse-hover-md")}),nt.on("drop",function(lt,vt){jr.current.classList.add("mouse-hover-md");var Tt;if(Tt=vt.dataTransfer.files,Tt.length>0){vt.preventDefault(),vt.stopPropagation();for(var Rt=function(Wt){var bt=Tt[Wt],kr=bt.name.split(".").pop();ve(bt,function(Ct){if(Ct.id){var Zt,Dt,gr;(bt==null||((Zt=bt.type)===null||Zt===void 0)?void 0:Zt.indexOf("image"))>-1?nt.replaceSelection("![,](/api/attachments/".concat(Ct.id,"?type=").concat(Ct.content_type,")")):(bt==null||((Dt=bt.type)===null||Dt===void 0)?void 0:Dt.indexOf("video"))>-1?nt.replaceSelection('')):(bt==null||((gr=bt.type)===null||gr===void 0)?void 0:gr.indexOf("pdf"))>-1?nt.replaceSelection('').concat(bt.name,"")):Oe.includes(kr)?nt.replaceSelection('').concat(bt.name,"")):nt.replaceSelection("[".concat(bt.name,"](").concat(k.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Ct.content_type,")"))}else(Ct==null?void 0:Ct.status)===401&&(document.location.href="/user/login")})},yt=0;yt0||yt.target.offsetWidth>0)&&(yr(),Be.setSize("100%","100%"),Be.refresh())}}catch(It){Tt.e(It)}finally{Tt.f()}});return lt.observe($t.current.parentElement),lt}if(Be){var ct=nt();return function(){ct.unobserve($t.current.parentElement)}}},[Be,yr]),Object(f.useEffect)(function(){if(Be){for(var nt=[],ct=function(){var yt=vt[lt];Tt=Object(B.a)(yt,2);var It=Tt[0],Wt=Tt[1],bt=Object(N.a)({},It,function(){Ln(Wt)});nt.push(bt),Be.addKeyMap(bt)},lt=0,vt=Object.entries(je);lt0){var nt=new Date().getTime(),ct=window.sessionStorage.getItem(Jr);nt>=Or+ce&&(!ct||ct!==nn)&&(window.sessionStorage.setItem(Jr,nn),Cn(!0))}},ce),Object(f.useEffect)(function(){Oi(Tr)},[Be,Tr]),Object(f.useEffect)(function(){Be&&(Ut&&Be.focus())},[Be,Ut]),Object(f.useEffect)(function(){if(Rr&&Be){var nt=Be.getScrollerElement();function ct(lt){var vt=lt.target;if(Wr.current){var Tt=vt.scrollTop/vt.scrollHeight;Wr.current.scrollTop=Wr.current.scrollHeight*Tt}}return nt.addEventListener("scroll",ct),function(){nt.removeEventListener("scroll",ct)}}},[Be,Rr]),Object(f.useEffect)(function(){if(Be&&qr){function nt(ct,lt){qr(ct,lt)}return Be.on("beforeChange",nt),function(){Be.off("beforeChange",nt)}}},[Be,qr]),Object(f.useEffect)(function(){if(Be&&dt){function nt(){dt(Be.getValue())}return Be.on("blur",nt),function(){Be.off("blur",nt)}}},[Be,dt]),Object(f.useEffect)(function(){if(Be){function nt(ct){var lt=ct.getValue();Fr(lt),Tn(new Date().getTime()),ct.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),qe&&qe(lt)}return Be.on("change",nt),function(){Be.off("change",nt)}}},[Be,qe]),Object(f.useEffect)(function(){Be&&(at==null?(Be.setValue(""),Fr("")):at!==Be.getValue()&&(Be.setValue(at),Fr(at),Be.setCursor(Be.lineCount(),0)))},[Be,at]);var Ln=Object(f.useCallback)(function(nt){var ct=Be.getCursor(),lt=Be.getSelection(),vt=lt.split(` `);switch(nt){case"bold":return Be.replaceSelection("**"+lt+"**"),lt===""&&Be.setCursor(ct.line,ct.ch+2),Be.focus();case"italic":return Be.replaceSelection("*"+lt+"*"),lt===""&&Be.setCursor(ct.line,ct.ch+1),Be.focus();case"code":return Be.replaceSelection("`"+lt+"`"),lt===""&&Be.setCursor(ct.line,ct.ch+1),Be.focus();case"inline-latex":return Be.replaceSelection("`$$"+lt+"$$`"),lt===""&&Be.setCursor(ct.line,ct.ch+3),Be.focus();case"latex":return Be.replaceSelection("```latex\n"+lt+"\n```"),Be.setCursor(ct.line+1,lt.length+1),Be.focus();case"line-break":return Be.replaceSelection(`
    `),Be.focus();case"list-ul":return lt===""?Be.replaceSelection("- "+lt):Be.replaceSelection(vt.map(function(Tt){return Tt===""?"":"- ".concat(Tt)}).join(` `)),Be.focus();case"list-ol":return lt===""?Be.replaceSelection("1. "+lt):Be.replaceSelection(vt.map(function(Tt,Rt){return Tt===""?"":"".concat(Rt+1,". ").concat(Tt)}).join(` `)),Be.focus();case"add-null-ch":return lt===""&&Be.setCursor(ct.line,ct.ch+1),Be.replaceSelection(Q),Be.focus();case"inster-template-1":return lt===""&&Be.setCursor(ct.line,ct.ch),Be.replaceSelection(q),Be.focus();case"eraser":return Be.setValue(""),Be.focus();case"trigger-watch":return Oi(!Rr),Be.focus();case"trigger-full-screen":return ki(!Cr),Be.focus();case He:Br(He);return;case Je:Br(Je);return;case et:Br(et);return;case Xe:Br(Xe);return;default:throw new Error}},[Be,Rr,Cr]),lr=Object(f.useCallback)(function(nt){Br("");switch(Ur){case He:var ct=nt.title,lt=nt.link;return Be.replaceSelection("[".concat(ct,"](").concat(lt,")")),Be.focus();case Je:var vt=nt.language,Tt=nt.content;return Be.replaceSelection(["```"+vt,Tt,"```"].join(` `)),Be.focus();case et:var Rt=nt.src,yt=nt.alt;return yt?Be.replaceSelection("![ ".concat(yt," ]( ").concat(Rt,' "').concat(yt,'" )')):Be.replaceSelection("![,](".concat(Rt,")")),Be.focus();case Xe:for(var It=nt.row,Wt=nt.col,bt=nt.align,kr=` `,Ct=0;Ct300&&(It=300);var Wt=Lt+It+"px";an(Wt)}}return nt.addEventListener("mousedown",vt),document.addEventListener("mousemove",Rt),document.addEventListener("mouseup",Tt),function(){nt.removeEventListener("mousedown",vt),document.removeEventListener("mousemove",Rt),document.removeEventListener("mouseup",Tt)}}},[Be,An]),Object(f.useEffect)(function(){an(Lt)},[Lt]);var Hr=re(Et),la=re(Zn),ua={width:Hr,height:la},$a=Object(f.useMemo)(function(){if(Or){var nt=new Date(Or),ct=nt.getHours(),lt=nt.getMinutes(),vt=nt.getSeconds();return ct=ct<10?"0"+ct:ct,lt=lt<10?"0"+lt:lt,vt=vt<10?"0"+vt:vt,"".concat(ct,":").concat(lt,":").concat(vt)}return 0},[Or]);function Qa(){window.sessionStorage.removeItem(Jr),Cn(!1),Tn(0)}function da(){Cn(!1),Tn(0),Be.setValue(window.sessionStorage.getItem(Jr))}function Fi(nt,ct){var lt=Be.getValue();lt=lt.replace(nt,ct),Fr(lt),Be==null||Be.setValue(lt)}return v.a.createElement(f.Fragment,null,v.a.createElement("div",{className:"markdown-editor-wrapper",ref:jr},v.a.createElement("div",{className:"markdown-editor-container ".concat(bn," ").concat(Rr?"on-preview":""," ").concat(or?"mini":""," ").concat(Cr?"full-screen":""),style:ua},v.a.createElement(W,{insertTemp:vr,watch:Rr,fullScreen:Cr,showNullButton:St,onActionCallback:Ln,hidetoolBar:Zr,uuid:on.current,setOpenPhones:function(){Mi.current=!0}}),v.a.createElement("div",{className:"markdown-editor-body"},v.a.createElement("div",{className:"codemirror-container"},v.a.createElement("textarea",{ref:$t,placeholder:Ai})),Rr?v.a.createElement("div",{ref:Wr,className:"preview-container"},pr==="stex"&&v.a.createElement(D,{value:nn}),pr!=="stex"&&v.a.createElement(m.a,{edit:!0,value:nn,replaces:Fi})):null))),it?v.a.createElement("a",{ref:An,className:"editor-resize"}):null,v.a.createElement(_.a,null,st[Ur]?v.a.createElement(K.a,{centered:!0,title:st[Ur],visible:!0,onCancel:Pr,footer:null,className:"markdown-popup-form"},Dn):null))}},SJMd:function(Ze,Ke){/** * @license * Copyright (C) 2006 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */var te,J,K,L=!1,H,I;window.PR_SHOULD_USE_CONTINUATION=!0;var O,B;(function(){var N=window,R=["break,continue,do,else,for,if,return,while"],A=[R,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],f=[A,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],v=[f,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],P=[f,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],w=[f,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],b="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",E=[f,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],l="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[R,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],s=[R,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],d=[R,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],C=[v,w,P,E,l,o,s,d],g=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,m="str",D="kwd",T="com",h="typ",c="lit",u="pun",a="pln",x="tag",y="dec",p="src",k="atn",F="atv",U="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function _(ve){for(var Se=0,De=!1,_e=!1,ke=0,Re=ve.length;ke122||(Q<65||ce>90||rt.push([Math.max(65,ce)|32,Math.min(Q,90)|32]),Q<97||ce>122||rt.push([Math.max(97,ce)&~32,Math.min(Q,122)&~32]))}}rt.sort(function(Te,Oe){return Te[0]-Oe[0]||Oe[1]-Te[1]});for(var q=[],re=[],Fe=0;Fese[0]&&(se[1]+1>se[0]&&Le.push("-"),Le.push(Ge(se[1])))}return Le.push("]"),Le.join("")}function et(Xe){for(var we=Xe.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),rt=we.length,$e=[],Le=0,Fe=0;Le=2&&ce==="["?we[Le]=He(ge):ce!=="\\"&&(we[Le]=ge.replace(/[a-zA-Z]/g,function(re){var se=re.charCodeAt(0);return"["+String.fromCharCode(se&~32,se|32)+"]"}))}return we.join("")}for(var Je=[],ke=0,Re=ve.length;ke=0;)De[Je.charAt(Xe)]=et;var we=et[1],rt=""+we;Ye.hasOwnProperty(rt)||(Ue.push(we),Ye[rt]=null)}Ue.push(/[\0-\uffff]/),_e=_(Ue)})();var ke=Se.length,Re=function(Ae){for(var Ue=Ae.sourceCode,Ye=Ae.basePos,Ge=Ae.sourceNode,He=[Ye,a],et=0,Je=Ue.match(_e)||[],Xe={},we=0,rt=Je.length;we=5&&Le.substring(0,5)==="lang-",ge&&!(Fe&&typeof Fe[1]=="string")&&(ge=!1,Le=p),ge||(Xe[$e]=Le)}var Q=et;if(et+=$e.length,!ge)He.push(Ye+Q,Le);else{var q=Fe[1],re=$e.indexOf(q),se=re+q.length;Fe[2]&&(se=$e.length-Fe[2].length,re=se-q.length);var Te=Le.substring(5);G(Ge,Ye+Q,$e.substring(0,re),Re,He),G(Ge,Ye+Q+re,q,he(Te,q),He),G(Ge,Ye+Q+se,$e.substring(se),Re,He)}}Ae.decorations=He};return Re}function be(ve){var Se=[],De=[];ve.tripleQuotedStrings?Se.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ve.multiLineStrings?Se.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Se.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ve.verbatimStrings&&De.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var _e=ve.hashComments;_e&&(ve.cStyleComments?(_e>1?Se.push([T,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Se.push([T,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),De.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Se.push([T,/^#[^\r\n]*/,null,"#"])),ve.cStyleComments&&(De.push([T,/^\/\/[^\r\n]*/,null]),De.push([T,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ke=ve.regexLiterals;if(ke){var Re=ke>1?"":` \r`,Ae=Re?".":"[\\S\\s]",Ue="/(?=[^/*"+Re+"])(?:[^/\\x5B\\x5C"+Re+"]|\\x5C"+Ae+"|\\x5B(?:[^\\x5C\\x5D"+Re+"]|\\x5C"+Ae+")*(?:\\x5D|$))+/";De.push(["lang-regex",RegExp("^"+W+"("+Ue+")")])}var Ye=ve.types;Ye&&De.push([h,Ye]);var Ge=(""+ve.keywords).replace(/^ | $/g,"");Ge.length&&De.push([D,new RegExp("^(?:"+Ge.replace(/[\s,]+/g,"|")+")\\b"),null]),Se.push([a,/^\s+/,null,` \r \xA0`]);var He="^.[^\\s\\w.$@'\"`/\\\\]*";return ve.regexLiterals&&(He+="(?!s*/)"),De.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[h,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[u,new RegExp(He),null]),ne(Se,De)}var me=be({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function pe(ve,Se,De){for(var _e=/(?:^|\s)nocode(?:\s|$)/,ke=/\r\n?|\n/,Re=ve.ownerDocument,Ae=Re.createElement("li");ve.firstChild;)Ae.appendChild(ve.firstChild);var Ue=[Ae];function Ye(we){var rt=we.nodeType;if(rt==1&&!_e.test(we.className))if(we.nodeName==="br")Ge(we),we.parentNode&&we.parentNode.removeChild(we);else for(var $e=we.firstChild;$e;$e=$e.nextSibling)Ye($e);else if((rt==3||rt==4)&&De){var Le=we.nodeValue,Fe=Le.match(ke);if(Fe){var ge=Le.substring(0,Fe.index);we.nodeValue=ge;var de=Le.substring(Fe.index+Fe[0].length);if(de){var ce=we.parentNode;ce.insertBefore(Re.createTextNode(de),we.nextSibling)}Ge(we),ge||we.parentNode.removeChild(we)}}}function Ge(we){for(;!we.nextSibling;)if(we=we.parentNode,!we)return;function rt(Fe,ge){var de=ge?Fe.cloneNode(!1):Fe,ce=Fe.parentNode;if(ce){var Q=rt(ce,1),q=Fe.nextSibling;Q.appendChild(de);for(var re=q;re;re=q)q=re.nextSibling,Q.appendChild(re)}return de}for(var $e=rt(we.nextSibling,0),Le;(Le=$e.parentNode)&&Le.nodeType===1;)$e=Le;Ue.push($e)}for(var He=0;He=ce&&(Ye+=2),Re>=Q&&(et+=2)}}finally{Le&&(Le.style.display=Fe)}}var fe={};function ie(ve,Se){for(var De=Se.length;--De>=0;){var _e=Se[De];fe.hasOwnProperty(_e)?N.console&&console.warn("cannot override language handler %s",_e):fe[_e]=ve}}function he(ve,Se){return ve&&fe.hasOwnProperty(ve)||(ve=/^\s*]*(?:>|$)/],[T,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[u,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ie(ne([[a,/^[\s]+/,null,` \r `],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[x,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[k,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[u,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ie(ne([],[[F,/^[\s\S]+/]]),["uq.val"]),ie(be({keywords:v,hashComments:!0,cStyleComments:!0,types:g}),["c","cc","cpp","cxx","cyc","m"]),ie(be({keywords:"null,true,false"}),["json"]),ie(be({keywords:w,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:g}),["cs"]),ie(be({keywords:P,cStyleComments:!0}),["java"]),ie(be({keywords:d,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ie(be({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ie(be({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ie(be({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ie(be({keywords:E,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ie(be({keywords:b,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ie(ne([],[[m,/^[\s\S]+/]]),["regex"]);function $(ve){var Se=ve.langExtension;try{var De=M(ve.sourceNode,ve.pre),_e=De.sourceCode;ve.sourceCode=_e,ve.spans=De.spans,ve.basePos=0,he(Se,_e)(ve),ue(ve)}catch(ke){N.console&&console.log(ke&&ke.stack||ke)}}function ae(ve,Se,De){var _e=De||!1,ke=Se||null,Re=document.createElement("div");Re.innerHTML="
    "+ve+"
    ",Re=Re.firstChild,_e&&pe(Re,_e,!0);var Ae={langExtension:ke,numberLines:_e,sourceNode:Re,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return $(Ae),Re.innerHTML}function ee(ve,Se){var De=Se||document.body,_e=De.ownerDocument||document;function ke(de){return De.getElementsByTagName(de)}for(var Re=[ke("pre"),ke("code"),ke("xmp")],Ae=[],Ue=0;Ue=15&&(v=!1,R=!0);var m=s&&(A||v&&(g==null||g<12.11)),D=L||B&&N>=9;function T(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var n=e.className,r=T(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function c(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function u(e,t){return c(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var S=0;S=t)return j+(t-S);j+=z-S,j+=n-j%n,S=z+1}}var Y=function(){this.id=null,this.f=null,this.time=0,this.handler=_(this.onTimeout,this)};Y.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Y.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n=t)return r+Math.min(j,t-i);if(i+=S-r,i+=n-i%n,r=S+1,i>=t)return r}}var ie=[""];function he(e){for(;ie.length<=e;)ie.push($(ie)+" ");return ie[e]}function $(e){return e[e.length-1]}function ae(e,t){for(var n=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ve.test(e))}function De(e,t){return t?t.source.indexOf("\\w")>-1&&Se(e)?!0:t.test(e):Se(e)}function _e(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ke=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Re(e){return e.charCodeAt(0)>=768&&ke.test(e)}function Ae(e,t,n){for(;(n<0?t>0:tn?-1:1;;){if(t==n)return t;var i=(t+n)/2,S=r<0?Math.ceil(i):Math.floor(i);if(S==t)return e(S)?t:n;e(S)?n=S:t=S+r}}function Ye(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,S=0;St||t==n&&j.to==t)&&(r(Math.max(j.from,t),Math.min(j.to,n),j.level==1?"rtl":"ltr",S),i=!0)}i||r(t,n,"ltr")}var Ge=null;function He(e,t,n){var r;Ge=null;for(var i=0;it)return i;S.to==t&&(S.from!=S.to&&n=="before"?r=i:Ge=i),S.from==t&&(S.from!=S.to&&n!="before"?r=i:Ge=i)}return r!=null?r:Ge}var et=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(X){return X<=247?e.charAt(X):1424<=X&&X<=1524?"R":1536<=X&&X<=1785?t.charAt(X-1536):1774<=X&&X<=2220?"r":8192<=X&&X<=8203?"w":X==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,S=/[LRr]/,j=/[Lb1n]/,z=/[1n]/;function V(X,oe,le){this.level=X,this.from=oe,this.to=le}return function(X,oe){var le=oe=="ltr"?"L":"R";if(X.length==0||oe=="ltr"&&!r.test(X))return!1;for(var xe=X.length,ye=[],Pe=0;Pe-1&&(r[t]=i.slice(0,S).concat(i.slice(S+1)))}}}function Le(e,t){var n=rt(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function ce(e){e.prototype.on=function(t,n){we(this,t,n)},e.prototype.off=function(t,n){$e(this,t,n)}}function Q(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function q(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function re(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function se(e){Q(e),q(e)}function Te(e){return e.target||e.srcElement}function Oe(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var je=function(){if(B&&N<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),st;function ht(e){if(st==null){var t=a("span","\u200B");u(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(st=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&N<8))}var n=st?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var Me;function mt(e){if(Me!=null)return Me;var t=u(e,document.createTextNode("A\u062EA")),n=y(t,0,1).getBoundingClientRect(),r=y(t,1,2).getBoundingClientRect();return c(e),!n||n.left==n.right?!1:Me=r.right-n.right<3}var at=` b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(` `,t);i==-1&&(i=e.length);var S=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),j=S.indexOf("\r");j!=-1?(n.push(S.slice(0,j)),t+=j+1):(n.push(S),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},qe=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},xt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Et=null;function Pt(e){if(Et!=null)return Et;var t=u(e,a("span","x")),n=t.getBoundingClientRect(),r=y(t,0,1).getBoundingClientRect();return Et=Math.abs(n.left-r.left)>1}var Lt={},pt={};function or(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Lt[e]=t}function Kt(e,t){pt[e]=t}function Ut(e){if(typeof e=="string"&&pt.hasOwnProperty(e))e=pt[e];else if(e&&typeof e.name=="string"&&pt.hasOwnProperty(e.name)){var t=pt[e.name];typeof t=="string"&&(t={name:t}),e=Ce(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ut("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ut("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Tr(e,t){t=Ut(t);var n=Lt[t.name];if(!n)return Tr(e,"text/plain");var r=n(e,t);if(vr.hasOwnProperty(t.name)){var i=vr[t.name];for(var S in i){if(!i.hasOwnProperty(S))continue;r.hasOwnProperty(S)&&(r["_"+S]=r[S]),r[S]=i[S]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var j in t.modeProps)r[j]=t.modeProps[j];return r}var vr={};function wi(e,t){var n=vr.hasOwnProperty(e)?vr[e]:vr[e]={};M(t,n)}function pr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function vn(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Jr(e,t,n){return e.startState?e.startState(t,n):!0}var _t=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};_t.prototype.eol=function(){return this.pos>=this.string.length},_t.prototype.sol=function(){return this.pos==this.lineStart},_t.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},_t.prototype.next=function(){if(this.post},_t.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},_t.prototype.skipToEnd=function(){this.pos=this.string.length},_t.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},_t.prototype.backUp=function(e){this.pos-=e},_t.prototype.column=function(){return this.lastColumnPos0?null:(S&&t!==!1&&(this.pos+=S[0].length),S)}},_t.prototype.current=function(){return this.string.slice(this.start,this.pos)},_t.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},_t.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},_t.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function it(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],S=i.chunkSize();if(t=e.first&&tn?Ne(n,it(e,n).text.length):Ci(t,it(e,t.line).text.length)}function Ci(e,t){var n=e.ch;return n==null||n>t?Ne(e.line,t):n<0?Ne(e.line,0):e}function Ai(e,t){for(var n=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},sr.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},sr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},sr.fromSaved=function(e,t,n){return t instanceof rn?new sr(e,pr(e.mode,t.state),n,t.lookAhead):new sr(e,pr(e.mode,t),n)},sr.prototype.save=function(e){var t=e!==!1?pr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new rn(t,this.maxLookAhead):t};function Li(e,t,n,r){var i=[e.state.modeGen],S={};Qn(e,t.text,e.doc.mode,n,function(X,oe){return i.push(X,oe)},S,r);for(var j=n.state,z=function(X){n.baseTokens=i;var oe=e.state.overlays[X],le=1,xe=0;n.state=!0,Qn(e,t.text,oe.mode,n,function(ye,Pe){for(var Ie=le;xeye&&i.splice(le,1,ye,i[le+1],We),le+=2,xe=Math.min(ye,We)}if(!Pe)return;if(oe.opaque)i.splice(Ie,le-Ie,ye,"overlay "+Pe),le=Ie+2;else for(;Iee.options.maxHighlightLength&&pr(e.doc.mode,r.state),S=Li(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=S.styles,S.classes?t.styleClasses=S.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Be(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new sr(r,!0,t);var S=Rr(e,t,n),j=S>r.first&&it(r,S-1).stateAfter,z=j?sr.fromSaved(r,j,S):new sr(r,Jr(r.mode),S);return r.iter(S,t,function(V){$n(e,V.text,z);var X=z.line;V.stateAfter=X==t-1||X%5==0||X>=i.viewFrom&&Xt.start)return S}throw new Error("Mode "+e.name+" failed to advance stream.")}var nn=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Fr(e,t,n,r){var i=e.doc,S=i.mode,j;t=ft(i,t);var z=it(i,t.line),V=Be(e,t.line,n),X=new _t(z.text,e.options.tabSize,V),oe;for(r&&(oe=[]);(r||X.pose.options.maxHighlightLength?(z=!1,j&&$n(e,t,r,oe.pos),oe.pos=t.length,le=null):le=Ri(En(n,oe,r.state,xe),S),xe){var ye=xe[0].name;ye&&(le="m-"+(le?ye+" "+le:ye))}if(!z||X!=le){for(;Vj;--z){if(z<=S.first)return S.first;var V=it(S,z-1),X=V.stateAfter;if(X&&(!n||z+(X instanceof rn?X.lookAhead:0)<=S.modeFrontier))return z;var oe=G(V.text,null,e.options.tabSize);(i==null||r>oe)&&(i=z-1,r=oe)}return i}function Oi(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontiern;r--){var i=it(e,r).stateAfter;if(i&&(!(i instanceof rn)||r+i.lookAhead=t:S.to>t);(r||(r=[])).push(new xn(j,S.from,V?null:S.to))}}return r}function _i(e,t,n){var r;if(e)for(var i=0;i=t:S.to>t);if(z||S.from==t&&j.type=="bookmark"&&(!n||S.marker.insertLeft)){var V=S.from==null||(j.inclusiveLeft?S.from<=t:S.from0&&z)for(var tt=0;tt0)continue;var oe=[V,1],le=dt(X.from,z.from),xe=dt(X.to,z.to);(le<0||!j.inclusiveLeft&&!le)&&oe.push({from:X.from,to:z.from}),(xe>0||!j.inclusiveRight&&!xe)&&oe.push({from:z.to,to:X.to}),i.splice.apply(i,oe),V+=oe.length-3}return i}function Jn(e){var t=e.markedSpans;if(!t)return;for(var n=0;nt)&&(!r||wn(r,S.marker)<0)&&(r=S.marker)}return r}function qn(e,t,n,r,i){var S=it(e,t),j=mr&&S.markedSpans;if(j)for(var z=0;z=0&&le<=0||oe<=0&&le>=0)continue;if(oe<=0&&(V.marker.inclusiveRight&&i.inclusiveLeft?dt(X.to,n)>=0:dt(X.to,n)>0)||oe>=0&&(V.marker.inclusiveRight&&i.inclusiveLeft?dt(X.from,r)<=0:dt(X.from,r)<0))return!0}}function $t(e){for(var t;t=Cn(e);)e=t.find(-1,!0).line;return e}function jr(e){for(var t;t=on(e);)e=t.find(1,!0).line;return e}function An(e){for(var t,n;t=on(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Wr(e,t){var n=it(e,t),r=$t(n);return n==r?t:St(r)}function Ii(e,t){if(t>e.lastLine())return t;var n=it(e,t),r;if(!yr(e,n))return t;for(;r=on(n);)n=r.find(1,!0).line;return St(n)+1}function yr(e,t){var n=mr&&t.markedSpans;if(n)for(var r=void 0,i=0;it.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Hr=function(e,t,n){this.text=e,Zn(this,t),this.height=n?n(this):1};Hr.prototype.lineNo=function(){return St(this)},ce(Hr);function la(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Jn(e),Zn(e,n);var i=r?r(e):1;i!=e.height&&cr(e,i)}function ua(e){e.parent=null,Jn(e)}var $a={},Qa={};function da(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Qa:$a;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Fi(e,t){var n=x("span",null,null,R?"padding-right: .1px":null),r={pre:x("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var S=i?t.rest[i-1]:t.line,j=void 0;r.pos=0,r.addToken=ct,mt(e.display.measure)&&(j=Je(S,e.doc.direction))&&(r.addToken=vt(r.addToken,j)),r.map=[];var z=t!=e.display.externalMeasured&&St(S);Rt(S,r,Yn(e,S,z)),S.styleClasses&&(S.styleClasses.bgClass&&(r.bgClass=U(S.styleClasses.bgClass,r.bgClass||"")),S.styleClasses.textClass&&(r.textClass=U(S.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ht(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(R){var V=r.content.lastChild;(/\bcm-tab\b/.test(V.className)||V.querySelector&&V.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Le(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=U(r.pre.className,r.textClass||"")),r}function nt(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ct(e,t,n,r,i,S,j){if(!t)return;var z=e.splitSpaces?lt(t,e.trailingSpace):t,V=e.cm.state.specialChars,X=!1,oe;if(!V.test(t))e.col+=t.length,oe=document.createTextNode(z),e.map.push(e.pos,e.pos+t.length,oe),B&&N<9&&(X=!0),e.pos+=t.length;else{oe=document.createDocumentFragment();for(var le=0;;){V.lastIndex=le;var xe=V.exec(t),ye=xe?xe.index-le:t.length-le;if(ye){var Pe=document.createTextNode(z.slice(le,le+ye));B&&N<9?oe.appendChild(a("span",[Pe])):oe.appendChild(Pe),e.map.push(e.pos,e.pos+ye,Pe),e.col+=ye,e.pos+=ye}if(!xe)break;le+=ye+1;var Ie=void 0;if(xe[0]==" "){var We=e.cm.options.tabSize,ze=We-e.col%We;Ie=oe.appendChild(a("span",he(ze),"cm-tab")),Ie.setAttribute("role","presentation"),Ie.setAttribute("cm-text"," "),e.col+=ze}else xe[0]=="\r"||xe[0]==` `?(Ie=oe.appendChild(a("span",xe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ie.setAttribute("cm-text",xe[0]),e.col+=1):(Ie=e.cm.options.specialCharPlaceholder(xe[0]),Ie.setAttribute("cm-text",xe[0]),B&&N<9?oe.appendChild(a("span",[Ie])):oe.appendChild(Ie),e.col+=1);e.map.push(e.pos,e.pos+1,Ie),e.pos++}}if(e.trailingSpace=z.charCodeAt(t.length-1)==32,n||r||i||X||S||j){var Qe=n||"";r&&(Qe+=r),i&&(Qe+=i);var Ve=a("span",[oe],Qe,S);if(j)for(var tt in j)j.hasOwnProperty(tt)&&tt!="style"&&tt!="class"&&Ve.setAttribute(tt,j[tt]);return e.content.appendChild(Ve)}e.content.appendChild(oe)}function lt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;iX&&le.from<=X);xe++);if(le.to>=oe)return e(n,r,i,S,j,z,V);e(n,r.slice(0,le.to-X),i,S,null,z,V),S=null,r=r.slice(le.to-X),X=le.to}}}function Tt(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Rt(e,t,n){var r=e.markedSpans,i=e.text,S=0;if(!r){for(var j=1;jV||gt.collapsed&&ot.to==V&&ot.from==V)){if(ot.to!=null&&ot.to!=V&&ye>ot.to&&(ye=ot.to,Ie=""),gt.className&&(Pe+=" "+gt.className),gt.css&&(xe=(xe?xe+";":"")+gt.css),gt.startStyle&&ot.from==V&&(We+=" "+gt.startStyle),gt.endStyle&&ot.to==ye&&(tt||(tt=[])).push(gt.endStyle,ot.to),gt.title&&((Qe||(Qe={})).title=gt.title),gt.attributes)for(var Ot in gt.attributes)(Qe||(Qe={}))[Ot]=gt.attributes[Ot];gt.collapsed&&(!ze||wn(ze.marker,gt)<0)&&(ze=ot)}else ot.from>V&&ye>ot.from&&(ye=ot.from)}if(tt)for(var Vt=0;Vt=z)break;for(var dr=Math.min(z,ye);;){if(oe){var nr=V+oe.length;if(!ze){var Bt=nr>dr?oe.slice(0,dr-V):oe;t.addToken(t,Bt,le?le+Pe:Pe,We,V+Bt.length==ye?Ie:"",xe,Qe)}if(nr>=dr){oe=oe.slice(dr-V),V=dr;break}V=nr,We=""}oe=i.slice(S,S=n[X++]),le=da(n[X++],t.cm.options)}}}function yt(e,t,n){this.line=t,this.rest=An(t),this.size=this.rest?St($(this.rest))-n+1:1,this.node=this.text=null,this.hidden=yr(e,t)}function It(e,t,n){for(var r=[],i,S=t;S2&&S.push((V.bottom+X.top)/2-n.top)}}S.push(n.bottom-n.top)}}function no(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;rn)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=$t(t);var n=St(t),r=e.display.externalMeasured=new yt(e.doc,t,n);r.lineN=n;var i=r.built=Fi(e,r);return r.text=i.pre,u(e.display.lineMeasure,i.pre),r}function io(e,t,n,r){return Lr(e,Rn(e,t),n,r)}function pa(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(S=V-z,i=S-1,t>=V&&(j="right")),i!=null){if(r=e[X+2],z==V&&n==(r.insertLeft?"left":"right")&&(j=n),n=="left"&&i==0)for(;X&&e[X-2]==e[X-3]&&e[X-1].insertLeft;)r=e[(X-=3)+2],j="left";if(n=="right"&&i==V-z)for(;X=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=oo(t.map,n,r),S=i.node,j=i.start,z=i.end,V=i.collapse,X;if(S.nodeType==3){for(var oe=0;oe<4;oe++){for(;j&&Re(t.line.text.charAt(i.coverStart+j));)--j;for(;i.coverStart+z0&&(V=r="right");var le;e.options.lineWrapping&&(le=S.getClientRects()).length>1?X=le[r=="right"?le.length-1:0]:X=S.getBoundingClientRect()}if(B&&N<9&&!j&&(!X||!X.left&&!X.right)){var xe=S.parentNode.getClientRects()[0];xe?X={left:xe.left,right:xe.left+Pn(e.display),top:xe.top,bottom:xe.bottom}:X=ao}for(var ye=X.top-t.rect.top,Pe=X.bottom-t.rect.top,Ie=(ye+Pe)/2,We=t.view.measure.heights,ze=0;ze=r.text.length?(V=r.text.length,X="before"):V<=0&&(V=0,X="after"),!z)return j(X=="before"?V-1:V,X=="before");function oe(Pe,Ie,We){var ze=z[Ie],Qe=ze.level==1;return j(We?Pe-1:Pe,Qe!=We)}var le=He(z,V,X),xe=Ge,ye=oe(V,le,X=="before");return xe!=null&&(ye.other=oe(V,xe,X!="before")),ye}function ho(e,t){var n=0;t=ft(e.doc,t),e.options.lineWrapping||(n=Pn(e.display)*t.ch);var r=it(e.doc,t.line),i=lr(r)+Ni(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function va(e,t,n,r,i){var S=Ne(e,t,n);return S.xRel=i,r&&(S.outside=r),S}function ya(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return va(r.first,0,null,-1,-1);var i=wr(r,n),S=r.first+r.size-1;if(i>S)return va(r.first+r.size-1,it(r,S).text.length,null,1,1);t<0&&(t=0);for(var j=it(r,i);;){var z=Ks(e,j,i,t,n),V=Mi(j,z.ch+(z.xRel>0||z.outside>0?1:0));if(!V)return z;var X=V.find(1);if(X.line==i)return X;j=it(r,i=X.line)}}function po(e,t,n,r){r-=ma(t);var i=t.text.length,S=Ue(function(j){return Lr(e,n,j-1).bottom<=r},i,0);return i=Ue(function(j){return Lr(e,n,j).top>r},S,i),{begin:S,end:i}}function mo(e,t,n,r){n||(n=Rn(e,t));var i=Ui(e,t,Lr(e,n,r),"line").top;return po(e,t,n,i)}function ba(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,i){i-=lr(t);var S=Rn(e,t),j=ma(t),z=0,V=t.text.length,X=!0,oe=Je(t,e.doc.direction);if(oe){var le=(e.options.lineWrapping?zs:Gs)(e,t,n,S,oe,r,i);X=le.level!=1,z=X?le.from:le.to-1,V=X?le.to:le.from-1}var xe=null,ye=null,Pe=Ue(function(ut){var ot=Lr(e,S,ut);return ot.top+=j,ot.bottom+=j,ba(ot,r,i,!1)?(ot.top<=i&&ot.left<=r&&(xe=ut,ye=ot),!0):!1},z,V),Ie,We,ze=!1;if(ye){var Qe=r-ye.left=tt.bottom?1:0}return Pe=Ae(t.text,Pe,1),va(n,Pe,We,ze,r-Ie)}function Gs(e,t,n,r,i,S,j){var z=Ue(function(le){var xe=i[le],ye=xe.level!=1;return ba(br(e,Ne(n,ye?xe.to:xe.from,ye?"before":"after"),"line",t,r),S,j,!0)},0,i.length-1),V=i[z];if(z>0){var X=V.level!=1,oe=br(e,Ne(n,X?V.from:V.to,X?"after":"before"),"line",t,r);ba(oe,S,j,!0)&&oe.top>j&&(V=i[z-1])}return V}function zs(e,t,n,r,i,S,j){var z=po(e,t,r,j),V=z.begin,X=z.end;/\s/.test(t.text.charAt(X-1))&&X--;for(var oe=null,le=null,xe=0;xe=X||ye.to<=V)continue;var Pe=ye.level!=1,Ie=Lr(e,r,Pe?Math.min(X,ye.to)-1:Math.max(V,ye.from)).right,We=IeWe)&&(oe=ye,le=We)}return oe||(oe=i[i.length-1]),oe.fromX&&(oe={from:oe.from,to:X,level:oe.level}),oe}var ln;function On(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(ln==null){ln=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)ln.appendChild(document.createTextNode("x")),ln.appendChild(a("br"));ln.appendChild(document.createTextNode("x"))}u(e.measure,ln);var n=ln.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function Pn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");u(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Ea(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,S=t.gutters.firstChild,j=0;S;S=S.nextSibling,++j){var z=e.display.gutterSpecs[j].className;n[z]=S.offsetLeft+S.clientLeft+i,r[z]=S.clientWidth}return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function xa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function go(e){var t=On(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Pn(e.display)-3);return function(i){if(yr(e.doc,i))return 0;var S=0;if(i.widgets)for(var j=0;j0&&(X=it(e.doc,V.line).text).length==V.ch){var oe=G(X,X.length,e.options.tabSize)-X.length;V=Ne(V.line,Math.max(0,Math.round((S-ro(e.display).left)/Pn(e.display))-oe))}return V}function dn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;rt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)mr&&Wr(e.doc,t)i.viewFrom?Gr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Gr(e);else if(t<=i.viewFrom){var S=Bi(e,n,n+r,1);S?(i.view=i.view.slice(S.index),i.viewFrom=S.lineN,i.viewTo+=r):Gr(e)}else if(n>=i.viewTo){var j=Bi(e,t,t,-1);j?(i.view=i.view.slice(0,j.index),i.viewTo=j.lineN):Gr(e)}else{var z=Bi(e,t,t,-1),V=Bi(e,n,n+r,1);z&&V?(i.view=i.view.slice(0,z.index).concat(It(e,z.lineN,V.lineN)).concat(i.view.slice(V.index)),i.viewTo+=r):Gr(e)}var X=i.externalMeasured;X&&(n=i.lineN&&t=r.viewTo)return;var S=r.view[dn(e,t)];if(S.node==null)return;var j=S.changes||(S.changes=[]);Z(j,n)==-1&&j.push(n)}function Gr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Bi(e,t,n,r){var i=dn(e,t),S,j=e.display.view;if(!mr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var z=e.display.viewFrom,V=0;V0){if(i==j.length-1)return null;S=z+j[i].size-t,i++}else S=z-t;t+=S,n+=S}for(;Wr(e.doc,n)!=n;){if(i==(r<0?0:j.length-1))return null;n+=r*j[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=It(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=It(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,dn(e,n)))),r.viewTo=n}function vo(e){for(var t=e.display.view,n=0,r=0;r=e.display.viewTo||z.to().line0?t.blinker=setInterval(function(){e.hasFocus()||kn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Eo(e){e.state.focused||(e.display.input.focus(),wa(e))}function xo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,kn(e))},100)}function wa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Le(e,"focus",e,t),e.state.focused=!0,F(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),R&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function kn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Le(e,"blur",e,t),e.state.focused=!1,h(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Wi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r.005||oe<-.005)&&(cr(i.line,j),To(i.line),i.rest))for(var le=0;lee.display.sizerWidth){var xe=Math.ceil(z/Pn(e.display));xe>e.display.maxLineLength&&(e.display.maxLineLength=xe,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function To(e){if(e.widgets)for(var t=0;t=j&&(S=wr(t,lr(it(t,V))-e.wrapper.clientHeight),j=V)}return{from:S,to:Math.max(j,S+1)}}function Ys(e,t){if(Fe(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!b){var S=a("div","\u200B",null,`position: absolute; top: `+(t.top-n.viewOffset-Ni(e.display))+`px; height: `+(t.bottom-t.top+Ar(e)+n.barHeight)+`px; left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(S),S.scrollIntoView(i),e.display.lineSpace.removeChild(S)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Ne(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Ne(t.line,t.ch+1,"before"):t);for(var S=0;S<5;S++){var j=!1,z=br(e,t),V=!n||n==t?z:br(e,n);i={left:Math.min(z.left,V.left),top:Math.min(z.top,V.top)-r,right:Math.max(z.left,V.left),bottom:Math.max(z.bottom,V.bottom)+r};var X=Ca(e,i),oe=e.doc.scrollTop,le=e.doc.scrollLeft;if(X.scrollTop!=null&&(ai(e,X.scrollTop),Math.abs(e.doc.scrollTop-oe)>1&&(j=!0)),X.scrollLeft!=null&&(cn(e,X.scrollLeft),Math.abs(e.doc.scrollLeft-le)>1&&(j=!0)),!j)break}return i}function Qs(e,t){var n=Ca(e,t);n.scrollTop!=null&&ai(e,n.scrollTop),n.scrollLeft!=null&&cn(e,n.scrollLeft)}function Ca(e,t){var n=e.display,r=On(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,S=ha(e),j={};t.bottom-t.top>S&&(t.bottom=t.top+S);var z=e.doc.height+fa(n),V=t.topz-r;if(t.topi+S){var oe=Math.min(t.top,(X?z:t.bottom)-S);oe!=i&&(j.scrollTop=oe)}var le=e.options.fixedGutter?0:n.gutters.offsetWidth,xe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-le,ye=sn(e)-n.gutters.offsetWidth,Pe=t.right-t.left>ye;return Pe&&(t.right=t.left+ye),t.left<10?j.scrollLeft=0:t.leftye+xe-3&&(j.scrollLeft=t.right+(Pe?0:10)-ye),j}function Aa(e,t){if(t==null)return;Ki(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function _n(e){Ki(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function ii(e,t,n){(t!=null||n!=null)&&Ki(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Js(e,t){Ki(e),e.curOp.scrollToPos=t}function Ki(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=ho(e,t.from),r=ho(e,t.to);So(e,n,r,t.margin)}}function So(e,t,n,r){var i=Ca(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});ii(e,i.scrollLeft,i.scrollTop)}function ai(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;L||Da(e,{top:t}),wo(e,t,!0),L&&Da(e),li(e,100)}function wo(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function cn(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Ro(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function oi(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+fa(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Ar(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var fn=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),we(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),we(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,B&&N<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};fn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var S=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+S)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},fn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},fn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},fn.prototype.zeroWidthHack=function(){var e=s&&!w?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Y,this.disableVert=new Y},fn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),S=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);S!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},fn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var si=function(){};si.prototype.update=function(){return{bottom:0,right:0}},si.prototype.setScrollLeft=function(){},si.prototype.setScrollTop=function(){},si.prototype.clear=function(){};function Mn(e,t){t||(t=oi(e));var n=e.display.barWidth,r=e.display.barHeight;Co(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Wi(e),Co(e,oi(e)),n=e.display.barWidth,r=e.display.barHeight}function Co(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var Ao={native:fn,null:si};function Lo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&h(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ao[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),we(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?cn(e,t):ai(e,t)},e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function hn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs},bt(e.curOp)}function pn(e){var t=e.curOp;t&&Ct(t,function(n){for(var r=0;r=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Gi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&La(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Wi(t),e.barMeasure=oi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=io(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Ar(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-sn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=Be(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(S){if(r.line>=e.display.viewFrom){var j=S.styles,z=S.text.length>e.options.maxHighlightLength?pr(t.mode,r.state):null,V=Li(e,S,r,!0);z&&(r.state=z),S.styles=V.styles;var X=S.styleClasses,oe=V.classes;oe?S.styleClasses=oe:X&&(S.styleClasses=null);for(var le=!j||j.length!=S.styles.length||X!=oe&&(!X||!oe||X.bgClass!=oe.bgClass||X.textClass!=oe.textClass),xe=0;!le&&xen)return li(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&ur(e,function(){for(var S=0;S=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&vo(e)==0)return!1;Oo(e)&&(Gr(e),t.dims=Ea(e));var i=r.first+r.size,S=Math.max(t.visible.from-e.options.viewportMargin,r.first),j=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFromj&&n.viewTo-j<20&&(j=Math.min(i,n.viewTo)),mr&&(S=Wr(e.doc,S),j=Ii(e.doc,j));var z=S!=n.viewFrom||j!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,S,j),n.viewOffset=lr(it(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var V=vo(e);if(!z&&V==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var X=sl(e);return V>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),V>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(X),c(n.cursorDiv),c(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,z&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,li(e,400)),n.updateLineNumbers=null,!0}function Do(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==sn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+fa(e.display)-ha(e),n.top)}),t.visible=Hi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Hi(e.display,e.doc,n));if(!La(e,t))break;Wi(e);var i=oi(e);ni(e),Mn(e,i),Oa(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Da(e,t){var n=new Gi(e,t);if(La(e,n)){Wi(e),Do(e,n);var r=oi(e);ni(e),Mn(e,r),Oa(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,S=r.lineDiv,j=S.firstChild;function z(Pe){var Ie=Pe.nextSibling;return R&&s&&e.display.currentWheelTarget==Pe?Pe.style.display="none":Pe.parentNode.removeChild(Pe),Ie}for(var V=r.view,X=r.viewFrom,oe=0;oe-1&&(ye=!1),Ja(e,le,X,n)),ye&&(c(le.lineNumber),le.lineNumber.appendChild(document.createTextNode(yn(e.options,X)))),j=le.node.nextSibling}X+=le.size}for(;j;)j=z(j)}function Ra(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Oa(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Ar(e)+"px"}function Ro(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=xa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,S=r+"px",j=0;jj.clientWidth,V=j.scrollHeight>j.clientHeight;if(!(r&&z||i&&V))return;if(i&&s&&R){e:for(var X=t.target,oe=S.view;X!=j;X=X.parentNode)for(var le=0;le=0&&dt(e,r.to())<=0)return n}return-1};var wt=function(e,t){this.anchor=e,this.head=t};wt.prototype.from=function(){return bn(this.anchor,this.head)},wt.prototype.to=function(){return tn(this.anchor,this.head)},wt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Er(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(xe,ye){return dt(xe.from(),ye.from())}),n=Z(t,i);for(var S=1;S0:V>=0){var X=bn(z.from(),j.from()),oe=tn(z.to(),j.to()),le=z.empty()?j.from()==j.head:z.from()==z.head;S<=n&&--n,t.splice(--S,2,new wt(le?oe:X,le?X:oe))}}return new hr(t,n)}function zr(e,t){return new hr([new wt(e,t||e)],0)}function Vr(e){return e.text?Ne(e.from.line+e.text.length-1,$(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Mo(e,t){if(dt(e,t.from)<0)return e;if(dt(e,t.to)<=0)return Vr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Vr(t).ch-t.to.ch),Ne(n,r)}function ka(e,t){for(var n=[],r=0;r1&&e.remove(z.line+1,Pe-1),e.insert(z.line+1,ze)}Dt(e,"change",e,t)}function Xr(e,t,n){function r(i,S,j){if(i.linked)for(var z=0;z1&&!e.done[e.done.length-2].ranges)return e.done.pop(),$(e.done)}function jo(e,t,n,r){var i=e.history;i.undone.length=0;var S=+new Date,j,z;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>S-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(j=pl(i,i.lastOp==r)))z=$(j.changes),dt(t.from,t.to)==0&&dt(t.from,z.to)==0?z.to=Vr(t):j.changes.push(Ia(e,t));else{var V=$(i.done);for((!V||!V.ranges)&&Xi(e.sel,i.done),j={changes:[Ia(e,t)],generation:i.generation},i.done.push(j);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=S,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,z||Le(e,"historyAdded")}function ml(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,S=r&&r.origin;n==i.lastSelOp||S&&i.lastSelOrigin==S&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==S||ml(e,S,$(i.done),t))?i.done[i.done.length-1]=t:Xi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=S,i.lastSelOp=n,r&&r.clearRedo!==!1&&Bo(i.undone)}function Xi(e,t){var n=$(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Wo(e,t,n,r){var i=t["spans_"+e.id],S=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(j){j.markedSpans&&((i||(i=t["spans_"+e.id]={}))[S]=j.markedSpans),++S})}function vl(e){if(!e)return null;for(var t,n=0;n-1&&($(z)[le]=X[le],delete X[le]))}}return r}function Fa(e,t,n,r){if(r){var i=e.anchor;if(n){var S=dt(t,i)<0;S!=dt(n,i)<0?(i=t,t=n):S!=dt(t,n)<0&&(t=n)}return new wt(i,t)}else return new wt(n||t,t)}function Yi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Qt(e,new hr([Fa(e.sel.primary(),t,n,i)],0),r)}function Ko(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),S=0;S=t.ch:z.to>t.ch))){if(i&&(Le(V,"beforeCursorEnter"),V.explicitlyCleared))if(S.markedSpans){--j;continue}else break;if(!V.atomic)continue;if(n){var le=V.find(r<0?1:-1),xe=void 0;if((r<0?oe:X)&&(le=$o(e,le,-r,le&&le.line==t.line?S:null)),le&&le.line==t.line&&(xe=dt(le,n))&&(r<0?xe<0:xe>0))return Fn(e,le,t,r,i)}var ye=V.find(r<0?-1:1);return(r<0?X:oe)&&(ye=$o(e,ye,r,ye.line==t.line?S:null)),ye?Fn(e,ye,t,r,i):null}}return t}function Qi(e,t,n,r,i){var S=r||1,j=Fn(e,t,n,S,i)||!i&&Fn(e,t,n,S,!0)||Fn(e,t,n,-S,i)||!i&&Fn(e,t,n,-S,!0);return j||(e.cantEdit=!0,Ne(e.first,0))}function $o(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ft(e,Ne(t.line-1)):null:n>0&&t.ch==(r||it(e,t.line)).text.length?t.line=0;--i)Zo(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Zo(e,t)}function Zo(e,t){if(t.text.length==1&&t.text[0]==""&&dt(t.from,t.to)==0)return;var n=ka(e,t);jo(e,t,n,e.cm?e.cm.curOp.id:NaN),ci(e,t,n,Or(e,t));var r=[];Xr(e,function(i,S){!S&&Z(r,i.history)==-1&&(rs(i.history,t),r.push(i.history)),ci(i,t,null,Or(i,t))})}function Ji(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,S,j=e.sel,z=t=="undo"?i.done:i.undone,V=t=="undo"?i.undone:i.done,X=0;X=0;--ye){var Pe=xe(ye);if(Pe)return Pe.v}}function qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new hr(ae(e.sel.ranges,function(i){return new wt(Ne(i.anchor.line+t,i.anchor.ch),Ne(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){tr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())return;if(t.from.lineS&&(t={from:t.from,to:Ne(S,it(e,S).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Sr(e,t.from,t.to),n||(n=ka(e,t)),e.cm?El(e.cm,t,r):Ma(e,t,r),$i(e,n,me),e.cantEdit&&Qi(e,Ne(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,S=t.from,j=t.to,z=!1,V=S.line;e.options.lineWrapping||(V=St($t(it(r,S.line))),r.iter(V,j.line+1,function(ye){if(ye==i.maxLine)return z=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ge(e),Ma(r,t,n,go(e)),e.options.lineWrapping||(r.iter(V,S.line+t.text.length,function(ye){var Pe=Dn(ye);Pe>i.maxLineLength&&(i.maxLine=ye,i.maxLineLength=Pe,i.maxLineChanged=!0,z=!1)}),z&&(e.curOp.updateMaxLine=!0)),Oi(r,S.line),li(e,400);var X=t.text.length-(j.line-S.line)-1;t.full?tr(e):S.line==j.line&&t.text.length==1&&!Fo(e.doc,t)?Kr(e,S.line,"text"):tr(e,S.line,j.line+1,X);var oe=de(e,"changes"),le=de(e,"change");if(le||oe){var xe={from:S,to:j,text:t.text,removed:t.removed,origin:t.origin};le&&Dt(e,"change",e,xe),oe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(xe)}e.display.selForContextMenu=null}function Un(e,t,n,r,i){var S;r||(r=n),dt(r,n)<0&&(S=[r,n],n=S[0],r=S[1]),typeof t=="string"&&(t=e.splitLines(t)),Nn(e,{from:n,to:r,text:t,origin:i})}function es(e,t,n,r){n1||!(this.children[0]instanceof hi))){var z=[];this.collapse(z),this.children=[new hi(z)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var j=i.lines.length%25+25,z=j;z10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=X,e.display.maxLineLength=oe,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&tr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Xo(e.doc)),e&&Dt(e,"markerCleared",e,this,r,i),t&&pn(e),this.parent&&this.parent.clear()},Yr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i0||j==0&&S.clearWhenEmpty!==!1)return S;if(S.replacedWith&&(S.collapsed=!0,S.widgetNode=x("span",[S.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||S.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(S.widgetNode.insertLeft=!0)),S.collapsed){if(qn(e,t.line,t,n,S)||t.line!=n.line&&qn(e,n.line,t,n,S))throw new Error("Inserting collapsed marker partially overlapping an existing one");ki()}S.addToHistory&&jo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var z=t.line,V=e.cm,X;if(e.iter(z,n.line+1,function(le){V&&S.collapsed&&!V.options.lineWrapping&&$t(le)==V.display.maxLine&&(X=!0),S.collapsed&&z!=t.line&&cr(le,0),Br(le,new xn(S,z==t.line?t.ch:null,z==n.line?n.ch:null)),++z}),S.collapsed&&e.iter(t.line,n.line+1,function(le){yr(e,le)&&cr(le,0)}),S.clearOnEnter&&we(S,"beforeCursorEnter",function(){return S.clear()}),S.readOnly&&(Cr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),S.collapsed&&(S.id=++is,S.atomic=!0),V){if(X&&(V.curOp.updateMaxLine=!0),S.collapsed)tr(V,t.line,n.line+1);else if(S.className||S.startStyle||S.endStyle||S.css||S.attributes||S.title)for(var oe=t.line;oe<=n.line;oe++)Kr(V,oe,"text");S.atomic&&Xo(V.doc),Dt(V,"markerAdded",V,S)}return S}var gi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n=0;V--)Nn(this,r[V]);z?zo(this,z):this.cm&&_n(this.cm)}),undo:zt(function(){Ji(this,"undo")}),redo:zt(function(){Ji(this,"redo")}),undoSelection:zt(function(){Ji(this,"undo",!0)}),redoSelection:zt(function(){Ji(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ft(this,e),t=ft(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(S){var j=S.markedSpans;if(j)for(var z=0;z=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;re)return t=e,!0;e-=S,++n}),ft(this,Ne(n,t))},indexFromPos:function(e){e=ft(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var oe=e.dataTransfer.getData("Text");if(oe){var le;if(t.state.draggingText&&!t.state.draggingText.copy&&(le=t.listSelections()),$i(t.doc,zr(n,n)),le)for(var xe=0;xe=0;z--)Un(e.doc,"",r[z].from,r[z].to,"+delete");_n(e)})}function Ua(e,t,n){var r=Ae(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ba(e,t,n){var r=Ua(e,t.ch,n);return r==null?null:new Ne(t.line,r,n<0?"after":"before")}function ja(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var S=Je(n,t.doc.direction);if(S){var j=i<0?$(S):S[0],z=i<0==(j.level==1),V=z?"after":"before",X;if(j.level>0||t.doc.direction=="rtl"){var oe=Rn(t,n);X=i<0?n.text.length-1:0;var le=Lr(t,oe,X).top;X=Ue(function(xe){return Lr(t,oe,xe).top==le},i<0==(j.level==1)?j.from:j.to-1,X),V=="before"&&(X=Ua(n,X,1))}else X=i<0?j.to:j.from;return new Ne(r,X,V)}}return new Ne(r,i<0?n.text.length:0,i<0?"before":"after")}function Ml(e,t,n,r){var i=Je(t,e.doc.direction);if(!i)return Ba(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var S=He(i,n.ch,n.sticky),j=i[S];if(e.doc.direction=="ltr"&&j.level%2==0&&(r>0?j.to>n.ch:j.from=j.from&&xe>=oe.begin)){var ye=le?"before":"after";return new Ne(n.line,xe,ye)}}var Pe=function(ze,Qe,Ve){for(var tt=function(Ot,Vt){return Vt?new Ne(n.line,z(Ot,1),"before"):new Ne(n.line,Ot,"after")};ze>=0&&ze0==(ut.level!=1),gt=ot?Ve.begin:z(Ve.end,-1);if(ut.from<=gt&>0?oe.end:z(oe.begin,-1);return We!=null&&!(r>0&&We==t.text.length)&&(Ie=Pe(r>0?0:i.length-1,r,X(We)),Ie)?Ie:null}var bi={selectAll:Qo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),me)},killLine:function(e){return Wn(e,function(t){if(t.empty()){var n=it(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new Ne(i.line,i.ch+1),e.replaceRange(S.charAt(i.ch-1)+S.charAt(i.ch-2),Ne(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var j=it(e.doc,i.line-1).text;j&&(i=new Ne(i.line,1),e.replaceRange(S.charAt(0)+e.doc.lineSeparator()+j.charAt(j.length-1),Ne(i.line-1,j.length-1),i,"+transpose"))}}n.push(new wt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return ur(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;re&&dt(t,this.pos)==0&&n==this.button};var xi,Ti;function Wl(e,t){var n=+new Date;return Ti&&Ti.compare(n,e,t)?(xi=Ti=null,"triple"):xi&&xi.compare(n,e,t)?(Ti=new Ha(n,e,t),xi=null,"double"):(xi=new Ha(n,e,t),Ti=null,"single")}function Es(e){var t=this,n=t.display;if(Fe(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,_r(n,e)){R||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ka(t,e))return;var r=un(t,e),i=Oe(e),S=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,S,e))return;i==1?r?Gl(t,r,S,e):Te(e)==n.scroller&&Q(e):i==2?(r&&Yi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(D?t.display.input.onContextMenu(e):xo(t))}function Hl(e,t,n,r,i){var S="Click";return r=="double"?S="Double"+S:r=="triple"&&(S="Triple"+S),S=(t==1?"Left":t==2?"Middle":"Right")+S,Ei(e,cs(S,i),i,function(j){if(typeof j=="string"&&(j=bi[j]),!j)return!1;var z=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),z=j(e,n)!=be}finally{e.state.suppressEdits=!1}return z})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var S=d?n.shiftKey&&n.metaKey:n.altKey;i.unit=S?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=s?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(s?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){B?setTimeout(_(Eo,e),0):e.curOp.focus=k();var i=Kl(e,n,r),S=e.doc.sel,j;e.options.dragDrop&&je&&!e.isReadOnly()&&n=="single"&&(j=S.contains(t))>-1&&(dt((j=S.ranges[j]).from(),t)<0||t.xRel>0)&&(dt(j.to(),t)>0||t.xRel<0)?zl(e,r,t,i):Vl(e,r,t,i)}function zl(e,t,n,r){var i=e.display,S=!1,j=Gt(e,function(X){R&&(i.scroller.draggable=!1),e.state.draggingText=!1,$e(i.wrapper.ownerDocument,"mouseup",j),$e(i.wrapper.ownerDocument,"mousemove",z),$e(i.scroller,"dragstart",V),$e(i.scroller,"drop",j),S||(Q(X),r.addNew||Yi(e.doc,n,null,null,r.extend),R&&!P||B&&N==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),z=function(X){S=S||Math.abs(t.clientX-X.clientX)+Math.abs(t.clientY-X.clientY)>=10},V=function(){return S=!0};R&&(i.scroller.draggable=!0),e.state.draggingText=j,j.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),we(i.wrapper.ownerDocument,"mouseup",j),we(i.wrapper.ownerDocument,"mousemove",z),we(i.scroller,"dragstart",V),we(i.scroller,"drop",j),xo(e),setTimeout(function(){return i.input.focus()},20)}function xs(e,t,n){if(n=="char")return new wt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new wt(Ne(t.line,0),ft(e.doc,Ne(t.line+1,0)));var r=n(e,t);return new wt(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,S=e.doc;Q(t);var j,z,V=S.sel,X=V.ranges;if(r.addNew&&!r.extend?(z=S.sel.contains(n),z>-1?j=X[z]:j=new wt(n,n)):(j=S.sel.primary(),z=S.sel.primIndex),r.unit=="rectangle")r.addNew||(j=new wt(n,n)),n=un(e,t,!0,!0),z=-1;else{var oe=xs(e,n,r.unit);r.extend?j=Fa(j,oe.anchor,oe.head,r.extend):j=oe}r.addNew?z==-1?(z=X.length,Qt(S,Er(e,X.concat([j]),z),{scroll:!1,origin:"*mouse"})):X.length>1&&X[z].empty()&&r.unit=="char"&&!r.extend?(Qt(S,Er(e,X.slice(0,z).concat(X.slice(z+1)),0),{scroll:!1,origin:"*mouse"}),V=S.sel):Na(S,z,j,pe):(z=0,Qt(S,new hr([j],0),pe),V=S.sel);var le=n;function xe(Ve){if(dt(le,Ve)==0)return;if(le=Ve,r.unit=="rectangle"){for(var tt=[],ut=e.options.tabSize,ot=G(it(S,n.line).text,n.ch,ut),gt=G(it(S,Ve.line).text,Ve.ch,ut),Ot=Math.min(ot,gt),Vt=Math.max(ot,gt),Mt=Math.min(n.line,Ve.line),dr=Math.min(e.lastLine(),Math.max(n.line,Ve.line));Mt<=dr;Mt++){var nr=it(S,Mt).text,Bt=fe(nr,Ot,ut);Ot==Vt?tt.push(new wt(Ne(Mt,Bt),Ne(Mt,Bt))):nr.length>Bt&&tt.push(new wt(Ne(Mt,Bt),Ne(Mt,fe(nr,Vt,ut))))}tt.length||tt.push(new wt(n,n)),Qt(S,Er(e,V.ranges.slice(0,z).concat(tt),z),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ve)}else{var ir=j,Yt=xs(e,Ve,r.unit),Ht=ir.anchor,jt;dt(Yt.anchor,Ht)>0?(jt=Yt.head,Ht=bn(ir.from(),Yt.anchor)):(jt=Yt.anchor,Ht=tn(ir.to(),Yt.head));var Ft=V.ranges.slice(0);Ft[z]=Xl(e,new wt(ft(S,Ht),jt)),Qt(S,Er(e,Ft,z),pe)}}var ye=i.wrapper.getBoundingClientRect(),Pe=0;function Ie(Ve){var tt=++Pe,ut=un(e,Ve,!0,r.unit=="rectangle");if(!ut)return;if(dt(ut,le)!=0){e.curOp.focus=k(),xe(ut);var ot=Hi(i,S);(ut.line>=ot.to||ut.lineye.bottom?20:0;gt&&setTimeout(Gt(e,function(){if(Pe!=tt)return;i.scroller.scrollTop+=gt,Ie(Ve)}),50)}}function We(Ve){e.state.selectingText=!1,Pe=Infinity,Ve&&(Q(Ve),i.input.focus()),$e(i.wrapper.ownerDocument,"mousemove",ze),$e(i.wrapper.ownerDocument,"mouseup",Qe),S.history.lastSelOrigin=null}var ze=Gt(e,function(Ve){Ve.buttons===0||!Oe(Ve)?We(Ve):Ie(Ve)}),Qe=Gt(e,We);e.state.selectingText=Qe,we(i.wrapper.ownerDocument,"mousemove",ze),we(i.wrapper.ownerDocument,"mouseup",Qe)}function Xl(e,t){var n=t.anchor,r=t.head,i=it(e.doc,n.line);if(dt(n,r)==0&&n.sticky==r.sticky)return t;var S=Je(i);if(!S)return t;var j=He(S,n.ch,n.sticky),z=S[j];if(z.from!=n.ch&&z.to!=n.ch)return t;var V=j+(z.from==n.ch==(z.level!=1)?0:1);if(V==0||V==S.length)return t;var X;if(r.line!=n.line)X=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var oe=He(S,r.ch,r.sticky),le=oe-j||(r.ch-n.ch)*(z.level==1?-1:1);oe==V-1||oe==V?X=le<0:X=le>0}var xe=S[V+(X?-1:0)],ye=X==(xe.level==1),Pe=ye?xe.from:xe.to,Ie=ye?"after":"before";return n.ch==Pe&&n.sticky==Ie?t:new wt(new Ne(n.line,Pe,Ie),r)}function Ts(e,t,n,r){var i,S;if(t.touches)i=t.touches[0].clientX,S=t.touches[0].clientY;else try{i=t.clientX,S=t.clientY}catch(xe){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Q(t);var j=e.display,z=j.lineDiv.getBoundingClientRect();if(S>z.bottom||!de(e,n))return re(t);S-=z.top-j.viewOffset;for(var V=0;V=i){var oe=wr(e.doc,S),le=e.display.gutterSpecs[V];return Le(e,n,e,oe,le.className,t),re(t)}}}function Ka(e,t){return Ts(e,t,"gutterClick",!0)}function Ss(e,t){if(_r(e.display,t)||Yl(e,t))return;if(Fe(e,t,"contextmenu"))return;D||e.display.input.onContextMenu(t)}function Yl(e,t){return de(e,"gutterContextMenu")?Ts(e,t,"gutterContextMenu",!1):!1}function ws(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ri(e)}var Hn={toString:function(){return"CodeMirror.Init"}},Cs={},ta={};function $l(e){var t=e.optionHandlers;function n(r,i,S,j){e.defaults[r]=i,S&&(t[r]=j?function(z,V,X){X!=Hn&&S(z,V,X)}:S)}e.defineOption=n,e.Init=Hn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,_a(r)},!0),n("indentUnit",2,_a,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){di(r),ri(r),tr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var S=[],j=r.doc.first;r.doc.iter(function(V){for(var X=0;;){var oe=V.text.indexOf(i,X);if(oe==-1)break;X=oe+i.length,S.push(Ne(j,oe))}j++});for(var z=S.length-1;z>=0;z--)Un(r.doc,i,S[z],Ne(S[z].line,S[z].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,S){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),S!=Hn&&r.refresh()}),n("specialCharPlaceholder",nt,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!C),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){ws(r),ui(r)},!0),n("keyMap","default",function(r,i,S){var j=qi(i),z=S!=Hn&&qi(S);z&&z.detach&&z.detach(r,j),j.attach&&j.attach(r,z||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Pa(i,r.options.lineNumbers),ui(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?xa(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Mn(r)},!0),n("scrollbarStyle","native",function(r){Lo(r),Mn(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Pa(r.options.gutters,i),ui(r)},!0),n("firstLineNumber",1,ui,!0),n("lineNumberFormatter",function(r){return r},ui,!0),n("showCursorWhenSelecting",!1,ni,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(kn(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Ql),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,ni,!0),n("singleCursorHeightPerLine",!0,ni,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,di,!0),n("addModeClass",!1,di,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,di,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Ql(e,t,n){var r=n&&n!=Hn;if(!t!=!r){var i=e.display.dragFunctions,S=t?we:$e;S(e.display.scroller,"dragstart",i.start),S(e.display.scroller,"dragenter",i.enter),S(e.display.scroller,"dragover",i.over),S(e.display.scroller,"dragleave",i.leave),S(e.display.scroller,"drop",i.drop)}}function Jl(e){e.options.lineWrapping?(F(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(h(e.display.wrapper,"CodeMirror-wrap"),Pr(e)),Ta(e),tr(e),ri(e),setTimeout(function(){return Mn(e)},100)}function kt(e,t){var n=this;if(!(this instanceof kt))return new kt(e,t);this.options=t=t?M(t):{},M(Cs,t,!1);var r=t.value;typeof r=="string"?r=new rr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new kt.inputStyles[t.inputStyle](this),S=this.display=new dl(e,r,i,t);S.wrapper.CodeMirror=this,ws(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Lo(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new Y,keySeq:null,specialChars:null},t.autofocus&&!o&&S.input.focus(),B&&N<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Rl(),hn(this),this.curOp.forceUpdate=!0,No(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&wa(n)},20):kn(this);for(var j in ta)ta.hasOwnProperty(j)&&ta[j](this,t[j],Hn);Oo(this),t.finishInit&&t.finishInit(this);for(var z=0;z20*20}we(t.scroller,"touchstart",function(V){if(!Fe(e,V)&&!S(V)&&!Ka(e,V)){t.input.ensurePolled(),clearTimeout(n);var X=+new Date;t.activeTouch={start:X,moved:!1,prev:X-r.end<=300?r:null},V.touches.length==1&&(t.activeTouch.left=V.touches[0].pageX,t.activeTouch.top=V.touches[0].pageY)}}),we(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),we(t.scroller,"touchend",function(V){var X=t.activeTouch;if(X&&!_r(t,V)&&X.left!=null&&!X.moved&&new Date-X.start<300){var oe=e.coordsChar(t.activeTouch,"page"),le;!X.prev||j(X,X.prev)?le=new wt(oe,oe):!X.prev.prev||j(X,X.prev.prev)?le=e.findWordAt(oe):le=new wt(Ne(oe.line,0),ft(e.doc,Ne(oe.line+1,0))),e.setSelection(le.anchor,le.head),e.focus(),Q(V)}i()}),we(t.scroller,"touchcancel",i),we(t.scroller,"scroll",function(){t.scroller.clientHeight&&(ai(e,t.scroller.scrollTop),cn(e,t.scroller.scrollLeft,!0),Le(e,"scroll",e))}),we(t.scroller,"mousewheel",function(V){return _o(e,V)}),we(t.scroller,"DOMMouseScroll",function(V){return _o(e,V)}),we(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(V){Fe(e,V)||se(V)},over:function(V){Fe(e,V)||(Dl(e,V),se(V))},start:function(V){return Ll(e,V)},drop:Gt(e,Al),leave:function(V){Fe(e,V)||ss(e)}};var z=t.input.getField();we(z,"keyup",function(V){return ys.call(e,V)}),we(z,"keydown",Gt(e,vs)),we(z,"keypress",Gt(e,bs)),we(z,"focus",function(V){return wa(e,V)}),we(z,"blur",function(V){return kn(e,V)})}var Ga=[];kt.defineInitHook=function(e){return Ga.push(e)};function Si(e,t,n,r){var i=e.doc,S;n==null&&(n="add"),n=="smart"&&(i.mode.indent?S=Be(e,t).state:n="prev");var j=e.options.tabSize,z=it(i,t),V=G(z.text,null,j);z.stateAfter&&(z.stateAfter=null);var X=z.text.match(/^\s*/)[0],oe;if(!r&&!/\S/.test(z.text))oe=0,n="not";else if(n=="smart"&&(oe=i.mode.indent(S,z.text.slice(X.length),z.text),oe==be||oe>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?oe=G(it(i,t-1).text,null,j):oe=0:n=="add"?oe=V+e.options.indentUnit:n=="subtract"?oe=V-e.options.indentUnit:typeof n=="number"&&(oe=V+n),oe=Math.max(0,oe);var le="",xe=0;if(e.options.indentWithTabs)for(var ye=Math.floor(oe/j);ye;--ye)xe+=j,le+=" ";if(xej,V=at(t),X=null;if(z&&r.ranges.length>1)if(xr&&xr.text.join(` `)==t){if(r.ranges.length%xr.text.length==0){X=[];for(var oe=0;oe=0;xe--){var ye=r.ranges[xe],Pe=ye.from(),Ie=ye.to();ye.empty()&&(n&&n>0?Pe=Ne(Pe.line,Pe.ch-n):e.state.overwrite&&!z?Ie=Ne(Ie.line,Math.min(it(S,Ie.line).text.length,Ie.ch+$(V).length)):z&&xr&&xr.lineWise&&xr.text.join(` `)==V.join(` `)&&(Pe=Ie=Ne(Pe.line,0)));var We={from:Pe,to:Ie,text:X?X[xe%X.length]:V,origin:i||(z?"paste":e.state.cutIncoming>j?"cut":"+input")};Nn(e.doc,We),Dt(e,"inputRead",e,We)}t&&!z&&Ls(e,t),_n(e),e.curOp.updateInput<2&&(e.curOp.updateInput=le),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function As(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&ur(t,function(){return za(t,n,0,null,"paste")}),!0}function Ls(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var S=e.getModeAt(i.head),j=!1;if(S.electricChars){for(var z=0;z-1){j=Si(e,i.head.line,"smart");break}}else S.electricInput&&(S.electricInput.test(it(e.doc,i.head.line).text.slice(0,i.head.ch))&&(j=Si(e,i.head.line,"smart")));j&&Dt(e,"electricInput",e,i.head.line)}}function Ds(e){for(var t=[],n=[],r=0;rS&&(Si(this,z.head.line,r,!0),S=z.head.line,j==this.doc.sel.primIndex&&_n(this));else{var V=z.from(),X=z.to(),oe=Math.max(S,V.line);S=Math.min(this.lastLine(),X.line-(X.ch?0:1))+1;for(var le=oe;le0&&Na(this.doc,j,new wt(V,xe[j].to()),me)}}}),getTokenAt:function(r,i){return Fr(this,r,i)},getLineTokens:function(r,i){return Fr(this,Ne(r),i,!0)},getTokenTypeAt:function(r){r=ft(this.doc,r);var i=Yn(this,it(this.doc,r.line)),S=0,j=(i.length-1)/2,z=r.ch,V;if(z==0)V=i[2];else for(;;){var X=S+j>>1;if((X?i[X*2-1]:0)>=z)j=X;else if(i[X*2+1]V&&(r=V,j=!0),z=it(this.doc,r)}else z=r;return Ui(this,z,{top:0,left:0},i||"page",S||j).top+(j?this.doc.height-lr(z):0)},defaultTextHeight:function(){return On(this.display)},defaultCharWidth:function(){return Pn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,S,j,z){var V=this.display;r=br(this,ft(this.doc,r));var X=r.bottom,oe=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),V.sizer.appendChild(i),j=="over")X=r.top;else if(j=="above"||j=="near"){var le=Math.max(V.wrapper.clientHeight,this.doc.height),xe=Math.max(V.sizer.clientWidth,V.lineSpace.clientWidth);(j=="above"||r.bottom+i.offsetHeight>le)&&r.top>i.offsetHeight?X=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=le&&(X=r.bottom),oe+i.offsetWidth>xe&&(oe=xe-i.offsetWidth)}i.style.top=X+"px",i.style.left=i.style.right="",z=="right"?(oe=V.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(z=="left"?oe=0:z=="middle"&&(oe=(V.sizer.clientWidth-i.offsetWidth)/2),i.style.left=oe+"px"),S&&Qs(this,{left:oe,top:X,right:oe+i.offsetWidth,bottom:X+i.offsetHeight})},triggerOnKeyDown:qt(vs),triggerOnKeyPress:qt(bs),triggerOnKeyUp:ys,triggerOnMouseDown:qt(Es),execCommand:function(r){if(bi.hasOwnProperty(r))return bi[r].call(null,this)},triggerElectric:qt(function(r){Ls(this,r)}),findPosH:function(r,i,S,j){var z=1;i<0&&(z=-1,i=-i);for(var V=ft(this.doc,r),X=0;X0&&oe(S.charAt(j-1));)--j;for(;z.5||this.options.lineWrapping)&&Ta(this),Le(this,"refresh",this)}),swapDoc:qt(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),No(this,r),ri(this),this.display.input.reset(),ii(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Dt(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ce(e),e.registerHelper=function(r,i,S){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=S},e.registerGlobalHelper=function(r,i,S,j){e.registerHelper(r,i,j),n[r]._global.push({pred:S,val:j})}}function Va(e,t,n,r,i){var S=t,j=n,z=it(e,t.line),V=i&&e.direction=="rtl"?-n:n;function X(){var Qe=t.line+V;return Qe=e.first+e.size?!1:(t=new Ne(Qe,t.ch,t.sticky),z=it(e,Qe))}function oe(Qe){var Ve;if(r=="codepoint"){var tt=z.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(tt)?Ve=null:Ve=new Ne(t.line,Math.max(0,Math.min(z.text.length,t.ch+n*(tt>=55296&&tt<56320?2:1))),-n)}else i?Ve=Ml(e.cm,z,t,n):Ve=Ba(z,t,n);if(Ve==null)if(!Qe&&X())t=ja(i,e.cm,z,t.line,V);else return!1;else t=Ve;return!0}if(r=="char"||r=="codepoint")oe();else if(r=="column")oe(!0);else if(r=="word"||r=="group")for(var le=null,xe=r=="group",ye=e.cm&&e.cm.getHelper(t,"wordChars"),Pe=!0;!(n<0&&!oe(!Pe));Pe=!1){var Ie=z.text.charAt(t.ch)||` `,We=De(Ie,ye)?"w":xe&&Ie==` `?"n":!xe||/\s/.test(Ie)?null:"p";if(xe&&!Pe&&!We&&(We="s"),le&&le!=We){n<0&&(n=1,oe(),t.sticky="after");break}if(We&&(le=We),n>0&&!oe(!Pe))break}var ze=Qi(e,t,S,j,!0);return qr(S,ze)&&(ze.hitSide=!0),ze}function Ps(e,t,n,r){var i=e.doc,S=t.left,j;if(r=="page"){var z=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),V=Math.max(z-.5*On(e.display),3);j=(n>0?t.bottom:t.top)+n*V}else r=="line"&&(j=n>0?t.bottom+3:t.top-3);for(var X;!(X=ya(e,S,j),!X.outside);){if(n<0?j<=0:j>=i.height){X.hitSide=!0;break}j+=n*5}return X}var At=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Y,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};At.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;Rs(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function S(z){for(var V=z.target;V;V=V.parentNode){if(V==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(V.className))break}return!1}we(i,"paste",function(z){if(!S(z)||Fe(r,z)||As(z,r))return;N<=11&&setTimeout(Gt(r,function(){return t.updateFromDOM()}),20)}),we(i,"compositionstart",function(z){t.composing={data:z.data,done:!1}}),we(i,"compositionupdate",function(z){t.composing||(t.composing={data:z.data,done:!1})}),we(i,"compositionend",function(z){t.composing&&(z.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),we(i,"touchstart",function(){return n.forceCompositionEnd()}),we(i,"input",function(){t.composing||t.readFromDOMSoon()});function j(z){if(!S(z)||Fe(r,z))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()}),z.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var V=Ds(r);ra({lineWise:!0,text:V.text}),z.type=="cut"&&r.operation(function(){r.setSelections(V.ranges,0,me),r.replaceSelection("",null,"cut")})}else return;if(z.clipboardData){z.clipboardData.clearData();var X=xr.text.join(` `);if(z.clipboardData.setData("Text",X),z.clipboardData.getData("Text")==X){z.preventDefault();return}}var oe=Os(),le=oe.firstChild;r.display.lineSpace.insertBefore(oe,r.display.lineSpace.firstChild),le.value=xr.text.join(` `);var xe=document.activeElement;W(le),setTimeout(function(){r.display.lineSpace.removeChild(oe),xe.focus(),xe==i&&n.showPrimarySelection()},50)}we(i,"copy",j),we(i,"cut",j)},At.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},At.prototype.prepareSelection=function(){var e=yo(this.cm,!1);return e.focus=document.activeElement==this.div,e},At.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},At.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},At.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line=t.display.viewFrom&&ks(t,r)||{node:z[0].measure.map[2],offset:0},X=i.linee.firstLine()&&(r=Ne(r.line-1,it(e.doc,r.line-1).length)),i.ch==it(e.doc,i.line).text.length&&i.linet.viewTo-1)return!1;var S,j,z;r.line==t.viewFrom||(S=dn(e,r.line))==0?(j=St(t.view[0].line),z=t.view[0].node):(j=St(t.view[S].line),z=t.view[S-1].node.nextSibling);var V=dn(e,i.line),X,oe;if(V==t.view.length-1?(X=t.viewTo-1,oe=t.lineDiv.lastChild):(X=St(t.view[V+1].line)-1,oe=t.view[V+1].node.previousSibling),!z)return!1;for(var le=e.doc.splitLines(tu(e,z,oe,j,X)),xe=Sr(e.doc,Ne(j,0),Ne(X,it(e.doc,X).text.length));le.length>1&&xe.length>1;)if($(le)==$(xe))le.pop(),xe.pop(),X--;else if(le[0]==xe[0])le.shift(),xe.shift(),j++;else break;for(var ye=0,Pe=0,Ie=le[0],We=xe[0],ze=Math.min(Ie.length,We.length);yer.ch&&Qe.charCodeAt(Qe.length-Pe-1)==Ve.charCodeAt(Ve.length-Pe-1);)ye--,Pe++;le[le.length-1]=Qe.slice(0,Qe.length-Pe).replace(/^\u200b+/,""),le[0]=le[0].slice(ye).replace(/\u200b+$/,"");var ut=Ne(j,ye),ot=Ne(X,xe.length?$(xe).length-Pe:0);if(le.length>1||le[0]||dt(ut,ot))return Un(e.doc,le,ut,ot,"+input"),!0},At.prototype.ensurePolled=function(){this.forceCompositionEnd()},At.prototype.reset=function(){this.forceCompositionEnd()},At.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},At.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},At.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&ur(this.cm,function(){return tr(e.cm)})},At.prototype.setUneditable=function(e){e.contentEditable="false"},At.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Gt(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},At.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},At.prototype.onContextMenu=function(){},At.prototype.resetPosition=function(){},At.prototype.needsContentAttribute=!0;function ks(e,t){var n=pa(e,t.line);if(!n||n.hidden)return null;var r=it(e.doc,t.line),i=no(n,r,t.line),S=Je(r,e.doc.direction),j="left";if(S){var z=He(S,t.ch);j=z%2?"right":"left"}var V=oo(i.map,t.ch,j);return V.offset=V.collapse=="right"?V.end:V.start,V}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Kn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var S="",j=!1,z=e.doc.lineSeparator(),V=!1;function X(ye){return function(Pe){return Pe.id==ye}}function oe(){j&&(S+=z,V&&(S+=z),j=V=!1)}function le(ye){ye&&(oe(),S+=ye)}function xe(ye){if(ye.nodeType==1){var Pe=ye.getAttribute("cm-text");if(Pe){le(Pe);return}var Ie=ye.getAttribute("cm-marker"),We;if(Ie){var ze=e.findMarks(Ne(r,0),Ne(i+1,0),X(+Ie));ze.length&&(We=ze[0].find(0))&&le(Sr(e.doc,We.from,We.to).join(z));return}if(ye.getAttribute("contenteditable")=="false")return;var Qe=/^(pre|div|p|li|table|br)$/i.test(ye.nodeName);if(!/^br$/i.test(ye.nodeName)&&ye.textContent.length==0)return;Qe&&oe();for(var Ve=0;Ve=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),we(i,"paste",function(j){if(Fe(r,j)||As(j,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function S(j){if(Fe(r,j))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var z=Ds(r);ra({lineWise:!0,text:z.text}),j.type=="cut"?r.setSelections(z.ranges,null,me):(n.prevInput="",i.value=z.text.join(` `),W(i))}else return;j.type=="cut"&&(r.state.cutIncoming=+new Date)}we(i,"cut",S),we(i,"copy",S),we(e.scroller,"paste",function(j){if(_r(e,j)||Fe(r,j))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var z=new Event("paste");z.clipboardData=j.clipboardData,i.dispatchEvent(z)}),we(e.lineSpace,"selectstart",function(j){_r(e,j)||Q(j)}),we(i,"compositionstart",function(){var j=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:j,range:r.markText(j,r.getCursor("to"),{className:"CodeMirror-composing"})}}),we(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Nt.prototype.createField=function(e){this.wrapper=Os(),this.textarea=this.wrapper.firstChild},Nt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Nt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=yo(e);if(e.options.moveInputWithCursor){var i=br(e,n.sel.primary().head,"div"),S=t.wrapper.getBoundingClientRect(),j=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+j.top-S.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+j.left-S.left))}return r},Nt.prototype.showSelection=function(e){var t=this.cm,n=t.display;u(n.cursorDiv,e.cursors),u(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Nt.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&W(this.textarea),B&&N>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",B&&N>=9&&(this.hasSelection=null))},Nt.prototype.getField=function(){return this.textarea},Nt.prototype.supportsTouch=function(){return!1},Nt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||k()!=this.textarea))try{this.textarea.focus()}catch(e){}},Nt.prototype.blur=function(){this.textarea.blur()},Nt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Nt.prototype.receivedFocus=function(){this.slowPoll()},Nt.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Nt.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},Nt.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||qe(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(B&&N>=9&&this.hasSelection===i||s&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var S=i.charCodeAt(0);if(S==8203&&!r&&(r="\u200B"),S==8666)return this.reset(),this.cm.execCommand("undo")}for(var j=0,z=Math.min(r.length,i.length);j1e3||i.indexOf(` `)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Nt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Nt.prototype.onKeyPress=function(){B&&N>=9&&(this.hasSelection=null),this.fastPoll()},Nt.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var S=un(n,e),j=r.scroller.scrollTop;if(!S||v)return;var z=n.options.resetSelectionOnContextMenu;z&&n.doc.sel.contains(S)==-1&&Gt(n,Qt)(n.doc,zr(S),me);var V=i.style.cssText,X=t.wrapper.style.cssText,oe=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-oe.top-5)+"px; left: "+(e.clientX-oe.left-5)+`px; z-index: 1000; background: `+(B?"rgba(255, 255, 255, .05)":"transparent")+`; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var le;R&&(le=window.scrollY),r.input.focus(),R&&window.scrollTo(null,le),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=ye,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function xe(){if(i.selectionStart!=null){var Ie=n.somethingSelected(),We="\u200B"+(Ie?i.value:"");i.value="\u21DA",i.value=We,t.prevInput=Ie?"":"\u200B",i.selectionStart=1,i.selectionEnd=We.length,r.selForContextMenu=n.doc.sel}}function ye(){if(t.contextMenuPending!=ye)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=X,i.style.cssText=V,B&&N<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=j),i.selectionStart!=null){(!B||B&&N<9)&&xe();var Ie=0,We=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Gt(n,Qo)(n):Ie++<10?r.detectingSelectAll=setTimeout(We,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(We,200)}}if(B&&N>=9&&xe(),D){se(e);var Pe=function(){$e(window,"mouseup",Pe),setTimeout(ye,20)};we(window,"mouseup",Pe)}else setTimeout(ye,50)},Nt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Nt.prototype.setUneditable=function(){},Nt.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?M(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=k();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=z.getValue()}var i;if(e.form&&(we(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var S=e.form;i=S.submit;try{var j=S.submit=function(){r(),S.submit=i,S.submit(),S.submit=j}}catch(V){}}t.finishInit=function(V){V.save=r,V.getTextArea=function(){return e},V.toTextArea=function(){V.toTextArea=isNaN,r(),e.parentNode.removeChild(V.getWrapperElement()),e.style.display="",e.form&&($e(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var z=kt(function(V){return e.parentNode.insertBefore(V,e.nextSibling)},t);return z}function iu(e){e.off=$e,e.on=we,e.wheelEventPixels=cl,e.Doc=rr,e.splitLines=at,e.countColumn=G,e.findColumn=fe,e.isWordChar=Se,e.Pass=be,e.signal=Le,e.Line=Hr,e.changeEnd=Vr,e.scrollbarModel=Ao,e.Pos=Ne,e.cmpPos=dt,e.modes=Lt,e.mimeModes=pt,e.resolveMode=Ut,e.getMode=Tr,e.modeExtensions=vr,e.extendMode=wi,e.copyState=pr,e.startState=Jr,e.innerMode=vn,e.commands=bi,e.keyMap=Mr,e.keyName=fs,e.isModifierKey=ds,e.lookupKey=jn,e.normalizeKeyMap=_l,e.StringStream=_t,e.SharedTextMarker=gi,e.TextMarker=Yr,e.LineWidget=mi,e.e_preventDefault=Q,e.e_stopPropagation=q,e.e_stop=se,e.addClass=F,e.contains=p,e.rmClass=h,e.keyNames=$r}$l(kt),ql(kt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ia in rr.prototype)rr.prototype.hasOwnProperty(ia)&&Z(au,ia)<0&&(kt.prototype[ia]=function(e){return function(){return e.apply(this.doc,arguments)}}(rr.prototype[ia]));return ce(rr),kt.inputStyles={textarea:Nt,contenteditable:At},kt.defineMode=function(e){!kt.defaults.mode&&e!="null"&&(kt.defaults.mode=e),or.apply(this,arguments)},kt.defineMIME=Kt,kt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),kt.defineMIME("text/plain","null"),kt.defineExtension=function(e,t){kt.prototype[e]=t},kt.defineDocExtension=function(e,t){rr.prototype[e]=t},kt.fromTextArea=nu,iu(kt),kt.version="5.58.2",kt})},X0ci:function(Ze,Ke,te){},Y1PL:function(Ze,Ke,te){"use strict";te.r(Ke),te.d(Ke,"ResizableTextArea",function(){return Z});var J=te("wx14"),K=te("1OyB"),L=te("vuIU"),H=te("Ji7U"),I=te("LK+K"),O=te("cDcd"),B=te("VTBJ"),N=te("rePB"),R=te("Zm9Q"),A=te("Kwbf"),f=te("c+Xe"),v=te("m+aA"),P=te("bdgK"),w=new Map;function b(me){me.forEach(function(pe){var ue,fe=pe.target;(ue=w.get(fe))===null||ue===void 0||ue.forEach(function(ie){return ie(fe)})})}var E=new P.default(b),l=null,o=null;function s(me,pe){w.has(me)||(w.set(me,new Set),E.observe(me)),w.get(me).add(pe)}function d(me,pe){w.has(me)&&(w.get(me).delete(pe),w.get(me).size||(E.unobserve(me),w.delete(me)))}var C=function(me){Object(H.a)(ue,me);var pe=Object(I.a)(ue);function ue(){return Object(K.a)(this,ue),pe.apply(this,arguments)}return Object(L.a)(ue,[{key:"render",value:function(){return this.props.children}}]),ue}(O.Component),g=O.createContext(null);function m(me){var pe=me.children,ue=me.onBatchResize,fe=O.useRef(0),ie=O.useRef([]),he=O.useContext(g),$=O.useCallback(function(ae,ee,Ee){fe.current+=1;var Ce=fe.current;ie.current.push({size:ae,element:ee,data:Ee}),Promise.resolve().then(function(){Ce===fe.current&&(ue==null||ue(ie.current),ie.current=[])}),he==null||he(ae,ee,Ee)},[ue,he]);return O.createElement(g.Provider,{value:$},pe)}function D(me){var pe=me.children,ue=me.disabled,fe=O.useRef(null),ie=O.useRef(null),he=O.useContext(g),$=O.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ae=O.isValidElement(pe)&&Object(f.c)(pe),ee=ae?pe.ref:null,Ee=O.useMemo(function(){return Object(f.a)(ee,fe)},[ee,fe]),Ce=O.useRef(me);Ce.current=me;var ve=O.useCallback(function(Se){var De=Ce.current,_e=De.onResize,ke=De.data,Re=Se.getBoundingClientRect(),Ae=Re.width,Ue=Re.height,Ye=Se.offsetWidth,Ge=Se.offsetHeight,He=Math.floor(Ae),et=Math.floor(Ue);if($.current.width!==He||$.current.height!==et||$.current.offsetWidth!==Ye||$.current.offsetHeight!==Ge){var Je={width:He,height:et,offsetWidth:Ye,offsetHeight:Ge};$.current=Je;var Xe=Ye===Math.round(Ae)?Ae:Ye,we=Ge===Math.round(Ue)?Ue:Ge,rt=Object(B.a)(Object(B.a)({},Je),{},{offsetWidth:Xe,offsetHeight:we});he==null||he(rt,Se,ke),_e&&Promise.resolve().then(function(){_e(rt,Se)})}},[]);return O.useEffect(function(){var Se=Object(v.a)(fe.current)||Object(v.a)(ie.current);return Se&&!ue&&s(Se,ve),function(){return d(Se,ve)}},[fe.current,ue]),O.createElement(C,{ref:ie},ae?O.cloneElement(pe,{ref:Ee}):pe)}var T="rc-observer-key";function h(me){var pe=me.children,ue=Object(R.a)(pe);return ue.map(function(fe,ie){var he=(fe==null?void 0:fe.key)||"".concat(T,"-").concat(ie);return O.createElement(D,Object(J.a)({},me,{key:he}),fe)})}h.Collection=m;var c=h,u=te("bT9E"),a=te("TSYQ"),x=te.n(a),y=` min-height:0 !important; max-height:none !important; height:0 !important; visibility:hidden !important; overflow:hidden !important; position:absolute !important; z-index:-1000 !important; top:0 !important; right:0 !important `,p=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],k={},F;function U(me){var pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ue=me.getAttribute("id")||me.getAttribute("data-reactid")||me.getAttribute("name");if(pe&&k[ue])return k[ue];var fe=window.getComputedStyle(me),ie=fe.getPropertyValue("box-sizing")||fe.getPropertyValue("-moz-box-sizing")||fe.getPropertyValue("-webkit-box-sizing"),he=parseFloat(fe.getPropertyValue("padding-bottom"))+parseFloat(fe.getPropertyValue("padding-top")),$=parseFloat(fe.getPropertyValue("border-bottom-width"))+parseFloat(fe.getPropertyValue("border-top-width")),ae=p.map(function(Ee){return"".concat(Ee,":").concat(fe.getPropertyValue(Ee))}).join(";"),ee={sizingStyle:ae,paddingSize:he,borderSize:$,boxSizing:ie};return pe&&ue&&(k[ue]=ee),ee}function W(me){var pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ue=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,fe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;F||(F=document.createElement("textarea"),F.setAttribute("tab-index","-1"),F.setAttribute("aria-hidden","true"),document.body.appendChild(F)),me.getAttribute("wrap")?F.setAttribute("wrap",me.getAttribute("wrap")):F.removeAttribute("wrap");var ie=U(me,pe),he=ie.paddingSize,$=ie.borderSize,ae=ie.boxSizing,ee=ie.sizingStyle;F.setAttribute("style","".concat(ee,";").concat(y)),F.value=me.value||me.placeholder||"";var Ee=Number.MIN_SAFE_INTEGER,Ce=Number.MAX_SAFE_INTEGER,ve=F.scrollHeight,Se;if(ae==="border-box"?ve+=$:ae==="content-box"&&(ve-=he),ue!==null||fe!==null){F.value=" ";var De=F.scrollHeight-he;ue!==null&&(Ee=De*ue,ae==="border-box"&&(Ee=Ee+he+$),ve=Math.max(Ee,ve)),fe!==null&&(Ce=De*fe,ae==="border-box"&&(Ce=Ce+he+$),Se=ve>Ce?"":"hidden",ve=Math.min(Ce,ve))}return{height:ve,minHeight:Ee,maxHeight:Ce,overflowY:Se,resize:"none"}}var _=te("Gytx"),M=te.n(_),G;(function(me){me[me.NONE=0]="NONE",me[me.RESIZING=1]="RESIZING",me[me.RESIZED=2]="RESIZED"})(G||(G={}));var Y=function(me){Object(H.a)(ue,me);var pe=Object(I.a)(ue);function ue(fe){var ie;return Object(K.a)(this,ue),ie=pe.call(this,fe),ie.nextFrameActionId=void 0,ie.resizeFrameId=void 0,ie.textArea=void 0,ie.saveTextArea=function(he){ie.textArea=he},ie.handleResize=function(he){var $=ie.state.resizeStatus,ae=ie.props,ee=ae.autoSize,Ee=ae.onResize;if($!==G.NONE)return;typeof Ee=="function"&&Ee(he),ee&&ie.resizeOnNextFrame()},ie.resizeOnNextFrame=function(){cancelAnimationFrame(ie.nextFrameActionId),ie.nextFrameActionId=requestAnimationFrame(ie.resizeTextarea)},ie.resizeTextarea=function(){var he=ie.props.autoSize;if(!he||!ie.textArea)return;var $=he.minRows,ae=he.maxRows,ee=W(ie.textArea,!1,$,ae);ie.setState({textareaStyles:ee,resizeStatus:G.RESIZING},function(){cancelAnimationFrame(ie.resizeFrameId),ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:G.RESIZED},function(){ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:G.NONE}),ie.fixFirefoxAutoScroll()})})})})},ie.renderTextArea=function(){var he=ie.props,$=he.prefixCls,ae=$===void 0?"rc-textarea":$,ee=he.autoSize,Ee=he.onResize,Ce=he.className,ve=he.disabled,Se=ie.state,De=Se.textareaStyles,_e=Se.resizeStatus,ke=Object(u.a)(ie.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Re=x()(ae,Ce,Object(N.a)({},"".concat(ae,"-disabled"),ve));"value"in ke&&(ke.value=ke.value||"");var Ae=Object(B.a)(Object(B.a)(Object(B.a)({},ie.props.style),De),_e===G.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return O.createElement(c,{onResize:ie.handleResize,disabled:!(ee||Ee)},O.createElement("textarea",Object(J.a)({},ke,{className:Re,style:Ae,ref:ie.saveTextArea})))},ie.state={textareaStyles:{},resizeStatus:G.NONE},ie}return Object(L.a)(ue,[{key:"componentDidUpdate",value:function(ie){(ie.value!==this.props.value||!M()(ie.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var ie=this.textArea.selectionStart,he=this.textArea.selectionEnd;this.textArea.setSelectionRange(ie,he)}}catch($){}}},{key:"render",value:function(){return this.renderTextArea()}}]),ue}(O.Component),Z=Y,ne=function(me){Object(H.a)(ue,me);var pe=Object(I.a)(ue);function ue(fe){var ie;Object(K.a)(this,ue),ie=pe.call(this,fe),ie.resizableTextArea=void 0,ie.focus=function(){ie.resizableTextArea.textArea.focus()},ie.saveTextArea=function($){ie.resizableTextArea=$},ie.handleChange=function($){var ae=ie.props.onChange;ie.setValue($.target.value,function(){ie.resizableTextArea.resizeTextarea()}),ae&&ae($)},ie.handleKeyDown=function($){var ae=ie.props,ee=ae.onPressEnter,Ee=ae.onKeyDown;$.keyCode===13&&ee&&ee($),Ee&&Ee($)};var he=typeof fe.value=="undefined"||fe.value===null?fe.defaultValue:fe.value;return ie.state={value:he},ie}return Object(L.a)(ue,[{key:"setValue",value:function(ie,he){"value"in this.props||this.setState({value:ie},he)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return O.createElement(Z,Object(J.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ie){return"value"in ie?{value:ie.value}:null}}]),ue}(O.Component),be=Ke.default=ne},ZpRC:function(Ze,Ke,te){"use strict";function J(f){return typeof f=="object"&&f!=null&&f.nodeType===1}function K(f,v){return(!v||f!=="hidden")&&f!=="visible"&&f!=="clip"}function L(f,v){if(f.clientHeightv||E>f&&l=v&&o>=P?E-f-w:l>v&&oP?l-v+b:0}var I=function(f,v){var P=window,w=v.scrollMode,b=v.block,E=v.inline,l=v.boundary,o=v.skipOverflowHiddenElements,s=typeof l=="function"?l:function(De){return De!==l};if(!J(f))throw new TypeError("Invalid target");for(var d=document.scrollingElement||document.documentElement,C=[],g=f;J(g)&&s(g);){if((g=g.parentElement)===d){C.push(g);break}g!=null&&g===document.body&&L(g)&&!L(document.documentElement)||g!=null&&L(g,o)&&C.push(g)}for(var m=P.visualViewport?P.visualViewport.width:innerWidth,D=P.visualViewport?P.visualViewport.height:innerHeight,T=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,c=f.getBoundingClientRect(),u=c.height,a=c.width,x=c.top,y=c.right,p=c.bottom,k=c.left,F=b==="start"||b==="nearest"?x:b==="end"?p:x+u/2,U=E==="center"?k+a/2:E==="end"?y:k,W=[],_=0;_=0&&k>=0&&p<=D&&y<=m&&x>=ne&&p<=me&&k>=pe&&y<=be)return W;var ue=getComputedStyle(M),fe=parseInt(ue.borderLeftWidth,10),ie=parseInt(ue.borderTopWidth,10),he=parseInt(ue.borderRightWidth,10),$=parseInt(ue.borderBottomWidth,10),ae=0,ee=0,Ee="offsetWidth"in M?M.offsetWidth-M.clientWidth-fe-he:0,Ce="offsetHeight"in M?M.offsetHeight-M.clientHeight-ie-$:0;if(d===M)ae=b==="start"?F:b==="end"?F-D:b==="nearest"?H(h,h+D,D,ie,$,h+F,h+F+u,u):F-D/2,ee=E==="start"?U:E==="center"?U-m/2:E==="end"?U-m:H(T,T+m,m,fe,he,T+U,T+U+a,a),ae=Math.max(0,ae+h),ee=Math.max(0,ee+T);else{ae=b==="start"?F-ne-ie:b==="end"?F-me+$+Ce:b==="nearest"?H(ne,me,Y,ie,$+Ce,F,F+u,u):F-(ne+Y/2)+Ce/2,ee=E==="start"?U-pe-fe:E==="center"?U-(pe+Z/2)+Ee/2:E==="end"?U-be+he+Ee:H(pe,be,Z,fe,he+Ee,U,U+a,a);var ve=M.scrollLeft,Se=M.scrollTop;F+=Se-(ae=Math.max(0,Math.min(Se+ae,M.scrollHeight-Y+Ce))),U+=ve-(ee=Math.max(0,Math.min(ve+ee,M.scrollWidth-Z+Ee)))}W.push({el:M,top:ae,left:ee})}return W};function O(f){return f===Object(f)&&Object.keys(f).length!==0}function B(f,v){v===void 0&&(v="auto");var P="scrollBehavior"in document.body.style;f.forEach(function(w){var b=w.el,E=w.top,l=w.left;b.scroll&&P?b.scroll({top:E,left:l,behavior:v}):(b.scrollTop=E,b.scrollLeft=l)})}function N(f){return f===!1?{block:"end",inline:"nearest"}:O(f)?f:{block:"start",inline:"nearest"}}function R(f,v){var P=!f.ownerDocument.documentElement.contains(f);if(O(v)&&typeof v.behavior=="function")return v.behavior(P?[]:I(f,v));if(P)return;var w=N(v);return B(I(f,w),w.behavior)}var A=Ke.a=R},Zss7:function(Ze,Ke,te){var J;(function(K){var L=/^\s+/,H=/\s+$/,I=0,O=K.round,B=K.min,N=K.max,R=K.random;function A($,ae){if($=$||"",ae=ae||{},$ instanceof A)return $;if(!(this instanceof A))return new A($,ae);var ee=f($);this._originalInput=$,this._r=ee.r,this._g=ee.g,this._b=ee.b,this._a=ee.a,this._roundA=O(100*this._a)/100,this._format=ae.format||ee.format,this._gradientType=ae.gradientType,this._r<1&&(this._r=O(this._r)),this._g<1&&(this._g=O(this._g)),this._b<1&&(this._b=O(this._b)),this._ok=ee.ok,this._tc_id=I++}A.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var $=this.toRgb();return($.r*299+$.g*587+$.b*114)/1e3},getLuminance:function(){var $=this.toRgb(),ae,ee,Ee,Ce,ve,Se;return ae=$.r/255,ee=$.g/255,Ee=$.b/255,ae<=.03928?Ce=ae/12.92:Ce=K.pow((ae+.055)/1.055,2.4),ee<=.03928?ve=ee/12.92:ve=K.pow((ee+.055)/1.055,2.4),Ee<=.03928?Se=Ee/12.92:Se=K.pow((Ee+.055)/1.055,2.4),.2126*Ce+.7152*ve+.0722*Se},setAlpha:function($){return this._a=W($),this._roundA=O(100*this._a)/100,this},toHsv:function(){var $=b(this._r,this._g,this._b);return{h:$.h*360,s:$.s,v:$.v,a:this._a}},toHsvString:function(){var $=b(this._r,this._g,this._b),ae=O($.h*360),ee=O($.s*100),Ee=O($.v*100);return this._a==1?"hsv("+ae+", "+ee+"%, "+Ee+"%)":"hsva("+ae+", "+ee+"%, "+Ee+"%, "+this._roundA+")"},toHsl:function(){var $=P(this._r,this._g,this._b);return{h:$.h*360,s:$.s,l:$.l,a:this._a}},toHslString:function(){var $=P(this._r,this._g,this._b),ae=O($.h*360),ee=O($.s*100),Ee=O($.l*100);return this._a==1?"hsl("+ae+", "+ee+"%, "+Ee+"%)":"hsla("+ae+", "+ee+"%, "+Ee+"%, "+this._roundA+")"},toHex:function($){return l(this._r,this._g,this._b,$)},toHexString:function($){return"#"+this.toHex($)},toHex8:function($){return o(this._r,this._g,this._b,this._a,$)},toHex8String:function($){return"#"+this.toHex8($)},toRgb:function(){return{r:O(this._r),g:O(this._g),b:O(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+O(this._r)+", "+O(this._g)+", "+O(this._b)+")":"rgba("+O(this._r)+", "+O(this._g)+", "+O(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:O(_(this._r,255)*100)+"%",g:O(_(this._g,255)*100)+"%",b:O(_(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+O(_(this._r,255)*100)+"%, "+O(_(this._g,255)*100)+"%, "+O(_(this._b,255)*100)+"%)":"rgba("+O(_(this._r,255)*100)+"%, "+O(_(this._g,255)*100)+"%, "+O(_(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:F[l(this._r,this._g,this._b,!0)]||!1},toFilter:function($){var ae="#"+s(this._r,this._g,this._b,this._a),ee=ae,Ee=this._gradientType?"GradientType = 1, ":"";if($){var Ce=A($);ee="#"+s(Ce._r,Ce._g,Ce._b,Ce._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ee+"startColorstr="+ae+",endColorstr="+ee+")"},toString:function($){var ae=!!$;$=$||this._format;var ee=!1,Ee=this._a<1&&this._a>=0,Ce=!ae&&Ee&&($==="hex"||$==="hex6"||$==="hex3"||$==="hex4"||$==="hex8"||$==="name");return Ce?$==="name"&&this._a===0?this.toName():this.toRgbString():($==="rgb"&&(ee=this.toRgbString()),$==="prgb"&&(ee=this.toPercentageRgbString()),($==="hex"||$==="hex6")&&(ee=this.toHexString()),$==="hex3"&&(ee=this.toHexString(!0)),$==="hex4"&&(ee=this.toHex8String(!0)),$==="hex8"&&(ee=this.toHex8String()),$==="name"&&(ee=this.toName()),$==="hsl"&&(ee=this.toHslString()),$==="hsv"&&(ee=this.toHsvString()),ee||this.toHexString())},clone:function(){return A(this.toString())},_applyModification:function($,ae){var ee=$.apply(null,[this].concat([].slice.call(ae)));return this._r=ee._r,this._g=ee._g,this._b=ee._b,this.setAlpha(ee._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(D,arguments)},darken:function(){return this._applyModification(T,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(C,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(h,arguments)},_applyCombination:function($,ae){return $.apply(null,[this].concat([].slice.call(ae)))},analogous:function(){return this._applyCombination(y,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(p,arguments)},splitcomplement:function(){return this._applyCombination(x,arguments)},triad:function(){return this._applyCombination(u,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},A.fromRatio=function($,ae){if(typeof $=="object"){var ee={};for(var Ee in $)$.hasOwnProperty(Ee)&&(Ee==="a"?ee[Ee]=$[Ee]:ee[Ee]=be($[Ee]));$=ee}return A($,ae)};function f($){var ae={r:0,g:0,b:0},ee=1,Ee=null,Ce=null,ve=null,Se=!1,De=!1;return typeof $=="string"&&($=ie($)),typeof $=="object"&&(fe($.r)&&fe($.g)&&fe($.b)?(ae=v($.r,$.g,$.b),Se=!0,De=String($.r).substr(-1)==="%"?"prgb":"rgb"):fe($.h)&&fe($.s)&&fe($.v)?(Ee=be($.s),Ce=be($.v),ae=E($.h,Ee,Ce),Se=!0,De="hsv"):fe($.h)&&fe($.s)&&fe($.l)&&(Ee=be($.s),ve=be($.l),ae=w($.h,Ee,ve),Se=!0,De="hsl"),$.hasOwnProperty("a")&&(ee=$.a)),ee=W(ee),{ok:Se,format:$.format||De,r:B(255,N(ae.r,0)),g:B(255,N(ae.g,0)),b:B(255,N(ae.b,0)),a:ee}}function v($,ae,ee){return{r:_($,255)*255,g:_(ae,255)*255,b:_(ee,255)*255}}function P($,ae,ee){$=_($,255),ae=_(ae,255),ee=_(ee,255);var Ee=N($,ae,ee),Ce=B($,ae,ee),ve,Se,De=(Ee+Ce)/2;if(Ee==Ce)ve=Se=0;else{var _e=Ee-Ce;Se=De>.5?_e/(2-Ee-Ce):_e/(Ee+Ce);switch(Ee){case $:ve=(ae-ee)/_e+(ae1&&(Ae-=1),Ae<1/6?ke+(Re-ke)*6*Ae:Ae<1/2?Re:Ae<2/3?ke+(Re-ke)*(2/3-Ae)*6:ke}if(ae===0)Ee=Ce=ve=ee;else{var De=ee<.5?ee*(1+ae):ee+ae-ee*ae,_e=2*ee-De;Ee=Se(_e,De,$+1/3),Ce=Se(_e,De,$),ve=Se(_e,De,$-1/3)}return{r:Ee*255,g:Ce*255,b:ve*255}}function b($,ae,ee){$=_($,255),ae=_(ae,255),ee=_(ee,255);var Ee=N($,ae,ee),Ce=B($,ae,ee),ve,Se,De=Ee,_e=Ee-Ce;if(Se=Ee===0?0:_e/Ee,Ee==Ce)ve=0;else{switch(Ee){case $:ve=(ae-ee)/_e+(ae>1)+720)%360;--ae;)Ee.h=(Ee.h+Ce)%360,ve.push(A(Ee));return ve}function p($,ae){ae=ae||6;for(var ee=A($).toHsv(),Ee=ee.h,Ce=ee.s,ve=ee.v,Se=[],De=1/ae;ae--;)Se.push(A({h:Ee,s:Ce,v:ve})),ve=(ve+De)%1;return Se}A.mix=function($,ae,ee){ee=ee===0?0:ee||50;var Ee=A($).toRgb(),Ce=A(ae).toRgb(),ve=ee/100,Se={r:(Ce.r-Ee.r)*ve+Ee.r,g:(Ce.g-Ee.g)*ve+Ee.g,b:(Ce.b-Ee.b)*ve+Ee.b,a:(Ce.a-Ee.a)*ve+Ee.a};return A(Se)},A.readability=function($,ae){var ee=A($),Ee=A(ae);return(K.max(ee.getLuminance(),Ee.getLuminance())+.05)/(K.min(ee.getLuminance(),Ee.getLuminance())+.05)},A.isReadable=function($,ae,ee){var Ee=A.readability($,ae),Ce,ve;ve=!1,Ce=he(ee);switch(Ce.level+Ce.size){case"AAsmall":case"AAAlarge":ve=Ee>=4.5;break;case"AAlarge":ve=Ee>=3;break;case"AAAsmall":ve=Ee>=7;break}return ve},A.mostReadable=function($,ae,ee){var Ee=null,Ce=0,ve,Se,De,_e;ee=ee||{},Se=ee.includeFallbackColors,De=ee.level,_e=ee.size;for(var ke=0;keCe&&(Ce=ve,Ee=A(ae[ke]));return A.isReadable($,Ee,{level:De,size:_e})||!Se?Ee:(ee.includeFallbackColors=!1,A.mostReadable($,["#fff","#000"],ee))};var k=A.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},F=A.hexNames=U(k);function U($){var ae={};for(var ee in $)$.hasOwnProperty(ee)&&(ae[$[ee]]=ee);return ae}function W($){return $=parseFloat($),(isNaN($)||$<0||$>1)&&($=1),$}function _($,ae){Y($)&&($="100%");var ee=Z($);return $=B(ae,N(0,parseFloat($))),ee&&($=parseInt($*ae,10)/100),K.abs($-ae)<1e-6?1:$%ae/parseFloat(ae)}function M($){return B(1,N(0,$))}function G($){return parseInt($,16)}function Y($){return typeof $=="string"&&$.indexOf(".")!=-1&&parseFloat($)===1}function Z($){return typeof $=="string"&&$.indexOf("%")!=-1}function ne($){return $.length==1?"0"+$:""+$}function be($){return $<=1&&($=$*100+"%"),$}function me($){return K.round(parseFloat($)*255).toString(16)}function pe($){return G($)/255}var ue=function(){var $="[-\\+]?\\d+%?",ae="[-\\+]?\\d*\\.\\d+%?",ee="(?:"+ae+")|(?:"+$+")",Ee="[\\s|\\(]+("+ee+")[,|\\s]+("+ee+")[,|\\s]+("+ee+")\\s*\\)?",Ce="[\\s|\\(]+("+ee+")[,|\\s]+("+ee+")[,|\\s]+("+ee+")[,|\\s]+("+ee+")\\s*\\)?";return{CSS_UNIT:new RegExp(ee),rgb:new RegExp("rgb"+Ee),rgba:new RegExp("rgba"+Ce),hsl:new RegExp("hsl"+Ee),hsla:new RegExp("hsla"+Ce),hsv:new RegExp("hsv"+Ee),hsva:new RegExp("hsva"+Ce),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function fe($){return!!ue.CSS_UNIT.exec($)}function ie($){$=$.replace(L,"").replace(H,"").toLowerCase();var ae=!1;if(k[$])$=k[$],ae=!0;else if($=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ee;return(ee=ue.rgb.exec($))?{r:ee[1],g:ee[2],b:ee[3]}:(ee=ue.rgba.exec($))?{r:ee[1],g:ee[2],b:ee[3],a:ee[4]}:(ee=ue.hsl.exec($))?{h:ee[1],s:ee[2],l:ee[3]}:(ee=ue.hsla.exec($))?{h:ee[1],s:ee[2],l:ee[3],a:ee[4]}:(ee=ue.hsv.exec($))?{h:ee[1],s:ee[2],v:ee[3]}:(ee=ue.hsva.exec($))?{h:ee[1],s:ee[2],v:ee[3],a:ee[4]}:(ee=ue.hex8.exec($))?{r:G(ee[1]),g:G(ee[2]),b:G(ee[3]),a:pe(ee[4]),format:ae?"name":"hex8"}:(ee=ue.hex6.exec($))?{r:G(ee[1]),g:G(ee[2]),b:G(ee[3]),format:ae?"name":"hex"}:(ee=ue.hex4.exec($))?{r:G(ee[1]+""+ee[1]),g:G(ee[2]+""+ee[2]),b:G(ee[3]+""+ee[3]),a:pe(ee[4]+""+ee[4]),format:ae?"name":"hex8"}:(ee=ue.hex3.exec($))?{r:G(ee[1]+""+ee[1]),g:G(ee[2]+""+ee[2]),b:G(ee[3]+""+ee[3]),format:ae?"name":"hex"}:!1}function he($){var ae,ee;return $=$||{level:"AA",size:"small"},ae=($.level||"AA").toUpperCase(),ee=($.size||"small").toLowerCase(),ae!=="AA"&&ae!=="AAA"&&(ae="AA"),ee!=="small"&&ee!=="large"&&(ee="small"),{level:ae,size:ee}}Ze.exports?Ze.exports=A:!(J=function(){return A}.call(Ke,te,Ke,Ze),J!==void 0&&(Ze.exports=J))})(Math)},aRTE:function(Ze,Ke){Ze.exports={L:1,M:0,Q:3,H:2}},bT9E:function(Ze,Ke,te){"use strict";te.d(Ke,"a",function(){return K});var J=te("VTBJ");function K(L,H){var I=Object(J.a)({},L);return Array.isArray(H)&&H.forEach(function(O){delete I[O]}),I}},c5Ni:function(Ze,Ke,te){},dQei:function(Ze,Ke){for(var te={glog:function(K){if(K<1)throw new Error("glog("+K+")");return te.LOG_TABLE[K]},gexp:function(K){for(;K<0;)K+=255;for(;K>=256;)K-=255;return te.EXP_TABLE[K]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},J=0;J<8;J++)te.EXP_TABLE[J]=1<1?Z-1:0),be=1;be1?_-1:0),G=1;G<_;G++)M[G-1]=arguments[G];W.apply(void 0,[U].concat(M))}},p.onChange=function(U){var W=p.props.onChange;p.state.focused&&(p.inputting=!0),p.rawInput=p.props.parser(p.getValueFromEvent(U)),p.setState({inputValue:p.rawInput}),W(p.toNumber(p.rawInput))},p.onMouseUp=function(){var U=p.props.onMouseUp;p.recordCursorPosition(),U&&U.apply(void 0,arguments)},p.onFocus=function(){var U;p.setState({focused:!0}),(U=p.props).onFocus.apply(U,arguments)},p.onBlur=function(){var U=p.props.onBlur;p.inputting=!1,p.setState({focused:!1});var W=p.getCurrentValidValue(p.state.inputValue),_=p.setValue(W,l);if(U){var M=p.input.value,G=p.getInputDisplayValue({focus:!1,value:_});p.input.value=G&&Number(G),U.apply(void 0,arguments),p.input.value=M}},p.getRatio=function(U){var W=1;return U.metaKey||U.ctrlKey?W=.1:U.shiftKey&&(W=10),W},p.getFullNum=function(U){return isNaN(U)?U:/e/i.test(String(U))?Number(U).toFixed(18).replace(/\.?0+$/,""):U},p.getPrecision=function(U){if(m(p.props.precision))return p.props.precision;var W=String(U);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var _=0;return W.indexOf(".")>=0&&(_=W.length-W.indexOf(".")-1),_},p.getInputDisplayValue=function(U){var W=U||p.state,_=W.focused,M=W.inputValue,G=W.value,Y;_?Y=M:Y=p.toPrecisionAsStep(G),Y==null&&(Y="");var Z=p.formatWrapper(Y);return m(p.props.decimalSeparator)&&(Z=Z.toString().replace(".",p.props.decimalSeparator)),Z},p.recordCursorPosition=function(){try{p.cursorStart=p.input.selectionStart,p.cursorEnd=p.input.selectionEnd,p.currentValue=p.input.value,p.cursorBefore=p.input.value.substring(0,p.cursorStart),p.cursorAfter=p.input.value.substring(p.cursorEnd)}catch(U){}},p.restoreByAfter=function(U){if(U===void 0)return!1;var W=p.input.value,_=W.lastIndexOf(U);if(_===-1)return!1;var M=p.cursorBefore.length;return p.lastKeyCode===v.a.DELETE&&p.cursorBefore.charAt(M-1)===U[0]?(p.fixCaret(M,M),!0):_+U.length===W.length?(p.fixCaret(_,_),!0):!1},p.partRestoreByAfter=function(U){return U===void 0?!1:Array.prototype.some.call(U,function(W,_){var M=U.substring(_);return p.restoreByAfter(M)})},p.isNotCompleteNumber=function(U){return isNaN(U)||U===""||U===null||U&&U.toString().indexOf(".")===U.toString().length-1},p.stop=function(){p.autoStepTimer&&clearTimeout(p.autoStepTimer)},p.down=function(U,W,_){p.pressingUpOrDown=!0,p.step("down",U,W,_)},p.up=function(U,W,_){p.pressingUpOrDown=!0,p.step("up",U,W,_)},p.saveInput=function(U){p.input=U};var k=y.value;k===void 0&&(k=y.defaultValue),p.state={focused:y.autoFocus};var F=p.getValidValue(p.toNumber(k));return p.state=w(w({},p.state),{},{inputValue:p.toPrecisionAsStep(F),value:F}),p}return Object(H.a)(x,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(p){var k=this.props,F=k.value,U=k.onChange,W=k.max,_=k.min,M=this.state.focused;if(p){if(!D(p.value,F)||!D(p.max,W)||!D(p.min,_)){var G=M?F:this.getValidValue(F),Y;this.pressingUpOrDown?Y=G:this.inputting?Y=this.rawInput:Y=this.toPrecisionAsStep(G),this.setState({value:G,inputValue:Y})}var Z="value"in this.props?F:this.state.value;"max"in this.props&&p.max!==W&&typeof Z=="number"&&Z>W&&U&&U(W),"min"in this.props&&p.min!==_&&typeof Z=="number"&&Z<_&&U&&U(_)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ne=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===v.a.BACKSPACE?ne=this.cursorStart-1:this.lastKeyCode===v.a.DELETE&&(ne=this.cursorStart):ne=this.input.value.length,this.fixCaret(ne,ne)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case v.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case v.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(be){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(p){var k=p;return k===""?k="":this.isNotCompleteNumber(parseFloat(k))?k=this.state.value:k=this.getValidValue(k),this.toNumber(k)}},{key:"getValueFromEvent",value:function(p){var k=p.target.value.trim().replace(/。/g,".");return m(this.props.decimalSeparator)&&(k=k.replace(this.props.decimalSeparator,".")),k}},{key:"getValidValue",value:function(p){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,U=parseFloat(p);return isNaN(U)?p:(UF&&(U=F),U)}},{key:"setValue",value:function(p,k){var F=this.props.precision,U=this.isNotCompleteNumber(parseFloat(p))?null:parseFloat(p),W=this.state.value,_=W===void 0?null:W,M=this.state.inputValue,G=M===void 0?null:M,Y=typeof U=="number"?U.toFixed(F):"".concat(U),Z=U!==_||Y!=="".concat(G);return"value"in this.props?(G=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:G},k)):this.setState({value:U,inputValue:this.toPrecisionAsStep(p)},k),Z&&this.props.onChange(U),U}},{key:"getMaxPrecision",value:function(p){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.props,U=F.precision,W=F.step;if(m(U))return U;var _=this.getPrecision(k),M=this.getPrecision(W),G=this.getPrecision(p);return p?Math.max(G,_+M):_+M}},{key:"getPrecisionFactor",value:function(p){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.getMaxPrecision(p,k);return Math.pow(10,F)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(p){return this.props.formatter?this.props.formatter(p):p}},{key:"toPrecisionAsStep",value:function(p){if(this.isNotCompleteNumber(p)||p==="")return p;var k=Math.abs(this.getMaxPrecision(p));return isNaN(k)?p.toString():Number(p).toFixed(k)}},{key:"toNumber",value:function(p){var k=this.props.precision,F=this.state.focused,U=p&&p.length>16&&F;return this.isNotCompleteNumber(p)||U?p:m(k)?Math.round(p*Math.pow(10,k))/Math.pow(10,k):Number(p)}},{key:"upStep",value:function(p,k){var F=this.props.step,U=this.getPrecisionFactor(p,k),W=Math.abs(this.getMaxPrecision(p,k)),_=((U*p+U*F*k)/U).toFixed(W);return this.toNumber(_)}},{key:"downStep",value:function(p,k){var F=this.props.step,U=this.getPrecisionFactor(p,k),W=Math.abs(this.getMaxPrecision(p,k)),_=((U*p-U*F*k)/U).toFixed(W);return this.toNumber(_)}},{key:"step",value:function(p,k){var F=this,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),k&&(k.persist(),k.preventDefault());var _=this.props;if(_.disabled)return;var M=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(M))return;var G=this["".concat(p,"Step")](M,U),Y=G>_.max||G<_.min;if(G>_.max?G=_.max:G<_.min&&(G=_.min),this.setValue(G,null),this.setState({focused:!0},function(){F.pressingUpOrDown=!1}),Y)return;this.autoStepTimer=setTimeout(function(){F[p](k,U,!0)},W?d:C)}},{key:"fixCaret",value:function(p,k){if(p===void 0||k===void 0||!this.input||!this.input.value)return;try{var F=this.input.selectionStart,U=this.input.selectionEnd;(p!==F||k!==U)&&this.input.setSelectionRange(p,k)}catch(W){}}},{key:"render",value:function(){var p,k=this.props,F=k.prefixCls,U=k.disabled,W=k.readOnly,_=k.useTouch,M=k.autoComplete,G=k.upHandler,Y=k.downHandler,Z=k.className,ne=k.max,be=k.min,me=k.style,pe=k.title,ue=k.onMouseEnter,fe=k.onMouseLeave,ie=k.onMouseOver,he=k.onMouseOut,$=k.required,ae=k.onClick,ee=k.tabIndex,Ee=k.type,Ce=k.placeholder,ve=k.id,Se=k.inputMode,De=k.pattern,_e=k.step,ke=k.maxLength,Re=k.autoFocus,Ae=k.name,Ue=k.onPaste,Ye=k.onInput,Ge=Object(J.a)(k,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),He=this.state,et=He.value,Je=He.focused,Xe=f()(F,(p={},Object(K.a)(p,Z,!!Z),Object(K.a)(p,"".concat(F,"-disabled"),U),Object(K.a)(p,"".concat(F,"-focused"),Je),p)),we={};Object.keys(Ge).forEach(function(se){(se.substr(0,5)==="data-"||se.substr(0,5)==="aria-"||se==="role")&&(we[se]=Ge[se])});var rt=!W&&!U,$e=this.getInputDisplayValue(null),Le=(et||et===0)&&(isNaN(et)||Number(et)>=ne),Fe=(et||et===0)&&(isNaN(et)||Number(et)<=be),ge=Le||U||W,de=Fe||U||W,ce=f()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(K.a)({},"".concat(F,"-handler-up-disabled"),ge)),Q=f()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(K.a)({},"".concat(F,"-handler-down-disabled"),de)),q=_?{onTouchStart:ge?l:this.up,onTouchEnd:this.stop}:{onMouseDown:ge?l:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},re=_?{onTouchStart:de?l:this.down,onTouchEnd:this.stop}:{onMouseDown:de?l:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return R.a.createElement("div",{className:Xe,style:me,title:pe,onMouseEnter:ue,onMouseLeave:fe,onMouseOver:ie,onMouseOut:he,onFocus:function(){return null},onBlur:function(){return null}},R.a.createElement("div",{className:"".concat(F,"-handler-wrap")},R.a.createElement("span",Object.assign({unselectable:"on"},q,{role:"button","aria-label":"Increase Value","aria-disabled":ge,className:ce}),G||R.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-up-inner"),onClick:o})),R.a.createElement("span",Object.assign({unselectable:"on"},re,{role:"button","aria-label":"Decrease Value","aria-disabled":de,className:Q}),Y||R.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-down-inner"),onClick:o}))),R.a.createElement("div",{className:"".concat(F,"-input-wrap")},R.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":be,"aria-valuemax":ne,"aria-valuenow":et,required:$,type:Ee,placeholder:Ce,onPaste:Ue,onClick:ae,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:ee,autoComplete:M,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:rt?this.onKeyDown:l,onKeyUp:rt?this.onKeyUp:l,autoFocus:Re,maxLength:ke,readOnly:W,disabled:U,max:ne,min:be,step:_e,name:Ae,title:pe,id:ve,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum($e),pattern:De,inputMode:Se,onInput:Ye},we))))}}]),x}(R.a.Component);T.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:g,min:-g,step:1,style:{},onChange:l,onKeyDown:l,onPressEnter:l,onFocus:l,onBlur:l,parser:s,required:!1,autoComplete:"off"};var h=T,c=Ke.a=h},f4xo:function(Ze,Ke,te){var J=te("nVVt");function K(L){this.mode=J.MODE_8BIT_BYTE,this.data=L}K.prototype={getLength:function(L){return this.data.length},write:function(L){for(var H=0;HF.length)&&(U=F.length);for(var W=0,_=new Array(U);W=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,_))continue;W[_]=F[_]}}return W}function b(F,U){if(F==null)return{};var W={},_=Object.keys(F),M,G;for(G=0;G<_.length;G++){if(M=_[G],U.indexOf(M)>=0)continue;W[M]=F[M]}return W}var E=function(U){var W=U.className,_=U.percent,M=U.prefixCls,G=U.strokeColor,Y=U.strokeLinecap,Z=U.strokeWidth,ne=U.style,be=U.trailColor,me=U.trailWidth,pe=U.transition,ue=w(U,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete ue.gapPosition;var fe=Array.isArray(_)?_:[_],ie=Array.isArray(G)?G:[G],he=O(fe),$=N(he,1),ae=$[0],ee=Z/2,Ee=100-Z/2,Ce="M ".concat(Y==="round"?ee:0,",").concat(ee,` L `).concat(Y==="round"?Ee:100,",").concat(ee),ve="0 0 100 ".concat(Z),Se=0;return K.a.createElement("svg",B({className:H()("".concat(M,"-line"),W),viewBox:ve,preserveAspectRatio:"none",style:ne},ue),K.a.createElement("path",{className:"".concat(M,"-line-trail"),d:Ce,strokeLinecap:Y,stroke:be,strokeWidth:me||Z,fillOpacity:"0"}),fe.map(function(De,_e){var ke={strokeDasharray:"".concat(De,"px, 100px"),strokeDashoffset:"-".concat(Se,"px"),transition:pe||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Re=ie[_e]||ie[ie.length-1];return Se+=De,K.a.createElement("path",{key:_e,className:"".concat(M,"-line-path"),d:Ce,strokeLinecap:Y,stroke:Re,strokeWidth:Z,fillOpacity:"0",ref:ae[_e],style:ke})}))};E.defaultProps=I;var l=E;function o(){return o=Object.assign||function(F){for(var U=1;UF.length)&&(U=F.length);for(var W=0,_=new Array(U);W=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,_))continue;W[_]=F[_]}}return W}function h(F,U){if(F==null)return{};var W={},_=Object.keys(F),M,G;for(G=0;G<_.length;G++){if(M=_[G],U.indexOf(M)>=0)continue;W[M]=F[M]}return W}var c=0;function u(F){return+F.replace("%","")}function a(F){return Array.isArray(F)?F:[F]}function x(F,U,W,_){var M=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,G=arguments.length>5?arguments[5]:void 0,Y=50-_/2,Z=0,ne=-Y,be=0,me=-2*Y;switch(G){case"left":Z=-Y,ne=0,be=2*Y,me=0;break;case"right":Z=Y,ne=0,be=-2*Y,me=0;break;case"bottom":ne=Y,me=2*Y;break;default:}var pe="M 50,50 m ".concat(Z,",").concat(ne,` a `).concat(Y,",").concat(Y," 0 1 1 ").concat(be,",").concat(-me,` a `).concat(Y,",").concat(Y," 0 1 1 ").concat(-be,",").concat(me),ue=Math.PI*2*Y,fe={stroke:W,strokeDasharray:"".concat(U/100*(ue-M),"px ").concat(ue,"px"),strokeDashoffset:"-".concat(M/2+F/100*(ue-M),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:pe,pathStyle:fe}}var y=function(U){var W=U.prefixCls,_=U.strokeWidth,M=U.trailWidth,G=U.gapDegree,Y=U.gapPosition,Z=U.trailColor,ne=U.strokeLinecap,be=U.style,me=U.className,pe=U.strokeColor,ue=U.percent,fe=T(U,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ie=Object(J.useMemo)(function(){return c+=1,c},[]),he=x(0,100,Z,_,G,Y),$=he.pathString,ae=he.pathStyle,ee=a(ue),Ee=a(pe),Ce=Ee.find(function(ke){return Object.prototype.toString.call(ke)==="[object Object]"}),ve=O(ee),Se=s(ve,1),De=Se[0],_e=function(){var Re=0;return ee.map(function(Ae,Ue){var Ye=Ee[Ue]||Ee[Ee.length-1],Ge=Object.prototype.toString.call(Ye)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ie,")"):"",He=x(Re,Ae,Ye,_,G,Y);return Re+=Ae,K.a.createElement("path",{key:Ue,className:"".concat(W,"-circle-path"),d:He.pathString,stroke:Ge,strokeLinecap:ne,strokeWidth:_,opacity:Ae===0?0:1,fillOpacity:"0",style:He.pathStyle,ref:De[Ue]})})};return K.a.createElement("svg",o({className:H()("".concat(W,"-circle"),me),viewBox:"0 0 100 100",style:be},fe),Ce&&K.a.createElement("defs",null,K.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ie),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Ce).sort(function(ke,Re){return u(ke)-u(Re)}).map(function(ke,Re){return K.a.createElement("stop",{key:Re,offset:ke,stopColor:Ce[ke]})}))),K.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:$,stroke:Z,strokeLinecap:ne,strokeWidth:M||_,fillOpacity:"0",style:ae}),_e().reverse())};y.defaultProps=I;var p=y,k={Line:l,Circle:p}},iIVh:function(Ze,Ke,te){},kSUc:function(Ze,Ke,te){},lZu9:function(Ze,Ke,te){(function(J){J(te("VrN/"),te("1eCo"),te("8EBN"))})(function(J){"use strict";J.defineMode("markdown",function(K,L){var H=J.getMode(K,"text/html"),I=H.name=="null";function O(_){if(J.findModeByName){var M=J.findModeByName(_);M&&(_=M.mime||M.mimes[0])}var G=J.getMode(K,_);return G.name=="null"?null:G}L.highlightFormatting===void 0&&(L.highlightFormatting=!1),L.maxBlockquoteDepth===void 0&&(L.maxBlockquoteDepth=0),L.taskLists===void 0&&(L.taskLists=!1),L.strikethrough===void 0&&(L.strikethrough=!1),L.emoji===void 0&&(L.emoji=!1),L.fencedCodeBlockHighlighting===void 0&&(L.fencedCodeBlockHighlighting=!0),L.fencedCodeBlockDefaultMode===void 0&&(L.fencedCodeBlockDefaultMode="text/plain"),L.xml===void 0&&(L.xml=!0),L.tokenTypeOverrides===void 0&&(L.tokenTypeOverrides={});var B={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var N in B)B.hasOwnProperty(N)&&L.tokenTypeOverrides[N]&&(B[N]=L.tokenTypeOverrides[N]);var R=/^([*\-_])(?:\s*\1){2,}\s*$/,A=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,f=/^\[(x| )\](?=\s)/i,v=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,P=/^ {0,3}(?:\={1,}|-{2,})\s*$/,w=/^[^#!\[\]*_\\<>` "'(~:]+/,b=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,E=/^\s*\[[^\]]+?\]:.*$/,l=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function s(_,M,G){return M.f=M.inline=G,G(_,M)}function d(_,M,G){return M.f=M.block=G,G(_,M)}function C(_){return!_||!/\S/.test(_.string)}function g(_){if(_.linkTitle=!1,_.linkHref=!1,_.linkText=!1,_.em=!1,_.strong=!1,_.strikethrough=!1,_.quote=0,_.indentedCode=!1,_.f==D){var M=I;if(!M){var G=J.innerMode(H,_.htmlState);M=G.mode.name=="xml"&&G.state.tagStart===null&&!G.state.context&&G.state.tokenize.isInText}M&&(_.f=u,_.block=m,_.htmlState=null)}return _.trailingSpace=0,_.trailingSpaceNewLine=!1,_.prevLine=_.thisLine,_.thisLine={stream:null},null}function m(_,M){var G=_.column()===M.indentation,Y=C(M.prevLine.stream),Z=M.indentedCode,ne=M.prevLine.hr,be=M.list!==!1,me=(M.listStack[M.listStack.length-1]||0)+3;M.indentedCode=!1;var pe=M.indentation;if(M.indentationDiff===null&&(M.indentationDiff=M.indentation,be)){for(M.list=null;pe=4&&(Z||M.prevLine.fencedCodeEnd||M.prevLine.header||Y))return _.skipToEnd(),M.indentedCode=!0,B.code;if(_.eatSpace())return null;if(G&&M.indentation<=me&&(ie=_.match(v))&&ie[1].length<=6)return M.quote=0,M.header=ie[1].length,M.thisLine.header=!0,L.highlightFormatting&&(M.formatting="header"),M.f=M.inline,h(M);if(M.indentation<=me&&_.eat(">"))return M.quote=G?1:M.quote+1,L.highlightFormatting&&(M.formatting="quote"),_.eatSpace(),h(M);if(!fe&&!M.setext&&G&&M.indentation<=me&&(ie=_.match(A))){var he=ie[1]?"ol":"ul";return M.indentation=pe+_.current().length,M.list=!0,M.quote=0,M.listStack.push(M.indentation),M.em=!1,M.strong=!1,M.code=!1,M.strikethrough=!1,L.taskLists&&_.match(f,!1)&&(M.taskList=!0),M.f=M.inline,L.highlightFormatting&&(M.formatting=["list","list-"+he]),h(M)}else{if(G&&M.indentation<=me&&(ie=_.match(b,!0)))return M.quote=0,M.fencedEndRE=new RegExp(ie[1]+"+ *$"),M.localMode=L.fencedCodeBlockHighlighting&&O(ie[2]||L.fencedCodeBlockDefaultMode),M.localMode&&(M.localState=J.startState(M.localMode)),M.f=M.block=T,L.highlightFormatting&&(M.formatting="code-block"),M.code=-1,h(M);if(M.setext||(!ue||!be)&&!M.quote&&M.list===!1&&!M.code&&!fe&&!E.test(_.string)&&(ie=_.lookAhead(1))&&(ie=ie.match(P)))return M.setext?(M.header=M.setext,M.setext=0,_.skipToEnd(),L.highlightFormatting&&(M.formatting="header")):(M.header=ie[0].charAt(0)=="="?1:2,M.setext=M.header),M.thisLine.header=!0,M.f=M.inline,h(M);if(fe)return _.skipToEnd(),M.hr=!0,M.thisLine.hr=!0,B.hr;if(_.peek()==="[")return s(_,M,k)}return s(_,M,M.inline)}function D(_,M){var G=H.token(_,M.htmlState);if(!I){var Y=J.innerMode(H,M.htmlState);(Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText||M.md_inside&&_.current().indexOf(">")>-1)&&(M.f=u,M.block=m,M.htmlState=null)}return G}function T(_,M){var G=M.listStack[M.listStack.length-1]||0,Y=M.indentation=_.quote?M.push(B.formatting+"-"+_.formatting[G]+"-"+_.quote):M.push("error"))}if(_.taskOpen)return M.push("meta"),M.length?M.join(" "):null;if(_.taskClosed)return M.push("property"),M.length?M.join(" "):null;if(_.linkHref?M.push(B.linkHref,"url"):(_.strong&&M.push(B.strong),_.em&&M.push(B.em),_.strikethrough&&M.push(B.strikethrough),_.emoji&&M.push(B.emoji),_.linkText&&M.push(B.linkText),_.code&&M.push(B.code),_.image&&M.push(B.image),_.imageAltText&&M.push(B.imageAltText,"link"),_.imageMarker&&M.push(B.imageMarker)),_.header&&M.push(B.header,B.header+"-"+_.header),_.quote&&(M.push(B.quote),!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=_.quote?M.push(B.quote+"-"+_.quote):M.push(B.quote+"-"+L.maxBlockquoteDepth)),_.list!==!1){var Y=(_.listStack.length-1)%3;Y?Y===1?M.push(B.list2):M.push(B.list3):M.push(B.list1)}return _.trailingSpaceNewLine?M.push("trailing-space-new-line"):_.trailingSpace&&M.push("trailing-space-"+(_.trailingSpace%2?"a":"b")),M.length?M.join(" "):null}function c(_,M){return _.match(w,!0)?h(M):void 0}function u(_,M){var G=M.text(_,M);if(typeof G!="undefined")return G;if(M.list)return M.list=null,h(M);if(M.taskList){var Y=_.match(f,!0)[1]===" ";return Y?M.taskOpen=!0:M.taskClosed=!0,L.highlightFormatting&&(M.formatting="task"),M.taskList=!1,h(M)}if(M.taskOpen=!1,M.taskClosed=!1,M.header&&_.match(/^#+$/,!0))return L.highlightFormatting&&(M.formatting="header"),h(M);var Z=_.next();if(M.linkTitle){M.linkTitle=!1;var ne=Z;Z==="("&&(ne=")"),ne=(ne+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var be="^\\s*(?:[^"+ne+"\\\\]+|\\\\\\\\|\\\\.)"+ne;if(_.match(new RegExp(be),!0))return B.linkHref}if(Z==="`"){var me=M.formatting;L.highlightFormatting&&(M.formatting="code"),_.eatWhile("`");var pe=_.current().length;if(M.code==0&&(!M.quote||pe==1))return M.code=pe,h(M);if(pe==M.code){var ue=h(M);return M.code=0,ue}else return M.formatting=me,h(M)}else if(M.code)return h(M);if(Z==="\\"&&(_.next(),L.highlightFormatting)){var fe=h(M),ie=B.formatting+"-escape";return fe?fe+" "+ie:ie}if(Z==="!"&&_.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return M.imageMarker=!0,M.image=!0,L.highlightFormatting&&(M.formatting="image"),h(M);if(Z==="["&&M.imageMarker&&_.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return M.imageMarker=!1,M.imageAltText=!0,L.highlightFormatting&&(M.formatting="image"),h(M);if(Z==="]"&&M.imageAltText){L.highlightFormatting&&(M.formatting="image");var fe=h(M);return M.imageAltText=!1,M.image=!1,M.inline=M.f=x,fe}if(Z==="["&&!M.image)return M.linkText&&_.match(/^.*?\]/)||(M.linkText=!0,L.highlightFormatting&&(M.formatting="link")),h(M);if(Z==="]"&&M.linkText){L.highlightFormatting&&(M.formatting="link");var fe=h(M);return M.linkText=!1,M.inline=M.f=_.match(/\(.*?\)| ?\[.*?\]/,!1)?x:u,fe}if(Z==="<"&&_.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){M.f=M.inline=a,L.highlightFormatting&&(M.formatting="link");var fe=h(M);return fe?fe+=" ":fe="",fe+B.linkInline}if(Z==="<"&&_.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){M.f=M.inline=a,L.highlightFormatting&&(M.formatting="link");var fe=h(M);return fe?fe+=" ":fe="",fe+B.linkEmail}if(L.xml&&Z==="<"&&_.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var he=_.string.indexOf(">",_.pos);if(he!=-1){var $=_.string.substring(_.start,he);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test($)&&(M.md_inside=!0)}return _.backUp(1),M.htmlState=J.startState(H),d(_,M,D)}if(L.xml&&Z==="<"&&_.match(/^\/\w*?>/))return M.md_inside=!1,"tag";if(Z==="*"||Z==="_"){for(var ae=1,ee=_.pos==1?" ":_.string.charAt(_.pos-2);ae<3&&_.eat(Z);)ae++;var Ee=_.peek()||" ",Ce=!/\s/.test(Ee)&&(!l.test(Ee)||/\s/.test(ee)||l.test(ee)),ve=!/\s/.test(ee)&&(!l.test(ee)||/\s/.test(Ee)||l.test(Ee)),Se=null,De=null;if(ae%2&&(!M.em&&Ce&&(Z==="*"||!ve||l.test(ee))?Se=!0:M.em==Z&&ve&&(Z==="*"||!Ce||l.test(Ee))&&(Se=!1)),ae>1&&(!M.strong&&Ce&&(Z==="*"||!ve||l.test(ee))?De=!0:M.strong==Z&&ve&&(Z==="*"||!Ce||l.test(Ee))&&(De=!1)),De!=null||Se!=null){L.highlightFormatting&&(M.formatting=Se==null?"strong":De==null?"em":"strong em"),Se===!0&&(M.em=Z),De===!0&&(M.strong=Z);var ue=h(M);return Se===!1&&(M.em=!1),De===!1&&(M.strong=!1),ue}}else if(Z===" "&&(_.eat("*")||_.eat("_"))){if(_.peek()===" ")return h(M);_.backUp(1)}if(L.strikethrough){if(Z==="~"&&_.eatWhile(Z)){if(M.strikethrough){L.highlightFormatting&&(M.formatting="strikethrough");var ue=h(M);return M.strikethrough=!1,ue}else if(_.match(/^[^\s]/,!1))return M.strikethrough=!0,L.highlightFormatting&&(M.formatting="strikethrough"),h(M)}else if(Z===" "&&_.match(/^~~/,!0)){if(_.peek()===" ")return h(M);_.backUp(2)}}if(L.emoji&&Z===":"&&_.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){M.emoji=!0,L.highlightFormatting&&(M.formatting="emoji");var _e=h(M);return M.emoji=!1,_e}return Z===" "&&(_.match(/^ +$/,!1)?M.trailingSpace++:M.trailingSpace&&(M.trailingSpaceNewLine=!0)),h(M)}function a(_,M){var G=_.next();if(G===">"){M.f=M.inline=u,L.highlightFormatting&&(M.formatting="link");var Y=h(M);return Y?Y+=" ":Y="",Y+B.linkInline}return _.match(/^[^>]+/,!0),B.linkInline}function x(_,M){if(_.eatSpace())return null;var G=_.next();return G==="("||G==="["?(M.f=M.inline=p(G==="("?")":"]"),L.highlightFormatting&&(M.formatting="link-string"),M.linkHref=!0,h(M)):"error"}var y={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function p(_){return function(M,G){var Y=M.next();if(Y===_){G.f=G.inline=u,L.highlightFormatting&&(G.formatting="link-string");var Z=h(G);return G.linkHref=!1,Z}return M.match(y[_]),G.linkHref=!0,h(G)}}function k(_,M){return _.match(/^([^\]\\]|\\.)*\]:/,!1)?(M.f=F,_.next(),L.highlightFormatting&&(M.formatting="link"),M.linkText=!0,h(M)):s(_,M,u)}function F(_,M){if(_.match(/^\]:/,!0)){M.f=M.inline=U,L.highlightFormatting&&(M.formatting="link");var G=h(M);return M.linkText=!1,G}return _.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function U(_,M){return _.eatSpace()?null:(_.match(/^[^\s]+/,!0),_.peek()===void 0?M.linkTitle=!0:_.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),M.f=M.inline=u,B.linkHref+" url")}var W={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:u,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(_){return{f:_.f,prevLine:_.prevLine,thisLine:_.thisLine,block:_.block,htmlState:_.htmlState&&J.copyState(H,_.htmlState),indentation:_.indentation,localMode:_.localMode,localState:_.localMode?J.copyState(_.localMode,_.localState):null,inline:_.inline,text:_.text,formatting:!1,linkText:_.linkText,linkTitle:_.linkTitle,linkHref:_.linkHref,code:_.code,em:_.em,strong:_.strong,strikethrough:_.strikethrough,emoji:_.emoji,header:_.header,setext:_.setext,hr:_.hr,taskList:_.taskList,list:_.list,listStack:_.listStack.slice(0),quote:_.quote,indentedCode:_.indentedCode,trailingSpace:_.trailingSpace,trailingSpaceNewLine:_.trailingSpaceNewLine,md_inside:_.md_inside,fencedEndRE:_.fencedEndRE}},token:function(_,M){if(M.formatting=!1,_!=M.thisLine.stream){if(M.header=0,M.hr=!1,_.match(/^\s*$/,!0))return g(M),null;if(M.prevLine=M.thisLine,M.thisLine={stream:_},M.taskList=!1,M.trailingSpace=0,M.trailingSpaceNewLine=!1,!M.localState&&(M.f=M.block,M.f!=D)){var G=_.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(M.indentation=G,M.indentationDiff=null,G>0)return null}}return M.f(_,M)},innerMode:function(_){return _.block==D?{state:_.htmlState,mode:H}:_.localState?{state:_.localState,mode:_.localMode}:{state:_,mode:W}},indent:function(_,M,G){return _.block==D&&H.indent?H.indent(_.htmlState,M,G):_.localState&&_.localMode.indent?_.localMode.indent(_.localState,M,G):J.Pass},blankLine:g,getType:h,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),J.defineMIME("text/markdown","markdown"),J.defineMIME("text/x-markdown","markdown")})},nVVt:function(Ze,Ke){Ze.exports={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3}},nojB:function(Ze,Ke,te){"use strict";te.r(Ke);var J=te("T2oS"),K=te("W9HT"),L=te("9og8"),H=te("tJVT"),I=te("k1fw"),O=te("WmNS"),B=te.n(O),N=te("cDcd"),R=te.n(N),A=te("X0ci"),f=te("iIVh"),v=te("Ty5D"),P=te("55Ip"),w=te("+L6B"),b=te("2/Rp"),E=te("5NDa"),l=te("5rEg"),o=te("2qtc"),s=te("kLXV"),d=te("miYZ"),C=te("tsqr"),g=te("PpiC"),m=te("y8nQ"),D=te("Vl3Y"),T=te("DZo9"),h=te("8z0m"),c=te("sRBo"),u=te("kaz8"),a=te("LtfV"),x=te("m3rI"),y=te("Ot1p"),p=u.a.Group,k=h.a.Dragger;function F(Z,ne){var be=new FileReader;be.addEventListener("load",function(){return ne(be.result)}),be.readAsDataURL(Z)}var U=function(Z){var ne=Z.callback,be=Z.tags,me=be===void 0?[]:be,pe=Z.initialValues,ue=pe===void 0?{}:pe,fe=Z.removeAttachment,ie=Object(N.useState)(""),he=Object(H.a)(ie,2),$=he[0],ae=he[1],ee=D.a.useForm(),Ee=Object(H.a)(ee,1),Ce=Ee[0];function ve(Re){var Ae=Re.cover_id,Ue=Re.attachment_ids,Ye=Object(g.a)(Re,["cover_id","attachment_ids"]);ne(Object(I.a)(Object(I.a)({},Ye),{},{cover_id:Ae==null?void 0:Ae.map(function(Ge){return Ge.response?Ge.response.id:Ge.uid})[(Ae==null?void 0:Ae.length)-1],attachment_ids:Ue?Ue==null?void 0:Ue.map(function(Ge){return Ge.response?Ge.response.id:Ge.uid}):[]}))}function Se(Re){return Array.isArray(Re)?Re:Re&&Re.fileList}var De={multiple:!0,beforeUpload:function(Ae){var Ue=Ae.size/1024/1024<100;if(!Ue)return C.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(100MB),\u5EFA\u8BAE\u4E0A\u4F20\u5230\u767E\u5EA6\u4E91\u7B49\u5176\u5B83\u5171\u4EAB\u5DE5\u5177\u91CC\uFF0C\u7136\u540E\u518Dtxt\u6587\u6863\u91CC\u7ED9\u51FA\u94FE\u63A5\u4EE5\u53CA\u5171\u4EAB\u5BC6\u7801\u5E76\u4E0A\u4F20"),Ue},action:"".concat(x.a.API_SERVER,"/api/attachments.json"),onRemove:function(Ae){s.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:"\u662F\u5426\u786E\u8BA4\u5220\u9664?",onOk:function(){return fe(Ae.response?Ae.response.id:Ae.uid)},onCancel:function(){return!1}})}};function _e(Re){Re.file.status==="done"&&F(Re.file.originFileObj,function(Ae){return ae(Ae)})}var ke={showUploadList:!1,withCredentials:!0,action:"".concat(x.a.API_SERVER,"/api/attachments.json"),onChange:_e};return Object(N.useEffect)(function(){ue.title&&(Ce.setFieldsValue(ue),ue.cover_id.length>0&&ae(x.a.IMG_SERVER+ue.cover_id[0].url))},[ue]),R.a.createElement(D.a,{form:Ce,initialValues:ue,className:"moop-panel",onFinish:ve},R.a.createElement(D.a.Item,{label:"\u6807\u9898",name:"title",extra:R.a.createElement("p",{className:"tip"},"\u7B80\u660E\u627C\u8981\u4ECB\u7ECD\u6587\u6863/\u89C6\u9891\u6240\u5305\u542B\u7684\u4E3B\u8981\u7684\u5185\u5BB9"),rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},R.a.createElement(l.a,{placeholder:"\u4F8B\u5982\uFF1A\u8F6F\u4EF6\u5DE5\u7A0B\u6559\u5B66\u6848\u4F8B"})),R.a.createElement("div",{className:"flex-container"},R.a.createElement(D.a.Item,{label:"\u4F5C\u8005",name:"author_name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u8005\u540D\u79F0"}]},R.a.createElement(l.a,{placeholder:"\u8BF7\u8F93\u5165\u59D3\u540D",style:{marginRight:20,width:200}})),R.a.createElement(D.a.Item,{name:"author_school_name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u8005\u5355\u4F4D\u540D\u79F0"}]},R.a.createElement(l.a,{placeholder:"\u8BF7\u8F93\u5165\u4F5C\u8005\u5355\u4F4D\u540D\u79F0",style:{width:200}}))),R.a.createElement(D.a.Item,{name:"tag_ids",label:"\u6807\u7B7E",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u4E00\u4E2A\u6807\u7B7E"}]},R.a.createElement(p,null,me.map(function(Re){return R.a.createElement(u.a,{key:Re.id,value:Re.id}," ",Re.name," ")}))),R.a.createElement(D.a.Item,{name:"publish",valuePropName:"checked"},R.a.createElement(u.a,null,"\u662F\u5426\u7533\u8BF7\u53D1\u5E03")),R.a.createElement(D.a.Item,{name:"content",label:"\u63CF\u8FF0",valuePropName:"defaultValue",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u63CF\u8FF0\u5185\u5BB9"}]},R.a.createElement(y.a,{id:"moop_cases_content",height:400})),R.a.createElement(D.a.Item,{name:"attachment_ids",valuePropName:"fileList",getValueFromEvent:Se},R.a.createElement(k,De,R.a.createElement("p",{className:"c-blue",style:{marginBottom:10,fontSize:18}},"\u4E0A\u4F20\u9644\u4EF6"),R.a.createElement("p",{className:"c-grey-c"},"\u4ECE\u6211\u7684\u7535\u8111\u9009\u62E9\u8981\u4E0A\u4F20\u7684\u6587\u6863\uFF1A\u6309\u4F4FCTRL\u53EF\u4EE5\u4E0A\u4F20\u591A\u4EFD\u6587\u6863\u3002\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\uFF1A100MB"))),R.a.createElement(D.a.Item,{name:"cover_id",label:"\u5C01\u9762\u56FE",extra:"\u4E0A\u4F20\u5C3A\u5BF8\uFF1A120*90 px",getValueFromEvent:Se,valuePropName:"fileList",rules:[{required:!0,message:"\u8BF7\u4E0A\u4F20\u5C01\u9762\u56FE"}]},R.a.createElement(h.a,ke,$?R.a.createElement("img",{src:$,width:120}):R.a.createElement("a",{title:"\u4E0A\u4F20\u5C01\u9762\u56FE",className:"upload-cover"}," ",R.a.createElement(a.a,null)," "))),R.a.createElement("div",{className:"desc"},R.a.createElement("h3",null,"\u5BA1\u6838\u8BF4\u660E"),R.a.createElement("p",null," \u5E73\u53F0\u7BA1\u7406\u5458\u5C06\u5BF9\u6BCF\u5929\u65B0\u4E0A\u4F20\u7684\u6587\u6863\u8FDB\u884C\u5BA1\u6838\uFF0C\u5BA1\u6838\u901A\u8FC7\u7684\u6587\u6863\u5C06\u516C\u5F00\u663E\u793A\uFF0C\u5426\u5219\u5C06\u79C1\u6709\u5316\u6216\u79FB\u9664 ")),R.a.createElement("div",{className:"desc"},R.a.createElement("h3",null,"\u6E29\u99A8\u63D0\u793A"),R.a.createElement("ul",{style:{padding:0}},R.a.createElement("li",null,"1.\u8BF7\u52FF\u4E0A\u4F20\u5DF2\u8BBE\u7F6E\u52A0\u5BC6\u53E3\u4EE4\u7684\u6587\u6863\u8D44\u6E90\uFF1B"),R.a.createElement("li",null,"2.\u53EF\u4EE5\u4E0A\u4F20\u7B26\u5408\u6559\u5B66\u6848\u4F8B\u6807\u51C6\u7684\u6587\u6863\u8D44\u6599\uFF0C\u5982",R.a.createElement("a",{href:"https://www.educoder.net/courses/1309/boards/5909/messages/34799",target:"_blank"}," \u6848\u4F8B\u5165\u5E93\u6807\u51C6 ")," \u3001",R.a.createElement("a",{href:"https://www.educoder.net/courses/1309/boards/5909/messages/34798",target:"_blank"},"\u6848\u4F8B\u4F7F\u7528\u8BF4\u660E\u4E66"),"\u4EE5\u53CA\u5176\u4ED6\u8D44\u6599\u7B49\uFF0C\u4E0A\u4F20\u652F\u6301\u7684\u6587\u4EF6\u6700\u5927\u5BB9\u91CF\uFF1A100MB\uFF1B"),R.a.createElement("li",null,"3.\u8BF7\u786E\u4FDD\u4E0A\u4F20\u5185\u5BB9\u65E0\u4FB5\u6743\u6216\u8FDD\u53CD\u56FD\u5BB6\u5173\u4E8E\u4E92\u8054\u7F51\u653F\u7B56\u7684\u4E0D\u826F\u884C\u4E3A\uFF1B"),R.a.createElement("li",null,"4.\u8BF7\u4F7F\u7528Chrome\uFF0CFirefox\uFF0CSafari\uFF0CIE11\uFF08\u53CA\u4EE5\u4E0A\u7248\u672C\uFF09\u6D4F\u89C8\u5668\uFF1B"))),R.a.createElement(D.a.Item,{style:{marginTop:10}},R.a.createElement(b.a,{type:"primary",htmlType:"submit"},"\u63D0\u4EA4")))},W=te("wzkS"),_={loading:!1,data:{},tags:[]},M;(function(Z){Z[Z.GET_DATA=0]="GET_DATA",Z[Z.SET_LOADING=1]="SET_LOADING",Z[Z.GET_TAGS=2]="GET_TAGS"})(M||(M={}));function G(Z,ne){switch(ne.type){case M.GET_DATA:return Object(I.a)(Object(I.a)({},Z),ne.payload);case M.GET_TAGS:return Object(I.a)(Object(I.a)({},Z),{},{tags:ne.payload});case M.SET_LOADING:return Object(I.a)(Object(I.a)({},Z),{},{loading:ne.payload});default:throw new Error}}var Y=Ke.default=function(){var Z=Object(v.i)(),ne=Z.caseId,be=Object(v.g)(),me=Object(N.useReducer)(G,_),pe=Object(H.a)(me,2),ue=pe[0],fe=pe[1],ie=ue.loading,he=ue.tags,$=ue.data;Object(N.useEffect)(function(){function Ce(){return ve.apply(this,arguments)}function ve(){return ve=Object(L.a)(B.a.mark(function Se(){var De;return B.a.wrap(function(ke){for(;;)switch(ke.prev=ke.next){case 0:return ke.next=2,Object(W.b)();case 2:De=ke.sent,fe({type:M.GET_TAGS,payload:De.library_tags});case 4:case"end":return ke.stop()}},Se)})),ve.apply(this,arguments)}Ce()},[]),Object(N.useEffect)(function(){var Ce=!1;function ve(){return Se.apply(this,arguments)}function Se(){return Se=Object(L.a)(B.a.mark(function De(){var _e,ke,Re,Ae,Ue,Ye,Ge,He,et;return B.a.wrap(function(Xe){for(;;)switch(Xe.prev=Xe.next){case 0:return fe({type:M.SET_LOADING,payload:!1}),Xe.next=3,Object(W.c)(ne);case 3:_e=Xe.sent,ke=_e.author_name,Re=_e.author_school_name,Ae=_e.content,Ue=_e.cover,Ye=_e.attachments,Ge=_e.status,He=_e.title,et=_e.tags,Ce||(_e.status===404?be.push("/moop_cases"):fe({type:M.GET_DATA,payload:{data:{title:He,author_name:ke,author_school_name:Re,content:Ae,tag_ids:et.map(function(we){return we.id}),publish:Ge==="published",attachment_ids:Ye.map(function(we){return{uid:we.id,id:we.id,name:we.title,url:we.url,filesize:we.filesize,status:"done"}}),cover_id:Ue!=null&&Ue.id?[{uid:Ue==null?void 0:Ue.id,id:Ue==null?void 0:Ue.id,name:Ue==null?void 0:Ue.title,url:Ue==null?void 0:Ue.url,filesize:Ue==null?void 0:Ue.filesize,status:"done"}]:[]},loading:!1}}));case 6:case"end":return Xe.stop()}},De)})),Se.apply(this,arguments)}return!Ce&&ne&&ve(),function(){Ce=!0}},[ne]);function ae(Ce){return ee.apply(this,arguments)}function ee(){return ee=Object(L.a)(B.a.mark(function Ce(ve){var Se,De;return B.a.wrap(function(ke){for(;;)switch(ke.prev=ke.next){case 0:if(!ne){ke.next=6;break}return ke.next=3,Object(W.e)(ne,ve);case 3:be.push("/moop_cases/".concat(ne,"/publish-success")),ke.next=11;break;case 6:return ke.next=8,Object(W.a)(ve);case 8:Se=ke.sent,De=Se.id,De&&be.push("/moop_cases/".concat(De,"/publish-success"));case 11:case"end":return ke.stop()}},Ce)})),ee.apply(this,arguments)}var Ee={initialValues:$,tags:he,removeAttachment:W.d,callback:ae};return R.a.createElement(K.a,{spinning:ie,delay:500},R.a.createElement("div",{className:"moop-info"},R.a.createElement("div",{className:"crumb"},R.a.createElement(P.a,{to:"/moop_cases"},"\u6559\u5B66\u6848\u4F8B > "),R.a.createElement("span",null,"\u65B0\u5EFA")),R.a.createElement("div",{className:"title"},R.a.createElement("h2",null,"\u4E0A\u4F20\u6559\u5B66\u6848\u4F8B"),R.a.createElement(P.a,{to:"/moop_cases"},"\u8FD4\u56DE")),R.a.createElement(U,Ee)))}},osHv:function(Ze,Ke,te){(function(J){J(te("VrN/"))})(function(J){"use strict";var K=J.Pos;function L(l,o){return l.line-o.line||l.ch-o.ch}var H="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",I=H+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",O=new RegExp("<(/?)(["+H+"]["+I+"]*)","g");function B(l,o,s,d){this.line=o,this.ch=s,this.cm=l,this.text=l.getLine(o),this.min=d?Math.max(d.from,l.firstLine()):l.firstLine(),this.max=d?Math.min(d.to-1,l.lastLine()):l.lastLine()}function N(l,o){var s=l.cm.getTokenTypeAt(K(l.line,o));return s&&/\btag\b/.test(s)}function R(l){return l.line>=l.max?void 0:(l.ch=0,l.text=l.cm.getLine(++l.line),!0)}function A(l){return l.line<=l.min?void 0:(l.text=l.cm.getLine(--l.line),l.ch=l.text.length,!0)}function f(l){for(;;){var o=l.text.indexOf(">",l.ch);if(o==-1){if(R(l))continue;return}if(!N(l,o+1)){l.ch=o+1;continue}var s=l.text.lastIndexOf("/",o),d=s>-1&&!/\S/.test(l.text.slice(s+1,o));return l.ch=o+1,d?"selfClose":"regular"}}function v(l){for(;;){var o=l.ch?l.text.lastIndexOf("<",l.ch-1):-1;if(o==-1){if(A(l))continue;return}if(!N(l,o+1)){l.ch=o;continue}O.lastIndex=o,l.ch=o;var s=O.exec(l.text);if(s&&s.index==o)return s}}function P(l){for(;;){O.lastIndex=l.ch;var o=O.exec(l.text);if(!o){if(R(l))continue;return}if(!N(l,o.index+1)){l.ch=o.index+1;continue}return l.ch=o.index+o[0].length,o}}function w(l){for(;;){var o=l.ch?l.text.lastIndexOf(">",l.ch-1):-1;if(o==-1){if(A(l))continue;return}if(!N(l,o+1)){l.ch=o;continue}var s=l.text.lastIndexOf("/",o),d=s>-1&&!/\S/.test(l.text.slice(s+1,o));return l.ch=o+1,d?"selfClose":"regular"}}function b(l,o){for(var s=[];;){var d=P(l),C,g=l.line,m=l.ch-(d?d[0].length:0);if(!d||!(C=f(l)))return;if(C=="selfClose")continue;if(d[1]){for(var D=s.length-1;D>=0;--D)if(s[D]==d[2]){s.length=D;break}if(D<0&&(!o||o==d[2]))return{tag:d[2],from:K(g,m),to:K(l.line,l.ch)}}else s.push(d[2])}}function E(l,o){for(var s=[];;){var d=w(l);if(!d)return;if(d=="selfClose"){v(l);continue}var C=l.line,g=l.ch,m=v(l);if(!m)return;if(m[1])s.push(m[2]);else{for(var D=s.length-1;D>=0;--D)if(s[D]==m[2]){s.length=D;break}if(D<0&&(!o||o==m[2]))return{tag:m[2],from:K(l.line,l.ch),to:K(C,g)}}}}J.registerHelper("fold","xml",function(l,o){for(var s=new B(l,o.line,0);;){var d=P(s);if(!d||s.line!=o.line)return;var C=f(s);if(!C)return;if(!d[1]&&C!="selfClose"){var g=K(s.line,s.ch),m=b(s,d[2]);return m&&L(m.from,g)>0?{from:g,to:m.from}:null}}}),J.findMatchingTag=function(l,o,s){var d=new B(l,o.line,o.ch,s);if(d.text.indexOf(">")==-1&&d.text.indexOf("<")==-1)return;var C=f(d),g=C&&K(d.line,d.ch),m=C&&v(d);if(!C||!m||L(d,o)>0)return;var D={from:K(d.line,d.ch),to:g,tag:m[2]};return C=="selfClose"?{open:D,close:null,at:"open"}:m[1]?{open:E(d,m[2]),close:D,at:"close"}:(d=new B(l,g.line,g.ch,s),{open:D,close:b(d,m[2]),at:"open"})},J.findEnclosingTag=function(l,o,s,d){for(var C=new B(l,o.line,o.ch,s);;){var g=E(C,d);if(!g)break;var m=new B(l,o.line,o.ch,s),D=b(m,g.tag);if(D)return{open:g,close:D}}},J.scanForClosingTag=function(l,o,s,d){var C=new B(l,o.line,o.ch,d?{from:0,to:d}:null);return b(C,s)}})},"p77/":function(Ze,Ke,te){},rUJ1:function(Ze,Ke){const te=/[&<>"']/,J=/[&<>"']/g,K=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,H={"&":"&","<":"<",">":">",'"':""","'":"'"},I=T=>H[T];function O(T,h){if(h){if(te.test(T))return T.replace(J,I)}else if(K.test(T))return T.replace(L,I);return T}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function N(T){return T.replace(B,(h,c)=>(c=c.toLowerCase(),c==="colon"?":":c.charAt(0)==="#"?c.charAt(1)==="x"?String.fromCharCode(parseInt(c.substring(2),16)):String.fromCharCode(+c.substring(1)):""))}const R=/(^|[^\[])\^/g;function A(T,h){T=T.source||T,h=h||"";const c={replace:(u,a)=>(a=a.source||a,a=a.replace(R,"$1"),T=T.replace(u,a),c),getRegex:()=>new RegExp(T,h)};return c}const f=/[^\w:]/g,v=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function P(T,h,c){if(T){let u;try{u=decodeURIComponent(N(c)).replace(f,"").toLowerCase()}catch(a){return null}if(u.indexOf("javascript:")===0||u.indexOf("vbscript:")===0||u.indexOf("data:")===0)return null}h&&!v.test(c)&&(c=o(h,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(u){return null}return c}const w={},b=/^[^:]+:\/*[^/]*$/,E=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(T,h){w[" "+T]||(b.test(T)?w[" "+T]=T+"/":w[" "+T]=g(T,"/",!0)),T=w[" "+T];const c=T.indexOf(":")===-1;return h.substring(0,2)==="//"?c?h:T.replace(E,"$1")+h:h.charAt(0)==="/"?c?h:T.replace(l,"$1")+h:T+h}const s={exec:function(){}};function d(T){let h=1,c,u;for(;h{let k=!1,F=y;for(;--F>=0&&p[F]==="\\";)k=!k;return k?"|":" |"}),u=c.split(/ \|/);let a=0;if(u.length>h)u.splice(h);else for(;u.length0},!1)}function f(v,P){for(var w={main:[P]},b={main:[]},E={main:{}};A(w);)for(var l=Object.keys(w),o=0;o=2*D/h||p<=F)return;var U=Number.POSITIVE_INFINITY,W;for(W=l.level-1;W>u;W--){var _=c[W].maxBitrate;if(U=D*_/(8*.8*y),U=p)return;var M=this.bwEstimator.getEstimate();A.logger.warn("Fragment "+l.sn+(o?" part "+o.index:"")+" of level "+l.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+` Current BW estimate: `+(Object(H.isFiniteNumber)(M)?(M/1024).toFixed(3):"Unknown")+` Kb/s Estimated load time for current fragment: `+p.toFixed(3)+` s Estimated load time for the next fragment: `+U.toFixed(3)+` s Time to underbuffer: `+F.toFixed(3)+" s"),s.nextLoadLevel=W,this.bwEstimator.sample(T,m.loaded),this.clearTimer(),l.loader&&(this.fragCurrent=this.partCurrent=null,l.loader.abort()),s.trigger(O.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:l,part:o,stats:m})},b.onFragLoaded=function(l,o){var s=o.frag,d=o.part;if(s.type===R.PlaylistLevelType.MAIN&&Object(H.isFiniteNumber)(s.sn)){var C=d?d.stats:s.stats,g=d?d.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var m=this.hls.levels[s.level],D=(m.loaded?m.loaded.bytes:0)+C.loaded,T=(m.loaded?m.loaded.duration:0)+g;m.loaded={bytes:D,duration:T},m.realBitrate=Math.round(8*D/T)}if(s.bitrateTest){var h={stats:C,frag:s,part:d,id:s.type};this.onFragBuffered(O.Events.FRAG_BUFFERED,h),s.bitrateTest=!1}}},b.onFragBuffered=function(l,o){var s=o.frag,d=o.part,C=d?d.stats:s.stats;if(C.aborted)return;if(s.type!==R.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var g=C.parsing.end-C.loading.start;this.bwEstimator.sample(g,C.loaded),C.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=g/1e3:this.bitrateTestDelay=0},b.onError=function(l,o){switch(o.details){case N.ErrorDetails.FRAG_LOAD_ERROR:case N.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},b.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},b.getNextABRAutoLevel=function(){var l=this.fragCurrent,o=this.partCurrent,s=this.hls,d=s.maxAutoLevel,C=s.config,g=s.minAutoLevel,m=s.media,D=o?o.duration:l?l.duration:0,T=m?m.currentTime:0,h=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():C.abrEwmaDefaultEstimate,u=(B.BufferHelper.bufferInfo(m,T,C.maxBufferHole).end-T)/h,a=this.findBestLevel(c,g,d,u,C.abrBandWidthFactor,C.abrBandWidthUpFactor);if(a>=0)return a;A.logger.trace((u?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var x=D?Math.min(D,C.maxStarvationDelay):C.maxStarvationDelay,y=C.abrBandWidthFactor,p=C.abrBandWidthUpFactor;if(!u){var k=this.bitrateTestDelay;if(k){var F=D?Math.min(D,C.maxLoadingDelay):C.maxLoadingDelay;x=F-k,A.logger.trace("bitrate test took "+Math.round(1e3*k)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*x)+" ms"),y=p=1}}return a=this.findBestLevel(c,g,d,u+x,y,p),Math.max(a,0)},b.findBestLevel=function(l,o,s,d,C,g){for(var m,D=this.fragCurrent,T=this.partCurrent,h=this.lastLoadedFragLevel,c=this.hls.levels,u=c[h],a=!!(u!=null&&(m=u.details)!==null&&m!==void 0&&m.live),x=u==null?void 0:u.codecSet,y=T?T.duration:D?D.duration:0,p=s;p>=o;p--){var k=c[p];if(!k||x&&k.codecSet!==x)continue;var F=k.details,U=(T?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||y,W=void 0;p<=h?W=C*l:W=g*l;var _=c[p].maxBitrate,M=_*U/W;if(A.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+p+"/"+Math.round(W)+"/"+_+"/"+U+"/"+d+"/"+M),W>_&&(!M||a&&!this.bitrateTestDelay||M0&&u===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=I.State.IDLE):(this.loadedmetadata=!1,this.state=I.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=u,this.tick()},h.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_TRACK:{var u,a=this.levels,x=this.trackId,y=a==null||((u=a[x])===null||u===void 0)?void 0:u.details;if(y){if(this.waitForCdnTuneIn(y))break;this.state=I.State.WAITING_INIT_PTS}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var p,k=performance.now(),F=this.retryDate;(!F||k>=F||(p=this.media)!==null&&p!==void 0&&p.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=I.State.IDLE);break}case I.State.WAITING_INIT_PTS:{var U=this.waitingData;if(U){var W=U.frag,_=U.part,M=U.cache,G=U.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.FRAG_LOADING;var Y=M.flush(),Z={frag:W,part:_,payload:Y,networkDetails:null};this._handleFragmentLoadProgress(Z),G&&D.prototype._handleFragmentLoadComplete.call(this,Z)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+W.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ne=this.getLoadPosition(),be=B.BufferHelper.bufferInfo(this.mediaBuffer,ne,this.config.maxBufferHole),me=Object(b.fragmentWithinToleranceTest)(be.end,this.config.maxFragLookUpTolerance,W);me<0&&(o.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+be.end+" is needed"),this.clearWaitingFragment())}}else this.state=I.State.IDLE}}this.onTickEnd()},h.clearWaitingFragment=function(){var u=this.waitingData;u&&(this.fragmentTracker.removeFragment(u.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.IDLE)},h.onTickEnd=function(){var u=this.media;if(!u||!u.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:u,x=a.buffered;!this.loadedmetadata&&x.length&&(this.loadedmetadata=!0),this.lastCurrentTime=u.currentTime},h.doTickIdle=function(){var u,a,x=this.hls,y=this.levels,p=this.media,k=this.trackId,F=x.config;if(!y||!y[k])return;if(!p&&(this.startFragRequested||!F.startFragPrefetch))return;var U=y[k],W=U.details;if(!W||W.live&&this.levelLastLoaded!==k||this.waitForCdnTuneIn(W)){this.state=I.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,f.ElementaryStreamTypes.AUDIO,A.PlaylistLevelType.AUDIO));var _=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,A.PlaylistLevelType.AUDIO);if(_===null)return;var M=_.len,G=this.getMaxBufferLength(),Y=this.audioSwitch;if(M>=G&&!Y)return;if(!Y&&this._streamEnded(_,W)){x.trigger(O.Events.BUFFER_EOS,{type:"audio"}),this.state=I.State.ENDED;return}var Z=W.fragments,ne=Z[0].start,be=_.end;if(Y){var me=this.getLoadPosition();be=me,W.PTSKnown&&mene||_.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),p.currentTime=ne+.05))}var pe=this.getNextFragment(be,W);if(!pe){this.bufferFlushed=!0;return}((u=pe.decryptdata)===null||u===void 0?void 0:u.keyFormat)==="identity"&&!((a=pe.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(pe,W):this.loadFragment(pe,W,be)},h.getMaxBufferLength=function(){var u=D.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,A.PlaylistLevelType.MAIN);return a===null?u:Math.max(u,a.len)},h.onMediaDetaching=function(){this.videoBuffer=null,D.prototype.onMediaDetaching.call(this)},h.onAudioTracksUpdated=function(u,a){var x=a.audioTracks;this.resetTransmuxer(),this.levels=x.map(function(y){return new R.Level(y)})},h.onAudioTrackSwitching=function(u,a){var x=!!a.url;this.trackId=a.id;var y=this.fragCurrent;y!=null&&y.loader&&y.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),x?this.setInterval(g):this.resetTransmuxer(),x?(this.audioSwitch=!0,this.state=I.State.IDLE):this.state=I.State.STOPPED,this.tick()},h.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},h.onLevelLoaded=function(u,a){this.mainDetails=a.details},h.onAudioTrackLoaded=function(u,a){var x,y=this.levels,p=a.details,k=a.id;if(!y){this.warn("Audio tracks were reset while loading level "+k);return}this.log("Track "+k+" loaded ["+p.startSN+","+p.endSN+"],duration:"+p.totalduration);var F=y[k],U=0;if(p.live||(x=F.details)!==null&&x!==void 0&&x.live){var W=this.mainDetails;if(p.fragments[0]||(p.deltaUpdateFailed=!0),p.deltaUpdateFailed||!W)return;!F.details&&p.hasProgramDateTime&&W.hasProgramDateTime?(Object(E.alignMediaPlaylistByPDT)(p,W),U=p.fragments[0].start):U=this.alignPlaylists(p,F.details)}F.details=p,this.levelLastLoaded=k,!this.startFragRequested&&(this.mainDetails||!p.live)&&this.setStartPosition(F.details,U),this.state===I.State.WAITING_TRACK&&!this.waitForCdnTuneIn(p)&&(this.state=I.State.IDLE),this.tick()},h._handleFragmentLoadProgress=function(u){var a,x=u.frag,y=u.part,p=u.payload,k=this.config,F=this.trackId,U=this.levels;if(!U){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+x.sn+" of level "+x.level+" will not be buffered");return}var W=U[F];console.assert(W,"Audio track is defined on fragment load progress");var _=W.details;console.assert(_,"Audio track details are defined on fragment load progress");var M=k.defaultAudioCodec||W.audioCodec||"mp4a.40.2",G=this.transmuxer;G||(G=this.transmuxer=new P.default(this.hls,A.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Y=this.initPTS[x.cc],Z=(a=x.initSegment)===null||a===void 0?void 0:a.data;if(Y!==void 0){var ne=!1,be=y?y.index:-1,me=be!==-1,pe=new w.ChunkMetadata(x.level,x.sn,x.stats.chunkCount,p.byteLength,be,me);G.push(p,Z,M,"",x,y,_.totalduration,ne,pe,Y)}else{o.logger.log("Unknown video PTS for cc "+x.cc+", waiting for video PTS before demuxing audio frag "+x.sn+" of ["+_.startSN+" ,"+_.endSN+"],track "+F);var ue=this.waitingData=this.waitingData||{frag:x,part:y,cache:new v.default,complete:!1},fe=ue.cache;fe.push(new Uint8Array(p)),this.waitingVideoCC=this.videoTrackCC,this.state=I.State.WAITING_INIT_PTS}},h._handleFragmentLoadComplete=function(u){if(this.waitingData){this.waitingData.complete=!0;return}D.prototype._handleFragmentLoadComplete.call(this,u)},h.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},h.onBufferCreated=function(u,a){var x=a.tracks.audio;x&&(this.mediaBuffer=x.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},h.onFragBuffered=function(u,a){var x=a.frag,y=a.part;if(x.type!==A.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(x)){this.warn("Fragment "+x.sn+(y?" p: "+y.index:"")+" of level "+x.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}x.sn!=="initSegment"&&(this.fragPrevious=x,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(x,y)},h.onError=function(u,a){switch(a.details){case l.ErrorDetails.FRAG_LOAD_ERROR:case l.ErrorDetails.FRAG_LOAD_TIMEOUT:case l.ErrorDetails.KEY_LOAD_ERROR:case l.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.AUDIO,a);break;case l.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case l.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==I.State.ERROR&&this.state!==I.State.STOPPED&&(this.state=a.fatal?I.State.ERROR:I.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case l.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var x=!0,y=this.getFwdBufferInfo(this.mediaBuffer,A.PlaylistLevelType.AUDIO);y&&y.len>.5&&(x=!this.reduceMaxBufferLength(y.len)),x&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},h.onBufferFlushed=function(u,a){var x=a.type;x===f.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(u){var a,x="audio",y=this.hls,p=u.remuxResult,k=u.chunkMeta,F=this.getCurrentContext(k);if(!F){this.warn("The loading context changed while buffering fragment "+k.sn+" of level "+k.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(k.level);return}var U=F.frag,W=F.part,_=p.audio,M=p.text,G=p.id3,Y=p.initSegment;if(this.fragContextChanged(U))return;if(this.state=I.State.PARSING,this.audioSwitch&&_&&this.completeAudioSwitch(),Y!=null&&Y.tracks&&(this._bufferInitSegment(Y.tracks,U,k),y.trigger(O.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:x,tracks:Y.tracks})),_){var Z=_.startPTS,ne=_.endPTS,be=_.startDTS,me=_.endDTS;W&&(W.elementaryStreams[f.ElementaryStreamTypes.AUDIO]={startPTS:Z,endPTS:ne,startDTS:be,endDTS:me}),U.setElementaryStreamInfo(f.ElementaryStreamTypes.AUDIO,Z,ne,be,me),this.bufferFragmentData(_,U,W,k)}if(G!=null&&(a=G.samples)!==null&&a!==void 0&&a.length){var pe=s({frag:U,id:x},G);y.trigger(O.Events.FRAG_PARSING_METADATA,pe)}if(M){var ue=s({frag:U,id:x},M);y.trigger(O.Events.FRAG_PARSING_USERDATA,ue)}},h._bufferInitSegment=function(u,a,x){if(this.state!==I.State.PARSING)return;u.video&&delete u.video;var y=u.audio;if(!y)return;y.levelCodec=y.codec,y.id="audio",this.log("Init audio buffer, container:"+y.container+", codecs[parsed]=["+y.codec+"]"),this.hls.trigger(O.Events.BUFFER_CODECS,u);var p=y.initSegment;if(p!=null&&p.byteLength){var k={type:"audio",frag:a,part:null,chunkMeta:x,parent:a.type,data:p};this.hls.trigger(O.Events.BUFFER_APPENDING,k)}this.tick()},h.loadFragment=function(u,a,x){var y=this.fragmentTracker.getState(u);this.fragCurrent=u,(this.audioSwitch||y===N.FragmentState.NOT_LOADED||y===N.FragmentState.PARTIAL)&&(u.sn==="initSegment"?this._loadInitSegment(u):a.live&&!Object(H.isFiniteNumber)(this.initPTS[u.cc])?(this.log("Waiting for video PTS in continuity counter "+u.cc+" of live stream before loading audio fragment "+u.sn+" of level "+this.trackId),this.state=I.State.WAITING_INIT_PTS):(this.startFragRequested=!0,D.prototype.loadFragment.call(this,u,a,x)))},h.completeAudioSwitch=function(){var u=this.hls,a=this.media,x=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,u.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:x})},T}(I.default);K.default=m},"./src/controller/audio-track-controller.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/events.ts"),I=L("./src/errors.ts"),O=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function N(P,w){for(var b=0;b=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=o[this.trackId];this.log("Now switching to audio-track index "+l);var d=o[l],C=d.id,g=d.groupId,m=g===void 0?"":g,D=d.name,T=d.type,h=d.url;if(this.trackId=l,this.trackName=D,this.selectDefaultTrack=!1,this.hls.trigger(H.Events.AUDIO_TRACK_SWITCHING,{id:C,groupId:m,name:D,type:T,url:h}),d.details&&!d.details.live)return;var c=this.switchParams(d.url,s==null?void 0:s.details);this.loadPlaylist(c)},b.selectInitialTrack=function(){var l=this.tracksInGroup;console.assert(l.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,s=this.findTrackId(o)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},b.findTrackId=function(l){for(var o=this.tracksInGroup,s=0;sw.partTarget&&(d+=1)}if(Object(H.isFiniteNumber)(s))return new I.HlsUrlParameters(s,Object(H.isFiniteNumber)(d)?d:void 0,I.HlsSkip.No)}}},f.loadPlaylist=function(P){},f.shouldLoadTrack=function(P){return this.canLoad&&P&&!!P.url&&(!P.details||P.details.live)},f.playlistLoaded=function(P,w,b){var E=this,l=w.details,o=w.stats,s=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(l.advancedDateTime=Date.now()-s,l.live||b!=null&&b.live){if(l.reloaded(b),b&&this.log("live playlist "+P+" "+(l.advanced?"REFRESHED "+l.lastPartSn+"-"+l.lastPartIndex:"MISSED")),b&&l.fragments.length>0&&Object(O.mergeDetails)(b,l),!this.canLoad||!l.live)return;var d,C=void 0,g=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var m=this.hls.config.lowLatencyMode,D=l.lastPartSn,T=l.endSN,h=l.lastPartIndex,c=h!==-1,u=D===T,a=m?0:h;c?(C=u?T+1:D,g=u?a:h+1):C=T+1;var x=l.age,y=x+l.ageHeader,p=Math.min(y-l.partTarget,l.targetduration*1.5);if(p>0){if(b&&p>b.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+b.tuneInGoal+" to: "+p+" with playlist age: "+l.age),p=0;else{var k=Math.floor(p/l.targetduration);if(C+=k,g!==void 0){var F=Math.round(p%l.targetduration/l.partTarget);g+=F}this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+x.toFixed(2)+"s goal: "+p+" skip sn "+k+" to part "+g)}l.tuneInGoal=p}if(d=this.getDeliveryDirectives(l,w.deliveryDirectives,C,g),m||!u){this.loadPlaylist(d);return}}else d=this.getDeliveryDirectives(l,w.deliveryDirectives,C,g);var U=Object(O.computeReloadInterval)(l,o);C!==void 0&&l.canBlockReload&&(U-=l.partTarget||1),this.log("reload live playlist "+P+" in "+Math.round(U)+" ms"),this.timer=self.setTimeout(function(){return E.loadPlaylist(d)},U)}else this.clearTimer()},f.getDeliveryDirectives=function(P,w,b,E){var l=Object(I.getSkipValue)(P,b);return w!=null&&w.skip&&P.deltaUpdateFailed&&(b=w.msn,E=w.part,l=I.HlsSkip.No),new I.HlsUrlParameters(b,E,l)},f.retryLoadingOrFail=function(P){var w=this,b=this.hls.config,E=this.retryCount-1&&(l=P.context)!==null&&l!==void 0&&l.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+P.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*b.levelLoadingRetryDelay,b.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return w.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+P.details+'"')}}else this.warn('cannot recover from error "'+P.details+'"'),this.clearTimer(),P.fatal=!0;return E},A}()},"./src/controller/base-stream-controller.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"State",function(){return T}),L.d(K,"default",function(){return h});var H=L("./src/polyfills/number.ts"),I=L("./src/task-loop.ts"),O=L("./src/controller/fragment-tracker.ts"),B=L("./src/utils/buffer-helper.ts"),N=L("./src/utils/logger.ts"),R=L("./src/events.ts"),A=L("./src/errors.ts"),f=L("./src/types/transmuxer.ts"),v=L("./src/utils/mp4-tools.ts"),P=L("./src/utils/discontinuities.ts"),w=L("./src/controller/fragment-finders.ts"),b=L("./src/controller/level-helper.ts"),E=L("./src/loader/fragment-loader.ts"),l=L("./src/crypt/decrypter.ts"),o=L("./src/utils/time-ranges.ts"),s=L("./src/types/loader.ts");function d(c,u){for(var a=0;aY;(W0&&W&&W.key&&W.iv&&W.method==="AES-128"){var _=self.performance.now();return p.decrypter.webCryptoDecrypt(new Uint8Array(U),W.key.buffer,W.iv.buffer).then(function(M){var G=self.performance.now();return F.trigger(R.Events.FRAG_DECRYPTED,{frag:y,payload:M,stats:{tstart:_,tdecrypt:G}}),k.payload=M,k})}return k}).then(function(k){var F=p.fragCurrent,U=p.hls,W=p.levels;if(!W)throw new Error("init load aborted, missing levels");var _=W[y.level].details;console.assert(_,"Level details are defined when init segment is loaded");var M=y.stats;p.state=T.IDLE,p.fragLoadError=0,y.data=new Uint8Array(k.payload),M.parsing.start=M.buffering.start=self.performance.now(),M.parsing.end=M.buffering.end=self.performance.now(),k.frag===F&&U.trigger(R.Events.FRAG_BUFFERED,{stats:M,frag:F,part:null,id:y.type}),p.tick()}).catch(function(k){p.warn(k),p.resetFragmentLoading(y)})},a.fragContextChanged=function(y){var p=this.fragCurrent;return!y||!p||y.level!==p.level||y.sn!==p.sn||y.urlId!==p.urlId},a.fragBufferedComplete=function(y,p){var k=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+y.type+" sn: "+y.sn+(p?" part: "+p.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level+" "+o.default.toString(B.BufferHelper.getBuffered(k))),this.state=T.IDLE,this.tick()},a._handleFragmentLoadComplete=function(y){var p=this.transmuxer;if(!p)return;var k=y.frag,F=y.part,U=y.partsLoaded,W=!U||U.length===0||U.some(function(M){return!M}),_=new f.ChunkMetadata(k.level,k.sn,k.stats.chunkCount+1,0,F?F.index:-1,!W);p.flush(_)},a._handleFragmentLoadProgress=function(y){},a._doFragLoad=function(y,p,k,F){var U=this;if(k===void 0&&(k=null),!this.levels)throw new Error("frag load aborted, missing levels");if(k=Math.max(y.start,k||0),this.config.lowLatencyMode&&p){var W=p.partList;if(W&&F){k>y.end&&p.fragmentHint&&(y=p.fragmentHint);var _=this.getNextPart(W,y,k);if(_>-1){var M=W[_];return this.log("Loading part sn: "+y.sn+" p: "+M.index+" cc: "+y.cc+" of playlist ["+p.startSN+"-"+p.endSN+"] parts [0-"+_+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(k.toFixed(3))),this.nextLoadPosition=M.start+M.duration,this.state=T.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:y,part:W[_],targetBufferTime:k}),this.doFragPartsLoad(y,W,_,F).catch(function(G){return U.handleFragLoadError(G)})}else if(!y.url||this.loadedEndOfParts(W,k))return Promise.resolve(null)}}return this.log("Loading fragment "+y.sn+" cc: "+y.cc+" "+(p?"of ["+p.startSN+"-"+p.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(k.toFixed(3))),Object(H.isFiniteNumber)(y.sn)&&!this.bitrateTest&&(this.nextLoadPosition=y.start+y.duration),this.state=T.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:y,targetBufferTime:k}),this.fragmentLoader.load(y,F).catch(function(G){return U.handleFragLoadError(G)})},a.doFragPartsLoad=function(y,p,k,F){var U=this;return new Promise(function(W,_){var M=[],G=function Y(Z){var ne=p[Z];U.fragmentLoader.loadPart(y,ne,F).then(function(be){M[ne.index]=be;var me=be.part;U.hls.trigger(R.Events.FRAG_LOADED,be);var pe=p[Z+1];if(pe&&pe.fragment===y)Y(Z+1);else return W({frag:y,part:me,partsLoaded:M})}).catch(_)};G(k)})},a.handleFragLoadError=function(y){var p=y.data;return p&&p.details===A.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(p.frag,p.part):this.hls.trigger(R.Events.ERROR,p),null},a._handleTransmuxerFlush=function(y){var p=this.getCurrentContext(y);if(!p||this.state!==T.PARSING){this.fragCurrent||(this.state=T.IDLE);return}var k=p.frag,F=p.part,U=p.level,W=self.performance.now();k.stats.parsing.end=W,F&&(F.stats.parsing.end=W),this.updateLevelTiming(k,F,U,y.partial)},a.getCurrentContext=function(y){var p=this.levels,k=y.level,F=y.sn,U=y.part;if(!p||!p[k])return this.warn("Levels object was unset while buffering fragment "+F+" of level "+k+". The current chunk will not be buffered."),null;var W=p[k],_=U>-1?Object(b.getPartWith)(W,F,U):null,M=_?_.fragment:Object(b.getFragmentWithSN)(W,F,this.fragCurrent);return M?{frag:M,part:_,level:W}:null},a.bufferFragmentData=function(y,p,k,F){if(!y||this.state!==T.PARSING)return;var U=y.data1,W=y.data2,_=U;if(U&&W&&(_=Object(v.appendUint8Array)(U,W)),!_||!_.length)return;var M={type:y.type,frag:p,part:k,chunkMeta:F,parent:p.type,data:_};this.hls.trigger(R.Events.BUFFER_APPENDING,M),y.dropped&&y.independent&&!k&&this.flushBufferGap(p)},a.flushBufferGap=function(y){var p=this.media;if(!p)return;if(!B.BufferHelper.isBuffered(p,p.currentTime)){this.flushMainBuffer(0,y.start);return}var k=p.currentTime,F=B.BufferHelper.bufferInfo(p,k,0),U=y.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,U*.25),_=Math.max(Math.min(y.start-W,F.end-W),k+W);y.start-_>W&&this.flushMainBuffer(_,y.start)},a.getFwdBufferInfo=function(y,p){var k=this.config,F=this.getLoadPosition();if(!Object(H.isFiniteNumber)(F))return null;var U=B.BufferHelper.bufferInfo(y,F,k.maxBufferHole);if(U.len===0&&U.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(F,p);if(W&&U.nextStart=k?(p.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+p.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(y,p){var k,F,U=p.fragments,W=U.length;if(!W)return null;var _=this.config,M=U[0].start,G;if(p.live){var Y=_.initialLiveManifestSize;if(W-1&&kk.start&&k.loaded},a.getInitialLiveFragment=function(y,p){var k=this.fragPrevious,F=null;if(k){if(y.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+k.programDateTime),F=Object(w.findFragmentByPDT)(p,k.endProgramDateTime,this.config.maxFragLookUpTolerance)),!F){var U=k.sn+1;if(U>=y.startSN&&U<=y.endSN){var W=p[U-y.startSN];k.cc===W.cc&&(F=W,this.log("Live playlist, switching playlist, load frag with next SN: "+F.sn))}F||(F=Object(w.findFragWithCC)(p,k.cc),F&&this.log("Live playlist, switching playlist, load frag with same CC: "+F.sn))}}else{var _=this.hls.liveSyncPosition;_!==null&&(F=this.getFragmentAtPosition(_,this.bitrateTest?y.fragmentEnd:y.edge,y))}return F},a.getFragmentAtPosition=function(y,p,k){var F=this.config,U=this.fragPrevious,W=k.fragments,_=k.endSN,M=k.fragmentHint,G=F.maxFragLookUpTolerance,Y=!!(F.lowLatencyMode&&k.partList&&M);Y&&M&&!this.bitrateTest&&(W=W.concat(M),_=M.sn);var Z;if(yp-G?0:G;Z=Object(w.findFragmentByPTS)(U,W,y,ne)}else Z=W[W.length-1];if(Z){var be=Z.sn-k.startSN,me=U&&Z.level===U.level,pe=W[be+1],ue=this.fragmentTracker.getState(Z);if(ue===O.FragmentState.BACKTRACKED){Z=null;for(var fe=be;W[fe]&&this.fragmentTracker.getState(W[fe])===O.FragmentState.BACKTRACKED;)U?Z=W[fe--]:Z=W[--fe];Z||(Z=pe)}else U&&Z.sn===U.sn&&!Y&&(me&&(Z.sn<_&&this.fragmentTracker.getState(pe)!==O.FragmentState.OK?(this.log("SN "+Z.sn+" just loaded, load next one: "+pe.sn),Z=pe):Z=null))}return Z},a.synchronizeToLiveEdge=function(y){var p=this.config,k=this.media;if(!k)return;var F=this.hls.liveSyncPosition,U=k.currentTime,W=y.fragments[0].start,_=y.edge,M=U>=W-p.maxFragLookUpTolerance&&U<=_;if(F!==null&&k.duration>F&&(U"+y.startSN+" prev-sn: "+(U?U.sn:"na")+" fragments: "+_),Z}return M},a.waitForCdnTuneIn=function(y){var p=3;return y.live&&y.canBlockReload&&y.tuneInGoal>Math.max(y.partHoldBack,y.partTarget*p)},a.setStartPosition=function(y,p){var k=this.startPosition;if(k"+y))}}]),u}(I.default)},"./src/controller/buffer-controller.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return w});var H=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),O=L("./src/utils/logger.ts"),B=L("./src/errors.ts"),N=L("./src/utils/buffer-helper.ts"),R=L("./src/utils/mediasource-helper.ts"),A=L("./src/loader/fragment.ts"),f=L("./src/controller/buffer-operation-queue.ts"),v=Object(R.getMediaSource)(),P=/([ha]vc.)(?:\.[^.,]+)+/,w=function(){function b(l){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=o.hls,d=o.media,C=o.mediaSource;O.logger.log("[buffer-controller]: Media source opened"),d&&(o.updateMediaElementDuration(),s.trigger(I.Events.MEDIA_ATTACHED,{media:d})),C&&C.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){O.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){O.logger.log("[buffer-controller]: Media source ended")},this.hls=l,this._initSourceBuffer(),this.registerListeners()}var E=b.prototype;return E.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},E.destroy=function(){this.unregisterListeners(),this.details=null},E.registerListeners=function(){var o=this.hls;o.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(I.Events.BUFFER_RESET,this.onBufferReset,this),o.on(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(I.Events.BUFFER_EOS,this.onBufferEos,this),o.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(I.Events.FRAG_PARSED,this.onFragParsed,this),o.on(I.Events.FRAG_CHANGED,this.onFragChanged,this)},E.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(I.Events.BUFFER_RESET,this.onBufferReset,this),o.off(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(I.Events.BUFFER_EOS,this.onBufferEos,this),o.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(I.Events.FRAG_PARSED,this.onFragParsed,this),o.off(I.Events.FRAG_CHANGED,this.onFragChanged,this)},E._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new f.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},E.onManifestParsed=function(o,s){var d=2;(s.audio&&!s.video||!s.altAudio)&&(d=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=d,this.details=null,O.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},E.onMediaAttaching=function(o,s){var d=this.media=s.media;if(d&&v){var C=this.mediaSource=new v;C.addEventListener("sourceopen",this._onMediaSourceOpen),C.addEventListener("sourceended",this._onMediaSourceEnded),C.addEventListener("sourceclose",this._onMediaSourceClose),d.src=self.URL.createObjectURL(C),this._objectUrl=d.src}},E.onMediaDetaching=function(){var o=this.media,s=this.mediaSource,d=this._objectUrl;if(s){if(O.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(C){O.logger.warn("[buffer-controller]: onMediaDetaching: "+C.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(d&&self.URL.revokeObjectURL(d),o.src===d?(o.removeAttribute("src"),o.load()):O.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(I.Events.MEDIA_DETACHED,void 0)},E.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(s){var d=o.sourceBuffer[s];try{d&&(o.removeBufferListeners(s),o.mediaSource&&o.mediaSource.removeSourceBuffer(d),o.sourceBuffer[s]=void 0)}catch(C){O.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",C)}}),this._initSourceBuffer()},E.onBufferCodecs=function(o,s){var d=this,C=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(g){if(C){var m=d.tracks[g];if(m&&typeof m.buffer.changeType=="function"){var D=s[g],T=D.codec,h=D.levelCodec,c=D.container,u=(m.levelCodec||m.codec).replace(P,"$1"),a=(h||T).replace(P,"$1");if(u!==a){var x=c+";codecs="+(h||T);d.appendChangeType(g,x)}}}else d.pendingTracks[g]=s[g]}),C)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},E.appendChangeType=function(o,s){var d=this,C=this.operationQueue,g={execute:function(){var D=d.sourceBuffer[o];D&&(O.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+s),D.changeType(s)),C.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(D){O.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",D)}};C.append(g,o)},E.onBufferAppending=function(o,s){var d=this,C=this.hls,g=this.operationQueue,m=this.tracks,D=s.data,T=s.type,h=s.frag,c=s.part,u=s.chunkMeta,a=u.buffering[T],x=self.performance.now();a.start=x;var y=h.stats.buffering,p=c?c.stats.buffering:null;y.start===0&&(y.start=x),p&&p.start===0&&(p.start=x);var k=m.audio,F=T==="audio"&&u.id===1&&(k==null?void 0:k.container)==="audio/mpeg",U={execute:function(){if(a.executeStart=self.performance.now(),F){var _=d.sourceBuffer[T];if(_){var M=h.start-_.timestampOffset;Math.abs(M)>=.1&&(O.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+M+") sn: "+h.sn+")"),_.timestampOffset=h.start)}}d.appendExecutor(D,T)},onStart:function(){},onComplete:function(){var _=self.performance.now();a.executeEnd=a.end=_,y.first===0&&(y.first=_),p&&p.first===0&&(p.first=_);var M=d.sourceBuffer,G={};for(var Y in M)G[Y]=N.BufferHelper.getBuffered(M[Y]);d.appendError=0,d.hls.trigger(I.Events.BUFFER_APPENDED,{type:T,frag:h,part:c,chunkMeta:u,parent:h.type,timeRanges:G})},onError:function(_){O.logger.error("[buffer-controller]: Error encountered while trying to append to the "+T+" SourceBuffer",_);var M={type:B.ErrorTypes.MEDIA_ERROR,parent:h.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:_,fatal:!1};_.code===DOMException.QUOTA_EXCEEDED_ERR?M.details=B.ErrorDetails.BUFFER_FULL_ERROR:(d.appendError++,M.details=B.ErrorDetails.BUFFER_APPEND_ERROR,d.appendError>C.config.appendErrorMaxRetry&&(O.logger.error("[buffer-controller]: Failed "+C.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),M.fatal=!0)),C.trigger(I.Events.ERROR,M)}};g.append(U,T)},E.onBufferFlushing=function(o,s){var d=this,C=this.operationQueue,g=function(D){return{execute:d.removeExecutor.bind(d,D,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){d.hls.trigger(I.Events.BUFFER_FLUSHED,{type:D})},onError:function(h){O.logger.warn("[buffer-controller]: Failed to remove from "+D+" SourceBuffer",h)}}};s.type?C.append(g(s.type),s.type):this.getSourceBufferTypes().forEach(function(m){C.append(g(m),m)})},E.onFragParsed=function(o,s){var d=this,C=s.frag,g=s.part,m=[],D=g?g.elementaryStreams:C.elementaryStreams;D[A.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(D[A.ElementaryStreamTypes.AUDIO]&&m.push("audio"),D[A.ElementaryStreamTypes.VIDEO]&&m.push("video"));var T=function(){var c=self.performance.now();C.stats.buffering.end=c,g&&(g.stats.buffering.end=c);var u=g?g.stats:C.stats;d.hls.trigger(I.Events.FRAG_BUFFERED,{frag:C,part:g,stats:u,id:C.type})};m.length===0&&O.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+C.type+" level: "+C.level+" sn: "+C.sn),this.blockBuffers(T,m)},E.onFragChanged=function(o,s){this.flushBackBuffer()},E.onBufferEos=function(o,s){var d=this,C=this.getSourceBufferTypes().reduce(function(g,m){var D=d.sourceBuffer[m];return(!s.type||s.type===m)&&(D&&!D.ended&&(D.ended=!0,O.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),g&&!!(!D||D.ended)},!0);C&&this.blockBuffers(function(){var g=d.mediaSource;if(!g||g.readyState!=="open")return;g.endOfStream()})},E.onLevelUpdated=function(o,s){var d=s.details;if(!d.fragments.length)return;this.details=d,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},E.flushBackBuffer=function(){var o=this.hls,s=this.details,d=this.media,C=this.sourceBuffer;if(!d||s===null)return;var g=this.getSourceBufferTypes();if(!g.length)return;var m=s.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(H.isFiniteNumber)(m)||m<0)return;var D=d.currentTime,T=s.levelTargetDuration,h=Math.max(m,T),c=Math.floor(D/T)*T-h;g.forEach(function(u){var a=C[u];if(a){var x=N.BufferHelper.getBuffered(a);x.length>0&&c>x.start(0)&&(o.trigger(I.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),s.live&&o.trigger(I.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(I.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:u}))}})},E.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,s=this.hls,d=this.media,C=this.mediaSource,g=o.fragments[0].start+o.totalduration,m=d.duration,D=Object(H.isFiniteNumber)(C.duration)?C.duration:0;o.live&&s.config.liveDurationInfinity?(O.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),C.duration=Infinity,this.updateSeekableRange(o)):(g>D&&g>m||!Object(H.isFiniteNumber)(m))&&(O.logger.log("[buffer-controller]: Updating Media Source duration to "+g.toFixed(3)),C.duration=g)},E.updateSeekableRange=function(o){var s=this.mediaSource,d=o.fragments,C=d.length;if(C&&o.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var g=Math.max(0,d[0].start),m=Math.max(g,g+o.totalduration);s.setLiveSeekableRange(g,m)}},E.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,s=this.operationQueue,d=this.pendingTracks,C=Object.keys(d).length;if(C&&!o||C===2){this.createSourceBuffers(d),this.pendingTracks={};var g=this.getSourceBufferTypes();if(g.length===0){this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}g.forEach(function(m){s.executeNext(m)})}},E.createSourceBuffers=function(o){var s=this.sourceBuffer,d=this.mediaSource;if(!d)throw Error("createSourceBuffers called when mediaSource was null");var C=0;for(var g in o)if(!s[g]){var m=o[g];if(!m)throw Error("source buffer exists for track "+g+", however track does not");var D=m.levelCodec||m.codec,T=m.container+";codecs="+D;O.logger.log("[buffer-controller]: creating sourceBuffer("+T+")");try{var h=s[g]=d.addSourceBuffer(T),c=g;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[g]={buffer:h,codec:D,container:m.container,levelCodec:m.levelCodec,id:m.id},C++}catch(u){O.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+u.message),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,mimeType:T})}}C&&this.hls.trigger(I.Events.BUFFER_CREATED,{tracks:this.tracks})},E._onSBUpdateStart=function(o){var s=this.operationQueue,d=s.current(o);d.onStart()},E._onSBUpdateEnd=function(o){var s=this.operationQueue,d=s.current(o);d.onComplete(),s.shiftAndExecuteNext(o)},E._onSBUpdateError=function(o,s){O.logger.error("[buffer-controller]: "+o+" SourceBuffer error",s),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var d=this.operationQueue.current(o);d&&d.onError(s)},E.removeExecutor=function(o,s,d){var C=this.media,g=this.mediaSource,m=this.operationQueue,D=this.sourceBuffer,T=D[o];if(!C||!g||!T){O.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(o);return}var h=Object(H.isFiniteNumber)(C.duration)?C.duration:Infinity,c=Object(H.isFiniteNumber)(g.duration)?g.duration:Infinity,u=Math.max(0,s),a=Math.min(d,h,c);a>u?(O.logger.log("[buffer-controller]: Removing ["+u+","+a+"] from the "+o+" SourceBuffer"),console.assert(!T.updating,o+" sourceBuffer must not be updating"),T.remove(u,a)):m.shiftAndExecuteNext(o)},E.appendExecutor=function(o,s){var d=this.operationQueue,C=this.sourceBuffer,g=C[s];if(!g){O.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),d.shiftAndExecuteNext(s);return}g.ended=!1,console.assert(!g.updating,s+" sourceBuffer must not be updating"),g.appendBuffer(o)},E.blockBuffers=function(o,s){var d=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){O.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var C=this.operationQueue,g=s.map(function(m){return C.appendBlocker(m)});Promise.all(g).then(function(){o(),s.forEach(function(m){var D=d.sourceBuffer[m];(!D||!D.updating)&&C.shiftAndExecuteNext(m)})})},E.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},E.addBufferListener=function(o,s,d){var C=this.sourceBuffer[o];if(!C)return;var g=d.bind(this,o);this.listeners[o].push({event:s,listener:g}),C.addEventListener(s,g)},E.removeBufferListeners=function(o){var s=this.sourceBuffer[o];if(!s)return;this.listeners[o].forEach(function(d){s.removeEventListener(d.event,d.listener)})},b}()},"./src/controller/buffer-operation-queue.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return I});var H=L("./src/utils/logger.ts"),I=function(){function O(N){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=N}var B=O.prototype;return B.append=function(R,A){var f=this.queues[A];f.push(R),f.length===1&&this.buffers[A]&&this.executeNext(A)},B.insertAbort=function(R,A){var f=this.queues[A];f.unshift(R),this.executeNext(A)},B.appendBlocker=function(R){var A,f=new Promise(function(P){A=P}),v={execute:A,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(v,R),f},B.executeNext=function(R){var A=this.buffers,f=this.queues,v=A[R],P=f[R];if(P.length){var w=P[0];try{w.execute()}catch(b){H.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),w.onError(b),(!v||!v.updating)&&(P.shift(),this.executeNext(R))}}},B.shiftAndExecuteNext=function(R){this.queues[R].shift(),this.executeNext(R)},B.current=function(R){return this.queues[R][0]},O}()},"./src/controller/cap-level-controller.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/events.ts");function I(N,R){for(var A=0;A0&&this.mediaWidth>0){var f=this.hls.levels;if(f.length){var v=this.hls;v.autoLevelCapping=this.getMaxLevel(f.length-1),v.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=v.autoLevelCapping}}},R.getMaxLevel=function(f){var v=this,P=this.hls.levels;if(!P.length)return-1;var w=P.filter(function(b,E){return N.isLevelAllowed(E,v.restrictedLevels)&&E<=f});return this.clientRect=null,N.getMaxLevelByMediaSize(w,this.mediaWidth,this.mediaHeight)},R.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},R.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},R.getDimensions=function(){if(this.clientRect)return this.clientRect;var f=this.media,v={width:0,height:0};if(f){var P=f.getBoundingClientRect();v.width=P.width,v.height=P.height,!v.width&&!v.height&&(v.width=P.right-P.left||f.width||0,v.height=P.bottom-P.top||f.height||0)}return this.clientRect=v,v},N.isLevelAllowed=function(f,v){return v===void 0&&(v=[]),v.indexOf(f)===-1},N.getMaxLevelByMediaSize=function(f,v,P){if(!f||!f.length)return-1;for(var w=function(s,d){return d?s.width!==d.width||s.height!==d.height:!0},b=f.length-1,E=0;E=v||l.height>=P)&&w(l,f[E+1])){b=E;break}}return b},O(N,[{key:"mediaWidth",get:function(){return this.getDimensions().width*N.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*N.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var f=1;try{f=self.devicePixelRatio}catch(v){}return f}}]),N}();K.default=B},"./src/controller/cmcd-controller.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return w});var H=L("./src/events.ts"),I=L("./src/types/cmcd.ts"),O=L("./src/utils/buffer-helper.ts"),B=L("./src/utils/logger.ts");function N(b,E){for(var l=0;l=b.length?{done:!0}:{done:!1,value:b[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function f(b,E){if(!b)return;if(typeof b=="string")return v(b,E);var l=Object.prototype.toString.call(b).slice(8,-1);if(l==="Object"&&b.constructor&&(l=b.constructor.name),l==="Map"||l==="Set")return Array.from(b);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return v(b,E)}function v(b,E){(E==null||E>b.length)&&(E=b.length);for(var l=0,o=new Array(E);ls&&(s=m.bitrate)}return s>0?s:NaN},E.getBufferLength=function(o){var s=this.hls.media,d=o===I.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!d||!s)return NaN;var C=O.BufferHelper.bufferInfo(d,s.currentTime,this.config.maxBufferHole);return C.len*1e3},E.createPlaylistLoader=function(){var o=this.config.pLoader,s=this.applyPlaylistData,d=o||this.config.loader;return function(){function C(m){this.loader=void 0,this.loader=new d(m)}var g=C.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(D,T,h){s(D),this.loader.load(D,T,h)},R(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},E.createFragmentLoader=function(){var o=this.config.fLoader,s=this.applyFragmentData,d=o||this.config.loader;return function(){function C(m){this.loader=void 0,this.loader=new d(m)}var g=C.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(D,T,h){s(D),this.loader.load(D,T,h)},R(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},b.uuid=function(){var o=URL.createObjectURL(new Blob),s=o.toString();return URL.revokeObjectURL(o),s.substr(s.lastIndexOf("/")+1)},b.serialize=function(o){for(var s=[],d=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},C=function(F){return Math.round(F)},g=function(F){return C(F/100)*100},m=function(F){return encodeURIComponent(F)},D={br:C,d:C,bl:g,dl:g,mtp:g,nor:m,rtp:g,tb:C},T=Object.keys(o||{}).sort(),h=A(T),c;!(c=h()).done;){var u=c.value,a=o[u];if(!d(a))continue;if(u==="v"&&a===1)continue;if(u=="pr"&&a===1)continue;var x=D[u];x&&(a=x(a));var y=typeof a,p=void 0;u==="ot"||u==="sf"||u==="st"?p=u+"="+a:y==="boolean"?p=u:y==="number"?p=u+"="+a:p=u+"="+JSON.stringify(a),s.push(p)}return s.join(",")},b.toHeaders=function(o){for(var s=Object.keys(o),d={},C=["Object","Request","Session","Status"],g=[{},{},{},{}],m={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},D=0,T=s;DA){this.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=A-this._requestLicenseFailureCount+1;O.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(s,d)}break}},b._generateLicenseRequestChallenge=function(l,o){switch(l.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+l.mediaKeySystemDomain)},b._requestLicense=function(l,o){O.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){O.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var d=this.getLicenseServerUrl(s.mediaKeySystemDomain),C=this._createLicenseXhr(d,l,o);O.logger.log("Sending license request to URL: "+d);var g=this._generateLicenseRequestChallenge(s,l);C.send(g)}catch(m){O.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},b.onMediaAttached=function(l,o){if(!this._emeEnabled)return;var s=o.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},b.onMediaDetached=function(){var l=this._media,o=this._mediaKeysList;if(!l)return;l.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return l.setMediaKeys(null)}).catch(function(){})},b.onManifestParsed=function(l,o){if(!this._emeEnabled)return;var s=o.levels.map(function(C){return C.audioCodec}).filter(function(C){return!!C}),d=o.levels.map(function(C){return C.videoCodec}).filter(function(C){return!!C});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,s,d)},R(w,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),w}();K.default=P},"./src/controller/fps-controller.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/events.ts"),I=L("./src/utils/logger.ts"),O=function(){function B(R){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=R,this.registerListeners()}var N=B.prototype;return N.setStreamController=function(A){this.streamController=A},N.registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},N.unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching)},N.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},N.onMediaAttaching=function(A,f){var v=this.hls.config;if(v.capLevelOnFPSDrop){var P=f.media instanceof self.HTMLVideoElement?f.media:null;this.media=P,P&&typeof P.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),v.fpsDroppedMonitoringPeriod)}},N.checkFPS=function(A,f,v){var P=performance.now();if(f){if(this.lastTime){var w=P-this.lastTime,b=v-this.lastDroppedFrames,E=f-this.lastDecodedFrames,l=1e3*b/w,o=this.hls;if(o.trigger(H.Events.FPS_DROP,{currentDropped:b,currentDecoded:E,totalDroppedFrames:v}),l>0&&b>o.config.fpsDroppedMonitoringThreshold*E){var s=o.currentLevel;I.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=s)&&(s=s-1,o.trigger(H.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:o.currentLevel}),o.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=P,this.lastDroppedFrames=v,this.lastDecodedFrames=f}},N.checkFPSInterval=function(){var A=this.media;if(A)if(this.isVideoPlaybackQualityAvailable){var f=A.getVideoPlaybackQuality();this.checkFPS(A,f.totalVideoFrames,f.droppedVideoFrames)}else this.checkFPS(A,A.webkitDecodedFrameCount,A.webkitDroppedFrameCount)},B}();K.default=O},"./src/controller/fragment-finders.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"findFragmentByPDT",function(){return O}),L.d(K,"findFragmentByPTS",function(){return B}),L.d(K,"fragmentWithinToleranceTest",function(){return N}),L.d(K,"pdtWithinToleranceTest",function(){return R}),L.d(K,"findFragWithCC",function(){return A});var H=L("./src/polyfills/number.ts"),I=L("./src/utils/binary-search.ts");function O(f,v,P){if(v===null||!Array.isArray(f)||!f.length||!Object(H.isFiniteNumber)(v))return null;var w=f[0].programDateTime;if(v<(w||0))return null;var b=f[f.length-1].endProgramDateTime;if(v>=(b||0))return null;P=P||0;for(var E=0;Ef&&P.start?-1:0}function R(f,v,P){var w=Math.min(v,P.duration+(P.deltaPTS?P.deltaPTS:0))*1e3,b=P.endProgramDateTime||0;return b-w>f}function A(f,v){return I.default.search(f,function(P){return P.ccv?-1:0})}},"./src/controller/fragment-tracker.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"FragmentState",function(){return O}),L.d(K,"FragmentTracker",function(){return B});var H=L("./src/events.ts"),I=L("./src/types/loader.ts"),O;(function(A){A.NOT_LOADED="NOT_LOADED",A.BACKTRACKED="BACKTRACKED",A.APPENDING="APPENDING",A.PARTIAL="PARTIAL",A.OK="OK"})(O||(O={}));var B=function(){function A(v){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=v,this._registerListeners()}var f=A.prototype;return f._registerListeners=function(){var P=this.hls;P.on(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.on(H.Events.FRAG_LOADED,this.onFragLoaded,this)},f._unregisterListeners=function(){var P=this.hls;P.off(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.off(H.Events.FRAG_LOADED,this.onFragLoaded,this)},f.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},f.getAppendedFrag=function(P,w){if(w===I.PlaylistLevelType.MAIN){var b=this.activeFragment,E=this.activeParts;if(!b)return null;if(E)for(var l=E.length;l--;){var o=E[l],s=o?o.end:b.appendedPTS;if(o.start<=P&&s!==void 0&&P<=s)return l>9&&(this.activeParts=E.slice(l-9)),o}else if(b.start<=P&&b.appendedPTS!==void 0&&P<=b.appendedPTS)return b}return this.getBufferedFrag(P,w)},f.getBufferedFrag=function(P,w){for(var b=this.fragments,E=Object.keys(b),l=E.length;l--;){var o=b[E[l]];if((o==null?void 0:o.body.type)===w&&o.buffered){var s=o.body;if(s.start<=P&&P<=s.end)return s}}return null},f.detectEvictedFragments=function(P,w,b){var E=this;Object.keys(this.fragments).forEach(function(l){var o=E.fragments[l];if(!o)return;if(!o.buffered){o.body.type===b&&E.removeFragment(o.body);return}var s=o.range[P];if(!s)return;s.time.some(function(d){var C=!E.isTimeBuffered(d.startPTS,d.endPTS,w);return C&&E.removeFragment(o.body),C})})},f.detectPartialFragments=function(P){var w=this,b=this.timeRanges,E=P.frag,l=P.part;if(!b||E.sn==="initSegment")return;var o=R(E),s=this.fragments[o];if(!s)return;Object.keys(b).forEach(function(d){var C=E.elementaryStreams[d];if(!C)return;var g=b[d],m=l!==null||C.partial===!0;s.range[d]=w.getBufferedTimes(E,l,m,g)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},f.fragBuffered=function(P){var w=R(P),b=this.fragments[w];b&&(b.backtrack=b.loaded=null,b.buffered=!0)},f.getBufferedTimes=function(P,w,b,E){for(var l={time:[],partial:b},o=w?w.start:P.start,s=w?w.end:P.end,d=P.minEndPTS||s,C=P.maxStartPTS||o,g=0;g=m&&d<=D){l.time.push({startPTS:Math.max(o,E.start(g)),endPTS:Math.min(s,E.end(g))});break}else if(om)l.partial=!0,l.time.push({startPTS:Math.max(o,E.start(g)),endPTS:Math.min(s,E.end(g))});else if(s<=m)break}return l},f.getPartialFragment=function(P){var w=null,b,E,l,o=0,s=this.bufferPadding,d=this.fragments;return Object.keys(d).forEach(function(C){var g=d[C];if(!g)return;N(g)&&(E=g.body.start-s,l=g.body.end+s,P>=E&&P<=l&&(b=Math.min(P-E,l-P),o<=b&&(w=g.body,o=b)))}),w},f.getState=function(P){var w=R(P),b=this.fragments[w];return b?b.buffered?N(b)?O.PARTIAL:O.OK:b.backtrack?O.BACKTRACKED:O.APPENDING:O.NOT_LOADED},f.backtrack=function(P,w){var b=R(P),E=this.fragments[b];if(!E||E.backtrack)return null;var l=E.backtrack=w||E.loaded;return E.loaded=null,l},f.getBacktrackData=function(P){var w=R(P),b=this.fragments[w];if(b){var E,l=b.backtrack;if(l!=null&&(E=l.payload)!==null&&E!==void 0&&E.byteLength)return l;this.removeFragment(P)}return null},f.isTimeBuffered=function(P,w,b){for(var E,l,o=0;o=E&&w<=l)return!0;if(w<=E)return!1}return!1},f.onFragLoaded=function(P,w){var b=w.frag,E=w.part;if(b.sn==="initSegment"||b.bitrateTest||E)return;var l=R(b);this.fragments[l]={body:b,loaded:w,backtrack:null,buffered:!1,range:Object.create(null)}},f.onBufferAppended=function(P,w){var b=this,E=w.frag,l=w.part,o=w.timeRanges;if(E.type===I.PlaylistLevelType.MAIN)if(this.activeFragment=E,l){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(l)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(d){var C=o[d];if(b.detectEvictedFragments(d,C),!l)for(var g=0;gP&&E.removeFragment(s)}})},f.removeFragment=function(P){var w=R(P);P.stats.loaded=0,P.clearElementaryStreamInfo(),delete this.fragments[w]},f.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},A}();function N(A){var f,v;return A.buffered&&(((f=A.range.video)===null||f===void 0?void 0:f.partial)||((v=A.range.audio)===null||v===void 0?void 0:v.partial))}function R(A){return A.type+"_"+A.level+"_"+A.urlId+"_"+A.sn}},"./src/controller/gap-controller.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"STALL_MINIMUM_DURATION_MS",function(){return N}),L.d(K,"MAX_START_GAP_JUMP",function(){return R}),L.d(K,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return A}),L.d(K,"SKIP_BUFFER_RANGE_START",function(){return f}),L.d(K,"default",function(){return v});var H=L("./src/utils/buffer-helper.ts"),I=L("./src/errors.ts"),O=L("./src/events.ts"),B=L("./src/utils/logger.ts"),N=250,R=2,A=.1,f=.05,v=function(){function P(b,E,l,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=b,this.media=E,this.fragmentTracker=l,this.hls=o}var w=P.prototype;return w.destroy=function(){this.hls=this.fragmentTracker=this.media=null},w.poll=function(E){var l=this.config,o=this.media,s=this.stalled,d=o.currentTime,C=o.seeking,g=this.seeking&&!C,m=!this.seeking&&C;if(this.seeking=C,d!==E){if(this.moved=!0,s!==null){if(this.stallReported){var D=self.performance.now()-s;B.logger.warn("playback not stuck anymore @"+d+", after "+Math.round(D)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||g)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!H.BufferHelper.getBuffered(o).length)return;var T=H.BufferHelper.bufferInfo(o,d,0),h=T.len>0,c=T.nextStart||0;if(!h&&!c)return;if(C){var u=T.len>R,a=!c||c-d>R&&!this.fragmentTracker.getPartialFragment(d);if(u||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var x,y=Math.max(c,T.start||0)-d,p=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,k=p==null||((x=p.details)===null||x===void 0)?void 0:x.live,F=k?p.details.targetduration*2:R;if(y>0&&y<=F){this._trySkipBufferHole(null);return}}var U=self.performance.now();if(s===null){this.stalled=U;return}var W=U-s;!C&&W>=N&&this._reportStall(T.len);var _=H.BufferHelper.bufferInfo(o,d,l.maxBufferHole);this._tryFixBufferStall(_,W)},w._tryFixBufferStall=function(E,l){var o=this.config,s=this.fragmentTracker,d=this.media,C=d.currentTime,g=s.getPartialFragment(C);if(g){var m=this._trySkipBufferHole(g);if(m)return}E.len>o.maxBufferHole&&l>o.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},w._reportStall=function(E){var l=this.hls,o=this.media,s=this.stallReported;s||(this.stallReported=!0,B.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+E+")"),l.trigger(O.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:E}))},w._trySkipBufferHole=function(E){for(var l=this.config,o=this.hls,s=this.media,d=s.currentTime,C=0,g=H.BufferHelper.getBuffered(s),m=0;m=C&&d.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,o)),D=Math.round(2/(1+Math.exp(-.75*d-this.edgeStalled))*20)/20;P.playbackRate=Math.min(m,Math.max(1,D))}else P.playbackRate!==1&&P.playbackRate!==0&&(P.playbackRate=1)},f.estimateLiveEdge=function(){var P=this.levelDetails;return P===null?null:P.edge+P.age},f.computeLatency=function(){var P=this.estimateLiveEdge();return P===null?null:P-this.currentTime},N(A,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var P=this.config,w=this.levelDetails;return P.liveMaxLatencyDuration!==void 0?P.liveMaxLatencyDuration:w?P.liveMaxLatencyDurationCount*w.targetduration:0}},{key:"targetLatency",get:function(){var P=this.levelDetails;if(P===null)return null;var w=P.holdBack,b=P.partHoldBack,E=P.targetduration,l=this.config,o=l.liveSyncDuration,s=l.liveSyncDurationCount,d=l.lowLatencyMode,C=this.hls.userConfig,g=d&&b||w;(C.liveSyncDuration||C.liveSyncDurationCount||g===0)&&(g=o!==void 0?o:s*E);var m=E,D=1;return g+Math.min(this.stallCount*D,m)}},{key:"liveSyncPosition",get:function(){var P=this.estimateLiveEdge(),w=this.targetLatency,b=this.levelDetails;if(P===null||w===null||b===null)return null;var E=b.edge,l=P-w-this.edgeStalled,o=E-b.totalduration,s=E-(this.config.lowLatencyMode&&b.partTarget||b.targetduration);return Math.min(Math.max(o,l),s)}},{key:"drift",get:function(){var P=this.levelDetails;return P===null?1:P.drift}},{key:"edgeStalled",get:function(){var P=this.levelDetails;if(P===null)return 0;var w=(this.config.lowLatencyMode&&P.partTarget||P.targetduration)*3;return Math.max(P.age-w,0)}},{key:"forwardBufferLength",get:function(){var P=this.media,w=this.levelDetails;if(!P||!w)return 0;var b=P.buffered.length;return b?P.buffered.end(b-1):w.edge-this.currentTime}}]),A}()},"./src/controller/level-controller.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return l});var H=L("./src/types/level.ts"),I=L("./src/events.ts"),O=L("./src/errors.ts"),B=L("./src/utils/codecs.ts"),N=L("./src/controller/level-helper.ts"),R=L("./src/controller/base-playlist-controller.ts"),A=L("./src/types/loader.ts");function f(){return f=Object.assign||function(o){for(var s=1;s0){c=D[0].bitrate,D.sort(function(W,_){return W.bitrate-_.bitrate}),this._levels=D;for(var k=0;kthis.hls.config.fragLoadingMaxRetry&&(u=m.frag.level)):u=m.frag.level}break;case O.ErrorDetails.LEVEL_LOAD_ERROR:case O.ErrorDetails.LEVEL_LOAD_TIMEOUT:D&&(D.deliveryDirectives&&(c=!1),u=D.level),h=!0;break;case O.ErrorDetails.REMUX_ALLOC_ERROR:u=m.level,h=!0;break}u!==void 0&&this.recoverLevel(m,u,h,c)},d.recoverLevel=function(g,m,D,T){var h=g.details,c=this._levels[m];if(c.loadError++,D){var u=this.retryLoadingOrFail(g);if(u)g.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(T){var a=c.url.length;if(a>1&&c.loadError1){var T=(m.urlId+1)%D;this.warn("Switching to redundant URL-id "+T),this._levels.forEach(function(h){h.urlId=T}),this.level=g}},d.onFragLoaded=function(g,m){var D=m.frag;if(D!==void 0&&D.type===A.PlaylistLevelType.MAIN){var T=this._levels[D.level];T!==void 0&&(T.fragmentError=0,T.loadError=0)}},d.onLevelLoaded=function(g,m){var D,T=m.level,h=m.details,c=this._levels[T];if(!c){var u;this.warn("Invalid level index "+T),(u=m.deliveryDirectives)!==null&&u!==void 0&&u.skip&&(h.deltaUpdateFailed=!0);return}T===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(T,m,c.details)):(D=m.deliveryDirectives)!==null&&D!==void 0&&D.skip&&(h.deltaUpdateFailed=!0)},d.onAudioTrackSwitched=function(g,m){var D=this.hls.levels[this.currentLevelIndex];if(!D)return;if(D.audioGroupIds){for(var T=-1,h=this.hls.audioTracks[m.id].groupId,c=0;c0){var T=D.urlId,h=D.url[T];if(g)try{h=g.addDirectives(h)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+m+(g?" at sn "+g.msn+" part "+g.part:"")+" with URL-id "+T+" "+h),this.clearTimer(),this.hls.trigger(I.Events.LEVEL_LOADING,{url:h,level:m,id:T,deliveryDirectives:g||null})}},d.removeLevel=function(g,m){var D=function(c,u){return u!==m},T=this._levels.filter(function(h,c){return c!==g?!0:h.url.length>1&&m!==void 0?(h.url=h.url.filter(D),h.audioGroupIds&&(h.audioGroupIds=h.audioGroupIds.filter(D)),h.textGroupIds&&(h.textGroupIds=h.textGroupIds.filter(D)),h.urlId=0,!0):!1}).map(function(h,c){var u=h.details;return u!=null&&u.fragments&&u.fragments.forEach(function(a){a.level=c}),h});this._levels=T,this.hls.trigger(I.Events.LEVELS_UPDATED,{levels:T})},P(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(g){var m,D=this._levels;if(D.length===0)return;if(this.currentLevelIndex===g&&(m=D[g])!==null&&m!==void 0&&m.details)return;if(g<0||g>=D.length){var T=g<0;if(this.hls.trigger(I.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.LEVEL_SWITCH_ERROR,level:g,fatal:T,reason:"invalid level idx"}),T)return;g=Math.min(g,D.length-1)}this.clearTimer();var h=this.currentLevelIndex,c=D[h],u=D[g];this.log("switching to level "+g+" from "+h),this.currentLevelIndex=g;var a=f({},u,{level:g,maxBitrate:u.maxBitrate,uri:u.uri,urlId:u.urlId});delete a._urlId,this.hls.trigger(I.Events.LEVEL_SWITCHING,a);var x=u.details;if(!x||x.live){var y=this.switchParams(u.uri,c==null?void 0:c.details);this.loadPlaylist(y)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(g){this.manualLevelIndex=g,this._startLevel===void 0&&(this._startLevel=g),g!==-1&&(this.level=g)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(g){this._firstLevel=g}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var g=this.hls.config.startLevel;return g!==void 0?g:this._firstLevel}else return this._startLevel},set:function(g){this._startLevel=g}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(g){this.level=g,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=g)}}]),s}(R.default)},"./src/controller/level-helper.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"addGroupId",function(){return O}),L.d(K,"assignTrackIdsByGroup",function(){return B}),L.d(K,"updatePTS",function(){return N}),L.d(K,"updateFragPTSDTS",function(){return A}),L.d(K,"mergeDetails",function(){return f}),L.d(K,"mapPartIntersection",function(){return v}),L.d(K,"mapFragmentIntersection",function(){return P}),L.d(K,"adjustSliding",function(){return w}),L.d(K,"addSliding",function(){return b}),L.d(K,"computeReloadInterval",function(){return E}),L.d(K,"getFragmentWithSN",function(){return l}),L.d(K,"getPartWith",function(){return o});var H=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts");function O(s,d,C){switch(d){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(C);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(C);break}}function B(s){var d={};s.forEach(function(C){var g=C.groupId||"";C.id=d[g]=d[g]||0,d[g]++})}function N(s,d,C){var g=s[d],m=s[C];R(g,m)}function R(s,d){var C=d.startPTS;if(Object(H.isFiniteNumber)(C)){var g=0,m;d.sn>s.sn?(g=C-s.start,m=s):(g=s.start-C,m=d),m.duration!==g&&(m.duration=g)}else if(d.sn>s.sn){var D=s.cc===d.cc;D&&s.minEndPTS?d.start=s.start+(s.minEndPTS-s.start):d.start=s.start+s.duration}else d.start=Math.max(s.start-d.duration,0)}function A(s,d,C,g,m,D){var T=g-C;T<=0&&(I.logger.warn("Fragment should have a positive duration",d),g=C+d.duration,D=m+d.duration);var h=C,c=g,u=d.startPTS,a=d.endPTS;if(Object(H.isFiniteNumber)(u)){var x=Math.abs(u-C);Object(H.isFiniteNumber)(d.deltaPTS)?d.deltaPTS=Math.max(x,d.deltaPTS):d.deltaPTS=x,h=Math.max(C,u),C=Math.min(C,u),m=Math.min(m,d.startDTS),c=Math.min(g,a),g=Math.max(g,a),D=Math.max(D,d.endDTS)}d.duration=g-C;var y=C-d.start;d.appendedPTS=g,d.start=d.startPTS=C,d.maxStartPTS=h,d.startDTS=m,d.endPTS=g,d.minEndPTS=c,d.endDTS=D;var p=d.sn;if(!s||ps.endSN)return 0;var k,F=p-s.startSN,U=s.fragments;for(U[F]=d,k=F;k>0;k--)R(U[k],U[k-1]);for(k=F;k=0;m--){var D=g[m].initSegment;if(D){C=D;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var T=0,h;if(P(s,d,function(k,F){k.relurl&&(T=k.cc-F.cc),Object(H.isFiniteNumber)(k.startPTS)&&Object(H.isFiniteNumber)(k.endPTS)&&(F.start=F.startPTS=k.startPTS,F.startDTS=k.startDTS,F.appendedPTS=k.appendedPTS,F.maxStartPTS=k.maxStartPTS,F.endPTS=k.endPTS,F.endDTS=k.endDTS,F.minEndPTS=k.minEndPTS,F.duration=k.endPTS-k.startPTS,F.duration&&(h=F),d.PTSKnown=d.alignedSliding=!0),F.elementaryStreams=k.elementaryStreams,F.loader=k.loader,F.stats=k.stats,F.urlId=k.urlId,k.initSegment&&(F.initSegment=k.initSegment,C=k.initSegment)}),C){var c=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments;c.forEach(function(k){var F;(!k.initSegment||k.initSegment.relurl===((F=C)===null||F===void 0?void 0:F.relurl))&&(k.initSegment=C)})}if(d.skippedSegments&&(d.deltaUpdateFailed=d.fragments.some(function(k){return!k}),d.deltaUpdateFailed)){I.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var u=d.skippedSegments;u--;)d.fragments.shift();d.startSN=d.fragments[0].sn,d.startCC=d.fragments[0].cc}var a=d.fragments;if(T){I.logger.warn("discontinuity sliding from playlist, take drift into account");for(var x=0;x=g.length)return;b(d,g[C].start)}function b(s,d){if(d){for(var C=s.fragments,g=s.skippedSegments;g0&&m0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),c=u),this.state=I.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=I.State.STOPPED},T.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},T.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_LEVEL:{var c,u=this.levels,a=this.level,x=u==null||((c=u[a])===null||c===void 0)?void 0:c.details;if(x&&(!x.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(x))break;this.state=I.State.IDLE;break}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var y,p=self.performance.now(),k=this.retryDate;(!k||p>=k||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=I.State.IDLE)}break;default:break}this.onTickEnd()},T.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},T.doTickIdle=function(){var c,u,a=this.hls,x=this.levelLastLoaded,y=this.levels,p=this.media,k=a.config,F=a.nextLoadLevel;if(x===null||!p&&(this.startFragRequested||!k.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!y||!y[F])return;var U=y[F];this.level=a.nextLoadLevel=F;var W=U.details;if(!W||this.state===I.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==F){this.state=I.State.WAITING_LEVEL;return}var _=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:p,A.PlaylistLevelType.MAIN);if(_===null)return;var M=_.len,G=this.getMaxBufferLength(U.maxBitrate);if(M>=G)return;if(this._streamEnded(_,W)){var Y={};this.altAudio&&(Y.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,Y),this.state=I.State.ENDED;return}var Z=_.end,ne=this.getNextFragment(Z,W);if(this.couldBacktrack&&!this.fragPrevious&&ne&&ne.sn!=="initSegment"){var be=ne.sn-W.startSN;be>1&&(ne=W.fragments[be-1],this.fragmentTracker.removeFragment(ne))}if(ne&&this.fragmentTracker.getState(ne)===R.FragmentState.OK&&this.nextLoadPosition>Z){var me=this.audioOnly&&!this.altAudio?f.ElementaryStreamTypes.AUDIO:f.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(p,me,A.PlaylistLevelType.MAIN),ne=this.getNextFragment(this.nextLoadPosition,W)}if(!ne)return;ne.initSegment&&!ne.initSegment.data&&!this.bitrateTest&&(ne=ne.initSegment),((c=ne.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((u=ne.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(ne,W):this.loadFragment(ne,W,Z)},T.loadFragment=function(c,u,a){var x,y=this.fragmentTracker.getState(c);if(this.fragCurrent=c,y===R.FragmentState.BACKTRACKED){var p=this.fragmentTracker.getBacktrackData(c);if(p){this._handleFragmentLoadProgress(p),this._handleFragmentLoadComplete(p);return}else y=R.FragmentState.NOT_LOADED}y===R.FragmentState.NOT_LOADED||y===R.FragmentState.PARTIAL?c.sn==="initSegment"?this._loadInitSegment(c):this.bitrateTest?(c.bitrateTest=!0,this.log("Fragment "+c.sn+" of level "+c.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(c)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,c,u,a)):y===R.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((x=this.media)===null||x===void 0?void 0:x.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},T.getAppendedFrag=function(c){var u=this.fragmentTracker.getAppendedFrag(c,A.PlaylistLevelType.MAIN);return u&&"fragment"in u?u.fragment:u},T.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,A.PlaylistLevelType.MAIN)},T.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},T.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},T.nextLevelSwitch=function(){var c=this.levels,u=this.media;if(u!=null&&u.readyState){var a,x=this.getAppendedFrag(u.currentTime);if(x&&x.start>1&&this.flushMainBuffer(0,x.start-1),!u.paused&&c){var y=this.hls.nextLoadLevel,p=c[y],k=this.fragLastKbps;k&&this.fragCurrent?a=this.fragCurrent.duration*p.maxBitrate/(1e3*k)+1:a=0}else a=0;var F=this.getBufferedFrag(u.currentTime+a);if(F){var U=this.followingBufferedFrag(F);if(U){this.abortCurrentFrag();var W=U.maxStartPTS?U.maxStartPTS:U.start,_=U.duration,M=Math.max(F.end,W+Math.min(Math.max(_-this.config.maxFragLookUpTolerance,_*.5),_*.75));this.flushMainBuffer(M,Number.POSITIVE_INFINITY)}}}},T.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===I.State.KEY_LOADING&&(this.state=I.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},T.flushMainBuffer=function(c,u){m.prototype.flushMainBuffer.call(this,c,u,this.altAudio?"video":null)},T.onMediaAttached=function(c,u){m.prototype.onMediaAttached.call(this,c,u);var a=u.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new w.default(this.config,a,this.fragmentTracker,this.hls)},T.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),m.prototype.onMediaDetaching.call(this)},T.onMediaPlaying=function(){this.tick()},T.onMediaSeeked=function(){var c=this.media,u=c?c.currentTime:null;Object(H.isFiniteNumber)(u)&&this.log("Media seeked to "+u.toFixed(3)),this.tick()},T.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(B.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},T.onManifestParsed=function(c,u){var a=!1,x=!1,y;u.levels.forEach(function(p){y=p.audioCodec,y&&(y.indexOf("mp4a.40.2")!==-1&&(a=!0),y.indexOf("mp4a.40.5")!==-1&&(x=!0))}),this.audioCodecSwitch=a&&x&&!Object(O.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=u.levels,this.startFragRequested=!1},T.onLevelLoading=function(c,u){var a=this.levels;if(!a||this.state!==I.State.IDLE)return;var x=a[u.level];(!x.details||x.details.live&&this.levelLastLoaded!==u.level||this.waitForCdnTuneIn(x.details))&&(this.state=I.State.WAITING_LEVEL)},T.onLevelLoaded=function(c,u){var a,x=this.levels,y=u.level,p=u.details,k=p.totalduration;if(!x){this.warn("Levels were reset while loading level "+y);return}this.log("Level "+y+" loaded ["+p.startSN+","+p.endSN+"], cc ["+p.startCC+", "+p.endCC+"] duration:"+k);var F=this.fragCurrent;F&&(this.state===I.State.FRAG_LOADING||this.state===I.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==u.level&&F.loader&&(this.state=I.State.IDLE,F.loader.abort()));var U=x[y],W=0;if(p.live||(a=U.details)!==null&&a!==void 0&&a.live){if(p.fragments[0]||(p.deltaUpdateFailed=!0),p.deltaUpdateFailed)return;W=this.alignPlaylists(p,U.details)}if(U.details=p,this.levelLastLoaded=y,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:p,level:y}),this.state===I.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(p))return;this.state=I.State.IDLE}this.startFragRequested?p.live&&this.synchronizeToLiveEdge(p):this.setStartPosition(p,W),this.tick()},T._handleFragmentLoadProgress=function(c){var u,a=c.frag,x=c.part,y=c.payload,p=this.levels;if(!p){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var k=p[a.level],F=k.details;if(!F){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var U=k.videoCodec,W=F.PTSKnown||!F.live,_=(u=a.initSegment)===null||u===void 0?void 0:u.data,M=this._getAudioCodec(k),G=this.transmuxer=this.transmuxer||new v.default(this.hls,A.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Y=x?x.index:-1,Z=Y!==-1,ne=new P.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,y.byteLength,Y,Z),be=this.initPTS[a.cc];G.push(y,_,M,U,a,x,F.totalduration,W,ne,be)},T.onAudioTrackSwitching=function(c,u){var a=this.altAudio,x=!!u.url,y=u.id;if(!x){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var p=this.fragCurrent;p!=null&&p.loader&&(this.log("Switching to main audio track, cancel main fragment load"),p.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var k=this.hls;a&&k.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),k.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:y})}},T.onAudioTrackSwitched=function(c,u){var a=u.id,x=!!this.hls.audioTracks[a].url;if(x){var y=this.videoBuffer;y&&this.mediaBuffer!==y&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=y)}this.altAudio=x,this.tick()},T.onBufferCreated=function(c,u){var a=u.tracks,x,y,p=!1;for(var k in a){var F=a[k];if(F.id==="main"){if(y=k,x=F,k==="video"){var U=a[k];U&&(this.videoBuffer=U.buffer)}}else p=!0}p&&x?(this.log("Alternate track found, use "+y+".buffered to schedule main fragment loading"),this.mediaBuffer=x.buffer):this.mediaBuffer=this.media},T.onFragBuffered=function(c,u){var a=u.frag,x=u.part;if(a&&a.type!==A.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(x?" p: "+x.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===I.State.PARSED&&(this.state=I.State.IDLE);return}var y=x?x.stats:a.stats;this.fragLastKbps=Math.round(8*y.total/(y.buffering.end-y.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,x)},T.onError=function(c,u){switch(u.details){case b.ErrorDetails.FRAG_LOAD_ERROR:case b.ErrorDetails.FRAG_LOAD_TIMEOUT:case b.ErrorDetails.KEY_LOAD_ERROR:case b.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.MAIN,u);break;case b.ErrorDetails.LEVEL_LOAD_ERROR:case b.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==I.State.ERROR&&(u.fatal?(this.warn(""+u.details),this.state=I.State.ERROR):!u.levelRetry&&this.state===I.State.WAITING_LEVEL&&(this.state=I.State.IDLE));break;case b.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="main"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var a=!0,x=this.getFwdBufferInfo(this.media,A.PlaylistLevelType.MAIN);x&&x.len>.5&&(a=!this.reduceMaxBufferLength(x.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},T.checkBuffer=function(){var c=this.media,u=this.gapController;if(!c||!u||!c.readyState)return;var a=N.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):u.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},T.onFragLoadEmergencyAborted=function(){this.state=I.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},T.onBufferFlushed=function(c,u){var a=u.type;if(a!==f.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var x=(a===f.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(x,a,A.PlaylistLevelType.MAIN)}},T.onLevelsUpdated=function(c,u){this.levels=u.levels},T.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},T.seekToStartPos=function(){var c=this.media,u=c.currentTime,a=this.startPosition;if(a>=0&&u0&&(p1&&c.seeking===!1){var a=c.currentTime;if(N.BufferHelper.isBuffered(c,a)?u=this.getAppendedFrag(a):N.BufferHelper.isBuffered(c,a+.1)&&(u=this.getAppendedFrag(a+.1)),u){var x=this.fragPlaying,y=u.level;(!x||u.sn!==x.sn||x.level!==y||u.urlId!==x.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:u}),(!x||x.level!==y)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:y}),this.fragPlaying=u)}}},o(D,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var u=this.getAppendedFrag(c.currentTime);if(u)return u.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var u=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(u)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),D}(I.default)},"./src/controller/subtitle-stream-controller.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"SubtitleStreamController",function(){return s});var H=L("./src/events.ts"),I=L("./src/utils/logger.ts"),O=L("./src/utils/buffer-helper.ts"),B=L("./src/controller/fragment-finders.ts"),N=L("./src/utils/discontinuities.ts"),R=L("./src/controller/level-helper.ts"),A=L("./src/controller/fragment-tracker.ts"),f=L("./src/controller/base-stream-controller.ts"),v=L("./src/types/loader.ts"),P=L("./src/types/level.ts");function w(d,C){for(var g=0;g=u[y].start&&x<=u[y].end){a=u[y];break}var p=h.start+h.duration;a?a.end=p:(a={start:x,end:p},u.push(a)),this.fragmentTracker.fragBuffered(h)},g.onBufferFlushing=function(D,T){var h=T.startOffset,c=T.endOffset;if(h===0&&c!==Number.POSITIVE_INFINITY){var u=this.currentTrackId,a=this.levels;if(!a.length||!a[u]||!a[u].details)return;var x=a[u].details,y=x.targetduration,p=c-y;if(p<=0)return;T.endOffsetSubtitles=Math.max(0,p),this.tracksBuffered.forEach(function(k){for(var F=0;F=x.length||u!==a||!y)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(h=y.details)!==null&&h!==void 0&&h.live){var p=this.mainDetails;if(c.deltaUpdateFailed||!p)return;var k=p.fragments[0];if(!y.details)c.hasProgramDateTime&&p.hasProgramDateTime?Object(N.alignMediaPlaylistByPDT)(c,p):k&&Object(R.addSliding)(c,k.start);else{var F=this.alignPlaylists(c,y.details);F===0&&k&&Object(R.addSliding)(c,k.start)}}if(y.details=c,this.levelLastLoaded=u,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===f.State.IDLE){var U=Object(B.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);U||(this.warn("Subtitle playlist not aligned with playback"),y.details=void 0)}},g._handleFragmentLoadComplete=function(D){var T=D.frag,h=D.payload,c=T.decryptdata,u=this.hls;if(this.fragContextChanged(T))return;if(h&&h.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(h),c.key.buffer,c.iv.buffer).then(function(x){var y=performance.now();u.trigger(H.Events.FRAG_DECRYPTED,{frag:T,payload:x,stats:{tstart:a,tdecrypt:y}})})}},g.doTick=function(){if(!this.media){this.state=f.State.IDLE;return}if(this.state===f.State.IDLE){var D,T=this.currentTrackId,h=this.levels;if(!h.length||!h[T]||!h[T].details)return;var c=h[T].details,u=c.targetduration,a=this.config,x=this.media,y=O.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,x.currentTime-u,a.maxBufferHole),p=y.end,k=y.len,F=this.getMaxBufferLength()+u;if(k>F)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var U=c.fragments,W=U.length,_=c.edge,M,G=this.fragPrevious;if(p<_){var Y=a.maxFragLookUpTolerance;G&&c.hasProgramDateTime&&(M=Object(B.findFragmentByPDT)(U,G.endProgramDateTime,Y)),M||(M=Object(B.findFragmentByPTS)(G,U,p,Y),!M&&G&&G.start-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},E.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},E.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=P(this.media.textTracks);o.forEach(function(s){Object(I.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},E.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},E.onManifestParsed=function(o,s){this.tracks=s.subtitleTracks},E.onSubtitleTrackLoaded=function(o,s){var d=s.id,C=s.details,g=this.trackId,m=this.tracksInGroup[g];if(!m){this.warn("Invalid subtitle track id "+d);return}var D=m.details;m.details=s.details,this.log("subtitle track "+d+" loaded ["+C.startSN+"-"+C.endSN+"]"),d===this.trackId&&(this.retryCount=0,this.playlistLoaded(d,s,D))},E.onLevelLoading=function(o,s){this.switchLevel(s.level)},E.onLevelSwitching=function(o,s){this.switchLevel(s.level)},E.switchLevel=function(o){var s=this.hls.levels[o];if(!(s!=null&&s.textGroupIds))return;var d=s.textGroupIds[s.urlId];if(this.groupId!==d){var C=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,g=this.tracks.filter(function(T){return!d||T.groupId===d});this.tracksInGroup=g;var m=this.findTrackId(C==null?void 0:C.name)||this.findTrackId();this.groupId=d;var D={subtitleTracks:g};this.log("Updating subtitle tracks, "+g.length+' track(s) found in "'+d+'" group-id'),this.hls.trigger(H.Events.SUBTITLE_TRACKS_UPDATED,D),m!==-1&&this.setSubtitleTrack(m,C)}},E.findTrackId=function(o){for(var s=this.tracksInGroup,d=0;d=C.length)return;this.clearTimer();var g=C[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,g){var m=g.id,D=g.groupId,T=D===void 0?"":D,h=g.name,c=g.type,u=g.url;this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:T,name:h,type:c,url:u});var a=this.switchParams(g.url,s==null?void 0:s.details);this.loadPlaylist(a)}else this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:o})},E.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,s=P(this.media.textTracks),d=0;d=0&&(c[0]=Math.min(c[0],C),c[1]=Math.max(c[1],g),T=!0,u/(g-C)>.5))return}if(T||D.push([C,g]),this.config.renderTextTracksNatively){var a=this.captionsTracks[d];this.Cues.newCue(a,C,g,m)}else{var x=this.Cues.newCue(null,C,g,m);this.hls.trigger(I.Events.CUES_PARSED,{type:"captions",cues:x,track:d})}},o.onInitPtsFound=function(d,C){var g=this,m=C.frag,D=C.id,T=C.initPTS,h=C.timescale,c=this.unparsedVttFrags;D==="main"&&(this.initPTS[m.cc]=T,this.timescale[m.cc]=h),c.length&&(this.unparsedVttFrags=[],c.forEach(function(u){g.onFragLoaded(I.Events.FRAG_LOADED,u)}))},o.getExistingTrack=function(d){var C=this.media;if(C)for(var g=0;g>>8^h&255^99,A[m]=h,f[h]=m;var c=g[m],u=g[c],a=g[u],x=g[h]*257^h*16843008;P[m]=x<<24|x>>>8,w[m]=x<<16|x>>>16,b[m]=x<<8|x>>>24,E[m]=x,x=a*16843009^u*65537^c*257^m*16843008,o[h]=x<<24|x>>>8,s[h]=x<<16|x>>>16,d[h]=x<<8|x>>>24,C[h]=x,m?(m=c^g[g[g[a^c]]],D^=g[g[D]]):m=D=1}},N.expandKey=function(A){for(var f=this.uint8ArrayToUint32Array_(A),v=!0,P=0;P>>6)+1;var x=(d[C+2]&60)>>>2;if(x>a.length-1){s.trigger(O.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+x});return}return T=(d[C+2]&1)<<2,T|=(d[C+3]&192)>>>6,H.logger.log("manifest codec:"+g+", ADTS type:"+m+", samplingIndex:"+x),/firefox/i.test(c)?x>=6?(m=5,h=new Array(4),D=x-3):(m=2,h=new Array(2),D=x):c.indexOf("android")!==-1?(m=2,h=new Array(2),D=x):(m=5,h=new Array(4),g&&(g.indexOf("mp4a.40.29")!==-1||g.indexOf("mp4a.40.5")!==-1)||!g&&x>=6?D=x-3:((g&&g.indexOf("mp4a.40.2")!==-1&&(x>=6&&T===1||/vivaldi/i.test(c))||!g&&T===1)&&(m=2,h=new Array(2)),D=x)),h[0]=m<<3,h[0]|=(x&14)>>1,h[1]|=(x&1)<<7,h[1]|=T<<3,m===5&&(h[1]|=(D&14)>>1,h[2]=(D&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:a[x],channelCount:T,codec:"mp4a.40."+m,manifestCodec:u}}function N(s,d){return s[d]===255&&(s[d+1]&246)===240}function R(s,d){return s[d+1]&1?7:9}function A(s,d){return(s[d+3]&3)<<11|s[d+4]<<3|(s[d+5]&224)>>>5}function f(s,d){return d+5=s.length)return!1;var g=A(s,d);if(g<=C)return!1;var m=d+g;return m===s.length||v(s,m)}return!1}function b(s,d,C,g,m){if(!s.samplerate){var D=B(d,C,g,m);if(!D)return;s.config=D.config,s.samplerate=D.samplerate,s.channelCount=D.channelCount,s.codec=D.codec,s.manifestCodec=D.manifestCodec,H.logger.log("parsed codec:"+s.codec+", rate:"+D.samplerate+", channels:"+D.channelCount)}}function E(s){return 1024*9e4/s}function l(s,d,C,g,m){var D=R(s,d),T=A(s,d);if(T-=D,T>0){var h=C+g*m;return{headerLength:D,frameLength:T,stamp:h}}}function o(s,d,C,g,m){var D=E(s.samplerate),T=l(d,C,g,m,D);if(T){var h=T.frameLength,c=T.headerLength,u=T.stamp,a=c+h,x=Math.max(0,C+a-d.length),y;x?(y=new Uint8Array(a-c),y.set(d.subarray(C+c,d.length),0)):y=d.subarray(C+c,C+a);var p={unit:y,pts:u};return x||s.samples.push(p),{sample:p,length:a,missing:x}}}},"./src/demux/base-audio-demuxer.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"initPTSFn",function(){return A});var H=L("./src/polyfills/number.ts"),I=L("./src/demux/id3.ts"),O=L("./src/demux/dummy-demuxed-track.ts"),B=L("./src/utils/mp4-tools.ts"),N=L("./src/utils/typed-array.ts"),R=function(){function f(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var v=f.prototype;return v.resetInitSegment=function(w,b,E){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},v.resetTimeStamp=function(){},v.resetContiguity=function(){},v.canParse=function(w,b){return!1},v.appendFrame=function(w,b,E){},v.demux=function(w,b){this.cachedData&&(w=Object(B.appendUint8Array)(this.cachedData,w),this.cachedData=null);var E=I.getID3Data(w,0),l=E?E.length:0,o,s,d=this._audioTrack,C=this._id3Track,g=E?I.getTimeStamp(E):void 0,m=w.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=A(g,b)),E&&E.length>0&&C.samples.push({pts:this.initPTS,dts:this.initPTS,data:E}),s=this.initPTS;lR?(this.word<<=R,this.bitsAvailable-=R):(R-=this.bitsAvailable,A=R>>3,R-=A>>3,this.bytesAvailable-=A,this.loadWord(),this.word<<=R,this.bitsAvailable-=R)},B.readBits=function(R){var A=Math.min(this.bitsAvailable,R),f=this.word>>>32-A;return R>32&&H.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=A,this.bitsAvailable>0?this.word<<=A:this.bytesAvailable>0&&this.loadWord(),A=R-A,A>0&&this.bitsAvailable?f<>>R)!==0)return this.word<<=R,this.bitsAvailable-=R,R;return this.loadWord(),R+this.skipLZ()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var R=this.skipLZ();return this.readBits(R+1)-1},B.readEG=function(){var R=this.readUEG();return 1&R?1+R>>>1:-1*(R>>>1)},B.readBoolean=function(){return this.readBits(1)===1},B.readUByte=function(){return this.readBits(8)},B.readUShort=function(){return this.readBits(16)},B.readUInt=function(){return this.readBits(32)},B.skipScalingList=function(R){for(var A=8,f=8,v,P=0;P0?m.subarray(T,T+h):void 0},B=function(m,D){var T=0;return T=(m[D]&127)<<21,T|=(m[D+1]&127)<<14,T|=(m[D+2]&127)<<7,T|=m[D+3]&127,T},N=function(m,D){return H(m,D)&&B(m,D+6)+10<=m.length-D},R=function(m){for(var D=v(m),T=0;T>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:p+=String.fromCharCode(a);break;case 12:case 13:x=m[k++],p+=String.fromCharCode((a&31)<<6|x&63);break;case 14:x=m[k++],y=m[k++],p+=String.fromCharCode((a&15)<<12|(x&63)<<6|(y&63)<<0);break;default:}}return p},s={decodeTextFrame:b},d;function C(){return!d&&typeof self.TextDecoder!="undefined"&&(d=new self.TextDecoder("utf-8")),d}},"./src/demux/mp3demuxer.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/id3.ts"),O=L("./src/utils/logger.ts"),B=L("./src/demux/mpegaudio.ts");function N(f,v){f.prototype=Object.create(v.prototype),f.prototype.constructor=f,R(f,v)}function R(f,v){return R=Object.setPrototypeOf||function(w,b){return w.__proto__=b,w},R(f,v)}var A=function(f){N(v,f);function v(){return f.apply(this,arguments)||this}var P=v.prototype;return P.resetInitSegment=function(b,E,l){f.prototype.resetInitSegment.call(this,b,E,l),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:b,duration:l,inputTimeScale:9e4,dropped:0}},v.probe=function(b){if(!b)return!1;for(var E=I.getID3Data(b,0)||[],l=E.length,o=b.length;l0},N.demux=function(A){var f=A,v=Object(I.dummyTrack)();if(this.config.progressive){this.remainderData&&(f=Object(H.appendUint8Array)(this.remainderData,A));var P=Object(H.segmentValidRange)(f);this.remainderData=P.remainder,v.samples=P.valid||new Uint8Array}else v.samples=f;return{audioTrack:Object(I.dummyTrack)(),avcTrack:v,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},N.flush=function(){var A=Object(I.dummyTrack)();return A.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(I.dummyTrack)(),avcTrack:A,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},N.demuxSampleAes=function(A,f,v){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},N.destroy=function(){},B}();O.minProbeByteLength=1024,K.default=O},"./src/demux/mpegaudio.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"appendFrame",function(){return R}),L.d(K,"parseHeader",function(){return A}),L.d(K,"isHeaderPattern",function(){return f}),L.d(K,"isHeader",function(){return v}),L.d(K,"canParse",function(){return P}),L.d(K,"probe",function(){return w});var H=null,I=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],O=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],B=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],N=[0,1,1,4];function R(b,E,l,o,s){if(l+24>E.length)return;var d=A(E,l);if(d&&l+d.frameLength<=E.length){var C=d.samplesPerFrame*9e4/d.sampleRate,g=o+s*C,m={unit:E.subarray(l,l+d.frameLength),pts:g,dts:g};return b.config=[],b.channelCount=d.channelCount,b.samplerate=d.sampleRate,b.samples.push(m),{sample:m,length:d.frameLength,missing:0}}}function A(b,E){var l=b[E+1]>>3&3,o=b[E+1]>>1&3,s=b[E+2]>>4&15,d=b[E+2]>>2&3;if(l!==1&&s!==0&&s!==15&&d!==3){var C=b[E+2]>>1&1,g=b[E+3]>>6,m=l===3?3-o:o===3?3:4,D=I[m*14+s-1]*1e3,T=l===3?0:l===2?1:2,h=O[T*3+d],c=g===3?1:2,u=B[l][o],a=N[o],x=u*8*a,y=Math.floor(u*D/h+C)*a;if(H===null){var p=navigator.userAgent||"",k=p.match(/Chrome\/(\d+)/i);H=k?parseInt(k[1]):0}var F=!!H&&H<=87;return F&&o===2&&D>=224e3&&g===0&&(b[E+3]=b[E+3]|128),{sampleRate:h,channelCount:c,frameLength:y,samplesPerFrame:x}}}function f(b,E){return b[E]===255&&(b[E+1]&224)===224&&(b[E+1]&6)!==0}function v(b,E){return E+1=A.length){v();return}if(A[f].unit.length<32)continue;var P=this.decrypter.isSync();if(this.decryptAacSample(A,f,v,P),!P)return}},N.getAvcEncryptedData=function(A){for(var f=Math.floor((A.length-48)/160)*16+16,v=new Int8Array(f),P=0,w=32;w<=A.length-16;w+=160,P+=16)v.set(A.subarray(w,w+16),P);return v},N.getAvcDecryptedUnit=function(A,f){for(var v=new Uint8Array(f),P=0,w=32;w<=A.length-16;w+=160,P+=16)A.set(v.subarray(P,P+16),w);return A},N.decryptAvcSample=function(A,f,v,P,w,b){var E=Object(I.discardEPB)(w.data),l=this.getAvcEncryptedData(E),o=this;this.decryptBuffer(l.buffer,function(s){w.data=o.getAvcDecryptedUnit(E,s),b||o.decryptAvcSamples(A,f,v+1,P)})},N.decryptAvcSamples=function(A,f,v,P){if(A instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;f++,v=0){if(f>=A.length){P();return}for(var w=A[f].units;!(v>=w.length);v++){var b=w[v];if(b.data.length<=48||b.type!==1&&b.type!==5)continue;var E=this.decrypter.isSync();if(this.decryptAvcSample(A,f,v,P,b,E),!E)return}}},B}();K.default=O},"./src/demux/transmuxer-interface.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return w});var H=L("./node_modules/webworkify-webpack/index.js"),I=L.n(H),O=L("./src/events.ts"),B=L("./src/demux/transmuxer.ts"),N=L("./src/utils/logger.ts"),R=L("./src/errors.ts"),A=L("./src/utils/mediasource-helper.ts"),f=L("./node_modules/eventemitter3/index.js"),v=L.n(f),P=Object(A.getMediaSource)()||{isTypeSupported:function(){return!1}},w=function(){function b(l,o,s,d){var C=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=l,this.id=o,this.onTransmuxComplete=s,this.onFlush=d;var g=l.config,m=function(u,a){a=a||{},a.frag=C.frag,a.id=C.id,l.trigger(u,a)};this.observer=new f.EventEmitter,this.observer.on(O.Events.FRAG_DECRYPTED,m),this.observer.on(O.Events.ERROR,m);var D={mp4:P.isTypeSupported("video/mp4"),mpeg:P.isTypeSupported("audio/mpeg"),mp3:P.isTypeSupported('audio/mp4; codecs="mp3"')},T=navigator.vendor;if(g.enableWorker&&typeof Worker!="undefined"){N.logger.log("demuxing in webworker");var h;try{h=this.worker=H("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(c){l.trigger(O.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},h.postMessage({cmd:"init",typeSupported:D,vendor:T,id:o,config:JSON.stringify(g)})}catch(c){N.logger.warn("Error in worker:",c),N.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new B.default(this.observer,D,g,T,o),this.worker=null}}else this.transmuxer=new B.default(this.observer,D,g,T,o)}var E=b.prototype;return E.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var d=this.observer;d&&d.removeAllListeners(),this.observer=null},E.push=function(o,s,d,C,g,m,D,T,h,c){var u=this;h.transmuxing.start=self.performance.now();var a=this.transmuxer,x=this.worker,y=m?m.start:g.start,p=g.decryptdata,k=this.frag,F=!(k&&g.cc===k.cc),U=!(k&&h.level===k.level),W=k?h.sn-k.sn:-1,_=this.part?h.part-this.part.index:1,M=!U&&(W===1||W===0&&_===1),G=self.performance.now();(U||W||g.stats.parsing.start===0)&&(g.stats.parsing.start=G),m&&(_||!M)&&(m.stats.parsing.start=G);var Y=new B.TransmuxState(F,M,T,U,y);if(!M||F){N.logger.log("[transmuxer-interface, "+g.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+` discontinuity: `+F+` trackSwitch: `+U+` contiguous: `+M+` accurateTimeOffset: `+T+` timeOffset: `+y);var Z=new B.TransmuxConfig(d,C,s,D,c);this.configureTransmuxer(Z)}if(this.frag=g,this.part=m,x)x.postMessage({cmd:"demux",data:o,decryptdata:p,chunkMeta:h,state:Y},o instanceof ArrayBuffer?[o]:[]);else if(a){var ne=a.push(o,p,h,Y);Object(B.isPromise)(ne)?ne.then(function(be){u.handleTransmuxComplete(be)}):this.handleTransmuxComplete(ne)}},E.flush=function(o){var s=this;o.transmuxing.start=self.performance.now();var d=this.transmuxer,C=this.worker;if(C)C.postMessage({cmd:"flush",chunkMeta:o});else if(d){var g=d.flush(o);Object(B.isPromise)(g)?g.then(function(m){s.handleFlushResult(m,o)}):this.handleFlushResult(g,o)}},E.handleFlushResult=function(o,s){var d=this;o.forEach(function(C){d.handleTransmuxComplete(C)}),this.onFlush(s)},E.onWorkerMessage=function(o){var s=o.data,d=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,d.trigger(s.event,s.data);break}}},E.configureTransmuxer=function(o){var s=this.worker,d=this.transmuxer;s?s.postMessage({cmd:"configure",config:o}):d&&d.configure(o)},E.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},b}()},"./src/demux/transmuxer-worker.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return R});var H=L("./src/demux/transmuxer.ts"),I=L("./src/events.ts"),O=L("./src/utils/logger.ts"),B=L("./node_modules/eventemitter3/index.js"),N=L.n(B);function R(w){var b=new B.EventEmitter,E=function(o,s){w.postMessage({event:o,data:s})};b.on(I.Events.FRAG_DECRYPTED,E),b.on(I.Events.ERROR,E),w.addEventListener("message",function(l){var o=l.data;switch(o.cmd){case"init":{var s=JSON.parse(o.config);w.transmuxer=new H.default(b,o.typeSupported,s,o.vendor,o.id),Object(O.enableLogs)(s.debug),E("init",null);break}case"configure":{w.transmuxer.configure(o.config);break}case"demux":{var d=w.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(H.isPromise)(d)?d.then(function(m){A(w,m)}):A(w,d);break}case"flush":{var C=o.chunkMeta,g=w.transmuxer.flush(C);Object(H.isPromise)(g)?g.then(function(m){v(w,m,C)}):v(w,g,C);break}default:break}})}function A(w,b){if(P(b.remuxResult))return;var E=[],l=b.remuxResult,o=l.audio,s=l.video;o&&f(E,o),s&&f(E,s),w.postMessage({event:"transmuxComplete",data:b},E)}function f(w,b){b.data1&&w.push(b.data1.buffer),b.data2&&w.push(b.data2.buffer)}function v(w,b,E){b.forEach(function(l){A(w,l)}),w.postMessage({event:"flush",data:E})}function P(w){return!w.audio&&!w.video&&!w.text&&!w.id3&&!w.initSegment}},"./src/demux/transmuxer.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return s}),L.d(K,"isPromise",function(){return g}),L.d(K,"TransmuxConfig",function(){return m}),L.d(K,"TransmuxState",function(){return D});var H=L("./src/events.ts"),I=L("./src/errors.ts"),O=L("./src/crypt/decrypter.ts"),B=L("./src/demux/aacdemuxer.ts"),N=L("./src/demux/mp4demuxer.ts"),R=L("./src/demux/tsdemuxer.ts"),A=L("./src/demux/mp3demuxer.ts"),f=L("./src/remux/mp4-remuxer.ts"),v=L("./src/remux/passthrough-remuxer.ts"),P=L("./src/demux/chunk-cache.ts"),w=L("./src/utils/mp4-tools.ts"),b=L("./src/utils/logger.ts"),E;try{E=self.performance.now.bind(self.performance)}catch(T){b.logger.debug("Unable to use Performance API on this environment"),E=self.Date.now}var l=[{demux:R.default,remux:f.default},{demux:N.default,remux:v.default},{demux:B.default,remux:f.default},{demux:A.default,remux:f.default}],o=1024;l.forEach(function(T){var h=T.demux;o=Math.max(o,h.minProbeByteLength)});var s=function(){function T(c,u,a,x,y){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new P.default,this.observer=c,this.typeSupported=u,this.config=a,this.vendor=x,this.id=y}var h=T.prototype;return h.configure=function(u){this.transmuxConfig=u,this.decrypter&&this.decrypter.reset()},h.push=function(u,a,x,y){var p=this,k=x.transmuxing;k.executeStart=E();var F=new Uint8Array(u),U=this.cache,W=this.config,_=this.currentTransmuxState,M=this.transmuxConfig;y&&(this.currentTransmuxState=y);var G=d(F,a);if(G&&G.method==="AES-128"){var Y=this.getDecrypter();if(W.enableSoftwareAES){var Z=Y.softwareDecrypt(F,G.key.buffer,G.iv.buffer);if(!Z)return k.executeEnd=E(),C(x);F=new Uint8Array(Z)}else return this.decryptionPromise=Y.webCryptoDecrypt(F,G.key.buffer,G.iv.buffer).then(function(Se){var De=p.push(Se,null,x);return p.decryptionPromise=null,De}),this.decryptionPromise}var ne=y||_,be=ne.contiguous,me=ne.discontinuity,pe=ne.trackSwitch,ue=ne.accurateTimeOffset,fe=ne.timeOffset,ie=M.audioCodec,he=M.videoCodec,$=M.defaultInitPts,ae=M.duration,ee=M.initSegmentData;if((me||pe)&&this.resetInitSegment(ee,ie,he,ae),me&&this.resetInitialTimestamp($),be||this.resetContiguity(),this.needsProbing(F,me,pe)){if(U.dataLength){var Ee=U.flush();F=Object(w.appendUint8Array)(Ee,F)}this.configureTransmuxer(F,M)}var Ce=this.transmux(F,G,fe,ue,x),ve=this.currentTransmuxState;return ve.contiguous=!0,ve.discontinuity=!1,ve.trackSwitch=!1,k.executeEnd=E(),Ce},h.flush=function(u){var a=this,x=u.transmuxing;x.executeStart=E();var y=this.decrypter,p=this.cache,k=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return a.flush(u)});var U=[],W=k.timeOffset;if(y){var _=y.flush();_&&U.push(this.push(_,null,u))}var M=p.dataLength;p.reset();var G=this.demuxer,Y=this.remuxer;if(!G||!Y)return M>=o&&this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),x.executeEnd=E(),[C(u)];var Z=G.flush(W);return g(Z)?Z.then(function(ne){return a.flushRemux(U,ne,u),U}):(this.flushRemux(U,Z,u),U)},h.flushRemux=function(u,a,x){var y=a.audioTrack,p=a.avcTrack,k=a.id3Track,F=a.textTrack,U=this.currentTransmuxState,W=U.accurateTimeOffset,_=U.timeOffset;b.logger.log("[transmuxer.ts]: Flushed fragment "+x.sn+(x.part>-1?" p: "+x.part:"")+" of level "+x.level);var M=this.remuxer.remux(y,p,k,F,_,W,!0,this.id);u.push({remuxResult:M,chunkMeta:x}),x.transmuxing.executeEnd=E()},h.resetInitialTimestamp=function(u){var a=this.demuxer,x=this.remuxer;if(!a||!x)return;a.resetTimeStamp(u),x.resetTimeStamp(u)},h.resetContiguity=function(){var u=this.demuxer,a=this.remuxer;if(!u||!a)return;u.resetContiguity(),a.resetNextTimestamp()},h.resetInitSegment=function(u,a,x,y){var p=this.demuxer,k=this.remuxer;if(!p||!k)return;p.resetInitSegment(a,x,y),k.resetInitSegment(u,a,x)},h.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},h.transmux=function(u,a,x,y,p){var k;return a&&a.method==="SAMPLE-AES"?k=this.transmuxSampleAes(u,a,x,y,p):k=this.transmuxUnencrypted(u,x,y,p),k},h.transmuxUnencrypted=function(u,a,x,y){var p=this.demuxer.demux(u,a,!1,!this.config.progressive),k=p.audioTrack,F=p.avcTrack,U=p.id3Track,W=p.textTrack,_=this.remuxer.remux(k,F,U,W,a,x,!1,this.id);return{remuxResult:_,chunkMeta:y}},h.transmuxSampleAes=function(u,a,x,y,p){var k=this;return this.demuxer.demuxSampleAes(u,a,x).then(function(F){var U=k.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,x,y,!1,k.id);return{remuxResult:U,chunkMeta:p}})},h.configureTransmuxer=function(u,a){for(var x=this.config,y=this.observer,p=this.typeSupported,k=this.vendor,F=a.audioCodec,U=a.defaultInitPts,W=a.duration,_=a.initSegmentData,M=a.videoCodec,G,Y=0,Z=l.length;Y0&&h!=null&&h.key!=null&&h.iv!==null&&h.method!=null&&(c=h),c}var C=function(h){return{remuxResult:{},chunkMeta:h}};function g(T){return"then"in T&&T.then instanceof Function}var m=function(h,c,u,a,x){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=h,this.videoCodec=c,this.initSegmentData=u,this.duration=a,this.defaultInitPts=x},D=function(h,c,u,a,x){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=h,this.contiguous=c,this.accurateTimeOffset=u,this.trackSwitch=a,this.timeOffset=x}},"./src/demux/tsdemuxer.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"discardEPB",function(){return C});var H=L("./src/demux/adts.ts"),I=L("./src/demux/mpegaudio.ts"),O=L("./src/demux/exp-golomb.ts"),B=L("./src/demux/id3.ts"),N=L("./src/demux/sample-aes.ts"),R=L("./src/events.ts"),A=L("./src/utils/mp4-tools.ts"),f=L("./src/utils/logger.ts"),v=L("./src/errors.ts"),P={video:1,audio:2,id3:3,text:4},w=function(){function g(D,T,h){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=D,this.config=T,this.typeSupported=h}g.probe=function(T){var h=g.syncOffset(T);return h<0?!1:(h&&f.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},g.syncOffset=function(T){for(var h=Math.min(1e3,T.length-3*188),c=0;c>4,ie=void 0;if(fe>1){if(ie=me+5+T[me+4],ie===me+188)continue}else ie=me+4;switch(ue){case k:pe&&(F&&(a=o(F))&&this.parseAVCPES(a,!1),F={data:[],size:0}),F&&(F.data.push(T.subarray(ie,me+188)),F.size+=me+188-ie);break;case U:pe&&(_&&(a=o(_))&&(y.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),_={data:[],size:0}),_&&(_.data.push(T.subarray(ie,me+188)),_.size+=me+188-ie);break;case W:pe&&(M&&(a=o(M))&&this.parseID3PES(a),M={data:[],size:0}),M&&(M.data.push(T.subarray(ie,me+188)),M.size+=me+188-ie);break;case 0:pe&&(ie+=T[ie]+1),Z=this._pmtId=E(T,ie);break;case Z:{pe&&(ie+=T[ie]+1);var he=l(T,ie,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);k=he.avc,k>0&&(x.pid=k),U=he.audio,U>0&&(y.pid=U,y.isAAC=he.isAAC),W=he.id3,W>0&&(p.pid=W),G&&!Y&&(f.logger.log("reparse from beginning"),G=!1,me=be-188),Y=this.pmtParsed=!0;break}case 17:case 8191:break;default:G=!0;break}}else this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});x.pesData=F,y.pesData=_,p.pesData=M;var $={audioTrack:y,avcTrack:x,id3Track:p,textTrack:this._txtTrack};return u&&this.extractRemainingSamples($),$},m.flush=function(){var T=this.remainderData;this.remainderData=null;var h;return T?h=this.demux(T,-1,!1,!0):h={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(h),this.sampleAes?this.decrypt(h,this.sampleAes):h},m.extractRemainingSamples=function(T){var h=T.audioTrack,c=T.avcTrack,u=T.id3Track,a=c.pesData,x=h.pesData,y=u.pesData,p;a&&(p=o(a))?(this.parseAVCPES(p,!0),c.pesData=null):c.pesData=a,x&&(p=o(x))?(h.isAAC?this.parseAACPES(p):this.parseMPEGPES(p),h.pesData=null):(x!=null&&x.size&&f.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=x),y&&(p=o(y))?(this.parseID3PES(p),u.pesData=null):u.pesData=y},m.demuxSampleAes=function(T,h,c){var u=this.demux(T,c,!0,!this.config.progressive),a=this.sampleAes=new N.default(this.observer,this.config,h);return this.decrypt(u,a)},m.decrypt=function(T,h){return new Promise(function(c){var u=T.audioTrack,a=T.avcTrack;u.samples&&u.isAAC?h.decryptAacSamples(u.samples,0,function(){a.samples?h.decryptAvcSamples(a.samples,0,0,function(){c(T)}):c(T)}):a.samples&&h.decryptAvcSamples(a.samples,0,0,function(){c(T)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(T,h){var c=this,u=this._avcTrack,a=this.parseAVCNALu(T.data),x=!1,y=this.avcSample,p,k=!1;T.data=null,y&&a.length&&!u.audFound&&(s(y,u),y=this.avcSample=b(!1,T.pts,T.dts,"")),a.forEach(function(F){switch(F.type){case 1:{p=!0,y||(y=c.avcSample=b(!0,T.pts,T.dts,"")),x&&(y.debug+="NDR "),y.frame=!0;var U=F.data;if(k&&U.length>4){var W=new O.default(U).readSliceType();(W===2||W===4||W===7||W===9)&&(y.key=!0)}break}case 5:p=!0,y||(y=c.avcSample=b(!0,T.pts,T.dts,"")),x&&(y.debug+="IDR "),y.key=!0,y.frame=!0;break;case 6:{p=!0,x&&y&&(y.debug+="SEI ");var _=new O.default(C(F.data));_.readUByte();for(var M=0,G=0,Y=!1,Z=0;!Y&&_.bytesAvailable>1;){M=0;do Z=_.readUByte(),M+=Z;while(Z===255);G=0;do Z=_.readUByte(),G+=Z;while(Z===255);if(M===4&&_.bytesAvailable!==0){Y=!0;var ne=_.readUByte();if(ne===181){var be=_.readUShort();if(be===49){var me=_.readUInt();if(me===1195456820){var pe=_.readUByte();if(pe===3){for(var ue=_.readUByte(),fe=_.readUByte(),ie=31&ue,he=[ue,fe],$=0;$16){for(var ae=[],ee=0;ee<16;ee++)ae.push(_.readUByte().toString(16)),(ee===3||ee===5||ee===7||ee===9)&&ae.push("-");for(var Ee=G-16,Ce=new Uint8Array(Ee),ve=0;ve=0){var _={data:T.subarray(U,y-u-1),type:W};x.push(_)}else{var M=this.getLastNalUnit();if(M&&(a&&y<=4-a&&(M.state&&(M.data=M.data.subarray(0,M.data.byteLength-a))),k=y-u-1,k>0)){var G=new Uint8Array(M.data.byteLength+k);G.set(M.data,0),G.set(T.subarray(0,k),M.data.byteLength),M.data=G,M.state=0}}y=0&&u>=0){var Y={data:T.subarray(U,h),type:W,state:u};x.push(Y)}if(x.length===0){var Z=this.getLastNalUnit();if(Z){var ne=new Uint8Array(Z.data.byteLength+T.byteLength);ne.set(Z.data,0),ne.set(T,Z.data.byteLength),Z.data=ne}}return c.naluState=u,x},m.parseAACPES=function(T){var h=0,c=this._audioTrack,u=this.aacOverFlow,a=T.data;if(u){this.aacOverFlow=null;var x=u.sample.unit.byteLength,y=Math.min(u.missing,x),p=x-y;u.sample.unit.set(a.subarray(0,y),p),c.samples.push(u.sample),h=u.missing}var k,F;for(k=h,F=a.length;k1;){var x=new Uint8Array(a[0].length+a[1].length);x.set(a[0]),x.set(a[1],a[0].length),a[0]=x,a.splice(1,1)}D=a[0];var y=(D[0]<<16)+(D[1]<<8)+D[2];if(y===1){if(T=(D[4]<<8)+D[5],T&&T>g.size-6)return null;var p=D[7];p&192&&(c=(D[9]&14)*536870912+(D[10]&255)*4194304+(D[11]&254)*16384+(D[12]&255)*128+(D[13]&254)/2,p&64?(u=(D[14]&14)*536870912+(D[15]&255)*4194304+(D[16]&254)*16384+(D[17]&255)*128+(D[18]&254)/2,c-u>60*9e4&&(f.logger.warn(Math.round((c-u)/9e4)+"s delta between PTS and DTS, align them"),c=u)):u=c),h=D[8];var k=h+9;if(g.size<=k)return null;g.size-=k;for(var F=new Uint8Array(g.size),U=0,W=a.length;U_){k-=_;continue}else D=D.subarray(k),_-=k,k=0;F.set(D,m),m+=_}return T&&(T-=h+3),{data:F,pts:c,dts:u,len:T}}return null}function s(g,m){if(g.units.length&&g.frame){if(g.pts===void 0){var D=m.samples,T=D.length;if(T){var h=D[T-1];g.pts=h.pts,g.dts=h.dts}else{m.dropped++;return}}m.samples.push(g)}g.debug.length&&f.logger.log(g.pts+"/"+g.dts+":"+g.debug)}function d(g,m){var D=g.length;if(D>0){if(m.pts>=g[D-1].pts)g.push(m);else for(var T=D-1;T>=0;T--)if(m.ptsc)return a;return 0}},{key:"maxAutoLevel",get:function(){var h=this.levels,c=this.autoLevelCapping,u;return c===-1&&h&&h.length?u=h.length-1:u=c,u}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(h){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,h)}},{key:"audioTracks",get:function(){var h=this.audioTrackController;return h?h.audioTracks:[]}},{key:"audioTrack",get:function(){var h=this.audioTrackController;return h?h.audioTrack:-1},set:function(h){var c=this.audioTrackController;c&&(c.audioTrack=h)}},{key:"subtitleTracks",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTrack:-1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleTrack=h)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var h=this.subtitleTrackController;return h?h.subtitleDisplay:!1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=h)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(h){this.config.lowLatencyMode=h}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return m.defaultConfig?m.defaultConfig:b.hlsDefaultConfig},set:function(h){m.defaultConfig=h}}]),m}();g.defaultConfig=void 0},"./src/is-supported.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"isSupported",function(){return O}),L.d(K,"changeTypeSupported",function(){return B});var H=L("./src/utils/mediasource-helper.ts");function I(){return self.SourceBuffer||self.WebKitSourceBuffer}function O(){var N=Object(H.getMediaSource)();if(!N)return!1;var R=I(),A=N&&typeof N.isTypeSupported=="function"&&N.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),f=!R||R.prototype&&typeof R.prototype.appendBuffer=="function"&&typeof R.prototype.remove=="function";return!!A&&!!f}function B(){var N,R=I();return typeof(R==null||((N=R.prototype)===null||N===void 0)?void 0:N.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return w}),L.d(K,"LoadError",function(){return E});var H=L("./src/polyfills/number.ts"),I=L("./src/errors.ts");function O(l,o){l.prototype=Object.create(o.prototype),l.prototype.constructor=l,f(l,o)}function B(l){var o=typeof Map=="function"?new Map:void 0;return B=function(d){if(d===null||!A(d))return d;if(typeof d!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(d))return o.get(d);o.set(d,C)}function C(){return N(d,arguments,v(this).constructor)}return C.prototype=Object.create(d.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),f(C,d)},B(l)}function N(l,o,s){return R()?N=Reflect.construct:N=function(C,g,m){var D=[null];D.push.apply(D,g);var T=Function.bind.apply(C,D),h=new T;return m&&f(h,m.prototype),h},N.apply(null,arguments)}function R(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function A(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function f(l,o){return f=Object.setPrototypeOf||function(d,C){return d.__proto__=C,d},f(l,o)}function v(l){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},v(l)}var P=Math.pow(2,17),w=function(){function l(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var o=l.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(d,C){var g=this,m=d.url;if(!m)return Promise.reject(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var D=this.config,T=D.fLoader,h=D.loader;return new Promise(function(c,u){g.loader&&g.loader.destroy();var a=g.loader=d.loader=T?new T(D):new h(D),x=b(d),y={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:P};d.stats=a.stats,a.load(x,y,{onSuccess:function(k,F,U,W){g.resetLoader(d,a),c({frag:d,part:null,payload:k.data,networkDetails:W})},onError:function(k,F,U){g.resetLoader(d,a),u(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,response:k,networkDetails:U}))},onAbort:function(k,F,U){g.resetLoader(d,a),u(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,networkDetails:U}))},onTimeout:function(k,F,U){g.resetLoader(d,a),u(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,networkDetails:U}))},onProgress:function(k,F,U,W){C&&C({frag:d,part:null,payload:U,networkDetails:W})}})})},o.loadPart=function(d,C,g){var m=this;this.abort();var D=this.config,T=D.fLoader,h=D.loader;return new Promise(function(c,u){m.loader&&m.loader.destroy();var a=m.loader=d.loader=T?new T(D):new h(D),x=b(d,C),y={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:P};C.stats=a.stats,a.load(x,y,{onSuccess:function(k,F,U,W){m.resetLoader(d,a),m.updateStatsFromPart(d,C);var _={frag:d,part:C,payload:k.data,networkDetails:W};g(_),c(_)},onError:function(k,F,U){m.resetLoader(d,a),u(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,part:C,response:k,networkDetails:U}))},onAbort:function(k,F,U){d.stats.aborted=C.stats.aborted,m.resetLoader(d,a),u(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,part:C,networkDetails:U}))},onTimeout:function(k,F,U){m.resetLoader(d,a),u(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,part:C,networkDetails:U}))}})})},o.updateStatsFromPart=function(d,C){var g=d.stats,m=C.stats,D=m.total;if(g.loaded+=m.loaded,D){var T=Math.round(d.duration/C.duration),h=Math.min(Math.round(g.loaded/D),T),c=T-h,u=c*Math.round(g.loaded/h);g.total=g.loaded+u}else g.total=Math.max(g.loaded,g.total);var a=g.loading,x=m.loading;a.start?a.first+=x.first-x.start:(a.start=x.start,a.first=x.first),a.end=x.end},o.resetLoader=function(d,C){d.loader=null,this.loader===C&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),C.destroy()},l}();function b(l,o){o===void 0&&(o=null);var s=o||l,d={frag:l,part:o,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},C=s.byteRangeStartOffset,g=s.byteRangeEndOffset;return Object(H.isFiniteNumber)(C)&&Object(H.isFiniteNumber)(g)&&(d.rangeStart=C,d.rangeEnd=g),d}var E=function(l){O(o,l);function o(s){for(var d,C=arguments.length,g=new Array(C>1?C-1:0),m=1;m>8*(15-D)&255;return m},d.setDecryptDataFromLevelKey=function(g,m){var D=g;return(g==null?void 0:g.method)==="AES-128"&&g.uri&&!g.iv&&(D=N.LevelKey.fromURI(g.uri),D.method=g.method,D.iv=this.createInitializationVector(m),D.keyFormat="identity"),D},d.setElementaryStreamInfo=function(g,m,D,T,h,c){c===void 0&&(c=!1);var u=this.elementaryStreams,a=u[g];if(!a){u[g]={startPTS:m,endPTS:D,startDTS:T,endDTS:h,partial:c};return}a.startPTS=Math.min(a.startPTS,m),a.endPTS=Math.max(a.endPTS,D),a.startDTS=Math.min(a.startDTS,T),a.endDTS=Math.max(a.endDTS,h)},d.clearElementaryStreamInfo=function(){var g=this.elementaryStreams;g[w.AUDIO]=null,g[w.VIDEO]=null,g[w.AUDIOVIDEO]=null},P(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var g=this.sn;typeof g!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&B.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),g=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,g)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(H.isFiniteNumber)(this.programDateTime))return null;var g=Object(H.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+g*1e3}},{key:"encrypted",get:function(){var g;return!!((g=this.decryptdata)!==null&&g!==void 0&&g.keyFormat&&this.decryptdata.uri)}}]),s}(b),l=function(o){A(s,o);function s(d,C,g,m,D){var T;T=o.call(this,g)||this,T.fragOffset=0,T.duration=0,T.gap=!1,T.independent=!1,T.relurl=void 0,T.fragment=void 0,T.index=void 0,T.stats=new R.LoadStats,T.duration=d.decimalFloatingPoint("DURATION"),T.gap=d.bool("GAP"),T.independent=d.bool("INDEPENDENT"),T.relurl=d.enumeratedString("URI"),T.fragment=C,T.index=m;var h=d.enumeratedString("BYTERANGE");return h&&T.setByteRange(h,D),D&&(T.fragOffset=D.fragOffset+D.duration),T}return P(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var C=this.elementaryStreams;return!!(C.audio||C.video||C.audiovideo)}}]),s}(b)},"./src/loader/key-loader.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return B});var H=L("./src/events.ts"),I=L("./src/errors.ts"),O=L("./src/utils/logger.ts"),B=function(){function N(A){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=A,this._registerListeners()}var R=N.prototype;return R._registerListeners=function(){this.hls.on(H.Events.KEY_LOADING,this.onKeyLoading,this)},R._unregisterListeners=function(){this.hls.off(H.Events.KEY_LOADING,this.onKeyLoading)},R.destroy=function(){this._unregisterListeners();for(var f in this.loaders){var v=this.loaders[f];v&&v.destroy()}this.loaders={}},R.onKeyLoading=function(f,v){var P=v.frag,w=P.type,b=this.loaders[w];if(!P.decryptdata){O.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var E=P.decryptdata.uri;if(E!==this.decrypturl||this.decryptkey===null){var l=this.hls.config;if(b&&(O.logger.warn("abort previous key loader for type:"+w),b.abort()),!E){O.logger.warn("key uri is falsy");return}var o=l.loader,s=P.loader=this.loaders[w]=new o(l);this.decrypturl=E,this.decryptkey=null;var d={url:E,frag:P,responseType:"arraybuffer"},C={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(d,C,g)}else this.decryptkey&&(P.decryptdata.key=this.decryptkey,this.hls.trigger(H.Events.KEY_LOADED,{frag:P}))},R.loadsuccess=function(f,v,P){var w=P.frag;if(!w.decryptdata){O.logger.error("after key load, decryptdata unset");return}this.decryptkey=w.decryptdata.key=new Uint8Array(f.data),w.loader=null,delete this.loaders[w.type],this.hls.trigger(H.Events.KEY_LOADED,{frag:w})},R.loaderror=function(f,v){var P=v.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:P,response:f})},R.loadtimeout=function(f,v){var P=v.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:P})},N}()},"./src/loader/level-details.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"LevelDetails",function(){return N});var H=L("./src/polyfills/number.ts");function I(R,A){for(var f=0;fv.endSN||P>0||P===0&&w>0,this.updated||this.advanced?this.misses=Math.floor(v.misses*.6):this.misses=v.misses+1,this.availabilityDelay=v.availabilityDelay},O(R,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(H.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var v=this.driftEndTime-this.driftStartTime;if(v>0){var P=this.driftEnd-this.driftStart;return P*1e3/v}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var v;return(v=this.partList)!==null&&v!==void 0&&v.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var v;return(v=this.fragments)!==null&&v!==void 0&&v.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var v;return(v=this.partList)!==null&&v!==void 0&&v.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var v;return(v=this.partList)!==null&&v!==void 0&&v.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),R}()},"./src/loader/level-key.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"LevelKey",function(){return N});var H=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(H);function O(R,A){for(var f=0;f2){var u=c.shift()+".";return u+=parseInt(c.shift()).toString(16),u+=("000"+parseInt(c.shift()).toString(16)).substr(-4),u}return h},D.resolve=function(h,c){return I.buildAbsoluteURL(c,h,{alwaysNormalize:!0})},D.parseMasterPlaylist=function(h,c){var u=[],a={},x=!1;P.lastIndex=0;for(var y;(y=P.exec(h))!=null;)if(y[1]){var p=new A.AttrList(y[1]),k={attrs:p,bitrate:p.decimalInteger("AVERAGE-BANDWIDTH")||p.decimalInteger("BANDWIDTH"),name:p.NAME,url:D.resolve(y[2],c)},F=p.decimalResolution("RESOLUTION");F&&(k.width=F.width,k.height=F.height),d((p.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),k),k.videoCodec&&k.videoCodec.indexOf("avc1")!==-1&&(k.videoCodec=D.convertAVC1ToAVCOTI(k.videoCodec)),u.push(k)}else if(y[3]){var U=new A.AttrList(y[3]);U["DATA-ID"]&&(x=!0,a[U["DATA-ID"]]=U)}return{levels:u,sessionData:x?a:null}},D.parseMasterPlaylistMedia=function(h,c,u,a){a===void 0&&(a=[]);var x,y=[],p=0;for(w.lastIndex=0;(x=w.exec(h))!==null;){var k=new A.AttrList(x[1]);if(k.TYPE===u){var F={attrs:k,bitrate:0,id:p++,groupId:k["GROUP-ID"],instreamId:k["INSTREAM-ID"],name:k.NAME||k.LANGUAGE||"",type:u,default:k.bool("DEFAULT"),autoselect:k.bool("AUTOSELECT"),forced:k.bool("FORCED"),lang:k.LANGUAGE,url:k.URI?D.resolve(k.URI,c):""};if(a.length){var U=D.findGroup(a,F.groupId)||a[0];C(F,U,"audioCodec"),C(F,U,"textCodec")}y.push(F)}}return y},D.parseLevelPlaylist=function(h,c,u,a,x){var y=new N.LevelDetails(c),p=y.fragments,k=null,F=0,U=0,W=0,_=0,M=null,G=new B.Fragment(a,c),Y,Z,ne,be=-1,me=!1;for(b.lastIndex=0,y.m3u8=h;(Y=b.exec(h))!==null;){me&&(me=!1,G=new B.Fragment(a,c),G.start=W,G.sn=F,G.cc=_,G.level=u,k&&(G.initSegment=k,G.rawProgramDateTime=k.rawProgramDateTime));var pe=Y[1];if(pe){G.duration=parseFloat(pe);var ue=(" "+Y[2]).slice(1);G.title=ue||null,G.tagList.push(ue?["INF",pe,ue]:["INF",pe])}else if(Y[3])Object(H.isFiniteNumber)(G.duration)&&(G.start=W,ne&&(G.levelkey=ne),G.sn=F,G.level=u,G.cc=_,G.urlId=x,p.push(G),G.relurl=(" "+Y[3]).slice(1),m(G,M),M=G,W+=G.duration,F++,U=0,me=!0);else if(Y[4]){var fe=(" "+Y[4]).slice(1);M?G.setByteRange(fe,M):G.setByteRange(fe)}else if(Y[5])G.rawProgramDateTime=(" "+Y[5]).slice(1),G.tagList.push(["PROGRAM-DATE-TIME",G.rawProgramDateTime]),be===-1&&(be=p.length);else{if(Y=Y[0].match(E),!Y){f.logger.warn("No matches on slow regex match for level playlist!");continue}for(Z=1;Z-1){f.logger.warn("Keyformat "+Ue+" is not supported from the manifest");continue}else if(Ue!=="identity")continue;De&&(ne=R.LevelKey.fromURL(c,_e),_e&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(De)>=0&&(ne.method=De,ne.keyFormat=Ue,Ae&&(ne.keyID=Ae),Re&&(ne.keyFormatVersions=Re),ne.iv=ke));break}case"START":{var Ge=new A.AttrList(he),He=Ge.decimalFloatingPoint("TIME-OFFSET");Object(H.isFiniteNumber)(He)&&(y.startTimeOffset=He);break}case"MAP":{var et=new A.AttrList(he);G.relurl=et.URI,et.BYTERANGE&&G.setByteRange(et.BYTERANGE),G.level=u,G.sn="initSegment",ne&&(G.levelkey=ne),G.initSegment=null,k=G,me=!0;break}case"SERVER-CONTROL":{var Je=new A.AttrList(he);y.canBlockReload=Je.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=Je.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&Je.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=Je.optionalFloat("PART-HOLD-BACK",0),y.holdBack=Je.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Xe=new A.AttrList(he);y.partTarget=Xe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var we=y.partList;we||(we=y.partList=[]);var rt=U>0?we[we.length-1]:void 0,$e=U++,Le=new B.Part(new A.AttrList(he),G,c,$e,rt);we.push(Le),G.duration+=Le.duration;break}case"PRELOAD-HINT":{var Fe=new A.AttrList(he);y.preloadHint=Fe;break}case"RENDITION-REPORT":{var ge=new A.AttrList(he);y.renditionReports=y.renditionReports||[],y.renditionReports.push(ge);break}default:f.logger.warn("line parsed but not handled: "+Y);break}}}M&&!M.relurl?(p.pop(),W-=M.duration,y.partList&&(y.fragmentHint=M)):y.partList&&(m(G,M),G.cc=_,y.fragmentHint=G);var de=p.length,ce=p[0],Q=p[de-1];if(W+=y.skippedSegments*y.targetduration,W>0&&de&&Q){y.averagetargetduration=W/de;var q=Q.sn;y.endSN=q!=="initSegment"?q:0,ce&&(y.startCC=ce.cc,ce.initSegment||y.fragments.every(function(re){return re.relurl&&o(re.relurl)})&&(f.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),G=new B.Fragment(a,c),G.relurl=Q.relurl,G.level=u,G.sn="initSegment",ce.initSegment=G,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(W+=y.fragmentHint.duration),y.totalduration=W,y.endCC=_,be>0&&g(p,be),y},D}();function d(D,T){["video","audio","text"].forEach(function(h){var c=D.filter(function(a){return Object(v.isCodecType)(a,h)});if(c.length){var u=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});T[h+"Codec"]=u.length>0?u[0]:c[0],D=D.filter(function(a){return c.indexOf(a)===-1})}}),T.unknownCodecs=D}function C(D,T,h){var c=T[h];c&&(D[h]=c)}function g(D,T){for(var h=D[T],c=T;c--;){var u=D[c];if(!u)return;u.programDateTime=h.programDateTime-u.duration*1e3,h=u}}function m(D,T){D.rawProgramDateTime?D.programDateTime=Date.parse(D.rawProgramDateTime):T!=null&&T.programDateTime&&(D.programDateTime=T.endProgramDateTime),Object(H.isFiniteNumber)(D.programDateTime)||(D.programDateTime=null,D.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),O=L("./src/errors.ts"),B=L("./src/utils/logger.ts"),N=L("./src/utils/mp4-tools.ts"),R=L("./src/loader/m3u8-parser.ts"),A=L("./src/types/loader.ts"),f=L("./src/utils/attr-list.ts");function v(b){var E=b.type;switch(E){case A.PlaylistContextType.AUDIO_TRACK:return A.PlaylistLevelType.AUDIO;case A.PlaylistContextType.SUBTITLE_TRACK:return A.PlaylistLevelType.SUBTITLE;default:return A.PlaylistLevelType.MAIN}}function P(b,E){var l=b.url;return(l===void 0||l.indexOf("data:")===0)&&(l=E.url),l}var w=function(){function b(l){this.hls=void 0,this.loaders=Object.create(null),this.hls=l,this.registerListeners()}var E=b.prototype;return E.registerListeners=function(){var o=this.hls;o.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},E.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},E.createInternalLoader=function(o){var s=this.hls.config,d=s.pLoader,C=s.loader,g=d||C,m=new g(s);return o.loader=m,this.loaders[o.type]=m,m},E.getInternalLoader=function(o){return this.loaders[o.type]},E.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},E.destroyInternalLoaders=function(){for(var o in this.loaders){var s=this.loaders[o];s&&s.destroy(),this.resetInternalLoader(o)}},E.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},E.onManifestLoading=function(o,s){var d=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:A.PlaylistContextType.MANIFEST,url:d,deliveryDirectives:null})},E.onLevelLoading=function(o,s){var d=s.id,C=s.level,g=s.url,m=s.deliveryDirectives;this.load({id:d,groupId:null,level:C,responseType:"text",type:A.PlaylistContextType.LEVEL,url:g,deliveryDirectives:m})},E.onAudioTrackLoading=function(o,s){var d=s.id,C=s.groupId,g=s.url,m=s.deliveryDirectives;this.load({id:d,groupId:C,level:null,responseType:"text",type:A.PlaylistContextType.AUDIO_TRACK,url:g,deliveryDirectives:m})},E.onSubtitleTrackLoading=function(o,s){var d=s.id,C=s.groupId,g=s.url,m=s.deliveryDirectives;this.load({id:d,groupId:C,level:null,responseType:"text",type:A.PlaylistContextType.SUBTITLE_TRACK,url:g,deliveryDirectives:m})},E.load=function(o){var s,d=this.hls.config,C=this.getInternalLoader(o);if(C){var g=C.context;if(g&&g.url===o.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),C.abort()}var m,D,T,h;switch(o.type){case A.PlaylistContextType.MANIFEST:m=d.manifestLoadingMaxRetry,D=d.manifestLoadingTimeOut,T=d.manifestLoadingRetryDelay,h=d.manifestLoadingMaxRetryTimeout;break;case A.PlaylistContextType.LEVEL:case A.PlaylistContextType.AUDIO_TRACK:case A.PlaylistContextType.SUBTITLE_TRACK:m=0,D=d.levelLoadingTimeOut;break;default:m=d.levelLoadingMaxRetry,D=d.levelLoadingTimeOut,T=d.levelLoadingRetryDelay,h=d.levelLoadingMaxRetryTimeout;break}if(C=this.createInternalLoader(o),(s=o.deliveryDirectives)!==null&&s!==void 0&&s.part){var c;if(o.type===A.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===A.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===A.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var u=c.partTarget,a=c.targetduration;u&&a&&(D=Math.min(Math.max(u*3,a*.8)*1e3,D))}}var x={timeout:D,maxRetry:m,retryDelay:T,maxRetryDelay:h,highWaterMark:0},y={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};C.load(o,x,y)},E.loadsuccess=function(o,s,d,C){if(C===void 0&&(C=null),d.isSidxRequest){this.handleSidxRequest(o,d),this.handlePlaylistLoaded(o,s,d,C);return}this.resetInternalLoader(d.type);var g=o.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,d,"no EXTM3U delimiter",C);return}s.parsing.start=performance.now(),g.indexOf("#EXTINF:")>0||g.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,s,d,C):this.handleMasterPlaylist(o,s,d,C)},E.loaderror=function(o,s,d){d===void 0&&(d=null),this.handleNetworkError(s,d,!1,o)},E.loadtimeout=function(o,s,d){d===void 0&&(d=null),this.handleNetworkError(s,d,!0)},E.handleMasterPlaylist=function(o,s,d,C){var g=this.hls,m=o.data,D=P(o,d),T=R.default.parseMasterPlaylist(m,D),h=T.levels,c=T.sessionData;if(!h.length){this.handleManifestParsingError(o,d,"no level found in manifest",C);return}var u=h.map(function(F){return{id:F.attrs.AUDIO,audioCodec:F.audioCodec}}),a=h.map(function(F){return{id:F.attrs.SUBTITLES,textCodec:F.textCodec}}),x=R.default.parseMasterPlaylistMedia(m,D,"AUDIO",u),y=R.default.parseMasterPlaylistMedia(m,D,"SUBTITLES",a),p=R.default.parseMasterPlaylistMedia(m,D,"CLOSED-CAPTIONS");if(x.length){var k=x.some(function(F){return!F.url});!k&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(B.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),x.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new f.AttrList({}),bitrate:0,url:""}))}g.trigger(I.Events.MANIFEST_LOADED,{levels:h,audioTracks:x,subtitles:y,captions:p,url:D,stats:s,networkDetails:C,sessionData:c})},E.handleTrackOrLevelPlaylist=function(o,s,d,C){var g=this.hls,m=d.id,D=d.level,T=d.type,h=P(o,d),c=Object(H.isFiniteNumber)(m)?m:0,u=Object(H.isFiniteNumber)(D)?D:c,a=v(d),x=R.default.parseLevelPlaylist(o.data,h,u,a,c);if(!x.fragments.length){g.trigger(I.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:h,reason:"no fragments found in level",level:typeof d.level=="number"?d.level:void 0});return}if(T===A.PlaylistContextType.MANIFEST){var y={attrs:new f.AttrList({}),bitrate:0,details:x,name:"",url:h};g.trigger(I.Events.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:h,stats:s,networkDetails:C,sessionData:null})}if(s.parsing.end=performance.now(),x.needSidxRanges){var p,k=(p=x.fragments[0].initSegment)===null||p===void 0?void 0:p.url;this.load({url:k,isSidxRequest:!0,type:T,level:D,levelDetails:x,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}d.levelDetails=x,this.handlePlaylistLoaded(o,s,d,C)},E.handleSidxRequest=function(o,s){var d=Object(N.parseSegmentIndex)(new Uint8Array(o.data));if(!d)return;var C=d.references,g=s.levelDetails;C.forEach(function(m,D){var T=m.info,h=g.fragments[D];h.byteRange.length===0&&h.setByteRange(String(1+T.end-T.start)+"@"+String(T.start)),h.initSegment&&h.initSegment.setByteRange(String(d.moovEndOffset)+"@0")})},E.handleManifestParsingError=function(o,s,d,C){this.hls.trigger(I.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===A.PlaylistContextType.MANIFEST,url:o.url,reason:d,response:o,context:s,networkDetails:C})},E.handleNetworkError=function(o,s,d,C){d===void 0&&(d=!1),B.logger.warn("[playlist-loader]: A network "+(d?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var g=O.ErrorDetails.UNKNOWN,m=!1,D=this.getInternalLoader(o);switch(o.type){case A.PlaylistContextType.MANIFEST:g=d?O.ErrorDetails.MANIFEST_LOAD_TIMEOUT:O.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case A.PlaylistContextType.LEVEL:g=d?O.ErrorDetails.LEVEL_LOAD_TIMEOUT:O.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case A.PlaylistContextType.AUDIO_TRACK:g=d?O.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:O.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case A.PlaylistContextType.SUBTITLE_TRACK:g=d?O.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:O.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}D&&this.resetInternalLoader(o.type);var T={type:O.ErrorTypes.NETWORK_ERROR,details:g,fatal:m,url:o.url,loader:D,context:o,networkDetails:s};C&&(T.response=C),this.hls.trigger(I.Events.ERROR,T)},E.handlePlaylistLoaded=function(o,s,d,C){var g=d.type,m=d.level,D=d.id,T=d.groupId,h=d.loader,c=d.levelDetails,u=d.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,d,"invalid target duration",C);return}if(!h)return;c.live&&(h.getCacheAge&&(c.ageHeader=h.getCacheAge()||0),(!h.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(g){case A.PlaylistContextType.MANIFEST:case A.PlaylistContextType.LEVEL:this.hls.trigger(I.Events.LEVEL_LOADED,{details:c,level:m||0,id:D||0,stats:s,networkDetails:C,deliveryDirectives:u});break;case A.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(I.Events.AUDIO_TRACK_LOADED,{details:c,id:D||0,groupId:T||"",stats:s,networkDetails:C,deliveryDirectives:u});break;case A.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADED,{details:c,id:D||0,groupId:T||"",stats:s,networkDetails:C,deliveryDirectives:u});break}},b}();K.default=w},"./src/polyfills/number.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"isFiniteNumber",function(){return H}),L.d(K,"MAX_SAFE_INTEGER",function(){return I});var H=Number.isFinite||function(O){return typeof O=="number"&&isFinite(O)},I=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(J,K,L){"use strict";L.r(K);var H=function(){function I(){}return I.getSilentFrame=function(B,N){switch(B){case"mp4a.40.2":if(N===1)return new Uint8Array([0,200,0,128,35,128]);if(N===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(N===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(N===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(N===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(N===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(N===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(N===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(N===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},I}();K.default=H},"./src/remux/mp4-generator.ts":function(J,K,L){"use strict";L.r(K);var H=Math.pow(2,32)-1,I=function(){function O(){}return O.init=function(){O.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var N;for(N in O.types)O.types.hasOwnProperty(N)&&(O.types[N]=[N.charCodeAt(0),N.charCodeAt(1),N.charCodeAt(2),N.charCodeAt(3)]);var R=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),A=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);O.HDLR_TYPES={video:R,audio:A};var f=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),v=new Uint8Array([0,0,0,0,0,0,0,0]);O.STTS=O.STSC=O.STCO=v,O.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),O.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),O.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),O.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var P=new Uint8Array([105,115,111,109]),w=new Uint8Array([97,118,99,49]),b=new Uint8Array([0,0,0,1]);O.FTYP=O.box(O.types.ftyp,P,b,P,w),O.DINF=O.box(O.types.dinf,O.box(O.types.dref,f))},O.box=function(N){for(var R=8,A=arguments.length,f=new Array(A>1?A-1:0),v=1;v>24&255,b[1]=R>>16&255,b[2]=R>>8&255,b[3]=R&255,b.set(N,4),P=0,R=8;P>24&255,N>>16&255,N>>8&255,N&255,A>>24,A>>16&255,A>>8&255,A&255,f>>24,f>>16&255,f>>8&255,f&255,85,196,0,0]))},O.mdia=function(N){return O.box(O.types.mdia,O.mdhd(N.timescale,N.duration),O.hdlr(N.type),O.minf(N))},O.mfhd=function(N){return O.box(O.types.mfhd,new Uint8Array([0,0,0,0,N>>24,N>>16&255,N>>8&255,N&255]))},O.minf=function(N){return N.type==="audio"?O.box(O.types.minf,O.box(O.types.smhd,O.SMHD),O.DINF,O.stbl(N)):O.box(O.types.minf,O.box(O.types.vmhd,O.VMHD),O.DINF,O.stbl(N))},O.moof=function(N,R,A){return O.box(O.types.moof,O.mfhd(N),O.traf(A,R))},O.moov=function(N){for(var R=N.length,A=[];R--;)A[R]=O.trak(N[R]);return O.box.apply(null,[O.types.moov,O.mvhd(N[0].timescale,N[0].duration)].concat(A).concat(O.mvex(N)))},O.mvex=function(N){for(var R=N.length,A=[];R--;)A[R]=O.trex(N[R]);return O.box.apply(null,[O.types.mvex].concat(A))},O.mvhd=function(N,R){R*=N;var A=Math.floor(R/(H+1)),f=Math.floor(R%(H+1)),v=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,A>>24,A>>16&255,A>>8&255,A&255,f>>24,f>>16&255,f>>8&255,f&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return O.box(O.types.mvhd,v)},O.sdtp=function(N){var R=N.samples||[],A=new Uint8Array(4+R.length),f,v;for(f=0;f>>8&255),R.push(P&255),R=R.concat(Array.prototype.slice.call(v));for(f=0;f>>8&255),A.push(P&255),A=A.concat(Array.prototype.slice.call(v));var w=O.box(O.types.avcC,new Uint8Array([1,R[3],R[4],R[5],252|3,224|N.sps.length].concat(R).concat([N.pps.length]).concat(A))),b=N.width,E=N.height,l=N.pixelRatio[0],o=N.pixelRatio[1];return O.box(O.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b>>8&255,b&255,E>>8&255,E&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),w,O.box(O.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),O.box(O.types.pasp,new Uint8Array([l>>24,l>>16&255,l>>8&255,l&255,o>>24,o>>16&255,o>>8&255,o&255])))},O.esds=function(N){var R=N.config.length;return new Uint8Array([0,0,0,0,3,23+R,0,1,0,4,15+R,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([R]).concat(N.config).concat([6,1,2]))},O.mp4a=function(N){var R=N.samplerate;return O.box(O.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,R>>8&255,R&255,0,0]),O.box(O.types.esds,O.esds(N)))},O.mp3=function(N){var R=N.samplerate;return O.box(O.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,R>>8&255,R&255,0,0]))},O.stsd=function(N){return N.type==="audio"?!N.isAAC&&N.codec==="mp3"?O.box(O.types.stsd,O.STSD,O.mp3(N)):O.box(O.types.stsd,O.STSD,O.mp4a(N)):O.box(O.types.stsd,O.STSD,O.avc1(N))},O.tkhd=function(N){var R=N.id,A=N.duration*N.timescale,f=N.width,v=N.height,P=Math.floor(A/(H+1)),w=Math.floor(A%(H+1));return O.box(O.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,R>>24&255,R>>16&255,R>>8&255,R&255,0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,w>>24,w>>16&255,w>>8&255,w&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,f>>8&255,f&255,0,0,v>>8&255,v&255,0,0]))},O.traf=function(N,R){var A=O.sdtp(N),f=N.id,v=Math.floor(R/(H+1)),P=Math.floor(R%(H+1));return O.box(O.types.traf,O.box(O.types.tfhd,new Uint8Array([0,0,0,0,f>>24,f>>16&255,f>>8&255,f&255])),O.box(O.types.tfdt,new Uint8Array([1,0,0,0,v>>24,v>>16&255,v>>8&255,v&255,P>>24,P>>16&255,P>>8&255,P&255])),O.trun(N,A.length+16+20+8+16+8+8),A)},O.trak=function(N){return N.duration=N.duration||4294967295,O.box(O.types.trak,O.tkhd(N),O.mdia(N))},O.trex=function(N){var R=N.id;return O.box(O.types.trex,new Uint8Array([0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},O.trun=function(N,R){var A=N.samples||[],f=A.length,v=12+16*f,P=new Uint8Array(v),w,b,E,l,o,s;for(R+=8+v,P.set([0,0,15,1,f>>>24&255,f>>>16&255,f>>>8&255,f&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255],0),w=0;w>>24&255,E>>>16&255,E>>>8&255,E&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*w);return O.box(O.types.trun,P)},O.initSegment=function(N){O.types||O.init();var R=O.moov(N),A=new Uint8Array(O.FTYP.byteLength+R.byteLength);return A.set(O.FTYP),A.set(R,O.FTYP.byteLength),A},O}();I.types=void 0,I.HDLR_TYPES=void 0,I.STTS=void 0,I.STSC=void 0,I.STCO=void 0,I.STSZ=void 0,I.VMHD=void 0,I.SMHD=void 0,I.STSD=void 0,I.FTYP=void 0,I.DINF=void 0,K.default=I},"./src/remux/mp4-remuxer.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return s}),L.d(K,"normalizePts",function(){return d});var H=L("./src/polyfills/number.ts"),I=L("./src/remux/aac-helper.ts"),O=L("./src/remux/mp4-generator.ts"),B=L("./src/events.ts"),N=L("./src/errors.ts"),R=L("./src/utils/logger.ts"),A=L("./src/types/loader.ts"),f=L("./src/utils/timescale-conversion.ts");function v(){return v=Object.assign||function(D){for(var T=1;T0?x:y.pts},c[0].pts);return u&&R.logger.debug("PTS rollover detected"),a},T.remux=function(c,u,a,x,y,p,k,F){var U,W,_,M,G,Y,Z=y,ne=y,be=c.pid>-1,me=u.pid>-1,pe=u.samples.length,ue=c.samples.length>0,fe=pe>1,ie=(!be||ue)&&(!me||fe)||this.ISGenerated||k;if(ie){this.ISGenerated||(_=this.generateIS(c,u,y));var he=this.isVideoContiguous,$=-1;if(fe&&($=C(u.samples),!he&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,$>0){R.logger.warn("[mp4-remuxer]: Dropped "+$+" out of "+pe+" video samples due to a missing keyframe");var ae=this.getVideoStartPts(u.samples);u.samples=u.samples.slice($),u.dropped+=$,ne+=(u.samples[0].pts-ae)/(u.timescale||9e4)}else $===-1&&(R.logger.warn("[mp4-remuxer]: No keyframe found out of "+pe+" video samples"),Y=!1);if(this.ISGenerated){if(ue&&fe){var ee=this.getVideoStartPts(u.samples),Ee=d(c.samples[0].pts,ee)-ee,Ce=Ee/u.inputTimeScale;Z+=Math.max(0,Ce),ne+=Math.max(0,-Ce)}if(ue){if(c.samplerate||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),_=this.generateIS(c,u,y)),W=this.remuxAudio(c,Z,this.isAudioContiguous,p,me||fe||F===A.PlaylistLevelType.AUDIO?ne:void 0),fe){var ve=W?W.endPTS-W.startPTS:0;u.inputTimeScale||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),_=this.generateIS(c,u,y)),U=this.remuxVideo(u,ne,he,ve)}}else fe&&(U=this.remuxVideo(u,ne,he,0));U&&(U.firstKeyFrame=$,U.independent=$!==-1)}}return this.ISGenerated&&(a.samples.length&&(G=this.remuxID3(a,y)),x.samples.length&&(M=this.remuxText(x,y))),{audio:W,video:U,initSegment:_,independent:Y,text:M,id3:G}},T.generateIS=function(c,u,a){var x=c.samples,y=u.samples,p=this.typeSupported,k={},F=!Object(H.isFiniteNumber)(this._initPTS),U="audio/mp4",W,_,M;if(F&&(W=_=Infinity),c.config&&x.length&&(c.timescale=c.samplerate,c.isAAC||(p.mpeg?(U="audio/mpeg",c.codec=""):p.mp3&&(c.codec="mp3")),k.audio={id:"audio",container:U,codec:c.codec,initSegment:!c.isAAC&&p.mpeg?new Uint8Array(0):O.default.initSegment([c]),metadata:{channelCount:c.channelCount}},F&&(M=c.inputTimeScale,W=_=x[0].pts-Math.round(M*a))),u.sps&&u.pps&&y.length&&(u.timescale=u.inputTimeScale,k.video={id:"main",container:"video/mp4",codec:u.codec,initSegment:O.default.initSegment([u]),metadata:{width:u.width,height:u.height}},F)){M=u.inputTimeScale;var G=this.getVideoStartPts(y),Y=Math.round(M*a);_=Math.min(_,d(y[0].dts,G)-Y),W=Math.min(W,G-Y)}if(Object.keys(k).length)return this.ISGenerated=!0,F&&(this._initPTS=W,this._initDTS=_),{tracks:k,initPTS:W,timescale:M}},T.remuxVideo=function(c,u,a,x){var y=c.inputTimeScale,p=c.samples,k=[],F=p.length,U=this._initPTS,W=this.nextAvcDts,_=8,M,G,Y,Z=Number.POSITIVE_INFINITY,ne=Number.NEGATIVE_INFINITY,be=0,me=!1;if(!a||W===null){var pe=u*y,ue=p[0].pts-d(p[0].dts,p[0].pts);W=pe-ue}for(var fe=0;feie.pts){var he=9e4*.2;be=Math.max(Math.min(be,ie.pts-ie.dts),-1*he)}ie.dts0?fe-1:fe].dts&&(me=!0)}me&&p.sort(function(mt,at){var qe=mt.dts-at.dts,xt=mt.pts-at.pts;return qe||xt}),G=p[0].dts,Y=p[p.length-1].dts;var $=Math.round((Y-G)/(F-1));if(be<0){if(be<$*-2){R.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(f.toMsFromMpegTsClock)(-$,!0)+" ms");for(var ae=be,ee=0;ee$,Se=Ce<-1;if(ve||Se){ve?R.logger.warn("AVC: "+Object(f.toMsFromMpegTsClock)(Ce,!0)+" ms ("+Ce+"dts) hole between fragments detected, filling it"):R.logger.warn("AVC: "+Object(f.toMsFromMpegTsClock)(-Ce,!0)+" ms ("+Ce+"dts) overlapping between fragments detected"),G=W;var De=p[0].pts-Ce;p[0].dts=G,p[0].pts=De,R.logger.log("Video: First PTS/DTS adjusted: "+Object(f.toMsFromMpegTsClock)(De,!0)+"/"+Object(f.toMsFromMpegTsClock)(G,!0)+", delta: "+Object(f.toMsFromMpegTsClock)(Ce,!0)+" ms")}}o&&(G=Math.max(0,G));for(var _e=0,ke=0,Re=0;Re0?we-1:we].dts;if(q.stretchShortVideoTrack&&this.nextAudioPts!==null){var se=Math.floor(q.maxBufferHole*y),Te=(x?Z+x*y:this.nextAudioPts)-rt.pts;Te>se?(M=Te-re,M<0&&(M=re),R.logger.log("[mp4-remuxer]: It is approximately "+Te/90+" ms to the next segment; using duration "+M/90+" ms for the last video frame.")):M=re}else M=re}var Oe=Math.round(rt.pts-rt.dts);k.push(new g(rt.key,M,Le,Oe))}if(k.length&&E&&E<70){var je=k[0].flags;je.dependsOn=2,je.isNonSync=0}console.assert(M!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=Y+M,this.isVideoContiguous=!0;var st=O.default.moof(c.sequenceNumber++,G,v({},c,{samples:k})),ht="video",Me={data1:st,data2:Je,startPTS:Z/y,endPTS:(ne+M)/y,startDTS:G/y,endDTS:W/y,type:ht,hasAudio:!1,hasVideo:!0,nb:k.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Je.length,"MDAT length must not be zero"),Me},T.remuxAudio=function(c,u,a,x,y){var p=c.inputTimeScale,k=c.samplerate?c.samplerate:p,F=p/k,U=c.isAAC?w:b,W=U*F,_=this._initPTS,M=!c.isAAC&&this.typeSupported.mpeg,G=[],Y=c.samples,Z=M?0:8,ne=this.nextAudioPts||-1,be=u*p;if(this.isAudioContiguous=a=a||Y.length&&ne>0&&(x&&Math.abs(be-ne)<9e3||Math.abs(d(Y[0].pts-_,be)-ne)<20*W),Y.forEach(function(ce){ce.pts=d(ce.pts-_,be)}),!a||ne<0){if(Y=Y.filter(function(ce){return ce.pts>=0}),!Y.length)return;y===0?ne=0:x?ne=Math.max(0,be):ne=Y[0].pts}if(c.isAAC)for(var me=y!==void 0,pe=this.config.maxAudioFramesDrift,ue=0,fe=ne;ue=pe*W&&ae0){ke+=Z;try{_e=new Uint8Array(ke)}catch(ce){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ke,reason:"fail allocating audio mdat "+ke});return}if(!M){var Je=new DataView(_e.buffer);Je.setUint32(0,ke),_e.set(O.default.types.mdat,4)}}else return;_e.set(Ge,Z);var Xe=Ge.byteLength;Z+=Xe,G.push(new g(!0,U,Xe,0)),De=He}var we=G.length;if(!we)return;var rt=G[G.length-1];this.nextAudioPts=ne=De+F*rt.duration;var $e=M?new Uint8Array(0):O.default.moof(c.sequenceNumber++,Se/F,v({},c,{samples:G}));c.samples=[];var Le=Se/p,Fe=ne/p,ge="audio",de={data1:$e,data2:_e,startPTS:Le,endPTS:Fe,startDTS:Le,endDTS:Fe,type:ge,hasAudio:!0,hasVideo:!1,nb:we};return this.isAudioContiguous=!0,console.assert(_e.length,"MDAT length must not be zero"),de},T.remuxEmptyAudio=function(c,u,a,x){var y=c.inputTimeScale,p=c.samplerate?c.samplerate:y,k=y/p,F=this.nextAudioPts,U=(F!==null?F:x.startDTS*y)+this._initDTS,W=x.endDTS*y+this._initDTS,_=k*w,M=Math.ceil((W-U)/_),G=I.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(R.logger.warn("[mp4-remuxer]: remux empty Audio"),!G){R.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Y=[],Z=0;Z4294967296;)D+=h;return D}function C(D){for(var T=0;T0?this.lastEndDTS=c:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var u=!!D.audio,a=!!D.video,x="";u&&(x+="audio"),a&&(x+="video");var y={data1:g,startPTS:h,startDTS:h,endPTS:c,endDTS:c,type:x,hasAudio:u,hasVideo:a,nb:1,dropped:0};return C.audio=y.type==="audio"?y:void 0,C.video=y.type!=="audio"?y:void 0,C.text=l,C.id3=E,C.initSegment=m,C},f}(),R=function(v,P,w){return Object(I.getStartDTS)(v,P)-w};function A(f,v){var P=f==null?void 0:f.codec;return P&&P.length>4?P:P==="hvc1"?"hvc1.1.c.L120.90":P==="av01"?"av01.0.04M.08":P==="avc1"||v===O.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}K.default=N},"./src/task-loop.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"default",function(){return H});var H=function(){function I(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var O=I.prototype;return O.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},O.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},O.onHandlerDestroyed=function(){},O.hasInterval=function(){return!!this._tickInterval},O.hasNextTick=function(){return!!this._tickTimer},O.setInterval=function(N){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,N),!0)},O.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},O.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},O.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},O.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},O.doTick=function(){},I}()},"./src/types/cmcd.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"CMCDVersion",function(){return H}),L.d(K,"CMCDObjectType",function(){return I}),L.d(K,"CMCDStreamingFormat",function(){return O}),L.d(K,"CMCDStreamType",function(){return B});var H=1,I;(function(N){N.MANIFEST="m",N.AUDIO="a",N.VIDEO="v",N.MUXED="av",N.INIT="i",N.CAPTION="c",N.TIMED_TEXT="tt",N.KEY="k",N.OTHER="o"})(I||(I={}));var O;(function(N){N.DASH="d",N.HLS="h",N.SMOOTH="s",N.OTHER="o"})(O||(O={}));var B;(function(N){N.VOD="v",N.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"HlsSkip",function(){return O}),L.d(K,"getSkipValue",function(){return B}),L.d(K,"HlsUrlParameters",function(){return N}),L.d(K,"Level",function(){return R});function H(A,f){for(var v=0;vNumber.MAX_SAFE_INTEGER?Infinity:f},N.hexadecimalInteger=function(A){if(this[A]){var f=(this[A]||"0x").slice(2);f=(f.length&1?"0":"")+f;for(var v=new Uint8Array(f.length/2),P=0;PNumber.MAX_SAFE_INTEGER?Infinity:f},N.decimalFloatingPoint=function(A){return parseFloat(this[A])},N.optionalFloat=function(A,f){var v=this[A];return v?parseFloat(v):f},N.enumeratedString=function(A){return this[A]},N.bool=function(A){return this[A]==="YES"},N.decimalResolution=function(A){var f=H.exec(this[A]);return f===null?void 0:{width:parseInt(f[1],10),height:parseInt(f[2],10)}},B.parseAttrList=function(A){var f,v={},P='"';for(I.lastIndex=0;(f=I.exec(A))!==null;){var w=f[2];w.indexOf(P)===0&&w.lastIndexOf(P)===w.length-1&&(w=w.slice(1,-1)),v[f[1]]=w}return v},B}()},"./src/utils/binary-search.ts":function(J,K,L){"use strict";L.r(K);var H={search:function(O,B){for(var N=0,R=O.length-1,A=null,f=null;N<=R;){A=(N+R)/2|0,f=O[A];var v=B(f);if(v>0)N=A+1;else if(v<0)R=A-1;else return f}return null}};K.default=H},"./src/utils/buffer-helper.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"BufferHelper",function(){return O});var H=L("./src/utils/logger.ts"),I={length:0,start:function(){return 0},end:function(){return 0}},O=function(){function B(){}return B.isBuffered=function(R,A){try{if(R){for(var f=B.getBuffered(R),v=0;v=f.start(v)&&A<=f.end(v))return!0}}catch(P){}return!1},B.bufferInfo=function(R,A,f){try{if(R){var v=B.getBuffered(R),P=[],w;for(w=0;wb&&(v[w-1].end=R[P].end):v.push(R[P])}else v.push(R[P])}else v=R;for(var E=0,l,o=A,s=A,d=0;d=C&&A=a&&H.logger.log(this.time+" ["+a+"] "+x)},h}(),E=function(c){for(var u=[],a=0;aN&&(this.logger.log(w.DEBUG,"Too large cursor position "+this.pos),this.pos=N)},c.moveCursor=function(a){var x=this.pos+a;if(a>1)for(var y=this.pos+1;y=144&&this.backSpace();var x=O(a);if(this.pos>=N){this.logger.log(w.ERROR,"Cannot insert "+a.toString(16)+" ("+x+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(x,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var x;for(x=a;x0&&(a?y="["+x.join(" | ")+"]":y=x.join(` `)),y},c.getTextAndFormat=function(){return this.rows},h}(),C=function(){function h(u,a,x){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=u,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new d(x),this.nonDisplayedMemory=new d(x),this.lastOutputScreen=new d(x),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=x}var c=h.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(a){this.outputFilter=a},c.setPAC=function(a){this.writeScreen.setPAC(a)},c.setBkgData=function(a){this.writeScreen.setBkgData(a)},c.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(w.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},c.insertChars=function(a){for(var x=0;x=46,x.italics)x.foreground="white";else{var y=Math.floor(a/2)-16,p=["white","green","blue","cyan","red","yellow","magenta"];x.foreground=p[y]}this.logger.log(w.INFO,"MIDROW: "+JSON.stringify(x)),this.writeScreen.setPen(x)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var x=this.logger.time;if(x===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=x:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,x,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:x),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},h}(),g=function(){function h(u,a,x){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var y=new b;this.channels=[null,new C(u,a,y),new C(u+1,x,y)],this.cmdHistory=T(),this.logger=y}var c=h.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,x){this.channels[a].setHandler(x)},c.addData=function(a,x){var y,p,k,F=!1;this.logger.time=a;for(var U=0;U ("+E([p,k])+")"),y=this.parseCmd(p,k),y||(y=this.parseMidrow(p,k)),y||(y=this.parsePAC(p,k)),y||(y=this.parseBackgroundAttributes(p,k)),!y&&(F=this.parseChars(p,k),F)){var W=this.currentChannel;if(W&&W>0){var _=this.channels[W];_.insertChars(F)}else this.logger.log(w.WARNING,"No channel found yet. TEXT-MODE?")}!y&&!F&&this.logger.log(w.WARNING,"Couldn't parse cleaned data "+E([p,k])+" orig: "+E([x[U],x[U+1]]))}},c.parseCmd=function(a,x){var y=this.cmdHistory,p=(a===20||a===28||a===21||a===29)&&x>=32&&x<=47,k=(a===23||a===31)&&x>=33&&x<=35;if(!(p||k))return!1;if(D(a,x,y))return m(null,null,y),this.logger.log(w.DEBUG,"Repeated command ("+E([a,x])+") is dropped"),!0;var F=a===20||a===21||a===23?1:2,U=this.channels[F];return a===20||a===21||a===28||a===29?x===32?U.ccRCL():x===33?U.ccBS():x===34?U.ccAOF():x===35?U.ccAON():x===36?U.ccDER():x===37?U.ccRU(2):x===38?U.ccRU(3):x===39?U.ccRU(4):x===40?U.ccFON():x===41?U.ccRDC():x===42?U.ccTR():x===43?U.ccRTD():x===44?U.ccEDM():x===45?U.ccCR():x===46?U.ccENM():x===47&&U.ccEOC():U.ccTO(x-32),m(a,x,y),this.currentChannel=F,!0},c.parseMidrow=function(a,x){var y=0;if((a===17||a===25)&&x>=32&&x<=47){if(a===17?y=1:y=2,y!==this.currentChannel)return this.logger.log(w.ERROR,"Mismatch channel in midrow parsing"),!1;var p=this.channels[y];return p?(p.ccMIDROW(x),this.logger.log(w.DEBUG,"MIDROW ("+E([a,x])+")"),!0):!1}return!1},c.parsePAC=function(a,x){var y,p=this.cmdHistory,k=(a>=17&&a<=23||a>=25&&a<=31)&&x>=64&&x<=127,F=(a===16||a===24)&&x>=64&&x<=95;if(!(k||F))return!1;if(D(a,x,p))return m(null,null,p),!0;var U=a<=23?1:2;x>=64&&x<=95?y=U===1?R[a]:f[a]:y=U===1?A[a]:v[a];var W=this.channels[U];return W?(W.setPAC(this.interpretPAC(y,x)),m(a,x,p),this.currentChannel=U,!0):!1},c.interpretPAC=function(a,x){var y,p={color:null,italics:!1,indent:null,underline:!1,row:a};return x>95?y=x-96:y=x-64,p.underline=(y&1)===1,y<=13?p.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(y/2)]:y<=15?(p.italics=!0,p.color="white"):p.indent=Math.floor((y-16)/2)*4,p},c.parseChars=function(a,x){var y,p=null,k=null;if(a>=25?(y=2,k=a-8):(y=1,k=a),k>=17&&k<=19){var F;k===17?F=x+80:k===18?F=x+112:F=x+144,this.logger.log(w.INFO,"Special char '"+O(F)+"' in channel "+y),p=[F]}else a>=32&&a<=127&&(p=x===0?[a]:[a,x]);if(p){var U=E(p);this.logger.log(w.DEBUG,"Char codes = "+U.join(",")),m(a,x,this.cmdHistory)}return p},c.parseBackgroundAttributes=function(a,x){var y=(a===16||a===24)&&x>=32&&x<=47,p=(a===23||a===31)&&x>=45&&x<=47;if(!(y||p))return!1;var k,F={};a===16||a===24?(k=Math.floor((x-32)/2),F.background=P[k],x%2===1&&(F.background=F.background+"_semi")):x===45?F.background="transparent":(F.foreground="black",x===47&&(F.underline=!0));var U=a<=23?1:2,W=this.channels[U];return W.setBkgData(F),m(a,x,this.cmdHistory),!0},c.reset=function(){for(var a=0;a=16?o--:o++;var m=Object(H.fixLineBreaks)(s.trim()),D=Object(I.generateCueId)(f,v,m);(!A||!A.cues||!A.cues.getCueById(D))&&(E=new d(f,v,m),E.id=D,E.line=C+1,E.align="left",E.position=10+Math.min(80,Math.floor(o*8/32)*10),w.push(E))}return A&&w.length&&(w.sort(function(T,h){return T.line==="auto"||h.line==="auto"?0:T.line>8&&h.line>8?h.line-T.line:T.line-h.line}),w.forEach(function(T){return Object(O.addCueToTrack)(A,T)})),w}};K.default=N},"./src/utils/discontinuities.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"findFirstFragWithCC",function(){return B}),L.d(K,"shouldAlignOnDiscontinuities",function(){return N}),L.d(K,"findDiscontinuousReferenceFrag",function(){return R}),L.d(K,"adjustSlidingStart",function(){return f}),L.d(K,"alignStream",function(){return v}),L.d(K,"alignPDT",function(){return w}),L.d(K,"alignFragmentByPDTDelta",function(){return b}),L.d(K,"alignMediaPlaylistByPDT",function(){return E});var H=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts"),O=L("./src/controller/level-helper.ts");function B(l,o){for(var s=null,d=0,C=l.length;ds.startCC||l&&l.cc=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},O}();K.default=I},"./src/utils/ewma.ts":function(J,K,L){"use strict";L.r(K);var H=function(){function I(B,N,R){N===void 0&&(N=0),R===void 0&&(R=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=B,this.alpha_=B?Math.exp(Math.log(.5)/B):0,this.estimate_=N,this.totalWeight_=R}var O=I.prototype;return O.sample=function(N,R){var A=Math.pow(this.alpha_,N);this.estimate_=R*(1-A)+A*this.estimate_,this.totalWeight_+=N},O.getTotalWeight=function(){return this.totalWeight_},O.getEstimate=function(){if(this.alpha_){var N=1-Math.pow(this.alpha_,this.totalWeight_);if(N)return this.estimate_/N}return this.estimate_},I}();K.default=H},"./src/utils/fetch-loader.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"fetchSupported",function(){return b});var H=L("./src/polyfills/number.ts"),I=L("./src/loader/load-stats.ts"),O=L("./src/demux/chunk-cache.ts");function B(d,C){d.prototype=Object.create(C.prototype),d.prototype.constructor=d,v(d,C)}function N(d){var C=typeof Map=="function"?new Map:void 0;return N=function(m){if(m===null||!f(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(typeof C!="undefined"){if(C.has(m))return C.get(m);C.set(m,D)}function D(){return R(m,arguments,P(this).constructor)}return D.prototype=Object.create(m.prototype,{constructor:{value:D,enumerable:!1,writable:!0,configurable:!0}}),v(D,m)},N(d)}function R(d,C,g){return A()?R=Reflect.construct:R=function(D,T,h){var c=[null];c.push.apply(c,T);var u=Function.bind.apply(D,c),a=new u;return h&&v(a,h.prototype),a},R.apply(null,arguments)}function A(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function f(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function v(d,C){return v=Object.setPrototypeOf||function(m,D){return m.__proto__=D,m},v(d,C)}function P(d){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(g){return g.__proto__||Object.getPrototypeOf(g)},P(d)}function w(){return w=Object.assign||function(d){for(var C=1;C=h&&c(D,T,u.flush(),m)):c(D,T,k,m),y()}).catch(function(){return Promise.reject()})};return x()},d}();function l(d,C){var g={method:"GET",mode:"cors",credentials:"same-origin",signal:C,headers:new self.Headers(w({},d.headers))};return d.rangeEnd&&g.headers.set("Range","bytes="+d.rangeStart+"-"+String(d.rangeEnd-1)),g}function o(d,C){return new self.Request(d.url,C)}var s=function(d){B(C,d);function C(g,m,D){var T;return T=d.call(this,g)||this,T.code=void 0,T.details=void 0,T.code=m,T.details=D,T}return C}(N(Error));K.default=E},"./src/utils/imsc1-ttml-parser.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"IMSC1_CODEC",function(){return f}),L.d(K,"parseIMSC1",function(){return b});var H=L("./src/utils/mp4-tools.ts"),I=L("./src/utils/vttparser.ts"),O=L("./src/utils/vttcue.ts"),B=L("./src/demux/id3.ts"),N=L("./src/utils/timescale-conversion.ts"),R=L("./src/utils/webvtt-parser.ts");function A(){return A=Object.assign||function(h){for(var c=1;c"):H}function N(f){for(var v=arguments.length,P=new Array(v>1?v-1:0),w=1;w>24,C[g+1]=m>>16&255,C[g+2]=m>>8&255,C[g+3]=m&255}function v(C,g){var m=[];if(!g.length)return m;var D,T,h;"data"in C?(D=C.data,T=C.start,h=C.end):(D=C,T=0,h=D.byteLength);for(var c=T;c1?c+u:h;if(a===g[0])if(g.length===1)m.push({data:D,start:c+8,end:x});else{var y=v({data:D,start:c+8,end:x},g.slice(1));y.length&&B.apply(m,y)}c=x}return m}function P(C){var g=v(C,["moov"]),m=g[0],D=m?m.end:null,T=v(C,["sidx"]);if(!T||!T[0])return null;var h=[],c=T[0],u=c.data[0],a=u===0?8:16,x=A(c,a);a+=4;var y=0,p=0;u===0?a+=8:a+=16,a+=2;var k=c.end+p,F=R(c,a);a+=2;for(var U=0;U>>31;if(G===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Y=A(c,W);W+=4,h.push({referenceSize:M,subsegmentDuration:Y,info:{duration:Y/x,start:k,end:k+M-1}}),k+=M,W+=4,a=W}return{earliestPresentationTime:y,timescale:x,version:u,referencesCount:F,references:h,moovEndOffset:D}}function w(C){for(var g=[],m=v(C,["moov","trak"]),D=0;DN)&&(this.startTime=N),this.endTime=R,this.screen=A,this.timelineController.createCaptionsTrack(this.trackName)},O.reset=function(){this.cueRanges=[]},I}()},"./src/utils/texttrack-utils.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"sendAddTrackEvent",function(){return I}),L.d(K,"addCueToTrack",function(){return O}),L.d(K,"clearCurrentCues",function(){return B}),L.d(K,"removeCuesInRange",function(){return N}),L.d(K,"getCuesInRange",function(){return A});var H=L("./src/utils/logger.ts");function I(f,v){var P;try{P=new Event("addtrack")}catch(w){P=document.createEvent("Event"),P.initEvent("addtrack",!1,!1)}P.track=f,v.dispatchEvent(P)}function O(f,v){var P=f.mode;if(P==="disabled"&&(f.mode="hidden"),f.cues&&!f.cues.getCueById(v.id))try{if(f.addCue(v),!f.cues.getCueById(v.id))throw new Error("addCue is failed for: "+v)}catch(b){H.logger.debug("[texttrack-utils]: "+b);var w=new self.TextTrackCue(v.startTime,v.endTime,v.text);w.id=v.id,f.addCue(w)}P==="disabled"&&(f.mode=P)}function B(f){var v=f.mode;if(v==="disabled"&&(f.mode="hidden"),f.cues)for(var P=f.cues.length;P--;)f.removeCue(f.cues[P]);v==="disabled"&&(f.mode=v)}function N(f,v,P){var w=f.mode;if(w==="disabled"&&(f.mode="hidden"),f.cues&&f.cues.length>0)for(var b=A(f.cues,v,P),E=0;Ef[P].endTime)return-1;for(var w=0,b=P;w<=b;){var E=Math.floor((b+w)/2);if(vf[E].startTime&&w-1)for(var E=b,l=f.length;E=v&&o.endTime<=P)w.push(o);else if(o.startTime>P)return w}return w}},"./src/utils/time-ranges.ts":function(J,K,L){"use strict";L.r(K);var H={toString:function(O){for(var B="",N=O.length,R=0;R1?v-1:0),w=1;w100)throw new Error("Position must be between 0 and 100.");h=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"positionAlign",R({},b,{get:function(){return c},set:function(y){var p=N(y);if(!p)throw new SyntaxError("An invalid or illegal string was specified.");c=p,this.hasBeenReset=!0}})),Object.defineProperty(w,"size",R({},b,{get:function(){return u},set:function(y){if(y<0||y>100)throw new Error("Size must be between 0 and 100.");u=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"align",R({},b,{get:function(){return a},set:function(y){var p=N(y);if(!p)throw new SyntaxError("An invalid or illegal string was specified.");a=p,this.hasBeenReset=!0}})),w.displayState=void 0}return A.prototype.getCueAsHTML=function(){var f=self.WebVTT;return f.convertCueToDOMTree(self,this.text)},A}()},"./src/utils/vttparser.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"parseTimeStamp",function(){return O}),L.d(K,"fixLineBreaks",function(){return v}),L.d(K,"VTTParser",function(){return P});var H=L("./src/utils/vttcue.ts"),I=function(){function w(){}var b=w.prototype;return b.decode=function(l,o){if(!l)return"";if(typeof l!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(l))},w}();function O(w){function b(l,o,s,d){return(l|0)*3600+(o|0)*60+(s|0)+parseFloat(d||0)}var E=w.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return E?parseFloat(E[2])>59?b(E[2],E[3],0,E[4]):b(E[1],E[2],E[3],E[4]):null}var B=function(){function w(){this.values=Object.create(null)}var b=w.prototype;return b.set=function(l,o){!this.get(l)&&o!==""&&(this.values[l]=o)},b.get=function(l,o,s){return s?this.has(l)?this.values[l]:o[s]:this.has(l)?this.values[l]:o},b.has=function(l){return l in this.values},b.alt=function(l,o,s){for(var d=0;d=0&&s<=100)return this.set(l,s),!0}return!1},w}();function N(w,b,E,l){var o=l?w.split(l):[w];for(var s in o){if(typeof o[s]!="string")continue;var d=o[s].split(E);if(d.length!==2)continue;var C=d[0],g=d[1];b(C,g)}}var R=new H.default(0,0,""),A=R.align==="middle"?"middle":"center";function f(w,b,E){var l=w;function o(){var C=O(w);if(C===null)throw new Error("Malformed timestamp: "+l);return w=w.replace(/^[^\sa-zA-Z-]+/,""),C}function s(C,g){var m=new B;N(C,function(h,c){var u;switch(h){case"region":for(var a=E.length-1;a>=0;a--)if(E[a].id===c){m.set(h,E[a].region);break}break;case"vertical":m.alt(h,c,["rl","lr"]);break;case"line":u=c.split(","),m.integer(h,u[0]),m.percent(h,u[0])&&m.set("snapToLines",!1),m.alt(h,u[0],["auto"]),u.length===2&&m.alt("lineAlign",u[1],["start",A,"end"]);break;case"position":u=c.split(","),m.percent(h,u[0]),u.length===2&&m.alt("positionAlign",u[1],["start",A,"end","line-left","line-right","auto"]);break;case"size":m.percent(h,c);break;case"align":m.alt(h,c,["start",A,"end","left","right"]);break}},/:/,/\s/),g.region=m.get("region",null),g.vertical=m.get("vertical","");var D=m.get("line","auto");D==="auto"&&R.line===-1&&(D=-1),g.line=D,g.lineAlign=m.get("lineAlign","start"),g.snapToLines=m.get("snapToLines",!0),g.size=m.get("size",100),g.align=m.get("align",A);var T=m.get("position","auto");T==="auto"&&R.position===50&&(T=g.align==="start"||g.align==="left"?0:g.align==="end"||g.align==="right"?100:50),g.position=T}function d(){w=w.replace(/^\s+/,"")}if(d(),b.startTime=o(),d(),w.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+l);w=w.substr(3),d(),b.endTime=o(),d(),s(w,b)}function v(w){return w.replace(//gi,` `)}var P=function(){function w(){this.state="INITIAL",this.buffer="",this.decoder=new I,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var b=w.prototype;return b.parse=function(l){var o=this;l&&(o.buffer+=o.decoder.decode(l,{stream:!0}));function s(){var T=o.buffer,h=0;for(T=v(T);h")===-1){o.cue.id=C;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{f(C,o.cue,o.regionList)}catch(T){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var D=C.indexOf("-->")!==-1;if(!C||D&&(m=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=` `),o.cue.text+=C}continue;case"BADCUE":C||(o.state="ID")}}}catch(T){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},b.flush=function(){var l=this;try{if((l.cue||l.state==="HEADER")&&(l.buffer+=` `,l.parse()),l.state==="INITIAL"||l.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){l.onparsingerror&&l.onparsingerror(o)}return l.onflush&&l.onflush(),this},w}()},"./src/utils/webvtt-parser.ts":function(J,K,L){"use strict";L.r(K),L.d(K,"generateCueId",function(){return P}),L.d(K,"parseWebVTT",function(){return b});var H=L("./src/polyfills/number.ts"),I=L("./src/utils/vttparser.ts"),O=L("./src/demux/id3.ts"),B=L("./src/utils/timescale-conversion.ts"),N=L("./src/remux/mp4-remuxer.ts"),R=/\r\n|\n\r|\n|\r/g,A=function(l,o,s){return s===void 0&&(s=0),l.substr(s,o.length)===o},f=function(l){var o=parseInt(l.substr(-3)),s=parseInt(l.substr(-6,2)),d=parseInt(l.substr(-9,2)),C=l.length>9?parseInt(l.substr(0,l.indexOf(":"))):0;if(!Object(H.isFiniteNumber)(o)||!Object(H.isFiniteNumber)(s)||!Object(H.isFiniteNumber)(d)||!Object(H.isFiniteNumber)(C))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+l);return o+=1e3*s,o+=60*1e3*d,o+=60*60*1e3*C,o},v=function(l){for(var o=5381,s=l.length;s;)o=o*33^l.charCodeAt(--s);return(o>>>0).toString()};function P(E,l,o){return v(E.toString())+v(l.toString())+v(o)}var w=function(l,o,s){var d=l[o],C=l[d.prevCC];if(!C||!C.new&&d.new){l.ccOffset=l.presentationOffset=d.start,d.new=!1;return}for(;(g=C)!==null&&g!==void 0&&g.new;){var g;l.ccOffset+=d.start-C.start,d.new=!1,d=C,C=l[d.prevCC]}l.presentationOffset=s};function b(E,l,o,s,d,C,g,m){var D=new I.VTTParser,T=Object(O.utf8ArrayToStr)(new Uint8Array(E)).trim().replace(R,` `).split(` `),h=[],c=Object(B.toMpegTsClockFromTimescale)(l,o),u="00:00.000",a=0,x=0,y,p=!0,k=!1;D.oncue=function(F){var U=s[d],W=s.ccOffset,_=(a-c)/9e4;if(U!=null&&U.new&&(x!==void 0?W=s.ccOffset=U.start:w(s,d,_)),_&&(W=_-s.presentationOffset),k){var M=F.endTime-F.startTime,G=Object(N.normalizePts)((F.startTime+W-x)*9e4,C*9e4)/9e4;F.startTime=G,F.endTime=G+M}var Y=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(Y)),F.id||(F.id=P(F.startTime,F.endTime,Y)),F.endTime>0&&h.push(F)},D.onparsingerror=function(F){y=F},D.onflush=function(){if(y){m(y);return}g(h)},T.forEach(function(F){if(p)if(A(F,"X-TIMESTAMP-MAP=")){p=!1,k=!0,F.substr(16).split(",").forEach(function(U){A(U,"LOCAL:")?u=U.substr(6):A(U,"MPEGTS:")&&(a=parseInt(U.substr(7)))});try{x=f(u)/1e3}catch(U){k=!1,y=U}return}else F===""&&(p=!1);D.parse(F+` `)}),D.flush()}},"./src/utils/xhr-loader.ts":function(J,K,L){"use strict";L.r(K);var H=L("./src/utils/logger.ts"),I=L("./src/loader/load-stats.ts"),O=/^age:\s*[\d.]+\s*$/m,B=function(){function N(A){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=A?A.xhrSetup:null,this.stats=new I.LoadStats,this.retryDelay=0}var R=N.prototype;return R.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},R.abortInternal=function(){var f=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),f&&(f.onreadystatechange=null,f.onprogress=null,f.readyState!==4&&(this.stats.aborted=!0,f.abort()))},R.abort=function(){var f;this.abortInternal(),(f=this.callbacks)!==null&&f!==void 0&&f.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},R.load=function(f,v,P){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=f,this.config=v,this.callbacks=P,this.retryDelay=v.retryDelay,this.loadInternal()},R.loadInternal=function(){var f=this.config,v=this.context;if(!f)return;var P=this.loader=new self.XMLHttpRequest,w=this.stats;w.loading.first=0,w.loaded=0;var b=this.xhrSetup;try{if(b)try{b(P,v.url)}catch(o){P.open("GET",v.url,!0),b(P,v.url)}P.readyState||P.open("GET",v.url,!0);var E=this.context.headers;if(E)for(var l in E)P.setRequestHeader(l,E[l])}catch(o){this.callbacks.onError({code:P.status,text:o.message},v,P);return}v.rangeEnd&&P.setRequestHeader("Range","bytes="+v.rangeStart+"-"+(v.rangeEnd-1)),P.onreadystatechange=this.readystatechange.bind(this),P.onprogress=this.loadprogress.bind(this),P.responseType=v.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),f.timeout),P.send()},R.readystatechange=function(){var f=this.context,v=this.loader,P=this.stats;if(!f||!v)return;var w=v.readyState,b=this.config;if(P.aborted)return;if(w>=2)if(self.clearTimeout(this.requestTimeout),P.loading.first===0&&(P.loading.first=Math.max(self.performance.now(),P.loading.start)),w===4){v.onreadystatechange=null,v.onprogress=null;var E=v.status;if(E>=200&&E<300){P.loading.end=Math.max(self.performance.now(),P.loading.first);var l,o;if(f.responseType==="arraybuffer"?(l=v.response,o=l.byteLength):(l=v.responseText,o=l.length),P.loaded=P.total=o,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(P,f,l,v),!this.callbacks)return;var d={url:v.responseURL,data:l};this.callbacks.onSuccess(d,P,f,v)}else P.retry>=b.maxRetry||E>=400&&E<499?(H.logger.error(E+" while loading "+f.url),this.callbacks.onError({code:E,text:v.statusText},f,v)):(H.logger.warn(E+" while loading "+f.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,b.maxRetryDelay),P.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),b.timeout)},R.loadtimeout=function(){H.logger.warn("timeout while loading "+this.context.url);var f=this.callbacks;f&&(this.abortInternal(),f.onTimeout(this.stats,this.context,this.loader))},R.loadprogress=function(f){var v=this.stats;v.loaded=f.loaded,f.lengthComputable&&(v.total=f.total)},R.getCacheAge=function(){var f=null;if(this.loader&&O.test(this.loader.getAllResponseHeaders())){var v=this.loader.getResponseHeader("age");f=v?parseFloat(v):null}return f},N}();K.default=B}}).default})},wU8J:function(Ze,Ke){function te(){this.buffer=new Array,this.length=0}te.prototype={get:function(J){var K=Math.floor(J/8);return(this.buffer[K]>>>7-J%8&1)==1},put:function(J,K){for(var L=0;L>>K-L-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(J){var K=Math.floor(this.length/8);this.buffer.length<=K&&this.buffer.push(0),J&&(this.buffer[K]|=128>>>this.length%8),this.length++}},Ze.exports=te},wzkS:function(Ze,Ke,te){"use strict";te.d(Ke,"c",function(){return I}),te.d(Ke,"b",function(){return O}),te.d(Ke,"d",function(){return B}),te.d(Ke,"a",function(){return R}),te.d(Ke,"e",function(){return A});var J=te("9og8"),K=te("WmNS"),L=te.n(K),H=te("ErOA");function I(f){return Object(H.c)("libraries/".concat(f,".json"))}function O(){return Object(H.c)("library_tags.json")}function B(f){return N.apply(this,arguments)}function N(){return N=Object(J.a)(L.a.mark(function f(v){var P;return L.a.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return b.next=2,Object(H.b)("attachments/".concat(v,".json"));case 2:return P=b.sent,b.abrupt("return",P.status===0);case 4:case"end":return b.stop()}},f)})),N.apply(this,arguments)}function R(f){return Object(H.f)("libraries.json",f)}function A(f,v){return Object(H.g)("libraries/".concat(f,".json"),v)}}}]);