You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/p__Shixuns__Detail__id.dfdc...

366 lines
962 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[267,6,7,9,12],{"+NIl":function(tt,Ke,le){(function(ce){ce(le("VrN/"))})(function(ce){"use strict";ce.defineMode("stex",function(J,O){"use strict";function Z(L,A){L.cmdState.push(A)}function F(L){return L.cmdState.length>0?L.cmdState[L.cmdState.length-1]:null}function k(L){var A=L.cmdState.pop();A&&A.closeBracket()}function G(L){for(var A=L.cmdState,_=A.length-1;_>=0;_--){var h=A[_];if(h.name=="DEFAULT")continue;return h}return{styleIdentifier:function(){return null}}}function H(L,A,_){return function(){this.name=L,this.bracketNo=0,this.style=A,this.styles=_,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var B={};B.importmodule=H("importmodule","tag",["string","builtin"]),B.documentclass=H("documentclass","tag",["","atom"]),B.usepackage=H("usepackage","tag",["atom"]),B.begin=H("begin","tag",["atom"]),B.end=H("end","tag",["atom"]),B.label=H("label","tag",["atom"]),B.ref=H("ref","tag",["atom"]),B.eqref=H("eqref","tag",["atom"]),B.cite=H("cite","tag",["atom"]),B.bibitem=H("bibitem","tag",["atom"]),B.Bibitem=H("Bibitem","tag",["atom"]),B.RBibitem=H("RBibitem","tag",["atom"]),B.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function R(L,A){L.f=A}function x(L,A){var _;if(L.match(/^\\[a-zA-Z@]+/)){var h=L.current().slice(1);return _=B.hasOwnProperty(h)?B[h]:B.DEFAULT,_=new _,Z(A,_),R(A,P),_.style}if(L.match(/^\\[$&%#{}_]/))return"tag";if(L.match(/^\\[,;!\/\\]/))return"tag";if(L.match("\\["))return R(A,function(s,d){return w(s,d,"\\]")}),"keyword";if(L.match("\\("))return R(A,function(s,d){return w(s,d,"\\)")}),"keyword";if(L.match("$$"))return R(A,function(s,d){return w(s,d,"$$")}),"keyword";if(L.match("$"))return R(A,function(s,d){return w(s,d,"$")}),"keyword";var o=L.next();if(o=="%")return L.skipToEnd(),"comment";if(o=="}"||o=="]"){if(_=F(A),_)_.closeBracket(o),R(A,P);else return"error";return"bracket"}else return o=="{"||o=="["?(_=B.DEFAULT,_=new _,Z(A,_),"bracket"):/\d/.test(o)?(L.eatWhile(/[\w.%]/),"atom"):(L.eatWhile(/[\w\-_]/),_=G(A),_.name=="begin"&&(_.argument=L.current()),_.styleIdentifier())}function w(L,A,_){if(L.eatSpace())return null;if(_&&L.match(_))return R(A,x),"keyword";if(L.match(/^\\[a-zA-Z@]+/))return"tag";if(L.match(/^[a-zA-Z]+/))return"variable-2";if(L.match(/^\\[$&%#{}_]/))return"tag";if(L.match(/^\\[,;!\/]/))return"tag";if(L.match(/^[\^_&]/))return"tag";if(L.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(L.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var h=L.next();return h=="{"||h=="}"||h=="["||h=="]"||h=="("||h==")"?"bracket":h=="%"?(L.skipToEnd(),"comment"):"error"}function P(L,A){var _=L.peek(),h;return _=="{"||_=="["?(h=F(A),h.openBracket(_),L.eat(_),R(A,x),"bracket"):/[ \t\r]/.test(_)?(L.eat(_),null):(R(A,x),k(A),x(L,A))}return{startState:function(){var L=O.inMathMode?function(A,_){return w(A,_)}:x;return{cmdState:[],f:L}},copyState:function(L){return{cmdState:L.cmdState.slice(),f:L.f}},token:function(L,A){return A.f(L,A)},blankLine:function(L){L.f=x,L.cmdState.length=0},lineComment:"%"}}),ce.defineMIME("text/x-stex","stex"),ce.defineMIME("text/x-latex","stex")})},"+XWH":function(tt,Ke){tt.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAsFJREFUWEftlk1IVFEUx393Ri2/8qMs0ayMKCKKFkNuA/tgMCUToWWQuCmoSFIKWkXkpg/CWpXVoo0ULcShNupSVMJFRZDNxJhQKYk1Q4YzN653bObNe6PPcRwkurt73z3n/3vn3HM4Aos1PiVdv0OyC0mFRDqt7iR7JhAhBP4sp2gsKxRDIt5RRHxASulIVsSOnRAinOUUVSYA32TYK6XcZsfJcu8IIXxmgInwbKrDnghUpcME4J0IyeX+2VLs/wOsjgg0tEtXENkFVCBTXPcCinKhuRq2lJhfh5gTl3IAVrbuEdBWZ4YQ7vawlzTVfXEeXDtpjIICmE112BPWvYCO0/EAN9Jb9/ea/jWA3eWQlQkjPnv9L6URqN4LDVVa+EEvDI8uDmELID8bTh2E8mJ40g9vx8yOKzfCxVpwRFrZw174Ng3Nh2AqAJ29MPHDbLcogBK/UAOlhdp48AN09hkd5a6Byyd0g1HL+xVudkOdCw7v02ffA3Cr2wyxIMD6ddByDApytJOwhLseeD9uBDhzFPZU6LPADFx/rgVVxC7VQWaG/hacgTs94J+M2i8IcLUBSov0ZSlBhXX4o1H8yH447oqedbyEN/7oflcZKMCMyCA3HYS2p0kAqL9XeYwF2FEK52uieX81Ai8GjYBLAZgbSNwxjWhDvn5YVinIWwtX6qEgkvfRLzrHCnR+WaXgdg+MJUjB3EgWC6AcWT3CR31w1g2q5tX6+UvnfSpo/Pv6A/Yf4d+hNB5gHkKV4eZieNwPqlmfc0fF1MN899kornZbSxYvw/tNcWO5FUC86+2boKVWn/a8hu5hs7jdE0+b0zAEmVKQyNHOMshWLfeTXSnre0kDLE82ar0KAdI4kCBEyNPqiPRJHZW0jmQI4fO0Oipj05m+oRQRzhGi6lmrGDIAqM1KjuUq7IA/B9EYL660/wBboz2SWAxBPwAAAABJRU5ErkJggg=="},"19Vz":function(tt,Ke,le){(function(ce){ce(le("VrN/"))})(function(ce){ce.defineOption("placeholder","",function(H,B,R){var x=R&&R!=ce.Init;if(B&&!x)H.on("blur",F),H.on("change",k),H.on("swapDoc",k),ce.on(H.getInputField(),"compositionupdate",H.state.placeholderCompose=function(){Z(H)}),k(H);else if(!B&&x){H.off("blur",F),H.off("change",k),H.off("swapDoc",k),ce.off(H.getInputField(),"compositionupdate",H.state.placeholderCompose),J(H);var w=H.getWrapperElement();w.className=w.className.replace(" CodeMirror-empty","")}B&&!H.hasFocus()&&F(H)});function J(H){H.state.placeholder&&(H.state.placeholder.parentNode.removeChild(H.state.placeholder),H.state.placeholder=null)}function O(H){J(H);var B=H.state.placeholder=document.createElement("pre");B.style.cssText="height: 0; overflow: visible",B.style.direction=H.getOption("direction"),B.className="CodeMirror-placeholder CodeMirror-line-like";var R=H.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),B.appendChild(R),H.display.lineSpace.insertBefore(B,H.display.lineSpace.firstChild)}function Z(H){setTimeout(function(){var B=!1,R=H.getInputField();R.nodeName=="TEXTAREA"?B=!R.value:H.lineCount()==1&&(B=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),B?O(H):J(H)},20)}function F(H){G(H)&&O(H)}function k(H){var B=H.getWrapperElement(),R=G(H);B.className=B.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?O(H):J(H)}function G(H){return H.lineCount()===1&&H.getLine(0)===""}})},"1eCo":function(tt,Ke,le){(function(ce){ce(le("VrN/"))})(function(ce){"use strict";var J={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},O={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ce.defineMode("xml",function(Z,F){var k=Z.indentUnit,G={},H=F.htmlMode?J:O;for(var B in H)G[B]=H[B];for(var B in F)G[B]=F[B];var R,x;function w(a,b){function v(j){return b.tokenize=j,j(a,b)}var S=a.next();if(S=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?v(A("atom","]]>")):null:a.match("--")?v(A("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),v(_(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),b.tokenize=A("meta","?>"),"meta"):(R=a.eat("/")?"closeTag":"openTag",b.tokenize=P,"tag bracket");if(S=="&"){var I;return a.eat("#")?a.eat("x")?I=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):I=a.eatWhile(/[\d]/)&&a.eat(";"):I=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),I?"atom":"error"}else return a.eatWhile(/[^&<]/),null}w.isInText=!0;function P(a,b){var v=a.next();if(v==">"||v=="/"&&a.eat(">"))return b.tokenize=w,R=v==">"?"endTag":"selfcloseTag","tag bracket";if(v=="=")return R="equals",null;if(v=="<"){b.tokenize=w,b.state=d,b.tagName=b.tagStart=null;var S=b.tokenize(a,b);return S?S+" tag error":"tag error"}else return/[\'\"]/.test(v)?(b.tokenize=L(v),b.stringStartCol=a.column(),b.tokenize(a,b)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function L(a){var b=function(v,S){for(;!v.eol();)if(v.next()==a){S.tokenize=P;break}return"string"};return b.isInAttribute=!0,b}function A(a,b){return function(v,S){for(;!v.eol();){if(v.match(b)){S.tokenize=w;break}v.next()}return a}}function _(a){return function(b,v){for(var S;(S=b.next())!=null;){if(S=="<")return v.tokenize=_(a+1),v.tokenize(b,v);if(S==">")if(a==1){v.tokenize=w;break}else return v.tokenize=_(a-1),v.tokenize(b,v)}return"meta"}}function h(a,b,v){this.prev=a.context,this.tagName=b,this.indent=a.indented,this.startOfLine=v,(G.doNotIndent.hasOwnProperty(b)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function s(a,b){for(var v;;){if(!a.context)return;if(v=a.context.tagName,!G.contextGrabbers.hasOwnProperty(v)||!G.contextGrabbers[v].hasOwnProperty(b))return;o(a)}}function d(a,b,v){return a=="openTag"?(v.tagStart=b.column(),T):a=="closeTag"?y:d}function T(a,b,v){return a=="word"?(v.tagName=b.current(),x="tag",E):G.allowMissingTagName&&a=="endTag"?(x="tag bracket",E(a,b,v)):(x="error",T)}function y(a,b,v){if(a=="word"){var S=b.current();return v.context&&v.context.tagName!=S&&G.implicitlyClosed.hasOwnProperty(v.context.tagName)&&o(v),v.context&&v.context.tagName==S||G.matchClosing===!1?(x="tag",m):(x="tag error",f)}else return G.allowMissingTagName&&a=="endTag"?(x="tag bracket",m(a,b,v)):(x="error",f)}function m(a,b,v){return a!="endTag"?(x="error",m):(o(v),d)}function f(a,b,v){return x="error",m(a,b,v)}function E(a,b,v){if(a=="word")return x="attribute",p;if(a=="endTag"||a=="selfcloseTag"){var S=v.tagName,I=v.tagStart;return v.tagName=v.tagStart=null,a=="selfcloseTag"||G.autoSelfClosers.hasOwnProperty(S)?s(v,S):(s(v,S),v.context=new h(v,S,I==v.indented)),d}return x="error",E}function p(a,b,v){return a=="equals"?g:(G.allowMissing||(x="error"),E(a,b,v))}function g(a,b,v){return a=="string"?u:a=="word"&&G.allowUnquoted?(x="string",E):(x="error",E(a,b,v))}function u(a,b,v){return a=="string"?u:E(a,b,v)}return{startState:function(a){var b={tokenize:w,state:d,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(b.baseIndent=a),b},token:function(a,b){if(!b.tagName&&a.sol()&&(b.indented=a.indentation()),a.eatSpace())return null;R=null;var v=b.tokenize(a,b);return(v||R)&&v!="comment"&&(x=null,b.state=b.state(R||v,a,b),x&&(v=x=="error"?v+" error":x)),v},indent:function(a,b,v){var S=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+k;if(S&&S.noIndent)return ce.Pass;if(a.tokenize!=P&&a.tokenize!=w)return v?v.match(/^(\s*)/)[0].length:0;if(a.tagName)return G.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+k*(G.multilineTagIndentFactor||1);if(G.alignCDATA&&/<!\[CDATA\[/.test(b))return 0;var I=b&&/^<(\/)?([\w_:\.-]*)/.exec(b);if(I&&I[1])for(;S;)if(S.tagName==I[2]){S=S.prev;break}else if(G.implicitlyClosed.hasOwnProperty(S.tagName))S=S.prev;else break;else if(I)for(;S;){var j=G.contextGrabbers[S.tagName];if(j&&j.hasOwnProperty(I[2]))S=S.prev;else break}for(;S&&S.prev&&!S.startOfLine;)S=S.prev;return S?S.indent+k:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:G.htmlMode?"html":"xml",helperType:G.htmlMode?"html":"xml",skipAttribute:function(a){a.state==g&&(a.state=E)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var b=[],v=a.context;v;v=v.prev)v.tagName&&b.push(v.tagName);return b.reverse()}}}),ce.defineMIME("text/xml","xml"),ce.defineMIME("application/xml","xml"),ce.mimeModes.hasOwnProperty("text/html")||ce.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"2Qv1":function(tt,Ke,le){"use strict";var ce=le("rAM+"),J=le("tJVT"),O=le("PpiC"),Z=le("q1tI"),F=le.n(Z),k=le("5Ru0"),G=le.n(k),H=le("9Bee"),B=function(x){var w=x.photo,P=x.profile,L=x.name,A=x.position,_=x.type,h=x.school,o=Object(O.a)(x,["photo","profile","name","position","type","school"]),s=Object(Z.useRef)(),d=Object(Z.useState)(),T=Object(J.a)(d,2),y=T[0],m=T[1],f=Object(Z.useState)(!0),E=Object(J.a)(f,2),p=E[0],g=E[1];return Object(Z.useEffect)(function(){if(!s.current)return;function u(){var b,v=new ResizeObserver(function(S){var I=Object(ce.a)(S),j;try{for(I.s();!(j=I.n()).done;){var z=j.value;m(z.target.offsetHeight>=185),console.log(z.target.offsetHeight)}}catch(V){I.e(V)}finally{I.f()}});return v.observe((b=s.current)===null||b===void 0?void 0:b.firstElementChild),v}var a=u();return function(){var b,v;((b=s.current)===null||b===void 0?void 0:b.firstElementChild)&&a.unobserve((v=s.current)===null||v===void 0?void 0:v.firstElementChild)}},[s.current]),F.a.createElement(F.a.Fragment,null,F.a.createElement("div",{className:G.a.fz_teacher_con,style:{maxHeight:p&&228,overflow:"hidden"}},F.a.createElement("img",{src:w,style:{height:227,width:169,objectFit:"cover"}}),F.a.createElement("div",{className:G.a.teacher_info_warp},F.a.createElement("div",{className:G.a.teacher_info},F.a.createElement("div",{className:G.a.teacher_name},L),F.a.createElement("div",{className:G.a.teacher_position},A),F.a.createElement("div",{className:G.a.teacher_school},h),F.a.createElement("div",{className:G.a.teacher_type},_)),F.a.createElement("div",{className:G.a.teacher_profile,ref:s},F.a.createElement(H.a,{value:P||""})))),y&&F.a.createElement("div",{style:{textAlign:"center",color:"#145DFF",cursor:"pointer",marginBottom:"30px",fontSize:14},onClick:function(a){a.stopPropagation(),g(!p)}},p?"\u67E5\u770B\u5168\u90E8 ":"\u6536\u8D77\u5168\u6587 ",F.a.createElement("i",{className:"iconfont font14 ".concat(p?"icon-jiantou9":"icon-changyongtubiao-xianxingdaochu-zhuanqu-")})))};Ke.a=B},"5Ru0":function(tt,Ke,le){tt.exports={fz_teacher_con:"fz_teacher_con___37ZGL",teacher_info_warp:"teacher_info_warp___EYBAR",teacher_profile:"teacher_profile___3RcyF",teacher_info:"teacher_info___2XAzP",teacher_name:"teacher_name___14ORw",teacher_position:"teacher_position___11gGq",teacher_school:"teacher_school___1tpzR",teacher_type:"teacher_type___318We"}},"7Cbv":function(tt,Ke,le){"use strict";var ce=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),J=new Uint8Array(16);function O(){if(!ce)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ce(J)}var Z=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function F(P){return typeof P=="string"&&Z.test(P)}for(var k=F,G=[],H=0;H<256;++H)G.push((H+256).toString(16).substr(1));function B(P){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,A=(G[P[L+0]]+G[P[L+1]]+G[P[L+2]]+G[P[L+3]]+"-"+G[P[L+4]]+G[P[L+5]]+"-"+G[P[L+6]]+G[P[L+7]]+"-"+G[P[L+8]]+G[P[L+9]]+"-"+G[P[L+10]]+G[P[L+11]]+G[P[L+12]]+G[P[L+13]]+G[P[L+14]]+G[P[L+15]]).toLowerCase();if(!k(A))throw TypeError("Stringified UUID is invalid");return A}var R=B;function x(P,L,A){P=P||{};var _=P.random||(P.rng||O)();if(_[6]=_[6]&15|64,_[8]=_[8]&63|128,L){A=A||0;for(var h=0;h<16;++h)L[A+h]=_[h];return L}return R(_)}var w=Ke.a=x},"7ahc":function(tt,Ke,le){"use strict";le.d(Ke,"a",function(){return T});var ce=le("k1fw"),J=le("0Owb"),O=le("+L6B"),Z=le("2/Rp"),F=le("y8nQ"),k=le("Vl3Y"),G=le("tJVT"),H=le("OaEy"),B=le("2fM7"),R=le("q1tI"),x=le.n(R),w=le("VrN/"),P=le.n(w),L=le("p77/"),A=le.n(L),_=le("c5Ni"),h=le.n(_),o=B.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(y){var m=y.callback,f=y.onCancel,E=Object(R.useState)("python"),p=Object(G.a)(E,2),g=p[0],u=p[1];function a(v){u(d[v][1])}function b(v){m(v)}return x.a.createElement(k.a,Object(J.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:b}),x.a.createElement(k.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},x.a.createElement(B.a,{onChange:a},Object.keys(d).map(function(v){return x.a.createElement(o,{key:v,value:v},d[v][0])}))),x.a.createElement(k.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},x.a.createElement(T,{mode:g})),x.a.createElement("div",{className:"flex-container flex-end"},x.a.createElement(Z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),x.a.createElement(Z.a,{type:"ghost",onClick:f},"\u53D6\u6D88")))};function T(y){var m=y.value,f=y.onChange,E=y.mode,p=y.options,g=p===void 0?{}:p,u=Object(R.useRef)(),a=Object(R.useState)(),b=Object(G.a)(a,2),v=b[0],S=b[1];return Object(R.useEffect)(function(){if(v){function I(j){var z=j.getValue();f&&f(z)}return v.on("change",I),function(){v.off("change",I)}}},[v,f]),Object(R.useEffect)(function(){v&&v.setOption("mode",E)},[v,E]),Object(R.useEffect)(function(){v&&((m!==v.getValue()||m==="")&&setTimeout(function(){v.setValue(m||" ")},300))},[v,m]),Object(R.useEffect)(function(){if(u.current&&!v){var I=P.a.fromTextArea(u.current,Object(ce.a)({mode:E,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},g));S(I)}},[u.current,v]),x.a.createElement("div",{className:"my-codemirror-container"},x.a.createElement("textarea",{ref:u}))}},"7ixt":function(tt,Ke,le){"use strict";le.d(Ke,"a",function(){return O});var ce={adjustX:1,adjustY:1},J=[0,0],O={left:{points:["cr","cl"],overflow:ce,offset:[-4,0],targetOffset:J},right:{points:["cl","cr"],overflow:ce,offset:[4,0],targetOffset:J},top:{points:["bc","tc"],overflow:ce,offset:[0,-4],targetOffset:J},bottom:{points:["tc","bc"],overflow:ce,offset:[0,4],targetOffset:J},topLeft:{points:["bl","tl"],overflow:ce,offset:[0,-4],targetOffset:J},leftTop:{points:["tr","tl"],overflow:ce,offset:[-4,0],targetOffset:J},topRight:{points:["br","tr"],overflow:ce,offset:[0,-4],targetOffset:J},rightTop:{points:["tl","tr"],overflow:ce,offset:[4,0],targetOffset:J},bottomRight:{points:["tr","br"],overflow:ce,offset:[0,4],targetOffset:J},rightBottom:{points:["bl","br"],overflow:ce,offset:[4,0],targetOffset:J},bottomLeft:{points:["tl","bl"],overflow:ce,offset:[0,4],targetOffset:J},leftBottom:{points:["br","bl"],overflow:ce,offset:[-4,0],targetOffset:J}},Z=O},"8EBN":function(tt,Ke,le){(function(ce){ce(le("VrN/"))})(function(ce){"use strict";ce.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 J=0;J<ce.modeInfo.length;J++){var O=ce.modeInfo[J];O.mimes&&(O.mime=O.mimes[0])}ce.findModeByMIME=function(Z){Z=Z.toLowerCase();for(var F=0;F<ce.modeInfo.length;F++){var k=ce.modeInfo[F];if(k.mime==Z)return k;if(k.mimes){for(var G=0;G<k.mimes.length;G++)if(k.mimes[G]==Z)return k}}if(/\+xml$/.test(Z))return ce.findModeByMIME("application/xml");if(/\+json$/.test(Z))return ce.findModeByMIME("application/json")},ce.findModeByExtension=function(Z){Z=Z.toLowerCase();for(var F=0;F<ce.modeInfo.length;F++){var k=ce.modeInfo[F];if(k.ext){for(var G=0;G<k.ext.length;G++)if(k.ext[G]==Z)return k}}},ce.findModeByFileName=function(Z){for(var F=0;F<ce.modeInfo.length;F++){var k=ce.modeInfo[F];if(k.file&&k.file.test(Z))return k}var G=Z.lastIndexOf("."),H=G>-1&&Z.substring(G+1,Z.length);if(H)return ce.findModeByExtension(H)},ce.findModeByName=function(Z){Z=Z.toLowerCase();for(var F=0;F<ce.modeInfo.length;F++){var k=ce.modeInfo[F];if(k.name.toLowerCase()==Z)return k;if(k.alias){for(var G=0;G<k.alias.length;G++)if(k.alias[G].toLowerCase()==Z)return k}}}})},"8hTe":function(tt,Ke,le){tt.exports={button:"button___1wy9m"}},"9Bee":function(tt,Ke,le){"use strict";var ce=le("DYRE"),J=le("zeV3"),O=le("+L6B"),Z=le("2/Rp"),F=le("k1fw"),k=le("9og8"),G=le("tJVT"),H=le("WmNS"),B=le.n(H),R=le("q1tI"),x=le.n(R),w=le("vg9a"),P=le("DlQD"),L=le.n(P),A=le("rUJ1");function _(se,q){var ee=se.match(/^(\s+)(?:```)/);if(ee===null)return q;var ae=ee[1];return q.split(`
`).map(function(ue){var te=ue.match(/^\s+/);if(te===null)return ue;var ne=Object(G.a)(te,1),de=ne[0];return de.length>=ae.length?ue.slice(ae.length):ue}).join(`
`)}var h=[],o=["<ul>"],s=new L.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function T(){h.length=0,o=["<ul>"]}var y={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function m(se,q,ee,ae){if(q>=se.length||se[q].level<=ee)return q;var ue=se[q];ae.push("<li><a href='#"+ue.anchor+"'>"+ue.text+"</a>"),q++;var te=[];return q=m(se,q,ue.level,te),te.length>0&&(ae.push("<ul>"),te.forEach(function(ne){ae.push(ne)}),ae.push("</ul>")),ae.push("</li>"),q=m(se,q,ee,ae),q}function f(){return m(h,0,0,o),o.push("</ul>"),o.join("")}var E={heading:function(q){var ee=d.exec(q);if(ee)return{type:"heading",raw:ee[0],depth:ee[1].length,text:ee[2]}},fences:function(q){var ee=this.rules.block.fences.exec(q);if(ee){var ae=ee[0],ue=_(ae,ee[3]||""),te=ee[2]?ee[2].trim():ee[2];if(["latex","katex","math"].indexOf(te)>=0){var ne=u(),de=ue;ue=ne,a[ne]={type:"block",expression:de}}return{type:"code",raw:ae,lang:te,text:ue}}}},p=/(?:\${2})([^\n`]+?)(?:\${2})/gi,g=0,u=function(){return"__special_katext_id_".concat(g++,"__")},a={};function b(){return a}function v(){g=0,a={}}function S(se){return se=se.replace(p,function(q,ee){var ae=u();return a[ae]={type:"inline",expression:ee},ae}),se}var I=s.listitem;s.listitem=function(se){return I(S(se))};var j=s.paragraph;s.paragraph=function(se){return j(S(se))};var z=s.tablecell;s.tablecell=function(se,q){return z(S(se),q)},s.code=function(se,q,ee){var ae=(q||"").match(/\S*/)[0];return ae?["latex","katex","math"].indexOf(ae)>=0?"<p class='editormd-tex'>".concat(se,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(q,'">').concat(ee?se:Object(A.escape)(se,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(ee?se:Object(A.escape)(se,!0))+"</code></pre>"},s.heading=function(se,q,ee){var ae=this.options.headerPrefix+ee.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return h.push({anchor:ae,level:q,text:se}),"<h"+q+' id="'+ae+'">'+se+"</h"+q+">"},L.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),L.a.use({tokenizer:E,renderer:s});var V=L.a,M=le("SJMd"),N=le("ulZh"),$=le.n(N),ie=le("m3rI"),he=le("Oy/b"),me=le("p5ED"),ke=le("ErOA"),Se=le("STEk");/* **********************************
cropro version 1.2.0
@license SEE LICENSE IN LICENSE
copyright Alan Mendelevich
see README and LICENSE for details
********************************** *//*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var Re=function(se,q){return(Re=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ee,ae){ee.__proto__=ae}||function(ee,ae){for(var ue in ae)Object.prototype.hasOwnProperty.call(ae,ue)&&(ee[ue]=ae[ue])})(se,q)};function Te(se,q){if(typeof q!="function"&&q!==null)throw new TypeError("Class extends value "+String(q)+" is not a constructor or null");function ee(){this.constructor=se}Re(se,q),se.prototype=q===null?Object.create(q):(ee.prototype=q.prototype,new ee)}function _e(se,q,ee,ae){return new(ee||(ee=Promise))(function(ue,te){function ne(ve){try{fe(ae.next(ve))}catch(Ee){te(Ee)}}function de(ve){try{fe(ae.throw(ve))}catch(Ee){te(Ee)}}function fe(ve){var Ee;ve.done?ue(ve.value):(Ee=ve.value,Ee instanceof ee?Ee:new ee(function(Me){Me(Ee)})).then(ne,de)}fe((ae=ae.apply(se,q||[])).next())})}function ye(se,q){var ee,ae,ue,te,ne={label:0,sent:function(){if(1&ue[0])throw ue[1];return ue[1]},trys:[],ops:[]};return te={next:de(0),throw:de(1),return:de(2)},typeof Symbol=="function"&&(te[Symbol.iterator]=function(){return this}),te;function de(fe){return function(ve){return function(Ee){if(ee)throw new TypeError("Generator is already executing.");for(;ne;)try{if(ee=1,ae&&(ue=2&Ee[0]?ae.return:Ee[0]?ae.throw||((ue=ae.return)&&ue.call(ae),0):ae.next)&&!(ue=ue.call(ae,Ee[1])).done)return ue;switch(ae=0,ue&&(Ee=[2&Ee[0],ue.value]),Ee[0]){case 0:case 1:ue=Ee;break;case 4:return ne.label++,{value:Ee[1],done:!1};case 5:ne.label++,ae=Ee[1],Ee=[0];continue;case 7:Ee=ne.ops.pop(),ne.trys.pop();continue;default:if(!(ue=ne.trys,(ue=ue.length>0&&ue[ue.length-1])||Ee[0]!==6&&Ee[0]!==2)){ne=0;continue}if(Ee[0]===3&&(!ue||Ee[1]>ue[0]&&Ee[1]<ue[3])){ne.label=Ee[1];break}if(Ee[0]===6&&ne.label<ue[1]){ne.label=ue[1],ue=Ee;break}if(ue&&ne.label<ue[2]){ne.label=ue[2],ne.ops.push(Ee);break}ue[2]&&ne.ops.pop(),ne.trys.pop();continue}Ee=q.call(se,ne)}catch(Me){Ee=[6,Me],ae=0}finally{ee=ue=0}if(5&Ee[0])throw Ee[1];return{value:Ee[0]?Ee[1]:void 0,done:!0}}([fe,ve])}}}var K=function(){function se(){}return se.addKey=function(q){se.key=q},Object.defineProperty(se,"isLicensed",{get:function(){return!!se.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(se.key)},enumerable:!1,configurable:!0}),se}(),l=function(){function se(){}return se.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},se.setAttributes=function(q,ee){for(var ae=0,ue=ee;ae<ue.length;ae++){var te=ue[ae],ne=te[0],de=te[1];q.setAttribute(ne,de)}},se.createRect=function(q,ee,ae){var ue=document.createElementNS("http://www.w3.org/2000/svg","rect");return ue.setAttribute("width",q.toString()),ue.setAttribute("height",ee.toString()),ae&&se.setAttributes(ue,ae),ue},se.createLine=function(q,ee,ae,ue,te){var ne=document.createElementNS("http://www.w3.org/2000/svg","line");return ne.setAttribute("x1",q.toString()),ne.setAttribute("y1",ee.toString()),ne.setAttribute("x2",ae.toString()),ne.setAttribute("y2",ue.toString()),te&&se.setAttributes(ne,te),ne},se.createPolygon=function(q,ee){var ae=document.createElementNS("http://www.w3.org/2000/svg","polygon");return ae.setAttribute("points",q),ee&&se.setAttributes(ae,ee),ae},se.createCircle=function(q,ee){var ae=document.createElementNS("http://www.w3.org/2000/svg","circle");return ae.setAttribute("cx",(q/2).toString()),ae.setAttribute("cy",(q/2).toString()),ae.setAttribute("r",q.toString()),ee&&se.setAttributes(ae,ee),ae},se.createEllipse=function(q,ee,ae){var ue=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return ue.setAttribute("cx",(q/2).toString()),ue.setAttribute("cy",(ee/2).toString()),ue.setAttribute("rx",(q/2).toString()),ue.setAttribute("ry",(ee/2).toString()),ae&&se.setAttributes(ue,ae),ue},se.createGroup=function(q){var ee=document.createElementNS("http://www.w3.org/2000/svg","g");return q&&se.setAttributes(ee,q),ee},se.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},se.createMarker=function(q,ee,ae,ue,te,ne,de){var fe=document.createElementNS("http://www.w3.org/2000/svg","marker");return se.setAttributes(fe,[["id",q],["orient",ee],["markerWidth",ae.toString()],["markerHeight",ue.toString()],["refX",te.toString()],["refY",ne.toString()]]),fe.appendChild(de),fe},se.createText=function(q){var ee=document.createElementNS("http://www.w3.org/2000/svg","text");return ee.setAttribute("x","0"),ee.setAttribute("y","0"),q&&se.setAttributes(ee,q),ee},se.createTSpan=function(q,ee){var ae=document.createElementNS("http://www.w3.org/2000/svg","tspan");return ae.textContent=q,ee&&se.setAttributes(ae,ee),ae},se.createImage=function(q){var ee=document.createElementNS("http://www.w3.org/2000/svg","image");return q&&se.setAttributes(ee,q),ee},se.createPoint=function(q,ee){var ae=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return ae.x=q,ae.y=ee,ae},se.createPath=function(q,ee){var ae=document.createElementNS("http://www.w3.org/2000/svg","path");return ae.setAttribute("d",q),ee&&se.setAttributes(ae,ee),ae},se.createElement=function(q,ee){var ae=document.createElementNS("http://www.w3.org/2000/svg",q);return ee&&se.setAttributes(ae,ee),ae},se.getHollowRectanglePath=function(q,ee,ae,ue,te,ne,de,fe){return"M"+q+","+ee+"V"+(ee+ue)+"H"+(q+ae)+"V"+ee+"H"+te+"V"+ne+"H"+(te+de)+"V"+(ne+fe)+"H"+te+"V"+ee+"Z"},se}(),c=function(){function se(q){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+q+"_"}return Object.defineProperty(se.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),se.prototype.addClass=function(q){return this.styleSheet===void 0&&this.addStyleSheet(),q.name=""+this.classNamePrefix+q.localName,this.classes.push(q),this.styleSheet.sheet.insertRule("."+q.name+" {"+q.style+"}",this.styleSheet.sheet.cssRules.length),q},se.prototype.addRule=function(q){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(q),this.styleSheet.sheet.insertRule(q.selector+" {"+q.style+"}",this.styleSheet.sheet.cssRules.length)},se.prototype.addStyleSheet=function(){var q;this.styleSheet=document.createElement("style"),((q=this.styleSheetRoot)!==null&&q!==void 0?q:document.head).appendChild(this.styleSheet),this.addRule(new D("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new D("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new D("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new X("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new X("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},se.prototype.removeStyleSheet=function(){var q;this.styleSheet&&(((q=this.styleSheetRoot)!==null&&q!==void 0?q:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},se}(),D=function(se,q){this.selector=se,this.style=q},X=function(se,q){this.localName=se,this.style=q},U=function(){function se(){this.blocks=[],this.display=""}return se.prototype.addButtonBlock=function(q){q.className=this.blockClassName,q.buttonClassName=this.buttonClassName,q.buttonColorsClassName=this.buttonColorsClassName,q.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(q)},se.prototype.addElementBlock=function(q){q.className===void 0&&(q.className=this.blockClassName),this.blocks.push(q)},se.prototype.getUI=function(){var q=document.createElement("div");return q.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,q.style.display=this.display,this.blocks.forEach(function(ee){return q.appendChild(ee.getUI())}),q},se}(),oe=function(){function se(){}return se.prototype.getUI=function(){var q=document.createElement("div");if(q.className=this.className,this.minWidth!==void 0&&(q.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":q.style.justifyContent="flex-start";break;case"center":q.style.justifyContent="center";break;case"end":q.style.justifyContent="flex-end"}return q.style.whiteSpace="nowrap",q},se}(),be=function(se){function q(){var ee=se!==null&&se.apply(this,arguments)||this;return ee.buttons=[],ee}return Te(q,se),q.prototype.addButton=function(ee){ee.className=this.buttonClassName,ee.colorsClassName=this.buttonColorsClassName,ee.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(ee)},q.prototype.getUI=function(){var ee=se.prototype.getUI.call(this);return this.buttons.forEach(function(ae){return ee.appendChild(ae.getUI())}),ee},q}(oe),xe=function(){function se(q,ee){this._isActive=!1,this._isHidden=!1,this._icon=q,this.title=ee,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(se.prototype,"icon",{get:function(){return this._icon},set:function(q){this._icon=q,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"isActive",{get:function(){return this._isActive},set:function(q){this._isActive=q,this.adjustClassName()},enumerable:!1,configurable:!0}),se.prototype.getUI=function(){var q=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return q.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},se.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},se.prototype.hide=function(){this._isHidden=!0},se}(),Pe=function(se){function q(){var ee=se!==null&&se.apply(this,arguments)||this;return ee.elements=[],ee}return Te(q,se),q.prototype.addElement=function(ee){this.elements.push(ee)},q.prototype.getUI=function(){var ee=se.prototype.getUI.call(this);return this.elements.forEach(function(ae){return ee.appendChild(ae)}),ee},q}(oe),De=function(){function se(q,ee){this.horizontal=q,this.vertical=ee}return Object.defineProperty(se.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),se.prototype.getVerticalLength=function(q){return q/this.ratio},se.prototype.getHorizontalLength=function(q){return q*this.ratio},se}(),Oe=function(){function se(){}return se.getIcon=function(q,ee){if(q>0&&ee>0){var ae=new De(q,ee),ue=ae.ratio>=1?20:ae.getHorizontalLength(20),te=ae.ratio<1?20:ae.getVerticalLength(20),ne=document.createElementNS("http://www.w3.org/2000/svg","svg");ne.setAttribute("xmlns","http://www.w3.org/2000/svg"),ne.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ne);var de=l.createDefs();ne.appendChild(de);var fe=l.createElement("clipPath",[["id","text-bg-clip"]]);de.appendChild(fe);var ve=l.createPath(l.getHollowRectanglePath((24-ue)/2,(24-te)/2,ue,te,(24-ue)/2+2,(24-te)/2+2,ue-4,te-4));ne.appendChild(ve);var Ee=l.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ee.appendChild(l.createTSpan(q+":"+ee)),ne.appendChild(Ee);var Me=Ee.getBBox();l.setAttributes(Ee,[["x",((24-Me.width)/2).toString()],["y",((24-Me.height)/2-Me.y).toString()]]);var Ge=l.createPath(l.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Me.width))/2,(24-Math.ceil(Me.height))/2,Math.ceil(Me.width),Math.ceil(Me.height)));return fe.appendChild(Ge),l.setAttributes(ve,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ne),ne.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},se}(),Ie=function(se){function q(ee,ae,ue){var te=se.call(this,ee,ae)||this;return te.isDropdownOpen=!1,te.onClick=te.dropdownButtonClicked,te.dropdownButtons=ue,te}return Te(q,se),q.prototype.setupDropdown=function(){var ee=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(ae){ae.className=ee.className,ae.colorsClassName=ee.colorsClassName,ee.dropdownBlock.appendChild(ae.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},q.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},q.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},q.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},q.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},q.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},q}(xe),He=function(){function se(q,ee){this.GRIP_SIZE=10,this.color=q,this.fillColor=ee,this.visual=l.createGroup(),this.visual.appendChild(l.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(l.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return se.prototype.ownsTarget=function(q){return q===this.visual||q===this.visual.childNodes[0]||q===this.visual.childNodes[1]},se.prototype.setCenter=function(q,ee){this.visual.childNodes.forEach(function(ae){return l.setAttributes(ae,[["cx",q.toString()],["cy",ee.toString()]])})},se}(),Ve=function(){function se(q,ee,ae,ue){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=q,this.canvasHeight=ee,this.margin=ae,this.container=ue,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(se.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(q){this._aspectRatio=q,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(q){this._isGridVisible=q,this.gridContainer&&l.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(q){this._zoomFactor=q,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),se.prototype.open=function(){var q=this;this.cropShadeElement=l.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=l.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var ee=0;ee<this.numberOfGridLines;ee++)this.horizontalGridLines.push(l.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(l.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(ae){return q.gridContainer.appendChild(ae)}),this.verticalGridLines.forEach(function(ae){return q.gridContainer.appendChild(ae)}),this.cropRectElement=l.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new He(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new He(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new He(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new He(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},se.prototype.setCropRectangle=function(q){this.cropRect=q;var ee=Object.assign({},this.cropRect);this.zoomFactor!==1&&(ee.width=this.cropRect.width*this.zoomFactor,ee.height=this.cropRect.height*this.zoomFactor,ee.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-ee.width/2,ee.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-ee.height/2),l.setAttributes(this.cropRectElement,[["x",ee.x.toString()],["y",ee.y.toString()],["width",ee.width.toString()],["height",ee.height.toString()]]);var ae=ee.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(te,ne){var de=ee.y+ae*(ne+1);l.setAttributes(te,[["x1",""+ee.x],["y1",""+de],["x2",""+(ee.x+ee.width)],["y2",""+de]])});var ue=ee.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(te,ne){var de=ee.x+ue*(ne+1);l.setAttributes(te,[["x1",""+de],["y1",""+ee.y],["x2",""+de],["y2",""+(ee.y+ee.height)]])}),l.setAttributes(this.cropShadeElement,[["d",l.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,ee.x,ee.y,ee.width,ee.height)]]),this.topLeftGrip.setCenter(ee.x,ee.y),this.topRightGrip.setCenter(ee.x+ee.width,ee.y),this.bottomLeftGrip.setCenter(ee.x,ee.y+ee.height),this.bottomRightGrip.setCenter(ee.x+ee.width,ee.y+ee.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},se.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},se.prototype.clientToLocalCoordinates=function(q,ee){var ae=this.container.getBoundingClientRect();return{x:q-ae.left+this.margin,y:ee-ae.top+this.margin}},se.prototype.onPointerDown=function(q){this.container.setPointerCapture(q.pointerId),this.previousPoint=this.clientToLocalCoordinates(q.clientX,q.clientY),this.cropRectElement===q.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(q.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(q.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(q.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(q.target)&&(this.activeGrip=this.bottomRightGrip)},se.prototype.onPointerMove=function(q){if(this.isMoving)this.move(this.clientToLocalCoordinates(q.clientX,q.clientY));else if(this.activeGrip){var ee=this.clientToLocalCoordinates(q.clientX,q.clientY);this.resize(ee)}q.preventDefault()},se.prototype.onPointerUp=function(q){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(q.pointerId)},se.prototype.move=function(q){var ee=q.x-this.previousPoint.x,ae=q.y-this.previousPoint.y;this.zoomFactor!==1&&(ee=-ee/this.zoomFactor,ae=-ae/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+ee),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+ae),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=q},se.prototype.resize=function(q){var ee=Object.assign({},this.cropRect),ae=q.x-this.previousPoint.x,ue=q.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:ee.x+ae<this.margin&&(ae=this.margin-ee.x),ee.x+=ae,ee.width=this.cropRect.x+this.cropRect.width-ee.x;break;case this.bottomRightGrip:case this.topRightGrip:ee.width+ae>this.canvasWidth*this.zoomFactor&&(ae=this.canvasWidth*this.zoomFactor-ee.width),ee.width+=ae}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(ee.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(ae),ee.height=this.aspectRatio.getVerticalLength(ee.width)):(ee.y+=ue,ee.height=this.cropRect.y+this.cropRect.height-ee.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?ee.height=this.aspectRatio.getVerticalLength(ee.width):ee.height+=ue}ee.width<10&&(ee.x=this.cropRect.x,ee.width=10),ee.height<10&&(ee.y=this.cropRect.y,ee.height=10),this.previousPoint=q,ee.x>=this.margin&&ee.y>=this.margin&&ee.x-this.margin+ee.width<=this.canvasWidth&&ee.y-this.margin+ee.height<=this.canvasHeight&&(this.cropRect=ee,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},se.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var q=this.cropRect.x+this.cropRect.width/2,ee=this.cropRect.y+this.cropRect.height/2,ae=this.aspectRatio.getHorizontalLength(this.cropRect.height),ue=this.aspectRatio.getVerticalLength(this.cropRect.width);ae/this.canvasWidth<ue/this.canvasHeight?this.cropRect.width=ae:this.cropRect.height=ue,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=q-this.cropRect.width/2,this.cropRect.y=ee-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},se.prototype.getRescaledRect=function(q,ee,ae,ue,te,ne){var de=ae/q,fe=ue/ee;return{x:(te.x-ne)*de+ne,y:(te.y-ne)*fe+ne,width:te.width*de,height:te.height*fe}},se.prototype.scaleCanvas=function(q,ee){var ae=this.getRescaledRect(this.canvasWidth,this.canvasHeight,q,ee,this.cropRect,this.margin);this.canvasWidth=q,this.canvasHeight=ee,this.onCropChange&&this.onCropChange(ae),this.setCropRectangle(ae)},se}(),Je=function(){function se(q){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=q,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(se.prototype,"angle",{get:function(){return this._angle},set:function(q){this._angle=q,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),se.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},se.prototype.onPointerDown=function(q){this.controlContainer.setPointerCapture(q.pointerId),this.isDragging=!0,this.previousPoint={x:q.clientX,y:q.clientY}},se.prototype.onPointerMove=function(q){this.isDragging&&(this.onAngleChange&&this.onAngleChange((q.clientX-this.previousPoint.x)/5),this.previousPoint.x=q.clientX)},se.prototype.onPointerUp=function(q){this.isDragging&&this.onAngleChange&&this.onAngleChange((q.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(q.pointerId)},se.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var q=this.angleLabelText.getBBox();l.setAttributes(this.angleLabelElement,[["x",((this.width-q.width)/2).toString()],["y",(this.height/2).toString()]])}},se.prototype.positionScaleShape=function(){if(this.scaleShape){var q=this.scaleShape.transform.baseVal.getItem(0);q.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(q,0)}},se.prototype.getVisual=function(){var q=document.createElementNS("http://www.w3.org/2000/svg","svg");q.setAttribute("xmlns","http://www.w3.org/2000/svg"),q.setAttribute("width",this.width+"px"),q.setAttribute("height",this.height+"px"),q.setAttribute("viewBox","0 0 "+this.width+" "+this.height),q.style.flexShrink="0",document.body.appendChild(q);for(var ee="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,ae=1;ae<=this.width/5+10;ae++){var ue=ae%5==0?this.height/3:this.height/6;ee+="h4v"+-ue+"h1v"+ue}ee+="v1H0Z",this.scaleShape=l.createPath(ee);var te=l.createTransform();this.scaleShape.transform.baseVal.appendItem(te),q.appendChild(this.scaleShape),this.angleLabelElement=l.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=l.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ne=l.createTSpan("");return ne.innerHTML="&deg;",this.angleLabelElement.appendChild(ne),q.appendChild(this.angleLabelElement),document.body.removeChild(q),q},se}(),Xe=function(){function se(){this.naturalSize=!1,this.imageType="image/png"}return se.prototype.rasterize=function(q,ee,ae,ue,te,ne,de){var fe=this;return new Promise(function(ve){var Ee=document.createElement("canvas");Ee.width=q.width.baseVal.value-2*ue,Ee.height=q.height.baseVal.value-2*ue;var Me=1,Ge=1;fe.naturalSize===!0?(Me=ee.naturalWidth/(q.width.baseVal.value-2*ue)/ne,Ge=ee.naturalHeight/(q.height.baseVal.value-2*ue)/de,Ee.width=ee.naturalWidth/ne,Ee.height=ee.naturalHeight/de):fe.width!==void 0&&fe.height!==void 0&&(Me=fe.width/ae.width,Ge=fe.height/ae.height,Ee.width*=Me,Ee.height*=Ge);var nt=Ee.getContext("2d");nt.translate(Ee.width/2,Ee.height/2),nt.rotate(te*Math.PI/180),nt.scale(ne,de),nt.translate(-Ee.width/2,-Ee.height/2),nt.drawImage(ee,0,0,Ee.width,Ee.height);var at=document.createElement("canvas");at.width=ae.width*Me,at.height=ae.height*Ge,at.getContext("2d").putImageData(nt.getImageData((ae.x-ue)*Me,(ae.y-ue)*Ge,ae.width*Me,ae.height*Ge),0,0),ve(at.toDataURL(fe.imageType,fe.imageQuality))})},se}(),We=function(){function se(q){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=se.instanceCounter++,this.styles=new c(this.instanceNo),this.target=q,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(se.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(q){this._zoomToCropEnabled=q,q?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(q){this._isGridVisible=q,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"gridLines",{get:function(){return this._gridLines},set:function(q){this._gridLines=q,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(q){this._rotationAngle=q,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"aspectRatio",{get:function(){var q;return(q=this._aspectRatio)!==null&&q!==void 0?q:this.aspectRatios[0]},set:function(q){this._aspectRatio=q},enumerable:!1,configurable:!0}),se.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},se.prototype.show=function(){this.showUI(),this.open()},se.prototype.close=function(q){q===void 0&&(q=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),q||this.closeEventListeners.forEach(function(ee){return ee()}),this._isOpen=!1)},se.prototype.addRenderEventListener=function(q){this.renderEventListeners.push(q)},se.prototype.removeRenderEventListener=function(q){this.renderEventListeners.indexOf(q)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(q),1)},se.prototype.addCloseEventListener=function(q){this.closeEventListeners.push(q)},se.prototype.removeCloseEventListener=function(q){this.closeEventListeners.indexOf(q)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(q),1)},se.prototype.setupResizeObserver=function(){var q=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){q.resize(q.target.clientWidth,q.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},se.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var q=1*this.target.clientWidth/this.target.clientHeight,ee=this.contentDiv.clientWidth/q>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*q:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,ae=ee+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/q;this.resize(ee,ae)}},se.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},se.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",l.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},se.prototype.resize=function(q,ee){this.imageWidth=Math.round(q),this.imageHeight=Math.round(ee),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},se.prototype.setEditingTarget=function(){var q=document.createElement("canvas");q.width=this.target.naturalWidth,q.height=this.target.naturalHeight,q.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var ee=q.toDataURL();l.setAttributes(this.editingTarget,[["href",ee]]),this.setEditingTargetSize()},se.prototype.setTopLeft=function(){var q=this.target.getBoundingClientRect(),ee=this.editorCanvas.getBoundingClientRect();this.left=q.left-ee.left-this.CANVAS_MARGIN,this.top=q.top-ee.top-this.CANVAS_MARGIN},se.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=l.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=l.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=l.createGroup(),this.editingTargetRotationScaleContainer=l.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var q=l.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(q);var ee=l.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(ee),this.editingTargetContainer=l.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},se.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},se.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=l.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Ve(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},se.prototype.zoomToCrop=function(){if(this.cropRect){var q=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,ee=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=q+"px "+ee+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-q+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-ee+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},se.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},se.prototype.cropRectChanged=function(q){this.cropRect=q,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},se.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},se.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},se.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},se.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var q=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,ee=this.target.offsetTop>q+this.CANVAS_MARGIN?this.target.offsetTop-(q+this.CANVAS_MARGIN):0;this.coverDiv.style.top=ee+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},se.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},se.prototype.addTopToolbar=function(){var q=this;this.topToolbar=new U,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var ee=new be;ee.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(ee);var ae=[];this.aspectRatios.forEach(function(Ge){var nt=new xe(Oe.getIcon(Ge.horizontal,Ge.vertical),Ge.horizontal===0&&Ge.vertical===0?"FREE":Ge.horizontal+":"+Ge.vertical);nt.onClick=function(){return q.ratioButtonClicked(Ge)},ae.push(nt)}),this.aspectRatioButton=new Ie(Oe.getIcon(0,0),"Aspect ratio",ae),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,ee.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var ue=new xe('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");ue.isActive=this.isGridVisible,ue.onClick=function(){q.isGridVisible=!q.isGridVisible,ue.isActive=q.isGridVisible},ee.addButton(ue);var te=new xe('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(te.isActive=this.zoomToCropEnabled,te.onClick=function(){q.zoomToCropEnabled=!q.zoomToCropEnabled,te.isActive=q.zoomToCropEnabled},ee.addButton(te),!K.isLicensed){var ne=new Pe;this.topToolbar.addElementBlock(ne);var de=document.createElement("div");de.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var fe=document.createElement("a");fe.style.color="currentColor",fe.href="https://markerjs.com/products/cropro",fe.target="_blank",fe.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',de.appendChild(fe),ne.addElement(de)}var ve=new be;ve.minWidth=3*this.toolbarHeight+"px",ve.contentAlign="end",this.topToolbar.addButtonBlock(ve);var Ee=new xe('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Ee.onClick=this.startRenderAndClose,ve.addButton(Ee),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ee.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Me=new xe('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");Me.onClick=this.close,ve.addButton(Me),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Me.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},se.prototype.addBottomToolbar=function(){var q=this;this.bottomToolbar=new U,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var ee=new be;ee.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(ee);var ae=new xe('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");ae.onClick=this.rotateLeftButtonClicked,ee.addButton(ae);var ue=new xe('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");ue.onClick=this.rotateRightButtonClicked,ee.addButton(ue);var te=new Pe;te.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(te),this.straightener=new Je("Straighten"),this.straightener.className=this.toolbarStraightenerStyleClass.name,this.straightener.colorsClassName=this.styles.settings.toolbarStraightenerColorsClassName?this.styles.settings.toolbarStraightenerColorsClassName:this.toolbarStraightenerStyleColorsClass.name,this.straightener.onAngleChange=function(ve){q.rotateBy(ve),q.straightener.angle=q.rotationAngle},te.addElement(this.straightener.getUI());var ne=new be;ne.minWidth=2*this.toolbarHeight+"px",ne.contentAlign="end",this.bottomToolbar.addButtonBlock(ne);var de=new xe('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");de.onClick=this.flipHorizontallyButtonClicked,ne.addButton(de);var fe=new xe('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");fe.onClick=this.flipVerticallyButtonClicked,ne.addButton(fe)},se.prototype.ratioButtonClicked=function(q){this.aspectRatio=q,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},se.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Oe.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},se.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new De(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},se.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},se.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},se.prototype.restoreState=function(q){if(q){var ee=this.cropLayer.getRescaledRect(q.width,q.height,this.imageWidth,this.imageHeight,q.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(ee),this.cropRectChanged(ee),this.flippedHorizontally=q.flippedHorizontally,this.flippedVertically=q.flippedVertically,this.applyFlip(),this.rotationAngle=q.rotationAngle,this.applyRotation()}},se.prototype.clientToLocalCoordinates=function(q,ee){var ae=this.cropImage.getBoundingClientRect();return{x:q-ae.left,y:ee-ae.top}},se.prototype.onWindowResize=function(){this.positionUI()},se.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var q=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=q+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},se.prototype.rotateLeftButtonClicked=function(){var q=this.rotationAngle-90;this.rotationAngle%90!=0&&(q+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(q)},se.prototype.rotateRightButtonClicked=function(){var q=this.rotationAngle+90;this.rotationAngle%90!=0&&(q-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(q)},se.prototype.rotateTo=function(q){q=(q=q>180?q-360:q)<=-180?q+360:q,this.rotationAngle=q,this.applyRotation()},se.prototype.rotateBy=function(q){this.rotateTo((this.rotationAngle+q)%360)},se.prototype.applyRotation=function(){var q=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var ee=this.editingTargetRotationContainer.transform.baseVal.getItem(0);ee.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(ee,0);var ae=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/ae.width,this.imageHeight/ae.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=q},se.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},se.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},se.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},se.prototype.startRenderAndClose=function(){return _e(this,void 0,void 0,function(){var q,ee;return ye(this,function(ae){switch(ae.label){case 0:return[4,this.render()];case 1:return q=ae.sent(),ee=this.getState(),this.renderEventListeners.forEach(function(ue){return ue(q,ee)}),this.close(!0),[2]}})})},se.prototype.render=function(){return _e(this,void 0,void 0,function(){var q;return ye(this,function(ee){switch(ee.label){case 0:return(q=new Xe).naturalSize=this.renderAtNaturalSize,q.imageType=this.renderImageType,q.imageQuality=this.renderImageQuality,q.width=this.renderWidth,q.height=this.renderHeight,this.unzoomFromCrop(),l.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,q.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return ee.sent(),[4,q.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,ee.sent()]}})})},se.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new X("toolbar",`
width: `+(this.displayMode==="inline"?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+`;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
height: `+this.toolbarHeight+`px;
box-sizing: content-box;
overflow: hidden;
line-height: 0px;
`)),this.toolbarStyleColorsClass=this.styles.addClass(new X("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new X("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var q=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new X("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*q)+`px;
height: `+(this.toolbarHeight-2*q)+`px;
padding: `+q+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new X("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new X("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new D("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new D("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new X("toolbar_dropdown",`
position: absolute;
max-width: `+4*this.toolbarHeight+`px;
z-index: 20;
white-space: normal;
box-sizing: content-box;
box-shadow: 3px 3px rgba(33, 33, 33, 0.1);
margin: `+(this.displayMode==="inline"?"0":this.popupMargin)+`px;
line-height: 0px;
`)),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new X("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new X("toolbar_straightener_block",`
display: flex;
overflow: hidden;
justify-content: center;
-webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);
`)),this.toolbarStraightenerStyleClass=this.styles.addClass(new X("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*q)+`px;
padding: `+q+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new X("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},se.instanceCounter=0,se}(),Qe=le("8hTe"),et=le.n(Qe),Ae=/<pre[^>]*>/g;function ut(se){var q=document.createElement("div");return q.innerHTML=se,q.childNodes.length===0?"":q.childNodes[0].nodeValue}var it=Ke.a=function(se){var q=se.value,ee=q===void 0?"":q,ae=se.edit,ue=ae===void 0?!1:ae,te=se.className,ne=se.showTextOnly,de=se.showLines,fe=se.replaces,ve=se.zoomImg,Ee=se.hasMask,Me=se.style,Ge=Me===void 0?{}:Me,nt=se.stylesPrev,at=nt===void 0?{}:nt,Tt=String(ee),ft=Object(R.useRef)(),dt=Object(R.useRef)(),Pt=Object(R.useState)(""),At=Object(G.a)(Pt,2),Ht=At[0],Bt=At[1],Lt=Object(R.useState)("office"),Sr=Object(G.a)(Lt,2),Dr=Sr[0],er=Sr[1],hr=function(){var Rt=new We(dt.current);Rt.displayMode="popup",Rt.addRenderEventListener(function(){var rr=Object(k.a)(B.a.mark(function St(Et){var Dt;return B.a.wrap(function(Xt){for(;;)switch(Xt.prev=Xt.next){case 0:return ft.current.style.display="none",Xt.next=3,Object(ke.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Et}});case 3:Dt=Xt.sent,Dt!=null&&Dt.id&&fe(dt.current.getAttribute("src").replace(ie.a.API_SERVER,""),"/api/attachments/".concat(Dt==null?void 0:Dt.id,"?type=").concat(Dt.content_type));case 5:case"end":return Xt.stop()}},St)}));return function(St){return rr.apply(this,arguments)}}()),Rt.show()},vr=function(){var Rt=new Se.a(dt.current);Rt.settings.displayMode="popup",Rt.addEventListener("render",function(){var rr=Object(k.a)(B.a.mark(function St(Et){var Dt;return B.a.wrap(function(Xt){for(;;)switch(Xt.prev=Xt.next){case 0:if(ft.current.style.display="none",!dt.current){Xt.next=6;break}return Xt.next=4,Object(ke.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Et.dataUrl}});case 4:Dt=Xt.sent,Dt!=null&&Dt.id&&fe(dt.current.getAttribute("src").replace(ie.a.API_SERVER,""),"/api/attachments/".concat(Dt==null?void 0:Dt.id,"?type=").concat(Dt.content_type));case 6:case"end":return Xt.stop()}},St)}));return function(St){return rr.apply(this,arguments)}}()),Rt.show(),window.markerArea=Rt},Vr=Object(R.useMemo)(function(){ft.current&&(ft.current.style.zIndex=-1);try{var Ze=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Rt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,rr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Tt=Tt.replace(Ze,"("+ie.a.API_SERVER+"/api/attachments/").replace(Rt,'"'+ie.a.API_SERVER+"/api/attachments/").replace(rr,'"'+ie.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(Cr){}var St=V(Tt),Et=b();if(Tt.match(/\[TOC\]/)&&(St=St.replace("<p>[TOC]</p>",f()),T()),St=St.replace(/(__special_katext_id_\d+__)/g,function(Cr,Xt){var Fe=Et[Xt],yt=Fe.type,Pr=Fe.expression;return Object(he.renderToString)(ut(Pr)||"",{displayMode:yt==="block",throwOnError:!1,output:"html"})}),St=St.replace(/▁/g,"\u2581\u2581\u2581"),v(),ne){var Dt=document.createElement("div");return Dt.innerHTML=St,Dt.innerText}return setTimeout(function(){return Or()},500),St},[Tt]),tr=Object(R.useRef)();y.WebkitLineClamp=de,de&&(Ge=Object(F.a)(Object(F.a)({},Ge),y));function Xr(Ze){var Rt=Ze.target;if(Rt.tagName.toUpperCase()==="IMG"){if(ve){var rr=Rt.getAttribute("src");Bt(rr),er("image")}}else if(Rt.tagName.toUpperCase()==="A"){var St=Rt.getAttribute("href");if(St.indexOf("office")>-1)Ze.preventDefault(),Bt(St),er("office");else if(St.indexOf("application/pdf")>-1)Ze.preventDefault(),Bt(St),er("pdf");else if(St.indexOf("text/html")>-1)Ze.preventDefault(),Bt(St),er("html");else if(St.startsWith("#")){Ze.preventDefault();var Et=document.getElementById(St.replace("#",""));Et&&Et.scrollIntoView(!0)}}}var Or=function(){var Rt,rr=(Rt=tr.current)===null||Rt===void 0?void 0:Rt.querySelectorAll("video");rr==null||rr.forEach(function(St){if(St.oncontextmenu=function(){return!1},St.src.indexOf(".m3u8")>-1&&!St.canPlayType("application/vnd.apple.mpegurl")){if($.a.isSupported()){var Et=new $.a;Et.loadSource(St.src),Et.attachMedia(St)}}})};Object(R.useEffect)(function(){if(tr.current&&Vr&&(Vr.match(Ae)&&window.PR.prettyPrint()),tr.current)return tr.current.addEventListener("click",Xr),function(){tr.current.removeEventListener("click",Xr),v(),T()}},[Vr,tr.current,Xr]);var Gt=function(Rt){if(!ue)return;Rt.target.nodeName==="IMG"?(ft.current.style.zIndex=1,ft.current.style.display="flex",ft.current.style.width=Rt.target.clientWidth+"px",ft.current.style.height=Rt.target.clientHeight+"px",ft.current.style.top=Rt.target.offsetTop+"px",ft.current.style.left=Rt.target.offsetLeft+"px",dt.current.src=Rt.target.getAttribute("src")):ft.current.style.display="none"};return x.a.createElement("div",{style:{position:"relative"}},x.a.createElement("div",{ref:tr,style:Object(F.a)({},Ge),className:"".concat(te||""," markdown-body ").concat(et.a.mdBody),onMouseOver:Gt,dangerouslySetInnerHTML:{__html:Vr}}),x.a.createElement("div",{ref:ft,className:et.a.button},x.a.createElement(J.a,null,x.a.createElement(Z.a,{onClick:function(){return hr()}},"\u88C1\u526A"),x.a.createElement(Z.a,{onClick:function(){return vr()}},"\u7F16\u8F91"))),x.a.createElement("img",{ref:dt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),x.a.createElement(me.a,{close:!0,data:Ht,type:Ht!=null&&Ht.length?Dr:"",style:Object(F.a)({},at),onClose:function(){return Bt("")}}))}},"9VGf":function(tt,Ke,le){"use strict";le.d(Ke,"a",function(){return O});var ce=le("q1tI"),J=le.n(ce);function O(Z,F){var k=Object(ce.useRef)();Object(ce.useEffect)(function(){k.current=Z}),Object(ce.useEffect)(function(){function G(){k.current()}if(F!==null){var H=setInterval(G,F);return function(){return clearInterval(H)}}},[F])}},Bd2K:function(tt,Ke,le){(function(ce){ce(le("VrN/"),le("osHv"))})(function(ce){ce.defineOption("autoCloseTags",!1,function(B,R,x){if(x!=ce.Init&&x&&B.removeKeyMap("autoCloseTags"),!R)return;var w={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(w["'/'"]=function(P){return k(P)}),(typeof R!="object"||R.whenOpening!==!1)&&(w["'>'"]=function(P){return Z(P)}),B.addKeyMap(w)});var J=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],O=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function Z(B){if(B.getOption("disableInput"))return ce.Pass;for(var R=B.listSelections(),x=[],w=B.getOption("autoCloseTags"),P=0;P<R.length;P++){if(!R[P].empty())return ce.Pass;var L=R[P].head,A=B.getTokenAt(L),_=ce.innerMode(B.getMode(),A.state),h=_.state,o=_.mode.xmlCurrentTag&&_.mode.xmlCurrentTag(h),s=o&&o.name;if(!s)return ce.Pass;var d=_.mode.configuration=="html",T=typeof w=="object"&&w.dontCloseTags||d&&J,y=typeof w=="object"&&w.indentTags||d&&O;A.end>L.ch&&(s=s.slice(0,s.length-A.end+L.ch));var m=s.toLowerCase();if(!s||A.type=="string"&&(A.end!=L.ch||!/[\"\']/.test(A.string.charAt(A.string.length-1))||A.string.length==1)||A.type=="tag"&&o.close||A.string.indexOf("/")==L.ch-A.start-1||T&&G(T,m)>-1||H(B,_.mode.xmlCurrentContext&&_.mode.xmlCurrentContext(h)||[],s,L,!0))return ce.Pass;var f=typeof w=="object"&&w.emptyTags;if(f&&G(f,s)>-1){x[P]={text:"/>",newPos:ce.Pos(L.line,L.ch+2)};continue}var E=y&&G(y,m)>-1;x[P]={indent:E,text:">"+(E?`
`:"")+"</"+s+">",newPos:E?ce.Pos(L.line+1,0):ce.Pos(L.line,L.ch+1)}}for(var p=typeof w=="object"&&w.dontIndentOnAutoClose,P=R.length-1;P>=0;P--){var g=x[P];B.replaceRange(g.text,R[P].head,R[P].anchor,"+insert");var u=B.listSelections().slice(0);u[P]={head:g.newPos,anchor:g.newPos},B.setSelections(u),!p&&g.indent&&(B.indentLine(g.newPos.line,null,!0),B.indentLine(g.newPos.line+1,null,!0))}}function F(B,R){for(var x=B.listSelections(),w=[],P=R?"/":"</",L=B.getOption("autoCloseTags"),A=typeof L=="object"&&L.dontIndentOnSlash,_=0;_<x.length;_++){if(!x[_].empty())return ce.Pass;var h=x[_].head,o=B.getTokenAt(h),s=ce.innerMode(B.getMode(),o.state),d=s.state;if(R&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=h.ch-1))return ce.Pass;var T,y=s.mode.name!="xml"&&B.getMode().name=="htmlmixed";if(y&&s.mode.name=="javascript")T=P+"script";else if(y&&s.mode.name=="css")T=P+"style";else{var m=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(d);if(!m||m.length&&H(B,m,m[m.length-1],h))return ce.Pass;T=P+m[m.length-1]}B.getLine(h.line).charAt(o.end)!=">"&&(T+=">"),w[_]=T}if(B.replaceSelections(w),x=B.listSelections(),!A)for(var _=0;_<x.length;_++)(_==x.length-1||x[_].head.line<x[_+1].head.line)&&B.indentLine(x[_].head.line)}function k(B){return B.getOption("disableInput")?ce.Pass:F(B,!0)}ce.commands.closeTag=function(B){return F(B)};function G(B,R){if(B.indexOf)return B.indexOf(R);for(var x=0,w=B.length;x<w;++x)if(B[x]==R)return x;return-1}function H(B,R,x,w,P){if(!ce.scanForClosingTag)return!1;var L=Math.min(B.lastLine()+1,w.line+500),A=ce.scanForClosingTag(B,w,null,L);if(!A||A.tag!=x)return!1;for(var _=P?1:0,h=R.length-1;h>=0&&R[h]==x;h--)++_;w=A.to;for(var h=1;h<_;h++){var o=ce.scanForClosingTag(B,w,null,L);if(!o||o.tag!=x)return!1;w=o.to}return!0}})},BdwD:function(tt,Ke,le){"use strict";var ce=le("+L6B"),J=le("2/Rp"),O=le("0Owb"),Z=le("k1fw"),F=le("q1tI"),k=le.n(F),G=le("FOrL"),H=le.n(G),B=function(x){var w=x.buttonProps,P=w===void 0?{}:w,L=x.styles,A=L===void 0?{}:L,_=x.imgStyles,h=_===void 0?{}:_,o=x.customText,s=x.ButtonText,d=x.ButtonClick,T=x.Buttonclass,y=x.ButtonTwo;return k.a.createElement("section",{className:"tc animated fadeIn",style:Object(Z.a)(Object(Z.a)({},{color:"#999",margin:"0 auto",padding:"100px 0"}),A)},k.a.createElement("img",{src:H.a,style:Object(Z.a)(Object(Z.a)({},{width:"200px",height:"150px"}),h)}),k.a.createElement("p",{className:"mt10 font14"},o||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),s&&k.a.createElement(J.a,Object(O.a)({className:T,onClick:d},P),s),y&&y)};Ke.a=B},BjJ7:function(tt,Ke,le){"use strict";le.d(Ke,"d",function(){return J}),le.d(Ke,"c",function(){return O}),le.d(Ke,"e",function(){return Z}),le.d(Ke,"b",function(){return F}),le.d(Ke,"a",function(){return G});var ce=le("m3rI");function J(H){var B=!0;if(H.length>0){for(var R=0;R<H.length;R++)if(H[R].compile_success==0||!H[R].compile_success){B=!1;break}}else B=!1;return B}function O(H){for(var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",R=[],x=0;x<H.length;x++){var w=H[x],P=B?"".concat(B,"/").concat(w.name):"".concat(w.name);R.push({title:w.name,isLeaf:!(w.type==="tree"),key:P})}return R}function Z(H,B,R){for(var x=0;x<H.length;x++){var w=H[x];if(w.key===B){w.children=R;break}w.children&&Z(w.children,B,R)}return H}function F(H,B,R){var x;return function(){var w=this,P=arguments,L=function(){x=null,R||H.apply(w,P)},A=R&&!x;clearTimeout(x),x=setTimeout(L,B),A&&H.apply(w,P)}}var k=!0,G=ce.a.API_SERVER},"C+DQ":function(tt,Ke,le){},DlQD:function(tt,Ke,le){(function(ce,J){tt.exports=J()})(this,function(){"use strict";function ce(ee,ae){for(var ue=0;ue<ae.length;ue++){var te=ae[ue];te.enumerable=te.enumerable||!1,te.configurable=!0,"value"in te&&(te.writable=!0),Object.defineProperty(ee,te.key,te)}}function J(ee,ae,ue){return ae&&ce(ee.prototype,ae),ue&&ce(ee,ue),ee}function O(ee,ae){if(!ee)return;if(typeof ee=="string")return Z(ee,ae);var ue=Object.prototype.toString.call(ee).slice(8,-1);if(ue==="Object"&&ee.constructor&&(ue=ee.constructor.name),ue==="Map"||ue==="Set")return Array.from(ee);if(ue==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ue))return Z(ee,ae)}function Z(ee,ae){(ae==null||ae>ee.length)&&(ae=ee.length);for(var ue=0,te=new Array(ae);ue<ae;ue++)te[ue]=ee[ue];return te}function F(ee,ae){var ue;if(typeof Symbol=="undefined"||ee[Symbol.iterator]==null){if(Array.isArray(ee)||(ue=O(ee))||ae&&ee&&typeof ee.length=="number"){ue&&(ee=ue);var te=0;return function(){return te>=ee.length?{done:!0}:{done:!1,value:ee[te++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return ue=ee[Symbol.iterator](),ue.next.bind(ue)}function k(ee,ae){return ae={exports:{}},ee(ae,ae.exports),ae.exports}var G=k(function(ee){function ae(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function ue(te){ee.exports.defaults=te}ee.exports={defaults:ae(),getDefaults:ae,changeDefaults:ue}}),H=G.defaults,B=G.getDefaults,R=G.changeDefaults,x=/[&<>"']/,w=/[&<>"']/g,P=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,A={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},_=function(ae){return A[ae]};function h(ee,ae){if(ae){if(x.test(ee))return ee.replace(w,_)}else if(P.test(ee))return ee.replace(L,_);return ee}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(ee){return ee.replace(o,function(ae,ue){return ue=ue.toLowerCase(),ue==="colon"?":":ue.charAt(0)==="#"?ue.charAt(1)==="x"?String.fromCharCode(parseInt(ue.substring(2),16)):String.fromCharCode(+ue.substring(1)):""})}var d=/(^|[^\[])\^/g;function T(ee,ae){ee=ee.source||ee,ae=ae||"";var ue={replace:function(ne,de){return de=de.source||de,de=de.replace(d,"$1"),ee=ee.replace(ne,de),ue},getRegex:function(){return new RegExp(ee,ae)}};return ue}var y=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function f(ee,ae,ue){if(ee){var te;try{te=decodeURIComponent(s(ue)).replace(y,"").toLowerCase()}catch(ne){return null}if(te.indexOf("javascript:")===0||te.indexOf("vbscript:")===0||te.indexOf("data:")===0)return null}ae&&!m.test(ue)&&(ue=a(ae,ue));try{ue=encodeURI(ue).replace(/%25/g,"%")}catch(ne){return null}return ue}var E={},p=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ee,ae){E[" "+ee]||(p.test(ee)?E[" "+ee]=ee+"/":E[" "+ee]=I(ee,"/",!0)),ee=E[" "+ee];var ue=ee.indexOf(":")===-1;return ae.substring(0,2)==="//"?ue?ae:ee.replace(g,"$1")+ae:ae.charAt(0)==="/"?ue?ae:ee.replace(u,"$1")+ae:ee+ae}var b={exec:function(){}};function v(ee){for(var ae=1,ue,te;ae<arguments.length;ae++){ue=arguments[ae];for(te in ue)Object.prototype.hasOwnProperty.call(ue,te)&&(ee[te]=ue[te])}return ee}function S(ee,ae){var ue=ee.replace(/\|/g,function(de,fe,ve){for(var Ee=!1,Me=fe;--Me>=0&&ve[Me]==="\\";)Ee=!Ee;return Ee?"|":" |"}),te=ue.split(/ \|/),ne=0;if(te.length>ae)te.splice(ae);else for(;te.length<ae;)te.push("");for(;ne<te.length;ne++)te[ne]=te[ne].trim().replace(/\\\|/g,"|");return te}function I(ee,ae,ue){var te=ee.length;if(te===0)return"";for(var ne=0;ne<te;){var de=ee.charAt(te-ne-1);if(de===ae&&!ue)ne++;else if(de!==ae&&ue)ne++;else break}return ee.substr(0,te-ne)}function j(ee,ae){if(ee.indexOf(ae[1])===-1)return-1;for(var ue=ee.length,te=0,ne=0;ne<ue;ne++)if(ee[ne]==="\\")ne++;else if(ee[ne]===ae[0])te++;else if(ee[ne]===ae[1]&&(te--,te<0))return ne;return-1}function z(ee){ee&&ee.sanitize&&!ee.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var V={escape:h,unescape:s,edit:T,cleanUrl:f,resolveUrl:a,noopTest:b,merge:v,splitCells:S,rtrim:I,findClosingBracket:j,checkSanitizeDeprecation:z},M=G.defaults,N=V.rtrim,$=V.splitCells,ie=V.escape,he=V.findClosingBracket;function me(ee,ae,ue){var te=ae.href,ne=ae.title?ie(ae.title):null,de=ee[1].replace(/\\([\[\]])/g,"$1");return ee[0].charAt(0)!=="!"?{type:"link",raw:ue,href:te,title:ne,text:de}:{type:"image",raw:ue,href:te,title:ne,text:ie(de)}}function ke(ee,ae){var ue=ee.match(/^(\s+)(?:```)/);if(ue===null)return ae;var te=ue[1];return ae.split(`
`).map(function(ne){var de=ne.match(/^\s+/);if(de===null)return ne;var fe=de[0];return fe.length>=te.length?ne.slice(te.length):ne}).join(`
`)}var Se=function(){function ee(ue){this.options=ue||M}var ae=ee.prototype;return ae.space=function(te){var ne=this.rules.block.newline.exec(te);if(ne)return ne[0].length>1?{type:"space",raw:ne[0]}:{raw:`
`}},ae.code=function(te,ne){var de=this.rules.block.code.exec(te);if(de){var fe=ne[ne.length-1];if(fe&&fe.type==="paragraph")return{raw:de[0],text:de[0].trimRight()};var ve=de[0].replace(/^ {4}/gm,"");return{type:"code",raw:de[0],codeBlockStyle:"indented",text:this.options.pedantic?ve:N(ve,`
`)}}},ae.fences=function(te){var ne=this.rules.block.fences.exec(te);if(ne){var de=ne[0],fe=ke(de,ne[3]||"");return{type:"code",raw:de,lang:ne[2]?ne[2].trim():ne[2],text:fe}}},ae.heading=function(te){var ne=this.rules.block.heading.exec(te);if(ne)return{type:"heading",raw:ne[0],depth:ne[1].length,text:ne[2]}},ae.nptable=function(te){var ne=this.rules.block.nptable.exec(te);if(ne){var de={type:"table",header:$(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
`):[],raw:ne[0]};if(de.header.length===de.align.length){var fe=de.align.length,ve;for(ve=0;ve<fe;ve++)/^ *-+: *$/.test(de.align[ve])?de.align[ve]="right":/^ *:-+: *$/.test(de.align[ve])?de.align[ve]="center":/^ *:-+ *$/.test(de.align[ve])?de.align[ve]="left":de.align[ve]=null;for(fe=de.cells.length,ve=0;ve<fe;ve++)de.cells[ve]=$(de.cells[ve],de.header.length);return de}}},ae.hr=function(te){var ne=this.rules.block.hr.exec(te);if(ne)return{type:"hr",raw:ne[0]}},ae.blockquote=function(te){var ne=this.rules.block.blockquote.exec(te);if(ne){var de=ne[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ne[0],text:de}}},ae.list=function(te){var ne=this.rules.block.list.exec(te);if(ne){for(var de=ne[0],fe=ne[2],ve=fe.length>1,Ee=fe[fe.length-1]===")",Me={type:"list",raw:de,ordered:ve,start:ve?+fe.slice(0,-1):"",loose:!1,items:[]},Ge=ne[0].match(this.rules.block.item),nt=!1,at,Tt,ft,dt,Pt,At,Ht,Bt=Ge.length,Lt=0;Lt<Bt;Lt++)at=Ge[Lt],de=at,Tt=at.length,at=at.replace(/^ *([*+-]|\d+[.)]) */,""),~at.indexOf(`
`)&&(Tt-=at.length,at=this.options.pedantic?at.replace(/^ {1,4}/gm,""):at.replace(new RegExp("^ {1,"+Tt+"}","gm"),"")),Lt!==Bt-1&&(ft=this.rules.block.bullet.exec(Ge[Lt+1])[0],(ve?ft.length===1||!Ee&&ft[ft.length-1]===")":ft.length>1||this.options.smartLists&&ft!==fe)&&(dt=Ge.slice(Lt+1).join(`
`),Me.raw=Me.raw.substring(0,Me.raw.length-dt.length),Lt=Bt-1)),Pt=nt||/\n\n(?!\s*$)/.test(at),Lt!==Bt-1&&(nt=at.charAt(at.length-1)===`
`,Pt||(Pt=nt)),Pt&&(Me.loose=!0),At=/^\[[ xX]\] /.test(at),Ht=void 0,At&&(Ht=at[1]!==" ",at=at.replace(/^\[[ xX]\] +/,"")),Me.items.push({type:"list_item",raw:de,task:At,checked:Ht,loose:Pt,text:at});return Me}},ae.html=function(te){var ne=this.rules.block.html.exec(te);if(ne)return{type:this.options.sanitize?"paragraph":"html",raw:ne[0],pre:!this.options.sanitizer&&(ne[1]==="pre"||ne[1]==="script"||ne[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ne[0]):ie(ne[0]):ne[0]}},ae.def=function(te){var ne=this.rules.block.def.exec(te);if(ne){ne[3]&&(ne[3]=ne[3].substring(1,ne[3].length-1));var de=ne[1].toLowerCase().replace(/\s+/g," ");return{tag:de,raw:ne[0],href:ne[2],title:ne[3]}}},ae.table=function(te){var ne=this.rules.block.table.exec(te);if(ne){var de={type:"table",header:$(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
`):[]};if(de.header.length===de.align.length){de.raw=ne[0];var fe=de.align.length,ve;for(ve=0;ve<fe;ve++)/^ *-+: *$/.test(de.align[ve])?de.align[ve]="right":/^ *:-+: *$/.test(de.align[ve])?de.align[ve]="center":/^ *:-+ *$/.test(de.align[ve])?de.align[ve]="left":de.align[ve]=null;for(fe=de.cells.length,ve=0;ve<fe;ve++)de.cells[ve]=$(de.cells[ve].replace(/^ *\| *| *\| *$/g,""),de.header.length);return de}}},ae.lheading=function(te){var ne=this.rules.block.lheading.exec(te);if(ne)return{type:"heading",raw:ne[0],depth:ne[2].charAt(0)==="="?1:2,text:ne[1]}},ae.paragraph=function(te){var ne=this.rules.block.paragraph.exec(te);if(ne)return{type:"paragraph",raw:ne[0],text:ne[1].charAt(ne[1].length-1)===`
`?ne[1].slice(0,-1):ne[1]}},ae.text=function(te,ne){var de=this.rules.block.text.exec(te);if(de){var fe=ne[ne.length-1];return fe&&fe.type==="text"?{raw:de[0],text:de[0]}:{type:"text",raw:de[0],text:de[0]}}},ae.escape=function(te){var ne=this.rules.inline.escape.exec(te);if(ne)return{type:"escape",raw:ne[0],text:ie(ne[1])}},ae.tag=function(te,ne,de){var fe=this.rules.inline.tag.exec(te);if(fe)return!ne&&/^<a /i.test(fe[0])?ne=!0:ne&&/^<\/a>/i.test(fe[0])&&(ne=!1),!de&&/^<(pre|code|kbd|script)(\s|>)/i.test(fe[0])?de=!0:de&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(fe[0])&&(de=!1),{type:this.options.sanitize?"text":"html",raw:fe[0],inLink:ne,inRawBlock:de,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(fe[0]):ie(fe[0]):fe[0]}},ae.link=function(te){var ne=this.rules.inline.link.exec(te);if(ne){var de=he(ne[2],"()");if(de>-1){var fe=ne[0].indexOf("!")===0?5:4,ve=fe+ne[1].length+de;ne[2]=ne[2].substring(0,de),ne[0]=ne[0].substring(0,ve).trim(),ne[3]=""}var Ee=ne[2],Me="";if(this.options.pedantic){var Ge=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ee);Ge?(Ee=Ge[1],Me=Ge[3]):Me=""}else Me=ne[3]?ne[3].slice(1,-1):"";Ee=Ee.trim().replace(/^<([\s\S]*)>$/,"$1");var nt=me(ne,{href:Ee&&Ee.replace(this.rules.inline._escapes,"$1"),title:Me&&Me.replace(this.rules.inline._escapes,"$1")},ne[0]);return nt}},ae.reflink=function(te,ne){var de;if((de=this.rules.inline.reflink.exec(te))||(de=this.rules.inline.nolink.exec(te))){var fe=(de[2]||de[1]).replace(/\s+/g," ");if(fe=ne[fe.toLowerCase()],!fe||!fe.href){var ve=de[0].charAt(0);return{type:"text",raw:ve,text:ve}}var Ee=me(de,fe,de[0]);return Ee}},ae.strong=function(te,ne,de){de===void 0&&(de="");var fe=this.rules.inline.strong.start.exec(te);if(fe&&(!fe[1]||fe[1]&&(de===""||this.rules.inline.punctuation.exec(de)))){ne=ne.slice(-1*te.length);var ve=fe[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ve.lastIndex=0;for(var Ee;(fe=ve.exec(ne))!=null;)if(Ee=this.rules.inline.strong.middle.exec(ne.slice(0,fe.index+3)),Ee)return{type:"strong",raw:te.slice(0,Ee[0].length),text:te.slice(2,Ee[0].length-2)}}},ae.em=function(te,ne,de){de===void 0&&(de="");var fe=this.rules.inline.em.start.exec(te);if(fe&&(!fe[1]||fe[1]&&(de===""||this.rules.inline.punctuation.exec(de)))){ne=ne.slice(-1*te.length);var ve=fe[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ve.lastIndex=0;for(var Ee;(fe=ve.exec(ne))!=null;)if(Ee=this.rules.inline.em.middle.exec(ne.slice(0,fe.index+2)),Ee)return{type:"em",raw:te.slice(0,Ee[0].length),text:te.slice(1,Ee[0].length-1)}}},ae.codespan=function(te){var ne=this.rules.inline.code.exec(te);if(ne){var de=ne[2].replace(/\n/g," "),fe=/[^ ]/.test(de),ve=de.startsWith(" ")&&de.endsWith(" ");return fe&&ve&&(de=de.substring(1,de.length-1)),de=ie(de,!0),{type:"codespan",raw:ne[0],text:de}}},ae.br=function(te){var ne=this.rules.inline.br.exec(te);if(ne)return{type:"br",raw:ne[0]}},ae.del=function(te){var ne=this.rules.inline.del.exec(te);if(ne)return{type:"del",raw:ne[0],text:ne[1]}},ae.autolink=function(te,ne){var de=this.rules.inline.autolink.exec(te);if(de){var fe,ve;return de[2]==="@"?(fe=ie(this.options.mangle?ne(de[1]):de[1]),ve="mailto:"+fe):(fe=ie(de[1]),ve=fe),{type:"link",raw:de[0],text:fe,href:ve,tokens:[{type:"text",raw:fe,text:fe}]}}},ae.url=function(te,ne){var de;if(de=this.rules.inline.url.exec(te)){var fe,ve;if(de[2]==="@")fe=ie(this.options.mangle?ne(de[0]):de[0]),ve="mailto:"+fe;else{var Ee;do Ee=de[0],de[0]=this.rules.inline._backpedal.exec(de[0])[0];while(Ee!==de[0]);fe=ie(de[0]),de[1]==="www."?ve="http://"+fe:ve=fe}return{type:"link",raw:de[0],text:fe,href:ve,tokens:[{type:"text",raw:fe,text:fe}]}}},ae.inlineText=function(te,ne,de){var fe=this.rules.inline.text.exec(te);if(fe){var ve;return ne?ve=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(fe[0]):ie(fe[0]):fe[0]:ve=ie(this.options.smartypants?de(fe[0]):fe[0]),{type:"text",raw:fe[0],text:ve}}},ee}(),Re=V.noopTest,Te=V.edit,_e=V.merge,ye={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:Re,table:Re,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ye._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ye._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ye.def=Te(ye.def).replace("label",ye._label).replace("title",ye._title).getRegex(),ye.bullet=/(?:[*+-]|\d{1,9}[.)])/,ye.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ye.item=Te(ye.item,"gm").replace(/bull/g,ye.bullet).getRegex(),ye.list=Te(ye.list).replace(/bull/g,ye.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ye.def.source+")").getRegex(),ye._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",ye._comment=/<!--(?!-?>)[\s\S]*?-->/,ye.html=Te(ye.html,"i").replace("comment",ye._comment).replace("tag",ye._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ye.paragraph=Te(ye._paragraph).replace("hr",ye.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ye._tag).getRegex(),ye.blockquote=Te(ye.blockquote).replace("paragraph",ye.paragraph).getRegex(),ye.normal=_e({},ye),ye.gfm=_e({},ye.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*|$)"}),ye.gfm.nptable=Te(ye.gfm.nptable).replace("hr",ye.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ye._tag).getRegex(),ye.gfm.table=Te(ye.gfm.table).replace("hr",ye.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ye._tag).getRegex(),ye.pedantic=_e({},ye.normal,{html:Te(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ye._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:Re,paragraph:Te(ye.normal._paragraph).replace("hr",ye.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ye.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var K={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Re,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Re,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};K._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",K.punctuation=Te(K.punctuation).replace(/punctuation/g,K._punctuation).getRegex(),K._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",K._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",K.em.start=Te(K.em.start).replace(/punctuation/g,K._punctuation).getRegex(),K.em.middle=Te(K.em.middle).replace(/punctuation/g,K._punctuation).replace(/overlapSkip/g,K._overlapSkip).getRegex(),K.em.endAst=Te(K.em.endAst,"g").replace(/punctuation/g,K._punctuation).getRegex(),K.em.endUnd=Te(K.em.endUnd,"g").replace(/punctuation/g,K._punctuation).getRegex(),K.strong.start=Te(K.strong.start).replace(/punctuation/g,K._punctuation).getRegex(),K.strong.middle=Te(K.strong.middle).replace(/punctuation/g,K._punctuation).replace(/blockSkip/g,K._blockSkip).getRegex(),K.strong.endAst=Te(K.strong.endAst,"g").replace(/punctuation/g,K._punctuation).getRegex(),K.strong.endUnd=Te(K.strong.endUnd,"g").replace(/punctuation/g,K._punctuation).getRegex(),K.blockSkip=Te(K._blockSkip,"g").getRegex(),K.overlapSkip=Te(K._overlapSkip,"g").getRegex(),K._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,K._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,K._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])?)+(?![-_])/,K.autolink=Te(K.autolink).replace("scheme",K._scheme).replace("email",K._email).getRegex(),K._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,K.tag=Te(K.tag).replace("comment",ye._comment).replace("attribute",K._attribute).getRegex(),K._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,K._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,K._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,K.link=Te(K.link).replace("label",K._label).replace("href",K._href).replace("title",K._title).getRegex(),K.reflink=Te(K.reflink).replace("label",K._label).getRegex(),K.reflinkSearch=Te(K.reflinkSearch,"g").replace("reflink",K.reflink).replace("nolink",K.nolink).getRegex(),K.normal=_e({},K),K.pedantic=_e({},K.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:Te(/^!?\[(label)\]\((.*?)\)/).replace("label",K._label).getRegex(),reflink:Te(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",K._label).getRegex()}),K.gfm=_e({},K.normal,{escape:Te(K.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),K.gfm.url=Te(K.gfm.url,"i").replace("email",K.gfm._extended_email).getRegex(),K.breaks=_e({},K.gfm,{br:Te(K.br).replace("{2,}","*").getRegex(),text:Te(K.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var l={block:ye,inline:K},c=G.defaults,D=l.block,X=l.inline;function U(ee){return ee.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function oe(ee){var ae="",ue,te,ne=ee.length;for(ue=0;ue<ne;ue++)te=ee.charCodeAt(ue),Math.random()>.5&&(te="x"+te.toString(16)),ae+="&#"+te+";";return ae}var be=function(){function ee(ue){this.tokens=[],this.tokens.links=Object.create(null),this.options=ue||c,this.options.tokenizer=this.options.tokenizer||new Se,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var te={block:D.normal,inline:X.normal};this.options.pedantic?(te.block=D.pedantic,te.inline=X.pedantic):this.options.gfm&&(te.block=D.gfm,this.options.breaks?te.inline=X.breaks:te.inline=X.gfm),this.tokenizer.rules=te}ee.lex=function(te,ne){var de=new ee(ne);return de.lex(te)};var ae=ee.prototype;return ae.lex=function(te){return te=te.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(te,this.tokens,!0),this.inline(this.tokens),this.tokens},ae.blockTokens=function(te,ne,de){ne===void 0&&(ne=[]),de===void 0&&(de=!0),te=te.replace(/^ +$/gm,"");for(var fe,ve,Ee,Me;te;){if(fe=this.tokenizer.space(te)){te=te.substring(fe.raw.length),fe.type&&ne.push(fe);continue}if(fe=this.tokenizer.code(te,ne)){te=te.substring(fe.raw.length),fe.type?ne.push(fe):(Me=ne[ne.length-1],Me.raw+=`
`+fe.raw,Me.text+=`
`+fe.text);continue}if(fe=this.tokenizer.fences(te)){te=te.substring(fe.raw.length),ne.push(fe);continue}if(fe=this.tokenizer.heading(te)){te=te.substring(fe.raw.length),ne.push(fe);continue}if(fe=this.tokenizer.nptable(te)){te=te.substring(fe.raw.length),ne.push(fe);continue}if(fe=this.tokenizer.hr(te)){te=te.substring(fe.raw.length),ne.push(fe);continue}if(fe=this.tokenizer.blockquote(te)){te=te.substring(fe.raw.length),fe.tokens=this.blockTokens(fe.text,[],de),ne.push(fe);continue}if(fe=this.tokenizer.list(te)){for(te=te.substring(fe.raw.length),Ee=fe.items.length,ve=0;ve<Ee;ve++)fe.items[ve].tokens=this.blockTokens(fe.items[ve].text,[],!1);ne.push(fe);continue}if(fe=this.tokenizer.html(te)){te=te.substring(fe.raw.length),ne.push(fe);continue}if(de&&(fe=this.tokenizer.def(te))){te=te.substring(fe.raw.length),this.tokens.links[fe.tag]||(this.tokens.links[fe.tag]={href:fe.href,title:fe.title});continue}if(fe=this.tokenizer.table(te)){te=te.substring(fe.raw.length),ne.push(fe);continue}if(fe=this.tokenizer.lheading(te)){te=te.substring(fe.raw.length),ne.push(fe);continue}if(de&&(fe=this.tokenizer.paragraph(te))){te=te.substring(fe.raw.length),ne.push(fe);continue}if(fe=this.tokenizer.text(te,ne)){te=te.substring(fe.raw.length),fe.type?ne.push(fe):(Me=ne[ne.length-1],Me.raw+=`
`+fe.raw,Me.text+=`
`+fe.text);continue}if(te){var Ge="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(Ge);break}else throw new Error(Ge)}}return ne},ae.inline=function(te){var ne,de,fe,ve,Ee,Me,Ge=te.length;for(ne=0;ne<Ge;ne++){Me=te[ne];switch(Me.type){case"paragraph":case"text":case"heading":{Me.tokens=[],this.inlineTokens(Me.text,Me.tokens);break}case"table":{for(Me.tokens={header:[],cells:[]},ve=Me.header.length,de=0;de<ve;de++)Me.tokens.header[de]=[],this.inlineTokens(Me.header[de],Me.tokens.header[de]);for(ve=Me.cells.length,de=0;de<ve;de++)for(Ee=Me.cells[de],Me.tokens.cells[de]=[],fe=0;fe<Ee.length;fe++)Me.tokens.cells[de][fe]=[],this.inlineTokens(Ee[fe],Me.tokens.cells[de][fe]);break}case"blockquote":{this.inline(Me.tokens);break}case"list":{for(ve=Me.items.length,de=0;de<ve;de++)this.inline(Me.items[de].tokens);break}}}return te},ae.inlineTokens=function(te,ne,de,fe,ve){ne===void 0&&(ne=[]),de===void 0&&(de=!1),fe===void 0&&(fe=!1),ve===void 0&&(ve="");var Ee,Me=te,Ge;if(this.tokens.links){var nt=Object.keys(this.tokens.links);if(nt.length>0)for(;(Ge=this.tokenizer.rules.inline.reflinkSearch.exec(Me))!=null;)nt.includes(Ge[0].slice(Ge[0].lastIndexOf("[")+1,-1))&&(Me=Me.slice(0,Ge.index)+"["+"a".repeat(Ge[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ge=this.tokenizer.rules.inline.blockSkip.exec(Me))!=null;)Me=Me.slice(0,Ge.index)+"["+"a".repeat(Ge[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;te;){if(Ee=this.tokenizer.escape(te)){te=te.substring(Ee.raw.length),ne.push(Ee);continue}if(Ee=this.tokenizer.tag(te,de,fe)){te=te.substring(Ee.raw.length),de=Ee.inLink,fe=Ee.inRawBlock,ne.push(Ee);continue}if(Ee=this.tokenizer.link(te)){te=te.substring(Ee.raw.length),Ee.type==="link"&&(Ee.tokens=this.inlineTokens(Ee.text,[],!0,fe)),ne.push(Ee);continue}if(Ee=this.tokenizer.reflink(te,this.tokens.links)){te=te.substring(Ee.raw.length),Ee.type==="link"&&(Ee.tokens=this.inlineTokens(Ee.text,[],!0,fe)),ne.push(Ee);continue}if(Ee=this.tokenizer.strong(te,Me,ve)){te=te.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],de,fe),ne.push(Ee);continue}if(Ee=this.tokenizer.em(te,Me,ve)){te=te.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],de,fe),ne.push(Ee);continue}if(Ee=this.tokenizer.codespan(te)){te=te.substring(Ee.raw.length),ne.push(Ee);continue}if(Ee=this.tokenizer.br(te)){te=te.substring(Ee.raw.length),ne.push(Ee);continue}if(Ee=this.tokenizer.del(te)){te=te.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],de,fe),ne.push(Ee);continue}if(Ee=this.tokenizer.autolink(te,oe)){te=te.substring(Ee.raw.length),ne.push(Ee);continue}if(!de&&(Ee=this.tokenizer.url(te,oe))){te=te.substring(Ee.raw.length),ne.push(Ee);continue}if(Ee=this.tokenizer.inlineText(te,fe,U)){te=te.substring(Ee.raw.length),ve=Ee.raw.slice(-1),ne.push(Ee);continue}if(te){var at="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(at);break}else throw new Error(at)}}return ne},J(ee,null,[{key:"rules",get:function(){return{block:D,inline:X}}}]),ee}(),xe=G.defaults,Pe=V.cleanUrl,De=V.escape,Oe=function(){function ee(ue){this.options=ue||xe}var ae=ee.prototype;return ae.code=function(te,ne,de){var fe=(ne||"").match(/\S*/)[0];if(this.options.highlight){var ve=this.options.highlight(te,fe);ve!=null&&ve!==te&&(de=!0,te=ve)}return fe?'<pre><code class="'+this.options.langPrefix+De(fe,!0)+'">'+(de?te:De(te,!0))+`</code></pre>
`:"<pre><code>"+(de?te:De(te,!0))+`</code></pre>
`},ae.blockquote=function(te){return`<blockquote>
`+te+`</blockquote>
`},ae.html=function(te){return te},ae.heading=function(te,ne,de,fe){return this.options.headerIds?"<h"+ne+' id="'+this.options.headerPrefix+fe.slug(de)+'">'+te+"</h"+ne+`>
`:"<h"+ne+">"+te+"</h"+ne+`>
`},ae.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ae.list=function(te,ne,de){var fe=ne?"ol":"ul",ve=ne&&de!==1?' start="'+de+'"':"";return"<"+fe+ve+`>
`+te+"</"+fe+`>
`},ae.listitem=function(te){return"<li>"+te+`</li>
`},ae.checkbox=function(te){return"<input "+(te?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ae.paragraph=function(te){return"<p>"+te+`</p>
`},ae.table=function(te,ne){return ne&&(ne="<tbody>"+ne+"</tbody>"),`<table>
<thead>
`+te+`</thead>
`+ne+`</table>
`},ae.tablerow=function(te){return`<tr>
`+te+`</tr>
`},ae.tablecell=function(te,ne){var de=ne.header?"th":"td",fe=ne.align?"<"+de+' align="'+ne.align+'">':"<"+de+">";return fe+te+"</"+de+`>
`},ae.strong=function(te){return"<strong>"+te+"</strong>"},ae.em=function(te){return"<em>"+te+"</em>"},ae.codespan=function(te){return"<code>"+te+"</code>"},ae.br=function(){return this.options.xhtml?"<br/>":"<br>"},ae.del=function(te){return"<del>"+te+"</del>"},ae.link=function(te,ne,de){if(te=Pe(this.options.sanitize,this.options.baseUrl,te),te===null)return de;var fe='<a href="'+De(te)+'"';return ne&&(fe+=' title="'+ne+'"'),fe+=">"+de+"</a>",fe},ae.image=function(te,ne,de){if(te=Pe(this.options.sanitize,this.options.baseUrl,te),te===null)return de;var fe='<img src="'+te+'" alt="'+de+'"';return ne&&(fe+=' title="'+ne+'"'),fe+=this.options.xhtml?"/>":">",fe},ae.text=function(te){return te},ee}(),Ie=function(){function ee(){}var ae=ee.prototype;return ae.strong=function(te){return te},ae.em=function(te){return te},ae.codespan=function(te){return te},ae.del=function(te){return te},ae.html=function(te){return te},ae.text=function(te){return te},ae.link=function(te,ne,de){return""+de},ae.image=function(te,ne,de){return""+de},ae.br=function(){return""},ee}(),He=function(){function ee(){this.seen={}}var ae=ee.prototype;return ae.slug=function(te){var ne=te.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ne)){var de=ne;do this.seen[de]++,ne=de+"-"+this.seen[de];while(this.seen.hasOwnProperty(ne))}return this.seen[ne]=0,ne},ee}(),Ve=G.defaults,Je=V.unescape,Xe=function(){function ee(ue){this.options=ue||Ve,this.options.renderer=this.options.renderer||new Oe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ie,this.slugger=new He}ee.parse=function(te,ne){var de=new ee(ne);return de.parse(te)};var ae=ee.prototype;return ae.parse=function(te,ne){ne===void 0&&(ne=!0);var de="",fe,ve,Ee,Me,Ge,nt,at,Tt,ft,dt,Pt,At,Ht,Bt,Lt,Sr,Dr,er,hr=te.length;for(fe=0;fe<hr;fe++){dt=te[fe];switch(dt.type){case"space":continue;case"hr":{de+=this.renderer.hr();continue}case"heading":{de+=this.renderer.heading(this.parseInline(dt.tokens),dt.depth,Je(this.parseInline(dt.tokens,this.textRenderer)),this.slugger);continue}case"code":{de+=this.renderer.code(dt.text,dt.lang,dt.escaped);continue}case"table":{for(Tt="",at="",Me=dt.header.length,ve=0;ve<Me;ve++)at+=this.renderer.tablecell(this.parseInline(dt.tokens.header[ve]),{header:!0,align:dt.align[ve]});for(Tt+=this.renderer.tablerow(at),ft="",Me=dt.cells.length,ve=0;ve<Me;ve++){for(nt=dt.tokens.cells[ve],at="",Ge=nt.length,Ee=0;Ee<Ge;Ee++)at+=this.renderer.tablecell(this.parseInline(nt[Ee]),{header:!1,align:dt.align[Ee]});ft+=this.renderer.tablerow(at)}de+=this.renderer.table(Tt,ft);continue}case"blockquote":{ft=this.parse(dt.tokens),de+=this.renderer.blockquote(ft);continue}case"list":{for(Pt=dt.ordered,At=dt.start,Ht=dt.loose,Me=dt.items.length,ft="",ve=0;ve<Me;ve++)Lt=dt.items[ve],Sr=Lt.checked,Dr=Lt.task,Bt="",Lt.task&&(er=this.renderer.checkbox(Sr),Ht?Lt.tokens.length>0&&Lt.tokens[0].type==="text"?(Lt.tokens[0].text=er+" "+Lt.tokens[0].text,Lt.tokens[0].tokens&&Lt.tokens[0].tokens.length>0&&Lt.tokens[0].tokens[0].type==="text"&&(Lt.tokens[0].tokens[0].text=er+" "+Lt.tokens[0].tokens[0].text)):Lt.tokens.unshift({type:"text",text:er}):Bt+=er),Bt+=this.parse(Lt.tokens,Ht),ft+=this.renderer.listitem(Bt,Dr,Sr);de+=this.renderer.list(ft,Pt,At);continue}case"html":{de+=this.renderer.html(dt.text);continue}case"paragraph":{de+=this.renderer.paragraph(this.parseInline(dt.tokens));continue}case"text":{for(ft=dt.tokens?this.parseInline(dt.tokens):dt.text;fe+1<hr&&te[fe+1].type==="text";)dt=te[++fe],ft+=`
`+(dt.tokens?this.parseInline(dt.tokens):dt.text);de+=ne?this.renderer.paragraph(ft):ft;continue}default:{var vr='Token with "'+dt.type+'" type was not found.';if(this.options.silent){console.error(vr);return}else throw new Error(vr)}}}return de},ae.parseInline=function(te,ne){ne=ne||this.renderer;var de="",fe,ve,Ee=te.length;for(fe=0;fe<Ee;fe++){ve=te[fe];switch(ve.type){case"escape":{de+=ne.text(ve.text);break}case"html":{de+=ne.html(ve.text);break}case"link":{de+=ne.link(ve.href,ve.title,this.parseInline(ve.tokens,ne));break}case"image":{de+=ne.image(ve.href,ve.title,ve.text);break}case"strong":{de+=ne.strong(this.parseInline(ve.tokens,ne));break}case"em":{de+=ne.em(this.parseInline(ve.tokens,ne));break}case"codespan":{de+=ne.codespan(ve.text);break}case"br":{de+=ne.br();break}case"del":{de+=ne.del(this.parseInline(ve.tokens,ne));break}case"text":{de+=ne.text(ve.text);break}default:{var Me='Token with "'+ve.type+'" type was not found.';if(this.options.silent){console.error(Me);return}else throw new Error(Me)}}}return de},ee}(),We=V.merge,Qe=V.checkSanitizeDeprecation,et=V.escape,Ae=G.getDefaults,ut=G.changeDefaults,it=G.defaults;function se(ee,ae,ue){if(typeof ee=="undefined"||ee===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ee!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ee)+", string expected");if(typeof ae=="function"&&(ue=ae,ae=null),ae=We({},se.defaults,ae||{}),Qe(ae),ue){var te=ae.highlight,ne;try{ne=be.lex(ee,ae)}catch(Ee){return ue(Ee)}var de=function(Me){var Ge;if(!Me)try{Ge=Xe.parse(ne,ae)}catch(nt){Me=nt}return ae.highlight=te,Me?ue(Me):ue(null,Ge)};if(!te||te.length<3)return de();if(delete ae.highlight,!ne.length)return de();var fe=0;se.walkTokens(ne,function(Ee){Ee.type==="code"&&(fe++,setTimeout(function(){te(Ee.text,Ee.lang,function(Me,Ge){if(Me)return de(Me);Ge!=null&&Ge!==Ee.text&&(Ee.text=Ge,Ee.escaped=!0),fe--,fe===0&&de()})},0))}),fe===0&&de();return}try{var ve=be.lex(ee,ae);return ae.walkTokens&&se.walkTokens(ve,ae.walkTokens),Xe.parse(ve,ae)}catch(Ee){if(Ee.message+=`
Please report this to https://github.com/markedjs/marked.`,ae.silent)return"<p>An error occurred:</p><pre>"+et(Ee.message+"",!0)+"</pre>";throw Ee}}se.options=se.setOptions=function(ee){return We(se.defaults,ee),ut(se.defaults),se},se.getDefaults=Ae,se.defaults=it,se.use=function(ee){var ae=We({},ee);if(ee.renderer&&function(){var te=se.defaults.renderer||new Oe,ne=function(ve){var Ee=te[ve];te[ve]=function(){for(var Me=arguments.length,Ge=new Array(Me),nt=0;nt<Me;nt++)Ge[nt]=arguments[nt];var at=ee.renderer[ve].apply(te,Ge);return at===!1&&(at=Ee.apply(te,Ge)),at}};for(var de in ee.renderer)ne(de);ae.renderer=te}(),ee.tokenizer&&function(){var te=se.defaults.tokenizer||new Se,ne=function(ve){var Ee=te[ve];te[ve]=function(){for(var Me=arguments.length,Ge=new Array(Me),nt=0;nt<Me;nt++)Ge[nt]=arguments[nt];var at=ee.tokenizer[ve].apply(te,Ge);return at===!1&&(at=Ee.apply(te,Ge)),at}};for(var de in ee.tokenizer)ne(de);ae.tokenizer=te}(),ee.walkTokens){var ue=se.defaults.walkTokens;ae.walkTokens=function(te){ee.walkTokens(te),ue&&ue(te)}}se.setOptions(ae)},se.walkTokens=function(ee,ae){for(var ue=F(ee),te;!(te=ue()).done;){var ne=te.value;ae(ne);switch(ne.type){case"table":{for(var de=F(ne.tokens.header),fe;!(fe=de()).done;){var ve=fe.value;se.walkTokens(ve,ae)}for(var Ee=F(ne.tokens.cells),Me;!(Me=Ee()).done;)for(var Ge=Me.value,nt=F(Ge),at;!(at=nt()).done;){var Tt=at.value;se.walkTokens(Tt,ae)}break}case"list":{se.walkTokens(ne.items,ae);break}default:ne.tokens&&se.walkTokens(ne.tokens,ae)}}},se.Parser=Xe,se.parser=Xe.parse,se.Renderer=Oe,se.TextRenderer=Ie,se.Lexer=be,se.lexer=be.lex,se.Tokenizer=Se,se.Slugger=He,se.parse=se;var q=se;return q})},ELLl:function(tt,Ke,le){(function(ce){ce(le("VrN/"))})(function(ce){var J={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},O=ce.Pos;ce.defineOption("autoCloseBrackets",!1,function(A,_,h){h&&h!=ce.Init&&(A.removeKeyMap(F),A.state.closeBrackets=null),_&&(k(Z(_,"pairs")),A.state.closeBrackets=_,A.addKeyMap(F))});function Z(A,_){return _=="pairs"&&typeof A=="string"?A:typeof A=="object"&&A[_]!=null?A[_]:J[_]}var F={Backspace:B,Enter:R};function k(A){for(var _=0;_<A.length;_++){var h=A.charAt(_),o="'"+h+"'";F[o]||(F[o]=G(h))}}k(J.pairs+"`");function G(A){return function(_){return w(_,A)}}function H(A){var _=A.state.closeBrackets;if(!_||_.override)return _;var h=A.getModeAt(A.getCursor());return h.closeBrackets||_}function B(A){var _=H(A);if(!_||A.getOption("disableInput"))return ce.Pass;for(var h=Z(_,"pairs"),o=A.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return ce.Pass;var d=P(A,o[s].head);if(!d||h.indexOf(d)%2!=0)return ce.Pass}for(var s=o.length-1;s>=0;s--){var T=o[s].head;A.replaceRange("",O(T.line,T.ch-1),O(T.line,T.ch+1),"+delete")}}function R(A){var _=H(A),h=_&&Z(_,"explode");if(!h||A.getOption("disableInput"))return ce.Pass;for(var o=A.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return ce.Pass;var d=P(A,o[s].head);if(!d||h.indexOf(d)%2!=0)return ce.Pass}A.operation(function(){var T=A.lineSeparator()||`
`;A.replaceSelection(T+T,null),A.execCommand("goCharLeft"),o=A.listSelections();for(var y=0;y<o.length;y++){var m=o[y].head.line;A.indentLine(m,null,!0),A.indentLine(m+1,null,!0)}})}function x(A){var _=ce.cmpPos(A.anchor,A.head)>0;return{anchor:new O(A.anchor.line,A.anchor.ch+(_?-1:1)),head:new O(A.head.line,A.head.ch+(_?1:-1))}}function w(A,_){var h=H(A);if(!h||A.getOption("disableInput"))return ce.Pass;var o=Z(h,"pairs"),s=o.indexOf(_);if(s==-1)return ce.Pass;for(var d=Z(h,"closeBefore"),T=Z(h,"triples"),y=o.charAt(s+1)==_,m=A.listSelections(),f=s%2==0,E,p=0;p<m.length;p++){var g=m[p],u=g.head,a,b=A.getRange(u,O(u.line,u.ch+1));if(f&&!g.empty())a="surround";else if((y||!f)&&b==_)y&&L(A,u)?a="both":T.indexOf(_)>=0&&A.getRange(u,O(u.line,u.ch+3))==_+_+_?a="skipThree":a="skip";else if(y&&u.ch>1&&T.indexOf(_)>=0&&A.getRange(O(u.line,u.ch-2),u)==_+_){if(u.ch>2&&/\bstring/.test(A.getTokenTypeAt(O(u.line,u.ch-2))))return ce.Pass;a="addFour"}else if(y){var v=u.ch==0?" ":A.getRange(O(u.line,u.ch-1),u);if(!ce.isWordChar(b)&&v!=_&&!ce.isWordChar(v))a="both";else return ce.Pass}else if(f&&(b.length===0||/\s/.test(b)||d.indexOf(b)>-1))a="both";else return ce.Pass;if(!E)E=a;else if(E!=a)return ce.Pass}var S=s%2?o.charAt(s-1):_,I=s%2?_:o.charAt(s+1);A.operation(function(){if(E=="skip")A.execCommand("goCharRight");else if(E=="skipThree")for(var j=0;j<3;j++)A.execCommand("goCharRight");else if(E=="surround"){for(var z=A.getSelections(),j=0;j<z.length;j++)z[j]=S+z[j]+I;A.replaceSelections(z,"around"),z=A.listSelections().slice();for(var j=0;j<z.length;j++)z[j]=x(z[j]);A.setSelections(z)}else E=="both"?(A.replaceSelection(S+I,null),A.triggerElectric(S+I),A.execCommand("goCharLeft")):E=="addFour"&&(A.replaceSelection(S+S+S+S,"before"),A.execCommand("goCharRight"))})}function P(A,_){var h=A.getRange(O(_.line,_.ch-1),O(_.line,_.ch+1));return h.length==2?h:null}function L(A,_){var h=A.getTokenAt(O(_.line,_.ch+1));return/\bstring/.test(h.type)&&h.start==_.ch&&(_.ch==0||!/\bstring/.test(A.getTokenTypeAt(_)))}})},F8ak:function(tt,Ke){tt.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAOJJREFUOE+lkrEOAUEQhr+RULmLTqcQvRfxAKJX6o5GcISKTqkXD+BB6OUKNDpZV1Gs7MbKkZA4U83+M/8/f2ZHSEQExRy0NNQEyqakIRJYX2FehpNrF5fsoS6wAPJJsUQea2iWYGUwS3yQlu79gWgNaGgYshh7Wdh9mfSuE9+gIkcYa+i6qjcaoZUins0slA8CxPe59PtPAYGJHGADVB1qGgvTKSoMLeSHIed2+yn06NuaiUqDl/TjDwaWYMIIqOHwxa7AJT3xH6vfl9PpkPE8VK/3upzU35H6AP46OUf+5cjvSj1v2525UKMAAAAASUVORK5CYII="},FOrL:function(tt,Ke,le){tt.exports=le.p+"static/nodata.a6b3f948.png"},G27J:function(tt,Ke,le){tt.exports={flex_box_center:"flex_box_center___2aZZ9",flex_space_between:"flex_space_between___24La_",flex_box_vertical_center:"flex_box_vertical_center___2VMtc",flex_box_center_end:"flex_box_center_end___22Off",flex_box_column:"flex_box_column___30J55",banner_warp:"banner_warp___1y1yF",banner:"banner___1axOg",banner_t:"banner_t___10cVg",banner_title_tags:"banner_title_tags___3L55n",banner_title:"banner_title___WgeUc",operate:"operate___YjadH",btn_update:"btn_update___1rJ_w",btn_del:"btn_del___J2OWi",banner_b:"banner_b___r-HPa",banner_bl:"banner_bl___iXruu",banner_br:"banner_br___2m_b1",banner_name:"banner_name___2hIYj",banner_school:"banner_school___2Yrkz",b_info_title:"b_info_title___2mBrL",b_info_value:"b_info_value___1L4yH",learing_btn:"learing_btn___3Jji7"}},GfqC:function(tt,Ke,le){"use strict";var ce=le("q1tI"),J=le.n(ce),O=le("TSYQ"),Z=le.n(O);function F(V,M){var N="cannot "+V.method+" "+V.action+" "+M.status+"'",$=new Error(N);return $.status=M.status,$.method=V.method,$.url=V.action,$}function k(V){var M=V.responseText||V.response;if(!M)return M;try{return JSON.parse(M)}catch(N){return M}}function G(V){var M=new XMLHttpRequest;V.onProgress&&M.upload&&(M.upload.onprogress=function(he){he.total>0&&(he.percent=he.loaded/he.total*100),V.onProgress(he)});var N=new FormData;V.data&&Object.keys(V.data).forEach(function(ie){var he=V.data[ie];if(Array.isArray(he)){he.forEach(function(me){N.append(ie+"[]",me)});return}N.append(ie,V.data[ie])}),V.file instanceof Blob?N.append(V.filename,V.file,V.file.name):N.append(V.filename,V.file),M.onerror=function(he){V.onError(he)},M.onload=function(){return M.status<200||M.status>=300?V.onError(F(V,M),k(M)):V.onSuccess(k(M),M)},M.open(V.method,V.action,!0),V.withCredentials&&"withCredentials"in M&&(M.withCredentials=!0);var $=V.headers||{};return $["X-Requested-With"]!==null&&M.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys($).forEach(function(ie){$[ie]!==null&&M.setRequestHeader(ie,$[ie])}),M.send(N),{abort:function(){M.abort()}}}var H=+new Date,B=0;function R(){return"rc-upload-"+H+"-"+ ++B}function x(V,M){return V.indexOf(M,V.length-M.length)!==-1}var w=function(V,M){if(V&&M){var N=Array.isArray(M)?M:M.split(","),$=V.name||"",ie=V.type||"",he=ie.replace(/\/.*$/,"");return N.some(function(me){var ke=me.trim();return ke.charAt(0)==="."?x($.toLowerCase(),ke.toLowerCase()):/\/\*$/.test(ke)?he===ke.replace(/\/.*$/,""):ie===ke})}return!0};function P(V,M){var N=V.createReader(),$=[];function ie(){N.readEntries(function(he){var me=Array.prototype.slice.apply(he);$=$.concat(me);var ke=!me.length;ke?M($):ie()})}ie()}var L=function(M,N,$){var ie=function he(me,ke){ke=ke||"",me.isFile?me.file(function(Se){$(Se)&&(me.fullPath&&!Se.webkitRelativePath&&(Object.defineProperties(Se,{webkitRelativePath:{writable:!0}}),Se.webkitRelativePath=me.fullPath.replace(/^\//,""),Object.defineProperties(Se,{webkitRelativePath:{writable:!1}})),N([Se]))}):me.isDirectory&&P(me,function(Se){Se.forEach(function(Re){he(Re,""+ke+me.name+"/")})})};M.forEach(function(he){ie(he.webkitGetAsEntry())})},A=L,_=Object.assign||function(V){for(var M=1;M<arguments.length;M++){var N=arguments[M];for(var $ in N)Object.prototype.hasOwnProperty.call(N,$)&&(V[$]=N[$])}return V},h=function(){function V(M,N){var $=[],ie=!0,he=!1,me=void 0;try{for(var ke=M[Symbol.iterator](),Se;!(ie=(Se=ke.next()).done)&&!($.push(Se.value),N&&$.length===N);ie=!0);}catch(Re){he=!0,me=Re}finally{try{!ie&&ke.return&&ke.return()}finally{if(he)throw me}}return $}return function(M,N){if(Array.isArray(M))return M;if(Symbol.iterator in Object(M))return V(M,N);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function V(M,N){for(var $=0;$<N.length;$++){var ie=N[$];ie.enumerable=ie.enumerable||!1,ie.configurable=!0,"value"in ie&&(ie.writable=!0),Object.defineProperty(M,ie.key,ie)}}return function(M,N,$){return N&&V(M.prototype,N),$&&V(M,$),M}}();function s(V,M,N){return M in V?Object.defineProperty(V,M,{value:N,enumerable:!0,configurable:!0,writable:!0}):V[M]=N,V}function d(V,M){var N={};for(var $ in V){if(M.indexOf($)>=0)continue;if(!Object.prototype.hasOwnProperty.call(V,$))continue;N[$]=V[$]}return N}function T(V,M){if(!(V instanceof M))throw new TypeError("Cannot call a class as a function")}function y(V,M){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:V}function m(V,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);V.prototype=Object.create(M&&M.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(V,M):V.__proto__=M)}var f=function(M){return Object.keys(M).reduce(function(N,$){return($.substr(0,5)==="data-"||$.substr(0,5)==="aria-"||$==="role")&&(N[$]=M[$]),N},{})},E=function(V){m(M,V);function M(){var N,$,ie,he;T(this,M);for(var me=arguments.length,ke=Array(me),Se=0;Se<me;Se++)ke[Se]=arguments[Se];return he=($=(ie=y(this,(N=M.__proto__||Object.getPrototypeOf(M)).call.apply(N,[this].concat(ke))),ie),ie.state={uid:R()},ie.reqs={},ie.onChange=function(Re){var Te=Re.target.files;ie.uploadFiles(Te),ie.reset()},ie.onClick=function(Re){var Te=ie.fileInput;if(!Te)return;var _e=ie.props,ye=_e.children,K=_e.onClick;ye&&ye.type==="button"&&(Te.parentNode.focus(),Te.parentNode.querySelector("button").blur()),Te.click(),K&&K(Re)},ie.onKeyDown=function(Re){Re.key==="Enter"&&ie.onClick()},ie.onFileDrop=function(Re){var Te=ie.props.multiple;if(Re.preventDefault(),Re.type==="dragover")return;if(ie.props.directory)A(Array.prototype.slice.call(Re.dataTransfer.items),ie.uploadFiles,function(ye){return w(ye,ie.props.accept)});else{var _e=Array.prototype.slice.call(Re.dataTransfer.files).filter(function(ye){return w(ye,ie.props.accept)});Te===!1&&(_e=_e.slice(0,1)),ie.uploadFiles(_e)}},ie.uploadFiles=function(Re){var Te=Array.prototype.slice.call(Re);Te.map(function(_e){return _e.uid=R(),_e}).forEach(function(_e){ie.upload(_e,Te)})},ie.saveFileInput=function(Re){ie.fileInput=Re},$),y(ie,he)}return o(M,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function($,ie){var he=this,me=this.props;if(!me.beforeUpload)return setTimeout(function(){return he.post($)},0);var ke=me.beforeUpload($,ie);ke&&ke.then?ke.then(function(Se){var Re=Object.prototype.toString.call(Se);return Re==="[object File]"||Re==="[object Blob]"?he.post(Se):he.post($)}).catch(function(Se){console.log(Se)}):ke!==!1&&setTimeout(function(){return he.post($)},0);return}},{key:"post",value:function($){var ie=this;if(!this._isMounted)return;var he=this.props,me=he.onStart,ke=he.onProgress,Se=he.transformFile,Re=Se===void 0?function(Te){return Te}:Se;new Promise(function(Te){var _e=he.action;return typeof _e=="function"&&(_e=_e($)),Te(_e)}).then(function(Te){var _e=$.uid,ye=he.customRequest||G,K=Promise.resolve(Re($)).then(function(l){var c=he.data;return typeof c=="function"&&(c=c(l)),Promise.all([l,c])}).catch(function(l){console.error(l)});K.then(function(l){var c=h(l,2),D=c[0],X=c[1],U={action:Te,filename:he.name,data:X,file:D,headers:he.headers,withCredentials:he.withCredentials,method:he.method||"post",onProgress:ke?function(oe){ke(oe,$)}:null,onSuccess:function(be,xe){delete ie.reqs[_e],he.onSuccess(be,$,xe)},onError:function(be,xe){delete ie.reqs[_e],he.onError(be,xe,$)}};me($),ie.reqs[_e]=ye(U)})})}},{key:"reset",value:function(){this.setState({uid:R()})}},{key:"abort",value:function($){var ie=this.reqs;if($){var he=$;$&&$.uid&&(he=$.uid),ie[he]&&ie[he].abort&&ie[he].abort(),delete ie[he]}else Object.keys(ie).forEach(function(me){ie[me]&&ie[me].abort&&ie[me].abort(),delete ie[me]})}},{key:"render",value:function(){var $,ie=this.props,he=ie.component,me=ie.prefixCls,ke=ie.className,Se=ie.disabled,Re=ie.id,Te=ie.style,_e=ie.multiple,ye=ie.accept,K=ie.children,l=ie.directory,c=ie.openFileDialogOnClick,D=ie.onMouseEnter,X=ie.onMouseLeave,U=d(ie,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),oe=Z()(($={},s($,me,!0),s($,me+"-disabled",Se),s($,ke,ke),$)),be=Se?{}:{onClick:c?this.onClick:function(){},onKeyDown:c?this.onKeyDown:function(){},onMouseEnter:D,onMouseLeave:X,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return J.a.createElement(he,_({},be,{className:oe,role:"button",style:Te}),J.a.createElement("input",_({},f(U),{id:Re,type:"file",ref:this.saveFileInput,onClick:function(Pe){return Pe.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ye,directory:l?"directory":null,webkitdirectory:l?"webkitdirectory":null,multiple:_e,onChange:this.onChange})),K)}}]),M}(ce.Component),p=E,g=Object.assign||function(V){for(var M=1;M<arguments.length;M++){var N=arguments[M];for(var $ in N)Object.prototype.hasOwnProperty.call(N,$)&&(V[$]=N[$])}return V},u=function(){function V(M,N){for(var $=0;$<N.length;$++){var ie=N[$];ie.enumerable=ie.enumerable||!1,ie.configurable=!0,"value"in ie&&(ie.writable=!0),Object.defineProperty(M,ie.key,ie)}}return function(M,N,$){return N&&V(M.prototype,N),$&&V(M,$),M}}();function a(V,M){if(!(V instanceof M))throw new TypeError("Cannot call a class as a function")}function b(V,M){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:V}function v(V,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);V.prototype=Object.create(M&&M.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(V,M):V.__proto__=M)}function S(){}var I=function(V){v(M,V);function M(){var N,$,ie,he;a(this,M);for(var me=arguments.length,ke=Array(me),Se=0;Se<me;Se++)ke[Se]=arguments[Se];return he=($=(ie=b(this,(N=M.__proto__||Object.getPrototypeOf(M)).call.apply(N,[this].concat(ke))),ie),ie.saveUploader=function(Re){ie.uploader=Re},$),b(ie,he)}return u(M,[{key:"abort",value:function($){this.uploader.abort($)}},{key:"render",value:function(){return J.a.createElement(p,g({},this.props,{ref:this.saveUploader}))}}]),M}(ce.Component);I.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:S,onError:S,onSuccess:S,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var j=I,z=Ke.a=j},Gytx:function(tt,Ke){tt.exports=function(ce,J,O,Z){var F=O?O.call(Z,ce,J):void 0;if(F!==void 0)return!!F;if(ce===J)return!0;if(typeof ce!="object"||!ce||typeof J!="object"||!J)return!1;var k=Object.keys(ce),G=Object.keys(J);if(k.length!==G.length)return!1;for(var H=Object.prototype.hasOwnProperty.bind(J),B=0;B<k.length;B++){var R=k[B];if(!H(R))return!1;var x=ce[R],w=J[R];if(F=O?O.call(Z,x,w,R):void 0,F===!1||F===void 0&&x!==w)return!1}return!0}},HmJG:function(tt,Ke,le){},I3p9:function(tt,Ke){tt.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAgCAYAAAABtRhCAAAAAXNSR0IArs4c6QAAAtFJREFUSEvtlktIlFEcxc+500yPkSDQbZDRe1FptihaRA+YmahVVrQpiKiIHtqMYkXYcz6toIhICFq0iaQn+hm4axHYpgdUJKItiqKIhDLB5rsnvhFrknTGYVwE3d3l3v//d8+5//tgpMFrhLgfUhDj0UhRcMOl3NBcSY8Rxw6MGyxDgKGZ31rDV4wkPY2HsOE5A0GzqKWaz/4DC+b2v2MpiWsU3lugbizy81JI8F24lKXNlRyIOvahpBW5QvMDGnPATfCCD4k1arX1bPv4AAdvi9eBaSy3HiayH9P9MxVxbCuEtYAmZANnVUiy14B7rfA8HEJXcxX708oc77jEMrfWrPP7O5sUfPsNM2AxD56Sgub+DZ4VCPBJW60p84O3XtTU3n6Ui1guq8OAJpG4bIx5ELJ4cruGb/150aR3TcC2PIEADZpa42Z3pYOpfZQraVlmMoLdoYlcdfcg38Qc7bHQJUjMG+gH+segImF2dJ/F5M9WbyQVDyVk0Mxxq9kZbdBBWXt+tH3MwdLf4QFjYi0JutGkfSpo4eBC6M2czHBPCsXegE1bWkjg7PIK9Dzu0O1AgGdk0SvZBAPmXMshvIg26CukcEGAJPsrEiyqJ+1QwmOSyexHHdshaWlBgABfttWaBekjkdQyS52GUMIA69w476Wr0/FuSNhUKGCK1CmISwTF/qhS8hHFOxZKACopEDBbOeQ2PqYqzS1lAav0PzAXB/6NPSTYIbDeTMBHpWyVyC0jXdbDVY9JIcFOGNa5Cd7KTLT+nBanUnIkrclma05Akh8A1lcsxdX6lUyNlDT93bByIKXfz7+1UYEkvwpsLDY4fz3Ovmyr98clMdaIzbA6Kah0ZEsd++3XTU/+gHSlaIo50byPn3IBDZ+z8aZCfT3YBeho5tsZDJlZ96vYxUhSCVJxQO0MmiOtVezOBzQ8xv+WfPlu4yJ3UnLd2sB2f85PaGqzMGy2jjkAAAAASUVORK5CYII="},KlHt:function(tt,Ke,le){tt.exports={main_com:"main_com___3jNG1",project_list:"project_list___PX2DU",course_con:"course_con___2Pa-P",case_item:"case_item___1Jkcb",case_item_info:"case_item_info___109nn",btn_up_de:"btn_up_de___3D5l9",btn_update:"btn_update___8qqJM",btn_del:"btn_del___2LaXV"}},LdHM:function(tt,Ke,le){"use strict";le.d(Ke,"b",function(){return d}),le.d(Ke,"a",function(){return y});var ce=le("1OyB"),J=le("vuIU"),O=le("Ji7U"),Z=le("LK+K"),F=le("q1tI"),k=le("rePB"),G=le("Ff2n"),H=le("ODXe"),B=le("4IlW"),R=le("bX4T"),x=le("YrtM"),w=le("TSYQ"),P=le.n(w),L=le("+nKL"),A=le("8OUc"),_=function($,ie){var he=$.prefixCls,me=$.id,ke=$.flattenOptions,Se=$.childrenAsData,Re=$.values,Te=$.searchValue,_e=$.multiple,ye=$.defaultActiveFirstOption,K=$.height,l=$.itemHeight,c=$.notFoundContent,D=$.open,X=$.menuItemSelectedIcon,U=$.virtual,oe=$.onSelect,be=$.onToggleOpen,xe=$.onActiveValue,Pe=$.onScroll,De=$.onMouseEnter,Oe="".concat(he,"-item"),Ie=Object(x.a)(function(){return ke},[D,ke],function(q,ee){return ee[0]&&q[1]!==ee[1]}),He=F.useRef(null),Ve=function(ee){ee.preventDefault()},Je=function(ee){He.current&&He.current.scrollTo({index:ee})},Xe=function(ee){for(var ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ue=Ie.length,te=0;te<ue;te+=1){var ne=(ee+te*ae+ue)%ue,de=Ie[ne],fe=de.group,ve=de.data;if(!fe&&!ve.disabled)return ne}return-1},We=F.useState(function(){return Xe(0)}),Qe=Object(H.a)(We,2),et=Qe[0],Ae=Qe[1],ut=function(ee){Ae(ee);var ae=Ie[ee];if(!ae){xe(null,-1);return}xe(ae.data.value,ee)};F.useEffect(function(){ut(ye!==!1?Xe(0):-1)},[Ie.length,Te]),F.useEffect(function(){var q=setTimeout(function(){if(!_e&&D&&Re.size===1){var ee=Array.from(Re)[0],ae=Ie.findIndex(function(ue){var te=ue.data;return te.value===ee});ut(ae),Je(ae)}});return function(){return clearTimeout(q)}},[D]);var it=function(ee){ee!==void 0&&oe(ee,{selected:!Re.has(ee)}),_e||be(!1)};if(F.useImperativeHandle(ie,function(){return{onKeyDown:function(ee){var ae=ee.which;switch(ae){case B.a.UP:case B.a.DOWN:{var ue=0;if(ae===B.a.UP?ue=-1:ae===B.a.DOWN&&(ue=1),ue!==0){var te=Xe(et+ue,ue);Je(te),ut(te)}break}case B.a.ENTER:{var ne=Ie[et];ne&&!ne.data.disabled?it(ne.data.value):it(void 0),D&&ee.preventDefault();break}case B.a.ESC:be(!1)}},onKeyUp:function(){},scrollTo:function(ee){Je(ee)}}}),Ie.length===0)return F.createElement("div",{role:"listbox",id:"".concat(me,"_list"),className:"".concat(Oe,"-empty"),onMouseDown:Ve},c);function se(q){var ee=Ie[q];if(!ee)return null;var ae=ee.data||{},ue=ae.value,te=ae.label,ne=ae.children,de=Object(R.a)(ae,!0),fe=Se?ne:te;return ee?F.createElement("div",Object.assign({"aria-label":typeof fe=="string"?fe:null},de,{key:q,role:"option",id:"".concat(me,"_list_").concat(q),"aria-selected":Re.has(ue)}),ue):null}return F.createElement(F.Fragment,null,F.createElement("div",{role:"listbox",id:"".concat(me,"_list"),style:{height:0,width:0,overflow:"hidden"}},se(et-1),se(et),se(et+1)),F.createElement(L.a,{itemKey:"key",ref:He,data:Ie,height:K,itemHeight:l,fullHeight:!1,onMouseDown:Ve,onScroll:Pe,virtual:U,onMouseEnter:De},function(q,ee){var ae,ue=q.group,te=q.groupOption,ne=q.data,de=ne.label,fe=ne.key;if(ue)return F.createElement("div",{className:P()(Oe,"".concat(Oe,"-group"))},de!==void 0?de:fe);var ve=ne.disabled,Ee=ne.value,Me=ne.title,Ge=ne.children,nt=ne.style,at=ne.className,Tt=Object(G.a)(ne,["disabled","value","title","children","style","className"]),ft=Re.has(Ee),dt="".concat(Oe,"-option"),Pt=P()(Oe,dt,at,(ae={},Object(k.a)(ae,"".concat(dt,"-grouped"),te),Object(k.a)(ae,"".concat(dt,"-active"),et===ee&&!ve),Object(k.a)(ae,"".concat(dt,"-disabled"),ve),Object(k.a)(ae,"".concat(dt,"-selected"),ft),ae)),At=Se?Ge:de,Ht=!X||typeof X=="function"||ft;return F.createElement("div",Object.assign({},Tt,{"aria-selected":ft,className:Pt,title:Me,onMouseMove:function(){if(et===ee||ve)return;ut(ee)},onClick:function(){ve||it(Ee)},style:nt}),F.createElement("div",{className:"".concat(dt,"-content")},At||Ee),F.isValidElement(X)||ft,Ht&&F.createElement(A.a,{className:"".concat(Oe,"-option-state"),customizeIcon:X,customizeIconProps:{isSelected:ft}},ft?"\u2713":null))}))},h=F.forwardRef(_);h.displayName="OptionList";var o=h,s=function(){return null};s.isSelectOption=!0;var d=s,T=function(){return null};T.isSelectOptGroup=!0;var y=T,m=le("VTBJ"),f=le("Zm9Q");function E(N){var $=N.key,ie=N.props,he=ie.children,me=ie.value,ke=Object(G.a)(ie,["children","value"]);return Object(m.a)({key:$,value:me!==void 0?me:$,children:he},ke)}function p(N){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(f.a)(N).map(function(ie,he){if(!F.isValidElement(ie)||!ie.type)return null;var me=ie.type.isSelectOptGroup,ke=ie.key,Se=ie.props,Re=Se.children,Te=Object(G.a)(Se,["children"]);return $||!me?E(ie):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(ke===null?he:ke,"__"),label:ke},Te),{},{options:p(Re)})}).filter(function(ie){return ie})}var g=le("2Qr1"),u=le("qNPg"),a=le("U8pU"),b=le("Kwbf"),v=le("WKfj");function S(N){var $=N.mode,ie=N.options,he=N.children,me=N.backfill,ke=N.allowClear,Se=N.placeholder,Re=N.getInputElement,Te=N.showSearch,_e=N.onSearch,ye=N.defaultOpen,K=N.autoFocus,l=N.labelInValue,c=N.value,D=N.inputValue,X=N.optionLabelProp,U=$==="multiple"||$==="tags",oe=Te!==void 0?Te:U||$==="combobox",be=ie||p(he);if(Object(b.a)($!=="tags"||be.every(function(Oe){return!Oe.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),$==="tags"||$==="combobox"){var xe=be.some(function(Oe){return Oe.options?Oe.options.some(function(Ie){return typeof("value"in Ie?Ie.value:Ie.key)=="number"}):typeof("value"in Oe?Oe.value:Oe.key)=="number"});Object(b.a)(!xe,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(b.a)($!=="combobox"||!X,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(b.a)($==="combobox"||!me,"`backfill` only works with `combobox` mode."),Object(b.a)($==="combobox"||!Re,"`getInputElement` only work with `combobox` mode."),Object(b.b)($!=="combobox"||!Re||!ke||!Se,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),_e&&!oe&&$!=="combobox"&&$!=="tags"&&Object(b.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(b.b)(!ye||K,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),c!=null){var Pe=Object(v.d)(c);Object(b.a)(!l||Pe.every(function(Oe){return Object(a.a)(Oe)==="object"&&("key"in Oe||"value"in Oe)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(b.a)(!U||Array.isArray(c),"`value` should be array when `mode` is `multiple` or `tags`")}if(he){var De=null;Object(f.a)(he).some(function(Oe){if(!F.isValidElement(Oe)||!Oe.type)return!1;var Ie=Oe.type;if(Ie.isSelectOption)return!1;if(Ie.isSelectOptGroup){var He=Object(f.a)(Oe.props.children).every(function(Ve){return!F.isValidElement(Ve)||!Oe.type||Ve.type.isSelectOption?!0:(De=Ve.type,!1)});return!He}return De=Ie,!0}),De&&Object(b.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(De.displayName||De.name||De,"`.")),Object(b.a)(D===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var I=S,j=Object(u.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:p,flattenOptions:g.d,getLabeledValue:g.e,filterOptions:g.b,isValueDisabled:g.g,findValueOption:g.c,warningProps:I,fillOptionsWithMissingValue:g.a}),z=function(N){Object(O.a)(ie,N);var $=Object(Z.a)(ie);function ie(){var he;return Object(ce.a)(this,ie),he=$.apply(this,arguments),he.selectRef=F.createRef(),he.focus=function(){he.selectRef.current.focus()},he.blur=function(){he.selectRef.current.blur()},he}return Object(J.a)(ie,[{key:"render",value:function(){return F.createElement(j,Object.assign({ref:this.selectRef},this.props))}}]),ie}(F.Component);z.Option=d,z.OptGroup=y;var V=z,M=Ke.c=V},M8RZ:function(tt,Ke,le){"use strict";le.d(Ke,"a",function(){return B});var ce=le("fWQN"),J=le("mtLc"),O=le("yKVA"),Z=le("879j"),F=le("q1tI"),k=le.n(F),G=le("i8i4"),H=le.n(G),B=function(R){Object(O.a)(w,R);var x=Object(Z.a)(w);function w(P){var L;Object(ce.a)(this,w),L=x.call(this,P);var A=window.document;return L.node=A.createElement("div"),A.body.appendChild(L.node),L}return Object(J.a)(w,[{key:"render",value:function(){var L=this.props.children;return Object(G.createPortal)(L,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),w}(k.a.Component)},"Nv+3":function(tt,Ke,le){"use strict";le.r(Ke);var ce=le("T2oS"),J=le("W9HT"),O=le("OaEy"),Z=le("2fM7"),F=le("5NDa"),k=le("5rEg"),G=le("DZo9"),H=le("8z0m"),B=le("miYZ"),R=le("tsqr"),x=le("2qtc"),w=le("kLXV"),P=le("5Dmo"),L=le("3S7+"),A=le("k1fw"),_=le("oBTY"),h=le("9og8"),o=le("rAM+"),s=le("tJVT"),d=le("PpiC"),T=le("WmNS"),y=le.n(T),m=le("q1tI"),f=le.n(m),E=le("Ty5D"),p=le("9kvl"),g=le("OnE8"),u=le.n(g),a=le("2Qv1"),b=le("HBuW"),v=le("Mgx3"),S=le("G27J"),I=le.n(S),j=le("m3rI"),z=le("6CvP"),V=function(c){var D,X,U,oe,be,xe=c.data,Pe=c.showBtn;return f.a.createElement("div",{className:I.a.banner_warp,style:{background:"url('".concat(j.a.IMG_SERVER+(xe==null||((D=xe.background_url)===null||D===void 0)?void 0:D.url),"') no-repeat")}},f.a.createElement("div",{className:I.a.banner},f.a.createElement("div",{className:I.a.banner_t},f.a.createElement("div",{className:I.a.banner_title_tags},f.a.createElement(L.a,{title:xe==null?void 0:xe.name},f.a.createElement("div",{className:I.a.banner_title},xe==null?void 0:xe.name))),Pe&&f.a.createElement("div",{className:I.a.operate},f.a.createElement("div",{className:I.a.btn_update,onClick:function(){p.d.push("/shixuns/".concat(xe==null?void 0:xe.id,"/edit?comeFrom=info"))}},f.a.createElement("span",{className:"icon-bianji_Hover"}),"\u7F16\u8F91"),f.a.createElement("div",{className:I.a.btn_del,onClick:function(Oe){w.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:f.a.createElement("div",null,"\u786E\u8BA4\u5220\u9664\u8BE5\u5B9E\u8DF5\u5E73\u53F0\u5417\uFF1F"),onOk:function(){var Ie=Object(h.a)(y.a.mark(function Ve(){return y.a.wrap(function(Xe){for(;;)switch(Xe.prev=Xe.next){case 0:Object(z.e)(xe==null?void 0:xe.id).then(function(We){(We==null?void 0:We.status)==0&&(R.b.success("\u5220\u9664\u6210\u529F"),p.d.push("/shixuns"))});case 1:case"end":return Xe.stop()}},Ve)}));function He(){return Ie.apply(this,arguments)}return He}()})}},f.a.createElement("span",{className:"icon-shanchu13"}),"\u5220\u9664"))),f.a.createElement("div",{className:I.a.banner_b},f.a.createElement("div",{className:I.a.banner_bl},f.a.createElement("img",{src:j.a.IMG_SERVER+(xe==null?void 0:xe.avatar_url)}),f.a.createElement("div",{className:I.a.banner_name},xe==null?void 0:xe.teacher),f.a.createElement("div",{className:I.a.banner_school},xe==null||((X=xe.school)===null||X===void 0)?void 0:X.name)),((xe==null||((U=xe.company)===null||U===void 0)?void 0:U.name)||(xe==null?void 0:xe.url))&&f.a.createElement("div",{className:I.a.banner_br},(xe==null||((oe=xe.company)===null||oe===void 0)?void 0:oe.name)&&f.a.createElement("div",null,f.a.createElement("span",{style:{margin:"0 20px"}},"\u5B9E\u8DF5\u5E73\u53F0"),f.a.createElement("span",{style:{marginRight:20}},xe==null||((be=xe.company)===null||be===void 0)?void 0:be.name)),(xe==null?void 0:xe.url)&&f.a.createElement("div",{className:I.a.learing_btn,style:{marginLeft:"auto"},onClick:function(){window.open(xe==null?void 0:xe.url)}},"\u73B0\u5728\u53BB\u5B66\u4E60")))))},M=V,N=le("BdwD"),$=le("ErOA"),ie=le("Ot1p"),he=le("VoVZ"),me=le("RJ7s"),ke=le("9Bee"),Se=le("YKnm"),Re=le.n(Se),Te=le("F8ak"),_e=le.n(Te),ye=function(c){var D,X,U,oe,be,xe,Pe,De,Oe=c.user,Ie=c.shixunsDetail,He=c.globalSetting,Ve=c.loading,Je=c.dispatch,Xe=Object(d.a)(c,["user","shixunsDetail","globalSetting","loading","dispatch"]),We=Object(E.i)(),Qe=Object(m.useState)(),et=Object(s.a)(Qe,2),Ae=et[0],ut=et[1],it=Object(m.useState)(!1),se=Object(s.a)(it,2),q=se[0],ee=se[1],ae=Object(m.useState)(!1),ue=Object(s.a)(ae,2),te=ue[0],ne=ue[1],de=Object(m.useState)(!1),fe=Object(s.a)(de,2),ve=fe[0],Ee=fe[1],Me=Object(m.useState)(!1),Ge=Object(s.a)(Me,2),nt=Ge[0],at=Ge[1],Tt=Object(m.useState)("\u65B0\u589E"),ft=Object(s.a)(Tt,2),dt=ft[0],Pt=ft[1],At=Object(m.useState)(null),Ht=Object(s.a)(At,2),Bt=Ht[0],Lt=Ht[1],Sr=Object(m.useState)(!1),Dr=Object(s.a)(Sr,2),er=Dr[0],hr=Dr[1],vr=Object(m.useState)(""),Vr=Object(s.a)(vr,2),tr=Vr[0],Xr=Vr[1],Or=Object(m.useRef)(),Gt=Object(m.useState)(),Ze=Object(s.a)(Gt,2),Rt=Ze[0],rr=Ze[1],St=Object(m.useState)(!0),Et=Object(s.a)(St,2),Dt=Et[0],Cr=Et[1],Xt=Object(m.useState)(!1),Fe=Object(s.a)(Xt,2),yt=Fe[0],Pr=Fe[1],yi=Object(m.useState)(!1),li=Object(s.a)(yi,2),ui=li[0],Yr=li[1],bt=Object(m.useState)(""),Mi=Object(s.a)(bt,2),je=Mi[0],Hr=Mi[1],Mr=Object(m.useState)(),bi=Object(s.a)(Mr,2),yr=bi[0],br=bi[1],Ii=Object(m.useState)(),xi=Object(s.a)(Ii,2),Zt=xi[0],Ei=xi[1],Yi=Object(m.useState)(),Si=Object(s.a)(Yi,2),ir=Si[0],di=Si[1],pn=Object(m.useState)(),Ci=Object(s.a)(pn,2),Kt=Ci[0],$r=Ci[1],mn=Object(m.useState)([]),ti=Object(s.a)(mn,2),$t=ti[0],hi=ti[1],gn=Object(m.useState)([]),Ni=Object(s.a)(gn,2),Ir=Ni[0],Ti=Ni[1],$i=Object(m.useState)([{name:"\u5DE5\u4F5C\u5355\u4F4D",type:"dw",count:0},{name:"\u7814\u53D1\u673A\u6784",type:"jg",count:0}]),Ui=Object(s.a)($i,2),Nr=Ui[0],ri=Ui[1],ci=Object(m.useState)("dw"),ii=Object(s.a)(ci,2),Ur=ii[0],Gr=ii[1],Jr=Object(m.useState)({teacher:"",career:"",school:"",description:"",teacher_url:"",teacher_attachment_id:"",identity:"2"}),zr=Object(s.a)(Jr,2),qe=zr[0],Zr=zr[1];Object(m.useEffect)(function(){if(!(We!=null&&We.id))return;Ft()},[We==null?void 0:We.id]),Object(m.useEffect)(function(){ni()},[Ur]),Object(m.useEffect)(function(){if(!Or.current)return;function we(){var ht,ot=new ResizeObserver(function(xt){var Ct=Object(o.a)(xt),_t;try{for(Ct.s();!(_t=Ct.n()).done;){var or=_t.value;rr(or.target.offsetHeight>=500)}}catch(st){Ct.e(st)}finally{Ct.f()}});return ot.observe((ht=Or.current)===null||ht===void 0?void 0:ht.firstElementChild),ot}var Ue=we();return function(){var ht,ot;((ht=Or.current)===null||ht===void 0?void 0:ht.firstElementChild)&&Ue.unobserve((ot=Or.current)===null||ot===void 0?void 0:ot.firstElementChild)}},[Or.current]);var Ft=function(){var we=Object(h.a)(y.a.mark(function Ue(){var ht,ot,xt,Ct,_t,or,st,pt;return y.a.wrap(function(gt){for(;;)switch(gt.prev=gt.next){case 0:return ne(!0),gt.next=3,Object(b.H)({id:We==null?void 0:We.id});case 3:if(ot=gt.sent,ot!=null&&(ht=ot.case)!==null&&ht!==void 0&&ht.id){gt.next=7;break}return location.href="/404",gt.abrupt("return");case 7:(ot==null?void 0:ot.status)==0&&(pt=[1,2].includes(Oe==null||((xt=Oe.userInfo)===null||xt===void 0)?void 0:xt.role)||(ot==null||((Ct=ot.case)===null||Ct===void 0)?void 0:Ct.user_id)==(Oe==null||((_t=Oe.userInfo)===null||_t===void 0)?void 0:_t.user_id),ee(pt),ut(ot==null?void 0:ot.case),hi(Object(_.a)(ot==null||((or=ot.case)===null||or===void 0)?void 0:or.tags)),ne(!1),Ti(ot==null||((st=ot.case)===null||st===void 0)?void 0:st.case_teachers));case 8:case"end":return gt.stop()}},Ue)}));return function(){return we.apply(this,arguments)}}(),fi=function(Ue,ht){qe["".concat(Ue)]=ht,Zr(Object(A.a)({},qe))},ni=function(){Object(z.t)().then(function(Ue){var ht,ot,xt=function(pt){var ct;Ue.schools[pt].check=!1,Ae==null||((ct=Ae.schools_selected)===null||ct===void 0)||ct.forEach(function(gt){(gt==null?void 0:gt.name)==Ue.schools[pt].name&&(Ue.schools[pt].check=!0)})};for(var Ct in Ue==null?void 0:Ue.schools)xt(Ct);var _t=function(pt){var ct;Ue.companies[pt].check=!1,Ae==null||((ct=Ae.schools_selected)===null||ct===void 0)||ct.forEach(function(gt){(gt==null?void 0:gt.name)==Ue.companies[pt].name&&(Ue.companies[pt].check=!0)})};for(var or in Ue==null?void 0:Ue.companies)_t(or);Nr[0].count=Ue==null||((ht=Ue.schools)===null||ht===void 0)?void 0:ht.length,Nr[1].count=Ue==null||((ot=Ue.companies)===null||ot===void 0)?void 0:ot.length,ri(Nr),Ur=="dw"?(br(Ue==null?void 0:Ue.schools),Ei(Ue==null?void 0:Ue.schools)):Ur=="jg"&&(di(Ue==null?void 0:Ue.companies),$r(Ue==null?void 0:Ue.companies))})},_i=function(Ue,ht){var ot=new RegExp(Ue);return ht==null?void 0:ht.filter(function(xt){return ot.test(xt.name)})};return f.a.createElement(J.a,{spinning:te},f.a.createElement(M,{data:Ae,showBtn:Oe==null||((D=Oe.userInfo)===null||D===void 0)?void 0:D.admin}),f.a.createElement("div",{className:u.a.detailCon},f.a.createElement("div",{className:u.a.con_left},f.a.createElement("div",{className:u.a.header_com},f.a.createElement("div",{className:u.a.detail_title},"\u5E73\u53F0\u4ECB\u7ECD"),q&&f.a.createElement("div",{className:u.a.btn_update,onClick:function(){hr(!0)}},f.a.createElement("span",{className:"icon-bianji_Hover"}),"\u7F16\u8F91")),Ae!=null&&Ae.description?f.a.createElement(f.a.Fragment,null,f.a.createElement("div",{ref:Or,className:"".concat(u.a.main_com," ").concat(u.a.course_con),style:{maxHeight:Dt&&500,overflow:"hidden"}},f.a.createElement(ke.a,{value:(Ae==null?void 0:Ae.description)||""})),Rt&&f.a.createElement("div",{style:{textAlign:"center",color:"#145DFF",cursor:"pointer",position:"relative",top:"-60px",fontSize:14},onClick:function(Ue){Ue.stopPropagation(),Cr(!Dt)}},Dt?"\u67E5\u770B\u5168\u90E8 ":"\u6536\u8D77\u5168\u6587 ",f.a.createElement("i",{className:"iconfont font14 ".concat(Dt?"icon-jiantou9":"icon-changyongtubiao-xianxingdaochu-zhuanqu-")}))):f.a.createElement(N.a,{customText:"\u6682\u65E0\u6570\u636E",styles:{padding:"50px 0"}}),f.a.createElement("div",{className:u.a.header_com},f.a.createElement("div",{className:u.a.detail_title},"\u5E94\u7528\u6848\u4F8B"),q&&f.a.createElement("div",{className:u.a.btn_add,onClick:function(){at(!0)}},f.a.createElement("img",{src:le("cLbz")}),"\u65B0\u589E\u5E94\u7528\u6848\u4F8B")),f.a.createElement(he.a,{type:"shixun",detailInfo:Ae,showBtn:q,getData:function(){Ft()},showEdit:function(){var we=Object(h.a)(y.a.mark(function Ue(ht){return y.a.wrap(function(xt){for(;;)switch(xt.prev=xt.next){case 0:Lt(ht),Pt("\u7F16\u8F91"),at(!0);case 3:case"end":return xt.stop()}},Ue)}));return function(Ue){return we.apply(this,arguments)}}()}),f.a.createElement("div",{className:u.a.header_com},f.a.createElement("div",{className:u.a.detail_title},"\u5E73\u53F0\u8D1F\u8D23\u4EBA"),q&&f.a.createElement("div",{className:u.a.btn_add,style:{width:153},onClick:function(){Ee(!0),Zr({teacher_url:"",teacher_attachment_id:"",teacher:"",career:"",identity:2,school:"",description:""})}},f.a.createElement("img",{src:le("cLbz")}),"\u65B0\u589E\u5E73\u53F0\u8D1F\u8D23\u4EBA")),Ir==null||((X=Ir.filter(function(we){return we.identity==1}))===null||X===void 0)?void 0:X.map(function(we,Ue){var ht;return(we==null?void 0:we.identity)==1&&f.a.createElement("div",{key:Ue,style:{position:"relative",marginBottom:20}},q&&f.a.createElement("div",{className:u.a.btn_list},f.a.createElement(L.a,{title:"\u7F16\u8F91"},f.a.createElement("span",{className:"icon-bianji_Hover ".concat(u.a.bj),onClick:function(){var xt,Ct;Ee(!0),Zr({teacher_id:we==null?void 0:we.teacher_id,teacher_url:we==null||((xt=we.attachment)===null||xt===void 0)?void 0:xt.url,teacher_attachment_id:we==null||((Ct=we.attachment)===null||Ct===void 0)?void 0:Ct.id,teacher:we==null?void 0:we.name,career:we==null?void 0:we.career,school:we==null?void 0:we.school,identity:we==null?void 0:we.identity,description:we==null?void 0:we.description})}})),f.a.createElement(L.a,{title:"\u5220\u9664"},f.a.createElement("span",{className:"icon-shanchu13 ".concat(u.a.sc),onClick:function(){w.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",icon:null,title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4F4D\u6559\u5E08\u5417\uFF1F",onOk:function(){Object(v.c)({teacher_id:we==null?void 0:we.teacher_id}).then(function(Ct){(Ct==null?void 0:Ct.status)==0&&(R.b.success("\u5220\u9664\u6210\u529F"),Ft())})}})}}))),f.a.createElement(a.a,{photo:we==null||((ht=we.attachment)===null||ht===void 0)?void 0:ht.url,profile:we==null?void 0:we.description,name:we==null?void 0:we.name,position:we==null?void 0:we.career,type:"\u8D1F\u8D23\u6559\u5E08",school:we==null?void 0:we.school}))}),Ir==null||((U=Ir.filter(function(we){return we.identity==2}))===null||U===void 0)?void 0:U.map(function(we,Ue){var ht,ot;return(we==null?void 0:we.identity)==2&&f.a.createElement("div",{key:Ue,style:{position:"relative",marginBottom:20}},q&&f.a.createElement("div",{className:u.a.btn_list},Ue!=0&&f.a.createElement(L.a,{title:"\u4E0A\u79FB"},f.a.createElement("span",{className:"icon-shangyi_Hover ".concat(u.a.sy),onClick:function(){Object(v.I)({teacher_id:we==null?void 0:we.teacher_id,id:We==null?void 0:We.id}).then(function(Ct){(Ct==null?void 0:Ct.status)==0&&(R.b.success("\u4E0A\u79FB\u6210\u529F"),Ft())})}})),Ue+1!=(Ir==null||((ht=Ir.filter(function(xt){return xt.identity==2}))===null||ht===void 0)?void 0:ht.length)&&f.a.createElement(L.a,{title:"\u4E0B\u79FB"},f.a.createElement("span",{className:"icon-xiayi_Hover ".concat(u.a.xy),onClick:function(){Object(v.f)({teacher_id:we==null?void 0:we.teacher_id,id:We==null?void 0:We.id}).then(function(Ct){(Ct==null?void 0:Ct.status)==0&&(R.b.success("\u4E0B\u79FB\u6210\u529F"),Ft())})}})),f.a.createElement(L.a,{title:"\u7F16\u8F91"},f.a.createElement("span",{className:"icon-bianji_Hover ".concat(u.a.bj),onClick:function(){var Ct,_t;Ee(!0),Zr({teacher_id:we==null?void 0:we.teacher_id,teacher_url:we==null||((Ct=we.attachment)===null||Ct===void 0)?void 0:Ct.url,teacher_attachment_id:we==null||((_t=we.attachment)===null||_t===void 0)?void 0:_t.id,teacher:we==null?void 0:we.name,career:we==null?void 0:we.career,school:we==null?void 0:we.school,identity:we==null?void 0:we.identity,description:we==null?void 0:we.description})}})),f.a.createElement(L.a,{title:"\u5220\u9664"},f.a.createElement("span",{className:"icon-shanchu13 ".concat(u.a.sc),onClick:function(){w.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",icon:null,title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4F4D\u6559\u5E08\u5417\uFF1F",onOk:function(){Object(v.c)({teacher_id:we==null?void 0:we.teacher_id}).then(function(_t){(_t==null?void 0:_t.status)==0&&(R.b.success("\u5220\u9664\u6210\u529F"),Ft())})}})}}))),f.a.createElement(a.a,{photo:we==null||((ot=we.attachment)===null||ot===void 0)?void 0:ot.url,profile:we==null?void 0:we.description,name:we==null?void 0:we.name,position:we==null?void 0:we.career,type:"\u5408\u4F5C\u6559\u5E08",school:we==null?void 0:we.school}))})),f.a.createElement("div",{className:u.a.con_right},f.a.createElement("div",{className:u.a.con_right_warp},f.a.createElement("div",{className:u.a.header_com},f.a.createElement("div",{className:u.a.detail_title},"\u7814\u53D1\u673A\u6784"),q&&f.a.createElement("div",{className:u.a.btn_update,onClick:function(){Gr("dw"),Hr(""),Pr(!0),ni()}},f.a.createElement("span",{className:"icon-bianji_Hover"}),"\u7F16\u8F91")),f.a.createElement("div",{className:u.a.main_com},(Ae==null||((oe=Ae.schools_selected)===null||oe===void 0)?void 0:oe.length)>0?Ae==null||((be=Ae.schools_selected)===null||be===void 0)?void 0:be.map(function(we,Ue){var ht;return f.a.createElement("div",{style:{position:"relative",marginBottom:25},key:Ue},Ue!=0&&q&&f.a.createElement(L.a,{title:"\u4E0A\u79FB"},f.a.createElement("span",{className:"icon-shangyi_Hover ".concat(u.a.shangyi_style),onClick:function(){var xt=Ae==null?void 0:Ae.schools_selected.map(function(_t){return _t==null?void 0:_t.name}),Ct=[xt[Ue],xt[Ue-1]];xt[Ue-1]=Ct[0],xt[Ue]=Ct[1],Object(b.Yb)({id:Number(We==null?void 0:We.id),schools:xt}).then(function(_t){_t.status==0&&(R.b.success("\u4E0A\u79FB\u6210\u529F"),Pr(!1),Ft())})}})),Ue+1!=(Ae==null||((ht=Ae.schools_selected)===null||ht===void 0)?void 0:ht.length)&&q&&f.a.createElement(L.a,{title:"\u4E0B\u79FB"},f.a.createElement("span",{className:"icon-xiayi_Hover ".concat(u.a.xiayi_style),onClick:function(){var xt=Ae==null?void 0:Ae.schools_selected.map(function(_t){return _t==null?void 0:_t.name}),Ct=[xt[Ue+1],xt[Ue]];xt[Ue]=Ct[0],xt[Ue+1]=Ct[1],Object(b.Yb)({id:Number(We==null?void 0:We.id),schools:xt}).then(function(_t){_t.status==0&&(R.b.success("\u4E0B\u79FB\u6210\u529F"),Pr(!1),Ft())})}})),f.a.createElement("a",{href:we==null?void 0:we.link_url},f.a.createElement("img",{src:j.a.IMG_SERVER+(we==null?void 0:we.pic_url),style:{padding:"3px 8px"}})))}):f.a.createElement(N.a,{customText:"\u6682\u65E0\u6570\u636E",styles:{padding:"50px 0"},imgStyles:{width:"150px",height:"100px"}}))),f.a.createElement("div",{className:u.a.con_right_warp},f.a.createElement("div",{className:u.a.header_com},f.a.createElement("div",{className:u.a.detail_title},"\u6280\u672F\u6807\u7B7E"),q&&f.a.createElement("div",{className:u.a.btn_update,onClick:function(){Hr(""),Yr(!0),ni()}},f.a.createElement("span",{className:"icon-bianji_Hover"}),"\u7F16\u8F91")),f.a.createElement("div",{className:u.a.tech_tags},(Ae==null||((xe=Ae.tags)===null||xe===void 0)?void 0:xe.length)>0?Ae==null||((Pe=Ae.tags)===null||Pe===void 0)?void 0:Pe.map(function(we,Ue){return f.a.createElement("div",{className:u.a.tag,key:Ue},we)}):f.a.createElement(N.a,{customText:"\u6682\u65E0\u6570\u636E",styles:{padding:"50px 0"},imgStyles:{width:"150px",height:"100px"}}))))),f.a.createElement(ke.a,{value:He==null||((De=He.setting)===null||De===void 0)?void 0:De.footer}),f.a.createElement(w.a,{centered:!0,maskClosable:!1,zIndex:200,width:900,title:"\u7F16\u8F91\u5E73\u53F0\u4ECB\u7ECD",visible:er,onCancel:function(){hr(!1)},footer:f.a.createElement("div",{className:"modal_list"},f.a.createElement("div",{className:"modal_close",onClick:function(){hr(!1)}},"\u53D6\u6D88"),f.a.createElement("div",{className:"modal_sumbit",onClick:Object(h.a)(y.a.mark(function we(){var Ue;return y.a.wrap(function(ot){for(;;)switch(ot.prev=ot.next){case 0:return ot.next=2,Object(b.Ib)({id:We==null?void 0:We.id,task:Ae==null?void 0:Ae.task,description:tr});case 2:Ue=ot.sent,(Ue==null?void 0:Ue.status)==0&&(hr(!1),R.b.success("\u7F16\u8F91\u6210\u529F"),Ft());case 4:case"end":return ot.stop()}},we)}))},"\u4FDD\u5B58\u7F16\u8F91"))},f.a.createElement(ie.a,{className:u.a.MdEditor,placeholder:"\u8BF7\u8F93\u5165\u8BFE\u7A0B\u4ECB\u7ECD",width:850,height:450,defaultValue:Ae==null?void 0:Ae.description,onChange:function(Ue){Xr(Ue)}})),f.a.createElement(me.a,{editInfo:Bt,addEditName:dt,id:We==null?void 0:We.id,type:"case",dialogvisible:nt,setDialogvisible:function(Ue){at(Ue),Ue||Pt("\u65B0\u589E")},getData:function(){return Ft()}}),f.a.createElement(w.a,{centered:!0,maskClosable:!1,zIndex:200,width:1131,title:"\u7F16\u8F91\u5E73\u53F0\u8D1F\u8D23\u4EBA\u8D44\u6599",visible:ve,onCancel:function(){Ee(!1)},footer:f.a.createElement("div",{className:"modal_list"},f.a.createElement("div",{className:"modal_close",onClick:function(){Ee(!1)}},"\u53D6\u6D88"),f.a.createElement("div",{className:"modal_sumbit",onClick:Object(h.a)(y.a.mark(function we(){return y.a.wrap(function(ht){for(;;)switch(ht.prev=ht.next){case 0:qe!=null&&qe.teacher_id?Object(v.i)({id:We==null?void 0:We.id,teacher_id:qe==null?void 0:qe.teacher_id,name:qe==null?void 0:qe.teacher,identity:qe==null?void 0:qe.identity,career:qe==null?void 0:qe.career,school:qe==null?void 0:qe.school,description:qe==null?void 0:qe.description,attachment_id:qe==null?void 0:qe.teacher_attachment_id}).then(function(ot){(ot==null?void 0:ot.status)==0&&(Ee(!1),R.b.success("\u7F16\u8F91\u6210\u529F"),Ft())}):Object(v.C)({id:We==null?void 0:We.id,name:qe==null?void 0:qe.teacher,identity:qe==null?void 0:qe.identity,career:qe==null?void 0:qe.career,school:qe==null?void 0:qe.school,description:qe==null?void 0:qe.description,attachment_id:qe==null?void 0:qe.teacher_attachment_id}).then(function(ot){(ot==null?void 0:ot.status)==0&&(Ee(!1),R.b.success("\u65B0\u589E\u6210\u529F"),Ft())});case 1:case"end":return ht.stop()}},we)}))},"\u4FDD\u5B58\u7F16\u8F91"))},f.a.createElement("div",{className:u.a.teach_modal},f.a.createElement(H.a,{action:"",accept:"image/*",withCredentials:!0,showUploadList:!1,customRequest:function(Ue){var ht=new FormData;ht.append("file",Ue==null?void 0:Ue.file),Object($.a)("".concat(j.a.API_SERVER,"/api/attachments.json"),{method:"post",body:ht},!0).then(function(ot){qe.teacher_attachment_id=ot.id,qe.teacher_url=ot.test,Zr(Object(A.a)({},qe))})}},f.a.createElement("div",{className:"".concat(u.a.users_style," ").concat(qe!=null&&qe.teacher_url?u.a.users_style2:"")},(qe==null?void 0:qe.teacher_url)&&f.a.createElement("img",{src:j.a.API_SERVER+(qe==null?void 0:qe.teacher_url),className:u.a.active_img}),f.a.createElement("div",{className:u.a.sc_warp},f.a.createElement("div",{className:u.a.add_icon},"+"),f.a.createElement("div",{className:u.a.wenan},"\u4E0A\u4F20\u6559\u5E08\u7167\u7247"),f.a.createElement("div",{className:u.a.yaoqiu},"\u5C3A\u5BF8220*295px\uFF0C\u5927\u5C0F200KB\u5185")))),f.a.createElement("div",{className:u.a.right_teacher_warp},f.a.createElement("div",{className:u.a.hang},f.a.createElement("span",{className:u.a.title},"\u8D1F\u8D23\u4EBA\u59D3\u540D"),f.a.createElement(k.a,{className:u.a.input1,placeholder:"\u8BF7\u8F93\u5165\u59D3\u540D",suffix:"",style:{marginRight:73},value:qe==null?void 0:qe.teacher,onChange:function(Ue){fi("teacher",Ue.target.value)}}),f.a.createElement("span",{className:u.a.title},"\u804C\u79F0"),f.a.createElement(k.a,{className:u.a.input1,placeholder:"\u8BF7\u8F93\u5165\u804C\u79F0",suffix:"",value:qe==null?void 0:qe.career,onChange:function(Ue){fi("career",Ue.target.value)}})),f.a.createElement("div",{className:u.a.hang},f.a.createElement("span",{className:u.a.title},"\u8D1F\u8D23\u4EBA\u8EAB\u4EFD"),f.a.createElement(Z.a,{size:"large",className:u.a.input1,style:{marginRight:32},value:qe==null?void 0:qe.identity,onChange:function(Ue){qe.identity=Ue,Zr(Object(A.a)({},qe))}},f.a.createElement(Z.a.Option,{value:1},"\u8D1F\u8D23\u6559\u5E08"),f.a.createElement(Z.a.Option,{value:2},"\u5408\u4F5C\u6559\u5E08")),f.a.createElement("span",{className:u.a.title,style:{marginLeft:8}},"\u5355\u4F4D/\u9662\u6821"),f.a.createElement(k.a,{className:u.a.input1,placeholder:"\u8BF7\u8F93\u5165\u5355\u4F4D/\u9662\u6821",suffix:"",value:qe==null?void 0:qe.school,onChange:function(Ue){fi("school",Ue.target.value)}})),f.a.createElement("div",{className:u.a.hang,style:{alignItems:"flex-start"}},f.a.createElement("span",{className:u.a.title,style:{marginTop:10}},"\u8D1F\u8D23\u4EBA\u7B80\u4ECB"),f.a.createElement(ie.a,{className:u.a.MdEditor,placeholder:"\u8BF7\u8F93\u5165\u5E73\u53F0\u8D1F\u8D23\u4EBA\u7B80\u4ECB",width:749,height:176,defaultValue:qe==null?void 0:qe.description,onChange:function(Ue){fi("description",Ue)}}))))),f.a.createElement(w.a,{centered:!0,maskClosable:!1,zIndex:200,width:750,title:"\u9009\u62E9\u7814\u53D1\u673A\u6784",visible:yt,onCancel:function(){Pr(!1)},footer:f.a.createElement("div",{className:"modal_list"},f.a.createElement("div",{className:"modal_close",onClick:function(){Pr(!1)}},"\u53D6\u6D88"),f.a.createElement("div",{className:"modal_sumbit",onClick:Object(h.a)(y.a.mark(function we(){var Ue,ht,ot,xt;return y.a.wrap(function(_t){for(;;)switch(_t.prev=_t.next){case 0:return Ue=Zt==null?void 0:Zt.concat(Kt),ht=Ue==null?void 0:Ue.filter(function(or){return or==null?void 0:or.check}),ot={id:Number(We==null?void 0:We.id),schools:ht==null?void 0:ht.map(function(or){return or==null?void 0:or.name})},_t.next=5,Object(b.Yb)(ot);case 5:xt=_t.sent,xt.status==0&&(R.b.success("\u7F16\u8F91\u6210\u529F"),Pr(!1),Ft());case 7:case"end":return _t.stop()}},we)}))},"\u786E\u5B9A"))},f.a.createElement("div",{className:u.a.input_search},f.a.createElement(k.a,{value:je,onChange:function(Ue){Hr(Ue.target.value)},placeholder:"\u8BF7\u8F93\u5165\u673A\u6784\u540D\u79F0\u8FDB\u884C\u641C\u7D22"}),f.a.createElement("i",{className:"iconfont icon-sousuo9 font14 pl10 current",onClick:function(){if((je==null?void 0:je.length)==0)br(Zt),di(Kt),Nr[0].count=Zt==null?void 0:Zt.length,Nr[1].count=Kt==null?void 0:Kt.length,ri(Nr),console.log(Zt),console.log(Kt);else{var Ue=_i(je,yr);br(Ue);var ht=_i(je,ir);di(ht),Nr[0].count=Ue==null?void 0:Ue.length,Nr[1].count=ht==null?void 0:ht.length,ri(Nr)}}})),f.a.createElement("div",{className:u.a.tabs},Nr.map(function(we,Ue){return f.a.createElement("div",{key:Ue,className:"".concat(Ur==we.type?u.a.active_tab:u.a.item_tab),onClick:function(){Gr(we.type)}},f.a.createElement("div",{style:{position:"relative"}},we.name,f.a.createElement("div",{className:"".concat(Ur==we.type?u.a.active_line:"")})),"\uFF08",we.count,"\uFF09")})),Ur=="dw"&&f.a.createElement("div",null,(yr==null?void 0:yr.length)>0?f.a.createElement("div",{className:u.a.platform_list},yr.map(function(we,Ue){return f.a.createElement("div",{className:we!=null&&we.check?u.a.platform_item_active:u.a.platform_item,key:Ue,onClick:function(){yr[Ue].check=!yr[Ue].check,br(Object(_.a)(yr)),Ei(Object(_.a)(Zt))}},f.a.createElement("img",{className:u.a.img_items,src:j.a.IMG_SERVER+(we==null?void 0:we.pic_url)}),(we==null?void 0:we.check)&&f.a.createElement("img",{className:u.a.select_img,src:Re.a}))})):f.a.createElement(N.a,{customText:"\u6682\u65E0\u6570\u636E",styles:{padding:"100px 0"}})),Ur=="jg"&&f.a.createElement("div",null,(ir==null?void 0:ir.length)>0?f.a.createElement("div",{className:u.a.platform_list},ir.map(function(we,Ue){return f.a.createElement("div",{className:we!=null&&we.check?u.a.platform_item_active:u.a.platform_item,key:Ue,onClick:function(){ir[Ue].check=!ir[Ue].check,di(Object(_.a)(ir)),$r(Object(_.a)(Kt))}},f.a.createElement("img",{className:u.a.img_items,src:j.a.IMG_SERVER+(we==null?void 0:we.pic_url)}),(we==null?void 0:we.check)&&f.a.createElement("img",{className:u.a.select_img,src:Re.a}))})):f.a.createElement(N.a,{customText:"\u6682\u65E0\u6570\u636E",styles:{padding:"100px 0"}}))),f.a.createElement(w.a,{centered:!0,maskClosable:!1,zIndex:200,width:750,title:"\u6280\u672F\u6807\u7B7E\u7BA1\u7406",visible:ui,onCancel:function(){Yr(!1)},footer:f.a.createElement("div",{className:"modal_list"},f.a.createElement("div",{className:"modal_close",onClick:function(){Yr(!1)}},"\u53D6\u6D88"),f.a.createElement("div",{className:"modal_sumbit",onClick:Object(h.a)(y.a.mark(function we(){var Ue,ht;return y.a.wrap(function(xt){for(;;)switch(xt.prev=xt.next){case 0:return Ue={id:Number(We==null?void 0:We.id),tags:$t},xt.next=3,Object(b.Zb)(Ue);case 3:ht=xt.sent,ht.status==0&&(R.b.success("\u7F16\u8F91\u6210\u529F"),Yr(!1),Ft());case 5:case"end":return xt.stop()}},we)}))},"\u786E\u5B9A"))},f.a.createElement("div",{className:u.a.input_add},f.a.createElement("div",{className:u.a.input_text},"\u540D\u79F0"),f.a.createElement(k.a,{value:je,onChange:function(Ue){Hr(Ue.target.value)},placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0"}),f.a.createElement("div",{className:u.a.add_text,onClick:function(){if(je.trim()){var Ue=$t;Ue.push(je),hi(Object(_.a)(Ue)),Hr("")}}},"\u65B0\u589E")),f.a.createElement("div",{className:u.a.line}),($t==null?void 0:$t.length)>0?f.a.createElement("div",{className:u.a.unit_list},$t.map(function(we,Ue){return f.a.createElement("div",{className:u.a.unit_item,key:Ue},we,f.a.createElement("img",{src:_e.a,className:u.a.close_style,onClick:function(){$t==null||$t.splice(Ue,1),hi(Object(_.a)($t))}}))})):f.a.createElement(N.a,{customText:"\u6682\u65E0\u6570\u636E",styles:{padding:"100px 0"}})))},K=Ke.default=Object(p.a)(function(l){var c=l.user,D=l.shixunsDetail,X=l.loading,U=l.globalSetting;return{user:c,shixunsDetail:D,globalSetting:U,loading:X.models.index}})(ye)},OLES:function(tt,Ke,le){"use strict";var ce=le("U8pU"),J=le("VTBJ"),O=le("Ff2n"),Z=le("q1tI"),F=le("uciX"),k=le("7ixt"),G=function(P){var L=P.overlay,A=P.prefixCls,_=P.id,h=P.overlayInnerStyle;return Z.createElement("div",{className:"".concat(A,"-inner"),id:_,role:"tooltip",style:h},typeof L=="function"?L():L)},H=G,B=function(P,L){var A=P.overlayClassName,_=P.trigger,h=_===void 0?["hover"]:_,o=P.mouseEnterDelay,s=o===void 0?0:o,d=P.mouseLeaveDelay,T=d===void 0?.1:d,y=P.overlayStyle,m=P.prefixCls,f=m===void 0?"rc-tooltip":m,E=P.children,p=P.onVisibleChange,g=P.afterVisibleChange,u=P.transitionName,a=P.animation,b=P.placement,v=b===void 0?"right":b,S=P.align,I=S===void 0?{}:S,j=P.destroyTooltipOnHide,z=j===void 0?!1:j,V=P.defaultVisible,M=P.getTooltipContainer,N=P.overlayInnerStyle,$=Object(O.a)(P,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),ie=Object(Z.useRef)(null);Object(Z.useImperativeHandle)(L,function(){return ie.current});var he=Object(J.a)({},$);"visible"in P&&(he.popupVisible=P.visible);var me=function(){var _e=P.arrowContent,ye=_e===void 0?null:_e,K=P.overlay,l=P.id;return[Z.createElement("div",{className:"".concat(f,"-arrow"),key:"arrow"},ye),Z.createElement(H,{key:"content",prefixCls:f,id:l,overlay:K,overlayInnerStyle:N})]},ke=!1,Se=!1;if(typeof z=="boolean")ke=z;else if(z&&Object(ce.a)(z)==="object"){var Re=z.keepParent;ke=Re===!0,Se=Re===!1}return Z.createElement(F.a,Object.assign({popupClassName:A,prefixCls:f,popup:me,action:h,builtinPlacements:k.a,popupPlacement:v,ref:ie,popupAlign:I,getPopupContainer:M,onPopupVisibleChange:p,afterPopupVisibleChange:g,popupTransitionName:u,popupAnimation:a,defaultPopupVisible:V,destroyPopupOnHide:ke,autoDestroy:Se,mouseLeaveDelay:T,popupStyle:y,mouseEnterDelay:s},he),E)},R=Object(Z.forwardRef)(B),x=Ke.a=R},OnE8:function(tt,Ke,le){tt.exports={flex_box_center:"flex_box_center___3KzVb",flex_space_between:"flex_space_between___1y_9_",flex_box_vertical_center:"flex_box_vertical_center___3HK2I",flex_box_center_end:"flex_box_center_end___34hl0",flex_box_column:"flex_box_column___1XnGy",detailCon:"detailCon___2sdZZ",con_left:"con_left___3sqZ7",main_com:"main_com___15oPb",btn_add:"btn_add___308Yq",header_com:"header_com___CRaf5",btn_update:"btn_update___9KS0Z",detail_title:"detail_title___1qZof",con_right:"con_right___I4z_j",con_right_warp:"con_right_warp___35g0A",tech_tags:"tech_tags___2yN9F",tag:"tag___H5a4E",foot:"foot___R2XeD",shiyan_modal:"shiyan_modal___37o3d",add_pilotPro_item:"add_pilotPro_item___1WWOi",pilot_name:"pilot_name___1LyWr",pilot_url:"pilot_url___2rNKr",title:"title___2ye6M",add_and_del:"add_and_del___3S6Jv",teach_modal:"teach_modal___1M5h9",users_style:"users_style___1f1Gg",sc_warp:"sc_warp___2TM8E",add_icon:"add_icon___3dqbi",wenan:"wenan___2QUwu",yaoqiu:"yaoqiu___NQg0K",users_style2:"users_style2___dRDoW",active_img:"active_img___VGR1o",right_teacher_warp:"right_teacher_warp___1eHYs",hang:"hang___37USu",input1:"input1___3-Ch7",input2:"input2___AKSnA",MdEditor:"MdEditor___3e6BC",input_search:"input_search___jOu7i",platform_list:"platform_list___1U5Xf",platform_item:"platform_item___2TrdO",platform_item_active:"platform_item_active___1ipEN",img_items:"img_items___29_zp",text_items:"text_items___1FL5J",select_img:"select_img___4c06h",unit_list:"unit_list___nx_7X",unit_item:"unit_item___2i0qE",close_style:"close_style___XNpSS",tabs:"tabs___2BB1H",item_tab:"item_tab___3xxY_",active_tab:"active_tab___1SBED",active_line:"active_line___33wfI",input_add:"input_add___5BXXy",input_text:"input_text___3Xv0U",add_text:"add_text___31f3s",line:"line___2iqRi",shangyi_style:"shangyi_style___1e--4",xiayi_style:"xiayi_style____EIQz",btn_list:"btn_list___2U1AI",sy:"sy___1T2Bb",xy:"xy___hiAbj",bj:"bj___1w4hY",sc:"sc___2n4_3"}},Ot1p:function(tt,Ke,le){"use strict";var ce=le("2qtc"),J=le("kLXV"),O=le("rAM+"),Z=le("miYZ"),F=le("tsqr"),k=le("9og8"),G=le("tJVT"),H=le("jrin"),B=le("WmNS"),R=le.n(B),x=le("q1tI"),w=le.n(x),P=le("VrN/"),L=le.n(P),A=le("bdgK"),_=le("p77/"),h=le("Bd2K"),o=le("ELLl"),s=le("19Vz"),d=le("lZu9"),T=le("+NIl"),y=le("kSUc"),m=le("9Bee"),f=function(ve){var Ee=ve.value,Me=Ee===void 0?"":Ee,Ge=ve.className,nt=ve.showTextOnly,at=ve.showLines,Tt=ve.style,ft=Tt===void 0?{}:Tt,dt=Object(x.useMemo)(function(){return""},[Me]);return w.a.createElement(w.a.Fragment,null,w.a.createElement("div",{dangerouslySetInnerHTML:{__html:dt}}))},E=le("0Owb"),p=le("dejd"),g=le("C+DQ"),u=le("1vsH"),a=le("m3rI"),b=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function v(ve){var Ee=ve.onActionCallback,Me=ve.title,Ge=ve.icon,nt=ve.actionName,at=ve.className,Tt=at===void 0?"":at,ft=ve.children;function dt(){Ee(nt)}return w.a.createElement("a",{title:Me,className:Tt,onClick:dt},w.a.createElement("i",{className:"md-iconfont ".concat(Ge)}),ft)}var S=function(ve){var Ee=ve.watch,Me=ve.showNullButton,Ge=ve.onActionCallback,nt=ve.fullScreen,at=ve.insertTemp,Tt=ve.hidetoolBar,ft=ve.uuid,dt=ve.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(u.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(u.F)("_educoder_session"),"&key=").concat(ft,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Pt=[].concat(b,[{title:"".concat(Ee?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ee?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return w.a.createElement("ul",{className:"markdown-toolbar-container"},!Tt&&Pt.map(function(At,Ht){return w.a.createElement("li",{key:Ht},At.actionName?w.a.createElement(v,Object(E.a)({},At,{onActionCallback:Ge})):w.a.createElement("span",{className:"v-line"}))}),Me?w.a.createElement("li",null,w.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Ge},w.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,at&&w.a.createElement("li",null,w.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(at),onActionCallback:Ge},w.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),w.a.createElement("li",{className:"btn-full-screen"},w.a.createElement(v,{icon:"".concat(nt?"icon-shrink":"icon-enlarge"),title:nt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ge})))},I=le("M8RZ"),j=le("+L6B"),z=le("2/Rp"),V=le("y8nQ"),M=le("Vl3Y"),N=le("5NDa"),$=le("5rEg"),ie={labelCol:{span:4},wrapperCol:{span:20}},he=function(ve){var Ee=ve.callback,Me=ve.onCancel;function Ge(nt){Ee(nt)}return w.a.createElement(M.a,Object(E.a)({},ie,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ge}),w.a.createElement(M.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},w.a.createElement($.a,null)),w.a.createElement(M.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},w.a.createElement($.a,null)),w.a.createElement("div",{className:"flex-container flex-end"},w.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),w.a.createElement(z.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))},me=le("7ahc"),ke=le("HmJG"),Se=le("BjJ7"),Re=M.a.useForm,Te={width:280,marginRight:10},_e={labelCol:{span:5},wrapperCol:{span:19}},ye=function(ve){var Ee=ve.callback,Me=ve.onCancel,Ge=Re(),nt=Object(G.a)(Ge,1),at=nt[0];function Tt(Pt){Ee(Pt)}function ft(Pt,At){if(Pt.status===-1){F.b.error(Pt.message);return}at.setFieldsValue({src:"/api/attachments/".concat(Pt.id),type:At.type})}function dt(Pt){var At=Pt.target.files[0];l(At,ft)}return w.a.createElement(M.a,Object(E.a)({form:at},_e,{className:"upload-image-panel",onFinish:Tt}),w.a.createElement(M.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},w.a.createElement("div",{className:"flex-container"},w.a.createElement(M.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},w.a.createElement($.a,{style:Te})),w.a.createElement(K,{onFileChange:dt}))),w.a.createElement(M.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},w.a.createElement($.a,{style:{width:264}})),w.a.createElement(M.a.Item,{style:{textAlign:"right"}},w.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),w.a.createElement(z.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))};function K(ve){var Ee=ve.onFileChange;return w.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",w.a.createElement("input",{type:"file",onChange:Ee}))}function l(ve,Ee){if(!ve)throw new String("\u6CA1\u6709\u6587\u4EF6");var Me=new FormData;Me.append("editormd-image-file",ve),Me.append("file_param_name","editormd-image-file"),Me.append("byxhr","true");var Ge=new window.XMLHttpRequest;Ge.withCredentials=!0,Ge.addEventListener("load",function(nt){Ee(JSON.parse(nt.target.responseText),ve)},!1),Ge.addEventListener("error",function(nt){console.error(nt)},!1),Ge.open("POST","".concat(Se.a,"/api/attachments.json")),Ge.send(Me)}var c=le("giR+"),D=le("fyUT"),X=le("7Kak"),U=le("9yH6"),oe=U.a.Group,be={margin:"0 8px"},xe=function(ve){var Ee=ve.callback,Me=ve.onCancel;function Ge(nt){Ee(nt)}return w.a.createElement(M.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ge},w.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},w.a.createElement("span",{style:be},"\u5355\u5143\u683C\u6570\uFF1A"),w.a.createElement("span",{style:be},"\u884C\u6570"),w.a.createElement(M.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},w.a.createElement(D.a,null)),w.a.createElement("span",{style:be},"\u5217\u6570"),w.a.createElement(M.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},w.a.createElement(D.a,null))),w.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},w.a.createElement("span",{style:be},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),w.a.createElement(M.a.Item,{name:"align"},w.a.createElement(oe,null,w.a.createElement(U.a,{value:"default"},w.a.createElement("i",{className:"fa fa-align-justify"})),w.a.createElement(U.a,{value:"left"},w.a.createElement("i",{className:"fa fa-align-left"})),w.a.createElement(U.a,{value:"center"},w.a.createElement("i",{className:"fa fa-align-center"})),w.a.createElement(U.a,{value:"right"},w.a.createElement("i",{className:"fa fa-align-right"}))))),w.a.createElement("div",{className:"flex-container flex-end"},w.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),w.a.createElement(z.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))},Pe=le("ErOA"),De=le("7Cbv"),Oe="link",Ie="upload-image",He="code-block",Ve="add-table",Je="------------",Xe={default:Je,left:":".concat(Je),center:":".concat(Je,":"),right:"".concat(Je,":")},We=le("9VGf"),Qe,et;function Ae(){}var ut=0,it=1e4,se="\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 ee(ve){return/^\d+$/.test(ve)?"".concat(ve,"px"):ve}var ae=navigator.platform.toUpperCase().indexOf("MAC")>=0,ue=ae?"Cmd":"Ctrl",te=["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"],ne=(Qe={},Object(H.a)(Qe,ue+"-B","bold"),Object(H.a)(Qe,ue+"-I","italic"),Qe),de=(et={},Object(H.a)(et,Oe,"\u6DFB\u52A0\u94FE\u63A5"),Object(H.a)(et,He,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(H.a)(et,Ie,"\u6DFB\u52A0\u6587\u4EF6"),Object(H.a)(et,Ve,"\u6DFB\u52A0\u8868\u683C"),et),fe=Ke.a=function(ve){var Ee=ve.defaultValue,Me=Ee===void 0?"":Ee,Ge=ve.onChange,nt=ve.width,at=nt===void 0?"100%":nt,Tt=ve.height,ft=Tt===void 0?400:Tt,dt=ve.miniToolbar,Pt=dt===void 0?!1:dt,At=ve.isFocus,Ht=At===void 0?!1:At,Bt=ve.watch,Lt=ve.insertTemp,Sr=ve.mode,Dr=Sr===void 0?"markdown":Sr,er=ve.id,hr=er===void 0?"markdown-editor-id":er,vr=ve.showResizeBar,Vr=vr===void 0?!1:vr,tr=ve.noStorage,Xr=tr===void 0?!1:tr,Or=ve.showNullButton,Gt=Or===void 0?!1:Or,Ze=ve.hidetoolBar,Rt=Ze===void 0?!1:Ze,rr=ve.fullScreen,St=rr===void 0?!1:rr,Et=ve.onBlur,Dt=ve.onCMBeforeChange,Cr=ve.onFullScreen,Xt=ve.className,Fe=Xt===void 0?"":Xt,yt=ve.disablePaste,Pr=yt===void 0?!1:yt,yi=ve.placeholder,li=yi===void 0?"":yi,ui=ve.values,Yr=ui===void 0?"":ui,bt=Object(x.useState)(null),Mi=Object(G.a)(bt,2),je=Mi[0],Hr=Mi[1],Mr=Object(x.useState)(Me),bi=Object(G.a)(Mr,2),yr=bi[0],br=bi[1],Ii=Object(x.useState)(Bt),xi=Object(G.a)(Ii,2),Zt=xi[0],Ei=xi[1],Yi=Object(x.useState)(St),Si=Object(G.a)(Yi,2),ir=Si[0],di=Si[1],pn=Object(x.useState)(""),Ci=Object(G.a)(pn,2),Kt=Ci[0],$r=Ci[1],mn=Object(x.useState)(0),ti=Object(G.a)(mn,2),$t=ti[0],hi=ti[1],gn=Object(x.useState)(ft),Ni=Object(G.a)(gn,2),Ir=Ni[0],Ti=Ni[1],$i=Object(x.useState)(!1),Ui=Object(G.a)($i,2),Nr=Ui[0],ri=Ui[1],ci=Object(x.useRef)(Object(De.a)()),ii=Object(x.useRef)(!1),Ur=Object(x.useRef)(),Gr=Object(x.useRef)(),Jr=Object(x.useRef)(),zr=Object(x.useRef)(),qe=Object(x.useRef)(),Zr=function(){var st=Object(k.a)(R.a.mark(function pt(){var ct,gt;return R.a.wrap(function(jt){for(;;)switch(jt.prev=jt.next){case 0:return jt.next=2,Object(Pe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:ci.current}});case 2:gt=jt.sent,gt!=null&&(ct=gt.attachments)!==null&&ct!==void 0&&ct.length&&(console.log("cm:",je,Gr),gt.attachments.map(function(Ot){Ot.content_type.indexOf("image")>-1?je.replaceSelection("![,](/api/attachments/".concat(Ot.id,"?type=").concat(Ot.content_type,")")):Ot.content_type.indexOf("video")>-1?je.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Ot.content_type.indexOf("pdf")>-1?je.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ot.id,"?type=").concat(Ot.content_type,'&disposition=inline" target="_blank">').concat(Ot.name,"</a>")):je.replaceSelection("[".concat(Ot.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ot.id,"?type=").concat(Ot.content_type,")"))}));case 4:case"end":return jt.stop()}},pt)}));return function(){return st.apply(this,arguments)}}();Object(x.useEffect)(function(){br(Yr),je==null||je.setValue(Yr)},[Yr]),Object(x.useEffect)(function(){Cr==null||Cr(ir)},[ir]),Object(x.useEffect)(function(){if(Gr.current){var st=L.a.fromTextArea(Gr.current,{mode:Dr,lineNumbers:!Pt,lineWrapping:!0,value:Me,autoCloseTags:!0,autoCloseBrackets:!0});Ht&&st.focus();function pt(ct,gt){if(Pr){gt.preventDefault();return}var Mt=gt.clipboardData;if(Mt){var jt=Mt.types.toString(),Ot=Mt.items;if(jt==="Files"||Mt.types.indexOf("Files")>-1){if(gt.preventDefault(),Dr=="stex")return;try{var nr,Tr=Ot[1];((nr=Ot[0])===null||nr===void 0?void 0:nr.kind)==="file"&&(Tr=Ot[0]);var kt=Tr.getAsFile(),pi=kt.name.split(".").pop();l(kt,function(It){if(It.id){var _r,pr,Kr;(kt==null||((_r=kt.type)===null||_r===void 0)?void 0:_r.indexOf("image"))>-1?st.replaceSelection("![,](/api/attachments/".concat(It.id,"?type=").concat(It.content_type,")")):(kt==null||((pr=kt.type)===null||pr===void 0)?void 0:pr.indexOf("video"))>-1?st.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(It.id,'"></video>')):(kt==null||((Kr=kt.type)===null||Kr===void 0)?void 0:Kr.indexOf("pdf"))>-1?st.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(It.id,"?type=").concat(kt.type,'&disposition=inline" target="_blank">').concat(kt.name,"</a>")):te.includes(pi)?st.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(It.id,'?type=office&disposition=inline" target="_blank">').concat(kt.name,"</a>")):st.replaceSelection("[".concat(kt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(It.id,"?type=").concat(It.content_type,")"))}else(It==null?void 0:It.status)===401&&(document.location.href="/user/login")})}catch(It){F.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return st.on("paste",pt),st.on("dragleave",function(ct,gt){Jr.current.classList.remove("mouse-hover-md")}),st.on("dragover",function(ct,gt){Jr.current.classList.add("mouse-hover-md")}),st.on("drop",function(ct,gt){Jr.current.classList.add("mouse-hover-md");var Mt;if(Mt=gt.dataTransfer.files,Mt.length>0){gt.preventDefault(),gt.stopPropagation();for(var jt=function(Tr){var kt=Mt[Tr],pi=kt.name.split(".").pop();l(kt,function(It){if(It.id){var _r,pr,Kr;(kt==null||((_r=kt.type)===null||_r===void 0)?void 0:_r.indexOf("image"))>-1?st.replaceSelection("![,](/api/attachments/".concat(It.id,"?type=").concat(It.content_type,")")):(kt==null||((pr=kt.type)===null||pr===void 0)?void 0:pr.indexOf("video"))>-1?st.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(It.id,'"></video>')):(kt==null||((Kr=kt.type)===null||Kr===void 0)?void 0:Kr.indexOf("pdf"))>-1?st.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(It.id,"?type=").concat(kt.type,'&disposition=inline" target="_blank">').concat(kt.name,"</a>")):te.includes(pi)?st.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(It.id,'?type=office&disposition=inline" target="_blank">').concat(kt.name,"</a>")):st.replaceSelection("[".concat(kt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(It.id,"?type=").concat(It.content_type,")"))}else(It==null?void 0:It.status)===401&&(document.location.href="/user/login")})},Ot=0;Ot<Mt.length;Ot++)jt(Ot)}}),Hr(st),function(){st.off("paste",pt)}}},[]);var Ft=Object(x.useCallback)(function(){if(Jr.current)try{}catch(st){console.log(st,"---- to set md editor body height")}},[Ir,Jr,ir]);Object(x.useEffect)(function(){function st(){var ct=new A.default(function(gt){var Mt=Object(O.a)(gt),jt;try{for(Mt.s();!(jt=Mt.n()).done;){var Ot=jt.value;(Ot.target.offsetHeight>0||Ot.target.offsetWidth>0)&&(Ft(),je.setSize("100%","100%"),je.refresh())}}catch(nr){Mt.e(nr)}finally{Mt.f()}});return ct.observe(Gr.current.parentElement),ct}if(je){var pt=st();return function(){pt.unobserve(Gr.current.parentElement)}}},[je,Ft]),Object(x.useEffect)(function(){if(je){for(var st=[],pt=function(){var Ot=gt[ct];Mt=Object(G.a)(Ot,2);var nr=Mt[0],Tr=Mt[1],kt=Object(H.a)({},nr,function(){fi(Tr)});st.push(kt),je.addKeyMap(kt)},ct=0,gt=Object.entries(ne);ct<gt.length;ct++){var Mt;pt()}return Ur.current=setInterval(function(){ii.current&&Zr()},4e3),function(){clearInterval(Ur.current);var jt=Object(O.a)(st),Ot;try{for(jt.s();!(Ot=jt.n()).done;){var nr=Ot.value;je.removeKeyMap(nr)}}catch(Tr){jt.e(Tr)}finally{jt.f()}}}},[je]),Object(x.useEffect)(function(){St!==ir&&di(St)},[St]),Object(We.a)(function(){if(!Xr&&$t>0){var st=new Date().getTime(),pt=window.sessionStorage.getItem(hr);st>=$t+it&&(!pt||pt!==yr)&&(window.sessionStorage.setItem(hr,yr),ri(!0))}},it),Object(x.useEffect)(function(){Ei(Bt)},[je,Bt]),Object(x.useEffect)(function(){je&&(Ht&&je.focus())},[je,Ht]),Object(x.useEffect)(function(){if(Zt&&je){var st=je.getScrollerElement();function pt(ct){var gt=ct.target;if(qe.current){var Mt=gt.scrollTop/gt.scrollHeight;qe.current.scrollTop=qe.current.scrollHeight*Mt}}return st.addEventListener("scroll",pt),function(){st.removeEventListener("scroll",pt)}}},[je,Zt]),Object(x.useEffect)(function(){if(je&&Dt){function st(pt,ct){Dt(pt,ct)}return je.on("beforeChange",st),function(){je.off("beforeChange",st)}}},[je,Dt]),Object(x.useEffect)(function(){if(je&&Et){function st(){Et(je.getValue())}return je.on("blur",st),function(){je.off("blur",st)}}},[je,Et]),Object(x.useEffect)(function(){if(je){function st(pt){var ct=pt.getValue();br(ct),hi(new Date().getTime()),pt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ge&&Ge(ct)}return je.on("change",st),function(){je.off("change",st)}}},[je,Ge]),Object(x.useEffect)(function(){je&&(Me==null?(je.setValue(""),br("")):Me!==je.getValue()&&(je.setValue(Me),br(Me),je.setCursor(je.lineCount(),0)))},[je,Me]);var fi=Object(x.useCallback)(function(st){var pt=je.getCursor(),ct=je.getSelection(),gt=ct.split(`
`);switch(st){case"bold":return je.replaceSelection("**"+ct+"**"),ct===""&&je.setCursor(pt.line,pt.ch+2),je.focus();case"italic":return je.replaceSelection("*"+ct+"*"),ct===""&&je.setCursor(pt.line,pt.ch+1),je.focus();case"code":return je.replaceSelection("`"+ct+"`"),ct===""&&je.setCursor(pt.line,pt.ch+1),je.focus();case"inline-latex":return je.replaceSelection("`$$"+ct+"$$`"),ct===""&&je.setCursor(pt.line,pt.ch+3),je.focus();case"latex":return je.replaceSelection("```latex\n"+ct+"\n```"),je.setCursor(pt.line+1,ct.length+1),je.focus();case"line-break":return je.replaceSelection(`<br/>
`),je.focus();case"list-ul":return ct===""?je.replaceSelection("- "+ct):je.replaceSelection(gt.map(function(Mt){return Mt===""?"":"- ".concat(Mt)}).join(`
`)),je.focus();case"list-ol":return ct===""?je.replaceSelection("1. "+ct):je.replaceSelection(gt.map(function(Mt,jt){return Mt===""?"":"".concat(jt+1,". ").concat(Mt)}).join(`
`)),je.focus();case"add-null-ch":return ct===""&&je.setCursor(pt.line,pt.ch+1),je.replaceSelection(se),je.focus();case"inster-template-1":return ct===""&&je.setCursor(pt.line,pt.ch),je.replaceSelection(q),je.focus();case"eraser":return je.setValue(""),je.focus();case"trigger-watch":return Ei(!Zt),je.focus();case"trigger-full-screen":return di(!ir),je.focus();case Oe:$r(Oe);return;case He:$r(He);return;case Ie:$r(Ie);return;case Ve:$r(Ve);return;default:throw new Error}},[je,Zt,ir]),ni=Object(x.useCallback)(function(st){$r("");switch(Kt){case Oe:var pt=st.title,ct=st.link;return je.replaceSelection("[".concat(pt,"](").concat(ct,")")),je.focus();case He:var gt=st.language,Mt=st.content;return je.replaceSelection(["```"+gt,Mt,"```"].join(`
`)),je.focus();case Ie:var jt=st.src,Ot=st.alt;return Ot?je.replaceSelection("![ ".concat(Ot," ]( ").concat(jt,' "').concat(Ot,'" )')):je.replaceSelection("![,](".concat(jt,")")),je.focus();case Ve:for(var nr=st.row,Tr=st.col,kt=st.align,pi=`
`,It=0;It<nr;It++){for(var _r=[],pr=[],Kr=0;Kr<Tr;Kr++)It===1&&pr.push(Xe[kt]),_r.push(" ");It===1&&(pi+="| ".concat(pr.join(" | "),` |
`)),pi+="| ".concat(_r.join(Tr===1?"":" | "),` |
`)}return je.replaceSelection(pi+`
`),je.focus();default:throw new Error}},[je,Kt]),_i=Object(x.useMemo)(function(){switch(Kt){case Oe:return w.a.createElement(he,{callback:ni,onCancel:we});case He:return w.a.createElement(me.b,{callback:ni,onCancel:we});case Ie:return w.a.createElement(ye,{callback:ni,onCancel:we});case Ve:return w.a.createElement(xe,{callback:ni,onCancel:we});default:return null}},[Kt]);function we(){$r("")}Object(x.useEffect)(function(){if(zr.current){var st=zr.current,pt=!1,ct=0;function gt(Ot){pt=!0,ct=Ot.pageY}function Mt(){pt=!1}function jt(Ot){if(pt){var nr=Ot.pageY-ct;nr<0&&(nr=0),nr>300&&(nr=300);var Tr=ft+nr+"px";Ti(Tr)}}return st.addEventListener("mousedown",gt),document.addEventListener("mousemove",jt),document.addEventListener("mouseup",Mt),function(){st.removeEventListener("mousedown",gt),document.removeEventListener("mousemove",jt),document.removeEventListener("mouseup",Mt)}}},[je,zr]),Object(x.useEffect)(function(){Ti(ft)},[ft]);var Ue=ee(at),ht=ee(Ir),ot={width:Ue,height:ht},xt=Object(x.useMemo)(function(){if($t){var st=new Date($t),pt=st.getHours(),ct=st.getMinutes(),gt=st.getSeconds();return pt=pt<10?"0"+pt:pt,ct=ct<10?"0"+ct:ct,gt=gt<10?"0"+gt:gt,"".concat(pt,":").concat(ct,":").concat(gt)}return 0},[$t]);function Ct(){window.sessionStorage.removeItem(hr),ri(!1),hi(0)}function _t(){ri(!1),hi(0),je.setValue(window.sessionStorage.getItem(hr))}function or(st,pt){var ct=je.getValue();ct=ct.replace(st,pt),br(ct),je==null||je.setValue(ct)}return w.a.createElement(x.Fragment,null,w.a.createElement("div",{className:"markdown-editor-wrapper",ref:Jr},w.a.createElement("div",{className:"markdown-editor-container ".concat(Fe," ").concat(Zt?"on-preview":""," ").concat(Pt?"mini":""," ").concat(ir?"full-screen":""),style:ot},w.a.createElement(S,{insertTemp:Lt,watch:Zt,fullScreen:ir,showNullButton:Gt,onActionCallback:fi,hidetoolBar:Rt,uuid:ci.current,setOpenPhones:function(){ii.current=!0}}),w.a.createElement("div",{className:"markdown-editor-body"},w.a.createElement("div",{className:"codemirror-container"},w.a.createElement("textarea",{ref:Gr,placeholder:li})),Zt?w.a.createElement("div",{ref:qe,className:"preview-container"},Dr==="stex"&&w.a.createElement(f,{value:yr}),Dr!=="stex"&&w.a.createElement(m.a,{edit:!0,value:yr,replaces:or})):null))),Vr?w.a.createElement("a",{ref:zr,className:"editor-resize"}):null,w.a.createElement(I.a,null,de[Kt]?w.a.createElement(J.a,{centered:!0,title:de[Kt],visible:!0,onCancel:we,footer:null,className:"markdown-popup-form"},_i):null))}},RJ7s:function(tt,Ke,le){"use strict";var ce=le("2qtc"),J=le("kLXV"),O=le("5NDa"),Z=le("5rEg"),F=le("miYZ"),k=le("tsqr"),G=le("9og8"),H=le("k1fw"),B=le("tJVT"),R=le("WmNS"),x=le.n(R),w=le("q1tI"),P=le.n(w),L=le("gpuL"),A=le.n(L),_=le("SVaM"),h=function(s){var d,T=s.editInfo,y=s.addEditName,m=s.type,f=s.id,E=s.dialogvisible,p=s.setDialogvisible,g=s.getData,u=Object(w.useState)({container_type:"",container_id:null,cases:[{name:"",url:""}]}),a=Object(B.a)(u,2),b=a[0],v=a[1];return Object(w.useEffect)(function(){E&&(b.container_type=m,b.container_id=f,b.cases=y=="\u7F16\u8F91"?[T]:[{name:"",url:""}],v(Object(H.a)({},b)))},[E]),P.a.createElement(J.a,{centered:!0,maskClosable:!1,zIndex:200,width:1038,bodyStyle:{maxHeight:553,overflowY:"auto"},title:"".concat(y,"\u5B9E\u9A8C\u9879\u76EE"),visible:E,onCancel:function(){p(!1)},footer:P.a.createElement("div",{className:"modal_list"},P.a.createElement("div",{className:"modal_close",onClick:function(){p(!1)}},"\u53D6\u6D88"),P.a.createElement("div",{className:"modal_sumbit",onClick:Object(G.a)(x.a.mark(function S(){var I,j,z,V,M;return x.a.wrap(function($){for(;;)switch($.prev=$.next){case 0:if(j=new RegExp(/^[^\u4e00-\u9fa5]+$/),z=0,b==null||((I=b.cases)===null||I===void 0)||I.forEach(function(ie){var he,me;(ie==null||((he=ie.name)===null||he===void 0)?void 0:he.length)==0||(ie==null||((me=ie.url)===null||me===void 0)?void 0:me.length)==0?z=1:j.test(ie==null?void 0:ie.url)||(z=2)}),!(z==1)){$.next=8;break}return k.b.error("\u8BF7\u586B\u5199\u540D\u79F0\u6216\u94FE\u63A5"),$.abrupt("return");case 8:if(!(z==2)){$.next=11;break}return k.b.error("\u94FE\u63A5\u4E2D\u4E0D\u80FD\u8F93\u5165\u4E2D\u6587"),$.abrupt("return");case 11:if(!(y=="\u7F16\u8F91")){$.next=18;break}return $.next=14,Object(_.d)(b.cases[0]);case 14:V=$.sent,(V==null?void 0:V.status)==0&&(k.b.success("\u7F16\u8F91\u6210\u529F"),p(!1),g()),$.next=23;break;case 18:if(!(y=="\u65B0\u589E")){$.next=23;break}return $.next=21,Object(_.b)(b);case 21:M=$.sent,(M==null?void 0:M.status)==0&&(k.b.success("\u65B0\u589E\u6210\u529F"),p(!1),g());case 23:case"end":return $.stop()}},S)}))},"\u786E\u8BA4\u65B0\u589E"))},P.a.createElement("div",{className:A.a.shiyan_modal},b==null||((d=b.cases)===null||d===void 0)?void 0:d.map(function(S,I){var j;return P.a.createElement("div",{key:I,className:A.a.add_pilotPro_item},P.a.createElement("div",{className:A.a.pilot_name},P.a.createElement("div",{className:A.a.title},P.a.createElement("span",{style:{color:"#ff4d4f",marginRight:4}},"*"),"\u540D\u79F0"),P.a.createElement(Z.a,{placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0",maxLength:100,value:S==null?void 0:S.name,onChange:function(V){b.cases[I].name=V.target.value,v(Object(H.a)({},b))}}),P.a.createElement("span",{className:A.a.record_count},(S==null||((j=S.name)===null||j===void 0)?void 0:j.length)||0,"/100")),P.a.createElement("div",{className:A.a.pilot_url},P.a.createElement("div",{className:A.a.title},P.a.createElement("span",{style:{color:"#ff4d4f",marginRight:4}},"*"),"\u94FE\u63A5"),P.a.createElement(Z.a,{placeholder:"\u8BF7\u8F93\u5165\u94FE\u63A5",suffix:"",value:S==null?void 0:S.url,onChange:function(V){b.cases[I].url=V.target.value,v(Object(H.a)({},b))}}),y=="\u65B0\u589E"&&P.a.createElement("div",{className:A.a.add_and_del,onClick:function(){var V;b==null||((V=b.cases)===null||V===void 0)||V.splice(I+1,0,{name:"",url:""}),v(Object(H.a)({},b))}},P.a.createElement("i",{className:"iconfont icon-tianjiatimu font14",style:{color:"#2FA34F"}})),I>0&&y=="\u65B0\u589E"&&P.a.createElement("div",{className:A.a.add_and_del,onClick:function(){var V;b==null||((V=b.cases)===null||V===void 0)||V.splice(I,1),v(Object(H.a)({},b))}},P.a.createElement("i",{className:"iconfont icon-shanjian font14",style:{color:"#E30000"}}))))})))};Ke.a=h},SJMd:function(tt,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 le,ce,J,O=!1,Z,F;window.PR_SHOULD_USE_CONTINUATION=!0;var k,G;(function(){var H=window,B=["break,continue,do,else,for,if,return,while"],R=[B,"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"],x=[R,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],w=[x,"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=[x,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],L=[x,"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"],A="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",_=[x,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],h="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=[B,"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=[B,"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=[B,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],T=[w,L,P,_,h,o,s,d],y=/^(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",f="kwd",E="com",p="typ",g="lit",u="pun",a="pln",b="tag",v="dec",S="src",I="atn",j="atv",z="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function M(oe){for(var be=0,xe=!1,Pe=!1,De=0,Oe=oe.length;De<Oe;++De){var Ie=oe[De];if(Ie.ignoreCase)Pe=!0;else if(/[a-z]/i.test(Ie.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){xe=!0,Pe=!1;break}}var He={b:8,t:9,n:10,v:11,f:12,r:13};function Ve(et){var Ae=et.charCodeAt(0);if(Ae!==92)return Ae;var ut=et.charAt(1);return Ae=He[ut],Ae||("0"<=ut&&ut<="7"?parseInt(et.substring(1),8):ut==="u"||ut==="x"?parseInt(et.substring(2),16):et.charCodeAt(1))}function Je(et){if(et<32)return(et<16?"\\x0":"\\x")+et.toString(16);var Ae=String.fromCharCode(et);return Ae==="\\"||Ae==="-"||Ae==="]"||Ae==="^"?"\\"+Ae:Ae}function Xe(et){var Ae=et.substring(1,et.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),ut=[],it=Ae[0]==="^",se=["["];it&&se.push("^");for(var q=it?1:0,ee=Ae.length;q<ee;++q){var ae=Ae[q];if(/\\[bdsw]/i.test(ae))se.push(ae);else{var ue=Ve(ae),te;q+2<ee&&Ae[q+1]==="-"?(te=Ve(Ae[q+2]),q+=2):te=ue,ut.push([ue,te]),te<65||ue>122||(te<65||ue>90||ut.push([Math.max(65,ue)|32,Math.min(te,90)|32]),te<97||ue>122||ut.push([Math.max(97,ue)&~32,Math.min(te,122)&~32]))}}ut.sort(function(ve,Ee){return ve[0]-Ee[0]||Ee[1]-ve[1]});for(var ne=[],de=[],q=0;q<ut.length;++q){var fe=ut[q];fe[0]<=de[1]+1?de[1]=Math.max(de[1],fe[1]):ne.push(de=fe)}for(var q=0;q<ne.length;++q){var fe=ne[q];se.push(Je(fe[0])),fe[1]>fe[0]&&(fe[1]+1>fe[0]&&se.push("-"),se.push(Je(fe[1])))}return se.push("]"),se.join("")}function We(et){for(var Ae=et.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")),ut=Ae.length,it=[],se=0,q=0;se<ut;++se){var ee=Ae[se];if(ee==="(")++q;else if(ee.charAt(0)==="\\"){var ae=+ee.substring(1);ae&&(ae<=q?it[ae]=-1:Ae[se]=Je(ae))}}for(var se=1;se<it.length;++se)it[se]===-1&&(it[se]=++be);for(var se=0,q=0;se<ut;++se){var ee=Ae[se];if(ee==="(")++q,it[q]||(Ae[se]="(?:");else if(ee.charAt(0)==="\\"){var ae=+ee.substring(1);ae&&ae<=q&&(Ae[se]="\\"+it[ae])}}for(var se=0;se<ut;++se)Ae[se]==="^"&&Ae[se+1]!=="^"&&(Ae[se]="");if(et.ignoreCase&&xe)for(var se=0;se<ut;++se){var ee=Ae[se],ue=ee.charAt(0);ee.length>=2&&ue==="["?Ae[se]=Xe(ee):ue!=="\\"&&(Ae[se]=ee.replace(/[a-zA-Z]/g,function(de){var fe=de.charCodeAt(0);return"["+String.fromCharCode(fe&~32,fe|32)+"]"}))}return Ae.join("")}for(var Qe=[],De=0,Oe=oe.length;De<Oe;++De){var Ie=oe[De];if(Ie.global||Ie.multiline)throw new Error(""+Ie);Qe.push("(?:"+We(Ie)+")")}return new RegExp(Qe.join("|"),Pe?"gi":"g")}function N(oe,be){var xe=/(?:^|\s)nocode(?:\s|$)/,Pe=[],De=0,Oe=[],Ie=0;function He(Ve){var Je=Ve.nodeType;if(Je==1){if(xe.test(Ve.className))return;for(var Xe=Ve.firstChild;Xe;Xe=Xe.nextSibling)He(Xe);var We=Ve.nodeName.toLowerCase();(We==="br"||We==="li")&&(Pe[Ie]=`
`,Oe[Ie<<1]=De++,Oe[Ie++<<1|1]=Ve)}else if(Je==3||Je==4){var Qe=Ve.nodeValue;Qe.length&&(be?Qe=Qe.replace(/\r\n?/g,`
`):Qe=Qe.replace(/[ \t\r\n]+/g," "),Pe[Ie]=Qe,Oe[Ie<<1]=De,De+=Qe.length,Oe[Ie++<<1|1]=Ve)}}return He(oe),{sourceCode:Pe.join("").replace(/\n$/,""),spans:Oe}}function $(oe,be,xe,Pe,De){if(!xe)return;var Oe={sourceNode:oe,pre:1,langExtension:null,numberLines:null,sourceCode:xe,spans:null,basePos:be,decorations:null};Pe(Oe),De.push.apply(De,Oe.decorations)}var ie=/\S/;function he(oe){for(var be=void 0,xe=oe.firstChild;xe;xe=xe.nextSibling){var Pe=xe.nodeType;be=Pe===1?be?oe:xe:Pe===3&&ie.test(xe.nodeValue)?oe:be}return be===oe?void 0:be}function me(oe,be){var xe={},Pe;(function(){for(var Ie=oe.concat(be),He=[],Ve={},Je=0,Xe=Ie.length;Je<Xe;++Je){var We=Ie[Je],Qe=We[3];if(Qe)for(var et=Qe.length;--et>=0;)xe[Qe.charAt(et)]=We;var Ae=We[1],ut=""+Ae;Ve.hasOwnProperty(ut)||(He.push(Ae),Ve[ut]=null)}He.push(/[\0-\uffff]/),Pe=M(He)})();var De=be.length,Oe=function(Ie){for(var He=Ie.sourceCode,Ve=Ie.basePos,Je=Ie.sourceNode,Xe=[Ve,a],We=0,Qe=He.match(Pe)||[],et={},Ae=0,ut=Qe.length;Ae<ut;++Ae){var it=Qe[Ae],se=et[it],q=void 0,ee;if(typeof se=="string")ee=!1;else{var ae=xe[it.charAt(0)];if(ae)q=it.match(ae[1]),se=ae[0];else{for(var ue=0;ue<De;++ue)if(ae=be[ue],q=it.match(ae[1]),q){se=ae[0];break}q||(se=a)}ee=se.length>=5&&se.substring(0,5)==="lang-",ee&&!(q&&typeof q[1]=="string")&&(ee=!1,se=S),ee||(et[it]=se)}var te=We;if(We+=it.length,!ee)Xe.push(Ve+te,se);else{var ne=q[1],de=it.indexOf(ne),fe=de+ne.length;q[2]&&(fe=it.length-q[2].length,de=fe-ne.length);var ve=se.substring(5);$(Je,Ve+te,it.substring(0,de),Oe,Xe),$(Je,Ve+te+de,ne,K(ve,ne),Xe),$(Je,Ve+te+fe,it.substring(fe),Oe,Xe)}}Ie.decorations=Xe};return Oe}function ke(oe){var be=[],xe=[];oe.tripleQuotedStrings?be.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):oe.multiLineStrings?be.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):be.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),oe.verbatimStrings&&xe.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Pe=oe.hashComments;Pe&&(oe.cStyleComments?(Pe>1?be.push([E,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):be.push([E,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),xe.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):be.push([E,/^#[^\r\n]*/,null,"#"])),oe.cStyleComments&&(xe.push([E,/^\/\/[^\r\n]*/,null]),xe.push([E,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var De=oe.regexLiterals;if(De){var Oe=De>1?"":`
\r`,Ie=Oe?".":"[\\S\\s]",He="/(?=[^/*"+Oe+"])(?:[^/\\x5B\\x5C"+Oe+"]|\\x5C"+Ie+"|\\x5B(?:[^\\x5C\\x5D"+Oe+"]|\\x5C"+Ie+")*(?:\\x5D|$))+/";xe.push(["lang-regex",RegExp("^"+V+"("+He+")")])}var Ve=oe.types;Ve&&xe.push([p,Ve]);var Je=(""+oe.keywords).replace(/^ | $/g,"");Je.length&&xe.push([f,new RegExp("^(?:"+Je.replace(/[\s,]+/g,"|")+")\\b"),null]),be.push([a,/^\s+/,null,` \r
\xA0`]);var Xe="^.[^\\s\\w.$@'\"`/\\\\]*";return oe.regexLiterals&&(Xe+="(?!s*/)"),xe.push([g,/^@[a-z_$][a-z_$@0-9]*/i,null],[p,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[g,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(Xe),null]),me(be,xe)}var Se=ke({keywords:T,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Re(oe,be,xe){for(var Pe=/(?:^|\s)nocode(?:\s|$)/,De=/\r\n?|\n/,Oe=oe.ownerDocument,Ie=Oe.createElement("li");oe.firstChild;)Ie.appendChild(oe.firstChild);var He=[Ie];function Ve(Ae){var ut=Ae.nodeType;if(ut==1&&!Pe.test(Ae.className))if(Ae.nodeName==="br")Je(Ae),Ae.parentNode&&Ae.parentNode.removeChild(Ae);else for(var it=Ae.firstChild;it;it=it.nextSibling)Ve(it);else if((ut==3||ut==4)&&xe){var se=Ae.nodeValue,q=se.match(De);if(q){var ee=se.substring(0,q.index);Ae.nodeValue=ee;var ae=se.substring(q.index+q[0].length);if(ae){var ue=Ae.parentNode;ue.insertBefore(Oe.createTextNode(ae),Ae.nextSibling)}Je(Ae),ee||Ae.parentNode.removeChild(Ae)}}}function Je(Ae){for(;!Ae.nextSibling;)if(Ae=Ae.parentNode,!Ae)return;function ut(q,ee){var ae=ee?q.cloneNode(!1):q,ue=q.parentNode;if(ue){var te=ut(ue,1),ne=q.nextSibling;te.appendChild(ae);for(var de=ne;de;de=ne)ne=de.nextSibling,te.appendChild(de)}return ae}for(var it=ut(Ae.nextSibling,0),se;(se=it.parentNode)&&se.nodeType===1;)it=se;He.push(it)}for(var Xe=0;Xe<He.length;++Xe)Ve(He[Xe]);be===(be|0)&&He[0].setAttribute("value",be);var We=Oe.createElement("ol");We.className="linenums";for(var Qe=Math.max(0,be-1|0)||0,Xe=0,et=He.length;Xe<et;++Xe)Ie=He[Xe],Ie.className="L"+(Xe+Qe)%10,Ie.firstChild||Ie.appendChild(Oe.createTextNode("\xA0")),We.appendChild(Ie);oe.appendChild(We)}function Te(oe){var be=/\bMSIE\s(\d+)/.exec(navigator.userAgent);be=be&&+be[1]<=8;var xe=/\n/g,Pe=oe.sourceCode,De=Pe.length,Oe=0,Ie=oe.spans,He=Ie.length,Ve=0,Je=oe.decorations,Xe=Je.length,We=0;Je[Xe]=De;var Qe,et;for(et=Qe=0;et<Xe;)Je[et]!==Je[et+2]?(Je[Qe++]=Je[et++],Je[Qe++]=Je[et++]):et+=2;for(Xe=Qe,et=Qe=0;et<Xe;){for(var Ae=Je[et],ut=Je[et+1],it=et+2;it+2<=Xe&&Je[it+1]===ut;)it+=2;Je[Qe++]=Ae,Je[Qe++]=ut,et=it}Xe=Je.length=Qe;var se=oe.sourceNode,q="";se&&(q=se.style.display,se.style.display="none");try{for(var ee=null;Ve<He;){var ae=Ie[Ve],ue=Ie[Ve+2]||De,te=Je[We+2]||De,it=Math.min(ue,te),ne=Ie[Ve+1],de;if(ne.nodeType!==1&&(de=Pe.substring(Oe,it))){be&&(de=de.replace(xe,"\r")),ne.nodeValue=de;var fe=ne.ownerDocument,ve=fe.createElement("span");ve.className=Je[We+1];var Ee=ne.parentNode;Ee.replaceChild(ve,ne),ve.appendChild(ne),Oe<ue&&(Ie[Ve+1]=ne=fe.createTextNode(Pe.substring(it,ue)),Ee.insertBefore(ne,ve.nextSibling))}Oe=it,Oe>=ue&&(Ve+=2),Oe>=te&&(We+=2)}}finally{se&&(se.style.display=q)}}var _e={};function ye(oe,be){for(var xe=be.length;--xe>=0;){var Pe=be[xe];_e.hasOwnProperty(Pe)?H.console&&console.warn("cannot override language handler %s",Pe):_e[Pe]=oe}}function K(oe,be){return oe&&_e.hasOwnProperty(oe)||(oe=/^\s*</.test(be)?"default-markup":"default-code"),_e[oe]}ye(Se,["default-code"]),ye(me([],[[a,/^[^<?]+/],[v,/^<!\w[^>]*(?:>|$)/],[E,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[u,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ye(me([[a,/^[\s]+/,null,` \r
`],[j,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[b,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[I,/^(?!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"]),ye(me([],[[j,/^[\s\S]+/]]),["uq.val"]),ye(ke({keywords:w,hashComments:!0,cStyleComments:!0,types:y}),["c","cc","cpp","cxx","cyc","m"]),ye(ke({keywords:"null,true,false"}),["json"]),ye(ke({keywords:L,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:y}),["cs"]),ye(ke({keywords:P,cStyleComments:!0}),["java"]),ye(ke({keywords:d,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ye(ke({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ye(ke({keywords:h,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ye(ke({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ye(ke({keywords:_,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ye(ke({keywords:A,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ye(me([],[[m,/^[\s\S]+/]]),["regex"]);function l(oe){var be=oe.langExtension;try{var xe=N(oe.sourceNode,oe.pre),Pe=xe.sourceCode;oe.sourceCode=Pe,oe.spans=xe.spans,oe.basePos=0,K(be,Pe)(oe),Te(oe)}catch(De){H.console&&console.log(De&&De.stack||De)}}function c(oe,be,xe){var Pe=xe||!1,De=be||null,Oe=document.createElement("div");Oe.innerHTML="<pre>"+oe+"</pre>",Oe=Oe.firstChild,Pe&&Re(Oe,Pe,!0);var Ie={langExtension:De,numberLines:Pe,sourceNode:Oe,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return l(Ie),Oe.innerHTML}function D(oe,be){var xe=be||document.body,Pe=xe.ownerDocument||document;function De(ae){return xe.getElementsByTagName(ae)}for(var Oe=[De("pre"),De("code"),De("xmp")],Ie=[],He=0;He<Oe.length;++He)for(var Ve=0,Je=Oe[He].length;Ve<Je;++Ve)Ie.push(Oe[He][Ve]);Oe=null;var Xe=Date;Xe.now||(Xe={now:function(){return+new Date}});var We=0,Qe=/\blang(?:uage)?-([\w.]+)(?!\S)/,et=/\bprettyprint\b/,Ae=/\bprettyprinted\b/,ut=/pre|xmp/i,it=/^code$/i,se=/^(?:pre|code|xmp)$/i,q={};function ee(){for(var ae=H.PR_SHOULD_USE_CONTINUATION?Xe.now()+250:Infinity;We<Ie.length&&Xe.now()<ae;We++){for(var ue=Ie[We],te=q,ne=ue;ne=ne.previousSibling;){var de=ne.nodeType,fe=(de===7||de===8)&&ne.nodeValue;if(fe?!/^\??prettify\b/.test(fe):de!==3||/\S/.test(ne.nodeValue))break;if(fe){te={},fe.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Bt,Lt,Sr){te[Lt]=Sr});break}}var ve=ue.className;if((te!==q||et.test(ve))&&!Ae.test(ve)){for(var Ee=!1,Me=ue.parentNode;Me;Me=Me.parentNode){var Ge=Me.tagName;if(se.test(Ge)&&Me.className&&et.test(Me.className)){Ee=!0;break}}if(!Ee){ue.className+=" prettyprinted";var nt=te.lang;if(!nt){nt=ve.match(Qe);var at;!nt&&(at=he(ue))&&it.test(at.tagName)&&(nt=at.className.match(Qe)),nt&&(nt=nt[1])}var Tt;if(ut.test(ue.tagName))Tt=1;else{var ft=ue.currentStyle,dt=Pe.defaultView,Pt=ft?ft.whiteSpace:dt&&dt.getComputedStyle?dt.getComputedStyle(ue,null).getPropertyValue("white-space"):0;Tt=Pt&&Pt.substring(0,3)==="pre"}var At=te.linenums;(At=At==="true"||+At)||(At=ve.match(/\blinenums\b(?::(\d+))?/),At=At?At[1]&&At[1].length?+At[1]:!0:!1),At&&Re(ue,At,Tt);var Ht={langExtension:nt,sourceNode:ue,numberLines:At,pre:Tt,sourceCode:null,basePos:null,spans:null,decorations:null};l(Ht)}}}We<Ie.length?H.setTimeout(ee,250):typeof oe=="function"&&oe()}ee()}var X=H.PR={createSimpleLexer:me,registerLangHandler:ye,sourceDecorator:ke,PR_ATTRIB_NAME:I,PR_ATTRIB_VALUE:j,PR_COMMENT:E,PR_DECLARATION:v,PR_KEYWORD:f,PR_LITERAL:g,PR_NOCODE:z,PR_PLAIN:a,PR_PUNCTUATION:u,PR_SOURCE:S,PR_STRING:m,PR_TAG:b,PR_TYPE:p,prettyPrintOne:O?H.prettyPrintOne=c:k=c,prettyPrint:G=O?H.prettyPrint=D:G=D},U=H.define;typeof U=="function"&&U.amd&&U("google-code-prettify",[],function(){return X})})()},STEk:function(tt,Ke,le){"use strict";le.d(Ke,"a",function(){return ye});/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var ce=function(K,l){return(ce=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,D){c.__proto__=D}||function(c,D){for(var X in D)Object.prototype.hasOwnProperty.call(D,X)&&(c[X]=D[X])})(K,l)};function J(K,l){function c(){this.constructor=K}ce(K,l),K.prototype=l===null?Object.create(l):(c.prototype=l.prototype,new c)}function O(K,l,c,D){return new(c||(c=Promise))(function(X,U){function oe(Pe){try{xe(D.next(Pe))}catch(De){U(De)}}function be(Pe){try{xe(D.throw(Pe))}catch(De){U(De)}}function xe(Pe){var De;Pe.done?X(Pe.value):(De=Pe.value,De instanceof c?De:new c(function(Oe){Oe(De)})).then(oe,be)}xe((D=D.apply(K,l||[])).next())})}function Z(K,l){var c,D,X,U,oe={label:0,sent:function(){if(1&X[0])throw X[1];return X[1]},trys:[],ops:[]};return U={next:be(0),throw:be(1),return:be(2)},typeof Symbol=="function"&&(U[Symbol.iterator]=function(){return this}),U;function be(xe){return function(Pe){return function(De){if(c)throw new TypeError("Generator is already executing.");for(;oe;)try{if(c=1,D&&(X=2&De[0]?D.return:De[0]?D.throw||((X=D.return)&&X.call(D),0):D.next)&&!(X=X.call(D,De[1])).done)return X;switch(D=0,X&&(De=[2&De[0],X.value]),De[0]){case 0:case 1:X=De;break;case 4:return oe.label++,{value:De[1],done:!1};case 5:oe.label++,D=De[1],De=[0];continue;case 7:De=oe.ops.pop(),oe.trys.pop();continue;default:if(!(X=oe.trys,(X=X.length>0&&X[X.length-1])||De[0]!==6&&De[0]!==2)){oe=0;continue}if(De[0]===3&&(!X||De[1]>X[0]&&De[1]<X[3])){oe.label=De[1];break}if(De[0]===6&&oe.label<X[1]){oe.label=X[1],X=De;break}if(X&&oe.label<X[2]){oe.label=X[2],oe.ops.push(De);break}X[2]&&oe.ops.pop(),oe.trys.pop();continue}De=l.call(K,oe)}catch(Oe){De=[6,Oe],D=0}finally{c=X=0}if(5&De[0])throw De[1];return{value:De[0]?De[1]:void 0,done:!0}}([xe,Pe])}}}function F(){for(var K=0,l=0,c=arguments.length;l<c;l++)K+=arguments[l].length;var D=Array(K),X=0;for(l=0;l<c;l++)for(var U=arguments[l],oe=0,be=U.length;oe<be;oe++,X++)D[X]=U[oe];return D}var k=function(){function K(){}return K.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},K.setAttributes=function(l,c){for(var D=0,X=c;D<X.length;D++){var U=X[D],oe=U[0],be=U[1];l.setAttribute(oe,be)}},K.createRect=function(l,c,D){var X=document.createElementNS("http://www.w3.org/2000/svg","rect");return X.setAttribute("width",l.toString()),X.setAttribute("height",c.toString()),D&&K.setAttributes(X,D),X},K.createLine=function(l,c,D,X,U){var oe=document.createElementNS("http://www.w3.org/2000/svg","line");return oe.setAttribute("x1",l.toString()),oe.setAttribute("y1",c.toString()),oe.setAttribute("x2",D.toString()),oe.setAttribute("y2",X.toString()),U&&K.setAttributes(oe,U),oe},K.createPolygon=function(l,c){var D=document.createElementNS("http://www.w3.org/2000/svg","polygon");return D.setAttribute("points",l),c&&K.setAttributes(D,c),D},K.createCircle=function(l,c){var D=document.createElementNS("http://www.w3.org/2000/svg","circle");return D.setAttribute("cx",(l/2).toString()),D.setAttribute("cy",(l/2).toString()),D.setAttribute("r",l.toString()),c&&K.setAttributes(D,c),D},K.createEllipse=function(l,c,D){var X=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return X.setAttribute("cx",(l/2).toString()),X.setAttribute("cy",(c/2).toString()),X.setAttribute("rx",(l/2).toString()),X.setAttribute("ry",(c/2).toString()),D&&K.setAttributes(X,D),X},K.createGroup=function(l){var c=document.createElementNS("http://www.w3.org/2000/svg","g");return l&&K.setAttributes(c,l),c},K.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},K.createMarker=function(l,c,D,X,U,oe,be){var xe=document.createElementNS("http://www.w3.org/2000/svg","marker");return K.setAttributes(xe,[["id",l],["orient",c],["markerWidth",D.toString()],["markerHeight",X.toString()],["refX",U.toString()],["refY",oe.toString()]]),xe.appendChild(be),xe},K.createText=function(l){var c=document.createElementNS("http://www.w3.org/2000/svg","text");return c.setAttribute("x","0"),c.setAttribute("y","0"),l&&K.setAttributes(c,l),c},K.createTSpan=function(l,c){var D=document.createElementNS("http://www.w3.org/2000/svg","tspan");return D.textContent=l,c&&K.setAttributes(D,c),D},K.createImage=function(l){var c=document.createElementNS("http://www.w3.org/2000/svg","image");return l&&K.setAttributes(c,l),c},K.createPoint=function(l,c){var D=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return D.x=l,D.y=c,D},K.createPath=function(l,c){var D=document.createElementNS("http://www.w3.org/2000/svg","path");return D.setAttribute("d",l),c&&K.setAttributes(D,c),D},K}(),G=function(){function K(){}return K.addKey=function(l){K.key=l},Object.defineProperty(K,"isLicensed",{get:function(){return!!K.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(K.key)},enumerable:!1,configurable:!0}),K}(),H=function(){function K(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return K.prototype.rasterize=function(l,c,D){var X=this;return new Promise(function(U){var oe=D!==void 0?D:document.createElement("canvas");l===null&&(X.markersOnly=!0,X.naturalSize=!1);var be=document.createElementNS("http://www.w3.org/2000/svg","svg");be.setAttribute("xmlns","http://www.w3.org/2000/svg"),be.setAttribute("width",c.width.baseVal.valueAsString),be.setAttribute("height",c.height.baseVal.valueAsString),be.setAttribute("viewBox","0 0 "+c.viewBox.baseVal.width.toString()+" "+c.viewBox.baseVal.height.toString()),be.innerHTML=c.innerHTML,X.naturalSize===!0?(be.width.baseVal.value=l.naturalWidth,be.height.baseVal.value=l.naturalHeight):X.width!==void 0&&X.height!==void 0&&(be.width.baseVal.value=X.width,be.height.baseVal.value=X.height),oe.width=be.width.baseVal.value,oe.height=be.height.baseVal.value;var xe=be.outerHTML,Pe=oe.getContext("2d");X.markersOnly!==!0&&Pe.drawImage(l,0,0,oe.width,oe.height);var De=window.URL,Oe=new Image(oe.width,oe.height);Oe.setAttribute("crossOrigin","anonymous");var Ie=new Blob([xe],{type:"image/svg+xml"}),He=De.createObjectURL(Ie);Oe.onload=function(){Pe.drawImage(Oe,0,0),De.revokeObjectURL(He);var Ve=oe.toDataURL(X.imageType,X.imageQuality);U(Ve)},Oe.src=He})},K}(),B=function(){},R=function(){function K(l){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+l+"_"}return Object.defineProperty(K.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),K.prototype.addClass=function(l){return this.styleSheet===void 0&&this.addStyleSheet(),l.name=""+this.classNamePrefix+l.localName,this.classes.push(l),this.styleSheet.sheet.insertRule("."+l.name+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length),l},K.prototype.addRule=function(l){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(l),this.styleSheet.sheet.insertRule(l.selector+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length)},K.prototype.addStyleSheet=function(){var l;this.styleSheet=document.createElement("style"),((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).appendChild(this.styleSheet),this.addRule(new x("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new x("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new x("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new w("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new w("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},K.prototype.removeStyleSheet=function(){var l;this.styleSheet&&(((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},K}(),x=function(K,l){this.selector=K,this.style=l},w=function(K,l){this.localName=K,this.style=l},P=function(){function K(l,c,D,X,U){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=l,this.displayMode=c,this.markerItems=D,this.uiStyleSettings=X,this.styles=U,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return K.prototype.show=function(l){var c=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=l,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var D=document.createElement("div");D.className=this.toolbarBlockStyleClass.name,D.style.whiteSpace="nowrap",this.uiContainer.appendChild(D),this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(U){var oe=document.createElement("div");oe.className=""+c.toolbarButtonStyleClass.name,oe.setAttribute("data-type-name",U.typeName),oe.innerHTML=U.icon,oe.addEventListener("click",function(){c.markerToolbarButtonClicked(oe,U)}),c.buttons.push(oe),c.markerButtons.push(oe)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var X=document.createElement("div");X.className=this.toolbarBlockStyleClass.name,X.style.whiteSpace="nowrap",X.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(X),this.addActionButton(X,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(X,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},K.prototype.addButtonClickListener=function(l){this.buttonClickListeners.push(l)},K.prototype.removeButtonClickListener=function(l){this.buttonClickListeners.indexOf(l)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(l),1)},K.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},K.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var l=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var c=0;c<this.markerButtons.length;c++)c<l||c===l&&this.markerButtons.length-1===l?this.markerButtonBlock.appendChild(this.markerButtons[c]):(c===l&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[c]))}},K.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},K.prototype.resetButtonStyles=function(){var l=this;this.buttons.forEach(function(c){c.className=c.className.replace(l.uiStyleSettings.toolbarButtonStyleColorsClassName?l.uiStyleSettings.toolbarButtonStyleColorsClassName:l.toolbarButtonStyleColorsClass.name,"").trim(),c.className=c.className.replace(l.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?l.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:l.toolbarActiveButtonStyleColorsClass.name,"").trim(),c.className+=" "+(l.uiStyleSettings.toolbarButtonStyleColorsClassName?l.uiStyleSettings.toolbarButtonStyleColorsClassName:l.toolbarButtonStyleColorsClass.name)})},K.prototype.addActionButton=function(l,c,D){var X=this,U=document.createElement("div");switch(U.className=""+this.toolbarButtonStyleClass.name,U.innerHTML=c,U.setAttribute("data-action",D),U.addEventListener("click",function(){X.actionToolbarButtonClicked(U,D)}),D){case"select":U.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":U.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":U.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":U.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":U.style.fill=this.uiStyleSettings.closeButtonColor}l.appendChild(U),this.buttons.push(U)},K.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new w("toolbar",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
height: `+this.uiStyleSettings.toolbarHeight+`px;
box-sizing: content-box;
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolbarStyleColorsClass=this.styles.addClass(new w("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new w("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new w("toolbar-overflow-block",`
position: absolute;
top: `+this.uiStyleSettings.toolbarHeight+`px;
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
z-index: 10;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new w("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var l=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new w("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*l)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*l)+`px;
padding: `+l+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new w("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new w("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new x("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new x("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},K.prototype.markerToolbarButtonClicked=function(l,c){this.setActiveButton(l),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(D){return D("marker",c)}),this.markerButtonOverflowBlock.style.display="none"},K.prototype.actionToolbarButtonClicked=function(l,c){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(D){return D("action",c)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},K.prototype.setActiveButton=function(l){this.resetButtonStyles(),l.className=l.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),l.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},K.prototype.setActiveMarkerButton=function(l){var c=this.markerButtons.find(function(D){return D.getAttribute("data-type-name")===l});c&&this.setActiveButton(c)},K.prototype.setCurrentMarker=function(l){var c=this;this.currentMarker=l,this.buttons.filter(function(D){return/delete|notes/.test(D.getAttribute("data-action"))}).forEach(function(D){c.currentMarker===void 0?(D.style.fillOpacity="0.4",D.style.pointerEvents="none"):(D.style.fillOpacity="1",D.style.pointerEvents="all")})},K}(),L=function(){function K(l,c,D,X){this.panels=[],this.panelButtons=[],this.markerjsContainer=l,this.displayMode=c,this.uiStyleSettings=D,this.styles=X,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return K.prototype.addStyles=function(){var l;this.toolboxStyleClass=this.styles.addClass(new w("toolbox",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: column;
font-family: sans-serif;
`+(this.displayMode==="popup"?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+`
box-sizing: content-box;
`+(this.displayMode==="popup"?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+`
`+(this.displayMode==="inline"?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolboxStyleColorsClass=this.styles.addClass(new w("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var c=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new w("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new w("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new w("toolbox-panel-row",`
display: flex;
`+(this.displayMode==="inline"?"position: absolute;":"")+`
`+(this.displayMode==="inline"?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+`
cursor: default;
height: `+1.5*this.uiStyleSettings.toolbarHeight+`px;
`+(this.displayMode==="inline"?"width: 100%;":"")+`
box-sizing: content-box;
`)),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new w("toolbox-panel-row_colors",`
background-color: `+((l=this.uiStyleSettings.toolboxBackgroundColor)!==null&&l!==void 0?l:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new w("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
padding: `+c+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new w("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new w("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new x("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new x("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},K.prototype.show=function(l){var c;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=l,this.uiContainer.className=this.toolboxStyleClass.name+" "+((c=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&c!==void 0?c:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},K.prototype.setPanelButtons=function(l){var c,D,X=this;this.panels=l,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((c=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&c!==void 0?c:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((D=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&D!==void 0?D:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(U){var oe;U.uiStyleSettings=X.uiStyleSettings;var be=document.createElement("div");be.className=X.toolboxButtonStyleClass.name+" "+((oe=X.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&oe!==void 0?oe:X.toolboxButtonStyleColorsClass.name),be.innerHTML=U.icon,be.title=U.title,be.addEventListener("click",function(){X.panelButtonClick(U)}),X.panelButtons.push(be),X.buttonRow.appendChild(be)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},K.prototype.panelButtonClick=function(l){var c=this,D=-1;if(l!==this.activePanel){D=this.panels.indexOf(l),this.panelRow.innerHTML="";var X=l.getUi();X.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(X),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=l}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){c.displayMode==="inline"?c.panelRow.style.display="none":c.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(U,oe){var be,xe;U.className=c.toolboxButtonStyleClass.name+" "+(oe===D?""+((be=c.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&be!==void 0?be:c.toolboxActiveButtonStyleColorsClass.name):""+((xe=c.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&xe!==void 0?xe:c.toolboxButtonStyleColorsClass.name))})},K}(),A=function(K,l){this.title=K,this.icon=l},_=function(K){function l(c,D,X,U){var oe=K.call(this,c,U||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return oe.colors=[],oe.addTransparent=!1,oe.colorBoxes=[],oe.colors=D,oe.currentColor=X,oe.setCurrentColor=oe.setCurrentColor.bind(oe),oe.getColorBox=oe.getColorBox.bind(oe),oe}return J(l,K),l.prototype.getUi=function(){var c=this,D=document.createElement("div");return D.style.overflow="hidden",D.style.whiteSpace="nowrap",this.colors.forEach(function(X){var U=c.getColorBox(X);D.appendChild(U),c.colorBoxes.push(U)}),D},l.prototype.getColorBox=function(c){var D=this,X=this.uiStyleSettings.toolbarHeight/4,U=this.uiStyleSettings.toolbarHeight-X,oe=document.createElement("div");oe.style.display="inline-block",oe.style.boxSizing="content-box",oe.style.width=U-2+"px",oe.style.height=U-2+"px",oe.style.padding="1px",oe.style.marginRight="2px",oe.style.marginBottom="2px",oe.style.borderWidth="2px",oe.style.borderStyle="solid",oe.style.borderRadius=(U+2)/2+"px",oe.style.borderColor=c===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",oe.addEventListener("click",function(){D.setCurrentColor(c,oe)});var be=document.createElement("div");return be.style.display="inline-block",be.style.width=U-2+"px",be.style.height=U-2+"px",be.style.backgroundColor=c,be.style.borderRadius=U/2+"px",c==="transparent"&&(be.style.fill=this.uiStyleSettings.toolboxAccentColor,be.innerHTML=`<svg viewBox="0 0 24 24">
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
</svg>`),oe.appendChild(be),oe},l.prototype.setCurrentColor=function(c,D){var X=this;this.currentColor=c,this.colorBoxes.forEach(function(U){U.style.borderColor=U===D?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(c)},l}(A),h=function(){function K(l,c,D){this._state="new",this._isSelected=!1,this._container=l,this._overlayContainer=c,this.globalSettings=D,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(K.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),K.prototype.ownsTarget=function(l){return!1},Object.defineProperty(K.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),K.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},K.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},K.prototype.pointerDown=function(l,c){},K.prototype.dblClick=function(l,c){},K.prototype.manipulate=function(l){},K.prototype.pointerUp=function(l){this.stateChanged()},K.prototype.dispose=function(){},K.prototype.addMarkerVisualToContainer=function(l){this.container.childNodes.length>0?this.container.insertBefore(l,this.container.childNodes[0]):this.container.appendChild(l)},K.prototype.getState=function(){return{typeName:K.typeName,state:this.state,notes:this.notes}},K.prototype.restoreState=function(l){this._state=l.state,this.notes=l.notes},K.prototype.scale=function(l,c){},K.prototype.colorChanged=function(l){this.onColorChanged&&this.onColorChanged(l),this.stateChanged()},K.prototype.fillColorChanged=function(l){this.onFillColorChanged&&this.onFillColorChanged(l),this.stateChanged()},K.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var l=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),l.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(l)&&this.onStateChanged(this)}},K.typeName="MarkerBase",K}(),o=function(){function K(){this.findGripByVisual=this.findGripByVisual.bind(this)}return K.prototype.findGripByVisual=function(l){return this.topLeft.ownsTarget(l)?this.topLeft:this.topCenter.ownsTarget(l)?this.topCenter:this.topRight.ownsTarget(l)?this.topRight:this.centerLeft.ownsTarget(l)?this.centerLeft:this.centerRight.ownsTarget(l)?this.centerRight:this.bottomLeft.ownsTarget(l)?this.bottomLeft:this.bottomCenter.ownsTarget(l)?this.bottomCenter:this.bottomRight.ownsTarget(l)?this.bottomRight:void 0},K}(),s=function(){function K(){this.GRIP_SIZE=10,this.visual=k.createGroup(),this.visual.appendChild(k.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(k.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return K.prototype.ownsTarget=function(l){return l===this.visual||l===this.visual.childNodes[0]||l===this.visual.childNodes[1]},K}(),d=function(){function K(){}return K.toITransformMatrix=function(l){return{a:l.a,b:l.b,c:l.c,d:l.d,e:l.e,f:l.f}},K.toSVGMatrix=function(l,c){return l.a=c.a,l.b=c.b,l.c=c.c,l.d=c.d,l.e=c.e,l.f=c.f,l},K}(),T=function(K){function l(c,D,X){var U=K.call(this,c,D,X)||this;return U.left=0,U.top=0,U.width=0,U.height=0,U.defaultSize={x:50,y:20},U.offsetX=0,U.offsetY=0,U.rotationAngle=0,U.CB_DISTANCE=10,U._suppressMarkerCreateEvent=!1,U.container.transform.baseVal.appendItem(k.createTransform()),U.setupControlBox(),U}return J(l,K),Object.defineProperty(l.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"visual",{get:function(){return this._visual},set:function(c){this._visual=c;var D=k.createTransform();this._visual.transform.baseVal.appendItem(D)},enumerable:!1,configurable:!0}),l.prototype.ownsTarget=function(c){return!!K.prototype.ownsTarget.call(this,c)||!!(this.controlGrips.findGripByVisual(c)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(c))},l.prototype.pointerDown=function(c,D){K.prototype.pointerDown.call(this,c,D),this.state==="new"&&(this.left=c.x,this.top=c.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var X=this.unrotatePoint(c);if(this.manipulationStartX=X.x,this.manipulationStartY=X.y,this.offsetX=X.x-this.left,this.offsetY=X.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(D),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(D)){this.activeGrip=this.rotatorGrip;var U=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=U.x-this.width/2,this.top=U.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var oe=this.container.transform.baseVal.getItem(0);oe.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(oe,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},l.prototype.pointerUp=function(c){var D=this.state;K.prototype.pointerUp.call(this,c),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(c),this._state="select",D==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},l.prototype.moveVisual=function(c){this.visual.style.transform="translate("+c.x+"px, "+c.y+"px)"},l.prototype.manipulate=function(c){var D=this.unrotatePoint(c);this.state==="creating"?this.resize(c):this.state==="move"?(this.left=this.manipulationStartLeft+(D.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(D.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(D):this.state==="rotate"&&this.rotate(c)},l.prototype.resize=function(c){var D=this.manipulationStartLeft,X=this.manipulationStartWidth,U=this.manipulationStartTop,oe=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:D=this.manipulationStartLeft+c.x-this.manipulationStartX,X=this.manipulationStartWidth+this.manipulationStartLeft-D;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:X=this.manipulationStartWidth+c.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:U=this.manipulationStartTop+c.y-this.manipulationStartY,oe=this.manipulationStartHeight+this.manipulationStartTop-U;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:oe=this.manipulationStartHeight+c.y-this.manipulationStartY}X>=0?(this.left=D,this.width=X):(this.left=D+X,this.width=-X),oe>=0?(this.top=U,this.height=oe):(this.top=U+oe,this.height=-oe),this.setSize()},l.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},l.prototype.rotate=function(c){if(Math.abs(c.x-this.centerX)>.1){var D=Math.sign(c.x-this.centerX);this.rotationAngle=180*Math.atan((c.y-this.centerY)/(c.x-this.centerX))/Math.PI+90*D,this.applyRotation()}},l.prototype.applyRotation=function(){var c=this.container.transform.baseVal.getItem(0);c.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(c,0)},l.prototype.rotatePoint=function(c){if(this.rotationAngle===0)return c;var D=this.container.getCTM(),X=k.createPoint(c.x,c.y);return{x:(X=X.matrixTransform(D)).x,y:X.y}},l.prototype.unrotatePoint=function(c){if(this.rotationAngle===0)return c;var D=this.container.getCTM();D=D.inverse();var X=k.createPoint(c.x,c.y);return{x:(X=X.matrixTransform(D)).x,y:X.y}},l.prototype.select=function(){K.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},l.prototype.deselect=function(){K.prototype.deselect.call(this),this.controlBox.style.display="none"},l.prototype.setupControlBox=function(){this.controlBox=k.createGroup();var c=k.createTransform();c.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(c),this.container.appendChild(this.controlBox),this.controlRect=k.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=k.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new o,this.addControlGrips(),this.controlBox.style.display="none"},l.prototype.adjustControlBox=function(){var c=this.controlBox.transform.baseVal.getItem(0);c.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(c,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},l.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},l.prototype.createGrip=function(){var c=new s;return c.visual.transform.baseVal.appendItem(k.createTransform()),this.controlBox.appendChild(c.visual),c},l.prototype.positionGrips=function(){var c=this.controlGrips.topLeft.GRIP_SIZE,D=-c/2,X=D,U=(this.width+this.CB_DISTANCE)/2-c/2,oe=(this.height+this.CB_DISTANCE)/2-c/2,be=this.height+this.CB_DISTANCE-c/2,xe=this.width+this.CB_DISTANCE-c/2;this.positionGrip(this.controlGrips.topLeft.visual,D,X),this.positionGrip(this.controlGrips.topCenter.visual,U,X),this.positionGrip(this.controlGrips.topRight.visual,xe,X),this.positionGrip(this.controlGrips.centerLeft.visual,D,oe),this.positionGrip(this.controlGrips.centerRight.visual,xe,oe),this.positionGrip(this.controlGrips.bottomLeft.visual,D,be),this.positionGrip(this.controlGrips.bottomCenter.visual,U,be),this.positionGrip(this.controlGrips.bottomRight.visual,xe,be),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,U,X-3*this.CB_DISTANCE)},l.prototype.positionGrip=function(c,D,X){var U=c.transform.baseVal.getItem(0);U.setTranslate(D,X),c.transform.baseVal.replaceItem(U,0)},l.prototype.hideControlBox=function(){this.controlBox.style.display="none"},l.prototype.showControlBox=function(){this.controlBox.style.display=""},l.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:d.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:d.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},K.prototype.getState.call(this))},l.prototype.restoreState=function(c){K.prototype.restoreState.call(this,c);var D=c;this.left=D.left,this.top=D.top,this.width=D.width,this.height=D.height,this.rotationAngle=D.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(d.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,D.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(d.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,D.containerTransformMatrix))},l.prototype.scale=function(c,D){K.prototype.scale.call(this,c,D);var X=this.rotatePoint({x:this.left,y:this.top}),U=this.unrotatePoint({x:X.x*c,y:X.y*D});this.left=U.x,this.top=U.y,this.width=this.width*c,this.height=this.height*D,this.adjustControlBox()},l}(h),y=function(K){function l(c,D,X){var U=K.call(this,c,D,X)||this;return U.fillColor="transparent",U.strokeColor="transparent",U.strokeWidth=0,U.strokeDasharray="",U.opacity=1,U.setStrokeColor=U.setStrokeColor.bind(U),U.setFillColor=U.setFillColor.bind(U),U.setStrokeWidth=U.setStrokeWidth.bind(U),U.setStrokeDasharray=U.setStrokeDasharray.bind(U),U.createVisual=U.createVisual.bind(U),U}return J(l,K),l.prototype.ownsTarget=function(c){return!(!K.prototype.ownsTarget.call(this,c)&&c!==this.visual)},l.prototype.createVisual=function(){this.visual=k.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(c,D){K.prototype.pointerDown.call(this,c,D),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},l.prototype.manipulate=function(c){K.prototype.manipulate.call(this,c)},l.prototype.resize=function(c){K.prototype.resize.call(this,c),this.setSize()},l.prototype.setSize=function(){K.prototype.setSize.call(this),k.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},l.prototype.pointerUp=function(c){K.prototype.pointerUp.call(this,c),this.setSize()},l.prototype.setStrokeColor=function(c){this.strokeColor=c,this.visual&&k.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(c),this.stateChanged()},l.prototype.setFillColor=function(c){this.fillColor=c,this.visual&&k.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},l.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.visual&&k.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},l.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.visual&&k.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},l.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},K.prototype.getState.call(this))},l.prototype.restoreState=function(c){var D=c;this.fillColor=D.fillColor,this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.opacity=D.opacity,this.createVisual(),K.prototype.restoreState.call(this,c),this.setSize()},l.prototype.scale=function(c,D){K.prototype.scale.call(this,c,D),this.setSize()},l.title="Rectangle marker",l}(T),m=function(K){function l(c,D,X,U){var oe=K.call(this,c,U||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return oe.widths=[],oe.widthBoxes=[],oe.widths=D,oe.currentWidth=X,oe.setCurrentWidth=oe.setCurrentWidth.bind(oe),oe}return J(l,K),l.prototype.getUi=function(){var c=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",this.widths.forEach(function(X){var U=document.createElement("div");U.style.display="flex",U.style.flexGrow="2",U.style.alignItems="center",U.style.justifyContent="space-between",U.style.padding="5px",U.style.borderWidth="2px",U.style.borderStyle="solid",U.style.borderColor=X===c.currentWidth?c.uiStyleSettings.toolboxAccentColor:"transparent",U.addEventListener("click",function(){c.setCurrentWidth(X,U)}),D.appendChild(U);var oe=document.createElement("div");oe.innerText=X.toString(),oe.style.marginRight="5px",U.appendChild(oe);var be=document.createElement("div");be.style.minHeight="20px",be.style.flexGrow="2",be.style.display="flex",be.style.alignItems="center";var xe=document.createElement("hr");xe.style.minWidth="20px",xe.style.border="0px",xe.style.borderTop=X+"px solid "+c.uiStyleSettings.toolboxColor,xe.style.flexGrow="2",be.appendChild(xe),U.appendChild(be),c.widthBoxes.push(U)}),D},l.prototype.setCurrentWidth=function(c,D){var X=this;this.currentWidth=c,this.widthBoxes.forEach(function(U){U.style.borderColor=U===D?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},l}(A),f=function(K){function l(c,D,X,U){var oe=K.call(this,c,U||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return oe.styles=[],oe.styleBoxes=[],oe.styles=D,oe.currentStyle=X,oe.setCurrentStyle=oe.setCurrentStyle.bind(oe),oe}return J(l,K),l.prototype.getUi=function(){var c=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",this.styles.forEach(function(X){var U=document.createElement("div");U.style.display="flex",U.style.alignItems="center",U.style.justifyContent="space-between",U.style.padding="5px",U.style.borderWidth="2px",U.style.borderStyle="solid",U.style.overflow="hidden",U.style.maxWidth=100/c.styles.length-5+"%",U.style.borderColor=X===c.currentStyle?c.uiStyleSettings.toolboxAccentColor:"transparent",U.addEventListener("click",function(){c.setCurrentStyle(X,U)}),D.appendChild(U);var oe=document.createElement("div");oe.style.minHeight="20px",oe.style.flexGrow="2",oe.style.overflow="hidden";var be=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+c.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(X!==""?'stroke-dasharray="'+X+'"':"")+` />
</svg>`;oe.innerHTML=be,U.appendChild(oe),c.styleBoxes.push(U)}),D},l.prototype.setCurrentStyle=function(c,D){var X=this;this.currentStyle=c,this.styleBoxes.forEach(function(U){U.style.borderColor=U===D?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},l}(A),E=function(K){function l(c,D,X){var U=K.call(this,c,D,X)||this;return U.strokeColor=X.defaultColor,U.strokeWidth=X.defaultStrokeWidth,U.strokeDasharray=X.defaultStrokeDasharray,U.strokePanel=new _("Line color",X.defaultColorSet,X.defaultColor),U.strokePanel.onColorChanged=U.setStrokeColor,U.strokeWidthPanel=new m("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),U.strokeWidthPanel.onWidthChanged=U.setStrokeWidth,U.strokeStylePanel=new f("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),U.strokeStylePanel.onStyleChanged=U.setStrokeDasharray,U}return J(l,K),Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var c=K.prototype.getState.call(this);return c.typeName=l.typeName,c},l.typeName="FrameMarker",l.title="Frame marker",l.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',l}(y),p=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},g=function(K){function l(c,D,X){var U=K.call(this,c,D,X)||this;return U.x1=0,U.y1=0,U.x2=0,U.y2=0,U.defaultLength=50,U.manipulationStartX=0,U.manipulationStartY=0,U.manipulationStartX1=0,U.manipulationStartY1=0,U.manipulationStartX2=0,U.manipulationStartY2=0,U.setupControlBox(),U}return J(l,K),l.prototype.ownsTarget=function(c){return!!K.prototype.ownsTarget.call(this,c)||!(!this.grip1.ownsTarget(c)&&!this.grip2.ownsTarget(c))},l.prototype.pointerDown=function(c,D){K.prototype.pointerDown.call(this,c,D),this.manipulationStartX=c.x,this.manipulationStartY=c.y,this.state==="new"&&(this.x1=c.x,this.y1=c.y,this.x2=c.x,this.y2=c.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(D)?this.activeGrip=this.grip1:this.grip2.ownsTarget(D)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},l.prototype.pointerUp=function(c){var D=this.state;K.prototype.pointerUp.call(this,c),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(c),this._state="select",D==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},l.prototype.adjustVisual=function(){},l.prototype.manipulate=function(c){this.state==="creating"?this.resize(c):this.state==="move"?(this.x1=this.manipulationStartX1+c.x-this.manipulationStartX,this.y1=this.manipulationStartY1+c.y-this.manipulationStartY,this.x2=this.manipulationStartX2+c.x-this.manipulationStartX,this.y2=this.manipulationStartY2+c.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(c)},l.prototype.resize=function(c){switch(this.activeGrip){case this.grip1:this.x1=c.x,this.y1=c.y;break;case this.grip2:case void 0:this.x2=c.x,this.y2=c.y}this.adjustVisual(),this.adjustControlBox()},l.prototype.select=function(){K.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},l.prototype.deselect=function(){K.prototype.deselect.call(this),this.controlBox.style.display="none"},l.prototype.setupControlBox=function(){this.controlBox=k.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},l.prototype.adjustControlBox=function(){this.positionGrips()},l.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},l.prototype.createGrip=function(){var c=new s;return c.visual.transform.baseVal.appendItem(k.createTransform()),this.controlBox.appendChild(c.visual),c},l.prototype.positionGrips=function(){var c=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-c/2,this.y1-c/2),this.positionGrip(this.grip2.visual,this.x2-c/2,this.y2-c/2)},l.prototype.positionGrip=function(c,D,X){var U=c.transform.baseVal.getItem(0);U.setTranslate(D,X),c.transform.baseVal.replaceItem(U,0)},l.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},K.prototype.getState.call(this))},l.prototype.restoreState=function(c){K.prototype.restoreState.call(this,c);var D=c;this.x1=D.x1,this.y1=D.y1,this.x2=D.x2,this.y2=D.y2},l.prototype.scale=function(c,D){K.prototype.scale.call(this,c,D),this.x1=this.x1*c,this.y1=this.y1*D,this.x2=this.x2*c,this.y2=this.y2*D,this.adjustVisual(),this.adjustControlBox()},l}(h),u=function(K){function l(c,D,X){var U=K.call(this,c,D,X)||this;return U.strokeColor="transparent",U.strokeWidth=0,U.strokeDasharray="",U.setStrokeColor=U.setStrokeColor.bind(U),U.setStrokeWidth=U.setStrokeWidth.bind(U),U.setStrokeDasharray=U.setStrokeDasharray.bind(U),U.strokeColor=X.defaultColor,U.strokeWidth=X.defaultStrokeWidth,U.strokeDasharray=X.defaultStrokeDasharray,U.strokePanel=new _("Line color",X.defaultColorSet,X.defaultColor),U.strokePanel.onColorChanged=U.setStrokeColor,U.strokeWidthPanel=new m("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),U.strokeWidthPanel.onWidthChanged=U.setStrokeWidth,U.strokeStylePanel=new f("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),U.strokeStylePanel.onStyleChanged=U.setStrokeDasharray,U}return J(l,K),l.prototype.ownsTarget=function(c){return!(!K.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.selectorLine&&c!==this.visibleLine)},l.prototype.createVisual=function(){this.visual=k.createGroup(),this.selectorLine=k.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=k.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(c,D){K.prototype.pointerDown.call(this,c,D),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},l.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),k.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),k.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),k.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},l.prototype.setStrokeColor=function(c){this.strokeColor=c,this.adjustVisual(),this.colorChanged(c)},l.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.adjustVisual()},l.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.adjustVisual(),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var c=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},K.prototype.getState.call(this));return c.typeName=l.typeName,c},l.prototype.restoreState=function(c){K.prototype.restoreState.call(this,c);var D=c;this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.createVisual(),this.adjustVisual()},l.typeName="LineMarker",l.title="Line marker",l.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',l}(g),a=function(K){function l(c,D,X,U){var oe=K.call(this,c,U||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return oe.fonts=[],oe.fontBoxes=[],oe.fonts=D,oe.currentFont=X,oe.setCurrentFont=oe.setCurrentFont.bind(oe),oe}return J(l,K),l.prototype.getUi=function(){var c=this,D=document.createElement("div");return D.style.overflow="hidden",D.style.flexGrow="2",this.fonts.forEach(function(X){var U=document.createElement("div");U.style.display="inline-block",U.style.alignItems="center",U.style.justifyContent="space-between",U.style.padding="5px",U.style.borderWidth="2px",U.style.borderStyle="solid",U.style.overflow="hidden",U.style.maxWidth=100/c.fonts.length-5+"%",U.style.borderColor=X===c.currentFont?c.uiStyleSettings.toolboxAccentColor:"transparent",U.addEventListener("click",function(){c.setCurrentFont(X,U)}),D.appendChild(U);var oe=document.createElement("div");oe.style.display="flex",oe.style.minHeight="20px",oe.style.flexGrow="2",oe.style.fontFamily=X,oe.style.overflow="hidden";var be=document.createElement("div");be.style.whiteSpace="nowrap",be.style.overflow="hidden",be.style.textOverflow="ellipsis",be.innerHTML="The quick brown fox jumps over the lazy dog",oe.appendChild(be),U.appendChild(oe),c.fontBoxes.push(U)}),D},l.prototype.setCurrentFont=function(c,D){var X=this;this.currentFont=c,this.fontBoxes.forEach(function(U){U.style.borderColor=U===D?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},l}(A),b=function(K){function l(c,D,X){var U=K.call(this,c,D,X)||this;return U.color="transparent",U.padding=5,U.DEFAULT_TEXT="your text here",U.text=U.DEFAULT_TEXT,U.isMoved=!1,U.color=X.defaultColor,U.fontFamily=X.defaultFontFamily,U.defaultSize={x:100,y:30},U.setColor=U.setColor.bind(U),U.setFont=U.setFont.bind(U),U.renderText=U.renderText.bind(U),U.sizeText=U.sizeText.bind(U),U.textEditDivClicked=U.textEditDivClicked.bind(U),U.showTextEditor=U.showTextEditor.bind(U),U.setSize=U.setSize.bind(U),U.positionTextEditor=U.positionTextEditor.bind(U),U.colorPanel=new _("Color",X.defaultColorSet,X.defaultColor),U.colorPanel.onColorChanged=U.setColor,U.fontFamilyPanel=new a("Font",X.defaultFontFamilies,X.defaultFontFamily),U.fontFamilyPanel.onFontChanged=U.setFont,U}return J(l,K),l.prototype.ownsTarget=function(c){if(K.prototype.ownsTarget.call(this,c)||c===this.visual||c===this.textElement||c===this.bgRectangle)return!0;var D=!1;return this.textElement.childNodes.forEach(function(X){X===c&&(D=!0)}),D},l.prototype.createVisual=function(){this.visual=k.createGroup(),this.bgRectangle=k.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=k.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(k.createTransform()),this.textElement.transform.baseVal.appendItem(k.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},l.prototype.pointerDown=function(c,D){K.prototype.pointerDown.call(this,c,D),this.isMoved=!1,this.pointerDownPoint=c,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},l.prototype.renderText=function(){var c=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(D){c.textElement.appendChild(k.createTSpan(D.trim()===""?" ":D.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},l.prototype.getTextScale=function(){var c=this.textElement.getBBox(),D=1;if(c.width>0&&c.height>0){var X=(1*this.width-this.width*this.padding*2/100)/c.width,U=(1*this.height-this.height*this.padding*2/100)/c.height;D=Math.min(X,U)}return D},l.prototype.getTextPosition=function(c){var D=this.textElement.getBBox(),X=0,U=0;return D.width>0&&D.height>0&&(X=(this.width-D.width*c)/2,U=this.height/2-D.height*c/2),{x:X,y:U}},l.prototype.sizeText=function(){var c=this.textElement.getBBox(),D=this.getTextScale(),X=this.getTextPosition(D);X.y-=c.y*D,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+X.x+"px, "+X.y+"px) scale("+D+", "+D+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(X.x,X.y),this.textElement.transform.baseVal.getItem(1).setScale(D,D))},l.prototype.manipulate=function(c){K.prototype.manipulate.call(this,c),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(c.x-this.pointerDownPoint.x)>5||Math.abs(c.y-this.pointerDownPoint.y)>5)},l.prototype.resize=function(c){K.prototype.resize.call(this,c),this.isMoved=!0,this.setSize(),this.sizeText()},l.prototype.setSize=function(){K.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(k.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),k.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},l.prototype.pointerUp=function(c){var D=this.state;D==="creating"&&(this._suppressMarkerCreateEvent=!0),K.prototype.pointerUp.call(this,c),this.setSize(),(D==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},l.prototype.showTextEditor=function(){var c=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(D){D.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var D=Number.parseFloat(c.textEditor.style.fontSize);c.textEditor.clientWidth>=Number.parseInt(c.textEditor.style.maxWidth)&&D>.9;)D-=.1,c.textEditor.style.fontSize=Math.max(D,.9)+"em"}),this.textEditor.addEventListener("keyup",function(D){D.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(D){if(D.clipboardData){var X=D.clipboardData.getData("text"),U=window.getSelection();if(!U.rangeCount)return!1;U.deleteFromDocument(),U.getRangeAt(0).insertNode(document.createTextNode(X)),D.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){c.textEditDivClicked(c.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},l.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var c=this.getTextScale(),D=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),X=this.textElement.getBBox(),U={x:X.width*c,y:X.height*c};D.x-=U.x/2,D.y-=U.y/2,this.textEditor.style.top=D.y+"px",this.textEditor.style.left=D.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-D.x+"px",this.textEditor.style.fontSize=Math.max(16*c,12)+"px",this.textElement.style.display="none"}},l.prototype.textEditDivClicked=function(c){this.text=c.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},l.prototype.select=function(){K.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},l.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),K.prototype.deselect.call(this)},l.prototype.dblClick=function(c,D){K.prototype.dblClick.call(this,c,D),this.showTextEditor()},l.prototype.setColor=function(c){this.textElement&&k.setAttributes(this.textElement,[["fill",c]]),this.color=c,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(c)},l.prototype.setFont=function(c){this.textElement&&k.setAttributes(this.textElement,[["font-family",c]]),this.fontFamily=c,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},l.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},l.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var c=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},K.prototype.getState.call(this));return c.typeName=l.typeName,c},l.prototype.restoreState=function(c){var D=c;this.color=D.color,this.fontFamily=D.fontFamily,this.padding=D.padding,this.text=D.text,this.createVisual(),K.prototype.restoreState.call(this,c),this.setSize()},l.prototype.scale=function(c,D){K.prototype.scale.call(this,c,D),this.setSize(),this.sizeText(),this.positionTextEditor()},l.typeName="TextMarker",l.title="Text marker",l.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',l}(T),v=function(K){function l(c,D,X){var U=K.call(this,c,D,X)||this;return U.color="transparent",U.lineWidth=3,U.drawing=!1,U.pixelRatio=1,U.color=X.defaultColor,U.lineWidth=X.defaultStrokeWidth,U.pixelRatio=X.freehandPixelRatio,U.setColor=U.setColor.bind(U),U.addCanvas=U.addCanvas.bind(U),U.finishCreation=U.finishCreation.bind(U),U.setLineWidth=U.setLineWidth.bind(U),U.colorPanel=new _("Color",X.defaultColorSet,X.defaultColor),U.colorPanel.onColorChanged=U.setColor,U.lineWidthPanel=new m("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),U.lineWidthPanel.onWidthChanged=U.setLineWidth,U}return J(l,K),l.prototype.ownsTarget=function(c){return!(!K.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.drawingImage)},l.prototype.createVisual=function(){this.visual=k.createGroup(),this.drawingImage=k.createImage(),this.visual.appendChild(this.drawingImage);var c=k.createTransform();this.visual.transform.baseVal.appendItem(c),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(c,D){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(c.x,c.y),this.drawing=!0):K.prototype.pointerDown.call(this,c,D)},l.prototype.manipulate=function(c){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(c.x,c.y),this.canvasContext.stroke()):K.prototype.manipulate.call(this,c)},l.prototype.resize=function(c){K.prototype.resize.call(this,c),k.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),k.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},l.prototype.pointerUp=function(c){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):K.prototype.pointerUp.call(this,c)},l.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},l.prototype.select=function(){this.state==="creating"&&this.finishCreation(),K.prototype.select.call(this)},l.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),K.prototype.deselect.call(this)},l.prototype.finishCreation=function(){for(var c=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),D=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],X=D[0],U=D[1],oe=D[2],be=D[3],xe=!1,Pe=0;Pe<this.canvasElement.height;Pe++)for(var De=0;De<this.canvasElement.width;De++)c.data[Pe*this.canvasElement.width*4+4*De+3]>0&&(xe=!0,Pe<U&&(U=Pe),De<X&&(X=De),Pe>be&&(be=Pe),De>oe&&(oe=De));if(xe){this.left=X/this.pixelRatio,this.top=U/this.pixelRatio,this.width=(oe-X)/this.pixelRatio,this.height=(be-U)/this.pixelRatio;var Oe=document.createElement("canvas");Oe.width=oe-X,Oe.height=be-U,Oe.getContext("2d").putImageData(this.canvasContext.getImageData(X,U,oe-X,be-U),0,0),this.drawingImgUrl=Oe.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},l.prototype.setDrawingImage=function(){k.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),k.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},l.prototype.setColor=function(c){this.color=c,this.colorChanged(c)},l.prototype.setLineWidth=function(c){this.lineWidth=c},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var c=Object.assign({drawingImgUrl:this.drawingImgUrl},K.prototype.getState.call(this));return c.typeName=l.typeName,c},l.prototype.restoreState=function(c){this.createVisual(),K.prototype.restoreState.call(this,c),this.drawingImgUrl=c.drawingImgUrl,this.setDrawingImage()},l.prototype.scale=function(c,D){K.prototype.scale.call(this,c,D),this.setDrawingImage()},l.typeName="FreehandMarker",l.title="Freehand marker",l.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',l}(T),S=function(K){function l(c,D,X){var U=K.call(this,c,X||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return U.typeBoxes=[],U.currentType=D,U.setCurrentType=U.setCurrentType.bind(U),U}return J(l,K),l.prototype.getUi=function(){var c=this,D=document.createElement("div");D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2";for(var X=function(be){var xe="both";switch(be){case 0:xe="both";break;case 1:xe="start";break;case 2:xe="end";break;case 3:xe="none"}var Pe=document.createElement("div");if(Pe.style.display="flex",Pe.style.flexGrow="2",Pe.style.alignItems="center",Pe.style.justifyContent="space-between",Pe.style.padding="5px",Pe.style.borderWidth="2px",Pe.style.borderStyle="solid",Pe.style.borderColor=xe===U.currentType?U.uiStyleSettings.toolboxAccentColor:"transparent",Pe.addEventListener("click",function(){c.setCurrentType(xe,Pe)}),D.appendChild(Pe),xe==="both"||xe==="start"){var De=document.createElement("div");De.style.display="flex",De.style.alignItems="center",De.style.minHeight="20px",De.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,5 10,0 10,10" fill="`+(U.uiStyleSettings!==void 0?U.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,De.style.marginLeft="5px",Pe.appendChild(De)}var Oe=document.createElement("div");Oe.style.display="flex",Oe.style.alignItems="center",Oe.style.minHeight="20px",Oe.style.flexGrow="2";var Ie=document.createElement("hr");if(Ie.style.minWidth="20px",Ie.style.border="0px",Ie.style.borderTop="3px solid "+(U.uiStyleSettings!==void 0?U.uiStyleSettings.toolboxColor:"#eeeeee"),Ie.style.flexGrow="2",Oe.appendChild(Ie),Pe.appendChild(Oe),xe==="both"||xe==="end"){var He=document.createElement("div");He.style.display="flex",He.style.alignItems="center",He.style.minHeight="20px",He.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,0 10,5 0,10" fill="`+(U.uiStyleSettings!==void 0?U.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,He.style.marginRight="5px",Pe.appendChild(He)}U.typeBoxes.push(Pe)},U=this,oe=0;oe<4;oe++)X(oe);return D},l.prototype.setCurrentType=function(c,D){var X=this;this.currentType=c,this.typeBoxes.forEach(function(U){U.style.borderColor=U===D?X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},l}(A),I=function(K){function l(c,D,X){var U=K.call(this,c,D,X)||this;return U.arrowType="end",U.arrowBaseHeight=10,U.arrowBaseWidth=10,U.getArrowPoints=U.getArrowPoints.bind(U),U.setArrowType=U.setArrowType.bind(U),U.arrowTypePanel=new S("Arrow type","end"),U.arrowTypePanel.onArrowTypeChanged=U.setArrowType,U}return J(l,K),l.prototype.ownsTarget=function(c){return!(!K.prototype.ownsTarget.call(this,c)&&c!==this.arrow1&&c!==this.arrow2)},l.prototype.getArrowPoints=function(c,D){var X=this.arrowBaseWidth+2*this.strokeWidth,U=this.arrowBaseHeight+2*this.strokeWidth;return c-X/2+","+(D+U/2)+" "+c+","+(D-U/2)+" "+(c+X/2)+","+(D+U/2)},l.prototype.createTips=function(){this.arrow1=k.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(k.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=k.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(k.createTransform()),this.visual.appendChild(this.arrow2)},l.prototype.pointerDown=function(c,D){K.prototype.pointerDown.call(this,c,D),this.state==="creating"&&this.createTips()},l.prototype.adjustVisual=function(){if(K.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",k.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),k.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var c=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),D=this.arrow1.transform.baseVal.getItem(0);D.setRotate(c,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(D,0);var X=this.arrow2.transform.baseVal.getItem(0);X.setRotate(c+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(X,0)}},l.prototype.setArrowType=function(c){this.arrowType=c,this.adjustVisual(),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var c=Object.assign({arrowType:this.arrowType},K.prototype.getState.call(this));return c.typeName=l.typeName,c},l.prototype.restoreState=function(c){K.prototype.restoreState.call(this,c);var D=c;this.arrowType=D.arrowType,this.createTips(),this.adjustVisual()},l.typeName="ArrowMarker",l.title="Arrow marker",l.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',l}(u),j=function(K){function l(c,D,X){var U=K.call(this,c,D,X)||this;return U.fillColor=X.defaultFillColor,U.strokeWidth=0,U.fillPanel=new _("Color",X.defaultColorSet,X.defaultFillColor),U.fillPanel.onColorChanged=U.setFillColor,U}return J(l,K),Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var c=K.prototype.getState.call(this);return c.typeName=l.typeName,c},l.typeName="CoverMarker",l.title="Cover marker",l.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',l}(y),z=function(K){function l(c,D,X,U){var oe=K.call(this,c,U||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return oe.opacities=[],oe.opacityBoxes=[],oe.opacities=D,oe.currentOpacity=X,oe.setCurrentOpacity=oe.setCurrentOpacity.bind(oe),oe}return J(l,K),l.prototype.getUi=function(){var c=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",D.style.justifyContent="space-between",this.opacities.forEach(function(X){var U=document.createElement("div");U.style.display="flex",U.style.alignItems="center",U.style.justifyContent="center",U.style.padding="5px",U.style.borderWidth="2px",U.style.borderStyle="solid",U.style.borderColor=X===c.currentOpacity?c.uiStyleSettings.toolboxAccentColor:"transparent",U.addEventListener("click",function(){c.setCurrentOpacity(X,U)}),D.appendChild(U);var oe=document.createElement("div");oe.innerText=100*X+"%",U.appendChild(oe),c.opacityBoxes.push(U)}),D},l.prototype.setCurrentOpacity=function(c,D){var X=this;this.currentOpacity=c,this.opacityBoxes.forEach(function(U){U.style.borderColor=U===D?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},l}(A),V=function(K){function l(c,D,X){var U=K.call(this,c,D,X)||this;return U.setOpacity=U.setOpacity.bind(U),U.fillColor=X.defaultHighlightColor,U.strokeWidth=0,U.opacity=X.defaultHighlightOpacity,U.fillPanel=new _("Color",X.defaultColorSet,U.fillColor),U.fillPanel.onColorChanged=U.setFillColor,U.opacityPanel=new z("Opacity",X.defaultOpacitySteps,U.opacity),U.opacityPanel.onOpacityChanged=U.setOpacity,U}return J(l,K),l.prototype.setOpacity=function(c){this.opacity=c,this.visual&&k.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var c=K.prototype.getState.call(this);return c.typeName=l.typeName,c},l.typeName="HighlightMarker",l.title="Highlight marker",l.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',l}(j),M='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',N=function(K){function l(c,D,X){var U=K.call(this,c,D,X)||this;return U.bgColor="transparent",U.tipPosition={x:0,y:0},U.tipBase1Position={x:0,y:0},U.tipBase2Position={x:0,y:0},U.tipMoving=!1,U.color=X.defaultStrokeColor,U.bgColor=X.defaultFillColor,U.fontFamily=X.defaultFontFamily,U.defaultSize={x:100,y:30},U.setBgColor=U.setBgColor.bind(U),U.getTipPoints=U.getTipPoints.bind(U),U.positionTip=U.positionTip.bind(U),U.setTipPoints=U.setTipPoints.bind(U),U.colorPanel=new _("Text color",X.defaultColorSet,U.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),U.colorPanel.onColorChanged=U.setColor,U.bgColorPanel=new _("Fill color",X.defaultColorSet,U.bgColor,M),U.bgColorPanel.onColorChanged=U.setBgColor,U.fontFamilyPanel=new a("Font",X.defaultFontFamilies,X.defaultFontFamily),U.fontFamilyPanel.onFontChanged=U.setFont,U.tipGrip=new s,U.tipGrip.visual.transform.baseVal.appendItem(k.createTransform()),U.controlBox.appendChild(U.tipGrip.visual),U}return J(l,K),l.prototype.ownsTarget=function(c){return K.prototype.ownsTarget.call(this,c)||this.tipGrip.ownsTarget(c)||this.tip===c},l.prototype.createTip=function(){k.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=k.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},l.prototype.pointerDown=function(c,D){this.state==="new"&&K.prototype.pointerDown.call(this,c,D),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(D)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):K.prototype.pointerDown.call(this,c,D)},l.prototype.pointerUp=function(c){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,K.prototype.pointerUp.call(this,c);else{var D=this.state==="creating";K.prototype.pointerUp.call(this,c),this.setTipPoints(D),this.positionTip()}},l.prototype.manipulate=function(c){if(this.tipMoving){var D=this.unrotatePoint(c);this.tipPosition={x:D.x-this.manipulationStartLeft,y:D.y-this.manipulationStartTop},this.positionTip()}else K.prototype.manipulate.call(this,c)},l.prototype.setBgColor=function(c){this.bgRectangle&&this.tip&&(k.setAttributes(this.bgRectangle,[["fill",c]]),k.setAttributes(this.tip,[["fill",c]])),this.bgColor=c,this.fillColorChanged(c)},l.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},l.prototype.setTipPoints=function(c){c===void 0&&(c=!1);var D=Math.min(this.height/2,15),X=this.height/5;c&&(this.tipPosition={x:D+X/2,y:this.height+20});var U=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?U<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(X=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:D,y:0},this.tipBase2Position={x:D+X,y:0}):(this.tipBase1Position={x:0,y:D},this.tipBase2Position={x:0,y:D+X}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?U<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(X=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-D-X,y:0},this.tipBase2Position={x:this.width-D,y:0}):(this.tipBase1Position={x:this.width,y:D},this.tipBase2Position={x:this.width,y:D+X}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?U<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(X=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-D-X,y:this.height},this.tipBase2Position={x:this.width-D,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-D-X},this.tipBase2Position={x:this.width,y:this.height-D}):U<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(X=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:D,y:this.height},this.tipBase2Position={x:D+X,y:this.height}):(this.tipBase1Position={x:0,y:this.height-D},this.tipBase2Position={x:0,y:this.height-D-X})},l.prototype.resize=function(c){K.prototype.resize.call(this,c),this.positionTip()},l.prototype.positionTip=function(){k.setAttributes(this.tip,[["points",this.getTipPoints()]]);var c=this.tipGrip.visual.transform.baseVal.getItem(0);c.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(c,0)},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),l.prototype.select=function(){this.positionTip(),K.prototype.select.call(this)},l.prototype.getState=function(){var c=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},K.prototype.getState.call(this));return c.typeName=l.typeName,c},l.prototype.restoreState=function(c){var D=c;this.bgColor=D.bgColor,this.tipPosition=D.tipPosition,K.prototype.restoreState.call(this,c),this.createTip(),this.setTipPoints()},l.prototype.scale=function(c,D){K.prototype.scale.call(this,c,D),this.tipPosition={x:this.tipPosition.x*c,y:this.tipPosition.y*D},this.positionTip()},l.typeName="CalloutMarker",l.title="Callout marker",l.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',l}(b),$=function(K){function l(c,D,X){var U=K.call(this,c,D,X)||this;return U.fillColor="transparent",U.strokeColor="transparent",U.strokeWidth=0,U.strokeDasharray="",U.opacity=1,U.strokeColor=X.defaultColor,U.strokeWidth=X.defaultStrokeWidth,U.strokeDasharray=X.defaultStrokeDasharray,U.fillColor=X.defaultFillColor,U.setStrokeColor=U.setStrokeColor.bind(U),U.setFillColor=U.setFillColor.bind(U),U.setStrokeWidth=U.setStrokeWidth.bind(U),U.setStrokeDasharray=U.setStrokeDasharray.bind(U),U.setOpacity=U.setOpacity.bind(U),U.createVisual=U.createVisual.bind(U),U.strokePanel=new _("Line color",F(X.defaultColorSet,["transparent"]),X.defaultColor),U.strokePanel.onColorChanged=U.setStrokeColor,U.fillPanel=new _("Fill color",F(X.defaultColorSet,["transparent"]),U.fillColor,M),U.fillPanel.onColorChanged=U.setFillColor,U.strokeWidthPanel=new m("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),U.strokeWidthPanel.onWidthChanged=U.setStrokeWidth,U.strokeStylePanel=new f("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),U.strokeStylePanel.onStyleChanged=U.setStrokeDasharray,U.opacityPanel=new z("Opacity",X.defaultOpacitySteps,U.opacity),U.opacityPanel.onOpacityChanged=U.setOpacity,U}return J(l,K),l.prototype.ownsTarget=function(c){return!(!K.prototype.ownsTarget.call(this,c)&&c!==this.visual)},l.prototype.createVisual=function(){this.visual=k.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(c,D){K.prototype.pointerDown.call(this,c,D),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},l.prototype.manipulate=function(c){K.prototype.manipulate.call(this,c)},l.prototype.resize=function(c){K.prototype.resize.call(this,c),this.setSize()},l.prototype.setSize=function(){K.prototype.setSize.call(this),k.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},l.prototype.pointerUp=function(c){K.prototype.pointerUp.call(this,c),this.setSize()},l.prototype.setStrokeColor=function(c){this.strokeColor=c,this.visual&&k.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(c),this.stateChanged()},l.prototype.setFillColor=function(c){this.fillColor=c,this.visual&&k.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(c),this.stateChanged()},l.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.visual&&k.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},l.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.visual&&k.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},l.prototype.setOpacity=function(c){this.opacity=c,this.visual&&k.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var c=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},K.prototype.getState.call(this));return c.typeName=l.typeName,c},l.prototype.restoreState=function(c){var D=c;this.fillColor=D.fillColor,this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.opacity=D.opacity,this.createVisual(),K.prototype.restoreState.call(this,c),this.setSize()},l.prototype.scale=function(c,D){K.prototype.scale.call(this,c,D),this.setSize()},l.typeName="EllipseMarker",l.title="Ellipse marker",l.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',l}(T),ie=function(K){function l(c,D,X){return K.call(this,c,D,X)||this}return J(l,K),Object.defineProperty(l.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),l.prototype.ownsTarget=function(c){return!(!K.prototype.ownsTarget.call(this,c)&&c!==this.tip1&&c!==this.tip2)},l.prototype.createTips=function(){this.tip1=k.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(k.createTransform()),this.visual.appendChild(this.tip1),this.tip2=k.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(k.createTransform()),this.visual.appendChild(this.tip2)},l.prototype.pointerDown=function(c,D){K.prototype.pointerDown.call(this,c,D),this.state==="creating"&&this.createTips()},l.prototype.adjustVisual=function(){if(K.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(k.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),k.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var c=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),D=this.tip1.transform.baseVal.getItem(0);D.setRotate(c,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(D,0);var X=this.tip2.transform.baseVal.getItem(0);X.setRotate(c+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(X,0)}},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var c=K.prototype.getState.call(this);return c.typeName=l.typeName,c},l.prototype.restoreState=function(c){K.prototype.restoreState.call(this,c),this.createTips(),this.adjustVisual()},l.typeName="MeasurementMarker",l.title="Measurement marker",l.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',l}(u),he=function(K){function l(c,D,X){var U=K.call(this,c,D,X)||this;return U.strokePanel.colors=X.defaultColorSet,U.fillColor="transparent",U}return J(l,K),Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var c=K.prototype.getState.call(this);return c.typeName=l.typeName,c},l.typeName="EllipseFrameMarker",l.title="Ellipse frame marker",l.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',l}($),me=function(){function K(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(K.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),K.prototype.addUndoStep=function(l){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(l)||(this.undoStack.push(l),JSON.stringify(this.lastRedoStep)!==JSON.stringify(l)&&this.redoStack.splice(0,this.redoStack.length))},K.prototype.replaceLastUndoStep=function(l){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=l)},K.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},K.prototype.undo=function(){if(this.undoStack.length>1){var l=this.undoStack.pop();return l!==void 0&&this.redoStack.push(l),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},K.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},K}(),ke=function(K){function l(c,D,X){var U=K.call(this,c,D,X)||this;return U.strokeColor="transparent",U.strokeWidth=0,U.strokeDasharray="",U.curveX=0,U.curveY=0,U.manipulationStartCurveX=0,U.manipulationStartCurveY=0,U.setStrokeColor=U.setStrokeColor.bind(U),U.setStrokeWidth=U.setStrokeWidth.bind(U),U.setStrokeDasharray=U.setStrokeDasharray.bind(U),U.positionGrips=U.positionGrips.bind(U),U.addControlGrips=U.addControlGrips.bind(U),U.adjustVisual=U.adjustVisual.bind(U),U.setupControlBox=U.setupControlBox.bind(U),U.resize=U.resize.bind(U),U.strokeColor=X.defaultColor,U.strokeWidth=X.defaultStrokeWidth,U.strokeDasharray=X.defaultStrokeDasharray,U.strokePanel=new _("Line color",X.defaultColorSet,X.defaultColor),U.strokePanel.onColorChanged=U.setStrokeColor,U.strokeWidthPanel=new m("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),U.strokeWidthPanel.onWidthChanged=U.setStrokeWidth,U.strokeStylePanel=new f("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),U.strokeStylePanel.onStyleChanged=U.setStrokeDasharray,U}return J(l,K),l.prototype.ownsTarget=function(c){return!(!K.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.selectorCurve&&c!==this.visibleCurve&&!this.curveGrip.ownsTarget(c))},l.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},l.prototype.createVisual=function(){this.visual=k.createGroup(),this.selectorCurve=k.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=k.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(c,D){K.prototype.pointerDown.call(this,c,D),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=c.x,this.curveY=c.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(D)&&(this.activeGrip=this.curveGrip,this._state="resize")},l.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),k.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),k.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),k.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},l.prototype.setupControlBox=function(){K.prototype.setupControlBox.call(this),this.curveControlLine1=k.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=k.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},l.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,K.prototype.addControlGrips.call(this)},l.prototype.positionGrips=function(){K.prototype.positionGrips.call(this);var c=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-c/2,this.curveY-c/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},l.prototype.manipulate=function(c){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+c.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+c.y-this.manipulationStartY),K.prototype.manipulate.call(this,c)},l.prototype.resize=function(c){this.activeGrip===this.curveGrip&&(this.curveX=c.x,this.curveY=c.y),K.prototype.resize.call(this,c),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},l.prototype.setStrokeColor=function(c){this.strokeColor=c,this.adjustVisual(),this.colorChanged(c)},l.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.adjustVisual()},l.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.adjustVisual()},l.prototype.scale=function(c,D){this.curveX=this.curveX*c,this.curveY=this.curveY*D,K.prototype.scale.call(this,c,D)},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var c=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},K.prototype.getState.call(this));return c.typeName=l.typeName,c},l.prototype.restoreState=function(c){K.prototype.restoreState.call(this,c);var D=c;this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.curveX=D.curveX,this.curveY=D.curveY,this.createVisual(),this.adjustVisual()},l.typeName="CurveMarker",l.title="Curve marker",l.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',l}(g),Se=function(){function K(l,c){c===void 0&&(c=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=l,this.cancelable=c}return Object.defineProperty(K.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),K.prototype.preventDefault=function(){this._defaultPrevented=!0},K}(),Re=function(K){function l(c,D,X){var U=K.call(this,c,!1)||this;return U.dataUrl=D,U.state=X,U}return J(l,K),l}(Se),Te=function(K){function l(c,D,X){X===void 0&&(X=!1);var U=K.call(this,c,X)||this;return U.marker=D,U}return J(l,K),l}(Se),_e=function(){function K(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return K.prototype.addEventListener=function(l,c){this[l].push(c)},K.prototype.removeEventListener=function(l,c){var D=this[l].indexOf(c);D>-1&&this[l].splice(D,1)},K}(),ye=function(){function K(l){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new p,this._isOpen=!1,this.undoRedoManager=new me,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new _e,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=K.instanceCounter++,this.styles=new R(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=l,this.targetRoot=document.body,this.width=l.clientWidth,this.height=l.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(K.prototype,"ALL_MARKER_TYPES",{get:function(){return[E,v,I,b,he,$,V,N,ie,j,u,ke]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[E,v,I,b,$,V,N]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"BASIC_MARKER_TYPES",{get:function(){return[E,v,I,b,V]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(l){var c=this;this._availableMarkerTypes.splice(0),l.forEach(function(D){if(typeof D=="string"){var X=c.ALL_MARKER_TYPES.find(function(U){return U.typeName===D});X!==void 0&&c._availableMarkerTypes.push(X)}else c._availableMarkerTypes.push(D)})},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(l){this._zoomLevel=l,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),K.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),G.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},K.prototype.show=function(){var l=this;this.styles.styleSheetRoot===void 0&&B.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=B.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(c){return c(new Se(l))})},K.prototype.render=function(){return O(this,void 0,void 0,function(){var l;return Z(this,function(c){switch(c.label){case 0:return this.setCurrentMarker(),(l=new H).naturalSize=this.renderAtNaturalSize,l.imageType=this.renderImageType,l.imageQuality=this.renderImageQuality,l.markersOnly=this.renderMarkersOnly,l.width=this.renderWidth,l.height=this.renderHeight,[4,l.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return c.sent(),[4,l.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,c.sent()]}})})},K.prototype.close=function(l){var c=this;if(l===void 0&&(l=!1),this.isOpen){var D=!1;l||this.eventListeners.beforeclose.forEach(function(X){var U=new Se(c,!0);X(U),U.defaultPrevented&&(D=!0)}),D||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(X){return X(new Se(c))}),this.detachEvents(),this._isOpen=!1)}},K.prototype.addMarkersToToolbar=function(){for(var l,c=[],D=0;D<arguments.length;D++)c[D]=arguments[D];(l=this._availableMarkerTypes).push.apply(l,c)},K.prototype.addRenderEventListener=function(l){this.addEventListener("render",function(c){l(c.dataUrl,c.state)})},K.prototype.removeRenderEventListener=function(l){},K.prototype.addCloseEventListener=function(l){this.addEventListener("close",function(){l()})},K.prototype.removeCloseEventListener=function(l){},K.prototype.setupResizeObserver=function(){var l=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){l.resize(l.target.clientWidth,l.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return l.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},K.prototype.onPopupTargetResize=function(){var l=1*this.target.clientWidth/this.target.clientHeight,c=this.editorCanvas.clientWidth/l>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*l:this.editorCanvas.clientWidth,D=c<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/l;this.resize(c,D)},K.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},K.prototype.resize=function(l,c){this._isResizing=!0;var D=l/this.imageWidth,X=c/this.imageHeight;this.imageWidth=Math.round(l),this.imageHeight=Math.round(c),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(D,X),this._isResizing=!1},K.prototype.scaleMarkers=function(l,c){var D,X=this;this._currentMarker&&this._currentMarker instanceof b?this._currentMarker.scale(l,c):(D=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(U){U!==X._currentMarker&&U.scale(l,c)}),D!==void 0&&this.setCurrentMarker(D)},K.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},K.prototype.setTopLeft=function(){var l=this.editingTarget.getBoundingClientRect(),c=this.editorCanvas.getBoundingClientRect();this.left=l.left-c.left,this.top=l.top-c.top},K.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},K.prototype.addDefs=function(){for(var l,c=[],D=0;D<arguments.length;D++)c[D]=arguments[D];this.defs=k.createDefs(),this.addDefsToImage(),(l=this.defs).append.apply(l,c)},K.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},K.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},K.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},K.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},K.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},K.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},K.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},K.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var l=document.createElement("a");l.href="https://markerjs.com/",l.target="_blank",l.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',l.title="Powered by marker.js",l.style.display="grid",l.style.alignItems="center",l.style.justifyItems="center",l.style.padding="3px",l.style.width="20px",l.style.height="20px",this.logoUI.appendChild(l),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},K.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},K.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},K.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},K.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var l=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=l+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new P(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new L(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},K.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},K.prototype.removeMarker=function(l){this.markerImage.removeChild(l.container),this.markers.indexOf(l)>-1&&this.markers.splice(this.markers.indexOf(l),1),l.dispose()},K.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},K.prototype.toolbarButtonClicked=function(l,c){if(l==="marker"&&c!==void 0)this.createNewMarker(c);else if(l==="action")switch(c){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},K.prototype.deleteSelectedMarker=function(){var l=this;if(this._currentMarker!==void 0){var c=!1;if(this.eventListeners.markerbeforedelete.forEach(function(X){var U=new Te(l,l._currentMarker,!0);X(U),U.defaultPrevented&&(c=!0)}),!c){var D=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(X){return X(new Te(l,D))})}}},K.prototype.clear=function(){var l=this,c=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(oe){var be=new Te(l,void 0,!0);oe(be),be.defaultPrevented&&(c=!0)}),!c)){this.setCurrentMarker();for(var D=function(oe){var be=X.markers[oe];X.setCurrentMarker(X.markers[oe]),X._currentMarker.dispose(),X.markerImage.removeChild(X._currentMarker.container),X.markers.splice(X.markers.indexOf(X._currentMarker),1),X.eventListeners.markerdelete.forEach(function(xe){return xe(new Te(l,be))})},X=this,U=this.markers.length-1;U>=0;U--)D(U);this.addUndoStep()}},Object.defineProperty(K.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),K.prototype.showNotesEditor=function(){var l;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(l=this._currentMarker.notes)!==null&&l!==void 0?l:"",this.overlayContainer.appendChild(this.notesArea))},K.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},K.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},K.prototype.addUndoStep=function(){var l=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var c=this.getState(),D=this.undoRedoManager.getLastUndoStep();if(!D||D.width===c.width&&D.height===c.height){var X=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(c),X<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(U){return U(new Se(l))})}else this.undoRedoManager.replaceLastUndoStep(c),this.eventListeners.statechange.forEach(function(U){return U(new Se(l))})}},K.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},K.prototype.undoStep=function(){var l=this,c=this.undoRedoManager.undo();c!==void 0&&(this.restoreState(c),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(D){return D(new Se(l))}))},K.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},K.prototype.redoStep=function(){var l=this,c=this.undoRedoManager.redo();c!==void 0&&(this.restoreState(c),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(D){return D(new Se(l))}))},K.prototype.stepZoom=function(){var l=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=l<this.zoomSteps.length-1?this.zoomSteps[l+1]:this.zoomSteps[0]},K.prototype.panTo=function(l){this.contentDiv.scrollBy({left:this.prevPanPoint.x-l.x,top:this.prevPanPoint.y-l.y}),this.prevPanPoint=l},K.prototype.startRenderAndClose=function(){return O(this,void 0,void 0,function(){var l,c,D=this;return Z(this,function(X){switch(X.label){case 0:return[4,this.render()];case 1:return l=X.sent(),c=this.getState(),this.eventListeners.render.forEach(function(U){return U(new Re(D,l,c))}),this.close(!0),[2]}})})},K.prototype.getState=function(l){l===!0&&this.setCurrentMarker();var c={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(D){return c.markers.push(D.getState())}),c},K.prototype.restoreState=function(l){var c=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);l.markers.forEach(function(D){var X=c._availableMarkerTypes.find(function(oe){return oe.typeName===D.typeName});if(X!==void 0){var U=c.addNewMarker(X);U.restoreState(D),c.markers.push(U)}}),l.width&&l.height&&(l.width!==this.imageWidth||l.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/l.width,this.imageHeight/l.height),this.eventListeners.restorestate.forEach(function(D){return D(new Se(c))})},K.prototype.addNewMarker=function(l){var c=k.createGroup();return this.markerImage.appendChild(c),new l(c,this.overlayContainer,this.settings)},K.prototype.createNewMarker=function(l){var c,D=this;(c=typeof l=="string"?this._availableMarkerTypes.find(function(X){return X.typeName===l}):l)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(c),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(c.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(X){return X(new Te(D,D._currentMarker))}))},K.prototype.markerCreated=function(l){var c=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(l),this.setCurrentMarker(l),l instanceof v&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(v):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(D){return D(new Te(c,c._currentMarker))})},K.prototype.colorChanged=function(l){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=l,this.settings.defaultStrokeColor=l)},K.prototype.fillColorChanged=function(l){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=l)},K.prototype.markerStateChanged=function(l){var c=this;this.eventListeners.markerchange.forEach(function(D){return D(new Te(c,l))})},K.prototype.setCurrentMarker=function(l){var c=this;this._currentMarker!==l&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(D){return D(new Te(c,c._currentMarker))})),this._currentMarker=l,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(D){return D(new Te(c,c._currentMarker))}))},K.prototype.onPointerDown=function(l){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||l.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var c=this.markers.find(function(D){return D.ownsTarget(l.target)});c!==void 0?(this.setCurrentMarker(c),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(l.clientX,l.clientY),l.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:l.clientX,y:l.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(l.clientX,l.clientY))},K.prototype.onDblClick=function(l){if(this._isFocused||this.focus(),this.mode==="select"){var c=this.markers.find(function(D){return D.ownsTarget(l.target)});c!==void 0&&c!==this._currentMarker&&this.setCurrentMarker(c),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(l.clientX,l.clientY),l.target):this.setCurrentMarker()}},K.prototype.onPointerMove=function(l){this.touchPoints!==1&&l.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||l.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(l.clientX,l.clientY)):this.zoomLevel>1&&this.panTo({x:l.clientX,y:l.clientY}))},K.prototype.onPointerUp=function(l){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(l.clientX,l.clientY)),this.isDragging=!1,this.addUndoStep()},K.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},K.prototype.onKeyUp=function(l){this._currentMarker===void 0||this.notesArea!==void 0||l.key!=="Delete"&&l.key!=="Backspace"||this.deleteSelectedMarker()},K.prototype.clientToLocalCoordinates=function(l,c){var D=this.markerImage.getBoundingClientRect();return{x:(l-D.left)/this.zoomLevel,y:(c-D.top)/this.zoomLevel}},K.prototype.onWindowResize=function(){this.positionUI()},K.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var l=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=l+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},K.prototype.addLicenseKey=function(l){G.addKey(l)},K.prototype.addEventListener=function(l,c){this.eventListeners.addEventListener(l,c)},K.prototype.removeEventListener=function(l,c){this.eventListeners.removeEventListener(l,c)},K.prototype.renderState=function(l){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(l),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(K.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),K.prototype.focus=function(){var l=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(c){return c(new Se(l))}))},K.prototype.blur=function(){var l=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(c){return c(new Se(l))}))},K.instanceCounter=0,K}()},VoVZ:function(tt,Ke,le){"use strict";var ce=le("miYZ"),J=le("tsqr"),O=le("9og8"),Z=le("2qtc"),F=le("kLXV"),k=le("k1fw"),G=le("WmNS"),H=le.n(G),B=le("q1tI"),R=le.n(B),x=le("KlHt"),w=le.n(x),P=le("SVaM"),L=le("BdwD"),A=function(h){var o,s,d=h.type,T=h.detailInfo,y=h.showBtn,m=h.getData,f=h.showEdit;return R.a.createElement("div",{className:"".concat(w.a.main_com," ").concat(w.a.project_list)},(T==null||((o=T.shixun_cases)===null||o===void 0)?void 0:o.length)>0?T==null||((s=T.shixun_cases)===null||s===void 0)?void 0:s.map(function(E,p){return R.a.createElement("div",{className:w.a.case_item,key:p},R.a.createElement("div",{className:w.a.case_item_info,onClick:function(){window.open(E.url)}},d=="path"&&R.a.createElement("img",{src:le("+XWH")}),d=="shixun"&&R.a.createElement("img",{src:le("I3p9")}),R.a.createElement("div",null,E==null?void 0:E.name)),y&&R.a.createElement("div",{className:w.a.btn_up_de},R.a.createElement("div",{className:"icon-bianji_Hover ".concat(w.a.btn_update),onClick:function(){f(Object(k.a)({},E))}}),R.a.createElement("div",{className:"icon-shanchu13 ".concat(w.a.btn_del),onClick:function(u){F.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:R.a.createElement("div",null,"\u786E\u8BA4\u5220\u9664\u8BE5\u6761\u5B9E\u9A8C\u9879\u76EE\u5417\uFF1F"),onOk:function(){var a=Object(O.a)(H.a.mark(function v(){return H.a.wrap(function(I){for(;;)switch(I.prev=I.next){case 0:Object(P.c)(E==null?void 0:E.id).then(function(j){(j==null?void 0:j.status)==0&&(J.b.success("\u5220\u9664\u6210\u529F"),m())});case 1:case"end":return I.stop()}},v)}));function b(){return a.apply(this,arguments)}return b}()})}})))}):R.a.createElement(L.a,{customText:"\u6682\u65E0\u6570\u636E",styles:{padding:"50px 0"}}))};Ke.a=A},"VrN/":function(tt,Ke,le){(function(ce,J){tt.exports=J()})(this,function(){"use strict";var ce=navigator.userAgent,J=navigator.platform,O=/gecko\/\d/i.test(ce),Z=/MSIE \d/.test(ce),F=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ce),k=/Edge\/(\d+)/.exec(ce),G=Z||F||k,H=G&&(Z?document.documentMode||6:+(k||F)[1]),B=!k&&/WebKit\//.test(ce),R=B&&/Qt\/\d+\.\d+/.test(ce),x=!k&&/Chrome\//.test(ce),w=/Opera\//.test(ce),P=/Apple Computer/.test(navigator.vendor),L=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ce),A=/PhantomJS/.test(ce),_=!k&&/AppleWebKit/.test(ce)&&/Mobile\/\w+/.test(ce),h=/Android/.test(ce),o=_||h||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ce),s=_||/Mac/.test(J),d=/\bCrOS\b/.test(ce),T=/win/i.test(J),y=w&&ce.match(/Version\/(\d*\.\d*)/);y&&(y=Number(y[1])),y&&y>=15&&(w=!1,B=!0);var m=s&&(R||w&&(y==null||y<12.11)),f=O||G&&H>=9;function E(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var p=function(e,t){var i=e.className,r=E(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function g(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function u(e,t){return g(e).appendChild(t)}function a(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var C=0;C<t.length;++C)n.appendChild(t[C]);return n}function b(e,t,i,r){var n=a(e,t,i,r);return n.setAttribute("role","presentation"),n}var v;document.createRange?v=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:v=function(e,t,i){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(n){return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r};function S(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function I(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function j(e,t){var i=e.className;E(t).test(i)||(e.className+=(i?" ":"")+t)}function z(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!E(i[r]).test(t)&&(t+=" "+i[r]);return t}var V=function(e){e.select()};_?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:G&&(V=function(e){try{e.select()}catch(t){}});function M(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function N(e,t,i){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function $(e,t,i,r,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var C=r||0,W=n||0;;){var Y=e.indexOf(" ",C);if(Y<0||Y>=t)return W+(t-C);W+=Y-C,W+=i-W%i,C=Y+1}}var ie=function(){this.id=null,this.f=null,this.time=0,this.handler=M(this.onTimeout,this)};ie.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ie.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function he(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var me=50,ke={toString:function(){return"CodeMirror.Pass"}},Se={scroll:!1},Re={origin:"*mouse"},Te={origin:"+move"};function _e(e,t,i){for(var r=0,n=0;;){var C=e.indexOf(" ",r);C==-1&&(C=e.length);var W=C-r;if(C==e.length||n+W>=t)return r+Math.min(W,t-n);if(n+=C-r,n+=i-n%i,r=C+1,n>=t)return r}}var ye=[""];function K(e){for(;ye.length<=e;)ye.push(l(ye)+" ");return ye[e]}function l(e){return e[e.length-1]}function c(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function D(e,t,i){for(var r=0,n=i(t);r<e.length&&i(e[r])<=n;)r++;e.splice(r,0,t)}function X(){}function U(e,t){var i;return Object.create?i=Object.create(e):(X.prototype=e,i=new X),t&&N(t,i),i}var oe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function be(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||oe.test(e))}function xe(e,t){return t?t.source.indexOf("\\w")>-1&&be(e)?!0:t.test(e):be(e)}function Pe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var De=/[\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 Oe(e){return e.charCodeAt(0)>=768&&De.test(e)}function Ie(e,t,i){for(;(i<0?t>0:t<e.length)&&Oe(e.charAt(t));)t+=i;return t}function He(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var n=(t+i)/2,C=r<0?Math.ceil(n):Math.floor(n);if(C==t)return e(C)?t:i;e(C)?i=C:t=C+r}}function Ve(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,C=0;C<e.length;++C){var W=e[C];(W.from<i&&W.to>t||t==i&&W.to==t)&&(r(Math.max(W.from,t),Math.min(W.to,i),W.level==1?"rtl":"ltr",C),n=!0)}n||r(t,i,"ltr")}var Je=null;function Xe(e,t,i){var r;Je=null;for(var n=0;n<e.length;++n){var C=e[n];if(C.from<t&&C.to>t)return n;C.to==t&&(C.from!=C.to&&i=="before"?r=n:Je=n),C.from==t&&(C.from!=C.to&&i!="before"?r=n:Je=n)}return r!=null?r:Je}var We=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(re){return re<=247?e.charAt(re):1424<=re&&re<=1524?"R":1536<=re&&re<=1785?t.charAt(re-1536):1774<=re&&re<=2220?"r":8192<=re&&re<=8203?"w":re==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,C=/[LRr]/,W=/[Lb1n]/,Y=/[1n]/;function Q(re,pe,ge){this.level=re,this.from=pe,this.to=ge}return function(re,pe){var ge=pe=="ltr"?"L":"R";if(re.length==0||pe=="ltr"&&!r.test(re))return!1;for(var Le=re.length,Ce=[],Ne=0;Ne<Le;++Ne)Ce.push(i(re.charCodeAt(Ne)));for(var Be=0,ze=ge;Be<Le;++Be){var Ye=Ce[Be];Ye=="m"?Ce[Be]=ze:ze=Ye}for(var rt=0,$e=ge;rt<Le;++rt){var lt=Ce[rt];lt=="1"&&$e=="r"?Ce[rt]="n":C.test(lt)&&($e=lt,lt=="r"&&(Ce[rt]="R"))}for(var vt=1,mt=Ce[0];vt<Le-1;++vt){var wt=Ce[vt];wt=="+"&&mt=="1"&&Ce[vt+1]=="1"?Ce[vt]="1":wt==","&&mt==Ce[vt+1]&&(mt=="1"||mt=="n")&&(Ce[vt]=mt),mt=wt}for(var Wt=0;Wt<Le;++Wt){var ur=Ce[Wt];if(ur==",")Ce[Wt]="N";else if(ur=="%"){var Vt=void 0;for(Vt=Wt+1;Vt<Le&&Ce[Vt]=="%";++Vt);for(var Fr=Wt&&Ce[Wt-1]=="!"||Vt<Le&&Ce[Vt]=="1"?"1":"N",Lr=Wt;Lr<Vt;++Lr)Ce[Lr]=Fr;Wt=Vt-1}}for(var Qt=0,kr=ge;Qt<Le;++Qt){var fr=Ce[Qt];kr=="L"&&fr=="1"?Ce[Qt]="L":C.test(fr)&&(kr=fr)}for(var ar=0;ar<Le;++ar)if(n.test(Ce[ar])){var qt=void 0;for(qt=ar+1;qt<Le&&n.test(Ce[qt]);++qt);for(var Yt=(ar?Ce[ar-1]:ge)=="L",Rr=(qt<Le?Ce[qt]:ge)=="L",cn=Yt==Rr?Yt?"L":"R":ge,Pi=ar;Pi<qt;++Pi)Ce[Pi]=cn;ar=qt-1}for(var gr=[],si,dr=0;dr<Le;)if(W.test(Ce[dr])){var Va=dr;for(++dr;dr<Le&&W.test(Ce[dr]);++dr);gr.push(new Q(0,Va,dr))}else{var vi=dr,Vi=gr.length,Xi=pe=="rtl"?1:0;for(++dr;dr<Le&&Ce[dr]!="L";++dr);for(var Er=vi;Er<dr;)if(Y.test(Ce[Er])){vi<Er&&(gr.splice(Vi,0,new Q(1,vi,Er)),Vi+=Xi);var fn=Er;for(++Er;Er<dr&&Y.test(Ce[Er]);++Er);gr.splice(Vi,0,new Q(2,fn,Er)),Vi+=Xi,vi=Er}else++Er;vi<dr&&gr.splice(Vi,0,new Q(1,vi,dr))}return pe=="ltr"&&(gr[0].level==1&&(si=re.match(/^\s+/))&&(gr[0].from=si[0].length,gr.unshift(new Q(0,0,si[0].length))),l(gr).level==1&&(si=re.match(/\s+$/))&&(l(gr).to-=si[0].length,gr.push(new Q(0,Le-si[0].length,Le)))),pe=="rtl"?gr.reverse():gr}}();function Qe(e,t){var i=e.order;return i==null&&(i=e.order=We(e.text,t)),i}var et=[],Ae=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||et).concat(i)}};function ut(e,t){return e._handlers&&e._handlers[t]||et}function it(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var r=e._handlers,n=r&&r[t];if(n){var C=he(n,i);C>-1&&(r[t]=n.slice(0,C).concat(n.slice(C+1)))}}}function se(e,t){var i=ut(e,t);if(!i.length)return;for(var r=Array.prototype.slice.call(arguments,2),n=0;n<i.length;++n)i[n].apply(null,r)}function q(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),se(e,i||t.type,e,t),de(t)||t.codemirrorIgnore}function ee(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)he(i,t[r])==-1&&i.push(t[r])}function ae(e,t){return ut(e,t).length>0}function ue(e){e.prototype.on=function(t,i){Ae(this,t,i)},e.prototype.off=function(t,i){it(this,t,i)}}function te(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ne(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function de(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function fe(e){te(e),ne(e)}function ve(e){return e.target||e.srcElement}function Ee(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var Me=function(){if(G&&H<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),Ge;function nt(e){if(Ge==null){var t=a("span","\u200B");u(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ge=t.offsetWidth<=1&&t.offsetHeight>2&&!(G&&H<8))}var i=Ge?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var at;function Tt(e){if(at!=null)return at;var t=u(e,document.createTextNode("A\u062EA")),i=v(t,0,1).getBoundingClientRect(),r=v(t,1,2).getBoundingClientRect();return g(e),!i||i.left==i.right?!1:at=r.right-i.right<3}var ft=`
b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf(`
`,t);n==-1&&(n=e.length);var C=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),W=C.indexOf("\r");W!=-1?(i.push(C.slice(0,W)),t+=W+1):(i.push(C),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},dt=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(i){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Pt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),At=null;function Ht(e){if(At!=null)return At;var t=u(e,a("span","x")),i=t.getBoundingClientRect(),r=v(t,0,1).getBoundingClientRect();return At=Math.abs(i.left-r.left)>1}var Bt={},Lt={};function Sr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Bt[e]=t}function Dr(e,t){Lt[e]=t}function er(e){if(typeof e=="string"&&Lt.hasOwnProperty(e))e=Lt[e];else if(e&&typeof e.name=="string"&&Lt.hasOwnProperty(e.name)){var t=Lt[e.name];typeof t=="string"&&(t={name:t}),e=U(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return er("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return er("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function hr(e,t){t=er(t);var i=Bt[t.name];if(!i)return hr(e,"text/plain");var r=i(e,t);if(vr.hasOwnProperty(t.name)){var n=vr[t.name];for(var C in n){if(!n.hasOwnProperty(C))continue;r.hasOwnProperty(C)&&(r["_"+C]=r[C]),r[C]=n[C]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var W in t.modeProps)r[W]=t.modeProps[W];return r}var vr={};function Vr(e,t){var i=vr.hasOwnProperty(e)?vr[e]:vr[e]={};N(t,i)}function tr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function Xr(e,t){for(var i;e.innerMode&&!(i=e.innerMode(t),!i||i.mode==e);)t=i.state,e=i.mode;return i||{mode:e,state:t}}function Or(e,t,i){return e.startState?e.startState(t,i):!0}var Gt=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};Gt.prototype.eol=function(){return this.pos>=this.string.length},Gt.prototype.sol=function(){return this.pos==this.lineStart},Gt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Gt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Gt.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},Gt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Gt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Gt.prototype.skipToEnd=function(){this.pos=this.string.length},Gt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Gt.prototype.backUp=function(e){this.pos-=e},Gt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=$(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},Gt.prototype.indentation=function(){return $(this.string,null,this.tabSize)-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},Gt.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(W){return i?W.toLowerCase():W},n=this.string.substr(this.pos,e.length);if(r(n)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var C=this.string.slice(this.pos).match(e);return C&&C.index>0?null:(C&&t!==!1&&(this.pos+=C[0].length),C)}},Gt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Gt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Gt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Gt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Ze(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 i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],C=n.chunkSize();if(t<C){i=n;break}t-=C}return i.lines[t]}function Rt(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(C){var W=C.text;n==i.line&&(W=W.slice(0,i.ch)),n==t.line&&(W=W.slice(t.ch)),r.push(W),++n}),r}function rr(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function St(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function Et(e){if(e.parent==null)return null;for(var t=e.parent,i=he(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var n=0;!(r.children[n]==t);++n)i+=r.children[n].chunkSize();return i+t.first}function Dt(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],C=n.height;if(t<C){e=n;continue e}t-=C,i+=n.chunkSize()}return i}while(!e.lines);for(var W=0;W<e.lines.length;++W){var Y=e.lines[W],Q=Y.height;if(t<Q)break;t-=Q}return i+W}function Cr(e,t){return t>=e.first&&t<e.first+e.size}function Xt(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Fe(e,t,i){if(i===void 0&&(i=null),!(this instanceof Fe))return new Fe(e,t,i);this.line=e,this.ch=t,this.sticky=i}function yt(e,t){return e.line-t.line||e.ch-t.ch}function Pr(e,t){return e.sticky==t.sticky&&yt(e,t)==0}function yi(e){return Fe(e.line,e.ch)}function li(e,t){return yt(e,t)<0?t:e}function ui(e,t){return yt(e,t)<0?e:t}function Yr(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function bt(e,t){if(t.line<e.first)return Fe(e.first,0);var i=e.first+e.size-1;return t.line>i?Fe(i,Ze(e,i).text.length):Mi(t,Ze(e,t.line).text.length)}function Mi(e,t){var i=e.ch;return i==null||i>t?Fe(e.line,t):i<0?Fe(e.line,0):e}function je(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=bt(e,t[r]);return i}var Hr=function(e,t){this.state=e,this.lookAhead=t},Mr=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};Mr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Mr.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}},Mr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Mr.fromSaved=function(e,t,i){return t instanceof Hr?new Mr(e,tr(e.mode,t.state),i,t.lookAhead):new Mr(e,tr(e.mode,t),i)},Mr.prototype.save=function(e){var t=e!==!1?tr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Hr(t,this.maxLookAhead):t};function bi(e,t,i,r){var n=[e.state.modeGen],C={};ir(e,t.text,e.doc.mode,i,function(re,pe){return n.push(re,pe)},C,r);for(var W=i.state,Y=function(re){i.baseTokens=n;var pe=e.state.overlays[re],ge=1,Le=0;i.state=!0,ir(e,t.text,pe.mode,i,function(Ce,Ne){for(var Be=ge;Le<Ce;){var ze=n[ge];ze>Ce&&n.splice(ge,1,Ce,n[ge+1],ze),ge+=2,Le=Math.min(Ce,ze)}if(!Ne)return;if(pe.opaque)n.splice(Be,ge-Be,Ce,"overlay "+Ne),ge=Be+2;else for(;Be<ge;Be+=2){var Ye=n[Be+1];n[Be+1]=(Ye?Ye+" ":"")+"overlay "+Ne}},C),i.state=W,i.baseTokens=null,i.baseTokenPos=1},Q=0;Q<e.state.overlays.length;++Q)Y(Q);return{styles:n,classes:C.bgClass||C.textClass?C:null}}function yr(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=br(e,Et(t)),n=t.text.length>e.options.maxHighlightLength&&tr(e.doc.mode,r.state),C=bi(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=C.styles,C.classes?t.styleClasses=C.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function br(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new Mr(r,!0,t);var C=di(e,t,i),W=C>r.first&&Ze(r,C-1).stateAfter,Y=W?Mr.fromSaved(r,W,C):new Mr(r,Or(r.mode),C);return r.iter(C,t,function(Q){Ii(e,Q.text,Y);var re=Y.line;Q.stateAfter=re==t-1||re%5==0||re>=n.viewFrom&&re<n.viewTo?Y.save():null,Y.nextLine()}),i&&(r.modeFrontier=Y.line),Y}function Ii(e,t,i,r){var n=e.doc.mode,C=new Gt(t,e.options.tabSize,i);for(C.start=C.pos=r||0,t==""&&xi(n,i.state);!C.eol();)Zt(n,C,i.state),C.start=C.pos}function xi(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=Xr(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function Zt(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=Xr(e,i).mode);var C=e.token(t,i);if(t.pos>t.start)return C}throw new Error("Mode "+e.name+" failed to advance stream.")}var Ei=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Yi(e,t,i,r){var n=e.doc,C=n.mode,W;t=bt(n,t);var Y=Ze(n,t.line),Q=br(e,t.line,i),re=new Gt(Y.text,e.options.tabSize,Q),pe;for(r&&(pe=[]);(r||re.pos<t.ch)&&!re.eol();)re.start=re.pos,W=Zt(C,re,Q.state),r&&pe.push(new Ei(re,W,tr(n.mode,Q.state)));return r?pe:new Ei(re,W,Q.state)}function Si(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var r=i[1]?"bgClass":"textClass";t[r]==null?t[r]=i[2]:new RegExp("(?:^|\\s)"+i[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+i[2])}return e}function ir(e,t,i,r,n,C,W){var Y=i.flattenSpans;Y==null&&(Y=e.options.flattenSpans);var Q=0,re=null,pe=new Gt(t,e.options.tabSize,r),ge,Le=e.options.addModeClass&&[null];for(t==""&&Si(xi(i,r.state),C);!pe.eol();){if(pe.pos>e.options.maxHighlightLength?(Y=!1,W&&Ii(e,t,r,pe.pos),pe.pos=t.length,ge=null):ge=Si(Zt(i,pe,r.state,Le),C),Le){var Ce=Le[0].name;Ce&&(ge="m-"+(ge?Ce+" "+ge:Ce))}if(!Y||re!=ge){for(;Q<pe.start;)Q=Math.min(pe.start,Q+5e3),n(Q,re);re=ge}pe.start=pe.pos}for(;Q<pe.pos;){var Ne=Math.min(pe.pos,Q+5e3);n(Ne,re),Q=Ne}}function di(e,t,i){for(var r,n,C=e.doc,W=i?-1:t-(e.doc.mode.innerMode?1e3:100),Y=t;Y>W;--Y){if(Y<=C.first)return C.first;var Q=Ze(C,Y-1),re=Q.stateAfter;if(re&&(!i||Y+(re instanceof Hr?re.lookAhead:0)<=C.modeFrontier))return Y;var pe=$(Q.text,null,e.options.tabSize);(n==null||r>pe)&&(n=Y-1,r=pe)}return n}function pn(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var i=e.first,r=t-1;r>i;r--){var n=Ze(e,r).stateAfter;if(n&&(!(n instanceof Hr)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}var Ci=!1,Kt=!1;function $r(){Ci=!0}function mn(){Kt=!0}function ti(e,t,i){this.marker=e,this.from=t,this.to=i}function $t(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function hi(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function gn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Ni(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var C=e[n],W=C.marker,Y=C.from==null||(W.inclusiveLeft?C.from<=t:C.from<t);if(Y||C.from==t&&W.type=="bookmark"&&(!i||!C.marker.insertLeft)){var Q=C.to==null||(W.inclusiveRight?C.to>=t:C.to>t);(r||(r=[])).push(new ti(W,C.from,Q?null:C.to))}}return r}function Ir(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var C=e[n],W=C.marker,Y=C.to==null||(W.inclusiveRight?C.to>=t:C.to>t);if(Y||C.from==t&&W.type=="bookmark"&&(!i||C.marker.insertLeft)){var Q=C.from==null||(W.inclusiveLeft?C.from<=t:C.from<t);(r||(r=[])).push(new ti(W,Q?null:C.from-t,C.to==null?null:C.to-t))}}return r}function Ti(e,t){if(t.full)return null;var i=Cr(e,t.from.line)&&Ze(e,t.from.line).markedSpans,r=Cr(e,t.to.line)&&Ze(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,C=t.to.ch,W=yt(t.from,t.to)==0,Y=Ni(i,n,W),Q=Ir(r,C,W),re=t.text.length==1,pe=l(t.text).length+(re?n:0);if(Y)for(var ge=0;ge<Y.length;++ge){var Le=Y[ge];if(Le.to==null){var Ce=$t(Q,Le.marker);Ce?re&&(Le.to=Ce.to==null?null:Ce.to+pe):Le.to=n}}if(Q)for(var Ne=0;Ne<Q.length;++Ne){var Be=Q[Ne];if(Be.to!=null&&(Be.to+=pe),Be.from==null){var ze=$t(Y,Be.marker);ze||(Be.from=pe,re&&(Y||(Y=[])).push(Be))}else Be.from+=pe,re&&(Y||(Y=[])).push(Be)}Y&&(Y=$i(Y)),Q&&Q!=Y&&(Q=$i(Q));var Ye=[Y];if(!re){var rt=t.text.length-2,$e;if(rt>0&&Y)for(var lt=0;lt<Y.length;++lt)Y[lt].to==null&&($e||($e=[])).push(new ti(Y[lt].marker,null,null));for(var vt=0;vt<rt;++vt)Ye.push($e);Ye.push(Q)}return Ye}function $i(e){for(var t=0;t<e.length;++t){var i=e[t];i.from!=null&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Ui(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(Ce){if(Ce.markedSpans)for(var Ne=0;Ne<Ce.markedSpans.length;++Ne){var Be=Ce.markedSpans[Ne].marker;Be.readOnly&&(!r||he(r,Be)==-1)&&(r||(r=[])).push(Be)}}),!r)return null;for(var n=[{from:t,to:i}],C=0;C<r.length;++C)for(var W=r[C],Y=W.find(0),Q=0;Q<n.length;++Q){var re=n[Q];if(yt(re.to,Y.from)<0||yt(re.from,Y.to)>0)continue;var pe=[Q,1],ge=yt(re.from,Y.from),Le=yt(re.to,Y.to);(ge<0||!W.inclusiveLeft&&!ge)&&pe.push({from:re.from,to:Y.from}),(Le>0||!W.inclusiveRight&&!Le)&&pe.push({from:Y.to,to:re.to}),n.splice.apply(n,pe),Q+=pe.length-3}return n}function Nr(e){var t=e.markedSpans;if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}function ri(e,t){if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}function ci(e){return e.inclusiveLeft?-1:0}function ii(e){return e.inclusiveRight?1:0}function Ur(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),C=yt(r.from,n.from)||ci(e)-ci(t);if(C)return-C;var W=yt(r.to,n.to)||ii(e)-ii(t);return W||t.id-e.id}function Gr(e,t){var i=Kt&&e.markedSpans,r;if(i)for(var n=void 0,C=0;C<i.length;++C)n=i[C],n.marker.collapsed&&(t?n.from:n.to)==null&&(!r||Ur(r,n.marker)<0)&&(r=n.marker);return r}function Jr(e){return Gr(e,!0)}function zr(e){return Gr(e,!1)}function qe(e,t){var i=Kt&&e.markedSpans,r;if(i)for(var n=0;n<i.length;++n){var C=i[n];C.marker.collapsed&&(C.from==null||C.from<t)&&(C.to==null||C.to>t)&&(!r||Ur(r,C.marker)<0)&&(r=C.marker)}return r}function Zr(e,t,i,r,n){var C=Ze(e,t),W=Kt&&C.markedSpans;if(W)for(var Y=0;Y<W.length;++Y){var Q=W[Y];if(!Q.marker.collapsed)continue;var re=Q.marker.find(0),pe=yt(re.from,i)||ci(Q.marker)-ci(n),ge=yt(re.to,r)||ii(Q.marker)-ii(n);if(pe>=0&&ge<=0||pe<=0&&ge>=0)continue;if(pe<=0&&(Q.marker.inclusiveRight&&n.inclusiveLeft?yt(re.to,i)>=0:yt(re.to,i)>0)||pe>=0&&(Q.marker.inclusiveRight&&n.inclusiveLeft?yt(re.from,r)<=0:yt(re.from,r)<0))return!0}}function Ft(e){for(var t;t=Jr(e);)e=t.find(-1,!0).line;return e}function fi(e){for(var t;t=zr(e);)e=t.find(1,!0).line;return e}function ni(e){for(var t,i;t=zr(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function _i(e,t){var i=Ze(e,t),r=Ft(i);return i==r?t:Et(r)}function we(e,t){if(t>e.lastLine())return t;var i=Ze(e,t),r;if(!Ue(e,i))return t;for(;r=zr(i);)i=r.find(1,!0).line;return Et(i)+1}function Ue(e,t){var i=Kt&&t.markedSpans;if(i)for(var r=void 0,n=0;n<i.length;++n){if(r=i[n],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&ht(e,t,r))return!0}}function ht(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return ht(e,r.line,$t(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n=void 0,C=0;C<t.markedSpans.length;++C)if(n=t.markedSpans[C],n.marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(n.to==null||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&ht(e,t,n))return!0}function ot(e){e=Ft(e);for(var t=0,i=e.parent,r=0;r<i.lines.length;++r){var n=i.lines[r];if(n==e)break;t+=n.height}for(var C=i.parent;C;i=C,C=i.parent)for(var W=0;W<C.children.length;++W){var Y=C.children[W];if(Y==i)break;t+=Y.height}return t}function xt(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=Jr(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=zr(r);){var C=i.find(0,!0);t-=r.text.length-C.from.ch,r=C.to.line,t+=r.text.length-C.to.ch}return t}function Ct(e){var t=e.display,i=e.doc;t.maxLine=Ze(i,i.first),t.maxLineLength=xt(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var n=xt(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var _t=function(e,t,i){this.text=e,ri(this,t),this.height=i?i(this):1};_t.prototype.lineNo=function(){return Et(this)},ue(_t);function or(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Nr(e),ri(e,i);var n=r?r(e):1;n!=e.height&&St(e,n)}function st(e){e.parent=null,Nr(e)}var pt={},ct={};function gt(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?ct:pt;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function Mt(e,t){var i=b("span",null,null,B?"padding-right: .1px":null),r={pre:b("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var C=n?t.rest[n-1]:t.line,W=void 0;r.pos=0,r.addToken=Ot,Tt(e.display.measure)&&(W=Qe(C,e.doc.direction))&&(r.addToken=Tr(r.addToken,W)),r.map=[];var Y=t!=e.display.externalMeasured&&Et(C);pi(C,r,yr(e,C,Y)),C.styleClasses&&(C.styleClasses.bgClass&&(r.bgClass=z(C.styleClasses.bgClass,r.bgClass||"")),C.styleClasses.textClass&&(r.textClass=z(C.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(nt(e.display.measure))),n==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(B){var Q=r.content.lastChild;(/\bcm-tab\b/.test(Q.className)||Q.querySelector&&Q.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return se(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=z(r.pre.className,r.textClass||"")),r}function jt(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 Ot(e,t,i,r,n,C,W){if(!t)return;var Y=e.splitSpaces?nr(t,e.trailingSpace):t,Q=e.cm.state.specialChars,re=!1,pe;if(!Q.test(t))e.col+=t.length,pe=document.createTextNode(Y),e.map.push(e.pos,e.pos+t.length,pe),G&&H<9&&(re=!0),e.pos+=t.length;else{pe=document.createDocumentFragment();for(var ge=0;;){Q.lastIndex=ge;var Le=Q.exec(t),Ce=Le?Le.index-ge:t.length-ge;if(Ce){var Ne=document.createTextNode(Y.slice(ge,ge+Ce));G&&H<9?pe.appendChild(a("span",[Ne])):pe.appendChild(Ne),e.map.push(e.pos,e.pos+Ce,Ne),e.col+=Ce,e.pos+=Ce}if(!Le)break;ge+=Ce+1;var Be=void 0;if(Le[0]==" "){var ze=e.cm.options.tabSize,Ye=ze-e.col%ze;Be=pe.appendChild(a("span",K(Ye),"cm-tab")),Be.setAttribute("role","presentation"),Be.setAttribute("cm-text"," "),e.col+=Ye}else Le[0]=="\r"||Le[0]==`
`?(Be=pe.appendChild(a("span",Le[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Be.setAttribute("cm-text",Le[0]),e.col+=1):(Be=e.cm.options.specialCharPlaceholder(Le[0]),Be.setAttribute("cm-text",Le[0]),G&&H<9?pe.appendChild(a("span",[Be])):pe.appendChild(Be),e.col+=1);e.map.push(e.pos,e.pos+1,Be),e.pos++}}if(e.trailingSpace=Y.charCodeAt(t.length-1)==32,i||r||n||re||C||W){var rt=i||"";r&&(rt+=r),n&&(rt+=n);var $e=a("span",[pe],rt,C);if(W)for(var lt in W)W.hasOwnProperty(lt)&&lt!="style"&&lt!="class"&&$e.setAttribute(lt,W[lt]);return e.content.appendChild($e)}e.content.appendChild(pe)}function nr(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var C=e.charAt(n);C==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(C="\xA0"),r+=C,i=C==" "}return r}function Tr(e,t){return function(i,r,n,C,W,Y,Q){n=n?n+" cm-force-border":"cm-force-border";for(var re=i.pos,pe=re+r.length;;){for(var ge=void 0,Le=0;Le<t.length&&!(ge=t[Le],ge.to>re&&ge.from<=re);Le++);if(ge.to>=pe)return e(i,r,n,C,W,Y,Q);e(i,r.slice(0,ge.to-re),n,C,null,Y,Q),C=null,r=r.slice(ge.to-re),re=ge.to}}}function kt(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function pi(e,t,i){var r=e.markedSpans,n=e.text,C=0;if(!r){for(var W=1;W<i.length;W+=2)t.addToken(t,n.slice(C,C=i[W]),gt(i[W+1],t.cm.options));return}for(var Y=n.length,Q=0,re=1,pe="",ge,Le,Ce=0,Ne,Be,ze,Ye,rt;;){if(Ce==Q){Ne=Be=ze=Le="",rt=null,Ye=null,Ce=Infinity;for(var $e=[],lt=void 0,vt=0;vt<r.length;++vt){var mt=r[vt],wt=mt.marker;if(wt.type=="bookmark"&&mt.from==Q&&wt.widgetNode)$e.push(wt);else if(mt.from<=Q&&(mt.to==null||mt.to>Q||wt.collapsed&&mt.to==Q&&mt.from==Q)){if(mt.to!=null&&mt.to!=Q&&Ce>mt.to&&(Ce=mt.to,Be=""),wt.className&&(Ne+=" "+wt.className),wt.css&&(Le=(Le?Le+";":"")+wt.css),wt.startStyle&&mt.from==Q&&(ze+=" "+wt.startStyle),wt.endStyle&&mt.to==Ce&&(lt||(lt=[])).push(wt.endStyle,mt.to),wt.title&&((rt||(rt={})).title=wt.title),wt.attributes)for(var Wt in wt.attributes)(rt||(rt={}))[Wt]=wt.attributes[Wt];wt.collapsed&&(!Ye||Ur(Ye.marker,wt)<0)&&(Ye=mt)}else mt.from>Q&&Ce>mt.from&&(Ce=mt.from)}if(lt)for(var ur=0;ur<lt.length;ur+=2)lt[ur+1]==Ce&&(Be+=" "+lt[ur]);if(!Ye||Ye.from==Q)for(var Vt=0;Vt<$e.length;++Vt)kt(t,0,$e[Vt]);if(Ye&&(Ye.from||0)==Q){if(kt(t,(Ye.to==null?Y+1:Ye.to)-Q,Ye.marker,Ye.from==null),Ye.to==null)return;Ye.to==Q&&(Ye=!1)}}if(Q>=Y)break;for(var Fr=Math.min(Y,Ce);;){if(pe){var Lr=Q+pe.length;if(!Ye){var Qt=Lr>Fr?pe.slice(0,Fr-Q):pe;t.addToken(t,Qt,ge?ge+Ne:Ne,ze,Q+Qt.length==Ce?Be:"",Le,rt)}if(Lr>=Fr){pe=pe.slice(Fr-Q),Q=Fr;break}Q=Lr,ze=""}pe=n.slice(C,C=i[re++]),ge=gt(i[re++],t.cm.options)}}}function It(e,t,i){this.line=t,this.rest=ni(t),this.size=this.rest?Et(l(this.rest))-i+1:1,this.node=this.text=null,this.hidden=Ue(e,t)}function _r(e,t,i){for(var r=[],n,C=t;C<i;C=n){var W=new It(e.doc,Ze(e.doc,C),C);n=C+W.size,r.push(W)}return r}var pr=null;function Kr(e){pr?pr.ops.push(e):e.ownsGroup=pr={ops:[e],delayedCallbacks:[]}}function Rs(e){var t=e.delayedCallbacks,i=0;do{for(;i<t.length;i++)t[i].call(null);for(var r=0;r<e.ops.length;r++){var n=e.ops[r];if(n.cursorActivityHandlers)for(;n.cursorActivityCalled<n.cursorActivityHandlers.length;)n.cursorActivityHandlers[n.cursorActivityCalled++].call(null,n.cm)}}while(i<t.length)}function Ds(e,t){var i=e.ownsGroup;if(!i)return;try{Rs(i)}finally{pr=null,t(i)}}var vn=null;function cr(e,t){var i=ut(e,t);if(!i.length)return;var r=Array.prototype.slice.call(arguments,2),n;pr?n=pr.delayedCallbacks:vn?n=vn:(n=vn=[],setTimeout(Os,0));for(var C=function(Y){n.push(function(){return i[Y].apply(null,r)})},W=0;W<i.length;++W)C(W)}function Os(){var e=vn;vn=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,i,r){for(var n=0;n<t.changes.length;n++){var C=t.changes[n];C=="text"?Ms(e,t):C=="gutter"?Ja(e,t,i,r):C=="class"?da(e,t):C=="widget"&&Is(e,t,r)}t.changes=null}function yn(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),G&&H<8&&(e.node.style.zIndex=2)),e.node}function Ps(e,t){var i=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),t.background)i?t.background.className=i:(t.background.parentNode.removeChild(t.background),t.background=null);else if(i){var r=yn(t);t.background=r.insertBefore(a("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):Mt(e,t)}function Ms(e,t){var i=t.text.className,r=$a(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,da(e,t)):i&&(t.text.className=i)}function da(e,t){Ps(e,t),t.line.wrapClass?yn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function Ja(e,t,i,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var n=yn(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),n.insertBefore(t.gutterBackground,t.text)}var C=t.line.gutterMarkers;if(e.options.lineNumbers||C){var W=yn(t),Y=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Y),W.insertBefore(Y,t.text),t.line.gutterClass&&(Y.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!C||!C["CodeMirror-linenumbers"])&&(t.lineNumber=Y.appendChild(a("div",Xt(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),C)for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var re=e.display.gutterSpecs[Q].className,pe=C.hasOwnProperty(re)&&C[re];pe&&Y.appendChild(a("div",[pe],"CodeMirror-gutter-elt","left: "+r.gutterLeft[re]+"px; width: "+r.gutterWidth[re]+"px"))}}}function Is(e,t,i){t.alignable&&(t.alignable=null);for(var r=E("CodeMirror-linewidget"),n=t.node.firstChild,C=void 0;n;n=C)C=n.nextSibling,r.test(n.className)&&t.node.removeChild(n);Za(e,t,i)}function Ns(e,t,i,r){var n=$a(e,t);return t.text=t.node=n.pre,n.bgClass&&(t.bgClass=n.bgClass),n.textClass&&(t.textClass=n.textClass),da(e,t),Ja(e,t,i,r),Za(e,t,r),t.node}function Za(e,t,i){if(Qa(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)Qa(e,t.rest[r],t,i,!1)}function Qa(e,t,i,r,n){if(!t.widgets)return;for(var C=yn(i),W=0,Y=t.widgets;W<Y.length;++W){var Q=Y[W],re=a("div",[Q.node],"CodeMirror-linewidget"+(Q.className?" "+Q.className:""));Q.handleMouseEvents||re.setAttribute("cm-ignore-events","true"),Us(Q,re,i,r),e.display.input.setUneditable(re),n&&Q.above?C.insertBefore(re,i.gutter||i.text):C.appendChild(re),cr(Q,"redraw")}}function Us(e,t,i,r){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var n=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(n-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=n+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function bn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!S(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),u(t.display.measure,a("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function mi(e,t){for(var i=ve(t);i!=e.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==e.sizer&&i!=e.mover)return!0}function Hn(e){return e.lineSpace.offsetTop}function ha(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=u(e.measure,a("pre","x","CodeMirror-line-like")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function ai(e){return me-e.display.nativeBarWidth}function Bi(e){return e.display.scroller.clientWidth-ai(e)-e.display.barWidth}function ca(e){return e.display.scroller.clientHeight-ai(e)-e.display.barHeight}function Bs(e,t,i){var r=e.options.lineWrapping,n=r&&Bi(e);if(!t.measure.heights||r&&t.measure.width!=n){var C=t.measure.heights=[];if(r){t.measure.width=n;for(var W=t.text.firstChild.getClientRects(),Y=0;Y<W.length-1;Y++){var Q=W[Y],re=W[Y+1];Math.abs(Q.bottom-re.bottom)>2&&C.push((Q.bottom+re.top)/2-i.top)}}C.push(i.bottom-i.top)}}function eo(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var n=0;n<e.rest.length;n++)if(Et(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Fs(e,t){t=Ft(t);var i=Et(t),r=e.display.externalMeasured=new It(e.doc,t,i);r.lineN=i;var n=r.built=Mt(e,r);return r.text=n.pre,u(e.display.lineMeasure,n.pre),r}function to(e,t,i,r){return oi(e,Ji(e,t),i,r)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Wi(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function Ji(e,t){var i=Et(t),r=fa(e,i);r&&!r.text?r=null:r&&r.changes&&(Ya(e,r,i,ba(e)),e.curOp.forceUpdate=!0),r||(r=Fs(e,t));var n=eo(r,t,i);return{line:t,view:r,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function oi(e,t,i,r,n){t.before&&(i=-1);var C=i+(r||""),W;return t.cache.hasOwnProperty(C)?W=t.cache[C]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Bs(e,t.view,t.rect),t.hasHeights=!0),W=Ws(e,t,i,r),W.bogus||(t.cache[C]=W)),{left:W.left,right:W.right,top:n?W.rtop:W.top,bottom:n?W.rbottom:W.bottom}}var ro={left:0,right:0,top:0,bottom:0};function io(e,t,i){for(var r,n,C,W,Y,Q,re=0;re<e.length;re+=3)if(Y=e[re],Q=e[re+1],t<Y?(n=0,C=1,W="left"):t<Q?(n=t-Y,C=n+1):(re==e.length-3||t==Q&&e[re+3]>t)&&(C=Q-Y,n=C-1,t>=Q&&(W="right")),n!=null){if(r=e[re+2],Y==Q&&i==(r.insertLeft?"left":"right")&&(W=i),i=="left"&&n==0)for(;re&&e[re-2]==e[re-3]&&e[re-1].insertLeft;)r=e[(re-=3)+2],W="left";if(i=="right"&&n==Q-Y)for(;re<e.length-3&&e[re+3]==e[re+4]&&!e[re+5].insertLeft;)r=e[(re+=3)+2],W="right";break}return{node:r,start:n,end:C,collapse:W,coverStart:Y,coverEnd:Q}}function js(e,t){var i=ro;if(t=="left")for(var r=0;r<e.length&&!((i=e[r]).left!=i.right);r++);else for(var n=e.length-1;n>=0&&!((i=e[n]).left!=i.right);n--);return i}function Ws(e,t,i,r){var n=io(t.map,i,r),C=n.node,W=n.start,Y=n.end,Q=n.collapse,re;if(C.nodeType==3){for(var pe=0;pe<4;pe++){for(;W&&Oe(t.line.text.charAt(n.coverStart+W));)--W;for(;n.coverStart+Y<n.coverEnd&&Oe(t.line.text.charAt(n.coverStart+Y));)++Y;if(G&&H<9&&W==0&&Y==n.coverEnd-n.coverStart?re=C.parentNode.getBoundingClientRect():re=js(v(C,W,Y).getClientRects(),r),re.left||re.right||W==0)break;Y=W,W=W-1,Q="right"}G&&H<11&&(re=Hs(e.display.measure,re))}else{W>0&&(Q=r="right");var ge;e.options.lineWrapping&&(ge=C.getClientRects()).length>1?re=ge[r=="right"?ge.length-1:0]:re=C.getBoundingClientRect()}if(G&&H<9&&!W&&(!re||!re.left&&!re.right)){var Le=C.parentNode.getClientRects()[0];Le?re={left:Le.left,right:Le.left+Qi(e.display),top:Le.top,bottom:Le.bottom}:re=ro}for(var Ce=re.top-t.rect.top,Ne=re.bottom-t.rect.top,Be=(Ce+Ne)/2,ze=t.view.measure.heights,Ye=0;Ye<ze.length-1&&!(Be<ze[Ye]);Ye++);var rt=Ye?ze[Ye-1]:0,$e=ze[Ye],lt={left:(Q=="right"?re.right:re.left)-t.rect.left,right:(Q=="left"?re.left:re.right)-t.rect.left,top:rt,bottom:$e};return!re.left&&!re.right&&(lt.bogus=!0),e.options.singleCursorHeightPerLine||(lt.rtop=Ce,lt.rbottom=Ne),lt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Ht(e))return t;var i=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*r,bottom:t.bottom*r}}function no(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function ao(e){e.display.externalMeasure=null,g(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)no(e.display.view[t])}function xn(e){ao(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function oo(){return x&&h?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return x&&h?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var i=0;i<e.widgets.length;++i)e.widgets[i].above&&(t+=bn(e.widgets[i]));return t}function Gn(e,t,i,r,n){if(!n){var C=pa(t);i.top+=C,i.bottom+=C}if(r=="line")return i;r||(r="local");var W=ot(t);if(r=="local"?W+=Hn(e.display):W-=e.display.viewOffset,r=="page"||r=="window"){var Y=e.display.lineSpace.getBoundingClientRect();W+=Y.top+(r=="window"?0:so());var Q=Y.left+(r=="window"?0:oo());i.left+=Q,i.right+=Q}return i.top+=W,i.bottom+=W,i}function lo(e,t,i){if(i=="div")return t;var r=t.left,n=t.top;if(i=="page")r-=oo(),n-=so();else if(i=="local"||!i){var C=e.display.sizer.getBoundingClientRect();r+=C.left,n+=C.top}var W=e.display.lineSpace.getBoundingClientRect();return{left:r-W.left,top:n-W.top}}function ma(e,t,i,r,n){return r||(r=Ze(e.doc,t.line)),Gn(e,r,to(e,r,t.ch,n),i)}function Qr(e,t,i,r,n,C){r=r||Ze(e.doc,t.line),n||(n=Ji(e,r));function W(Ne,Be){var ze=oi(e,n,Ne,Be?"right":"left",C);return Be?ze.left=ze.right:ze.right=ze.left,Gn(e,r,ze,i)}var Y=Qe(r,e.doc.direction),Q=t.ch,re=t.sticky;if(Q>=r.text.length?(Q=r.text.length,re="before"):Q<=0&&(Q=0,re="after"),!Y)return W(re=="before"?Q-1:Q,re=="before");function pe(Ne,Be,ze){var Ye=Y[Be],rt=Ye.level==1;return W(ze?Ne-1:Ne,rt!=ze)}var ge=Xe(Y,Q,re),Le=Je,Ce=pe(Q,ge,re=="before");return Le!=null&&(Ce.other=pe(Q,Le,re!="before")),Ce}function uo(e,t){var i=0;t=bt(e.doc,t),e.options.lineWrapping||(i=Qi(e.display)*t.ch);var r=Ze(e.doc,t.line),n=ot(r)+Hn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function ga(e,t,i,r,n){var C=Fe(e,t,i);return C.xRel=n,r&&(C.outside=r),C}function va(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return ga(r.first,0,null,-1,-1);var n=Dt(r,i),C=r.first+r.size-1;if(n>C)return ga(r.first+r.size-1,Ze(r,C).text.length,null,1,1);t<0&&(t=0);for(var W=Ze(r,n);;){var Y=Gs(e,W,n,t,i),Q=qe(W,Y.ch+(Y.xRel>0||Y.outside>0?1:0));if(!Q)return Y;var re=Q.find(1);if(re.line==n)return re;W=Ze(r,n=re.line)}}function ho(e,t,i,r){r-=pa(t);var n=t.text.length,C=He(function(W){return oi(e,i,W-1).bottom<=r},n,0);return n=He(function(W){return oi(e,i,W).top>r},C,n),{begin:C,end:n}}function co(e,t,i,r){i||(i=Ji(e,t));var n=Gn(e,t,oi(e,i,r),"line").top;return ho(e,t,i,n)}function ya(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function Gs(e,t,i,r,n){n-=ot(t);var C=Ji(e,t),W=pa(t),Y=0,Q=t.text.length,re=!0,pe=Qe(t,e.doc.direction);if(pe){var ge=(e.options.lineWrapping?Ks:zs)(e,t,i,C,pe,r,n);re=ge.level!=1,Y=re?ge.from:ge.to-1,Q=re?ge.to:ge.from-1}var Le=null,Ce=null,Ne=He(function(vt){var mt=oi(e,C,vt);return mt.top+=W,mt.bottom+=W,ya(mt,r,n,!1)?(mt.top<=n&&mt.left<=r&&(Le=vt,Ce=mt),!0):!1},Y,Q),Be,ze,Ye=!1;if(Ce){var rt=r-Ce.left<Ce.right-r,$e=rt==re;Ne=Le+($e?0:1),ze=$e?"after":"before",Be=rt?Ce.left:Ce.right}else{!re&&(Ne==Q||Ne==Y)&&Ne++,ze=Ne==0?"after":Ne==t.text.length?"before":oi(e,C,Ne-(re?1:0)).bottom+W<=n==re?"after":"before";var lt=Qr(e,Fe(i,Ne,ze),"line",t,C);Be=lt.left,Ye=n<lt.top?-1:n>=lt.bottom?1:0}return Ne=Ie(t.text,Ne,1),ga(i,Ne,ze,Ye,r-Be)}function zs(e,t,i,r,n,C,W){var Y=He(function(ge){var Le=n[ge],Ce=Le.level!=1;return ya(Qr(e,Fe(i,Ce?Le.to:Le.from,Ce?"before":"after"),"line",t,r),C,W,!0)},0,n.length-1),Q=n[Y];if(Y>0){var re=Q.level!=1,pe=Qr(e,Fe(i,re?Q.from:Q.to,re?"after":"before"),"line",t,r);ya(pe,C,W,!0)&&pe.top>W&&(Q=n[Y-1])}return Q}function Ks(e,t,i,r,n,C,W){var Y=ho(e,t,r,W),Q=Y.begin,re=Y.end;/\s/.test(t.text.charAt(re-1))&&re--;for(var pe=null,ge=null,Le=0;Le<n.length;Le++){var Ce=n[Le];if(Ce.from>=re||Ce.to<=Q)continue;var Ne=Ce.level!=1,Be=oi(e,r,Ne?Math.min(re,Ce.to)-1:Math.max(Q,Ce.from)).right,ze=Be<C?C-Be+1e9:Be-C;(!pe||ge>ze)&&(pe=Ce,ge=ze)}return pe||(pe=n[n.length-1]),pe.from<Q&&(pe={from:Q,to:pe.to,level:pe.level}),pe.to>re&&(pe={from:pe.from,to:re,level:pe.level}),pe}var Fi;function Zi(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Fi==null){Fi=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Fi.appendChild(document.createTextNode("x")),Fi.appendChild(a("br"));Fi.appendChild(document.createTextNode("x"))}u(e.measure,Fi);var i=Fi.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),g(e.measure),i||1}function Qi(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),i=a("pre",[t],"CodeMirror-line-like");u(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function ba(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,C=t.gutters.firstChild,W=0;C;C=C.nextSibling,++W){var Y=e.display.gutterSpecs[W].className;i[Y]=C.offsetLeft+C.clientLeft+n,r[Y]=C.clientWidth}return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function xa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function fo(e){var t=Zi(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/Qi(e.display)-3);return function(n){if(Ue(e.doc,n))return 0;var C=0;if(n.widgets)for(var W=0;W<n.widgets.length;W++)n.widgets[W].height&&(C+=n.widgets[W].height);return i?C+(Math.ceil(n.text.length/r)||1)*t:C+t}}function Ea(e){var t=e.doc,i=fo(e);t.iter(function(r){var n=i(r);n!=r.height&&St(r,n)})}function ji(e,t,i,r){var n=e.display;if(!i&&ve(t).getAttribute("cm-not-content")=="true")return null;var C,W,Y=n.lineSpace.getBoundingClientRect();try{C=t.clientX-Y.left,W=t.clientY-Y.top}catch(ge){return null}var Q=va(e,C,W),re;if(r&&Q.xRel>0&&(re=Ze(e.doc,Q.line).text).length==Q.ch){var pe=$(re,re.length,e.options.tabSize)-re.length;Q=Fe(Q.line,Math.max(0,Math.round((C-qa(e.display).left)/Qi(e.display))-pe))}return Q}function Wi(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var i=e.display.view,r=0;r<i.length;r++)if(t-=i[r].size,t<0)return r}function wr(e,t,i,r){t==null&&(t=e.doc.first),i==null&&(i=e.doc.first+e.doc.size),r||(r=0);var n=e.display;if(r&&i<n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>t)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)Kt&&_i(e.doc,t)<n.viewTo&&Ai(e);else if(i<=n.viewFrom)Kt&&we(e.doc,i+r)>n.viewFrom?Ai(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)Ai(e);else if(t<=n.viewFrom){var C=zn(e,i,i+r,1);C?(n.view=n.view.slice(C.index),n.viewFrom=C.lineN,n.viewTo+=r):Ai(e)}else if(i>=n.viewTo){var W=zn(e,t,t,-1);W?(n.view=n.view.slice(0,W.index),n.viewTo=W.lineN):Ai(e)}else{var Y=zn(e,t,t,-1),Q=zn(e,i,i+r,1);Y&&Q?(n.view=n.view.slice(0,Y.index).concat(_r(e,Y.lineN,Q.lineN)).concat(n.view.slice(Q.index)),n.viewTo+=r):Ai(e)}var re=n.externalMeasured;re&&(i<re.lineN?re.lineN+=r:t<re.lineN+re.size&&(n.externalMeasured=null))}function wi(e,t,i){e.curOp.viewChanged=!0;var r=e.display,n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var C=r.view[Wi(e,t)];if(C.node==null)return;var W=C.changes||(C.changes=[]);he(W,i)==-1&&W.push(i)}function Ai(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function zn(e,t,i,r){var n=Wi(e,t),C,W=e.display.view;if(!Kt||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var Y=e.display.viewFrom,Q=0;Q<n;Q++)Y+=W[Q].size;if(Y!=t){if(r>0){if(n==W.length-1)return null;C=Y+W[n].size-t,n++}else C=Y-t;t+=C,i+=C}for(;_i(e.doc,i)!=i;){if(n==(r<0?0:W.length-1))return null;i+=r*W[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Vs(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=_r(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=_r(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Wi(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(_r(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,Wi(e,i)))),r.viewTo=i}function po(e){for(var t=e.display.view,i=0,r=0;r<t.length;r++){var n=t[r];!n.hidden&&(!n.node||n.changes)&&++i}return i}function En(e){e.display.input.showSelection(e.display.input.prepareSelection())}function mo(e,t){t===void 0&&(t=!0);for(var i=e.doc,r={},n=r.cursors=document.createDocumentFragment(),C=r.selection=document.createDocumentFragment(),W=0;W<i.sel.ranges.length;W++){if(!t&&W==i.sel.primIndex)continue;var Y=i.sel.ranges[W];if(Y.from().line>=e.display.viewTo||Y.to().line<e.display.viewFrom)continue;var Q=Y.empty();(Q||e.options.showCursorWhenSelecting)&&go(e,Y.head,n),Q||Xs(e,Y,C)}return r}function go(e,t,i){var r=Qr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),n=i.appendChild(a("div","\xA0","CodeMirror-cursor"));if(n.style.left=r.left+"px",n.style.top=r.top+"px",n.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var C=i.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));C.style.display="",C.style.left=r.other.left+"px",C.style.top=r.other.top+"px",C.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Kn(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,i){var r=e.display,n=e.doc,C=document.createDocumentFragment(),W=qa(e.display),Y=W.left,Q=Math.max(r.sizerWidth,Bi(e)-r.sizer.offsetLeft)-W.right,re=n.direction=="ltr";function pe($e,lt,vt,mt){lt<0&&(lt=0),lt=Math.round(lt),mt=Math.round(mt),C.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+$e+`px;
top: `+lt+"px; width: "+(vt==null?Q-$e:vt)+`px;
height: `+(mt-lt)+"px"))}function ge($e,lt,vt){var mt=Ze(n,$e),wt=mt.text.length,Wt,ur;function Vt(Qt,kr){return ma(e,Fe($e,Qt),"div",mt,kr)}function Fr(Qt,kr,fr){var ar=co(e,mt,null,Qt),qt=kr=="ltr"==(fr=="after")?"left":"right",Yt=fr=="after"?ar.begin:ar.end-(/\s/.test(mt.text.charAt(ar.end-1))?2:1);return Vt(Yt,qt)[qt]}var Lr=Qe(mt,n.direction);return Ve(Lr,lt||0,vt==null?wt:vt,function(Qt,kr,fr,ar){var qt=fr=="ltr",Yt=Vt(Qt,qt?"left":"right"),Rr=Vt(kr-1,qt?"right":"left"),cn=lt==null&&Qt==0,Pi=vt==null&&kr==wt,gr=ar==0,si=!Lr||ar==Lr.length-1;if(Rr.top-Yt.top<=3){var dr=(re?cn:Pi)&&gr,Va=(re?Pi:cn)&&si,vi=dr?Y:(qt?Yt:Rr).left,Vi=Va?Q:(qt?Rr:Yt).right;pe(vi,Yt.top,Vi-vi,Yt.bottom)}else{var Xi,Er,fn,Xa;qt?(Xi=re&&cn&&gr?Y:Yt.left,Er=re?Q:Fr(Qt,fr,"before"),fn=re?Y:Fr(kr,fr,"after"),Xa=re&&Pi&&si?Q:Rr.right):(Xi=re?Fr(Qt,fr,"before"):Y,Er=!re&&cn&&gr?Q:Yt.right,fn=!re&&Pi&&si?Y:Rr.left,Xa=re?Fr(kr,fr,"after"):Q),pe(Xi,Yt.top,Er-Xi,Yt.bottom),Yt.bottom<Rr.top&&pe(Y,Yt.bottom,null,Rr.top),pe(fn,Rr.top,Xa-fn,Rr.bottom)}(!Wt||Kn(Yt,Wt)<0)&&(Wt=Yt),Kn(Rr,Wt)<0&&(Wt=Rr),(!ur||Kn(Yt,ur)<0)&&(ur=Yt),Kn(Rr,ur)<0&&(ur=Rr)}),{start:Wt,end:ur}}var Le=t.from(),Ce=t.to();if(Le.line==Ce.line)ge(Le.line,Le.ch,Ce.ch);else{var Ne=Ze(n,Le.line),Be=Ze(n,Ce.line),ze=Ft(Ne)==Ft(Be),Ye=ge(Le.line,Le.ch,ze?Ne.text.length+1:null).end,rt=ge(Ce.line,ze?0:null,Ce.ch).start;ze&&(Ye.top<rt.top-2?(pe(Ye.right,Ye.top,null,Ye.bottom),pe(Y,rt.top,rt.left,rt.bottom)):pe(Ye.right,Ye.top,rt.left-Ye.right,Ye.bottom)),Ye.bottom<rt.top&&pe(Y,Ye.bottom,null,rt.top)}i.appendChild(C)}function Sa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var i=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||qi(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function vo(e){e.state.focused||(e.display.input.focus(),Ca(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,qi(e))},100)}function Ca(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(se(e,"focus",e,t),e.state.focused=!0,j(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),B&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function qi(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(se(e,"blur",e,t),e.state.focused=!1,p(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Vn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var n=t.view[r],C=e.options.lineWrapping,W=void 0,Y=0;if(n.hidden)continue;if(G&&H<8){var Q=n.node.offsetTop+n.node.offsetHeight;W=Q-i,i=Q}else{var re=n.node.getBoundingClientRect();W=re.bottom-re.top,!C&&n.text.firstChild&&(Y=n.text.firstChild.getBoundingClientRect().right-re.left-1)}var pe=n.line.height-W;if((pe>.005||pe<-.005)&&(St(n.line,W),bo(n.line),n.rest))for(var ge=0;ge<n.rest.length;ge++)bo(n.rest[ge]);if(Y>e.display.sizerWidth){var Le=Math.ceil(Y/Qi(e.display));Le>e.display.maxLineLength&&(e.display.maxLineLength=Le,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}function bo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var i=e.widgets[t],r=i.node.parentNode;r&&(i.height=r.offsetHeight)}}function Xn(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-Hn(e));var n=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,C=Dt(t,r),W=Dt(t,n);if(i&&i.ensure){var Y=i.ensure.from.line,Q=i.ensure.to.line;Y<C?(C=Y,W=Dt(t,ot(Ze(t,Y))+e.wrapper.clientHeight)):Math.min(Q,t.lastLine())>=W&&(C=Dt(t,ot(Ze(t,Q))-e.wrapper.clientHeight),W=Q)}return{from:C,to:Math.max(W,C+1)}}function Ys(e,t){if(q(e,"scrollCursorIntoView"))return;var i=e.display,r=i.sizer.getBoundingClientRect(),n=null;if(t.top+r.top<0?n=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),n!=null&&!A){var C=a("div","\u200B",null,`position: absolute;
top: `+(t.top-i.viewOffset-Hn(e.display))+`px;
height: `+(t.bottom-t.top+ai(e)+i.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(C),C.scrollIntoView(n),e.display.lineSpace.removeChild(C)}}function $s(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(t=t.ch?Fe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?Fe(t.line,t.ch+1,"before"):t);for(var C=0;C<5;C++){var W=!1,Y=Qr(e,t),Q=!i||i==t?Y:Qr(e,i);n={left:Math.min(Y.left,Q.left),top:Math.min(Y.top,Q.top)-r,right:Math.max(Y.left,Q.left),bottom:Math.max(Y.bottom,Q.bottom)+r};var re=Ta(e,n),pe=e.doc.scrollTop,ge=e.doc.scrollLeft;if(re.scrollTop!=null&&(Cn(e,re.scrollTop),Math.abs(e.doc.scrollTop-pe)>1&&(W=!0)),re.scrollLeft!=null&&(Hi(e,re.scrollLeft),Math.abs(e.doc.scrollLeft-ge)>1&&(W=!0)),!W)break}return n}function Js(e,t){var i=Ta(e,t);i.scrollTop!=null&&Cn(e,i.scrollTop),i.scrollLeft!=null&&Hi(e,i.scrollLeft)}function Ta(e,t){var i=e.display,r=Zi(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,C=ca(e),W={};t.bottom-t.top>C&&(t.bottom=t.top+C);var Y=e.doc.height+ha(i),Q=t.top<r,re=t.bottom>Y-r;if(t.top<n)W.scrollTop=Q?0:t.top;else if(t.bottom>n+C){var pe=Math.min(t.top,(re?Y:t.bottom)-C);pe!=n&&(W.scrollTop=pe)}var ge=e.options.fixedGutter?0:i.gutters.offsetWidth,Le=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-ge,Ce=Bi(e)-i.gutters.offsetWidth,Ne=t.right-t.left>Ce;return Ne&&(t.right=t.left+Ce),t.left<10?W.scrollLeft=0:t.left<Le?W.scrollLeft=Math.max(0,t.left+ge-(Ne?0:10)):t.right>Ce+Le-3&&(W.scrollLeft=t.right+(Ne?0:10)-Ce),W}function _a(e,t){if(t==null)return;Yn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function en(e){Yn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Sn(e,t,i){(t!=null||i!=null)&&Yn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Zs(e,t){Yn(e),e.curOp.scrollToPos=t}function Yn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=uo(e,t.from),r=uo(e,t.to);xo(e,i,r,t.margin)}}function xo(e,t,i,r){var n=Ta(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});Sn(e,n.scrollLeft,n.scrollTop)}function Cn(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;O||Aa(e,{top:t}),Eo(e,t,!0),O&&Aa(e),wn(e,100)}function Eo(e,t,i){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!i)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Hi(e,t,i,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,wo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Tn(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+ha(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?i:0,docHeight:r,scrollHeight:r+ai(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Gi=function(e,t,i){this.cm=i;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),Ae(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ae(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,G&&H<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Gi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var C=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+C)+"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:i?r:0,bottom:t?r:0}},Gi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Gi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Gi.prototype.zeroWidthHack=function(){var e=s&&!L?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ie,this.disableVert=new ie},Gi.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),C=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);C!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Gi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var _n=function(){};_n.prototype.update=function(){return{bottom:0,right:0}},_n.prototype.setScrollLeft=function(){},_n.prototype.setScrollTop=function(){},_n.prototype.clear=function(){};function tn(e,t){t||(t=Tn(e));var i=e.display.barWidth,r=e.display.barHeight;So(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&Vn(e),So(e,Tn(e)),i=e.display.barWidth,r=e.display.barHeight}function So(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var Co={native:Gi,null:_n};function To(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&p(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Co[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ae(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?Hi(e,t):Cn(e,t)},e),e.display.scrollbars.addClass&&j(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function zi(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:++Qs},Kr(e.curOp)}function Ki(e){var t=e.curOp;t&&Ds(t,function(i){for(var r=0;r<i.ops.length;r++)i.ops[r].cm.curOp=null;qs(i)})}function qs(e){for(var t=e.ops,i=0;i<t.length;i++)el(t[i]);for(var r=0;r<t.length;r++)tl(t[r]);for(var n=0;n<t.length;n++)rl(t[n]);for(var C=0;C<t.length;C++)il(t[C]);for(var W=0;W<t.length;W++)nl(t[W])}function el(e){var t=e.cm,i=t.display;ol(t),e.updateMaxLine&&Ct(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new $n(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&wa(e.cm,e.update)}function rl(e){var t=e.cm,i=t.display;e.updatedDisplay&&Vn(t),e.barMeasure=Tn(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=to(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+ai(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-Bi(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function il(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Hi(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==I();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&tn(t,e.barMeasure),e.updatedDisplay&&ka(t,e.barMeasure),e.selectionChanged&&Sa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&vo(e.cm)}function nl(e){var t=e.cm,i=t.display,r=t.doc;if(e.updatedDisplay&&_o(t,e.update),i.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(i.wheelStartX=i.wheelStartY=null),e.scrollTop!=null&&Eo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Hi(t,e.scrollLeft,!0,!0),e.scrollToPos){var n=$s(t,bt(r,e.scrollToPos.from),bt(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,n)}var C=e.maybeHiddenMarkers,W=e.maybeUnhiddenMarkers;if(C)for(var Y=0;Y<C.length;++Y)C[Y].lines.length||se(C[Y],"hide");if(W)for(var Q=0;Q<W.length;++Q)W[Q].lines.length&&se(W[Q],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&se(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Br(e,t){if(e.curOp)return t();zi(e);try{return t()}finally{Ki(e)}}function sr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);zi(e);try{return t.apply(e,arguments)}finally{Ki(e)}}}function xr(e){return function(){if(this.curOp)return e.apply(this,arguments);zi(this);try{return e.apply(this,arguments)}finally{Ki(this)}}}function lr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);zi(t);try{return e.apply(this,arguments)}finally{Ki(t)}}}function wn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,M(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var i=+new Date+e.options.workTime,r=br(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(C){if(r.line>=e.display.viewFrom){var W=C.styles,Y=C.text.length>e.options.maxHighlightLength?tr(t.mode,r.state):null,Q=bi(e,C,r,!0);Y&&(r.state=Y),C.styles=Q.styles;var re=C.styleClasses,pe=Q.classes;pe?C.styleClasses=pe:re&&(C.styleClasses=null);for(var ge=!W||W.length!=C.styles.length||re!=pe&&(!re||!pe||re.bgClass!=pe.bgClass||re.textClass!=pe.textClass),Le=0;!ge&&Le<W.length;++Le)ge=W[Le]!=C.styles[Le];ge&&n.push(r.line),C.stateAfter=r.save(),r.nextLine()}else C.text.length<=e.options.maxHighlightLength&&Ii(e,C.text,r),C.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return wn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&Br(e,function(){for(var C=0;C<n.length;C++)wi(e,n[C],"text")})}var $n=function(e,t,i){var r=e.display;this.viewport=t,this.visible=Xn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Bi(e),this.force=i,this.dims=ba(e),this.events=[]};$n.prototype.signal=function(e,t){ae(e,t)&&this.events.push(arguments)},$n.prototype.finish=function(){for(var e=0;e<this.events.length;e++)se.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=ai(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=ai(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=I();if(!t||!S(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&S(e.display.lineDiv,r.anchorNode)&&(i.anchorNode=r.anchorNode,i.anchorOffset=r.anchorOffset,i.focusNode=r.focusNode,i.focusOffset=r.focusOffset)}return i}function ll(e){if(!e||!e.activeElt||e.activeElt==I())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&S(document.body,e.anchorNode)&&S(document.body,e.focusNode)){var t=window.getSelection(),i=document.createRange();i.setEnd(e.anchorNode,e.anchorOffset),i.collapse(!1),t.removeAllRanges(),t.addRange(i),t.extend(e.focusNode,e.focusOffset)}}function wa(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return Ai(e),!1;if(!t.force&&t.visible.from>=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&po(e)==0)return!1;Ao(e)&&(Ai(e),t.dims=ba(e));var n=r.first+r.size,C=Math.max(t.visible.from-e.options.viewportMargin,r.first),W=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFrom<C&&C-i.viewFrom<20&&(C=Math.max(r.first,i.viewFrom)),i.viewTo>W&&i.viewTo-W<20&&(W=Math.min(n,i.viewTo)),Kt&&(C=_i(e.doc,C),W=we(e.doc,W));var Y=C!=i.viewFrom||W!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,C,W),i.viewOffset=ot(Ze(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var Q=po(e);if(!Y&&Q==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var re=sl(e);return Q>4&&(i.lineDiv.style.display="none"),ul(e,i.updateLineNumbers,t.dims),Q>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,ll(re),g(i.cursorDiv),g(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,Y&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,wn(e,400)),i.updateLineNumbers=null,!0}function _o(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Bi(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ha(e.display)-ca(e),i.top)}),t.visible=Xn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Xn(e.display,e.doc,i));if(!wa(e,t))break;Vn(e);var n=Tn(e);En(e),tn(e,n),ka(e,n),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 Aa(e,t){var i=new $n(e,t);if(wa(e,i)){Vn(e),_o(e,i);var r=Tn(e);En(e),tn(e,r),ka(e,r),i.finish()}}function ul(e,t,i){var r=e.display,n=e.options.lineNumbers,C=r.lineDiv,W=C.firstChild;function Y(Ne){var Be=Ne.nextSibling;return B&&s&&e.display.currentWheelTarget==Ne?Ne.style.display="none":Ne.parentNode.removeChild(Ne),Be}for(var Q=r.view,re=r.viewFrom,pe=0;pe<Q.length;pe++){var ge=Q[pe];if(!ge.hidden)if(!ge.node||ge.node.parentNode!=C){var Le=Ns(e,ge,re,i);C.insertBefore(Le,W)}else{for(;W!=ge.node;)W=Y(W);var Ce=n&&t!=null&&t<=re&&ge.lineNumber;ge.changes&&(he(ge.changes,"gutter")>-1&&(Ce=!1),Ya(e,ge,re,i)),Ce&&(g(ge.lineNumber),ge.lineNumber.appendChild(document.createTextNode(Xt(e.options,re)))),W=ge.node.nextSibling}re+=ge.size}for(;W;)W=Y(W)}function La(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ka(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+ai(e)+"px"}function wo(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=xa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,C=r+"px",W=0;W<i.length;W++)if(!i[W].hidden){e.options.fixedGutter&&(i[W].gutter&&(i[W].gutter.style.left=C),i[W].gutterBackground&&(i[W].gutterBackground.style.left=C));var Y=i[W].alignable;if(Y)for(var Q=0;Q<Y.length;Q++)Y[Q].style.left=C}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}function Ao(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=Xt(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var n=r.measure.appendChild(a("div",[a("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),C=n.firstChild.offsetWidth,W=n.offsetWidth-C;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(C,r.lineGutter.offsetWidth-W)+1,r.lineNumWidth=r.lineNumInnerWidth+W,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",La(e.display),!0}return!1}function Ra(e,t){for(var i=[],r=!1,n=0;n<e.length;n++){var C=e[n],W=null;if(typeof C!="string"&&(W=C.style,C=C.className),C=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:C,style:W})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function Lo(e){var t=e.gutters,i=e.gutterSpecs;g(t),e.lineGutter=null;for(var r=0;r<i.length;++r){var n=i[r],C=n.className,W=n.style,Y=t.appendChild(a("div",null,"CodeMirror-gutter "+C));W&&(Y.style.cssText=W),C=="CodeMirror-linenumbers"&&(e.lineGutter=Y,Y.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",La(e)}function An(e){Lo(e.display),wr(e),wo(e)}function dl(e,t,i,r){var n=this;this.input=i,n.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=b("div",null,"CodeMirror-code"),n.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=a("div",null,"CodeMirror-cursors"),n.measure=a("div",null,"CodeMirror-measure"),n.lineMeasure=a("div",null,"CodeMirror-measure"),n.lineSpace=b("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var C=b("div",[n.lineSpace],"CodeMirror-lines");n.mover=a("div",[C],null,"position: relative"),n.sizer=a("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=a("div",null,null,"position: absolute; height: "+me+"px; width: 1px;"),n.gutters=a("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=a("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=a("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),G&&H<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!B&&!(O&&o)&&(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,n.gutterSpecs=Ra(r.gutters,r.lineNumbers),Lo(n),i.init(n)}var Jn=0,jr=null;G?jr=-.53:O?jr=15:x?jr=-.7:P&&(jr=-1/3);function ko(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),i==null&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:i==null&&(i=e.wheelDelta),{x:t,y:i}}function hl(e){var t=ko(e);return t.x*=jr,t.y*=jr,t}function Ro(e,t){var i=ko(t),r=i.x,n=i.y,C=e.display,W=C.scroller,Y=W.scrollWidth>W.clientWidth,Q=W.scrollHeight>W.clientHeight;if(!(r&&Y||n&&Q))return;if(n&&s&&B){e:for(var re=t.target,pe=C.view;re!=W;re=re.parentNode)for(var ge=0;ge<pe.length;ge++)if(pe[ge].node==re){e.display.currentWheelTarget=re;break e}}if(r&&!O&&!w&&jr!=null){n&&Q&&Cn(e,Math.max(0,W.scrollTop+n*jr)),Hi(e,Math.max(0,W.scrollLeft+r*jr)),(!n||n&&Q)&&te(t),C.wheelStartX=null;return}if(n&&jr!=null){var Le=n*jr,Ce=e.doc.scrollTop,Ne=Ce+C.wrapper.clientHeight;Le<0?Ce=Math.max(0,Ce+Le-50):Ne=Math.min(e.doc.height,Ne+Le+50),Aa(e,{top:Ce,bottom:Ne})}Jn<20&&(C.wheelStartX==null?(C.wheelStartX=W.scrollLeft,C.wheelStartY=W.scrollTop,C.wheelDX=r,C.wheelDY=n,setTimeout(function(){if(C.wheelStartX==null)return;var Be=W.scrollLeft-C.wheelStartX,ze=W.scrollTop-C.wheelStartY,Ye=ze&&C.wheelDY&&ze/C.wheelDY||Be&&C.wheelDX&&Be/C.wheelDX;if(C.wheelStartX=C.wheelStartY=null,!Ye)return;jr=(jr*Jn+Ye)/(Jn+1),++Jn},200)):(C.wheelDX+=r,C.wheelDY+=n))}var Wr=function(e,t){this.ranges=e,this.primIndex=t};Wr.prototype.primary=function(){return this.ranges[this.primIndex]},Wr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var i=this.ranges[t],r=e.ranges[t];if(!Pr(i.anchor,r.anchor)||!Pr(i.head,r.head))return!1}return!0},Wr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Nt(yi(this.ranges[t].anchor),yi(this.ranges[t].head));return new Wr(e,this.primIndex)},Wr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Wr.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(yt(t,r.from())>=0&&yt(e,r.to())<=0)return i}return-1};var Nt=function(e,t){this.anchor=e,this.head=t};Nt.prototype.from=function(){return ui(this.anchor,this.head)},Nt.prototype.to=function(){return li(this.anchor,this.head)},Nt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function qr(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(Le,Ce){return yt(Le.from(),Ce.from())}),i=he(t,n);for(var C=1;C<t.length;C++){var W=t[C],Y=t[C-1],Q=yt(Y.to(),W.from());if(r&&!W.empty()?Q>0:Q>=0){var re=ui(Y.from(),W.from()),pe=li(Y.to(),W.to()),ge=Y.empty()?W.from()==W.head:Y.from()==Y.head;C<=i&&--i,t.splice(--C,2,new Nt(ge?pe:re,ge?re:pe))}}return new Wr(t,i)}function Li(e,t){return new Wr([new Nt(e,t||e)],0)}function ki(e){return e.text?Fe(e.from.line+e.text.length-1,l(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Do(e,t){if(yt(e,t.from)<0)return e;if(yt(e,t.to)<=0)return ki(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=ki(t).ch-t.to.ch),Fe(i,r)}function Da(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new Nt(Do(n.anchor,t),Do(n.head,t)))}return qr(e.cm,i,e.sel.primIndex)}function Oo(e,t,i){return e.line==t.line?Fe(i.line,e.ch-t.ch+i.ch):Fe(i.line+(e.line-t.line),e.ch)}function cl(e,t,i){for(var r=[],n=Fe(e.first,0),C=n,W=0;W<t.length;W++){var Y=t[W],Q=Oo(Y.from,n,C),re=Oo(ki(Y),n,C);if(n=Y.to,C=re,i=="around"){var pe=e.sel.ranges[W],ge=yt(pe.head,pe.anchor)<0;r[W]=new Nt(ge?re:Q,ge?Q:re)}else r[W]=new Nt(Q,Q)}return new Wr(r,e.sel.primIndex)}function Oa(e){e.doc.mode=hr(e.options,e.doc.modeOption),Ln(e)}function Ln(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,wn(e,100),e.state.modeGen++,e.curOp&&wr(e)}function Po(e,t){return t.from.ch==0&&t.to.ch==0&&l(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Pa(e,t,i,r){function n(rt){return i?i[rt]:null}function C(rt,$e,lt){or(rt,$e,lt,r),cr(rt,"change",rt,t)}function W(rt,$e){for(var lt=[],vt=rt;vt<$e;++vt)lt.push(new _t(re[vt],n(vt),r));return lt}var Y=t.from,Q=t.to,re=t.text,pe=Ze(e,Y.line),ge=Ze(e,Q.line),Le=l(re),Ce=n(re.length-1),Ne=Q.line-Y.line;if(t.full)e.insert(0,W(0,re.length)),e.remove(re.length,e.size-re.length);else if(Po(e,t)){var Be=W(0,re.length-1);C(ge,ge.text,Ce),Ne&&e.remove(Y.line,Ne),Be.length&&e.insert(Y.line,Be)}else if(pe==ge)if(re.length==1)C(pe,pe.text.slice(0,Y.ch)+Le+pe.text.slice(Q.ch),Ce);else{var ze=W(1,re.length-1);ze.push(new _t(Le+pe.text.slice(Q.ch),Ce,r)),C(pe,pe.text.slice(0,Y.ch)+re[0],n(0)),e.insert(Y.line+1,ze)}else if(re.length==1)C(pe,pe.text.slice(0,Y.ch)+re[0]+ge.text.slice(Q.ch),n(0)),e.remove(Y.line+1,Ne);else{C(pe,pe.text.slice(0,Y.ch)+re[0],n(0)),C(ge,Le+ge.text.slice(Q.ch),Ce);var Ye=W(1,re.length-1);Ne>1&&e.remove(Y.line+1,Ne-1),e.insert(Y.line+1,Ye)}cr(e,"change",e,t)}function Ri(e,t,i){function r(n,C,W){if(n.linked)for(var Y=0;Y<n.linked.length;++Y){var Q=n.linked[Y];if(Q.doc==C)continue;var re=W&&Q.sharedHist;if(i&&!re)continue;t(Q.doc,re),r(Q.doc,n,re)}}r(e,null,!0)}function Mo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ea(e),Oa(e),Io(e),e.options.lineWrapping||Ct(e),e.options.mode=t.modeOption,wr(e)}function Io(e){(e.doc.direction=="rtl"?j:p)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Br(e,function(){Io(e),wr(e)})}function Zn(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ma(e,t){var i={from:yi(t.from),to:ki(t),text:Rt(e,t.from,t.to)};return Bo(e,i,t.from.line,t.to.line+1),Ri(e,function(r){return Bo(r,i,t.from.line,t.to.line+1)},!0),i}function No(e){for(;e.length;){var t=l(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return No(e.done),l(e.done);if(e.done.length&&!l(e.done).ranges)return l(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),l(e.done)}function Uo(e,t,i,r){var n=e.history;n.undone.length=0;var C=+new Date,W,Y;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>C-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(W=pl(n,n.lastOp==r)))Y=l(W.changes),yt(t.from,t.to)==0&&yt(t.from,Y.to)==0?Y.to=ki(t):W.changes.push(Ma(e,t));else{var Q=l(n.done);for((!Q||!Q.ranges)&&Qn(e.sel,n.done),W={changes:[Ma(e,t)],generation:n.generation},n.done.push(W);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=C,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,Y||se(e,"historyAdded")}function ml(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,i,r){var n=e.history,C=r&&r.origin;i==n.lastSelOp||C&&n.lastSelOrigin==C&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==C||ml(e,C,l(n.done),t))?n.done[n.done.length-1]=t:Qn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=C,n.lastSelOp=i,r&&r.clearRedo!==!1&&No(n.undone)}function Qn(e,t){var i=l(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Bo(e,t,i,r){var n=t["spans_"+e.id],C=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(W){W.markedSpans&&((n||(n=t["spans_"+e.id]={}))[C]=W.markedSpans),++C})}function vl(e){if(!e)return null;for(var t,i=0;i<e.length;++i)e[i].marker.explicitlyCleared?t||(t=e.slice(0,i)):t&&t.push(e[i]);return t?t.length?t:null:e}function yl(e,t){var i=t["spans_"+e.id];if(!i)return null;for(var r=[],n=0;n<t.text.length;++n)r.push(vl(i[n]));return r}function Fo(e,t){var i=yl(e,t),r=Ti(e,t);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var C=i[n],W=r[n];if(C&&W){e:for(var Y=0;Y<W.length;++Y){for(var Q=W[Y],re=0;re<C.length;++re)if(C[re].marker==Q.marker)continue e;C.push(Q)}}else W&&(i[n]=W)}return i}function rn(e,t,i){for(var r=[],n=0;n<e.length;++n){var C=e[n];if(C.ranges){r.push(i?Wr.prototype.deepCopy.call(C):C);continue}var W=C.changes,Y=[];r.push({changes:Y});for(var Q=0;Q<W.length;++Q){var re=W[Q],pe=void 0;if(Y.push({from:re.from,to:re.to,text:re.text}),t)for(var ge in re)(pe=ge.match(/^spans_(\d+)$/))&&(he(t,Number(pe[1]))>-1&&(l(Y)[ge]=re[ge],delete re[ge]))}}return r}function Ia(e,t,i,r){if(r){var n=e.anchor;if(i){var C=yt(t,n)<0;C!=yt(i,n)<0?(n=t,t=i):C!=yt(t,i)<0&&(t=i)}return new Nt(n,t)}else return new Nt(i||t,t)}function qn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),mr(e,new Wr([Ia(e.sel.primary(),t,i,n)],0),r)}function jo(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),C=0;C<e.sel.ranges.length;C++)r[C]=Ia(e.sel.ranges[C],t[C],null,n);var W=qr(e.cm,r,e.sel.primIndex);mr(e,W,i)}function Na(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,mr(e,qr(e.cm,n,e.sel.primIndex),r)}function Wo(e,t,i,r){mr(e,Li(t,i),r)}function bl(e,t,i){var r={ranges:t.ranges,update:function(n){this.ranges=[];for(var C=0;C<n.length;C++)this.ranges[C]=new Nt(bt(e,n[C].anchor),bt(e,n[C].head))},origin:i&&i.origin};return se(e,"beforeSelectionChange",e,r),e.cm&&se(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?qr(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,i){var r=e.history.done,n=l(r);n&&n.ranges?(r[r.length-1]=t,ea(e,t,i)):mr(e,t,i)}function mr(e,t,i){ea(e,t,i),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function ea(e,t,i){(ae(e,"beforeSelectionChange")||e.cm&&ae(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var r=i&&i.bias||(yt(t.primary().head,e.sel.primary().head)<0?-1:1);Go(e,Ko(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&en(e.cm)}function Go(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ee(e.cm)),cr(e,"cursorActivity",e)}function zo(e){Go(e,Ko(e,e.sel,null,!1))}function Ko(e,t,i,r){for(var n,C=0;C<t.ranges.length;C++){var W=t.ranges[C],Y=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[C],Q=ta(e,W.anchor,Y&&Y.anchor,i,r),re=ta(e,W.head,Y&&Y.head,i,r);(n||Q!=W.anchor||re!=W.head)&&(n||(n=t.ranges.slice(0,C)),n[C]=new Nt(Q,re))}return n?qr(e.cm,n,t.primIndex):t}function nn(e,t,i,r,n){var C=Ze(e,t.line);if(C.markedSpans)for(var W=0;W<C.markedSpans.length;++W){var Y=C.markedSpans[W],Q=Y.marker,re="selectLeft"in Q?!Q.selectLeft:Q.inclusiveLeft,pe="selectRight"in Q?!Q.selectRight:Q.inclusiveRight;if((Y.from==null||(re?Y.from<=t.ch:Y.from<t.ch))&&(Y.to==null||(pe?Y.to>=t.ch:Y.to>t.ch))){if(n&&(se(Q,"beforeCursorEnter"),Q.explicitlyCleared))if(C.markedSpans){--W;continue}else break;if(!Q.atomic)continue;if(i){var ge=Q.find(r<0?1:-1),Le=void 0;if((r<0?pe:re)&&(ge=Vo(e,ge,-r,ge&&ge.line==t.line?C:null)),ge&&ge.line==t.line&&(Le=yt(ge,i))&&(r<0?Le<0:Le>0))return nn(e,ge,t,r,n)}var Ce=Q.find(r<0?-1:1);return(r<0?re:pe)&&(Ce=Vo(e,Ce,r,Ce.line==t.line?C:null)),Ce?nn(e,Ce,t,r,n):null}}return t}function ta(e,t,i,r,n){var C=r||1,W=nn(e,t,i,C,n)||!n&&nn(e,t,i,C,!0)||nn(e,t,i,-C,n)||!n&&nn(e,t,i,-C,!0);return W||(e.cantEdit=!0,Fe(e.first,0))}function Vo(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?bt(e,Fe(t.line-1)):null:i>0&&t.ch==(r||Ze(e,t.line)).text.length?t.line<e.first+e.size-1?Fe(t.line+1,0):null:new Fe(t.line,t.ch+i)}function Xo(e){e.setSelection(Fe(e.firstLine(),0),Fe(e.lastLine()),Se)}function Yo(e,t,i){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return i&&(r.update=function(n,C,W,Y){n&&(r.from=bt(e,n)),C&&(r.to=bt(e,C)),W&&(r.text=W),Y!==void 0&&(r.origin=Y)}),se(e,"beforeChange",e,r),e.cm&&se(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function an(e,t,i){if(e.cm){if(!e.cm.curOp)return sr(e.cm,an)(e,t,i);if(e.cm.state.suppressEdits)return}if((ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=Ci&&!i&&Ui(e,t.from,t.to);if(r)for(var n=r.length-1;n>=0;--n)$o(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else $o(e,t)}function $o(e,t){if(t.text.length==1&&t.text[0]==""&&yt(t.from,t.to)==0)return;var i=Da(e,t);Uo(e,t,i,e.cm?e.cm.curOp.id:NaN),kn(e,t,i,Ti(e,t));var r=[];Ri(e,function(n,C){!C&&he(r,n.history)==-1&&(qo(n.history,t),r.push(n.history)),kn(n,t,null,Ti(n,t))})}function ra(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!i)return;for(var n=e.history,C,W=e.sel,Y=t=="undo"?n.done:n.undone,Q=t=="undo"?n.undone:n.done,re=0;re<Y.length&&!(C=Y[re],i?C.ranges&&!C.equals(e.sel):!C.ranges);re++);if(re==Y.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(C=Y.pop(),C.ranges){if(Qn(C,Q),i&&!C.equals(e.sel)){mr(e,C,{clearRedo:!1});return}W=C}else if(r){Y.push(C);return}else break;var pe=[];Qn(W,Q),Q.push({changes:pe,generation:n.generation}),n.generation=C.generation||++n.maxGeneration;for(var ge=ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"),Le=function(Be){var ze=C.changes[Be];if(ze.origin=t,ge&&!Yo(e,ze,!1))return Y.length=0,{};pe.push(Ma(e,ze));var Ye=Be?Da(e,ze):l(Y);kn(e,ze,Ye,Fo(e,ze)),!Be&&e.cm&&e.cm.scrollIntoView({from:ze.from,to:ki(ze)});var rt=[];Ri(e,function($e,lt){!lt&&he(rt,$e.history)==-1&&(qo($e.history,ze),rt.push($e.history)),kn($e,ze,null,Fo($e,ze))})},Ce=C.changes.length-1;Ce>=0;--Ce){var Ne=Le(Ce);if(Ne)return Ne.v}}function Jo(e,t){if(t==0)return;if(e.first+=t,e.sel=new Wr(c(e.sel.ranges,function(n){return new Nt(Fe(n.anchor.line+t,n.anchor.ch),Fe(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){wr(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)wi(e.cm,r,"gutter")}}function kn(e,t,i,r){if(e.cm&&!e.cm.curOp)return sr(e.cm,kn)(e,t,i,r);if(t.to.line<e.first){Jo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var n=t.text.length-1-(e.first-t.from.line);Jo(e,n),t={from:Fe(e.first,0),to:Fe(t.to.line+n,t.to.ch),text:[l(t.text)],origin:t.origin}}var C=e.lastLine();t.to.line>C&&(t={from:t.from,to:Fe(C,Ze(e,C).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Rt(e,t.from,t.to),i||(i=Da(e,t)),e.cm?xl(e.cm,t,r):Pa(e,t,r),ea(e,i,Se),e.cantEdit&&ta(e,Fe(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,i){var r=e.doc,n=e.display,C=t.from,W=t.to,Y=!1,Q=C.line;e.options.lineWrapping||(Q=Et(Ft(Ze(r,C.line))),r.iter(Q,W.line+1,function(Ce){if(Ce==n.maxLine)return Y=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ee(e),Pa(r,t,i,fo(e)),e.options.lineWrapping||(r.iter(Q,C.line+t.text.length,function(Ce){var Ne=xt(Ce);Ne>n.maxLineLength&&(n.maxLine=Ce,n.maxLineLength=Ne,n.maxLineChanged=!0,Y=!1)}),Y&&(e.curOp.updateMaxLine=!0)),pn(r,C.line),wn(e,400);var re=t.text.length-(W.line-C.line)-1;t.full?wr(e):C.line==W.line&&t.text.length==1&&!Po(e.doc,t)?wi(e,C.line,"text"):wr(e,C.line,W.line+1,re);var pe=ae(e,"changes"),ge=ae(e,"change");if(ge||pe){var Le={from:C,to:W,text:t.text,removed:t.removed,origin:t.origin};ge&&cr(e,"change",e,Le),pe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Le)}e.display.selForContextMenu=null}function on(e,t,i,r,n){var C;r||(r=i),yt(r,i)<0&&(C=[r,i],i=C[0],r=C[1]),typeof t=="string"&&(t=e.splitLines(t)),an(e,{from:i,to:r,text:t,origin:n})}function Zo(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Qo(e,t,i,r){for(var n=0;n<e.length;++n){var C=e[n],W=!0;if(C.ranges){C.copied||(C=e[n]=C.deepCopy(),C.copied=!0);for(var Y=0;Y<C.ranges.length;Y++)Zo(C.ranges[Y].anchor,t,i,r),Zo(C.ranges[Y].head,t,i,r);continue}for(var Q=0;Q<C.changes.length;++Q){var re=C.changes[Q];if(i<re.from.line)re.from=Fe(re.from.line+r,re.from.ch),re.to=Fe(re.to.line+r,re.to.ch);else if(t<=re.to.line){W=!1;break}}W||(e.splice(0,n+1),n=0)}}function qo(e,t){var i=t.from.line,r=t.to.line,n=t.text.length-(r-i)-1;Qo(e.done,i,r,n),Qo(e.undone,i,r,n)}function Rn(e,t,i,r){var n=t,C=t;return typeof t=="number"?C=Ze(e,Yr(e,t)):n=Et(t),n==null?null:(r(C,n)&&e.cm&&wi(e.cm,n,i),C)}function Dn(e){this.lines=e,this.parent=null;for(var t=0,i=0;i<e.length;++i)e[i].parent=this,t+=e[i].height;this.height=t}Dn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,r=e+t;i<r;++i){var n=this.lines[i];this.height-=n.height,st(n),cr(n,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,i){this.height+=i,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,i){for(var r=e+t;e<r;++e)if(i(this.lines[e]))return!0}};function On(e){this.children=e;for(var t=0,i=0,r=0;r<e.length;++r){var n=e[r];t+=n.chunkSize(),i+=n.height,n.parent=this}this.size=t,this.height=i,this.parent=null}On.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var r=this.children[i],n=r.chunkSize();if(e<n){var C=Math.min(t,n-e),W=r.height;if(r.removeInner(e,C),this.height-=W-r.height,n==C&&(this.children.splice(i--,1),r.parent=null),(t-=C)==0)break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Dn))){var Y=[];this.collapse(Y),this.children=[new Dn(Y)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,i){this.size+=t.length,this.height+=i;for(var r=0;r<this.children.length;++r){var n=this.children[r],C=n.chunkSize();if(e<=C){if(n.insertInner(e,t,i),n.lines&&n.lines.length>50){for(var W=n.lines.length%25+25,Y=W;Y<n.lines.length;){var Q=new Dn(n.lines.slice(Y,Y+=25));n.height-=Q.height,this.children.splice(++r,0,Q),Q.parent=this}n.lines=n.lines.slice(0,W),this.maybeSpill()}break}e-=C}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new On(t);if(e.parent){e.size-=i.size,e.height-=i.height;var n=he(e.parent.children,e);e.parent.children.splice(n+1,0,i)}else{var r=new On(e.children);r.parent=e,e.children=[r,i],e=r}i.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,i){for(var r=0;r<this.children.length;++r){var n=this.children[r],C=n.chunkSize();if(e<C){var W=Math.min(t,C-e);if(n.iterN(e,W,i))return!0;if((t-=W)==0)break;e=0}else e-=C}}};var Pn=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};Pn.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=Et(i);if(r==null||!t)return;for(var n=0;n<t.length;++n)t[n]==this&&t.splice(n--,1);t.length||(i.widgets=null);var C=bn(this);St(i,Math.max(0,i.height-C)),e&&(Br(e,function(){es(e,i,-C),wi(e,r,"widget")}),cr(e,"lineWidgetCleared",e,this,r))},Pn.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,r=this.line;this.height=null;var n=bn(this)-t;if(!n)return;Ue(this.doc,r)||St(r,r.height+n),i&&Br(i,function(){i.curOp.forceUpdate=!0,es(i,r,n),cr(i,"lineWidgetChanged",i,e,Et(r))})},ue(Pn);function es(e,t,i){ot(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&_a(e,i)}function El(e,t,i,r){var n=new Pn(e,i,r),C=e.cm;return C&&n.noHScroll&&(C.display.alignWidgets=!0),Rn(e,t,"widget",function(W){var Y=W.widgets||(W.widgets=[]);if(n.insertAt==null?Y.push(n):Y.splice(Math.min(Y.length-1,Math.max(0,n.insertAt)),0,n),n.line=W,C&&!Ue(e,W)){var Q=ot(W)<e.scrollTop;St(W,W.height+bn(n)),Q&&_a(C,n.height),C.curOp.forceUpdate=!0}return!0}),C&&cr(C,"lineWidgetAdded",C,n,typeof t=="number"?t:Et(t)),n}var ts=0,Di=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};Di.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&zi(e),ae(this,"clear")){var i=this.find();i&&cr(this,"clear",i.from,i.to)}for(var r=null,n=null,C=0;C<this.lines.length;++C){var W=this.lines[C],Y=$t(W.markedSpans,this);e&&!this.collapsed?wi(e,Et(W),"text"):e&&(Y.to!=null&&(n=Et(W)),Y.from!=null&&(r=Et(W))),W.markedSpans=hi(W.markedSpans,Y),Y.from==null&&this.collapsed&&!Ue(this.doc,W)&&e&&St(W,Zi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Q=0;Q<this.lines.length;++Q){var re=Ft(this.lines[Q]),pe=xt(re);pe>e.display.maxLineLength&&(e.display.maxLine=re,e.display.maxLineLength=pe,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&wr(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&zo(e.doc)),e&&cr(e,"markerCleared",e,this,r,n),t&&Ki(e),this.parent&&this.parent.clear()},Di.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var C=this.lines[n],W=$t(C.markedSpans,this);if(W.from!=null&&(i=Fe(t?C:Et(C),W.from),e==-1))return i;if(W.to!=null&&(r=Fe(t?C:Et(C),W.to),e==1))return r}return i&&{from:i,to:r}},Di.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;if(!t||!r)return;Br(r,function(){var n=t.line,C=Et(t.line),W=fa(r,C);if(W&&(no(W),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Ue(i.doc,n)&&i.height!=null){var Y=i.height;i.height=null;var Q=bn(i)-Y;Q&&St(n,n.height+Q)}cr(r,"markerChanged",r,e)})},Di.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||he(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Di.prototype.detachLine=function(e){if(this.lines.splice(he(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ue(Di);function sn(e,t,i,r,n){if(r&&r.shared)return Sl(e,t,i,r,n);if(e.cm&&!e.cm.curOp)return sr(e.cm,sn)(e,t,i,r,n);var C=new Di(e,n),W=yt(t,i);if(r&&N(r,C,!1),W>0||W==0&&C.clearWhenEmpty!==!1)return C;if(C.replacedWith&&(C.collapsed=!0,C.widgetNode=b("span",[C.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||C.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(C.widgetNode.insertLeft=!0)),C.collapsed){if(Zr(e,t.line,t,i,C)||t.line!=i.line&&Zr(e,i.line,t,i,C))throw new Error("Inserting collapsed marker partially overlapping an existing one");mn()}C.addToHistory&&Uo(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var Y=t.line,Q=e.cm,re;if(e.iter(Y,i.line+1,function(ge){Q&&C.collapsed&&!Q.options.lineWrapping&&Ft(ge)==Q.display.maxLine&&(re=!0),C.collapsed&&Y!=t.line&&St(ge,0),gn(ge,new ti(C,Y==t.line?t.ch:null,Y==i.line?i.ch:null)),++Y}),C.collapsed&&e.iter(t.line,i.line+1,function(ge){Ue(e,ge)&&St(ge,0)}),C.clearOnEnter&&Ae(C,"beforeCursorEnter",function(){return C.clear()}),C.readOnly&&($r(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),C.collapsed&&(C.id=++ts,C.atomic=!0),Q){if(re&&(Q.curOp.updateMaxLine=!0),C.collapsed)wr(Q,t.line,i.line+1);else if(C.className||C.startStyle||C.endStyle||C.css||C.attributes||C.title)for(var pe=t.line;pe<=i.line;pe++)wi(Q,pe,"text");C.atomic&&zo(Q.doc),cr(Q,"markerAdded",Q,C)}return C}var Mn=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};Mn.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();cr(this,"clear")},Mn.prototype.find=function(e,t){return this.primary.find(e,t)},ue(Mn);function Sl(e,t,i,r,n){r=N(r),r.shared=!1;var C=[sn(e,t,i,r,n)],W=C[0],Y=r.widgetNode;return Ri(e,function(Q){Y&&(r.widgetNode=Y.cloneNode(!0)),C.push(sn(Q,bt(Q,t),bt(Q,i),r,n));for(var re=0;re<Q.linked.length;++re)if(Q.linked[re].isParent)return;W=l(C)}),new Mn(C,W)}function rs(e){return e.findMarks(Fe(e.first,0),e.clipPos(Fe(e.lastLine())),function(t){return t.parent})}function Cl(e,t){for(var i=0;i<t.length;i++){var r=t[i],n=r.find(),C=e.clipPos(n.from),W=e.clipPos(n.to);if(yt(C,W)){var Y=sn(e,C,W,r.primary,r.primary.type);r.markers.push(Y),Y.parent=r}}}function Tl(e){for(var t=function(r){var n=e[r],C=[n.primary.doc];Ri(n.primary.doc,function(Q){return C.push(Q)});for(var W=0;W<n.markers.length;W++){var Y=n.markers[W];he(C,Y.doc)==-1&&(Y.parent=null,n.markers.splice(W--,1))}},i=0;i<e.length;i++)t(i)}var _l=0,Ar=function(e,t,i,r,n){if(!(this instanceof Ar))return new Ar(e,t,i,r,n);i==null&&(i=0),On.call(this,[new Dn([new _t("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var C=Fe(i,0);this.sel=Li(C),this.history=new Zn(null),this.id=++_l,this.modeOption=t,this.lineSep=r,this.direction=n=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Pa(this,{from:C,to:C,text:e}),mr(this,Li(C),Se)};Ar.prototype=U(On.prototype,{constructor:Ar,iter:function(e,t,i){i?this.iterN(e-this.first,t-e,i):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var i=0,r=0;r<t.length;++r)i+=t[r].height;this.insertInner(e-this.first,t,i)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=rr(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:lr(function(e){var t=Fe(this.first,0),i=this.first+this.size-1;an(this,{from:t,to:Fe(i,Ze(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Sn(this.cm,0,0),mr(this,Li(t),Se)}),replaceRange:function(e,t,i,r){t=bt(this,t),i=i?bt(this,i):t,on(this,e,t,i,r)},getRange:function(e,t,i){var r=Rt(this,bt(this,e),bt(this,t));return i===!1?r:r.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Cr(this,e))return Ze(this,e)},getLineNumber:function(e){return Et(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=Ze(this,e)),Ft(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return bt(this,e)},getCursor:function(e){var t=this.sel.primary(),i;return e==null||e=="head"?i=t.head:e=="anchor"?i=t.anchor:e=="end"||e=="to"||e===!1?i=t.to():i=t.from(),i},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:lr(function(e,t,i){Wo(this,bt(this,typeof e=="number"?Fe(e,t||0):e),null,i)}),setSelection:lr(function(e,t,i){Wo(this,bt(this,e),bt(this,t||e),i)}),extendSelection:lr(function(e,t,i){qn(this,bt(this,e),t&&bt(this,t),i)}),extendSelections:lr(function(e,t){jo(this,je(this,e),t)}),extendSelectionsBy:lr(function(e,t){var i=c(this.sel.ranges,e);jo(this,je(this,i),t)}),setSelections:lr(function(e,t,i){if(!e.length)return;for(var r=[],n=0;n<e.length;n++)r[n]=new Nt(bt(this,e[n].anchor),bt(this,e[n].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),mr(this,qr(this.cm,r,t),i)}),addSelection:lr(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new Nt(bt(this,e),bt(this,t||e))),mr(this,qr(this.cm,r,r.length-1),i)}),getSelection:function(e){for(var t=this.sel.ranges,i,r=0;r<t.length;r++){var n=Rt(this,t[r].from(),t[r].to());i=i?i.concat(n):n}return e===!1?i:i.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],i=this.sel.ranges,r=0;r<i.length;r++){var n=Rt(this,i[r].from(),i[r].to());e!==!1&&(n=n.join(e||this.lineSeparator())),t[r]=n}return t},replaceSelection:function(e,t,i){for(var r=[],n=0;n<this.sel.ranges.length;n++)r[n]=e;this.replaceSelections(r,t,i||"+input")},replaceSelections:lr(function(e,t,i){for(var r=[],n=this.sel,C=0;C<n.ranges.length;C++){var W=n.ranges[C];r[C]={from:W.from(),to:W.to(),text:this.splitLines(e[C]),origin:i}}for(var Y=t&&t!="end"&&cl(this,r,t),Q=r.length-1;Q>=0;Q--)an(this,r[Q]);Y?Ho(this,Y):this.cm&&en(this.cm)}),undo:lr(function(){ra(this,"undo")}),redo:lr(function(){ra(this,"redo")}),undoSelection:lr(function(){ra(this,"undo",!0)}),redoSelection:lr(function(){ra(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){var e=this;this.history=new Zn(this.history.maxGeneration),Ri(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:rn(this.history.done),undone:rn(this.history.undone)}},setHistory:function(e){var t=this.history=new Zn(this.history.maxGeneration);t.done=rn(e.done.slice(0),null,!0),t.undone=rn(e.undone.slice(0),null,!0)},setGutterMarker:lr(function(e,t,i){return Rn(this,e,"gutter",function(r){var n=r.gutterMarkers||(r.gutterMarkers={});return n[t]=i,!i&&Pe(n)&&(r.gutterMarkers=null),!0})}),clearGutter:lr(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&Rn(t,i,"gutter",function(){return i.gutterMarkers[e]=null,Pe(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Cr(this,e))return null;if(t=e,e=Ze(this,e),!e)return null}else if(t=Et(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:lr(function(e,t,i){return Rn(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[n])r[n]=i;else{if(E(i).test(r[n]))return!1;r[n]+=" "+i}return!0})}),removeLineClass:lr(function(e,t,i){return Rn(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",C=r[n];if(C)if(i==null)r[n]=null;else{var W=C.match(E(i));if(!W)return!1;var Y=W.index+W[0].length;r[n]=C.slice(0,W.index)+(!W.index||Y==C.length?"":" ")+C.slice(Y)||null}else return!1;return!0})}),addLineWidget:lr(function(e,t,i){return El(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return sn(this,bt(this,e),bt(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=bt(this,e),sn(this,e,e,i,"bookmark")},findMarksAt:function(e){e=bt(this,e);var t=[],i=Ze(this,e.line).markedSpans;if(i)for(var r=0;r<i.length;++r){var n=i[r];(n.from==null||n.from<=e.ch)&&(n.to==null||n.to>=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=bt(this,e),t=bt(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(C){var W=C.markedSpans;if(W)for(var Y=0;Y<W.length;Y++){var Q=W[Y];!(Q.to!=null&&n==e.line&&e.ch>=Q.to||Q.from==null&&n!=e.line||Q.from!=null&&n==t.line&&Q.from>=t.ch)&&(!i||i(Q.marker))&&r.push(Q.marker.parent||Q.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;r<i.length;++r)i[r].from!=null&&e.push(i[r].marker)}),e},posFromIndex:function(e){var t,i=this.first,r=this.lineSeparator().length;return this.iter(function(n){var C=n.text.length+r;if(C>e)return t=e,!0;e-=C,++i}),bt(this,Fe(i,t))},indexFromPos:function(e){e=bt(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+i}),t},copy:function(e){var t=new Ar(rr(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,i=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<i&&(i=e.to);var r=new Ar(rr(this,t,i),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Cl(r,rs(this)),r},unlinkDoc:function(e){if(e instanceof zt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var i=this.linked[t];if(i.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Tl(rs(this));break}if(e.history==this.history){var r=[e.id];Ri(e,function(n){return r.push(n.id)},!0),e.history=new Zn(null),e.history.done=rn(this.history.done,r),e.history.undone=rn(this.history.undone,r)}},iterLinkedDocs:function(e){Ri(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):ft(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:lr(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&fl(this.cm)})}),Ar.prototype.eachLine=Ar.prototype.iter;var is=0;function wl(e){var t=this;if(ns(t),q(t,e)||mi(t.display,e))return;te(e),G&&(is=+new Date);var i=ji(t,e,!0),r=e.dataTransfer.files;if(!i||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var n=r.length,C=Array(n),W=0,Y=function(){++W==n&&sr(t,function(){i=bt(t.doc,i);var Ce={from:i,to:i,text:t.doc.splitLines(C.filter(function(Ne){return Ne!=null}).join(t.doc.lineSeparator())),origin:"paste"};an(t.doc,Ce),Ho(t.doc,Li(bt(t.doc,i),bt(t.doc,ki(Ce))))})()},Q=function(Ce,Ne){if(t.options.allowDropFileTypes&&he(t.options.allowDropFileTypes,Ce.type)==-1){Y();return}var Be=new FileReader;Be.onerror=function(){return Y()},Be.onload=function(){var ze=Be.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(ze)){Y();return}C[Ne]=ze,Y()},Be.readAsText(Ce)},re=0;re<r.length;re++)Q(r[re],re);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var pe=e.dataTransfer.getData("Text");if(pe){var ge;if(t.state.draggingText&&!t.state.draggingText.copy&&(ge=t.listSelections()),ea(t.doc,Li(i,i)),ge)for(var Le=0;Le<ge.length;++Le)on(t.doc,"",ge[Le].anchor,ge[Le].head,"drag");t.replaceSelection(pe,"around","paste"),t.display.input.focus()}}catch(Ce){}}}function Al(e,t){if(G&&(!e.state.draggingText||+new Date-is<100)){fe(t);return}if(q(e,t)||mi(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!P){var i=a("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",w&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),w&&i.parentNode.removeChild(i)}}function Ll(e,t){var i=ji(e,t);if(!i)return;var r=document.createDocumentFragment();go(e,i,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),u(e.display.dragCursor,r)}function ns(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function as(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),i=[],r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&i.push(n)}i.length&&i[0].operation(function(){for(var C=0;C<i.length;C++)e(i[C])})}var os=!1;function kl(){if(os)return;Rl(),os=!0}function Rl(){var e;Ae(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(Dl)},100))}),Ae(window,"blur",function(){return as(qi)})}function Dl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Oi={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},In=0;In<10;In++)Oi[In+48]=Oi[In+96]=String(In);for(var ia=65;ia<=90;ia++)Oi[ia]=String.fromCharCode(ia);for(var Nn=1;Nn<=12;Nn++)Oi[Nn+111]=Oi[Nn+63235]="F"+Nn;var gi={};gi.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},gi.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},gi.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},gi.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},gi.default=s?gi.macDefault:gi.pcDefault;function Ol(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,n,C,W=0;W<t.length-1;W++){var Y=t[W];if(/^(cmd|meta|m)$/i.test(Y))C=!0;else if(/^a(lt)?$/i.test(Y))i=!0;else if(/^(c|ctrl|control)$/i.test(Y))r=!0;else if(/^s(hift)?$/i.test(Y))n=!0;else throw new Error("Unrecognized modifier name: "+Y)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),C&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Pl(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if(r=="..."){delete e[i];continue}for(var n=c(i.split(" "),Ol),C=0;C<n.length;C++){var W=void 0,Y=void 0;C==n.length-1?(Y=n.join(" "),W=r):(Y=n.slice(0,C+1).join(" "),W="...");var Q=t[Y];if(!Q)t[Y]=W;else if(Q!=W)throw new Error("Inconsistent bindings for "+Y)}delete e[i]}for(var re in t)e[re]=t[re];return e}function ln(e,t,i,r){t=na(t);var n=t.call?t.call(e,r):t[e];if(n===!1)return"nothing";if(n==="...")return"multi";if(n!=null&&i(n))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return ln(e,t.fallthrough,i,r);for(var C=0;C<t.fallthrough.length;C++){var W=ln(e,t.fallthrough[C],i,r);if(W)return W}}}function ss(e){var t=typeof e=="string"?e:Oi[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ls(e,t,i){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(m?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(m?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function us(e,t){if(w&&e.keyCode==34&&e.char)return!1;var i=Oi[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),ls(i,e,t))}function na(e){return typeof e=="string"?gi[e]:e}function un(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var C=t(i[n]);r.length&&yt(C.from,l(r).to)<=0;){var W=r.pop();if(yt(W.from,C.from)<0){C.from=W.from;break}}r.push(C)}Br(e,function(){for(var Y=r.length-1;Y>=0;Y--)on(e.doc,"",r[Y].from,r[Y].to,"+delete");en(e)})}function Ua(e,t,i){var r=Ie(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Ba(e,t,i){var r=Ua(e,t.ch,i);return r==null?null:new Fe(t.line,r,i<0?"after":"before")}function Fa(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var C=Qe(i,t.doc.direction);if(C){var W=n<0?l(C):C[0],Y=n<0==(W.level==1),Q=Y?"after":"before",re;if(W.level>0||t.doc.direction=="rtl"){var pe=Ji(t,i);re=n<0?i.text.length-1:0;var ge=oi(t,pe,re).top;re=He(function(Le){return oi(t,pe,Le).top==ge},n<0==(W.level==1)?W.from:W.to-1,re),Q=="before"&&(re=Ua(i,re,1))}else re=n<0?W.to:W.from;return new Fe(r,re,Q)}}return new Fe(r,n<0?i.text.length:0,n<0?"before":"after")}function Ml(e,t,i,r){var n=Qe(t,e.doc.direction);if(!n)return Ba(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var C=Xe(n,i.ch,i.sticky),W=n[C];if(e.doc.direction=="ltr"&&W.level%2==0&&(r>0?W.to>i.ch:W.from<i.ch))return Ba(t,i,r);var Y=function(Ye,rt){return Ua(t,Ye instanceof Fe?Ye.ch:Ye,rt)},Q,re=function(Ye){return e.options.lineWrapping?(Q=Q||Ji(e,t),co(e,t,Q,Ye)):{begin:0,end:t.text.length}},pe=re(i.sticky=="before"?Y(i,-1):i.ch);if(e.doc.direction=="rtl"||W.level==1){var ge=W.level==1==r<0,Le=Y(i,ge?1:-1);if(Le!=null&&(ge?Le<=W.to&&Le<=pe.end:Le>=W.from&&Le>=pe.begin)){var Ce=ge?"before":"after";return new Fe(i.line,Le,Ce)}}var Ne=function(Ye,rt,$e){for(var lt=function(Wt,ur){return ur?new Fe(i.line,Y(Wt,1),"before"):new Fe(i.line,Wt,"after")};Ye>=0&&Ye<n.length;Ye+=rt){var vt=n[Ye],mt=rt>0==(vt.level!=1),wt=mt?$e.begin:Y($e.end,-1);if(vt.from<=wt&&wt<vt.to)return lt(wt,mt);if(wt=mt?vt.from:Y(vt.to,-1),$e.begin<=wt&&wt<$e.end)return lt(wt,mt)}},Be=Ne(C+r,r,pe);if(Be)return Be;var ze=r>0?pe.end:Y(pe.begin,-1);return ze!=null&&!(r>0&&ze==t.text.length)&&(Be=Ne(r>0?0:n.length-1,r,re(ze)),Be)?Be:null}var Un={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Se)},killLine:function(e){return un(e,function(t){if(t.empty()){var i=Ze(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:Fe(t.head.line+1,0)}:{from:t.head,to:Fe(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return un(e,function(t){return{from:Fe(t.from().line,0),to:bt(e.doc,Fe(t.to().line+1,0))}})},delLineLeft:function(e){return un(e,function(t){return{from:Fe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return un(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return un(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Fe(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Fe(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ds(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return hs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},Te)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},Te)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return r.ch<e.getLine(r.line).search(/\S/)?hs(e,t.head):r},Te)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],i=e.listSelections(),r=e.options.tabSize,n=0;n<i.length;n++){var C=i[n].from(),W=$(e.getLine(C.line),C.ch,r);t.push(K(r-W%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Br(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var n=t[r].head,C=Ze(e.doc,n.line).text;if(C){if(n.ch==C.length&&(n=new Fe(n.line,n.ch-1)),n.ch>0)n=new Fe(n.line,n.ch+1),e.replaceRange(C.charAt(n.ch-1)+C.charAt(n.ch-2),Fe(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var W=Ze(e.doc,n.line-1).text;W&&(n=new Fe(n.line,1),e.replaceRange(C.charAt(0)+e.doc.lineSeparator()+W.charAt(W.length-1),Fe(n.line-1,W.length-1),n,"+transpose"))}}i.push(new Nt(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return Br(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);en(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ds(e,t){var i=Ze(e.doc,t),r=Ft(i);return r!=i&&(t=Et(r)),Fa(!0,e,r,t,1)}function Il(e,t){var i=Ze(e.doc,t),r=fi(i);return r!=i&&(t=Et(r)),Fa(!0,e,i,t,-1)}function hs(e,t){var i=ds(e,t.line),r=Ze(e.doc,i.line),n=Qe(r,e.doc.direction);if(!n||n[0].level==0){var C=Math.max(i.ch,r.text.search(/\S/)),W=t.line==i.line&&t.ch<=C&&t.ch;return Fe(i.line,W?0:C,i.sticky)}return i}function aa(e,t,i){if(typeof t=="string"&&(t=Un[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),n=t(e)!=ke}finally{e.display.shift=r,e.state.suppressEdits=!1}return n}function Nl(e,t,i){for(var r=0;r<e.state.keyMaps.length;r++){var n=ln(t,e.state.keyMaps[r],i,e);if(n)return n}return e.options.extraKeys&&ln(t,e.options.extraKeys,i,e)||ln(t,e.options.keyMap,i,e)}var Ul=new ie;function Bn(e,t,i,r){var n=e.state.keySeq;if(n){if(ss(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==n&&(e.state.keySeq=null,e.display.input.reset())}),cs(e,n+" "+t,i,r))return!0}return cs(e,t,i,r)}function cs(e,t,i,r){var n=Nl(e,t,r);return n=="multi"&&(e.state.keySeq=t),n=="handled"&&cr(e,"keyHandled",e,t,i),(n=="handled"||n=="multi")&&(te(i),Sa(e)),!!n}function fs(e,t){var i=us(t,!0);return i?t.shiftKey&&!e.state.keySeq?Bn(e,"Shift-"+i,t,function(r){return aa(e,r,!0)})||Bn(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return aa(e,r)}):Bn(e,i,t,function(r){return aa(e,r)}):!1}function Bl(e,t,i){return Bn(e,"'"+i+"'",t,function(r){return aa(e,r,!0)})}var ja=null;function ps(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=I(),q(t,e))return;G&&H<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=fs(t,e);w&&(ja=r?i:null,!r&&i==88&&!Pt&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),O&&!s&&!r&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Fl(t)}function Fl(e){var t=e.display.lineDiv;j(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(p(t,"CodeMirror-crosshair"),it(document,"keyup",i),it(document,"mouseover",i))}Ae(document,"keyup",i),Ae(document,"mouseover",i)}function ms(e){e.keyCode==16&&(this.doc.sel.shift=!1),q(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(mi(t.display,e)||q(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var i=e.keyCode,r=e.charCode;if(w&&i==ja){ja=null,te(e);return}if(w&&(!e.which||e.which<10)&&fs(t,e))return;var n=String.fromCharCode(r==null?i:r);if(n=="\b")return;if(Bl(t,e,n))return;t.display.input.onKeyPress(e)}var jl=400,Wa=function(e,t,i){this.time=e,this.pos=t,this.button=i};Wa.prototype.compare=function(e,t,i){return this.time+jl>e&&yt(t,this.pos)==0&&i==this.button};var Fn,jn;function Wl(e,t){var i=+new Date;return jn&&jn.compare(i,e,t)?(Fn=jn=null,"triple"):Fn&&Fn.compare(i,e,t)?(jn=new Wa(i,e,t),Fn=null,"double"):(Fn=new Wa(i,e,t),jn=null,"single")}function vs(e){var t=this,i=t.display;if(q(t,e)||i.activeTouch&&i.input.supportsTouch())return;if(i.input.ensurePolled(),i.shift=e.shiftKey,mi(i,e)){B||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=ji(t,e),n=Ee(e),C=r?Wl(r,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,n,r,C,e))return;n==1?r?zl(t,r,C,e):ve(e)==i.scroller&&te(e):n==2?(r&&qn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(f?t.display.input.onContextMenu(e):yo(t))}function Hl(e,t,i,r,n){var C="Click";return r=="double"?C="Double"+C:r=="triple"&&(C="Triple"+C),C=(t==1?"Left":t==2?"Middle":"Right")+C,Bn(e,ls(C,n),n,function(W){if(typeof W=="string"&&(W=Un[W]),!W)return!1;var Y=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Y=W(e,i)!=ke}finally{e.state.suppressEdits=!1}return Y})}function Gl(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var C=d?i.shiftKey&&i.metaKey:i.altKey;n.unit=C?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=s?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(s?i.altKey:i.ctrlKey)),n}function zl(e,t,i,r){G?setTimeout(M(vo,e),0):e.curOp.focus=I();var n=Gl(e,i,r),C=e.doc.sel,W;e.options.dragDrop&&Me&&!e.isReadOnly()&&i=="single"&&(W=C.contains(t))>-1&&(yt((W=C.ranges[W]).from(),t)<0||t.xRel>0)&&(yt(W.to(),t)>0||t.xRel<0)?Kl(e,r,t,n):Vl(e,r,t,n)}function Kl(e,t,i,r){var n=e.display,C=!1,W=sr(e,function(re){B&&(n.scroller.draggable=!1),e.state.draggingText=!1,it(n.wrapper.ownerDocument,"mouseup",W),it(n.wrapper.ownerDocument,"mousemove",Y),it(n.scroller,"dragstart",Q),it(n.scroller,"drop",W),C||(te(re),r.addNew||qn(e.doc,i,null,null,r.extend),B&&!P||G&&H==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),Y=function(re){C=C||Math.abs(t.clientX-re.clientX)+Math.abs(t.clientY-re.clientY)>=10},Q=function(){return C=!0};B&&(n.scroller.draggable=!0),e.state.draggingText=W,W.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),Ae(n.wrapper.ownerDocument,"mouseup",W),Ae(n.wrapper.ownerDocument,"mousemove",Y),Ae(n.scroller,"dragstart",Q),Ae(n.scroller,"drop",W),yo(e),setTimeout(function(){return n.input.focus()},20)}function ys(e,t,i){if(i=="char")return new Nt(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Nt(Fe(t.line,0),bt(e.doc,Fe(t.line+1,0)));var r=i(e,t);return new Nt(r.from,r.to)}function Vl(e,t,i,r){var n=e.display,C=e.doc;te(t);var W,Y,Q=C.sel,re=Q.ranges;if(r.addNew&&!r.extend?(Y=C.sel.contains(i),Y>-1?W=re[Y]:W=new Nt(i,i)):(W=C.sel.primary(),Y=C.sel.primIndex),r.unit=="rectangle")r.addNew||(W=new Nt(i,i)),i=ji(e,t,!0,!0),Y=-1;else{var pe=ys(e,i,r.unit);r.extend?W=Ia(W,pe.anchor,pe.head,r.extend):W=pe}r.addNew?Y==-1?(Y=re.length,mr(C,qr(e,re.concat([W]),Y),{scroll:!1,origin:"*mouse"})):re.length>1&&re[Y].empty()&&r.unit=="char"&&!r.extend?(mr(C,qr(e,re.slice(0,Y).concat(re.slice(Y+1)),0),{scroll:!1,origin:"*mouse"}),Q=C.sel):Na(C,Y,W,Re):(Y=0,mr(C,new Wr([W],0),Re),Q=C.sel);var ge=i;function Le($e){if(yt(ge,$e)==0)return;if(ge=$e,r.unit=="rectangle"){for(var lt=[],vt=e.options.tabSize,mt=$(Ze(C,i.line).text,i.ch,vt),wt=$(Ze(C,$e.line).text,$e.ch,vt),Wt=Math.min(mt,wt),ur=Math.max(mt,wt),Vt=Math.min(i.line,$e.line),Fr=Math.min(e.lastLine(),Math.max(i.line,$e.line));Vt<=Fr;Vt++){var Lr=Ze(C,Vt).text,Qt=_e(Lr,Wt,vt);Wt==ur?lt.push(new Nt(Fe(Vt,Qt),Fe(Vt,Qt))):Lr.length>Qt&&lt.push(new Nt(Fe(Vt,Qt),Fe(Vt,_e(Lr,ur,vt))))}lt.length||lt.push(new Nt(i,i)),mr(C,qr(e,Q.ranges.slice(0,Y).concat(lt),Y),{origin:"*mouse",scroll:!1}),e.scrollIntoView($e)}else{var kr=W,fr=ys(e,$e,r.unit),ar=kr.anchor,qt;yt(fr.anchor,ar)>0?(qt=fr.head,ar=ui(kr.from(),fr.anchor)):(qt=fr.anchor,ar=li(kr.to(),fr.head));var Yt=Q.ranges.slice(0);Yt[Y]=Xl(e,new Nt(bt(C,ar),qt)),mr(C,qr(e,Yt,Y),Re)}}var Ce=n.wrapper.getBoundingClientRect(),Ne=0;function Be($e){var lt=++Ne,vt=ji(e,$e,!0,r.unit=="rectangle");if(!vt)return;if(yt(vt,ge)!=0){e.curOp.focus=I(),Le(vt);var mt=Xn(n,C);(vt.line>=mt.to||vt.line<mt.from)&&setTimeout(sr(e,function(){Ne==lt&&Be($e)}),150)}else{var wt=$e.clientY<Ce.top?-20:$e.clientY>Ce.bottom?20:0;wt&&setTimeout(sr(e,function(){if(Ne!=lt)return;n.scroller.scrollTop+=wt,Be($e)}),50)}}function ze($e){e.state.selectingText=!1,Ne=Infinity,$e&&(te($e),n.input.focus()),it(n.wrapper.ownerDocument,"mousemove",Ye),it(n.wrapper.ownerDocument,"mouseup",rt),C.history.lastSelOrigin=null}var Ye=sr(e,function($e){$e.buttons===0||!Ee($e)?ze($e):Be($e)}),rt=sr(e,ze);e.state.selectingText=rt,Ae(n.wrapper.ownerDocument,"mousemove",Ye),Ae(n.wrapper.ownerDocument,"mouseup",rt)}function Xl(e,t){var i=t.anchor,r=t.head,n=Ze(e.doc,i.line);if(yt(i,r)==0&&i.sticky==r.sticky)return t;var C=Qe(n);if(!C)return t;var W=Xe(C,i.ch,i.sticky),Y=C[W];if(Y.from!=i.ch&&Y.to!=i.ch)return t;var Q=W+(Y.from==i.ch==(Y.level!=1)?0:1);if(Q==0||Q==C.length)return t;var re;if(r.line!=i.line)re=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var pe=Xe(C,r.ch,r.sticky),ge=pe-W||(r.ch-i.ch)*(Y.level==1?-1:1);pe==Q-1||pe==Q?re=ge<0:re=ge>0}var Le=C[Q+(re?-1:0)],Ce=re==(Le.level==1),Ne=Ce?Le.from:Le.to,Be=Ce?"after":"before";return i.ch==Ne&&i.sticky==Be?t:new Nt(new Fe(i.line,Ne,Be),r)}function bs(e,t,i,r){var n,C;if(t.touches)n=t.touches[0].clientX,C=t.touches[0].clientY;else try{n=t.clientX,C=t.clientY}catch(Le){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&te(t);var W=e.display,Y=W.lineDiv.getBoundingClientRect();if(C>Y.bottom||!ae(e,i))return de(t);C-=Y.top-W.viewOffset;for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var re=W.gutters.childNodes[Q];if(re&&re.getBoundingClientRect().right>=n){var pe=Dt(e.doc,C),ge=e.display.gutterSpecs[Q];return se(e,i,e,pe,ge.className,t),de(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function xs(e,t){if(mi(e.display,t)||Yl(e,t))return;if(q(e,t,"contextmenu"))return;f||e.display.input.onContextMenu(t)}function Yl(e,t){return ae(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function Es(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),xn(e)}var dn={toString:function(){return"CodeMirror.Init"}},Ss={},oa={};function $l(e){var t=e.optionHandlers;function i(r,n,C,W){e.defaults[r]=n,C&&(t[r]=W?function(Y,Q,re){re!=dn&&C(Y,Q,re)}:C)}e.defineOption=i,e.Init=dn,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Oa(r)},!0),i("indentUnit",2,Oa,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){Ln(r),xn(r),wr(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!n)return;var C=[],W=r.doc.first;r.doc.iter(function(Q){for(var re=0;;){var pe=Q.text.indexOf(n,re);if(pe==-1)break;re=pe+n.length,C.push(Fe(W,pe))}W++});for(var Y=C.length-1;Y>=0;Y--)on(r.doc,n,C[Y],Fe(C[Y].line,C[Y].ch+n.length))}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,n,C){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),C!=dn&&r.refresh()}),i("specialCharPlaceholder",jt,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!T),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Es(r),An(r)},!0),i("keyMap","default",function(r,n,C){var W=na(n),Y=C!=dn&&na(C);Y&&Y.detach&&Y.detach(r,W),W.attach&&W.attach(r,Y||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Zl,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Ra(n,r.options.lineNumbers),An(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?xa(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return tn(r)},!0),i("scrollbarStyle","native",function(r){To(r),tn(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=Ra(r.options.gutters,n),An(r)},!0),i("firstLineNumber",1,An,!0),i("lineNumberFormatter",function(r){return r},An,!0),i("showCursorWhenSelecting",!1,En,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(qi(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Jl),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,En,!0),i("singleCursorHeightPerLine",!0,En,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,Ln,!0),i("addModeClass",!1,Ln,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,Ln,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Jl(e,t,i){var r=i&&i!=dn;if(!t!=!r){var n=e.display.dragFunctions,C=t?Ae:it;C(e.display.scroller,"dragstart",n.start),C(e.display.scroller,"dragenter",n.enter),C(e.display.scroller,"dragover",n.over),C(e.display.scroller,"dragleave",n.leave),C(e.display.scroller,"drop",n.drop)}}function Zl(e){e.options.lineWrapping?(j(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(p(e.display.wrapper,"CodeMirror-wrap"),Ct(e)),Ea(e),wr(e),xn(e),setTimeout(function(){return tn(e)},100)}function zt(e,t){var i=this;if(!(this instanceof zt))return new zt(e,t);this.options=t=t?N(t):{},N(Ss,t,!1);var r=t.value;typeof r=="string"?r=new Ar(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new zt.inputStyles[t.inputStyle](this),C=this.display=new dl(e,r,n,t);C.wrapper.CodeMirror=this,Es(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),To(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 ie,keySeq:null,specialChars:null},t.autofocus&&!o&&C.input.focus(),G&&H<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Ql(this),kl(),zi(this),this.curOp.forceUpdate=!0,Mo(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ca(i)},20):qi(this);for(var W in oa)oa.hasOwnProperty(W)&&oa[W](this,t[W],dn);Ao(this),t.finishInit&&t.finishInit(this);for(var Y=0;Y<Ga.length;++Y)Ga[Y](this);Ki(this),B&&t.lineWrapping&&getComputedStyle(C.lineDiv).textRendering=="optimizelegibility"&&(C.lineDiv.style.textRendering="auto")}zt.defaults=Ss,zt.optionHandlers=oa;function Ql(e){var t=e.display;Ae(t.scroller,"mousedown",sr(e,vs)),G&&H<11?Ae(t.scroller,"dblclick",sr(e,function(Q){if(q(e,Q))return;var re=ji(e,Q);if(!re||Ha(e,Q)||mi(e.display,Q))return;te(Q);var pe=e.findWordAt(re);qn(e.doc,pe.anchor,pe.head)})):Ae(t.scroller,"dblclick",function(Q){return q(e,Q)||te(Q)}),Ae(t.scroller,"contextmenu",function(Q){return xs(e,Q)}),Ae(t.input.getField(),"contextmenu",function(Q){t.scroller.contains(Q.target)||xs(e,Q)});var i,r={end:0};function n(){t.activeTouch&&(i=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function C(Q){if(Q.touches.length!=1)return!1;var re=Q.touches[0];return re.radiusX<=1&&re.radiusY<=1}function W(Q,re){if(re.left==null)return!0;var pe=re.left-Q.left,ge=re.top-Q.top;return pe*pe+ge*ge>20*20}Ae(t.scroller,"touchstart",function(Q){if(!q(e,Q)&&!C(Q)&&!Ha(e,Q)){t.input.ensurePolled(),clearTimeout(i);var re=+new Date;t.activeTouch={start:re,moved:!1,prev:re-r.end<=300?r:null},Q.touches.length==1&&(t.activeTouch.left=Q.touches[0].pageX,t.activeTouch.top=Q.touches[0].pageY)}}),Ae(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ae(t.scroller,"touchend",function(Q){var re=t.activeTouch;if(re&&!mi(t,Q)&&re.left!=null&&!re.moved&&new Date-re.start<300){var pe=e.coordsChar(t.activeTouch,"page"),ge;!re.prev||W(re,re.prev)?ge=new Nt(pe,pe):!re.prev.prev||W(re,re.prev.prev)?ge=e.findWordAt(pe):ge=new Nt(Fe(pe.line,0),bt(e.doc,Fe(pe.line+1,0))),e.setSelection(ge.anchor,ge.head),e.focus(),te(Q)}n()}),Ae(t.scroller,"touchcancel",n),Ae(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Cn(e,t.scroller.scrollTop),Hi(e,t.scroller.scrollLeft,!0),se(e,"scroll",e))}),Ae(t.scroller,"mousewheel",function(Q){return Ro(e,Q)}),Ae(t.scroller,"DOMMouseScroll",function(Q){return Ro(e,Q)}),Ae(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Q){q(e,Q)||fe(Q)},over:function(Q){q(e,Q)||(Ll(e,Q),fe(Q))},start:function(Q){return Al(e,Q)},drop:sr(e,wl),leave:function(Q){q(e,Q)||ns(e)}};var Y=t.input.getField();Ae(Y,"keyup",function(Q){return ms.call(e,Q)}),Ae(Y,"keydown",sr(e,ps)),Ae(Y,"keypress",sr(e,gs)),Ae(Y,"focus",function(Q){return Ca(e,Q)}),Ae(Y,"blur",function(Q){return qi(e,Q)})}var Ga=[];zt.defineInitHook=function(e){return Ga.push(e)};function Wn(e,t,i,r){var n=e.doc,C;i==null&&(i="add"),i=="smart"&&(n.mode.indent?C=br(e,t).state:i="prev");var W=e.options.tabSize,Y=Ze(n,t),Q=$(Y.text,null,W);Y.stateAfter&&(Y.stateAfter=null);var re=Y.text.match(/^\s*/)[0],pe;if(!r&&!/\S/.test(Y.text))pe=0,i="not";else if(i=="smart"&&(pe=n.mode.indent(C,Y.text.slice(re.length),Y.text),pe==ke||pe>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?pe=$(Ze(n,t-1).text,null,W):pe=0:i=="add"?pe=Q+e.options.indentUnit:i=="subtract"?pe=Q-e.options.indentUnit:typeof i=="number"&&(pe=Q+i),pe=Math.max(0,pe);var ge="",Le=0;if(e.options.indentWithTabs)for(var Ce=Math.floor(pe/W);Ce;--Ce)Le+=W,ge+=" ";if(Le<pe&&(ge+=K(pe-Le)),ge!=re)return on(n,ge,Fe(t,0),Fe(t,re.length),"+input"),Y.stateAfter=null,!0;for(var Ne=0;Ne<n.sel.ranges.length;Ne++){var Be=n.sel.ranges[Ne];if(Be.head.line==t&&Be.head.ch<re.length){var ze=Fe(t,re.length);Na(n,Ne,new Nt(ze,ze));break}}}var ei=null;function sa(e){ei=e}function za(e,t,i,r,n){var C=e.doc;e.display.shift=!1,r||(r=C.sel);var W=+new Date-200,Y=n=="paste"||e.state.pasteIncoming>W,Q=ft(t),re=null;if(Y&&r.ranges.length>1)if(ei&&ei.text.join(`
`)==t){if(r.ranges.length%ei.text.length==0){re=[];for(var pe=0;pe<ei.text.length;pe++)re.push(C.splitLines(ei.text[pe]))}}else Q.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(re=c(Q,function(Ye){return[Ye]}));for(var ge=e.curOp.updateInput,Le=r.ranges.length-1;Le>=0;Le--){var Ce=r.ranges[Le],Ne=Ce.from(),Be=Ce.to();Ce.empty()&&(i&&i>0?Ne=Fe(Ne.line,Ne.ch-i):e.state.overwrite&&!Y?Be=Fe(Be.line,Math.min(Ze(C,Be.line).text.length,Be.ch+l(Q).length)):Y&&ei&&ei.lineWise&&ei.text.join(`
`)==Q.join(`
`)&&(Ne=Be=Fe(Ne.line,0)));var ze={from:Ne,to:Be,text:re?re[Le%re.length]:Q,origin:n||(Y?"paste":e.state.cutIncoming>W?"cut":"+input")};an(e.doc,ze),cr(e,"inputRead",e,ze)}t&&!Y&&Ts(e,t),en(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ge),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Cs(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Br(t,function(){return za(t,i,0,null,"paste")}),!0}function Ts(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)continue;var C=e.getModeAt(n.head),W=!1;if(C.electricChars){for(var Y=0;Y<C.electricChars.length;Y++)if(t.indexOf(C.electricChars.charAt(Y))>-1){W=Wn(e,n.head.line,"smart");break}}else C.electricInput&&(C.electricInput.test(Ze(e.doc,n.head.line).text.slice(0,n.head.ch))&&(W=Wn(e,n.head.line,"smart")));W&&cr(e,"electricInput",e,n.head.line)}}function _s(e){for(var t=[],i=[],r=0;r<e.doc.sel.ranges.length;r++){var n=e.doc.sel.ranges[r].head.line,C={anchor:Fe(n,0),head:Fe(n+1,0)};i.push(C),t.push(e.getRange(C.anchor,C.head))}return{text:t,ranges:i}}function ws(e,t,i,r){e.setAttribute("autocorrect",i?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function As(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return B?e.style.width="1000px":e.setAttribute("wrap","off"),_&&(e.style.border="1px solid black"),ws(e),t}function ql(e){var t=e.optionHandlers,i=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,n){var C=this.options,W=C[r];if(C[r]==n&&r!="mode")return;C[r]=n,t.hasOwnProperty(r)&&sr(this,t[r])(this,n,W),se(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,n){this.state.keyMaps[n?"push":"unshift"](na(r))},removeKeyMap:function(r){for(var n=this.state.keyMaps,C=0;C<n.length;++C)if(n[C]==r||n[C].name==r)return n.splice(C,1),!0},addOverlay:xr(function(r,n){var C=r.token?r:e.getMode(this.options,r);if(C.startState)throw new Error("Overlays may not be stateful.");D(this.state.overlays,{mode:C,modeSpec:r,opaque:n&&n.opaque,priority:n&&n.priority||0},function(W){return W.priority}),this.state.modeGen++,wr(this)}),removeOverlay:xr(function(r){for(var n=this.state.overlays,C=0;C<n.length;++C){var W=n[C].modeSpec;if(W==r||typeof r=="string"&&W.name==r){n.splice(C,1),this.state.modeGen++,wr(this);return}}}),indentLine:xr(function(r,n,C){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),Cr(this.doc,r)&&Wn(this,r,n,C)}),indentSelection:xr(function(r){for(var n=this.doc.sel.ranges,C=-1,W=0;W<n.length;W++){var Y=n[W];if(Y.empty())Y.head.line>C&&(Wn(this,Y.head.line,r,!0),C=Y.head.line,W==this.doc.sel.primIndex&&en(this));else{var Q=Y.from(),re=Y.to(),pe=Math.max(C,Q.line);C=Math.min(this.lastLine(),re.line-(re.ch?0:1))+1;for(var ge=pe;ge<C;++ge)Wn(this,ge,r);var Le=this.doc.sel.ranges;Q.ch==0&&n.length==Le.length&&Le[W].from().ch>0&&Na(this.doc,W,new Nt(Q,Le[W].to()),Se)}}}),getTokenAt:function(r,n){return Yi(this,r,n)},getLineTokens:function(r,n){return Yi(this,Fe(r),n,!0)},getTokenTypeAt:function(r){r=bt(this.doc,r);var n=yr(this,Ze(this.doc,r.line)),C=0,W=(n.length-1)/2,Y=r.ch,Q;if(Y==0)Q=n[2];else for(;;){var re=C+W>>1;if((re?n[re*2-1]:0)>=Y)W=re;else if(n[re*2+1]<Y)C=re+1;else{Q=n[re*2+2];break}}var pe=Q?Q.indexOf("overlay "):-1;return pe<0?Q:pe==0?null:Q.slice(0,pe-1)},getModeAt:function(r){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(r).state).mode:n},getHelper:function(r,n){return this.getHelpers(r,n)[0]},getHelpers:function(r,n){var C=[];if(!i.hasOwnProperty(n))return C;var W=i[n],Y=this.getModeAt(r);if(typeof Y[n]=="string")W[Y[n]]&&C.push(W[Y[n]]);else if(Y[n])for(var Q=0;Q<Y[n].length;Q++){var re=W[Y[n][Q]];re&&C.push(re)}else Y.helperType&&W[Y.helperType]?C.push(W[Y.helperType]):W[Y.name]&&C.push(W[Y.name]);for(var pe=0;pe<W._global.length;pe++){var ge=W._global[pe];ge.pred(Y,this)&&he(C,ge.val)==-1&&C.push(ge.val)}return C},getStateAfter:function(r,n){var C=this.doc;return r=Yr(C,r==null?C.first+C.size-1:r),br(this,r+1,n).state},cursorCoords:function(r,n){var C,W=this.doc.sel.primary();return r==null?C=W.head:typeof r=="object"?C=bt(this.doc,r):C=r?W.from():W.to(),Qr(this,C,n||"page")},charCoords:function(r,n){return ma(this,bt(this.doc,r),n||"page")},coordsChar:function(r,n){return r=lo(this,r,n||"page"),va(this,r.left,r.top)},lineAtHeight:function(r,n){return r=lo(this,{top:r,left:0},n||"page").top,Dt(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,C){var W=!1,Y;if(typeof r=="number"){var Q=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>Q&&(r=Q,W=!0),Y=Ze(this.doc,r)}else Y=r;return Gn(this,Y,{top:0,left:0},n||"page",C||W).top+(W?this.doc.height-ot(Y):0)},defaultTextHeight:function(){return Zi(this.display)},defaultCharWidth:function(){return Qi(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,C,W,Y){var Q=this.display;r=Qr(this,bt(this.doc,r));var re=r.bottom,pe=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),Q.sizer.appendChild(n),W=="over")re=r.top;else if(W=="above"||W=="near"){var ge=Math.max(Q.wrapper.clientHeight,this.doc.height),Le=Math.max(Q.sizer.clientWidth,Q.lineSpace.clientWidth);(W=="above"||r.bottom+n.offsetHeight>ge)&&r.top>n.offsetHeight?re=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=ge&&(re=r.bottom),pe+n.offsetWidth>Le&&(pe=Le-n.offsetWidth)}n.style.top=re+"px",n.style.left=n.style.right="",Y=="right"?(pe=Q.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(Y=="left"?pe=0:Y=="middle"&&(pe=(Q.sizer.clientWidth-n.offsetWidth)/2),n.style.left=pe+"px"),C&&Js(this,{left:pe,top:re,right:pe+n.offsetWidth,bottom:re+n.offsetHeight})},triggerOnKeyDown:xr(ps),triggerOnKeyPress:xr(gs),triggerOnKeyUp:ms,triggerOnMouseDown:xr(vs),execCommand:function(r){if(Un.hasOwnProperty(r))return Un[r].call(null,this)},triggerElectric:xr(function(r){Ts(this,r)}),findPosH:function(r,n,C,W){var Y=1;n<0&&(Y=-1,n=-n);for(var Q=bt(this.doc,r),re=0;re<n&&!(Q=Ka(this.doc,Q,Y,C,W),Q.hitSide);++re);return Q},moveH:xr(function(r,n){var C=this;this.extendSelectionsBy(function(W){return C.display.shift||C.doc.extend||W.empty()?Ka(C.doc,W.head,r,n,C.options.rtlMoveVisually):r<0?W.from():W.to()},Te)}),deleteH:xr(function(r,n){var C=this.doc.sel,W=this.doc;C.somethingSelected()?W.replaceSelection("",null,"+delete"):un(this,function(Y){var Q=Ka(W,Y.head,r,n,!1);return r<0?{from:Q,to:Y.head}:{from:Y.head,to:Q}})}),findPosV:function(r,n,C,W){var Y=1,Q=W;n<0&&(Y=-1,n=-n);for(var re=bt(this.doc,r),pe=0;pe<n;++pe){var ge=Qr(this,re,"div");if(Q==null?Q=ge.left:ge.left=Q,re=Ls(this,ge,Y,C),re.hitSide)break}return re},moveV:xr(function(r,n){var C=this,W=this.doc,Y=[],Q=!this.display.shift&&!W.extend&&W.sel.somethingSelected();if(W.extendSelectionsBy(function(pe){if(Q)return r<0?pe.from():pe.to();var ge=Qr(C,pe.head,"div");pe.goalColumn!=null&&(ge.left=pe.goalColumn),Y.push(ge.left);var Le=Ls(C,ge,r,n);return n=="page"&&pe==W.sel.primary()&&_a(C,ma(C,Le,"div").top-ge.top),Le},Te),Y.length)for(var re=0;re<W.sel.ranges.length;re++)W.sel.ranges[re].goalColumn=Y[re]}),findWordAt:function(r){var n=this.doc,C=Ze(n,r.line).text,W=r.ch,Y=r.ch;if(C){var Q=this.getHelper(r,"wordChars");(r.sticky=="before"||Y==C.length)&&W?--W:++Y;for(var re=C.charAt(W),pe=xe(re,Q)?function(ge){return xe(ge,Q)}:/\s/.test(re)?function(ge){return/\s/.test(ge)}:function(ge){return!/\s/.test(ge)&&!xe(ge)};W>0&&pe(C.charAt(W-1));)--W;for(;Y<C.length&&pe(C.charAt(Y));)++Y}return new Nt(Fe(r.line,W),Fe(r.line,Y))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?j(this.display.cursorDiv,"CodeMirror-overwrite"):p(this.display.cursorDiv,"CodeMirror-overwrite"),se(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==I()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:xr(function(r,n){Sn(this,r,n)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-ai(this)-this.display.barHeight,width:r.scrollWidth-ai(this)-this.display.barWidth,clientHeight:ca(this),clientWidth:Bi(this)}},scrollIntoView:xr(function(r,n){r==null?(r={from:this.doc.sel.primary().head,to:null},n==null&&(n=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Fe(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=n||0,r.from.line!=null?Zs(this,r):xo(this,r.from,r.to,r.margin)}),setSize:xr(function(r,n){var C=this,W=function(Q){return typeof Q=="number"||/^\d+$/.test(String(Q))?Q+"px":Q};r!=null&&(this.display.wrapper.style.width=W(r)),n!=null&&(this.display.wrapper.style.height=W(n)),this.options.lineWrapping&&ao(this);var Y=this.display.viewFrom;this.doc.iter(Y,this.display.viewTo,function(Q){if(Q.widgets){for(var re=0;re<Q.widgets.length;re++)if(Q.widgets[re].noHScroll){wi(C,Y,"widget");break}}++Y}),this.curOp.forceUpdate=!0,se(this,"refresh",this)}),operation:function(r){return Br(this,r)},startOperation:function(){return zi(this)},endOperation:function(){return Ki(this)},refresh:xr(function(){var r=this.display.cachedTextHeight;wr(this),this.curOp.forceUpdate=!0,xn(this),Sn(this,this.doc.scrollLeft,this.doc.scrollTop),La(this.display),(r==null||Math.abs(r-Zi(this.display))>.5||this.options.lineWrapping)&&Ea(this),se(this,"refresh",this)}),swapDoc:xr(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),Mo(this,r),xn(this),this.display.input.reset(),Sn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,cr(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ue(e),e.registerHelper=function(r,n,C){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=C},e.registerGlobalHelper=function(r,n,C,W){e.registerHelper(r,n,W),i[r]._global.push({pred:C,val:W})}}function Ka(e,t,i,r,n){var C=t,W=i,Y=Ze(e,t.line),Q=n&&e.direction=="rtl"?-i:i;function re(){var rt=t.line+Q;return rt<e.first||rt>=e.first+e.size?!1:(t=new Fe(rt,t.ch,t.sticky),Y=Ze(e,rt))}function pe(rt){var $e;if(r=="codepoint"){var lt=Y.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(lt)?$e=null:$e=new Fe(t.line,Math.max(0,Math.min(Y.text.length,t.ch+i*(lt>=55296&&lt<56320?2:1))),-i)}else n?$e=Ml(e.cm,Y,t,i):$e=Ba(Y,t,i);if($e==null)if(!rt&&re())t=Fa(n,e.cm,Y,t.line,Q);else return!1;else t=$e;return!0}if(r=="char"||r=="codepoint")pe();else if(r=="column")pe(!0);else if(r=="word"||r=="group")for(var ge=null,Le=r=="group",Ce=e.cm&&e.cm.getHelper(t,"wordChars"),Ne=!0;!(i<0&&!pe(!Ne));Ne=!1){var Be=Y.text.charAt(t.ch)||`
`,ze=xe(Be,Ce)?"w":Le&&Be==`
`?"n":!Le||/\s/.test(Be)?null:"p";if(Le&&!Ne&&!ze&&(ze="s"),ge&&ge!=ze){i<0&&(i=1,pe(),t.sticky="after");break}if(ze&&(ge=ze),i>0&&!pe(!Ne))break}var Ye=ta(e,t,C,W,!0);return Pr(C,Ye)&&(Ye.hitSide=!0),Ye}function Ls(e,t,i,r){var n=e.doc,C=t.left,W;if(r=="page"){var Y=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Q=Math.max(Y-.5*Zi(e.display),3);W=(i>0?t.bottom:t.top)+i*Q}else r=="line"&&(W=i>0?t.bottom+3:t.top-3);for(var re;!(re=va(e,C,W),!re.outside);){if(i<0?W<=0:W>=n.height){re.hitSide=!0;break}W+=i*5}return re}var Ut=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ie,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Ut.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;ws(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function C(Y){for(var Q=Y.target;Q;Q=Q.parentNode){if(Q==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Q.className))break}return!1}Ae(n,"paste",function(Y){if(!C(Y)||q(r,Y)||Cs(Y,r))return;H<=11&&setTimeout(sr(r,function(){return t.updateFromDOM()}),20)}),Ae(n,"compositionstart",function(Y){t.composing={data:Y.data,done:!1}}),Ae(n,"compositionupdate",function(Y){t.composing||(t.composing={data:Y.data,done:!1})}),Ae(n,"compositionend",function(Y){t.composing&&(Y.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ae(n,"touchstart",function(){return i.forceCompositionEnd()}),Ae(n,"input",function(){t.composing||t.readFromDOMSoon()});function W(Y){if(!C(Y)||q(r,Y))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()}),Y.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var Q=_s(r);sa({lineWise:!0,text:Q.text}),Y.type=="cut"&&r.operation(function(){r.setSelections(Q.ranges,0,Se),r.replaceSelection("",null,"cut")})}else return;if(Y.clipboardData){Y.clipboardData.clearData();var re=ei.text.join(`
`);if(Y.clipboardData.setData("Text",re),Y.clipboardData.getData("Text")==re){Y.preventDefault();return}}var pe=As(),ge=pe.firstChild;r.display.lineSpace.insertBefore(pe,r.display.lineSpace.firstChild),ge.value=ei.text.join(`
`);var Le=document.activeElement;V(ge),setTimeout(function(){r.display.lineSpace.removeChild(pe),Le.focus(),Le==n&&i.showPrimarySelection()},50)}Ae(n,"copy",W),Ae(n,"cut",W)},Ut.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Ut.prototype.prepareSelection=function(){var e=mo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Ut.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Ut.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Ut.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line<t.display.viewFrom){e.removeAllRanges();return}var C=la(t,e.anchorNode,e.anchorOffset),W=la(t,e.focusNode,e.focusOffset);if(C&&!C.bad&&W&&!W.bad&&yt(ui(C,W),r)==0&&yt(li(C,W),n)==0)return;var Y=t.display.view,Q=r.line>=t.display.viewFrom&&ks(t,r)||{node:Y[0].measure.map[2],offset:0},re=n.line<t.display.viewTo&&ks(t,n);if(!re){var pe=Y[Y.length-1].measure,ge=pe.maps?pe.maps[pe.maps.length-1]:pe.map;re={node:ge[ge.length-1],offset:ge[ge.length-2]-ge[ge.length-3]}}if(!Q||!re){e.removeAllRanges();return}var Le=e.rangeCount&&e.getRangeAt(0),Ce;try{Ce=v(Q.node,Q.offset,re.offset,re.node)}catch(Ne){}Ce&&(!O&&t.state.focused?(e.collapse(Q.node,Q.offset),Ce.collapsed||(e.removeAllRanges(),e.addRange(Ce))):(e.removeAllRanges(),e.addRange(Ce)),Le&&e.anchorNode==null?e.addRange(Le):O&&this.startGracePeriod()),this.rememberSelection()},Ut.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},Ut.prototype.showMultipleSelections=function(e){u(this.cm.display.cursorDiv,e.cursors),u(this.cm.display.selectionDiv,e.selection)},Ut.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Ut.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return S(this.div,t)},Ut.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Ut.prototype.blur=function(){this.div.blur()},Ut.prototype.getField=function(){return this.div},Ut.prototype.supportsTouch=function(){return!0},Ut.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Br(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},Ut.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Ut.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(h&&x&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var i=la(t,e.anchorNode,e.anchorOffset),r=la(t,e.focusNode,e.focusOffset);i&&r&&Br(t,function(){mr(t.doc,Li(i,r),Se),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Ut.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,i=e.doc.sel.primary(),r=i.from(),n=i.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Fe(r.line-1,Ze(e.doc,r.line-1).length)),n.ch==Ze(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=Fe(n.line+1,0)),r.line<t.viewFrom||n.line>t.viewTo-1)return!1;var C,W,Y;r.line==t.viewFrom||(C=Wi(e,r.line))==0?(W=Et(t.view[0].line),Y=t.view[0].node):(W=Et(t.view[C].line),Y=t.view[C-1].node.nextSibling);var Q=Wi(e,n.line),re,pe;if(Q==t.view.length-1?(re=t.viewTo-1,pe=t.lineDiv.lastChild):(re=Et(t.view[Q+1].line)-1,pe=t.view[Q+1].node.previousSibling),!Y)return!1;for(var ge=e.doc.splitLines(tu(e,Y,pe,W,re)),Le=Rt(e.doc,Fe(W,0),Fe(re,Ze(e.doc,re).text.length));ge.length>1&&Le.length>1;)if(l(ge)==l(Le))ge.pop(),Le.pop(),re--;else if(ge[0]==Le[0])ge.shift(),Le.shift(),W++;else break;for(var Ce=0,Ne=0,Be=ge[0],ze=Le[0],Ye=Math.min(Be.length,ze.length);Ce<Ye&&Be.charCodeAt(Ce)==ze.charCodeAt(Ce);)++Ce;for(var rt=l(ge),$e=l(Le),lt=Math.min(rt.length-(ge.length==1?Ce:0),$e.length-(Le.length==1?Ce:0));Ne<lt&&rt.charCodeAt(rt.length-Ne-1)==$e.charCodeAt($e.length-Ne-1);)++Ne;if(ge.length==1&&Le.length==1&&W==r.line)for(;Ce&&Ce>r.ch&&rt.charCodeAt(rt.length-Ne-1)==$e.charCodeAt($e.length-Ne-1);)Ce--,Ne++;ge[ge.length-1]=rt.slice(0,rt.length-Ne).replace(/^\u200b+/,""),ge[0]=ge[0].slice(Ce).replace(/\u200b+$/,"");var vt=Fe(W,Ce),mt=Fe(re,Le.length?l(Le).length-Ne:0);if(ge.length>1||ge[0]||yt(vt,mt))return on(e.doc,ge,vt,mt,"+input"),!0},Ut.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ut.prototype.reset=function(){this.forceCompositionEnd()},Ut.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Ut.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)},Ut.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Br(this.cm,function(){return wr(e.cm)})},Ut.prototype.setUneditable=function(e){e.contentEditable="false"},Ut.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||sr(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Ut.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Ut.prototype.onContextMenu=function(){},Ut.prototype.resetPosition=function(){},Ut.prototype.needsContentAttribute=!0;function ks(e,t){var i=fa(e,t.line);if(!i||i.hidden)return null;var r=Ze(e.doc,t.line),n=eo(i,r,t.line),C=Qe(r,e.doc.direction),W="left";if(C){var Y=Xe(C,t.ch);W=Y%2?"right":"left"}var Q=io(n.map,t.ch,W);return Q.offset=Q.collapse=="right"?Q.end:Q.start,Q}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function hn(e,t){return t&&(e.bad=!0),e}function tu(e,t,i,r,n){var C="",W=!1,Y=e.doc.lineSeparator(),Q=!1;function re(Ce){return function(Ne){return Ne.id==Ce}}function pe(){W&&(C+=Y,Q&&(C+=Y),W=Q=!1)}function ge(Ce){Ce&&(pe(),C+=Ce)}function Le(Ce){if(Ce.nodeType==1){var Ne=Ce.getAttribute("cm-text");if(Ne){ge(Ne);return}var Be=Ce.getAttribute("cm-marker"),ze;if(Be){var Ye=e.findMarks(Fe(r,0),Fe(n+1,0),re(+Be));Ye.length&&(ze=Ye[0].find(0))&&ge(Rt(e.doc,ze.from,ze.to).join(Y));return}if(Ce.getAttribute("contenteditable")=="false")return;var rt=/^(pre|div|p|li|table|br)$/i.test(Ce.nodeName);if(!/^br$/i.test(Ce.nodeName)&&Ce.textContent.length==0)return;rt&&pe();for(var $e=0;$e<Ce.childNodes.length;$e++)Le(Ce.childNodes[$e]);/^(pre|p)$/i.test(Ce.nodeName)&&(Q=!0),rt&&(W=!0)}else Ce.nodeType==3&&ge(Ce.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Le(t),t==i);)t=t.nextSibling,Q=!1;return C}function la(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return hn(e.clipPos(Fe(e.display.viewTo-1)),!0);t=null,i=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var n=0;n<e.display.view.length;n++){var C=e.display.view[n];if(C.node==r)return ru(C,t,i)}}function ru(e,t,i){var r=e.text.firstChild,n=!1;if(!t||!S(r,t))return hn(Fe(Et(e.line),0),!0);if(t==r&&(n=!0,t=r.childNodes[i],i=0,!t)){var C=e.rest?l(e.rest):e.line;return hn(Fe(Et(C),C.text.length),n)}var W=t.nodeType==3?t:null,Y=t;for(!W&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(W=t.firstChild,i&&(i=W.nodeValue.length));Y.parentNode!=r;)Y=Y.parentNode;var Q=e.measure,re=Q.maps;function pe(ze,Ye,rt){for(var $e=-1;$e<(re?re.length:0);$e++)for(var lt=$e<0?Q.map:re[$e],vt=0;vt<lt.length;vt+=3){var mt=lt[vt+2];if(mt==ze||mt==Ye){var wt=Et($e<0?e.line:e.rest[$e]),Wt=lt[vt]+rt;return(rt<0||mt!=ze)&&(Wt=lt[vt+(rt?1:0)]),Fe(wt,Wt)}}}var ge=pe(W,Y,i);if(ge)return hn(ge,n);for(var Le=Y.nextSibling,Ce=W?W.nodeValue.length-i:0;Le;Le=Le.nextSibling){if(ge=pe(Le,Le.firstChild,0),ge)return hn(Fe(ge.line,ge.ch-Ce),n);Ce+=Le.textContent.length}for(var Ne=Y.previousSibling,Be=i;Ne;Ne=Ne.previousSibling){if(ge=pe(Ne,Ne.firstChild,-1),ge)return hn(Fe(ge.line,ge.ch+Be),n);Be+=Ne.textContent.length}}var Jt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ie,this.hasSelection=!1,this.composing=null};Jt.prototype.init=function(e){var t=this,i=this,r=this.cm;this.createField(e);var n=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),_&&(n.style.width="0px"),Ae(n,"input",function(){G&&H>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),Ae(n,"paste",function(W){if(q(r,W)||Cs(W,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function C(W){if(q(r,W))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Y=_s(r);sa({lineWise:!0,text:Y.text}),W.type=="cut"?r.setSelections(Y.ranges,null,Se):(i.prevInput="",n.value=Y.text.join(`
`),V(n))}else return;W.type=="cut"&&(r.state.cutIncoming=+new Date)}Ae(n,"cut",C),Ae(n,"copy",C),Ae(e.scroller,"paste",function(W){if(mi(e,W)||q(r,W))return;if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var Y=new Event("paste");Y.clipboardData=W.clipboardData,n.dispatchEvent(Y)}),Ae(e.lineSpace,"selectstart",function(W){mi(e,W)||te(W)}),Ae(n,"compositionstart",function(){var W=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:W,range:r.markText(W,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ae(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},Jt.prototype.createField=function(e){this.wrapper=As(),this.textarea=this.wrapper.firstChild},Jt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Jt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=mo(e);if(e.options.moveInputWithCursor){var n=Qr(e,i.sel.primary().head,"div"),C=t.wrapper.getBoundingClientRect(),W=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+W.top-C.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+W.left-C.left))}return r},Jt.prototype.showSelection=function(e){var t=this.cm,i=t.display;u(i.cursorDiv,e.cursors),u(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Jt.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&V(this.textarea),G&&H>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",G&&H>=9&&(this.hasSelection=null))},Jt.prototype.getField=function(){return this.textarea},Jt.prototype.supportsTouch=function(){return!1},Jt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||I()!=this.textarea))try{this.textarea.focus()}catch(e){}},Jt.prototype.blur=function(){this.textarea.blur()},Jt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Jt.prototype.receivedFocus=function(){this.slowPoll()},Jt.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()})},Jt.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},Jt.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||dt(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(G&&H>=9&&this.hasSelection===n||s&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var C=n.charCodeAt(0);if(C==8203&&!r&&(r="\u200B"),C==8666)return this.reset(),this.cm.execCommand("undo")}for(var W=0,Y=Math.min(r.length,n.length);W<Y&&r.charCodeAt(W)==n.charCodeAt(W);)++W;return Br(t,function(){za(t,n.slice(W),r.length-W,null,e.composing?"*compose":null),n.length>1e3||n.indexOf(`
`)>-1?i.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Jt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Jt.prototype.onKeyPress=function(){G&&H>=9&&(this.hasSelection=null),this.fastPoll()},Jt.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var C=ji(i,e),W=r.scroller.scrollTop;if(!C||w)return;var Y=i.options.resetSelectionOnContextMenu;Y&&i.doc.sel.contains(C)==-1&&sr(i,mr)(i.doc,Li(C),Se);var Q=n.style.cssText,re=t.wrapper.style.cssText,pe=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-pe.top-5)+"px; left: "+(e.clientX-pe.left-5)+`px;
z-index: 1000; background: `+(G?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ge;B&&(ge=window.scrollY),r.input.focus(),B&&window.scrollTo(null,ge),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=Ce,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function Le(){if(n.selectionStart!=null){var Be=i.somethingSelected(),ze="\u200B"+(Be?n.value:"");n.value="\u21DA",n.value=ze,t.prevInput=Be?"":"\u200B",n.selectionStart=1,n.selectionEnd=ze.length,r.selForContextMenu=i.doc.sel}}function Ce(){if(t.contextMenuPending!=Ce)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=re,n.style.cssText=Q,G&&H<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=W),n.selectionStart!=null){(!G||G&&H<9)&&Le();var Be=0,ze=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?sr(i,Xo)(i):Be++<10?r.detectingSelectAll=setTimeout(ze,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(ze,200)}}if(G&&H>=9&&Le(),f){fe(e);var Ne=function(){it(window,"mouseup",Ne),setTimeout(Ce,20)};Ae(window,"mouseup",Ne)}else setTimeout(Ce,50)},Jt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Jt.prototype.setUneditable=function(){},Jt.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?N(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 i=I();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=Y.getValue()}var n;if(e.form&&(Ae(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var C=e.form;n=C.submit;try{var W=C.submit=function(){r(),C.submit=n,C.submit(),C.submit=W}}catch(Q){}}t.finishInit=function(Q){Q.save=r,Q.getTextArea=function(){return e},Q.toTextArea=function(){Q.toTextArea=isNaN,r(),e.parentNode.removeChild(Q.getWrapperElement()),e.style.display="",e.form&&(it(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var Y=zt(function(Q){return e.parentNode.insertBefore(Q,e.nextSibling)},t);return Y}function nu(e){e.off=it,e.on=Ae,e.wheelEventPixels=hl,e.Doc=Ar,e.splitLines=ft,e.countColumn=$,e.findColumn=_e,e.isWordChar=be,e.Pass=ke,e.signal=se,e.Line=_t,e.changeEnd=ki,e.scrollbarModel=Co,e.Pos=Fe,e.cmpPos=yt,e.modes=Bt,e.mimeModes=Lt,e.resolveMode=er,e.getMode=hr,e.modeExtensions=vr,e.extendMode=Vr,e.copyState=tr,e.startState=Or,e.innerMode=Xr,e.commands=Un,e.keyMap=gi,e.keyName=us,e.isModifierKey=ss,e.lookupKey=ln,e.normalizeKeyMap=Pl,e.StringStream=Gt,e.SharedTextMarker=Mn,e.TextMarker=Di,e.LineWidget=Pn,e.e_preventDefault=te,e.e_stopPropagation=ne,e.e_stop=fe,e.addClass=j,e.contains=S,e.rmClass=p,e.keyNames=Oi}$l(zt),ql(zt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ua in Ar.prototype)Ar.prototype.hasOwnProperty(ua)&&he(au,ua)<0&&(zt.prototype[ua]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ar.prototype[ua]));return ue(Ar),zt.inputStyles={textarea:Jt,contenteditable:Ut},zt.defineMode=function(e){!zt.defaults.mode&&e!="null"&&(zt.defaults.mode=e),Sr.apply(this,arguments)},zt.defineMIME=Dr,zt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),zt.defineMIME("text/plain","null"),zt.defineExtension=function(e,t){zt.prototype[e]=t},zt.defineDocExtension=function(e,t){Ar.prototype[e]=t},zt.fromTextArea=iu,nu(zt),zt.version="5.58.2",zt})},Y1PL:function(tt,Ke,le){"use strict";le.r(Ke),le.d(Ke,"ResizableTextArea",function(){return he});var ce=le("wx14"),J=le("1OyB"),O=le("vuIU"),Z=le("Ji7U"),F=le("LK+K"),k=le("q1tI"),G=le("VTBJ"),H=le("rePB"),B=le("Zm9Q"),R=le("Kwbf"),x=le("c+Xe"),w=le("m+aA"),P=le("bdgK"),L=new Map;function A(Se){Se.forEach(function(Re){var Te,_e=Re.target;(Te=L.get(_e))===null||Te===void 0||Te.forEach(function(ye){return ye(_e)})})}var _=new P.default(A),h=null,o=null;function s(Se,Re){L.has(Se)||(L.set(Se,new Set),_.observe(Se)),L.get(Se).add(Re)}function d(Se,Re){L.has(Se)&&(L.get(Se).delete(Re),L.get(Se).size||(_.unobserve(Se),L.delete(Se)))}var T=function(Se){Object(Z.a)(Te,Se);var Re=Object(F.a)(Te);function Te(){return Object(J.a)(this,Te),Re.apply(this,arguments)}return Object(O.a)(Te,[{key:"render",value:function(){return this.props.children}}]),Te}(k.Component),y=k.createContext(null);function m(Se){var Re=Se.children,Te=Se.onBatchResize,_e=k.useRef(0),ye=k.useRef([]),K=k.useContext(y),l=k.useCallback(function(c,D,X){_e.current+=1;var U=_e.current;ye.current.push({size:c,element:D,data:X}),Promise.resolve().then(function(){U===_e.current&&(Te==null||Te(ye.current),ye.current=[])}),K==null||K(c,D,X)},[Te,K]);return k.createElement(y.Provider,{value:l},Re)}function f(Se){var Re=Se.children,Te=Se.disabled,_e=k.useRef(null),ye=k.useRef(null),K=k.useContext(y),l=k.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),c=k.isValidElement(Re)&&Object(x.c)(Re),D=c?Re.ref:null,X=k.useMemo(function(){return Object(x.a)(D,_e)},[D,_e]),U=k.useRef(Se);U.current=Se;var oe=k.useCallback(function(be){var xe=U.current,Pe=xe.onResize,De=xe.data,Oe=be.getBoundingClientRect(),Ie=Oe.width,He=Oe.height,Ve=be.offsetWidth,Je=be.offsetHeight,Xe=Math.floor(Ie),We=Math.floor(He);if(l.current.width!==Xe||l.current.height!==We||l.current.offsetWidth!==Ve||l.current.offsetHeight!==Je){var Qe={width:Xe,height:We,offsetWidth:Ve,offsetHeight:Je};l.current=Qe;var et=Ve===Math.round(Ie)?Ie:Ve,Ae=Je===Math.round(He)?He:Je,ut=Object(G.a)(Object(G.a)({},Qe),{},{offsetWidth:et,offsetHeight:Ae});K==null||K(ut,be,De),Pe&&Promise.resolve().then(function(){Pe(ut,be)})}},[]);return k.useEffect(function(){var be=Object(w.a)(_e.current)||Object(w.a)(ye.current);return be&&!Te&&s(be,oe),function(){return d(be,oe)}},[_e.current,Te]),k.createElement(T,{ref:ye},c?k.cloneElement(Re,{ref:X}):Re)}var E="rc-observer-key";function p(Se){var Re=Se.children,Te=Object(B.a)(Re);return Te.map(function(_e,ye){var K=(_e==null?void 0:_e.key)||"".concat(E,"-").concat(ye);return k.createElement(f,Object(ce.a)({},Se,{key:K}),_e)})}p.Collection=m;var g=p,u=le("bT9E"),a=le("TSYQ"),b=le.n(a),v=`
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
`,S=["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"],I={},j;function z(Se){var Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=Se.getAttribute("id")||Se.getAttribute("data-reactid")||Se.getAttribute("name");if(Re&&I[Te])return I[Te];var _e=window.getComputedStyle(Se),ye=_e.getPropertyValue("box-sizing")||_e.getPropertyValue("-moz-box-sizing")||_e.getPropertyValue("-webkit-box-sizing"),K=parseFloat(_e.getPropertyValue("padding-bottom"))+parseFloat(_e.getPropertyValue("padding-top")),l=parseFloat(_e.getPropertyValue("border-bottom-width"))+parseFloat(_e.getPropertyValue("border-top-width")),c=S.map(function(X){return"".concat(X,":").concat(_e.getPropertyValue(X))}).join(";"),D={sizingStyle:c,paddingSize:K,borderSize:l,boxSizing:ye};return Re&&Te&&(I[Te]=D),D}function V(Se){var Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,_e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;j||(j=document.createElement("textarea"),j.setAttribute("tab-index","-1"),j.setAttribute("aria-hidden","true"),document.body.appendChild(j)),Se.getAttribute("wrap")?j.setAttribute("wrap",Se.getAttribute("wrap")):j.removeAttribute("wrap");var ye=z(Se,Re),K=ye.paddingSize,l=ye.borderSize,c=ye.boxSizing,D=ye.sizingStyle;j.setAttribute("style","".concat(D,";").concat(v)),j.value=Se.value||Se.placeholder||"";var X=Number.MIN_SAFE_INTEGER,U=Number.MAX_SAFE_INTEGER,oe=j.scrollHeight,be;if(c==="border-box"?oe+=l:c==="content-box"&&(oe-=K),Te!==null||_e!==null){j.value=" ";var xe=j.scrollHeight-K;Te!==null&&(X=xe*Te,c==="border-box"&&(X=X+K+l),oe=Math.max(X,oe)),_e!==null&&(U=xe*_e,c==="border-box"&&(U=U+K+l),be=oe>U?"":"hidden",oe=Math.min(U,oe))}return{height:oe,minHeight:X,maxHeight:U,overflowY:be,resize:"none"}}var M=le("Gytx"),N=le.n(M),$;(function(Se){Se[Se.NONE=0]="NONE",Se[Se.RESIZING=1]="RESIZING",Se[Se.RESIZED=2]="RESIZED"})($||($={}));var ie=function(Se){Object(Z.a)(Te,Se);var Re=Object(F.a)(Te);function Te(_e){var ye;return Object(J.a)(this,Te),ye=Re.call(this,_e),ye.nextFrameActionId=void 0,ye.resizeFrameId=void 0,ye.textArea=void 0,ye.saveTextArea=function(K){ye.textArea=K},ye.handleResize=function(K){var l=ye.state.resizeStatus,c=ye.props,D=c.autoSize,X=c.onResize;if(l!==$.NONE)return;typeof X=="function"&&X(K),D&&ye.resizeOnNextFrame()},ye.resizeOnNextFrame=function(){cancelAnimationFrame(ye.nextFrameActionId),ye.nextFrameActionId=requestAnimationFrame(ye.resizeTextarea)},ye.resizeTextarea=function(){var K=ye.props.autoSize;if(!K||!ye.textArea)return;var l=K.minRows,c=K.maxRows,D=V(ye.textArea,!1,l,c);ye.setState({textareaStyles:D,resizeStatus:$.RESIZING},function(){cancelAnimationFrame(ye.resizeFrameId),ye.resizeFrameId=requestAnimationFrame(function(){ye.setState({resizeStatus:$.RESIZED},function(){ye.resizeFrameId=requestAnimationFrame(function(){ye.setState({resizeStatus:$.NONE}),ye.fixFirefoxAutoScroll()})})})})},ye.renderTextArea=function(){var K=ye.props,l=K.prefixCls,c=l===void 0?"rc-textarea":l,D=K.autoSize,X=K.onResize,U=K.className,oe=K.disabled,be=ye.state,xe=be.textareaStyles,Pe=be.resizeStatus,De=Object(u.a)(ye.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Oe=b()(c,U,Object(H.a)({},"".concat(c,"-disabled"),oe));"value"in De&&(De.value=De.value||"");var Ie=Object(G.a)(Object(G.a)(Object(G.a)({},ye.props.style),xe),Pe===$.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return k.createElement(g,{onResize:ye.handleResize,disabled:!(D||X)},k.createElement("textarea",Object(ce.a)({},De,{className:Oe,style:Ie,ref:ye.saveTextArea})))},ye.state={textareaStyles:{},resizeStatus:$.NONE},ye}return Object(O.a)(Te,[{key:"componentDidUpdate",value:function(ye){(ye.value!==this.props.value||!N()(ye.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 ye=this.textArea.selectionStart,K=this.textArea.selectionEnd;this.textArea.setSelectionRange(ye,K)}}catch(l){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Te}(k.Component),he=ie,me=function(Se){Object(Z.a)(Te,Se);var Re=Object(F.a)(Te);function Te(_e){var ye;Object(J.a)(this,Te),ye=Re.call(this,_e),ye.resizableTextArea=void 0,ye.focus=function(){ye.resizableTextArea.textArea.focus()},ye.saveTextArea=function(l){ye.resizableTextArea=l},ye.handleChange=function(l){var c=ye.props.onChange;ye.setValue(l.target.value,function(){ye.resizableTextArea.resizeTextarea()}),c&&c(l)},ye.handleKeyDown=function(l){var c=ye.props,D=c.onPressEnter,X=c.onKeyDown;l.keyCode===13&&D&&D(l),X&&X(l)};var K=typeof _e.value=="undefined"||_e.value===null?_e.defaultValue:_e.value;return ye.state={value:K},ye}return Object(O.a)(Te,[{key:"setValue",value:function(ye,K){"value"in this.props||this.setState({value:ye},K)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return k.createElement(he,Object(ce.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ye){return"value"in ye?{value:ye.value}:null}}]),Te}(k.Component),ke=Ke.default=me},YKnm:function(tt,Ke){tt.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAKhJREFUOE/FktkNg0AMRMf0EEQ50EdIK5BWgD6gnGiLiJFXONoDFlZ8xN/zxseYcLPoJo9sg/LFPRidGcmyWQYKC5ht4MJ2bcLbDNRfmuAI9lYQkTiGR/XgraursRP8RIGgenL9JcyiKRjNZ6IlbOAbOMcR4aPlmYD6CI5WkHj0ODpVCo5iVIiB5ayzrhKlULbMbkxnnxobyKfJLXYS2TO79AepKf5vsAItjVcRnmIf4gAAAABJRU5ErkJggg=="},Zss7:function(tt,Ke,le){var ce;(function(J){var O=/^\s+/,Z=/\s+$/,F=0,k=J.round,G=J.min,H=J.max,B=J.random;function R(l,c){if(l=l||"",c=c||{},l instanceof R)return l;if(!(this instanceof R))return new R(l,c);var D=x(l);this._originalInput=l,this._r=D.r,this._g=D.g,this._b=D.b,this._a=D.a,this._roundA=k(100*this._a)/100,this._format=c.format||D.format,this._gradientType=c.gradientType,this._r<1&&(this._r=k(this._r)),this._g<1&&(this._g=k(this._g)),this._b<1&&(this._b=k(this._b)),this._ok=D.ok,this._tc_id=F++}R.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 l=this.toRgb();return(l.r*299+l.g*587+l.b*114)/1e3},getLuminance:function(){var l=this.toRgb(),c,D,X,U,oe,be;return c=l.r/255,D=l.g/255,X=l.b/255,c<=.03928?U=c/12.92:U=J.pow((c+.055)/1.055,2.4),D<=.03928?oe=D/12.92:oe=J.pow((D+.055)/1.055,2.4),X<=.03928?be=X/12.92:be=J.pow((X+.055)/1.055,2.4),.2126*U+.7152*oe+.0722*be},setAlpha:function(l){return this._a=V(l),this._roundA=k(100*this._a)/100,this},toHsv:function(){var l=A(this._r,this._g,this._b);return{h:l.h*360,s:l.s,v:l.v,a:this._a}},toHsvString:function(){var l=A(this._r,this._g,this._b),c=k(l.h*360),D=k(l.s*100),X=k(l.v*100);return this._a==1?"hsv("+c+", "+D+"%, "+X+"%)":"hsva("+c+", "+D+"%, "+X+"%, "+this._roundA+")"},toHsl:function(){var l=P(this._r,this._g,this._b);return{h:l.h*360,s:l.s,l:l.l,a:this._a}},toHslString:function(){var l=P(this._r,this._g,this._b),c=k(l.h*360),D=k(l.s*100),X=k(l.l*100);return this._a==1?"hsl("+c+", "+D+"%, "+X+"%)":"hsla("+c+", "+D+"%, "+X+"%, "+this._roundA+")"},toHex:function(l){return h(this._r,this._g,this._b,l)},toHexString:function(l){return"#"+this.toHex(l)},toHex8:function(l){return o(this._r,this._g,this._b,this._a,l)},toHex8String:function(l){return"#"+this.toHex8(l)},toRgb:function(){return{r:k(this._r),g:k(this._g),b:k(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+k(this._r)+", "+k(this._g)+", "+k(this._b)+")":"rgba("+k(this._r)+", "+k(this._g)+", "+k(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:k(M(this._r,255)*100)+"%",g:k(M(this._g,255)*100)+"%",b:k(M(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+k(M(this._r,255)*100)+"%, "+k(M(this._g,255)*100)+"%, "+k(M(this._b,255)*100)+"%)":"rgba("+k(M(this._r,255)*100)+"%, "+k(M(this._g,255)*100)+"%, "+k(M(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:j[h(this._r,this._g,this._b,!0)]||!1},toFilter:function(l){var c="#"+s(this._r,this._g,this._b,this._a),D=c,X=this._gradientType?"GradientType = 1, ":"";if(l){var U=R(l);D="#"+s(U._r,U._g,U._b,U._a)}return"progid:DXImageTransform.Microsoft.gradient("+X+"startColorstr="+c+",endColorstr="+D+")"},toString:function(l){var c=!!l;l=l||this._format;var D=!1,X=this._a<1&&this._a>=0,U=!c&&X&&(l==="hex"||l==="hex6"||l==="hex3"||l==="hex4"||l==="hex8"||l==="name");return U?l==="name"&&this._a===0?this.toName():this.toRgbString():(l==="rgb"&&(D=this.toRgbString()),l==="prgb"&&(D=this.toPercentageRgbString()),(l==="hex"||l==="hex6")&&(D=this.toHexString()),l==="hex3"&&(D=this.toHexString(!0)),l==="hex4"&&(D=this.toHex8String(!0)),l==="hex8"&&(D=this.toHex8String()),l==="name"&&(D=this.toName()),l==="hsl"&&(D=this.toHslString()),l==="hsv"&&(D=this.toHsvString()),D||this.toHexString())},clone:function(){return R(this.toString())},_applyModification:function(l,c){var D=l.apply(null,[this].concat([].slice.call(c)));return this._r=D._r,this._g=D._g,this._b=D._b,this.setAlpha(D._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(f,arguments)},darken:function(){return this._applyModification(E,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(T,arguments)},greyscale:function(){return this._applyModification(y,arguments)},spin:function(){return this._applyModification(p,arguments)},_applyCombination:function(l,c){return l.apply(null,[this].concat([].slice.call(c)))},analogous:function(){return this._applyCombination(v,arguments)},complement:function(){return this._applyCombination(g,arguments)},monochromatic:function(){return this._applyCombination(S,arguments)},splitcomplement:function(){return this._applyCombination(b,arguments)},triad:function(){return this._applyCombination(u,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},R.fromRatio=function(l,c){if(typeof l=="object"){var D={};for(var X in l)l.hasOwnProperty(X)&&(X==="a"?D[X]=l[X]:D[X]=ke(l[X]));l=D}return R(l,c)};function x(l){var c={r:0,g:0,b:0},D=1,X=null,U=null,oe=null,be=!1,xe=!1;return typeof l=="string"&&(l=ye(l)),typeof l=="object"&&(_e(l.r)&&_e(l.g)&&_e(l.b)?(c=w(l.r,l.g,l.b),be=!0,xe=String(l.r).substr(-1)==="%"?"prgb":"rgb"):_e(l.h)&&_e(l.s)&&_e(l.v)?(X=ke(l.s),U=ke(l.v),c=_(l.h,X,U),be=!0,xe="hsv"):_e(l.h)&&_e(l.s)&&_e(l.l)&&(X=ke(l.s),oe=ke(l.l),c=L(l.h,X,oe),be=!0,xe="hsl"),l.hasOwnProperty("a")&&(D=l.a)),D=V(D),{ok:be,format:l.format||xe,r:G(255,H(c.r,0)),g:G(255,H(c.g,0)),b:G(255,H(c.b,0)),a:D}}function w(l,c,D){return{r:M(l,255)*255,g:M(c,255)*255,b:M(D,255)*255}}function P(l,c,D){l=M(l,255),c=M(c,255),D=M(D,255);var X=H(l,c,D),U=G(l,c,D),oe,be,xe=(X+U)/2;if(X==U)oe=be=0;else{var Pe=X-U;be=xe>.5?Pe/(2-X-U):Pe/(X+U);switch(X){case l:oe=(c-D)/Pe+(c<D?6:0);break;case c:oe=(D-l)/Pe+2;break;case D:oe=(l-c)/Pe+4;break}oe/=6}return{h:oe,s:be,l:xe}}function L(l,c,D){var X,U,oe;l=M(l,360),c=M(c,100),D=M(D,100);function be(De,Oe,Ie){return Ie<0&&(Ie+=1),Ie>1&&(Ie-=1),Ie<1/6?De+(Oe-De)*6*Ie:Ie<1/2?Oe:Ie<2/3?De+(Oe-De)*(2/3-Ie)*6:De}if(c===0)X=U=oe=D;else{var xe=D<.5?D*(1+c):D+c-D*c,Pe=2*D-xe;X=be(Pe,xe,l+1/3),U=be(Pe,xe,l),oe=be(Pe,xe,l-1/3)}return{r:X*255,g:U*255,b:oe*255}}function A(l,c,D){l=M(l,255),c=M(c,255),D=M(D,255);var X=H(l,c,D),U=G(l,c,D),oe,be,xe=X,Pe=X-U;if(be=X===0?0:Pe/X,X==U)oe=0;else{switch(X){case l:oe=(c-D)/Pe+(c<D?6:0);break;case c:oe=(D-l)/Pe+2;break;case D:oe=(l-c)/Pe+4;break}oe/=6}return{h:oe,s:be,v:xe}}function _(l,c,D){l=M(l,360)*6,c=M(c,100),D=M(D,100);var X=J.floor(l),U=l-X,oe=D*(1-c),be=D*(1-U*c),xe=D*(1-(1-U)*c),Pe=X%6,De=[D,be,oe,oe,xe,D][Pe],Oe=[xe,D,D,be,oe,oe][Pe],Ie=[oe,oe,xe,D,D,be][Pe];return{r:De*255,g:Oe*255,b:Ie*255}}function h(l,c,D,X){var U=[me(k(l).toString(16)),me(k(c).toString(16)),me(k(D).toString(16))];return X&&U[0].charAt(0)==U[0].charAt(1)&&U[1].charAt(0)==U[1].charAt(1)&&U[2].charAt(0)==U[2].charAt(1)?U[0].charAt(0)+U[1].charAt(0)+U[2].charAt(0):U.join("")}function o(l,c,D,X,U){var oe=[me(k(l).toString(16)),me(k(c).toString(16)),me(k(D).toString(16)),me(Se(X))];return U&&oe[0].charAt(0)==oe[0].charAt(1)&&oe[1].charAt(0)==oe[1].charAt(1)&&oe[2].charAt(0)==oe[2].charAt(1)&&oe[3].charAt(0)==oe[3].charAt(1)?oe[0].charAt(0)+oe[1].charAt(0)+oe[2].charAt(0)+oe[3].charAt(0):oe.join("")}function s(l,c,D,X){var U=[me(Se(X)),me(k(l).toString(16)),me(k(c).toString(16)),me(k(D).toString(16))];return U.join("")}R.equals=function(l,c){return!l||!c?!1:R(l).toRgbString()==R(c).toRgbString()},R.random=function(){return R.fromRatio({r:B(),g:B(),b:B()})};function d(l,c){c=c===0?0:c||10;var D=R(l).toHsl();return D.s-=c/100,D.s=N(D.s),R(D)}function T(l,c){c=c===0?0:c||10;var D=R(l).toHsl();return D.s+=c/100,D.s=N(D.s),R(D)}function y(l){return R(l).desaturate(100)}function m(l,c){c=c===0?0:c||10;var D=R(l).toHsl();return D.l+=c/100,D.l=N(D.l),R(D)}function f(l,c){c=c===0?0:c||10;var D=R(l).toRgb();return D.r=H(0,G(255,D.r-k(255*-(c/100)))),D.g=H(0,G(255,D.g-k(255*-(c/100)))),D.b=H(0,G(255,D.b-k(255*-(c/100)))),R(D)}function E(l,c){c=c===0?0:c||10;var D=R(l).toHsl();return D.l-=c/100,D.l=N(D.l),R(D)}function p(l,c){var D=R(l).toHsl(),X=(D.h+c)%360;return D.h=X<0?360+X:X,R(D)}function g(l){var c=R(l).toHsl();return c.h=(c.h+180)%360,R(c)}function u(l){var c=R(l).toHsl(),D=c.h;return[R(l),R({h:(D+120)%360,s:c.s,l:c.l}),R({h:(D+240)%360,s:c.s,l:c.l})]}function a(l){var c=R(l).toHsl(),D=c.h;return[R(l),R({h:(D+90)%360,s:c.s,l:c.l}),R({h:(D+180)%360,s:c.s,l:c.l}),R({h:(D+270)%360,s:c.s,l:c.l})]}function b(l){var c=R(l).toHsl(),D=c.h;return[R(l),R({h:(D+72)%360,s:c.s,l:c.l}),R({h:(D+216)%360,s:c.s,l:c.l})]}function v(l,c,D){c=c||6,D=D||30;var X=R(l).toHsl(),U=360/D,oe=[R(l)];for(X.h=(X.h-(U*c>>1)+720)%360;--c;)X.h=(X.h+U)%360,oe.push(R(X));return oe}function S(l,c){c=c||6;for(var D=R(l).toHsv(),X=D.h,U=D.s,oe=D.v,be=[],xe=1/c;c--;)be.push(R({h:X,s:U,v:oe})),oe=(oe+xe)%1;return be}R.mix=function(l,c,D){D=D===0?0:D||50;var X=R(l).toRgb(),U=R(c).toRgb(),oe=D/100,be={r:(U.r-X.r)*oe+X.r,g:(U.g-X.g)*oe+X.g,b:(U.b-X.b)*oe+X.b,a:(U.a-X.a)*oe+X.a};return R(be)},R.readability=function(l,c){var D=R(l),X=R(c);return(J.max(D.getLuminance(),X.getLuminance())+.05)/(J.min(D.getLuminance(),X.getLuminance())+.05)},R.isReadable=function(l,c,D){var X=R.readability(l,c),U,oe;oe=!1,U=K(D);switch(U.level+U.size){case"AAsmall":case"AAAlarge":oe=X>=4.5;break;case"AAlarge":oe=X>=3;break;case"AAAsmall":oe=X>=7;break}return oe},R.mostReadable=function(l,c,D){var X=null,U=0,oe,be,xe,Pe;D=D||{},be=D.includeFallbackColors,xe=D.level,Pe=D.size;for(var De=0;De<c.length;De++)oe=R.readability(l,c[De]),oe>U&&(U=oe,X=R(c[De]));return R.isReadable(l,X,{level:xe,size:Pe})||!be?X:(D.includeFallbackColors=!1,R.mostReadable(l,["#fff","#000"],D))};var I=R.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"},j=R.hexNames=z(I);function z(l){var c={};for(var D in l)l.hasOwnProperty(D)&&(c[l[D]]=D);return c}function V(l){return l=parseFloat(l),(isNaN(l)||l<0||l>1)&&(l=1),l}function M(l,c){ie(l)&&(l="100%");var D=he(l);return l=G(c,H(0,parseFloat(l))),D&&(l=parseInt(l*c,10)/100),J.abs(l-c)<1e-6?1:l%c/parseFloat(c)}function N(l){return G(1,H(0,l))}function $(l){return parseInt(l,16)}function ie(l){return typeof l=="string"&&l.indexOf(".")!=-1&&parseFloat(l)===1}function he(l){return typeof l=="string"&&l.indexOf("%")!=-1}function me(l){return l.length==1?"0"+l:""+l}function ke(l){return l<=1&&(l=l*100+"%"),l}function Se(l){return J.round(parseFloat(l)*255).toString(16)}function Re(l){return $(l)/255}var Te=function(){var l="[-\\+]?\\d+%?",c="[-\\+]?\\d*\\.\\d+%?",D="(?:"+c+")|(?:"+l+")",X="[\\s|\\(]+("+D+")[,|\\s]+("+D+")[,|\\s]+("+D+")\\s*\\)?",U="[\\s|\\(]+("+D+")[,|\\s]+("+D+")[,|\\s]+("+D+")[,|\\s]+("+D+")\\s*\\)?";return{CSS_UNIT:new RegExp(D),rgb:new RegExp("rgb"+X),rgba:new RegExp("rgba"+U),hsl:new RegExp("hsl"+X),hsla:new RegExp("hsla"+U),hsv:new RegExp("hsv"+X),hsva:new RegExp("hsva"+U),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 _e(l){return!!Te.CSS_UNIT.exec(l)}function ye(l){l=l.replace(O,"").replace(Z,"").toLowerCase();var c=!1;if(I[l])l=I[l],c=!0;else if(l=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var D;return(D=Te.rgb.exec(l))?{r:D[1],g:D[2],b:D[3]}:(D=Te.rgba.exec(l))?{r:D[1],g:D[2],b:D[3],a:D[4]}:(D=Te.hsl.exec(l))?{h:D[1],s:D[2],l:D[3]}:(D=Te.hsla.exec(l))?{h:D[1],s:D[2],l:D[3],a:D[4]}:(D=Te.hsv.exec(l))?{h:D[1],s:D[2],v:D[3]}:(D=Te.hsva.exec(l))?{h:D[1],s:D[2],v:D[3],a:D[4]}:(D=Te.hex8.exec(l))?{r:$(D[1]),g:$(D[2]),b:$(D[3]),a:Re(D[4]),format:c?"name":"hex8"}:(D=Te.hex6.exec(l))?{r:$(D[1]),g:$(D[2]),b:$(D[3]),format:c?"name":"hex"}:(D=Te.hex4.exec(l))?{r:$(D[1]+""+D[1]),g:$(D[2]+""+D[2]),b:$(D[3]+""+D[3]),a:Re(D[4]+""+D[4]),format:c?"name":"hex8"}:(D=Te.hex3.exec(l))?{r:$(D[1]+""+D[1]),g:$(D[2]+""+D[2]),b:$(D[3]+""+D[3]),format:c?"name":"hex"}:!1}function K(l){var c,D;return l=l||{level:"AA",size:"small"},c=(l.level||"AA").toUpperCase(),D=(l.size||"small").toLowerCase(),c!=="AA"&&c!=="AAA"&&(c="AA"),D!=="small"&&D!=="large"&&(D="small"),{level:c,size:D}}tt.exports?tt.exports=R:!(ce=function(){return R}.call(Ke,le,Ke,tt),ce!==void 0&&(tt.exports=ce))})(Math)},bT9E:function(tt,Ke,le){"use strict";le.d(Ke,"a",function(){return J});var ce=le("VTBJ");function J(O,Z){var F=Object(ce.a)({},O);return Array.isArray(Z)&&Z.forEach(function(k){delete F[k]}),F}},c5Ni:function(tt,Ke,le){},cLbz:function(tt,Ke,le){tt.exports=le.p+"static/add_icon_light.3e1b4fba.svg"},dejd:function(tt,Ke,le){},dmUQ:function(tt,Ke,le){"use strict";var ce=le("Ff2n"),J=le("rePB"),O=le("1OyB"),Z=le("vuIU"),F=le("Ji7U"),k=le("md7G"),G=le("foSv"),H=le("q1tI"),B=le.n(H),R=le("TSYQ"),x=le.n(R),w=le("4IlW");function P(u,a){var b=Object.keys(u);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(u);a&&(v=v.filter(function(S){return Object.getOwnPropertyDescriptor(u,S).enumerable})),b.push.apply(b,v)}return b}function L(u){for(var a=1;a<arguments.length;a++){var b=arguments[a]!=null?arguments[a]:{};a%2?P(Object(b),!0).forEach(function(v){Object(J.a)(u,v,b[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(b)):P(Object(b)).forEach(function(v){Object.defineProperty(u,v,Object.getOwnPropertyDescriptor(b,v))})}return u}function A(u){var a=_();return function(){var v=Object(G.a)(u),S;if(a){var I=Object(G.a)(this).constructor;S=Reflect.construct(v,arguments,I)}else S=v.apply(this,arguments);return Object(k.a)(this,S)}}function _(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(u){return!1}}function h(){}function o(u){u.preventDefault()}var s=function(a){return a.replace(/[^\w.-]+/g,"")},d=200,T=600,y=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,m=function(a){return a!=null},f=function(a,b){return b===a||typeof b=="number"&&typeof a=="number"&&isNaN(b)&&isNaN(a)},E=function(u){Object(F.a)(b,u);var a=A(b);function b(v){var S;Object(O.a)(this,b),S=a.call(this,v),S.onKeyDown=function(z){var V=S.props,M=V.onKeyDown,N=V.onPressEnter;if(z.keyCode===w.a.UP){var $=S.getRatio(z);S.up(z,$,null),S.stop()}else if(z.keyCode===w.a.DOWN){var ie=S.getRatio(z);S.down(z,ie,null),S.stop()}else z.keyCode===w.a.ENTER&&N&&N(z);if(S.recordCursorPosition(),S.lastKeyCode=z.keyCode,M){for(var he=arguments.length,me=new Array(he>1?he-1:0),ke=1;ke<he;ke++)me[ke-1]=arguments[ke];M.apply(void 0,[z].concat(me))}},S.onKeyUp=function(z){var V=S.props.onKeyUp;if(S.stop(),S.recordCursorPosition(),V){for(var M=arguments.length,N=new Array(M>1?M-1:0),$=1;$<M;$++)N[$-1]=arguments[$];V.apply(void 0,[z].concat(N))}},S.onChange=function(z){var V=S.props.onChange;S.state.focused&&(S.inputting=!0),S.rawInput=S.props.parser(S.getValueFromEvent(z)),S.setState({inputValue:S.rawInput}),V(S.toNumber(S.rawInput))},S.onMouseUp=function(){var z=S.props.onMouseUp;S.recordCursorPosition(),z&&z.apply(void 0,arguments)},S.onFocus=function(){var z;S.setState({focused:!0}),(z=S.props).onFocus.apply(z,arguments)},S.onBlur=function(){var z=S.props.onBlur;S.inputting=!1,S.setState({focused:!1});var V=S.getCurrentValidValue(S.state.inputValue),M=S.setValue(V,h);if(z){var N=S.input.value,$=S.getInputDisplayValue({focus:!1,value:M});S.input.value=$&&Number($),z.apply(void 0,arguments),S.input.value=N}},S.getRatio=function(z){var V=1;return z.metaKey||z.ctrlKey?V=.1:z.shiftKey&&(V=10),V},S.getFullNum=function(z){return isNaN(z)?z:/e/i.test(String(z))?Number(z).toFixed(18).replace(/\.?0+$/,""):z},S.getPrecision=function(z){if(m(S.props.precision))return S.props.precision;var V=String(z);if(V.indexOf("e-")>=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var M=0;return V.indexOf(".")>=0&&(M=V.length-V.indexOf(".")-1),M},S.getInputDisplayValue=function(z){var V=z||S.state,M=V.focused,N=V.inputValue,$=V.value,ie;M?ie=N:ie=S.toPrecisionAsStep($),ie==null&&(ie="");var he=S.formatWrapper(ie);return m(S.props.decimalSeparator)&&(he=he.toString().replace(".",S.props.decimalSeparator)),he},S.recordCursorPosition=function(){try{S.cursorStart=S.input.selectionStart,S.cursorEnd=S.input.selectionEnd,S.currentValue=S.input.value,S.cursorBefore=S.input.value.substring(0,S.cursorStart),S.cursorAfter=S.input.value.substring(S.cursorEnd)}catch(z){}},S.restoreByAfter=function(z){if(z===void 0)return!1;var V=S.input.value,M=V.lastIndexOf(z);if(M===-1)return!1;var N=S.cursorBefore.length;return S.lastKeyCode===w.a.DELETE&&S.cursorBefore.charAt(N-1)===z[0]?(S.fixCaret(N,N),!0):M+z.length===V.length?(S.fixCaret(M,M),!0):!1},S.partRestoreByAfter=function(z){return z===void 0?!1:Array.prototype.some.call(z,function(V,M){var N=z.substring(M);return S.restoreByAfter(N)})},S.isNotCompleteNumber=function(z){return isNaN(z)||z===""||z===null||z&&z.toString().indexOf(".")===z.toString().length-1},S.stop=function(){S.autoStepTimer&&clearTimeout(S.autoStepTimer)},S.down=function(z,V,M){S.pressingUpOrDown=!0,S.step("down",z,V,M)},S.up=function(z,V,M){S.pressingUpOrDown=!0,S.step("up",z,V,M)},S.saveInput=function(z){S.input=z};var I=v.value;I===void 0&&(I=v.defaultValue),S.state={focused:v.autoFocus};var j=S.getValidValue(S.toNumber(I));return S.state=L(L({},S.state),{},{inputValue:S.toPrecisionAsStep(j),value:j}),S}return Object(Z.a)(b,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(S){var I=this.props,j=I.value,z=I.onChange,V=I.max,M=I.min,N=this.state.focused;if(S){if(!f(S.value,j)||!f(S.max,V)||!f(S.min,M)){var $=N?j:this.getValidValue(j),ie;this.pressingUpOrDown?ie=$:this.inputting?ie=this.rawInput:ie=this.toPrecisionAsStep($),this.setState({value:$,inputValue:ie})}var he="value"in this.props?j:this.state.value;"max"in this.props&&S.max!==V&&typeof he=="number"&&he>V&&z&&z(V),"min"in this.props&&S.min!==M&&typeof he=="number"&&he<M&&z&&z(M)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var me=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===w.a.BACKSPACE?me=this.cursorStart-1:this.lastKeyCode===w.a.DELETE&&(me=this.cursorStart):me=this.input.value.length,this.fixCaret(me,me)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case w.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case w.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(ke){}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(S){var I=S;return I===""?I="":this.isNotCompleteNumber(parseFloat(I))?I=this.state.value:I=this.getValidValue(I),this.toNumber(I)}},{key:"getValueFromEvent",value:function(S){var I=S.target.value.trim().replace(/。/g,".");return m(this.props.decimalSeparator)&&(I=I.replace(this.props.decimalSeparator,".")),I}},{key:"getValidValue",value:function(S){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,z=parseFloat(S);return isNaN(z)?S:(z<I&&(z=I),z>j&&(z=j),z)}},{key:"setValue",value:function(S,I){var j=this.props.precision,z=this.isNotCompleteNumber(parseFloat(S))?null:parseFloat(S),V=this.state.value,M=V===void 0?null:V,N=this.state.inputValue,$=N===void 0?null:N,ie=typeof z=="number"?z.toFixed(j):"".concat(z),he=z!==M||ie!=="".concat($);return"value"in this.props?($=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:$},I)):this.setState({value:z,inputValue:this.toPrecisionAsStep(S)},I),he&&this.props.onChange(z),z}},{key:"getMaxPrecision",value:function(S){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,j=this.props,z=j.precision,V=j.step;if(m(z))return z;var M=this.getPrecision(I),N=this.getPrecision(V),$=this.getPrecision(S);return S?Math.max($,M+N):M+N}},{key:"getPrecisionFactor",value:function(S){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,j=this.getMaxPrecision(S,I);return Math.pow(10,j)}},{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(S){return this.props.formatter?this.props.formatter(S):S}},{key:"toPrecisionAsStep",value:function(S){if(this.isNotCompleteNumber(S)||S==="")return S;var I=Math.abs(this.getMaxPrecision(S));return isNaN(I)?S.toString():Number(S).toFixed(I)}},{key:"toNumber",value:function(S){var I=this.props.precision,j=this.state.focused,z=S&&S.length>16&&j;return this.isNotCompleteNumber(S)||z?S:m(I)?Math.round(S*Math.pow(10,I))/Math.pow(10,I):Number(S)}},{key:"upStep",value:function(S,I){var j=this.props.step,z=this.getPrecisionFactor(S,I),V=Math.abs(this.getMaxPrecision(S,I)),M=((z*S+z*j*I)/z).toFixed(V);return this.toNumber(M)}},{key:"downStep",value:function(S,I){var j=this.props.step,z=this.getPrecisionFactor(S,I),V=Math.abs(this.getMaxPrecision(S,I)),M=((z*S-z*j*I)/z).toFixed(V);return this.toNumber(M)}},{key:"step",value:function(S,I){var j=this,z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),I&&(I.persist(),I.preventDefault());var M=this.props;if(M.disabled)return;var N=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(N))return;var $=this["".concat(S,"Step")](N,z),ie=$>M.max||$<M.min;if($>M.max?$=M.max:$<M.min&&($=M.min),this.setValue($,null),this.setState({focused:!0},function(){j.pressingUpOrDown=!1}),ie)return;this.autoStepTimer=setTimeout(function(){j[S](I,z,!0)},V?d:T)}},{key:"fixCaret",value:function(S,I){if(S===void 0||I===void 0||!this.input||!this.input.value)return;try{var j=this.input.selectionStart,z=this.input.selectionEnd;(S!==j||I!==z)&&this.input.setSelectionRange(S,I)}catch(V){}}},{key:"render",value:function(){var S,I=this.props,j=I.prefixCls,z=I.disabled,V=I.readOnly,M=I.useTouch,N=I.autoComplete,$=I.upHandler,ie=I.downHandler,he=I.className,me=I.max,ke=I.min,Se=I.style,Re=I.title,Te=I.onMouseEnter,_e=I.onMouseLeave,ye=I.onMouseOver,K=I.onMouseOut,l=I.required,c=I.onClick,D=I.tabIndex,X=I.type,U=I.placeholder,oe=I.id,be=I.inputMode,xe=I.pattern,Pe=I.step,De=I.maxLength,Oe=I.autoFocus,Ie=I.name,He=I.onPaste,Ve=I.onInput,Je=Object(ce.a)(I,["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"]),Xe=this.state,We=Xe.value,Qe=Xe.focused,et=x()(j,(S={},Object(J.a)(S,he,!!he),Object(J.a)(S,"".concat(j,"-disabled"),z),Object(J.a)(S,"".concat(j,"-focused"),Qe),S)),Ae={};Object.keys(Je).forEach(function(fe){(fe.substr(0,5)==="data-"||fe.substr(0,5)==="aria-"||fe==="role")&&(Ae[fe]=Je[fe])});var ut=!V&&!z,it=this.getInputDisplayValue(null),se=(We||We===0)&&(isNaN(We)||Number(We)>=me),q=(We||We===0)&&(isNaN(We)||Number(We)<=ke),ee=se||z||V,ae=q||z||V,ue=x()("".concat(j,"-handler"),"".concat(j,"-handler-up"),Object(J.a)({},"".concat(j,"-handler-up-disabled"),ee)),te=x()("".concat(j,"-handler"),"".concat(j,"-handler-down"),Object(J.a)({},"".concat(j,"-handler-down-disabled"),ae)),ne=M?{onTouchStart:ee?h:this.up,onTouchEnd:this.stop}:{onMouseDown:ee?h:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},de=M?{onTouchStart:ae?h:this.down,onTouchEnd:this.stop}:{onMouseDown:ae?h:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return B.a.createElement("div",{className:et,style:Se,title:Re,onMouseEnter:Te,onMouseLeave:_e,onMouseOver:ye,onMouseOut:K,onFocus:function(){return null},onBlur:function(){return null}},B.a.createElement("div",{className:"".concat(j,"-handler-wrap")},B.a.createElement("span",Object.assign({unselectable:"on"},ne,{role:"button","aria-label":"Increase Value","aria-disabled":ee,className:ue}),$||B.a.createElement("span",{unselectable:"on",className:"".concat(j,"-handler-up-inner"),onClick:o})),B.a.createElement("span",Object.assign({unselectable:"on"},de,{role:"button","aria-label":"Decrease Value","aria-disabled":ae,className:te}),ie||B.a.createElement("span",{unselectable:"on",className:"".concat(j,"-handler-down-inner"),onClick:o}))),B.a.createElement("div",{className:"".concat(j,"-input-wrap")},B.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":ke,"aria-valuemax":me,"aria-valuenow":We,required:l,type:X,placeholder:U,onPaste:He,onClick:c,onMouseUp:this.onMouseUp,className:"".concat(j,"-input"),tabIndex:D,autoComplete:N,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:ut?this.onKeyDown:h,onKeyUp:ut?this.onKeyUp:h,autoFocus:Oe,maxLength:De,readOnly:V,disabled:z,max:me,min:ke,step:Pe,name:Ie,title:Re,id:oe,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(it),pattern:xe,inputMode:be,onInput:Ve},Ae))))}}]),b}(B.a.Component);E.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:y,min:-y,step:1,style:{},onChange:h,onKeyDown:h,onPressEnter:h,onFocus:h,onBlur:h,parser:s,required:!1,autoComplete:"off"};var p=E,g=Ke.a=p},gpuL:function(tt,Ke,le){tt.exports={shiyan_modal:"shiyan_modal___2Z3Hj",add_pilotPro_item:"add_pilotPro_item___3Op9Y",pilot_name:"pilot_name___1HSSk",pilot_url:"pilot_url___2tlR1",title:"title___j5tUH",add_and_del:"add_and_del___J3fcE",record_count:"record_count___r_E7k"}},h78n:function(tt,Ke,le){"use strict";le.d(Ke,"a",function(){return S});var ce=le("q1tI"),J=le.n(ce),O=le("TSYQ"),Z=le.n(O),F={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},k=function(z){var V=z.map(function(){return Object(ce.useRef)()}),M=Object(ce.useRef)();return Object(ce.useEffect)(function(){var N=Date.now(),$=!1;Object.keys(V).forEach(function(ie){var he=V[ie].current;if(!he)return;$=!0;var me=he.style;me.transitionDuration=".3s, .3s, .3s, .06s",M.current&&N-M.current<100&&(me.transitionDuration="0s, 0s")}),$&&(M.current=Date.now())}),[V]};function G(){return G=Object.assign||function(j){for(var z=1;z<arguments.length;z++){var V=arguments[z];for(var M in V)Object.prototype.hasOwnProperty.call(V,M)&&(j[M]=V[M])}return j},G.apply(this,arguments)}function H(j,z){return P(j)||w(j,z)||R(j,z)||B()}function B(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function R(j,z){if(!j)return;if(typeof j=="string")return x(j,z);var V=Object.prototype.toString.call(j).slice(8,-1);if(V==="Object"&&j.constructor&&(V=j.constructor.name),V==="Map"||V==="Set")return Array.from(j);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return x(j,z)}function x(j,z){(z==null||z>j.length)&&(z=j.length);for(var V=0,M=new Array(z);V<z;V++)M[V]=j[V];return M}function w(j,z){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(j)))return;var V=[],M=!0,N=!1,$=void 0;try{for(var ie=j[Symbol.iterator](),he;!(M=(he=ie.next()).done)&&!(V.push(he.value),z&&V.length===z);M=!0);}catch(me){N=!0,$=me}finally{try{!M&&ie.return!=null&&ie.return()}finally{if(N)throw $}}return V}function P(j){if(Array.isArray(j))return j}function L(j,z){if(j==null)return{};var V=A(j,z),M,N;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(j);for(N=0;N<$.length;N++){if(M=$[N],z.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(j,M))continue;V[M]=j[M]}}return V}function A(j,z){if(j==null)return{};var V={},M=Object.keys(j),N,$;for($=0;$<M.length;$++){if(N=M[$],z.indexOf(N)>=0)continue;V[N]=j[N]}return V}var _=function(z){var V=z.className,M=z.percent,N=z.prefixCls,$=z.strokeColor,ie=z.strokeLinecap,he=z.strokeWidth,me=z.style,ke=z.trailColor,Se=z.trailWidth,Re=z.transition,Te=L(z,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Te.gapPosition;var _e=Array.isArray(M)?M:[M],ye=Array.isArray($)?$:[$],K=k(_e),l=H(K,1),c=l[0],D=he/2,X=100-he/2,U="M ".concat(ie==="round"?D:0,",").concat(D,`
L `).concat(ie==="round"?X:100,",").concat(D),oe="0 0 100 ".concat(he),be=0;return J.a.createElement("svg",G({className:Z()("".concat(N,"-line"),V),viewBox:oe,preserveAspectRatio:"none",style:me},Te),J.a.createElement("path",{className:"".concat(N,"-line-trail"),d:U,strokeLinecap:ie,stroke:ke,strokeWidth:Se||he,fillOpacity:"0"}),_e.map(function(xe,Pe){var De={strokeDasharray:"".concat(xe,"px, 100px"),strokeDashoffset:"-".concat(be,"px"),transition:Re||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Oe=ye[Pe]||ye[ye.length-1];return be+=xe,J.a.createElement("path",{key:Pe,className:"".concat(N,"-line-path"),d:U,strokeLinecap:ie,stroke:Oe,strokeWidth:he,fillOpacity:"0",ref:c[Pe],style:De})}))};_.defaultProps=F;var h=_;function o(){return o=Object.assign||function(j){for(var z=1;z<arguments.length;z++){var V=arguments[z];for(var M in V)Object.prototype.hasOwnProperty.call(V,M)&&(j[M]=V[M])}return j},o.apply(this,arguments)}function s(j,z){return f(j)||m(j,z)||T(j,z)||d()}function d(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function T(j,z){if(!j)return;if(typeof j=="string")return y(j,z);var V=Object.prototype.toString.call(j).slice(8,-1);if(V==="Object"&&j.constructor&&(V=j.constructor.name),V==="Map"||V==="Set")return Array.from(j);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return y(j,z)}function y(j,z){(z==null||z>j.length)&&(z=j.length);for(var V=0,M=new Array(z);V<z;V++)M[V]=j[V];return M}function m(j,z){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(j)))return;var V=[],M=!0,N=!1,$=void 0;try{for(var ie=j[Symbol.iterator](),he;!(M=(he=ie.next()).done)&&!(V.push(he.value),z&&V.length===z);M=!0);}catch(me){N=!0,$=me}finally{try{!M&&ie.return!=null&&ie.return()}finally{if(N)throw $}}return V}function f(j){if(Array.isArray(j))return j}function E(j,z){if(j==null)return{};var V=p(j,z),M,N;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(j);for(N=0;N<$.length;N++){if(M=$[N],z.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(j,M))continue;V[M]=j[M]}}return V}function p(j,z){if(j==null)return{};var V={},M=Object.keys(j),N,$;for($=0;$<M.length;$++){if(N=M[$],z.indexOf(N)>=0)continue;V[N]=j[N]}return V}var g=0;function u(j){return+j.replace("%","")}function a(j){return Array.isArray(j)?j:[j]}function b(j,z,V,M){var N=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,$=arguments.length>5?arguments[5]:void 0,ie=50-M/2,he=0,me=-ie,ke=0,Se=-2*ie;switch($){case"left":he=-ie,me=0,ke=2*ie,Se=0;break;case"right":he=ie,me=0,ke=-2*ie,Se=0;break;case"bottom":me=ie,Se=2*ie;break;default:}var Re="M 50,50 m ".concat(he,",").concat(me,`
a `).concat(ie,",").concat(ie," 0 1 1 ").concat(ke,",").concat(-Se,`
a `).concat(ie,",").concat(ie," 0 1 1 ").concat(-ke,",").concat(Se),Te=Math.PI*2*ie,_e={stroke:V,strokeDasharray:"".concat(z/100*(Te-N),"px ").concat(Te,"px"),strokeDashoffset:"-".concat(N/2+j/100*(Te-N),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Re,pathStyle:_e}}var v=function(z){var V=z.prefixCls,M=z.strokeWidth,N=z.trailWidth,$=z.gapDegree,ie=z.gapPosition,he=z.trailColor,me=z.strokeLinecap,ke=z.style,Se=z.className,Re=z.strokeColor,Te=z.percent,_e=E(z,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ye=Object(ce.useMemo)(function(){return g+=1,g},[]),K=b(0,100,he,M,$,ie),l=K.pathString,c=K.pathStyle,D=a(Te),X=a(Re),U=X.find(function(De){return Object.prototype.toString.call(De)==="[object Object]"}),oe=k(D),be=s(oe,1),xe=be[0],Pe=function(){var Oe=0;return D.map(function(Ie,He){var Ve=X[He]||X[X.length-1],Je=Object.prototype.toString.call(Ve)==="[object Object]"?"url(#".concat(V,"-gradient-").concat(ye,")"):"",Xe=b(Oe,Ie,Ve,M,$,ie);return Oe+=Ie,J.a.createElement("path",{key:He,className:"".concat(V,"-circle-path"),d:Xe.pathString,stroke:Je,strokeLinecap:me,strokeWidth:M,opacity:Ie===0?0:1,fillOpacity:"0",style:Xe.pathStyle,ref:xe[He]})})};return J.a.createElement("svg",o({className:Z()("".concat(V,"-circle"),Se),viewBox:"0 0 100 100",style:ke},_e),U&&J.a.createElement("defs",null,J.a.createElement("linearGradient",{id:"".concat(V,"-gradient-").concat(ye),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(U).sort(function(De,Oe){return u(De)-u(Oe)}).map(function(De,Oe){return J.a.createElement("stop",{key:Oe,offset:De,stopColor:U[De]})}))),J.a.createElement("path",{className:"".concat(V,"-circle-trail"),d:l,stroke:he,strokeLinecap:me,strokeWidth:N||M,fillOpacity:"0",style:c}),Pe().reverse())};v.defaultProps=F;var S=v,I={Line:h,Circle:S}},kSUc:function(tt,Ke,le){},lZu9:function(tt,Ke,le){(function(ce){ce(le("VrN/"),le("1eCo"),le("8EBN"))})(function(ce){"use strict";ce.defineMode("markdown",function(J,O){var Z=ce.getMode(J,"text/html"),F=Z.name=="null";function k(M){if(ce.findModeByName){var N=ce.findModeByName(M);N&&(M=N.mime||N.mimes[0])}var $=ce.getMode(J,M);return $.name=="null"?null:$}O.highlightFormatting===void 0&&(O.highlightFormatting=!1),O.maxBlockquoteDepth===void 0&&(O.maxBlockquoteDepth=0),O.taskLists===void 0&&(O.taskLists=!1),O.strikethrough===void 0&&(O.strikethrough=!1),O.emoji===void 0&&(O.emoji=!1),O.fencedCodeBlockHighlighting===void 0&&(O.fencedCodeBlockHighlighting=!0),O.fencedCodeBlockDefaultMode===void 0&&(O.fencedCodeBlockDefaultMode="text/plain"),O.xml===void 0&&(O.xml=!0),O.tokenTypeOverrides===void 0&&(O.tokenTypeOverrides={});var G={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 H in G)G.hasOwnProperty(H)&&O.tokenTypeOverrides[H]&&(G[H]=O.tokenTypeOverrides[H]);var B=/^([*\-_])(?:\s*\1){2,}\s*$/,R=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,x=/^\[(x| )\](?=\s)/i,w=O.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,P=/^ {0,3}(?:\={1,}|-{2,})\s*$/,L=/^[^#!\[\]*_\\<>` "'(~:]+/,A=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,_=/^\s*\[[^\]]+?\]:.*$/,h=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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,N,$){return N.f=N.inline=$,$(M,N)}function d(M,N,$){return N.f=N.block=$,$(M,N)}function T(M){return!M||!/\S/.test(M.string)}function y(M){if(M.linkTitle=!1,M.linkHref=!1,M.linkText=!1,M.em=!1,M.strong=!1,M.strikethrough=!1,M.quote=0,M.indentedCode=!1,M.f==f){var N=F;if(!N){var $=ce.innerMode(Z,M.htmlState);N=$.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText}N&&(M.f=u,M.block=m,M.htmlState=null)}return M.trailingSpace=0,M.trailingSpaceNewLine=!1,M.prevLine=M.thisLine,M.thisLine={stream:null},null}function m(M,N){var $=M.column()===N.indentation,ie=T(N.prevLine.stream),he=N.indentedCode,me=N.prevLine.hr,ke=N.list!==!1,Se=(N.listStack[N.listStack.length-1]||0)+3;N.indentedCode=!1;var Re=N.indentation;if(N.indentationDiff===null&&(N.indentationDiff=N.indentation,ke)){for(N.list=null;Re<N.listStack[N.listStack.length-1];)N.listStack.pop(),N.listStack.length?N.indentation=N.listStack[N.listStack.length-1]:N.list=!1;N.list!==!1&&(N.indentationDiff=Re-N.listStack[N.listStack.length-1])}var Te=!ie&&!me&&!N.prevLine.header&&(!ke||!he)&&!N.prevLine.fencedCodeEnd,_e=(N.list===!1||me||ie)&&N.indentation<=Se&&M.match(B),ye=null;if(N.indentationDiff>=4&&(he||N.prevLine.fencedCodeEnd||N.prevLine.header||ie))return M.skipToEnd(),N.indentedCode=!0,G.code;if(M.eatSpace())return null;if($&&N.indentation<=Se&&(ye=M.match(w))&&ye[1].length<=6)return N.quote=0,N.header=ye[1].length,N.thisLine.header=!0,O.highlightFormatting&&(N.formatting="header"),N.f=N.inline,p(N);if(N.indentation<=Se&&M.eat(">"))return N.quote=$?1:N.quote+1,O.highlightFormatting&&(N.formatting="quote"),M.eatSpace(),p(N);if(!_e&&!N.setext&&$&&N.indentation<=Se&&(ye=M.match(R))){var K=ye[1]?"ol":"ul";return N.indentation=Re+M.current().length,N.list=!0,N.quote=0,N.listStack.push(N.indentation),N.em=!1,N.strong=!1,N.code=!1,N.strikethrough=!1,O.taskLists&&M.match(x,!1)&&(N.taskList=!0),N.f=N.inline,O.highlightFormatting&&(N.formatting=["list","list-"+K]),p(N)}else{if($&&N.indentation<=Se&&(ye=M.match(A,!0)))return N.quote=0,N.fencedEndRE=new RegExp(ye[1]+"+ *$"),N.localMode=O.fencedCodeBlockHighlighting&&k(ye[2]||O.fencedCodeBlockDefaultMode),N.localMode&&(N.localState=ce.startState(N.localMode)),N.f=N.block=E,O.highlightFormatting&&(N.formatting="code-block"),N.code=-1,p(N);if(N.setext||(!Te||!ke)&&!N.quote&&N.list===!1&&!N.code&&!_e&&!_.test(M.string)&&(ye=M.lookAhead(1))&&(ye=ye.match(P)))return N.setext?(N.header=N.setext,N.setext=0,M.skipToEnd(),O.highlightFormatting&&(N.formatting="header")):(N.header=ye[0].charAt(0)=="="?1:2,N.setext=N.header),N.thisLine.header=!0,N.f=N.inline,p(N);if(_e)return M.skipToEnd(),N.hr=!0,N.thisLine.hr=!0,G.hr;if(M.peek()==="[")return s(M,N,I)}return s(M,N,N.inline)}function f(M,N){var $=Z.token(M,N.htmlState);if(!F){var ie=ce.innerMode(Z,N.htmlState);(ie.mode.name=="xml"&&ie.state.tagStart===null&&!ie.state.context&&ie.state.tokenize.isInText||N.md_inside&&M.current().indexOf(">")>-1)&&(N.f=u,N.block=m,N.htmlState=null)}return $}function E(M,N){var $=N.listStack[N.listStack.length-1]||0,ie=N.indentation<$,he=$+3;if(N.fencedEndRE&&N.indentation<=he&&(ie||M.match(N.fencedEndRE))){O.highlightFormatting&&(N.formatting="code-block");var me;return ie||(me=p(N)),N.localMode=N.localState=null,N.block=m,N.f=u,N.fencedEndRE=null,N.code=0,N.thisLine.fencedCodeEnd=!0,ie?d(M,N,N.block):me}else return N.localMode?N.localMode.token(M,N.localState):(M.skipToEnd(),G.code)}function p(M){var N=[];if(M.formatting){N.push(G.formatting),typeof M.formatting=="string"&&(M.formatting=[M.formatting]);for(var $=0;$<M.formatting.length;$++)N.push(G.formatting+"-"+M.formatting[$]),M.formatting[$]==="header"&&N.push(G.formatting+"-"+M.formatting[$]+"-"+M.header),M.formatting[$]==="quote"&&(!O.maxBlockquoteDepth||O.maxBlockquoteDepth>=M.quote?N.push(G.formatting+"-"+M.formatting[$]+"-"+M.quote):N.push("error"))}if(M.taskOpen)return N.push("meta"),N.length?N.join(" "):null;if(M.taskClosed)return N.push("property"),N.length?N.join(" "):null;if(M.linkHref?N.push(G.linkHref,"url"):(M.strong&&N.push(G.strong),M.em&&N.push(G.em),M.strikethrough&&N.push(G.strikethrough),M.emoji&&N.push(G.emoji),M.linkText&&N.push(G.linkText),M.code&&N.push(G.code),M.image&&N.push(G.image),M.imageAltText&&N.push(G.imageAltText,"link"),M.imageMarker&&N.push(G.imageMarker)),M.header&&N.push(G.header,G.header+"-"+M.header),M.quote&&(N.push(G.quote),!O.maxBlockquoteDepth||O.maxBlockquoteDepth>=M.quote?N.push(G.quote+"-"+M.quote):N.push(G.quote+"-"+O.maxBlockquoteDepth)),M.list!==!1){var ie=(M.listStack.length-1)%3;ie?ie===1?N.push(G.list2):N.push(G.list3):N.push(G.list1)}return M.trailingSpaceNewLine?N.push("trailing-space-new-line"):M.trailingSpace&&N.push("trailing-space-"+(M.trailingSpace%2?"a":"b")),N.length?N.join(" "):null}function g(M,N){return M.match(L,!0)?p(N):void 0}function u(M,N){var $=N.text(M,N);if(typeof $!="undefined")return $;if(N.list)return N.list=null,p(N);if(N.taskList){var ie=M.match(x,!0)[1]===" ";return ie?N.taskOpen=!0:N.taskClosed=!0,O.highlightFormatting&&(N.formatting="task"),N.taskList=!1,p(N)}if(N.taskOpen=!1,N.taskClosed=!1,N.header&&M.match(/^#+$/,!0))return O.highlightFormatting&&(N.formatting="header"),p(N);var he=M.next();if(N.linkTitle){N.linkTitle=!1;var me=he;he==="("&&(me=")"),me=(me+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var ke="^\\s*(?:[^"+me+"\\\\]+|\\\\\\\\|\\\\.)"+me;if(M.match(new RegExp(ke),!0))return G.linkHref}if(he==="`"){var Se=N.formatting;O.highlightFormatting&&(N.formatting="code"),M.eatWhile("`");var Re=M.current().length;if(N.code==0&&(!N.quote||Re==1))return N.code=Re,p(N);if(Re==N.code){var Te=p(N);return N.code=0,Te}else return N.formatting=Se,p(N)}else if(N.code)return p(N);if(he==="\\"&&(M.next(),O.highlightFormatting)){var _e=p(N),ye=G.formatting+"-escape";return _e?_e+" "+ye:ye}if(he==="!"&&M.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return N.imageMarker=!0,N.image=!0,O.highlightFormatting&&(N.formatting="image"),p(N);if(he==="["&&N.imageMarker&&M.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return N.imageMarker=!1,N.imageAltText=!0,O.highlightFormatting&&(N.formatting="image"),p(N);if(he==="]"&&N.imageAltText){O.highlightFormatting&&(N.formatting="image");var _e=p(N);return N.imageAltText=!1,N.image=!1,N.inline=N.f=b,_e}if(he==="["&&!N.image)return N.linkText&&M.match(/^.*?\]/)||(N.linkText=!0,O.highlightFormatting&&(N.formatting="link")),p(N);if(he==="]"&&N.linkText){O.highlightFormatting&&(N.formatting="link");var _e=p(N);return N.linkText=!1,N.inline=N.f=M.match(/\(.*?\)| ?\[.*?\]/,!1)?b:u,_e}if(he==="<"&&M.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=a,O.highlightFormatting&&(N.formatting="link");var _e=p(N);return _e?_e+=" ":_e="",_e+G.linkInline}if(he==="<"&&M.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=a,O.highlightFormatting&&(N.formatting="link");var _e=p(N);return _e?_e+=" ":_e="",_e+G.linkEmail}if(O.xml&&he==="<"&&M.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var K=M.string.indexOf(">",M.pos);if(K!=-1){var l=M.string.substring(M.start,K);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(l)&&(N.md_inside=!0)}return M.backUp(1),N.htmlState=ce.startState(Z),d(M,N,f)}if(O.xml&&he==="<"&&M.match(/^\/\w*?>/))return N.md_inside=!1,"tag";if(he==="*"||he==="_"){for(var c=1,D=M.pos==1?" ":M.string.charAt(M.pos-2);c<3&&M.eat(he);)c++;var X=M.peek()||" ",U=!/\s/.test(X)&&(!h.test(X)||/\s/.test(D)||h.test(D)),oe=!/\s/.test(D)&&(!h.test(D)||/\s/.test(X)||h.test(X)),be=null,xe=null;if(c%2&&(!N.em&&U&&(he==="*"||!oe||h.test(D))?be=!0:N.em==he&&oe&&(he==="*"||!U||h.test(X))&&(be=!1)),c>1&&(!N.strong&&U&&(he==="*"||!oe||h.test(D))?xe=!0:N.strong==he&&oe&&(he==="*"||!U||h.test(X))&&(xe=!1)),xe!=null||be!=null){O.highlightFormatting&&(N.formatting=be==null?"strong":xe==null?"em":"strong em"),be===!0&&(N.em=he),xe===!0&&(N.strong=he);var Te=p(N);return be===!1&&(N.em=!1),xe===!1&&(N.strong=!1),Te}}else if(he===" "&&(M.eat("*")||M.eat("_"))){if(M.peek()===" ")return p(N);M.backUp(1)}if(O.strikethrough){if(he==="~"&&M.eatWhile(he)){if(N.strikethrough){O.highlightFormatting&&(N.formatting="strikethrough");var Te=p(N);return N.strikethrough=!1,Te}else if(M.match(/^[^\s]/,!1))return N.strikethrough=!0,O.highlightFormatting&&(N.formatting="strikethrough"),p(N)}else if(he===" "&&M.match(/^~~/,!0)){if(M.peek()===" ")return p(N);M.backUp(2)}}if(O.emoji&&he===":"&&M.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){N.emoji=!0,O.highlightFormatting&&(N.formatting="emoji");var Pe=p(N);return N.emoji=!1,Pe}return he===" "&&(M.match(/^ +$/,!1)?N.trailingSpace++:N.trailingSpace&&(N.trailingSpaceNewLine=!0)),p(N)}function a(M,N){var $=M.next();if($===">"){N.f=N.inline=u,O.highlightFormatting&&(N.formatting="link");var ie=p(N);return ie?ie+=" ":ie="",ie+G.linkInline}return M.match(/^[^>]+/,!0),G.linkInline}function b(M,N){if(M.eatSpace())return null;var $=M.next();return $==="("||$==="["?(N.f=N.inline=S($==="("?")":"]"),O.highlightFormatting&&(N.formatting="link-string"),N.linkHref=!0,p(N)):"error"}var v={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function S(M){return function(N,$){var ie=N.next();if(ie===M){$.f=$.inline=u,O.highlightFormatting&&($.formatting="link-string");var he=p($);return $.linkHref=!1,he}return N.match(v[M]),$.linkHref=!0,p($)}}function I(M,N){return M.match(/^([^\]\\]|\\.)*\]:/,!1)?(N.f=j,M.next(),O.highlightFormatting&&(N.formatting="link"),N.linkText=!0,p(N)):s(M,N,u)}function j(M,N){if(M.match(/^\]:/,!0)){N.f=N.inline=z,O.highlightFormatting&&(N.formatting="link");var $=p(N);return N.linkText=!1,$}return M.match(/^([^\]\\]|\\.)+/,!0),G.linkText}function z(M,N){return M.eatSpace()?null:(M.match(/^[^\s]+/,!0),M.peek()===void 0?N.linkTitle=!0:M.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),N.f=N.inline=u,G.linkHref+" url")}var V={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:u,text:g,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(M){return{f:M.f,prevLine:M.prevLine,thisLine:M.thisLine,block:M.block,htmlState:M.htmlState&&ce.copyState(Z,M.htmlState),indentation:M.indentation,localMode:M.localMode,localState:M.localMode?ce.copyState(M.localMode,M.localState):null,inline:M.inline,text:M.text,formatting:!1,linkText:M.linkText,linkTitle:M.linkTitle,linkHref:M.linkHref,code:M.code,em:M.em,strong:M.strong,strikethrough:M.strikethrough,emoji:M.emoji,header:M.header,setext:M.setext,hr:M.hr,taskList:M.taskList,list:M.list,listStack:M.listStack.slice(0),quote:M.quote,indentedCode:M.indentedCode,trailingSpace:M.trailingSpace,trailingSpaceNewLine:M.trailingSpaceNewLine,md_inside:M.md_inside,fencedEndRE:M.fencedEndRE}},token:function(M,N){if(N.formatting=!1,M!=N.thisLine.stream){if(N.header=0,N.hr=!1,M.match(/^\s*$/,!0))return y(N),null;if(N.prevLine=N.thisLine,N.thisLine={stream:M},N.taskList=!1,N.trailingSpace=0,N.trailingSpaceNewLine=!1,!N.localState&&(N.f=N.block,N.f!=f)){var $=M.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(N.indentation=$,N.indentationDiff=null,$>0)return null}}return N.f(M,N)},innerMode:function(M){return M.block==f?{state:M.htmlState,mode:Z}:M.localState?{state:M.localState,mode:M.localMode}:{state:M,mode:V}},indent:function(M,N,$){return M.block==f&&Z.indent?Z.indent(M.htmlState,N,$):M.localState&&M.localMode.indent?M.localMode.indent(M.localState,N,$):ce.Pass},blankLine:y,getType:p,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),ce.defineMIME("text/markdown","markdown"),ce.defineMIME("text/x-markdown","markdown")})},osHv:function(tt,Ke,le){(function(ce){ce(le("VrN/"))})(function(ce){"use strict";var J=ce.Pos;function O(h,o){return h.line-o.line||h.ch-o.ch}var Z="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",F=Z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",k=new RegExp("<(/?)(["+Z+"]["+F+"]*)","g");function G(h,o,s,d){this.line=o,this.ch=s,this.cm=h,this.text=h.getLine(o),this.min=d?Math.max(d.from,h.firstLine()):h.firstLine(),this.max=d?Math.min(d.to-1,h.lastLine()):h.lastLine()}function H(h,o){var s=h.cm.getTokenTypeAt(J(h.line,o));return s&&/\btag\b/.test(s)}function B(h){return h.line>=h.max?void 0:(h.ch=0,h.text=h.cm.getLine(++h.line),!0)}function R(h){return h.line<=h.min?void 0:(h.text=h.cm.getLine(--h.line),h.ch=h.text.length,!0)}function x(h){for(;;){var o=h.text.indexOf(">",h.ch);if(o==-1){if(B(h))continue;return}if(!H(h,o+1)){h.ch=o+1;continue}var s=h.text.lastIndexOf("/",o),d=s>-1&&!/\S/.test(h.text.slice(s+1,o));return h.ch=o+1,d?"selfClose":"regular"}}function w(h){for(;;){var o=h.ch?h.text.lastIndexOf("<",h.ch-1):-1;if(o==-1){if(R(h))continue;return}if(!H(h,o+1)){h.ch=o;continue}k.lastIndex=o,h.ch=o;var s=k.exec(h.text);if(s&&s.index==o)return s}}function P(h){for(;;){k.lastIndex=h.ch;var o=k.exec(h.text);if(!o){if(B(h))continue;return}if(!H(h,o.index+1)){h.ch=o.index+1;continue}return h.ch=o.index+o[0].length,o}}function L(h){for(;;){var o=h.ch?h.text.lastIndexOf(">",h.ch-1):-1;if(o==-1){if(R(h))continue;return}if(!H(h,o+1)){h.ch=o;continue}var s=h.text.lastIndexOf("/",o),d=s>-1&&!/\S/.test(h.text.slice(s+1,o));return h.ch=o+1,d?"selfClose":"regular"}}function A(h,o){for(var s=[];;){var d=P(h),T,y=h.line,m=h.ch-(d?d[0].length:0);if(!d||!(T=x(h)))return;if(T=="selfClose")continue;if(d[1]){for(var f=s.length-1;f>=0;--f)if(s[f]==d[2]){s.length=f;break}if(f<0&&(!o||o==d[2]))return{tag:d[2],from:J(y,m),to:J(h.line,h.ch)}}else s.push(d[2])}}function _(h,o){for(var s=[];;){var d=L(h);if(!d)return;if(d=="selfClose"){w(h);continue}var T=h.line,y=h.ch,m=w(h);if(!m)return;if(m[1])s.push(m[2]);else{for(var f=s.length-1;f>=0;--f)if(s[f]==m[2]){s.length=f;break}if(f<0&&(!o||o==m[2]))return{tag:m[2],from:J(h.line,h.ch),to:J(T,y)}}}}ce.registerHelper("fold","xml",function(h,o){for(var s=new G(h,o.line,0);;){var d=P(s);if(!d||s.line!=o.line)return;var T=x(s);if(!T)return;if(!d[1]&&T!="selfClose"){var y=J(s.line,s.ch),m=A(s,d[2]);return m&&O(m.from,y)>0?{from:y,to:m.from}:null}}}),ce.findMatchingTag=function(h,o,s){var d=new G(h,o.line,o.ch,s);if(d.text.indexOf(">")==-1&&d.text.indexOf("<")==-1)return;var T=x(d),y=T&&J(d.line,d.ch),m=T&&w(d);if(!T||!m||O(d,o)>0)return;var f={from:J(d.line,d.ch),to:y,tag:m[2]};return T=="selfClose"?{open:f,close:null,at:"open"}:m[1]?{open:_(d,m[2]),close:f,at:"close"}:(d=new G(h,y.line,y.ch,s),{open:f,close:A(d,m[2]),at:"open"})},ce.findEnclosingTag=function(h,o,s,d){for(var T=new G(h,o.line,o.ch,s);;){var y=_(T,d);if(!y)break;var m=new G(h,o.line,o.ch,s),f=A(m,y.tag);if(f)return{open:y,close:f}}},ce.scanForClosingTag=function(h,o,s,d){var T=new G(h,o.line,o.ch,d?{from:0,to:d}:null);return A(T,s)}})},p5ED:function(tt,Ke,le){"use strict";var ce=le("+L6B"),J=le("2/Rp"),O=le("5Dmo"),Z=le("3S7+"),F=le("k1fw"),k=le("9og8"),G=le("tJVT"),H=le("WmNS"),B=le.n(H),R=le("q1tI"),x=le.n(R),w=le("vHTk"),P=le.n(w),L=le("yEEn"),A=le("ZW9T"),_=le("1vsH"),h=le("V0Rq"),o=le("m3rI");Ke.a=function(s){var d,T,y,m,f,E,p,g=s.editOffice,u=g===void 0?"view":g,a=s.data,b=s.theme,v=s.type,S=s.filename,I=s.monacoEditor,j=s.className,z=s.style,V=s.close,M=s.onClose,N=s.hasMask,$=s.disabledDownload,ie=Object(R.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),he=Object(G.a)(ie,2),me=he[0],ke=he[1],Se=Object(R.useState)(""),Re=Object(G.a)(Se,2),Te=Re[0],_e=Re[1],ye=Object(R.useState)(),K=Object(G.a)(ye,2),l=K[0],c=K[1],D=window.ENV==="build"?"/react/build":"",X=o.a.PROXY_SERVER||location.origin,U,oe=1024*1024,be=10*oe,xe=Object(R.useRef)();(d=a)!==null&&d!==void 0&&d.startsWith("/api")&&v!=="txt"&&(a=(o.a.API_SERVER||location.origin)+a),v==="office"&&(U=Object(_.T)(a).filesize,U>be&&(v="other")),S&&I&&(I.filename=S),Object(R.useEffect)(function(){var Ie,He,Ve=(Ie=document.cookie)===null||Ie===void 0||((He=Ie.replace(/\s/g,""))===null||He===void 0)?void 0:He.split(";");Ve==null||Ve.map(function(Je){var Xe=Je.split("=");Xe[0]==="_educoder_session"&&_e(Xe[1])})},[]),Object(R.useEffect)(function(){v==="office"&&Pe()},[v,a]);var Pe=function(){var Ie=Object(k.a)(B.a.mark(function He(){var Ve,Je,Xe;return B.a.wrap(function(Qe){for(;;)switch(Qe.prev=Qe.next){case 0:return console.log("data:",a),Ve=a,a.startsWith("http")||(Ve=location.origin+Ve),Je=new URL(Ve).pathname.split("/").pop(),Qe.next=6,Object(h.V)({attachment_id:Je});case 6:Xe=Qe.sent,c(Xe);case 8:case"end":return Qe.stop()}},He)}));return function(){return Ie.apply(this,arguments)}}(),De=function(){if(a.startsWith("http")||a.startsWith("blob:")){Oe();return}Object(_.z)(S||"educoder",a,S)},Oe=function(){Object(_.x)(S||"educoder",decodeURIComponent(a))};return x.a.createElement("div",{style:Object(F.a)({},z||{}),className:"".concat(N&&P.a.bgBlack," ").concat(v?P.a.wrp:"hide")},V&&x.a.createElement("div",{className:P.a.close,ref:xe},!$&&x.a.createElement(Z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return xe.current}},x.a.createElement("span",{onClick:Oe},x.a.createElement("i",{className:"icon-quxiaozhiding"}))),x.a.createElement(Z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return xe.current}},x.a.createElement("span",{className:"",onClick:M},x.a.createElement("i",{className:"icon-guanbi1"})))),x.a.createElement("div",{className:"".concat(P.a[j]," ").concat(j," ").concat(P.a.monaco," ").concat(v==="txt"?"show":"hide")},v==="txt"&&x.a.createElement(A.b,I)),v==="audio"&&x.a.createElement("audio",{src:"".concat(((T=a)===null||T===void 0?void 0:T.indexOf("http://"))>-1||((y=a)===null||y===void 0?void 0:y.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(a),autoPlay:!0}),v==="video"&&x.a.createElement(x.a.Fragment,null,((m=a)===null||m===void 0?void 0:m.indexOf("http"))>-1?x.a.createElement("video",{controls:!0,src:"".concat(a),autoPlay:!0}):x.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(a),autoPlay:!0})),v==="office"&&l&&x.a.createElement("iframe",{src:"".concat(D,"/office.html?key=").concat(l.key,"&url=").concat(X+l.url,"&callbackUrl=").concat(X+l.callbackUrl,"&fileType=").concat(l.fileType,"&title=").concat(l.title,"&model=").concat(u,"&officeServer=").concat(o.a.OFFICE_SERVER,"&disabledDownload=").concat(!!$)}),v==="html"&&x.a.createElement("iframe",{src:a+"&disposition=inline"}),v==="pdf"&&x.a.createElement("iframe",{src:"".concat(D,"/js/pdfview/index.html?url=").concat(a,"&disabledDownload=").concat(!!$)}),v==="image"&&x.a.createElement("img",{src:"".concat(((f=a)===null||f===void 0?void 0:f.indexOf("http://"))>-1||((E=a)===null||E===void 0?void 0:E.indexOf("https://"))>-1||(p=a)!==null&&p!==void 0&&p.startsWith("/api")?"":"data:image/png;base64,").concat(a)}),v==="other"&&x.a.createElement("div",null,x.a.createElement(J.a,{type:"primary",size:"large",onClick:De},x.a.createElement(L.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),v==="download"&&x.a.createElement(J.a,{type:"primary",size:"large",onClick:De},x.a.createElement(L.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(tt,Ke,le){},rUJ1:function(tt,Ke){const le=/[&<>"']/,ce=/[&<>"']/g,J=/[<>"']|&(?!#?\w+;)/,O=/[<>"']|&(?!#?\w+;)/g,Z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},F=E=>Z[E];function k(E,p){if(p){if(le.test(E))return E.replace(ce,F)}else if(J.test(E))return E.replace(O,F);return E}const G=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function H(E){return E.replace(G,(p,g)=>(g=g.toLowerCase(),g==="colon"?":":g.charAt(0)==="#"?g.charAt(1)==="x"?String.fromCharCode(parseInt(g.substring(2),16)):String.fromCharCode(+g.substring(1)):""))}const B=/(^|[^\[])\^/g;function R(E,p){E=E.source||E,p=p||"";const g={replace:(u,a)=>(a=a.source||a,a=a.replace(B,"$1"),E=E.replace(u,a),g),getRegex:()=>new RegExp(E,p)};return g}const x=/[^\w:]/g,w=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function P(E,p,g){if(E){let u;try{u=decodeURIComponent(H(g)).replace(x,"").toLowerCase()}catch(a){return null}if(u.indexOf("javascript:")===0||u.indexOf("vbscript:")===0||u.indexOf("data:")===0)return null}p&&!w.test(g)&&(g=o(p,g));try{g=encodeURI(g).replace(/%25/g,"%")}catch(u){return null}return g}const L={},A=/^[^:]+:\/*[^/]*$/,_=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(E,p){L[" "+E]||(A.test(E)?L[" "+E]=E+"/":L[" "+E]=y(E,"/",!0)),E=L[" "+E];const g=E.indexOf(":")===-1;return p.substring(0,2)==="//"?g?p:E.replace(_,"$1")+p:p.charAt(0)==="/"?g?p:E.replace(h,"$1")+p:E+p}const s={exec:function(){}};function d(E){let p=1,g,u;for(;p<arguments.length;p++){g=arguments[p];for(u in g)Object.prototype.hasOwnProperty.call(g,u)&&(E[u]=g[u])}return E}function T(E,p){const g=E.replace(/\|/g,(b,v,S)=>{let I=!1,j=v;for(;--j>=0&&S[j]==="\\";)I=!I;return I?"|":" |"}),u=g.split(/ \|/);let a=0;if(u.length>p)u.splice(p);else for(;u.length<p;)u.push("");for(;a<u.length;a++)u[a]=u[a].trim().replace(/\\\|/g,"|");return u}function y(E,p,g){const u=E.length;if(u===0)return"";let a=0;for(;a<u;){const b=E.charAt(u-a-1);if(b===p&&!g)a++;else if(b!==p&&g)a++;else break}return E.substr(0,u-a)}function m(E,p){if(E.indexOf(p[1])===-1)return-1;const g=E.length;let u=0,a=0;for(;a<g;a++)if(E[a]==="\\")a++;else if(E[a]===p[0])u++;else if(E[a]===p[1]&&(u--,u<0))return a;return-1}function f(E){E&&E.sanitize&&!E.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}tt.exports={escape:k,unescape:H,edit:R,cleanUrl:P,resolveUrl:o,noopTest:s,merge:d,splitCells:T,rtrim:y,findClosingBracket:m,checkSanitizeDeprecation:f}},ulZh:function(tt,Ke,le){typeof window!="undefined"&&function(J,O){tt.exports=O()}(this,function(){return function(ce){var J={};function O(Z){if(J[Z])return J[Z].exports;var F=J[Z]={i:Z,l:!1,exports:{}};return ce[Z].call(F.exports,F,F.exports,O),F.l=!0,F.exports}return O.m=ce,O.c=J,O.d=function(Z,F,k){O.o(Z,F)||Object.defineProperty(Z,F,{enumerable:!0,get:k})},O.r=function(Z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Z,"__esModule",{value:!0})},O.t=function(Z,F){if(F&1&&(Z=O(Z)),F&8)return Z;if(F&4&&typeof Z=="object"&&Z&&Z.__esModule)return Z;var k=Object.create(null);if(O.r(k),Object.defineProperty(k,"default",{enumerable:!0,value:Z}),F&2&&typeof Z!="string")for(var G in Z)O.d(k,G,function(H){return Z[H]}.bind(null,G));return k},O.n=function(Z){var F=Z&&Z.__esModule?function(){return Z.default}:function(){return Z};return O.d(F,"a",F),F},O.o=function(Z,F){return Object.prototype.hasOwnProperty.call(Z,F)},O.p="/dist/",O(O.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ce,J,O){"use strict";var Z=Object.prototype.hasOwnProperty,F="~";function k(){}Object.create&&(k.prototype=Object.create(null),new k().__proto__||(F=!1));function G(x,w,P){this.fn=x,this.context=w,this.once=P||!1}function H(x,w,P,L,A){if(typeof P!="function")throw new TypeError("The listener must be a function");var _=new G(P,L||x,A),h=F?F+w:w;return x._events[h]?x._events[h].fn?x._events[h]=[x._events[h],_]:x._events[h].push(_):(x._events[h]=_,x._eventsCount++),x}function B(x,w){--x._eventsCount===0?x._events=new k:delete x._events[w]}function R(){this._events=new k,this._eventsCount=0}R.prototype.eventNames=function(){var w=[],P,L;if(this._eventsCount===0)return w;for(L in P=this._events)Z.call(P,L)&&w.push(F?L.slice(1):L);return Object.getOwnPropertySymbols?w.concat(Object.getOwnPropertySymbols(P)):w},R.prototype.listeners=function(w){var P=F?F+w:w,L=this._events[P];if(!L)return[];if(L.fn)return[L.fn];for(var A=0,_=L.length,h=new Array(_);A<_;A++)h[A]=L[A].fn;return h},R.prototype.listenerCount=function(w){var P=F?F+w:w,L=this._events[P];return L?L.fn?1:L.length:0},R.prototype.emit=function(w,P,L,A,_,h){var o=F?F+w:w;if(!this._events[o])return!1;var s=this._events[o],d=arguments.length,T,y;if(s.fn){s.once&&this.removeListener(w,s.fn,void 0,!0);switch(d){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,P),!0;case 3:return s.fn.call(s.context,P,L),!0;case 4:return s.fn.call(s.context,P,L,A),!0;case 5:return s.fn.call(s.context,P,L,A,_),!0;case 6:return s.fn.call(s.context,P,L,A,_,h),!0}for(y=1,T=new Array(d-1);y<d;y++)T[y-1]=arguments[y];s.fn.apply(s.context,T)}else{var m=s.length,f;for(y=0;y<m;y++){s[y].once&&this.removeListener(w,s[y].fn,void 0,!0);switch(d){case 1:s[y].fn.call(s[y].context);break;case 2:s[y].fn.call(s[y].context,P);break;case 3:s[y].fn.call(s[y].context,P,L);break;case 4:s[y].fn.call(s[y].context,P,L,A);break;default:if(!T)for(f=1,T=new Array(d-1);f<d;f++)T[f-1]=arguments[f];s[y].fn.apply(s[y].context,T)}}}return!0},R.prototype.on=function(w,P,L){return H(this,w,P,L,!1)},R.prototype.once=function(w,P,L){return H(this,w,P,L,!0)},R.prototype.removeListener=function(w,P,L,A){var _=F?F+w:w;if(!this._events[_])return this;if(!P)return B(this,_),this;var h=this._events[_];if(h.fn)h.fn===P&&(!A||h.once)&&(!L||h.context===L)&&B(this,_);else{for(var o=0,s=[],d=h.length;o<d;o++)(h[o].fn!==P||A&&!h[o].once||L&&h[o].context!==L)&&s.push(h[o]);s.length?this._events[_]=s.length===1?s[0]:s:B(this,_)}return this},R.prototype.removeAllListeners=function(w){var P;return w?(P=F?F+w:w,this._events[P]&&B(this,P)):(this._events=new k,this._eventsCount=0),this},R.prototype.off=R.prototype.removeListener,R.prototype.addListener=R.prototype.on,R.prefixed=F,R.EventEmitter=R,ce.exports=R},"./node_modules/url-toolkit/src/url-toolkit.js":function(ce,J,O){(function(Z){var F=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,k=/^([^\/?#]*)([^]*)$/,G=/(?:\/|^)\.(?=\/)/g,H=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,B={buildAbsoluteURL:function(R,x,w){if(w=w||{},R=R.trim(),x=x.trim(),!x){if(!w.alwaysNormalize)return R;var P=B.parseURL(R);if(!P)throw new Error("Error trying to parse base URL.");return P.path=B.normalizePath(P.path),B.buildURLFromParts(P)}var L=B.parseURL(x);if(!L)throw new Error("Error trying to parse relative URL.");if(L.scheme)return w.alwaysNormalize?(L.path=B.normalizePath(L.path),B.buildURLFromParts(L)):x;var A=B.parseURL(R);if(!A)throw new Error("Error trying to parse base URL.");if(!A.netLoc&&A.path&&A.path[0]!=="/"){var _=k.exec(A.path);A.netLoc=_[1],A.path=_[2]}A.netLoc&&!A.path&&(A.path="/");var h={scheme:A.scheme,netLoc:L.netLoc,path:null,params:L.params,query:L.query,fragment:L.fragment};if(!L.netLoc&&(h.netLoc=A.netLoc,L.path[0]!=="/"))if(!L.path)h.path=A.path,L.params||(h.params=A.params,L.query||(h.query=A.query));else{var o=A.path,s=o.substring(0,o.lastIndexOf("/")+1)+L.path;h.path=B.normalizePath(s)}return h.path===null&&(h.path=w.alwaysNormalize?B.normalizePath(L.path):L.path),B.buildURLFromParts(h)},parseURL:function(R){var x=F.exec(R);return x?{scheme:x[1]||"",netLoc:x[2]||"",path:x[3]||"",params:x[4]||"",query:x[5]||"",fragment:x[6]||""}:null},normalizePath:function(R){for(R=R.split("").reverse().join("").replace(G,"");R.length!==(R=R.replace(H,"")).length;);return R.split("").reverse().join("")},buildURLFromParts:function(R){return R.scheme+R.netLoc+R.path+R.params+R.query+R.fragment}};ce.exports=B})(this)},"./node_modules/webworkify-webpack/index.js":function(ce,J,O){function Z(w){var P={};function L(_){if(P[_])return P[_].exports;var h=P[_]={i:_,l:!1,exports:{}};return w[_].call(h.exports,h,h.exports,L),h.l=!0,h.exports}L.m=w,L.c=P,L.i=function(_){return _},L.d=function(_,h,o){L.o(_,h)||Object.defineProperty(_,h,{configurable:!1,enumerable:!0,get:o})},L.r=function(_){Object.defineProperty(_,"__esModule",{value:!0})},L.n=function(_){var h=_&&_.__esModule?function(){return _.default}:function(){return _};return L.d(h,"a",h),h},L.o=function(_,h){return Object.prototype.hasOwnProperty.call(_,h)},L.p="/",L.oe=function(_){throw console.error(_),_};var A=L(L.s=ENTRY_MODULE);return A.default||A}var F="[\\.|\\-|\\+|\\w|/|@]+",k="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+F+").*?\\)";function G(w){return(w+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function H(w){return!isNaN(1*w)}function B(w,P,L){var A={};A[L]=[];var _=P.toString(),h=_.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!h)return A;for(var o=h[1],s=new RegExp("(\\\\n|\\W)"+G(o)+k,"g"),d;d=s.exec(_);){if(d[3]==="dll-reference")continue;A[L].push(d[3])}for(s=new RegExp("\\("+G(o)+'\\("(dll-reference\\s('+F+'))"\\)\\)'+k,"g");d=s.exec(_);)w[d[2]]||(A[L].push(d[1]),w[d[2]]=O(d[1]).m),A[d[2]]=A[d[2]]||[],A[d[2]].push(d[4]);for(var T=Object.keys(A),y=0;y<T.length;y++)for(var m=0;m<A[T[y]].length;m++)H(A[T[y]][m])&&(A[T[y]][m]=1*A[T[y]][m]);return A}function R(w){var P=Object.keys(w);return P.reduce(function(L,A){return L||w[A].length>0},!1)}function x(w,P){for(var L={main:[P]},A={main:[]},_={main:{}};R(L);)for(var h=Object.keys(L),o=0;o<h.length;o++){var s=h[o],d=L[s],T=d.pop();if(_[s]=_[s]||{},_[s][T]||!w[s][T])continue;_[s][T]=!0,A[s]=A[s]||[],A[s].push(T);for(var y=B(w,w[s][T],s),m=Object.keys(y),f=0;f<m.length;f++)L[m[f]]=L[m[f]]||[],L[m[f]]=L[m[f]].concat(y[m[f]])}return A}ce.exports=function(w,P){P=P||{};var L={main:O.m},A=P.all?{main:Object.keys(L.main)}:x(L,w),_="";Object.keys(A).filter(function(T){return T!=="main"}).forEach(function(T){for(var y=0;A[T][y];)y++;A[T].push(y),L[T][y]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",_=_+"var "+T+" = ("+Z.toString().replace("ENTRY_MODULE",JSON.stringify(y))+")({"+A[T].map(function(m){return""+JSON.stringify(m)+": "+L[T][m].toString()}).join(",")+`});
`}),_=_+"new (("+Z.toString().replace("ENTRY_MODULE",JSON.stringify(w))+")({"+A.main.map(function(T){return""+JSON.stringify(T)+": "+L.main[T].toString()}).join(",")+"}))(self);";var h=new window.Blob([_],{type:"text/javascript"});if(P.bare)return h;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,s=o.createObjectURL(h),d=new window.Worker(s);return d.objectURL=s,d}},"./src/config.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"hlsDefaultConfig",function(){return f}),O.d(J,"mergeConfig",function(){return p}),O.d(J,"enableStreamingMode",function(){return g});var Z=O("./src/controller/abr-controller.ts"),F=O("./src/controller/audio-stream-controller.ts"),k=O("./src/controller/audio-track-controller.ts"),G=O("./src/controller/subtitle-stream-controller.ts"),H=O("./src/controller/subtitle-track-controller.ts"),B=O("./src/controller/buffer-controller.ts"),R=O("./src/controller/timeline-controller.ts"),x=O("./src/controller/cap-level-controller.ts"),w=O("./src/controller/fps-controller.ts"),P=O("./src/controller/eme-controller.ts"),L=O("./src/controller/cmcd-controller.ts"),A=O("./src/utils/xhr-loader.ts"),_=O("./src/utils/fetch-loader.ts"),h=O("./src/utils/cues.ts"),o=O("./src/utils/mediakeys-helper.ts"),s=O("./src/utils/logger.ts");function d(){return d=Object.assign||function(u){for(var a=1;a<arguments.length;a++){var b=arguments[a];for(var v in b)Object.prototype.hasOwnProperty.call(b,v)&&(u[v]=b[v])}return u},d.apply(this,arguments)}function T(u,a){var b=Object.keys(u);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(u);a&&(v=v.filter(function(S){return Object.getOwnPropertyDescriptor(u,S).enumerable})),b.push.apply(b,v)}return b}function y(u){for(var a=1;a<arguments.length;a++){var b=arguments[a]!=null?arguments[a]:{};a%2?T(Object(b),!0).forEach(function(v){m(u,v,b[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(b)):T(Object(b)).forEach(function(v){Object.defineProperty(u,v,Object.getOwnPropertyDescriptor(b,v))})}return u}function m(u,a,b){return a in u?Object.defineProperty(u,a,{value:b,enumerable:!0,configurable:!0,writable:!0}):u[a]=b,u}var f=y(y({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:A.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Z.default,bufferController:B.default,capLevelController:x.default,fpsController:w.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},E()),{},{subtitleStreamController:G.SubtitleStreamController,subtitleTrackController:H.default,timelineController:R.TimelineController,audioStreamController:F.default,audioTrackController:k.default,emeController:P.default,cmcdController:L.default});function E(){return{cueHandler:h.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function p(u,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return d({},u,a)}function g(u){var a=u.loader;if(a!==_.default&&a!==A.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),u.progressive=!1;else{var b=Object(_.fetchSupported)();b&&(u.loader=_.default,u.progressive=!0,u.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/polyfills/number.ts"),F=O("./src/utils/ewma-bandwidth-estimator.ts"),k=O("./src/events.ts"),G=O("./src/utils/buffer-helper.ts"),H=O("./src/errors.ts"),B=O("./src/types/loader.ts"),R=O("./src/utils/logger.ts");function x(L,A){for(var _=0;_<A.length;_++){var h=A[_];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(L,h.key,h)}}function w(L,A,_){return A&&x(L.prototype,A),_&&x(L,_),L}var P=function(){function L(_){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=_;var h=_.config;this.bwEstimator=new F.default(h.abrEwmaSlowVoD,h.abrEwmaFastVoD,h.abrEwmaDefaultEstimate),this.registerListeners()}var A=L.prototype;return A.registerListeners=function(){var h=this.hls;h.on(k.Events.FRAG_LOADING,this.onFragLoading,this),h.on(k.Events.FRAG_LOADED,this.onFragLoaded,this),h.on(k.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.on(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(k.Events.ERROR,this.onError,this)},A.unregisterListeners=function(){var h=this.hls;h.off(k.Events.FRAG_LOADING,this.onFragLoading,this),h.off(k.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(k.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.off(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(k.Events.ERROR,this.onError,this)},A.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},A.onFragLoading=function(h,o){var s=o.frag;if(s.type===B.PlaylistLevelType.MAIN&&!this.timer){var d;this.fragCurrent=s,this.partCurrent=(d=o.part)!=null?d:null,this.timer=self.setInterval(this.onCheck,100)}},A.onLevelLoaded=function(h,o){var s=this.hls.config;o.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},A._abandonRulesCheck=function(){var h=this.fragCurrent,o=this.partCurrent,s=this.hls,d=s.autoLevelEnabled,T=s.config,y=s.media;if(!h||!y)return;var m=o?o.stats:h.stats,f=o?o.duration:h.duration;if(m.aborted){R.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!d||y.paused||!y.playbackRate||!y.readyState)return;var E=performance.now()-m.loading.start,p=Math.abs(y.playbackRate);if(E<=500*f/p)return;var g=s.levels,u=s.minAutoLevel,a=g[h.level],b=m.total||Math.max(m.loaded,Math.round(f*a.maxBitrate/8)),v=Math.max(1,m.bwEstimate?m.bwEstimate/8:m.loaded*1e3/E),S=(b-m.loaded)/v,I=y.currentTime,j=(G.BufferHelper.bufferInfo(y,I,T.maxBufferHole).end-I)/p;if(j>=2*f/p||S<=j)return;var z=Number.POSITIVE_INFINITY,V;for(V=h.level-1;V>u;V--){var M=g[V].maxBitrate;if(z=f*M/(8*.8*v),z<j)break}if(z>=S)return;var N=this.bwEstimator.getEstimate();R.logger.warn("Fragment "+h.sn+(o?" part "+o.index:"")+" of level "+h.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
Current BW estimate: `+(Object(Z.isFiniteNumber)(N)?(N/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+S.toFixed(3)+` s
Estimated load time for the next fragment: `+z.toFixed(3)+` s
Time to underbuffer: `+j.toFixed(3)+" s"),s.nextLoadLevel=V,this.bwEstimator.sample(E,m.loaded),this.clearTimer(),h.loader&&(this.fragCurrent=this.partCurrent=null,h.loader.abort()),s.trigger(k.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:h,part:o,stats:m})},A.onFragLoaded=function(h,o){var s=o.frag,d=o.part;if(s.type===B.PlaylistLevelType.MAIN&&Object(Z.isFiniteNumber)(s.sn)){var T=d?d.stats:s.stats,y=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],f=(m.loaded?m.loaded.bytes:0)+T.loaded,E=(m.loaded?m.loaded.duration:0)+y;m.loaded={bytes:f,duration:E},m.realBitrate=Math.round(8*f/E)}if(s.bitrateTest){var p={stats:T,frag:s,part:d,id:s.type};this.onFragBuffered(k.Events.FRAG_BUFFERED,p),s.bitrateTest=!1}}},A.onFragBuffered=function(h,o){var s=o.frag,d=o.part,T=d?d.stats:s.stats;if(T.aborted)return;if(s.type!==B.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var y=T.parsing.end-T.loading.start;this.bwEstimator.sample(y,T.loaded),T.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=y/1e3:this.bitrateTestDelay=0},A.onError=function(h,o){switch(o.details){case H.ErrorDetails.FRAG_LOAD_ERROR:case H.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},A.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},A.getNextABRAutoLevel=function(){var h=this.fragCurrent,o=this.partCurrent,s=this.hls,d=s.maxAutoLevel,T=s.config,y=s.minAutoLevel,m=s.media,f=o?o.duration:h?h.duration:0,E=m?m.currentTime:0,p=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,g=this.bwEstimator?this.bwEstimator.getEstimate():T.abrEwmaDefaultEstimate,u=(G.BufferHelper.bufferInfo(m,E,T.maxBufferHole).end-E)/p,a=this.findBestLevel(g,y,d,u,T.abrBandWidthFactor,T.abrBandWidthUpFactor);if(a>=0)return a;R.logger.trace((u?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var b=f?Math.min(f,T.maxStarvationDelay):T.maxStarvationDelay,v=T.abrBandWidthFactor,S=T.abrBandWidthUpFactor;if(!u){var I=this.bitrateTestDelay;if(I){var j=f?Math.min(f,T.maxLoadingDelay):T.maxLoadingDelay;b=j-I,R.logger.trace("bitrate test took "+Math.round(1e3*I)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*b)+" ms"),v=S=1}}return a=this.findBestLevel(g,y,d,u+b,v,S),Math.max(a,0)},A.findBestLevel=function(h,o,s,d,T,y){for(var m,f=this.fragCurrent,E=this.partCurrent,p=this.lastLoadedFragLevel,g=this.hls.levels,u=g[p],a=!!(u!=null&&(m=u.details)!==null&&m!==void 0&&m.live),b=u==null?void 0:u.codecSet,v=E?E.duration:f?f.duration:0,S=s;S>=o;S--){var I=g[S];if(!I||b&&I.codecSet!==b)continue;var j=I.details,z=(E?j==null?void 0:j.partTarget:j==null?void 0:j.averagetargetduration)||v,V=void 0;S<=p?V=T*h:V=y*h;var M=g[S].maxBitrate,N=M*z/V;if(R.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+S+"/"+Math.round(V)+"/"+M+"/"+z+"/"+d+"/"+N),V>M&&(!N||a&&!this.bitrateTestDelay||N<d))return S}return-1},w(L,[{key:"nextAutoLevel",get:function(){var h=this._nextAutoLevel,o=this.bwEstimator;if(h!==-1&&(!o||!o.canEstimate()))return h;var s=this.getNextABRAutoLevel();return h!==-1&&(s=Math.min(h,s)),s},set:function(h){this._nextAutoLevel=h}}]),L}();J.default=P},"./src/controller/audio-stream-controller.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/polyfills/number.ts"),F=O("./src/controller/base-stream-controller.ts"),k=O("./src/events.ts"),G=O("./src/utils/buffer-helper.ts"),H=O("./src/controller/fragment-tracker.ts"),B=O("./src/types/level.ts"),R=O("./src/types/loader.ts"),x=O("./src/loader/fragment.ts"),w=O("./src/demux/chunk-cache.ts"),P=O("./src/demux/transmuxer-interface.ts"),L=O("./src/types/transmuxer.ts"),A=O("./src/controller/fragment-finders.ts"),_=O("./src/utils/discontinuities.ts"),h=O("./src/errors.ts"),o=O("./src/utils/logger.ts");function s(){return s=Object.assign||function(f){for(var E=1;E<arguments.length;E++){var p=arguments[E];for(var g in p)Object.prototype.hasOwnProperty.call(p,g)&&(f[g]=p[g])}return f},s.apply(this,arguments)}function d(f,E){f.prototype=Object.create(E.prototype),f.prototype.constructor=f,T(f,E)}function T(f,E){return T=Object.setPrototypeOf||function(g,u){return g.__proto__=u,g},T(f,E)}var y=100,m=function(f){d(E,f);function E(g,u){var a;return a=f.call(this,g,u,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var p=E.prototype;return p.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},p._registerListeners=function(){var u=this.hls;u.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(k.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.on(k.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.on(k.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(k.Events.ERROR,this.onError,this),u.on(k.Events.BUFFER_RESET,this.onBufferReset,this),u.on(k.Events.BUFFER_CREATED,this.onBufferCreated,this),u.on(k.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.on(k.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(k.Events.FRAG_BUFFERED,this.onFragBuffered,this)},p._unregisterListeners=function(){var u=this.hls;u.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(k.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.off(k.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.off(k.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(k.Events.ERROR,this.onError,this),u.off(k.Events.BUFFER_RESET,this.onBufferReset,this),u.off(k.Events.BUFFER_CREATED,this.onBufferCreated,this),u.off(k.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.off(k.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(k.Events.FRAG_BUFFERED,this.onFragBuffered,this)},p.onInitPtsFound=function(u,a){var b=a.frag,v=a.id,S=a.initPTS;if(v==="main"){var I=b.cc;this.initPTS[b.cc]=S,this.log("InitPTS for cc: "+I+" found from main: "+S),this.videoTrackCC=I,this.state===F.State.WAITING_INIT_PTS&&this.tick()}},p.startLoad=function(u){if(!this.levels){this.startPosition=u,this.state=F.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(y),this.fragLoadError=0,a>0&&u===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=F.State.IDLE):(this.loadedmetadata=!1,this.state=F.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=u,this.tick()},p.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_TRACK:{var u,a=this.levels,b=this.trackId,v=a==null||((u=a[b])===null||u===void 0)?void 0:u.details;if(v){if(this.waitForCdnTuneIn(v))break;this.state=F.State.WAITING_INIT_PTS}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var S,I=performance.now(),j=this.retryDate;(!j||I>=j||(S=this.media)!==null&&S!==void 0&&S.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=F.State.IDLE);break}case F.State.WAITING_INIT_PTS:{var z=this.waitingData;if(z){var V=z.frag,M=z.part,N=z.cache,$=z.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.FRAG_LOADING;var ie=N.flush(),he={frag:V,part:M,payload:ie,networkDetails:null};this._handleFragmentLoadProgress(he),$&&f.prototype._handleFragmentLoadComplete.call(this,he)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+V.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var me=this.getLoadPosition(),ke=G.BufferHelper.bufferInfo(this.mediaBuffer,me,this.config.maxBufferHole),Se=Object(A.fragmentWithinToleranceTest)(ke.end,this.config.maxFragLookUpTolerance,V);Se<0&&(o.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+ke.end+" is needed"),this.clearWaitingFragment())}}else this.state=F.State.IDLE}}this.onTickEnd()},p.clearWaitingFragment=function(){var u=this.waitingData;u&&(this.fragmentTracker.removeFragment(u.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.IDLE)},p.onTickEnd=function(){var u=this.media;if(!u||!u.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:u,b=a.buffered;!this.loadedmetadata&&b.length&&(this.loadedmetadata=!0),this.lastCurrentTime=u.currentTime},p.doTickIdle=function(){var u,a,b=this.hls,v=this.levels,S=this.media,I=this.trackId,j=b.config;if(!v||!v[I])return;if(!S&&(this.startFragRequested||!j.startFragPrefetch))return;var z=v[I],V=z.details;if(!V||V.live&&this.levelLastLoaded!==I||this.waitForCdnTuneIn(V)){this.state=F.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,x.ElementaryStreamTypes.AUDIO,R.PlaylistLevelType.AUDIO));var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,R.PlaylistLevelType.AUDIO);if(M===null)return;var N=M.len,$=this.getMaxBufferLength(),ie=this.audioSwitch;if(N>=$&&!ie)return;if(!ie&&this._streamEnded(M,V)){b.trigger(k.Events.BUFFER_EOS,{type:"audio"}),this.state=F.State.ENDED;return}var he=V.fragments,me=he[0].start,ke=M.end;if(ie){var Se=this.getLoadPosition();ke=Se,V.PTSKnown&&Se<me&&((M.end>me||M.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),S.currentTime=me+.05))}var Re=this.getNextFragment(ke,V);if(!Re){this.bufferFlushed=!0;return}((u=Re.decryptdata)===null||u===void 0?void 0:u.keyFormat)==="identity"&&!((a=Re.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Re,V):this.loadFragment(Re,V,ke)},p.getMaxBufferLength=function(){var u=f.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,R.PlaylistLevelType.MAIN);return a===null?u:Math.max(u,a.len)},p.onMediaDetaching=function(){this.videoBuffer=null,f.prototype.onMediaDetaching.call(this)},p.onAudioTracksUpdated=function(u,a){var b=a.audioTracks;this.resetTransmuxer(),this.levels=b.map(function(v){return new B.Level(v)})},p.onAudioTrackSwitching=function(u,a){var b=!!a.url;this.trackId=a.id;var v=this.fragCurrent;v!=null&&v.loader&&v.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),b?this.setInterval(y):this.resetTransmuxer(),b?(this.audioSwitch=!0,this.state=F.State.IDLE):this.state=F.State.STOPPED,this.tick()},p.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},p.onLevelLoaded=function(u,a){this.mainDetails=a.details},p.onAudioTrackLoaded=function(u,a){var b,v=this.levels,S=a.details,I=a.id;if(!v){this.warn("Audio tracks were reset while loading level "+I);return}this.log("Track "+I+" loaded ["+S.startSN+","+S.endSN+"],duration:"+S.totalduration);var j=v[I],z=0;if(S.live||(b=j.details)!==null&&b!==void 0&&b.live){var V=this.mainDetails;if(S.fragments[0]||(S.deltaUpdateFailed=!0),S.deltaUpdateFailed||!V)return;!j.details&&S.hasProgramDateTime&&V.hasProgramDateTime?(Object(_.alignMediaPlaylistByPDT)(S,V),z=S.fragments[0].start):z=this.alignPlaylists(S,j.details)}j.details=S,this.levelLastLoaded=I,!this.startFragRequested&&(this.mainDetails||!S.live)&&this.setStartPosition(j.details,z),this.state===F.State.WAITING_TRACK&&!this.waitForCdnTuneIn(S)&&(this.state=F.State.IDLE),this.tick()},p._handleFragmentLoadProgress=function(u){var a,b=u.frag,v=u.part,S=u.payload,I=this.config,j=this.trackId,z=this.levels;if(!z){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+b.sn+" of level "+b.level+" will not be buffered");return}var V=z[j];console.assert(V,"Audio track is defined on fragment load progress");var M=V.details;console.assert(M,"Audio track details are defined on fragment load progress");var N=I.defaultAudioCodec||V.audioCodec||"mp4a.40.2",$=this.transmuxer;$||($=this.transmuxer=new P.default(this.hls,R.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ie=this.initPTS[b.cc],he=(a=b.initSegment)===null||a===void 0?void 0:a.data;if(ie!==void 0){var me=!1,ke=v?v.index:-1,Se=ke!==-1,Re=new L.ChunkMetadata(b.level,b.sn,b.stats.chunkCount,S.byteLength,ke,Se);$.push(S,he,N,"",b,v,M.totalduration,me,Re,ie)}else{o.logger.log("Unknown video PTS for cc "+b.cc+", waiting for video PTS before demuxing audio frag "+b.sn+" of ["+M.startSN+" ,"+M.endSN+"],track "+j);var Te=this.waitingData=this.waitingData||{frag:b,part:v,cache:new w.default,complete:!1},_e=Te.cache;_e.push(new Uint8Array(S)),this.waitingVideoCC=this.videoTrackCC,this.state=F.State.WAITING_INIT_PTS}},p._handleFragmentLoadComplete=function(u){if(this.waitingData){this.waitingData.complete=!0;return}f.prototype._handleFragmentLoadComplete.call(this,u)},p.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},p.onBufferCreated=function(u,a){var b=a.tracks.audio;b&&(this.mediaBuffer=b.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},p.onFragBuffered=function(u,a){var b=a.frag,v=a.part;if(b.type!==R.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(b)){this.warn("Fragment "+b.sn+(v?" p: "+v.index:"")+" of level "+b.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}b.sn!=="initSegment"&&(this.fragPrevious=b,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(k.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(b,v)},p.onError=function(u,a){switch(a.details){case h.ErrorDetails.FRAG_LOAD_ERROR:case h.ErrorDetails.FRAG_LOAD_TIMEOUT:case h.ErrorDetails.KEY_LOAD_ERROR:case h.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.AUDIO,a);break;case h.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case h.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==F.State.ERROR&&this.state!==F.State.STOPPED&&(this.state=a.fatal?F.State.ERROR:F.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case h.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var b=!0,v=this.getFwdBufferInfo(this.mediaBuffer,R.PlaylistLevelType.AUDIO);v&&v.len>.5&&(b=!this.reduceMaxBufferLength(v.len)),b&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,f.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},p.onBufferFlushed=function(u,a){var b=a.type;b===x.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},p._handleTransmuxComplete=function(u){var a,b="audio",v=this.hls,S=u.remuxResult,I=u.chunkMeta,j=this.getCurrentContext(I);if(!j){this.warn("The loading context changed while buffering fragment "+I.sn+" of level "+I.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(I.level);return}var z=j.frag,V=j.part,M=S.audio,N=S.text,$=S.id3,ie=S.initSegment;if(this.fragContextChanged(z))return;if(this.state=F.State.PARSING,this.audioSwitch&&M&&this.completeAudioSwitch(),ie!=null&&ie.tracks&&(this._bufferInitSegment(ie.tracks,z,I),v.trigger(k.Events.FRAG_PARSING_INIT_SEGMENT,{frag:z,id:b,tracks:ie.tracks})),M){var he=M.startPTS,me=M.endPTS,ke=M.startDTS,Se=M.endDTS;V&&(V.elementaryStreams[x.ElementaryStreamTypes.AUDIO]={startPTS:he,endPTS:me,startDTS:ke,endDTS:Se}),z.setElementaryStreamInfo(x.ElementaryStreamTypes.AUDIO,he,me,ke,Se),this.bufferFragmentData(M,z,V,I)}if($!=null&&(a=$.samples)!==null&&a!==void 0&&a.length){var Re=s({frag:z,id:b},$);v.trigger(k.Events.FRAG_PARSING_METADATA,Re)}if(N){var Te=s({frag:z,id:b},N);v.trigger(k.Events.FRAG_PARSING_USERDATA,Te)}},p._bufferInitSegment=function(u,a,b){if(this.state!==F.State.PARSING)return;u.video&&delete u.video;var v=u.audio;if(!v)return;v.levelCodec=v.codec,v.id="audio",this.log("Init audio buffer, container:"+v.container+", codecs[parsed]=["+v.codec+"]"),this.hls.trigger(k.Events.BUFFER_CODECS,u);var S=v.initSegment;if(S!=null&&S.byteLength){var I={type:"audio",frag:a,part:null,chunkMeta:b,parent:a.type,data:S};this.hls.trigger(k.Events.BUFFER_APPENDING,I)}this.tick()},p.loadFragment=function(u,a,b){var v=this.fragmentTracker.getState(u);this.fragCurrent=u,(this.audioSwitch||v===H.FragmentState.NOT_LOADED||v===H.FragmentState.PARTIAL)&&(u.sn==="initSegment"?this._loadInitSegment(u):a.live&&!Object(Z.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=F.State.WAITING_INIT_PTS):(this.startFragRequested=!0,f.prototype.loadFragment.call(this,u,a,b)))},p.completeAudioSwitch=function(){var u=this.hls,a=this.media,b=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),f.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,u.trigger(k.Events.AUDIO_TRACK_SWITCHED,{id:b})},E}(F.default);J.default=m},"./src/controller/audio-track-controller.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/events.ts"),F=O("./src/errors.ts"),k=O("./src/controller/base-playlist-controller.ts"),G=O("./src/types/loader.ts");function H(P,L){for(var A=0;A<L.length;A++){var _=L[A];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(P,_.key,_)}}function B(P,L,A){return L&&H(P.prototype,L),A&&H(P,A),P}function R(P,L){P.prototype=Object.create(L.prototype),P.prototype.constructor=P,x(P,L)}function x(P,L){return x=Object.setPrototypeOf||function(_,h){return _.__proto__=h,_},x(P,L)}var w=function(P){R(L,P);function L(_){var h;return h=P.call(this,_,"[audio-track-controller]")||this,h.tracks=[],h.groupId=null,h.tracksInGroup=[],h.trackId=-1,h.trackName="",h.selectDefaultTrack=!0,h.registerListeners(),h}var A=L.prototype;return A.registerListeners=function(){var h=this.hls;h.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.on(Z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on(Z.Events.ERROR,this.onError,this)},A.unregisterListeners=function(){var h=this.hls;h.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),h.off(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.off(Z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.off(Z.Events.ERROR,this.onError,this)},A.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,P.prototype.destroy.call(this)},A.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},A.onManifestParsed=function(h,o){this.tracks=o.audioTracks||[]},A.onAudioTrackLoaded=function(h,o){var s=o.id,d=o.details,T=this.tracksInGroup[s];if(!T){this.warn("Invalid audio track id "+s);return}var y=T.details;T.details=o.details,this.log("audioTrack "+s+" loaded ["+d.startSN+"-"+d.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,o,y))},A.onLevelLoading=function(h,o){this.switchLevel(o.level)},A.onLevelSwitching=function(h,o){this.switchLevel(o.level)},A.switchLevel=function(h){var o=this.hls.levels[h];if(!(o!=null&&o.audioGroupIds))return;var s=o.audioGroupIds[o.urlId];if(this.groupId!==s){this.groupId=s;var d=this.tracks.filter(function(y){return!s||y.groupId===s});this.selectDefaultTrack&&!d.some(function(y){return y.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=d;var T={audioTracks:d};this.log("Updating audio tracks, "+d.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(Z.Events.AUDIO_TRACKS_UPDATED,T),this.selectInitialTrack()}},A.onError=function(h,o){if(P.prototype.onError.call(this,h,o),o.fatal||!o.context)return;o.context.type===G.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},A.setAudioTrack=function(h){var o=this.tracksInGroup;if(h<0||h>=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 "+h);var d=o[h],T=d.id,y=d.groupId,m=y===void 0?"":y,f=d.name,E=d.type,p=d.url;if(this.trackId=h,this.trackName=f,this.selectDefaultTrack=!1,this.hls.trigger(Z.Events.AUDIO_TRACK_SWITCHING,{id:T,groupId:m,name:f,type:E,url:p}),d.details&&!d.details.live)return;var g=this.switchParams(d.url,s==null?void 0:s.details);this.loadPlaylist(g)},A.selectInitialTrack=function(){var h=this.tracksInGroup;console.assert(h.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,s=this.findTrackId(o)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},A.findTrackId=function(h){for(var o=this.tracksInGroup,s=0;s<o.length;s++){var d=o[s];if((!this.selectDefaultTrack||d.default)&&(!h||h===d.name))return d.id}return-1},A.loadPlaylist=function(h){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var s=o.id,d=o.groupId,T=o.url;if(h)try{T=h.addDirectives(T)}catch(y){this.warn("Could not construct new URL with HLS Delivery Directives: "+y)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(Z.Events.AUDIO_TRACK_LOADING,{url:T,id:s,groupId:d,deliveryDirectives:h||null})}},B(L,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(h){this.selectDefaultTrack=!1,this.setAudioTrack(h)}}]),L}(k.default);J.default=w},"./src/controller/base-playlist-controller.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return B});var Z=O("./src/polyfills/number.ts"),F=O("./src/types/level.ts"),k=O("./src/controller/level-helper.ts"),G=O("./src/utils/logger.ts"),H=O("./src/errors.ts"),B=function(){function R(w,P){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=G.logger.log.bind(G.logger,P+":"),this.warn=G.logger.warn.bind(G.logger,P+":"),this.hls=w}var x=R.prototype;return x.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},x.onError=function(P,L){L.fatal&&L.type===H.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},x.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},x.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},x.stopLoad=function(){this.canLoad=!1,this.clearTimer()},x.switchParams=function(P,L){var A=L==null?void 0:L.renditionReports;if(A)for(var _=0;_<A.length;_++){var h=A[_],o=""+h.URI;if(o===P.substr(-o.length)){var s=parseInt(h["LAST-MSN"]),d=parseInt(h["LAST-PART"]);if(L&&this.hls.config.lowLatencyMode){var T=Math.min(L.age-L.partTarget,L.targetduration);d!==void 0&&T>L.partTarget&&(d+=1)}if(Object(Z.isFiniteNumber)(s))return new F.HlsUrlParameters(s,Object(Z.isFiniteNumber)(d)?d:void 0,F.HlsSkip.No)}}},x.loadPlaylist=function(P){},x.shouldLoadTrack=function(P){return this.canLoad&&P&&!!P.url&&(!P.details||P.details.live)},x.playlistLoaded=function(P,L,A){var _=this,h=L.details,o=L.stats,s=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(h.advancedDateTime=Date.now()-s,h.live||A!=null&&A.live){if(h.reloaded(A),A&&this.log("live playlist "+P+" "+(h.advanced?"REFRESHED "+h.lastPartSn+"-"+h.lastPartIndex:"MISSED")),A&&h.fragments.length>0&&Object(k.mergeDetails)(A,h),!this.canLoad||!h.live)return;var d,T=void 0,y=void 0;if(h.canBlockReload&&h.endSN&&h.advanced){var m=this.hls.config.lowLatencyMode,f=h.lastPartSn,E=h.endSN,p=h.lastPartIndex,g=p!==-1,u=f===E,a=m?0:p;g?(T=u?E+1:f,y=u?a:p+1):T=E+1;var b=h.age,v=b+h.ageHeader,S=Math.min(v-h.partTarget,h.targetduration*1.5);if(S>0){if(A&&S>A.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+A.tuneInGoal+" to: "+S+" with playlist age: "+h.age),S=0;else{var I=Math.floor(S/h.targetduration);if(T+=I,y!==void 0){var j=Math.round(S%h.targetduration/h.partTarget);y+=j}this.log("CDN Tune-in age: "+h.ageHeader+"s last advanced "+b.toFixed(2)+"s goal: "+S+" skip sn "+I+" to part "+y)}h.tuneInGoal=S}if(d=this.getDeliveryDirectives(h,L.deliveryDirectives,T,y),m||!u){this.loadPlaylist(d);return}}else d=this.getDeliveryDirectives(h,L.deliveryDirectives,T,y);var z=Object(k.computeReloadInterval)(h,o);T!==void 0&&h.canBlockReload&&(z-=h.partTarget||1),this.log("reload live playlist "+P+" in "+Math.round(z)+" ms"),this.timer=self.setTimeout(function(){return _.loadPlaylist(d)},z)}else this.clearTimer()},x.getDeliveryDirectives=function(P,L,A,_){var h=Object(F.getSkipValue)(P,A);return L!=null&&L.skip&&P.deltaUpdateFailed&&(A=L.msn,_=L.part,h=F.HlsSkip.No),new F.HlsUrlParameters(A,_,h)},x.retryLoadingOrFail=function(P){var L=this,A=this.hls.config,_=this.retryCount<A.levelLoadingMaxRetry;if(_){var h;if(this.retryCount++,P.details.indexOf("LoadTimeOut")>-1&&(h=P.context)!==null&&h!==void 0&&h.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+P.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*A.levelLoadingRetryDelay,A.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return L.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 _},R}()},"./src/controller/base-stream-controller.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"State",function(){return E}),O.d(J,"default",function(){return p});var Z=O("./src/polyfills/number.ts"),F=O("./src/task-loop.ts"),k=O("./src/controller/fragment-tracker.ts"),G=O("./src/utils/buffer-helper.ts"),H=O("./src/utils/logger.ts"),B=O("./src/events.ts"),R=O("./src/errors.ts"),x=O("./src/types/transmuxer.ts"),w=O("./src/utils/mp4-tools.ts"),P=O("./src/utils/discontinuities.ts"),L=O("./src/controller/fragment-finders.ts"),A=O("./src/controller/level-helper.ts"),_=O("./src/loader/fragment-loader.ts"),h=O("./src/crypt/decrypter.ts"),o=O("./src/utils/time-ranges.ts"),s=O("./src/types/loader.ts");function d(g,u){for(var a=0;a<u.length;a++){var b=u[a];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(g,b.key,b)}}function T(g,u,a){return u&&d(g.prototype,u),a&&d(g,a),g}function y(g){if(g===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return g}function m(g,u){g.prototype=Object.create(u.prototype),g.prototype.constructor=g,f(g,u)}function f(g,u){return f=Object.setPrototypeOf||function(b,v){return b.__proto__=v,b},f(g,u)}var E={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},p=function(g){m(u,g);function u(b,v,S){var I;return I=g.call(this)||this,I.hls=void 0,I.fragPrevious=null,I.fragCurrent=null,I.fragmentTracker=void 0,I.transmuxer=null,I._state=E.STOPPED,I.media=void 0,I.mediaBuffer=void 0,I.config=void 0,I.bitrateTest=!1,I.lastCurrentTime=0,I.nextLoadPosition=0,I.startPosition=0,I.loadedmetadata=!1,I.fragLoadError=0,I.retryDate=0,I.levels=null,I.fragmentLoader=void 0,I.levelLastLoaded=null,I.startFragRequested=!1,I.decrypter=void 0,I.initPTS=[],I.onvseeking=null,I.onvended=null,I.logPrefix="",I.log=void 0,I.warn=void 0,I.logPrefix=S,I.log=H.logger.log.bind(H.logger,S+":"),I.warn=H.logger.warn.bind(H.logger,S+":"),I.hls=b,I.fragmentLoader=new _.default(b.config),I.fragmentTracker=v,I.config=b.config,I.decrypter=new h.default(b,b.config),b.on(B.Events.KEY_LOADED,I.onKeyLoaded,y(I)),I}var a=u.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(v){},a.stopLoad=function(){this.fragmentLoader.abort();var v=this.fragCurrent;v&&this.fragmentTracker.removeFragment(v),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=E.STOPPED},a._streamEnded=function(v,S){var I=this.fragCurrent,j=this.fragmentTracker;if(!S.live&&I&&I.sn===S.endSN&&!v.nextStart){var z=j.getState(I);return z===k.FragmentState.PARTIAL||z===k.FragmentState.OK}return!1},a.onMediaAttached=function(v,S){var I=this.media=this.mediaBuffer=S.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),I.addEventListener("seeking",this.onvseeking),I.addEventListener("ended",this.onvended);var j=this.config;this.levels&&j.autoStartLoad&&this.state===E.STOPPED&&this.startLoad(j.startPosition)},a.onMediaDetaching=function(){var v=this.media;v!=null&&v.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),v&&(v.removeEventListener("seeking",this.onvseeking),v.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var v=this.config,S=this.fragCurrent,I=this.media,j=this.mediaBuffer,z=this.state,V=I?I.currentTime:0,M=G.BufferHelper.bufferInfo(j||I,V,v.maxBufferHole);if(this.log("media seeking to "+(Object(Z.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+z),z===E.ENDED)this.resetLoadingState();else if(S&&!M.len){var N=v.maxFragLookUpTolerance,$=S.start-N,ie=S.start+S.duration+N,he=V>ie;(V<$||he)&&(he&&S.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),S.loader.abort()),this.resetLoadingState())}I&&(this.lastCurrentTime=V),!this.loadedmetadata&&!M.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(v,S){if(this.state!==E.KEY_LOADING||S.frag!==this.fragCurrent||!this.levels)return;this.state=E.IDLE;var I=this.levels[S.frag.level].details;I&&this.loadFragment(S.frag,I,S.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),g.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=E.STOPPED,this.hls.off(B.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,g.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(v,S){this.log("Loading key for "+v.sn+" of ["+S.startSN+"-"+S.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level),this.state=E.KEY_LOADING,this.fragCurrent=v,this.hls.trigger(B.Events.KEY_LOADING,{frag:v})},a.loadFragment=function(v,S,I){this._loadFragForPlayback(v,S,I)},a._loadFragForPlayback=function(v,S,I){var j=this,z=function(M){if(j.fragContextChanged(v)){j.warn("Fragment "+v.sn+(M.part?" p: "+M.part.index:"")+" of level "+v.level+" was dropped during download."),j.fragmentTracker.removeFragment(v);return}v.stats.chunkCount++,j._handleFragmentLoadProgress(M)};this._doFragLoad(v,S,I,z).then(function(V){if(!V)return;j.fragLoadError=0;var M=j.state;if(j.fragContextChanged(v)){(M===E.FRAG_LOADING||M===E.BACKTRACKING||!j.fragCurrent&&M===E.PARSING)&&(j.fragmentTracker.removeFragment(v),j.state=E.IDLE);return}if("payload"in V&&(j.log("Loaded fragment "+v.sn+" of level "+v.level),j.hls.trigger(B.Events.FRAG_LOADED,V),j.state===E.BACKTRACKING)){j.fragmentTracker.backtrack(v,V),j.resetFragmentLoading(v);return}j._handleFragmentLoadComplete(V)}).catch(function(V){j.warn(V),j.resetFragmentLoading(v)})},a.flushMainBuffer=function(v,S,I){if(I===void 0&&(I=null),!(v-S))return;var j={startOffset:v,endOffset:S,type:I};this.fragLoadError=0,this.hls.trigger(B.Events.BUFFER_FLUSHING,j)},a._loadInitSegment=function(v){var S=this;this._doFragLoad(v).then(function(I){if(!I||S.fragContextChanged(v)||!S.levels)throw new Error("init load aborted");return I}).then(function(I){var j=S.hls,z=I.payload,V=v.decryptdata;if(z&&z.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var M=self.performance.now();return S.decrypter.webCryptoDecrypt(new Uint8Array(z),V.key.buffer,V.iv.buffer).then(function(N){var $=self.performance.now();return j.trigger(B.Events.FRAG_DECRYPTED,{frag:v,payload:N,stats:{tstart:M,tdecrypt:$}}),I.payload=N,I})}return I}).then(function(I){var j=S.fragCurrent,z=S.hls,V=S.levels;if(!V)throw new Error("init load aborted, missing levels");var M=V[v.level].details;console.assert(M,"Level details are defined when init segment is loaded");var N=v.stats;S.state=E.IDLE,S.fragLoadError=0,v.data=new Uint8Array(I.payload),N.parsing.start=N.buffering.start=self.performance.now(),N.parsing.end=N.buffering.end=self.performance.now(),I.frag===j&&z.trigger(B.Events.FRAG_BUFFERED,{stats:N,frag:j,part:null,id:v.type}),S.tick()}).catch(function(I){S.warn(I),S.resetFragmentLoading(v)})},a.fragContextChanged=function(v){var S=this.fragCurrent;return!v||!S||v.level!==S.level||v.sn!==S.sn||v.urlId!==S.urlId},a.fragBufferedComplete=function(v,S){var I=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+v.type+" sn: "+v.sn+(S?" part: "+S.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level+" "+o.default.toString(G.BufferHelper.getBuffered(I))),this.state=E.IDLE,this.tick()},a._handleFragmentLoadComplete=function(v){var S=this.transmuxer;if(!S)return;var I=v.frag,j=v.part,z=v.partsLoaded,V=!z||z.length===0||z.some(function(N){return!N}),M=new x.ChunkMetadata(I.level,I.sn,I.stats.chunkCount+1,0,j?j.index:-1,!V);S.flush(M)},a._handleFragmentLoadProgress=function(v){},a._doFragLoad=function(v,S,I,j){var z=this;if(I===void 0&&(I=null),!this.levels)throw new Error("frag load aborted, missing levels");if(I=Math.max(v.start,I||0),this.config.lowLatencyMode&&S){var V=S.partList;if(V&&j){I>v.end&&S.fragmentHint&&(v=S.fragmentHint);var M=this.getNextPart(V,v,I);if(M>-1){var N=V[M];return this.log("Loading part sn: "+v.sn+" p: "+N.index+" cc: "+v.cc+" of playlist ["+S.startSN+"-"+S.endSN+"] parts [0-"+M+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(I.toFixed(3))),this.nextLoadPosition=N.start+N.duration,this.state=E.FRAG_LOADING,this.hls.trigger(B.Events.FRAG_LOADING,{frag:v,part:V[M],targetBufferTime:I}),this.doFragPartsLoad(v,V,M,j).catch(function($){return z.handleFragLoadError($)})}else if(!v.url||this.loadedEndOfParts(V,I))return Promise.resolve(null)}}return this.log("Loading fragment "+v.sn+" cc: "+v.cc+" "+(S?"of ["+S.startSN+"-"+S.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(I.toFixed(3))),Object(Z.isFiniteNumber)(v.sn)&&!this.bitrateTest&&(this.nextLoadPosition=v.start+v.duration),this.state=E.FRAG_LOADING,this.hls.trigger(B.Events.FRAG_LOADING,{frag:v,targetBufferTime:I}),this.fragmentLoader.load(v,j).catch(function($){return z.handleFragLoadError($)})},a.doFragPartsLoad=function(v,S,I,j){var z=this;return new Promise(function(V,M){var N=[],$=function ie(he){var me=S[he];z.fragmentLoader.loadPart(v,me,j).then(function(ke){N[me.index]=ke;var Se=ke.part;z.hls.trigger(B.Events.FRAG_LOADED,ke);var Re=S[he+1];if(Re&&Re.fragment===v)ie(he+1);else return V({frag:v,part:Se,partsLoaded:N})}).catch(M)};$(I)})},a.handleFragLoadError=function(v){var S=v.data;return S&&S.details===R.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(S.frag,S.part):this.hls.trigger(B.Events.ERROR,S),null},a._handleTransmuxerFlush=function(v){var S=this.getCurrentContext(v);if(!S||this.state!==E.PARSING){this.fragCurrent||(this.state=E.IDLE);return}var I=S.frag,j=S.part,z=S.level,V=self.performance.now();I.stats.parsing.end=V,j&&(j.stats.parsing.end=V),this.updateLevelTiming(I,j,z,v.partial)},a.getCurrentContext=function(v){var S=this.levels,I=v.level,j=v.sn,z=v.part;if(!S||!S[I])return this.warn("Levels object was unset while buffering fragment "+j+" of level "+I+". The current chunk will not be buffered."),null;var V=S[I],M=z>-1?Object(A.getPartWith)(V,j,z):null,N=M?M.fragment:Object(A.getFragmentWithSN)(V,j,this.fragCurrent);return N?{frag:N,part:M,level:V}:null},a.bufferFragmentData=function(v,S,I,j){if(!v||this.state!==E.PARSING)return;var z=v.data1,V=v.data2,M=z;if(z&&V&&(M=Object(w.appendUint8Array)(z,V)),!M||!M.length)return;var N={type:v.type,frag:S,part:I,chunkMeta:j,parent:S.type,data:M};this.hls.trigger(B.Events.BUFFER_APPENDING,N),v.dropped&&v.independent&&!I&&this.flushBufferGap(S)},a.flushBufferGap=function(v){var S=this.media;if(!S)return;if(!G.BufferHelper.isBuffered(S,S.currentTime)){this.flushMainBuffer(0,v.start);return}var I=S.currentTime,j=G.BufferHelper.bufferInfo(S,I,0),z=v.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,z*.25),M=Math.max(Math.min(v.start-V,j.end-V),I+V);v.start-M>V&&this.flushMainBuffer(M,v.start)},a.getFwdBufferInfo=function(v,S){var I=this.config,j=this.getLoadPosition();if(!Object(Z.isFiniteNumber)(j))return null;var z=G.BufferHelper.bufferInfo(v,j,I.maxBufferHole);if(z.len===0&&z.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(j,S);if(V&&z.nextStart<V.end)return G.BufferHelper.bufferInfo(v,j,Math.max(z.nextStart,I.maxBufferHole))}return z},a.getMaxBufferLength=function(v){var S=this.config,I;return v?I=Math.max(8*S.maxBufferSize/v,S.maxBufferLength):I=S.maxBufferLength,Math.min(I,S.maxMaxBufferLength)},a.reduceMaxBufferLength=function(v){var S=this.config,I=v||S.maxBufferLength;return S.maxMaxBufferLength>=I?(S.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+S.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(v,S){var I,j,z=S.fragments,V=z.length;if(!V)return null;var M=this.config,N=z[0].start,$;if(S.live){var ie=M.initialLiveManifestSize;if(V<ie)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+ie+")"),null;!S.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&($=this.getInitialLiveFragment(S,z),this.startPosition=$?this.hls.liveSyncPosition||$.start:v)}else v<=N&&($=z[0]);if(!$){var he=M.lowLatencyMode?S.partEnd:S.fragmentEnd;$=this.getFragmentAtPosition(v,he,S)}return(I=$)!==null&&I!==void 0&&I.initSegment&&!((j=$)!==null&&j!==void 0&&j.initSegment.data)&&!this.bitrateTest&&($=$.initSegment),$},a.getNextPart=function(v,S,I){for(var j=-1,z=!1,V=!0,M=0,N=v.length;M<N;M++){var $=v[M];if(V=V&&!$.independent,j>-1&&I<$.start)break;var ie=$.loaded;!ie&&(z||$.independent||V)&&$.fragment===S&&(j=M),z=ie}return j},a.loadedEndOfParts=function(v,S){var I=v[v.length-1];return I&&S>I.start&&I.loaded},a.getInitialLiveFragment=function(v,S){var I=this.fragPrevious,j=null;if(I){if(v.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+I.programDateTime),j=Object(L.findFragmentByPDT)(S,I.endProgramDateTime,this.config.maxFragLookUpTolerance)),!j){var z=I.sn+1;if(z>=v.startSN&&z<=v.endSN){var V=S[z-v.startSN];I.cc===V.cc&&(j=V,this.log("Live playlist, switching playlist, load frag with next SN: "+j.sn))}j||(j=Object(L.findFragWithCC)(S,I.cc),j&&this.log("Live playlist, switching playlist, load frag with same CC: "+j.sn))}}else{var M=this.hls.liveSyncPosition;M!==null&&(j=this.getFragmentAtPosition(M,this.bitrateTest?v.fragmentEnd:v.edge,v))}return j},a.getFragmentAtPosition=function(v,S,I){var j=this.config,z=this.fragPrevious,V=I.fragments,M=I.endSN,N=I.fragmentHint,$=j.maxFragLookUpTolerance,ie=!!(j.lowLatencyMode&&I.partList&&N);ie&&N&&!this.bitrateTest&&(V=V.concat(N),M=N.sn);var he;if(v<S){var me=v>S-$?0:$;he=Object(L.findFragmentByPTS)(z,V,v,me)}else he=V[V.length-1];if(he){var ke=he.sn-I.startSN,Se=z&&he.level===z.level,Re=V[ke+1],Te=this.fragmentTracker.getState(he);if(Te===k.FragmentState.BACKTRACKED){he=null;for(var _e=ke;V[_e]&&this.fragmentTracker.getState(V[_e])===k.FragmentState.BACKTRACKED;)z?he=V[_e--]:he=V[--_e];he||(he=Re)}else z&&he.sn===z.sn&&!ie&&(Se&&(he.sn<M&&this.fragmentTracker.getState(Re)!==k.FragmentState.OK?(this.log("SN "+he.sn+" just loaded, load next one: "+Re.sn),he=Re):he=null))}return he},a.synchronizeToLiveEdge=function(v){var S=this.config,I=this.media;if(!I)return;var j=this.hls.liveSyncPosition,z=I.currentTime,V=v.fragments[0].start,M=v.edge,N=z>=V-S.maxFragLookUpTolerance&&z<=M;if(j!==null&&I.duration>j&&(z<j||!N)){var $=S.liveMaxLatencyDuration!==void 0?S.liveMaxLatencyDuration:S.liveMaxLatencyDurationCount*v.targetduration;(!N&&I.readyState<4||z<M-$)&&(this.loadedmetadata||(this.nextLoadPosition=j),I.readyState&&(this.warn("Playback: "+z.toFixed(3)+" is located too far from the end of live sliding playlist: "+M+", reset currentTime to : "+j.toFixed(3)),I.currentTime=j))}},a.alignPlaylists=function(v,S){var I=this.levels,j=this.levelLastLoaded,z=this.fragPrevious,V=j!==null?I[j]:null,M=v.fragments.length;if(!M)return this.warn("No fragments in live playlist"),0;var N=v.fragments[0].start,$=!S,ie=v.alignedSliding&&Object(Z.isFiniteNumber)(N);if($||!ie&&!N){Object(P.alignStream)(z,V,v);var he=v.fragments[0].start;return this.log("Live playlist sliding: "+he.toFixed(2)+" start-sn: "+(S?S.startSN:"na")+"->"+v.startSN+" prev-sn: "+(z?z.sn:"na")+" fragments: "+M),he}return N},a.waitForCdnTuneIn=function(v){var S=3;return v.live&&v.canBlockReload&&v.tuneInGoal>Math.max(v.partHoldBack,v.partTarget*S)},a.setStartPosition=function(v,S){var I=this.startPosition;if(I<S&&(I=-1),I===-1||this.lastCurrentTime===-1){var j=v.startTimeOffset;Object(Z.isFiniteNumber)(j)?(I=S+j,j<0&&(I+=v.totalduration),I=Math.min(Math.max(S,I),S+v.totalduration),this.log("Start time offset "+j+" found in playlist, adjust startPosition to "+I),this.startPosition=I):v.live?I=this.hls.liveSyncPosition||S:this.startPosition=I=0,this.lastCurrentTime=I}this.nextLoadPosition=I},a.getLoadPosition=function(){var v=this.media,S=0;return this.loadedmetadata&&v?S=v.currentTime:this.nextLoadPosition&&(S=this.nextLoadPosition),S},a.handleFragLoadAborted=function(v,S){this.transmuxer&&v.sn!=="initSegment"&&v.stats.aborted&&(this.warn("Fragment "+v.sn+(S?" part"+S.index:"")+" of level "+v.level+" was aborted"),this.resetFragmentLoading(v))},a.resetFragmentLoading=function(v){(!this.fragCurrent||!this.fragContextChanged(v))&&(this.state=E.IDLE)},a.onFragmentOrKeyLoadError=function(v,S){if(S.fatal)return;var I=S.frag;if(!I||I.type!==v)return;var j=this.fragCurrent;console.assert(j&&I.sn===j.sn&&I.level===j.level&&I.urlId===j.urlId,"Frag load error must match current frag to retry");var z=this.config;if(this.fragLoadError+1<=z.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(I.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*z.fragLoadingRetryDelay,z.fragLoadingMaxRetryTimeout);this.warn("Fragment "+I.sn+" of "+v+" "+I.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=E.FRAG_LOADING_WAITING_RETRY}else S.levelRetry?(v===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=E.IDLE):(H.logger.error(S.details+" reaches max retry, redispatch as fatal ..."),S.fatal=!0,this.hls.stopLoad(),this.state=E.ERROR)},a.afterBufferFlushed=function(v,S,I){if(!v)return;var j=G.BufferHelper.getBuffered(v);this.fragmentTracker.detectEvictedFragments(S,j,I),this.state===E.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=E.IDLE},a.resetLiveStartWhenNotLoaded=function(v){if(!this.loadedmetadata){this.startFragRequested=!1;var S=this.levels?this.levels[v].details:null;if(S!=null&&S.live)return this.startPosition=-1,this.setStartPosition(S,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(v,S,I,j){var z=this,V=I.details;console.assert(!!V,"level.details must be defined");var M=Object.keys(v.elementaryStreams).reduce(function(N,$){var ie=v.elementaryStreams[$];if(ie){var he=ie.endPTS-ie.startPTS;if(he<=0)return z.warn("Could not parse fragment "+v.sn+" "+$+" duration reliably ("+he+") resetting transmuxer to fallback to playlist timing"),z.resetTransmuxer(),N||!1;var me=j?0:Object(A.updateFragPTSDTS)(V,v,ie.startPTS,ie.endPTS,ie.startDTS,ie.endDTS);return z.hls.trigger(B.Events.LEVEL_PTS_UPDATED,{details:V,level:I,drift:me,type:$,frag:v,start:ie.startPTS,end:ie.endPTS}),!0}return N},!1);M?(this.state=E.PARSED,this.hls.trigger(B.Events.FRAG_PARSED,{frag:v,part:S})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},T(u,[{key:"state",get:function(){return this._state},set:function(v){var S=this._state;S!==v&&(this._state=v,this.log(S+"->"+v))}}]),u}(F.default)},"./src/controller/buffer-controller.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return L});var Z=O("./src/polyfills/number.ts"),F=O("./src/events.ts"),k=O("./src/utils/logger.ts"),G=O("./src/errors.ts"),H=O("./src/utils/buffer-helper.ts"),B=O("./src/utils/mediasource-helper.ts"),R=O("./src/loader/fragment.ts"),x=O("./src/controller/buffer-operation-queue.ts"),w=Object(B.getMediaSource)(),P=/([ha]vc.)(?:\.[^.,]+)+/,L=function(){function A(h){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,T=o.mediaSource;k.logger.log("[buffer-controller]: Media source opened"),d&&(o.updateMediaElementDuration(),s.trigger(F.Events.MEDIA_ATTACHED,{media:d})),T&&T.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){k.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){k.logger.log("[buffer-controller]: Media source ended")},this.hls=h,this._initSourceBuffer(),this.registerListeners()}var _=A.prototype;return _.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},_.destroy=function(){this.unregisterListeners(),this.details=null},_.registerListeners=function(){var o=this.hls;o.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(F.Events.BUFFER_RESET,this.onBufferReset,this),o.on(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(F.Events.BUFFER_EOS,this.onBufferEos,this),o.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(F.Events.FRAG_PARSED,this.onFragParsed,this),o.on(F.Events.FRAG_CHANGED,this.onFragChanged,this)},_.unregisterListeners=function(){var o=this.hls;o.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(F.Events.BUFFER_RESET,this.onBufferReset,this),o.off(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(F.Events.BUFFER_EOS,this.onBufferEos,this),o.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(F.Events.FRAG_PARSED,this.onFragParsed,this),o.off(F.Events.FRAG_CHANGED,this.onFragChanged,this)},_._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new x.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},_.onManifestParsed=function(o,s){var d=2;(s.audio&&!s.video||!s.altAudio)&&(d=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=d,this.details=null,k.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},_.onMediaAttaching=function(o,s){var d=this.media=s.media;if(d&&w){var T=this.mediaSource=new w;T.addEventListener("sourceopen",this._onMediaSourceOpen),T.addEventListener("sourceended",this._onMediaSourceEnded),T.addEventListener("sourceclose",this._onMediaSourceClose),d.src=self.URL.createObjectURL(T),this._objectUrl=d.src}},_.onMediaDetaching=function(){var o=this.media,s=this.mediaSource,d=this._objectUrl;if(s){if(k.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(T){k.logger.warn("[buffer-controller]: onMediaDetaching: "+T.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()):k.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(F.Events.MEDIA_DETACHED,void 0)},_.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(T){k.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",T)}}),this._initSourceBuffer()},_.onBufferCodecs=function(o,s){var d=this,T=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(y){if(T){var m=d.tracks[y];if(m&&typeof m.buffer.changeType=="function"){var f=s[y],E=f.codec,p=f.levelCodec,g=f.container,u=(m.levelCodec||m.codec).replace(P,"$1"),a=(p||E).replace(P,"$1");if(u!==a){var b=g+";codecs="+(p||E);d.appendChangeType(y,b)}}}else d.pendingTracks[y]=s[y]}),T)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},_.appendChangeType=function(o,s){var d=this,T=this.operationQueue,y={execute:function(){var f=d.sourceBuffer[o];f&&(k.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+s),f.changeType(s)),T.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(f){k.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",f)}};T.append(y,o)},_.onBufferAppending=function(o,s){var d=this,T=this.hls,y=this.operationQueue,m=this.tracks,f=s.data,E=s.type,p=s.frag,g=s.part,u=s.chunkMeta,a=u.buffering[E],b=self.performance.now();a.start=b;var v=p.stats.buffering,S=g?g.stats.buffering:null;v.start===0&&(v.start=b),S&&S.start===0&&(S.start=b);var I=m.audio,j=E==="audio"&&u.id===1&&(I==null?void 0:I.container)==="audio/mpeg",z={execute:function(){if(a.executeStart=self.performance.now(),j){var M=d.sourceBuffer[E];if(M){var N=p.start-M.timestampOffset;Math.abs(N)>=.1&&(k.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+p.start+" (delta: "+N+") sn: "+p.sn+")"),M.timestampOffset=p.start)}}d.appendExecutor(f,E)},onStart:function(){},onComplete:function(){var M=self.performance.now();a.executeEnd=a.end=M,v.first===0&&(v.first=M),S&&S.first===0&&(S.first=M);var N=d.sourceBuffer,$={};for(var ie in N)$[ie]=H.BufferHelper.getBuffered(N[ie]);d.appendError=0,d.hls.trigger(F.Events.BUFFER_APPENDED,{type:E,frag:p,part:g,chunkMeta:u,parent:p.type,timeRanges:$})},onError:function(M){k.logger.error("[buffer-controller]: Error encountered while trying to append to the "+E+" SourceBuffer",M);var N={type:G.ErrorTypes.MEDIA_ERROR,parent:p.type,details:G.ErrorDetails.BUFFER_APPEND_ERROR,err:M,fatal:!1};M.code===DOMException.QUOTA_EXCEEDED_ERR?N.details=G.ErrorDetails.BUFFER_FULL_ERROR:(d.appendError++,N.details=G.ErrorDetails.BUFFER_APPEND_ERROR,d.appendError>T.config.appendErrorMaxRetry&&(k.logger.error("[buffer-controller]: Failed "+T.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),N.fatal=!0)),T.trigger(F.Events.ERROR,N)}};y.append(z,E)},_.onBufferFlushing=function(o,s){var d=this,T=this.operationQueue,y=function(f){return{execute:d.removeExecutor.bind(d,f,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){d.hls.trigger(F.Events.BUFFER_FLUSHED,{type:f})},onError:function(p){k.logger.warn("[buffer-controller]: Failed to remove from "+f+" SourceBuffer",p)}}};s.type?T.append(y(s.type),s.type):this.getSourceBufferTypes().forEach(function(m){T.append(y(m),m)})},_.onFragParsed=function(o,s){var d=this,T=s.frag,y=s.part,m=[],f=y?y.elementaryStreams:T.elementaryStreams;f[R.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(f[R.ElementaryStreamTypes.AUDIO]&&m.push("audio"),f[R.ElementaryStreamTypes.VIDEO]&&m.push("video"));var E=function(){var g=self.performance.now();T.stats.buffering.end=g,y&&(y.stats.buffering.end=g);var u=y?y.stats:T.stats;d.hls.trigger(F.Events.FRAG_BUFFERED,{frag:T,part:y,stats:u,id:T.type})};m.length===0&&k.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+T.type+" level: "+T.level+" sn: "+T.sn),this.blockBuffers(E,m)},_.onFragChanged=function(o,s){this.flushBackBuffer()},_.onBufferEos=function(o,s){var d=this,T=this.getSourceBufferTypes().reduce(function(y,m){var f=d.sourceBuffer[m];return(!s.type||s.type===m)&&(f&&!f.ended&&(f.ended=!0,k.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),y&&!!(!f||f.ended)},!0);T&&this.blockBuffers(function(){var y=d.mediaSource;if(!y||y.readyState!=="open")return;y.endOfStream()})},_.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()},_.flushBackBuffer=function(){var o=this.hls,s=this.details,d=this.media,T=this.sourceBuffer;if(!d||s===null)return;var y=this.getSourceBufferTypes();if(!y.length)return;var m=s.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(Z.isFiniteNumber)(m)||m<0)return;var f=d.currentTime,E=s.levelTargetDuration,p=Math.max(m,E),g=Math.floor(f/E)*E-p;y.forEach(function(u){var a=T[u];if(a){var b=H.BufferHelper.getBuffered(a);b.length>0&&g>b.start(0)&&(o.trigger(F.Events.BACK_BUFFER_REACHED,{bufferEnd:g}),s.live&&o.trigger(F.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:g}),o.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:g,type:u}))}})},_.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,s=this.hls,d=this.media,T=this.mediaSource,y=o.fragments[0].start+o.totalduration,m=d.duration,f=Object(Z.isFiniteNumber)(T.duration)?T.duration:0;o.live&&s.config.liveDurationInfinity?(k.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),T.duration=Infinity,this.updateSeekableRange(o)):(y>f&&y>m||!Object(Z.isFiniteNumber)(m))&&(k.logger.log("[buffer-controller]: Updating Media Source duration to "+y.toFixed(3)),T.duration=y)},_.updateSeekableRange=function(o){var s=this.mediaSource,d=o.fragments,T=d.length;if(T&&o.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var y=Math.max(0,d[0].start),m=Math.max(y,y+o.totalduration);s.setLiveSeekableRange(y,m)}},_.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,s=this.operationQueue,d=this.pendingTracks,T=Object.keys(d).length;if(T&&!o||T===2){this.createSourceBuffers(d),this.pendingTracks={};var y=this.getSourceBufferTypes();if(y.length===0){this.hls.trigger(F.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}y.forEach(function(m){s.executeNext(m)})}},_.createSourceBuffers=function(o){var s=this.sourceBuffer,d=this.mediaSource;if(!d)throw Error("createSourceBuffers called when mediaSource was null");var T=0;for(var y in o)if(!s[y]){var m=o[y];if(!m)throw Error("source buffer exists for track "+y+", however track does not");var f=m.levelCodec||m.codec,E=m.container+";codecs="+f;k.logger.log("[buffer-controller]: creating sourceBuffer("+E+")");try{var p=s[y]=d.addSourceBuffer(E),g=y;this.addBufferListener(g,"updatestart",this._onSBUpdateStart),this.addBufferListener(g,"updateend",this._onSBUpdateEnd),this.addBufferListener(g,"error",this._onSBUpdateError),this.tracks[y]={buffer:p,codec:f,container:m.container,levelCodec:m.levelCodec,id:m.id},T++}catch(u){k.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+u.message),this.hls.trigger(F.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,mimeType:E})}}T&&this.hls.trigger(F.Events.BUFFER_CREATED,{tracks:this.tracks})},_._onSBUpdateStart=function(o){var s=this.operationQueue,d=s.current(o);d.onStart()},_._onSBUpdateEnd=function(o){var s=this.operationQueue,d=s.current(o);d.onComplete(),s.shiftAndExecuteNext(o)},_._onSBUpdateError=function(o,s){k.logger.error("[buffer-controller]: "+o+" SourceBuffer error",s),this.hls.trigger(F.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var d=this.operationQueue.current(o);d&&d.onError(s)},_.removeExecutor=function(o,s,d){var T=this.media,y=this.mediaSource,m=this.operationQueue,f=this.sourceBuffer,E=f[o];if(!T||!y||!E){k.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(o);return}var p=Object(Z.isFiniteNumber)(T.duration)?T.duration:Infinity,g=Object(Z.isFiniteNumber)(y.duration)?y.duration:Infinity,u=Math.max(0,s),a=Math.min(d,p,g);a>u?(k.logger.log("[buffer-controller]: Removing ["+u+","+a+"] from the "+o+" SourceBuffer"),console.assert(!E.updating,o+" sourceBuffer must not be updating"),E.remove(u,a)):m.shiftAndExecuteNext(o)},_.appendExecutor=function(o,s){var d=this.operationQueue,T=this.sourceBuffer,y=T[s];if(!y){k.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),d.shiftAndExecuteNext(s);return}y.ended=!1,console.assert(!y.updating,s+" sourceBuffer must not be updating"),y.appendBuffer(o)},_.blockBuffers=function(o,s){var d=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){k.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var T=this.operationQueue,y=s.map(function(m){return T.appendBlocker(m)});Promise.all(y).then(function(){o(),s.forEach(function(m){var f=d.sourceBuffer[m];(!f||!f.updating)&&T.shiftAndExecuteNext(m)})})},_.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},_.addBufferListener=function(o,s,d){var T=this.sourceBuffer[o];if(!T)return;var y=d.bind(this,o);this.listeners[o].push({event:s,listener:y}),T.addEventListener(s,y)},_.removeBufferListeners=function(o){var s=this.sourceBuffer[o];if(!s)return;this.listeners[o].forEach(function(d){s.removeEventListener(d.event,d.listener)})},A}()},"./src/controller/buffer-operation-queue.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return F});var Z=O("./src/utils/logger.ts"),F=function(){function k(H){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=H}var G=k.prototype;return G.append=function(B,R){var x=this.queues[R];x.push(B),x.length===1&&this.buffers[R]&&this.executeNext(R)},G.insertAbort=function(B,R){var x=this.queues[R];x.unshift(B),this.executeNext(R)},G.appendBlocker=function(B){var R,x=new Promise(function(P){R=P}),w={execute:R,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(w,B),x},G.executeNext=function(B){var R=this.buffers,x=this.queues,w=R[B],P=x[B];if(P.length){var L=P[0];try{L.execute()}catch(A){Z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),L.onError(A),(!w||!w.updating)&&(P.shift(),this.executeNext(B))}}},G.shiftAndExecuteNext=function(B){this.queues[B].shift(),this.executeNext(B)},G.current=function(B){return this.queues[B][0]},k}()},"./src/controller/cap-level-controller.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/events.ts");function F(H,B){for(var R=0;R<B.length;R++){var x=B[R];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(H,x.key,x)}}function k(H,B,R){return B&&F(H.prototype,B),R&&F(H,R),H}var G=function(){function H(R){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=R,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var B=H.prototype;return B.setStreamController=function(x){this.streamController=x},B.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},B.registerListeners=function(){var x=this.hls;x.on(Z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),x.on(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),x.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.on(Z.Events.BUFFER_CODECS,this.onBufferCodecs,this),x.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},B.unregisterListener=function(){var x=this.hls;x.off(Z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),x.off(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),x.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.off(Z.Events.BUFFER_CODECS,this.onBufferCodecs,this),x.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},B.onFpsDropLevelCapping=function(x,w){H.isLevelAllowed(w.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(w.droppedLevel)},B.onMediaAttaching=function(x,w){this.media=w.media instanceof HTMLVideoElement?w.media:null},B.onManifestParsed=function(x,w){var P=this.hls;this.restrictedLevels=[],this.firstLevel=w.firstLevel,P.config.capLevelToPlayerSize&&w.video&&this.startCapping()},B.onBufferCodecs=function(x,w){var P=this.hls;P.config.capLevelToPlayerSize&&w.video&&this.startCapping()},B.onMediaDetaching=function(){this.stopCapping()},B.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var x=this.hls.levels;if(x.length){var w=this.hls;w.autoLevelCapping=this.getMaxLevel(x.length-1),w.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=w.autoLevelCapping}}},B.getMaxLevel=function(x){var w=this,P=this.hls.levels;if(!P.length)return-1;var L=P.filter(function(A,_){return H.isLevelAllowed(_,w.restrictedLevels)&&_<=x});return this.clientRect=null,H.getMaxLevelByMediaSize(L,this.mediaWidth,this.mediaHeight)},B.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()},B.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},B.getDimensions=function(){if(this.clientRect)return this.clientRect;var x=this.media,w={width:0,height:0};if(x){var P=x.getBoundingClientRect();w.width=P.width,w.height=P.height,!w.width&&!w.height&&(w.width=P.right-P.left||x.width||0,w.height=P.bottom-P.top||x.height||0)}return this.clientRect=w,w},H.isLevelAllowed=function(x,w){return w===void 0&&(w=[]),w.indexOf(x)===-1},H.getMaxLevelByMediaSize=function(x,w,P){if(!x||!x.length)return-1;for(var L=function(s,d){return d?s.width!==d.width||s.height!==d.height:!0},A=x.length-1,_=0;_<x.length;_+=1){var h=x[_];if((h.width>=w||h.height>=P)&&L(h,x[_+1])){A=_;break}}return A},k(H,[{key:"mediaWidth",get:function(){return this.getDimensions().width*H.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*H.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var x=1;try{x=self.devicePixelRatio}catch(w){}return x}}]),H}();J.default=G},"./src/controller/cmcd-controller.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return L});var Z=O("./src/events.ts"),F=O("./src/types/cmcd.ts"),k=O("./src/utils/buffer-helper.ts"),G=O("./src/utils/logger.ts");function H(A,_){for(var h=0;h<_.length;h++){var o=_[h];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(A,o.key,o)}}function B(A,_,h){return _&&H(A.prototype,_),h&&H(A,h),A}function R(A,_){var h=typeof Symbol!="undefined"&&A[Symbol.iterator]||A["@@iterator"];if(h)return(h=h.call(A)).next.bind(h);if(Array.isArray(A)||(h=x(A))||_&&A&&typeof A.length=="number"){h&&(A=h);var o=0;return function(){return o>=A.length?{done:!0}:{done:!1,value:A[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 x(A,_){if(!A)return;if(typeof A=="string")return w(A,_);var h=Object.prototype.toString.call(A).slice(8,-1);if(h==="Object"&&A.constructor&&(h=A.constructor.name),h==="Map"||h==="Set")return Array.from(A);if(h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h))return w(A,_)}function w(A,_){(_==null||_>A.length)&&(_=A.length);for(var h=0,o=new Array(_);h<_;h++)o[h]=A[h];return o}function P(){return P=Object.assign||function(A){for(var _=1;_<arguments.length;_++){var h=arguments[_];for(var o in h)Object.prototype.hasOwnProperty.call(h,o)&&(A[o]=h[o])}return A},P.apply(this,arguments)}var L=function(){function A(h){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(T){try{o.apply(T,{ot:F.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(y){G.logger.warn("Could not generate manifest CMCD data.",y)}},this.applyFragmentData=function(T){try{var y=T.frag,m=o.hls.levels[y.level],f=o.getObjectType(y),E={d:y.duration*1e3,ot:f};(f===F.CMCDObjectType.VIDEO||f===F.CMCDObjectType.AUDIO||f==F.CMCDObjectType.MUXED)&&(E.br=m.bitrate/1e3,E.tb=o.getTopBandwidth(f),E.bl=o.getBufferLength(f)),o.apply(T,E)}catch(p){G.logger.warn("Could not generate segment CMCD data.",p)}},this.hls=h;var s=this.config=h.config,d=s.cmcd;d!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=d.sessionId||A.uuid(),this.cid=d.contentId,this.useHeaders=d.useHeaders===!0,this.registerListeners())}var _=A.prototype;return _.registerListeners=function(){var o=this.hls;o.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(Z.Events.BUFFER_CREATED,this.onBufferCreated,this)},_.unregisterListeners=function(){var o=this.hls;o.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(Z.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},_.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},_.onMediaAttached=function(o,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},_.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},_.onBufferCreated=function(o,s){var d,T;this.audioBuffer=(d=s.tracks.audio)===null||d===void 0?void 0:d.buffer,this.videoBuffer=(T=s.tracks.video)===null||T===void 0?void 0:T.buffer},_.createData=function(){var o;return{v:F.CMCDVersion,sf:F.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},_.apply=function(o,s){s===void 0&&(s={}),P(s,this.createData());var d=s.ot===F.CMCDObjectType.INIT||s.ot===F.CMCDObjectType.VIDEO||s.ot===F.CMCDObjectType.MUXED;if(this.starved&&d&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var T=A.toHeaders(s);if(!Object.keys(T).length)return;o.headers||(o.headers={}),P(o.headers,T)}else{var y=A.toQuery(s);if(!y)return;o.url=A.appendQueryToUri(o.url,y)}},_.getObjectType=function(o){var s=o.type;return s==="subtitle"?F.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?F.CMCDObjectType.INIT:s==="audio"?F.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?F.CMCDObjectType.VIDEO:F.CMCDObjectType.MUXED:void 0},_.getTopBandwidth=function(o){for(var s=0,d=o===F.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,T=R(d),y;!(y=T()).done;){var m=y.value;m.bitrate>s&&(s=m.bitrate)}return s>0?s:NaN},_.getBufferLength=function(o){var s=this.hls.media,d=o===F.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!d||!s)return NaN;var T=k.BufferHelper.bufferInfo(d,s.currentTime,this.config.maxBufferHole);return T.len*1e3},_.createPlaylistLoader=function(){var o=this.config.pLoader,s=this.applyPlaylistData,d=o||this.config.loader;return function(){function T(m){this.loader=void 0,this.loader=new d(m)}var y=T.prototype;return y.destroy=function(){this.loader.destroy()},y.abort=function(){this.loader.abort()},y.load=function(f,E,p){s(f),this.loader.load(f,E,p)},B(T,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),T}()},_.createFragmentLoader=function(){var o=this.config.fLoader,s=this.applyFragmentData,d=o||this.config.loader;return function(){function T(m){this.loader=void 0,this.loader=new d(m)}var y=T.prototype;return y.destroy=function(){this.loader.destroy()},y.abort=function(){this.loader.abort()},y.load=function(f,E,p){s(f),this.loader.load(f,E,p)},B(T,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),T}()},A.uuid=function(){var o=URL.createObjectURL(new Blob),s=o.toString();return URL.revokeObjectURL(o),s.substr(s.lastIndexOf("/")+1)},A.serialize=function(o){for(var s=[],d=function(j){return!Number.isNaN(j)&&j!=null&&j!==""&&j!==!1},T=function(j){return Math.round(j)},y=function(j){return T(j/100)*100},m=function(j){return encodeURIComponent(j)},f={br:T,d:T,bl:y,dl:y,mtp:y,nor:m,rtp:y,tb:T},E=Object.keys(o||{}).sort(),p=R(E),g;!(g=p()).done;){var u=g.value,a=o[u];if(!d(a))continue;if(u==="v"&&a===1)continue;if(u=="pr"&&a===1)continue;var b=f[u];b&&(a=b(a));var v=typeof a,S=void 0;u==="ot"||u==="sf"||u==="st"?S=u+"="+a:v==="boolean"?S=u:v==="number"?S=u+"="+a:S=u+"="+JSON.stringify(a),s.push(S)}return s.join(",")},A.toHeaders=function(o){for(var s=Object.keys(o),d={},T=["Object","Request","Session","Status"],y=[{},{},{},{}],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},f=0,E=s;f<E.length;f++){var p=E[f],g=m[p]!=null?m[p]:1;y[g][p]=o[p]}for(var u=0;u<y.length;u++){var a=A.serialize(y[u]);a&&(d["CMCD-"+T[u]]=a)}return d},A.toQuery=function(o){return"CMCD="+encodeURIComponent(A.serialize(o))},A.appendQueryToUri=function(o,s){if(!s)return o;var d=o.includes("?")?"&":"?";return""+o+d+s},A}()},"./src/controller/eme-controller.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/events.ts"),F=O("./src/errors.ts"),k=O("./src/utils/logger.ts"),G=O("./src/utils/mediakeys-helper.ts");function H(L,A){for(var _=0;_<A.length;_++){var h=A[_];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(L,h.key,h)}}function B(L,A,_){return A&&H(L.prototype,A),_&&H(L,_),L}var R=3,x=function(A,_,h){var o={audioCapabilities:[],videoCapabilities:[]};return A.forEach(function(s){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:h.audioRobustness||""})}),_.forEach(function(s){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:h.videoRobustness||""})}),[o]},w=function(A,_,h,o){switch(A){case G.KeySystems.WIDEVINE:return x(_,h,o);default:throw new Error("Unknown key-system: "+A)}},P=function(){function L(_){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=_,this._config=_.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var A=L.prototype;return A.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},A._registerListeners=function(){this.hls.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},A._unregisterListeners=function(){this.hls.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},A.getLicenseServerUrl=function(h){switch(h){case G.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+h+'"')},A._attemptKeySystemAccess=function(h,o,s){var d=this,T=w(h,o,s,this._drmSystemOptions);k.logger.log("Requesting encrypted media key-system access");var y=this.requestMediaKeySystemAccess(h,T);this.mediaKeysPromise=y.then(function(m){return d._onMediaKeySystemAccessObtained(h,m)}),y.catch(function(m){k.logger.error('Failed to obtain key-system "'+h+'" access:',m)})},A._onMediaKeySystemAccessObtained=function(h,o){var s=this;k.logger.log('Access for key-system "'+h+'" obtained');var d={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:h};this._mediaKeysList.push(d);var T=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(y){return d.mediaKeys=y,k.logger.log('Media-keys created for key-system "'+h+'"'),s._onMediaKeysCreated(),y});return T.catch(function(y){k.logger.error("Failed to create media-keys:",y)}),T},A._onMediaKeysCreated=function(){var h=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),h._onNewMediaKeySession(o.mediaKeysSession))})},A._onNewMediaKeySession=function(h){var o=this;k.logger.log("New key-system session "+h.sessionId),h.addEventListener("message",function(s){o._onKeySessionMessage(h,s.message)},!1)},A._onKeySessionMessage=function(h,o){k.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(s){k.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),h.update(s)})},A.onMediaEncrypted=function(h){var o=this;if(k.logger.log('Media is encrypted using "'+h.initDataType+'" init data type'),!this.mediaKeysPromise){k.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(T){if(!o._media)return;o._attemptSetMediaKeys(T),o._generateRequestWithPreferredKeySession(h.initDataType,h.initData)};this.mediaKeysPromise.then(s).catch(s)},A._attemptSetMediaKeys=function(h){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){k.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}k.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},A._generateRequestWithPreferredKeySession=function(h,o){var s=this,d=this._mediaKeysList[0];if(!d){k.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(d.mediaKeysSessionInitialized){k.logger.warn("Key-Session already initialized but requested again");return}var T=d.mediaKeysSession;if(!T){k.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){k.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}k.logger.log('Generating key-session request for "'+h+'" init data type'),d.mediaKeysSessionInitialized=!0,T.generateRequest(h,o).then(function(){k.logger.debug("Key-session generation succeeded")}).catch(function(y){k.logger.error("Error generating key-session request:",y),s.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},A._createLicenseXhr=function(h,o,s){var d=new XMLHttpRequest;d.responseType="arraybuffer",d.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,d,h,o,s);var T=this._licenseXhrSetup;if(T)try{T.call(this.hls,d,h),T=void 0}catch(y){k.logger.error(y)}try{d.readyState||d.open("POST",h,!0),T&&T.call(this.hls,d,h)}catch(y){throw new Error("issue setting up KeySystem license XHR "+y)}return d},A._onLicenseRequestReadyStageChange=function(h,o,s,d){switch(h.readyState){case 4:if(h.status===200){this._requestLicenseFailureCount=0,k.logger.log("License request succeeded");var T=h.response,y=this._licenseResponseCallback;if(y)try{T=y.call(this.hls,h,o)}catch(f){k.logger.error(f)}d(T)}else{if(k.logger.error("License Request XHR failed ("+o+"). Status: "+h.status+" ("+h.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>R){this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=R-this._requestLicenseFailureCount+1;k.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(s,d)}break}},A._generateLicenseRequestChallenge=function(h,o){switch(h.mediaKeySystemDomain){case G.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+h.mediaKeySystemDomain)},A._requestLicense=function(h,o){k.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){k.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var d=this.getLicenseServerUrl(s.mediaKeySystemDomain),T=this._createLicenseXhr(d,h,o);k.logger.log("Sending license request to URL: "+d);var y=this._generateLicenseRequestChallenge(s,h);T.send(y)}catch(m){k.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},A.onMediaAttached=function(h,o){if(!this._emeEnabled)return;var s=o.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},A.onMediaDetached=function(){var h=this._media,o=this._mediaKeysList;if(!h)return;h.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 h.setMediaKeys(null)}).catch(function(){})},A.onManifestParsed=function(h,o){if(!this._emeEnabled)return;var s=o.levels.map(function(T){return T.audioCodec}).filter(function(T){return!!T}),d=o.levels.map(function(T){return T.videoCodec}).filter(function(T){return!!T});this._attemptKeySystemAccess(G.KeySystems.WIDEVINE,s,d)},B(L,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),L}();J.default=P},"./src/controller/fps-controller.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/events.ts"),F=O("./src/utils/logger.ts"),k=function(){function G(B){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=B,this.registerListeners()}var H=G.prototype;return H.setStreamController=function(R){this.streamController=R},H.registerListeners=function(){this.hls.on(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},H.unregisterListeners=function(){this.hls.off(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},H.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},H.onMediaAttaching=function(R,x){var w=this.hls.config;if(w.capLevelOnFPSDrop){var P=x.media instanceof self.HTMLVideoElement?x.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),w.fpsDroppedMonitoringPeriod)}},H.checkFPS=function(R,x,w){var P=performance.now();if(x){if(this.lastTime){var L=P-this.lastTime,A=w-this.lastDroppedFrames,_=x-this.lastDecodedFrames,h=1e3*A/L,o=this.hls;if(o.trigger(Z.Events.FPS_DROP,{currentDropped:A,currentDecoded:_,totalDroppedFrames:w}),h>0&&A>o.config.fpsDroppedMonitoringThreshold*_){var s=o.currentLevel;F.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=s)&&(s=s-1,o.trigger(Z.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:o.currentLevel}),o.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=P,this.lastDroppedFrames=w,this.lastDecodedFrames=x}},H.checkFPSInterval=function(){var R=this.media;if(R)if(this.isVideoPlaybackQualityAvailable){var x=R.getVideoPlaybackQuality();this.checkFPS(R,x.totalVideoFrames,x.droppedVideoFrames)}else this.checkFPS(R,R.webkitDecodedFrameCount,R.webkitDroppedFrameCount)},G}();J.default=k},"./src/controller/fragment-finders.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"findFragmentByPDT",function(){return k}),O.d(J,"findFragmentByPTS",function(){return G}),O.d(J,"fragmentWithinToleranceTest",function(){return H}),O.d(J,"pdtWithinToleranceTest",function(){return B}),O.d(J,"findFragWithCC",function(){return R});var Z=O("./src/polyfills/number.ts"),F=O("./src/utils/binary-search.ts");function k(x,w,P){if(w===null||!Array.isArray(x)||!x.length||!Object(Z.isFiniteNumber)(w))return null;var L=x[0].programDateTime;if(w<(L||0))return null;var A=x[x.length-1].endProgramDateTime;if(w>=(A||0))return null;P=P||0;for(var _=0;_<x.length;++_){var h=x[_];if(B(w,P,h))return h}return null}function G(x,w,P,L){P===void 0&&(P=0),L===void 0&&(L=0);var A=null;if(x?A=w[x.sn-w[0].sn+1]||null:P===0&&w[0].start===0&&(A=w[0]),A&&H(P,L,A)===0)return A;var _=F.default.search(w,H.bind(null,P,L));return _||A}function H(x,w,P){x===void 0&&(x=0),w===void 0&&(w=0);var L=Math.min(w,P.duration+(P.deltaPTS?P.deltaPTS:0));return P.start+P.duration-L<=x?1:P.start-L>x&&P.start?-1:0}function B(x,w,P){var L=Math.min(w,P.duration+(P.deltaPTS?P.deltaPTS:0))*1e3,A=P.endProgramDateTime||0;return A-L>x}function R(x,w){return F.default.search(x,function(P){return P.cc<w?1:P.cc>w?-1:0})}},"./src/controller/fragment-tracker.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"FragmentState",function(){return k}),O.d(J,"FragmentTracker",function(){return G});var Z=O("./src/events.ts"),F=O("./src/types/loader.ts"),k;(function(R){R.NOT_LOADED="NOT_LOADED",R.BACKTRACKED="BACKTRACKED",R.APPENDING="APPENDING",R.PARTIAL="PARTIAL",R.OK="OK"})(k||(k={}));var G=function(){function R(w){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=w,this._registerListeners()}var x=R.prototype;return x._registerListeners=function(){var P=this.hls;P.on(Z.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.on(Z.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.on(Z.Events.FRAG_LOADED,this.onFragLoaded,this)},x._unregisterListeners=function(){var P=this.hls;P.off(Z.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.off(Z.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.off(Z.Events.FRAG_LOADED,this.onFragLoaded,this)},x.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},x.getAppendedFrag=function(P,L){if(L===F.PlaylistLevelType.MAIN){var A=this.activeFragment,_=this.activeParts;if(!A)return null;if(_)for(var h=_.length;h--;){var o=_[h],s=o?o.end:A.appendedPTS;if(o.start<=P&&s!==void 0&&P<=s)return h>9&&(this.activeParts=_.slice(h-9)),o}else if(A.start<=P&&A.appendedPTS!==void 0&&P<=A.appendedPTS)return A}return this.getBufferedFrag(P,L)},x.getBufferedFrag=function(P,L){for(var A=this.fragments,_=Object.keys(A),h=_.length;h--;){var o=A[_[h]];if((o==null?void 0:o.body.type)===L&&o.buffered){var s=o.body;if(s.start<=P&&P<=s.end)return s}}return null},x.detectEvictedFragments=function(P,L,A){var _=this;Object.keys(this.fragments).forEach(function(h){var o=_.fragments[h];if(!o)return;if(!o.buffered){o.body.type===A&&_.removeFragment(o.body);return}var s=o.range[P];if(!s)return;s.time.some(function(d){var T=!_.isTimeBuffered(d.startPTS,d.endPTS,L);return T&&_.removeFragment(o.body),T})})},x.detectPartialFragments=function(P){var L=this,A=this.timeRanges,_=P.frag,h=P.part;if(!A||_.sn==="initSegment")return;var o=B(_),s=this.fragments[o];if(!s)return;Object.keys(A).forEach(function(d){var T=_.elementaryStreams[d];if(!T)return;var y=A[d],m=h!==null||T.partial===!0;s.range[d]=L.getBufferedTimes(_,h,m,y)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},x.fragBuffered=function(P){var L=B(P),A=this.fragments[L];A&&(A.backtrack=A.loaded=null,A.buffered=!0)},x.getBufferedTimes=function(P,L,A,_){for(var h={time:[],partial:A},o=L?L.start:P.start,s=L?L.end:P.end,d=P.minEndPTS||s,T=P.maxStartPTS||o,y=0;y<_.length;y++){var m=_.start(y)-this.bufferPadding,f=_.end(y)+this.bufferPadding;if(T>=m&&d<=f){h.time.push({startPTS:Math.max(o,_.start(y)),endPTS:Math.min(s,_.end(y))});break}else if(o<f&&s>m)h.partial=!0,h.time.push({startPTS:Math.max(o,_.start(y)),endPTS:Math.min(s,_.end(y))});else if(s<=m)break}return h},x.getPartialFragment=function(P){var L=null,A,_,h,o=0,s=this.bufferPadding,d=this.fragments;return Object.keys(d).forEach(function(T){var y=d[T];if(!y)return;H(y)&&(_=y.body.start-s,h=y.body.end+s,P>=_&&P<=h&&(A=Math.min(P-_,h-P),o<=A&&(L=y.body,o=A)))}),L},x.getState=function(P){var L=B(P),A=this.fragments[L];return A?A.buffered?H(A)?k.PARTIAL:k.OK:A.backtrack?k.BACKTRACKED:k.APPENDING:k.NOT_LOADED},x.backtrack=function(P,L){var A=B(P),_=this.fragments[A];if(!_||_.backtrack)return null;var h=_.backtrack=L||_.loaded;return _.loaded=null,h},x.getBacktrackData=function(P){var L=B(P),A=this.fragments[L];if(A){var _,h=A.backtrack;if(h!=null&&(_=h.payload)!==null&&_!==void 0&&_.byteLength)return h;this.removeFragment(P)}return null},x.isTimeBuffered=function(P,L,A){for(var _,h,o=0;o<A.length;o++){if(_=A.start(o)-this.bufferPadding,h=A.end(o)+this.bufferPadding,P>=_&&L<=h)return!0;if(L<=_)return!1}return!1},x.onFragLoaded=function(P,L){var A=L.frag,_=L.part;if(A.sn==="initSegment"||A.bitrateTest||_)return;var h=B(A);this.fragments[h]={body:A,loaded:L,backtrack:null,buffered:!1,range:Object.create(null)}},x.onBufferAppended=function(P,L){var A=this,_=L.frag,h=L.part,o=L.timeRanges;if(_.type===F.PlaylistLevelType.MAIN)if(this.activeFragment=_,h){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(h)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(d){var T=o[d];if(A.detectEvictedFragments(d,T),!h)for(var y=0;y<T.length;y++)_.appendedPTS=Math.max(T.end(y),_.appendedPTS||0)})},x.onFragBuffered=function(P,L){this.detectPartialFragments(L)},x.hasFragment=function(P){var L=B(P);return!!this.fragments[L]},x.removeFragmentsInRange=function(P,L,A){var _=this;Object.keys(this.fragments).forEach(function(h){var o=_.fragments[h];if(!o)return;if(o.buffered){var s=o.body;s.type===A&&s.start<L&&s.end>P&&_.removeFragment(s)}})},x.removeFragment=function(P){var L=B(P);P.stats.loaded=0,P.clearElementaryStreamInfo(),delete this.fragments[L]},x.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},R}();function H(R){var x,w;return R.buffered&&(((x=R.range.video)===null||x===void 0?void 0:x.partial)||((w=R.range.audio)===null||w===void 0?void 0:w.partial))}function B(R){return R.type+"_"+R.level+"_"+R.urlId+"_"+R.sn}},"./src/controller/gap-controller.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"STALL_MINIMUM_DURATION_MS",function(){return H}),O.d(J,"MAX_START_GAP_JUMP",function(){return B}),O.d(J,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return R}),O.d(J,"SKIP_BUFFER_RANGE_START",function(){return x}),O.d(J,"default",function(){return w});var Z=O("./src/utils/buffer-helper.ts"),F=O("./src/errors.ts"),k=O("./src/events.ts"),G=O("./src/utils/logger.ts"),H=250,B=2,R=.1,x=.05,w=function(){function P(A,_,h,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=A,this.media=_,this.fragmentTracker=h,this.hls=o}var L=P.prototype;return L.destroy=function(){this.hls=this.fragmentTracker=this.media=null},L.poll=function(_){var h=this.config,o=this.media,s=this.stalled,d=o.currentTime,T=o.seeking,y=this.seeking&&!T,m=!this.seeking&&T;if(this.seeking=T,d!==_){if(this.moved=!0,s!==null){if(this.stallReported){var f=self.performance.now()-s;G.logger.warn("playback not stuck anymore @"+d+", after "+Math.round(f)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||y)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!Z.BufferHelper.getBuffered(o).length)return;var E=Z.BufferHelper.bufferInfo(o,d,0),p=E.len>0,g=E.nextStart||0;if(!p&&!g)return;if(T){var u=E.len>B,a=!g||g-d>B&&!this.fragmentTracker.getPartialFragment(d);if(u||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var b,v=Math.max(g,E.start||0)-d,S=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,I=S==null||((b=S.details)===null||b===void 0)?void 0:b.live,j=I?S.details.targetduration*2:B;if(v>0&&v<=j){this._trySkipBufferHole(null);return}}var z=self.performance.now();if(s===null){this.stalled=z;return}var V=z-s;!T&&V>=H&&this._reportStall(E.len);var M=Z.BufferHelper.bufferInfo(o,d,h.maxBufferHole);this._tryFixBufferStall(M,V)},L._tryFixBufferStall=function(_,h){var o=this.config,s=this.fragmentTracker,d=this.media,T=d.currentTime,y=s.getPartialFragment(T);if(y){var m=this._trySkipBufferHole(y);if(m)return}_.len>o.maxBufferHole&&h>o.highBufferWatchdogPeriod*1e3&&(G.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},L._reportStall=function(_){var h=this.hls,o=this.media,s=this.stallReported;s||(this.stallReported=!0,G.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+_+")"),h.trigger(k.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:_}))},L._trySkipBufferHole=function(_){for(var h=this.config,o=this.hls,s=this.media,d=s.currentTime,T=0,y=Z.BufferHelper.getBuffered(s),m=0;m<y.length;m++){var f=y.start(m);if(d+h.maxBufferHole>=T&&d<f){var E=Math.max(f+x,s.currentTime+R);return G.logger.warn("skipping hole, adjusting currentTime from "+d+" to "+E),this.moved=!0,this.stalled=null,s.currentTime=E,_&&o.trigger(k.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+d+" to "+E,frag:_}),E}T=y.end(m)}return 0},L._tryNudgeBuffer=function(){var _=this.config,h=this.hls,o=this.media,s=o.currentTime,d=(this.nudgeRetry||0)+1;if(this.nudgeRetry=d,d<_.nudgeMaxRetry){var T=s+d*_.nudgeOffset;G.logger.warn("Nudging 'currentTime' from "+s+" to "+T),o.currentTime=T,h.trigger(k.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else G.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+_.nudgeMaxRetry+" nudges"),h.trigger(k.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},P}()},"./src/controller/id3-track-controller.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/events.ts"),F=O("./src/utils/texttrack-utils.ts"),k=O("./src/demux/id3.ts"),G=.25,H=function(){function B(x){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=x,this._registerListeners()}var R=B.prototype;return R.destroy=function(){this._unregisterListeners()},R._registerListeners=function(){var w=this.hls;w.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.on(Z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),w.on(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R._unregisterListeners=function(){var w=this.hls;w.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.off(Z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),w.off(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R.onMediaAttached=function(w,P){this.media=P.media},R.onMediaDetaching=function(){if(!this.id3Track)return;Object(F.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},R.getID3Track=function(w){if(!this.media)return;for(var P=0;P<w.length;P++){var L=w[P];if(L.kind==="metadata"&&L.label==="id3")return Object(F.sendAddTrackEvent)(L,this.media),L}return this.media.addTextTrack("metadata","id3")},R.onFragParsingMetadata=function(w,P){if(!this.media)return;var L=P.frag,A=P.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var _=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,h=0;h<A.length;h++){var o=k.getID3Frames(A[h].data);if(o){var s=A[h].pts,d=h<A.length-1?A[h+1].pts:L.end,T=d-s;T<=0&&(d=s+G);for(var y=0;y<o.length;y++){var m=o[y];if(!k.isTimeStampFrame(m)){var f=new _(s,d,"");f.value=m,this.id3Track.addCue(f)}}}}},R.onBufferFlushing=function(w,P){var L=P.startOffset,A=P.endOffset,_=P.type;if(!_||_==="audio"){var h=this.id3Track;h&&Object(F.removeCuesInRange)(h,L,A)}},B}();J.default=H},"./src/controller/latency-controller.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return B});var Z=O("./src/errors.ts"),F=O("./src/events.ts"),k=O("./src/utils/logger.ts");function G(R,x){for(var w=0;w<x.length;w++){var P=x[w];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(R,P.key,P)}}function H(R,x,w){return x&&G(R.prototype,x),w&&G(R,w),R}var B=function(){function R(w){var P=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return P.timeupdate()},this.hls=w,this.config=w.config,this.registerListeners()}var x=R.prototype;return x.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},x.registerListeners=function(){this.hls.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(F.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){this.hls.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(F.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(F.Events.ERROR,this.onError)},x.onMediaAttached=function(P,L){this.media=L.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},x.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},x.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},x.onLevelUpdated=function(P,L){var A=L.details;this.levelDetails=A,A.advanced&&this.timeupdate(),!A.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},x.onError=function(P,L){if(L.details!==Z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,k.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},x.timeupdate=function(){var P=this.media,L=this.levelDetails;if(!P||!L)return;this.currentTime=P.currentTime;var A=this.computeLatency();if(A===null)return;this._latency=A;var _=this.config,h=_.lowLatencyMode,o=_.maxLiveSyncPlaybackRate;if(!h||o===1)return;var s=this.targetLatency;if(s===null)return;var d=A-s,T=Math.min(this.maxLatency,s+L.targetduration),y=d<T;if(L.live&&y&&d>.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,o)),f=Math.round(2/(1+Math.exp(-.75*d-this.edgeStalled))*20)/20;P.playbackRate=Math.min(m,Math.max(1,f))}else P.playbackRate!==1&&P.playbackRate!==0&&(P.playbackRate=1)},x.estimateLiveEdge=function(){var P=this.levelDetails;return P===null?null:P.edge+P.age},x.computeLatency=function(){var P=this.estimateLiveEdge();return P===null?null:P-this.currentTime},H(R,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var P=this.config,L=this.levelDetails;return P.liveMaxLatencyDuration!==void 0?P.liveMaxLatencyDuration:L?P.liveMaxLatencyDurationCount*L.targetduration:0}},{key:"targetLatency",get:function(){var P=this.levelDetails;if(P===null)return null;var L=P.holdBack,A=P.partHoldBack,_=P.targetduration,h=this.config,o=h.liveSyncDuration,s=h.liveSyncDurationCount,d=h.lowLatencyMode,T=this.hls.userConfig,y=d&&A||L;(T.liveSyncDuration||T.liveSyncDurationCount||y===0)&&(y=o!==void 0?o:s*_);var m=_,f=1;return y+Math.min(this.stallCount*f,m)}},{key:"liveSyncPosition",get:function(){var P=this.estimateLiveEdge(),L=this.targetLatency,A=this.levelDetails;if(P===null||L===null||A===null)return null;var _=A.edge,h=P-L-this.edgeStalled,o=_-A.totalduration,s=_-(this.config.lowLatencyMode&&A.partTarget||A.targetduration);return Math.min(Math.max(o,h),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 L=(this.config.lowLatencyMode&&P.partTarget||P.targetduration)*3;return Math.max(P.age-L,0)}},{key:"forwardBufferLength",get:function(){var P=this.media,L=this.levelDetails;if(!P||!L)return 0;var A=P.buffered.length;return A?P.buffered.end(A-1):L.edge-this.currentTime}}]),R}()},"./src/controller/level-controller.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return h});var Z=O("./src/types/level.ts"),F=O("./src/events.ts"),k=O("./src/errors.ts"),G=O("./src/utils/codecs.ts"),H=O("./src/controller/level-helper.ts"),B=O("./src/controller/base-playlist-controller.ts"),R=O("./src/types/loader.ts");function x(){return x=Object.assign||function(o){for(var s=1;s<arguments.length;s++){var d=arguments[s];for(var T in d)Object.prototype.hasOwnProperty.call(d,T)&&(o[T]=d[T])}return o},x.apply(this,arguments)}function w(o,s){for(var d=0;d<s.length;d++){var T=s[d];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(o,T.key,T)}}function P(o,s,d){return s&&w(o.prototype,s),d&&w(o,d),o}function L(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,A(o,s)}function A(o,s){return A=Object.setPrototypeOf||function(T,y){return T.__proto__=y,T},A(o,s)}var _=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),h=function(o){L(s,o);function s(T){var y;return y=o.call(this,T,"[level-controller]")||this,y._levels=[],y._firstLevel=-1,y._startLevel=void 0,y.currentLevelIndex=-1,y.manualLevelIndex=-1,y.onParsedComplete=void 0,y._registerListeners(),y}var d=s.prototype;return d._registerListeners=function(){var y=this.hls;y.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),y.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),y.on(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),y.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),y.on(F.Events.ERROR,this.onError,this)},d._unregisterListeners=function(){var y=this.hls;y.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),y.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),y.off(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),y.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),y.off(F.Events.ERROR,this.onError,this)},d.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},d.startLoad=function(){var y=this._levels;y.forEach(function(m){m.loadError=0}),o.prototype.startLoad.call(this)},d.onManifestLoaded=function(y,m){var f=[],E=[],p=[],g,u={},a,b=!1,v=!1,S=!1;if(m.levels.forEach(function(V){var M=V.attrs;b=b||!!(V.width&&V.height),v=v||!!V.videoCodec,S=S||!!V.audioCodec,_&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var N=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;a=u[N],a?a.url.push(V.url):(a=new Z.Level(V),u[N]=a,f.push(a)),M&&(M.AUDIO&&Object(H.addGroupId)(a,"audio",M.AUDIO),M.SUBTITLES&&Object(H.addGroupId)(a,"text",M.SUBTITLES))}),(b||v)&&S&&(f=f.filter(function(V){var M=V.videoCodec,N=V.width,$=V.height;return!!M||!!(N&&$)})),f=f.filter(function(V){var M=V.audioCodec,N=V.videoCodec;return(!M||Object(G.isCodecSupportedInMp4)(M,"audio"))&&(!N||Object(G.isCodecSupportedInMp4)(N,"video"))}),m.audioTracks&&(E=m.audioTracks.filter(function(V){return!V.audioCodec||Object(G.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(H.assignTrackIdsByGroup)(E)),m.subtitles&&(p=m.subtitles,Object(H.assignTrackIdsByGroup)(p)),f.length>0){g=f[0].bitrate,f.sort(function(V,M){return V.bitrate-M.bitrate}),this._levels=f;for(var I=0;I<f.length;I++)if(f[I].bitrate===g){this._firstLevel=I,this.log("manifest loaded, "+f.length+" level(s) found, first bitrate: "+g);break}var j=S&&!v,z={levels:f,audioTracks:E,subtitleTracks:p,firstLevel:this._firstLevel,stats:m.stats,audio:S,video:v,altAudio:!j&&E.some(function(V){return!!V.url})};this.hls.trigger(F.Events.MANIFEST_PARSED,z),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(F.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:m.url,reason:"no level with compatible codecs found in manifest"})},d.onError=function(y,m){if(o.prototype.onError.call(this,y,m),m.fatal)return;var f=m.context,E=this._levels[this.currentLevelIndex];if(f&&(f.type===R.PlaylistContextType.AUDIO_TRACK&&E.audioGroupIds&&f.groupId===E.audioGroupIds[E.urlId]||f.type===R.PlaylistContextType.SUBTITLE_TRACK&&E.textGroupIds&&f.groupId===E.textGroupIds[E.urlId])){this.redundantFailover(this.currentLevelIndex);return}var p=!1,g=!0,u;switch(m.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:case k.ErrorDetails.KEY_LOAD_ERROR:case k.ErrorDetails.KEY_LOAD_TIMEOUT:if(m.frag){var a=this._levels[m.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(u=m.frag.level)):u=m.frag.level}break;case k.ErrorDetails.LEVEL_LOAD_ERROR:case k.ErrorDetails.LEVEL_LOAD_TIMEOUT:f&&(f.deliveryDirectives&&(g=!1),u=f.level),p=!0;break;case k.ErrorDetails.REMUX_ALLOC_ERROR:u=m.level,p=!0;break}u!==void 0&&this.recoverLevel(m,u,p,g)},d.recoverLevel=function(y,m,f,E){var p=y.details,g=this._levels[m];if(g.loadError++,f){var u=this.retryLoadingOrFail(y);if(u)y.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(E){var a=g.url.length;if(a>1&&g.loadError<a)y.levelRetry=!0,this.redundantFailover(m);else if(this.manualLevelIndex===-1){var b=m===0?this._levels.length-1:m-1;this.currentLevelIndex!==b&&this._levels[b].loadError===0&&(this.warn(p+": switch to "+b),y.levelRetry=!0,this.hls.nextAutoLevel=b)}}},d.redundantFailover=function(y){var m=this._levels[y],f=m.url.length;if(f>1){var E=(m.urlId+1)%f;this.warn("Switching to redundant URL-id "+E),this._levels.forEach(function(p){p.urlId=E}),this.level=y}},d.onFragLoaded=function(y,m){var f=m.frag;if(f!==void 0&&f.type===R.PlaylistLevelType.MAIN){var E=this._levels[f.level];E!==void 0&&(E.fragmentError=0,E.loadError=0)}},d.onLevelLoaded=function(y,m){var f,E=m.level,p=m.details,g=this._levels[E];if(!g){var u;this.warn("Invalid level index "+E),(u=m.deliveryDirectives)!==null&&u!==void 0&&u.skip&&(p.deltaUpdateFailed=!0);return}E===this.currentLevelIndex?(g.fragmentError===0&&(g.loadError=0,this.retryCount=0),this.playlistLoaded(E,m,g.details)):(f=m.deliveryDirectives)!==null&&f!==void 0&&f.skip&&(p.deltaUpdateFailed=!0)},d.onAudioTrackSwitched=function(y,m){var f=this.hls.levels[this.currentLevelIndex];if(!f)return;if(f.audioGroupIds){for(var E=-1,p=this.hls.audioTracks[m.id].groupId,g=0;g<f.audioGroupIds.length;g++)if(f.audioGroupIds[g]===p){E=g;break}E!==f.urlId&&(f.urlId=E,this.startLoad())}},d.loadPlaylist=function(y){var m=this.currentLevelIndex,f=this._levels[m];if(this.canLoad&&f&&f.url.length>0){var E=f.urlId,p=f.url[E];if(y)try{p=y.addDirectives(p)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("Attempt loading level index "+m+(y?" at sn "+y.msn+" part "+y.part:"")+" with URL-id "+E+" "+p),this.clearTimer(),this.hls.trigger(F.Events.LEVEL_LOADING,{url:p,level:m,id:E,deliveryDirectives:y||null})}},d.removeLevel=function(y,m){var f=function(g,u){return u!==m},E=this._levels.filter(function(p,g){return g!==y?!0:p.url.length>1&&m!==void 0?(p.url=p.url.filter(f),p.audioGroupIds&&(p.audioGroupIds=p.audioGroupIds.filter(f)),p.textGroupIds&&(p.textGroupIds=p.textGroupIds.filter(f)),p.urlId=0,!0):!1}).map(function(p,g){var u=p.details;return u!=null&&u.fragments&&u.fragments.forEach(function(a){a.level=g}),p});this._levels=E,this.hls.trigger(F.Events.LEVELS_UPDATED,{levels:E})},P(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(y){var m,f=this._levels;if(f.length===0)return;if(this.currentLevelIndex===y&&(m=f[y])!==null&&m!==void 0&&m.details)return;if(y<0||y>=f.length){var E=y<0;if(this.hls.trigger(F.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.LEVEL_SWITCH_ERROR,level:y,fatal:E,reason:"invalid level idx"}),E)return;y=Math.min(y,f.length-1)}this.clearTimer();var p=this.currentLevelIndex,g=f[p],u=f[y];this.log("switching to level "+y+" from "+p),this.currentLevelIndex=y;var a=x({},u,{level:y,maxBitrate:u.maxBitrate,uri:u.uri,urlId:u.urlId});delete a._urlId,this.hls.trigger(F.Events.LEVEL_SWITCHING,a);var b=u.details;if(!b||b.live){var v=this.switchParams(u.uri,g==null?void 0:g.details);this.loadPlaylist(v)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(y){this.manualLevelIndex=y,this._startLevel===void 0&&(this._startLevel=y),y!==-1&&(this.level=y)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(y){this._firstLevel=y}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var y=this.hls.config.startLevel;return y!==void 0?y:this._firstLevel}else return this._startLevel},set:function(y){this._startLevel=y}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(y){this.level=y,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=y)}}]),s}(B.default)},"./src/controller/level-helper.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"addGroupId",function(){return k}),O.d(J,"assignTrackIdsByGroup",function(){return G}),O.d(J,"updatePTS",function(){return H}),O.d(J,"updateFragPTSDTS",function(){return R}),O.d(J,"mergeDetails",function(){return x}),O.d(J,"mapPartIntersection",function(){return w}),O.d(J,"mapFragmentIntersection",function(){return P}),O.d(J,"adjustSliding",function(){return L}),O.d(J,"addSliding",function(){return A}),O.d(J,"computeReloadInterval",function(){return _}),O.d(J,"getFragmentWithSN",function(){return h}),O.d(J,"getPartWith",function(){return o});var Z=O("./src/polyfills/number.ts"),F=O("./src/utils/logger.ts");function k(s,d,T){switch(d){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(T);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(T);break}}function G(s){var d={};s.forEach(function(T){var y=T.groupId||"";T.id=d[y]=d[y]||0,d[y]++})}function H(s,d,T){var y=s[d],m=s[T];B(y,m)}function B(s,d){var T=d.startPTS;if(Object(Z.isFiniteNumber)(T)){var y=0,m;d.sn>s.sn?(y=T-s.start,m=s):(y=s.start-T,m=d),m.duration!==y&&(m.duration=y)}else if(d.sn>s.sn){var f=s.cc===d.cc;f&&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 R(s,d,T,y,m,f){var E=y-T;E<=0&&(F.logger.warn("Fragment should have a positive duration",d),y=T+d.duration,f=m+d.duration);var p=T,g=y,u=d.startPTS,a=d.endPTS;if(Object(Z.isFiniteNumber)(u)){var b=Math.abs(u-T);Object(Z.isFiniteNumber)(d.deltaPTS)?d.deltaPTS=Math.max(b,d.deltaPTS):d.deltaPTS=b,p=Math.max(T,u),T=Math.min(T,u),m=Math.min(m,d.startDTS),g=Math.min(y,a),y=Math.max(y,a),f=Math.max(f,d.endDTS)}d.duration=y-T;var v=T-d.start;d.appendedPTS=y,d.start=d.startPTS=T,d.maxStartPTS=p,d.startDTS=m,d.endPTS=y,d.minEndPTS=g,d.endDTS=f;var S=d.sn;if(!s||S<s.startSN||S>s.endSN)return 0;var I,j=S-s.startSN,z=s.fragments;for(z[j]=d,I=j;I>0;I--)B(z[I],z[I-1]);for(I=j;I<z.length-1;I++)B(z[I],z[I+1]);return s.fragmentHint&&B(z[z.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,v}function x(s,d){for(var T=null,y=s.fragments,m=y.length-1;m>=0;m--){var f=y[m].initSegment;if(f){T=f;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var E=0,p;if(P(s,d,function(I,j){I.relurl&&(E=I.cc-j.cc),Object(Z.isFiniteNumber)(I.startPTS)&&Object(Z.isFiniteNumber)(I.endPTS)&&(j.start=j.startPTS=I.startPTS,j.startDTS=I.startDTS,j.appendedPTS=I.appendedPTS,j.maxStartPTS=I.maxStartPTS,j.endPTS=I.endPTS,j.endDTS=I.endDTS,j.minEndPTS=I.minEndPTS,j.duration=I.endPTS-I.startPTS,j.duration&&(p=j),d.PTSKnown=d.alignedSliding=!0),j.elementaryStreams=I.elementaryStreams,j.loader=I.loader,j.stats=I.stats,j.urlId=I.urlId,I.initSegment&&(j.initSegment=I.initSegment,T=I.initSegment)}),T){var g=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments;g.forEach(function(I){var j;(!I.initSegment||I.initSegment.relurl===((j=T)===null||j===void 0?void 0:j.relurl))&&(I.initSegment=T)})}if(d.skippedSegments&&(d.deltaUpdateFailed=d.fragments.some(function(I){return!I}),d.deltaUpdateFailed)){F.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(E){F.logger.warn("discontinuity sliding from playlist, take drift into account");for(var b=0;b<a.length;b++)a[b].cc+=E}d.skippedSegments&&(d.startCC=d.fragments[0].cc),w(s.partList,d.partList,function(I,j){j.elementaryStreams=I.elementaryStreams,j.stats=I.stats}),p?R(d,p,p.startPTS,p.endPTS,p.startDTS,p.endDTS):L(s,d),a.length&&(d.totalduration=d.edge-a[0].start),d.driftStartTime=s.driftStartTime,d.driftStart=s.driftStart;var v=d.advancedDateTime;if(d.advanced&&v){var S=d.edge;d.driftStart||(d.driftStartTime=v,d.driftStart=S),d.driftEndTime=v,d.driftEnd=S}else d.driftEndTime=s.driftEndTime,d.driftEnd=s.driftEnd,d.advancedDateTime=s.advancedDateTime}function w(s,d,T){if(s&&d)for(var y=0,m=0,f=s.length;m<=f;m++){var E=s[m],p=d[m+y];E&&p&&E.index===p.index&&E.fragment.sn===p.fragment.sn?T(E,p):y--}}function P(s,d,T){for(var y=d.skippedSegments,m=Math.max(s.startSN,d.startSN)-d.startSN,f=(s.fragmentHint?1:0)+(y?d.endSN:Math.min(s.endSN,d.endSN))-d.startSN,E=d.startSN-s.startSN,p=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments,g=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,u=m;u<=f;u++){var a=g[E+u],b=p[u];y&&!b&&u<y&&(b=d.fragments[u]=a),a&&b&&T(a,b)}}function L(s,d){var T=d.startSN+d.skippedSegments-s.startSN,y=s.fragments;if(T<0||T>=y.length)return;A(d,y[T].start)}function A(s,d){if(d){for(var T=s.fragments,y=s.skippedSegments;y<T.length;y++)T[y].start+=d;s.fragmentHint&&(s.fragmentHint.start+=d)}}function _(s,d){var T=1e3*s.levelTargetDuration,y=T/2,m=s.age,f=m>0&&m<T*3,E=d.loading.end-d.loading.start,p,g=s.availabilityDelay;if(s.updated===!1)if(f){var u=333*s.misses;p=Math.max(Math.min(y,E*2),u),s.availabilityDelay=(s.availabilityDelay||0)+p}else p=y;else f?(g=Math.min(g||T/2,m),s.availabilityDelay=g,p=g+T-m):p=T-E;return Math.round(p)}function h(s,d,T){if(!s||!s.details)return null;var y=s.details,m=y.fragments[d-y.startSN];return m||(m=y.fragmentHint,m&&m.sn===d?m:d<y.startSN&&T&&T.sn===d?T:null)}function o(s,d,T){if(!s||!s.details)return null;var y=s.details.partList;if(y)for(var m=y.length;m--;){var f=y[m];if(f.index===T&&f.fragment.sn===d)return f}return null}},"./src/controller/stream-controller.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return y});var Z=O("./src/polyfills/number.ts"),F=O("./src/controller/base-stream-controller.ts"),k=O("./src/is-supported.ts"),G=O("./src/events.ts"),H=O("./src/utils/buffer-helper.ts"),B=O("./src/controller/fragment-tracker.ts"),R=O("./src/types/loader.ts"),x=O("./src/loader/fragment.ts"),w=O("./src/demux/transmuxer-interface.ts"),P=O("./src/types/transmuxer.ts"),L=O("./src/controller/gap-controller.ts"),A=O("./src/errors.ts"),_=O("./src/utils/logger.ts");function h(m,f){for(var E=0;E<f.length;E++){var p=f[E];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(m,p.key,p)}}function o(m,f,E){return f&&h(m.prototype,f),E&&h(m,E),m}function s(m,f){m.prototype=Object.create(f.prototype),m.prototype.constructor=m,d(m,f)}function d(m,f){return d=Object.setPrototypeOf||function(p,g){return p.__proto__=g,p},d(m,f)}var T=100,y=function(m){s(f,m);function f(p,g){var u;return u=m.call(this,p,g,"[stream-controller]")||this,u.audioCodecSwap=!1,u.gapController=null,u.level=-1,u._forceStartLoad=!1,u.altAudio=!1,u.audioOnly=!1,u.fragPlaying=null,u.onvplaying=null,u.onvseeked=null,u.fragLastKbps=0,u.stalled=!1,u.couldBacktrack=!1,u.audioCodecSwitch=!1,u.videoBuffer=null,u._registerListeners(),u}var E=f.prototype;return E._registerListeners=function(){var g=this.hls;g.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),g.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),g.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),g.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),g.on(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.on(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),g.on(G.Events.ERROR,this.onError,this),g.on(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),g.on(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.on(G.Events.BUFFER_CREATED,this.onBufferCreated,this),g.on(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),g.on(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),g.on(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E._unregisterListeners=function(){var g=this.hls;g.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),g.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),g.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),g.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.off(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.off(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),g.off(G.Events.ERROR,this.onError,this),g.off(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),g.off(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.off(G.Events.BUFFER_CREATED,this.onBufferCreated,this),g.off(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),g.off(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),g.off(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},E.startLoad=function(g){if(this.levels){var u=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(T),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var b=a.startLevel;b===-1&&(a.config.testBandwidth?(b=0,this.bitrateTest=!0):b=a.nextAutoLevel),this.level=a.nextLoadLevel=b,this.loadedmetadata=!1}u>0&&g===-1&&(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),g=u),this.state=F.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=g,this.tick()}else this._forceStartLoad=!0,this.state=F.State.STOPPED},E.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},E.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_LEVEL:{var g,u=this.levels,a=this.level,b=u==null||((g=u[a])===null||g===void 0)?void 0:g.details;if(b&&(!b.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(b))break;this.state=F.State.IDLE;break}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var v,S=self.performance.now(),I=this.retryDate;(!I||S>=I||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=F.State.IDLE)}break;default:break}this.onTickEnd()},E.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},E.doTickIdle=function(){var g,u,a=this.hls,b=this.levelLastLoaded,v=this.levels,S=this.media,I=a.config,j=a.nextLoadLevel;if(b===null||!S&&(this.startFragRequested||!I.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!v||!v[j])return;var z=v[j];this.level=a.nextLoadLevel=j;var V=z.details;if(!V||this.state===F.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==j){this.state=F.State.WAITING_LEVEL;return}var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:S,R.PlaylistLevelType.MAIN);if(M===null)return;var N=M.len,$=this.getMaxBufferLength(z.maxBitrate);if(N>=$)return;if(this._streamEnded(M,V)){var ie={};this.altAudio&&(ie.type="video"),this.hls.trigger(G.Events.BUFFER_EOS,ie),this.state=F.State.ENDED;return}var he=M.end,me=this.getNextFragment(he,V);if(this.couldBacktrack&&!this.fragPrevious&&me&&me.sn!=="initSegment"){var ke=me.sn-V.startSN;ke>1&&(me=V.fragments[ke-1],this.fragmentTracker.removeFragment(me))}if(me&&this.fragmentTracker.getState(me)===B.FragmentState.OK&&this.nextLoadPosition>he){var Se=this.audioOnly&&!this.altAudio?x.ElementaryStreamTypes.AUDIO:x.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(S,Se,R.PlaylistLevelType.MAIN),me=this.getNextFragment(this.nextLoadPosition,V)}if(!me)return;me.initSegment&&!me.initSegment.data&&!this.bitrateTest&&(me=me.initSegment),((g=me.decryptdata)===null||g===void 0?void 0:g.keyFormat)==="identity"&&!((u=me.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(me,V):this.loadFragment(me,V,he)},E.loadFragment=function(g,u,a){var b,v=this.fragmentTracker.getState(g);if(this.fragCurrent=g,v===B.FragmentState.BACKTRACKED){var S=this.fragmentTracker.getBacktrackData(g);if(S){this._handleFragmentLoadProgress(S),this._handleFragmentLoadComplete(S);return}else v=B.FragmentState.NOT_LOADED}v===B.FragmentState.NOT_LOADED||v===B.FragmentState.PARTIAL?g.sn==="initSegment"?this._loadInitSegment(g):this.bitrateTest?(g.bitrateTest=!0,this.log("Fragment "+g.sn+" of level "+g.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(g)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,g,u,a)):v===B.FragmentState.APPENDING?this.reduceMaxBufferLength(g.duration)&&this.fragmentTracker.removeFragment(g):((b=this.media)===null||b===void 0?void 0:b.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},E.getAppendedFrag=function(g){var u=this.fragmentTracker.getAppendedFrag(g,R.PlaylistLevelType.MAIN);return u&&"fragment"in u?u.fragment:u},E.getBufferedFrag=function(g){return this.fragmentTracker.getBufferedFrag(g,R.PlaylistLevelType.MAIN)},E.followingBufferedFrag=function(g){return g?this.getBufferedFrag(g.end+.5):null},E.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},E.nextLevelSwitch=function(){var g=this.levels,u=this.media;if(u!=null&&u.readyState){var a,b=this.getAppendedFrag(u.currentTime);if(b&&b.start>1&&this.flushMainBuffer(0,b.start-1),!u.paused&&g){var v=this.hls.nextLoadLevel,S=g[v],I=this.fragLastKbps;I&&this.fragCurrent?a=this.fragCurrent.duration*S.maxBitrate/(1e3*I)+1:a=0}else a=0;var j=this.getBufferedFrag(u.currentTime+a);if(j){var z=this.followingBufferedFrag(j);if(z){this.abortCurrentFrag();var V=z.maxStartPTS?z.maxStartPTS:z.start,M=z.duration,N=Math.max(j.end,V+Math.min(Math.max(M-this.config.maxFragLookUpTolerance,M*.5),M*.75));this.flushMainBuffer(N,Number.POSITIVE_INFINITY)}}}},E.abortCurrentFrag=function(){var g=this.fragCurrent;this.fragCurrent=null,g!=null&&g.loader&&g.loader.abort(),this.state===F.State.KEY_LOADING&&(this.state=F.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},E.flushMainBuffer=function(g,u){m.prototype.flushMainBuffer.call(this,g,u,this.altAudio?"video":null)},E.onMediaAttached=function(g,u){m.prototype.onMediaAttached.call(this,g,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 L.default(this.config,a,this.fragmentTracker,this.hls)},E.onMediaDetaching=function(){var g=this.media;g&&(g.removeEventListener("playing",this.onvplaying),g.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)},E.onMediaPlaying=function(){this.tick()},E.onMediaSeeked=function(){var g=this.media,u=g?g.currentTime:null;Object(Z.isFiniteNumber)(u)&&this.log("Media seeked to "+u.toFixed(3)),this.tick()},E.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(G.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},E.onManifestParsed=function(g,u){var a=!1,b=!1,v;u.levels.forEach(function(S){v=S.audioCodec,v&&(v.indexOf("mp4a.40.2")!==-1&&(a=!0),v.indexOf("mp4a.40.5")!==-1&&(b=!0))}),this.audioCodecSwitch=a&&b&&!Object(k.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},E.onLevelLoading=function(g,u){var a=this.levels;if(!a||this.state!==F.State.IDLE)return;var b=a[u.level];(!b.details||b.details.live&&this.levelLastLoaded!==u.level||this.waitForCdnTuneIn(b.details))&&(this.state=F.State.WAITING_LEVEL)},E.onLevelLoaded=function(g,u){var a,b=this.levels,v=u.level,S=u.details,I=S.totalduration;if(!b){this.warn("Levels were reset while loading level "+v);return}this.log("Level "+v+" loaded ["+S.startSN+","+S.endSN+"], cc ["+S.startCC+", "+S.endCC+"] duration:"+I);var j=this.fragCurrent;j&&(this.state===F.State.FRAG_LOADING||this.state===F.State.FRAG_LOADING_WAITING_RETRY)&&(j.level!==u.level&&j.loader&&(this.state=F.State.IDLE,j.loader.abort()));var z=b[v],V=0;if(S.live||(a=z.details)!==null&&a!==void 0&&a.live){if(S.fragments[0]||(S.deltaUpdateFailed=!0),S.deltaUpdateFailed)return;V=this.alignPlaylists(S,z.details)}if(z.details=S,this.levelLastLoaded=v,this.hls.trigger(G.Events.LEVEL_UPDATED,{details:S,level:v}),this.state===F.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(S))return;this.state=F.State.IDLE}this.startFragRequested?S.live&&this.synchronizeToLiveEdge(S):this.setStartPosition(S,V),this.tick()},E._handleFragmentLoadProgress=function(g){var u,a=g.frag,b=g.part,v=g.payload,S=this.levels;if(!S){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var I=S[a.level],j=I.details;if(!j){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var z=I.videoCodec,V=j.PTSKnown||!j.live,M=(u=a.initSegment)===null||u===void 0?void 0:u.data,N=this._getAudioCodec(I),$=this.transmuxer=this.transmuxer||new w.default(this.hls,R.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ie=b?b.index:-1,he=ie!==-1,me=new P.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,v.byteLength,ie,he),ke=this.initPTS[a.cc];$.push(v,M,N,z,a,b,j.totalduration,V,me,ke)},E.onAudioTrackSwitching=function(g,u){var a=this.altAudio,b=!!u.url,v=u.id;if(!b){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var S=this.fragCurrent;S!=null&&S.loader&&(this.log("Switching to main audio track, cancel main fragment load"),S.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var I=this.hls;a&&I.trigger(G.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),I.trigger(G.Events.AUDIO_TRACK_SWITCHED,{id:v})}},E.onAudioTrackSwitched=function(g,u){var a=u.id,b=!!this.hls.audioTracks[a].url;if(b){var v=this.videoBuffer;v&&this.mediaBuffer!==v&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=v)}this.altAudio=b,this.tick()},E.onBufferCreated=function(g,u){var a=u.tracks,b,v,S=!1;for(var I in a){var j=a[I];if(j.id==="main"){if(v=I,b=j,I==="video"){var z=a[I];z&&(this.videoBuffer=z.buffer)}}else S=!0}S&&b?(this.log("Alternate track found, use "+v+".buffered to schedule main fragment loading"),this.mediaBuffer=b.buffer):this.mediaBuffer=this.media},E.onFragBuffered=function(g,u){var a=u.frag,b=u.part;if(a&&a.type!==R.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(b?" p: "+b.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===F.State.PARSED&&(this.state=F.State.IDLE);return}var v=b?b.stats:a.stats;this.fragLastKbps=Math.round(8*v.total/(v.buffering.end-v.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,b)},E.onError=function(g,u){switch(u.details){case A.ErrorDetails.FRAG_LOAD_ERROR:case A.ErrorDetails.FRAG_LOAD_TIMEOUT:case A.ErrorDetails.KEY_LOAD_ERROR:case A.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.MAIN,u);break;case A.ErrorDetails.LEVEL_LOAD_ERROR:case A.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==F.State.ERROR&&(u.fatal?(this.warn(""+u.details),this.state=F.State.ERROR):!u.levelRetry&&this.state===F.State.WAITING_LEVEL&&(this.state=F.State.IDLE));break;case A.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="main"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var a=!0,b=this.getFwdBufferInfo(this.media,R.PlaylistLevelType.MAIN);b&&b.len>.5&&(a=!this.reduceMaxBufferLength(b.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},E.checkBuffer=function(){var g=this.media,u=this.gapController;if(!g||!u||!g.readyState)return;var a=H.BufferHelper.getBuffered(g);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):u.poll(this.lastCurrentTime),this.lastCurrentTime=g.currentTime},E.onFragLoadEmergencyAborted=function(){this.state=F.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},E.onBufferFlushed=function(g,u){var a=u.type;if(a!==x.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var b=(a===x.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(b,a,R.PlaylistLevelType.MAIN)}},E.onLevelsUpdated=function(g,u){this.levels=u.levels},E.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},E.seekToStartPos=function(){var g=this.media,u=g.currentTime,a=this.startPosition;if(a>=0&&u<a){if(g.seeking){_.logger.log("could not seek to "+a+", already seeking at "+u);return}var b=H.BufferHelper.getBuffered(g),v=b.length?b.start(0):0,S=v-a;S>0&&(S<this.config.maxBufferHole||S<this.config.maxFragLookUpTolerance)&&(_.logger.log("adjusting start position by "+S+" to match buffer start"),a+=S,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+u),g.currentTime=a}},E._getAudioCodec=function(g){var u=this.config.defaultAudioCodec||g.audioCodec;return this.audioCodecSwap&&u&&(this.log("Swapping audio codec"),u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5"),u},E._loadBitrateTestFrag=function(g){var u=this;this._doFragLoad(g).then(function(a){var b=u.hls;if(!a||b.nextLoadLevel||u.fragContextChanged(g))return;u.fragLoadError=0,u.state=F.State.IDLE,u.startFragRequested=!1,u.bitrateTest=!1;var v=g.stats;v.parsing.start=v.parsing.end=v.buffering.start=v.buffering.end=self.performance.now(),b.trigger(G.Events.FRAG_LOADED,a)})},E._handleTransmuxComplete=function(g){var u,a="main",b=this.hls,v=g.remuxResult,S=g.chunkMeta,I=this.getCurrentContext(S);if(!I){this.warn("The loading context changed while buffering fragment "+S.sn+" of level "+S.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(S.level);return}var j=I.frag,z=I.part,V=I.level,M=v.video,N=v.text,$=v.id3,ie=v.initSegment,he=this.altAudio?void 0:v.audio;if(this.fragContextChanged(j))return;if(this.state=F.State.PARSING,ie){ie.tracks&&(this._bufferInitSegment(V,ie.tracks,j,S),b.trigger(G.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:a,tracks:ie.tracks}));var me=ie.initPTS,ke=ie.timescale;Object(Z.isFiniteNumber)(me)&&(this.initPTS[j.cc]=me,b.trigger(G.Events.INIT_PTS_FOUND,{frag:j,id:a,initPTS:me,timescale:ke}))}if(M&&v.independent!==!1){if(V.details){var Se=M.startPTS,Re=M.endPTS,Te=M.startDTS,_e=M.endDTS;if(z)z.elementaryStreams[M.type]={startPTS:Se,endPTS:Re,startDTS:Te,endDTS:_e};else if(M.firstKeyFrame&&M.independent&&(this.couldBacktrack=!0),M.dropped&&M.independent){var ye=this.getLoadPosition()+this.config.maxBufferHole;if(ye<Se){this.backtrack(j);return}j.setElementaryStreamInfo(M.type,j.start,Re,j.start,_e,!0)}j.setElementaryStreamInfo(M.type,Se,Re,Te,_e),this.bufferFragmentData(M,j,z,S)}}else if(v.independent===!1){this.backtrack(j);return}if(he){var K=he.startPTS,l=he.endPTS,c=he.startDTS,D=he.endDTS;z&&(z.elementaryStreams[x.ElementaryStreamTypes.AUDIO]={startPTS:K,endPTS:l,startDTS:c,endDTS:D}),j.setElementaryStreamInfo(x.ElementaryStreamTypes.AUDIO,K,l,c,D),this.bufferFragmentData(he,j,z,S)}if($!=null&&(u=$.samples)!==null&&u!==void 0&&u.length){var X={frag:j,id:a,samples:$.samples};b.trigger(G.Events.FRAG_PARSING_METADATA,X)}if(N){var U={frag:j,id:a,samples:N.samples};b.trigger(G.Events.FRAG_PARSING_USERDATA,U)}},E._bufferInitSegment=function(g,u,a,b){var v=this;if(this.state!==F.State.PARSING)return;this.audioOnly=!!u.audio&&!u.video,this.altAudio&&!this.audioOnly&&delete u.audio;var S=u.audio,I=u.video,j=u.audiovideo;if(S){var z=g.audioCodec,V=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(z&&(z.indexOf("mp4a.40.5")!==-1?z="mp4a.40.2":z="mp4a.40.5"),S.metadata.channelCount!==1&&V.indexOf("firefox")===-1&&(z="mp4a.40.5")),V.indexOf("android")!==-1&&S.container!=="audio/mpeg"&&(z="mp4a.40.2",this.log("Android: force audio codec to "+z)),g.audioCodec&&g.audioCodec!==z&&this.log('Swapping manifest audio codec "'+g.audioCodec+'" for "'+z+'"'),S.levelCodec=z,S.id="main",this.log("Init audio buffer, container:"+S.container+", codecs[selected/level/parsed]=["+(z||"")+"/"+(g.audioCodec||"")+"/"+S.codec+"]")}I&&(I.levelCodec=g.videoCodec,I.id="main",this.log("Init video buffer, container:"+I.container+", codecs[level/parsed]=["+(g.videoCodec||"")+"/"+I.codec+"]")),j&&this.log("Init audiovideo buffer, container:"+j.container+", codecs[level/parsed]=["+(g.attrs.CODECS||"")+"/"+j.codec+"]"),this.hls.trigger(G.Events.BUFFER_CODECS,u),Object.keys(u).forEach(function(M){var N=u[M],$=N.initSegment;$!=null&&$.byteLength&&v.hls.trigger(G.Events.BUFFER_APPENDING,{type:M,data:$,frag:a,part:null,chunkMeta:b,parent:a.type})}),this.tick()},E.backtrack=function(g){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(g);var u=this.fragmentTracker.backtrack(g);this.fragPrevious=null,this.nextLoadPosition=g.start,u?this.resetFragmentLoading(g):this.state=F.State.BACKTRACKING},E.checkFragmentChanged=function(){var g=this.media,u=null;if(g&&g.readyState>1&&g.seeking===!1){var a=g.currentTime;if(H.BufferHelper.isBuffered(g,a)?u=this.getAppendedFrag(a):H.BufferHelper.isBuffered(g,a+.1)&&(u=this.getAppendedFrag(a+.1)),u){var b=this.fragPlaying,v=u.level;(!b||u.sn!==b.sn||b.level!==v||u.urlId!==b.urlId)&&(this.hls.trigger(G.Events.FRAG_CHANGED,{frag:u}),(!b||b.level!==v)&&this.hls.trigger(G.Events.LEVEL_SWITCHED,{level:v}),this.fragPlaying=u)}}},o(f,[{key:"nextLevel",get:function(){var g=this.nextBufferedFrag;return g?g.level:-1}},{key:"currentLevel",get:function(){var g=this.media;if(g){var u=this.getAppendedFrag(g.currentTime);if(u)return u.level}return-1}},{key:"nextBufferedFrag",get:function(){var g=this.media;if(g){var u=this.getAppendedFrag(g.currentTime);return this.followingBufferedFrag(u)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),f}(F.default)},"./src/controller/subtitle-stream-controller.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"SubtitleStreamController",function(){return s});var Z=O("./src/events.ts"),F=O("./src/utils/logger.ts"),k=O("./src/utils/buffer-helper.ts"),G=O("./src/controller/fragment-finders.ts"),H=O("./src/utils/discontinuities.ts"),B=O("./src/controller/level-helper.ts"),R=O("./src/controller/fragment-tracker.ts"),x=O("./src/controller/base-stream-controller.ts"),w=O("./src/types/loader.ts"),P=O("./src/types/level.ts");function L(d,T){for(var y=0;y<T.length;y++){var m=T[y];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(d,m.key,m)}}function A(d,T,y){return T&&L(d.prototype,T),y&&L(d,y),d}function _(d,T){d.prototype=Object.create(T.prototype),d.prototype.constructor=d,h(d,T)}function h(d,T){return h=Object.setPrototypeOf||function(m,f){return m.__proto__=f,m},h(d,T)}var o=500,s=function(d){_(T,d);function T(m,f){var E;return E=d.call(this,m,f,"[subtitle-stream-controller]")||this,E.levels=[],E.currentTrackId=-1,E.tracksBuffered=[],E.mainDetails=null,E._registerListeners(),E}var y=T.prototype;return y.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},y._registerListeners=function(){var f=this.hls;f.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.on(Z.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(Z.Events.ERROR,this.onError,this),f.on(Z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),f.on(Z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),f.on(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),f.on(Z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),f.on(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},y._unregisterListeners=function(){var f=this.hls;f.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(Z.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(Z.Events.ERROR,this.onError,this),f.off(Z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),f.off(Z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),f.off(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),f.off(Z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),f.off(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},y.startLoad=function(){this.stopLoad(),this.state=x.State.IDLE,this.setInterval(o),this.tick()},y.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},y.onLevelLoaded=function(f,E){this.mainDetails=E.details},y.onSubtitleFragProcessed=function(f,E){var p=E.frag,g=E.success;if(this.fragPrevious=p,this.state=x.State.IDLE,!g)return;var u=this.tracksBuffered[this.currentTrackId];if(!u)return;for(var a,b=p.start,v=0;v<u.length;v++)if(b>=u[v].start&&b<=u[v].end){a=u[v];break}var S=p.start+p.duration;a?a.end=S:(a={start:b,end:S},u.push(a)),this.fragmentTracker.fragBuffered(p)},y.onBufferFlushing=function(f,E){var p=E.startOffset,g=E.endOffset;if(p===0&&g!==Number.POSITIVE_INFINITY){var u=this.currentTrackId,a=this.levels;if(!a.length||!a[u]||!a[u].details)return;var b=a[u].details,v=b.targetduration,S=g-v;if(S<=0)return;E.endOffsetSubtitles=Math.max(0,S),this.tracksBuffered.forEach(function(I){for(var j=0;j<I.length;){if(I[j].end<=S){I.shift();continue}else if(I[j].start<S)I[j].start=S;else break;j++}}),this.fragmentTracker.removeFragmentsInRange(p,S,w.PlaylistLevelType.SUBTITLE)}},y.onError=function(f,E){var p,g=E.frag;if(!g||g.type!==w.PlaylistLevelType.SUBTITLE)return;(p=this.fragCurrent)!==null&&p!==void 0&&p.loader&&this.fragCurrent.loader.abort(),this.state=x.State.IDLE},y.onSubtitleTracksUpdated=function(f,E){var p=this,g=E.subtitleTracks;this.tracksBuffered=[],this.levels=g.map(function(u){return new P.Level(u)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(u){p.tracksBuffered[u.id]=[]}),this.mediaBuffer=null},y.onSubtitleTrackSwitch=function(f,E){if(this.currentTrackId=E.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var p=this.levels[this.currentTrackId];p!=null&&p.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,p&&this.setInterval(o)},y.onSubtitleTrackLoaded=function(f,E){var p,g=E.details,u=E.id,a=this.currentTrackId,b=this.levels;if(!b.length)return;var v=b[a];if(u>=b.length||u!==a||!v)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,g.live||(p=v.details)!==null&&p!==void 0&&p.live){var S=this.mainDetails;if(g.deltaUpdateFailed||!S)return;var I=S.fragments[0];if(!v.details)g.hasProgramDateTime&&S.hasProgramDateTime?Object(H.alignMediaPlaylistByPDT)(g,S):I&&Object(B.addSliding)(g,I.start);else{var j=this.alignPlaylists(g,v.details);j===0&&I&&Object(B.addSliding)(g,I.start)}}if(v.details=g,this.levelLastLoaded=u,this.tick(),g.live&&!this.fragCurrent&&this.media&&this.state===x.State.IDLE){var z=Object(G.findFragmentByPTS)(null,g.fragments,this.media.currentTime,0);z||(this.warn("Subtitle playlist not aligned with playback"),v.details=void 0)}},y._handleFragmentLoadComplete=function(f){var E=f.frag,p=f.payload,g=E.decryptdata,u=this.hls;if(this.fragContextChanged(E))return;if(p&&p.byteLength>0&&g&&g.key&&g.iv&&g.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(p),g.key.buffer,g.iv.buffer).then(function(b){var v=performance.now();u.trigger(Z.Events.FRAG_DECRYPTED,{frag:E,payload:b,stats:{tstart:a,tdecrypt:v}})})}},y.doTick=function(){if(!this.media){this.state=x.State.IDLE;return}if(this.state===x.State.IDLE){var f,E=this.currentTrackId,p=this.levels;if(!p.length||!p[E]||!p[E].details)return;var g=p[E].details,u=g.targetduration,a=this.config,b=this.media,v=k.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,b.currentTime-u,a.maxBufferHole),S=v.end,I=v.len,j=this.getMaxBufferLength()+u;if(I>j)return;console.assert(g,"Subtitle track details are defined on idle subtitle stream controller tick");var z=g.fragments,V=z.length,M=g.edge,N,$=this.fragPrevious;if(S<M){var ie=a.maxFragLookUpTolerance;$&&g.hasProgramDateTime&&(N=Object(G.findFragmentByPDT)(z,$.endProgramDateTime,ie)),N||(N=Object(G.findFragmentByPTS)($,z,S,ie),!N&&$&&$.start<z[0].start&&(N=z[0]))}else N=z[V-1];(f=N)!==null&&f!==void 0&&f.encrypted?(F.logger.log("Loading key for "+N.sn),this.state=x.State.KEY_LOADING,this.hls.trigger(Z.Events.KEY_LOADING,{frag:N})):N&&this.fragmentTracker.getState(N)===R.FragmentState.NOT_LOADED&&this.loadFragment(N,g,S)}},y.loadFragment=function(f,E,p){this.fragCurrent=f,d.prototype.loadFragment.call(this,f,E,p)},A(T,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),T}(x.default)},"./src/controller/subtitle-track-controller.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/events.ts"),F=O("./src/utils/texttrack-utils.ts"),k=O("./src/controller/base-playlist-controller.ts"),G=O("./src/types/loader.ts");function H(L,A){for(var _=0;_<A.length;_++){var h=A[_];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(L,h.key,h)}}function B(L,A,_){return A&&H(L.prototype,A),_&&H(L,_),L}function R(L,A){L.prototype=Object.create(A.prototype),L.prototype.constructor=L,x(L,A)}function x(L,A){return x=Object.setPrototypeOf||function(h,o){return h.__proto__=o,h},x(L,A)}var w=function(L){R(A,L);function A(h){var o;return o=L.call(this,h,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var _=A.prototype;return _.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,L.prototype.destroy.call(this)},_.registerListeners=function(){var o=this.hls;o.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(Z.Events.ERROR,this.onError,this)},_.unregisterListeners=function(){var o=this.hls;o.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(Z.Events.ERROR,this.onError,this)},_.onMediaAttached=function(o,s){if(this.media=s.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},_.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},_.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(F.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},_.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},_.onManifestParsed=function(o,s){this.tracks=s.subtitleTracks},_.onSubtitleTrackLoaded=function(o,s){var d=s.id,T=s.details,y=this.trackId,m=this.tracksInGroup[y];if(!m){this.warn("Invalid subtitle track id "+d);return}var f=m.details;m.details=s.details,this.log("subtitle track "+d+" loaded ["+T.startSN+"-"+T.endSN+"]"),d===this.trackId&&(this.retryCount=0,this.playlistLoaded(d,s,f))},_.onLevelLoading=function(o,s){this.switchLevel(s.level)},_.onLevelSwitching=function(o,s){this.switchLevel(s.level)},_.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 T=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,y=this.tracks.filter(function(E){return!d||E.groupId===d});this.tracksInGroup=y;var m=this.findTrackId(T==null?void 0:T.name)||this.findTrackId();this.groupId=d;var f={subtitleTracks:y};this.log("Updating subtitle tracks, "+y.length+' track(s) found in "'+d+'" group-id'),this.hls.trigger(Z.Events.SUBTITLE_TRACKS_UPDATED,f),m!==-1&&this.setSubtitleTrack(m,T)}},_.findTrackId=function(o){for(var s=this.tracksInGroup,d=0;d<s.length;d++){var T=s[d];if((!this.selectDefaultTrack||T.default)&&(!o||o===T.name))return T.id}return-1},_.onError=function(o,s){if(L.prototype.onError.call(this,o,s),s.fatal||!s.context)return;s.context.type===G.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},_.loadPlaylist=function(o){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var d=s.id,T=s.groupId,y=s.url;if(o)try{y=o.addDirectives(y)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("Loading subtitle playlist for id "+d),this.hls.trigger(Z.Events.SUBTITLE_TRACK_LOADING,{url:y,id:d,groupId:T,deliveryDirectives:o||null})}},_.toggleTrackModes=function(o){var s=this,d=this.media,T=this.subtitleDisplay,y=this.trackId;if(!d)return;var m=P(d.textTracks),f=m.filter(function(g){return g.groupId===s.groupId});if(o===-1)[].slice.call(m).forEach(function(g){g.mode="disabled"});else{var E=f[y];E&&(E.mode="disabled")}var p=f[o];p&&(p.mode=T?"showing":"hidden")},_.setSubtitleTrack=function(o,s){var d,T=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(d=T[o])!==null&&d!==void 0&&d.details)||o<-1||o>=T.length)return;this.clearTimer();var y=T[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,y){var m=y.id,f=y.groupId,E=f===void 0?"":f,p=y.name,g=y.type,u=y.url;this.hls.trigger(Z.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:E,name:p,type:g,url:u});var a=this.switchParams(y.url,s==null?void 0:s.details);this.loadPlaylist(a)}else this.hls.trigger(Z.Events.SUBTITLE_TRACK_SWITCH,{id:o})},_.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<s.length;d++)if(s[d].mode==="hidden")o=d;else if(s[d].mode==="showing"){o=d;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},B(A,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,s)}}]),A}(k.default);function P(L){for(var A=[],_=0;_<L.length;_++){var h=L[_];h.kind==="subtitles"&&h.label&&A.push(L[_])}return A}J.default=w},"./src/controller/timeline-controller.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"TimelineController",function(){return P});var Z=O("./src/polyfills/number.ts"),F=O("./src/events.ts"),k=O("./src/utils/cea-608-parser.ts"),G=O("./src/utils/output-filter.ts"),H=O("./src/utils/webvtt-parser.ts"),B=O("./src/utils/texttrack-utils.ts"),R=O("./src/utils/imsc1-ttml-parser.ts"),x=O("./src/types/loader.ts"),w=O("./src/utils/logger.ts"),P=function(){function h(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=_(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var d=new G.default(this,"textTrack1"),T=new G.default(this,"textTrack2"),y=new G.default(this,"textTrack3"),m=new G.default(this,"textTrack4");this.cea608Parser1=new k.default(1,d,T),this.cea608Parser2=new k.default(3,y,m)}s.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(F.Events.FRAG_LOADING,this.onFragLoading,this),s.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=h.prototype;return o.destroy=function(){var d=this.hls;d.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),d.off(F.Events.FRAG_LOADING,this.onFragLoading,this),d.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),d.off(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),d.off(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),d.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(d,T,y,m,f){for(var E=!1,p=f.length;p--;){var g=f[p],u=A(g[0],g[1],T,y);if(u>=0&&(g[0]=Math.min(g[0],T),g[1]=Math.max(g[1],y),E=!0,u/(y-T)>.5))return}if(E||f.push([T,y]),this.config.renderTextTracksNatively){var a=this.captionsTracks[d];this.Cues.newCue(a,T,y,m)}else{var b=this.Cues.newCue(null,T,y,m);this.hls.trigger(F.Events.CUES_PARSED,{type:"captions",cues:b,track:d})}},o.onInitPtsFound=function(d,T){var y=this,m=T.frag,f=T.id,E=T.initPTS,p=T.timescale,g=this.unparsedVttFrags;f==="main"&&(this.initPTS[m.cc]=E,this.timescale[m.cc]=p),g.length&&(this.unparsedVttFrags=[],g.forEach(function(u){y.onFragLoaded(F.Events.FRAG_LOADED,u)}))},o.getExistingTrack=function(d){var T=this.media;if(T)for(var y=0;y<T.textTracks.length;y++){var m=T.textTracks[y];if(m[d])return m}return null},o.createCaptionsTrack=function(d){this.config.renderTextTracksNatively?this.createNativeTrack(d):this.createNonNativeTrack(d)},o.createNativeTrack=function(d){if(this.captionsTracks[d])return;var T=this.captionsProperties,y=this.captionsTracks,m=this.media,f=T[d],E=f.label,p=f.languageCode,g=this.getExistingTrack(d);if(g)y[d]=g,Object(B.clearCurrentCues)(y[d]),Object(B.sendAddTrackEvent)(y[d],m);else{var u=this.createTextTrack("captions",E,p);u&&(u[d]=!0,y[d]=u)}},o.createNonNativeTrack=function(d){if(this.nonNativeCaptionsTracks[d])return;var T=this.captionsProperties[d];if(!T)return;var y=T.label,m={_id:d,label:y,kind:"captions",default:T.media?!!T.media.default:!1,closedCaptions:T.media};this.nonNativeCaptionsTracks[d]=m,this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[m]})},o.createTextTrack=function(d,T,y){var m=this.media;return m?m.addTextTrack(d,T,y):void 0},o.onMediaAttaching=function(d,T){this.media=T.media,this._cleanTracks()},o.onMediaDetaching=function(){var d=this.captionsTracks;Object.keys(d).forEach(function(T){Object(B.clearCurrentCues)(d[T]),delete d[T]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=_(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var d=this.media;if(!d)return;var T=d.textTracks;if(T)for(var y=0;y<T.length;y++)Object(B.clearCurrentCues)(T[y])},o.onSubtitleTracksUpdated=function(d,T){var y=this;this.textTracks=[];var m=T.subtitleTracks||[],f=m.some(function(u){return u.textCodec===R.IMSC1_CODEC});if(this.config.enableWebVTT||f&&this.config.enableIMSC1){var E=this.tracks&&m&&this.tracks.length===m.length;if(this.tracks=m||[],this.config.renderTextTracksNatively){var p=this.media?this.media.textTracks:[];this.tracks.forEach(function(u,a){var b;if(a<p.length){for(var v=null,S=0;S<p.length;S++)if(L(p[S],u)){v=p[S];break}v&&(b=v)}b?Object(B.clearCurrentCues)(b):(b=y.createTextTrack("subtitles",u.name,u.lang),b&&(b.mode="disabled")),b&&(b.groupId=u.groupId,y.textTracks.push(b))})}else if(!E&&this.tracks&&this.tracks.length){var g=this.tracks.map(function(u){return{label:u.name,kind:u.type.toLowerCase(),default:u.default,subtitleTrack:u}});this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:g})}}},o.onManifestLoaded=function(d,T){var y=this;this.config.enableCEA708Captions&&T.captions&&T.captions.forEach(function(m){var f=/(?:CC|SERVICE)([1-4])/.exec(m.instreamId);if(!f)return;var E="textTrack"+f[1],p=y.captionsProperties[E];if(!p)return;p.label=m.name,m.lang&&(p.languageCode=m.lang),p.media=m})},o.onFragLoading=function(d,T){var y=this.cea608Parser1,m=this.cea608Parser2,f=this.lastSn,E=this.lastPartIndex;if(!this.enabled||!(y&&m))return;if(T.frag.type===x.PlaylistLevelType.MAIN){var p,g,u=T.frag.sn,a=(p=T==null||((g=T.part)===null||g===void 0)?void 0:g.index)!=null?p:-1;u===f+1||u===f&&a===E+1||(y.reset(),m.reset()),this.lastSn=u,this.lastPartIndex=a}},o.onFragLoaded=function(d,T){var y=T.frag,m=T.payload,f=this.initPTS,E=this.unparsedVttFrags;if(y.type===x.PlaylistLevelType.SUBTITLE)if(m.byteLength){if(!Object(Z.isFiniteNumber)(f[y.cc])){E.push(T),f.length&&this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:y,error:new Error("Missing initial subtitle PTS")});return}var p=y.decryptdata;if(p==null||p.key==null||p.method!=="AES-128"){var g=this.tracks[y.level],u=this.vttCCs;u[y.cc]||(u[y.cc]={start:y.start,prevCC:this.prevCC,new:!0},this.prevCC=y.cc),g&&g.textCodec===R.IMSC1_CODEC?this._parseIMSC1(y,m):this._parseVTTs(y,m,u)}}else this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:y,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(d,T){var y=this,m=this.hls;Object(R.parseIMSC1)(T,this.initPTS[d.cc],this.timescale[d.cc],function(f){y._appendCues(f,d.level),m.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(f){w.logger.log("Failed to parse IMSC1: "+f),m.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:f})})},o._parseVTTs=function(d,T,y){var m=this,f=this.hls;Object(H.parseWebVTT)(T,this.initPTS[d.cc],this.timescale[d.cc],y,d.cc,d.start,function(E){m._appendCues(E,d.level),f.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(E){m._fallbackToIMSC1(d,T),w.logger.log("Failed to parse VTT cue: "+E),f.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:E})})},o._fallbackToIMSC1=function(d,T){var y=this,m=this.tracks[d.level];m.textCodec||Object(R.parseIMSC1)(T,this.initPTS[d.cc],this.timescale[d.cc],function(){m.textCodec=R.IMSC1_CODEC,y._parseIMSC1(d,T)},function(){m.textCodec="wvtt"})},o._appendCues=function(d,T){var y=this.hls;if(this.config.renderTextTracksNatively){var m=this.textTracks[T];if(m.mode==="disabled")return;d.forEach(function(p){return Object(B.addCueToTrack)(m,p)})}else{var f=this.tracks[T],E=f.default?"default":"subtitles"+T;y.trigger(F.Events.CUES_PARSED,{type:"subtitles",cues:d,track:E})}},o.onFragDecrypted=function(d,T){var y=T.frag;if(y.type===x.PlaylistLevelType.SUBTITLE){if(!Object(Z.isFiniteNumber)(this.initPTS[y.cc])){this.unparsedVttFrags.push(T);return}this.onFragLoaded(F.Events.FRAG_LOADED,T)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(d,T){var y=this.cea608Parser1,m=this.cea608Parser2;if(!this.enabled||!(y&&m))return;for(var f=0;f<T.samples.length;f++){var E=T.samples[f].bytes;if(E){var p=this.extractCea608Data(E);y.addData(T.samples[f].pts,p[0]),m.addData(T.samples[f].pts,p[1])}}},o.onBufferFlushing=function(d,T){var y=T.startOffset,m=T.endOffset,f=T.endOffsetSubtitles,E=T.type,p=this.media;if(!p||p.currentTime<m)return;if(!E||E==="video"){var g=this.captionsTracks;Object.keys(g).forEach(function(a){return Object(B.removeCuesInRange)(g[a],y,m)})}if(this.config.renderTextTracksNatively&&(y===0&&f!==void 0)){var u=this.textTracks;Object.keys(u).forEach(function(a){return Object(B.removeCuesInRange)(u[a],y,f)})}},o.extractCea608Data=function(d){for(var T=d[0]&31,y=2,m=[[],[]],f=0;f<T;f++){var E=d[y++],p=127&d[y++],g=127&d[y++],u=(4&E)!==0,a=3&E;if(p===0&&g===0)continue;u&&((a===0||a===1)&&(m[a].push(p),m[a].push(g)))}return m},h}();function L(h,o){return h&&h.label===o.name&&!(h.textTrack1||h.textTrack2)}function A(h,o,s,d){return Math.min(o,d)-Math.max(h,s)}function _(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return Z});var Z=function(){function F(G,H){this.subtle=void 0,this.aesIV=void 0,this.subtle=G,this.aesIV=H}var k=F.prototype;return k.decrypt=function(H,B){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},B,H)},F}()},"./src/crypt/aes-decryptor.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"removePadding",function(){return F}),O.d(J,"default",function(){return k});var Z=O("./src/utils/typed-array.ts");function F(G){var H=G.byteLength,B=H&&new DataView(G.buffer).getUint8(H-1);return B?Object(Z.sliceUint8)(G,0,H-B):G}var k=function(){function G(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var H=G.prototype;return H.uint8ArrayToUint32Array_=function(R){for(var x=new DataView(R),w=new Uint32Array(4),P=0;P<4;P++)w[P]=x.getUint32(P*4);return w},H.initTable=function(){var R=this.sBox,x=this.invSBox,w=this.subMix,P=w[0],L=w[1],A=w[2],_=w[3],h=this.invSubMix,o=h[0],s=h[1],d=h[2],T=h[3],y=new Uint32Array(256),m=0,f=0,E=0;for(E=0;E<256;E++)E<128?y[E]=E<<1:y[E]=E<<1^283;for(E=0;E<256;E++){var p=f^f<<1^f<<2^f<<3^f<<4;p=p>>>8^p&255^99,R[m]=p,x[p]=m;var g=y[m],u=y[g],a=y[u],b=y[p]*257^p*16843008;P[m]=b<<24|b>>>8,L[m]=b<<16|b>>>16,A[m]=b<<8|b>>>24,_[m]=b,b=a*16843009^u*65537^g*257^m*16843008,o[p]=b<<24|b>>>8,s[p]=b<<16|b>>>16,d[p]=b<<8|b>>>24,T[p]=b,m?(m=g^y[y[y[a^g]]],f^=y[y[f]]):m=f=1}},H.expandKey=function(R){for(var x=this.uint8ArrayToUint32Array_(R),w=!0,P=0;P<x.length&&w;)w=x[P]===this.key[P],P++;if(w)return;this.key=x;var L=this.keySize=x.length;if(L!==4&&L!==6&&L!==8)throw new Error("Invalid aes key size="+L);var A=this.ksRows=(L+6+1)*4,_,h,o=this.keySchedule=new Uint32Array(A),s=this.invKeySchedule=new Uint32Array(A),d=this.sBox,T=this.rcon,y=this.invSubMix,m=y[0],f=y[1],E=y[2],p=y[3],g,u;for(_=0;_<A;_++){if(_<L){g=o[_]=x[_];continue}u=g,_%L===0?(u=u<<8|u>>>24,u=d[u>>>24]<<24|d[u>>>16&255]<<16|d[u>>>8&255]<<8|d[u&255],u^=T[_/L|0]<<24):L>6&&_%L===4&&(u=d[u>>>24]<<24|d[u>>>16&255]<<16|d[u>>>8&255]<<8|d[u&255]),o[_]=g=(o[_-L]^u)>>>0}for(h=0;h<A;h++)_=A-h,h&3?u=o[_]:u=o[_-4],h<4||_<=4?s[h]=u:s[h]=m[d[u>>>24]]^f[d[u>>>16&255]]^E[d[u>>>8&255]]^p[d[u&255]],s[h]=s[h]>>>0},H.networkToHostOrderSwap=function(R){return R<<24|(R&65280)<<8|(R&16711680)>>8|R>>>24},H.decrypt=function(R,x,w){for(var P=this.keySize+6,L=this.invKeySchedule,A=this.invSBox,_=this.invSubMix,h=_[0],o=_[1],s=_[2],d=_[3],T=this.uint8ArrayToUint32Array_(w),y=T[0],m=T[1],f=T[2],E=T[3],p=new Int32Array(R),g=new Int32Array(p.length),u,a,b,v,S,I,j,z,V,M,N,$,ie,he,me=this.networkToHostOrderSwap;x<p.length;){for(V=me(p[x]),M=me(p[x+1]),N=me(p[x+2]),$=me(p[x+3]),S=V^L[0],I=$^L[1],j=N^L[2],z=M^L[3],ie=4,he=1;he<P;he++)u=h[S>>>24]^o[I>>16&255]^s[j>>8&255]^d[z&255]^L[ie],a=h[I>>>24]^o[j>>16&255]^s[z>>8&255]^d[S&255]^L[ie+1],b=h[j>>>24]^o[z>>16&255]^s[S>>8&255]^d[I&255]^L[ie+2],v=h[z>>>24]^o[S>>16&255]^s[I>>8&255]^d[j&255]^L[ie+3],S=u,I=a,j=b,z=v,ie=ie+4;u=A[S>>>24]<<24^A[I>>16&255]<<16^A[j>>8&255]<<8^A[z&255]^L[ie],a=A[I>>>24]<<24^A[j>>16&255]<<16^A[z>>8&255]<<8^A[S&255]^L[ie+1],b=A[j>>>24]<<24^A[z>>16&255]<<16^A[S>>8&255]<<8^A[I&255]^L[ie+2],v=A[z>>>24]<<24^A[S>>16&255]<<16^A[I>>8&255]<<8^A[j&255]^L[ie+3],g[x]=me(u^y),g[x+1]=me(v^m),g[x+2]=me(b^f),g[x+3]=me(a^E),y=V,m=M,f=N,E=$,x=x+4}return g.buffer},G}()},"./src/crypt/decrypter.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return x});var Z=O("./src/crypt/aes-crypto.ts"),F=O("./src/crypt/fast-aes-key.ts"),k=O("./src/crypt/aes-decryptor.ts"),G=O("./src/utils/logger.ts"),H=O("./src/utils/mp4-tools.ts"),B=O("./src/utils/typed-array.ts"),R=16,x=function(){function w(L,A,_){var h=_===void 0?{}:_,o=h.removePKCS7Padding,s=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=L,this.config=A,this.removePKCS7Padding=s,s)try{var d=self.crypto;d&&(this.subtle=d.subtle||d.webkitSubtle)}catch(T){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var P=w.prototype;return P.destroy=function(){this.observer=null},P.isSync=function(){return this.config.enableSoftwareAES},P.flush=function(){var A=this.currentResult;if(!A){this.reset();return}var _=new Uint8Array(A);return this.reset(),this.removePKCS7Padding?Object(k.removePadding)(_):_},P.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},P.decrypt=function(A,_,h,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(A),_,h);var s=this.flush();s&&o(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(A),_,h).then(o)},P.softwareDecrypt=function(A,_,h){var o=this.currentIV,s=this.currentResult,d=this.remainderData;this.logOnce("JS AES decrypt"),d&&(A=Object(H.appendUint8Array)(d,A),this.remainderData=null);var T=this.getValidChunk(A);if(!T.length)return null;o&&(h=o);var y=this.softwareDecrypter;y||(y=this.softwareDecrypter=new k.default),y.expandKey(_);var m=s;return this.currentResult=y.decrypt(T.buffer,0,h),this.currentIV=Object(B.sliceUint8)(T,-16).buffer,m||null},P.webCryptoDecrypt=function(A,_,h){var o=this,s=this.subtle;return(this.key!==_||!this.fastAesKey)&&(this.key=_,this.fastAesKey=new F.default(s,_)),this.fastAesKey.expandKey().then(function(d){if(!s)return Promise.reject(new Error("web crypto not initialized"));var T=new Z.default(s,h);return T.decrypt(A.buffer,d)}).catch(function(d){return o.onWebCryptoError(d,A,_,h)})},P.onWebCryptoError=function(A,_,h,o){return G.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",A),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(_,h,o)},P.getValidChunk=function(A){var _=A,h=A.length-A.length%R;return h!==A.length&&(_=Object(B.sliceUint8)(A,0,h),this.remainderData=Object(B.sliceUint8)(A,h)),_},P.logOnce=function(A){if(!this.logEnabled)return;G.logger.log("[decrypter.ts]: "+A),this.logEnabled=!1},w}()},"./src/crypt/fast-aes-key.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return Z});var Z=function(){function F(G,H){this.subtle=void 0,this.key=void 0,this.subtle=G,this.key=H}var k=F.prototype;return k.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},F}()},"./src/demux/aacdemuxer.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/demux/base-audio-demuxer.ts"),F=O("./src/demux/adts.ts"),k=O("./src/utils/logger.ts"),G=O("./src/demux/id3.ts");function H(x,w){x.prototype=Object.create(w.prototype),x.prototype.constructor=x,B(x,w)}function B(x,w){return B=Object.setPrototypeOf||function(L,A){return L.__proto__=A,L},B(x,w)}var R=function(x){H(w,x);function w(L,A){var _;return _=x.call(this)||this,_.observer=void 0,_.config=void 0,_.observer=L,_.config=A,_}var P=w.prototype;return P.resetInitSegment=function(A,_,h){x.prototype.resetInitSegment.call(this,A,_,h),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:A,duration:h,inputTimeScale:9e4,dropped:0}},w.probe=function(A){if(!A)return!1;for(var _=G.getID3Data(A,0)||[],h=_.length,o=A.length;h<o;h++)if(F.probe(A,h))return k.logger.log("ADTS sync word found !"),!0;return!1},P.canParse=function(A,_){return F.canParse(A,_)},P.appendFrame=function(A,_,h){F.initTrackConfig(A,this.observer,_,h,A.manifestCodec);var o=F.appendFrame(A,_,h,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},w}(Z.default);R.minProbeByteLength=9,J.default=R},"./src/demux/adts.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"getAudioConfig",function(){return G}),O.d(J,"isHeaderPattern",function(){return H}),O.d(J,"getHeaderLength",function(){return B}),O.d(J,"getFullFrameLength",function(){return R}),O.d(J,"canGetFrameLength",function(){return x}),O.d(J,"isHeader",function(){return w}),O.d(J,"canParse",function(){return P}),O.d(J,"probe",function(){return L}),O.d(J,"initTrackConfig",function(){return A}),O.d(J,"getFrameDuration",function(){return _}),O.d(J,"parseFrameHeader",function(){return h}),O.d(J,"appendFrame",function(){return o});var Z=O("./src/utils/logger.ts"),F=O("./src/errors.ts"),k=O("./src/events.ts");function G(s,d,T,y){var m,f,E,p,g=navigator.userAgent.toLowerCase(),u=y,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];m=((d[T+2]&192)>>>6)+1;var b=(d[T+2]&60)>>>2;if(b>a.length-1){s.trigger(k.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+b});return}return E=(d[T+2]&1)<<2,E|=(d[T+3]&192)>>>6,Z.logger.log("manifest codec:"+y+", ADTS type:"+m+", samplingIndex:"+b),/firefox/i.test(g)?b>=6?(m=5,p=new Array(4),f=b-3):(m=2,p=new Array(2),f=b):g.indexOf("android")!==-1?(m=2,p=new Array(2),f=b):(m=5,p=new Array(4),y&&(y.indexOf("mp4a.40.29")!==-1||y.indexOf("mp4a.40.5")!==-1)||!y&&b>=6?f=b-3:((y&&y.indexOf("mp4a.40.2")!==-1&&(b>=6&&E===1||/vivaldi/i.test(g))||!y&&E===1)&&(m=2,p=new Array(2)),f=b)),p[0]=m<<3,p[0]|=(b&14)>>1,p[1]|=(b&1)<<7,p[1]|=E<<3,m===5&&(p[1]|=(f&14)>>1,p[2]=(f&1)<<7,p[2]|=2<<2,p[3]=0),{config:p,samplerate:a[b],channelCount:E,codec:"mp4a.40."+m,manifestCodec:u}}function H(s,d){return s[d]===255&&(s[d+1]&246)===240}function B(s,d){return s[d+1]&1?7:9}function R(s,d){return(s[d+3]&3)<<11|s[d+4]<<3|(s[d+5]&224)>>>5}function x(s,d){return d+5<s.length}function w(s,d){return d+1<s.length&&H(s,d)}function P(s,d){return x(s,d)&&H(s,d)&&R(s,d)<=s.length-d}function L(s,d){if(w(s,d)){var T=B(s,d);if(d+T>=s.length)return!1;var y=R(s,d);if(y<=T)return!1;var m=d+y;return m===s.length||w(s,m)}return!1}function A(s,d,T,y,m){if(!s.samplerate){var f=G(d,T,y,m);if(!f)return;s.config=f.config,s.samplerate=f.samplerate,s.channelCount=f.channelCount,s.codec=f.codec,s.manifestCodec=f.manifestCodec,Z.logger.log("parsed codec:"+s.codec+", rate:"+f.samplerate+", channels:"+f.channelCount)}}function _(s){return 1024*9e4/s}function h(s,d,T,y,m){var f=B(s,d),E=R(s,d);if(E-=f,E>0){var p=T+y*m;return{headerLength:f,frameLength:E,stamp:p}}}function o(s,d,T,y,m){var f=_(s.samplerate),E=h(d,T,y,m,f);if(E){var p=E.frameLength,g=E.headerLength,u=E.stamp,a=g+p,b=Math.max(0,T+a-d.length),v;b?(v=new Uint8Array(a-g),v.set(d.subarray(T+g,d.length),0)):v=d.subarray(T+g,T+a);var S={unit:v,pts:u};return b||s.samples.push(S),{sample:S,length:a,missing:b}}}},"./src/demux/base-audio-demuxer.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"initPTSFn",function(){return R});var Z=O("./src/polyfills/number.ts"),F=O("./src/demux/id3.ts"),k=O("./src/demux/dummy-demuxed-track.ts"),G=O("./src/utils/mp4-tools.ts"),H=O("./src/utils/typed-array.ts"),B=function(){function x(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var w=x.prototype;return w.resetInitSegment=function(L,A,_){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},w.resetTimeStamp=function(){},w.resetContiguity=function(){},w.canParse=function(L,A){return!1},w.appendFrame=function(L,A,_){},w.demux=function(L,A){this.cachedData&&(L=Object(G.appendUint8Array)(this.cachedData,L),this.cachedData=null);var _=F.getID3Data(L,0),h=_?_.length:0,o,s,d=this._audioTrack,T=this._id3Track,y=_?F.getTimeStamp(_):void 0,m=L.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=R(y,A)),_&&_.length>0&&T.samples.push({pts:this.initPTS,dts:this.initPTS,data:_}),s=this.initPTS;h<m;){if(this.canParse(L,h)){var f=this.appendFrame(d,L,h);f?(this.frameIndex++,s=f.sample.pts,h+=f.length,o=h):h=m}else F.canParse(L,h)?(_=F.getID3Data(L,h),T.samples.push({pts:s,dts:s,data:_}),h+=_.length,o=h):h++;if(h===m&&o!==m){var E=Object(H.sliceUint8)(L,o);this.cachedData?this.cachedData=Object(G.appendUint8Array)(this.cachedData,E):this.cachedData=E}}return{audioTrack:d,avcTrack:Object(k.dummyTrack)(),id3Track:T,textTrack:Object(k.dummyTrack)()}},w.demuxSampleAes=function(L,A,_){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},w.flush=function(L){var A=this.cachedData;return A&&(this.cachedData=null,this.demux(A,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(k.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(k.dummyTrack)()}},w.destroy=function(){},x}(),R=function(w,P){return Object(Z.isFiniteNumber)(w)?w*90:P*9e4};J.default=B},"./src/demux/chunk-cache.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return Z});var Z=function(){function k(){this.chunks=[],this.dataLength=0}var G=k.prototype;return G.push=function(B){this.chunks.push(B),this.dataLength+=B.length},G.flush=function(){var B=this.chunks,R=this.dataLength,x;if(B.length)B.length===1?x=B[0]:x=F(B,R);else return new Uint8Array(0);return this.reset(),x},G.reset=function(){this.chunks.length=0,this.dataLength=0},k}();function F(k,G){for(var H=new Uint8Array(G),B=0,R=0;R<k.length;R++){var x=k[R];H.set(x,B),B+=x.length}return H}},"./src/demux/dummy-demuxed-track.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"dummyTrack",function(){return Z});function Z(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/utils/logger.ts"),F=function(){function k(H){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=H,this.bytesAvailable=H.byteLength,this.word=0,this.bitsAvailable=0}var G=k.prototype;return G.loadWord=function(){var B=this.data,R=this.bytesAvailable,x=B.byteLength-R,w=new Uint8Array(4),P=Math.min(4,R);if(P===0)throw new Error("no bytes available");w.set(B.subarray(x,x+P)),this.word=new DataView(w.buffer).getUint32(0),this.bitsAvailable=P*8,this.bytesAvailable-=P},G.skipBits=function(B){var R;this.bitsAvailable>B?(this.word<<=B,this.bitsAvailable-=B):(B-=this.bitsAvailable,R=B>>3,B-=R>>3,this.bytesAvailable-=R,this.loadWord(),this.word<<=B,this.bitsAvailable-=B)},G.readBits=function(B){var R=Math.min(this.bitsAvailable,B),x=this.word>>>32-R;return B>32&&Z.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=R,this.bitsAvailable>0?this.word<<=R:this.bytesAvailable>0&&this.loadWord(),R=B-R,R>0&&this.bitsAvailable?x<<R|this.readBits(R):x},G.skipLZ=function(){var B;for(B=0;B<this.bitsAvailable;++B)if((this.word&2147483648>>>B)!==0)return this.word<<=B,this.bitsAvailable-=B,B;return this.loadWord(),B+this.skipLZ()},G.skipUEG=function(){this.skipBits(1+this.skipLZ())},G.skipEG=function(){this.skipBits(1+this.skipLZ())},G.readUEG=function(){var B=this.skipLZ();return this.readBits(B+1)-1},G.readEG=function(){var B=this.readUEG();return 1&B?1+B>>>1:-1*(B>>>1)},G.readBoolean=function(){return this.readBits(1)===1},G.readUByte=function(){return this.readBits(8)},G.readUShort=function(){return this.readBits(16)},G.readUInt=function(){return this.readBits(32)},G.skipScalingList=function(B){for(var R=8,x=8,w,P=0;P<B;P++)x!==0&&(w=this.readEG(),x=(R+w+256)%256),R=x===0?R:x},G.readSPS=function(){var B=0,R=0,x=0,w=0,P,L,A,_=this.readUByte.bind(this),h=this.readBits.bind(this),o=this.readUEG.bind(this),s=this.readBoolean.bind(this),d=this.skipBits.bind(this),T=this.skipEG.bind(this),y=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);_();var f=_();if(h(5),d(3),_(),y(),f===100||f===110||f===122||f===244||f===44||f===83||f===86||f===118||f===128){var E=o();if(E===3&&d(1),y(),y(),d(1),s())for(L=E!==3?8:12,A=0;A<L;A++)s()&&(A<6?m(16):m(64))}y();var p=o();if(p===0)o();else if(p===1)for(d(1),T(),T(),P=o(),A=0;A<P;A++)T();y(),d(1);var g=o(),u=o(),a=h(1);a===0&&d(1),d(1),s()&&(B=o(),R=o(),x=o(),w=o());var b=[1,1];if(s()&&s()){var v=_();switch(v){case 1:b=[1,1];break;case 2:b=[12,11];break;case 3:b=[10,11];break;case 4:b=[16,11];break;case 5:b=[40,33];break;case 6:b=[24,11];break;case 7:b=[20,11];break;case 8:b=[32,11];break;case 9:b=[80,33];break;case 10:b=[18,11];break;case 11:b=[15,11];break;case 12:b=[64,33];break;case 13:b=[160,99];break;case 14:b=[4,3];break;case 15:b=[3,2];break;case 16:b=[2,1];break;case 255:{b=[_()<<8|_(),_()<<8|_()];break}}}return{width:Math.ceil((g+1)*16-B*2-R*2),height:(2-a)*(u+1)*16-(a?2:4)*(x+w),pixelRatio:b}},G.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},k}();J.default=F},"./src/demux/id3.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"isHeader",function(){return Z}),O.d(J,"isFooter",function(){return F}),O.d(J,"getID3Data",function(){return k}),O.d(J,"canParse",function(){return H}),O.d(J,"getTimeStamp",function(){return B}),O.d(J,"isTimeStampFrame",function(){return R}),O.d(J,"getID3Frames",function(){return w}),O.d(J,"decodeFrame",function(){return P}),O.d(J,"utf8ArrayToStr",function(){return o}),O.d(J,"testables",function(){return s});var Z=function(m,f){return f+10<=m.length&&(m[f]===73&&m[f+1]===68&&m[f+2]===51&&(m[f+3]<255&&m[f+4]<255&&(m[f+6]<128&&m[f+7]<128&&m[f+8]<128&&m[f+9]<128)))},F=function(m,f){return f+10<=m.length&&(m[f]===51&&m[f+1]===68&&m[f+2]===73&&(m[f+3]<255&&m[f+4]<255&&(m[f+6]<128&&m[f+7]<128&&m[f+8]<128&&m[f+9]<128)))},k=function(m,f){for(var E=f,p=0;Z(m,f);){p+=10;var g=G(m,f+6);p+=g,F(m,f+10)&&(p+=10),f+=p}return p>0?m.subarray(E,E+p):void 0},G=function(m,f){var E=0;return E=(m[f]&127)<<21,E|=(m[f+1]&127)<<14,E|=(m[f+2]&127)<<7,E|=m[f+3]&127,E},H=function(m,f){return Z(m,f)&&G(m,f+6)+10<=m.length-f},B=function(m){for(var f=w(m),E=0;E<f.length;E++){var p=f[E];if(R(p))return h(p)}return},R=function(m){return m&&m.key==="PRIV"&&m.info==="com.apple.streaming.transportStreamTimestamp"},x=function(m){var f=String.fromCharCode(m[0],m[1],m[2],m[3]),E=G(m,4),p=10;return{type:f,size:E,data:m.subarray(p,p+E)}},w=function(m){for(var f=0,E=[];Z(m,f);){var p=G(m,f+6);f+=10;for(var g=f+p;f+8<g;){var u=x(m.subarray(f)),a=P(u);a&&E.push(a),f+=u.size+10}F(m,f)&&(f+=10)}return E},P=function(m){return m.type==="PRIV"?L(m):m.type[0]==="W"?_(m):A(m)},L=function(m){if(m.size<2)return;var f=o(m.data,!0),E=new Uint8Array(m.data.subarray(f.length+1));return{key:m.type,info:f,data:E.buffer}},A=function(m){if(m.size<2)return;if(m.type==="TXXX"){var f=1,E=o(m.data.subarray(f),!0);f+=E.length+1;var p=o(m.data.subarray(f));return{key:m.type,info:E,data:p}}var g=o(m.data.subarray(1));return{key:m.type,data:g}},_=function(m){if(m.type==="WXXX"){if(m.size<2)return;var f=1,E=o(m.data.subarray(f),!0);f+=E.length+1;var p=o(m.data.subarray(f));return{key:m.type,info:E,data:p}}var g=o(m.data);return{key:m.type,data:g}},h=function(m){if(m.data.byteLength===8){var f=new Uint8Array(m.data),E=f[3]&1,p=(f[4]<<23)+(f[5]<<15)+(f[6]<<7)+f[7];return p/=45,E&&(p+=4772185884e-2),Math.round(p)}return},o=function(m,f){f===void 0&&(f=!1);var E=T();if(E){var p=E.decode(m);if(f){var g=p.indexOf("\0");return g!==-1?p.substring(0,g):p}return p.replace(/\0/g,"")}for(var u=m.length,a,b,v,S="",I=0;I<u;){if(a=m[I++],a===0&&f)return S;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:S+=String.fromCharCode(a);break;case 12:case 13:b=m[I++],S+=String.fromCharCode((a&31)<<6|b&63);break;case 14:b=m[I++],v=m[I++],S+=String.fromCharCode((a&15)<<12|(b&63)<<6|(v&63)<<0);break;default:}}return S},s={decodeTextFrame:A},d;function T(){return!d&&typeof self.TextDecoder!="undefined"&&(d=new self.TextDecoder("utf-8")),d}},"./src/demux/mp3demuxer.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/demux/base-audio-demuxer.ts"),F=O("./src/demux/id3.ts"),k=O("./src/utils/logger.ts"),G=O("./src/demux/mpegaudio.ts");function H(x,w){x.prototype=Object.create(w.prototype),x.prototype.constructor=x,B(x,w)}function B(x,w){return B=Object.setPrototypeOf||function(L,A){return L.__proto__=A,L},B(x,w)}var R=function(x){H(w,x);function w(){return x.apply(this,arguments)||this}var P=w.prototype;return P.resetInitSegment=function(A,_,h){x.prototype.resetInitSegment.call(this,A,_,h),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:A,duration:h,inputTimeScale:9e4,dropped:0}},w.probe=function(A){if(!A)return!1;for(var _=F.getID3Data(A,0)||[],h=_.length,o=A.length;h<o;h++)if(G.probe(A,h))return k.logger.log("MPEG Audio sync word found !"),!0;return!1},P.canParse=function(A,_){return G.canParse(A,_)},P.appendFrame=function(A,_,h){return this.initPTS===null?void 0:G.appendFrame(A,_,h,this.initPTS,this.frameIndex)},w}(Z.default);R.minProbeByteLength=4,J.default=R},"./src/demux/mp4demuxer.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/utils/mp4-tools.ts"),F=O("./src/demux/dummy-demuxed-track.ts"),k=function(){function G(B,R){this.remainderData=null,this.config=void 0,this.config=R}var H=G.prototype;return H.resetTimeStamp=function(){},H.resetInitSegment=function(){},H.resetContiguity=function(){},G.probe=function(R){return Object(Z.findBox)({data:R,start:0,end:Math.min(R.length,16384)},["moof"]).length>0},H.demux=function(R){var x=R,w=Object(F.dummyTrack)();if(this.config.progressive){this.remainderData&&(x=Object(Z.appendUint8Array)(this.remainderData,R));var P=Object(Z.segmentValidRange)(x);this.remainderData=P.remainder,w.samples=P.valid||new Uint8Array}else w.samples=x;return{audioTrack:Object(F.dummyTrack)(),avcTrack:w,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},H.flush=function(){var R=Object(F.dummyTrack)();return R.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(F.dummyTrack)(),avcTrack:R,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},H.demuxSampleAes=function(R,x,w){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},H.destroy=function(){},G}();k.minProbeByteLength=1024,J.default=k},"./src/demux/mpegaudio.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"appendFrame",function(){return B}),O.d(J,"parseHeader",function(){return R}),O.d(J,"isHeaderPattern",function(){return x}),O.d(J,"isHeader",function(){return w}),O.d(J,"canParse",function(){return P}),O.d(J,"probe",function(){return L});var Z=null,F=[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],k=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],G=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],H=[0,1,1,4];function B(A,_,h,o,s){if(h+24>_.length)return;var d=R(_,h);if(d&&h+d.frameLength<=_.length){var T=d.samplesPerFrame*9e4/d.sampleRate,y=o+s*T,m={unit:_.subarray(h,h+d.frameLength),pts:y,dts:y};return A.config=[],A.channelCount=d.channelCount,A.samplerate=d.sampleRate,A.samples.push(m),{sample:m,length:d.frameLength,missing:0}}}function R(A,_){var h=A[_+1]>>3&3,o=A[_+1]>>1&3,s=A[_+2]>>4&15,d=A[_+2]>>2&3;if(h!==1&&s!==0&&s!==15&&d!==3){var T=A[_+2]>>1&1,y=A[_+3]>>6,m=h===3?3-o:o===3?3:4,f=F[m*14+s-1]*1e3,E=h===3?0:h===2?1:2,p=k[E*3+d],g=y===3?1:2,u=G[h][o],a=H[o],b=u*8*a,v=Math.floor(u*f/p+T)*a;if(Z===null){var S=navigator.userAgent||"",I=S.match(/Chrome\/(\d+)/i);Z=I?parseInt(I[1]):0}var j=!!Z&&Z<=87;return j&&o===2&&f>=224e3&&y===0&&(A[_+3]=A[_+3]|128),{sampleRate:p,channelCount:g,frameLength:v,samplesPerFrame:b}}}function x(A,_){return A[_]===255&&(A[_+1]&224)===224&&(A[_+1]&6)!==0}function w(A,_){return _+1<A.length&&x(A,_)}function P(A,_){var h=4;return x(A,_)&&h<=A.length-_}function L(A,_){if(_+1<A.length&&x(A,_)){var h=4,o=R(A,_),s=h;o!=null&&o.frameLength&&(s=o.frameLength);var d=_+s;return d===A.length||w(A,d)}return!1}},"./src/demux/sample-aes.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/crypt/decrypter.ts"),F=O("./src/demux/tsdemuxer.ts"),k=function(){function G(B,R,x){this.keyData=void 0,this.decrypter=void 0,this.keyData=x,this.decrypter=new Z.default(B,R,{removePKCS7Padding:!1})}var H=G.prototype;return H.decryptBuffer=function(R,x){this.decrypter.decrypt(R,this.keyData.key.buffer,this.keyData.iv.buffer,x)},H.decryptAacSample=function(R,x,w,P){var L=R[x].unit,A=L.subarray(16,L.length-L.length%16),_=A.buffer.slice(A.byteOffset,A.byteOffset+A.length),h=this;this.decryptBuffer(_,function(o){var s=new Uint8Array(o);L.set(s,16),P||h.decryptAacSamples(R,x+1,w)})},H.decryptAacSamples=function(R,x,w){for(;;x++){if(x>=R.length){w();return}if(R[x].unit.length<32)continue;var P=this.decrypter.isSync();if(this.decryptAacSample(R,x,w,P),!P)return}},H.getAvcEncryptedData=function(R){for(var x=Math.floor((R.length-48)/160)*16+16,w=new Int8Array(x),P=0,L=32;L<=R.length-16;L+=160,P+=16)w.set(R.subarray(L,L+16),P);return w},H.getAvcDecryptedUnit=function(R,x){for(var w=new Uint8Array(x),P=0,L=32;L<=R.length-16;L+=160,P+=16)R.set(w.subarray(P,P+16),L);return R},H.decryptAvcSample=function(R,x,w,P,L,A){var _=Object(F.discardEPB)(L.data),h=this.getAvcEncryptedData(_),o=this;this.decryptBuffer(h.buffer,function(s){L.data=o.getAvcDecryptedUnit(_,s),A||o.decryptAvcSamples(R,x,w+1,P)})},H.decryptAvcSamples=function(R,x,w,P){if(R instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;x++,w=0){if(x>=R.length){P();return}for(var L=R[x].units;!(w>=L.length);w++){var A=L[w];if(A.data.length<=48||A.type!==1&&A.type!==5)continue;var _=this.decrypter.isSync();if(this.decryptAvcSample(R,x,w,P,A,_),!_)return}}},G}();J.default=k},"./src/demux/transmuxer-interface.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return L});var Z=O("./node_modules/webworkify-webpack/index.js"),F=O.n(Z),k=O("./src/events.ts"),G=O("./src/demux/transmuxer.ts"),H=O("./src/utils/logger.ts"),B=O("./src/errors.ts"),R=O("./src/utils/mediasource-helper.ts"),x=O("./node_modules/eventemitter3/index.js"),w=O.n(x),P=Object(R.getMediaSource)()||{isTypeSupported:function(){return!1}},L=function(){function A(h,o,s,d){var T=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=h,this.id=o,this.onTransmuxComplete=s,this.onFlush=d;var y=h.config,m=function(u,a){a=a||{},a.frag=T.frag,a.id=T.id,h.trigger(u,a)};this.observer=new x.EventEmitter,this.observer.on(k.Events.FRAG_DECRYPTED,m),this.observer.on(k.Events.ERROR,m);var f={mp4:P.isTypeSupported("video/mp4"),mpeg:P.isTypeSupported("audio/mpeg"),mp3:P.isTypeSupported('audio/mp4; codecs="mp3"')},E=navigator.vendor;if(y.enableWorker&&typeof Worker!="undefined"){H.logger.log("demuxing in webworker");var p;try{p=this.worker=Z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),p.addEventListener("message",this.onwmsg),p.onerror=function(g){h.trigger(k.Events.ERROR,{type:B.ErrorTypes.OTHER_ERROR,details:B.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(g.message+" ("+g.filename+":"+g.lineno+")")})},p.postMessage({cmd:"init",typeSupported:f,vendor:E,id:o,config:JSON.stringify(y)})}catch(g){H.logger.warn("Error in worker:",g),H.logger.error("Error while initializing DemuxerWorker, fallback to inline"),p&&self.URL.revokeObjectURL(p.objectURL),this.transmuxer=new G.default(this.observer,f,y,E,o),this.worker=null}}else this.transmuxer=new G.default(this.observer,f,y,E,o)}var _=A.prototype;return _.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},_.push=function(o,s,d,T,y,m,f,E,p,g){var u=this;p.transmuxing.start=self.performance.now();var a=this.transmuxer,b=this.worker,v=m?m.start:y.start,S=y.decryptdata,I=this.frag,j=!(I&&y.cc===I.cc),z=!(I&&p.level===I.level),V=I?p.sn-I.sn:-1,M=this.part?p.part-this.part.index:1,N=!z&&(V===1||V===0&&M===1),$=self.performance.now();(z||V||y.stats.parsing.start===0)&&(y.stats.parsing.start=$),m&&(M||!N)&&(m.stats.parsing.start=$);var ie=new G.TransmuxState(j,N,E,z,v);if(!N||j){H.logger.log("[transmuxer-interface, "+y.type+"]: Starting new transmux session for sn: "+p.sn+" p: "+p.part+" level: "+p.level+" id: "+p.id+`
discontinuity: `+j+`
trackSwitch: `+z+`
contiguous: `+N+`
accurateTimeOffset: `+E+`
timeOffset: `+v);var he=new G.TransmuxConfig(d,T,s,f,g);this.configureTransmuxer(he)}if(this.frag=y,this.part=m,b)b.postMessage({cmd:"demux",data:o,decryptdata:S,chunkMeta:p,state:ie},o instanceof ArrayBuffer?[o]:[]);else if(a){var me=a.push(o,S,p,ie);Object(G.isPromise)(me)?me.then(function(ke){u.handleTransmuxComplete(ke)}):this.handleTransmuxComplete(me)}},_.flush=function(o){var s=this;o.transmuxing.start=self.performance.now();var d=this.transmuxer,T=this.worker;if(T)T.postMessage({cmd:"flush",chunkMeta:o});else if(d){var y=d.flush(o);Object(G.isPromise)(y)?y.then(function(m){s.handleFlushResult(m,o)}):this.handleFlushResult(y,o)}},_.handleFlushResult=function(o,s){var d=this;o.forEach(function(T){d.handleTransmuxComplete(T)}),this.onFlush(s)},_.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}}},_.configureTransmuxer=function(o){var s=this.worker,d=this.transmuxer;s?s.postMessage({cmd:"configure",config:o}):d&&d.configure(o)},_.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},A}()},"./src/demux/transmuxer-worker.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return B});var Z=O("./src/demux/transmuxer.ts"),F=O("./src/events.ts"),k=O("./src/utils/logger.ts"),G=O("./node_modules/eventemitter3/index.js"),H=O.n(G);function B(L){var A=new G.EventEmitter,_=function(o,s){L.postMessage({event:o,data:s})};A.on(F.Events.FRAG_DECRYPTED,_),A.on(F.Events.ERROR,_),L.addEventListener("message",function(h){var o=h.data;switch(o.cmd){case"init":{var s=JSON.parse(o.config);L.transmuxer=new Z.default(A,o.typeSupported,s,o.vendor,o.id),Object(k.enableLogs)(s.debug),_("init",null);break}case"configure":{L.transmuxer.configure(o.config);break}case"demux":{var d=L.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(Z.isPromise)(d)?d.then(function(m){R(L,m)}):R(L,d);break}case"flush":{var T=o.chunkMeta,y=L.transmuxer.flush(T);Object(Z.isPromise)(y)?y.then(function(m){w(L,m,T)}):w(L,y,T);break}default:break}})}function R(L,A){if(P(A.remuxResult))return;var _=[],h=A.remuxResult,o=h.audio,s=h.video;o&&x(_,o),s&&x(_,s),L.postMessage({event:"transmuxComplete",data:A},_)}function x(L,A){A.data1&&L.push(A.data1.buffer),A.data2&&L.push(A.data2.buffer)}function w(L,A,_){A.forEach(function(h){R(L,h)}),L.postMessage({event:"flush",data:_})}function P(L){return!L.audio&&!L.video&&!L.text&&!L.id3&&!L.initSegment}},"./src/demux/transmuxer.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return s}),O.d(J,"isPromise",function(){return y}),O.d(J,"TransmuxConfig",function(){return m}),O.d(J,"TransmuxState",function(){return f});var Z=O("./src/events.ts"),F=O("./src/errors.ts"),k=O("./src/crypt/decrypter.ts"),G=O("./src/demux/aacdemuxer.ts"),H=O("./src/demux/mp4demuxer.ts"),B=O("./src/demux/tsdemuxer.ts"),R=O("./src/demux/mp3demuxer.ts"),x=O("./src/remux/mp4-remuxer.ts"),w=O("./src/remux/passthrough-remuxer.ts"),P=O("./src/demux/chunk-cache.ts"),L=O("./src/utils/mp4-tools.ts"),A=O("./src/utils/logger.ts"),_;try{_=self.performance.now.bind(self.performance)}catch(E){A.logger.debug("Unable to use Performance API on this environment"),_=self.Date.now}var h=[{demux:B.default,remux:x.default},{demux:H.default,remux:w.default},{demux:G.default,remux:x.default},{demux:R.default,remux:x.default}],o=1024;h.forEach(function(E){var p=E.demux;o=Math.max(o,p.minProbeByteLength)});var s=function(){function E(g,u,a,b,v){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=g,this.typeSupported=u,this.config=a,this.vendor=b,this.id=v}var p=E.prototype;return p.configure=function(u){this.transmuxConfig=u,this.decrypter&&this.decrypter.reset()},p.push=function(u,a,b,v){var S=this,I=b.transmuxing;I.executeStart=_();var j=new Uint8Array(u),z=this.cache,V=this.config,M=this.currentTransmuxState,N=this.transmuxConfig;v&&(this.currentTransmuxState=v);var $=d(j,a);if($&&$.method==="AES-128"){var ie=this.getDecrypter();if(V.enableSoftwareAES){var he=ie.softwareDecrypt(j,$.key.buffer,$.iv.buffer);if(!he)return I.executeEnd=_(),T(b);j=new Uint8Array(he)}else return this.decryptionPromise=ie.webCryptoDecrypt(j,$.key.buffer,$.iv.buffer).then(function(be){var xe=S.push(be,null,b);return S.decryptionPromise=null,xe}),this.decryptionPromise}var me=v||M,ke=me.contiguous,Se=me.discontinuity,Re=me.trackSwitch,Te=me.accurateTimeOffset,_e=me.timeOffset,ye=N.audioCodec,K=N.videoCodec,l=N.defaultInitPts,c=N.duration,D=N.initSegmentData;if((Se||Re)&&this.resetInitSegment(D,ye,K,c),Se&&this.resetInitialTimestamp(l),ke||this.resetContiguity(),this.needsProbing(j,Se,Re)){if(z.dataLength){var X=z.flush();j=Object(L.appendUint8Array)(X,j)}this.configureTransmuxer(j,N)}var U=this.transmux(j,$,_e,Te,b),oe=this.currentTransmuxState;return oe.contiguous=!0,oe.discontinuity=!1,oe.trackSwitch=!1,I.executeEnd=_(),U},p.flush=function(u){var a=this,b=u.transmuxing;b.executeStart=_();var v=this.decrypter,S=this.cache,I=this.currentTransmuxState,j=this.decryptionPromise;if(j)return j.then(function(){return a.flush(u)});var z=[],V=I.timeOffset;if(v){var M=v.flush();M&&z.push(this.push(M,null,u))}var N=S.dataLength;S.reset();var $=this.demuxer,ie=this.remuxer;if(!$||!ie)return N>=o&&this.observer.emit(Z.Events.ERROR,Z.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),b.executeEnd=_(),[T(u)];var he=$.flush(V);return y(he)?he.then(function(me){return a.flushRemux(z,me,u),z}):(this.flushRemux(z,he,u),z)},p.flushRemux=function(u,a,b){var v=a.audioTrack,S=a.avcTrack,I=a.id3Track,j=a.textTrack,z=this.currentTransmuxState,V=z.accurateTimeOffset,M=z.timeOffset;A.logger.log("[transmuxer.ts]: Flushed fragment "+b.sn+(b.part>-1?" p: "+b.part:"")+" of level "+b.level);var N=this.remuxer.remux(v,S,I,j,M,V,!0,this.id);u.push({remuxResult:N,chunkMeta:b}),b.transmuxing.executeEnd=_()},p.resetInitialTimestamp=function(u){var a=this.demuxer,b=this.remuxer;if(!a||!b)return;a.resetTimeStamp(u),b.resetTimeStamp(u)},p.resetContiguity=function(){var u=this.demuxer,a=this.remuxer;if(!u||!a)return;u.resetContiguity(),a.resetNextTimestamp()},p.resetInitSegment=function(u,a,b,v){var S=this.demuxer,I=this.remuxer;if(!S||!I)return;S.resetInitSegment(a,b,v),I.resetInitSegment(u,a,b)},p.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},p.transmux=function(u,a,b,v,S){var I;return a&&a.method==="SAMPLE-AES"?I=this.transmuxSampleAes(u,a,b,v,S):I=this.transmuxUnencrypted(u,b,v,S),I},p.transmuxUnencrypted=function(u,a,b,v){var S=this.demuxer.demux(u,a,!1,!this.config.progressive),I=S.audioTrack,j=S.avcTrack,z=S.id3Track,V=S.textTrack,M=this.remuxer.remux(I,j,z,V,a,b,!1,this.id);return{remuxResult:M,chunkMeta:v}},p.transmuxSampleAes=function(u,a,b,v,S){var I=this;return this.demuxer.demuxSampleAes(u,a,b).then(function(j){var z=I.remuxer.remux(j.audioTrack,j.avcTrack,j.id3Track,j.textTrack,b,v,!1,I.id);return{remuxResult:z,chunkMeta:S}})},p.configureTransmuxer=function(u,a){for(var b=this.config,v=this.observer,S=this.typeSupported,I=this.vendor,j=a.audioCodec,z=a.defaultInitPts,V=a.duration,M=a.initSegmentData,N=a.videoCodec,$,ie=0,he=h.length;ie<he;ie++)if(h[ie].demux.probe(u)){$=h[ie];break}$||(A.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),$={demux:H.default,remux:w.default});var me=this.demuxer,ke=this.remuxer,Se=$.remux,Re=$.demux;(!ke||!(ke instanceof Se))&&(this.remuxer=new Se(v,b,S,I)),(!me||!(me instanceof Re))&&(this.demuxer=new Re(v,b,S),this.probe=Re.probe),this.resetInitSegment(M,j,N,V),this.resetInitialTimestamp(z)},p.needsProbing=function(u,a,b){return!this.demuxer||!this.remuxer||a||b},p.getDecrypter=function(){var u=this.decrypter;return u||(u=this.decrypter=new k.default(this.observer,this.config)),u},E}();function d(E,p){var g=null;return E.byteLength>0&&p!=null&&p.key!=null&&p.iv!==null&&p.method!=null&&(g=p),g}var T=function(p){return{remuxResult:{},chunkMeta:p}};function y(E){return"then"in E&&E.then instanceof Function}var m=function(p,g,u,a,b){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=p,this.videoCodec=g,this.initSegmentData=u,this.duration=a,this.defaultInitPts=b},f=function(p,g,u,a,b){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=p,this.contiguous=g,this.accurateTimeOffset=u,this.trackSwitch=a,this.timeOffset=b}},"./src/demux/tsdemuxer.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"discardEPB",function(){return T});var Z=O("./src/demux/adts.ts"),F=O("./src/demux/mpegaudio.ts"),k=O("./src/demux/exp-golomb.ts"),G=O("./src/demux/id3.ts"),H=O("./src/demux/sample-aes.ts"),B=O("./src/events.ts"),R=O("./src/utils/mp4-tools.ts"),x=O("./src/utils/logger.ts"),w=O("./src/errors.ts"),P={video:1,audio:2,id3:3,text:4},L=function(){function y(f,E,p){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=f,this.config=E,this.typeSupported=p}y.probe=function(E){var p=y.syncOffset(E);return p<0?!1:(p&&x.logger.warn("MPEG2-TS detected but first sync word found @ offset "+p+", junk ahead ?"),!0)},y.syncOffset=function(E){for(var p=Math.min(1e3,E.length-3*188),g=0;g<p;){if(E[g]===71&&E[g+188]===71&&E[g+2*188]===71)return g;g++}return-1},y.createTrack=function(E,p){return{container:E==="video"||E==="audio"?"video/mp2t":void 0,type:E,id:P[E],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:E==="audio"?p:void 0}};var m=y.prototype;return m.resetInitSegment=function(E,p,g){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=y.createTrack("video",g),this._audioTrack=y.createTrack("audio",g),this._id3Track=y.createTrack("id3",g),this._txtTrack=y.createTrack("text",g),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=E,this.videoCodec=p,this._duration=g},m.resetTimeStamp=function(){},m.resetContiguity=function(){var E=this._audioTrack,p=this._avcTrack,g=this._id3Track;E&&(E.pesData=null),p&&(p.pesData=null),g&&(g.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},m.demux=function(E,p,g,u){g===void 0&&(g=!1),u===void 0&&(u=!1),g||(this.sampleAes=null);var a,b=this._avcTrack,v=this._audioTrack,S=this._id3Track,I=b.pid,j=b.pesData,z=v.pid,V=S.pid,M=v.pesData,N=S.pesData,$=!1,ie=this.pmtParsed,he=this._pmtId,me=E.length;if(this.remainderData&&(E=Object(R.appendUint8Array)(this.remainderData,E),me=E.length,this.remainderData=null),me<188&&!u)return this.remainderData=E,{audioTrack:v,avcTrack:b,id3Track:S,textTrack:this._txtTrack};var ke=Math.max(0,y.syncOffset(E));me-=(me+ke)%188,me<E.byteLength&&!u&&(this.remainderData=new Uint8Array(E.buffer,me,E.buffer.byteLength-me));for(var Se=ke;Se<me;Se+=188)if(E[Se]===71){var Re=!!(E[Se+1]&64),Te=((E[Se+1]&31)<<8)+E[Se+2],_e=(E[Se+3]&48)>>4,ye=void 0;if(_e>1){if(ye=Se+5+E[Se+4],ye===Se+188)continue}else ye=Se+4;switch(Te){case I:Re&&(j&&(a=o(j))&&this.parseAVCPES(a,!1),j={data:[],size:0}),j&&(j.data.push(E.subarray(ye,Se+188)),j.size+=Se+188-ye);break;case z:Re&&(M&&(a=o(M))&&(v.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),M={data:[],size:0}),M&&(M.data.push(E.subarray(ye,Se+188)),M.size+=Se+188-ye);break;case V:Re&&(N&&(a=o(N))&&this.parseID3PES(a),N={data:[],size:0}),N&&(N.data.push(E.subarray(ye,Se+188)),N.size+=Se+188-ye);break;case 0:Re&&(ye+=E[ye]+1),he=this._pmtId=_(E,ye);break;case he:{Re&&(ye+=E[ye]+1);var K=h(E,ye,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,g);I=K.avc,I>0&&(b.pid=I),z=K.audio,z>0&&(v.pid=z,v.isAAC=K.isAAC),V=K.id3,V>0&&(S.pid=V),$&&!ie&&(x.logger.log("reparse from beginning"),$=!1,Se=ke-188),ie=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=!0;break}}else this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});b.pesData=j,v.pesData=M,S.pesData=N;var l={audioTrack:v,avcTrack:b,id3Track:S,textTrack:this._txtTrack};return u&&this.extractRemainingSamples(l),l},m.flush=function(){var E=this.remainderData;this.remainderData=null;var p;return E?p=this.demux(E,-1,!1,!0):p={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(p),this.sampleAes?this.decrypt(p,this.sampleAes):p},m.extractRemainingSamples=function(E){var p=E.audioTrack,g=E.avcTrack,u=E.id3Track,a=g.pesData,b=p.pesData,v=u.pesData,S;a&&(S=o(a))?(this.parseAVCPES(S,!0),g.pesData=null):g.pesData=a,b&&(S=o(b))?(p.isAAC?this.parseAACPES(S):this.parseMPEGPES(S),p.pesData=null):(b!=null&&b.size&&x.logger.log("last AAC PES packet truncated,might overlap between fragments"),p.pesData=b),v&&(S=o(v))?(this.parseID3PES(S),u.pesData=null):u.pesData=v},m.demuxSampleAes=function(E,p,g){var u=this.demux(E,g,!0,!this.config.progressive),a=this.sampleAes=new H.default(this.observer,this.config,p);return this.decrypt(u,a)},m.decrypt=function(E,p){return new Promise(function(g){var u=E.audioTrack,a=E.avcTrack;u.samples&&u.isAAC?p.decryptAacSamples(u.samples,0,function(){a.samples?p.decryptAvcSamples(a.samples,0,0,function(){g(E)}):g(E)}):a.samples&&p.decryptAvcSamples(a.samples,0,0,function(){g(E)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(E,p){var g=this,u=this._avcTrack,a=this.parseAVCNALu(E.data),b=!1,v=this.avcSample,S,I=!1;E.data=null,v&&a.length&&!u.audFound&&(s(v,u),v=this.avcSample=A(!1,E.pts,E.dts,"")),a.forEach(function(j){switch(j.type){case 1:{S=!0,v||(v=g.avcSample=A(!0,E.pts,E.dts,"")),b&&(v.debug+="NDR "),v.frame=!0;var z=j.data;if(I&&z.length>4){var V=new k.default(z).readSliceType();(V===2||V===4||V===7||V===9)&&(v.key=!0)}break}case 5:S=!0,v||(v=g.avcSample=A(!0,E.pts,E.dts,"")),b&&(v.debug+="IDR "),v.key=!0,v.frame=!0;break;case 6:{S=!0,b&&v&&(v.debug+="SEI ");var M=new k.default(T(j.data));M.readUByte();for(var N=0,$=0,ie=!1,he=0;!ie&&M.bytesAvailable>1;){N=0;do he=M.readUByte(),N+=he;while(he===255);$=0;do he=M.readUByte(),$+=he;while(he===255);if(N===4&&M.bytesAvailable!==0){ie=!0;var me=M.readUByte();if(me===181){var ke=M.readUShort();if(ke===49){var Se=M.readUInt();if(Se===1195456820){var Re=M.readUByte();if(Re===3){for(var Te=M.readUByte(),_e=M.readUByte(),ye=31&Te,K=[Te,_e],l=0;l<ye;l++)K.push(M.readUByte()),K.push(M.readUByte()),K.push(M.readUByte());d(g._txtTrack.samples,{type:3,pts:E.pts,bytes:K})}}}}}else if(N===5&&M.bytesAvailable!==0){if(ie=!0,$>16){for(var c=[],D=0;D<16;D++)c.push(M.readUByte().toString(16)),(D===3||D===5||D===7||D===9)&&c.push("-");for(var X=$-16,U=new Uint8Array(X),oe=0;oe<X;oe++)U[oe]=M.readUByte();d(g._txtTrack.samples,{pts:E.pts,payloadType:N,uuid:c.join(""),userData:Object(G.utf8ArrayToStr)(U),userDataBytes:U})}}else if($<M.bytesAvailable)for(var be=0;be<$;be++)M.readUByte()}break}case 7:if(S=!0,I=!0,b&&v&&(v.debug+="SPS "),!u.sps){var xe=new k.default(j.data),Pe=xe.readSPS();u.width=Pe.width,u.height=Pe.height,u.pixelRatio=Pe.pixelRatio,u.sps=[j.data],u.duration=g._duration;for(var De=j.data.subarray(1,4),Oe="avc1.",Ie=0;Ie<3;Ie++){var He=De[Ie].toString(16);He.length<2&&(He="0"+He),Oe+=He}u.codec=Oe}break;case 8:S=!0,b&&v&&(v.debug+="PPS "),u.pps||(u.pps=[j.data]);break;case 9:S=!1,u.audFound=!0,v&&s(v,u),v=g.avcSample=A(!1,E.pts,E.dts,b?"AUD ":"");break;case 12:S=!1;break;default:S=!1,v&&(v.debug+="unknown NAL "+j.type+" ");break}if(v&&S){var Ve=v.units;Ve.push(j)}}),p&&v&&(s(v,u),this.avcSample=null)},m.getLastNalUnit=function(){var E,p=this.avcSample,g;if(!p||p.units.length===0){var u=this._avcTrack.samples;p=u[u.length-1]}if((E=p)!==null&&E!==void 0&&E.units){var a=p.units;g=a[a.length-1]}return g},m.parseAVCNALu=function(E){var p=E.byteLength,g=this._avcTrack,u=g.naluState||0,a=u,b=[],v=0,S,I,j,z=-1,V=0;for(u===-1&&(z=0,V=E[0]&31,u=0,v=1);v<p;){if(S=E[v++],!u){u=S?0:1;continue}if(u===1){u=S?0:2;continue}if(!S)u=3;else if(S===1){if(z>=0){var M={data:E.subarray(z,v-u-1),type:V};b.push(M)}else{var N=this.getLastNalUnit();if(N&&(a&&v<=4-a&&(N.state&&(N.data=N.data.subarray(0,N.data.byteLength-a))),I=v-u-1,I>0)){var $=new Uint8Array(N.data.byteLength+I);$.set(N.data,0),$.set(E.subarray(0,I),N.data.byteLength),N.data=$,N.state=0}}v<p?(j=E[v]&31,z=v,V=j,u=0):u=-1}else u=0}if(z>=0&&u>=0){var ie={data:E.subarray(z,p),type:V,state:u};b.push(ie)}if(b.length===0){var he=this.getLastNalUnit();if(he){var me=new Uint8Array(he.data.byteLength+E.byteLength);me.set(he.data,0),me.set(E,he.data.byteLength),he.data=me}}return g.naluState=u,b},m.parseAACPES=function(E){var p=0,g=this._audioTrack,u=this.aacOverFlow,a=E.data;if(u){this.aacOverFlow=null;var b=u.sample.unit.byteLength,v=Math.min(u.missing,b),S=b-v;u.sample.unit.set(a.subarray(0,v),S),g.samples.push(u.sample),p=u.missing}var I,j;for(I=p,j=a.length;I<j-1&&!Z.isHeader(a,I);I++);if(I!==p){var z,V;if(I<j-1?(z="AAC PES did not start with ADTS header,offset:"+I,V=!1):(z="no ADTS header found in AAC PES",V=!0),x.logger.warn("parsing error:"+z),this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:z}),V)return}Z.initTrackConfig(g,this.observer,a,I,this.audioCodec);var M;if(E.pts!==void 0)M=E.pts;else if(u){var N=Z.getFrameDuration(g.samplerate);M=u.sample.pts+N}else{x.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var $=0;I<j;)if(Z.isHeader(a,I)){if(I+5<j){var ie=Z.appendFrame(g,a,I,M,$);if(ie)if(ie.missing)this.aacOverFlow=ie;else{I+=ie.length,$++;continue}}break}else I++},m.parseMPEGPES=function(E){var p=E.data,g=p.length,u=0,a=0,b=E.pts;if(b===void 0){x.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<g;)if(F.isHeader(p,a)){var v=F.appendFrame(this._audioTrack,p,a,b,u);if(v)a+=v.length,u++;else break}else a++},m.parseID3PES=function(E){if(E.pts===void 0){x.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(E)},y}();L.minProbeByteLength=188;function A(y,m,f,E){return{key:y,frame:!1,pts:m,dts:f,units:[],debug:E,length:0}}function _(y,m){return(y[m+10]&31)<<8|y[m+11]}function h(y,m,f,E){var p={audio:-1,avc:-1,id3:-1,isAAC:!0},g=(y[m+1]&15)<<8|y[m+2],u=m+3+g-4,a=(y[m+10]&15)<<8|y[m+11];for(m+=12+a;m<u;){var b=(y[m+1]&31)<<8|y[m+2];switch(y[m]){case 207:if(!E){x.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:p.audio===-1&&(p.audio=b);break;case 21:p.id3===-1&&(p.id3=b);break;case 219:if(!E){x.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:p.avc===-1&&(p.avc=b);break;case 3:case 4:f?p.audio===-1&&(p.audio=b,p.isAAC=!1):x.logger.log("MPEG audio found, not supported in this browser");break;case 36:x.logger.warn("Unsupported HEVC stream type found");break;default:break}m+=((y[m+3]&15)<<8|y[m+4])+5}return p}function o(y){var m=0,f,E,p,g,u,a=y.data;if(!y||y.size===0)return null;for(;a[0].length<19&&a.length>1;){var b=new Uint8Array(a[0].length+a[1].length);b.set(a[0]),b.set(a[1],a[0].length),a[0]=b,a.splice(1,1)}f=a[0];var v=(f[0]<<16)+(f[1]<<8)+f[2];if(v===1){if(E=(f[4]<<8)+f[5],E&&E>y.size-6)return null;var S=f[7];S&192&&(g=(f[9]&14)*536870912+(f[10]&255)*4194304+(f[11]&254)*16384+(f[12]&255)*128+(f[13]&254)/2,S&64?(u=(f[14]&14)*536870912+(f[15]&255)*4194304+(f[16]&254)*16384+(f[17]&255)*128+(f[18]&254)/2,g-u>60*9e4&&(x.logger.warn(Math.round((g-u)/9e4)+"s delta between PTS and DTS, align them"),g=u)):u=g),p=f[8];var I=p+9;if(y.size<=I)return null;y.size-=I;for(var j=new Uint8Array(y.size),z=0,V=a.length;z<V;z++){f=a[z];var M=f.byteLength;if(I)if(I>M){I-=M;continue}else f=f.subarray(I),M-=I,I=0;j.set(f,m),m+=M}return E&&(E-=p+3),{data:j,pts:g,dts:u,len:E}}return null}function s(y,m){if(y.units.length&&y.frame){if(y.pts===void 0){var f=m.samples,E=f.length;if(E){var p=f[E-1];y.pts=p.pts,y.dts=p.dts}else{m.dropped++;return}}m.samples.push(y)}y.debug.length&&x.logger.log(y.pts+"/"+y.dts+":"+y.debug)}function d(y,m){var f=y.length;if(f>0){if(m.pts>=y[f-1].pts)y.push(m);else for(var E=f-1;E>=0;E--)if(m.pts<y[E].pts){y.splice(E,0,m);break}}else y.push(m)}function T(y){for(var m=y.byteLength,f=[],E=1;E<m-2;)y[E]===0&&y[E+1]===0&&y[E+2]===3?(f.push(E+2),E+=2):E++;if(f.length===0)return y;var p=m-f.length,g=new Uint8Array(p),u=0;for(E=0;E<p;u++,E++)u===f[0]&&(u++,f.shift()),g[E]=y[u];return g}J.default=L},"./src/errors.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"ErrorTypes",function(){return Z}),O.d(J,"ErrorDetails",function(){return F});var Z;(function(k){k.NETWORK_ERROR="networkError",k.MEDIA_ERROR="mediaError",k.KEY_SYSTEM_ERROR="keySystemError",k.MUX_ERROR="muxError",k.OTHER_ERROR="otherError"})(Z||(Z={}));var F;(function(k){k.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",k.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",k.KEY_SYSTEM_NO_SESSION="keySystemNoSession",k.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",k.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",k.MANIFEST_LOAD_ERROR="manifestLoadError",k.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",k.MANIFEST_PARSING_ERROR="manifestParsingError",k.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",k.LEVEL_EMPTY_ERROR="levelEmptyError",k.LEVEL_LOAD_ERROR="levelLoadError",k.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",k.LEVEL_SWITCH_ERROR="levelSwitchError",k.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",k.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",k.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",k.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",k.FRAG_LOAD_ERROR="fragLoadError",k.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",k.FRAG_DECRYPT_ERROR="fragDecryptError",k.FRAG_PARSING_ERROR="fragParsingError",k.REMUX_ALLOC_ERROR="remuxAllocError",k.KEY_LOAD_ERROR="keyLoadError",k.KEY_LOAD_TIMEOUT="keyLoadTimeOut",k.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",k.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",k.BUFFER_APPEND_ERROR="bufferAppendError",k.BUFFER_APPENDING_ERROR="bufferAppendingError",k.BUFFER_STALLED_ERROR="bufferStalledError",k.BUFFER_FULL_ERROR="bufferFullError",k.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",k.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",k.INTERNAL_EXCEPTION="internalException",k.INTERNAL_ABORTED="aborted",k.UNKNOWN="unknown"})(F||(F={}))},"./src/events.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"Events",function(){return Z});var Z;(function(F){F.MEDIA_ATTACHING="hlsMediaAttaching",F.MEDIA_ATTACHED="hlsMediaAttached",F.MEDIA_DETACHING="hlsMediaDetaching",F.MEDIA_DETACHED="hlsMediaDetached",F.BUFFER_RESET="hlsBufferReset",F.BUFFER_CODECS="hlsBufferCodecs",F.BUFFER_CREATED="hlsBufferCreated",F.BUFFER_APPENDING="hlsBufferAppending",F.BUFFER_APPENDED="hlsBufferAppended",F.BUFFER_EOS="hlsBufferEos",F.BUFFER_FLUSHING="hlsBufferFlushing",F.BUFFER_FLUSHED="hlsBufferFlushed",F.MANIFEST_LOADING="hlsManifestLoading",F.MANIFEST_LOADED="hlsManifestLoaded",F.MANIFEST_PARSED="hlsManifestParsed",F.LEVEL_SWITCHING="hlsLevelSwitching",F.LEVEL_SWITCHED="hlsLevelSwitched",F.LEVEL_LOADING="hlsLevelLoading",F.LEVEL_LOADED="hlsLevelLoaded",F.LEVEL_UPDATED="hlsLevelUpdated",F.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",F.LEVELS_UPDATED="hlsLevelsUpdated",F.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",F.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",F.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",F.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",F.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",F.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",F.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",F.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",F.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",F.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",F.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",F.CUES_PARSED="hlsCuesParsed",F.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",F.INIT_PTS_FOUND="hlsInitPtsFound",F.FRAG_LOADING="hlsFragLoading",F.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",F.FRAG_LOADED="hlsFragLoaded",F.FRAG_DECRYPTED="hlsFragDecrypted",F.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",F.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",F.FRAG_PARSING_METADATA="hlsFragParsingMetadata",F.FRAG_PARSED="hlsFragParsed",F.FRAG_BUFFERED="hlsFragBuffered",F.FRAG_CHANGED="hlsFragChanged",F.FPS_DROP="hlsFpsDrop",F.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",F.ERROR="hlsError",F.DESTROYING="hlsDestroying",F.KEY_LOADING="hlsKeyLoading",F.KEY_LOADED="hlsKeyLoaded",F.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",F.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Z||(Z={}))},"./src/hls.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return y});var Z=O("./node_modules/url-toolkit/src/url-toolkit.js"),F=O.n(Z),k=O("./src/loader/playlist-loader.ts"),G=O("./src/loader/key-loader.ts"),H=O("./src/controller/id3-track-controller.ts"),B=O("./src/controller/latency-controller.ts"),R=O("./src/controller/level-controller.ts"),x=O("./src/controller/fragment-tracker.ts"),w=O("./src/controller/stream-controller.ts"),P=O("./src/is-supported.ts"),L=O("./src/utils/logger.ts"),A=O("./src/config.ts"),_=O("./node_modules/eventemitter3/index.js"),h=O.n(_),o=O("./src/events.ts"),s=O("./src/errors.ts");function d(m,f){for(var E=0;E<f.length;E++){var p=f[E];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(m,p.key,p)}}function T(m,f,E){return f&&d(m.prototype,f),E&&d(m,E),m}var y=function(){m.isSupported=function(){return Object(P.isSupported)()};function m(E){E===void 0&&(E={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new _.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var p=this.config=Object(A.mergeConfig)(m.DefaultConfig,E);this.userConfig=E,Object(L.enableLogs)(p.debug),this._autoLevelCapping=-1,p.progressive&&Object(A.enableStreamingMode)(p);var g=p.abrController,u=p.bufferController,a=p.capLevelController,b=p.fpsController,v=this.abrController=new g(this),S=this.bufferController=new u(this),I=this.capLevelController=new a(this),j=new b(this),z=new k.default(this),V=new G.default(this),M=new H.default(this),N=this.levelController=new R.default(this),$=new x.FragmentTracker(this),ie=this.streamController=new w.default(this,$);I.setStreamController(ie),j.setStreamController(ie);var he=[N,ie];this.networkControllers=he;var me=[z,V,v,S,I,j,M,$];this.audioTrackController=this.createController(p.audioTrackController,null,he),this.createController(p.audioStreamController,$,he),this.subtitleTrackController=this.createController(p.subtitleTrackController,null,he),this.createController(p.subtitleStreamController,$,he),this.createController(p.timelineController,null,me),this.emeController=this.createController(p.emeController,null,me),this.cmcdController=this.createController(p.cmcdController,null,me),this.latencyController=this.createController(B.default,null,me),this.coreComponents=me}var f=m.prototype;return f.createController=function(p,g,u){if(p){var a=g?new p(this,g):new p(this);return u&&u.push(a),a}return null},f.on=function(p,g,u){u===void 0&&(u=this),this._emitter.on(p,g,u)},f.once=function(p,g,u){u===void 0&&(u=this),this._emitter.once(p,g,u)},f.removeAllListeners=function(p){this._emitter.removeAllListeners(p)},f.off=function(p,g,u,a){u===void 0&&(u=this),this._emitter.off(p,g,u,a)},f.listeners=function(p){return this._emitter.listeners(p)},f.emit=function(p,g,u){return this._emitter.emit(p,g,u)},f.trigger=function(p,g){if(this.config.debug)return this.emit(p,p,g);try{return this.emit(p,p,g)}catch(u){L.logger.error("An internal error happened while handling event "+p+'. Error message: "'+u.message+'". Here is a stacktrace:',u),this.trigger(o.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:p,error:u})}return!1},f.listenerCount=function(p){return this._emitter.listenerCount(p)},f.destroy=function(){L.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(p){return p.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(p){return p.destroy()}),this.coreComponents.length=0},f.attachMedia=function(p){L.logger.log("attachMedia"),this._media=p,this.trigger(o.Events.MEDIA_ATTACHING,{media:p})},f.detachMedia=function(){L.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},f.loadSource=function(p){this.stopLoad();var g=this.media,u=this.url,a=this.url=Z.buildAbsoluteURL(self.location.href,p,{alwaysNormalize:!0});L.logger.log("loadSource:"+a),g&&u&&u!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(g)),this.trigger(o.Events.MANIFEST_LOADING,{url:p})},f.startLoad=function(p){p===void 0&&(p=-1),L.logger.log("startLoad("+p+")"),this.networkControllers.forEach(function(g){g.startLoad(p)})},f.stopLoad=function(){L.logger.log("stopLoad"),this.networkControllers.forEach(function(p){p.stopLoad()})},f.swapAudioCodec=function(){L.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},f.recoverMediaError=function(){L.logger.log("recoverMediaError");var p=this._media;this.detachMedia(),p&&this.attachMedia(p)},f.removeLevel=function(p,g){g===void 0&&(g=0),this.levelController.removeLevel(p,g)},T(m,[{key:"levels",get:function(){var p=this.levelController.levels;return p||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(p){L.logger.log("set currentLevel:"+p),this.loadLevel=p,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(p){L.logger.log("set nextLevel:"+p),this.levelController.manualLevel=p,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(p){L.logger.log("set loadLevel:"+p),this.levelController.manualLevel=p}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(p){this.levelController.nextLoadLevel=p}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(p){L.logger.log("set firstLevel:"+p),this.levelController.firstLevel=p}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(p){L.logger.log("set startLevel:"+p),p!==-1&&(p=Math.max(p,this.minAutoLevel)),this.levelController.startLevel=p}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(p){var g=!!p;g!==this.config.capLevelToPlayerSize&&(g?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=g)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(p){this._autoLevelCapping!==p&&(L.logger.log("set autoLevelCapping:"+p),this._autoLevelCapping=p)}},{key:"bandwidthEstimate",get:function(){var p=this.abrController.bwEstimator;return p?p.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var p=this.levels,g=this.config.minAutoBitrate;if(!p)return 0;for(var u=p.length,a=0;a<u;a++)if(p[a].maxBitrate>g)return a;return 0}},{key:"maxAutoLevel",get:function(){var p=this.levels,g=this.autoLevelCapping,u;return g===-1&&p&&p.length?u=p.length-1:u=g,u}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(p){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,p)}},{key:"audioTracks",get:function(){var p=this.audioTrackController;return p?p.audioTracks:[]}},{key:"audioTrack",get:function(){var p=this.audioTrackController;return p?p.audioTrack:-1},set:function(p){var g=this.audioTrackController;g&&(g.audioTrack=p)}},{key:"subtitleTracks",get:function(){var p=this.subtitleTrackController;return p?p.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var p=this.subtitleTrackController;return p?p.subtitleTrack:-1},set:function(p){var g=this.subtitleTrackController;g&&(g.subtitleTrack=p)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var p=this.subtitleTrackController;return p?p.subtitleDisplay:!1},set:function(p){var g=this.subtitleTrackController;g&&(g.subtitleDisplay=p)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(p){this.config.lowLatencyMode=p}},{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:A.hlsDefaultConfig},set:function(p){m.defaultConfig=p}}]),m}();y.defaultConfig=void 0},"./src/is-supported.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"isSupported",function(){return k}),O.d(J,"changeTypeSupported",function(){return G});var Z=O("./src/utils/mediasource-helper.ts");function F(){return self.SourceBuffer||self.WebKitSourceBuffer}function k(){var H=Object(Z.getMediaSource)();if(!H)return!1;var B=F(),R=H&&typeof H.isTypeSupported=="function"&&H.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),x=!B||B.prototype&&typeof B.prototype.appendBuffer=="function"&&typeof B.prototype.remove=="function";return!!R&&!!x}function G(){var H,B=F();return typeof(B==null||((H=B.prototype)===null||H===void 0)?void 0:H.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return L}),O.d(J,"LoadError",function(){return _});var Z=O("./src/polyfills/number.ts"),F=O("./src/errors.ts");function k(h,o){h.prototype=Object.create(o.prototype),h.prototype.constructor=h,x(h,o)}function G(h){var o=typeof Map=="function"?new Map:void 0;return G=function(d){if(d===null||!R(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,T)}function T(){return H(d,arguments,w(this).constructor)}return T.prototype=Object.create(d.prototype,{constructor:{value:T,enumerable:!1,writable:!0,configurable:!0}}),x(T,d)},G(h)}function H(h,o,s){return B()?H=Reflect.construct:H=function(T,y,m){var f=[null];f.push.apply(f,y);var E=Function.bind.apply(T,f),p=new E;return m&&x(p,m.prototype),p},H.apply(null,arguments)}function B(){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(h){return!1}}function R(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function x(h,o){return x=Object.setPrototypeOf||function(d,T){return d.__proto__=T,d},x(h,o)}function w(h){return w=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},w(h)}var P=Math.pow(2,17),L=function(){function h(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var o=h.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,T){var y=this,m=d.url;if(!m)return Promise.reject(new _({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var f=this.config,E=f.fLoader,p=f.loader;return new Promise(function(g,u){y.loader&&y.loader.destroy();var a=y.loader=d.loader=E?new E(f):new p(f),b=A(d),v={timeout:f.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:f.fragLoadingMaxRetryTimeout,highWaterMark:P};d.stats=a.stats,a.load(b,v,{onSuccess:function(I,j,z,V){y.resetLoader(d,a),g({frag:d,part:null,payload:I.data,networkDetails:V})},onError:function(I,j,z){y.resetLoader(d,a),u(new _({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,response:I,networkDetails:z}))},onAbort:function(I,j,z){y.resetLoader(d,a),u(new _({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,networkDetails:z}))},onTimeout:function(I,j,z){y.resetLoader(d,a),u(new _({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,networkDetails:z}))},onProgress:function(I,j,z,V){T&&T({frag:d,part:null,payload:z,networkDetails:V})}})})},o.loadPart=function(d,T,y){var m=this;this.abort();var f=this.config,E=f.fLoader,p=f.loader;return new Promise(function(g,u){m.loader&&m.loader.destroy();var a=m.loader=d.loader=E?new E(f):new p(f),b=A(d,T),v={timeout:f.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:f.fragLoadingMaxRetryTimeout,highWaterMark:P};T.stats=a.stats,a.load(b,v,{onSuccess:function(I,j,z,V){m.resetLoader(d,a),m.updateStatsFromPart(d,T);var M={frag:d,part:T,payload:I.data,networkDetails:V};y(M),g(M)},onError:function(I,j,z){m.resetLoader(d,a),u(new _({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,part:T,response:I,networkDetails:z}))},onAbort:function(I,j,z){d.stats.aborted=T.stats.aborted,m.resetLoader(d,a),u(new _({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,part:T,networkDetails:z}))},onTimeout:function(I,j,z){m.resetLoader(d,a),u(new _({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,part:T,networkDetails:z}))}})})},o.updateStatsFromPart=function(d,T){var y=d.stats,m=T.stats,f=m.total;if(y.loaded+=m.loaded,f){var E=Math.round(d.duration/T.duration),p=Math.min(Math.round(y.loaded/f),E),g=E-p,u=g*Math.round(y.loaded/p);y.total=y.loaded+u}else y.total=Math.max(y.loaded,y.total);var a=y.loading,b=m.loading;a.start?a.first+=b.first-b.start:(a.start=b.start,a.first=b.first),a.end=b.end},o.resetLoader=function(d,T){d.loader=null,this.loader===T&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),T.destroy()},h}();function A(h,o){o===void 0&&(o=null);var s=o||h,d={frag:h,part:o,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},T=s.byteRangeStartOffset,y=s.byteRangeEndOffset;return Object(Z.isFiniteNumber)(T)&&Object(Z.isFiniteNumber)(y)&&(d.rangeStart=T,d.rangeEnd=y),d}var _=function(h){k(o,h);function o(s){for(var d,T=arguments.length,y=new Array(T>1?T-1:0),m=1;m<T;m++)y[m-1]=arguments[m];return d=h.call.apply(h,[this].concat(y))||this,d.data=void 0,d.data=s,d}return o}(G(Error))},"./src/loader/fragment.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"ElementaryStreamTypes",function(){return L}),O.d(J,"BaseSegment",function(){return A}),O.d(J,"Fragment",function(){return _}),O.d(J,"Part",function(){return h});var Z=O("./src/polyfills/number.ts"),F=O("./node_modules/url-toolkit/src/url-toolkit.js"),k=O.n(F),G=O("./src/utils/logger.ts"),H=O("./src/loader/level-key.ts"),B=O("./src/loader/load-stats.ts");function R(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,x(o,s)}function x(o,s){return x=Object.setPrototypeOf||function(T,y){return T.__proto__=y,T},x(o,s)}function w(o,s){for(var d=0;d<s.length;d++){var T=s[d];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(o,T.key,T)}}function P(o,s,d){return s&&w(o.prototype,s),d&&w(o,d),o}var L;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(L||(L={}));var A=function(){function o(d){var T;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(T={},T[L.AUDIO]=null,T[L.VIDEO]=null,T[L.AUDIOVIDEO]=null,T),this.baseurl=d}var s=o.prototype;return s.setByteRange=function(T,y){var m=T.split("@",2),f=[];m.length===1?f[0]=y?y.byteRangeEndOffset:0:f[0]=parseInt(m[1]),f[1]=parseInt(m[0])+f[0],this._byteRange=f},P(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(F.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(T){this._url=T}}]),o}(),_=function(o){R(s,o);function s(T,y){var m;return m=o.call(this,y)||this,m._decryptdata=null,m.rawProgramDateTime=null,m.programDateTime=null,m.tagList=[],m.duration=0,m.sn=0,m.levelkey=void 0,m.type=void 0,m.loader=null,m.level=-1,m.cc=0,m.startPTS=void 0,m.endPTS=void 0,m.appendedPTS=void 0,m.startDTS=void 0,m.endDTS=void 0,m.start=0,m.deltaPTS=void 0,m.maxStartPTS=void 0,m.minEndPTS=void 0,m.stats=new B.LoadStats,m.urlId=0,m.data=void 0,m.bitrateTest=!1,m.title=null,m.initSegment=null,m.type=T,m}var d=s.prototype;return d.createInitializationVector=function(y){for(var m=new Uint8Array(16),f=12;f<16;f++)m[f]=y>>8*(15-f)&255;return m},d.setDecryptDataFromLevelKey=function(y,m){var f=y;return(y==null?void 0:y.method)==="AES-128"&&y.uri&&!y.iv&&(f=H.LevelKey.fromURI(y.uri),f.method=y.method,f.iv=this.createInitializationVector(m),f.keyFormat="identity"),f},d.setElementaryStreamInfo=function(y,m,f,E,p,g){g===void 0&&(g=!1);var u=this.elementaryStreams,a=u[y];if(!a){u[y]={startPTS:m,endPTS:f,startDTS:E,endDTS:p,partial:g};return}a.startPTS=Math.min(a.startPTS,m),a.endPTS=Math.max(a.endPTS,f),a.startDTS=Math.min(a.startDTS,E),a.endDTS=Math.max(a.endDTS,p)},d.clearElementaryStreamInfo=function(){var y=this.elementaryStreams;y[L.AUDIO]=null,y[L.VIDEO]=null,y[L.AUDIOVIDEO]=null},P(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var y=this.sn;typeof y!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&G.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),y=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,y)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(Z.isFiniteNumber)(this.programDateTime))return null;var y=Object(Z.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+y*1e3}},{key:"encrypted",get:function(){var y;return!!((y=this.decryptdata)!==null&&y!==void 0&&y.keyFormat&&this.decryptdata.uri)}}]),s}(A),h=function(o){R(s,o);function s(d,T,y,m,f){var E;E=o.call(this,y)||this,E.fragOffset=0,E.duration=0,E.gap=!1,E.independent=!1,E.relurl=void 0,E.fragment=void 0,E.index=void 0,E.stats=new B.LoadStats,E.duration=d.decimalFloatingPoint("DURATION"),E.gap=d.bool("GAP"),E.independent=d.bool("INDEPENDENT"),E.relurl=d.enumeratedString("URI"),E.fragment=T,E.index=m;var p=d.enumeratedString("BYTERANGE");return p&&E.setByteRange(p,f),f&&(E.fragOffset=f.fragOffset+f.duration),E}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 T=this.elementaryStreams;return!!(T.audio||T.video||T.audiovideo)}}]),s}(A)},"./src/loader/key-loader.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return G});var Z=O("./src/events.ts"),F=O("./src/errors.ts"),k=O("./src/utils/logger.ts"),G=function(){function H(R){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=R,this._registerListeners()}var B=H.prototype;return B._registerListeners=function(){this.hls.on(Z.Events.KEY_LOADING,this.onKeyLoading,this)},B._unregisterListeners=function(){this.hls.off(Z.Events.KEY_LOADING,this.onKeyLoading)},B.destroy=function(){this._unregisterListeners();for(var x in this.loaders){var w=this.loaders[x];w&&w.destroy()}this.loaders={}},B.onKeyLoading=function(x,w){var P=w.frag,L=P.type,A=this.loaders[L];if(!P.decryptdata){k.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var _=P.decryptdata.uri;if(_!==this.decrypturl||this.decryptkey===null){var h=this.hls.config;if(A&&(k.logger.warn("abort previous key loader for type:"+L),A.abort()),!_){k.logger.warn("key uri is falsy");return}var o=h.loader,s=P.loader=this.loaders[L]=new o(h);this.decrypturl=_,this.decryptkey=null;var d={url:_,frag:P,responseType:"arraybuffer"},T={timeout:h.fragLoadingTimeOut,maxRetry:0,retryDelay:h.fragLoadingRetryDelay,maxRetryDelay:h.fragLoadingMaxRetryTimeout,highWaterMark:0},y={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(d,T,y)}else this.decryptkey&&(P.decryptdata.key=this.decryptkey,this.hls.trigger(Z.Events.KEY_LOADED,{frag:P}))},B.loadsuccess=function(x,w,P){var L=P.frag;if(!L.decryptdata){k.logger.error("after key load, decryptdata unset");return}this.decryptkey=L.decryptdata.key=new Uint8Array(x.data),L.loader=null,delete this.loaders[L.type],this.hls.trigger(Z.Events.KEY_LOADED,{frag:L})},B.loaderror=function(x,w){var P=w.frag,L=P.loader;L&&L.abort(),delete this.loaders[P.type],this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:P,response:x})},B.loadtimeout=function(x,w){var P=w.frag,L=P.loader;L&&L.abort(),delete this.loaders[P.type],this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:P})},H}()},"./src/loader/level-details.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"LevelDetails",function(){return H});var Z=O("./src/polyfills/number.ts");function F(B,R){for(var x=0;x<R.length;x++){var w=R[x];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(B,w.key,w)}}function k(B,R,x){return R&&F(B.prototype,R),x&&F(B,x),B}var G=10,H=function(){function B(x){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=x}var R=B.prototype;return R.reloaded=function(w){if(!w){this.advanced=!0,this.updated=!0;return}var P=this.lastPartSn-w.lastPartSn,L=this.lastPartIndex-w.lastPartIndex;this.updated=this.endSN!==w.endSN||!!L||!!P,this.advanced=this.endSN>w.endSN||P>0||P===0&&L>0,this.updated||this.advanced?this.misses=Math.floor(w.misses*.6):this.misses=w.misses+1,this.availabilityDelay=w.availabilityDelay},k(B,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Z.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||G}},{key:"drift",get:function(){var w=this.driftEndTime-this.driftStartTime;if(w>0){var P=this.driftEnd-this.driftStart;return P*1e3/w}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var w;return(w=this.fragments)!==null&&w!==void 0&&w.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 w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),B}()},"./src/loader/level-key.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"LevelKey",function(){return H});var Z=O("./node_modules/url-toolkit/src/url-toolkit.js"),F=O.n(Z);function k(B,R){for(var x=0;x<R.length;x++){var w=R[x];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(B,w.key,w)}}function G(B,R,x){return R&&k(B.prototype,R),x&&k(B,x),B}var H=function(){B.fromURL=function(x,w){return new B(x,w)},B.fromURI=function(x){return new B(x)};function B(R,x){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,x?this._uri=Object(Z.buildAbsoluteURL)(R,x,{alwaysNormalize:!0}):this._uri=R}return G(B,[{key:"uri",get:function(){return this._uri}}]),B}()},"./src/loader/load-stats.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"LoadStats",function(){return Z});var Z=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return s});var Z=O("./src/polyfills/number.ts"),F=O("./node_modules/url-toolkit/src/url-toolkit.js"),k=O.n(F),G=O("./src/loader/fragment.ts"),H=O("./src/loader/level-details.ts"),B=O("./src/loader/level-key.ts"),R=O("./src/utils/attr-list.ts"),x=O("./src/utils/logger.ts"),w=O("./src/utils/codecs.ts"),P=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,L=/#EXT-X-MEDIA:(.*)/g,A=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),_=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),h=/\.(mp4|m4s|m4v|m4a)$/i;function o(f){var E,p;return h.test((E=(p=F.parseURL(f))===null||p===void 0?void 0:p.path)!=null?E:"")}var s=function(){function f(){}return f.findGroup=function(p,g){for(var u=0;u<p.length;u++){var a=p[u];if(a.id===g)return a}},f.convertAVC1ToAVCOTI=function(p){var g=p.split(".");if(g.length>2){var u=g.shift()+".";return u+=parseInt(g.shift()).toString(16),u+=("000"+parseInt(g.shift()).toString(16)).substr(-4),u}return p},f.resolve=function(p,g){return F.buildAbsoluteURL(g,p,{alwaysNormalize:!0})},f.parseMasterPlaylist=function(p,g){var u=[],a={},b=!1;P.lastIndex=0;for(var v;(v=P.exec(p))!=null;)if(v[1]){var S=new R.AttrList(v[1]),I={attrs:S,bitrate:S.decimalInteger("AVERAGE-BANDWIDTH")||S.decimalInteger("BANDWIDTH"),name:S.NAME,url:f.resolve(v[2],g)},j=S.decimalResolution("RESOLUTION");j&&(I.width=j.width,I.height=j.height),d((S.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),I),I.videoCodec&&I.videoCodec.indexOf("avc1")!==-1&&(I.videoCodec=f.convertAVC1ToAVCOTI(I.videoCodec)),u.push(I)}else if(v[3]){var z=new R.AttrList(v[3]);z["DATA-ID"]&&(b=!0,a[z["DATA-ID"]]=z)}return{levels:u,sessionData:b?a:null}},f.parseMasterPlaylistMedia=function(p,g,u,a){a===void 0&&(a=[]);var b,v=[],S=0;for(L.lastIndex=0;(b=L.exec(p))!==null;){var I=new R.AttrList(b[1]);if(I.TYPE===u){var j={attrs:I,bitrate:0,id:S++,groupId:I["GROUP-ID"],instreamId:I["INSTREAM-ID"],name:I.NAME||I.LANGUAGE||"",type:u,default:I.bool("DEFAULT"),autoselect:I.bool("AUTOSELECT"),forced:I.bool("FORCED"),lang:I.LANGUAGE,url:I.URI?f.resolve(I.URI,g):""};if(a.length){var z=f.findGroup(a,j.groupId)||a[0];T(j,z,"audioCodec"),T(j,z,"textCodec")}v.push(j)}}return v},f.parseLevelPlaylist=function(p,g,u,a,b){var v=new H.LevelDetails(g),S=v.fragments,I=null,j=0,z=0,V=0,M=0,N=null,$=new G.Fragment(a,g),ie,he,me,ke=-1,Se=!1;for(A.lastIndex=0,v.m3u8=p;(ie=A.exec(p))!==null;){Se&&(Se=!1,$=new G.Fragment(a,g),$.start=V,$.sn=j,$.cc=M,$.level=u,I&&($.initSegment=I,$.rawProgramDateTime=I.rawProgramDateTime));var Re=ie[1];if(Re){$.duration=parseFloat(Re);var Te=(" "+ie[2]).slice(1);$.title=Te||null,$.tagList.push(Te?["INF",Re,Te]:["INF",Re])}else if(ie[3])Object(Z.isFiniteNumber)($.duration)&&($.start=V,me&&($.levelkey=me),$.sn=j,$.level=u,$.cc=M,$.urlId=b,S.push($),$.relurl=(" "+ie[3]).slice(1),m($,N),N=$,V+=$.duration,j++,z=0,Se=!0);else if(ie[4]){var _e=(" "+ie[4]).slice(1);N?$.setByteRange(_e,N):$.setByteRange(_e)}else if(ie[5])$.rawProgramDateTime=(" "+ie[5]).slice(1),$.tagList.push(["PROGRAM-DATE-TIME",$.rawProgramDateTime]),ke===-1&&(ke=S.length);else{if(ie=ie[0].match(_),!ie){x.logger.warn("No matches on slow regex match for level playlist!");continue}for(he=1;he<ie.length&&!(typeof ie[he]!="undefined");he++);var ye=(" "+ie[he]).slice(1),K=(" "+ie[he+1]).slice(1),l=ie[he+2]?(" "+ie[he+2]).slice(1):"";switch(ye){case"PLAYLIST-TYPE":v.type=K.toUpperCase();break;case"MEDIA-SEQUENCE":j=v.startSN=parseInt(K);break;case"SKIP":{var c=new R.AttrList(K),D=c.decimalInteger("SKIPPED-SEGMENTS");if(Object(Z.isFiniteNumber)(D)){v.skippedSegments=D;for(var X=D;X--;)S.unshift(null);j+=D}var U=c.enumeratedString("RECENTLY-REMOVED-DATERANGES");U&&(v.recentlyRemovedDateranges=U.split(" "));break}case"TARGETDURATION":v.targetduration=parseFloat(K);break;case"VERSION":v.version=parseInt(K);break;case"EXTM3U":break;case"ENDLIST":v.live=!1;break;case"#":(K||l)&&$.tagList.push(l?[K,l]:[K]);break;case"DIS":M++;case"GAP":$.tagList.push([ye]);break;case"BITRATE":$.tagList.push([ye,K]);break;case"DISCONTINUITY-SEQ":M=parseInt(K);break;case"KEY":{var oe,be=new R.AttrList(K),xe=be.enumeratedString("METHOD"),Pe=be.URI,De=be.hexadecimalInteger("IV"),Oe=be.enumeratedString("KEYFORMATVERSIONS"),Ie=be.enumeratedString("KEYID"),He=(oe=be.enumeratedString("KEYFORMAT"))!=null?oe:"identity",Ve=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ve.indexOf(He)>-1){x.logger.warn("Keyformat "+He+" is not supported from the manifest");continue}else if(He!=="identity")continue;xe&&(me=B.LevelKey.fromURL(g,Pe),Pe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(xe)>=0&&(me.method=xe,me.keyFormat=He,Ie&&(me.keyID=Ie),Oe&&(me.keyFormatVersions=Oe),me.iv=De));break}case"START":{var Je=new R.AttrList(K),Xe=Je.decimalFloatingPoint("TIME-OFFSET");Object(Z.isFiniteNumber)(Xe)&&(v.startTimeOffset=Xe);break}case"MAP":{var We=new R.AttrList(K);$.relurl=We.URI,We.BYTERANGE&&$.setByteRange(We.BYTERANGE),$.level=u,$.sn="initSegment",me&&($.levelkey=me),$.initSegment=null,I=$,Se=!0;break}case"SERVER-CONTROL":{var Qe=new R.AttrList(K);v.canBlockReload=Qe.bool("CAN-BLOCK-RELOAD"),v.canSkipUntil=Qe.optionalFloat("CAN-SKIP-UNTIL",0),v.canSkipDateRanges=v.canSkipUntil>0&&Qe.bool("CAN-SKIP-DATERANGES"),v.partHoldBack=Qe.optionalFloat("PART-HOLD-BACK",0),v.holdBack=Qe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var et=new R.AttrList(K);v.partTarget=et.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ae=v.partList;Ae||(Ae=v.partList=[]);var ut=z>0?Ae[Ae.length-1]:void 0,it=z++,se=new G.Part(new R.AttrList(K),$,g,it,ut);Ae.push(se),$.duration+=se.duration;break}case"PRELOAD-HINT":{var q=new R.AttrList(K);v.preloadHint=q;break}case"RENDITION-REPORT":{var ee=new R.AttrList(K);v.renditionReports=v.renditionReports||[],v.renditionReports.push(ee);break}default:x.logger.warn("line parsed but not handled: "+ie);break}}}N&&!N.relurl?(S.pop(),V-=N.duration,v.partList&&(v.fragmentHint=N)):v.partList&&(m($,N),$.cc=M,v.fragmentHint=$);var ae=S.length,ue=S[0],te=S[ae-1];if(V+=v.skippedSegments*v.targetduration,V>0&&ae&&te){v.averagetargetduration=V/ae;var ne=te.sn;v.endSN=ne!=="initSegment"?ne:0,ue&&(v.startCC=ue.cc,ue.initSegment||v.fragments.every(function(de){return de.relurl&&o(de.relurl)})&&(x.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),$=new G.Fragment(a,g),$.relurl=te.relurl,$.level=u,$.sn="initSegment",ue.initSegment=$,v.needSidxRanges=!0))}else v.endSN=0,v.startCC=0;return v.fragmentHint&&(V+=v.fragmentHint.duration),v.totalduration=V,v.endCC=M,ke>0&&y(S,ke),v},f}();function d(f,E){["video","audio","text"].forEach(function(p){var g=f.filter(function(a){return Object(w.isCodecType)(a,p)});if(g.length){var u=g.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});E[p+"Codec"]=u.length>0?u[0]:g[0],f=f.filter(function(a){return g.indexOf(a)===-1})}}),E.unknownCodecs=f}function T(f,E,p){var g=E[p];g&&(f[p]=g)}function y(f,E){for(var p=f[E],g=E;g--;){var u=f[g];if(!u)return;u.programDateTime=p.programDateTime-u.duration*1e3,p=u}}function m(f,E){f.rawProgramDateTime?f.programDateTime=Date.parse(f.rawProgramDateTime):E!=null&&E.programDateTime&&(f.programDateTime=E.endProgramDateTime),Object(Z.isFiniteNumber)(f.programDateTime)||(f.programDateTime=null,f.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/polyfills/number.ts"),F=O("./src/events.ts"),k=O("./src/errors.ts"),G=O("./src/utils/logger.ts"),H=O("./src/utils/mp4-tools.ts"),B=O("./src/loader/m3u8-parser.ts"),R=O("./src/types/loader.ts"),x=O("./src/utils/attr-list.ts");function w(A){var _=A.type;switch(_){case R.PlaylistContextType.AUDIO_TRACK:return R.PlaylistLevelType.AUDIO;case R.PlaylistContextType.SUBTITLE_TRACK:return R.PlaylistLevelType.SUBTITLE;default:return R.PlaylistLevelType.MAIN}}function P(A,_){var h=A.url;return(h===void 0||h.indexOf("data:")===0)&&(h=_.url),h}var L=function(){function A(h){this.hls=void 0,this.loaders=Object.create(null),this.hls=h,this.registerListeners()}var _=A.prototype;return _.registerListeners=function(){var o=this.hls;o.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},_.unregisterListeners=function(){var o=this.hls;o.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(F.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},_.createInternalLoader=function(o){var s=this.hls.config,d=s.pLoader,T=s.loader,y=d||T,m=new y(s);return o.loader=m,this.loaders[o.type]=m,m},_.getInternalLoader=function(o){return this.loaders[o.type]},_.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},_.destroyInternalLoaders=function(){for(var o in this.loaders){var s=this.loaders[o];s&&s.destroy(),this.resetInternalLoader(o)}},_.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},_.onManifestLoading=function(o,s){var d=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:R.PlaylistContextType.MANIFEST,url:d,deliveryDirectives:null})},_.onLevelLoading=function(o,s){var d=s.id,T=s.level,y=s.url,m=s.deliveryDirectives;this.load({id:d,groupId:null,level:T,responseType:"text",type:R.PlaylistContextType.LEVEL,url:y,deliveryDirectives:m})},_.onAudioTrackLoading=function(o,s){var d=s.id,T=s.groupId,y=s.url,m=s.deliveryDirectives;this.load({id:d,groupId:T,level:null,responseType:"text",type:R.PlaylistContextType.AUDIO_TRACK,url:y,deliveryDirectives:m})},_.onSubtitleTrackLoading=function(o,s){var d=s.id,T=s.groupId,y=s.url,m=s.deliveryDirectives;this.load({id:d,groupId:T,level:null,responseType:"text",type:R.PlaylistContextType.SUBTITLE_TRACK,url:y,deliveryDirectives:m})},_.load=function(o){var s,d=this.hls.config,T=this.getInternalLoader(o);if(T){var y=T.context;if(y&&y.url===o.url){G.logger.trace("[playlist-loader]: playlist request ongoing");return}G.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),T.abort()}var m,f,E,p;switch(o.type){case R.PlaylistContextType.MANIFEST:m=d.manifestLoadingMaxRetry,f=d.manifestLoadingTimeOut,E=d.manifestLoadingRetryDelay,p=d.manifestLoadingMaxRetryTimeout;break;case R.PlaylistContextType.LEVEL:case R.PlaylistContextType.AUDIO_TRACK:case R.PlaylistContextType.SUBTITLE_TRACK:m=0,f=d.levelLoadingTimeOut;break;default:m=d.levelLoadingMaxRetry,f=d.levelLoadingTimeOut,E=d.levelLoadingRetryDelay,p=d.levelLoadingMaxRetryTimeout;break}if(T=this.createInternalLoader(o),(s=o.deliveryDirectives)!==null&&s!==void 0&&s.part){var g;if(o.type===R.PlaylistContextType.LEVEL&&o.level!==null?g=this.hls.levels[o.level].details:o.type===R.PlaylistContextType.AUDIO_TRACK&&o.id!==null?g=this.hls.audioTracks[o.id].details:o.type===R.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(g=this.hls.subtitleTracks[o.id].details),g){var u=g.partTarget,a=g.targetduration;u&&a&&(f=Math.min(Math.max(u*3,a*.8)*1e3,f))}}var b={timeout:f,maxRetry:m,retryDelay:E,maxRetryDelay:p,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};T.load(o,b,v)},_.loadsuccess=function(o,s,d,T){if(T===void 0&&(T=null),d.isSidxRequest){this.handleSidxRequest(o,d),this.handlePlaylistLoaded(o,s,d,T);return}this.resetInternalLoader(d.type);var y=o.data;if(y.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,d,"no EXTM3U delimiter",T);return}s.parsing.start=performance.now(),y.indexOf("#EXTINF:")>0||y.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,s,d,T):this.handleMasterPlaylist(o,s,d,T)},_.loaderror=function(o,s,d){d===void 0&&(d=null),this.handleNetworkError(s,d,!1,o)},_.loadtimeout=function(o,s,d){d===void 0&&(d=null),this.handleNetworkError(s,d,!0)},_.handleMasterPlaylist=function(o,s,d,T){var y=this.hls,m=o.data,f=P(o,d),E=B.default.parseMasterPlaylist(m,f),p=E.levels,g=E.sessionData;if(!p.length){this.handleManifestParsingError(o,d,"no level found in manifest",T);return}var u=p.map(function(j){return{id:j.attrs.AUDIO,audioCodec:j.audioCodec}}),a=p.map(function(j){return{id:j.attrs.SUBTITLES,textCodec:j.textCodec}}),b=B.default.parseMasterPlaylistMedia(m,f,"AUDIO",u),v=B.default.parseMasterPlaylistMedia(m,f,"SUBTITLES",a),S=B.default.parseMasterPlaylistMedia(m,f,"CLOSED-CAPTIONS");if(b.length){var I=b.some(function(j){return!j.url});!I&&p[0].audioCodec&&!p[0].attrs.AUDIO&&(G.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),b.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new x.AttrList({}),bitrate:0,url:""}))}y.trigger(F.Events.MANIFEST_LOADED,{levels:p,audioTracks:b,subtitles:v,captions:S,url:f,stats:s,networkDetails:T,sessionData:g})},_.handleTrackOrLevelPlaylist=function(o,s,d,T){var y=this.hls,m=d.id,f=d.level,E=d.type,p=P(o,d),g=Object(Z.isFiniteNumber)(m)?m:0,u=Object(Z.isFiniteNumber)(f)?f:g,a=w(d),b=B.default.parseLevelPlaylist(o.data,p,u,a,g);if(!b.fragments.length){y.trigger(F.Events.ERROR,{type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:p,reason:"no fragments found in level",level:typeof d.level=="number"?d.level:void 0});return}if(E===R.PlaylistContextType.MANIFEST){var v={attrs:new x.AttrList({}),bitrate:0,details:b,name:"",url:p};y.trigger(F.Events.MANIFEST_LOADED,{levels:[v],audioTracks:[],url:p,stats:s,networkDetails:T,sessionData:null})}if(s.parsing.end=performance.now(),b.needSidxRanges){var S,I=(S=b.fragments[0].initSegment)===null||S===void 0?void 0:S.url;this.load({url:I,isSidxRequest:!0,type:E,level:f,levelDetails:b,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}d.levelDetails=b,this.handlePlaylistLoaded(o,s,d,T)},_.handleSidxRequest=function(o,s){var d=Object(H.parseSegmentIndex)(new Uint8Array(o.data));if(!d)return;var T=d.references,y=s.levelDetails;T.forEach(function(m,f){var E=m.info,p=y.fragments[f];p.byteRange.length===0&&p.setByteRange(String(1+E.end-E.start)+"@"+String(E.start)),p.initSegment&&p.initSegment.setByteRange(String(d.moovEndOffset)+"@0")})},_.handleManifestParsingError=function(o,s,d,T){this.hls.trigger(F.Events.ERROR,{type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===R.PlaylistContextType.MANIFEST,url:o.url,reason:d,response:o,context:s,networkDetails:T})},_.handleNetworkError=function(o,s,d,T){d===void 0&&(d=!1),G.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 y=k.ErrorDetails.UNKNOWN,m=!1,f=this.getInternalLoader(o);switch(o.type){case R.PlaylistContextType.MANIFEST:y=d?k.ErrorDetails.MANIFEST_LOAD_TIMEOUT:k.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case R.PlaylistContextType.LEVEL:y=d?k.ErrorDetails.LEVEL_LOAD_TIMEOUT:k.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case R.PlaylistContextType.AUDIO_TRACK:y=d?k.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:k.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case R.PlaylistContextType.SUBTITLE_TRACK:y=d?k.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:k.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}f&&this.resetInternalLoader(o.type);var E={type:k.ErrorTypes.NETWORK_ERROR,details:y,fatal:m,url:o.url,loader:f,context:o,networkDetails:s};T&&(E.response=T),this.hls.trigger(F.Events.ERROR,E)},_.handlePlaylistLoaded=function(o,s,d,T){var y=d.type,m=d.level,f=d.id,E=d.groupId,p=d.loader,g=d.levelDetails,u=d.deliveryDirectives;if(!(g!=null&&g.targetduration)){this.handleManifestParsingError(o,d,"invalid target duration",T);return}if(!p)return;g.live&&(p.getCacheAge&&(g.ageHeader=p.getCacheAge()||0),(!p.getCacheAge||isNaN(g.ageHeader))&&(g.ageHeader=0));switch(y){case R.PlaylistContextType.MANIFEST:case R.PlaylistContextType.LEVEL:this.hls.trigger(F.Events.LEVEL_LOADED,{details:g,level:m||0,id:f||0,stats:s,networkDetails:T,deliveryDirectives:u});break;case R.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(F.Events.AUDIO_TRACK_LOADED,{details:g,id:f||0,groupId:E||"",stats:s,networkDetails:T,deliveryDirectives:u});break;case R.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(F.Events.SUBTITLE_TRACK_LOADED,{details:g,id:f||0,groupId:E||"",stats:s,networkDetails:T,deliveryDirectives:u});break}},A}();J.default=L},"./src/polyfills/number.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"isFiniteNumber",function(){return Z}),O.d(J,"MAX_SAFE_INTEGER",function(){return F});var Z=Number.isFinite||function(k){return typeof k=="number"&&isFinite(k)},F=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ce,J,O){"use strict";O.r(J);var Z=function(){function F(){}return F.getSilentFrame=function(G,H){switch(G){case"mp4a.40.2":if(H===1)return new Uint8Array([0,200,0,128,35,128]);if(H===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(H===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(H===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(H===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(H===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(H===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(H===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(H===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},F}();J.default=Z},"./src/remux/mp4-generator.ts":function(ce,J,O){"use strict";O.r(J);var Z=Math.pow(2,32)-1,F=function(){function k(){}return k.init=function(){k.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 H;for(H in k.types)k.types.hasOwnProperty(H)&&(k.types[H]=[H.charCodeAt(0),H.charCodeAt(1),H.charCodeAt(2),H.charCodeAt(3)]);var B=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]),R=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]);k.HDLR_TYPES={video:B,audio:R};var x=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),w=new Uint8Array([0,0,0,0,0,0,0,0]);k.STTS=k.STSC=k.STCO=w,k.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),k.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),k.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),k.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var P=new Uint8Array([105,115,111,109]),L=new Uint8Array([97,118,99,49]),A=new Uint8Array([0,0,0,1]);k.FTYP=k.box(k.types.ftyp,P,A,P,L),k.DINF=k.box(k.types.dinf,k.box(k.types.dref,x))},k.box=function(H){for(var B=8,R=arguments.length,x=new Array(R>1?R-1:0),w=1;w<R;w++)x[w-1]=arguments[w];for(var P=x.length,L=P;P--;)B+=x[P].byteLength;var A=new Uint8Array(B);for(A[0]=B>>24&255,A[1]=B>>16&255,A[2]=B>>8&255,A[3]=B&255,A.set(H,4),P=0,B=8;P<L;P++)A.set(x[P],B),B+=x[P].byteLength;return A},k.hdlr=function(H){return k.box(k.types.hdlr,k.HDLR_TYPES[H])},k.mdat=function(H){return k.box(k.types.mdat,H)},k.mdhd=function(H,B){B*=H;var R=Math.floor(B/(Z+1)),x=Math.floor(B%(Z+1));return k.box(k.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,H>>24&255,H>>16&255,H>>8&255,H&255,R>>24,R>>16&255,R>>8&255,R&255,x>>24,x>>16&255,x>>8&255,x&255,85,196,0,0]))},k.mdia=function(H){return k.box(k.types.mdia,k.mdhd(H.timescale,H.duration),k.hdlr(H.type),k.minf(H))},k.mfhd=function(H){return k.box(k.types.mfhd,new Uint8Array([0,0,0,0,H>>24,H>>16&255,H>>8&255,H&255]))},k.minf=function(H){return H.type==="audio"?k.box(k.types.minf,k.box(k.types.smhd,k.SMHD),k.DINF,k.stbl(H)):k.box(k.types.minf,k.box(k.types.vmhd,k.VMHD),k.DINF,k.stbl(H))},k.moof=function(H,B,R){return k.box(k.types.moof,k.mfhd(H),k.traf(R,B))},k.moov=function(H){for(var B=H.length,R=[];B--;)R[B]=k.trak(H[B]);return k.box.apply(null,[k.types.moov,k.mvhd(H[0].timescale,H[0].duration)].concat(R).concat(k.mvex(H)))},k.mvex=function(H){for(var B=H.length,R=[];B--;)R[B]=k.trex(H[B]);return k.box.apply(null,[k.types.mvex].concat(R))},k.mvhd=function(H,B){B*=H;var R=Math.floor(B/(Z+1)),x=Math.floor(B%(Z+1)),w=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,H>>24&255,H>>16&255,H>>8&255,H&255,R>>24,R>>16&255,R>>8&255,R&255,x>>24,x>>16&255,x>>8&255,x&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 k.box(k.types.mvhd,w)},k.sdtp=function(H){var B=H.samples||[],R=new Uint8Array(4+B.length),x,w;for(x=0;x<B.length;x++)w=B[x].flags,R[x+4]=w.dependsOn<<4|w.isDependedOn<<2|w.hasRedundancy;return k.box(k.types.sdtp,R)},k.stbl=function(H){return k.box(k.types.stbl,k.stsd(H),k.box(k.types.stts,k.STTS),k.box(k.types.stsc,k.STSC),k.box(k.types.stsz,k.STSZ),k.box(k.types.stco,k.STCO))},k.avc1=function(H){var B=[],R=[],x,w,P;for(x=0;x<H.sps.length;x++)w=H.sps[x],P=w.byteLength,B.push(P>>>8&255),B.push(P&255),B=B.concat(Array.prototype.slice.call(w));for(x=0;x<H.pps.length;x++)w=H.pps[x],P=w.byteLength,R.push(P>>>8&255),R.push(P&255),R=R.concat(Array.prototype.slice.call(w));var L=k.box(k.types.avcC,new Uint8Array([1,B[3],B[4],B[5],252|3,224|H.sps.length].concat(B).concat([H.pps.length]).concat(R))),A=H.width,_=H.height,h=H.pixelRatio[0],o=H.pixelRatio[1];return k.box(k.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,A>>8&255,A&255,_>>8&255,_&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),L,k.box(k.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),k.box(k.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,o>>24,o>>16&255,o>>8&255,o&255])))},k.esds=function(H){var B=H.config.length;return new Uint8Array([0,0,0,0,3,23+B,0,1,0,4,15+B,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([B]).concat(H.config).concat([6,1,2]))},k.mp4a=function(H){var B=H.samplerate;return k.box(k.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,H.channelCount,0,16,0,0,0,0,B>>8&255,B&255,0,0]),k.box(k.types.esds,k.esds(H)))},k.mp3=function(H){var B=H.samplerate;return k.box(k.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,H.channelCount,0,16,0,0,0,0,B>>8&255,B&255,0,0]))},k.stsd=function(H){return H.type==="audio"?!H.isAAC&&H.codec==="mp3"?k.box(k.types.stsd,k.STSD,k.mp3(H)):k.box(k.types.stsd,k.STSD,k.mp4a(H)):k.box(k.types.stsd,k.STSD,k.avc1(H))},k.tkhd=function(H){var B=H.id,R=H.duration*H.timescale,x=H.width,w=H.height,P=Math.floor(R/(Z+1)),L=Math.floor(R%(Z+1));return k.box(k.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,B>>24&255,B>>16&255,B>>8&255,B&255,0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,L>>24,L>>16&255,L>>8&255,L&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,x>>8&255,x&255,0,0,w>>8&255,w&255,0,0]))},k.traf=function(H,B){var R=k.sdtp(H),x=H.id,w=Math.floor(B/(Z+1)),P=Math.floor(B%(Z+1));return k.box(k.types.traf,k.box(k.types.tfhd,new Uint8Array([0,0,0,0,x>>24,x>>16&255,x>>8&255,x&255])),k.box(k.types.tfdt,new Uint8Array([1,0,0,0,w>>24,w>>16&255,w>>8&255,w&255,P>>24,P>>16&255,P>>8&255,P&255])),k.trun(H,R.length+16+20+8+16+8+8),R)},k.trak=function(H){return H.duration=H.duration||4294967295,k.box(k.types.trak,k.tkhd(H),k.mdia(H))},k.trex=function(H){var B=H.id;return k.box(k.types.trex,new Uint8Array([0,0,0,0,B>>24,B>>16&255,B>>8&255,B&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},k.trun=function(H,B){var R=H.samples||[],x=R.length,w=12+16*x,P=new Uint8Array(w),L,A,_,h,o,s;for(B+=8+w,P.set([0,0,15,1,x>>>24&255,x>>>16&255,x>>>8&255,x&255,B>>>24&255,B>>>16&255,B>>>8&255,B&255],0),L=0;L<x;L++)A=R[L],_=A.duration,h=A.size,o=A.flags,s=A.cts,P.set([_>>>24&255,_>>>16&255,_>>>8&255,_&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*L);return k.box(k.types.trun,P)},k.initSegment=function(H){k.types||k.init();var B=k.moov(H),R=new Uint8Array(k.FTYP.byteLength+B.byteLength);return R.set(k.FTYP),R.set(B,k.FTYP.byteLength),R},k}();F.types=void 0,F.HDLR_TYPES=void 0,F.STTS=void 0,F.STSC=void 0,F.STCO=void 0,F.STSZ=void 0,F.VMHD=void 0,F.SMHD=void 0,F.STSD=void 0,F.FTYP=void 0,F.DINF=void 0,J.default=F},"./src/remux/mp4-remuxer.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return s}),O.d(J,"normalizePts",function(){return d});var Z=O("./src/polyfills/number.ts"),F=O("./src/remux/aac-helper.ts"),k=O("./src/remux/mp4-generator.ts"),G=O("./src/events.ts"),H=O("./src/errors.ts"),B=O("./src/utils/logger.ts"),R=O("./src/types/loader.ts"),x=O("./src/utils/timescale-conversion.ts");function w(){return w=Object.assign||function(f){for(var E=1;E<arguments.length;E++){var p=arguments[E];for(var g in p)Object.prototype.hasOwnProperty.call(p,g)&&(f[g]=p[g])}return f},w.apply(this,arguments)}var P=10*1e3,L=1024,A=1152,_=null,h=null,o=!1,s=function(){function f(p,g,u,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=p,this.config=g,this.typeSupported=u,this.ISGenerated=!1,_===null){var b=navigator.userAgent||"",v=b.match(/Chrome\/(\d+)/i);_=v?parseInt(v[1]):0}if(h===null){var S=navigator.userAgent.match(/Safari\/(\d+)/i);h=S?parseInt(S[1]):0}o=!!_&&_<75||!!h&&h<600}var E=f.prototype;return E.destroy=function(){},E.resetTimeStamp=function(g){B.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=g},E.resetNextTimestamp=function(){B.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},E.resetInitSegment=function(){B.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},E.getVideoStartPts=function(g){var u=!1,a=g.reduce(function(b,v){var S=v.pts-b;return S<-4294967296?(u=!0,d(b,v.pts)):S>0?b:v.pts},g[0].pts);return u&&B.logger.debug("PTS rollover detected"),a},E.remux=function(g,u,a,b,v,S,I,j){var z,V,M,N,$,ie,he=v,me=v,ke=g.pid>-1,Se=u.pid>-1,Re=u.samples.length,Te=g.samples.length>0,_e=Re>1,ye=(!ke||Te)&&(!Se||_e)||this.ISGenerated||I;if(ye){this.ISGenerated||(M=this.generateIS(g,u,v));var K=this.isVideoContiguous,l=-1;if(_e&&(l=T(u.samples),!K&&this.config.forceKeyFrameOnDiscontinuity))if(ie=!0,l>0){B.logger.warn("[mp4-remuxer]: Dropped "+l+" out of "+Re+" video samples due to a missing keyframe");var c=this.getVideoStartPts(u.samples);u.samples=u.samples.slice(l),u.dropped+=l,me+=(u.samples[0].pts-c)/(u.timescale||9e4)}else l===-1&&(B.logger.warn("[mp4-remuxer]: No keyframe found out of "+Re+" video samples"),ie=!1);if(this.ISGenerated){if(Te&&_e){var D=this.getVideoStartPts(u.samples),X=d(g.samples[0].pts,D)-D,U=X/u.inputTimeScale;he+=Math.max(0,U),me+=Math.max(0,-U)}if(Te){if(g.samplerate||(B.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),M=this.generateIS(g,u,v)),V=this.remuxAudio(g,he,this.isAudioContiguous,S,Se||_e||j===R.PlaylistLevelType.AUDIO?me:void 0),_e){var oe=V?V.endPTS-V.startPTS:0;u.inputTimeScale||(B.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),M=this.generateIS(g,u,v)),z=this.remuxVideo(u,me,K,oe)}}else _e&&(z=this.remuxVideo(u,me,K,0));z&&(z.firstKeyFrame=l,z.independent=l!==-1)}}return this.ISGenerated&&(a.samples.length&&($=this.remuxID3(a,v)),b.samples.length&&(N=this.remuxText(b,v))),{audio:V,video:z,initSegment:M,independent:ie,text:N,id3:$}},E.generateIS=function(g,u,a){var b=g.samples,v=u.samples,S=this.typeSupported,I={},j=!Object(Z.isFiniteNumber)(this._initPTS),z="audio/mp4",V,M,N;if(j&&(V=M=Infinity),g.config&&b.length&&(g.timescale=g.samplerate,g.isAAC||(S.mpeg?(z="audio/mpeg",g.codec=""):S.mp3&&(g.codec="mp3")),I.audio={id:"audio",container:z,codec:g.codec,initSegment:!g.isAAC&&S.mpeg?new Uint8Array(0):k.default.initSegment([g]),metadata:{channelCount:g.channelCount}},j&&(N=g.inputTimeScale,V=M=b[0].pts-Math.round(N*a))),u.sps&&u.pps&&v.length&&(u.timescale=u.inputTimeScale,I.video={id:"main",container:"video/mp4",codec:u.codec,initSegment:k.default.initSegment([u]),metadata:{width:u.width,height:u.height}},j)){N=u.inputTimeScale;var $=this.getVideoStartPts(v),ie=Math.round(N*a);M=Math.min(M,d(v[0].dts,$)-ie),V=Math.min(V,$-ie)}if(Object.keys(I).length)return this.ISGenerated=!0,j&&(this._initPTS=V,this._initDTS=M),{tracks:I,initPTS:V,timescale:N}},E.remuxVideo=function(g,u,a,b){var v=g.inputTimeScale,S=g.samples,I=[],j=S.length,z=this._initPTS,V=this.nextAvcDts,M=8,N,$,ie,he=Number.POSITIVE_INFINITY,me=Number.NEGATIVE_INFINITY,ke=0,Se=!1;if(!a||V===null){var Re=u*v,Te=S[0].pts-d(S[0].dts,S[0].pts);V=Re-Te}for(var _e=0;_e<j;_e++){var ye=S[_e];if(ye.pts=d(ye.pts-z,V),ye.dts=d(ye.dts-z,V),ye.dts>ye.pts){var K=9e4*.2;ke=Math.max(Math.min(ke,ye.pts-ye.dts),-1*K)}ye.dts<S[_e>0?_e-1:_e].dts&&(Se=!0)}Se&&S.sort(function(Tt,ft){var dt=Tt.dts-ft.dts,Pt=Tt.pts-ft.pts;return dt||Pt}),$=S[0].dts,ie=S[S.length-1].dts;var l=Math.round((ie-$)/(j-1));if(ke<0){if(ke<l*-2){B.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(x.toMsFromMpegTsClock)(-l,!0)+" ms");for(var c=ke,D=0;D<j;D++)S[D].dts=c=Math.max(c,S[D].pts-l),S[D].pts=Math.max(c,S[D].pts)}else{B.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(x.toMsFromMpegTsClock)(ke,!0)+" ms to overcome this issue");for(var X=0;X<j;X++)S[X].dts=S[X].dts+ke}$=S[0].dts}if(a){var U=$-V,oe=U>l,be=U<-1;if(oe||be){oe?B.logger.warn("AVC: "+Object(x.toMsFromMpegTsClock)(U,!0)+" ms ("+U+"dts) hole between fragments detected, filling it"):B.logger.warn("AVC: "+Object(x.toMsFromMpegTsClock)(-U,!0)+" ms ("+U+"dts) overlapping between fragments detected"),$=V;var xe=S[0].pts-U;S[0].dts=$,S[0].pts=xe,B.logger.log("Video: First PTS/DTS adjusted: "+Object(x.toMsFromMpegTsClock)(xe,!0)+"/"+Object(x.toMsFromMpegTsClock)($,!0)+", delta: "+Object(x.toMsFromMpegTsClock)(U,!0)+" ms")}}o&&($=Math.max(0,$));for(var Pe=0,De=0,Oe=0;Oe<j;Oe++){for(var Ie=S[Oe],He=Ie.units,Ve=He.length,Je=0,Xe=0;Xe<Ve;Xe++)Je+=He[Xe].data.length;De+=Je,Pe+=Ve,Ie.length=Je,Ie.dts=Math.max(Ie.dts,$),Ie.pts=Math.max(Ie.pts,Ie.dts,0),he=Math.min(Ie.pts,he),me=Math.max(Ie.pts,me)}ie=S[j-1].dts;var We=De+4*Pe+8,Qe;try{Qe=new Uint8Array(We)}catch(Tt){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:H.ErrorTypes.MUX_ERROR,details:H.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:We,reason:"fail allocating video mdat "+We});return}var et=new DataView(Qe.buffer);et.setUint32(0,We),Qe.set(k.default.types.mdat,4);for(var Ae=0;Ae<j;Ae++){for(var ut=S[Ae],it=ut.units,se=0,q=0,ee=it.length;q<ee;q++){var ae=it[q],ue=ae.data,te=ae.data.byteLength;et.setUint32(M,te),M+=4,Qe.set(ue,M),M+=te,se+=4+te}if(Ae<j-1)N=S[Ae+1].dts-ut.dts;else{var ne=this.config,de=ut.dts-S[Ae>0?Ae-1:Ae].dts;if(ne.stretchShortVideoTrack&&this.nextAudioPts!==null){var fe=Math.floor(ne.maxBufferHole*v),ve=(b?he+b*v:this.nextAudioPts)-ut.pts;ve>fe?(N=ve-de,N<0&&(N=de),B.logger.log("[mp4-remuxer]: It is approximately "+ve/90+" ms to the next segment; using duration "+N/90+" ms for the last video frame.")):N=de}else N=de}var Ee=Math.round(ut.pts-ut.dts);I.push(new y(ut.key,N,se,Ee))}if(I.length&&_&&_<70){var Me=I[0].flags;Me.dependsOn=2,Me.isNonSync=0}console.assert(N!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ie+N,this.isVideoContiguous=!0;var Ge=k.default.moof(g.sequenceNumber++,$,w({},g,{samples:I})),nt="video",at={data1:Ge,data2:Qe,startPTS:he/v,endPTS:(me+N)/v,startDTS:$/v,endDTS:V/v,type:nt,hasAudio:!1,hasVideo:!0,nb:I.length,dropped:g.dropped};return g.samples=[],g.dropped=0,console.assert(Qe.length,"MDAT length must not be zero"),at},E.remuxAudio=function(g,u,a,b,v){var S=g.inputTimeScale,I=g.samplerate?g.samplerate:S,j=S/I,z=g.isAAC?L:A,V=z*j,M=this._initPTS,N=!g.isAAC&&this.typeSupported.mpeg,$=[],ie=g.samples,he=N?0:8,me=this.nextAudioPts||-1,ke=u*S;if(this.isAudioContiguous=a=a||ie.length&&me>0&&(b&&Math.abs(ke-me)<9e3||Math.abs(d(ie[0].pts-M,ke)-me)<20*V),ie.forEach(function(ue){ue.pts=d(ue.pts-M,ke)}),!a||me<0){if(ie=ie.filter(function(ue){return ue.pts>=0}),!ie.length)return;v===0?me=0:b?me=Math.max(0,ke):me=ie[0].pts}if(g.isAAC)for(var Se=v!==void 0,Re=this.config.maxAudioFramesDrift,Te=0,_e=me;Te<ie.length;Te++){var ye=ie[Te],K=ye.pts,l=K-_e,c=Math.abs(1e3*l/S);if(l<=-Re*V&&Se)Te===0&&(B.logger.warn("Audio frame @ "+(K/S).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*l/S)+" ms."),this.nextAudioPts=me=_e=K);else if(l>=Re*V&&c<P&&Se){var D=Math.round(l/V);_e=K-D*V,_e<0&&(D--,_e+=V),Te===0&&(this.nextAudioPts=me=_e),B.logger.warn("[mp4-remuxer]: Injecting "+D+" audio frame @ "+(_e/S).toFixed(3)+"s due to "+Math.round(1e3*l/S)+" ms gap.");for(var X=0;X<D;X++){var U=Math.max(_e,0),oe=F.default.getSilentFrame(g.manifestCodec||g.codec,g.channelCount);oe||(B.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),oe=ye.unit.subarray()),ie.splice(Te,0,{unit:oe,pts:U}),_e+=V,Te++}}ye.pts=_e,_e+=V}for(var be=null,xe=null,Pe,De=0,Oe=ie.length;Oe--;)De+=ie[Oe].unit.byteLength;for(var Ie=0,He=ie.length;Ie<He;Ie++){var Ve=ie[Ie],Je=Ve.unit,Xe=Ve.pts;if(xe!==null){var We=$[Ie-1];We.duration=Math.round((Xe-xe)/j)}else if(a&&g.isAAC&&(Xe=me),be=Xe,De>0){De+=he;try{Pe=new Uint8Array(De)}catch(ue){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:H.ErrorTypes.MUX_ERROR,details:H.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:De,reason:"fail allocating audio mdat "+De});return}if(!N){var Qe=new DataView(Pe.buffer);Qe.setUint32(0,De),Pe.set(k.default.types.mdat,4)}}else return;Pe.set(Je,he);var et=Je.byteLength;he+=et,$.push(new y(!0,z,et,0)),xe=Xe}var Ae=$.length;if(!Ae)return;var ut=$[$.length-1];this.nextAudioPts=me=xe+j*ut.duration;var it=N?new Uint8Array(0):k.default.moof(g.sequenceNumber++,be/j,w({},g,{samples:$}));g.samples=[];var se=be/S,q=me/S,ee="audio",ae={data1:it,data2:Pe,startPTS:se,endPTS:q,startDTS:se,endDTS:q,type:ee,hasAudio:!0,hasVideo:!1,nb:Ae};return this.isAudioContiguous=!0,console.assert(Pe.length,"MDAT length must not be zero"),ae},E.remuxEmptyAudio=function(g,u,a,b){var v=g.inputTimeScale,S=g.samplerate?g.samplerate:v,I=v/S,j=this.nextAudioPts,z=(j!==null?j:b.startDTS*v)+this._initDTS,V=b.endDTS*v+this._initDTS,M=I*L,N=Math.ceil((V-z)/M),$=F.default.getSilentFrame(g.manifestCodec||g.codec,g.channelCount);if(B.logger.warn("[mp4-remuxer]: remux empty Audio"),!$){B.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ie=[],he=0;he<N;he++){var me=z+he*M;ie.push({unit:$,pts:me,dts:me})}return g.samples=ie,this.remuxAudio(g,u,a,!1)},E.remuxID3=function(g,u){var a=g.samples.length;if(!a)return;for(var b=g.inputTimeScale,v=this._initPTS,S=this._initDTS,I=0;I<a;I++){var j=g.samples[I];j.pts=d(j.pts-v,u*b)/b,j.dts=d(j.dts-S,u*b)/b}var z=g.samples;return g.samples=[],{samples:z}},E.remuxText=function(g,u){var a=g.samples.length;if(!a)return;for(var b=g.inputTimeScale,v=this._initPTS,S=0;S<a;S++){var I=g.samples[S];I.pts=d(I.pts-v,u*b)/b}g.samples.sort(function(z,V){return z.pts-V.pts});var j=g.samples;return g.samples=[],{samples:j}},f}();function d(f,E){var p;if(E===null)return f;for(E<f?p=-8589934592:p=8589934592;Math.abs(f-E)>4294967296;)f+=p;return f}function T(f){for(var E=0;E<f.length;E++)if(f[E].key)return E;return-1}var y=function(E,p,g,u){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=p,this.size=g,this.cts=u,this.flags=new m(E)},m=function(E){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=E?2:1,this.isNonSync=E?0:1}},"./src/remux/passthrough-remuxer.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/polyfills/number.ts"),F=O("./src/utils/mp4-tools.ts"),k=O("./src/loader/fragment.ts"),G=O("./src/utils/logger.ts"),H=function(){function x(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var w=x.prototype;return w.destroy=function(){},w.resetTimeStamp=function(L){this.initPTS=L,this.lastEndDTS=null},w.resetNextTimestamp=function(){this.lastEndDTS=null},w.resetInitSegment=function(L,A,_){this.audioCodec=A,this.videoCodec=_,this.generateInitSegment(L),this.emitInitSegment=!0},w.generateInitSegment=function(L){var A=this.audioCodec,_=this.videoCodec;if(!L||!L.byteLength){this.initTracks=void 0,this.initData=void 0;return}var h=this.initData=Object(F.parseInitSegment)(L);A||(A=R(h.audio,k.ElementaryStreamTypes.AUDIO)),_||(_=R(h.video,k.ElementaryStreamTypes.VIDEO));var o={};h.audio&&h.video?o.audiovideo={container:"video/mp4",codec:A+","+_,initSegment:L,id:"main"}:h.audio?o.audio={container:"audio/mp4",codec:A,initSegment:L,id:"audio"}:h.video?o.video={container:"video/mp4",codec:_,initSegment:L,id:"main"}:G.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},w.remux=function(L,A,_,h,o){var s=this.initPTS,d=this.lastEndDTS,T={audio:void 0,video:void 0,text:h,id3:_,initSegment:void 0};Object(Z.isFiniteNumber)(d)||(d=this.lastEndDTS=o||0);var y=A.samples;if(!y||!y.length)return T;var m={initPTS:void 0,timescale:1},f=this.initData;if((!f||!f.length)&&(this.generateInitSegment(y),f=this.initData),!f||!f.length)return G.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),T;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1),Object(Z.isFiniteNumber)(s)||(this.initPTS=m.initPTS=s=B(f,y,d));var E=Object(F.getDuration)(y,f),p=d,g=E+p;Object(F.offsetStartDTS)(f,y,s),E>0?this.lastEndDTS=g:(G.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var u=!!f.audio,a=!!f.video,b="";u&&(b+="audio"),a&&(b+="video");var v={data1:y,startPTS:p,startDTS:p,endPTS:g,endDTS:g,type:b,hasAudio:u,hasVideo:a,nb:1,dropped:0};return T.audio=v.type==="audio"?v:void 0,T.video=v.type!=="audio"?v:void 0,T.text=h,T.id3=_,T.initSegment=m,T},x}(),B=function(w,P,L){return Object(F.getStartDTS)(w,P)-L};function R(x,w){var P=x==null?void 0:x.codec;return P&&P.length>4?P:P==="hvc1"?"hvc1.1.c.L120.90":P==="av01"?"av01.0.04M.08":P==="avc1"||w===k.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}J.default=H},"./src/task-loop.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return Z});var Z=function(){function F(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var k=F.prototype;return k.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},k.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},k.onHandlerDestroyed=function(){},k.hasInterval=function(){return!!this._tickInterval},k.hasNextTick=function(){return!!this._tickTimer},k.setInterval=function(H){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,H),!0)},k.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},k.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},k.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},k.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},k.doTick=function(){},F}()},"./src/types/cmcd.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"CMCDVersion",function(){return Z}),O.d(J,"CMCDObjectType",function(){return F}),O.d(J,"CMCDStreamingFormat",function(){return k}),O.d(J,"CMCDStreamType",function(){return G});var Z=1,F;(function(H){H.MANIFEST="m",H.AUDIO="a",H.VIDEO="v",H.MUXED="av",H.INIT="i",H.CAPTION="c",H.TIMED_TEXT="tt",H.KEY="k",H.OTHER="o"})(F||(F={}));var k;(function(H){H.DASH="d",H.HLS="h",H.SMOOTH="s",H.OTHER="o"})(k||(k={}));var G;(function(H){H.VOD="v",H.LIVE="l"})(G||(G={}))},"./src/types/level.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"HlsSkip",function(){return k}),O.d(J,"getSkipValue",function(){return G}),O.d(J,"HlsUrlParameters",function(){return H}),O.d(J,"Level",function(){return B});function Z(R,x){for(var w=0;w<x.length;w++){var P=x[w];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(R,P.key,P)}}function F(R,x,w){return x&&Z(R.prototype,x),w&&Z(R,w),R}var k;(function(R){R.No="",R.Yes="YES",R.v2="v2"})(k||(k={}));function G(R,x){var w=R.canSkipUntil,P=R.canSkipDateRanges,L=R.endSN,A=x!==void 0?x-L:0;return w&&A<w?P?k.v2:k.Yes:k.No}var H=function(){function R(w,P,L){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=w,this.part=P,this.skip=L}var x=R.prototype;return x.addDirectives=function(P){var L=new self.URL(P);return this.msn!==void 0&&L.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&L.searchParams.set("_HLS_part",this.part.toString()),this.skip&&L.searchParams.set("_HLS_skip",this.skip),L.toString()},R}(),B=function(){function R(x){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[x.url],this.attrs=x.attrs,this.bitrate=x.bitrate,x.details&&(this.details=x.details),this.id=x.id||0,this.name=x.name,this.width=x.width||0,this.height=x.height||0,this.audioCodec=x.audioCodec,this.videoCodec=x.videoCodec,this.unknownCodecs=x.unknownCodecs,this.codecSet=[x.videoCodec,x.audioCodec].filter(function(w){return w}).join(",").replace(/\.[^.,]+/g,"")}return F(R,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(w){var P=w%this.url.length;this._urlId!==P&&(this.details=void 0,this._urlId=P)}}]),R}()},"./src/types/loader.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"PlaylistContextType",function(){return Z}),O.d(J,"PlaylistLevelType",function(){return F});var Z;(function(k){k.MANIFEST="manifest",k.LEVEL="level",k.AUDIO_TRACK="audioTrack",k.SUBTITLE_TRACK="subtitleTrack"})(Z||(Z={}));var F;(function(k){k.MAIN="main",k.AUDIO="audio",k.SUBTITLE="subtitle"})(F||(F={}))},"./src/types/transmuxer.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"ChunkMetadata",function(){return Z});var Z=function(G,H,B,R,x,w){R===void 0&&(R=0),x===void 0&&(x=-1),w===void 0&&(w=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=F(),this.buffering={audio:F(),video:F(),audiovideo:F()},this.level=G,this.sn=H,this.id=B,this.size=R,this.part=x,this.partial=w};function F(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"AttrList",function(){return k});var Z=/^(\d+)x(\d+)$/,F=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,k=function(){function G(B){typeof B=="string"&&(B=G.parseAttrList(B));for(var R in B)B.hasOwnProperty(R)&&(this[R]=B[R])}var H=G.prototype;return H.decimalInteger=function(R){var x=parseInt(this[R],10);return x>Number.MAX_SAFE_INTEGER?Infinity:x},H.hexadecimalInteger=function(R){if(this[R]){var x=(this[R]||"0x").slice(2);x=(x.length&1?"0":"")+x;for(var w=new Uint8Array(x.length/2),P=0;P<x.length/2;P++)w[P]=parseInt(x.slice(P*2,P*2+2),16);return w}else return null},H.hexadecimalIntegerAsNumber=function(R){var x=parseInt(this[R],16);return x>Number.MAX_SAFE_INTEGER?Infinity:x},H.decimalFloatingPoint=function(R){return parseFloat(this[R])},H.optionalFloat=function(R,x){var w=this[R];return w?parseFloat(w):x},H.enumeratedString=function(R){return this[R]},H.bool=function(R){return this[R]==="YES"},H.decimalResolution=function(R){var x=Z.exec(this[R]);return x===null?void 0:{width:parseInt(x[1],10),height:parseInt(x[2],10)}},G.parseAttrList=function(R){var x,w={},P='"';for(F.lastIndex=0;(x=F.exec(R))!==null;){var L=x[2];L.indexOf(P)===0&&L.lastIndexOf(P)===L.length-1&&(L=L.slice(1,-1)),w[x[1]]=L}return w},G}()},"./src/utils/binary-search.ts":function(ce,J,O){"use strict";O.r(J);var Z={search:function(k,G){for(var H=0,B=k.length-1,R=null,x=null;H<=B;){R=(H+B)/2|0,x=k[R];var w=G(x);if(w>0)H=R+1;else if(w<0)B=R-1;else return x}return null}};J.default=Z},"./src/utils/buffer-helper.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"BufferHelper",function(){return k});var Z=O("./src/utils/logger.ts"),F={length:0,start:function(){return 0},end:function(){return 0}},k=function(){function G(){}return G.isBuffered=function(B,R){try{if(B){for(var x=G.getBuffered(B),w=0;w<x.length;w++)if(R>=x.start(w)&&R<=x.end(w))return!0}}catch(P){}return!1},G.bufferInfo=function(B,R,x){try{if(B){var w=G.getBuffered(B),P=[],L;for(L=0;L<w.length;L++)P.push({start:w.start(L),end:w.end(L)});return this.bufferedInfo(P,R,x)}}catch(A){}return{len:0,start:R,end:R,nextStart:void 0}},G.bufferedInfo=function(B,R,x){R=Math.max(0,R),B.sort(function(m,f){var E=m.start-f.start;return E||f.end-m.end});var w=[];if(x)for(var P=0;P<B.length;P++){var L=w.length;if(L){var A=w[L-1].end;B[P].start-A<x?B[P].end>A&&(w[L-1].end=B[P].end):w.push(B[P])}else w.push(B[P])}else w=B;for(var _=0,h,o=R,s=R,d=0;d<w.length;d++){var T=w[d].start,y=w[d].end;if(R+x>=T&&R<y)o=T,s=y,_=s-R;else if(R+x<T){h=T;break}}return{len:_,start:o||0,end:s||0,nextStart:h}},G.getBuffered=function(B){try{return B.buffered}catch(R){return Z.logger.log("failed to get media.buffered",R),F}},G}()},"./src/utils/cea-608-parser.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"Row",function(){return s}),O.d(J,"CaptionScreen",function(){return d});var Z=O("./src/utils/logger.ts"),F={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},k=function(g){var u=g;return F.hasOwnProperty(g)&&(u=F[g]),String.fromCharCode(u)},G=15,H=100,B={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},R={17:2,18:4,21:6,22:8,23:10,19:13,20:15},x={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},w={25:2,26:4,29:6,30:8,31:10,27:13,28:15},P=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],L;(function(p){p[p.ERROR=0]="ERROR",p[p.TEXT=1]="TEXT",p[p.WARNING=2]="WARNING",p[p.INFO=2]="INFO",p[p.DEBUG=3]="DEBUG",p[p.DATA=3]="DATA"})(L||(L={}));var A=function(){function p(){this.time=null,this.verboseLevel=L.ERROR}var g=p.prototype;return g.log=function(a,b){this.verboseLevel>=a&&Z.logger.log(this.time+" ["+a+"] "+b)},p}(),_=function(g){for(var u=[],a=0;a<g.length;a++)u.push(g[a].toString(16));return u},h=function(){function p(u,a,b,v,S){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=u||"white",this.underline=a||!1,this.italics=b||!1,this.background=v||"black",this.flash=S||!1}var g=p.prototype;return g.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},g.setStyles=function(a){for(var b=["foreground","underline","italics","background","flash"],v=0;v<b.length;v++){var S=b[v];a.hasOwnProperty(S)&&(this[S]=a[S])}},g.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},g.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},g.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},g.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},p}(),o=function(){function p(u,a,b,v,S,I){this.uchar=void 0,this.penState=void 0,this.uchar=u||" ",this.penState=new h(a,b,v,S,I)}var g=p.prototype;return g.reset=function(){this.uchar=" ",this.penState.reset()},g.setChar=function(a,b){this.uchar=a,this.penState.copy(b)},g.setPenState=function(a){this.penState.copy(a)},g.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},g.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},g.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},p}(),s=function(){function p(u){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<H;a++)this.chars.push(new o);this.logger=u,this.pos=0,this.currPenState=new h}var g=p.prototype;return g.equals=function(a){for(var b=!0,v=0;v<H;v++)if(!this.chars[v].equals(a.chars[v])){b=!1;break}return b},g.copy=function(a){for(var b=0;b<H;b++)this.chars[b].copy(a.chars[b])},g.isEmpty=function(){for(var a=!0,b=0;b<H;b++)if(!this.chars[b].isEmpty()){a=!1;break}return a},g.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(L.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>H&&(this.logger.log(L.DEBUG,"Too large cursor position "+this.pos),this.pos=H)},g.moveCursor=function(a){var b=this.pos+a;if(a>1)for(var v=this.pos+1;v<b+1;v++)this.chars[v].setPenState(this.currPenState);this.setCursor(b)},g.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},g.insertChar=function(a){a>=144&&this.backSpace();var b=k(a);if(this.pos>=H){this.logger.log(L.ERROR,"Cannot insert "+a.toString(16)+" ("+b+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(b,this.currPenState),this.moveCursor(1)},g.clearFromPos=function(a){var b;for(b=a;b<H;b++)this.chars[b].reset()},g.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},g.clearToEndOfRow=function(){this.clearFromPos(this.pos)},g.getTextString=function(){for(var a=[],b=!0,v=0;v<H;v++){var S=this.chars[v].uchar;S!==" "&&(b=!1),a.push(S)}return b?"":a.join("")},g.setPenStyles=function(a){this.currPenState.setStyles(a);var b=this.chars[this.pos];b.setPenState(this.currPenState)},p}(),d=function(){function p(u){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<G;a++)this.rows.push(new s(u));this.logger=u,this.currRow=G-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var g=p.prototype;return g.reset=function(){for(var a=0;a<G;a++)this.rows[a].clear();this.currRow=G-1},g.equals=function(a){for(var b=!0,v=0;v<G;v++)if(!this.rows[v].equals(a.rows[v])){b=!1;break}return b},g.copy=function(a){for(var b=0;b<G;b++)this.rows[b].copy(a.rows[b])},g.isEmpty=function(){for(var a=!0,b=0;b<G;b++)if(!this.rows[b].isEmpty()){a=!1;break}return a},g.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},g.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},g.insertChar=function(a){var b=this.rows[this.currRow];b.insertChar(a)},g.setPen=function(a){var b=this.rows[this.currRow];b.setPenStyles(a)},g.moveCursor=function(a){var b=this.rows[this.currRow];b.moveCursor(a)},g.setCursor=function(a){this.logger.log(L.INFO,"setCursor: "+a);var b=this.rows[this.currRow];b.setCursor(a)},g.setPAC=function(a){this.logger.log(L.INFO,"pacData = "+JSON.stringify(a));var b=a.row-1;if(this.nrRollUpRows&&b<this.nrRollUpRows-1&&(b=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==b){for(var v=0;v<G;v++)this.rows[v].clear();var S=this.currRow+1-this.nrRollUpRows,I=this.lastOutputScreen;if(I){var j=I.rows[S].cueStartTime,z=this.logger.time;if(j&&z!==null&&j<z)for(var V=0;V<this.nrRollUpRows;V++)this.rows[b-this.nrRollUpRows+V+1].copy(I.rows[S+V])}}this.currRow=b;var M=this.rows[this.currRow];if(a.indent!==null){var N=a.indent,$=Math.max(N-1,0);M.setCursor(a.indent),a.color=M.chars[$].penState.foreground}var ie={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(ie)},g.setBkgData=function(a){this.logger.log(L.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},g.setRollUpRows=function(a){this.nrRollUpRows=a},g.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(L.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(L.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,b=this.rows.splice(a,1)[0];b.clear(),this.rows.splice(this.currRow,0,b),this.logger.log(L.INFO,"Rolling up")},g.getDisplayText=function(a){a=a||!1;for(var b=[],v="",S=-1,I=0;I<G;I++){var j=this.rows[I].getTextString();j&&(S=I+1,a?b.push("Row "+S+": '"+j+"'"):b.push(j.trim()))}return b.length>0&&(a?v="["+b.join(" | ")+"]":v=b.join(`
`)),v},g.getTextAndFormat=function(){return this.rows},p}(),T=function(){function p(u,a,b){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=u,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new d(b),this.nonDisplayedMemory=new d(b),this.lastOutputScreen=new d(b),this.currRollUpRow=this.displayedMemory.rows[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=b}var g=p.prototype;return g.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},g.getHandler=function(){return this.outputFilter},g.setHandler=function(a){this.outputFilter=a},g.setPAC=function(a){this.writeScreen.setPAC(a)},g.setBkgData=function(a){this.writeScreen.setBkgData(a)},g.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(L.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},g.insertChars=function(a){for(var b=0;b<a.length;b++)this.writeScreen.insertChar(a[b]);var v=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(L.INFO,v+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(L.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},g.ccRCL=function(){this.logger.log(L.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},g.ccBS=function(){if(this.logger.log(L.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},g.ccAOF=function(){},g.ccAON=function(){},g.ccDER=function(){this.logger.log(L.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},g.ccRU=function(a){this.logger.log(L.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},g.ccFON=function(){this.logger.log(L.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},g.ccRDC=function(){this.logger.log(L.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},g.ccTR=function(){this.logger.log(L.INFO,"TR"),this.setMode("MODE_TEXT")},g.ccRTD=function(){this.logger.log(L.INFO,"RTD"),this.setMode("MODE_TEXT")},g.ccEDM=function(){this.logger.log(L.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},g.ccCR=function(){this.logger.log(L.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},g.ccENM=function(){this.logger.log(L.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},g.ccEOC=function(){if(this.logger.log(L.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(L.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},g.ccTO=function(a){this.logger.log(L.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},g.ccMIDROW=function(a){var b={flash:!1};if(b.underline=a%2===1,b.italics=a>=46,b.italics)b.foreground="white";else{var v=Math.floor(a/2)-16,S=["white","green","blue","cyan","red","yellow","magenta"];b.foreground=S[v]}this.logger.log(L.INFO,"MIDROW: "+JSON.stringify(b)),this.writeScreen.setPen(b)},g.outputDataUpdate=function(a){a===void 0&&(a=!1);var b=this.logger.time;if(b===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=b:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,b,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:b),this.lastOutputScreen.copy(this.displayedMemory))},g.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},p}(),y=function(){function p(u,a,b){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var v=new A;this.channels=[null,new T(u,a,v),new T(u+1,b,v)],this.cmdHistory=E(),this.logger=v}var g=p.prototype;return g.getHandler=function(a){return this.channels[a].getHandler()},g.setHandler=function(a,b){this.channels[a].setHandler(b)},g.addData=function(a,b){var v,S,I,j=!1;this.logger.time=a;for(var z=0;z<b.length;z+=2){if(S=b[z]&127,I=b[z+1]&127,S===0&&I===0)continue;if(this.logger.log(L.DATA,"["+_([b[z],b[z+1]])+"] -> ("+_([S,I])+")"),v=this.parseCmd(S,I),v||(v=this.parseMidrow(S,I)),v||(v=this.parsePAC(S,I)),v||(v=this.parseBackgroundAttributes(S,I)),!v&&(j=this.parseChars(S,I),j)){var V=this.currentChannel;if(V&&V>0){var M=this.channels[V];M.insertChars(j)}else this.logger.log(L.WARNING,"No channel found yet. TEXT-MODE?")}!v&&!j&&this.logger.log(L.WARNING,"Couldn't parse cleaned data "+_([S,I])+" orig: "+_([b[z],b[z+1]]))}},g.parseCmd=function(a,b){var v=this.cmdHistory,S=(a===20||a===28||a===21||a===29)&&b>=32&&b<=47,I=(a===23||a===31)&&b>=33&&b<=35;if(!(S||I))return!1;if(f(a,b,v))return m(null,null,v),this.logger.log(L.DEBUG,"Repeated command ("+_([a,b])+") is dropped"),!0;var j=a===20||a===21||a===23?1:2,z=this.channels[j];return a===20||a===21||a===28||a===29?b===32?z.ccRCL():b===33?z.ccBS():b===34?z.ccAOF():b===35?z.ccAON():b===36?z.ccDER():b===37?z.ccRU(2):b===38?z.ccRU(3):b===39?z.ccRU(4):b===40?z.ccFON():b===41?z.ccRDC():b===42?z.ccTR():b===43?z.ccRTD():b===44?z.ccEDM():b===45?z.ccCR():b===46?z.ccENM():b===47&&z.ccEOC():z.ccTO(b-32),m(a,b,v),this.currentChannel=j,!0},g.parseMidrow=function(a,b){var v=0;if((a===17||a===25)&&b>=32&&b<=47){if(a===17?v=1:v=2,v!==this.currentChannel)return this.logger.log(L.ERROR,"Mismatch channel in midrow parsing"),!1;var S=this.channels[v];return S?(S.ccMIDROW(b),this.logger.log(L.DEBUG,"MIDROW ("+_([a,b])+")"),!0):!1}return!1},g.parsePAC=function(a,b){var v,S=this.cmdHistory,I=(a>=17&&a<=23||a>=25&&a<=31)&&b>=64&&b<=127,j=(a===16||a===24)&&b>=64&&b<=95;if(!(I||j))return!1;if(f(a,b,S))return m(null,null,S),!0;var z=a<=23?1:2;b>=64&&b<=95?v=z===1?B[a]:x[a]:v=z===1?R[a]:w[a];var V=this.channels[z];return V?(V.setPAC(this.interpretPAC(v,b)),m(a,b,S),this.currentChannel=z,!0):!1},g.interpretPAC=function(a,b){var v,S={color:null,italics:!1,indent:null,underline:!1,row:a};return b>95?v=b-96:v=b-64,S.underline=(v&1)===1,v<=13?S.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(v/2)]:v<=15?(S.italics=!0,S.color="white"):S.indent=Math.floor((v-16)/2)*4,S},g.parseChars=function(a,b){var v,S=null,I=null;if(a>=25?(v=2,I=a-8):(v=1,I=a),I>=17&&I<=19){var j;I===17?j=b+80:I===18?j=b+112:j=b+144,this.logger.log(L.INFO,"Special char '"+k(j)+"' in channel "+v),S=[j]}else a>=32&&a<=127&&(S=b===0?[a]:[a,b]);if(S){var z=_(S);this.logger.log(L.DEBUG,"Char codes = "+z.join(",")),m(a,b,this.cmdHistory)}return S},g.parseBackgroundAttributes=function(a,b){var v=(a===16||a===24)&&b>=32&&b<=47,S=(a===23||a===31)&&b>=45&&b<=47;if(!(v||S))return!1;var I,j={};a===16||a===24?(I=Math.floor((b-32)/2),j.background=P[I],b%2===1&&(j.background=j.background+"_semi")):b===45?j.background="transparent":(j.foreground="black",b===47&&(j.underline=!0));var z=a<=23?1:2,V=this.channels[z];return V.setBkgData(j),m(a,b,this.cmdHistory),!0},g.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var b=this.channels[a];b&&b.reset()}this.cmdHistory=E()},g.cueSplitAtTime=function(a){for(var b=0;b<this.channels.length;b++){var v=this.channels[b];v&&v.cueSplitAtTime(a)}},p}();function m(p,g,u){u.a=p,u.b=g}function f(p,g,u){return u.a===p&&u.b===g}function E(){return{a:null,b:null}}J.default=y},"./src/utils/codecs.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"isCodecType",function(){return F}),O.d(J,"isCodecSupportedInMp4",function(){return k});var Z={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function F(G,H){var B=Z[H];return!!B&&B[G.slice(0,4)]===!0}function k(G,H){return MediaSource.isTypeSupported((H||"video")+'/mp4;codecs="'+G+'"')}},"./src/utils/cues.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/utils/vttparser.ts"),F=O("./src/utils/webvtt-parser.ts"),k=O("./src/utils/texttrack-utils.ts"),G=/\s/,H={newCue:function(R,x,w,P){for(var L=[],A,_,h,o,s,d=self.VTTCue||self.TextTrackCue,T=0;T<P.rows.length;T++)if(A=P.rows[T],h=!0,o=0,s="",!A.isEmpty()){for(var y=0;y<A.chars.length;y++)G.test(A.chars[y].uchar)&&h?o++:(s+=A.chars[y].uchar,h=!1);A.cueStartTime=x,x===w&&(w+=1e-4),o>=16?o--:o++;var m=Object(Z.fixLineBreaks)(s.trim()),f=Object(F.generateCueId)(x,w,m);(!R||!R.cues||!R.cues.getCueById(f))&&(_=new d(x,w,m),_.id=f,_.line=T+1,_.align="left",_.position=10+Math.min(80,Math.floor(o*8/32)*10),L.push(_))}return R&&L.length&&(L.sort(function(E,p){return E.line==="auto"||p.line==="auto"?0:E.line>8&&p.line>8?p.line-E.line:E.line-p.line}),L.forEach(function(E){return Object(k.addCueToTrack)(R,E)})),L}};J.default=H},"./src/utils/discontinuities.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"findFirstFragWithCC",function(){return G}),O.d(J,"shouldAlignOnDiscontinuities",function(){return H}),O.d(J,"findDiscontinuousReferenceFrag",function(){return B}),O.d(J,"adjustSlidingStart",function(){return x}),O.d(J,"alignStream",function(){return w}),O.d(J,"alignPDT",function(){return L}),O.d(J,"alignFragmentByPDTDelta",function(){return A}),O.d(J,"alignMediaPlaylistByPDT",function(){return _});var Z=O("./src/polyfills/number.ts"),F=O("./src/utils/logger.ts"),k=O("./src/controller/level-helper.ts");function G(h,o){for(var s=null,d=0,T=h.length;d<T;d++){var y=h[d];if(y&&y.cc===o){s=y;break}}return s}function H(h,o,s){return!!(o.details&&(s.endCC>s.startCC||h&&h.cc<s.startCC))}function B(h,o){var s=h.fragments,d=o.fragments;if(!d.length||!s.length){F.logger.log("No fragments to align");return}var T=G(s,d[0].cc);if(!T||T&&!T.startPTS){F.logger.log("No frag in previous level to align on");return}return T}function R(h,o){if(h){var s=h.start+o;h.start=h.startPTS=s,h.endPTS=s+h.duration}}function x(h,o){for(var s=o.fragments,d=0,T=s.length;d<T;d++)R(s[d],h);o.fragmentHint&&R(o.fragmentHint,h),o.alignedSliding=!0}function w(h,o,s){if(!o)return;P(h,s,o),!s.alignedSliding&&o.details&&L(s,o.details),!s.alignedSliding&&o.details&&!s.skippedSegments&&Object(k.adjustSliding)(o.details,s)}function P(h,o,s){if(H(h,s,o)){var d=B(s.details,o);d&&Object(Z.isFiniteNumber)(d.start)&&(F.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),x(d.start,o))}}function L(h,o){if(!o.fragments.length||!h.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,d=h.fragments[0].programDateTime,T=(d-s)/1e3+o.fragments[0].start;T&&Object(Z.isFiniteNumber)(T)&&(F.logger.log("Adjusting PTS using programDateTime delta "+(d-s)+"ms, sliding:"+T.toFixed(3)+" "+h.url+" "),x(T,h))}function A(h,o){var s=h.programDateTime;if(!s)return;var d=(s-o)/1e3;h.start=h.startPTS=d,h.endPTS=d+h.duration}function _(h,o){if(!o.fragments.length||!h.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,d=o.fragments[0].start,T=s-d*1e3;h.fragments.forEach(function(y){A(y,T)}),h.fragmentHint&&A(h.fragmentHint,T),h.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/utils/ewma.ts"),F=function(){function k(H,B,R){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=R,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Z.default(H),this.fast_=new Z.default(B)}var G=k.prototype;return G.update=function(B,R){var x=this.slow_,w=this.fast_;this.slow_.halfLife!==B&&(this.slow_=new Z.default(B,x.getEstimate(),x.getTotalWeight())),this.fast_.halfLife!==R&&(this.fast_=new Z.default(R,w.getEstimate(),w.getTotalWeight()))},G.sample=function(B,R){B=Math.max(B,this.minDelayMs_);var x=8*R,w=B/1e3,P=x/w;this.fast_.sample(w,P),this.slow_.sample(w,P)},G.canEstimate=function(){var B=this.fast_;return B&&B.getTotalWeight()>=this.minWeight_},G.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},G.destroy=function(){},k}();J.default=F},"./src/utils/ewma.ts":function(ce,J,O){"use strict";O.r(J);var Z=function(){function F(G,H,B){H===void 0&&(H=0),B===void 0&&(B=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=G,this.alpha_=G?Math.exp(Math.log(.5)/G):0,this.estimate_=H,this.totalWeight_=B}var k=F.prototype;return k.sample=function(H,B){var R=Math.pow(this.alpha_,H);this.estimate_=B*(1-R)+R*this.estimate_,this.totalWeight_+=H},k.getTotalWeight=function(){return this.totalWeight_},k.getEstimate=function(){if(this.alpha_){var H=1-Math.pow(this.alpha_,this.totalWeight_);if(H)return this.estimate_/H}return this.estimate_},F}();J.default=Z},"./src/utils/fetch-loader.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"fetchSupported",function(){return A});var Z=O("./src/polyfills/number.ts"),F=O("./src/loader/load-stats.ts"),k=O("./src/demux/chunk-cache.ts");function G(d,T){d.prototype=Object.create(T.prototype),d.prototype.constructor=d,w(d,T)}function H(d){var T=typeof Map=="function"?new Map:void 0;return H=function(m){if(m===null||!x(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(typeof T!="undefined"){if(T.has(m))return T.get(m);T.set(m,f)}function f(){return B(m,arguments,P(this).constructor)}return f.prototype=Object.create(m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),w(f,m)},H(d)}function B(d,T,y){return R()?B=Reflect.construct:B=function(f,E,p){var g=[null];g.push.apply(g,E);var u=Function.bind.apply(f,g),a=new u;return p&&w(a,p.prototype),a},B.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(d){return!1}}function x(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function w(d,T){return w=Object.setPrototypeOf||function(m,f){return m.__proto__=f,m},w(d,T)}function P(d){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(y){return y.__proto__||Object.getPrototypeOf(y)},P(d)}function L(){return L=Object.assign||function(d){for(var T=1;T<arguments.length;T++){var y=arguments[T];for(var m in y)Object.prototype.hasOwnProperty.call(y,m)&&(d[m]=y[m])}return d},L.apply(this,arguments)}function A(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(d){}return!1}var _=function(){function d(y){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=y.fetchSetup||o,this.controller=new self.AbortController,this.stats=new F.LoadStats}var T=d.prototype;return T.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},T.abortInternal=function(){var m=this.response;(!m||!m.ok)&&(this.stats.aborted=!0,this.controller.abort())},T.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},T.load=function(m,f,E){var p=this,g=this.stats;if(g.loading.start)throw new Error("Loader can only be used once.");g.loading.start=self.performance.now();var u=h(m,this.controller.signal),a=E.onProgress,b=m.responseType==="arraybuffer",v=b?"byteLength":"length";this.context=m,this.config=f,this.callbacks=E,this.request=this.fetchSetup(m,u),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){p.abortInternal(),E.onTimeout(g,m,p.response)},f.timeout),self.fetch(this.request).then(function(S){if(p.response=p.loader=S,!S.ok){var I=S.status,j=S.statusText;throw new s(j||"fetch, bad network response",I,S)}return g.loading.first=Math.max(self.performance.now(),g.loading.start),g.total=parseInt(S.headers.get("Content-Length")||"0"),a&&Object(Z.isFiniteNumber)(f.highWaterMark)?p.loadProgressively(S,g,m,f.highWaterMark,a):b?S.arrayBuffer():S.text()}).then(function(S){var I=p.response;self.clearTimeout(p.requestTimeout),g.loading.end=Math.max(self.performance.now(),g.loading.first),g.loaded=g.total=S[v];var j={url:I.url,data:S};a&&!Object(Z.isFiniteNumber)(f.highWaterMark)&&a(g,m,S,I),E.onSuccess(j,g,m,I)}).catch(function(S){if(self.clearTimeout(p.requestTimeout),g.aborted)return;var I=S.code||0;E.onError({code:I,text:S.message},m,S.details)})},T.getCacheAge=function(){var m=null;if(this.response){var f=this.response.headers.get("age");m=f?parseFloat(f):null}return m},T.loadProgressively=function(m,f,E,p,g){p===void 0&&(p=0);var u=new k.default,a=m.body.getReader(),b=function v(){return a.read().then(function(S){if(S.done)return u.dataLength&&g(f,E,u.flush(),m),Promise.resolve(new ArrayBuffer(0));var I=S.value,j=I.length;return f.loaded+=j,j<p||u.dataLength?(u.push(I),u.dataLength>=p&&g(f,E,u.flush(),m)):g(f,E,I,m),v()}).catch(function(){return Promise.reject()})};return b()},d}();function h(d,T){var y={method:"GET",mode:"cors",credentials:"same-origin",signal:T,headers:new self.Headers(L({},d.headers))};return d.rangeEnd&&y.headers.set("Range","bytes="+d.rangeStart+"-"+String(d.rangeEnd-1)),y}function o(d,T){return new self.Request(d.url,T)}var s=function(d){G(T,d);function T(y,m,f){var E;return E=d.call(this,y)||this,E.code=void 0,E.details=void 0,E.code=m,E.details=f,E}return T}(H(Error));J.default=_},"./src/utils/imsc1-ttml-parser.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"IMSC1_CODEC",function(){return x}),O.d(J,"parseIMSC1",function(){return A});var Z=O("./src/utils/mp4-tools.ts"),F=O("./src/utils/vttparser.ts"),k=O("./src/utils/vttcue.ts"),G=O("./src/demux/id3.ts"),H=O("./src/utils/timescale-conversion.ts"),B=O("./src/utils/webvtt-parser.ts");function R(){return R=Object.assign||function(p){for(var g=1;g<arguments.length;g++){var u=arguments[g];for(var a in u)Object.prototype.hasOwnProperty.call(u,a)&&(p[a]=u[a])}return p},R.apply(this,arguments)}var x="stpp.ttml.im1t",w=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,P=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,L={left:"start",center:"center",right:"end",start:"start",end:"end"};function A(p,g,u,a,b){var v=Object(Z.findBox)(new Uint8Array(p),["mdat"]);if(v.length===0){b(new Error("Could not parse IMSC1 mdat"));return}var S=v[0],I=Object(G.utf8ArrayToStr)(new Uint8Array(p,S.start,S.end-S.start)),j=Object(H.toTimescaleFromScale)(g,1,u);try{a(_(I,j))}catch(z){b(z)}}function _(p,g){var u=new DOMParser,a=u.parseFromString(p,"text/xml"),b=a.getElementsByTagName("tt")[0];if(!b)throw new Error("Invalid ttml");var v={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},S=Object.keys(v).reduce(function(M,N){return M[N]=b.getAttribute("ttp:"+N)||v[N],M},{}),I=b.getAttribute("xml:space")!=="preserve",j=o(h(b,"styling","style")),z=o(h(b,"layout","region")),V=h(b,"body","[begin]");return[].map.call(V,function(M){var N=s(M,I);if(!N||!M.hasAttribute("begin"))return null;var $=m(M.getAttribute("begin"),S),ie=m(M.getAttribute("dur"),S),he=m(M.getAttribute("end"),S);if($===null)throw y(M);if(he===null){if(ie===null)throw y(M);he=$+ie}var me=new k.default($-g,he-g,N);me.id=Object(B.generateCueId)(me.startTime,me.endTime,me.text);var ke=z[M.getAttribute("region")],Se=j[M.getAttribute("style")];me.position=10,me.size=80;var Re=d(ke,Se),Te=Re.textAlign;if(Te){var _e=L[Te];_e&&(me.lineAlign=_e),me.align=Te}return R(me,Re),me}).filter(function(M){return M!==null})}function h(p,g,u){var a=p.getElementsByTagName(g)[0];return a?[].slice.call(a.querySelectorAll(u)):[]}function o(p){return p.reduce(function(g,u){var a=u.getAttribute("xml:id");return a&&(g[a]=u),g},{})}function s(p,g){return[].slice.call(p.childNodes).reduce(function(u,a,b){var v;return a.nodeName==="br"&&b?u+`
`:(v=a.childNodes)!==null&&v!==void 0&&v.length?s(a,g):g?u+a.textContent.trim().replace(/\s+/g," "):u+a.textContent},"")}function d(p,g){var u="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(b,v){var S=T(g,u,v)||T(p,u,v);return S&&(b[v]=S),b},{})}function T(p,g,u){return p.hasAttributeNS(g,u)?p.getAttributeNS(g,u):null}function y(p){return new Error("Could not parse ttml timestamp "+p)}function m(p,g){if(!p)return null;var u=Object(F.parseTimeStamp)(p);return u===null&&(w.test(p)?u=f(p,g):P.test(p)&&(u=E(p,g))),u}function f(p,g){var u=w.exec(p),a=(u[4]|0)+(u[5]|0)/g.subFrameRate;return(u[1]|0)*3600+(u[2]|0)*60+(u[3]|0)+a/g.frameRate}function E(p,g){var u=P.exec(p),a=Number(u[1]),b=u[2];switch(b){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/g.frameRate;case"t":return a/g.tickRate}return a}},"./src/utils/logger.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"enableLogs",function(){return B}),O.d(J,"logger",function(){return R});var Z=function(){},F={trace:Z,debug:Z,log:Z,warn:Z,info:Z,error:Z},k=F;function G(x){var w=self.console[x];return w?w.bind(self.console,"["+x+"] >"):Z}function H(x){for(var w=arguments.length,P=new Array(w>1?w-1:0),L=1;L<w;L++)P[L-1]=arguments[L];P.forEach(function(A){k[A]=x[A]?x[A].bind(x):G(A)})}function B(x){if(self.console&&x===!0||typeof x=="object"){H(x,"debug","log","info","warn","error");try{k.log()}catch(w){k=F}}else k=F}var R=k},"./src/utils/mediakeys-helper.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"KeySystems",function(){return Z}),O.d(J,"requestMediaKeySystemAccess",function(){return F});var Z;(function(k){k.WIDEVINE="com.widevine.alpha",k.PLAYREADY="com.microsoft.playready"})(Z||(Z={}));var F=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"getMediaSource",function(){return Z});function Z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"bin2str",function(){return H}),O.d(J,"readUint16",function(){return B}),O.d(J,"readUint32",function(){return R}),O.d(J,"writeUint32",function(){return x}),O.d(J,"findBox",function(){return w}),O.d(J,"parseSegmentIndex",function(){return P}),O.d(J,"parseInitSegment",function(){return L}),O.d(J,"getStartDTS",function(){return A}),O.d(J,"getDuration",function(){return _}),O.d(J,"computeRawDurationFromSamples",function(){return h}),O.d(J,"offsetStartDTS",function(){return o}),O.d(J,"segmentValidRange",function(){return s}),O.d(J,"appendUint8Array",function(){return d});var Z=O("./src/utils/typed-array.ts"),F=O("./src/loader/fragment.ts"),k=Math.pow(2,32)-1,G=[].push;function H(T){return String.fromCharCode.apply(null,T)}function B(T,y){"data"in T&&(y+=T.start,T=T.data);var m=T[y]<<8|T[y+1];return m<0?65536+m:m}function R(T,y){"data"in T&&(y+=T.start,T=T.data);var m=T[y]<<24|T[y+1]<<16|T[y+2]<<8|T[y+3];return m<0?4294967296+m:m}function x(T,y,m){"data"in T&&(y+=T.start,T=T.data),T[y]=m>>24,T[y+1]=m>>16&255,T[y+2]=m>>8&255,T[y+3]=m&255}function w(T,y){var m=[];if(!y.length)return m;var f,E,p;"data"in T?(f=T.data,E=T.start,p=T.end):(f=T,E=0,p=f.byteLength);for(var g=E;g<p;){var u=R(f,g),a=H(f.subarray(g+4,g+8)),b=u>1?g+u:p;if(a===y[0])if(y.length===1)m.push({data:f,start:g+8,end:b});else{var v=w({data:f,start:g+8,end:b},y.slice(1));v.length&&G.apply(m,v)}g=b}return m}function P(T){var y=w(T,["moov"]),m=y[0],f=m?m.end:null,E=w(T,["sidx"]);if(!E||!E[0])return null;var p=[],g=E[0],u=g.data[0],a=u===0?8:16,b=R(g,a);a+=4;var v=0,S=0;u===0?a+=8:a+=16,a+=2;var I=g.end+S,j=B(g,a);a+=2;for(var z=0;z<j;z++){var V=a,M=R(g,V);V+=4;var N=M&2147483647,$=(M&2147483648)>>>31;if($===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ie=R(g,V);V+=4,p.push({referenceSize:N,subsegmentDuration:ie,info:{duration:ie/b,start:I,end:I+N-1}}),I+=N,V+=4,a=V}return{earliestPresentationTime:v,timescale:b,version:u,referencesCount:j,references:p,moovEndOffset:f}}function L(T){for(var y=[],m=w(T,["moov","trak"]),f=0;f<m.length;f++){var E=m[f],p=w(E,["tkhd"])[0];if(p){var g=p.data[p.start],u=g===0?12:20,a=R(p,u),b=w(E,["mdia","mdhd"])[0];if(b){g=b.data[b.start],u=g===0?12:20;var v=R(b,u),S=w(E,["mdia","hdlr"])[0];if(S){var I=H(S.data.subarray(S.start+8,S.start+12)),j={soun:F.ElementaryStreamTypes.AUDIO,vide:F.ElementaryStreamTypes.VIDEO}[I];if(j){var z=w(E,["mdia","minf","stbl","stsd"])[0],V=void 0;z&&(V=H(z.data.subarray(z.start+12,z.start+16))),y[a]={timescale:v,type:j},y[j]={timescale:v,id:a,codec:V}}}}}}var M=w(T,["moov","mvex","trex"]);return M.forEach(function(N){var $=R(N,4),ie=y[$];ie&&(ie.default={duration:R(N,12),flags:R(N,20)})}),y}function A(T,y){return w(y,["moof","traf"]).reduce(function(m,f){var E=w(f,["tfdt"])[0],p=E.data[E.start],g=w(f,["tfhd"]).reduce(function(u,a){var b=R(a,4),v=T[b];if(v){var S=R(E,4);p===1&&(S*=Math.pow(2,32),S+=R(E,8));var I=v.timescale||9e4,j=S/I;if(isFinite(j)&&(u===null||j<u))return j}return u},null);return g!==null&&isFinite(g)&&(m===null||g<m)?g:m},null)||0}function _(T,y){for(var m=0,f=0,E=0,p=w(T,["moof","traf"]),g=0;g<p.length;g++){var u=p[g],a=w(u,["tfhd"])[0],b=R(a,4),v=y[b];if(!v)continue;var S=v.default,I=R(a,0)|(S==null?void 0:S.flags),j=S==null?void 0:S.duration;I&8&&(I&2?j=R(a,12):j=R(a,8));for(var z=v.timescale||9e4,V=w(u,["trun"]),M=0;M<V.length;M++){if(j){var N=R(V[M],4);m=j*N}else m=h(V[M]);v.type===F.ElementaryStreamTypes.VIDEO?f+=m/z:v.type===F.ElementaryStreamTypes.AUDIO&&(E+=m/z)}}if(f===0&&E===0){var $=P(T);if($!=null&&$.references)return $.references.reduce(function(ie,he){return ie+he.info.duration||0},0)}return f||E}function h(T){var y=R(T,0),m=8;y&1&&(m+=4),y&4&&(m+=4);for(var f=0,E=R(T,4),p=0;p<E;p++){if(y&256){var g=R(T,m);f+=g,m+=4}y&512&&(m+=4),y&1024&&(m+=4),y&2048&&(m+=4)}return f}function o(T,y,m){w(y,["moof","traf"]).forEach(function(f){w(f,["tfhd"]).forEach(function(E){var p=R(E,4),g=T[p];if(!g)return;var u=g.timescale||9e4;w(f,["tfdt"]).forEach(function(a){var b=a.data[a.start],v=R(a,4);if(b===0)x(a,4,v-m*u);else{v*=Math.pow(2,32),v+=R(a,8),v-=m*u,v=Math.max(v,0);var S=Math.floor(v/(k+1)),I=Math.floor(v%(k+1));x(a,4,S),x(a,8,I)}})})})}function s(T){var y={valid:null,remainder:null},m=w(T,["moof"]);if(m){if(m.length<2)return y.remainder=T,y}else return y;var f=m[m.length-1];return y.valid=Object(Z.sliceUint8)(T,0,f.start-8),y.remainder=Object(Z.sliceUint8)(T,f.start-8),y}function d(T,y){var m=new Uint8Array(T.length+y.length);return m.set(T),m.set(y,T.length),m}},"./src/utils/output-filter.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return Z});var Z=function(){function F(G,H){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=G,this.trackName=H}var k=F.prototype;return k.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},k.newCue=function(H,B,R){(this.startTime===null||this.startTime>H)&&(this.startTime=H),this.endTime=B,this.screen=R,this.timelineController.createCaptionsTrack(this.trackName)},k.reset=function(){this.cueRanges=[]},F}()},"./src/utils/texttrack-utils.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"sendAddTrackEvent",function(){return F}),O.d(J,"addCueToTrack",function(){return k}),O.d(J,"clearCurrentCues",function(){return G}),O.d(J,"removeCuesInRange",function(){return H}),O.d(J,"getCuesInRange",function(){return R});var Z=O("./src/utils/logger.ts");function F(x,w){var P;try{P=new Event("addtrack")}catch(L){P=document.createEvent("Event"),P.initEvent("addtrack",!1,!1)}P.track=x,w.dispatchEvent(P)}function k(x,w){var P=x.mode;if(P==="disabled"&&(x.mode="hidden"),x.cues&&!x.cues.getCueById(w.id))try{if(x.addCue(w),!x.cues.getCueById(w.id))throw new Error("addCue is failed for: "+w)}catch(A){Z.logger.debug("[texttrack-utils]: "+A);var L=new self.TextTrackCue(w.startTime,w.endTime,w.text);L.id=w.id,x.addCue(L)}P==="disabled"&&(x.mode=P)}function G(x){var w=x.mode;if(w==="disabled"&&(x.mode="hidden"),x.cues)for(var P=x.cues.length;P--;)x.removeCue(x.cues[P]);w==="disabled"&&(x.mode=w)}function H(x,w,P){var L=x.mode;if(L==="disabled"&&(x.mode="hidden"),x.cues&&x.cues.length>0)for(var A=R(x.cues,w,P),_=0;_<A.length;_++)x.removeCue(A[_]);L==="disabled"&&(x.mode=L)}function B(x,w){if(w<x[0].startTime)return 0;var P=x.length-1;if(w>x[P].endTime)return-1;for(var L=0,A=P;L<=A;){var _=Math.floor((A+L)/2);if(w<x[_].startTime)A=_-1;else if(w>x[_].startTime&&L<P)L=_+1;else return _}return x[L].startTime-w<w-x[A].startTime?L:A}function R(x,w,P){var L=[],A=B(x,w);if(A>-1)for(var _=A,h=x.length;_<h;_++){var o=x[_];if(o.startTime>=w&&o.endTime<=P)L.push(o);else if(o.startTime>P)return L}return L}},"./src/utils/time-ranges.ts":function(ce,J,O){"use strict";O.r(J);var Z={toString:function(k){for(var G="",H=k.length,B=0;B<H;B++)G+="["+k.start(B).toFixed(3)+","+k.end(B).toFixed(3)+"]";return G}};J.default=Z},"./src/utils/timescale-conversion.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"toTimescaleFromBase",function(){return F}),O.d(J,"toTimescaleFromScale",function(){return k}),O.d(J,"toMsFromMpegTsClock",function(){return G}),O.d(J,"toMpegTsClockFromTimescale",function(){return H});var Z=9e4;function F(B,R,x,w){x===void 0&&(x=1),w===void 0&&(w=!1);var P=B*R*x;return w?Math.round(P):P}function k(B,R,x,w){return x===void 0&&(x=1),w===void 0&&(w=!1),F(B,R,1/x,w)}function G(B,R){return R===void 0&&(R=!1),F(B,1e3,1/Z,R)}function H(B,R){return R===void 0&&(R=1),F(B,Z,1/R)}},"./src/utils/typed-array.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"sliceUint8",function(){return Z});function Z(F,k,G){return Uint8Array.prototype.slice?F.slice(k,G):new Uint8Array(Array.prototype.slice.call(F,k,G))}},"./src/utils/vttcue.ts":function(ce,J,O){"use strict";O.r(J),J.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Z=["","lr","rl"],F=["start","middle","end","left","right"];function k(x,w){if(typeof w!="string")return!1;if(!Array.isArray(x))return!1;var P=w.toLowerCase();return~x.indexOf(P)?P:!1}function G(x){return k(Z,x)}function H(x){return k(F,x)}function B(x){for(var w=arguments.length,P=new Array(w>1?w-1:0),L=1;L<w;L++)P[L-1]=arguments[L];for(var A=1;A<arguments.length;A++){var _=arguments[A];for(var h in _)x[h]=_[h]}return x}function R(x,w,P){var L=this,A={enumerable:!0};L.hasBeenReset=!1;var _="",h=!1,o=x,s=w,d=P,T=null,y="",m=!0,f="auto",E="start",p=50,g="middle",u=50,a="middle";Object.defineProperty(L,"id",B({},A,{get:function(){return _},set:function(v){_=""+v}})),Object.defineProperty(L,"pauseOnExit",B({},A,{get:function(){return h},set:function(v){h=!!v}})),Object.defineProperty(L,"startTime",B({},A,{get:function(){return o},set:function(v){if(typeof v!="number")throw new TypeError("Start time must be set to a number.");o=v,this.hasBeenReset=!0}})),Object.defineProperty(L,"endTime",B({},A,{get:function(){return s},set:function(v){if(typeof v!="number")throw new TypeError("End time must be set to a number.");s=v,this.hasBeenReset=!0}})),Object.defineProperty(L,"text",B({},A,{get:function(){return d},set:function(v){d=""+v,this.hasBeenReset=!0}})),Object.defineProperty(L,"region",B({},A,{get:function(){return T},set:function(v){T=v,this.hasBeenReset=!0}})),Object.defineProperty(L,"vertical",B({},A,{get:function(){return y},set:function(v){var S=G(v);if(S===!1)throw new SyntaxError("An invalid or illegal string was specified.");y=S,this.hasBeenReset=!0}})),Object.defineProperty(L,"snapToLines",B({},A,{get:function(){return m},set:function(v){m=!!v,this.hasBeenReset=!0}})),Object.defineProperty(L,"line",B({},A,{get:function(){return f},set:function(v){if(typeof v!="number"&&v!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");f=v,this.hasBeenReset=!0}})),Object.defineProperty(L,"lineAlign",B({},A,{get:function(){return E},set:function(v){var S=H(v);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");E=S,this.hasBeenReset=!0}})),Object.defineProperty(L,"position",B({},A,{get:function(){return p},set:function(v){if(v<0||v>100)throw new Error("Position must be between 0 and 100.");p=v,this.hasBeenReset=!0}})),Object.defineProperty(L,"positionAlign",B({},A,{get:function(){return g},set:function(v){var S=H(v);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");g=S,this.hasBeenReset=!0}})),Object.defineProperty(L,"size",B({},A,{get:function(){return u},set:function(v){if(v<0||v>100)throw new Error("Size must be between 0 and 100.");u=v,this.hasBeenReset=!0}})),Object.defineProperty(L,"align",B({},A,{get:function(){return a},set:function(v){var S=H(v);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");a=S,this.hasBeenReset=!0}})),L.displayState=void 0}return R.prototype.getCueAsHTML=function(){var x=self.WebVTT;return x.convertCueToDOMTree(self,this.text)},R}()},"./src/utils/vttparser.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"parseTimeStamp",function(){return k}),O.d(J,"fixLineBreaks",function(){return w}),O.d(J,"VTTParser",function(){return P});var Z=O("./src/utils/vttcue.ts"),F=function(){function L(){}var A=L.prototype;return A.decode=function(h,o){if(!h)return"";if(typeof h!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(h))},L}();function k(L){function A(h,o,s,d){return(h|0)*3600+(o|0)*60+(s|0)+parseFloat(d||0)}var _=L.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return _?parseFloat(_[2])>59?A(_[2],_[3],0,_[4]):A(_[1],_[2],_[3],_[4]):null}var G=function(){function L(){this.values=Object.create(null)}var A=L.prototype;return A.set=function(h,o){!this.get(h)&&o!==""&&(this.values[h]=o)},A.get=function(h,o,s){return s?this.has(h)?this.values[h]:o[s]:this.has(h)?this.values[h]:o},A.has=function(h){return h in this.values},A.alt=function(h,o,s){for(var d=0;d<s.length;++d)if(o===s[d]){this.set(h,o);break}},A.integer=function(h,o){/^-?\d+$/.test(o)&&this.set(h,parseInt(o,10))},A.percent=function(h,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var s=parseFloat(o);if(s>=0&&s<=100)return this.set(h,s),!0}return!1},L}();function H(L,A,_,h){var o=h?L.split(h):[L];for(var s in o){if(typeof o[s]!="string")continue;var d=o[s].split(_);if(d.length!==2)continue;var T=d[0],y=d[1];A(T,y)}}var B=new Z.default(0,0,""),R=B.align==="middle"?"middle":"center";function x(L,A,_){var h=L;function o(){var T=k(L);if(T===null)throw new Error("Malformed timestamp: "+h);return L=L.replace(/^[^\sa-zA-Z-]+/,""),T}function s(T,y){var m=new G;H(T,function(p,g){var u;switch(p){case"region":for(var a=_.length-1;a>=0;a--)if(_[a].id===g){m.set(p,_[a].region);break}break;case"vertical":m.alt(p,g,["rl","lr"]);break;case"line":u=g.split(","),m.integer(p,u[0]),m.percent(p,u[0])&&m.set("snapToLines",!1),m.alt(p,u[0],["auto"]),u.length===2&&m.alt("lineAlign",u[1],["start",R,"end"]);break;case"position":u=g.split(","),m.percent(p,u[0]),u.length===2&&m.alt("positionAlign",u[1],["start",R,"end","line-left","line-right","auto"]);break;case"size":m.percent(p,g);break;case"align":m.alt(p,g,["start",R,"end","left","right"]);break}},/:/,/\s/),y.region=m.get("region",null),y.vertical=m.get("vertical","");var f=m.get("line","auto");f==="auto"&&B.line===-1&&(f=-1),y.line=f,y.lineAlign=m.get("lineAlign","start"),y.snapToLines=m.get("snapToLines",!0),y.size=m.get("size",100),y.align=m.get("align",R);var E=m.get("position","auto");E==="auto"&&B.position===50&&(E=y.align==="start"||y.align==="left"?0:y.align==="end"||y.align==="right"?100:50),y.position=E}function d(){L=L.replace(/^\s+/,"")}if(d(),A.startTime=o(),d(),L.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+h);L=L.substr(3),d(),A.endTime=o(),d(),s(L,A)}function w(L){return L.replace(/<br(?: \/)?>/gi,`
`)}var P=function(){function L(){this.state="INITIAL",this.buffer="",this.decoder=new F,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var A=L.prototype;return A.parse=function(h){var o=this;h&&(o.buffer+=o.decoder.decode(h,{stream:!0}));function s(){var E=o.buffer,p=0;for(E=w(E);p<E.length&&E[p]!=="\r"&&E[p]!==`
`;)++p;var g=E.substr(0,p);return E[p]==="\r"&&++p,E[p]===`
`&&++p,o.buffer=E.substr(p),g}function d(E){H(E,function(p,g){},/:/)}try{var T="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;T=s();var y=T.match(/^()?WEBVTT([ \t].*)?$/);if(!y||!y[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var m=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;m?m=!1:T=s();switch(o.state){case"HEADER":/:/.test(T)?d(T):T||(o.state="ID");continue;case"NOTE":T||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(T)){o.state="NOTE";break}if(!T)continue;if(o.cue=new Z.default(0,0,""),o.state="CUE",T.indexOf("-->")===-1){o.cue.id=T;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{x(T,o.cue,o.regionList)}catch(E){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var f=T.indexOf("-->")!==-1;if(!T||f&&(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+=T}continue;case"BADCUE":T||(o.state="ID")}}}catch(E){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},A.flush=function(){var h=this;try{if((h.cue||h.state==="HEADER")&&(h.buffer+=`
`,h.parse()),h.state==="INITIAL"||h.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){h.onparsingerror&&h.onparsingerror(o)}return h.onflush&&h.onflush(),this},L}()},"./src/utils/webvtt-parser.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"generateCueId",function(){return P}),O.d(J,"parseWebVTT",function(){return A});var Z=O("./src/polyfills/number.ts"),F=O("./src/utils/vttparser.ts"),k=O("./src/demux/id3.ts"),G=O("./src/utils/timescale-conversion.ts"),H=O("./src/remux/mp4-remuxer.ts"),B=/\r\n|\n\r|\n|\r/g,R=function(h,o,s){return s===void 0&&(s=0),h.substr(s,o.length)===o},x=function(h){var o=parseInt(h.substr(-3)),s=parseInt(h.substr(-6,2)),d=parseInt(h.substr(-9,2)),T=h.length>9?parseInt(h.substr(0,h.indexOf(":"))):0;if(!Object(Z.isFiniteNumber)(o)||!Object(Z.isFiniteNumber)(s)||!Object(Z.isFiniteNumber)(d)||!Object(Z.isFiniteNumber)(T))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+h);return o+=1e3*s,o+=60*1e3*d,o+=60*60*1e3*T,o},w=function(h){for(var o=5381,s=h.length;s;)o=o*33^h.charCodeAt(--s);return(o>>>0).toString()};function P(_,h,o){return w(_.toString())+w(h.toString())+w(o)}var L=function(h,o,s){var d=h[o],T=h[d.prevCC];if(!T||!T.new&&d.new){h.ccOffset=h.presentationOffset=d.start,d.new=!1;return}for(;(y=T)!==null&&y!==void 0&&y.new;){var y;h.ccOffset+=d.start-T.start,d.new=!1,d=T,T=h[d.prevCC]}h.presentationOffset=s};function A(_,h,o,s,d,T,y,m){var f=new F.VTTParser,E=Object(k.utf8ArrayToStr)(new Uint8Array(_)).trim().replace(B,`
`).split(`
`),p=[],g=Object(G.toMpegTsClockFromTimescale)(h,o),u="00:00.000",a=0,b=0,v,S=!0,I=!1;f.oncue=function(j){var z=s[d],V=s.ccOffset,M=(a-g)/9e4;if(z!=null&&z.new&&(b!==void 0?V=s.ccOffset=z.start:L(s,d,M)),M&&(V=M-s.presentationOffset),I){var N=j.endTime-j.startTime,$=Object(H.normalizePts)((j.startTime+V-b)*9e4,T*9e4)/9e4;j.startTime=$,j.endTime=$+N}var ie=j.text.trim();j.text=decodeURIComponent(encodeURIComponent(ie)),j.id||(j.id=P(j.startTime,j.endTime,ie)),j.endTime>0&&p.push(j)},f.onparsingerror=function(j){v=j},f.onflush=function(){if(v){m(v);return}y(p)},E.forEach(function(j){if(S)if(R(j,"X-TIMESTAMP-MAP=")){S=!1,I=!0,j.substr(16).split(",").forEach(function(z){R(z,"LOCAL:")?u=z.substr(6):R(z,"MPEGTS:")&&(a=parseInt(z.substr(7)))});try{b=x(u)/1e3}catch(z){I=!1,v=z}return}else j===""&&(S=!1);f.parse(j+`
`)}),f.flush()}},"./src/utils/xhr-loader.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/utils/logger.ts"),F=O("./src/loader/load-stats.ts"),k=/^age:\s*[\d.]+\s*$/m,G=function(){function H(R){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=R?R.xhrSetup:null,this.stats=new F.LoadStats,this.retryDelay=0}var B=H.prototype;return B.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},B.abortInternal=function(){var x=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),x&&(x.onreadystatechange=null,x.onprogress=null,x.readyState!==4&&(this.stats.aborted=!0,x.abort()))},B.abort=function(){var x;this.abortInternal(),(x=this.callbacks)!==null&&x!==void 0&&x.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},B.load=function(x,w,P){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=x,this.config=w,this.callbacks=P,this.retryDelay=w.retryDelay,this.loadInternal()},B.loadInternal=function(){var x=this.config,w=this.context;if(!x)return;var P=this.loader=new self.XMLHttpRequest,L=this.stats;L.loading.first=0,L.loaded=0;var A=this.xhrSetup;try{if(A)try{A(P,w.url)}catch(o){P.open("GET",w.url,!0),A(P,w.url)}P.readyState||P.open("GET",w.url,!0);var _=this.context.headers;if(_)for(var h in _)P.setRequestHeader(h,_[h])}catch(o){this.callbacks.onError({code:P.status,text:o.message},w,P);return}w.rangeEnd&&P.setRequestHeader("Range","bytes="+w.rangeStart+"-"+(w.rangeEnd-1)),P.onreadystatechange=this.readystatechange.bind(this),P.onprogress=this.loadprogress.bind(this),P.responseType=w.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),x.timeout),P.send()},B.readystatechange=function(){var x=this.context,w=this.loader,P=this.stats;if(!x||!w)return;var L=w.readyState,A=this.config;if(P.aborted)return;if(L>=2)if(self.clearTimeout(this.requestTimeout),P.loading.first===0&&(P.loading.first=Math.max(self.performance.now(),P.loading.start)),L===4){w.onreadystatechange=null,w.onprogress=null;var _=w.status;if(_>=200&&_<300){P.loading.end=Math.max(self.performance.now(),P.loading.first);var h,o;if(x.responseType==="arraybuffer"?(h=w.response,o=h.byteLength):(h=w.responseText,o=h.length),P.loaded=P.total=o,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(P,x,h,w),!this.callbacks)return;var d={url:w.responseURL,data:h};this.callbacks.onSuccess(d,P,x,w)}else P.retry>=A.maxRetry||_>=400&&_<499?(Z.logger.error(_+" while loading "+x.url),this.callbacks.onError({code:_,text:w.statusText},x,w)):(Z.logger.warn(_+" while loading "+x.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,A.maxRetryDelay),P.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),A.timeout)},B.loadtimeout=function(){Z.logger.warn("timeout while loading "+this.context.url);var x=this.callbacks;x&&(this.abortInternal(),x.onTimeout(this.stats,this.context,this.loader))},B.loadprogress=function(x){var w=this.stats;w.loaded=x.loaded,x.lengthComputable&&(w.total=x.total)},B.getCacheAge=function(){var x=null;if(this.loader&&k.test(this.loader.getAllResponseHeaders())){var w=this.loader.getResponseHeader("age");x=w?parseFloat(w):null}return x},H}();J.default=G}}).default})},vHTk:function(tt,Ke,le){tt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);