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.
431 lines
1.1 MiB
431 lines
1.1 MiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[274,5,7,8],{"+NIl":function(Mt,st,ne){(function(oe){oe(ne("VrN/"))})(function(oe){"use strict";oe.defineMode("stex",function(Z,D){"use strict";function $(c,h){c.cmdState.push(h)}function j(c){return c.cmdState.length>0?c.cmdState[c.cmdState.length-1]:null}function F(c){var h=c.cmdState.pop();h&&h.closeBracket()}function V(c){for(var h=c.cmdState,d=h.length-1;d>=0;d--){var l=h[d];if(l.name=="DEFAULT")continue;return l}return{styleIdentifier:function(){return null}}}function H(c,h,d){return function(){this.name=c,this.bracketNo=0,this.style=h,this.styles=d,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var k={};k.importmodule=H("importmodule","tag",["string","builtin"]),k.documentclass=H("documentclass","tag",["","atom"]),k.usepackage=H("usepackage","tag",["atom"]),k.begin=H("begin","tag",["atom"]),k.end=H("end","tag",["atom"]),k.label=H("label","tag",["atom"]),k.ref=H("ref","tag",["atom"]),k.eqref=H("eqref","tag",["atom"]),k.cite=H("cite","tag",["atom"]),k.bibitem=H("bibitem","tag",["atom"]),k.Bibitem=H("Bibitem","tag",["atom"]),k.RBibitem=H("RBibitem","tag",["atom"]),k.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function L(c,h){c.f=h}function y(c,h){var d;if(c.match(/^\\[a-zA-Z@]+/)){var l=c.current().slice(1);return d=k.hasOwnProperty(l)?k[l]:k.DEFAULT,d=new d,$(h,d),L(h,p),d.style}if(c.match(/^\\[$&%#{}_]/))return"tag";if(c.match(/^\\[,;!\/\\]/))return"tag";if(c.match("\\["))return L(h,function(u,f){return v(u,f,"\\]")}),"keyword";if(c.match("\\("))return L(h,function(u,f){return v(u,f,"\\)")}),"keyword";if(c.match("$$"))return L(h,function(u,f){return v(u,f,"$$")}),"keyword";if(c.match("$"))return L(h,function(u,f){return v(u,f,"$")}),"keyword";var s=c.next();if(s=="%")return c.skipToEnd(),"comment";if(s=="}"||s=="]"){if(d=j(h),d)d.closeBracket(s),L(h,p);else return"error";return"bracket"}else return s=="{"||s=="["?(d=k.DEFAULT,d=new d,$(h,d),"bracket"):/\d/.test(s)?(c.eatWhile(/[\w.%]/),"atom"):(c.eatWhile(/[\w\-_]/),d=V(h),d.name=="begin"&&(d.argument=c.current()),d.styleIdentifier())}function v(c,h,d){if(c.eatSpace())return null;if(d&&c.match(d))return L(h,y),"keyword";if(c.match(/^\\[a-zA-Z@]+/))return"tag";if(c.match(/^[a-zA-Z]+/))return"variable-2";if(c.match(/^\\[$&%#{}_]/))return"tag";if(c.match(/^\\[,;!\/]/))return"tag";if(c.match(/^[\^_&]/))return"tag";if(c.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(c.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var l=c.next();return l=="{"||l=="}"||l=="["||l=="]"||l=="("||l==")"?"bracket":l=="%"?(c.skipToEnd(),"comment"):"error"}function p(c,h){var d=c.peek(),l;return d=="{"||d=="["?(l=j(h),l.openBracket(d),c.eat(d),L(h,y),"bracket"):/[ \t\r]/.test(d)?(c.eat(d),null):(L(h,y),F(h),y(c,h))}return{startState:function(){var c=D.inMathMode?function(h,d){return v(h,d)}:y;return{cmdState:[],f:c}},copyState:function(c){return{cmdState:c.cmdState.slice(),f:c.f}},token:function(c,h){return h.f(c,h)},blankLine:function(c){c.f=y,c.cmdState.length=0},lineComment:"%"}}),oe.defineMIME("text/x-stex","stex"),oe.defineMIME("text/x-latex","stex")})},"+ua5":function(Mt,st,ne){},"19Vz":function(Mt,st,ne){(function(oe){oe(ne("VrN/"))})(function(oe){oe.defineOption("placeholder","",function(H,k,L){var y=L&&L!=oe.Init;if(k&&!y)H.on("blur",j),H.on("change",F),H.on("swapDoc",F),oe.on(H.getInputField(),"compositionupdate",H.state.placeholderCompose=function(){$(H)}),F(H);else if(!k&&y){H.off("blur",j),H.off("change",F),H.off("swapDoc",F),oe.off(H.getInputField(),"compositionupdate",H.state.placeholderCompose),Z(H);var v=H.getWrapperElement();v.className=v.className.replace(" CodeMirror-empty","")}k&&!H.hasFocus()&&j(H)});function Z(H){H.state.placeholder&&(H.state.placeholder.parentNode.removeChild(H.state.placeholder),H.state.placeholder=null)}function D(H){Z(H);var k=H.state.placeholder=document.createElement("pre");k.style.cssText="height: 0; overflow: visible",k.style.direction=H.getOption("direction"),k.className="CodeMirror-placeholder CodeMirror-line-like";var L=H.getOption("placeholder");typeof L=="string"&&(L=document.createTextNode(L)),k.appendChild(L),H.display.lineSpace.insertBefore(k,H.display.lineSpace.firstChild)}function $(H){setTimeout(function(){var k=!1,L=H.getInputField();L.nodeName=="TEXTAREA"?k=!L.value:H.lineCount()==1&&(k=!/[^\u200b]/.test(L.querySelector(".CodeMirror-line").textContent)),k?D(H):Z(H)},20)}function j(H){V(H)&&D(H)}function F(H){var k=H.getWrapperElement(),L=V(H);k.className=k.className.replace(" CodeMirror-empty","")+(L?" CodeMirror-empty":""),L?D(H):Z(H)}function V(H){return H.lineCount()===1&&H.getLine(0)===""}})},"1eCo":function(Mt,st,ne){(function(oe){oe(ne("VrN/"))})(function(oe){"use strict";var Z={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};oe.defineMode("xml",function($,j){var F=$.indentUnit,V={},H=j.htmlMode?Z:D;for(var k in H)V[k]=H[k];for(var k in j)V[k]=j[k];var L,y;function v(a,m){function r(M){return m.tokenize=M,M(a,m)}var b=a.next();if(b=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?r(h("atom","]]>")):null:a.match("--")?r(h("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),r(d(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),m.tokenize=h("meta","?>"),"meta"):(L=a.eat("/")?"closeTag":"openTag",m.tokenize=p,"tag bracket");if(b=="&"){var P;return a.eat("#")?a.eat("x")?P=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):P=a.eatWhile(/[\d]/)&&a.eat(";"):P=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),P?"atom":"error"}else return a.eatWhile(/[^&<]/),null}v.isInText=!0;function p(a,m){var r=a.next();if(r==">"||r=="/"&&a.eat(">"))return m.tokenize=v,L=r==">"?"endTag":"selfcloseTag","tag bracket";if(r=="=")return L="equals",null;if(r=="<"){m.tokenize=v,m.state=f,m.tagName=m.tagStart=null;var b=m.tokenize(a,m);return b?b+" tag error":"tag error"}else return/[\'\"]/.test(r)?(m.tokenize=c(r),m.stringStartCol=a.column(),m.tokenize(a,m)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function c(a){var m=function(r,b){for(;!r.eol();)if(r.next()==a){b.tokenize=p;break}return"string"};return m.isInAttribute=!0,m}function h(a,m){return function(r,b){for(;!r.eol();){if(r.match(m)){b.tokenize=v;break}r.next()}return a}}function d(a){return function(m,r){for(var b;(b=m.next())!=null;){if(b=="<")return r.tokenize=d(a+1),r.tokenize(m,r);if(b==">")if(a==1){r.tokenize=v;break}else return r.tokenize=d(a-1),r.tokenize(m,r)}return"meta"}}function l(a,m,r){this.prev=a.context,this.tagName=m,this.indent=a.indented,this.startOfLine=r,(V.doNotIndent.hasOwnProperty(m)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function s(a){a.context&&(a.context=a.context.prev)}function u(a,m){for(var r;;){if(!a.context)return;if(r=a.context.tagName,!V.contextGrabbers.hasOwnProperty(r)||!V.contextGrabbers[r].hasOwnProperty(m))return;s(a)}}function f(a,m,r){return a=="openTag"?(r.tagStart=m.column(),O):a=="closeTag"?x:f}function O(a,m,r){return a=="word"?(r.tagName=m.current(),y="tag",R):V.allowMissingTagName&&a=="endTag"?(y="tag bracket",R(a,m,r)):(y="error",O)}function x(a,m,r){if(a=="word"){var b=m.current();return r.context&&r.context.tagName!=b&&V.implicitlyClosed.hasOwnProperty(r.context.tagName)&&s(r),r.context&&r.context.tagName==b||V.matchClosing===!1?(y="tag",w):(y="tag error",A)}else return V.allowMissingTagName&&a=="endTag"?(y="tag bracket",w(a,m,r)):(y="error",A)}function w(a,m,r){return a!="endTag"?(y="error",w):(s(r),f)}function A(a,m,r){return y="error",w(a,m,r)}function R(a,m,r){if(a=="word")return y="attribute",T;if(a=="endTag"||a=="selfcloseTag"){var b=r.tagName,P=r.tagStart;return r.tagName=r.tagStart=null,a=="selfcloseTag"||V.autoSelfClosers.hasOwnProperty(b)?u(r,b):(u(r,b),r.context=new l(r,b,P==r.indented)),f}return y="error",R}function T(a,m,r){return a=="equals"?E:(V.allowMissing||(y="error"),R(a,m,r))}function E(a,m,r){return a=="string"?g:a=="word"&&V.allowUnquoted?(y="string",R):(y="error",R(a,m,r))}function g(a,m,r){return a=="string"?g:R(a,m,r)}return{startState:function(a){var m={tokenize:v,state:f,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(m.baseIndent=a),m},token:function(a,m){if(!m.tagName&&a.sol()&&(m.indented=a.indentation()),a.eatSpace())return null;L=null;var r=m.tokenize(a,m);return(r||L)&&r!="comment"&&(y=null,m.state=m.state(L||r,a,m),y&&(r=y=="error"?r+" error":y)),r},indent:function(a,m,r){var b=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+F;if(b&&b.noIndent)return oe.Pass;if(a.tokenize!=p&&a.tokenize!=v)return r?r.match(/^(\s*)/)[0].length:0;if(a.tagName)return V.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+F*(V.multilineTagIndentFactor||1);if(V.alignCDATA&&/<!\[CDATA\[/.test(m))return 0;var P=m&&/^<(\/)?([\w_:\.-]*)/.exec(m);if(P&&P[1])for(;b;)if(b.tagName==P[2]){b=b.prev;break}else if(V.implicitlyClosed.hasOwnProperty(b.tagName))b=b.prev;else break;else if(P)for(;b;){var M=V.contextGrabbers[b.tagName];if(M&&M.hasOwnProperty(P[2]))b=b.prev;else break}for(;b&&b.prev&&!b.startOfLine;)b=b.prev;return b?b.indent+F:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:V.htmlMode?"html":"xml",helperType:V.htmlMode?"html":"xml",skipAttribute:function(a){a.state==E&&(a.state=R)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var m=[],r=a.context;r;r=r.prev)r.tagName&&m.push(r.tagName);return m.reverse()}}}),oe.defineMIME("text/xml","xml"),oe.defineMIME("application/xml","xml"),oe.mimeModes.hasOwnProperty("text/html")||oe.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"55Ip":function(Mt,st,ne){"use strict";ne.d(st,"a",function(){return u});var oe=ne("Ty5D"),Z=ne("dI71"),D=ne("q1tI"),$=ne.n(D),j=ne("YS25"),F=ne("17x9"),V=ne.n(F),H=ne("wx14"),k=ne("zLVn"),L=ne("9R94"),y=function(E){Object(Z.a)(g,E);function g(){for(var m,r=arguments.length,b=new Array(r),P=0;P<r;P++)b[P]=arguments[P];return m=E.call.apply(E,[this].concat(b))||this,m.history=Object(j.a)(m.props),m}var a=g.prototype;return a.render=function(){return $.a.createElement(oe.c,{history:this.history,children:this.props.children})},g}($.a.Component),v=function(E){Object(Z.a)(g,E);function g(){for(var m,r=arguments.length,b=new Array(r),P=0;P<r;P++)b[P]=arguments[P];return m=E.call.apply(E,[this].concat(b))||this,m.history=Object(j.b)(m.props),m}var a=g.prototype;return a.render=function(){return $.a.createElement(oe.c,{history:this.history,children:this.props.children})},g}($.a.Component),p=function(g,a){return typeof g=="function"?g(a):g},c=function(g,a){return typeof g=="string"?Object(j.c)(g,null,null,a):g},h=function(g){return g},d=$.a.forwardRef;typeof d=="undefined"&&(d=h);function l(E){return!!(E.metaKey||E.altKey||E.ctrlKey||E.shiftKey)}var s=d(function(E,g){var a=E.innerRef,m=E.navigate,r=E.onClick,b=Object(k.a)(E,["innerRef","navigate","onClick"]),P=b.target,M=Object(H.a)({},b,{onClick:function(X){try{r&&r(X)}catch(U){throw X.preventDefault(),U}!X.defaultPrevented&&X.button===0&&(!P||P==="_self")&&!l(X)&&(X.preventDefault(),m())}});return h!==d?M.ref=g||a:M.ref=a,$.a.createElement("a",M)}),u=d(function(E,g){var a=E.component,m=a===void 0?s:a,r=E.replace,b=E.to,P=E.innerRef,M=Object(k.a)(E,["component","replace","to","innerRef"]);return $.a.createElement(oe.e.Consumer,null,function(W){W||Object(L.a)(!1);var X=W.history,U=c(p(b,W.location),W.location),S=U?X.createHref(U):"",B=Object(H.a)({},M,{href:S,navigate:function(){var te=p(b,W.location),ae=r?X.replace:X.push;ae(te)}});return h!==d?B.ref=g||P:B.innerRef=P,$.a.createElement(m,B)})});if(!1)var f,O;var x=function(g){return g},w=$.a.forwardRef;typeof w=="undefined"&&(w=x);function A(){for(var E=arguments.length,g=new Array(E),a=0;a<E;a++)g[a]=arguments[a];return g.filter(function(m){return m}).join(" ")}var R=w(function(E,g){var a=E["aria-current"],m=a===void 0?"page":a,r=E.activeClassName,b=r===void 0?"active":r,P=E.activeStyle,M=E.className,W=E.exact,X=E.isActive,U=E.location,S=E.sensitive,B=E.strict,J=E.style,te=E.to,ae=E.innerRef,_e=Object(k.a)(E,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return $.a.createElement(oe.e.Consumer,null,function(de){de||Object(L.a)(!1);var Ee=U||de.location,Te=c(p(te,Ee),Ee),me=Te.pathname,ce=me&&me.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),se=ce?Object(oe.f)(Ee.pathname,{path:ce,exact:W,sensitive:S,strict:B}):null,Se=!!(X?X(se,Ee):se),je=Se?A(M,b):M,We=Se?Object(H.a)({},J,{},P):J,Xe=Object(H.a)({"aria-current":Se&&m||null,className:je,style:We,to:Te},_e);return x!==w?Xe.ref=g||ae:Xe.innerRef=ae,$.a.createElement(u,Xe)})});if(!1)var T},"5VLF":function(Mt,st,ne){"use strict";var oe,Z;function D($,j,F){var V=function(H,k){return $.js_beautify(H,k)};return V.js=$.js_beautify,V.css=j.css_beautify,V.html=F.html_beautify,V.js_beautify=$.js_beautify,V.css_beautify=j.css_beautify,V.html_beautify=F.html_beautify,V}!(oe=[ne("6UM0"),ne("TXwP"),ne("psGv")],Z=function($,j,F){return D($,j,F)}.apply(st,oe),Z!==void 0&&(Mt.exports=Z))},"6+eU":function(Mt,st,ne){"use strict";ne.d(st,"a",function(){return w});var oe=ne("wx14"),Z=ne("rePB"),D=ne("VTBJ"),$=ne("1OyB"),j=ne("vuIU"),F=ne("Ji7U"),V=ne("LK+K"),H=ne("q1tI"),k=ne.n(H),L=ne("TSYQ"),y=ne.n(L),v=function(R){var T,E="".concat(R.rootPrefixCls,"-item"),g=y()(E,"".concat(E,"-").concat(R.page),(T={},Object(Z.a)(T,"".concat(E,"-active"),R.active),Object(Z.a)(T,R.className,!!R.className),Object(Z.a)(T,"".concat(E,"-disabled"),!R.page),T)),a=function(){R.onClick(R.page)},m=function(b){R.onKeyPress(b,R.onClick,R.page)};return k.a.createElement("li",{title:R.showTitle?R.page:null,className:g,onClick:a,onKeyPress:m,tabIndex:"0"},R.itemRender(R.page,"page",k.a.createElement("a",{rel:"nofollow"},R.page)))},p=v,c={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},h=function(A){Object(F.a)(T,A);var R=Object(V.a)(T);function T(){var E;Object($.a)(this,T);for(var g=arguments.length,a=new Array(g),m=0;m<g;m++)a[m]=arguments[m];return E=R.call.apply(R,[this].concat(a)),E.state={goInputText:""},E.buildOptionText=function(r){return"".concat(r," ").concat(E.props.locale.items_per_page)},E.changeSize=function(r){E.props.changeSize(Number(r))},E.handleChange=function(r){E.setState({goInputText:r.target.value})},E.handleBlur=function(r){var b=E.props,P=b.goButton,M=b.quickGo,W=b.rootPrefixCls,X=E.state.goInputText;if(P||X==="")return;if(r.relatedTarget&&(r.relatedTarget.className.indexOf("".concat(W,"-prev"))>=0||r.relatedTarget.className.indexOf("".concat(W,"-next"))>=0))return;E.setState({goInputText:""}),M(E.getValidValue())},E.go=function(r){var b=E.state.goInputText;if(b==="")return;(r.keyCode===c.ENTER||r.type==="click")&&(E.setState({goInputText:""}),E.props.quickGo(E.getValidValue()))},E}return Object(j.a)(T,[{key:"getValidValue",value:function(){var g=this.state,a=g.goInputText,m=g.current;return!a||isNaN(a)?m:Number(a)}},{key:"getPageSizeOptions",value:function(){var g=this.props,a=g.pageSize,m=g.pageSizeOptions;return m.some(function(r){return r.toString()===a.toString()})?m:m.concat([a.toString()]).sort(function(r,b){var P=isNaN(Number(r))?0:Number(r),M=isNaN(Number(b))?0:Number(b);return P-M})}},{key:"render",value:function(){var g=this,a=this.props,m=a.pageSize,r=a.locale,b=a.rootPrefixCls,P=a.changeSize,M=a.quickGo,W=a.goButton,X=a.selectComponentClass,U=a.buildOptionText,S=a.selectPrefixCls,B=a.disabled,J=this.state.goInputText,te="".concat(b,"-options"),ae=X,_e=null,de=null,Ee=null;if(!P&&!M)return null;var Te=this.getPageSizeOptions();if(P&&ae){var me=Te.map(function(ce,se){return k.a.createElement(ae.Option,{key:se,value:ce.toString()},(U||g.buildOptionText)(ce))});_e=k.a.createElement(ae,{disabled:B,prefixCls:S,showSearch:!1,className:"".concat(te,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(m||Te[0]).toString(),onChange:this.changeSize,getPopupContainer:function(se){return se.parentNode}},me)}return M&&(W&&(Ee=typeof W=="boolean"?k.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:B,className:"".concat(te,"-quick-jumper-button")},r.jump_to_confirm):k.a.createElement("span",{onClick:this.go,onKeyUp:this.go},W)),de=k.a.createElement("div",{className:"".concat(te,"-quick-jumper")},r.jump_to,k.a.createElement("input",{disabled:B,type:"text",value:J,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),r.page,Ee)),k.a.createElement("li",{className:"".concat(te)},_e,de)}}]),T}(k.a.Component);h.defaultProps={pageSizeOptions:["10","20","50","100"]};var d=h,l=ne("N2Kk");function s(){}function u(A){return typeof A=="number"&&isFinite(A)&&Math.floor(A)===A}function f(A,R,T){return T}function O(A,R,T){var E=typeof A=="undefined"?R.pageSize:A;return Math.floor((T.total-1)/E)+1}var x=function(A){Object(F.a)(T,A);var R=Object(V.a)(T);function T(E){var g;Object($.a)(this,T),g=R.call(this,E),g.getJumpPrevPage=function(){return Math.max(1,g.state.current-(g.props.showLessItems?3:5))},g.getJumpNextPage=function(){return Math.min(O(void 0,g.state,g.props),g.state.current+(g.props.showLessItems?3:5))},g.getItemIcon=function(P,M){var W=g.props.prefixCls,X=P||k.a.createElement("button",{type:"button","aria-label":M,className:"".concat(W,"-item-link")});return typeof P=="function"&&(X=k.a.createElement(P,Object(D.a)({},g.props))),X},g.savePaginationNode=function(P){g.paginationNode=P},g.isValid=function(P){return u(P)&&P!==g.state.current},g.shouldDisplayQuickJumper=function(){var P=g.props,M=P.showQuickJumper,W=P.pageSize,X=P.total;return X<=W?!1:M},g.handleKeyDown=function(P){(P.keyCode===c.ARROW_UP||P.keyCode===c.ARROW_DOWN)&&P.preventDefault()},g.handleKeyUp=function(P){var M=g.getValidValue(P),W=g.state.currentInputValue;M!==W&&g.setState({currentInputValue:M}),P.keyCode===c.ENTER?g.handleChange(M):P.keyCode===c.ARROW_UP?g.handleChange(M-1):P.keyCode===c.ARROW_DOWN&&g.handleChange(M+1)},g.changePageSize=function(P){var M=g.state.current,W=O(P,g.state,g.props);M=M>W?W:M,W===0&&(M=g.state.current),typeof P=="number"&&("pageSize"in g.props||g.setState({pageSize:P}),"current"in g.props||g.setState({current:M,currentInputValue:M})),g.props.onShowSizeChange(M,P),"onChange"in g.props&&g.props.onChange&&g.props.onChange(M,P)},g.handleChange=function(P){var M=g.props.disabled,W=P;if(g.isValid(W)&&!M){var X=O(void 0,g.state,g.props);W>X?W=X:W<1&&(W=1),"current"in g.props||g.setState({current:W,currentInputValue:W});var U=g.state.pageSize;return g.props.onChange(W,U),W}return g.state.current},g.prev=function(){g.hasPrev()&&g.handleChange(g.state.current-1)},g.next=function(){g.hasNext()&&g.handleChange(g.state.current+1)},g.jumpPrev=function(){g.handleChange(g.getJumpPrevPage())},g.jumpNext=function(){g.handleChange(g.getJumpNextPage())},g.hasPrev=function(){return g.state.current>1},g.hasNext=function(){return g.state.current<O(void 0,g.state,g.props)},g.runIfEnter=function(P,M){if(P.key==="Enter"||P.charCode===13){for(var W=arguments.length,X=new Array(W>2?W-2:0),U=2;U<W;U++)X[U-2]=arguments[U];M.apply(void 0,X)}},g.runIfEnterPrev=function(P){g.runIfEnter(P,g.prev)},g.runIfEnterNext=function(P){g.runIfEnter(P,g.next)},g.runIfEnterJumpPrev=function(P){g.runIfEnter(P,g.jumpPrev)},g.runIfEnterJumpNext=function(P){g.runIfEnter(P,g.jumpNext)},g.handleGoTO=function(P){(P.keyCode===c.ENTER||P.type==="click")&&g.handleChange(g.state.currentInputValue)};var a=E.onChange!==s,m="current"in E;m&&!a&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var r=E.defaultCurrent;"current"in E&&(r=E.current);var b=E.defaultPageSize;return"pageSize"in E&&(b=E.pageSize),r=Math.min(r,O(b,void 0,E)),g.state={current:r,currentInputValue:r,pageSize:b},g}return Object(j.a)(T,[{key:"componentDidUpdate",value:function(g,a){var m=this.props.prefixCls;if(a.current!==this.state.current&&this.paginationNode){var r=this.paginationNode.querySelector(".".concat(m,"-item-").concat(a.current));r&&document.activeElement===r&&r.blur()}}},{key:"getValidValue",value:function(g){var a=g.target.value,m=O(void 0,this.state,this.props),r=this.state.currentInputValue,b;return a===""?b=a:isNaN(Number(a))?b=r:a>=m?b=m:b=Number(a),b}},{key:"getShowSizeChanger",value:function(){var g=this.props,a=g.showSizeChanger,m=g.total,r=g.totalBoundaryShowSizeChanger;return typeof a!="undefined"?a:m>r}},{key:"renderPrev",value:function(g){var a=this.props,m=a.prevIcon,r=a.itemRender,b=r(g,"prev",this.getItemIcon(m,"prev page")),P=!this.hasPrev();return Object(H.isValidElement)(b)?Object(H.cloneElement)(b,{disabled:P}):b}},{key:"renderNext",value:function(g){var a=this.props,m=a.nextIcon,r=a.itemRender,b=r(g,"next",this.getItemIcon(m,"next page")),P=!this.hasNext();return Object(H.isValidElement)(b)?Object(H.cloneElement)(b,{disabled:P}):b}},{key:"render",value:function(){var g=this,a=this.props,m=a.prefixCls,r=a.className,b=a.style,P=a.disabled,M=a.hideOnSinglePage,W=a.total,X=a.locale,U=a.showQuickJumper,S=a.showLessItems,B=a.showTitle,J=a.showTotal,te=a.simple,ae=a.itemRender,_e=a.showPrevNextJumpers,de=a.jumpPrevIcon,Ee=a.jumpNextIcon,Te=a.selectComponentClass,me=a.selectPrefixCls,ce=a.pageSizeOptions,se=this.state,Se=se.current,je=se.pageSize,We=se.currentInputValue;if(M===!0&&W<=je)return null;var Xe=O(void 0,this.state,this.props),Qe=[],Pe=null,Ue=null,Ye=null,Ze=null,Ve=null,He=U&&U.goButton,Fe=S?1:2,ft=Se-1>0?Se-1:0,lt=Se+1<Xe?Se+1:Xe,rt=Object.keys(this.props).reduce(function(ie,re){return(re.substr(0,5)==="data-"||re.substr(0,5)==="aria-"||re==="role")&&(ie[re]=g.props[re]),ie},{});if(te)return He&&(typeof He=="boolean"?Ve=k.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},X.jump_to_confirm):Ve=k.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},He),Ve=k.a.createElement("li",{title:B?"".concat(X.jump_to).concat(Se,"/").concat(Xe):null,className:"".concat(m,"-simple-pager")},Ve)),k.a.createElement("ul",Object(oe.a)({className:y()(m,"".concat(m,"-simple"),Object(Z.a)({},"".concat(m,"-disabled"),P),r),style:b,ref:this.savePaginationNode},rt),k.a.createElement("li",{title:B?X.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:y()("".concat(m,"-prev"),Object(Z.a)({},"".concat(m,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(ft)),k.a.createElement("li",{title:B?"".concat(Se,"/").concat(Xe):null,className:"".concat(m,"-simple-pager")},k.a.createElement("input",{type:"text",value:We,disabled:P,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),k.a.createElement("span",{className:"".concat(m,"-slash")},"/"),Xe),k.a.createElement("li",{title:B?X.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:y()("".concat(m,"-next"),Object(Z.a)({},"".concat(m,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(lt)),Ve);if(Xe<=3+Fe*2){var dt={locale:X,rootPrefixCls:m,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:B,itemRender:ae};Xe||Qe.push(k.a.createElement(p,Object(oe.a)({},dt,{key:"noPager",page:Xe,className:"".concat(m,"-disabled")})));for(var bt=1;bt<=Xe;bt+=1){var ut=Se===bt;Qe.push(k.a.createElement(p,Object(oe.a)({},dt,{key:bt,page:bt,active:ut})))}}else{var at=S?X.prev_3:X.prev_5,Ie=S?X.next_3:X.next_5;_e&&(Pe=k.a.createElement("li",{title:B?at:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:y()("".concat(m,"-jump-prev"),Object(Z.a)({},"".concat(m,"-jump-prev-custom-icon"),!!de))},ae(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(de,"prev page"))),Ue=k.a.createElement("li",{title:B?Ie:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:y()("".concat(m,"-jump-next"),Object(Z.a)({},"".concat(m,"-jump-next-custom-icon"),!!Ee))},ae(this.getJumpNextPage(),"jump-next",this.getItemIcon(Ee,"next page")))),Ze=k.a.createElement(p,{locale:X,last:!0,rootPrefixCls:m,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:Xe,page:Xe,active:!1,showTitle:B,itemRender:ae}),Ye=k.a.createElement(p,{locale:X,rootPrefixCls:m,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:B,itemRender:ae});var yt=Math.max(1,Se-Fe),nt=Math.min(Se+Fe,Xe);Se-1<=Fe&&(nt=1+Fe*2),Xe-Se<=Fe&&(yt=Xe-Fe*2);for(var Oe=yt;Oe<=nt;Oe+=1){var Ge=Se===Oe;Qe.push(k.a.createElement(p,{locale:X,rootPrefixCls:m,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:Oe,page:Oe,active:Ge,showTitle:B,itemRender:ae}))}Se-1>=Fe*2&&Se!==1+2&&(Qe[0]=Object(H.cloneElement)(Qe[0],{className:"".concat(m,"-item-after-jump-prev")}),Qe.unshift(Pe)),Xe-Se>=Fe*2&&Se!==Xe-2&&(Qe[Qe.length-1]=Object(H.cloneElement)(Qe[Qe.length-1],{className:"".concat(m,"-item-before-jump-next")}),Qe.push(Ue)),yt!==1&&Qe.unshift(Ye),nt!==Xe&&Qe.push(Ze)}var be=null;J&&(be=k.a.createElement("li",{className:"".concat(m,"-total-text")},J(W,[W===0?0:(Se-1)*je+1,Se*je>W?W:Se*je])));var fe=!this.hasPrev()||!Xe,pe=!this.hasNext()||!Xe;return k.a.createElement("ul",Object(oe.a)({className:y()(m,r,Object(Z.a)({},"".concat(m,"-disabled"),P)),style:b,unselectable:"unselectable",ref:this.savePaginationNode},rt),be,k.a.createElement("li",{title:B?X.prev_page:null,onClick:this.prev,tabIndex:fe?null:0,onKeyPress:this.runIfEnterPrev,className:y()("".concat(m,"-prev"),Object(Z.a)({},"".concat(m,"-disabled"),fe)),"aria-disabled":fe},this.renderPrev(ft)),Qe,k.a.createElement("li",{title:B?X.next_page:null,onClick:this.next,tabIndex:pe?null:0,onKeyPress:this.runIfEnterNext,className:y()("".concat(m,"-next"),Object(Z.a)({},"".concat(m,"-disabled"),pe)),"aria-disabled":pe},this.renderNext(lt)),k.a.createElement(d,{disabled:P,locale:X,rootPrefixCls:m,selectComponentClass:Te,selectPrefixCls:me,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:Se,pageSize:je,pageSizeOptions:ce,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:He}))}}],[{key:"getDerivedStateFromProps",value:function(g,a){var m={};if("current"in g&&(m.current=g.current,g.current!==a.current&&(m.currentInputValue=m.current)),"pageSize"in g&&g.pageSize!==a.pageSize){var r=a.current,b=O(g.pageSize,a,g);r=r>b?b:r,"current"in g||(m.current=r,m.currentInputValue=r),m.pageSize=g.pageSize}return m}}]),T}(k.a.Component);x.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:s,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:s,locale:l.a,style:{},itemRender:f,totalBoundaryShowSizeChanger:50};var w=x},"6UM0":function(Mt,st,ne){var oe,Z;(function(){var D;(function(){"use strict";var j=[function(k,L,y){var v=y(1).Beautifier,p=y(5).Options;function c(h,d){var l=new v(h,d);return l.beautify()}k.exports=c,k.exports.defaultOptions=function(){return new p}},function(k,L,y){var v=y(2).Output,p=y(3).Token,c=y(4),h=y(5).Options,d=y(7).Tokenizer,l=y(7).line_starters,s=y(7).positionable_operators,u=y(7).TOKEN;function f(S,B){return B.indexOf(S)!==-1}function O(S){return S.replace(/^\s+/g,"")}function x(S){for(var B={},J=0;J<S.length;J++)B[S[J].replace(/-/g,"_")]=S[J];return B}function w(S,B){return S&&S.type===u.RESERVED&&S.text===B}function A(S,B){return S&&S.type===u.RESERVED&&f(S.text,B)}var R=["case","return","do","if","throw","else","await","break","continue","async"],T=["before-newline","after-newline","preserve-newline"],E=x(T),g=[E.before_newline,E.preserve_newline],a={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function m(S,B){if(B.multiline_frame||B.mode===a.ForInitializer||B.mode===a.Conditional)return;S.remove_indent(B.start_line_index)}function r(S){S=S.replace(c.allLineBreaks,`
|
|
`);for(var B=[],J=S.indexOf(`
|
|
`);J!==-1;)B.push(S.substring(0,J)),S=S.substring(J+1),J=S.indexOf(`
|
|
`);return S.length&&B.push(S),B}function b(S){return S===a.ArrayLiteral}function P(S){return f(S,[a.Expression,a.ForInitializer,a.Conditional])}function M(S,B){for(var J=0;J<S.length;J++){var te=S[J].trim();if(te.charAt(0)!==B)return!1}return!0}function W(S,B){for(var J=0,te=S.length,ae;J<te;J++)if(ae=S[J],ae&&ae.indexOf(B)!==0)return!1;return!0}function X(S,B){B=B||{},this._source_text=S||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new h(B)}X.prototype.create_flags=function(S,B){var J=0;S&&(J=S.indentation_level,!this._output.just_added_newline()&&S.line_indent_level>J&&(J=S.line_indent_level));var te={mode:B,parent:S,last_token:S?S.last_token:new p(u.START_BLOCK,""),last_word:S?S.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:J,alignment:0,line_indent_level:S?S.line_indent_level:J,start_line_index:this._output.get_line_number(),ternary_depth:0};return te},X.prototype._reset=function(S){var B=S.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new v(this._options,B),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(a.BlockStatement);var J=new d(S,this._options);return this._tokens=J.tokenize(),S},X.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var S,B=this._reset(this._source_text),J=this._options.eol;this._options.eol==="auto"&&(J=`
|
|
`,B&&c.lineBreak.test(B||"")&&(J=B.match(c.lineBreak)[0]));for(var te=this._tokens.next();te;)this.handle_token(te),this._last_last_text=this._flags.last_token.text,this._flags.last_token=te,te=this._tokens.next();return S=this._output.get_code(J),S},X.prototype.handle_token=function(S,B){S.type===u.START_EXPR?this.handle_start_expr(S):S.type===u.END_EXPR?this.handle_end_expr(S):S.type===u.START_BLOCK?this.handle_start_block(S):S.type===u.END_BLOCK?this.handle_end_block(S):S.type===u.WORD?this.handle_word(S):S.type===u.RESERVED?this.handle_word(S):S.type===u.SEMICOLON?this.handle_semicolon(S):S.type===u.STRING?this.handle_string(S):S.type===u.EQUALS?this.handle_equals(S):S.type===u.OPERATOR?this.handle_operator(S):S.type===u.COMMA?this.handle_comma(S):S.type===u.BLOCK_COMMENT?this.handle_block_comment(S,B):S.type===u.COMMENT?this.handle_comment(S,B):S.type===u.DOT?this.handle_dot(S):S.type===u.EOF?this.handle_eof(S):S.type===u.UNKNOWN?this.handle_unknown(S,B):this.handle_unknown(S,B)},X.prototype.handle_whitespace_and_comments=function(S,B){var J=S.newlines,te=this._options.keep_array_indentation&&b(this._flags.mode);if(S.comments_before)for(var ae=S.comments_before.next();ae;)this.handle_whitespace_and_comments(ae,B),this.handle_token(ae,B),ae=S.comments_before.next();if(te)for(var _e=0;_e<J;_e+=1)this.print_newline(_e>0,B);else if(this._options.max_preserve_newlines&&J>this._options.max_preserve_newlines&&(J=this._options.max_preserve_newlines),this._options.preserve_newlines&&J>1){this.print_newline(!1,B);for(var de=1;de<J;de+=1)this.print_newline(!0,B)}};var U=["async","break","continue","return","throw","yield"];X.prototype.allow_wrap_or_preserved_newline=function(S,B){if(B=B===void 0?!1:B,this._output.just_added_newline())return;var J=this._options.preserve_newlines&&S.newlines||B,te=f(this._flags.last_token.text,s)||f(S.text,s);if(te){var ae=f(this._flags.last_token.text,s)&&f(this._options.operator_position,g)||f(S.text,s);J=J&&ae}if(J)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(A(this._flags.last_token,U))return;this._output.set_wrap_point()}},X.prototype.print_newline=function(S,B){if(!B&&(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==u.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")))for(var J=this._tokens.peek();this._flags.mode===a.Statement&&!(this._flags.if_block&&w(J,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(S)&&(this._flags.multiline_frame=!0)},X.prototype.print_token_line_indentation=function(S){this._output.just_added_newline()&&(this._options.keep_array_indentation&&S.newlines&&(S.text==="["||b(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(S.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},X.prototype.print_token=function(S){if(this._output.raw){this._output.add_raw_token(S);return}if(this._options.comma_first&&S.previous&&S.previous.type===u.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var B=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(B),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(S),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(S),this._output.non_breaking_space=!0,this._output.add_token(S.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},X.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},X.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},X.prototype.set_mode=function(S){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,S),this._flags=this.create_flags(this._previous_flags,S),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},X.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===a.Statement&&m(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},X.prototype.start_of_object_property=function(){return this._flags.parent.mode===a.ObjectLiteral&&this._flags.mode===a.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||A(this._flags.last_token,["get","set"]))},X.prototype.start_of_statement=function(S){var B=!1;return B=B||A(this._flags.last_token,["var","let","const"])&&S.type===u.WORD,B=B||w(this._flags.last_token,"do"),B=B||!(this._flags.parent.mode===a.ObjectLiteral&&this._flags.mode===a.Statement)&&A(this._flags.last_token,U)&&!S.newlines,B=B||w(this._flags.last_token,"else")&&!(w(S,"if")&&!S.comments_before),B=B||this._flags.last_token.type===u.END_EXPR&&(this._previous_flags.mode===a.ForInitializer||this._previous_flags.mode===a.Conditional),B=B||this._flags.last_token.type===u.WORD&&this._flags.mode===a.BlockStatement&&!this._flags.in_case&&!(S.text==="--"||S.text==="++")&&this._last_last_text!=="function"&&S.type!==u.WORD&&S.type!==u.RESERVED,B=B||this._flags.mode===a.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||A(this._flags.last_token,["get","set"])),B?(this.set_mode(a.Statement),this.indent(),this.handle_whitespace_and_comments(S,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(S,A(S,["do","for","if","while"])),!0):!1},X.prototype.handle_start_expr=function(S){this.start_of_statement(S)||this.handle_whitespace_and_comments(S);var B=a.Expression;if(S.text==="["){if(this._flags.last_token.type===u.WORD||this._flags.last_token.text===")"){A(this._flags.last_token,l)&&(this._output.space_before_token=!0),this.print_token(S),this.set_mode(B),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}B=a.ArrayLiteral,b(this._flags.mode)&&((this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline())),f(this._flags.last_token.type,[u.START_EXPR,u.END_EXPR,u.WORD,u.OPERATOR,u.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===u.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,B=a.ForInitializer):f(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,B=a.Conditional):f(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&S.whitespace_before===""?this._output.space_before_token=!1:(f(this._flags.last_token.text,l)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===u.EQUALS||this._flags.last_token.type===u.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(S);else if(this._flags.last_token.type===u.WORD){this._output.space_before_token=!1;var J=this._tokens.peek(-3);if(this._options.space_after_named_function&&J){var te=this._tokens.peek(-4);A(J,["async","function"])||J.text==="*"&&A(te,["async","function"])?this._output.space_before_token=!0:this._flags.mode===a.ObjectLiteral?(J.text==="{"||J.text===","||J.text==="*"&&(te.text==="{"||te.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(S);(this._flags.last_token.type===u.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(f(this._last_last_text,["function","yield"])||this._flags.mode===a.ObjectLiteral&&f(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===u.START_BLOCK?this.print_newline():(this._flags.last_token.type===u.END_EXPR||this._flags.last_token.type===u.START_EXPR||this._flags.last_token.type===u.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===u.COMMA)&&this.allow_wrap_or_preserved_newline(S,S.newlines),this.print_token(S),this.set_mode(B),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},X.prototype.handle_end_expr=function(S){for(;this._flags.mode===a.Statement;)this.restore_mode();this.handle_whitespace_and_comments(S),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(S,S.text==="]"&&b(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===u.START_EXPR&&!this._options.space_in_empty_paren?(this._output.trim(),this._output.space_before_token=!1):this._output.space_before_token=!0),this.deindent(),this.print_token(S),this.restore_mode(),m(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===a.Conditional&&(this._previous_flags.mode=a.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},X.prototype.handle_start_block=function(S){this.handle_whitespace_and_comments(S);var B=this._tokens.peek(),J=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===u.END_EXPR?(this.set_mode(a.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(a.BlockStatement):J&&(f(J.text,[":",","])&&f(B.type,[u.STRING,u.WORD,u.RESERVED])||f(B.text,["get","set","..."])&&f(J.type,[u.WORD,u.RESERVED]))?f(this._last_last_text,["class","interface"])&&!f(J.text,[":",","])?this.set_mode(a.BlockStatement):this.set_mode(a.ObjectLiteral):this._flags.last_token.type===u.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(a.BlockStatement):f(this._flags.last_token.type,[u.EQUALS,u.START_EXPR,u.COMMA,u.OPERATOR])||A(this._flags.last_token,["return","throw","import","default"])?this.set_mode(a.ObjectLiteral):this.set_mode(a.BlockStatement),this._flags.last_token&&(A(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var te=!B.comments_before&&B.text==="}",ae=te&&this._flags.last_word==="function"&&this._flags.last_token.type===u.END_EXPR;if(this._options.brace_preserve_inline){var _e=0,de=null;this._flags.inline_frame=!0;do if(_e+=1,de=this._tokens.peek(_e-1),de.newlines){this._flags.inline_frame=!1;break}while(de.type!==u.EOF&&!(de.type===u.END_BLOCK&&de.opened===S))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&S.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==u.OPERATOR&&(ae||this._flags.last_token.type===u.EQUALS||A(this._flags.last_token,R)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(b(this._previous_flags.mode)&&(this._flags.last_token.type===u.START_EXPR||this._flags.last_token.type===u.COMMA)&&((this._flags.last_token.type===u.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===u.COMMA||this._flags.last_token.type===u.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(S),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==u.OPERATOR&&this._flags.last_token.type!==u.START_EXPR&&(this._flags.last_token.type===u.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(S),this.indent(),!te&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},X.prototype.handle_end_block=function(S){for(this.handle_whitespace_and_comments(S);this._flags.mode===a.Statement;)this.restore_mode();var B=this._flags.last_token.type===u.START_BLOCK;this._flags.inline_frame&&!B?this._output.space_before_token=!0:this._options.brace_style==="expand"?B||this.print_newline():B||(b(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(S)},X.prototype.handle_word=function(S){if(S.type===u.RESERVED){if(f(S.text,["set","get"])&&this._flags.mode!==a.ObjectLiteral)S.type=u.WORD;else if(S.text==="import"&&f(this._tokens.peek().text,["(","."]))S.type=u.WORD;else if(f(S.text,["as","from"])&&!this._flags.import_block)S.type=u.WORD;else if(this._flags.mode===a.ObjectLiteral){var B=this._tokens.peek();B.text===":"&&(S.type=u.WORD)}}if(this.start_of_statement(S)?A(this._flags.last_token,["var","let","const"])&&S.type===u.WORD&&(this._flags.declaration_statement=!0):S.newlines&&!P(this._flags.mode)&&(this._flags.last_token.type!==u.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==u.EQUALS&&(this._options.preserve_newlines||!A(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(S),this.print_newline()):this.handle_whitespace_and_comments(S),this._flags.do_block&&!this._flags.do_while)if(w(S,"while")){this._output.space_before_token=!0,this.print_token(S),this._output.space_before_token=!0,this._flags.do_while=!0;return}else this.print_newline(),this._flags.do_block=!1;if(this._flags.if_block)if(!this._flags.else_block&&w(S,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===a.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&A(S,["case","default"])){this.print_newline(),!this._flags.case_block&&(this._flags.case_body||this._options.jslint_happy)&&this.deindent(),this._flags.case_body=!1,this.print_token(S),this._flags.in_case=!0;return}if((this._flags.last_token.type===u.COMMA||this._flags.last_token.type===u.START_EXPR||this._flags.last_token.type===u.EQUALS||this._flags.last_token.type===u.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(S)),w(S,"function")){(f(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(f(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===u.OPERATOR))&&(!this._output.just_added_blankline()&&!S.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===u.RESERVED||this._flags.last_token.type===u.WORD?A(this._flags.last_token,["get","set","new","export"])||A(this._flags.last_token,U)?this._output.space_before_token=!0:w(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===u.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(P(this._flags.mode)||b(this._flags.mode))||this.print_newline(),this.print_token(S),this._flags.last_word=S.text;return}var J="NONE";if(this._flags.last_token.type===u.END_BLOCK?this._previous_flags.inline_frame?J="SPACE":A(S,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&S.newlines?J="NEWLINE":(J="SPACE",this._output.space_before_token=!0):J="NEWLINE":this._flags.last_token.type===u.SEMICOLON&&this._flags.mode===a.BlockStatement?J="NEWLINE":this._flags.last_token.type===u.SEMICOLON&&P(this._flags.mode)?J="SPACE":this._flags.last_token.type===u.STRING?J="NEWLINE":this._flags.last_token.type===u.RESERVED||this._flags.last_token.type===u.WORD||this._flags.last_token.text==="*"&&(f(this._last_last_text,["function","yield"])||this._flags.mode===a.ObjectLiteral&&f(this._last_last_text,["{",","]))?J="SPACE":this._flags.last_token.type===u.START_BLOCK?this._flags.inline_frame?J="SPACE":J="NEWLINE":this._flags.last_token.type===u.END_EXPR&&(this._output.space_before_token=!0,J="NEWLINE"),A(S,l)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?J="SPACE":J="NEWLINE"),A(S,["else","catch","finally"]))if((!(this._flags.last_token.type===u.END_BLOCK&&this._previous_flags.mode===a.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&S.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var te=this._output.current_line;te.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else J==="NEWLINE"?A(this._flags.last_token,R)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&A(S,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==u.END_EXPR?(this._flags.last_token.type!==u.START_EXPR||!A(S,["var","let","const"]))&&this._flags.last_token.text!==":"&&(w(S,"if")&&w(S.previous,"else")?this._output.space_before_token=!0:this.print_newline()):A(S,l)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&b(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():J==="SPACE"&&(this._output.space_before_token=!0);S.previous&&(S.previous.type===u.WORD||S.previous.type===u.RESERVED)&&(this._output.space_before_token=!0),this.print_token(S),this._flags.last_word=S.text,S.type===u.RESERVED&&(S.text==="do"?this._flags.do_block=!0:S.text==="if"?this._flags.if_block=!0:S.text==="import"?this._flags.import_block=!0:this._flags.import_block&&w(S,"from")&&(this._flags.import_block=!1))},X.prototype.handle_semicolon=function(S){this.start_of_statement(S)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(S);for(var B=this._tokens.peek();this._flags.mode===a.Statement&&!(this._flags.if_block&&w(B,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(S)},X.prototype.handle_string=function(S){S.text.startsWith("`")&&S.newlines===0&&S.whitespace_before===""&&(S.previous.text===")"||this._flags.last_token.type===u.WORD)||(this.start_of_statement(S)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(S),this._flags.last_token.type===u.RESERVED||this._flags.last_token.type===u.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===u.COMMA||this._flags.last_token.type===u.START_EXPR||this._flags.last_token.type===u.EQUALS||this._flags.last_token.type===u.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(S):S.text.startsWith("`")&&this._flags.last_token.type===u.END_EXPR&&(S.previous.text==="]"||S.previous.text===")")&&S.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(S)},X.prototype.handle_equals=function(S){this.start_of_statement(S)||this.handle_whitespace_and_comments(S),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(S),this._output.space_before_token=!0},X.prototype.handle_comma=function(S){this.handle_whitespace_and_comments(S,!0),this.print_token(S),this._output.space_before_token=!0,this._flags.declaration_statement?(P(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(S)):this._flags.mode===a.ObjectLiteral||this._flags.mode===a.Statement&&this._flags.parent.mode===a.ObjectLiteral?(this._flags.mode===a.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(S)},X.prototype.handle_operator=function(S){var B=S.text==="*"&&(A(this._flags.last_token,["function","yield"])||f(this._flags.last_token.type,[u.START_BLOCK,u.COMMA,u.END_BLOCK,u.SEMICOLON])),J=f(S.text,["-","+"])&&(f(this._flags.last_token.type,[u.START_BLOCK,u.START_EXPR,u.EQUALS,u.OPERATOR])||f(this._flags.last_token.text,l)||this._flags.last_token.text===",");if(!this.start_of_statement(S)){var te=!B;this.handle_whitespace_and_comments(S,te)}if(S.text==="*"&&this._flags.last_token.type===u.DOT){this.print_token(S);return}if(S.text==="::"){this.print_token(S);return}if(this._flags.last_token.type===u.OPERATOR&&f(this._options.operator_position,g)&&this.allow_wrap_or_preserved_newline(S),S.text===":"&&this._flags.in_case){this.print_token(S),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==u.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0);return}var ae=!0,_e=!0,de=!1;if(S.text===":"?this._flags.ternary_depth===0?ae=!1:(this._flags.ternary_depth-=1,de=!0):S.text==="?"&&(this._flags.ternary_depth+=1),!J&&!B&&this._options.preserve_newlines&&f(S.text,s)){var Ee=S.text===":",Te=Ee&&de,me=Ee&&!de;switch(this._options.operator_position){case E.before_newline:this._output.space_before_token=!me,this.print_token(S),(!Ee||Te)&&this.allow_wrap_or_preserved_newline(S),this._output.space_before_token=!0;return;case E.after_newline:this._output.space_before_token=!0,!Ee||Te?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(S):this._output.space_before_token=!1,this.print_token(S),this._output.space_before_token=!0;return;case E.preserve_newline:me||this.allow_wrap_or_preserved_newline(S),ae=!(this._output.just_added_newline()||me),this._output.space_before_token=ae,this.print_token(S),this._output.space_before_token=!0;return}}if(B){this.allow_wrap_or_preserved_newline(S),ae=!1;var ce=this._tokens.peek();_e=ce&&f(ce.type,[u.WORD,u.RESERVED])}else if(S.text==="...")this.allow_wrap_or_preserved_newline(S),ae=this._flags.last_token.type===u.START_BLOCK,_e=!1;else if(f(S.text,["--","++","!","~"])||J){if((this._flags.last_token.type===u.COMMA||this._flags.last_token.type===u.START_EXPR)&&this.allow_wrap_or_preserved_newline(S),ae=!1,_e=!1,S.newlines&&(S.text==="--"||S.text==="++"||S.text==="~")){var se=A(this._flags.last_token,R)&&S.newlines;se&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(se,!0)}this._flags.last_token.text===";"&&P(this._flags.mode)&&(ae=!0),this._flags.last_token.type===u.RESERVED?ae=!0:this._flags.last_token.type===u.END_EXPR?ae=!(this._flags.last_token.text==="]"&&(S.text==="--"||S.text==="++")):this._flags.last_token.type===u.OPERATOR&&(ae=f(S.text,["--","-","++","+"])&&f(this._flags.last_token.text,["--","-","++","+"]),f(S.text,["+","-"])&&f(this._flags.last_token.text,["--","++"])&&(_e=!0)),(this._flags.mode===a.BlockStatement&&!this._flags.inline_frame||this._flags.mode===a.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||ae,this.print_token(S),this._output.space_before_token=_e},X.prototype.handle_block_comment=function(S,B){if(this._output.raw){this._output.add_raw_token(S),S.directives&&S.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(S.directives){this.print_newline(!1,B),this.print_token(S),S.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!c.newline.test(S.text)&&!S.newlines){this._output.space_before_token=!0,this.print_token(S),this._output.space_before_token=!0;return}else this.print_block_commment(S,B)},X.prototype.print_block_commment=function(S,B){var J=r(S.text),te,ae=!1,_e=!1,de=S.whitespace_before,Ee=de.length;if(this.print_newline(!1,B),this.print_token_line_indentation(S),this._output.add_token(J[0]),this.print_newline(!1,B),J.length>1){for(J=J.slice(1),ae=M(J,"*"),_e=W(J,de),ae&&(this._flags.alignment=1),te=0;te<J.length;te++)ae?(this.print_token_line_indentation(S),this._output.add_token(O(J[te]))):_e&&J[te]?(this.print_token_line_indentation(S),this._output.add_token(J[te].substring(Ee))):(this._output.current_line.set_indent(-1),this._output.add_token(J[te])),this.print_newline(!1,B);this._flags.alignment=0}},X.prototype.handle_comment=function(S,B){S.newlines?this.print_newline(!1,B):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(S),this.print_newline(!1,B)},X.prototype.handle_dot=function(S){this.start_of_statement(S)||this.handle_whitespace_and_comments(S,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),A(this._flags.last_token,R)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(S,this._flags.last_token.text===")"&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(S)},X.prototype.handle_unknown=function(S,B){this.print_token(S),S.text[S.text.length-1]===`
|
|
`&&this.print_newline(!1,B)},X.prototype.handle_eof=function(S){for(;this._flags.mode===a.Statement;)this.restore_mode();this.handle_whitespace_and_comments(S)},k.exports.Beautifier=X},function(k){function L(p){this.__parent=p,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}L.prototype.clone_empty=function(){var p=new L(this.__parent);return p.set_indent(this.__indent_count,this.__alignment_count),p},L.prototype.item=function(p){return p<0?this.__items[this.__items.length+p]:this.__items[p]},L.prototype.has_match=function(p){for(var c=this.__items.length-1;c>=0;c--)if(this.__items[c].match(p))return!0;return!1},L.prototype.set_indent=function(p,c){this.is_empty()&&(this.__indent_count=p||0,this.__alignment_count=c||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},L.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},L.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},L.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var p=this.__parent.current_line;return p.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),p.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),p.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,p.__items[0]===" "&&(p.__items.splice(0,1),p.__character_count-=1),!0}return!1},L.prototype.is_empty=function(){return this.__items.length===0},L.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},L.prototype.push=function(p){this.__items.push(p);var c=p.lastIndexOf(`
|
|
`);c!==-1?this.__character_count=p.length-c:this.__character_count+=p.length},L.prototype.pop=function(){var p=null;return this.is_empty()||(p=this.__items.pop(),this.__character_count-=p.length),p},L.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},L.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},L.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},L.prototype.toString=function(){var p="";return this.is_empty()?this.__parent.indent_empty_lines&&(p=this.__parent.get_indent_string(this.__indent_count)):(p=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),p+=this.__items.join("")),p};function y(p,c){this.__cache=[""],this.__indent_size=p.indent_size,this.__indent_string=p.indent_char,p.indent_with_tabs||(this.__indent_string=new Array(p.indent_size+1).join(p.indent_char)),c=c||"",p.indent_level>0&&(c=new Array(p.indent_level+1).join(this.__indent_string)),this.__base_string=c,this.__base_string_length=c.length}y.prototype.get_indent_size=function(p,c){var h=this.__base_string_length;return c=c||0,p<0&&(h=0),h+=p*this.__indent_size,h+=c,h},y.prototype.get_indent_string=function(p,c){var h=this.__base_string;return c=c||0,p<0&&(p=0,h=""),c+=p*this.__indent_size,this.__ensure_cache(c),h+=this.__cache[c],h},y.prototype.__ensure_cache=function(p){for(;p>=this.__cache.length;)this.__add_column()},y.prototype.__add_column=function(){var p=this.__cache.length,c=0,h="";this.__indent_size&&p>=this.__indent_size&&(c=Math.floor(p/this.__indent_size),p-=c*this.__indent_size,h=new Array(c+1).join(this.__indent_string)),p&&(h+=new Array(p+1).join(" ")),this.__cache.push(h)};function v(p,c){this.__indent_cache=new y(p,c),this.raw=!1,this._end_with_newline=p.end_with_newline,this.indent_size=p.indent_size,this.wrap_line_length=p.wrap_line_length,this.indent_empty_lines=p.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new L(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}v.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},v.prototype.get_line_number=function(){return this.__lines.length},v.prototype.get_indent_string=function(p,c){return this.__indent_cache.get_indent_string(p,c)},v.prototype.get_indent_size=function(p,c){return this.__indent_cache.get_indent_size(p,c)},v.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},v.prototype.add_new_line=function(p){return this.is_empty()||!p&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},v.prototype.get_code=function(p){this.trim(!0);var c=this.current_line.pop();c&&(c[c.length-1]===`
|
|
`&&(c=c.replace(/\n+$/g,"")),this.current_line.push(c)),this._end_with_newline&&this.__add_outputline();var h=this.__lines.join(`
|
|
`);return p!==`
|
|
`&&(h=h.replace(/[\n]/g,p)),h},v.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},v.prototype.set_indent=function(p,c){return p=p||0,c=c||0,this.next_line.set_indent(p,c),this.__lines.length>1?(this.current_line.set_indent(p,c),!0):(this.current_line.set_indent(),!1)},v.prototype.add_raw_token=function(p){for(var c=0;c<p.newlines;c++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(p.whitespace_before),this.current_line.push(p.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},v.prototype.add_token=function(p){this.__add_space_before_token(),this.current_line.push(p),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},v.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},v.prototype.remove_indent=function(p){for(var c=this.__lines.length;p<c;)this.__lines[p]._remove_indent(),p++;this.current_line._remove_wrap_indent()},v.prototype.trim=function(p){for(p=p===void 0?!1:p,this.current_line.trim();p&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},v.prototype.just_added_newline=function(){return this.current_line.is_empty()},v.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},v.prototype.ensure_empty_line_above=function(p,c){for(var h=this.__lines.length-2;h>=0;){var d=this.__lines[h];if(d.is_empty())break;if(d.item(0).indexOf(p)!==0&&d.item(-1)!==c){this.__lines.splice(h+1,0,new L(this)),this.previous_line=this.__lines[this.__lines.length-2];break}h--}},k.exports.Output=v},function(k){function L(y,v,p,c){this.type=y,this.text=v,this.comments_before=null,this.newlines=p||0,this.whitespace_before=c||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}k.exports.Token=L},function(k,L){var y="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",v="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",p="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",c="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",h="(?:\\\\u[0-9a-fA-F]{4}|["+y+p+"])",d="(?:\\\\u[0-9a-fA-F]{4}|["+v+p+c+"])*";L.identifier=new RegExp(h+d,"g"),L.identifierStart=new RegExp(h),L.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+v+p+c+"])+");var l=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;L.newline=/[\n\r\u2028\u2029]/,L.lineBreak=new RegExp(`\r
|
|
|`+L.newline.source),L.allLineBreaks=new RegExp(L.lineBreak.source,"g")},function(k,L,y){var v=y(6).Options,p=["before-newline","after-newline","preserve-newline"];function c(h){v.call(this,h,"js");var d=this.raw_options.brace_style||null;d==="expand-strict"?this.raw_options.brace_style="expand":d==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var l=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var s=0;s<l.length;s++)l[s]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=l[s];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",p),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}c.prototype=new v,k.exports.Options=c},function(k){function L(p,c){this.raw_options=y(p,c),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}L.prototype._get_array=function(p,c){var h=this.raw_options[p],d=c||[];return typeof h=="object"?h!==null&&typeof h.concat=="function"&&(d=h.concat()):typeof h=="string"&&(d=h.split(/[^a-zA-Z0-9_\/\-]+/)),d},L.prototype._get_boolean=function(p,c){var h=this.raw_options[p],d=h===void 0?!!c:!!h;return d},L.prototype._get_characters=function(p,c){var h=this.raw_options[p],d=c||"";return typeof h=="string"&&(d=h.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),d},L.prototype._get_number=function(p,c){var h=this.raw_options[p];c=parseInt(c,10),isNaN(c)&&(c=0);var d=parseInt(h,10);return isNaN(d)&&(d=c),d},L.prototype._get_selection=function(p,c,h){var d=this._get_selection_list(p,c,h);if(d.length!==1)throw new Error("Invalid Option Value: The option '"+p+`' can only be one of the following values:
|
|
`+c+`
|
|
You passed in: '`+this.raw_options[p]+"'");return d[0]},L.prototype._get_selection_list=function(p,c,h){if(!c||c.length===0)throw new Error("Selection list cannot be empty.");if(h=h||[c[0]],!this._is_valid_selection(h,c))throw new Error("Invalid Default Value!");var d=this._get_array(p,h);if(!this._is_valid_selection(d,c))throw new Error("Invalid Option Value: The option '"+p+`' can contain only the following values:
|
|
`+c+`
|
|
You passed in: '`+this.raw_options[p]+"'");return d},L.prototype._is_valid_selection=function(p,c){return p.length&&c.length&&!p.some(function(h){return c.indexOf(h)===-1})};function y(p,c){var h={};p=v(p);var d;for(d in p)d!==c&&(h[d]=p[d]);if(c&&p[c])for(d in p[c])h[d]=p[c][d];return h}function v(p){var c={},h;for(h in p){var d=h.replace(/-/g,"_");c[d]=p[h]}return c}k.exports.Options=L,k.exports.normalizeOpts=v,k.exports.mergeOpts=y},function(k,L,y){var v=y(8).InputScanner,p=y(9).Tokenizer,c=y(9).TOKEN,h=y(13).Directives,d=y(4),l=y(12).Pattern,s=y(14).TemplatablePattern;function u(M,W){return W.indexOf(M)!==-1}var f={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:c.START,RAW:c.RAW,EOF:c.EOF},O=new h(/\/\*/,/\*\//),x=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,w=/[0-9]/,A=/[^\d\.]/,R=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),T=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";T=T.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),T="\\?\\.(?!\\d) "+T,T=T.replace(/ /g,"|");var E=new RegExp(T),g="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),a=g.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),m=new RegExp("^(?:"+a.join("|")+")$"),r,b=function(M,W){p.call(this,M,W),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var X=new l(this._input),U=new s(this._input).read_options(this._options);this.__patterns={template:U,identifier:U.starting_with(d.identifier).matching(d.identifierMatch),number:X.matching(x),punct:X.matching(E),comment:X.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:X.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:X.matching(/<!--/),html_comment_end:X.matching(/-->/),include:X.starting_with(/#include/).until_after(d.lineBreak),shebang:X.starting_with(/#!/).until_after(d.lineBreak),xml:X.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:U.until(/['\\\n\r\u2028\u2029]/),double_quote:U.until(/["\\\n\r\u2028\u2029]/),template_text:U.until(/[`\\$]/),template_expression:U.until(/[`}\\]/)}};b.prototype=new p,b.prototype._is_comment=function(M){return M.type===f.COMMENT||M.type===f.BLOCK_COMMENT||M.type===f.UNKNOWN},b.prototype._is_opening=function(M){return M.type===f.START_BLOCK||M.type===f.START_EXPR},b.prototype._is_closing=function(M,W){return(M.type===f.END_BLOCK||M.type===f.END_EXPR)&&W&&(M.text==="]"&&W.text==="["||M.text===")"&&W.text==="("||M.text==="}"&&W.text==="{")},b.prototype._reset=function(){r=!1},b.prototype._get_next_token=function(M,W){var X=null;this._readWhitespace();var U=this._input.peek();return U===null?this._create_token(f.EOF,""):(X=X||this._read_non_javascript(U),X=X||this._read_string(U),X=X||this._read_word(M),X=X||this._read_singles(U),X=X||this._read_comment(U),X=X||this._read_regexp(U,M),X=X||this._read_xml(U,M),X=X||this._read_punctuation(),X=X||this._create_token(f.UNKNOWN,this._input.next()),X)},b.prototype._read_word=function(M){var W;if(W=this.__patterns.identifier.read(),W!=="")return W=W.replace(d.allLineBreaks,`
|
|
`),!(M.type===f.DOT||M.type===f.RESERVED&&(M.text==="set"||M.text==="get"))&&m.test(W)?(W==="in"||W==="of")&&(M.type===f.WORD||M.type===f.STRING)?this._create_token(f.OPERATOR,W):this._create_token(f.RESERVED,W):this._create_token(f.WORD,W);if(W=this.__patterns.number.read(),W!=="")return this._create_token(f.WORD,W)},b.prototype._read_singles=function(M){var W=null;return M==="("||M==="["?W=this._create_token(f.START_EXPR,M):M===")"||M==="]"?W=this._create_token(f.END_EXPR,M):M==="{"?W=this._create_token(f.START_BLOCK,M):M==="}"?W=this._create_token(f.END_BLOCK,M):M===";"?W=this._create_token(f.SEMICOLON,M):M==="."&&A.test(this._input.peek(1))?W=this._create_token(f.DOT,M):M===","&&(W=this._create_token(f.COMMA,M)),W&&this._input.next(),W},b.prototype._read_punctuation=function(){var M=this.__patterns.punct.read();if(M!=="")return M==="="?this._create_token(f.EQUALS,M):M==="?."?this._create_token(f.DOT,M):this._create_token(f.OPERATOR,M)},b.prototype._read_non_javascript=function(M){var W="";if(M==="#"){if(this._is_first_token()&&(W=this.__patterns.shebang.read(),W))return this._create_token(f.UNKNOWN,W.trim()+`
|
|
`);if(W=this.__patterns.include.read(),W)return this._create_token(f.UNKNOWN,W.trim()+`
|
|
`);M=this._input.next();var X="#";if(this._input.hasNext()&&this._input.testChar(w)){do M=this._input.next(),X+=M;while(this._input.hasNext()&&M!=="#"&&M!=="=");return M==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(X+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(X+="{}",this._input.next(),this._input.next())),this._create_token(f.WORD,X)}this._input.back()}else if(M==="<"&&this._is_first_token()){if(W=this.__patterns.html_comment_start.read(),W){for(;this._input.hasNext()&&!this._input.testChar(d.newline);)W+=this._input.next();return r=!0,this._create_token(f.COMMENT,W)}}else if(r&&M==="-"&&(W=this.__patterns.html_comment_end.read(),W))return r=!1,this._create_token(f.COMMENT,W);return null},b.prototype._read_comment=function(M){var W=null;if(M==="/"){var X="";if(this._input.peek(1)==="*"){X=this.__patterns.block_comment.read();var U=O.get_directives(X);U&&U.ignore==="start"&&(X+=O.readIgnored(this._input)),X=X.replace(d.allLineBreaks,`
|
|
`),W=this._create_token(f.BLOCK_COMMENT,X),W.directives=U}else this._input.peek(1)==="/"&&(X=this.__patterns.comment.read(),W=this._create_token(f.COMMENT,X))}return W},b.prototype._read_string=function(M){if(M==="`"||M==="'"||M==='"'){var W=this._input.next();return this.has_char_escapes=!1,M==="`"?W+=this._read_string_recursive("`",!0,"${"):W+=this._read_string_recursive(M),this.has_char_escapes&&this._options.unescape_strings&&(W=P(W)),this._input.peek()===M&&(W+=this._input.next()),W=W.replace(d.allLineBreaks,`
|
|
`),this._create_token(f.STRING,W)}return null},b.prototype._allow_regexp_or_xml=function(M){return M.type===f.RESERVED&&u(M.text,["return","case","throw","else","do","typeof","yield"])||M.type===f.END_EXPR&&M.text===")"&&M.opened.previous.type===f.RESERVED&&u(M.opened.previous.text,["if","while","for"])||u(M.type,[f.COMMENT,f.START_EXPR,f.START_BLOCK,f.START,f.END_BLOCK,f.OPERATOR,f.EQUALS,f.EOF,f.SEMICOLON,f.COMMA])},b.prototype._read_regexp=function(M,W){if(M==="/"&&this._allow_regexp_or_xml(W)){for(var X=this._input.next(),U=!1,S=!1;this._input.hasNext()&&(U||S||this._input.peek()!==M)&&!this._input.testChar(d.newline);)X+=this._input.peek(),U?U=!1:(U=this._input.peek()==="\\",this._input.peek()==="["?S=!0:this._input.peek()==="]"&&(S=!1)),this._input.next();return this._input.peek()===M&&(X+=this._input.next(),X+=this._input.read(d.identifier)),this._create_token(f.STRING,X)}return null},b.prototype._read_xml=function(M,W){if(this._options.e4x&&M==="<"&&this._allow_regexp_or_xml(W)){var X="",U=this.__patterns.xml.read_match();if(U){for(var S=U[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),B=S.indexOf("{")===0,J=0;U;){var te=!!U[1],ae=U[2],_e=!!U[U.length-1]||ae.slice(0,8)==="![CDATA[";if(!_e&&(ae===S||B&&ae.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(te?--J:++J),X+=U[0],J<=0)break;U=this.__patterns.xml.read_match()}return U||(X+=this._input.match(/[\s\S]*/g)[0]),X=X.replace(d.allLineBreaks,`
|
|
`),this._create_token(f.STRING,X)}}return null};function P(M){for(var W="",X=0,U=new v(M),S=null;U.hasNext();)if(S=U.match(/([\s]|[^\\]|\\\\)+/g),S&&(W+=S[0]),U.peek()==="\\"){if(U.next(),U.peek()==="x")S=U.match(/x([0-9A-Fa-f]{2})/g);else if(U.peek()==="u")S=U.match(/u([0-9A-Fa-f]{4})/g);else{W+="\\",U.hasNext()&&(W+=U.next());continue}if(!S)return M;if(X=parseInt(S[1],16),X>126&&X<=255&&S[0].indexOf("x")===0)return M;if(X>=0&&X<32){W+="\\"+S[0];continue}else X===34||X===39||X===92?W+="\\"+String.fromCharCode(X):W+=String.fromCharCode(X)}return W}b.prototype._read_string_recursive=function(M,W,X){var U,S;M==="'"?S=this.__patterns.single_quote:M==='"'?S=this.__patterns.double_quote:M==="`"?S=this.__patterns.template_text:M==="}"&&(S=this.__patterns.template_expression);for(var B=S.read(),J="";this._input.hasNext();){if(J=this._input.next(),J===M||!W&&d.newline.test(J)){this._input.back();break}else J==="\\"&&this._input.hasNext()?(U=this._input.peek(),U==="x"||U==="u"?this.has_char_escapes=!0:U==="\r"&&this._input.peek(1)===`
|
|
`&&this._input.next(),J+=this._input.next()):X&&(X==="${"&&J==="$"&&this._input.peek()==="{"&&(J+=this._input.next()),X===J&&(M==="`"?J+=this._read_string_recursive("}",W,"`"):J+=this._read_string_recursive("`",W,"${"),this._input.hasNext()&&(J+=this._input.next())));J+=S.read(),B+=J}return B},k.exports.Tokenizer=b,k.exports.TOKEN=f,k.exports.positionable_operators=R.slice(),k.exports.line_starters=g.slice()},function(k){var L=RegExp.prototype.hasOwnProperty("sticky");function y(v){this.__input=v||"",this.__input_length=this.__input.length,this.__position=0}y.prototype.restart=function(){this.__position=0},y.prototype.back=function(){this.__position>0&&(this.__position-=1)},y.prototype.hasNext=function(){return this.__position<this.__input_length},y.prototype.next=function(){var v=null;return this.hasNext()&&(v=this.__input.charAt(this.__position),this.__position+=1),v},y.prototype.peek=function(v){var p=null;return v=v||0,v+=this.__position,v>=0&&v<this.__input_length&&(p=this.__input.charAt(v)),p},y.prototype.__match=function(v,p){v.lastIndex=p;var c=v.exec(this.__input);return c&&!(L&&v.sticky)&&(c.index!==p&&(c=null)),c},y.prototype.test=function(v,p){return p=p||0,p+=this.__position,p>=0&&p<this.__input_length?!!this.__match(v,p):!1},y.prototype.testChar=function(v,p){var c=this.peek(p);return v.lastIndex=0,c!==null&&v.test(c)},y.prototype.match=function(v){var p=this.__match(v,this.__position);return p?this.__position+=p[0].length:p=null,p},y.prototype.read=function(v,p,c){var h="",d;return v&&(d=this.match(v),d&&(h+=d[0])),p&&(d||!v)&&(h+=this.readUntil(p,c)),h},y.prototype.readUntil=function(v,p){var c="",h=this.__position;v.lastIndex=this.__position;var d=v.exec(this.__input);return d?(h=d.index,p&&(h+=d[0].length)):h=this.__input_length,c=this.__input.substring(this.__position,h),this.__position=h,c},y.prototype.readUntilAfter=function(v){return this.readUntil(v,!0)},y.prototype.get_regexp=function(v,p){var c=null,h="g";return p&&L&&(h="y"),typeof v=="string"&&v!==""?c=new RegExp(v,h):v&&(c=new RegExp(v.source,h)),c},y.prototype.get_literal_regexp=function(v){return RegExp(v.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},y.prototype.peekUntilAfter=function(v){var p=this.__position,c=this.readUntilAfter(v);return this.__position=p,c},y.prototype.lookBack=function(v){var p=this.__position-1;return p>=v.length&&this.__input.substring(p-v.length,p).toLowerCase()===v},k.exports.InputScanner=y},function(k,L,y){var v=y(8).InputScanner,p=y(3).Token,c=y(10).TokenStream,h=y(11).WhitespacePattern,d={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},l=function(s,u){this._input=new v(s),this._options=u||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new h(this._input)};l.prototype.tokenize=function(){this._input.restart(),this.__tokens=new c,this._reset();for(var s,u=new p(d.START,""),f=null,O=[],x=new c;u.type!==d.EOF;){for(s=this._get_next_token(u,f);this._is_comment(s);)x.add(s),s=this._get_next_token(u,f);x.isEmpty()||(s.comments_before=x,x=new c),s.parent=f,this._is_opening(s)?(O.push(f),f=s):f&&this._is_closing(s,f)&&(s.opened=f,f.closed=s,f=O.pop(),s.parent=f),s.previous=u,u.next=s,this.__tokens.add(s),u=s}return this.__tokens},l.prototype._is_first_token=function(){return this.__tokens.isEmpty()},l.prototype._reset=function(){},l.prototype._get_next_token=function(s,u){this._readWhitespace();var f=this._input.read(/.+/g);return f?this._create_token(d.RAW,f):this._create_token(d.EOF,"")},l.prototype._is_comment=function(s){return!1},l.prototype._is_opening=function(s){return!1},l.prototype._is_closing=function(s,u){return!1},l.prototype._create_token=function(s,u){var f=new p(s,u,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return f},l.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},k.exports.Tokenizer=l,k.exports.TOKEN=d},function(k){function L(y){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=y}L.prototype.restart=function(){this.__position=0},L.prototype.isEmpty=function(){return this.__tokens_length===0},L.prototype.hasNext=function(){return this.__position<this.__tokens_length},L.prototype.next=function(){var y=null;return this.hasNext()&&(y=this.__tokens[this.__position],this.__position+=1),y},L.prototype.peek=function(y){var v=null;return y=y||0,y+=this.__position,y>=0&&y<this.__tokens_length&&(v=this.__tokens[y]),v},L.prototype.add=function(y){this.__parent_token&&(y.parent=this.__parent_token),this.__tokens.push(y),this.__tokens_length+=1},k.exports.TokenStream=L},function(k,L,y){var v=y(12).Pattern;function p(c,h){v.call(this,c,h),h?this._line_regexp=this._input.get_regexp(h._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}p.prototype=new v,p.prototype.__set_whitespace_patterns=function(c,h){c+="\\t ",h+="\\n\\r",this._match_pattern=this._input.get_regexp("["+c+h+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+h+"]")},p.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var c=this._input.read(this._match_pattern);if(c===" ")this.whitespace_before_token=" ";else if(c){var h=this.__split(this._newline_regexp,c);this.newline_count=h.length-1,this.whitespace_before_token=h[this.newline_count]}return c},p.prototype.matching=function(c,h){var d=this._create();return d.__set_whitespace_patterns(c,h),d._update(),d},p.prototype._create=function(){return new p(this._input,this)},p.prototype.__split=function(c,h){c.lastIndex=0;for(var d=0,l=[],s=c.exec(h);s;)l.push(h.substring(d,s.index)),d=s.index+s[0].length,s=c.exec(h);return d<h.length?l.push(h.substring(d,h.length)):l.push(""),l},k.exports.WhitespacePattern=p},function(k){function L(y,v){this._input=y,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,v&&(this._starting_pattern=this._input.get_regexp(v._starting_pattern,!0),this._match_pattern=this._input.get_regexp(v._match_pattern,!0),this._until_pattern=this._input.get_regexp(v._until_pattern),this._until_after=v._until_after)}L.prototype.read=function(){var y=this._input.read(this._starting_pattern);return(!this._starting_pattern||y)&&(y+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),y},L.prototype.read_match=function(){return this._input.match(this._match_pattern)},L.prototype.until_after=function(y){var v=this._create();return v._until_after=!0,v._until_pattern=this._input.get_regexp(y),v._update(),v},L.prototype.until=function(y){var v=this._create();return v._until_after=!1,v._until_pattern=this._input.get_regexp(y),v._update(),v},L.prototype.starting_with=function(y){var v=this._create();return v._starting_pattern=this._input.get_regexp(y,!0),v._update(),v},L.prototype.matching=function(y){var v=this._create();return v._match_pattern=this._input.get_regexp(y,!0),v._update(),v},L.prototype._create=function(){return new L(this._input,this)},L.prototype._update=function(){},k.exports.Pattern=L},function(k){function L(y,v){y=typeof y=="string"?y:y.source,v=typeof v=="string"?v:v.source,this.__directives_block_pattern=new RegExp(y+/ beautify( \w+[:]\w+)+ /.source+v,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(y+/\sbeautify\signore:end\s/.source+v,"g")}L.prototype.get_directives=function(y){if(!y.match(this.__directives_block_pattern))return null;var v={};this.__directive_pattern.lastIndex=0;for(var p=this.__directive_pattern.exec(y);p;)v[p[1]]=p[2],p=this.__directive_pattern.exec(y);return v},L.prototype.readIgnored=function(y){return y.readUntilAfter(this.__directives_end_ignore_pattern)},k.exports.Directives=L},function(k,L,y){var v=y(12).Pattern,p={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function c(h,d){v.call(this,h,d),this.__template_pattern=null,this._disabled=Object.assign({},p),this._excluded=Object.assign({},p),d&&(this.__template_pattern=this._input.get_regexp(d.__template_pattern),this._excluded=Object.assign(this._excluded,d._excluded),this._disabled=Object.assign(this._disabled,d._disabled));var l=new v(h);this.__patterns={handlebars_comment:l.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:l.starting_with(/{{{/).until_after(/}}}/),handlebars:l.starting_with(/{{/).until_after(/}}/),php:l.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:l.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:l.starting_with(/{%/).until_after(/%}/),django_value:l.starting_with(/{{/).until_after(/}}/),django_comment:l.starting_with(/{#/).until_after(/#}/),smarty:l.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:l.starting_with(/{\*/).until_after(/\*}/),smarty_literal:l.starting_with(/{literal}/).until_after(/{\/literal}/)}}c.prototype=new v,c.prototype._create=function(){return new c(this._input,this)},c.prototype._update=function(){this.__set_templated_pattern()},c.prototype.disable=function(h){var d=this._create();return d._disabled[h]=!0,d._update(),d},c.prototype.read_options=function(h){var d=this._create();for(var l in p)d._disabled[l]=h.templating.indexOf(l)===-1;return d._update(),d},c.prototype.exclude=function(h){var d=this._create();return d._excluded[h]=!0,d._update(),d},c.prototype.read=function(){var h="";this._match_pattern?h=this._input.read(this._starting_pattern):h=this._input.read(this._starting_pattern,this.__template_pattern);for(var d=this._read_template();d;)this._match_pattern?d+=this._input.read(this._match_pattern):d+=this._input.readUntil(this.__template_pattern),h+=d,d=this._read_template();return this._until_after&&(h+=this._input.readUntilAfter(this._until_pattern)),h},c.prototype.__set_templated_pattern=function(){var h=[];this._disabled.php||h.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||h.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||h.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(h.push(this.__patterns.django._starting_pattern.source),h.push(this.__patterns.django_value._starting_pattern.source),h.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||h.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&h.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+h.join("|")+")")},c.prototype._read_template=function(){var h="",d=this._input.peek();if(d==="<"){var l=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&l==="?"&&(h=h||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&l==="%"&&(h=h||this.__patterns.erb.read())}else d==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(h=h||this.__patterns.handlebars_comment.read(),h=h||this.__patterns.handlebars_unescaped.read(),h=h||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(h=h||this.__patterns.django_value.read()),this._excluded.django||(h=h||this.__patterns.django_comment.read(),h=h||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(h=h||this.__patterns.smarty_comment.read(),h=h||this.__patterns.smarty_literal.read(),h=h||this.__patterns.smarty.read()));return h},k.exports.TemplatablePattern=c}],F={};function V(k){var L=F[k];if(L!==void 0)return L.exports;var y=F[k]={exports:{}};return j[k](y,y.exports,V),y.exports}var H=V(0);D=H})();var $=D;!(oe=[],Z=function(){return{js_beautify:$}}.apply(st,oe),Z!==void 0&&(Mt.exports=Z))})()},"7Cbv":function(Mt,st,ne){"use strict";var oe=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Z=new Uint8Array(16);function D(){if(!oe)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return oe(Z)}var $=/^(?:[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 j(p){return typeof p=="string"&&$.test(p)}for(var F=j,V=[],H=0;H<256;++H)V.push((H+256).toString(16).substr(1));function k(p){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,h=(V[p[c+0]]+V[p[c+1]]+V[p[c+2]]+V[p[c+3]]+"-"+V[p[c+4]]+V[p[c+5]]+"-"+V[p[c+6]]+V[p[c+7]]+"-"+V[p[c+8]]+V[p[c+9]]+"-"+V[p[c+10]]+V[p[c+11]]+V[p[c+12]]+V[p[c+13]]+V[p[c+14]]+V[p[c+15]]).toLowerCase();if(!F(h))throw TypeError("Stringified UUID is invalid");return h}var L=k;function y(p,c,h){p=p||{};var d=p.random||(p.rng||D)();if(d[6]=d[6]&15|64,d[8]=d[8]&63|128,c){h=h||0;for(var l=0;l<16;++l)c[h+l]=d[l];return c}return L(d)}var v=st.a=y},"7ahc":function(Mt,st,ne){"use strict";ne.d(st,"a",function(){return O});var oe=ne("k1fw"),Z=ne("0Owb"),D=ne("+L6B"),$=ne("2/Rp"),j=ne("y8nQ"),F=ne("Vl3Y"),V=ne("tJVT"),H=ne("OaEy"),k=ne("2fM7"),L=ne("q1tI"),y=ne.n(L),v=ne("VrN/"),p=ne.n(v),c=ne("p77/"),h=ne.n(c),d=ne("c5Ni"),l=ne.n(d),s=k.a.Option,u={labelCol:{span:4},wrapperCol:{span:20}},f={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"]};st.b=function(x){var w=x.callback,A=x.onCancel,R=Object(L.useState)("python"),T=Object(V.a)(R,2),E=T[0],g=T[1];function a(r){g(f[r][1])}function m(r){w(r)}return y.a.createElement(F.a,Object(Z.a)({},u,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:m}),y.a.createElement(F.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},y.a.createElement(k.a,{onChange:a},Object.keys(f).map(function(r){return y.a.createElement(s,{key:r,value:r},f[r][0])}))),y.a.createElement(F.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},y.a.createElement(O,{mode:E})),y.a.createElement("div",{className:"flex-container flex-end"},y.a.createElement($.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement($.a,{type:"ghost",onClick:A},"\u53D6\u6D88")))};function O(x){var w=x.value,A=x.onChange,R=x.mode,T=x.options,E=T===void 0?{}:T,g=Object(L.useRef)(),a=Object(L.useState)(),m=Object(V.a)(a,2),r=m[0],b=m[1];return Object(L.useEffect)(function(){if(r){function P(M){var W=M.getValue();A&&A(W)}return r.on("change",P),function(){r.off("change",P)}}},[r,A]),Object(L.useEffect)(function(){r&&r.setOption("mode",R)},[r,R]),Object(L.useEffect)(function(){r&&((w!==r.getValue()||w==="")&&setTimeout(function(){r.setValue(w||" ")},300))},[r,w]),Object(L.useEffect)(function(){if(g.current&&!r){var P=p.a.fromTextArea(g.current,Object(oe.a)({mode:R,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},E));b(P)}},[g.current,r]),y.a.createElement("div",{className:"my-codemirror-container"},y.a.createElement("textarea",{ref:g}))}},"7qnI":function(Mt,st,ne){"use strict";var oe=ne("5Dmo"),Z=ne("3S7+"),D=ne("fWQN"),$=ne("mtLc"),j=ne("yKVA"),F=ne("879j"),V=ne("5NDa"),H=ne("5rEg"),k=ne("q1tI"),L=ne.n(k),y=ne("O2Wb"),v=ne.n(y),p=H.a.TextArea,c=function(h){Object(j.a)(l,h);var d=Object(F.a)(l);function l(){return Object(D.a)(this,l),d.apply(this,arguments)}return Object($.a)(l,[{key:"render",value:function(){var u=this,f=this.props,O=f.index,x=f.onAnswerChange,w=f.addChildAnswer,A=f.exerciseIsPublish,R=f.answers,T=f.activeOptionErrorIndex,E=f.flex,g=E===void 0?"0 0 1000px":E;return L.a.createElement("div",{className:v.a.flex},L.a.createElement("div",{className:"".concat(v.a.color666," mb5 mt6"),style:{flex:"0 0 90px"}},"\u7B54\u6848(\u586B\u7A7A",O+1,"):"),L.a.createElement("div",{className:"".concat(v.a.flex," ").concat(v.a.flex1),style:{flexDirection:"column"}},R.map(function(a,m){var r="".concat(O,"-").concat(m);return L.a.createElement("div",{className:"".concat(v.a.flex," ").concat(v.a.flex1),key:m},L.a.createElement("div",{className:v.a.flex1,style:{flex:g}},L.a.createElement("div",null,L.a.createElement(p,{className:r===T?v.a.error:"",spellCheck:!1,rows:4,value:a||"",defaultValue:"\u8BF7\u8F93\u5165\u53C2\u8003\u7B54\u6848".concat(m==0?"":"(\u53EF\u9009)"),onChange:function(P){return x(O,m,P.target.value)},style:{minHeight:95}}))),!A&&L.a.createElement(L.a.Fragment,null,m!=0&&L.a.createElement(Z.a,{title:"\u5220\u9664"},L.a.createElement("i",{className:"".concat(v.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return u.props.deleteChildAnswer(O,m)},style:{float:"right"}})),m===0&&L.a.createElement(Z.a,{title:"\u5220\u9664"},L.a.createElement("i",{className:"".concat(v.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return u.props.deleteChildAnswermain(O,m)},style:{float:"right"}})),L.a.createElement(Z.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},L.a.createElement("i",{className:"".concat(v.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return w(O)},style:{float:"right",visibility:m==R.length-1?"":"hidden"}}))))})))}}]),l}(k.Component);st.a=c},"8EBN":function(Mt,st,ne){(function(oe){oe(ne("VrN/"))})(function(oe){"use strict";oe.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 Z=0;Z<oe.modeInfo.length;Z++){var D=oe.modeInfo[Z];D.mimes&&(D.mime=D.mimes[0])}oe.findModeByMIME=function($){$=$.toLowerCase();for(var j=0;j<oe.modeInfo.length;j++){var F=oe.modeInfo[j];if(F.mime==$)return F;if(F.mimes){for(var V=0;V<F.mimes.length;V++)if(F.mimes[V]==$)return F}}if(/\+xml$/.test($))return oe.findModeByMIME("application/xml");if(/\+json$/.test($))return oe.findModeByMIME("application/json")},oe.findModeByExtension=function($){$=$.toLowerCase();for(var j=0;j<oe.modeInfo.length;j++){var F=oe.modeInfo[j];if(F.ext){for(var V=0;V<F.ext.length;V++)if(F.ext[V]==$)return F}}},oe.findModeByFileName=function($){for(var j=0;j<oe.modeInfo.length;j++){var F=oe.modeInfo[j];if(F.file&&F.file.test($))return F}var V=$.lastIndexOf("."),H=V>-1&&$.substring(V+1,$.length);if(H)return oe.findModeByExtension(H)},oe.findModeByName=function($){$=$.toLowerCase();for(var j=0;j<oe.modeInfo.length;j++){var F=oe.modeInfo[j];if(F.name.toLowerCase()==$)return F;if(F.alias){for(var V=0;V<F.alias.length;V++)if(F.alias[V].toLowerCase()==$)return F}}}})},"8hTe":function(Mt,st,ne){Mt.exports={button:"button___1wy9m"}},"9Bee":function(Mt,st,ne){"use strict";var oe=ne("DYRE"),Z=ne("zeV3"),D=ne("+L6B"),$=ne("2/Rp"),j=ne("k1fw"),F=ne("9og8"),V=ne("tJVT"),H=ne("WmNS"),k=ne.n(H),L=ne("q1tI"),y=ne.n(L),v=ne("vg9a"),p=ne("DlQD"),c=ne.n(p),h=ne("rUJ1");function d(K,_){var C=K.match(/^(\s+)(?:```)/);if(C===null)return _;var N=C[1];return _.split(`
|
|
`).map(function(Q){var G=Q.match(/^\s+/);if(G===null)return Q;var le=Object(V.a)(G,1),Ae=le[0];return Ae.length>=N.length?Q.slice(N.length):Q}).join(`
|
|
`)}var l=[],s=["<ul>"],u=new c.a.Renderer,f=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function O(){l.length=0,s=["<ul>"]}var x={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function w(K,_,C,N){if(_>=K.length||K[_].level<=C)return _;var Q=K[_];N.push("<li><a href='#"+Q.anchor+"'>"+Q.text+"</a>"),_++;var G=[];return _=w(K,_,Q.level,G),G.length>0&&(N.push("<ul>"),G.forEach(function(le){N.push(le)}),N.push("</ul>")),N.push("</li>"),_=w(K,_,C,N),_}function A(){return w(l,0,0,s),s.push("</ul>"),s.join("")}var R={heading:function(_){var C=f.exec(_);if(C)return{type:"heading",raw:C[0],depth:C[1].length,text:C[2]}},fences:function(_){var C=this.rules.block.fences.exec(_);if(C){var N=C[0],Q=d(N,C[3]||""),G=C[2]?C[2].trim():C[2];if(["latex","katex","math"].indexOf(G)>=0){var le=g(),Ae=Q;Q=le,a[le]={type:"block",expression:Ae}}return{type:"code",raw:N,lang:G,text:Q}}}},T=/(?:\${2})([^\n`]+?)(?:\${2})/gi,E=0,g=function(){return"__special_katext_id_".concat(E++,"__")},a={};function m(){return a}function r(){E=0,a={}}function b(K){return K=K.replace(T,function(_,C){var N=g();return a[N]={type:"inline",expression:C},N}),K}var P=u.listitem;u.listitem=function(K){return P(b(K))};var M=u.paragraph;u.paragraph=function(K){return M(b(K))};var W=u.tablecell;u.tablecell=function(K,_){return W(b(K),_)},u.code=function(K,_,C){var N=(_||"").match(/\S*/)[0];return N?["latex","katex","math"].indexOf(N)>=0?"<p class='editormd-tex'>".concat(K,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(_,'">').concat(C?K:Object(h.escape)(K,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(C?K:Object(h.escape)(K,!0))+"</code></pre>"},u.heading=function(K,_,C){var N=this.options.headerPrefix+C.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return l.push({anchor:N,level:_,text:K}),"<h"+_+' id="'+N+'">'+K+"</h"+_+">"},c.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),c.a.use({tokenizer:R,renderer:u});var X=c.a,U=ne("SJMd"),S=ne("ulZh"),B=ne.n(S),J=ne("m3rI"),te=ne("Oy/b"),ae=ne("p5ED"),_e=ne("ErOA");/*! *****************************************************************************
|
|
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 de=function(K,_){return(de=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,N){C.__proto__=N}||function(C,N){for(var Q in N)Object.prototype.hasOwnProperty.call(N,Q)&&(C[Q]=N[Q])})(K,_)};function Ee(K,_){function C(){this.constructor=K}de(K,_),K.prototype=_===null?Object.create(_):(C.prototype=_.prototype,new C)}function Te(K,_,C,N){return new(C||(C=Promise))(function(Q,G){function le(ot){try{Me(N.next(ot))}catch(Re){G(Re)}}function Ae(ot){try{Me(N.throw(ot))}catch(Re){G(Re)}}function Me(ot){var Re;ot.done?Q(ot.value):(Re=ot.value,Re instanceof C?Re:new C(function($e){$e(Re)})).then(le,Ae)}Me((N=N.apply(K,_||[])).next())})}function me(K,_){var C,N,Q,G,le={label:0,sent:function(){if(1&Q[0])throw Q[1];return Q[1]},trys:[],ops:[]};return G={next:Ae(0),throw:Ae(1),return:Ae(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function Ae(Me){return function(ot){return function(Re){if(C)throw new TypeError("Generator is already executing.");for(;le;)try{if(C=1,N&&(Q=2&Re[0]?N.return:Re[0]?N.throw||((Q=N.return)&&Q.call(N),0):N.next)&&!(Q=Q.call(N,Re[1])).done)return Q;switch(N=0,Q&&(Re=[2&Re[0],Q.value]),Re[0]){case 0:case 1:Q=Re;break;case 4:return le.label++,{value:Re[1],done:!1};case 5:le.label++,N=Re[1],Re=[0];continue;case 7:Re=le.ops.pop(),le.trys.pop();continue;default:if(!(Q=le.trys,(Q=Q.length>0&&Q[Q.length-1])||Re[0]!==6&&Re[0]!==2)){le=0;continue}if(Re[0]===3&&(!Q||Re[1]>Q[0]&&Re[1]<Q[3])){le.label=Re[1];break}if(Re[0]===6&&le.label<Q[1]){le.label=Q[1],Q=Re;break}if(Q&&le.label<Q[2]){le.label=Q[2],le.ops.push(Re);break}Q[2]&&le.ops.pop(),le.trys.pop();continue}Re=_.call(K,le)}catch($e){Re=[6,$e],N=0}finally{C=Q=0}if(5&Re[0])throw Re[1];return{value:Re[0]?Re[1]:void 0,done:!0}}([Me,ot])}}}function ce(){for(var K=0,_=0,C=arguments.length;_<C;_++)K+=arguments[_].length;var N=Array(K),Q=0;for(_=0;_<C;_++)for(var G=arguments[_],le=0,Ae=G.length;le<Ae;le++,Q++)N[Q]=G[le];return N}var se=function(){function K(){}return K.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},K.setAttributes=function(_,C){for(var N=0,Q=C;N<Q.length;N++){var G=Q[N],le=G[0],Ae=G[1];_.setAttribute(le,Ae)}},K.createRect=function(_,C,N){var Q=document.createElementNS("http://www.w3.org/2000/svg","rect");return Q.setAttribute("width",_.toString()),Q.setAttribute("height",C.toString()),N&&K.setAttributes(Q,N),Q},K.createLine=function(_,C,N,Q,G){var le=document.createElementNS("http://www.w3.org/2000/svg","line");return le.setAttribute("x1",_.toString()),le.setAttribute("y1",C.toString()),le.setAttribute("x2",N.toString()),le.setAttribute("y2",Q.toString()),G&&K.setAttributes(le,G),le},K.createPolygon=function(_,C){var N=document.createElementNS("http://www.w3.org/2000/svg","polygon");return N.setAttribute("points",_),C&&K.setAttributes(N,C),N},K.createCircle=function(_,C){var N=document.createElementNS("http://www.w3.org/2000/svg","circle");return N.setAttribute("cx",(_/2).toString()),N.setAttribute("cy",(_/2).toString()),N.setAttribute("r",_.toString()),C&&K.setAttributes(N,C),N},K.createEllipse=function(_,C,N){var Q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Q.setAttribute("cx",(_/2).toString()),Q.setAttribute("cy",(C/2).toString()),Q.setAttribute("rx",(_/2).toString()),Q.setAttribute("ry",(C/2).toString()),N&&K.setAttributes(Q,N),Q},K.createGroup=function(_){var C=document.createElementNS("http://www.w3.org/2000/svg","g");return _&&K.setAttributes(C,_),C},K.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},K.createMarker=function(_,C,N,Q,G,le,Ae){var Me=document.createElementNS("http://www.w3.org/2000/svg","marker");return K.setAttributes(Me,[["id",_],["orient",C],["markerWidth",N.toString()],["markerHeight",Q.toString()],["refX",G.toString()],["refY",le.toString()]]),Me.appendChild(Ae),Me},K.createText=function(_){var C=document.createElementNS("http://www.w3.org/2000/svg","text");return C.setAttribute("x","0"),C.setAttribute("y","0"),_&&K.setAttributes(C,_),C},K.createTSpan=function(_,C){var N=document.createElementNS("http://www.w3.org/2000/svg","tspan");return N.textContent=_,C&&K.setAttributes(N,C),N},K.createImage=function(_){var C=document.createElementNS("http://www.w3.org/2000/svg","image");return _&&K.setAttributes(C,_),C},K.createPoint=function(_,C){var N=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return N.x=_,N.y=C,N},K.createPath=function(_,C){var N=document.createElementNS("http://www.w3.org/2000/svg","path");return N.setAttribute("d",_),C&&K.setAttributes(N,C),N},K}(),Se=function(){function K(){}return K.addKey=function(_){K.key=_},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}(),je=function(){function K(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return K.prototype.rasterize=function(_,C,N){var Q=this;return new Promise(function(G){var le=N!==void 0?N:document.createElement("canvas");_===null&&(Q.markersOnly=!0,Q.naturalSize=!1);var Ae=document.createElementNS("http://www.w3.org/2000/svg","svg");Ae.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ae.setAttribute("width",C.width.baseVal.valueAsString),Ae.setAttribute("height",C.height.baseVal.valueAsString),Ae.setAttribute("viewBox","0 0 "+C.viewBox.baseVal.width.toString()+" "+C.viewBox.baseVal.height.toString()),Ae.innerHTML=C.innerHTML,Q.naturalSize===!0?(Ae.width.baseVal.value=_.naturalWidth,Ae.height.baseVal.value=_.naturalHeight):Q.width!==void 0&&Q.height!==void 0&&(Ae.width.baseVal.value=Q.width,Ae.height.baseVal.value=Q.height),le.width=Ae.width.baseVal.value,le.height=Ae.height.baseVal.value;var Me=Ae.outerHTML,ot=le.getContext("2d");Q.markersOnly!==!0&&ot.drawImage(_,0,0,le.width,le.height);var Re=window.URL,$e=new Image(le.width,le.height);$e.setAttribute("crossOrigin","anonymous");var ze=new Blob([Me],{type:"image/svg+xml"}),xt=Re.createObjectURL(ze);$e.onload=function(){ot.drawImage($e,0,0),Re.revokeObjectURL(xt);var vt=le.toDataURL(Q.imageType,Q.imageQuality);G(vt)},$e.src=xt})},K}(),We=function(){},Xe=function(){function K(_){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+_+"_"}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(_){return this.styleSheet===void 0&&this.addStyleSheet(),_.name=""+this.classNamePrefix+_.localName,this.classes.push(_),this.styleSheet.sheet.insertRule("."+_.name+" {"+_.style+"}",this.styleSheet.sheet.cssRules.length),_},K.prototype.addRule=function(_){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(_),this.styleSheet.sheet.insertRule(_.selector+" {"+_.style+"}",this.styleSheet.sheet.cssRules.length)},K.prototype.addStyleSheet=function(){var _;this.styleSheet=document.createElement("style"),((_=this.styleSheetRoot)!==null&&_!==void 0?_:document.head).appendChild(this.styleSheet),this.addRule(new Qe("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Qe("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new Qe("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Pe("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Pe("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},K.prototype.removeStyleSheet=function(){var _;this.styleSheet&&(((_=this.styleSheetRoot)!==null&&_!==void 0?_:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},K}(),Qe=function(K,_){this.selector=K,this.style=_},Pe=function(K,_){this.localName=K,this.style=_},Ue=function(){function K(_,C,N,Q,G){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=_,this.displayMode=C,this.markerItems=N,this.uiStyleSettings=Q,this.styles=G,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(_){var C=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=_,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var N=document.createElement("div");N.className=this.toolbarBlockStyleClass.name,N.style.whiteSpace="nowrap",this.uiContainer.appendChild(N),this.addActionButton(N,'<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(N,'<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(N,'<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(N,'<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(N,'<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(N,'<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(N,'<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(N,'<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(G){var le=document.createElement("div");le.className=""+C.toolbarButtonStyleClass.name,le.setAttribute("data-type-name",G.typeName),le.innerHTML=G.icon,le.addEventListener("click",function(){C.markerToolbarButtonClicked(le,G)}),C.buttons.push(le),C.markerButtons.push(le)}),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 Q=document.createElement("div");Q.className=this.toolbarBlockStyleClass.name,Q.style.whiteSpace="nowrap",Q.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(Q),this.addActionButton(Q,'<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(Q,'<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(_){this.buttonClickListeners.push(_)},K.prototype.removeButtonClickListener=function(_){this.buttonClickListeners.indexOf(_)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(_),1)},K.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},K.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var _=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<_||C===_&&this.markerButtons.length-1===_?this.markerButtonBlock.appendChild(this.markerButtons[C]):(C===_&&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 _=this;this.buttons.forEach(function(C){C.className=C.className.replace(_.uiStyleSettings.toolbarButtonStyleColorsClassName?_.uiStyleSettings.toolbarButtonStyleColorsClassName:_.toolbarButtonStyleColorsClass.name,"").trim(),C.className=C.className.replace(_.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?_.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:_.toolbarActiveButtonStyleColorsClass.name,"").trim(),C.className+=" "+(_.uiStyleSettings.toolbarButtonStyleColorsClassName?_.uiStyleSettings.toolbarButtonStyleColorsClassName:_.toolbarButtonStyleColorsClass.name)})},K.prototype.addActionButton=function(_,C,N){var Q=this,G=document.createElement("div");switch(G.className=""+this.toolbarButtonStyleClass.name,G.innerHTML=C,G.setAttribute("data-action",N),G.addEventListener("click",function(){Q.actionToolbarButtonClicked(G,N)}),N){case"select":G.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":G.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":G.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":G.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":G.style.fill=this.uiStyleSettings.closeButtonColor}_.appendChild(G),this.buttons.push(G)},K.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Pe("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 Pe("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Pe("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Pe("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 Pe("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var _=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Pe("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*_)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*_)+`px;
|
|
padding: `+_+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Pe("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Pe("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new Qe("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new Qe("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},K.prototype.markerToolbarButtonClicked=function(_,C){this.setActiveButton(_),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(N){return N("marker",C)}),this.markerButtonOverflowBlock.style.display="none"},K.prototype.actionToolbarButtonClicked=function(_,C){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(N){return N("action",C)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},K.prototype.setActiveButton=function(_){this.resetButtonStyles(),_.className=_.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),_.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},K.prototype.setActiveMarkerButton=function(_){var C=this.markerButtons.find(function(N){return N.getAttribute("data-type-name")===_});C&&this.setActiveButton(C)},K.prototype.setCurrentMarker=function(_){var C=this;this.currentMarker=_,this.buttons.filter(function(N){return/delete|notes/.test(N.getAttribute("data-action"))}).forEach(function(N){C.currentMarker===void 0?(N.style.fillOpacity="0.4",N.style.pointerEvents="none"):(N.style.fillOpacity="1",N.style.pointerEvents="all")})},K}(),Ye=function(){function K(_,C,N,Q){this.panels=[],this.panelButtons=[],this.markerjsContainer=_,this.displayMode=C,this.uiStyleSettings=N,this.styles=Q,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return K.prototype.addStyles=function(){var _;this.toolboxStyleClass=this.styles.addClass(new Pe("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 Pe("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var C=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Pe("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Pe("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Pe("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 Pe("toolbox-panel-row_colors",`
|
|
background-color: `+((_=this.uiStyleSettings.toolboxBackgroundColor)!==null&&_!==void 0?_:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Pe("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 Pe("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Pe("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new Qe("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new Qe("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},K.prototype.show=function(_){var C;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=_,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(_){var C,N,Q=this;this.panels=_,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+" "+((N=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&N!==void 0?N:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(G){var le;G.uiStyleSettings=Q.uiStyleSettings;var Ae=document.createElement("div");Ae.className=Q.toolboxButtonStyleClass.name+" "+((le=Q.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&le!==void 0?le:Q.toolboxButtonStyleColorsClass.name),Ae.innerHTML=G.icon,Ae.title=G.title,Ae.addEventListener("click",function(){Q.panelButtonClick(G)}),Q.panelButtons.push(Ae),Q.buttonRow.appendChild(Ae)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},K.prototype.panelButtonClick=function(_){var C=this,N=-1;if(_!==this.activePanel){N=this.panels.indexOf(_),this.panelRow.innerHTML="";var Q=_.getUi();Q.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(Q),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=_}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(G,le){var Ae,Me;G.className=C.toolboxButtonStyleClass.name+" "+(le===N?""+((Ae=C.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Ae!==void 0?Ae:C.toolboxActiveButtonStyleColorsClass.name):""+((Me=C.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Me!==void 0?Me:C.toolboxButtonStyleColorsClass.name))})},K}(),Ze=function(K,_){this.title=K,this.icon=_},Ve=function(K){function _(C,N,Q,G){var le=K.call(this,C,G||'<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 le.colors=[],le.addTransparent=!1,le.colorBoxes=[],le.colors=N,le.currentColor=Q,le.setCurrentColor=le.setCurrentColor.bind(le),le.getColorBox=le.getColorBox.bind(le),le}return Ee(_,K),_.prototype.getUi=function(){var C=this,N=document.createElement("div");return N.style.overflow="hidden",N.style.whiteSpace="nowrap",this.colors.forEach(function(Q){var G=C.getColorBox(Q);N.appendChild(G),C.colorBoxes.push(G)}),N},_.prototype.getColorBox=function(C){var N=this,Q=this.uiStyleSettings.toolbarHeight/4,G=this.uiStyleSettings.toolbarHeight-Q,le=document.createElement("div");le.style.display="inline-block",le.style.boxSizing="content-box",le.style.width=G-2+"px",le.style.height=G-2+"px",le.style.padding="1px",le.style.marginRight="2px",le.style.marginBottom="2px",le.style.borderWidth="2px",le.style.borderStyle="solid",le.style.borderRadius=(G+2)/2+"px",le.style.borderColor=C===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",le.addEventListener("click",function(){N.setCurrentColor(C,le)});var Ae=document.createElement("div");return Ae.style.display="inline-block",Ae.style.width=G-2+"px",Ae.style.height=G-2+"px",Ae.style.backgroundColor=C,Ae.style.borderRadius=G/2+"px",C==="transparent"&&(Ae.style.fill=this.uiStyleSettings.toolboxAccentColor,Ae.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>`),le.appendChild(Ae),le},_.prototype.setCurrentColor=function(C,N){var Q=this;this.currentColor=C,this.colorBoxes.forEach(function(G){G.style.borderColor=G===N?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(C)},_}(Ze),He=function(){function K(_,C,N){this._state="new",this._isSelected=!1,this._container=_,this._overlayContainer=C,this.globalSettings=N,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(_){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(_,C){},K.prototype.dblClick=function(_,C){},K.prototype.manipulate=function(_){},K.prototype.pointerUp=function(_){this.stateChanged()},K.prototype.dispose=function(){},K.prototype.addMarkerVisualToContainer=function(_){this.container.childNodes.length>0?this.container.insertBefore(_,this.container.childNodes[0]):this.container.appendChild(_)},K.prototype.getState=function(){return{typeName:K.typeName,state:this.state,notes:this.notes}},K.prototype.restoreState=function(_){this._state=_.state,this.notes=_.notes},K.prototype.scale=function(_,C){},K.prototype.colorChanged=function(_){this.onColorChanged&&this.onColorChanged(_),this.stateChanged()},K.prototype.fillColorChanged=function(_){this.onFillColorChanged&&this.onFillColorChanged(_),this.stateChanged()},K.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var _=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),_.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(_)&&this.onStateChanged(this)}},K.typeName="MarkerBase",K}(),Fe=function(){function K(){this.findGripByVisual=this.findGripByVisual.bind(this)}return K.prototype.findGripByVisual=function(_){return this.topLeft.ownsTarget(_)?this.topLeft:this.topCenter.ownsTarget(_)?this.topCenter:this.topRight.ownsTarget(_)?this.topRight:this.centerLeft.ownsTarget(_)?this.centerLeft:this.centerRight.ownsTarget(_)?this.centerRight:this.bottomLeft.ownsTarget(_)?this.bottomLeft:this.bottomCenter.ownsTarget(_)?this.bottomCenter:this.bottomRight.ownsTarget(_)?this.bottomRight:void 0},K}(),ft=function(){function K(){this.GRIP_SIZE=10,this.visual=se.createGroup(),this.visual.appendChild(se.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(se.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return K.prototype.ownsTarget=function(_){return _===this.visual||_===this.visual.childNodes[0]||_===this.visual.childNodes[1]},K}(),lt=function(){function K(){}return K.toITransformMatrix=function(_){return{a:_.a,b:_.b,c:_.c,d:_.d,e:_.e,f:_.f}},K.toSVGMatrix=function(_,C){return _.a=C.a,_.b=C.b,_.c=C.c,_.d=C.d,_.e=C.e,_.f=C.f,_},K}(),rt=function(K){function _(C,N,Q){var G=K.call(this,C,N,Q)||this;return G.left=0,G.top=0,G.width=0,G.height=0,G.defaultSize={x:50,y:20},G.offsetX=0,G.offsetY=0,G.rotationAngle=0,G.CB_DISTANCE=10,G._suppressMarkerCreateEvent=!1,G.container.transform.baseVal.appendItem(se.createTransform()),G.setupControlBox(),G}return Ee(_,K),Object.defineProperty(_.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"visual",{get:function(){return this._visual},set:function(C){this._visual=C;var N=se.createTransform();this._visual.transform.baseVal.appendItem(N)},enumerable:!1,configurable:!0}),_.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))},_.prototype.pointerDown=function(C,N){K.prototype.pointerDown.call(this,C,N),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 Q=this.unrotatePoint(C);if(this.manipulationStartX=Q.x,this.manipulationStartY=Q.y,this.offsetX=Q.x-this.left,this.offsetY=Q.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(N),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(N)){this.activeGrip=this.rotatorGrip;var G=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=G.x-this.width/2,this.top=G.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var le=this.container.transform.baseVal.getItem(0);le.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(le,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},_.prototype.pointerUp=function(C){var N=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",N==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},_.prototype.moveVisual=function(C){this.visual.style.transform="translate("+C.x+"px, "+C.y+"px)"},_.prototype.manipulate=function(C){var N=this.unrotatePoint(C);this.state==="creating"?this.resize(C):this.state==="move"?(this.left=this.manipulationStartLeft+(N.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(N.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(N):this.state==="rotate"&&this.rotate(C)},_.prototype.resize=function(C){var N=this.manipulationStartLeft,Q=this.manipulationStartWidth,G=this.manipulationStartTop,le=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:N=this.manipulationStartLeft+C.x-this.manipulationStartX,Q=this.manipulationStartWidth+this.manipulationStartLeft-N;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:Q=this.manipulationStartWidth+C.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:G=this.manipulationStartTop+C.y-this.manipulationStartY,le=this.manipulationStartHeight+this.manipulationStartTop-G;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:le=this.manipulationStartHeight+C.y-this.manipulationStartY}Q>=0?(this.left=N,this.width=Q):(this.left=N+Q,this.width=-Q),le>=0?(this.top=G,this.height=le):(this.top=G+le,this.height=-le),this.setSize()},_.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},_.prototype.rotate=function(C){if(Math.abs(C.x-this.centerX)>.1){var N=Math.sign(C.x-this.centerX);this.rotationAngle=180*Math.atan((C.y-this.centerY)/(C.x-this.centerX))/Math.PI+90*N,this.applyRotation()}},_.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)},_.prototype.rotatePoint=function(C){if(this.rotationAngle===0)return C;var N=this.container.getCTM(),Q=se.createPoint(C.x,C.y);return{x:(Q=Q.matrixTransform(N)).x,y:Q.y}},_.prototype.unrotatePoint=function(C){if(this.rotationAngle===0)return C;var N=this.container.getCTM();N=N.inverse();var Q=se.createPoint(C.x,C.y);return{x:(Q=Q.matrixTransform(N)).x,y:Q.y}},_.prototype.select=function(){K.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},_.prototype.deselect=function(){K.prototype.deselect.call(this),this.controlBox.style.display="none"},_.prototype.setupControlBox=function(){this.controlBox=se.createGroup();var C=se.createTransform();C.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(C),this.container.appendChild(this.controlBox),this.controlRect=se.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=se.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 Fe,this.addControlGrips(),this.controlBox.style.display="none"},_.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()},_.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()},_.prototype.createGrip=function(){var C=new ft;return C.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(C.visual),C},_.prototype.positionGrips=function(){var C=this.controlGrips.topLeft.GRIP_SIZE,N=-C/2,Q=N,G=(this.width+this.CB_DISTANCE)/2-C/2,le=(this.height+this.CB_DISTANCE)/2-C/2,Ae=this.height+this.CB_DISTANCE-C/2,Me=this.width+this.CB_DISTANCE-C/2;this.positionGrip(this.controlGrips.topLeft.visual,N,Q),this.positionGrip(this.controlGrips.topCenter.visual,G,Q),this.positionGrip(this.controlGrips.topRight.visual,Me,Q),this.positionGrip(this.controlGrips.centerLeft.visual,N,le),this.positionGrip(this.controlGrips.centerRight.visual,Me,le),this.positionGrip(this.controlGrips.bottomLeft.visual,N,Ae),this.positionGrip(this.controlGrips.bottomCenter.visual,G,Ae),this.positionGrip(this.controlGrips.bottomRight.visual,Me,Ae),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,G,Q-3*this.CB_DISTANCE)},_.prototype.positionGrip=function(C,N,Q){var G=C.transform.baseVal.getItem(0);G.setTranslate(N,Q),C.transform.baseVal.replaceItem(G,0)},_.prototype.hideControlBox=function(){this.controlBox.style.display="none"},_.prototype.showControlBox=function(){this.controlBox.style.display=""},_.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:lt.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:lt.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},K.prototype.getState.call(this))},_.prototype.restoreState=function(C){K.prototype.restoreState.call(this,C);var N=C;this.left=N.left,this.top=N.top,this.width=N.width,this.height=N.height,this.rotationAngle=N.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(lt.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,N.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(lt.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,N.containerTransformMatrix))},_.prototype.scale=function(C,N){K.prototype.scale.call(this,C,N);var Q=this.rotatePoint({x:this.left,y:this.top}),G=this.unrotatePoint({x:Q.x*C,y:Q.y*N});this.left=G.x,this.top=G.y,this.width=this.width*C,this.height=this.height*N,this.adjustControlBox()},_}(He),dt=function(K){function _(C,N,Q){var G=K.call(this,C,N,Q)||this;return G.fillColor="transparent",G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.opacity=1,G.setStrokeColor=G.setStrokeColor.bind(G),G.setFillColor=G.setFillColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.createVisual=G.createVisual.bind(G),G}return Ee(_,K),_.prototype.ownsTarget=function(C){return!(!K.prototype.ownsTarget.call(this,C)&&C!==this.visual)},_.prototype.createVisual=function(){this.visual=se.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)},_.prototype.pointerDown=function(C,N){K.prototype.pointerDown.call(this,C,N),this.state==="new"&&(this.createVisual(),this.moveVisual(C),this._state="creating")},_.prototype.manipulate=function(C){K.prototype.manipulate.call(this,C)},_.prototype.resize=function(C){K.prototype.resize.call(this,C),this.setSize()},_.prototype.setSize=function(){K.prototype.setSize.call(this),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},_.prototype.pointerUp=function(C){K.prototype.pointerUp.call(this,C),this.setSize()},_.prototype.setStrokeColor=function(C){this.strokeColor=C,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(C),this.stateChanged()},_.prototype.setFillColor=function(C){this.fillColor=C,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},_.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},_.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},_.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))},_.prototype.restoreState=function(C){var N=C;this.fillColor=N.fillColor,this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.opacity=N.opacity,this.createVisual(),K.prototype.restoreState.call(this,C),this.setSize()},_.prototype.scale=function(C,N){K.prototype.scale.call(this,C,N),this.setSize()},_.title="Rectangle marker",_}(rt),bt=function(K){function _(C,N,Q,G){var le=K.call(this,C,G||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return le.widths=[],le.widthBoxes=[],le.widths=N,le.currentWidth=Q,le.setCurrentWidth=le.setCurrentWidth.bind(le),le}return Ee(_,K),_.prototype.getUi=function(){var C=this,N=document.createElement("div");return N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2",this.widths.forEach(function(Q){var G=document.createElement("div");G.style.display="flex",G.style.flexGrow="2",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.borderColor=Q===C.currentWidth?C.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){C.setCurrentWidth(Q,G)}),N.appendChild(G);var le=document.createElement("div");le.innerText=Q.toString(),le.style.marginRight="5px",G.appendChild(le);var Ae=document.createElement("div");Ae.style.minHeight="20px",Ae.style.flexGrow="2",Ae.style.display="flex",Ae.style.alignItems="center";var Me=document.createElement("hr");Me.style.minWidth="20px",Me.style.border="0px",Me.style.borderTop=Q+"px solid "+C.uiStyleSettings.toolboxColor,Me.style.flexGrow="2",Ae.appendChild(Me),G.appendChild(Ae),C.widthBoxes.push(G)}),N},_.prototype.setCurrentWidth=function(C,N){var Q=this;this.currentWidth=C,this.widthBoxes.forEach(function(G){G.style.borderColor=G===N?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},_}(Ze),ut=function(K){function _(C,N,Q,G){var le=K.call(this,C,G||'<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 le.styles=[],le.styleBoxes=[],le.styles=N,le.currentStyle=Q,le.setCurrentStyle=le.setCurrentStyle.bind(le),le}return Ee(_,K),_.prototype.getUi=function(){var C=this,N=document.createElement("div");return N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2",this.styles.forEach(function(Q){var G=document.createElement("div");G.style.display="flex",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.overflow="hidden",G.style.maxWidth=100/C.styles.length-5+"%",G.style.borderColor=Q===C.currentStyle?C.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){C.setCurrentStyle(Q,G)}),N.appendChild(G);var le=document.createElement("div");le.style.minHeight="20px",le.style.flexGrow="2",le.style.overflow="hidden";var Ae=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+C.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(Q!==""?'stroke-dasharray="'+Q+'"':"")+` />
|
|
</svg>`;le.innerHTML=Ae,G.appendChild(le),C.styleBoxes.push(G)}),N},_.prototype.setCurrentStyle=function(C,N){var Q=this;this.currentStyle=C,this.styleBoxes.forEach(function(G){G.style.borderColor=G===N?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},_}(Ze),at=function(K){function _(C,N,Q){var G=K.call(this,C,N,Q)||this;return G.strokeColor=Q.defaultColor,G.strokeWidth=Q.defaultStrokeWidth,G.strokeDasharray=Q.defaultStrokeDasharray,G.strokePanel=new Ve("Line color",Q.defaultColorSet,Q.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new bt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new ut("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Ee(_,K),Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),_.prototype.getState=function(){var C=K.prototype.getState.call(this);return C.typeName=_.typeName,C},_.typeName="FrameMarker",_.title="Frame marker",_.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',_}(dt),Ie=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},yt=function(K){function _(C,N,Q){var G=K.call(this,C,N,Q)||this;return G.x1=0,G.y1=0,G.x2=0,G.y2=0,G.defaultLength=50,G.manipulationStartX=0,G.manipulationStartY=0,G.manipulationStartX1=0,G.manipulationStartY1=0,G.manipulationStartX2=0,G.manipulationStartY2=0,G.setupControlBox(),G}return Ee(_,K),_.prototype.ownsTarget=function(C){return!!K.prototype.ownsTarget.call(this,C)||!(!this.grip1.ownsTarget(C)&&!this.grip2.ownsTarget(C))},_.prototype.pointerDown=function(C,N){K.prototype.pointerDown.call(this,C,N),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(N)?this.activeGrip=this.grip1:this.grip2.ownsTarget(N)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},_.prototype.pointerUp=function(C){var N=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",N==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},_.prototype.adjustVisual=function(){},_.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)},_.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()},_.prototype.select=function(){K.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},_.prototype.deselect=function(){K.prototype.deselect.call(this),this.controlBox.style.display="none"},_.prototype.setupControlBox=function(){this.controlBox=se.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},_.prototype.adjustControlBox=function(){this.positionGrips()},_.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},_.prototype.createGrip=function(){var C=new ft;return C.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(C.visual),C},_.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)},_.prototype.positionGrip=function(C,N,Q){var G=C.transform.baseVal.getItem(0);G.setTranslate(N,Q),C.transform.baseVal.replaceItem(G,0)},_.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},K.prototype.getState.call(this))},_.prototype.restoreState=function(C){K.prototype.restoreState.call(this,C);var N=C;this.x1=N.x1,this.y1=N.y1,this.x2=N.x2,this.y2=N.y2},_.prototype.scale=function(C,N){K.prototype.scale.call(this,C,N),this.x1=this.x1*C,this.y1=this.y1*N,this.x2=this.x2*C,this.y2=this.y2*N,this.adjustVisual(),this.adjustControlBox()},_}(He),nt=function(K){function _(C,N,Q){var G=K.call(this,C,N,Q)||this;return G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.setStrokeColor=G.setStrokeColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.strokeColor=Q.defaultColor,G.strokeWidth=Q.defaultStrokeWidth,G.strokeDasharray=Q.defaultStrokeDasharray,G.strokePanel=new Ve("Line color",Q.defaultColorSet,Q.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new bt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new ut("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Ee(_,K),_.prototype.ownsTarget=function(C){return!(!K.prototype.ownsTarget.call(this,C)&&C!==this.visual&&C!==this.selectorLine&&C!==this.visibleLine)},_.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorLine=se.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=se.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)},_.prototype.pointerDown=function(C,N){K.prototype.pointerDown.call(this,C,N),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},_.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()),se.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},_.prototype.setStrokeColor=function(C){this.strokeColor=C,this.adjustVisual(),this.colorChanged(C)},_.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.adjustVisual()},_.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.adjustVisual(),this.stateChanged()},Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),_.prototype.getState=function(){var C=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},K.prototype.getState.call(this));return C.typeName=_.typeName,C},_.prototype.restoreState=function(C){K.prototype.restoreState.call(this,C);var N=C;this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.createVisual(),this.adjustVisual()},_.typeName="LineMarker",_.title="Line marker",_.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',_}(yt),Oe=function(K){function _(C,N,Q,G){var le=K.call(this,C,G||'<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 le.fonts=[],le.fontBoxes=[],le.fonts=N,le.currentFont=Q,le.setCurrentFont=le.setCurrentFont.bind(le),le}return Ee(_,K),_.prototype.getUi=function(){var C=this,N=document.createElement("div");return N.style.overflow="hidden",N.style.flexGrow="2",this.fonts.forEach(function(Q){var G=document.createElement("div");G.style.display="inline-block",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.overflow="hidden",G.style.maxWidth=100/C.fonts.length-5+"%",G.style.borderColor=Q===C.currentFont?C.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){C.setCurrentFont(Q,G)}),N.appendChild(G);var le=document.createElement("div");le.style.display="flex",le.style.minHeight="20px",le.style.flexGrow="2",le.style.fontFamily=Q,le.style.overflow="hidden";var Ae=document.createElement("div");Ae.style.whiteSpace="nowrap",Ae.style.overflow="hidden",Ae.style.textOverflow="ellipsis",Ae.innerHTML="The quick brown fox jumps over the lazy dog",le.appendChild(Ae),G.appendChild(le),C.fontBoxes.push(G)}),N},_.prototype.setCurrentFont=function(C,N){var Q=this;this.currentFont=C,this.fontBoxes.forEach(function(G){G.style.borderColor=G===N?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},_}(Ze),Ge=function(K){function _(C,N,Q){var G=K.call(this,C,N,Q)||this;return G.color="transparent",G.padding=5,G.DEFAULT_TEXT="your text here",G.text=G.DEFAULT_TEXT,G.isMoved=!1,G.color=Q.defaultColor,G.fontFamily=Q.defaultFontFamily,G.defaultSize={x:100,y:30},G.setColor=G.setColor.bind(G),G.setFont=G.setFont.bind(G),G.renderText=G.renderText.bind(G),G.sizeText=G.sizeText.bind(G),G.textEditDivClicked=G.textEditDivClicked.bind(G),G.showTextEditor=G.showTextEditor.bind(G),G.setSize=G.setSize.bind(G),G.positionTextEditor=G.positionTextEditor.bind(G),G.colorPanel=new Ve("Color",Q.defaultColorSet,Q.defaultColor),G.colorPanel.onColorChanged=G.setColor,G.fontFamilyPanel=new Oe("Font",Q.defaultFontFamilies,Q.defaultFontFamily),G.fontFamilyPanel.onFontChanged=G.setFont,G}return Ee(_,K),_.prototype.ownsTarget=function(C){if(K.prototype.ownsTarget.call(this,C)||C===this.visual||C===this.textElement||C===this.bgRectangle)return!0;var N=!1;return this.textElement.childNodes.forEach(function(Q){Q===C&&(N=!0)}),N},_.prototype.createVisual=function(){this.visual=se.createGroup(),this.bgRectangle=se.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=se.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},_.prototype.pointerDown=function(C,N){K.prototype.pointerDown.call(this,C,N),this.isMoved=!1,this.pointerDownPoint=C,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(C),this._state="creating")},_.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(N){C.textElement.appendChild(se.createTSpan(N.trim()===""?" ":N.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},_.prototype.getTextScale=function(){var C=this.textElement.getBBox(),N=1;if(C.width>0&&C.height>0){var Q=(1*this.width-this.width*this.padding*2/100)/C.width,G=(1*this.height-this.height*this.padding*2/100)/C.height;N=Math.min(Q,G)}return N},_.prototype.getTextPosition=function(C){var N=this.textElement.getBBox(),Q=0,G=0;return N.width>0&&N.height>0&&(Q=(this.width-N.width*C)/2,G=this.height/2-N.height*C/2),{x:Q,y:G}},_.prototype.sizeText=function(){var C=this.textElement.getBBox(),N=this.getTextScale(),Q=this.getTextPosition(N);Q.y-=C.y*N,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+Q.x+"px, "+Q.y+"px) scale("+N+", "+N+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(Q.x,Q.y),this.textElement.transform.baseVal.getItem(1).setScale(N,N))},_.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)},_.prototype.resize=function(C){K.prototype.resize.call(this,C),this.isMoved=!0,this.setSize(),this.sizeText()},_.prototype.setSize=function(){K.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},_.prototype.pointerUp=function(C){var N=this.state;N==="creating"&&(this._suppressMarkerCreateEvent=!0),K.prototype.pointerUp.call(this,C),this.setSize(),(N==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},_.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(N){N.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var N=Number.parseFloat(C.textEditor.style.fontSize);C.textEditor.clientWidth>=Number.parseInt(C.textEditor.style.maxWidth)&&N>.9;)N-=.1,C.textEditor.style.fontSize=Math.max(N,.9)+"em"}),this.textEditor.addEventListener("keyup",function(N){N.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(N){if(N.clipboardData){var Q=N.clipboardData.getData("text"),G=window.getSelection();if(!G.rangeCount)return!1;G.deleteFromDocument(),G.getRangeAt(0).insertNode(document.createTextNode(Q)),N.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")},_.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var C=this.getTextScale(),N=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),Q=this.textElement.getBBox(),G={x:Q.width*C,y:Q.height*C};N.x-=G.x/2,N.y-=G.y/2,this.textEditor.style.top=N.y+"px",this.textEditor.style.left=N.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-N.x+"px",this.textEditor.style.fontSize=Math.max(16*C,12)+"px",this.textElement.style.display="none"}},_.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()},_.prototype.select=function(){K.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},_.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),K.prototype.deselect.call(this)},_.prototype.dblClick=function(C,N){K.prototype.dblClick.call(this,C,N),this.showTextEditor()},_.prototype.setColor=function(C){this.textElement&&se.setAttributes(this.textElement,[["fill",C]]),this.color=C,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(C)},_.prototype.setFont=function(C){this.textElement&&se.setAttributes(this.textElement,[["font-family",C]]),this.fontFamily=C,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},_.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},_.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),_.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=_.typeName,C},_.prototype.restoreState=function(C){var N=C;this.color=N.color,this.fontFamily=N.fontFamily,this.padding=N.padding,this.text=N.text,this.createVisual(),K.prototype.restoreState.call(this,C),this.setSize()},_.prototype.scale=function(C,N){K.prototype.scale.call(this,C,N),this.setSize(),this.sizeText(),this.positionTextEditor()},_.typeName="TextMarker",_.title="Text marker",_.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>',_}(rt),be=function(K){function _(C,N,Q){var G=K.call(this,C,N,Q)||this;return G.color="transparent",G.lineWidth=3,G.drawing=!1,G.pixelRatio=1,G.color=Q.defaultColor,G.lineWidth=Q.defaultStrokeWidth,G.pixelRatio=Q.freehandPixelRatio,G.setColor=G.setColor.bind(G),G.addCanvas=G.addCanvas.bind(G),G.finishCreation=G.finishCreation.bind(G),G.setLineWidth=G.setLineWidth.bind(G),G.colorPanel=new Ve("Color",Q.defaultColorSet,Q.defaultColor),G.colorPanel.onColorChanged=G.setColor,G.lineWidthPanel=new bt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),G.lineWidthPanel.onWidthChanged=G.setLineWidth,G}return Ee(_,K),_.prototype.ownsTarget=function(C){return!(!K.prototype.ownsTarget.call(this,C)&&C!==this.visual&&C!==this.drawingImage)},_.prototype.createVisual=function(){this.visual=se.createGroup(),this.drawingImage=se.createImage(),this.visual.appendChild(this.drawingImage);var C=se.createTransform();this.visual.transform.baseVal.appendItem(C),this.addMarkerVisualToContainer(this.visual)},_.prototype.pointerDown=function(C,N){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,N)},_.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)},_.prototype.resize=function(C){K.prototype.resize.call(this,C),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},_.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)},_.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)},_.prototype.select=function(){this.state==="creating"&&this.finishCreation(),K.prototype.select.call(this)},_.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),K.prototype.deselect.call(this)},_.prototype.finishCreation=function(){for(var C=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),N=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],Q=N[0],G=N[1],le=N[2],Ae=N[3],Me=!1,ot=0;ot<this.canvasElement.height;ot++)for(var Re=0;Re<this.canvasElement.width;Re++)C.data[ot*this.canvasElement.width*4+4*Re+3]>0&&(Me=!0,ot<G&&(G=ot),Re<Q&&(Q=Re),ot>Ae&&(Ae=ot),Re>le&&(le=Re));if(Me){this.left=Q/this.pixelRatio,this.top=G/this.pixelRatio,this.width=(le-Q)/this.pixelRatio,this.height=(Ae-G)/this.pixelRatio;var $e=document.createElement("canvas");$e.width=le-Q,$e.height=Ae-G,$e.getContext("2d").putImageData(this.canvasContext.getImageData(Q,G,le-Q,Ae-G),0,0),this.drawingImgUrl=$e.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},_.prototype.setDrawingImage=function(){se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},_.prototype.setColor=function(C){this.color=C,this.colorChanged(C)},_.prototype.setLineWidth=function(C){this.lineWidth=C},Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),_.prototype.getState=function(){var C=Object.assign({drawingImgUrl:this.drawingImgUrl},K.prototype.getState.call(this));return C.typeName=_.typeName,C},_.prototype.restoreState=function(C){this.createVisual(),K.prototype.restoreState.call(this,C),this.drawingImgUrl=C.drawingImgUrl,this.setDrawingImage()},_.prototype.scale=function(C,N){K.prototype.scale.call(this,C,N),this.setDrawingImage()},_.typeName="FreehandMarker",_.title="Freehand marker",_.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>',_}(rt),fe=function(K){function _(C,N,Q){var G=K.call(this,C,Q||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return G.typeBoxes=[],G.currentType=N,G.setCurrentType=G.setCurrentType.bind(G),G}return Ee(_,K),_.prototype.getUi=function(){var C=this,N=document.createElement("div");N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2";for(var Q=function(Ae){var Me="both";switch(Ae){case 0:Me="both";break;case 1:Me="start";break;case 2:Me="end";break;case 3:Me="none"}var ot=document.createElement("div");if(ot.style.display="flex",ot.style.flexGrow="2",ot.style.alignItems="center",ot.style.justifyContent="space-between",ot.style.padding="5px",ot.style.borderWidth="2px",ot.style.borderStyle="solid",ot.style.borderColor=Me===G.currentType?G.uiStyleSettings.toolboxAccentColor:"transparent",ot.addEventListener("click",function(){C.setCurrentType(Me,ot)}),N.appendChild(ot),Me==="both"||Me==="start"){var Re=document.createElement("div");Re.style.display="flex",Re.style.alignItems="center",Re.style.minHeight="20px",Re.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="`+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Re.style.marginLeft="5px",ot.appendChild(Re)}var $e=document.createElement("div");$e.style.display="flex",$e.style.alignItems="center",$e.style.minHeight="20px",$e.style.flexGrow="2";var ze=document.createElement("hr");if(ze.style.minWidth="20px",ze.style.border="0px",ze.style.borderTop="3px solid "+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee"),ze.style.flexGrow="2",$e.appendChild(ze),ot.appendChild($e),Me==="both"||Me==="end"){var xt=document.createElement("div");xt.style.display="flex",xt.style.alignItems="center",xt.style.minHeight="20px",xt.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="`+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,xt.style.marginRight="5px",ot.appendChild(xt)}G.typeBoxes.push(ot)},G=this,le=0;le<4;le++)Q(le);return N},_.prototype.setCurrentType=function(C,N){var Q=this;this.currentType=C,this.typeBoxes.forEach(function(G){G.style.borderColor=G===N?Q.uiStyleSettings!==void 0?Q.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},_}(Ze),pe=function(K){function _(C,N,Q){var G=K.call(this,C,N,Q)||this;return G.arrowType="end",G.arrowBaseHeight=10,G.arrowBaseWidth=10,G.getArrowPoints=G.getArrowPoints.bind(G),G.setArrowType=G.setArrowType.bind(G),G.arrowTypePanel=new fe("Arrow type","end"),G.arrowTypePanel.onArrowTypeChanged=G.setArrowType,G}return Ee(_,K),_.prototype.ownsTarget=function(C){return!(!K.prototype.ownsTarget.call(this,C)&&C!==this.arrow1&&C!==this.arrow2)},_.prototype.getArrowPoints=function(C,N){var Q=this.arrowBaseWidth+2*this.strokeWidth,G=this.arrowBaseHeight+2*this.strokeWidth;return C-Q/2+","+(N+G/2)+" "+C+","+(N-G/2)+" "+(C+Q/2)+","+(N+G/2)},_.prototype.createTips=function(){this.arrow1=se.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=se.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow2)},_.prototype.pointerDown=function(C,N){K.prototype.pointerDown.call(this,C,N),this.state==="creating"&&this.createTips()},_.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",se.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),se.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),N=this.arrow1.transform.baseVal.getItem(0);N.setRotate(C,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(N,0);var Q=this.arrow2.transform.baseVal.getItem(0);Q.setRotate(C+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(Q,0)}},_.prototype.setArrowType=function(C){this.arrowType=C,this.adjustVisual(),this.stateChanged()},Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),_.prototype.getState=function(){var C=Object.assign({arrowType:this.arrowType},K.prototype.getState.call(this));return C.typeName=_.typeName,C},_.prototype.restoreState=function(C){K.prototype.restoreState.call(this,C);var N=C;this.arrowType=N.arrowType,this.createTips(),this.adjustVisual()},_.typeName="ArrowMarker",_.title="Arrow marker",_.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',_}(nt),ie=function(K){function _(C,N,Q){var G=K.call(this,C,N,Q)||this;return G.fillColor=Q.defaultFillColor,G.strokeWidth=0,G.fillPanel=new Ve("Color",Q.defaultColorSet,Q.defaultFillColor),G.fillPanel.onColorChanged=G.setFillColor,G}return Ee(_,K),Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),_.prototype.getState=function(){var C=K.prototype.getState.call(this);return C.typeName=_.typeName,C},_.typeName="CoverMarker",_.title="Cover marker",_.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',_}(dt),re=function(K){function _(C,N,Q,G){var le=K.call(this,C,G||'<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 le.opacities=[],le.opacityBoxes=[],le.opacities=N,le.currentOpacity=Q,le.setCurrentOpacity=le.setCurrentOpacity.bind(le),le}return Ee(_,K),_.prototype.getUi=function(){var C=this,N=document.createElement("div");return N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2",N.style.justifyContent="space-between",this.opacities.forEach(function(Q){var G=document.createElement("div");G.style.display="flex",G.style.alignItems="center",G.style.justifyContent="center",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.borderColor=Q===C.currentOpacity?C.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){C.setCurrentOpacity(Q,G)}),N.appendChild(G);var le=document.createElement("div");le.innerText=100*Q+"%",G.appendChild(le),C.opacityBoxes.push(G)}),N},_.prototype.setCurrentOpacity=function(C,N){var Q=this;this.currentOpacity=C,this.opacityBoxes.forEach(function(G){G.style.borderColor=G===N?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},_}(Ze),ue=function(K){function _(C,N,Q){var G=K.call(this,C,N,Q)||this;return G.setOpacity=G.setOpacity.bind(G),G.fillColor=Q.defaultHighlightColor,G.strokeWidth=0,G.opacity=Q.defaultHighlightOpacity,G.fillPanel=new Ve("Color",Q.defaultColorSet,G.fillColor),G.fillPanel.onColorChanged=G.setFillColor,G.opacityPanel=new re("Opacity",Q.defaultOpacitySteps,G.opacity),G.opacityPanel.onOpacityChanged=G.setOpacity,G}return Ee(_,K),_.prototype.setOpacity=function(C){this.opacity=C,this.visual&&se.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),_.prototype.getState=function(){var C=K.prototype.getState.call(this);return C.typeName=_.typeName,C},_.typeName="HighlightMarker",_.title="Highlight marker",_.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>',_}(ie),ge='<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>',ye=function(K){function _(C,N,Q){var G=K.call(this,C,N,Q)||this;return G.bgColor="transparent",G.tipPosition={x:0,y:0},G.tipBase1Position={x:0,y:0},G.tipBase2Position={x:0,y:0},G.tipMoving=!1,G.color=Q.defaultStrokeColor,G.bgColor=Q.defaultFillColor,G.fontFamily=Q.defaultFontFamily,G.defaultSize={x:100,y:30},G.setBgColor=G.setBgColor.bind(G),G.getTipPoints=G.getTipPoints.bind(G),G.positionTip=G.positionTip.bind(G),G.setTipPoints=G.setTipPoints.bind(G),G.colorPanel=new Ve("Text color",Q.defaultColorSet,G.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>'),G.colorPanel.onColorChanged=G.setColor,G.bgColorPanel=new Ve("Fill color",Q.defaultColorSet,G.bgColor,ge),G.bgColorPanel.onColorChanged=G.setBgColor,G.fontFamilyPanel=new Oe("Font",Q.defaultFontFamilies,Q.defaultFontFamily),G.fontFamilyPanel.onFontChanged=G.setFont,G.tipGrip=new ft,G.tipGrip.visual.transform.baseVal.appendItem(se.createTransform()),G.controlBox.appendChild(G.tipGrip.visual),G}return Ee(_,K),_.prototype.ownsTarget=function(C){return K.prototype.ownsTarget.call(this,C)||this.tipGrip.ownsTarget(C)||this.tip===C},_.prototype.createTip=function(){se.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=se.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},_.prototype.pointerDown=function(C,N){this.state==="new"&&K.prototype.pointerDown.call(this,C,N),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(N)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):K.prototype.pointerDown.call(this,C,N)},_.prototype.pointerUp=function(C){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,K.prototype.pointerUp.call(this,C);else{var N=this.state==="creating";K.prototype.pointerUp.call(this,C),this.setTipPoints(N),this.positionTip()}},_.prototype.manipulate=function(C){if(this.tipMoving){var N=this.unrotatePoint(C);this.tipPosition={x:N.x-this.manipulationStartLeft,y:N.y-this.manipulationStartTop},this.positionTip()}else K.prototype.manipulate.call(this,C)},_.prototype.setBgColor=function(C){this.bgRectangle&&this.tip&&(se.setAttributes(this.bgRectangle,[["fill",C]]),se.setAttributes(this.tip,[["fill",C]])),this.bgColor=C,this.fillColorChanged(C)},_.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},_.prototype.setTipPoints=function(C){C===void 0&&(C=!1);var N=Math.min(this.height/2,15),Q=this.height/5;C&&(this.tipPosition={x:N+Q/2,y:this.height+20});var G=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?G<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(Q=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:N,y:0},this.tipBase2Position={x:N+Q,y:0}):(this.tipBase1Position={x:0,y:N},this.tipBase2Position={x:0,y:N+Q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?G<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(Q=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-N-Q,y:0},this.tipBase2Position={x:this.width-N,y:0}):(this.tipBase1Position={x:this.width,y:N},this.tipBase2Position={x:this.width,y:N+Q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?G<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(Q=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-N-Q,y:this.height},this.tipBase2Position={x:this.width-N,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-N-Q},this.tipBase2Position={x:this.width,y:this.height-N}):G<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(Q=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:N,y:this.height},this.tipBase2Position={x:N+Q,y:this.height}):(this.tipBase1Position={x:0,y:this.height-N},this.tipBase2Position={x:0,y:this.height-N-Q})},_.prototype.resize=function(C){K.prototype.resize.call(this,C),this.positionTip()},_.prototype.positionTip=function(){se.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(_.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),_.prototype.select=function(){this.positionTip(),K.prototype.select.call(this)},_.prototype.getState=function(){var C=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},K.prototype.getState.call(this));return C.typeName=_.typeName,C},_.prototype.restoreState=function(C){var N=C;this.bgColor=N.bgColor,this.tipPosition=N.tipPosition,K.prototype.restoreState.call(this,C),this.createTip(),this.setTipPoints()},_.prototype.scale=function(C,N){K.prototype.scale.call(this,C,N),this.tipPosition={x:this.tipPosition.x*C,y:this.tipPosition.y*N},this.positionTip()},_.typeName="CalloutMarker",_.title="Callout marker",_.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>',_}(Ge),Le=function(K){function _(C,N,Q){var G=K.call(this,C,N,Q)||this;return G.fillColor="transparent",G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.opacity=1,G.strokeColor=Q.defaultColor,G.strokeWidth=Q.defaultStrokeWidth,G.strokeDasharray=Q.defaultStrokeDasharray,G.fillColor=Q.defaultFillColor,G.setStrokeColor=G.setStrokeColor.bind(G),G.setFillColor=G.setFillColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.setOpacity=G.setOpacity.bind(G),G.createVisual=G.createVisual.bind(G),G.strokePanel=new Ve("Line color",ce(Q.defaultColorSet,["transparent"]),Q.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.fillPanel=new Ve("Fill color",ce(Q.defaultColorSet,["transparent"]),G.fillColor,ge),G.fillPanel.onColorChanged=G.setFillColor,G.strokeWidthPanel=new bt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new ut("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G.opacityPanel=new re("Opacity",Q.defaultOpacitySteps,G.opacity),G.opacityPanel.onOpacityChanged=G.setOpacity,G}return Ee(_,K),_.prototype.ownsTarget=function(C){return!(!K.prototype.ownsTarget.call(this,C)&&C!==this.visual)},_.prototype.createVisual=function(){this.visual=se.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)},_.prototype.pointerDown=function(C,N){K.prototype.pointerDown.call(this,C,N),this.state==="new"&&(this.createVisual(),this.moveVisual(C),this._state="creating")},_.prototype.manipulate=function(C){K.prototype.manipulate.call(this,C)},_.prototype.resize=function(C){K.prototype.resize.call(this,C),this.setSize()},_.prototype.setSize=function(){K.prototype.setSize.call(this),se.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},_.prototype.pointerUp=function(C){K.prototype.pointerUp.call(this,C),this.setSize()},_.prototype.setStrokeColor=function(C){this.strokeColor=C,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(C),this.stateChanged()},_.prototype.setFillColor=function(C){this.fillColor=C,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(C),this.stateChanged()},_.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},_.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},_.prototype.setOpacity=function(C){this.opacity=C,this.visual&&se.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),_.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=_.typeName,C},_.prototype.restoreState=function(C){var N=C;this.fillColor=N.fillColor,this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.opacity=N.opacity,this.createVisual(),K.prototype.restoreState.call(this,C),this.setSize()},_.prototype.scale=function(C,N){K.prototype.scale.call(this,C,N),this.setSize()},_.typeName="EllipseMarker",_.title="Ellipse marker",_.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>',_}(rt),Be=function(K){function _(C,N,Q){return K.call(this,C,N,Q)||this}return Ee(_,K),Object.defineProperty(_.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),_.prototype.ownsTarget=function(C){return!(!K.prototype.ownsTarget.call(this,C)&&C!==this.tip1&&C!==this.tip2)},_.prototype.createTips=function(){this.tip1=se.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(se.createTransform()),this.visual.appendChild(this.tip1),this.tip2=se.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(se.createTransform()),this.visual.appendChild(this.tip2)},_.prototype.pointerDown=function(C,N){K.prototype.pointerDown.call(this,C,N),this.state==="creating"&&this.createTips()},_.prototype.adjustVisual=function(){if(K.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(se.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()]]),se.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),N=this.tip1.transform.baseVal.getItem(0);N.setRotate(C,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(N,0);var Q=this.tip2.transform.baseVal.getItem(0);Q.setRotate(C+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(Q,0)}},Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),_.prototype.getState=function(){var C=K.prototype.getState.call(this);return C.typeName=_.typeName,C},_.prototype.restoreState=function(C){K.prototype.restoreState.call(this,C),this.createTips(),this.adjustVisual()},_.typeName="MeasurementMarker",_.title="Measurement marker",_.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>',_}(nt),pt=function(K){function _(C,N,Q){var G=K.call(this,C,N,Q)||this;return G.strokePanel.colors=Q.defaultColorSet,G.fillColor="transparent",G}return Ee(_,K),Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),_.prototype.getState=function(){var C=K.prototype.getState.call(this);return C.typeName=_.typeName,C},_.typeName="EllipseFrameMarker",_.title="Ellipse frame marker",_.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>',_}(Le),It=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(_){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(_)||(this.undoStack.push(_),JSON.stringify(this.lastRedoStep)!==JSON.stringify(_)&&this.redoStack.splice(0,this.redoStack.length))},K.prototype.replaceLastUndoStep=function(_){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=_)},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 _=this.undoStack.pop();return _!==void 0&&this.redoStack.push(_),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}(),Lt=function(K){function _(C,N,Q){var G=K.call(this,C,N,Q)||this;return G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.curveX=0,G.curveY=0,G.manipulationStartCurveX=0,G.manipulationStartCurveY=0,G.setStrokeColor=G.setStrokeColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.positionGrips=G.positionGrips.bind(G),G.addControlGrips=G.addControlGrips.bind(G),G.adjustVisual=G.adjustVisual.bind(G),G.setupControlBox=G.setupControlBox.bind(G),G.resize=G.resize.bind(G),G.strokeColor=Q.defaultColor,G.strokeWidth=Q.defaultStrokeWidth,G.strokeDasharray=Q.defaultStrokeDasharray,G.strokePanel=new Ve("Line color",Q.defaultColorSet,Q.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new bt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new ut("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Ee(_,K),_.prototype.ownsTarget=function(C){return!(!K.prototype.ownsTarget.call(this,C)&&C!==this.visual&&C!==this.selectorCurve&&C!==this.visibleCurve&&!this.curveGrip.ownsTarget(C))},_.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},_.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorCurve=se.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=se.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)},_.prototype.pointerDown=function(C,N){K.prototype.pointerDown.call(this,C,N),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(N)&&(this.activeGrip=this.curveGrip,this._state="resize")},_.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),se.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},_.prototype.setupControlBox=function(){K.prototype.setupControlBox.call(this),this.curveControlLine1=se.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=se.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)},_.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,K.prototype.addControlGrips.call(this)},_.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()))},_.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)},_.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)},_.prototype.setStrokeColor=function(C){this.strokeColor=C,this.adjustVisual(),this.colorChanged(C)},_.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.adjustVisual()},_.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.adjustVisual()},_.prototype.scale=function(C,N){this.curveX=this.curveX*C,this.curveY=this.curveY*N,K.prototype.scale.call(this,C,N)},Object.defineProperty(_.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),_.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=_.typeName,C},_.prototype.restoreState=function(C){K.prototype.restoreState.call(this,C);var N=C;this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.curveX=N.curveX,this.curveY=N.curveY,this.createVisual(),this.adjustVisual()},_.typeName="CurveMarker",_.title="Curve marker",_.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>',_}(yt),Vt=function(){function K(_,C){C===void 0&&(C=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=_,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}(),tt=function(K){function _(C,N,Q){var G=K.call(this,C,!1)||this;return G.dataUrl=N,G.state=Q,G}return Ee(_,K),_}(Vt),ke=function(K){function _(C,N,Q){Q===void 0&&(Q=!1);var G=K.call(this,C,Q)||this;return G.marker=N,G}return Ee(_,K),_}(Vt),Ct=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(_,C){this[_].push(C)},K.prototype.removeEventListener=function(_,C){var N=this[_].indexOf(C);N>-1&&this[_].splice(N,1)},K}(),Rt=function(){function K(_){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Ie,this._isOpen=!1,this.undoRedoManager=new It,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 Ct,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=K.instanceCounter++,this.styles=new Xe(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=_,this.targetRoot=document.body,this.width=_.clientWidth,this.height=_.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[at,be,pe,Ge,pt,Le,ue,ye,Be,ie,nt,Lt]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[at,be,pe,Ge,Le,ue,ye]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"BASIC_MARKER_TYPES",{get:function(){return[at,be,pe,Ge,ue]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(_){var C=this;this._availableMarkerTypes.splice(0),_.forEach(function(N){if(typeof N=="string"){var Q=C.ALL_MARKER_TYPES.find(function(G){return G.typeName===N});Q!==void 0&&C._availableMarkerTypes.push(Q)}else C._availableMarkerTypes.push(N)})},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(_){this._zoomLevel=_,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(),Se.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},K.prototype.show=function(){var _=this;this.styles.styleSheetRoot===void 0&&We.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=We.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(C){return C(new Vt(_))})},K.prototype.render=function(){return Te(this,void 0,void 0,function(){var _;return me(this,function(C){switch(C.label){case 0:return this.setCurrentMarker(),(_=new je).naturalSize=this.renderAtNaturalSize,_.imageType=this.renderImageType,_.imageQuality=this.renderImageQuality,_.markersOnly=this.renderMarkersOnly,_.width=this.renderWidth,_.height=this.renderHeight,[4,_.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return C.sent(),[4,_.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,C.sent()]}})})},K.prototype.close=function(_){var C=this;if(_===void 0&&(_=!1),this.isOpen){var N=!1;_||this.eventListeners.beforeclose.forEach(function(Q){var G=new Vt(C,!0);Q(G),G.defaultPrevented&&(N=!0)}),N||(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(Q){return Q(new Vt(C))}),this.detachEvents(),this._isOpen=!1)}},K.prototype.addMarkersToToolbar=function(){for(var _,C=[],N=0;N<arguments.length;N++)C[N]=arguments[N];(_=this._availableMarkerTypes).push.apply(_,C)},K.prototype.addRenderEventListener=function(_){this.addEventListener("render",function(C){_(C.dataUrl,C.state)})},K.prototype.removeRenderEventListener=function(_){},K.prototype.addCloseEventListener=function(_){this.addEventListener("close",function(){_()})},K.prototype.removeCloseEventListener=function(_){},K.prototype.setupResizeObserver=function(){var _=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){_.resize(_.target.clientWidth,_.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return _.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},K.prototype.onPopupTargetResize=function(){var _=1*this.target.clientWidth/this.target.clientHeight,C=this.editorCanvas.clientWidth/_>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*_:this.editorCanvas.clientWidth,N=C<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/_;this.resize(C,N)},K.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},K.prototype.resize=function(_,C){this._isResizing=!0;var N=_/this.imageWidth,Q=C/this.imageHeight;this.imageWidth=Math.round(_),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(N,Q),this._isResizing=!1},K.prototype.scaleMarkers=function(_,C){var N,Q=this;this._currentMarker&&this._currentMarker instanceof Ge?this._currentMarker.scale(_,C):(N=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(G){G!==Q._currentMarker&&G.scale(_,C)}),N!==void 0&&this.setCurrentMarker(N)},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 _=this.editingTarget.getBoundingClientRect(),C=this.editorCanvas.getBoundingClientRect();this.left=_.left-C.left,this.top=_.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 _,C=[],N=0;N<arguments.length;N++)C[N]=arguments[N];this.defs=se.createDefs(),this.addDefsToImage(),(_=this.defs).append.apply(_,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 _=document.createElement("a");_.href="https://markerjs.com/",_.target="_blank",_.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>',_.title="Powered by marker.js",_.style.display="grid",_.style.alignItems="center",_.style.justifyItems="center",_.style.padding="3px",_.style.width="20px",_.style.height="20px",this.logoUI.appendChild(_),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 _=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=_+"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 Ue(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 Ye(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(_){this.markerImage.removeChild(_.container),this.markers.indexOf(_)>-1&&this.markers.splice(this.markers.indexOf(_),1),_.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(_,C){if(_==="marker"&&C!==void 0)this.createNewMarker(C);else if(_==="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 _=this;if(this._currentMarker!==void 0){var C=!1;if(this.eventListeners.markerbeforedelete.forEach(function(Q){var G=new ke(_,_._currentMarker,!0);Q(G),G.defaultPrevented&&(C=!0)}),!C){var N=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(Q){return Q(new ke(_,N))})}}},K.prototype.clear=function(){var _=this,C=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(le){var Ae=new ke(_,void 0,!0);le(Ae),Ae.defaultPrevented&&(C=!0)}),!C)){this.setCurrentMarker();for(var N=function(le){var Ae=Q.markers[le];Q.setCurrentMarker(Q.markers[le]),Q._currentMarker.dispose(),Q.markerImage.removeChild(Q._currentMarker.container),Q.markers.splice(Q.markers.indexOf(Q._currentMarker),1),Q.eventListeners.markerdelete.forEach(function(Me){return Me(new ke(_,Ae))})},Q=this,G=this.markers.length-1;G>=0;G--)N(G);this.addUndoStep()}},Object.defineProperty(K.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),K.prototype.showNotesEditor=function(){var _;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=(_=this._currentMarker.notes)!==null&&_!==void 0?_:"",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 _=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var C=this.getState(),N=this.undoRedoManager.getLastUndoStep();if(!N||N.width===C.width&&N.height===C.height){var Q=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(C),Q<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(G){return G(new Vt(_))})}else this.undoRedoManager.replaceLastUndoStep(C),this.eventListeners.statechange.forEach(function(G){return G(new Vt(_))})}},K.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},K.prototype.undoStep=function(){var _=this,C=this.undoRedoManager.undo();C!==void 0&&(this.restoreState(C),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(N){return N(new Vt(_))}))},K.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},K.prototype.redoStep=function(){var _=this,C=this.undoRedoManager.redo();C!==void 0&&(this.restoreState(C),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(N){return N(new Vt(_))}))},K.prototype.stepZoom=function(){var _=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=_<this.zoomSteps.length-1?this.zoomSteps[_+1]:this.zoomSteps[0]},K.prototype.panTo=function(_){this.contentDiv.scrollBy({left:this.prevPanPoint.x-_.x,top:this.prevPanPoint.y-_.y}),this.prevPanPoint=_},K.prototype.startRenderAndClose=function(){return Te(this,void 0,void 0,function(){var _,C,N=this;return me(this,function(Q){switch(Q.label){case 0:return[4,this.render()];case 1:return _=Q.sent(),C=this.getState(),this.eventListeners.render.forEach(function(G){return G(new tt(N,_,C))}),this.close(!0),[2]}})})},K.prototype.getState=function(_){_===!0&&this.setCurrentMarker();var C={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(N){return C.markers.push(N.getState())}),C},K.prototype.restoreState=function(_){var C=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);_.markers.forEach(function(N){var Q=C._availableMarkerTypes.find(function(le){return le.typeName===N.typeName});if(Q!==void 0){var G=C.addNewMarker(Q);G.restoreState(N),C.markers.push(G)}}),_.width&&_.height&&(_.width!==this.imageWidth||_.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/_.width,this.imageHeight/_.height),this.eventListeners.restorestate.forEach(function(N){return N(new Vt(C))})},K.prototype.addNewMarker=function(_){var C=se.createGroup();return this.markerImage.appendChild(C),new _(C,this.overlayContainer,this.settings)},K.prototype.createNewMarker=function(_){var C,N=this;(C=typeof _=="string"?this._availableMarkerTypes.find(function(Q){return Q.typeName===_}):_)&&(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(Q){return Q(new ke(N,N._currentMarker))}))},K.prototype.markerCreated=function(_){var C=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(_),this.setCurrentMarker(_),_ instanceof be&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(be):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(N){return N(new ke(C,C._currentMarker))})},K.prototype.colorChanged=function(_){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=_,this.settings.defaultStrokeColor=_)},K.prototype.fillColorChanged=function(_){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=_)},K.prototype.markerStateChanged=function(_){var C=this;this.eventListeners.markerchange.forEach(function(N){return N(new ke(C,_))})},K.prototype.setCurrentMarker=function(_){var C=this;this._currentMarker!==_&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(N){return N(new ke(C,C._currentMarker))})),this._currentMarker=_,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(N){return N(new ke(C,C._currentMarker))}))},K.prototype.onPointerDown=function(_){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||_.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(N){return N.ownsTarget(_.target)});C!==void 0?(this.setCurrentMarker(C),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(_.clientX,_.clientY),_.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:_.clientX,y:_.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(_.clientX,_.clientY))},K.prototype.onDblClick=function(_){if(this._isFocused||this.focus(),this.mode==="select"){var C=this.markers.find(function(N){return N.ownsTarget(_.target)});C!==void 0&&C!==this._currentMarker&&this.setCurrentMarker(C),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(_.clientX,_.clientY),_.target):this.setCurrentMarker()}},K.prototype.onPointerMove=function(_){this.touchPoints!==1&&_.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||_.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(_.clientX,_.clientY)):this.zoomLevel>1&&this.panTo({x:_.clientX,y:_.clientY}))},K.prototype.onPointerUp=function(_){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(_.clientX,_.clientY)),this.isDragging=!1,this.addUndoStep()},K.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},K.prototype.onKeyUp=function(_){this._currentMarker===void 0||this.notesArea!==void 0||_.key!=="Delete"&&_.key!=="Backspace"||this.deleteSelectedMarker()},K.prototype.clientToLocalCoordinates=function(_,C){var N=this.markerImage.getBoundingClientRect();return{x:(_-N.left)/this.zoomLevel,y:(C-N.top)/this.zoomLevel}},K.prototype.onWindowResize=function(){this.positionUI()},K.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var _=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=_+"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(_){Se.addKey(_)},K.prototype.addEventListener=function(_,C){this.eventListeners.addEventListener(_,C)},K.prototype.removeEventListener=function(_,C){this.eventListeners.removeEventListener(_,C)},K.prototype.renderState=function(_){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(_),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(K.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),K.prototype.focus=function(){var _=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 Vt(_))}))},K.prototype.blur=function(){var _=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(C){return C(new Vt(_))}))},K.instanceCounter=0,K}();/* **********************************
|
|
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 ni=function(K,_){return(ni=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,N){C.__proto__=N}||function(C,N){for(var Q in N)Object.prototype.hasOwnProperty.call(N,Q)&&(C[Q]=N[Q])})(K,_)};function Qt(K,_){if(typeof _!="function"&&_!==null)throw new TypeError("Class extends value "+String(_)+" is not a constructor or null");function C(){this.constructor=K}ni(K,_),K.prototype=_===null?Object.create(_):(C.prototype=_.prototype,new C)}function Tt(K,_,C,N){return new(C||(C=Promise))(function(Q,G){function le(ot){try{Me(N.next(ot))}catch(Re){G(Re)}}function Ae(ot){try{Me(N.throw(ot))}catch(Re){G(Re)}}function Me(ot){var Re;ot.done?Q(ot.value):(Re=ot.value,Re instanceof C?Re:new C(function($e){$e(Re)})).then(le,Ae)}Me((N=N.apply(K,_||[])).next())})}function qe(K,_){var C,N,Q,G,le={label:0,sent:function(){if(1&Q[0])throw Q[1];return Q[1]},trys:[],ops:[]};return G={next:Ae(0),throw:Ae(1),return:Ae(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function Ae(Me){return function(ot){return function(Re){if(C)throw new TypeError("Generator is already executing.");for(;le;)try{if(C=1,N&&(Q=2&Re[0]?N.return:Re[0]?N.throw||((Q=N.return)&&Q.call(N),0):N.next)&&!(Q=Q.call(N,Re[1])).done)return Q;switch(N=0,Q&&(Re=[2&Re[0],Q.value]),Re[0]){case 0:case 1:Q=Re;break;case 4:return le.label++,{value:Re[1],done:!1};case 5:le.label++,N=Re[1],Re=[0];continue;case 7:Re=le.ops.pop(),le.trys.pop();continue;default:if(!(Q=le.trys,(Q=Q.length>0&&Q[Q.length-1])||Re[0]!==6&&Re[0]!==2)){le=0;continue}if(Re[0]===3&&(!Q||Re[1]>Q[0]&&Re[1]<Q[3])){le.label=Re[1];break}if(Re[0]===6&&le.label<Q[1]){le.label=Q[1],Q=Re;break}if(Q&&le.label<Q[2]){le.label=Q[2],le.ops.push(Re);break}Q[2]&&le.ops.pop(),le.trys.pop();continue}Re=_.call(K,le)}catch($e){Re=[6,$e],N=0}finally{C=Q=0}if(5&Re[0])throw Re[1];return{value:Re[0]?Re[1]:void 0,done:!0}}([Me,ot])}}}var Oi=function(){function K(){}return K.addKey=function(_){K.key=_},Object.defineProperty(K,"isLicensed",{get:function(){return!!K.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(K.key)},enumerable:!1,configurable:!0}),K}(),xe=function(){function K(){}return K.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},K.setAttributes=function(_,C){for(var N=0,Q=C;N<Q.length;N++){var G=Q[N],le=G[0],Ae=G[1];_.setAttribute(le,Ae)}},K.createRect=function(_,C,N){var Q=document.createElementNS("http://www.w3.org/2000/svg","rect");return Q.setAttribute("width",_.toString()),Q.setAttribute("height",C.toString()),N&&K.setAttributes(Q,N),Q},K.createLine=function(_,C,N,Q,G){var le=document.createElementNS("http://www.w3.org/2000/svg","line");return le.setAttribute("x1",_.toString()),le.setAttribute("y1",C.toString()),le.setAttribute("x2",N.toString()),le.setAttribute("y2",Q.toString()),G&&K.setAttributes(le,G),le},K.createPolygon=function(_,C){var N=document.createElementNS("http://www.w3.org/2000/svg","polygon");return N.setAttribute("points",_),C&&K.setAttributes(N,C),N},K.createCircle=function(_,C){var N=document.createElementNS("http://www.w3.org/2000/svg","circle");return N.setAttribute("cx",(_/2).toString()),N.setAttribute("cy",(_/2).toString()),N.setAttribute("r",_.toString()),C&&K.setAttributes(N,C),N},K.createEllipse=function(_,C,N){var Q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Q.setAttribute("cx",(_/2).toString()),Q.setAttribute("cy",(C/2).toString()),Q.setAttribute("rx",(_/2).toString()),Q.setAttribute("ry",(C/2).toString()),N&&K.setAttributes(Q,N),Q},K.createGroup=function(_){var C=document.createElementNS("http://www.w3.org/2000/svg","g");return _&&K.setAttributes(C,_),C},K.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},K.createMarker=function(_,C,N,Q,G,le,Ae){var Me=document.createElementNS("http://www.w3.org/2000/svg","marker");return K.setAttributes(Me,[["id",_],["orient",C],["markerWidth",N.toString()],["markerHeight",Q.toString()],["refX",G.toString()],["refY",le.toString()]]),Me.appendChild(Ae),Me},K.createText=function(_){var C=document.createElementNS("http://www.w3.org/2000/svg","text");return C.setAttribute("x","0"),C.setAttribute("y","0"),_&&K.setAttributes(C,_),C},K.createTSpan=function(_,C){var N=document.createElementNS("http://www.w3.org/2000/svg","tspan");return N.textContent=_,C&&K.setAttributes(N,C),N},K.createImage=function(_){var C=document.createElementNS("http://www.w3.org/2000/svg","image");return _&&K.setAttributes(C,_),C},K.createPoint=function(_,C){var N=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return N.x=_,N.y=C,N},K.createPath=function(_,C){var N=document.createElementNS("http://www.w3.org/2000/svg","path");return N.setAttribute("d",_),C&&K.setAttributes(N,C),N},K.createElement=function(_,C){var N=document.createElementNS("http://www.w3.org/2000/svg",_);return C&&K.setAttributes(N,C),N},K.getHollowRectanglePath=function(_,C,N,Q,G,le,Ae,Me){return"M"+_+","+C+"V"+(C+Q)+"H"+(_+N)+"V"+C+"H"+G+"V"+le+"H"+(G+Ae)+"V"+(le+Me)+"H"+G+"V"+C+"Z"},K}(),Dt=function(){function K(_){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+_+"_"}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:"#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(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(_){return this.styleSheet===void 0&&this.addStyleSheet(),_.name=""+this.classNamePrefix+_.localName,this.classes.push(_),this.styleSheet.sheet.insertRule("."+_.name+" {"+_.style+"}",this.styleSheet.sheet.cssRules.length),_},K.prototype.addRule=function(_){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(_),this.styleSheet.sheet.insertRule(_.selector+" {"+_.style+"}",this.styleSheet.sheet.cssRules.length)},K.prototype.addStyleSheet=function(){var _;this.styleSheet=document.createElement("style"),((_=this.styleSheetRoot)!==null&&_!==void 0?_:document.head).appendChild(this.styleSheet),this.addRule(new Ut("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Ut("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new Ut("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Ft("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Ft("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},K.prototype.removeStyleSheet=function(){var _;this.styleSheet&&(((_=this.styleSheetRoot)!==null&&_!==void 0?_:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},K}(),Ut=function(K,_){this.selector=K,this.style=_},Ft=function(K,_){this.localName=K,this.style=_},At=function(){function K(){this.blocks=[],this.display=""}return K.prototype.addButtonBlock=function(_){_.className=this.blockClassName,_.buttonClassName=this.buttonClassName,_.buttonColorsClassName=this.buttonColorsClassName,_.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(_)},K.prototype.addElementBlock=function(_){_.className===void 0&&(_.className=this.blockClassName),this.blocks.push(_)},K.prototype.getUI=function(){var _=document.createElement("div");return _.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,_.style.display=this.display,this.blocks.forEach(function(C){return _.appendChild(C.getUI())}),_},K}(),ei=function(){function K(){}return K.prototype.getUI=function(){var _=document.createElement("div");if(_.className=this.className,this.minWidth!==void 0&&(_.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":_.style.justifyContent="flex-start";break;case"center":_.style.justifyContent="center";break;case"end":_.style.justifyContent="flex-end"}return _.style.whiteSpace="nowrap",_},K}(),di=function(K){function _(){var C=K!==null&&K.apply(this,arguments)||this;return C.buttons=[],C}return Qt(_,K),_.prototype.addButton=function(C){C.className=this.buttonClassName,C.colorsClassName=this.buttonColorsClassName,C.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(C)},_.prototype.getUI=function(){var C=K.prototype.getUI.call(this);return this.buttons.forEach(function(N){return C.appendChild(N.getUI())}),C},_}(ei),Bt=function(){function K(_,C){this._isActive=!1,this._isHidden=!1,this._icon=_,this.title=C,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(K.prototype,"icon",{get:function(){return this._icon},set:function(_){this._icon=_,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isActive",{get:function(){return this._isActive},set:function(_){this._isActive=_,this.adjustClassName()},enumerable:!1,configurable:!0}),K.prototype.getUI=function(){var _=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 _.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},K.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,"")))},K.prototype.hide=function(){this._isHidden=!0},K}(),it=function(K){function _(){var C=K!==null&&K.apply(this,arguments)||this;return C.elements=[],C}return Qt(_,K),_.prototype.addElement=function(C){this.elements.push(C)},_.prototype.getUI=function(){var C=K.prototype.getUI.call(this);return this.elements.forEach(function(N){return C.appendChild(N)}),C},_}(ei),fi=function(){function K(_,C){this.horizontal=_,this.vertical=C}return Object.defineProperty(K.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),K.prototype.getVerticalLength=function(_){return _/this.ratio},K.prototype.getHorizontalLength=function(_){return _*this.ratio},K}(),ri=function(){function K(){}return K.getIcon=function(_,C){if(_>0&&C>0){var N=new fi(_,C),Q=N.ratio>=1?20:N.getHorizontalLength(20),G=N.ratio<1?20:N.getVerticalLength(20),le=document.createElementNS("http://www.w3.org/2000/svg","svg");le.setAttribute("xmlns","http://www.w3.org/2000/svg"),le.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(le);var Ae=xe.createDefs();le.appendChild(Ae);var Me=xe.createElement("clipPath",[["id","text-bg-clip"]]);Ae.appendChild(Me);var ot=xe.createPath(xe.getHollowRectanglePath((24-Q)/2,(24-G)/2,Q,G,(24-Q)/2+2,(24-G)/2+2,Q-4,G-4));le.appendChild(ot);var Re=xe.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Re.appendChild(xe.createTSpan(_+":"+C)),le.appendChild(Re);var $e=Re.getBBox();xe.setAttributes(Re,[["x",((24-$e.width)/2).toString()],["y",((24-$e.height)/2-$e.y).toString()]]);var ze=xe.createPath(xe.getHollowRectanglePath(0,0,24,24,(24-Math.ceil($e.width))/2,(24-Math.ceil($e.height))/2,Math.ceil($e.width),Math.ceil($e.height)));return Me.appendChild(ze),xe.setAttributes(ot,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(le),le.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>'},K}(),Kt=function(K){function _(C,N,Q){var G=K.call(this,C,N)||this;return G.isDropdownOpen=!1,G.onClick=G.dropdownButtonClicked,G.dropdownButtons=Q,G}return Qt(_,K),_.prototype.setupDropdown=function(){var C=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(N){N.className=C.className,N.colorsClassName=C.colorsClassName,C.dropdownBlock.appendChild(N.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},_.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},_.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},_.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},_.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},_.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},_}(Bt),Et=function(){function K(_,C){this.GRIP_SIZE=10,this.color=_,this.fillColor=C,this.visual=xe.createGroup(),this.visual.appendChild(xe.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(xe.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return K.prototype.ownsTarget=function(_){return _===this.visual||_===this.visual.childNodes[0]||_===this.visual.childNodes[1]},K.prototype.setCenter=function(_,C){this.visual.childNodes.forEach(function(N){return xe.setAttributes(N,[["cx",_.toString()],["cy",C.toString()]])})},K}(),Nt=function(){function K(_,C,N,Q){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=_,this.canvasHeight=C,this.margin=N,this.container=Q,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(K.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(_){this._aspectRatio=_,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(_){this._isGridVisible=_,this.gridContainer&&xe.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(_){this._zoomFactor=_,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),K.prototype.open=function(){var _=this;this.cropShadeElement=xe.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=xe.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var C=0;C<this.numberOfGridLines;C++)this.horizontalGridLines.push(xe.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(xe.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(N){return _.gridContainer.appendChild(N)}),this.verticalGridLines.forEach(function(N){return _.gridContainer.appendChild(N)}),this.cropRectElement=xe.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Et(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Et(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Et(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Et(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},K.prototype.setCropRectangle=function(_){this.cropRect=_;var C=Object.assign({},this.cropRect);this.zoomFactor!==1&&(C.width=this.cropRect.width*this.zoomFactor,C.height=this.cropRect.height*this.zoomFactor,C.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-C.width/2,C.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-C.height/2),xe.setAttributes(this.cropRectElement,[["x",C.x.toString()],["y",C.y.toString()],["width",C.width.toString()],["height",C.height.toString()]]);var N=C.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(G,le){var Ae=C.y+N*(le+1);xe.setAttributes(G,[["x1",""+C.x],["y1",""+Ae],["x2",""+(C.x+C.width)],["y2",""+Ae]])});var Q=C.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(G,le){var Ae=C.x+Q*(le+1);xe.setAttributes(G,[["x1",""+Ae],["y1",""+C.y],["x2",""+Ae],["y2",""+(C.y+C.height)]])}),xe.setAttributes(this.cropShadeElement,[["d",xe.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,C.x,C.y,C.width,C.height)]]),this.topLeftGrip.setCenter(C.x,C.y),this.topRightGrip.setCenter(C.x+C.width,C.y),this.bottomLeftGrip.setCenter(C.x,C.y+C.height),this.bottomRightGrip.setCenter(C.x+C.width,C.y+C.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},K.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)},K.prototype.clientToLocalCoordinates=function(_,C){var N=this.container.getBoundingClientRect();return{x:_-N.left+this.margin,y:C-N.top+this.margin}},K.prototype.onPointerDown=function(_){this.container.setPointerCapture(_.pointerId),this.previousPoint=this.clientToLocalCoordinates(_.clientX,_.clientY),this.cropRectElement===_.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(_.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(_.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(_.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(_.target)&&(this.activeGrip=this.bottomRightGrip)},K.prototype.onPointerMove=function(_){if(this.isMoving)this.move(this.clientToLocalCoordinates(_.clientX,_.clientY));else if(this.activeGrip){var C=this.clientToLocalCoordinates(_.clientX,_.clientY);this.resize(C)}_.preventDefault()},K.prototype.onPointerUp=function(_){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(_.pointerId)},K.prototype.move=function(_){var C=_.x-this.previousPoint.x,N=_.y-this.previousPoint.y;this.zoomFactor!==1&&(C=-C/this.zoomFactor,N=-N/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+C),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+N),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=_},K.prototype.resize=function(_){var C=Object.assign({},this.cropRect),N=_.x-this.previousPoint.x,Q=_.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:C.x+N<this.margin&&(N=this.margin-C.x),C.x+=N,C.width=this.cropRect.x+this.cropRect.width-C.x;break;case this.bottomRightGrip:case this.topRightGrip:C.width+N>this.canvasWidth*this.zoomFactor&&(N=this.canvasWidth*this.zoomFactor-C.width),C.width+=N}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(C.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(N),C.height=this.aspectRatio.getVerticalLength(C.width)):(C.y+=Q,C.height=this.cropRect.y+this.cropRect.height-C.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?C.height=this.aspectRatio.getVerticalLength(C.width):C.height+=Q}C.width<10&&(C.x=this.cropRect.x,C.width=10),C.height<10&&(C.y=this.cropRect.y,C.height=10),this.previousPoint=_,C.x>=this.margin&&C.y>=this.margin&&C.x-this.margin+C.width<=this.canvasWidth&&C.y-this.margin+C.height<=this.canvasHeight&&(this.cropRect=C,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},K.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var _=this.cropRect.x+this.cropRect.width/2,C=this.cropRect.y+this.cropRect.height/2,N=this.aspectRatio.getHorizontalLength(this.cropRect.height),Q=this.aspectRatio.getVerticalLength(this.cropRect.width);N/this.canvasWidth<Q/this.canvasHeight?this.cropRect.width=N:this.cropRect.height=Q,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=_-this.cropRect.width/2,this.cropRect.y=C-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)}},K.prototype.getRescaledRect=function(_,C,N,Q,G,le){var Ae=N/_,Me=Q/C;return{x:(G.x-le)*Ae+le,y:(G.y-le)*Me+le,width:G.width*Ae,height:G.height*Me}},K.prototype.scaleCanvas=function(_,C){var N=this.getRescaledRect(this.canvasWidth,this.canvasHeight,_,C,this.cropRect,this.margin);this.canvasWidth=_,this.canvasHeight=C,this.onCropChange&&this.onCropChange(N),this.setCropRectangle(N)},K}(),ti=function(){function K(_){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=_,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(K.prototype,"angle",{get:function(){return this._angle},set:function(_){this._angle=_,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),K.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},K.prototype.onPointerDown=function(_){this.controlContainer.setPointerCapture(_.pointerId),this.isDragging=!0,this.previousPoint={x:_.clientX,y:_.clientY}},K.prototype.onPointerMove=function(_){this.isDragging&&(this.onAngleChange&&this.onAngleChange((_.clientX-this.previousPoint.x)/5),this.previousPoint.x=_.clientX)},K.prototype.onPointerUp=function(_){this.isDragging&&this.onAngleChange&&this.onAngleChange((_.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(_.pointerId)},K.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var _=this.angleLabelText.getBBox();xe.setAttributes(this.angleLabelElement,[["x",((this.width-_.width)/2).toString()],["y",(this.height/2).toString()]])}},K.prototype.positionScaleShape=function(){if(this.scaleShape){var _=this.scaleShape.transform.baseVal.getItem(0);_.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(_,0)}},K.prototype.getVisual=function(){var _=document.createElementNS("http://www.w3.org/2000/svg","svg");_.setAttribute("xmlns","http://www.w3.org/2000/svg"),_.setAttribute("width",this.width+"px"),_.setAttribute("height",this.height+"px"),_.setAttribute("viewBox","0 0 "+this.width+" "+this.height),_.style.flexShrink="0",document.body.appendChild(_);for(var C="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,N=1;N<=this.width/5+10;N++){var Q=N%5==0?this.height/3:this.height/6;C+="h4v"+-Q+"h1v"+Q}C+="v1H0Z",this.scaleShape=xe.createPath(C);var G=xe.createTransform();this.scaleShape.transform.baseVal.appendItem(G),_.appendChild(this.scaleShape),this.angleLabelElement=xe.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=xe.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var le=xe.createTSpan("");return le.innerHTML="°",this.angleLabelElement.appendChild(le),_.appendChild(this.angleLabelElement),document.body.removeChild(_),_},K}(),oi=function(){function K(){this.naturalSize=!1,this.imageType="image/png"}return K.prototype.rasterize=function(_,C,N,Q,G,le,Ae){var Me=this;return new Promise(function(ot){var Re=document.createElement("canvas");Re.width=_.width.baseVal.value-2*Q,Re.height=_.height.baseVal.value-2*Q;var $e=1,ze=1;Me.naturalSize===!0?($e=C.naturalWidth/(_.width.baseVal.value-2*Q)/le,ze=C.naturalHeight/(_.height.baseVal.value-2*Q)/Ae,Re.width=C.naturalWidth/le,Re.height=C.naturalHeight/Ae):Me.width!==void 0&&Me.height!==void 0&&($e=Me.width/N.width,ze=Me.height/N.height,Re.width*=$e,Re.height*=ze);var xt=Re.getContext("2d");xt.translate(Re.width/2,Re.height/2),xt.rotate(G*Math.PI/180),xt.scale(le,Ae),xt.translate(-Re.width/2,-Re.height/2),xt.drawImage(C,0,0,Re.width,Re.height);var vt=document.createElement("canvas");vt.width=N.width*$e,vt.height=N.height*ze,vt.getContext("2d").putImageData(xt.getImageData((N.x-Q)*$e,(N.y-Q)*ze,N.width*$e,N.height*ze),0,0),ot(vt.toDataURL(Me.imageType,Me.imageQuality))})},K}(),De=function(){function K(_){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=K.instanceCounter++,this.styles=new Dt(this.instanceNo),this.target=_,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(K.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(_){this._zoomToCropEnabled=_,_?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(_){this._isGridVisible=_,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"gridLines",{get:function(){return this._gridLines},set:function(_){this._gridLines=_,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(_){this._rotationAngle=_,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"aspectRatio",{get:function(){var _;return(_=this._aspectRatio)!==null&&_!==void 0?_:this.aspectRatios[0]},set:function(_){this._aspectRatio=_},enumerable:!1,configurable:!0}),K.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},K.prototype.show=function(){this.showUI(),this.open()},K.prototype.close=function(_){_===void 0&&(_=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),_||this.closeEventListeners.forEach(function(C){return C()}),this._isOpen=!1)},K.prototype.addRenderEventListener=function(_){this.renderEventListeners.push(_)},K.prototype.removeRenderEventListener=function(_){this.renderEventListeners.indexOf(_)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(_),1)},K.prototype.addCloseEventListener=function(_){this.closeEventListeners.push(_)},K.prototype.removeCloseEventListener=function(_){this.closeEventListeners.indexOf(_)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(_),1)},K.prototype.setupResizeObserver=function(){var _=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){_.resize(_.target.clientWidth,_.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))},K.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var _=1*this.target.clientWidth/this.target.clientHeight,C=this.contentDiv.clientWidth/_>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*_:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,N=C+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/_;this.resize(C,N)}},K.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},K.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",xe.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},K.prototype.resize=function(_,C){this.imageWidth=Math.round(_),this.imageHeight=Math.round(C),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()},K.prototype.setEditingTarget=function(){var _=document.createElement("canvas");_.width=this.target.naturalWidth,_.height=this.target.naturalHeight,_.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var C=_.toDataURL();xe.setAttributes(this.editingTarget,[["href",C]]),this.setEditingTargetSize()},K.prototype.setTopLeft=function(){var _=this.target.getBoundingClientRect(),C=this.editorCanvas.getBoundingClientRect();this.left=_.left-C.left-this.CANVAS_MARGIN,this.top=_.top-C.top-this.CANVAS_MARGIN},K.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=xe.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=xe.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=xe.createGroup(),this.editingTargetRotationScaleContainer=xe.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var _=xe.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(_);var C=xe.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(C),this.editingTargetContainer=xe.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)},K.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},K.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=xe.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Nt(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()},K.prototype.zoomToCrop=function(){if(this.cropRect){var _=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,C=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=_+"px "+C+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-_+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-C+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},K.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)},K.prototype.cropRectChanged=function(_){this.cropRect=_,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},K.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},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.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 _=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,C=this.target.offsetTop>_+this.CANVAS_MARGIN?this.target.offsetTop-(_+this.CANVAS_MARGIN):0;this.coverDiv.style.top=C+"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},K.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},K.prototype.addTopToolbar=function(){var _=this;this.topToolbar=new At,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 C=new di;C.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(C);var N=[];this.aspectRatios.forEach(function(ze){var xt=new Bt(ri.getIcon(ze.horizontal,ze.vertical),ze.horizontal===0&&ze.vertical===0?"FREE":ze.horizontal+":"+ze.vertical);xt.onClick=function(){return _.ratioButtonClicked(ze)},N.push(xt)}),this.aspectRatioButton=new Kt(ri.getIcon(0,0),"Aspect ratio",N),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,C.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var Q=new Bt('<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");Q.isActive=this.isGridVisible,Q.onClick=function(){_.isGridVisible=!_.isGridVisible,Q.isActive=_.isGridVisible},C.addButton(Q);var G=new Bt('<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(G.isActive=this.zoomToCropEnabled,G.onClick=function(){_.zoomToCropEnabled=!_.zoomToCropEnabled,G.isActive=_.zoomToCropEnabled},C.addButton(G),!Oi.isLicensed){var le=new it;this.topToolbar.addElementBlock(le);var Ae=document.createElement("div");Ae.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Me=document.createElement("a");Me.style.color="currentColor",Me.href="https://markerjs.com/products/cropro",Me.target="_blank",Me.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>',Ae.appendChild(Me),le.addElement(Ae)}var ot=new di;ot.minWidth=3*this.toolbarHeight+"px",ot.contentAlign="end",this.topToolbar.addButtonBlock(ot);var Re=new Bt('<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");Re.onClick=this.startRenderAndClose,ot.addButton(Re),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Re.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var $e=new Bt('<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");$e.onClick=this.close,ot.addButton($e),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&($e.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},K.prototype.addBottomToolbar=function(){var _=this;this.bottomToolbar=new At,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 C=new di;C.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(C);var N=new Bt('<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");N.onClick=this.rotateLeftButtonClicked,C.addButton(N);var Q=new Bt('<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");Q.onClick=this.rotateRightButtonClicked,C.addButton(Q);var G=new it;G.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(G),this.straightener=new ti("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(ot){_.rotateBy(ot),_.straightener.angle=_.rotationAngle},G.addElement(this.straightener.getUI());var le=new di;le.minWidth=2*this.toolbarHeight+"px",le.contentAlign="end",this.bottomToolbar.addButtonBlock(le);var Ae=new Bt('<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");Ae.onClick=this.flipHorizontallyButtonClicked,le.addButton(Ae);var Me=new Bt('<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");Me.onClick=this.flipVerticallyButtonClicked,le.addButton(Me)},K.prototype.ratioButtonClicked=function(_){this.aspectRatio=_,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},K.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=ri.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},K.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new fi(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},K.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},K.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},K.prototype.restoreState=function(_){if(_){var C=this.cropLayer.getRescaledRect(_.width,_.height,this.imageWidth,this.imageHeight,_.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(C),this.cropRectChanged(C),this.flippedHorizontally=_.flippedHorizontally,this.flippedVertically=_.flippedVertically,this.applyFlip(),this.rotationAngle=_.rotationAngle,this.applyRotation()}},K.prototype.clientToLocalCoordinates=function(_,C){var N=this.cropImage.getBoundingClientRect();return{x:_-N.left,y:C-N.top}},K.prototype.onWindowResize=function(){this.positionUI()},K.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var _=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=_+"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()},K.prototype.rotateLeftButtonClicked=function(){var _=this.rotationAngle-90;this.rotationAngle%90!=0&&(_+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(_)},K.prototype.rotateRightButtonClicked=function(){var _=this.rotationAngle+90;this.rotationAngle%90!=0&&(_-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(_)},K.prototype.rotateTo=function(_){_=(_=_>180?_-360:_)<=-180?_+360:_,this.rotationAngle=_,this.applyRotation()},K.prototype.rotateBy=function(_){this.rotateTo((this.rotationAngle+_)%360)},K.prototype.applyRotation=function(){var _=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var C=this.editingTargetRotationContainer.transform.baseVal.getItem(0);C.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(C,0);var N=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/N.width,this.imageHeight/N.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=_},K.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},K.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},K.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},K.prototype.startRenderAndClose=function(){return Tt(this,void 0,void 0,function(){var _,C;return qe(this,function(N){switch(N.label){case 0:return[4,this.render()];case 1:return _=N.sent(),C=this.getState(),this.renderEventListeners.forEach(function(Q){return Q(_,C)}),this.close(!0),[2]}})})},K.prototype.render=function(){return Tt(this,void 0,void 0,function(){var _;return qe(this,function(C){switch(C.label){case 0:return(_=new oi).naturalSize=this.renderAtNaturalSize,_.imageType=this.renderImageType,_.imageQuality=this.renderImageQuality,_.width=this.renderWidth,_.height=this.renderHeight,this.unzoomFromCrop(),xe.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,_.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 C.sent(),[4,_.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,C.sent()]}})})},K.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ft("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 Ft("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Ft("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var _=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ft("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*_)+`px;
|
|
height: `+(this.toolbarHeight-2*_)+`px;
|
|
padding: `+_+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Ft("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ft("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new Ut("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new Ut("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Ft("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 Ft("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Ft("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 Ft("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*_)+`px;
|
|
padding: `+_+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Ft("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},K.instanceCounter=0,K}(),gt=ne("8hTe"),pi=ne.n(gt),Ei=/<pre[^>]*>/g;function wi(K){var _=document.createElement("div");return _.innerHTML=K,_.childNodes.length===0?"":_.childNodes[0].nodeValue}var vi=st.a=function(K){var _=K.value,C=_===void 0?"":_,N=K.edit,Q=N===void 0?!1:N,G=K.className,le=K.showTextOnly,Ae=K.showLines,Me=K.replaces,ot=K.zoomImg,Re=K.hasMask,$e=K.style,ze=$e===void 0?{}:$e,xt=K.stylesPrev,vt=xt===void 0?{}:xt,hi=String(C),Pt=Object(L.useRef)(),zt=Object(L.useRef)(),yi=Object(L.useState)(""),Si=Object(V.a)(yi,2),bi=Si[0],Jt=Si[1],wt=Object(L.useState)("office"),mt=Object(V.a)(wt,2),Wt=mt[0],$t=mt[1],ai=function(){var li=new De(zt.current);li.displayMode="popup",li.addRenderEventListener(function(){var Ci=Object(F.a)(k.a.mark(function qt(Ii){var ui;return k.a.wrap(function(Pi){for(;;)switch(Pi.prev=Pi.next){case 0:return Pt.current.style.display="none",Pi.next=3,Object(_e.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Ii}});case 3:ui=Pi.sent,ui!=null&&ui.id&&Me(zt.current.getAttribute("src").replace(J.a.API_SERVER,""),"/api/attachments/".concat(ui==null?void 0:ui.id,"?type=").concat(ui.content_type));case 5:case"end":return Pi.stop()}},qt)}));return function(qt){return Ci.apply(this,arguments)}}()),li.show()},Ht=function(){var li=new Rt(zt.current);li.settings.displayMode="popup",li.addEventListener("render",function(){var Ci=Object(F.a)(k.a.mark(function qt(Ii){var ui;return k.a.wrap(function(Pi){for(;;)switch(Pi.prev=Pi.next){case 0:if(Pt.current.style.display="none",!zt.current){Pi.next=6;break}return Pi.next=4,Object(_e.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Ii.dataUrl}});case 4:ui=Pi.sent,ui!=null&&ui.id&&Me(zt.current.getAttribute("src").replace(J.a.API_SERVER,""),"/api/attachments/".concat(ui==null?void 0:ui.id,"?type=").concat(ui.content_type));case 6:case"end":return Pi.stop()}},qt)}));return function(qt){return Ci.apply(this,arguments)}}()),li.show(),window.markerArea=li},Fi=Object(L.useMemo)(function(){Pt.current&&(Pt.current.style.zIndex=-1);try{var xi=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,li=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Ci=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;hi=hi.replace(xi,"("+J.a.API_SERVER+"/api/attachments/").replace(li,'"'+J.a.API_SERVER+"/api/attachments/").replace(Ci,'"'+J.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(pn){}var qt=X(hi),Ii=m();if(hi.match(/\[TOC\]/)&&(qt=qt.replace("<p>[TOC]</p>",A()),O()),qt=qt.replace(/(__special_katext_id_\d+__)/g,function(pn,Pi){var Ri=Ii[Pi],En=Ri.type,xn=Ri.expression;return Object(te.renderToString)(wi(xn)||"",{displayMode:En==="block",throwOnError:!1,output:"html"})}),qt=qt.replace(/▁/g,"\u2581\u2581\u2581"),r(),le){var ui=document.createElement("div");return ui.innerHTML=qt,ui.innerText}return setTimeout(function(){return gn()},500),qt},[hi]),Di=Object(L.useRef)();x.WebkitLineClamp=Ae,Ae&&(ze=Object(j.a)(Object(j.a)({},ze),x));function en(xi){var li=xi.target;if(li.tagName.toUpperCase()==="IMG"){if(ot){var Ci=li.getAttribute("src");Jt(Ci),$t("image")}}else if(li.tagName.toUpperCase()==="A"){var qt=li.getAttribute("href");if(qt.indexOf("office")>-1)xi.preventDefault(),Jt(qt),$t("office");else if(qt.indexOf("application/pdf")>-1)xi.preventDefault(),Jt(qt),$t("pdf");else if(qt.indexOf("text/html")>-1)xi.preventDefault(),Jt(qt),$t("html");else if(qt.startsWith("#")){xi.preventDefault();var Ii=document.getElementById(qt.replace("#",""));Ii&&Ii.scrollIntoView(!0)}}}var gn=function(){var li,Ci=(li=Di.current)===null||li===void 0?void 0:li.querySelectorAll("video");Ci==null||Ci.forEach(function(qt){if(qt.oncontextmenu=function(){return!1},qt.src.indexOf(".m3u8")>-1&&!qt.canPlayType("application/vnd.apple.mpegurl")){if(B.a.isSupported()){var Ii=new B.a;Ii.loadSource(qt.src),Ii.attachMedia(qt)}}})};Object(L.useEffect)(function(){if(Di.current&&Fi&&(Fi.match(Ei)&&window.PR.prettyPrint()),Di.current)return Di.current.addEventListener("click",en),function(){Di.current.removeEventListener("click",en),r(),O()}},[Fi,Di.current,en]);var Cn=function(li){if(!Q)return;li.target.nodeName==="IMG"?(Pt.current.style.zIndex=1,Pt.current.style.display="flex",Pt.current.style.width=li.target.clientWidth+"px",Pt.current.style.height=li.target.clientHeight+"px",Pt.current.style.top=li.target.offsetTop+"px",Pt.current.style.left=li.target.offsetLeft+"px",zt.current.src=li.target.getAttribute("src")):Pt.current.style.display="none"};return y.a.createElement("div",{style:{position:"relative"}},y.a.createElement("div",{ref:Di,style:Object(j.a)({},ze),className:"".concat(G||""," markdown-body ").concat(pi.a.mdBody),onMouseOver:Cn,dangerouslySetInnerHTML:{__html:Fi}}),y.a.createElement("div",{ref:Pt,className:pi.a.button},y.a.createElement(Z.a,null,y.a.createElement($.a,{onClick:function(){return ai()}},"\u88C1\u526A"),y.a.createElement($.a,{onClick:function(){return Ht()}},"\u7F16\u8F91"))),y.a.createElement("img",{ref:zt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),y.a.createElement(ae.a,{close:!0,data:bi,type:bi!=null&&bi.length?Wt:"",style:Object(j.a)({},vt),onClose:function(){return Jt("")}}))}},"9VGf":function(Mt,st,ne){"use strict";ne.d(st,"a",function(){return D});var oe=ne("q1tI"),Z=ne.n(oe);function D($,j){var F=Object(oe.useRef)();Object(oe.useEffect)(function(){F.current=$}),Object(oe.useEffect)(function(){function V(){F.current()}if(j!==null){var H=setInterval(V,j);return function(){return clearInterval(H)}}},[j])}},BU3w:function(Mt,st,ne){"use strict";ne.d(st,"a",function(){return F});var oe=ne("MNnm"),Z="rc-util-key";function D(V){if(V.attachTo)return V.attachTo;var H=document.querySelector("head");return H||document.body}function $(V){var H,k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(oe.a)())return null;var L=document.createElement("style");if((H=k.csp)===null||H===void 0?void 0:H.nonce){var y;L.nonce=(y=k.csp)===null||y===void 0?void 0:y.nonce}L.innerHTML=V;var v=D(k),p=v.firstChild;return k.prepend&&v.prepend?v.prepend(L):k.prepend&&p?v.insertBefore(L,p):v.appendChild(L),L}var j=new Map;function F(V,H){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},L=D(k);if(!j.has(L)){var y=$("",k),v=y.parentNode;j.set(L,v),v.removeChild(y)}var p=Array.from(j.get(L).children).find(function(s){return s.tagName==="STYLE"&&s[Z]===H});if(p){var c,h;if(((c=k.csp)===null||c===void 0?void 0:c.nonce)&&p.nonce!==((h=k.csp)===null||h===void 0?void 0:h.nonce)){var d;p.nonce=(d=k.csp)===null||d===void 0?void 0:d.nonce}return p.innerHTML!==V&&(p.innerHTML=V),p}var l=$(V,k);return l[Z]=H,l}},Bd2K:function(Mt,st,ne){(function(oe){oe(ne("VrN/"),ne("osHv"))})(function(oe){oe.defineOption("autoCloseTags",!1,function(k,L,y){if(y!=oe.Init&&y&&k.removeKeyMap("autoCloseTags"),!L)return;var v={name:"autoCloseTags"};(typeof L!="object"||L.whenClosing!==!1)&&(v["'/'"]=function(p){return F(p)}),(typeof L!="object"||L.whenOpening!==!1)&&(v["'>'"]=function(p){return $(p)}),k.addKeyMap(v)});var Z=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function $(k){if(k.getOption("disableInput"))return oe.Pass;for(var L=k.listSelections(),y=[],v=k.getOption("autoCloseTags"),p=0;p<L.length;p++){if(!L[p].empty())return oe.Pass;var c=L[p].head,h=k.getTokenAt(c),d=oe.innerMode(k.getMode(),h.state),l=d.state,s=d.mode.xmlCurrentTag&&d.mode.xmlCurrentTag(l),u=s&&s.name;if(!u)return oe.Pass;var f=d.mode.configuration=="html",O=typeof v=="object"&&v.dontCloseTags||f&&Z,x=typeof v=="object"&&v.indentTags||f&&D;h.end>c.ch&&(u=u.slice(0,u.length-h.end+c.ch));var w=u.toLowerCase();if(!u||h.type=="string"&&(h.end!=c.ch||!/[\"\']/.test(h.string.charAt(h.string.length-1))||h.string.length==1)||h.type=="tag"&&s.close||h.string.indexOf("/")==c.ch-h.start-1||O&&V(O,w)>-1||H(k,d.mode.xmlCurrentContext&&d.mode.xmlCurrentContext(l)||[],u,c,!0))return oe.Pass;var A=typeof v=="object"&&v.emptyTags;if(A&&V(A,u)>-1){y[p]={text:"/>",newPos:oe.Pos(c.line,c.ch+2)};continue}var R=x&&V(x,w)>-1;y[p]={indent:R,text:">"+(R?`
|
|
|
|
`:"")+"</"+u+">",newPos:R?oe.Pos(c.line+1,0):oe.Pos(c.line,c.ch+1)}}for(var T=typeof v=="object"&&v.dontIndentOnAutoClose,p=L.length-1;p>=0;p--){var E=y[p];k.replaceRange(E.text,L[p].head,L[p].anchor,"+insert");var g=k.listSelections().slice(0);g[p]={head:E.newPos,anchor:E.newPos},k.setSelections(g),!T&&E.indent&&(k.indentLine(E.newPos.line,null,!0),k.indentLine(E.newPos.line+1,null,!0))}}function j(k,L){for(var y=k.listSelections(),v=[],p=L?"/":"</",c=k.getOption("autoCloseTags"),h=typeof c=="object"&&c.dontIndentOnSlash,d=0;d<y.length;d++){if(!y[d].empty())return oe.Pass;var l=y[d].head,s=k.getTokenAt(l),u=oe.innerMode(k.getMode(),s.state),f=u.state;if(L&&(s.type=="string"||s.string.charAt(0)!="<"||s.start!=l.ch-1))return oe.Pass;var O,x=u.mode.name!="xml"&&k.getMode().name=="htmlmixed";if(x&&u.mode.name=="javascript")O=p+"script";else if(x&&u.mode.name=="css")O=p+"style";else{var w=u.mode.xmlCurrentContext&&u.mode.xmlCurrentContext(f);if(!w||w.length&&H(k,w,w[w.length-1],l))return oe.Pass;O=p+w[w.length-1]}k.getLine(l.line).charAt(s.end)!=">"&&(O+=">"),v[d]=O}if(k.replaceSelections(v),y=k.listSelections(),!h)for(var d=0;d<y.length;d++)(d==y.length-1||y[d].head.line<y[d+1].head.line)&&k.indentLine(y[d].head.line)}function F(k){return k.getOption("disableInput")?oe.Pass:j(k,!0)}oe.commands.closeTag=function(k){return j(k)};function V(k,L){if(k.indexOf)return k.indexOf(L);for(var y=0,v=k.length;y<v;++y)if(k[y]==L)return y;return-1}function H(k,L,y,v,p){if(!oe.scanForClosingTag)return!1;var c=Math.min(k.lastLine()+1,v.line+500),h=oe.scanForClosingTag(k,v,null,c);if(!h||h.tag!=y)return!1;for(var d=p?1:0,l=L.length-1;l>=0&&L[l]==y;l--)++d;v=h.to;for(var l=1;l<d;l++){var s=oe.scanForClosingTag(k,v,null,c);if(!s||s.tag!=y)return!1;v=s.to}return!0}})},BjJ7:function(Mt,st,ne){"use strict";ne.d(st,"d",function(){return Z}),ne.d(st,"c",function(){return D}),ne.d(st,"e",function(){return $}),ne.d(st,"b",function(){return j}),ne.d(st,"a",function(){return V});var oe=ne("m3rI");function Z(H){var k=!0;if(H.length>0){for(var L=0;L<H.length;L++)if(H[L].compile_success==0||!H[L].compile_success){k=!1;break}}else k=!1;return k}function D(H){for(var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",L=[],y=0;y<H.length;y++){var v=H[y],p=k?"".concat(k,"/").concat(v.name):"".concat(v.name);L.push({title:v.name,isLeaf:!(v.type==="tree"),key:p})}return L}function $(H,k,L){for(var y=0;y<H.length;y++){var v=H[y];if(v.key===k){v.children=L;break}v.children&&$(v.children,k,L)}return H}function j(H,k,L){var y;return function(){var v=this,p=arguments,c=function(){y=null,L||H.apply(v,p)},h=L&&!y;clearTimeout(y),y=setTimeout(c,k),h&&H.apply(v,p)}}var F=!0,V=oe.a.API_SERVER},"C+DQ":function(Mt,st,ne){},DlQD:function(Mt,st,ne){(function(oe,Z){Mt.exports=Z()})(this,function(){"use strict";function oe(be,fe){for(var pe=0;pe<fe.length;pe++){var ie=fe[pe];ie.enumerable=ie.enumerable||!1,ie.configurable=!0,"value"in ie&&(ie.writable=!0),Object.defineProperty(be,ie.key,ie)}}function Z(be,fe,pe){return fe&&oe(be.prototype,fe),pe&&oe(be,pe),be}function D(be,fe){if(!be)return;if(typeof be=="string")return $(be,fe);var pe=Object.prototype.toString.call(be).slice(8,-1);if(pe==="Object"&&be.constructor&&(pe=be.constructor.name),pe==="Map"||pe==="Set")return Array.from(be);if(pe==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(pe))return $(be,fe)}function $(be,fe){(fe==null||fe>be.length)&&(fe=be.length);for(var pe=0,ie=new Array(fe);pe<fe;pe++)ie[pe]=be[pe];return ie}function j(be,fe){var pe;if(typeof Symbol=="undefined"||be[Symbol.iterator]==null){if(Array.isArray(be)||(pe=D(be))||fe&&be&&typeof be.length=="number"){pe&&(be=pe);var ie=0;return function(){return ie>=be.length?{done:!0}:{done:!1,value:be[ie++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return pe=be[Symbol.iterator](),pe.next.bind(pe)}function F(be,fe){return fe={exports:{}},be(fe,fe.exports),fe.exports}var V=F(function(be){function fe(){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 pe(ie){be.exports.defaults=ie}be.exports={defaults:fe(),getDefaults:fe,changeDefaults:pe}}),H=V.defaults,k=V.getDefaults,L=V.changeDefaults,y=/[&<>"']/,v=/[&<>"']/g,p=/[<>"']|&(?!#?\w+;)/,c=/[<>"']|&(?!#?\w+;)/g,h={"&":"&","<":"<",">":">",'"':""","'":"'"},d=function(fe){return h[fe]};function l(be,fe){if(fe){if(y.test(be))return be.replace(v,d)}else if(p.test(be))return be.replace(c,d);return be}var s=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function u(be){return be.replace(s,function(fe,pe){return pe=pe.toLowerCase(),pe==="colon"?":":pe.charAt(0)==="#"?pe.charAt(1)==="x"?String.fromCharCode(parseInt(pe.substring(2),16)):String.fromCharCode(+pe.substring(1)):""})}var f=/(^|[^\[])\^/g;function O(be,fe){be=be.source||be,fe=fe||"";var pe={replace:function(re,ue){return ue=ue.source||ue,ue=ue.replace(f,"$1"),be=be.replace(re,ue),pe},getRegex:function(){return new RegExp(be,fe)}};return pe}var x=/[^\w:]/g,w=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function A(be,fe,pe){if(be){var ie;try{ie=decodeURIComponent(u(pe)).replace(x,"").toLowerCase()}catch(re){return null}if(ie.indexOf("javascript:")===0||ie.indexOf("vbscript:")===0||ie.indexOf("data:")===0)return null}fe&&!w.test(pe)&&(pe=a(fe,pe));try{pe=encodeURI(pe).replace(/%25/g,"%")}catch(re){return null}return pe}var R={},T=/^[^:]+:\/*[^/]*$/,E=/^([^:]+:)[\s\S]*$/,g=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(be,fe){R[" "+be]||(T.test(be)?R[" "+be]=be+"/":R[" "+be]=P(be,"/",!0)),be=R[" "+be];var pe=be.indexOf(":")===-1;return fe.substring(0,2)==="//"?pe?fe:be.replace(E,"$1")+fe:fe.charAt(0)==="/"?pe?fe:be.replace(g,"$1")+fe:be+fe}var m={exec:function(){}};function r(be){for(var fe=1,pe,ie;fe<arguments.length;fe++){pe=arguments[fe];for(ie in pe)Object.prototype.hasOwnProperty.call(pe,ie)&&(be[ie]=pe[ie])}return be}function b(be,fe){var pe=be.replace(/\|/g,function(ue,ge,ye){for(var Le=!1,Be=ge;--Be>=0&&ye[Be]==="\\";)Le=!Le;return Le?"|":" |"}),ie=pe.split(/ \|/),re=0;if(ie.length>fe)ie.splice(fe);else for(;ie.length<fe;)ie.push("");for(;re<ie.length;re++)ie[re]=ie[re].trim().replace(/\\\|/g,"|");return ie}function P(be,fe,pe){var ie=be.length;if(ie===0)return"";for(var re=0;re<ie;){var ue=be.charAt(ie-re-1);if(ue===fe&&!pe)re++;else if(ue!==fe&&pe)re++;else break}return be.substr(0,ie-re)}function M(be,fe){if(be.indexOf(fe[1])===-1)return-1;for(var pe=be.length,ie=0,re=0;re<pe;re++)if(be[re]==="\\")re++;else if(be[re]===fe[0])ie++;else if(be[re]===fe[1]&&(ie--,ie<0))return re;return-1}function W(be){be&&be.sanitize&&!be.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 X={escape:l,unescape:u,edit:O,cleanUrl:A,resolveUrl:a,noopTest:m,merge:r,splitCells:b,rtrim:P,findClosingBracket:M,checkSanitizeDeprecation:W},U=V.defaults,S=X.rtrim,B=X.splitCells,J=X.escape,te=X.findClosingBracket;function ae(be,fe,pe){var ie=fe.href,re=fe.title?J(fe.title):null,ue=be[1].replace(/\\([\[\]])/g,"$1");return be[0].charAt(0)!=="!"?{type:"link",raw:pe,href:ie,title:re,text:ue}:{type:"image",raw:pe,href:ie,title:re,text:J(ue)}}function _e(be,fe){var pe=be.match(/^(\s+)(?:```)/);if(pe===null)return fe;var ie=pe[1];return fe.split(`
|
|
`).map(function(re){var ue=re.match(/^\s+/);if(ue===null)return re;var ge=ue[0];return ge.length>=ie.length?re.slice(ie.length):re}).join(`
|
|
`)}var de=function(){function be(pe){this.options=pe||U}var fe=be.prototype;return fe.space=function(ie){var re=this.rules.block.newline.exec(ie);if(re)return re[0].length>1?{type:"space",raw:re[0]}:{raw:`
|
|
`}},fe.code=function(ie,re){var ue=this.rules.block.code.exec(ie);if(ue){var ge=re[re.length-1];if(ge&&ge.type==="paragraph")return{raw:ue[0],text:ue[0].trimRight()};var ye=ue[0].replace(/^ {4}/gm,"");return{type:"code",raw:ue[0],codeBlockStyle:"indented",text:this.options.pedantic?ye:S(ye,`
|
|
`)}}},fe.fences=function(ie){var re=this.rules.block.fences.exec(ie);if(re){var ue=re[0],ge=_e(ue,re[3]||"");return{type:"code",raw:ue,lang:re[2]?re[2].trim():re[2],text:ge}}},fe.heading=function(ie){var re=this.rules.block.heading.exec(ie);if(re)return{type:"heading",raw:re[0],depth:re[1].length,text:re[2]}},fe.nptable=function(ie){var re=this.rules.block.nptable.exec(ie);if(re){var ue={type:"table",header:B(re[1].replace(/^ *| *\| *$/g,"")),align:re[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:re[3]?re[3].replace(/\n$/,"").split(`
|
|
`):[],raw:re[0]};if(ue.header.length===ue.align.length){var ge=ue.align.length,ye;for(ye=0;ye<ge;ye++)/^ *-+: *$/.test(ue.align[ye])?ue.align[ye]="right":/^ *:-+: *$/.test(ue.align[ye])?ue.align[ye]="center":/^ *:-+ *$/.test(ue.align[ye])?ue.align[ye]="left":ue.align[ye]=null;for(ge=ue.cells.length,ye=0;ye<ge;ye++)ue.cells[ye]=B(ue.cells[ye],ue.header.length);return ue}}},fe.hr=function(ie){var re=this.rules.block.hr.exec(ie);if(re)return{type:"hr",raw:re[0]}},fe.blockquote=function(ie){var re=this.rules.block.blockquote.exec(ie);if(re){var ue=re[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:re[0],text:ue}}},fe.list=function(ie){var re=this.rules.block.list.exec(ie);if(re){for(var ue=re[0],ge=re[2],ye=ge.length>1,Le=ge[ge.length-1]===")",Be={type:"list",raw:ue,ordered:ye,start:ye?+ge.slice(0,-1):"",loose:!1,items:[]},pt=re[0].match(this.rules.block.item),It=!1,Lt,Vt,tt,ke,Ct,Rt,ni,Qt=pt.length,Tt=0;Tt<Qt;Tt++)Lt=pt[Tt],ue=Lt,Vt=Lt.length,Lt=Lt.replace(/^ *([*+-]|\d+[.)]) */,""),~Lt.indexOf(`
|
|
`)&&(Vt-=Lt.length,Lt=this.options.pedantic?Lt.replace(/^ {1,4}/gm,""):Lt.replace(new RegExp("^ {1,"+Vt+"}","gm"),"")),Tt!==Qt-1&&(tt=this.rules.block.bullet.exec(pt[Tt+1])[0],(ye?tt.length===1||!Le&&tt[tt.length-1]===")":tt.length>1||this.options.smartLists&&tt!==ge)&&(ke=pt.slice(Tt+1).join(`
|
|
`),Be.raw=Be.raw.substring(0,Be.raw.length-ke.length),Tt=Qt-1)),Ct=It||/\n\n(?!\s*$)/.test(Lt),Tt!==Qt-1&&(It=Lt.charAt(Lt.length-1)===`
|
|
`,Ct||(Ct=It)),Ct&&(Be.loose=!0),Rt=/^\[[ xX]\] /.test(Lt),ni=void 0,Rt&&(ni=Lt[1]!==" ",Lt=Lt.replace(/^\[[ xX]\] +/,"")),Be.items.push({type:"list_item",raw:ue,task:Rt,checked:ni,loose:Ct,text:Lt});return Be}},fe.html=function(ie){var re=this.rules.block.html.exec(ie);if(re)return{type:this.options.sanitize?"paragraph":"html",raw:re[0],pre:!this.options.sanitizer&&(re[1]==="pre"||re[1]==="script"||re[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(re[0]):J(re[0]):re[0]}},fe.def=function(ie){var re=this.rules.block.def.exec(ie);if(re){re[3]&&(re[3]=re[3].substring(1,re[3].length-1));var ue=re[1].toLowerCase().replace(/\s+/g," ");return{tag:ue,raw:re[0],href:re[2],title:re[3]}}},fe.table=function(ie){var re=this.rules.block.table.exec(ie);if(re){var ue={type:"table",header:B(re[1].replace(/^ *| *\| *$/g,"")),align:re[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:re[3]?re[3].replace(/\n$/,"").split(`
|
|
`):[]};if(ue.header.length===ue.align.length){ue.raw=re[0];var ge=ue.align.length,ye;for(ye=0;ye<ge;ye++)/^ *-+: *$/.test(ue.align[ye])?ue.align[ye]="right":/^ *:-+: *$/.test(ue.align[ye])?ue.align[ye]="center":/^ *:-+ *$/.test(ue.align[ye])?ue.align[ye]="left":ue.align[ye]=null;for(ge=ue.cells.length,ye=0;ye<ge;ye++)ue.cells[ye]=B(ue.cells[ye].replace(/^ *\| *| *\| *$/g,""),ue.header.length);return ue}}},fe.lheading=function(ie){var re=this.rules.block.lheading.exec(ie);if(re)return{type:"heading",raw:re[0],depth:re[2].charAt(0)==="="?1:2,text:re[1]}},fe.paragraph=function(ie){var re=this.rules.block.paragraph.exec(ie);if(re)return{type:"paragraph",raw:re[0],text:re[1].charAt(re[1].length-1)===`
|
|
`?re[1].slice(0,-1):re[1]}},fe.text=function(ie,re){var ue=this.rules.block.text.exec(ie);if(ue){var ge=re[re.length-1];return ge&&ge.type==="text"?{raw:ue[0],text:ue[0]}:{type:"text",raw:ue[0],text:ue[0]}}},fe.escape=function(ie){var re=this.rules.inline.escape.exec(ie);if(re)return{type:"escape",raw:re[0],text:J(re[1])}},fe.tag=function(ie,re,ue){var ge=this.rules.inline.tag.exec(ie);if(ge)return!re&&/^<a /i.test(ge[0])?re=!0:re&&/^<\/a>/i.test(ge[0])&&(re=!1),!ue&&/^<(pre|code|kbd|script)(\s|>)/i.test(ge[0])?ue=!0:ue&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ge[0])&&(ue=!1),{type:this.options.sanitize?"text":"html",raw:ge[0],inLink:re,inRawBlock:ue,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ge[0]):J(ge[0]):ge[0]}},fe.link=function(ie){var re=this.rules.inline.link.exec(ie);if(re){var ue=te(re[2],"()");if(ue>-1){var ge=re[0].indexOf("!")===0?5:4,ye=ge+re[1].length+ue;re[2]=re[2].substring(0,ue),re[0]=re[0].substring(0,ye).trim(),re[3]=""}var Le=re[2],Be="";if(this.options.pedantic){var pt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Le);pt?(Le=pt[1],Be=pt[3]):Be=""}else Be=re[3]?re[3].slice(1,-1):"";Le=Le.trim().replace(/^<([\s\S]*)>$/,"$1");var It=ae(re,{href:Le&&Le.replace(this.rules.inline._escapes,"$1"),title:Be&&Be.replace(this.rules.inline._escapes,"$1")},re[0]);return It}},fe.reflink=function(ie,re){var ue;if((ue=this.rules.inline.reflink.exec(ie))||(ue=this.rules.inline.nolink.exec(ie))){var ge=(ue[2]||ue[1]).replace(/\s+/g," ");if(ge=re[ge.toLowerCase()],!ge||!ge.href){var ye=ue[0].charAt(0);return{type:"text",raw:ye,text:ye}}var Le=ae(ue,ge,ue[0]);return Le}},fe.strong=function(ie,re,ue){ue===void 0&&(ue="");var ge=this.rules.inline.strong.start.exec(ie);if(ge&&(!ge[1]||ge[1]&&(ue===""||this.rules.inline.punctuation.exec(ue)))){re=re.slice(-1*ie.length);var ye=ge[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ye.lastIndex=0;for(var Le;(ge=ye.exec(re))!=null;)if(Le=this.rules.inline.strong.middle.exec(re.slice(0,ge.index+3)),Le)return{type:"strong",raw:ie.slice(0,Le[0].length),text:ie.slice(2,Le[0].length-2)}}},fe.em=function(ie,re,ue){ue===void 0&&(ue="");var ge=this.rules.inline.em.start.exec(ie);if(ge&&(!ge[1]||ge[1]&&(ue===""||this.rules.inline.punctuation.exec(ue)))){re=re.slice(-1*ie.length);var ye=ge[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ye.lastIndex=0;for(var Le;(ge=ye.exec(re))!=null;)if(Le=this.rules.inline.em.middle.exec(re.slice(0,ge.index+2)),Le)return{type:"em",raw:ie.slice(0,Le[0].length),text:ie.slice(1,Le[0].length-1)}}},fe.codespan=function(ie){var re=this.rules.inline.code.exec(ie);if(re){var ue=re[2].replace(/\n/g," "),ge=/[^ ]/.test(ue),ye=ue.startsWith(" ")&&ue.endsWith(" ");return ge&&ye&&(ue=ue.substring(1,ue.length-1)),ue=J(ue,!0),{type:"codespan",raw:re[0],text:ue}}},fe.br=function(ie){var re=this.rules.inline.br.exec(ie);if(re)return{type:"br",raw:re[0]}},fe.del=function(ie){var re=this.rules.inline.del.exec(ie);if(re)return{type:"del",raw:re[0],text:re[1]}},fe.autolink=function(ie,re){var ue=this.rules.inline.autolink.exec(ie);if(ue){var ge,ye;return ue[2]==="@"?(ge=J(this.options.mangle?re(ue[1]):ue[1]),ye="mailto:"+ge):(ge=J(ue[1]),ye=ge),{type:"link",raw:ue[0],text:ge,href:ye,tokens:[{type:"text",raw:ge,text:ge}]}}},fe.url=function(ie,re){var ue;if(ue=this.rules.inline.url.exec(ie)){var ge,ye;if(ue[2]==="@")ge=J(this.options.mangle?re(ue[0]):ue[0]),ye="mailto:"+ge;else{var Le;do Le=ue[0],ue[0]=this.rules.inline._backpedal.exec(ue[0])[0];while(Le!==ue[0]);ge=J(ue[0]),ue[1]==="www."?ye="http://"+ge:ye=ge}return{type:"link",raw:ue[0],text:ge,href:ye,tokens:[{type:"text",raw:ge,text:ge}]}}},fe.inlineText=function(ie,re,ue){var ge=this.rules.inline.text.exec(ie);if(ge){var ye;return re?ye=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ge[0]):J(ge[0]):ge[0]:ye=J(this.options.smartypants?ue(ge[0]):ge[0]),{type:"text",raw:ge[0],text:ye}}},be}(),Ee=X.noopTest,Te=X.edit,me=X.merge,ce={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:Ee,table:Ee,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ce._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ce._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ce.def=Te(ce.def).replace("label",ce._label).replace("title",ce._title).getRegex(),ce.bullet=/(?:[*+-]|\d{1,9}[.)])/,ce.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ce.item=Te(ce.item,"gm").replace(/bull/g,ce.bullet).getRegex(),ce.list=Te(ce.list).replace(/bull/g,ce.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ce.def.source+")").getRegex(),ce._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ce._comment=/<!--(?!-?>)[\s\S]*?-->/,ce.html=Te(ce.html,"i").replace("comment",ce._comment).replace("tag",ce._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ce.paragraph=Te(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ce._tag).getRegex(),ce.blockquote=Te(ce.blockquote).replace("paragraph",ce.paragraph).getRegex(),ce.normal=me({},ce),ce.gfm=me({},ce.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),ce.gfm.nptable=Te(ce.gfm.nptable).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ce._tag).getRegex(),ce.gfm.table=Te(ce.gfm.table).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ce._tag).getRegex(),ce.pedantic=me({},ce.normal,{html:Te(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ce._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:Ee,paragraph:Te(ce.normal._paragraph).replace("hr",ce.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ce.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var se={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ee,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:Ee,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};se._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",se.punctuation=Te(se.punctuation).replace(/punctuation/g,se._punctuation).getRegex(),se._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",se._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",se.em.start=Te(se.em.start).replace(/punctuation/g,se._punctuation).getRegex(),se.em.middle=Te(se.em.middle).replace(/punctuation/g,se._punctuation).replace(/overlapSkip/g,se._overlapSkip).getRegex(),se.em.endAst=Te(se.em.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.em.endUnd=Te(se.em.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.start=Te(se.strong.start).replace(/punctuation/g,se._punctuation).getRegex(),se.strong.middle=Te(se.strong.middle).replace(/punctuation/g,se._punctuation).replace(/blockSkip/g,se._blockSkip).getRegex(),se.strong.endAst=Te(se.strong.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.endUnd=Te(se.strong.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.blockSkip=Te(se._blockSkip,"g").getRegex(),se.overlapSkip=Te(se._overlapSkip,"g").getRegex(),se._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,se._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,se._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])?)+(?![-_])/,se.autolink=Te(se.autolink).replace("scheme",se._scheme).replace("email",se._email).getRegex(),se._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,se.tag=Te(se.tag).replace("comment",ce._comment).replace("attribute",se._attribute).getRegex(),se._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,se._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,se._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,se.link=Te(se.link).replace("label",se._label).replace("href",se._href).replace("title",se._title).getRegex(),se.reflink=Te(se.reflink).replace("label",se._label).getRegex(),se.reflinkSearch=Te(se.reflinkSearch,"g").replace("reflink",se.reflink).replace("nolink",se.nolink).getRegex(),se.normal=me({},se),se.pedantic=me({},se.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",se._label).getRegex(),reflink:Te(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",se._label).getRegex()}),se.gfm=me({},se.normal,{escape:Te(se.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),se.gfm.url=Te(se.gfm.url,"i").replace("email",se.gfm._extended_email).getRegex(),se.breaks=me({},se.gfm,{br:Te(se.br).replace("{2,}","*").getRegex(),text:Te(se.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Se={block:ce,inline:se},je=V.defaults,We=Se.block,Xe=Se.inline;function Qe(be){return be.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 Pe(be){var fe="",pe,ie,re=be.length;for(pe=0;pe<re;pe++)ie=be.charCodeAt(pe),Math.random()>.5&&(ie="x"+ie.toString(16)),fe+="&#"+ie+";";return fe}var Ue=function(){function be(pe){this.tokens=[],this.tokens.links=Object.create(null),this.options=pe||je,this.options.tokenizer=this.options.tokenizer||new de,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ie={block:We.normal,inline:Xe.normal};this.options.pedantic?(ie.block=We.pedantic,ie.inline=Xe.pedantic):this.options.gfm&&(ie.block=We.gfm,this.options.breaks?ie.inline=Xe.breaks:ie.inline=Xe.gfm),this.tokenizer.rules=ie}be.lex=function(ie,re){var ue=new be(re);return ue.lex(ie)};var fe=be.prototype;return fe.lex=function(ie){return ie=ie.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(ie,this.tokens,!0),this.inline(this.tokens),this.tokens},fe.blockTokens=function(ie,re,ue){re===void 0&&(re=[]),ue===void 0&&(ue=!0),ie=ie.replace(/^ +$/gm,"");for(var ge,ye,Le,Be;ie;){if(ge=this.tokenizer.space(ie)){ie=ie.substring(ge.raw.length),ge.type&&re.push(ge);continue}if(ge=this.tokenizer.code(ie,re)){ie=ie.substring(ge.raw.length),ge.type?re.push(ge):(Be=re[re.length-1],Be.raw+=`
|
|
`+ge.raw,Be.text+=`
|
|
`+ge.text);continue}if(ge=this.tokenizer.fences(ie)){ie=ie.substring(ge.raw.length),re.push(ge);continue}if(ge=this.tokenizer.heading(ie)){ie=ie.substring(ge.raw.length),re.push(ge);continue}if(ge=this.tokenizer.nptable(ie)){ie=ie.substring(ge.raw.length),re.push(ge);continue}if(ge=this.tokenizer.hr(ie)){ie=ie.substring(ge.raw.length),re.push(ge);continue}if(ge=this.tokenizer.blockquote(ie)){ie=ie.substring(ge.raw.length),ge.tokens=this.blockTokens(ge.text,[],ue),re.push(ge);continue}if(ge=this.tokenizer.list(ie)){for(ie=ie.substring(ge.raw.length),Le=ge.items.length,ye=0;ye<Le;ye++)ge.items[ye].tokens=this.blockTokens(ge.items[ye].text,[],!1);re.push(ge);continue}if(ge=this.tokenizer.html(ie)){ie=ie.substring(ge.raw.length),re.push(ge);continue}if(ue&&(ge=this.tokenizer.def(ie))){ie=ie.substring(ge.raw.length),this.tokens.links[ge.tag]||(this.tokens.links[ge.tag]={href:ge.href,title:ge.title});continue}if(ge=this.tokenizer.table(ie)){ie=ie.substring(ge.raw.length),re.push(ge);continue}if(ge=this.tokenizer.lheading(ie)){ie=ie.substring(ge.raw.length),re.push(ge);continue}if(ue&&(ge=this.tokenizer.paragraph(ie))){ie=ie.substring(ge.raw.length),re.push(ge);continue}if(ge=this.tokenizer.text(ie,re)){ie=ie.substring(ge.raw.length),ge.type?re.push(ge):(Be=re[re.length-1],Be.raw+=`
|
|
`+ge.raw,Be.text+=`
|
|
`+ge.text);continue}if(ie){var pt="Infinite loop on byte: "+ie.charCodeAt(0);if(this.options.silent){console.error(pt);break}else throw new Error(pt)}}return re},fe.inline=function(ie){var re,ue,ge,ye,Le,Be,pt=ie.length;for(re=0;re<pt;re++){Be=ie[re];switch(Be.type){case"paragraph":case"text":case"heading":{Be.tokens=[],this.inlineTokens(Be.text,Be.tokens);break}case"table":{for(Be.tokens={header:[],cells:[]},ye=Be.header.length,ue=0;ue<ye;ue++)Be.tokens.header[ue]=[],this.inlineTokens(Be.header[ue],Be.tokens.header[ue]);for(ye=Be.cells.length,ue=0;ue<ye;ue++)for(Le=Be.cells[ue],Be.tokens.cells[ue]=[],ge=0;ge<Le.length;ge++)Be.tokens.cells[ue][ge]=[],this.inlineTokens(Le[ge],Be.tokens.cells[ue][ge]);break}case"blockquote":{this.inline(Be.tokens);break}case"list":{for(ye=Be.items.length,ue=0;ue<ye;ue++)this.inline(Be.items[ue].tokens);break}}}return ie},fe.inlineTokens=function(ie,re,ue,ge,ye){re===void 0&&(re=[]),ue===void 0&&(ue=!1),ge===void 0&&(ge=!1),ye===void 0&&(ye="");var Le,Be=ie,pt;if(this.tokens.links){var It=Object.keys(this.tokens.links);if(It.length>0)for(;(pt=this.tokenizer.rules.inline.reflinkSearch.exec(Be))!=null;)It.includes(pt[0].slice(pt[0].lastIndexOf("[")+1,-1))&&(Be=Be.slice(0,pt.index)+"["+"a".repeat(pt[0].length-2)+"]"+Be.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(pt=this.tokenizer.rules.inline.blockSkip.exec(Be))!=null;)Be=Be.slice(0,pt.index)+"["+"a".repeat(pt[0].length-2)+"]"+Be.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ie;){if(Le=this.tokenizer.escape(ie)){ie=ie.substring(Le.raw.length),re.push(Le);continue}if(Le=this.tokenizer.tag(ie,ue,ge)){ie=ie.substring(Le.raw.length),ue=Le.inLink,ge=Le.inRawBlock,re.push(Le);continue}if(Le=this.tokenizer.link(ie)){ie=ie.substring(Le.raw.length),Le.type==="link"&&(Le.tokens=this.inlineTokens(Le.text,[],!0,ge)),re.push(Le);continue}if(Le=this.tokenizer.reflink(ie,this.tokens.links)){ie=ie.substring(Le.raw.length),Le.type==="link"&&(Le.tokens=this.inlineTokens(Le.text,[],!0,ge)),re.push(Le);continue}if(Le=this.tokenizer.strong(ie,Be,ye)){ie=ie.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],ue,ge),re.push(Le);continue}if(Le=this.tokenizer.em(ie,Be,ye)){ie=ie.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],ue,ge),re.push(Le);continue}if(Le=this.tokenizer.codespan(ie)){ie=ie.substring(Le.raw.length),re.push(Le);continue}if(Le=this.tokenizer.br(ie)){ie=ie.substring(Le.raw.length),re.push(Le);continue}if(Le=this.tokenizer.del(ie)){ie=ie.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],ue,ge),re.push(Le);continue}if(Le=this.tokenizer.autolink(ie,Pe)){ie=ie.substring(Le.raw.length),re.push(Le);continue}if(!ue&&(Le=this.tokenizer.url(ie,Pe))){ie=ie.substring(Le.raw.length),re.push(Le);continue}if(Le=this.tokenizer.inlineText(ie,ge,Qe)){ie=ie.substring(Le.raw.length),ye=Le.raw.slice(-1),re.push(Le);continue}if(ie){var Lt="Infinite loop on byte: "+ie.charCodeAt(0);if(this.options.silent){console.error(Lt);break}else throw new Error(Lt)}}return re},Z(be,null,[{key:"rules",get:function(){return{block:We,inline:Xe}}}]),be}(),Ye=V.defaults,Ze=X.cleanUrl,Ve=X.escape,He=function(){function be(pe){this.options=pe||Ye}var fe=be.prototype;return fe.code=function(ie,re,ue){var ge=(re||"").match(/\S*/)[0];if(this.options.highlight){var ye=this.options.highlight(ie,ge);ye!=null&&ye!==ie&&(ue=!0,ie=ye)}return ge?'<pre><code class="'+this.options.langPrefix+Ve(ge,!0)+'">'+(ue?ie:Ve(ie,!0))+`</code></pre>
|
|
`:"<pre><code>"+(ue?ie:Ve(ie,!0))+`</code></pre>
|
|
`},fe.blockquote=function(ie){return`<blockquote>
|
|
`+ie+`</blockquote>
|
|
`},fe.html=function(ie){return ie},fe.heading=function(ie,re,ue,ge){return this.options.headerIds?"<h"+re+' id="'+this.options.headerPrefix+ge.slug(ue)+'">'+ie+"</h"+re+`>
|
|
`:"<h"+re+">"+ie+"</h"+re+`>
|
|
`},fe.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},fe.list=function(ie,re,ue){var ge=re?"ol":"ul",ye=re&&ue!==1?' start="'+ue+'"':"";return"<"+ge+ye+`>
|
|
`+ie+"</"+ge+`>
|
|
`},fe.listitem=function(ie){return"<li>"+ie+`</li>
|
|
`},fe.checkbox=function(ie){return"<input "+(ie?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},fe.paragraph=function(ie){return"<p>"+ie+`</p>
|
|
`},fe.table=function(ie,re){return re&&(re="<tbody>"+re+"</tbody>"),`<table>
|
|
<thead>
|
|
`+ie+`</thead>
|
|
`+re+`</table>
|
|
`},fe.tablerow=function(ie){return`<tr>
|
|
`+ie+`</tr>
|
|
`},fe.tablecell=function(ie,re){var ue=re.header?"th":"td",ge=re.align?"<"+ue+' align="'+re.align+'">':"<"+ue+">";return ge+ie+"</"+ue+`>
|
|
`},fe.strong=function(ie){return"<strong>"+ie+"</strong>"},fe.em=function(ie){return"<em>"+ie+"</em>"},fe.codespan=function(ie){return"<code>"+ie+"</code>"},fe.br=function(){return this.options.xhtml?"<br/>":"<br>"},fe.del=function(ie){return"<del>"+ie+"</del>"},fe.link=function(ie,re,ue){if(ie=Ze(this.options.sanitize,this.options.baseUrl,ie),ie===null)return ue;var ge='<a href="'+Ve(ie)+'"';return re&&(ge+=' title="'+re+'"'),ge+=">"+ue+"</a>",ge},fe.image=function(ie,re,ue){if(ie=Ze(this.options.sanitize,this.options.baseUrl,ie),ie===null)return ue;var ge='<img src="'+ie+'" alt="'+ue+'"';return re&&(ge+=' title="'+re+'"'),ge+=this.options.xhtml?"/>":">",ge},fe.text=function(ie){return ie},be}(),Fe=function(){function be(){}var fe=be.prototype;return fe.strong=function(ie){return ie},fe.em=function(ie){return ie},fe.codespan=function(ie){return ie},fe.del=function(ie){return ie},fe.html=function(ie){return ie},fe.text=function(ie){return ie},fe.link=function(ie,re,ue){return""+ue},fe.image=function(ie,re,ue){return""+ue},fe.br=function(){return""},be}(),ft=function(){function be(){this.seen={}}var fe=be.prototype;return fe.slug=function(ie){var re=ie.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(re)){var ue=re;do this.seen[ue]++,re=ue+"-"+this.seen[ue];while(this.seen.hasOwnProperty(re))}return this.seen[re]=0,re},be}(),lt=V.defaults,rt=X.unescape,dt=function(){function be(pe){this.options=pe||lt,this.options.renderer=this.options.renderer||new He,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Fe,this.slugger=new ft}be.parse=function(ie,re){var ue=new be(re);return ue.parse(ie)};var fe=be.prototype;return fe.parse=function(ie,re){re===void 0&&(re=!0);var ue="",ge,ye,Le,Be,pt,It,Lt,Vt,tt,ke,Ct,Rt,ni,Qt,Tt,qe,Oi,xe,Dt=ie.length;for(ge=0;ge<Dt;ge++){ke=ie[ge];switch(ke.type){case"space":continue;case"hr":{ue+=this.renderer.hr();continue}case"heading":{ue+=this.renderer.heading(this.parseInline(ke.tokens),ke.depth,rt(this.parseInline(ke.tokens,this.textRenderer)),this.slugger);continue}case"code":{ue+=this.renderer.code(ke.text,ke.lang,ke.escaped);continue}case"table":{for(Vt="",Lt="",Be=ke.header.length,ye=0;ye<Be;ye++)Lt+=this.renderer.tablecell(this.parseInline(ke.tokens.header[ye]),{header:!0,align:ke.align[ye]});for(Vt+=this.renderer.tablerow(Lt),tt="",Be=ke.cells.length,ye=0;ye<Be;ye++){for(It=ke.tokens.cells[ye],Lt="",pt=It.length,Le=0;Le<pt;Le++)Lt+=this.renderer.tablecell(this.parseInline(It[Le]),{header:!1,align:ke.align[Le]});tt+=this.renderer.tablerow(Lt)}ue+=this.renderer.table(Vt,tt);continue}case"blockquote":{tt=this.parse(ke.tokens),ue+=this.renderer.blockquote(tt);continue}case"list":{for(Ct=ke.ordered,Rt=ke.start,ni=ke.loose,Be=ke.items.length,tt="",ye=0;ye<Be;ye++)Tt=ke.items[ye],qe=Tt.checked,Oi=Tt.task,Qt="",Tt.task&&(xe=this.renderer.checkbox(qe),ni?Tt.tokens.length>0&&Tt.tokens[0].type==="text"?(Tt.tokens[0].text=xe+" "+Tt.tokens[0].text,Tt.tokens[0].tokens&&Tt.tokens[0].tokens.length>0&&Tt.tokens[0].tokens[0].type==="text"&&(Tt.tokens[0].tokens[0].text=xe+" "+Tt.tokens[0].tokens[0].text)):Tt.tokens.unshift({type:"text",text:xe}):Qt+=xe),Qt+=this.parse(Tt.tokens,ni),tt+=this.renderer.listitem(Qt,Oi,qe);ue+=this.renderer.list(tt,Ct,Rt);continue}case"html":{ue+=this.renderer.html(ke.text);continue}case"paragraph":{ue+=this.renderer.paragraph(this.parseInline(ke.tokens));continue}case"text":{for(tt=ke.tokens?this.parseInline(ke.tokens):ke.text;ge+1<Dt&&ie[ge+1].type==="text";)ke=ie[++ge],tt+=`
|
|
`+(ke.tokens?this.parseInline(ke.tokens):ke.text);ue+=re?this.renderer.paragraph(tt):tt;continue}default:{var Ut='Token with "'+ke.type+'" type was not found.';if(this.options.silent){console.error(Ut);return}else throw new Error(Ut)}}}return ue},fe.parseInline=function(ie,re){re=re||this.renderer;var ue="",ge,ye,Le=ie.length;for(ge=0;ge<Le;ge++){ye=ie[ge];switch(ye.type){case"escape":{ue+=re.text(ye.text);break}case"html":{ue+=re.html(ye.text);break}case"link":{ue+=re.link(ye.href,ye.title,this.parseInline(ye.tokens,re));break}case"image":{ue+=re.image(ye.href,ye.title,ye.text);break}case"strong":{ue+=re.strong(this.parseInline(ye.tokens,re));break}case"em":{ue+=re.em(this.parseInline(ye.tokens,re));break}case"codespan":{ue+=re.codespan(ye.text);break}case"br":{ue+=re.br();break}case"del":{ue+=re.del(this.parseInline(ye.tokens,re));break}case"text":{ue+=re.text(ye.text);break}default:{var Be='Token with "'+ye.type+'" type was not found.';if(this.options.silent){console.error(Be);return}else throw new Error(Be)}}}return ue},be}(),bt=X.merge,ut=X.checkSanitizeDeprecation,at=X.escape,Ie=V.getDefaults,yt=V.changeDefaults,nt=V.defaults;function Oe(be,fe,pe){if(typeof be=="undefined"||be===null)throw new Error("marked(): input parameter is undefined or null");if(typeof be!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(be)+", string expected");if(typeof fe=="function"&&(pe=fe,fe=null),fe=bt({},Oe.defaults,fe||{}),ut(fe),pe){var ie=fe.highlight,re;try{re=Ue.lex(be,fe)}catch(Le){return pe(Le)}var ue=function(Be){var pt;if(!Be)try{pt=dt.parse(re,fe)}catch(It){Be=It}return fe.highlight=ie,Be?pe(Be):pe(null,pt)};if(!ie||ie.length<3)return ue();if(delete fe.highlight,!re.length)return ue();var ge=0;Oe.walkTokens(re,function(Le){Le.type==="code"&&(ge++,setTimeout(function(){ie(Le.text,Le.lang,function(Be,pt){if(Be)return ue(Be);pt!=null&&pt!==Le.text&&(Le.text=pt,Le.escaped=!0),ge--,ge===0&&ue()})},0))}),ge===0&&ue();return}try{var ye=Ue.lex(be,fe);return fe.walkTokens&&Oe.walkTokens(ye,fe.walkTokens),dt.parse(ye,fe)}catch(Le){if(Le.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,fe.silent)return"<p>An error occurred:</p><pre>"+at(Le.message+"",!0)+"</pre>";throw Le}}Oe.options=Oe.setOptions=function(be){return bt(Oe.defaults,be),yt(Oe.defaults),Oe},Oe.getDefaults=Ie,Oe.defaults=nt,Oe.use=function(be){var fe=bt({},be);if(be.renderer&&function(){var ie=Oe.defaults.renderer||new He,re=function(ye){var Le=ie[ye];ie[ye]=function(){for(var Be=arguments.length,pt=new Array(Be),It=0;It<Be;It++)pt[It]=arguments[It];var Lt=be.renderer[ye].apply(ie,pt);return Lt===!1&&(Lt=Le.apply(ie,pt)),Lt}};for(var ue in be.renderer)re(ue);fe.renderer=ie}(),be.tokenizer&&function(){var ie=Oe.defaults.tokenizer||new de,re=function(ye){var Le=ie[ye];ie[ye]=function(){for(var Be=arguments.length,pt=new Array(Be),It=0;It<Be;It++)pt[It]=arguments[It];var Lt=be.tokenizer[ye].apply(ie,pt);return Lt===!1&&(Lt=Le.apply(ie,pt)),Lt}};for(var ue in be.tokenizer)re(ue);fe.tokenizer=ie}(),be.walkTokens){var pe=Oe.defaults.walkTokens;fe.walkTokens=function(ie){be.walkTokens(ie),pe&&pe(ie)}}Oe.setOptions(fe)},Oe.walkTokens=function(be,fe){for(var pe=j(be),ie;!(ie=pe()).done;){var re=ie.value;fe(re);switch(re.type){case"table":{for(var ue=j(re.tokens.header),ge;!(ge=ue()).done;){var ye=ge.value;Oe.walkTokens(ye,fe)}for(var Le=j(re.tokens.cells),Be;!(Be=Le()).done;)for(var pt=Be.value,It=j(pt),Lt;!(Lt=It()).done;){var Vt=Lt.value;Oe.walkTokens(Vt,fe)}break}case"list":{Oe.walkTokens(re.items,fe);break}default:re.tokens&&Oe.walkTokens(re.tokens,fe)}}},Oe.Parser=dt,Oe.parser=dt.parse,Oe.Renderer=He,Oe.TextRenderer=Fe,Oe.Lexer=Ue,Oe.lexer=Ue.lex,Oe.Tokenizer=de,Oe.Slugger=ft,Oe.parse=Oe;var Ge=Oe;return Ge})},ELLl:function(Mt,st,ne){(function(oe){oe(ne("VrN/"))})(function(oe){var Z={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=oe.Pos;oe.defineOption("autoCloseBrackets",!1,function(h,d,l){l&&l!=oe.Init&&(h.removeKeyMap(j),h.state.closeBrackets=null),d&&(F($(d,"pairs")),h.state.closeBrackets=d,h.addKeyMap(j))});function $(h,d){return d=="pairs"&&typeof h=="string"?h:typeof h=="object"&&h[d]!=null?h[d]:Z[d]}var j={Backspace:k,Enter:L};function F(h){for(var d=0;d<h.length;d++){var l=h.charAt(d),s="'"+l+"'";j[s]||(j[s]=V(l))}}F(Z.pairs+"`");function V(h){return function(d){return v(d,h)}}function H(h){var d=h.state.closeBrackets;if(!d||d.override)return d;var l=h.getModeAt(h.getCursor());return l.closeBrackets||d}function k(h){var d=H(h);if(!d||h.getOption("disableInput"))return oe.Pass;for(var l=$(d,"pairs"),s=h.listSelections(),u=0;u<s.length;u++){if(!s[u].empty())return oe.Pass;var f=p(h,s[u].head);if(!f||l.indexOf(f)%2!=0)return oe.Pass}for(var u=s.length-1;u>=0;u--){var O=s[u].head;h.replaceRange("",D(O.line,O.ch-1),D(O.line,O.ch+1),"+delete")}}function L(h){var d=H(h),l=d&&$(d,"explode");if(!l||h.getOption("disableInput"))return oe.Pass;for(var s=h.listSelections(),u=0;u<s.length;u++){if(!s[u].empty())return oe.Pass;var f=p(h,s[u].head);if(!f||l.indexOf(f)%2!=0)return oe.Pass}h.operation(function(){var O=h.lineSeparator()||`
|
|
`;h.replaceSelection(O+O,null),h.execCommand("goCharLeft"),s=h.listSelections();for(var x=0;x<s.length;x++){var w=s[x].head.line;h.indentLine(w,null,!0),h.indentLine(w+1,null,!0)}})}function y(h){var d=oe.cmpPos(h.anchor,h.head)>0;return{anchor:new D(h.anchor.line,h.anchor.ch+(d?-1:1)),head:new D(h.head.line,h.head.ch+(d?1:-1))}}function v(h,d){var l=H(h);if(!l||h.getOption("disableInput"))return oe.Pass;var s=$(l,"pairs"),u=s.indexOf(d);if(u==-1)return oe.Pass;for(var f=$(l,"closeBefore"),O=$(l,"triples"),x=s.charAt(u+1)==d,w=h.listSelections(),A=u%2==0,R,T=0;T<w.length;T++){var E=w[T],g=E.head,a,m=h.getRange(g,D(g.line,g.ch+1));if(A&&!E.empty())a="surround";else if((x||!A)&&m==d)x&&c(h,g)?a="both":O.indexOf(d)>=0&&h.getRange(g,D(g.line,g.ch+3))==d+d+d?a="skipThree":a="skip";else if(x&&g.ch>1&&O.indexOf(d)>=0&&h.getRange(D(g.line,g.ch-2),g)==d+d){if(g.ch>2&&/\bstring/.test(h.getTokenTypeAt(D(g.line,g.ch-2))))return oe.Pass;a="addFour"}else if(x){var r=g.ch==0?" ":h.getRange(D(g.line,g.ch-1),g);if(!oe.isWordChar(m)&&r!=d&&!oe.isWordChar(r))a="both";else return oe.Pass}else if(A&&(m.length===0||/\s/.test(m)||f.indexOf(m)>-1))a="both";else return oe.Pass;if(!R)R=a;else if(R!=a)return oe.Pass}var b=u%2?s.charAt(u-1):d,P=u%2?d:s.charAt(u+1);h.operation(function(){if(R=="skip")h.execCommand("goCharRight");else if(R=="skipThree")for(var M=0;M<3;M++)h.execCommand("goCharRight");else if(R=="surround"){for(var W=h.getSelections(),M=0;M<W.length;M++)W[M]=b+W[M]+P;h.replaceSelections(W,"around"),W=h.listSelections().slice();for(var M=0;M<W.length;M++)W[M]=y(W[M]);h.setSelections(W)}else R=="both"?(h.replaceSelection(b+P,null),h.triggerElectric(b+P),h.execCommand("goCharLeft")):R=="addFour"&&(h.replaceSelection(b+b+b+b,"before"),h.execCommand("goCharRight"))})}function p(h,d){var l=h.getRange(D(d.line,d.ch-1),D(d.line,d.ch+1));return l.length==2?l:null}function c(h,d){var l=h.getTokenAt(D(d.line,d.ch+1));return/\bstring/.test(l.type)&&l.start==d.ch&&(d.ch==0||!/\bstring/.test(h.getTokenTypeAt(d)))}})},HmJG:function(Mt,st,ne){},LdHM:function(Mt,st,ne){"use strict";ne.d(st,"b",function(){return f}),ne.d(st,"a",function(){return x});var oe=ne("1OyB"),Z=ne("vuIU"),D=ne("Ji7U"),$=ne("LK+K"),j=ne("q1tI"),F=ne("rePB"),V=ne("Ff2n"),H=ne("ODXe"),k=ne("4IlW"),L=ne("bX4T"),y=ne("YrtM"),v=ne("TSYQ"),p=ne.n(v),c=ne("+nKL"),h=ne("8OUc"),d=function(B,J){var te=B.prefixCls,ae=B.id,_e=B.flattenOptions,de=B.childrenAsData,Ee=B.values,Te=B.searchValue,me=B.multiple,ce=B.defaultActiveFirstOption,se=B.height,Se=B.itemHeight,je=B.notFoundContent,We=B.open,Xe=B.menuItemSelectedIcon,Qe=B.virtual,Pe=B.onSelect,Ue=B.onToggleOpen,Ye=B.onActiveValue,Ze=B.onScroll,Ve=B.onMouseEnter,He="".concat(te,"-item"),Fe=Object(y.a)(function(){return _e},[We,_e],function(Ge,be){return be[0]&&Ge[1]!==be[1]}),ft=j.useRef(null),lt=function(be){be.preventDefault()},rt=function(be){ft.current&&ft.current.scrollTo({index:be})},dt=function(be){for(var fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,pe=Fe.length,ie=0;ie<pe;ie+=1){var re=(be+ie*fe+pe)%pe,ue=Fe[re],ge=ue.group,ye=ue.data;if(!ge&&!ye.disabled)return re}return-1},bt=j.useState(function(){return dt(0)}),ut=Object(H.a)(bt,2),at=ut[0],Ie=ut[1],yt=function(be){Ie(be);var fe=Fe[be];if(!fe){Ye(null,-1);return}Ye(fe.data.value,be)};j.useEffect(function(){yt(ce!==!1?dt(0):-1)},[Fe.length,Te]),j.useEffect(function(){var Ge=setTimeout(function(){if(!me&&We&&Ee.size===1){var be=Array.from(Ee)[0],fe=Fe.findIndex(function(pe){var ie=pe.data;return ie.value===be});yt(fe),rt(fe)}});return function(){return clearTimeout(Ge)}},[We]);var nt=function(be){be!==void 0&&Pe(be,{selected:!Ee.has(be)}),me||Ue(!1)};if(j.useImperativeHandle(J,function(){return{onKeyDown:function(be){var fe=be.which;switch(fe){case k.a.UP:case k.a.DOWN:{var pe=0;if(fe===k.a.UP?pe=-1:fe===k.a.DOWN&&(pe=1),pe!==0){var ie=dt(at+pe,pe);rt(ie),yt(ie)}break}case k.a.ENTER:{var re=Fe[at];re&&!re.data.disabled?nt(re.data.value):nt(void 0),We&&be.preventDefault();break}case k.a.ESC:Ue(!1)}},onKeyUp:function(){},scrollTo:function(be){rt(be)}}}),Fe.length===0)return j.createElement("div",{role:"listbox",id:"".concat(ae,"_list"),className:"".concat(He,"-empty"),onMouseDown:lt},je);function Oe(Ge){var be=Fe[Ge];if(!be)return null;var fe=be.data||{},pe=fe.value,ie=fe.label,re=fe.children,ue=Object(L.a)(fe,!0),ge=de?re:ie;return be?j.createElement("div",Object.assign({"aria-label":typeof ge=="string"?ge:null},ue,{key:Ge,role:"option",id:"".concat(ae,"_list_").concat(Ge),"aria-selected":Ee.has(pe)}),pe):null}return j.createElement(j.Fragment,null,j.createElement("div",{role:"listbox",id:"".concat(ae,"_list"),style:{height:0,width:0,overflow:"hidden"}},Oe(at-1),Oe(at),Oe(at+1)),j.createElement(c.a,{itemKey:"key",ref:ft,data:Fe,height:se,itemHeight:Se,fullHeight:!1,onMouseDown:lt,onScroll:Ze,virtual:Qe,onMouseEnter:Ve},function(Ge,be){var fe,pe=Ge.group,ie=Ge.groupOption,re=Ge.data,ue=re.label,ge=re.key;if(pe)return j.createElement("div",{className:p()(He,"".concat(He,"-group"))},ue!==void 0?ue:ge);var ye=re.disabled,Le=re.value,Be=re.title,pt=re.children,It=re.style,Lt=re.className,Vt=Object(V.a)(re,["disabled","value","title","children","style","className"]),tt=Ee.has(Le),ke="".concat(He,"-option"),Ct=p()(He,ke,Lt,(fe={},Object(F.a)(fe,"".concat(ke,"-grouped"),ie),Object(F.a)(fe,"".concat(ke,"-active"),at===be&&!ye),Object(F.a)(fe,"".concat(ke,"-disabled"),ye),Object(F.a)(fe,"".concat(ke,"-selected"),tt),fe)),Rt=de?pt:ue,ni=!Xe||typeof Xe=="function"||tt;return j.createElement("div",Object.assign({},Vt,{"aria-selected":tt,className:Ct,title:Be,onMouseMove:function(){if(at===be||ye)return;yt(be)},onClick:function(){ye||nt(Le)},style:It}),j.createElement("div",{className:"".concat(ke,"-content")},Rt||Le),j.isValidElement(Xe)||tt,ni&&j.createElement(h.a,{className:"".concat(He,"-option-state"),customizeIcon:Xe,customizeIconProps:{isSelected:tt}},tt?"\u2713":null))}))},l=j.forwardRef(d);l.displayName="OptionList";var s=l,u=function(){return null};u.isSelectOption=!0;var f=u,O=function(){return null};O.isSelectOptGroup=!0;var x=O,w=ne("VTBJ"),A=ne("Zm9Q");function R(S){var B=S.key,J=S.props,te=J.children,ae=J.value,_e=Object(V.a)(J,["children","value"]);return Object(w.a)({key:B,value:ae!==void 0?ae:B,children:te},_e)}function T(S){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(A.a)(S).map(function(J,te){if(!j.isValidElement(J)||!J.type)return null;var ae=J.type.isSelectOptGroup,_e=J.key,de=J.props,Ee=de.children,Te=Object(V.a)(de,["children"]);return B||!ae?R(J):Object(w.a)(Object(w.a)({key:"__RC_SELECT_GRP__".concat(_e===null?te:_e,"__"),label:_e},Te),{},{options:T(Ee)})}).filter(function(J){return J})}var E=ne("2Qr1"),g=ne("qNPg"),a=ne("U8pU"),m=ne("Kwbf"),r=ne("WKfj");function b(S){var B=S.mode,J=S.options,te=S.children,ae=S.backfill,_e=S.allowClear,de=S.placeholder,Ee=S.getInputElement,Te=S.showSearch,me=S.onSearch,ce=S.defaultOpen,se=S.autoFocus,Se=S.labelInValue,je=S.value,We=S.inputValue,Xe=S.optionLabelProp,Qe=B==="multiple"||B==="tags",Pe=Te!==void 0?Te:Qe||B==="combobox",Ue=J||T(te);if(Object(m.a)(B!=="tags"||Ue.every(function(He){return!He.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),B==="tags"||B==="combobox"){var Ye=Ue.some(function(He){return He.options?He.options.some(function(Fe){return typeof("value"in Fe?Fe.value:Fe.key)=="number"}):typeof("value"in He?He.value:He.key)=="number"});Object(m.a)(!Ye,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(m.a)(B!=="combobox"||!Xe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(m.a)(B==="combobox"||!ae,"`backfill` only works with `combobox` mode."),Object(m.a)(B==="combobox"||!Ee,"`getInputElement` only work with `combobox` mode."),Object(m.b)(B!=="combobox"||!Ee||!_e||!de,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),me&&!Pe&&B!=="combobox"&&B!=="tags"&&Object(m.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(m.b)(!ce||se,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),je!=null){var Ze=Object(r.d)(je);Object(m.a)(!Se||Ze.every(function(He){return Object(a.a)(He)==="object"&&("key"in He||"value"in He)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(m.a)(!Qe||Array.isArray(je),"`value` should be array when `mode` is `multiple` or `tags`")}if(te){var Ve=null;Object(A.a)(te).some(function(He){if(!j.isValidElement(He)||!He.type)return!1;var Fe=He.type;if(Fe.isSelectOption)return!1;if(Fe.isSelectOptGroup){var ft=Object(A.a)(He.props.children).every(function(lt){return!j.isValidElement(lt)||!He.type||lt.type.isSelectOption?!0:(Ve=lt.type,!1)});return!ft}return Ve=Fe,!0}),Ve&&Object(m.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ve.displayName||Ve.name||Ve,"`.")),Object(m.a)(We===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var P=b,M=Object(g.a)({prefixCls:"rc-select",components:{optionList:s},convertChildrenToData:T,flattenOptions:E.d,getLabeledValue:E.e,filterOptions:E.b,isValueDisabled:E.g,findValueOption:E.c,warningProps:P,fillOptionsWithMissingValue:E.a}),W=function(S){Object(D.a)(J,S);var B=Object($.a)(J);function J(){var te;return Object(oe.a)(this,J),te=B.apply(this,arguments),te.selectRef=j.createRef(),te.focus=function(){te.selectRef.current.focus()},te.blur=function(){te.selectRef.current.blur()},te}return Object(Z.a)(J,[{key:"render",value:function(){return j.createElement(M,Object.assign({ref:this.selectRef},this.props))}}]),J}(j.Component);W.Option=f,W.OptGroup=x;var X=W,U=st.c=X},LuLp:function(Mt,st,ne){Mt.exports={flex_box_center:"flex_box_center___4bUZY",flex_space_between:"flex_space_between___1xTjN",flex_box_vertical_center:"flex_box_vertical_center___1vgGz",flex_box_center_end:"flex_box_center_end___P7hNa",flex_box_column:"flex_box_column___2sxpi",wrap:"wrap___lYrXF",modal:"modal___jAVte",titleWrap:"titleWrap___3ZYOv",required:"required___TyqrE",title:"title___YHdJB",colorGray:"colorGray___QPU3J",choiceWrap:"choiceWrap___3fip5",answer:"answer___1b5_q",activeAnswer:"activeAnswer___3IKUq",deleteIcon:"deleteIcon___dg_3n",addIcon:"addIcon___3bFJA",editorWrap:"editorWrap___xeZgL",htmlWrap:"htmlWrap___1-J33",radio:"radio___14ZC8",color333:"color333___2Hi7e",color999:"color999___wFMNh",questionType:"questionType___2DcP-",questionChoices:"questionChoices___1QDDn"}},M8RZ:function(Mt,st,ne){"use strict";ne.d(st,"a",function(){return k});var oe=ne("fWQN"),Z=ne("mtLc"),D=ne("yKVA"),$=ne("879j"),j=ne("q1tI"),F=ne.n(j),V=ne("i8i4"),H=ne.n(V),k=function(L){Object(D.a)(v,L);var y=Object($.a)(v);function v(p){var c;Object(oe.a)(this,v),c=y.call(this,p);var h=window.document;return c.node=h.createElement("div"),h.body.appendChild(c.node),c}return Object(Z.a)(v,[{key:"render",value:function(){var c=this.props.children;return Object(V.createPortal)(c,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),v}(F.a.Component)},O2Wb:function(Mt,st,ne){Mt.exports={flex:"flex___2gmSR",flex1:"flex1___3Tu1g",color666:"color666___2uyGL",error:"error___yJ86W",deleteIcon:"deleteIcon___1D2tg",addIcon:"addIcon___2VIYB"}},Ot1p:function(Mt,st,ne){"use strict";var oe=ne("2qtc"),Z=ne("kLXV"),D=ne("rAM+"),$=ne("miYZ"),j=ne("tsqr"),F=ne("9og8"),V=ne("tJVT"),H=ne("jrin"),k=ne("WmNS"),L=ne.n(k),y=ne("q1tI"),v=ne.n(y),p=ne("VrN/"),c=ne.n(p),h=ne("bdgK"),d=ne("p77/"),l=ne("Bd2K"),s=ne("ELLl"),u=ne("19Vz"),f=ne("lZu9"),O=ne("+NIl"),x=ne("kSUc"),w=ne("9Bee"),A=function(ye){var Le=ye.value,Be=Le===void 0?"":Le,pt=ye.className,It=ye.showTextOnly,Lt=ye.showLines,Vt=ye.style,tt=Vt===void 0?{}:Vt,ke=Object(y.useMemo)(function(){return""},[Be]);return v.a.createElement(v.a.Fragment,null,v.a.createElement("div",{dangerouslySetInnerHTML:{__html:ke}}))},R=ne("0Owb"),T=ne("dejd"),E=ne("C+DQ"),g=ne("1vsH"),a=ne("m3rI"),m=[{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 r(ye){var Le=ye.onActionCallback,Be=ye.title,pt=ye.icon,It=ye.actionName,Lt=ye.className,Vt=Lt===void 0?"":Lt,tt=ye.children;function ke(){Le(It)}return v.a.createElement("a",{title:Be,className:Vt,onClick:ke},v.a.createElement("i",{className:"md-iconfont ".concat(pt)}),tt)}var b=function(ye){var Le=ye.watch,Be=ye.showNullButton,pt=ye.onActionCallback,It=ye.fullScreen,Lt=ye.insertTemp,Vt=ye.hidetoolBar,tt=ye.uuid,ke=ye.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(g.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(g.F)("_educoder_session"),"&key=").concat(tt,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Ct=[].concat(m,[{title:"".concat(Le?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Le?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return v.a.createElement("ul",{className:"markdown-toolbar-container"},!Vt&&Ct.map(function(Rt,ni){return v.a.createElement("li",{key:ni},Rt.actionName?v.a.createElement(r,Object(R.a)({},Rt,{onActionCallback:pt})):v.a.createElement("span",{className:"v-line"}))}),Be?v.a.createElement("li",null,v.a.createElement(r,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:pt},v.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Lt&&v.a.createElement("li",null,v.a.createElement(r,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Lt),onActionCallback:pt},v.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),v.a.createElement("li",{className:"btn-full-screen"},v.a.createElement(r,{icon:"".concat(It?"icon-shrink":"icon-enlarge"),title:It?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:pt})))},P=ne("M8RZ"),M=ne("+L6B"),W=ne("2/Rp"),X=ne("y8nQ"),U=ne("Vl3Y"),S=ne("5NDa"),B=ne("5rEg"),J={labelCol:{span:4},wrapperCol:{span:20}},te=function(ye){var Le=ye.callback,Be=ye.onCancel;function pt(It){Le(It)}return v.a.createElement(U.a,Object(R.a)({},J,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:pt}),v.a.createElement(U.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},v.a.createElement(B.a,null)),v.a.createElement(U.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},v.a.createElement(B.a,null)),v.a.createElement("div",{className:"flex-container flex-end"},v.a.createElement(W.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(W.a,{type:"ghost",onClick:Be},"\u53D6\u6D88")))},ae=ne("7ahc"),_e=ne("HmJG"),de=ne("BjJ7"),Ee=U.a.useForm,Te={width:280,marginRight:10},me={labelCol:{span:5},wrapperCol:{span:19}},ce=function(ye){var Le=ye.callback,Be=ye.onCancel,pt=Ee(),It=Object(V.a)(pt,1),Lt=It[0];function Vt(Ct){Le(Ct)}function tt(Ct,Rt){if(Ct.status===-1){j.b.error(Ct.message);return}Lt.setFieldsValue({src:"/api/attachments/".concat(Ct.id),type:Rt.type})}function ke(Ct){var Rt=Ct.target.files[0];Se(Rt,tt)}return v.a.createElement(U.a,Object(R.a)({form:Lt},me,{className:"upload-image-panel",onFinish:Vt}),v.a.createElement(U.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},v.a.createElement("div",{className:"flex-container"},v.a.createElement(U.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},v.a.createElement(B.a,{style:Te})),v.a.createElement(se,{onFileChange:ke}))),v.a.createElement(U.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},v.a.createElement(B.a,{style:{width:264}})),v.a.createElement(U.a.Item,{style:{textAlign:"right"}},v.a.createElement(W.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(W.a,{type:"ghost",onClick:Be},"\u53D6\u6D88")))};function se(ye){var Le=ye.onFileChange;return v.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",v.a.createElement("input",{type:"file",onChange:Le}))}function Se(ye,Le){if(!ye)throw new String("\u6CA1\u6709\u6587\u4EF6");var Be=new FormData;Be.append("editormd-image-file",ye),Be.append("file_param_name","editormd-image-file"),Be.append("byxhr","true");var pt=new window.XMLHttpRequest;pt.withCredentials=!0,pt.addEventListener("load",function(It){Le(JSON.parse(It.target.responseText),ye)},!1),pt.addEventListener("error",function(It){console.error(It)},!1),pt.open("POST","".concat(de.a,"/api/attachments.json")),pt.send(Be)}var je=ne("giR+"),We=ne("fyUT"),Xe=ne("7Kak"),Qe=ne("9yH6"),Pe=Qe.a.Group,Ue={margin:"0 8px"},Ye=function(ye){var Le=ye.callback,Be=ye.onCancel;function pt(It){Le(It)}return v.a.createElement(U.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:pt},v.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},v.a.createElement("span",{style:Ue},"\u5355\u5143\u683C\u6570\uFF1A"),v.a.createElement("span",{style:Ue},"\u884C\u6570"),v.a.createElement(U.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},v.a.createElement(We.a,null)),v.a.createElement("span",{style:Ue},"\u5217\u6570"),v.a.createElement(U.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},v.a.createElement(We.a,null))),v.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},v.a.createElement("span",{style:Ue},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),v.a.createElement(U.a.Item,{name:"align"},v.a.createElement(Pe,null,v.a.createElement(Qe.a,{value:"default"},v.a.createElement("i",{className:"fa fa-align-justify"})),v.a.createElement(Qe.a,{value:"left"},v.a.createElement("i",{className:"fa fa-align-left"})),v.a.createElement(Qe.a,{value:"center"},v.a.createElement("i",{className:"fa fa-align-center"})),v.a.createElement(Qe.a,{value:"right"},v.a.createElement("i",{className:"fa fa-align-right"}))))),v.a.createElement("div",{className:"flex-container flex-end"},v.a.createElement(W.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(W.a,{type:"ghost",onClick:Be},"\u53D6\u6D88")))},Ze=ne("ErOA"),Ve=ne("7Cbv"),He="link",Fe="upload-image",ft="code-block",lt="add-table",rt="------------",dt={default:rt,left:":".concat(rt),center:":".concat(rt,":"),right:"".concat(rt,":")},bt=ne("9VGf"),ut,at;function Ie(){}var yt=0,nt=1e4,Oe="\u2581",Ge=`
|
|
**\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 be(ye){return/^\d+$/.test(ye)?"".concat(ye,"px"):ye}var fe=navigator.platform.toUpperCase().indexOf("MAC")>=0,pe=fe?"Cmd":"Ctrl",ie=["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"],re=(ut={},Object(H.a)(ut,pe+"-B","bold"),Object(H.a)(ut,pe+"-I","italic"),ut),ue=(at={},Object(H.a)(at,He,"\u6DFB\u52A0\u94FE\u63A5"),Object(H.a)(at,ft,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(H.a)(at,Fe,"\u6DFB\u52A0\u6587\u4EF6"),Object(H.a)(at,lt,"\u6DFB\u52A0\u8868\u683C"),at),ge=st.a=function(ye){var Le=ye.defaultValue,Be=Le===void 0?"":Le,pt=ye.onChange,It=ye.width,Lt=It===void 0?"100%":It,Vt=ye.height,tt=Vt===void 0?400:Vt,ke=ye.miniToolbar,Ct=ke===void 0?!1:ke,Rt=ye.isFocus,ni=Rt===void 0?!1:Rt,Qt=ye.watch,Tt=ye.insertTemp,qe=ye.mode,Oi=qe===void 0?"markdown":qe,xe=ye.id,Dt=xe===void 0?"markdown-editor-id":xe,Ut=ye.showResizeBar,Ft=Ut===void 0?!1:Ut,At=ye.noStorage,ei=At===void 0?!1:At,di=ye.showNullButton,Bt=di===void 0?!1:di,it=ye.hidetoolBar,fi=it===void 0?!1:it,ri=ye.fullScreen,Kt=ri===void 0?!1:ri,Et=ye.onBlur,Nt=ye.onCMBeforeChange,ti=ye.onFullScreen,oi=ye.className,De=oi===void 0?"":oi,gt=ye.disablePaste,pi=gt===void 0?!1:gt,Ei=ye.placeholder,wi=Ei===void 0?"":Ei,vi=ye.values,K=vi===void 0?"":vi,_=Object(y.useState)(null),C=Object(V.a)(_,2),N=C[0],Q=C[1],G=Object(y.useState)(Be),le=Object(V.a)(G,2),Ae=le[0],Me=le[1],ot=Object(y.useState)(Qt),Re=Object(V.a)(ot,2),$e=Re[0],ze=Re[1],xt=Object(y.useState)(Kt),vt=Object(V.a)(xt,2),hi=vt[0],Pt=vt[1],zt=Object(y.useState)(""),yi=Object(V.a)(zt,2),Si=yi[0],bi=yi[1],Jt=Object(y.useState)(0),wt=Object(V.a)(Jt,2),mt=wt[0],Wt=wt[1],$t=Object(y.useState)(tt),ai=Object(V.a)($t,2),Ht=ai[0],Fi=ai[1],Di=Object(y.useState)(!1),en=Object(V.a)(Di,2),gn=en[0],Cn=en[1],xi=Object(y.useRef)(Object(Ve.a)()),li=Object(y.useRef)(!1),Ci=Object(y.useRef)(),qt=Object(y.useRef)(),Ii=Object(y.useRef)(),ui=Object(y.useRef)(),pn=Object(y.useRef)(),Pi=function(){var et=Object(F.a)(L.a.mark(function kt(){var Ot,Xt;return L.a.wrap(function(ci){for(;;)switch(ci.prev=ci.next){case 0:return ci.next=2,Object(Ze.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:xi.current}});case 2:Xt=ci.sent,Xt!=null&&(Ot=Xt.attachments)!==null&&Ot!==void 0&&Ot.length&&(console.log("cm:",N,qt),Xt.attachments.map(function(si){si.content_type.indexOf("image")>-1?N.replaceSelection(".concat(si.content_type,")")):si.content_type.indexOf("video")>-1?N.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):si.content_type.indexOf("pdf")>-1?N.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(si.id,"?type=").concat(si.content_type,'&disposition=inline" target="_blank">').concat(si.name,"</a>")):N.replaceSelection("[".concat(si.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(si.id,"?type=").concat(si.content_type,")"))}));case 4:case"end":return ci.stop()}},kt)}));return function(){return et.apply(this,arguments)}}();Object(y.useEffect)(function(){Me(K),N==null||N.setValue(K)},[K]),Object(y.useEffect)(function(){ti==null||ti(hi)},[hi]),Object(y.useEffect)(function(){if(qt.current){var et=c.a.fromTextArea(qt.current,{mode:Oi,lineNumbers:!Ct,lineWrapping:!0,value:Be,autoCloseTags:!0,autoCloseBrackets:!0});ni&&et.focus();function kt(Ot,Xt){if(pi){Xt.preventDefault();return}var Yt=Xt.clipboardData;if(Yt){var ci=Yt.types.toString(),si=Yt.items;if(ci==="Files"||Yt.types.indexOf("Files")>-1){if(Xt.preventDefault(),Oi=="stex")return;try{var Bi,tn=si[1];((Bi=si[0])===null||Bi===void 0?void 0:Bi.kind)==="file"&&(tn=si[0]);var ii=tn.getAsFile(),An=ii.name.split(".").pop();Se(ii,function(mi){if(mi.id){var nn,$i,mn;(ii==null||((nn=ii.type)===null||nn===void 0)?void 0:nn.indexOf("image"))>-1?et.replaceSelection(".concat(mi.content_type,")")):(ii==null||(($i=ii.type)===null||$i===void 0)?void 0:$i.indexOf("video"))>-1?et.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(mi.id,'"></video>')):(ii==null||((mn=ii.type)===null||mn===void 0)?void 0:mn.indexOf("pdf"))>-1?et.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(mi.id,"?type=").concat(ii.type,'&disposition=inline" target="_blank">').concat(ii.name,"</a>")):ie.includes(An)?et.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(mi.id,'?type=office&disposition=inline" target="_blank">').concat(ii.name,"</a>")):et.replaceSelection("[".concat(ii.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(mi.id,"?type=").concat(mi.content_type,")"))}else(mi==null?void 0:mi.status)===401&&(document.location.href="/user/login")})}catch(mi){j.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return et.on("paste",kt),et.on("dragleave",function(Ot,Xt){Ii.current.classList.remove("mouse-hover-md")}),et.on("dragover",function(Ot,Xt){Ii.current.classList.add("mouse-hover-md")}),et.on("drop",function(Ot,Xt){Ii.current.classList.add("mouse-hover-md");var Yt;if(Yt=Xt.dataTransfer.files,Yt.length>0){Xt.preventDefault(),Xt.stopPropagation();for(var ci=function(tn){var ii=Yt[tn],An=ii.name.split(".").pop();Se(ii,function(mi){if(mi.id){var nn,$i,mn;(ii==null||((nn=ii.type)===null||nn===void 0)?void 0:nn.indexOf("image"))>-1?et.replaceSelection(".concat(mi.content_type,")")):(ii==null||(($i=ii.type)===null||$i===void 0)?void 0:$i.indexOf("video"))>-1?et.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(mi.id,'"></video>')):(ii==null||((mn=ii.type)===null||mn===void 0)?void 0:mn.indexOf("pdf"))>-1?et.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(mi.id,"?type=").concat(ii.type,'&disposition=inline" target="_blank">').concat(ii.name,"</a>")):ie.includes(An)?et.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(mi.id,'?type=office&disposition=inline" target="_blank">').concat(ii.name,"</a>")):et.replaceSelection("[".concat(ii.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(mi.id,"?type=").concat(mi.content_type,")"))}else(mi==null?void 0:mi.status)===401&&(document.location.href="/user/login")})},si=0;si<Yt.length;si++)ci(si)}}),Q(et),function(){et.off("paste",kt)}}},[]);var Ri=Object(y.useCallback)(function(){if(Ii.current)try{}catch(et){console.log(et,"---- to set md editor body height")}},[Ht,Ii,hi]);Object(y.useEffect)(function(){function et(){var Ot=new h.default(function(Xt){var Yt=Object(D.a)(Xt),ci;try{for(Yt.s();!(ci=Yt.n()).done;){var si=ci.value;(si.target.offsetHeight>0||si.target.offsetWidth>0)&&(Ri(),N.setSize("100%","100%"),N.refresh())}}catch(Bi){Yt.e(Bi)}finally{Yt.f()}});return Ot.observe(qt.current.parentElement),Ot}if(N){var kt=et();return function(){kt.unobserve(qt.current.parentElement)}}},[N,Ri]),Object(y.useEffect)(function(){if(N){for(var et=[],kt=function(){var si=Xt[Ot];Yt=Object(V.a)(si,2);var Bi=Yt[0],tn=Yt[1],ii=Object(H.a)({},Bi,function(){En(tn)});et.push(ii),N.addKeyMap(ii)},Ot=0,Xt=Object.entries(re);Ot<Xt.length;Ot++){var Yt;kt()}return Ci.current=setInterval(function(){li.current&&Pi()},4e3),function(){clearInterval(Ci.current);var ci=Object(D.a)(et),si;try{for(ci.s();!(si=ci.n()).done;){var Bi=si.value;N.removeKeyMap(Bi)}}catch(tn){ci.e(tn)}finally{ci.f()}}}},[N]),Object(y.useEffect)(function(){Kt!==hi&&Pt(Kt)},[Kt]),Object(bt.a)(function(){if(!ei&&mt>0){var et=new Date().getTime(),kt=window.sessionStorage.getItem(Dt);et>=mt+nt&&(!kt||kt!==Ae)&&(window.sessionStorage.setItem(Dt,Ae),Cn(!0))}},nt),Object(y.useEffect)(function(){ze(Qt)},[N,Qt]),Object(y.useEffect)(function(){N&&(ni&&N.focus())},[N,ni]),Object(y.useEffect)(function(){if($e&&N){var et=N.getScrollerElement();function kt(Ot){var Xt=Ot.target;if(pn.current){var Yt=Xt.scrollTop/Xt.scrollHeight;pn.current.scrollTop=pn.current.scrollHeight*Yt}}return et.addEventListener("scroll",kt),function(){et.removeEventListener("scroll",kt)}}},[N,$e]),Object(y.useEffect)(function(){if(N&&Nt){function et(kt,Ot){Nt(kt,Ot)}return N.on("beforeChange",et),function(){N.off("beforeChange",et)}}},[N,Nt]),Object(y.useEffect)(function(){if(N&&Et){function et(){Et(N.getValue())}return N.on("blur",et),function(){N.off("blur",et)}}},[N,Et]),Object(y.useEffect)(function(){if(N){function et(kt){var Ot=kt.getValue();Me(Ot),Wt(new Date().getTime()),kt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),pt&&pt(Ot)}return N.on("change",et),function(){N.off("change",et)}}},[N,pt]),Object(y.useEffect)(function(){N&&(Be==null?(N.setValue(""),Me("")):Be!==N.getValue()&&(N.setValue(Be),Me(Be),N.setCursor(N.lineCount(),0)))},[N,Be]);var En=Object(y.useCallback)(function(et){var kt=N.getCursor(),Ot=N.getSelection(),Xt=Ot.split(`
|
|
`);switch(et){case"bold":return N.replaceSelection("**"+Ot+"**"),Ot===""&&N.setCursor(kt.line,kt.ch+2),N.focus();case"italic":return N.replaceSelection("*"+Ot+"*"),Ot===""&&N.setCursor(kt.line,kt.ch+1),N.focus();case"code":return N.replaceSelection("`"+Ot+"`"),Ot===""&&N.setCursor(kt.line,kt.ch+1),N.focus();case"inline-latex":return N.replaceSelection("`$$"+Ot+"$$`"),Ot===""&&N.setCursor(kt.line,kt.ch+3),N.focus();case"latex":return N.replaceSelection("```latex\n"+Ot+"\n```"),N.setCursor(kt.line+1,Ot.length+1),N.focus();case"line-break":return N.replaceSelection(`<br/>
|
|
`),N.focus();case"list-ul":return Ot===""?N.replaceSelection("- "+Ot):N.replaceSelection(Xt.map(function(Yt){return Yt===""?"":"- ".concat(Yt)}).join(`
|
|
`)),N.focus();case"list-ol":return Ot===""?N.replaceSelection("1. "+Ot):N.replaceSelection(Xt.map(function(Yt,ci){return Yt===""?"":"".concat(ci+1,". ").concat(Yt)}).join(`
|
|
`)),N.focus();case"add-null-ch":return Ot===""&&N.setCursor(kt.line,kt.ch+1),N.replaceSelection(Oe),N.focus();case"inster-template-1":return Ot===""&&N.setCursor(kt.line,kt.ch),N.replaceSelection(Ge),N.focus();case"eraser":return N.setValue(""),N.focus();case"trigger-watch":return ze(!$e),N.focus();case"trigger-full-screen":return Pt(!hi),N.focus();case He:bi(He);return;case ft:bi(ft);return;case Fe:bi(Fe);return;case lt:bi(lt);return;default:throw new Error}},[N,$e,hi]),xn=Object(y.useCallback)(function(et){bi("");switch(Si){case He:var kt=et.title,Ot=et.link;return N.replaceSelection("[".concat(kt,"](").concat(Ot,")")),N.focus();case ft:var Xt=et.language,Yt=et.content;return N.replaceSelection(["```"+Xt,Yt,"```"].join(`
|
|
`)),N.focus();case Fe:var ci=et.src,si=et.alt;return si?N.replaceSelection(".concat(ci,' "').concat(si,'" )')):N.replaceSelection("")),N.focus();case lt:for(var Bi=et.row,tn=et.col,ii=et.align,An=`
|
|
`,mi=0;mi<Bi;mi++){for(var nn=[],$i=[],mn=0;mn<tn;mn++)mi===1&&$i.push(dt[ii]),nn.push(" ");mi===1&&(An+="| ".concat($i.join(" | "),` |
|
|
`)),An+="| ".concat(nn.join(tn===1?"":" | "),` |
|
|
`)}return N.replaceSelection(An+`
|
|
`),N.focus();default:throw new Error}},[N,Si]),kn=Object(y.useMemo)(function(){switch(Si){case He:return v.a.createElement(te,{callback:xn,onCancel:vn});case ft:return v.a.createElement(ae.b,{callback:xn,onCancel:vn});case Fe:return v.a.createElement(ce,{callback:xn,onCancel:vn});case lt:return v.a.createElement(Ye,{callback:xn,onCancel:vn});default:return null}},[Si]);function vn(){bi("")}Object(y.useEffect)(function(){if(ui.current){var et=ui.current,kt=!1,Ot=0;function Xt(si){kt=!0,Ot=si.pageY}function Yt(){kt=!1}function ci(si){if(kt){var Bi=si.pageY-Ot;Bi<0&&(Bi=0),Bi>300&&(Bi=300);var tn=tt+Bi+"px";Fi(tn)}}return et.addEventListener("mousedown",Xt),document.addEventListener("mousemove",ci),document.addEventListener("mouseup",Yt),function(){et.removeEventListener("mousedown",Xt),document.removeEventListener("mousemove",ci),document.removeEventListener("mouseup",Yt)}}},[N,ui]),Object(y.useEffect)(function(){Fi(tt)},[tt]);var cn=be(Lt),Hn=be(Ht),Ki={width:cn,height:Hn},Wn=Object(y.useMemo)(function(){if(mt){var et=new Date(mt),kt=et.getHours(),Ot=et.getMinutes(),Xt=et.getSeconds();return kt=kt<10?"0"+kt:kt,Ot=Ot<10?"0"+Ot:Ot,Xt=Xt<10?"0"+Xt:Xt,"".concat(kt,":").concat(Ot,":").concat(Xt)}return 0},[mt]);function qn(){window.sessionStorage.removeItem(Dt),Cn(!1),Wt(0)}function Rn(){Cn(!1),Wt(0),N.setValue(window.sessionStorage.getItem(Dt))}function Vi(et,kt){var Ot=N.getValue();Ot=Ot.replace(et,kt),Me(Ot),N==null||N.setValue(Ot)}return v.a.createElement(y.Fragment,null,v.a.createElement("div",{className:"markdown-editor-wrapper",ref:Ii},v.a.createElement("div",{className:"markdown-editor-container ".concat(De," ").concat($e?"on-preview":""," ").concat(Ct?"mini":""," ").concat(hi?"full-screen":""),style:Ki},v.a.createElement(b,{insertTemp:Tt,watch:$e,fullScreen:hi,showNullButton:Bt,onActionCallback:En,hidetoolBar:fi,uuid:xi.current,setOpenPhones:function(){li.current=!0}}),v.a.createElement("div",{className:"markdown-editor-body"},v.a.createElement("div",{className:"codemirror-container"},v.a.createElement("textarea",{ref:qt,placeholder:wi})),$e?v.a.createElement("div",{ref:pn,className:"preview-container"},Oi==="stex"&&v.a.createElement(A,{value:Ae}),Oi!=="stex"&&v.a.createElement(w.a,{edit:!0,value:Ae,replaces:Vi})):null))),Ft?v.a.createElement("a",{ref:ui,className:"editor-resize"}):null,v.a.createElement(P.a,null,ue[Si]?v.a.createElement(Z.a,{centered:!0,title:ue[Si],visible:!0,onCancel:vn,footer:null,className:"markdown-popup-form"},kn):null))}},SJMd:function(Mt,st){/**
|
|
* @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 ne,oe,Z,D=!1,$,j;window.PR_SHOULD_USE_CONTINUATION=!0;var F,V;(function(){var H=window,k=["break,continue,do,else,for,if,return,while"],L=[k,"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"],y=[L,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],v=[y,"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=[y,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],c=[y,"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"],h="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",d=[y,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],l="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",s=[k,"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"],u=[k,"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"],f=[k,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],O=[v,c,p,d,l,s,u,f],x=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,w="str",A="kwd",R="com",T="typ",E="lit",g="pun",a="pln",m="tag",r="dec",b="src",P="atn",M="atv",W="nocode",X="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function U(Pe){for(var Ue=0,Ye=!1,Ze=!1,Ve=0,He=Pe.length;Ve<He;++Ve){var Fe=Pe[Ve];if(Fe.ignoreCase)Ze=!0;else if(/[a-z]/i.test(Fe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ye=!0,Ze=!1;break}}var ft={b:8,t:9,n:10,v:11,f:12,r:13};function lt(at){var Ie=at.charCodeAt(0);if(Ie!==92)return Ie;var yt=at.charAt(1);return Ie=ft[yt],Ie||("0"<=yt&&yt<="7"?parseInt(at.substring(1),8):yt==="u"||yt==="x"?parseInt(at.substring(2),16):at.charCodeAt(1))}function rt(at){if(at<32)return(at<16?"\\x0":"\\x")+at.toString(16);var Ie=String.fromCharCode(at);return Ie==="\\"||Ie==="-"||Ie==="]"||Ie==="^"?"\\"+Ie:Ie}function dt(at){var Ie=at.substring(1,at.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")),yt=[],nt=Ie[0]==="^",Oe=["["];nt&&Oe.push("^");for(var Ge=nt?1:0,be=Ie.length;Ge<be;++Ge){var fe=Ie[Ge];if(/\\[bdsw]/i.test(fe))Oe.push(fe);else{var pe=lt(fe),ie;Ge+2<be&&Ie[Ge+1]==="-"?(ie=lt(Ie[Ge+2]),Ge+=2):ie=pe,yt.push([pe,ie]),ie<65||pe>122||(ie<65||pe>90||yt.push([Math.max(65,pe)|32,Math.min(ie,90)|32]),ie<97||pe>122||yt.push([Math.max(97,pe)&~32,Math.min(ie,122)&~32]))}}yt.sort(function(ye,Le){return ye[0]-Le[0]||Le[1]-ye[1]});for(var re=[],ue=[],Ge=0;Ge<yt.length;++Ge){var ge=yt[Ge];ge[0]<=ue[1]+1?ue[1]=Math.max(ue[1],ge[1]):re.push(ue=ge)}for(var Ge=0;Ge<re.length;++Ge){var ge=re[Ge];Oe.push(rt(ge[0])),ge[1]>ge[0]&&(ge[1]+1>ge[0]&&Oe.push("-"),Oe.push(rt(ge[1])))}return Oe.push("]"),Oe.join("")}function bt(at){for(var Ie=at.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")),yt=Ie.length,nt=[],Oe=0,Ge=0;Oe<yt;++Oe){var be=Ie[Oe];if(be==="(")++Ge;else if(be.charAt(0)==="\\"){var fe=+be.substring(1);fe&&(fe<=Ge?nt[fe]=-1:Ie[Oe]=rt(fe))}}for(var Oe=1;Oe<nt.length;++Oe)nt[Oe]===-1&&(nt[Oe]=++Ue);for(var Oe=0,Ge=0;Oe<yt;++Oe){var be=Ie[Oe];if(be==="(")++Ge,nt[Ge]||(Ie[Oe]="(?:");else if(be.charAt(0)==="\\"){var fe=+be.substring(1);fe&&fe<=Ge&&(Ie[Oe]="\\"+nt[fe])}}for(var Oe=0;Oe<yt;++Oe)Ie[Oe]==="^"&&Ie[Oe+1]!=="^"&&(Ie[Oe]="");if(at.ignoreCase&&Ye)for(var Oe=0;Oe<yt;++Oe){var be=Ie[Oe],pe=be.charAt(0);be.length>=2&&pe==="["?Ie[Oe]=dt(be):pe!=="\\"&&(Ie[Oe]=be.replace(/[a-zA-Z]/g,function(ue){var ge=ue.charCodeAt(0);return"["+String.fromCharCode(ge&~32,ge|32)+"]"}))}return Ie.join("")}for(var ut=[],Ve=0,He=Pe.length;Ve<He;++Ve){var Fe=Pe[Ve];if(Fe.global||Fe.multiline)throw new Error(""+Fe);ut.push("(?:"+bt(Fe)+")")}return new RegExp(ut.join("|"),Ze?"gi":"g")}function S(Pe,Ue){var Ye=/(?:^|\s)nocode(?:\s|$)/,Ze=[],Ve=0,He=[],Fe=0;function ft(lt){var rt=lt.nodeType;if(rt==1){if(Ye.test(lt.className))return;for(var dt=lt.firstChild;dt;dt=dt.nextSibling)ft(dt);var bt=lt.nodeName.toLowerCase();(bt==="br"||bt==="li")&&(Ze[Fe]=`
|
|
`,He[Fe<<1]=Ve++,He[Fe++<<1|1]=lt)}else if(rt==3||rt==4){var ut=lt.nodeValue;ut.length&&(Ue?ut=ut.replace(/\r\n?/g,`
|
|
`):ut=ut.replace(/[ \t\r\n]+/g," "),Ze[Fe]=ut,He[Fe<<1]=Ve,Ve+=ut.length,He[Fe++<<1|1]=lt)}}return ft(Pe),{sourceCode:Ze.join("").replace(/\n$/,""),spans:He}}function B(Pe,Ue,Ye,Ze,Ve){if(!Ye)return;var He={sourceNode:Pe,pre:1,langExtension:null,numberLines:null,sourceCode:Ye,spans:null,basePos:Ue,decorations:null};Ze(He),Ve.push.apply(Ve,He.decorations)}var J=/\S/;function te(Pe){for(var Ue=void 0,Ye=Pe.firstChild;Ye;Ye=Ye.nextSibling){var Ze=Ye.nodeType;Ue=Ze===1?Ue?Pe:Ye:Ze===3&&J.test(Ye.nodeValue)?Pe:Ue}return Ue===Pe?void 0:Ue}function ae(Pe,Ue){var Ye={},Ze;(function(){for(var Fe=Pe.concat(Ue),ft=[],lt={},rt=0,dt=Fe.length;rt<dt;++rt){var bt=Fe[rt],ut=bt[3];if(ut)for(var at=ut.length;--at>=0;)Ye[ut.charAt(at)]=bt;var Ie=bt[1],yt=""+Ie;lt.hasOwnProperty(yt)||(ft.push(Ie),lt[yt]=null)}ft.push(/[\0-\uffff]/),Ze=U(ft)})();var Ve=Ue.length,He=function(Fe){for(var ft=Fe.sourceCode,lt=Fe.basePos,rt=Fe.sourceNode,dt=[lt,a],bt=0,ut=ft.match(Ze)||[],at={},Ie=0,yt=ut.length;Ie<yt;++Ie){var nt=ut[Ie],Oe=at[nt],Ge=void 0,be;if(typeof Oe=="string")be=!1;else{var fe=Ye[nt.charAt(0)];if(fe)Ge=nt.match(fe[1]),Oe=fe[0];else{for(var pe=0;pe<Ve;++pe)if(fe=Ue[pe],Ge=nt.match(fe[1]),Ge){Oe=fe[0];break}Ge||(Oe=a)}be=Oe.length>=5&&Oe.substring(0,5)==="lang-",be&&!(Ge&&typeof Ge[1]=="string")&&(be=!1,Oe=b),be||(at[nt]=Oe)}var ie=bt;if(bt+=nt.length,!be)dt.push(lt+ie,Oe);else{var re=Ge[1],ue=nt.indexOf(re),ge=ue+re.length;Ge[2]&&(ge=nt.length-Ge[2].length,ue=ge-re.length);var ye=Oe.substring(5);B(rt,lt+ie,nt.substring(0,ue),He,dt),B(rt,lt+ie+ue,re,se(ye,re),dt),B(rt,lt+ie+ge,nt.substring(ge),He,dt)}}Fe.decorations=dt};return He}function _e(Pe){var Ue=[],Ye=[];Pe.tripleQuotedStrings?Ue.push([w,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Pe.multiLineStrings?Ue.push([w,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Ue.push([w,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Pe.verbatimStrings&&Ye.push([w,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ze=Pe.hashComments;Ze&&(Pe.cStyleComments?(Ze>1?Ue.push([R,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Ue.push([R,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ye.push([w,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Ue.push([R,/^#[^\r\n]*/,null,"#"])),Pe.cStyleComments&&(Ye.push([R,/^\/\/[^\r\n]*/,null]),Ye.push([R,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ve=Pe.regexLiterals;if(Ve){var He=Ve>1?"":`
|
|
\r`,Fe=He?".":"[\\S\\s]",ft="/(?=[^/*"+He+"])(?:[^/\\x5B\\x5C"+He+"]|\\x5C"+Fe+"|\\x5B(?:[^\\x5C\\x5D"+He+"]|\\x5C"+Fe+")*(?:\\x5D|$))+/";Ye.push(["lang-regex",RegExp("^"+X+"("+ft+")")])}var lt=Pe.types;lt&&Ye.push([T,lt]);var rt=(""+Pe.keywords).replace(/^ | $/g,"");rt.length&&Ye.push([A,new RegExp("^(?:"+rt.replace(/[\s,]+/g,"|")+")\\b"),null]),Ue.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var dt="^.[^\\s\\w.$@'\"`/\\\\]*";return Pe.regexLiterals&&(dt+="(?!s*/)"),Ye.push([E,/^@[a-z_$][a-z_$@0-9]*/i,null],[T,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[E,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[g,new RegExp(dt),null]),ae(Ue,Ye)}var de=_e({keywords:O,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ee(Pe,Ue,Ye){for(var Ze=/(?:^|\s)nocode(?:\s|$)/,Ve=/\r\n?|\n/,He=Pe.ownerDocument,Fe=He.createElement("li");Pe.firstChild;)Fe.appendChild(Pe.firstChild);var ft=[Fe];function lt(Ie){var yt=Ie.nodeType;if(yt==1&&!Ze.test(Ie.className))if(Ie.nodeName==="br")rt(Ie),Ie.parentNode&&Ie.parentNode.removeChild(Ie);else for(var nt=Ie.firstChild;nt;nt=nt.nextSibling)lt(nt);else if((yt==3||yt==4)&&Ye){var Oe=Ie.nodeValue,Ge=Oe.match(Ve);if(Ge){var be=Oe.substring(0,Ge.index);Ie.nodeValue=be;var fe=Oe.substring(Ge.index+Ge[0].length);if(fe){var pe=Ie.parentNode;pe.insertBefore(He.createTextNode(fe),Ie.nextSibling)}rt(Ie),be||Ie.parentNode.removeChild(Ie)}}}function rt(Ie){for(;!Ie.nextSibling;)if(Ie=Ie.parentNode,!Ie)return;function yt(Ge,be){var fe=be?Ge.cloneNode(!1):Ge,pe=Ge.parentNode;if(pe){var ie=yt(pe,1),re=Ge.nextSibling;ie.appendChild(fe);for(var ue=re;ue;ue=re)re=ue.nextSibling,ie.appendChild(ue)}return fe}for(var nt=yt(Ie.nextSibling,0),Oe;(Oe=nt.parentNode)&&Oe.nodeType===1;)nt=Oe;ft.push(nt)}for(var dt=0;dt<ft.length;++dt)lt(ft[dt]);Ue===(Ue|0)&&ft[0].setAttribute("value",Ue);var bt=He.createElement("ol");bt.className="linenums";for(var ut=Math.max(0,Ue-1|0)||0,dt=0,at=ft.length;dt<at;++dt)Fe=ft[dt],Fe.className="L"+(dt+ut)%10,Fe.firstChild||Fe.appendChild(He.createTextNode("\xA0")),bt.appendChild(Fe);Pe.appendChild(bt)}function Te(Pe){var Ue=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Ue=Ue&&+Ue[1]<=8;var Ye=/\n/g,Ze=Pe.sourceCode,Ve=Ze.length,He=0,Fe=Pe.spans,ft=Fe.length,lt=0,rt=Pe.decorations,dt=rt.length,bt=0;rt[dt]=Ve;var ut,at;for(at=ut=0;at<dt;)rt[at]!==rt[at+2]?(rt[ut++]=rt[at++],rt[ut++]=rt[at++]):at+=2;for(dt=ut,at=ut=0;at<dt;){for(var Ie=rt[at],yt=rt[at+1],nt=at+2;nt+2<=dt&&rt[nt+1]===yt;)nt+=2;rt[ut++]=Ie,rt[ut++]=yt,at=nt}dt=rt.length=ut;var Oe=Pe.sourceNode,Ge="";Oe&&(Ge=Oe.style.display,Oe.style.display="none");try{for(var be=null;lt<ft;){var fe=Fe[lt],pe=Fe[lt+2]||Ve,ie=rt[bt+2]||Ve,nt=Math.min(pe,ie),re=Fe[lt+1],ue;if(re.nodeType!==1&&(ue=Ze.substring(He,nt))){Ue&&(ue=ue.replace(Ye,"\r")),re.nodeValue=ue;var ge=re.ownerDocument,ye=ge.createElement("span");ye.className=rt[bt+1];var Le=re.parentNode;Le.replaceChild(ye,re),ye.appendChild(re),He<pe&&(Fe[lt+1]=re=ge.createTextNode(Ze.substring(nt,pe)),Le.insertBefore(re,ye.nextSibling))}He=nt,He>=pe&&(lt+=2),He>=ie&&(bt+=2)}}finally{Oe&&(Oe.style.display=Ge)}}var me={};function ce(Pe,Ue){for(var Ye=Ue.length;--Ye>=0;){var Ze=Ue[Ye];me.hasOwnProperty(Ze)?H.console&&console.warn("cannot override language handler %s",Ze):me[Ze]=Pe}}function se(Pe,Ue){return Pe&&me.hasOwnProperty(Pe)||(Pe=/^\s*</.test(Ue)?"default-markup":"default-code"),me[Pe]}ce(de,["default-code"]),ce(ae([],[[a,/^[^<?]+/],[r,/^<!\w[^>]*(?:>|$)/],[R,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[g,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ce(ae([[a,/^[\s]+/,null,` \r
|
|
`],[M,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[g,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ce(ae([],[[M,/^[\s\S]+/]]),["uq.val"]),ce(_e({keywords:v,hashComments:!0,cStyleComments:!0,types:x}),["c","cc","cpp","cxx","cyc","m"]),ce(_e({keywords:"null,true,false"}),["json"]),ce(_e({keywords:c,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:x}),["cs"]),ce(_e({keywords:p,cStyleComments:!0}),["java"]),ce(_e({keywords:f,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ce(_e({keywords:s,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ce(_e({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ce(_e({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ce(_e({keywords:d,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ce(_e({keywords:h,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ce(ae([],[[w,/^[\s\S]+/]]),["regex"]);function Se(Pe){var Ue=Pe.langExtension;try{var Ye=S(Pe.sourceNode,Pe.pre),Ze=Ye.sourceCode;Pe.sourceCode=Ze,Pe.spans=Ye.spans,Pe.basePos=0,se(Ue,Ze)(Pe),Te(Pe)}catch(Ve){H.console&&console.log(Ve&&Ve.stack||Ve)}}function je(Pe,Ue,Ye){var Ze=Ye||!1,Ve=Ue||null,He=document.createElement("div");He.innerHTML="<pre>"+Pe+"</pre>",He=He.firstChild,Ze&&Ee(He,Ze,!0);var Fe={langExtension:Ve,numberLines:Ze,sourceNode:He,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Se(Fe),He.innerHTML}function We(Pe,Ue){var Ye=Ue||document.body,Ze=Ye.ownerDocument||document;function Ve(fe){return Ye.getElementsByTagName(fe)}for(var He=[Ve("pre"),Ve("code"),Ve("xmp")],Fe=[],ft=0;ft<He.length;++ft)for(var lt=0,rt=He[ft].length;lt<rt;++lt)Fe.push(He[ft][lt]);He=null;var dt=Date;dt.now||(dt={now:function(){return+new Date}});var bt=0,ut=/\blang(?:uage)?-([\w.]+)(?!\S)/,at=/\bprettyprint\b/,Ie=/\bprettyprinted\b/,yt=/pre|xmp/i,nt=/^code$/i,Oe=/^(?:pre|code|xmp)$/i,Ge={};function be(){for(var fe=H.PR_SHOULD_USE_CONTINUATION?dt.now()+250:Infinity;bt<Fe.length&&dt.now()<fe;bt++){for(var pe=Fe[bt],ie=Ge,re=pe;re=re.previousSibling;){var ue=re.nodeType,ge=(ue===7||ue===8)&&re.nodeValue;if(ge?!/^\??prettify\b/.test(ge):ue!==3||/\S/.test(re.nodeValue))break;if(ge){ie={},ge.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Qt,Tt,qe){ie[Tt]=qe});break}}var ye=pe.className;if((ie!==Ge||at.test(ye))&&!Ie.test(ye)){for(var Le=!1,Be=pe.parentNode;Be;Be=Be.parentNode){var pt=Be.tagName;if(Oe.test(pt)&&Be.className&&at.test(Be.className)){Le=!0;break}}if(!Le){pe.className+=" prettyprinted";var It=ie.lang;if(!It){It=ye.match(ut);var Lt;!It&&(Lt=te(pe))&&nt.test(Lt.tagName)&&(It=Lt.className.match(ut)),It&&(It=It[1])}var Vt;if(yt.test(pe.tagName))Vt=1;else{var tt=pe.currentStyle,ke=Ze.defaultView,Ct=tt?tt.whiteSpace:ke&&ke.getComputedStyle?ke.getComputedStyle(pe,null).getPropertyValue("white-space"):0;Vt=Ct&&Ct.substring(0,3)==="pre"}var Rt=ie.linenums;(Rt=Rt==="true"||+Rt)||(Rt=ye.match(/\blinenums\b(?::(\d+))?/),Rt=Rt?Rt[1]&&Rt[1].length?+Rt[1]:!0:!1),Rt&&Ee(pe,Rt,Vt);var ni={langExtension:It,sourceNode:pe,numberLines:Rt,pre:Vt,sourceCode:null,basePos:null,spans:null,decorations:null};Se(ni)}}}bt<Fe.length?H.setTimeout(be,250):typeof Pe=="function"&&Pe()}be()}var Xe=H.PR={createSimpleLexer:ae,registerLangHandler:ce,sourceDecorator:_e,PR_ATTRIB_NAME:P,PR_ATTRIB_VALUE:M,PR_COMMENT:R,PR_DECLARATION:r,PR_KEYWORD:A,PR_LITERAL:E,PR_NOCODE:W,PR_PLAIN:a,PR_PUNCTUATION:g,PR_SOURCE:b,PR_STRING:w,PR_TAG:m,PR_TYPE:T,prettyPrintOne:D?H.prettyPrintOne=je:F=je,prettyPrint:V=D?H.prettyPrint=We:V=We},Qe=H.define;typeof Qe=="function"&&Qe.amd&&Qe("google-code-prettify",[],function(){return Xe})})()},TXwP:function(Mt,st,ne){var oe,Z;(function(){var D;(function(){"use strict";var j=[,,function(k){function L(p){this.__parent=p,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}L.prototype.clone_empty=function(){var p=new L(this.__parent);return p.set_indent(this.__indent_count,this.__alignment_count),p},L.prototype.item=function(p){return p<0?this.__items[this.__items.length+p]:this.__items[p]},L.prototype.has_match=function(p){for(var c=this.__items.length-1;c>=0;c--)if(this.__items[c].match(p))return!0;return!1},L.prototype.set_indent=function(p,c){this.is_empty()&&(this.__indent_count=p||0,this.__alignment_count=c||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},L.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},L.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},L.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var p=this.__parent.current_line;return p.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),p.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),p.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,p.__items[0]===" "&&(p.__items.splice(0,1),p.__character_count-=1),!0}return!1},L.prototype.is_empty=function(){return this.__items.length===0},L.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},L.prototype.push=function(p){this.__items.push(p);var c=p.lastIndexOf(`
|
|
`);c!==-1?this.__character_count=p.length-c:this.__character_count+=p.length},L.prototype.pop=function(){var p=null;return this.is_empty()||(p=this.__items.pop(),this.__character_count-=p.length),p},L.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},L.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},L.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},L.prototype.toString=function(){var p="";return this.is_empty()?this.__parent.indent_empty_lines&&(p=this.__parent.get_indent_string(this.__indent_count)):(p=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),p+=this.__items.join("")),p};function y(p,c){this.__cache=[""],this.__indent_size=p.indent_size,this.__indent_string=p.indent_char,p.indent_with_tabs||(this.__indent_string=new Array(p.indent_size+1).join(p.indent_char)),c=c||"",p.indent_level>0&&(c=new Array(p.indent_level+1).join(this.__indent_string)),this.__base_string=c,this.__base_string_length=c.length}y.prototype.get_indent_size=function(p,c){var h=this.__base_string_length;return c=c||0,p<0&&(h=0),h+=p*this.__indent_size,h+=c,h},y.prototype.get_indent_string=function(p,c){var h=this.__base_string;return c=c||0,p<0&&(p=0,h=""),c+=p*this.__indent_size,this.__ensure_cache(c),h+=this.__cache[c],h},y.prototype.__ensure_cache=function(p){for(;p>=this.__cache.length;)this.__add_column()},y.prototype.__add_column=function(){var p=this.__cache.length,c=0,h="";this.__indent_size&&p>=this.__indent_size&&(c=Math.floor(p/this.__indent_size),p-=c*this.__indent_size,h=new Array(c+1).join(this.__indent_string)),p&&(h+=new Array(p+1).join(" ")),this.__cache.push(h)};function v(p,c){this.__indent_cache=new y(p,c),this.raw=!1,this._end_with_newline=p.end_with_newline,this.indent_size=p.indent_size,this.wrap_line_length=p.wrap_line_length,this.indent_empty_lines=p.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new L(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}v.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},v.prototype.get_line_number=function(){return this.__lines.length},v.prototype.get_indent_string=function(p,c){return this.__indent_cache.get_indent_string(p,c)},v.prototype.get_indent_size=function(p,c){return this.__indent_cache.get_indent_size(p,c)},v.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},v.prototype.add_new_line=function(p){return this.is_empty()||!p&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},v.prototype.get_code=function(p){this.trim(!0);var c=this.current_line.pop();c&&(c[c.length-1]===`
|
|
`&&(c=c.replace(/\n+$/g,"")),this.current_line.push(c)),this._end_with_newline&&this.__add_outputline();var h=this.__lines.join(`
|
|
`);return p!==`
|
|
`&&(h=h.replace(/[\n]/g,p)),h},v.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},v.prototype.set_indent=function(p,c){return p=p||0,c=c||0,this.next_line.set_indent(p,c),this.__lines.length>1?(this.current_line.set_indent(p,c),!0):(this.current_line.set_indent(),!1)},v.prototype.add_raw_token=function(p){for(var c=0;c<p.newlines;c++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(p.whitespace_before),this.current_line.push(p.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},v.prototype.add_token=function(p){this.__add_space_before_token(),this.current_line.push(p),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},v.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},v.prototype.remove_indent=function(p){for(var c=this.__lines.length;p<c;)this.__lines[p]._remove_indent(),p++;this.current_line._remove_wrap_indent()},v.prototype.trim=function(p){for(p=p===void 0?!1:p,this.current_line.trim();p&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},v.prototype.just_added_newline=function(){return this.current_line.is_empty()},v.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},v.prototype.ensure_empty_line_above=function(p,c){for(var h=this.__lines.length-2;h>=0;){var d=this.__lines[h];if(d.is_empty())break;if(d.item(0).indexOf(p)!==0&&d.item(-1)!==c){this.__lines.splice(h+1,0,new L(this)),this.previous_line=this.__lines[this.__lines.length-2];break}h--}},k.exports.Output=v},,,,function(k){function L(p,c){this.raw_options=y(p,c),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}L.prototype._get_array=function(p,c){var h=this.raw_options[p],d=c||[];return typeof h=="object"?h!==null&&typeof h.concat=="function"&&(d=h.concat()):typeof h=="string"&&(d=h.split(/[^a-zA-Z0-9_\/\-]+/)),d},L.prototype._get_boolean=function(p,c){var h=this.raw_options[p],d=h===void 0?!!c:!!h;return d},L.prototype._get_characters=function(p,c){var h=this.raw_options[p],d=c||"";return typeof h=="string"&&(d=h.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),d},L.prototype._get_number=function(p,c){var h=this.raw_options[p];c=parseInt(c,10),isNaN(c)&&(c=0);var d=parseInt(h,10);return isNaN(d)&&(d=c),d},L.prototype._get_selection=function(p,c,h){var d=this._get_selection_list(p,c,h);if(d.length!==1)throw new Error("Invalid Option Value: The option '"+p+`' can only be one of the following values:
|
|
`+c+`
|
|
You passed in: '`+this.raw_options[p]+"'");return d[0]},L.prototype._get_selection_list=function(p,c,h){if(!c||c.length===0)throw new Error("Selection list cannot be empty.");if(h=h||[c[0]],!this._is_valid_selection(h,c))throw new Error("Invalid Default Value!");var d=this._get_array(p,h);if(!this._is_valid_selection(d,c))throw new Error("Invalid Option Value: The option '"+p+`' can contain only the following values:
|
|
`+c+`
|
|
You passed in: '`+this.raw_options[p]+"'");return d},L.prototype._is_valid_selection=function(p,c){return p.length&&c.length&&!p.some(function(h){return c.indexOf(h)===-1})};function y(p,c){var h={};p=v(p);var d;for(d in p)d!==c&&(h[d]=p[d]);if(c&&p[c])for(d in p[c])h[d]=p[c][d];return h}function v(p){var c={},h;for(h in p){var d=h.replace(/-/g,"_");c[d]=p[h]}return c}k.exports.Options=L,k.exports.normalizeOpts=v,k.exports.mergeOpts=y},,function(k){var L=RegExp.prototype.hasOwnProperty("sticky");function y(v){this.__input=v||"",this.__input_length=this.__input.length,this.__position=0}y.prototype.restart=function(){this.__position=0},y.prototype.back=function(){this.__position>0&&(this.__position-=1)},y.prototype.hasNext=function(){return this.__position<this.__input_length},y.prototype.next=function(){var v=null;return this.hasNext()&&(v=this.__input.charAt(this.__position),this.__position+=1),v},y.prototype.peek=function(v){var p=null;return v=v||0,v+=this.__position,v>=0&&v<this.__input_length&&(p=this.__input.charAt(v)),p},y.prototype.__match=function(v,p){v.lastIndex=p;var c=v.exec(this.__input);return c&&!(L&&v.sticky)&&(c.index!==p&&(c=null)),c},y.prototype.test=function(v,p){return p=p||0,p+=this.__position,p>=0&&p<this.__input_length?!!this.__match(v,p):!1},y.prototype.testChar=function(v,p){var c=this.peek(p);return v.lastIndex=0,c!==null&&v.test(c)},y.prototype.match=function(v){var p=this.__match(v,this.__position);return p?this.__position+=p[0].length:p=null,p},y.prototype.read=function(v,p,c){var h="",d;return v&&(d=this.match(v),d&&(h+=d[0])),p&&(d||!v)&&(h+=this.readUntil(p,c)),h},y.prototype.readUntil=function(v,p){var c="",h=this.__position;v.lastIndex=this.__position;var d=v.exec(this.__input);return d?(h=d.index,p&&(h+=d[0].length)):h=this.__input_length,c=this.__input.substring(this.__position,h),this.__position=h,c},y.prototype.readUntilAfter=function(v){return this.readUntil(v,!0)},y.prototype.get_regexp=function(v,p){var c=null,h="g";return p&&L&&(h="y"),typeof v=="string"&&v!==""?c=new RegExp(v,h):v&&(c=new RegExp(v.source,h)),c},y.prototype.get_literal_regexp=function(v){return RegExp(v.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},y.prototype.peekUntilAfter=function(v){var p=this.__position,c=this.readUntilAfter(v);return this.__position=p,c},y.prototype.lookBack=function(v){var p=this.__position-1;return p>=v.length&&this.__input.substring(p-v.length,p).toLowerCase()===v},k.exports.InputScanner=y},,,,,function(k){function L(y,v){y=typeof y=="string"?y:y.source,v=typeof v=="string"?v:v.source,this.__directives_block_pattern=new RegExp(y+/ beautify( \w+[:]\w+)+ /.source+v,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(y+/\sbeautify\signore:end\s/.source+v,"g")}L.prototype.get_directives=function(y){if(!y.match(this.__directives_block_pattern))return null;var v={};this.__directive_pattern.lastIndex=0;for(var p=this.__directive_pattern.exec(y);p;)v[p[1]]=p[2],p=this.__directive_pattern.exec(y);return v},L.prototype.readIgnored=function(y){return y.readUntilAfter(this.__directives_end_ignore_pattern)},k.exports.Directives=L},,function(k,L,y){var v=y(16).Beautifier,p=y(17).Options;function c(h,d){var l=new v(h,d);return l.beautify()}k.exports=c,k.exports.defaultOptions=function(){return new p}},function(k,L,y){var v=y(17).Options,p=y(2).Output,c=y(8).InputScanner,h=y(13).Directives,d=new h(/\/\*/,/\*\//),l=/\r\n|[\r\n]/,s=/\r\n|[\r\n]/g,u=/\s/,f=/(?:\s|\n)+/g,O=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,x=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function w(A,R){this._source_text=A||"",this._options=new v(R),this._ch=null,this._input=null,this.NESTED_AT_RULE={"@page":!0,"@font-face":!0,"@keyframes":!0,"@media":!0,"@supports":!0,"@document":!0},this.CONDITIONAL_GROUP_RULE={"@media":!0,"@supports":!0,"@document":!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}w.prototype.eatString=function(A){var R="";for(this._ch=this._input.next();this._ch;){if(R+=this._ch,this._ch==="\\")R+=this._input.next();else if(A.indexOf(this._ch)!==-1||this._ch===`
|
|
`)break;this._ch=this._input.next()}return R},w.prototype.eatWhitespace=function(A){for(var R=u.test(this._input.peek()),T=0;u.test(this._input.peek());)this._ch=this._input.next(),A&&this._ch===`
|
|
`&&((T===0||T<this._options.max_preserve_newlines)&&(T++,this._output.add_new_line(!0)));return R},w.prototype.foundNestedPseudoClass=function(){for(var A=0,R=1,T=this._input.peek(R);T;){if(T==="{")return!0;if(T==="(")A+=1;else if(T===")"){if(A===0)return!1;A-=1}else if(T===";"||T==="}")return!1;R++,T=this._input.peek(R)}return!1},w.prototype.print_string=function(A){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(A)},w.prototype.preserveSingleSpace=function(A){A&&(this._output.space_before_token=!0)},w.prototype.indent=function(){this._indentLevel++},w.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},w.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var A=this._source_text,R=this._options.eol;R==="auto"&&(R=`
|
|
`,A&&l.test(A||"")&&(R=A.match(l)[0])),A=A.replace(s,`
|
|
`);var T=A.match(/^[\t ]*/)[0];this._output=new p(this._options,T),this._input=new c(A),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var E=0,g=!1,a=!1,m=!1,r=!1,b=!1,P=!1,M=this._ch,W=!1,X,U,S;X=this._input.read(f),U=X!=="",S=M,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),M=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var B=this._input.read(O),J=d.get_directives(B);J&&J.ignore==="start"&&(B+=d.readIgnored(this._input)),this.print_string(B),this.eatWhitespace(!0),this._output.add_new_line()}else if(this._ch==="/"&&this._input.peek()==="/")this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(x)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(U),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var te=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);te.match(/[ :]$/)&&(te=this.eatString(": ").replace(/\s$/,""),this.print_string(te),this._output.space_before_token=!0),te=te.replace(/\s$/,""),te==="extend"?r=!0:te==="import"&&(b=!0),te in this.NESTED_AT_RULE?(this._nestedLevel+=1,te in this.CONDITIONAL_GROUP_RULE&&(m=!0)):!g&&E===0&&te.indexOf(":")!==-1&&(a=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(U),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")a&&(a=!1,this.outdent()),m?(m=!1,g=this._indentLevel>=this._nestedLevel):g=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&g&&(this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",",")),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(S==="("?this._output.space_before_token=!1:S!==","&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if(this._ch==="}")this.outdent(),this._output.add_new_line(),S==="{"&&this._output.trim(!0),b=!1,r=!1,a&&(this.outdent(),a=!1),this.print_string(this._ch),g=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&(this._input.peek()!=="}"&&this._output.add_new_line(!0)),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var ae=0;ae<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;ae++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[ae])){W=!0;break}(g||m)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!r&&E===0?(this.print_string(":"),a||(a=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var _e=S==='"'||S==="'";this.preserveSingleSpace(_e||U),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")W=!1,E===0?(a&&(this.outdent(),a=!1),r=!1,b=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),E++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),E&&(E--,this.outdent()));else{var de=!1;this._input.lookBack("with")&&(de=!0),this.preserveSingleSpace(U||de),this.print_string(this._ch),a&&S==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),P=!0):(this.eatWhitespace(),E++,this.indent())}else if(this._ch===")")E&&(E--,this.outdent()),P&&this._input.peek()===";"&&this._options.selector_separator_newline&&(P=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!a||P)&&E===0&&!b&&!r?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!a&&E===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&u.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(U),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),u.test(this._ch)&&(this._ch="");else if(this._ch==="!"&&!this._input.lookBack("\\"))this._output.space_before_token=!0,this.print_string(this._ch);else{var Ee=S==='"'||S==="'";this.preserveSingleSpace(Ee||U),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&W&&this._output.add_new_line()}var Te=this._output.get_code(R);return Te},k.exports.Beautifier=w},function(k,L,y){var v=y(6).Options;function p(c){v.call(this,c,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var h=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||h;var d=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var l=0;l<d.length;l++)d[l]!=="expand"?this.brace_style="collapse":this.brace_style=d[l]}p.prototype=new v,k.exports.Options=p}],F={};function V(k){var L=F[k];if(L!==void 0)return L.exports;var y=F[k]={exports:{}};return j[k](y,y.exports,V),y.exports}var H=V(15);D=H})();var $=D;!(oe=[],Z=function(){return{css_beautify:$}}.apply(st,oe),Z!==void 0&&(Mt.exports=Z))})()},"VrN/":function(Mt,st,ne){(function(oe,Z){Mt.exports=Z()})(this,function(){"use strict";var oe=navigator.userAgent,Z=navigator.platform,D=/gecko\/\d/i.test(oe),$=/MSIE \d/.test(oe),j=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(oe),F=/Edge\/(\d+)/.exec(oe),V=$||j||F,H=V&&($?document.documentMode||6:+(F||j)[1]),k=!F&&/WebKit\//.test(oe),L=k&&/Qt\/\d+\.\d+/.test(oe),y=!F&&/Chrome\//.test(oe),v=/Opera\//.test(oe),p=/Apple Computer/.test(navigator.vendor),c=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(oe),h=/PhantomJS/.test(oe),d=!F&&/AppleWebKit/.test(oe)&&/Mobile\/\w+/.test(oe),l=/Android/.test(oe),s=d||l||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(oe),u=d||/Mac/.test(Z),f=/\bCrOS\b/.test(oe),O=/win/i.test(Z),x=v&&oe.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(v=!1,k=!0);var w=u&&(L||v&&(x==null||x<12.11)),A=D||V&&H>=9;function R(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var T=function(e,t){var n=e.className,i=R(t).exec(n);if(i){var o=n.slice(i.index+i[0].length);e.className=n.slice(0,i.index)+(o?i[1]+o:"")}};function E(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function g(e,t){return E(e).appendChild(t)}function a(e,t,n,i){var o=document.createElement(e);if(n&&(o.className=n),i&&(o.style.cssText=i),typeof t=="string")o.appendChild(document.createTextNode(t));else if(t)for(var I=0;I<t.length;++I)o.appendChild(t[I]);return o}function m(e,t,n,i){var o=a(e,t,n,i);return o.setAttribute("role","presentation"),o}var r;document.createRange?r=function(e,t,n,i){var o=document.createRange();return o.setEnd(i||e,n),o.setStart(e,t),o}:r=function(e,t,n){var i=document.body.createTextRange();try{i.moveToElementText(e.parentNode)}catch(o){return i}return i.collapse(!0),i.moveEnd("character",n),i.moveStart("character",t),i};function b(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function P(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function M(e,t){var n=e.className;R(t).test(n)||(e.className+=(n?" ":"")+t)}function W(e,t){for(var n=e.split(" "),i=0;i<n.length;i++)n[i]&&!R(n[i]).test(t)&&(t+=" "+n[i]);return t}var X=function(e){e.select()};d?X=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:V&&(X=function(e){try{e.select()}catch(t){}});function U(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function S(e,t,n){t||(t={});for(var i in e)e.hasOwnProperty(i)&&(n!==!1||!t.hasOwnProperty(i))&&(t[i]=e[i]);return t}function B(e,t,n,i,o){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var I=i||0,z=o||0;;){var Y=e.indexOf(" ",I);if(Y<0||Y>=t)return z+(t-I);z+=Y-I,z+=n-z%n,I=Y+1}}var J=function(){this.id=null,this.f=null,this.time=0,this.handler=U(this.onTimeout,this)};J.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},J.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function te(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var ae=50,_e={toString:function(){return"CodeMirror.Pass"}},de={scroll:!1},Ee={origin:"*mouse"},Te={origin:"+move"};function me(e,t,n){for(var i=0,o=0;;){var I=e.indexOf(" ",i);I==-1&&(I=e.length);var z=I-i;if(I==e.length||o+z>=t)return i+Math.min(z,t-o);if(o+=I-i,o+=n-o%n,i=I+1,o>=t)return i}}var ce=[""];function se(e){for(;ce.length<=e;)ce.push(Se(ce)+" ");return ce[e]}function Se(e){return e[e.length-1]}function je(e,t){for(var n=[],i=0;i<e.length;i++)n[i]=t(e[i],i);return n}function We(e,t,n){for(var i=0,o=n(t);i<e.length&&n(e[i])<=o;)i++;e.splice(i,0,t)}function Xe(){}function Qe(e,t){var n;return Object.create?n=Object.create(e):(Xe.prototype=e,n=new Xe),t&&S(t,n),n}var Pe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Ue(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Pe.test(e))}function Ye(e,t){return t?t.source.indexOf("\\w")>-1&&Ue(e)?!0:t.test(e):Ue(e)}function Ze(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ve=/[\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 He(e){return e.charCodeAt(0)>=768&&Ve.test(e)}function Fe(e,t,n){for(;(n<0?t>0:t<e.length)&&He(e.charAt(t));)t+=n;return t}function ft(e,t,n){for(var i=t>n?-1:1;;){if(t==n)return t;var o=(t+n)/2,I=i<0?Math.ceil(o):Math.floor(o);if(I==t)return e(I)?t:n;e(I)?n=I:t=I+i}}function lt(e,t,n,i){if(!e)return i(t,n,"ltr",0);for(var o=!1,I=0;I<e.length;++I){var z=e[I];(z.from<n&&z.to>t||t==n&&z.to==t)&&(i(Math.max(z.from,t),Math.min(z.to,n),z.level==1?"rtl":"ltr",I),o=!0)}o||i(t,n,"ltr")}var rt=null;function dt(e,t,n){var i;rt=null;for(var o=0;o<e.length;++o){var I=e[o];if(I.from<t&&I.to>t)return o;I.to==t&&(I.from!=I.to&&n=="before"?i=o:rt=o),I.from==t&&(I.from!=I.to&&n!="before"?i=o:rt=o)}return i!=null?i:rt}var bt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(ee){return ee<=247?e.charAt(ee):1424<=ee&&ee<=1524?"R":1536<=ee&&ee<=1785?t.charAt(ee-1536):1774<=ee&&ee<=2220?"r":8192<=ee&&ee<=8203?"w":ee==8204?"b":"L"}var i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,I=/[LRr]/,z=/[Lb1n]/,Y=/[1n]/;function q(ee,he,ve){this.level=ee,this.from=he,this.to=ve}return function(ee,he){var ve=he=="ltr"?"L":"R";if(ee.length==0||he=="ltr"&&!i.test(ee))return!1;for(var Ce=ee.length,we=[],Ne=0;Ne<Ce;++Ne)we.push(n(ee.charCodeAt(Ne)));for(var Ke=0,Je=ve;Ke<Ce;++Ke){var ht=we[Ke];ht=="m"?we[Ke]=Je:Je=ht}for(var _t=0,ct=ve;_t<Ce;++_t){var St=we[_t];St=="1"&&ct=="r"?we[_t]="n":I.test(St)&&(ct=St,St=="r"&&(we[_t]="R"))}for(var Gt=1,jt=we[0];Gt<Ce-1;++Gt){var Zt=we[Gt];Zt=="+"&&jt=="1"&&we[Gt+1]=="1"?we[Gt]="1":Zt==","&&jt==we[Gt+1]&&(jt=="1"||jt=="n")&&(we[Gt]=jt),jt=Zt}for(var Ti=0;Ti<Ce;++Ti){var Gi=we[Ti];if(Gi==",")we[Ti]="N";else if(Gi=="%"){var Li=void 0;for(Li=Ti+1;Li<Ce&&we[Li]=="%";++Li);for(var hn=Ti&&we[Ti-1]=="!"||Li<Ce&&we[Li]=="1"?"1":"N",sn=Ti;sn<Li;++sn)we[sn]=hn;Ti=Li-1}}for(var Ni=0,on=ve;Ni<Ce;++Ni){var Yi=we[Ni];on=="L"&&Yi=="1"?we[Ni]="L":I.test(Yi)&&(on=Yi)}for(var ji=0;ji<Ce;++ji)if(o.test(we[ji])){var Ui=void 0;for(Ui=ji+1;Ui<Ce&&o.test(we[Ui]);++Ui);for(var ki=(ji?we[ji-1]:ve)=="L",ln=(Ui<Ce?we[Ui]:ve)=="L",mr=ki==ln?ki?"L":"R":ve,jn=ji;jn<Ui;++jn)we[jn]=mr;ji=Ui-1}for(var Ji=[],Sn,zi=0;zi<Ce;)if(z.test(we[zi])){var Va=zi;for(++zi;zi<Ce&&z.test(we[zi]);++zi);Ji.push(new q(0,Va,zi))}else{var In=zi,Jn=Ji.length,Zn=he=="rtl"?1:0;for(++zi;zi<Ce&&we[zi]!="L";++zi);for(var qi=In;qi<zi;)if(Y.test(we[qi])){In<qi&&(Ji.splice(Jn,0,new q(1,In,qi)),Jn+=Zn);var gr=qi;for(++qi;qi<zi&&Y.test(we[qi]);++qi);Ji.splice(Jn,0,new q(2,gr,qi)),Jn+=Zn,In=qi}else++qi;In<zi&&Ji.splice(Jn,0,new q(1,In,zi))}return he=="ltr"&&(Ji[0].level==1&&(Sn=ee.match(/^\s+/))&&(Ji[0].from=Sn[0].length,Ji.unshift(new q(0,0,Sn[0].length))),Se(Ji).level==1&&(Sn=ee.match(/\s+$/))&&(Se(Ji).to-=Sn[0].length,Ji.push(new q(0,Ce-Sn[0].length,Ce)))),he=="rtl"?Ji.reverse():Ji}}();function ut(e,t){var n=e.order;return n==null&&(n=e.order=bt(e.text,t)),n}var at=[],Ie=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var i=e._handlers||(e._handlers={});i[t]=(i[t]||at).concat(n)}};function yt(e,t){return e._handlers&&e._handlers[t]||at}function nt(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var i=e._handlers,o=i&&i[t];if(o){var I=te(o,n);I>-1&&(i[t]=o.slice(0,I).concat(o.slice(I+1)))}}}function Oe(e,t){var n=yt(e,t);if(!n.length)return;for(var i=Array.prototype.slice.call(arguments,2),o=0;o<n.length;++o)n[o].apply(null,i)}function Ge(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Oe(e,n||t.type,e,t),ue(t)||t.codemirrorIgnore}function be(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),i=0;i<t.length;++i)te(n,t[i])==-1&&n.push(t[i])}function fe(e,t){return yt(e,t).length>0}function pe(e){e.prototype.on=function(t,n){Ie(this,t,n)},e.prototype.off=function(t,n){nt(this,t,n)}}function ie(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function re(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ue(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ge(e){ie(e),re(e)}function ye(e){return e.target||e.srcElement}function Le(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),u&&e.ctrlKey&&t==1&&(t=3),t}var Be=function(){if(V&&H<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),pt;function It(e){if(pt==null){var t=a("span","\u200B");g(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(pt=t.offsetWidth<=1&&t.offsetHeight>2&&!(V&&H<8))}var n=pt?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var Lt;function Vt(e){if(Lt!=null)return Lt;var t=g(e,document.createTextNode("A\u062EA")),n=r(t,0,1).getBoundingClientRect(),i=r(t,1,2).getBoundingClientRect();return E(e),!n||n.left==n.right?!1:Lt=i.right-n.right<3}var tt=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],i=e.length;t<=i;){var o=e.indexOf(`
|
|
`,t);o==-1&&(o=e.length);var I=e.slice(t,e.charAt(o-1)=="\r"?o-1:o),z=I.indexOf("\r");z!=-1?(n.push(I.slice(0,z)),t+=z+1):(n.push(I),t=o+1)}return n}:function(e){return e.split(/\r\n?|\n/)},ke=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Ct=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Rt=null;function ni(e){if(Rt!=null)return Rt;var t=g(e,a("span","x")),n=t.getBoundingClientRect(),i=r(t,0,1).getBoundingClientRect();return Rt=Math.abs(n.left-i.left)>1}var Qt={},Tt={};function qe(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Qt[e]=t}function Oi(e,t){Tt[e]=t}function xe(e){if(typeof e=="string"&&Tt.hasOwnProperty(e))e=Tt[e];else if(e&&typeof e.name=="string"&&Tt.hasOwnProperty(e.name)){var t=Tt[e.name];typeof t=="string"&&(t={name:t}),e=Qe(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return xe("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return xe("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Dt(e,t){t=xe(t);var n=Qt[t.name];if(!n)return Dt(e,"text/plain");var i=n(e,t);if(Ut.hasOwnProperty(t.name)){var o=Ut[t.name];for(var I in o){if(!o.hasOwnProperty(I))continue;i.hasOwnProperty(I)&&(i["_"+I]=i[I]),i[I]=o[I]}}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var z in t.modeProps)i[z]=t.modeProps[z];return i}var Ut={};function Ft(e,t){var n=Ut.hasOwnProperty(e)?Ut[e]:Ut[e]={};S(t,n)}function At(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var i in t){var o=t[i];o instanceof Array&&(o=o.concat([])),n[i]=o}return n}function ei(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function di(e,t,n){return e.startState?e.startState(t,n):!0}var Bt=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Bt.prototype.eol=function(){return this.pos>=this.string.length},Bt.prototype.sol=function(){return this.pos==this.lineStart},Bt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Bt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Bt.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Bt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Bt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Bt.prototype.skipToEnd=function(){this.pos=this.string.length},Bt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Bt.prototype.backUp=function(e){this.pos-=e},Bt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=B(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?B(this.string,this.lineStart,this.tabSize):0)},Bt.prototype.indentation=function(){return B(this.string,null,this.tabSize)-(this.lineStart?B(this.string,this.lineStart,this.tabSize):0)},Bt.prototype.match=function(e,t,n){if(typeof e=="string"){var i=function(z){return n?z.toLowerCase():z},o=this.string.substr(this.pos,e.length);if(i(o)==i(e))return t!==!1&&(this.pos+=e.length),!0}else{var I=this.string.slice(this.pos).match(e);return I&&I.index>0?null:(I&&t!==!1&&(this.pos+=I[0].length),I)}},Bt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Bt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Bt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Bt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function it(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var i=0;;++i){var o=n.children[i],I=o.chunkSize();if(t<I){n=o;break}t-=I}return n.lines[t]}function fi(e,t,n){var i=[],o=t.line;return e.iter(t.line,n.line+1,function(I){var z=I.text;o==n.line&&(z=z.slice(0,n.ch)),o==t.line&&(z=z.slice(t.ch)),i.push(z),++o}),i}function ri(e,t,n){var i=[];return e.iter(t,n,function(o){i.push(o.text)}),i}function Kt(e,t){var n=t-e.height;if(n)for(var i=e;i;i=i.parent)i.height+=n}function Et(e){if(e.parent==null)return null;for(var t=e.parent,n=te(t.lines,e),i=t.parent;i;t=i,i=i.parent)for(var o=0;!(i.children[o]==t);++o)n+=i.children[o].chunkSize();return n+t.first}function Nt(e,t){var n=e.first;e:do{for(var i=0;i<e.children.length;++i){var o=e.children[i],I=o.height;if(t<I){e=o;continue e}t-=I,n+=o.chunkSize()}return n}while(!e.lines);for(var z=0;z<e.lines.length;++z){var Y=e.lines[z],q=Y.height;if(t<q)break;t-=q}return n+z}function ti(e,t){return t>=e.first&&t<e.first+e.size}function oi(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function De(e,t,n){if(n===void 0&&(n=null),!(this instanceof De))return new De(e,t,n);this.line=e,this.ch=t,this.sticky=n}function gt(e,t){return e.line-t.line||e.ch-t.ch}function pi(e,t){return e.sticky==t.sticky&>(e,t)==0}function Ei(e){return De(e.line,e.ch)}function wi(e,t){return gt(e,t)<0?t:e}function vi(e,t){return gt(e,t)<0?e:t}function K(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function _(e,t){if(t.line<e.first)return De(e.first,0);var n=e.first+e.size-1;return t.line>n?De(n,it(e,n).text.length):C(t,it(e,t.line).text.length)}function C(e,t){var n=e.ch;return n==null||n>t?De(e.line,t):n<0?De(e.line,0):e}function N(e,t){for(var n=[],i=0;i<t.length;i++)n[i]=_(e,t[i]);return n}var Q=function(e,t){this.state=e,this.lookAhead=t},G=function(e,t,n,i){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};G.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},G.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}},G.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},G.fromSaved=function(e,t,n){return t instanceof Q?new G(e,At(e.mode,t.state),n,t.lookAhead):new G(e,At(e.mode,t),n)},G.prototype.save=function(e){var t=e!==!1?At(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Q(t,this.maxLookAhead):t};function le(e,t,n,i){var o=[e.state.modeGen],I={};hi(e,t.text,e.doc.mode,n,function(ee,he){return o.push(ee,he)},I,i);for(var z=n.state,Y=function(ee){n.baseTokens=o;var he=e.state.overlays[ee],ve=1,Ce=0;n.state=!0,hi(e,t.text,he.mode,n,function(we,Ne){for(var Ke=ve;Ce<we;){var Je=o[ve];Je>we&&o.splice(ve,1,we,o[ve+1],Je),ve+=2,Ce=Math.min(we,Je)}if(!Ne)return;if(he.opaque)o.splice(Ke,ve-Ke,we,"overlay "+Ne),ve=Ke+2;else for(;Ke<ve;Ke+=2){var ht=o[Ke+1];o[Ke+1]=(ht?ht+" ":"")+"overlay "+Ne}},I),n.state=z,n.baseTokens=null,n.baseTokenPos=1},q=0;q<e.state.overlays.length;++q)Y(q);return{styles:o,classes:I.bgClass||I.textClass?I:null}}function Ae(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var i=Me(e,Et(t)),o=t.text.length>e.options.maxHighlightLength&&At(e.doc.mode,i.state),I=le(e,t,i);o&&(i.state=o),t.stateAfter=i.save(!o),t.styles=I.styles,I.classes?t.styleClasses=I.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Me(e,t,n){var i=e.doc,o=e.display;if(!i.mode.startState)return new G(i,!0,t);var I=Pt(e,t,n),z=I>i.first&&it(i,I-1).stateAfter,Y=z?G.fromSaved(i,z,I):new G(i,di(i.mode),I);return i.iter(I,t,function(q){ot(e,q.text,Y);var ee=Y.line;q.stateAfter=ee==t-1||ee%5==0||ee>=o.viewFrom&&ee<o.viewTo?Y.save():null,Y.nextLine()}),n&&(i.modeFrontier=Y.line),Y}function ot(e,t,n,i){var o=e.doc.mode,I=new Bt(t,e.options.tabSize,n);for(I.start=I.pos=i||0,t==""&&Re(o,n.state);!I.eol();)$e(o,I,n.state),I.start=I.pos}function Re(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=ei(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function $e(e,t,n,i){for(var o=0;o<10;o++){i&&(i[0]=ei(e,n).mode);var I=e.token(t,n);if(t.pos>t.start)return I}throw new Error("Mode "+e.name+" failed to advance stream.")}var ze=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function xt(e,t,n,i){var o=e.doc,I=o.mode,z;t=_(o,t);var Y=it(o,t.line),q=Me(e,t.line,n),ee=new Bt(Y.text,e.options.tabSize,q),he;for(i&&(he=[]);(i||ee.pos<t.ch)&&!ee.eol();)ee.start=ee.pos,z=$e(I,ee,q.state),i&&he.push(new ze(ee,z,At(o.mode,q.state)));return i?he:new ze(ee,z,q.state)}function vt(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var i=n[1]?"bgClass":"textClass";t[i]==null?t[i]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[i])||(t[i]+=" "+n[2])}return e}function hi(e,t,n,i,o,I,z){var Y=n.flattenSpans;Y==null&&(Y=e.options.flattenSpans);var q=0,ee=null,he=new Bt(t,e.options.tabSize,i),ve,Ce=e.options.addModeClass&&[null];for(t==""&&vt(Re(n,i.state),I);!he.eol();){if(he.pos>e.options.maxHighlightLength?(Y=!1,z&&ot(e,t,i,he.pos),he.pos=t.length,ve=null):ve=vt($e(n,he,i.state,Ce),I),Ce){var we=Ce[0].name;we&&(ve="m-"+(ve?we+" "+ve:we))}if(!Y||ee!=ve){for(;q<he.start;)q=Math.min(he.start,q+5e3),o(q,ee);ee=ve}he.start=he.pos}for(;q<he.pos;){var Ne=Math.min(he.pos,q+5e3);o(Ne,ee),q=Ne}}function Pt(e,t,n){for(var i,o,I=e.doc,z=n?-1:t-(e.doc.mode.innerMode?1e3:100),Y=t;Y>z;--Y){if(Y<=I.first)return I.first;var q=it(I,Y-1),ee=q.stateAfter;if(ee&&(!n||Y+(ee instanceof Q?ee.lookAhead:0)<=I.modeFrontier))return Y;var he=B(q.text,null,e.options.tabSize);(o==null||i>he)&&(o=Y-1,i=he)}return o}function zt(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,i=t-1;i>n;i--){var o=it(e,i).stateAfter;if(o&&(!(o instanceof Q)||i+o.lookAhead<t)){n=i+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var yi=!1,Si=!1;function bi(){yi=!0}function Jt(){Si=!0}function wt(e,t,n){this.marker=e,this.from=t,this.to=n}function mt(e,t){if(e)for(var n=0;n<e.length;++n){var i=e[n];if(i.marker==t)return i}}function Wt(e,t){for(var n,i=0;i<e.length;++i)e[i]!=t&&(n||(n=[])).push(e[i]);return n}function $t(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function ai(e,t,n){var i;if(e)for(var o=0;o<e.length;++o){var I=e[o],z=I.marker,Y=I.from==null||(z.inclusiveLeft?I.from<=t:I.from<t);if(Y||I.from==t&&z.type=="bookmark"&&(!n||!I.marker.insertLeft)){var q=I.to==null||(z.inclusiveRight?I.to>=t:I.to>t);(i||(i=[])).push(new wt(z,I.from,q?null:I.to))}}return i}function Ht(e,t,n){var i;if(e)for(var o=0;o<e.length;++o){var I=e[o],z=I.marker,Y=I.to==null||(z.inclusiveRight?I.to>=t:I.to>t);if(Y||I.from==t&&z.type=="bookmark"&&(!n||I.marker.insertLeft)){var q=I.from==null||(z.inclusiveLeft?I.from<=t:I.from<t);(i||(i=[])).push(new wt(z,q?null:I.from-t,I.to==null?null:I.to-t))}}return i}function Fi(e,t){if(t.full)return null;var n=ti(e,t.from.line)&&it(e,t.from.line).markedSpans,i=ti(e,t.to.line)&&it(e,t.to.line).markedSpans;if(!n&&!i)return null;var o=t.from.ch,I=t.to.ch,z=gt(t.from,t.to)==0,Y=ai(n,o,z),q=Ht(i,I,z),ee=t.text.length==1,he=Se(t.text).length+(ee?o:0);if(Y)for(var ve=0;ve<Y.length;++ve){var Ce=Y[ve];if(Ce.to==null){var we=mt(q,Ce.marker);we?ee&&(Ce.to=we.to==null?null:we.to+he):Ce.to=o}}if(q)for(var Ne=0;Ne<q.length;++Ne){var Ke=q[Ne];if(Ke.to!=null&&(Ke.to+=he),Ke.from==null){var Je=mt(Y,Ke.marker);Je||(Ke.from=he,ee&&(Y||(Y=[])).push(Ke))}else Ke.from+=he,ee&&(Y||(Y=[])).push(Ke)}Y&&(Y=Di(Y)),q&&q!=Y&&(q=Di(q));var ht=[Y];if(!ee){var _t=t.text.length-2,ct;if(_t>0&&Y)for(var St=0;St<Y.length;++St)Y[St].to==null&&(ct||(ct=[])).push(new wt(Y[St].marker,null,null));for(var Gt=0;Gt<_t;++Gt)ht.push(ct);ht.push(q)}return ht}function Di(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function en(e,t,n){var i=null;if(e.iter(t.line,n.line+1,function(we){if(we.markedSpans)for(var Ne=0;Ne<we.markedSpans.length;++Ne){var Ke=we.markedSpans[Ne].marker;Ke.readOnly&&(!i||te(i,Ke)==-1)&&(i||(i=[])).push(Ke)}}),!i)return null;for(var o=[{from:t,to:n}],I=0;I<i.length;++I)for(var z=i[I],Y=z.find(0),q=0;q<o.length;++q){var ee=o[q];if(gt(ee.to,Y.from)<0||gt(ee.from,Y.to)>0)continue;var he=[q,1],ve=gt(ee.from,Y.from),Ce=gt(ee.to,Y.to);(ve<0||!z.inclusiveLeft&&!ve)&&he.push({from:ee.from,to:Y.from}),(Ce>0||!z.inclusiveRight&&!Ce)&&he.push({from:Y.to,to:ee.to}),o.splice.apply(o,he),q+=he.length-3}return o}function gn(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function Cn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function xi(e){return e.inclusiveLeft?-1:0}function li(e){return e.inclusiveRight?1:0}function Ci(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var i=e.find(),o=t.find(),I=gt(i.from,o.from)||xi(e)-xi(t);if(I)return-I;var z=gt(i.to,o.to)||li(e)-li(t);return z||t.id-e.id}function qt(e,t){var n=Si&&e.markedSpans,i;if(n)for(var o=void 0,I=0;I<n.length;++I)o=n[I],o.marker.collapsed&&(t?o.from:o.to)==null&&(!i||Ci(i,o.marker)<0)&&(i=o.marker);return i}function Ii(e){return qt(e,!0)}function ui(e){return qt(e,!1)}function pn(e,t){var n=Si&&e.markedSpans,i;if(n)for(var o=0;o<n.length;++o){var I=n[o];I.marker.collapsed&&(I.from==null||I.from<t)&&(I.to==null||I.to>t)&&(!i||Ci(i,I.marker)<0)&&(i=I.marker)}return i}function Pi(e,t,n,i,o){var I=it(e,t),z=Si&&I.markedSpans;if(z)for(var Y=0;Y<z.length;++Y){var q=z[Y];if(!q.marker.collapsed)continue;var ee=q.marker.find(0),he=gt(ee.from,n)||xi(q.marker)-xi(o),ve=gt(ee.to,i)||li(q.marker)-li(o);if(he>=0&&ve<=0||he<=0&&ve>=0)continue;if(he<=0&&(q.marker.inclusiveRight&&o.inclusiveLeft?gt(ee.to,n)>=0:gt(ee.to,n)>0)||he>=0&&(q.marker.inclusiveRight&&o.inclusiveLeft?gt(ee.from,i)<=0:gt(ee.from,i)<0))return!0}}function Ri(e){for(var t;t=Ii(e);)e=t.find(-1,!0).line;return e}function En(e){for(var t;t=ui(e);)e=t.find(1,!0).line;return e}function xn(e){for(var t,n;t=ui(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function kn(e,t){var n=it(e,t),i=Ri(n);return n==i?t:Et(i)}function vn(e,t){if(t>e.lastLine())return t;var n=it(e,t),i;if(!cn(e,n))return t;for(;i=ui(n);)n=i.find(1,!0).line;return Et(n)+1}function cn(e,t){var n=Si&&t.markedSpans;if(n)for(var i=void 0,o=0;o<n.length;++o){if(i=n[o],!i.marker.collapsed)continue;if(i.from==null)return!0;if(i.marker.widgetNode)continue;if(i.from==0&&i.marker.inclusiveLeft&&Hn(e,t,i))return!0}}function Hn(e,t,n){if(n.to==null){var i=n.marker.find(1,!0);return Hn(e,i.line,mt(i.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var o=void 0,I=0;I<t.markedSpans.length;++I)if(o=t.markedSpans[I],o.marker.collapsed&&!o.marker.widgetNode&&o.from==n.to&&(o.to==null||o.to!=n.from)&&(o.marker.inclusiveLeft||n.marker.inclusiveRight)&&Hn(e,t,o))return!0}function Ki(e){e=Ri(e);for(var t=0,n=e.parent,i=0;i<n.lines.length;++i){var o=n.lines[i];if(o==e)break;t+=o.height}for(var I=n.parent;I;n=I,I=n.parent)for(var z=0;z<I.children.length;++z){var Y=I.children[z];if(Y==n)break;t+=Y.height}return t}function Wn(e){if(e.height==0)return 0;for(var t=e.text.length,n,i=e;n=Ii(i);){var o=n.find(0,!0);i=o.from.line,t+=o.from.ch-o.to.ch}for(i=e;n=ui(i);){var I=n.find(0,!0);t-=i.text.length-I.from.ch,i=I.to.line,t+=i.text.length-I.to.ch}return t}function qn(e){var t=e.display,n=e.doc;t.maxLine=it(n,n.first),t.maxLineLength=Wn(t.maxLine),t.maxLineChanged=!0,n.iter(function(i){var o=Wn(i);o>t.maxLineLength&&(t.maxLineLength=o,t.maxLine=i)})}var Rn=function(e,t,n){this.text=e,Cn(this,t),this.height=n?n(this):1};Rn.prototype.lineNo=function(){return Et(this)},pe(Rn);function Vi(e,t,n,i){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),gn(e),Cn(e,n);var o=i?i(e):1;o!=e.height&&Kt(e,o)}function et(e){e.parent=null,gn(e)}var kt={},Ot={};function Xt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Ot:kt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Yt(e,t){var n=m("span",null,null,k?"padding-right: .1px":null),i={pre:m("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var o=0;o<=(t.rest?t.rest.length:0);o++){var I=o?t.rest[o-1]:t.line,z=void 0;i.pos=0,i.addToken=si,Vt(e.display.measure)&&(z=ut(I,e.doc.direction))&&(i.addToken=tn(i.addToken,z)),i.map=[];var Y=t!=e.display.externalMeasured&&Et(I);An(I,i,Ae(e,I,Y)),I.styleClasses&&(I.styleClasses.bgClass&&(i.bgClass=W(I.styleClasses.bgClass,i.bgClass||"")),I.styleClasses.textClass&&(i.textClass=W(I.styleClasses.textClass,i.textClass||""))),i.map.length==0&&i.map.push(0,0,i.content.appendChild(It(e.display.measure))),o==0?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(k){var q=i.content.lastChild;(/\bcm-tab\b/.test(q.className)||q.querySelector&&q.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return Oe(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=W(i.pre.className,i.textClass||"")),i}function ci(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 si(e,t,n,i,o,I,z){if(!t)return;var Y=e.splitSpaces?Bi(t,e.trailingSpace):t,q=e.cm.state.specialChars,ee=!1,he;if(!q.test(t))e.col+=t.length,he=document.createTextNode(Y),e.map.push(e.pos,e.pos+t.length,he),V&&H<9&&(ee=!0),e.pos+=t.length;else{he=document.createDocumentFragment();for(var ve=0;;){q.lastIndex=ve;var Ce=q.exec(t),we=Ce?Ce.index-ve:t.length-ve;if(we){var Ne=document.createTextNode(Y.slice(ve,ve+we));V&&H<9?he.appendChild(a("span",[Ne])):he.appendChild(Ne),e.map.push(e.pos,e.pos+we,Ne),e.col+=we,e.pos+=we}if(!Ce)break;ve+=we+1;var Ke=void 0;if(Ce[0]==" "){var Je=e.cm.options.tabSize,ht=Je-e.col%Je;Ke=he.appendChild(a("span",se(ht),"cm-tab")),Ke.setAttribute("role","presentation"),Ke.setAttribute("cm-text"," "),e.col+=ht}else Ce[0]=="\r"||Ce[0]==`
|
|
`?(Ke=he.appendChild(a("span",Ce[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ke.setAttribute("cm-text",Ce[0]),e.col+=1):(Ke=e.cm.options.specialCharPlaceholder(Ce[0]),Ke.setAttribute("cm-text",Ce[0]),V&&H<9?he.appendChild(a("span",[Ke])):he.appendChild(Ke),e.col+=1);e.map.push(e.pos,e.pos+1,Ke),e.pos++}}if(e.trailingSpace=Y.charCodeAt(t.length-1)==32,n||i||o||ee||I||z){var _t=n||"";i&&(_t+=i),o&&(_t+=o);var ct=a("span",[he],_t,I);if(z)for(var St in z)z.hasOwnProperty(St)&&St!="style"&&St!="class"&&ct.setAttribute(St,z[St]);return e.content.appendChild(ct)}e.content.appendChild(he)}function Bi(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,i="",o=0;o<e.length;o++){var I=e.charAt(o);I==" "&&n&&(o==e.length-1||e.charCodeAt(o+1)==32)&&(I="\xA0"),i+=I,n=I==" "}return i}function tn(e,t){return function(n,i,o,I,z,Y,q){o=o?o+" cm-force-border":"cm-force-border";for(var ee=n.pos,he=ee+i.length;;){for(var ve=void 0,Ce=0;Ce<t.length&&!(ve=t[Ce],ve.to>ee&&ve.from<=ee);Ce++);if(ve.to>=he)return e(n,i,o,I,z,Y,q);e(n,i.slice(0,ve.to-ee),o,I,null,Y,q),I=null,i=i.slice(ve.to-ee),ee=ve.to}}}function ii(e,t,n,i){var o=!i&&n.widgetNode;o&&e.map.push(e.pos,e.pos+t,o),!i&&e.cm.display.input.needsContentAttribute&&(o||(o=e.content.appendChild(document.createElement("span"))),o.setAttribute("cm-marker",n.id)),o&&(e.cm.display.input.setUneditable(o),e.content.appendChild(o)),e.pos+=t,e.trailingSpace=!1}function An(e,t,n){var i=e.markedSpans,o=e.text,I=0;if(!i){for(var z=1;z<n.length;z+=2)t.addToken(t,o.slice(I,I=n[z]),Xt(n[z+1],t.cm.options));return}for(var Y=o.length,q=0,ee=1,he="",ve,Ce,we=0,Ne,Ke,Je,ht,_t;;){if(we==q){Ne=Ke=Je=Ce="",_t=null,ht=null,we=Infinity;for(var ct=[],St=void 0,Gt=0;Gt<i.length;++Gt){var jt=i[Gt],Zt=jt.marker;if(Zt.type=="bookmark"&&jt.from==q&&Zt.widgetNode)ct.push(Zt);else if(jt.from<=q&&(jt.to==null||jt.to>q||Zt.collapsed&&jt.to==q&&jt.from==q)){if(jt.to!=null&&jt.to!=q&&we>jt.to&&(we=jt.to,Ke=""),Zt.className&&(Ne+=" "+Zt.className),Zt.css&&(Ce=(Ce?Ce+";":"")+Zt.css),Zt.startStyle&&jt.from==q&&(Je+=" "+Zt.startStyle),Zt.endStyle&&jt.to==we&&(St||(St=[])).push(Zt.endStyle,jt.to),Zt.title&&((_t||(_t={})).title=Zt.title),Zt.attributes)for(var Ti in Zt.attributes)(_t||(_t={}))[Ti]=Zt.attributes[Ti];Zt.collapsed&&(!ht||Ci(ht.marker,Zt)<0)&&(ht=jt)}else jt.from>q&&we>jt.from&&(we=jt.from)}if(St)for(var Gi=0;Gi<St.length;Gi+=2)St[Gi+1]==we&&(Ke+=" "+St[Gi]);if(!ht||ht.from==q)for(var Li=0;Li<ct.length;++Li)ii(t,0,ct[Li]);if(ht&&(ht.from||0)==q){if(ii(t,(ht.to==null?Y+1:ht.to)-q,ht.marker,ht.from==null),ht.to==null)return;ht.to==q&&(ht=!1)}}if(q>=Y)break;for(var hn=Math.min(Y,we);;){if(he){var sn=q+he.length;if(!ht){var Ni=sn>hn?he.slice(0,hn-q):he;t.addToken(t,Ni,ve?ve+Ne:Ne,Je,q+Ni.length==we?Ke:"",Ce,_t)}if(sn>=hn){he=he.slice(hn-q),q=hn;break}q=sn,Je=""}he=o.slice(I,I=n[ee++]),ve=Xt(n[ee++],t.cm.options)}}}function mi(e,t,n){this.line=t,this.rest=xn(t),this.size=this.rest?Et(Se(this.rest))-n+1:1,this.node=this.text=null,this.hidden=cn(e,t)}function nn(e,t,n){for(var i=[],o,I=t;I<n;I=o){var z=new mi(e.doc,it(e.doc,I),I);o=I+z.size,i.push(z)}return i}var $i=null;function mn(e){$i?$i.ops.push(e):e.ownsGroup=$i={ops:[e],delayedCallbacks:[]}}function Lo(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var i=0;i<e.ops.length;i++){var o=e.ops[i];if(o.cursorActivityHandlers)for(;o.cursorActivityCalled<o.cursorActivityHandlers.length;)o.cursorActivityHandlers[o.cursorActivityCalled++].call(null,o.cm)}}while(n<t.length)}function Io(e,t){var n=e.ownsGroup;if(!n)return;try{Lo(n)}finally{$i=null,t(n)}}var vr=null;function Xi(e,t){var n=yt(e,t);if(!n.length)return;var i=Array.prototype.slice.call(arguments,2),o;$i?o=$i.delayedCallbacks:vr?o=vr:(o=vr=[],setTimeout(ko,0));for(var I=function(Y){o.push(function(){return n[Y].apply(null,i)})},z=0;z<n.length;++z)I(z)}function ko(){var e=vr;vr=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,n,i){for(var o=0;o<t.changes.length;o++){var I=t.changes[o];I=="text"?Po(e,t):I=="gutter"?Qa(e,t,n,i):I=="class"?ha(e,t):I=="widget"&&Mo(e,t,i)}t.changes=null}function yr(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),V&&H<8&&(e.node.style.zIndex=2)),e.node}function Do(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var i=yr(t);t.background=i.insertBefore(a("div",null,n),i.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Yt(e,t)}function Po(e,t){var n=t.text.className,i=$a(e,t);t.text==t.node&&(t.node=i.pre),t.text.parentNode.replaceChild(i.pre,t.text),t.text=i.pre,i.bgClass!=t.bgClass||i.textClass!=t.textClass?(t.bgClass=i.bgClass,t.textClass=i.textClass,ha(e,t)):n&&(t.text.className=n)}function ha(e,t){Do(e,t),t.line.wrapClass?yr(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Qa(e,t,n,i){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 o=yr(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),o.insertBefore(t.gutterBackground,t.text)}var I=t.line.gutterMarkers;if(e.options.lineNumbers||I){var z=yr(t),Y=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Y),z.insertBefore(Y,t.text),t.line.gutterClass&&(Y.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!I||!I["CodeMirror-linenumbers"])&&(t.lineNumber=Y.appendChild(a("div",oi(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),I)for(var q=0;q<e.display.gutterSpecs.length;++q){var ee=e.display.gutterSpecs[q].className,he=I.hasOwnProperty(ee)&&I[ee];he&&Y.appendChild(a("div",[he],"CodeMirror-gutter-elt","left: "+i.gutterLeft[ee]+"px; width: "+i.gutterWidth[ee]+"px"))}}}function Mo(e,t,n){t.alignable&&(t.alignable=null);for(var i=R("CodeMirror-linewidget"),o=t.node.firstChild,I=void 0;o;o=I)I=o.nextSibling,i.test(o.className)&&t.node.removeChild(o);Ja(e,t,n)}function No(e,t,n,i){var o=$a(e,t);return t.text=t.node=o.pre,o.bgClass&&(t.bgClass=o.bgClass),o.textClass&&(t.textClass=o.textClass),ha(e,t),Qa(e,t,n,i),Ja(e,t,i),t.node}function Ja(e,t,n){if(Za(e,t.line,t,n,!0),t.rest)for(var i=0;i<t.rest.length;i++)Za(e,t.rest[i],t,n,!1)}function Za(e,t,n,i,o){if(!t.widgets)return;for(var I=yr(n),z=0,Y=t.widgets;z<Y.length;++z){var q=Y[z],ee=a("div",[q.node],"CodeMirror-linewidget"+(q.className?" "+q.className:""));q.handleMouseEvents||ee.setAttribute("cm-ignore-events","true"),Uo(q,ee,n,i),e.display.input.setUneditable(ee),o&&q.above?I.insertBefore(ee,n.gutter||n.text):I.appendChild(ee),Xi(q,"redraw")}}function Uo(e,t,n,i){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var o=i.wrapperWidth;t.style.left=i.fixedPos+"px",e.coverGutter||(o-=i.gutterTotalWidth,t.style.paddingLeft=i.gutterTotalWidth+"px"),t.style.width=o+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-i.gutterTotalWidth+"px"))}function _r(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!b(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),g(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function On(e,t){for(var n=ye(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Wr(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=g(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,i={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(i.left)&&!isNaN(i.right)&&(e.cachedPaddingH=i),i}function Tn(e){return ae-e.display.nativeBarWidth}function Gn(e){return e.display.scroller.clientWidth-Tn(e)-e.display.barWidth}function da(e){return e.display.scroller.clientHeight-Tn(e)-e.display.barHeight}function Fo(e,t,n){var i=e.options.lineWrapping,o=i&&Gn(e);if(!t.measure.heights||i&&t.measure.width!=o){var I=t.measure.heights=[];if(i){t.measure.width=o;for(var z=t.text.firstChild.getClientRects(),Y=0;Y<z.length-1;Y++){var q=z[Y],ee=z[Y+1];Math.abs(q.bottom-ee.bottom)>2&&I.push((q.bottom+ee.top)/2-n.top)}}I.push(n.bottom-n.top)}}function es(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var i=0;i<e.rest.length;i++)if(e.rest[i]==t)return{map:e.measure.maps[i],cache:e.measure.caches[i]};for(var o=0;o<e.rest.length;o++)if(Et(e.rest[o])>n)return{map:e.measure.maps[o],cache:e.measure.caches[o],before:!0}}function Bo(e,t){t=Ri(t);var n=Et(t),i=e.display.externalMeasured=new mi(e.doc,t,n);i.lineN=n;var o=i.built=Yt(e,i);return i.text=o.pre,g(e.display.lineMeasure,o.pre),i}function ts(e,t,n,i){return wn(e,er(e,t),n,i)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Vn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function er(e,t){var n=Et(t),i=fa(e,n);i&&!i.text?i=null:i&&i.changes&&(Ya(e,i,n,_a(e)),e.curOp.forceUpdate=!0),i||(i=Bo(e,t));var o=es(i,t,n);return{line:t,view:i,rect:null,map:o.map,cache:o.cache,before:o.before,hasHeights:!1}}function wn(e,t,n,i,o){t.before&&(n=-1);var I=n+(i||""),z;return t.cache.hasOwnProperty(I)?z=t.cache[I]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fo(e,t.view,t.rect),t.hasHeights=!0),z=Ho(e,t,n,i),z.bogus||(t.cache[I]=z)),{left:z.left,right:z.right,top:o?z.rtop:z.top,bottom:o?z.rbottom:z.bottom}}var is={left:0,right:0,top:0,bottom:0};function ns(e,t,n){for(var i,o,I,z,Y,q,ee=0;ee<e.length;ee+=3)if(Y=e[ee],q=e[ee+1],t<Y?(o=0,I=1,z="left"):t<q?(o=t-Y,I=o+1):(ee==e.length-3||t==q&&e[ee+3]>t)&&(I=q-Y,o=I-1,t>=q&&(z="right")),o!=null){if(i=e[ee+2],Y==q&&n==(i.insertLeft?"left":"right")&&(z=n),n=="left"&&o==0)for(;ee&&e[ee-2]==e[ee-3]&&e[ee-1].insertLeft;)i=e[(ee-=3)+2],z="left";if(n=="right"&&o==q-Y)for(;ee<e.length-3&&e[ee+3]==e[ee+4]&&!e[ee+5].insertLeft;)i=e[(ee+=3)+2],z="right";break}return{node:i,start:o,end:I,collapse:z,coverStart:Y,coverEnd:q}}function jo(e,t){var n=is;if(t=="left")for(var i=0;i<e.length&&!((n=e[i]).left!=n.right);i++);else for(var o=e.length-1;o>=0&&!((n=e[o]).left!=n.right);o--);return n}function Ho(e,t,n,i){var o=ns(t.map,n,i),I=o.node,z=o.start,Y=o.end,q=o.collapse,ee;if(I.nodeType==3){for(var he=0;he<4;he++){for(;z&&He(t.line.text.charAt(o.coverStart+z));)--z;for(;o.coverStart+Y<o.coverEnd&&He(t.line.text.charAt(o.coverStart+Y));)++Y;if(V&&H<9&&z==0&&Y==o.coverEnd-o.coverStart?ee=I.parentNode.getBoundingClientRect():ee=jo(r(I,z,Y).getClientRects(),i),ee.left||ee.right||z==0)break;Y=z,z=z-1,q="right"}V&&H<11&&(ee=Wo(e.display.measure,ee))}else{z>0&&(q=i="right");var ve;e.options.lineWrapping&&(ve=I.getClientRects()).length>1?ee=ve[i=="right"?ve.length-1:0]:ee=I.getBoundingClientRect()}if(V&&H<9&&!z&&(!ee||!ee.left&&!ee.right)){var Ce=I.parentNode.getClientRects()[0];Ce?ee={left:Ce.left,right:Ce.left+ir(e.display),top:Ce.top,bottom:Ce.bottom}:ee=is}for(var we=ee.top-t.rect.top,Ne=ee.bottom-t.rect.top,Ke=(we+Ne)/2,Je=t.view.measure.heights,ht=0;ht<Je.length-1&&!(Ke<Je[ht]);ht++);var _t=ht?Je[ht-1]:0,ct=Je[ht],St={left:(q=="right"?ee.right:ee.left)-t.rect.left,right:(q=="left"?ee.left:ee.right)-t.rect.left,top:_t,bottom:ct};return!ee.left&&!ee.right&&(St.bogus=!0),e.options.singleCursorHeightPerLine||(St.rtop=we,St.rbottom=Ne),St}function Wo(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!ni(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*i,bottom:t.bottom*i}}function rs(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 as(e){e.display.externalMeasure=null,E(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)rs(e.display.view[t])}function br(e){as(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ss(){return y&&l?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function os(){return y&&l?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=_r(e.widgets[n]));return t}function Gr(e,t,n,i,o){if(!o){var I=pa(t);n.top+=I,n.bottom+=I}if(i=="line")return n;i||(i="local");var z=Ki(t);if(i=="local"?z+=Wr(e.display):z-=e.display.viewOffset,i=="page"||i=="window"){var Y=e.display.lineSpace.getBoundingClientRect();z+=Y.top+(i=="window"?0:os());var q=Y.left+(i=="window"?0:ss());n.left+=q,n.right+=q}return n.top+=z,n.bottom+=z,n}function ls(e,t,n){if(n=="div")return t;var i=t.left,o=t.top;if(n=="page")i-=ss(),o-=os();else if(n=="local"||!n){var I=e.display.sizer.getBoundingClientRect();i+=I.left,o+=I.top}var z=e.display.lineSpace.getBoundingClientRect();return{left:i-z.left,top:o-z.top}}function ma(e,t,n,i,o){return i||(i=it(e.doc,t.line)),Gr(e,i,ts(e,i,t.ch,o),n)}function yn(e,t,n,i,o,I){i=i||it(e.doc,t.line),o||(o=er(e,i));function z(Ne,Ke){var Je=wn(e,o,Ne,Ke?"right":"left",I);return Ke?Je.left=Je.right:Je.right=Je.left,Gr(e,i,Je,n)}var Y=ut(i,e.doc.direction),q=t.ch,ee=t.sticky;if(q>=i.text.length?(q=i.text.length,ee="before"):q<=0&&(q=0,ee="after"),!Y)return z(ee=="before"?q-1:q,ee=="before");function he(Ne,Ke,Je){var ht=Y[Ke],_t=ht.level==1;return z(Je?Ne-1:Ne,_t!=Je)}var ve=dt(Y,q,ee),Ce=rt,we=he(q,ve,ee=="before");return Ce!=null&&(we.other=he(q,Ce,ee!="before")),we}function us(e,t){var n=0;t=_(e.doc,t),e.options.lineWrapping||(n=ir(e.display)*t.ch);var i=it(e.doc,t.line),o=Ki(i)+Wr(e.display);return{left:n,right:n,top:o,bottom:o+i.height}}function ga(e,t,n,i,o){var I=De(e,t,n);return I.xRel=o,i&&(I.outside=i),I}function va(e,t,n){var i=e.doc;if(n+=e.display.viewOffset,n<0)return ga(i.first,0,null,-1,-1);var o=Nt(i,n),I=i.first+i.size-1;if(o>I)return ga(i.first+i.size-1,it(i,I).text.length,null,1,1);t<0&&(t=0);for(var z=it(i,o);;){var Y=Go(e,z,o,t,n),q=pn(z,Y.ch+(Y.xRel>0||Y.outside>0?1:0));if(!q)return Y;var ee=q.find(1);if(ee.line==o)return ee;z=it(i,o=ee.line)}}function hs(e,t,n,i){i-=pa(t);var o=t.text.length,I=ft(function(z){return wn(e,n,z-1).bottom<=i},o,0);return o=ft(function(z){return wn(e,n,z).top>i},I,o),{begin:I,end:o}}function cs(e,t,n,i){n||(n=er(e,t));var o=Gr(e,t,wn(e,n,i),"line").top;return hs(e,t,n,o)}function ya(e,t,n,i){return e.bottom<=n?!1:e.top>n?!0:(i?e.left:e.right)>t}function Go(e,t,n,i,o){o-=Ki(t);var I=er(e,t),z=pa(t),Y=0,q=t.text.length,ee=!0,he=ut(t,e.doc.direction);if(he){var ve=(e.options.lineWrapping?Ko:zo)(e,t,n,I,he,i,o);ee=ve.level!=1,Y=ee?ve.from:ve.to-1,q=ee?ve.to:ve.from-1}var Ce=null,we=null,Ne=ft(function(Gt){var jt=wn(e,I,Gt);return jt.top+=z,jt.bottom+=z,ya(jt,i,o,!1)?(jt.top<=o&&jt.left<=i&&(Ce=Gt,we=jt),!0):!1},Y,q),Ke,Je,ht=!1;if(we){var _t=i-we.left<we.right-i,ct=_t==ee;Ne=Ce+(ct?0:1),Je=ct?"after":"before",Ke=_t?we.left:we.right}else{!ee&&(Ne==q||Ne==Y)&&Ne++,Je=Ne==0?"after":Ne==t.text.length?"before":wn(e,I,Ne-(ee?1:0)).bottom+z<=o==ee?"after":"before";var St=yn(e,De(n,Ne,Je),"line",t,I);Ke=St.left,ht=o<St.top?-1:o>=St.bottom?1:0}return Ne=Fe(t.text,Ne,1),ga(n,Ne,Je,ht,i-Ke)}function zo(e,t,n,i,o,I,z){var Y=ft(function(ve){var Ce=o[ve],we=Ce.level!=1;return ya(yn(e,De(n,we?Ce.to:Ce.from,we?"before":"after"),"line",t,i),I,z,!0)},0,o.length-1),q=o[Y];if(Y>0){var ee=q.level!=1,he=yn(e,De(n,ee?q.from:q.to,ee?"after":"before"),"line",t,i);ya(he,I,z,!0)&&he.top>z&&(q=o[Y-1])}return q}function Ko(e,t,n,i,o,I,z){var Y=hs(e,t,i,z),q=Y.begin,ee=Y.end;/\s/.test(t.text.charAt(ee-1))&&ee--;for(var he=null,ve=null,Ce=0;Ce<o.length;Ce++){var we=o[Ce];if(we.from>=ee||we.to<=q)continue;var Ne=we.level!=1,Ke=wn(e,i,Ne?Math.min(ee,we.to)-1:Math.max(q,we.from)).right,Je=Ke<I?I-Ke+1e9:Ke-I;(!he||ve>Je)&&(he=we,ve=Je)}return he||(he=o[o.length-1]),he.from<q&&(he={from:q,to:he.to,level:he.level}),he.to>ee&&(he={from:he.from,to:ee,level:he.level}),he}var zn;function tr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(zn==null){zn=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)zn.appendChild(document.createTextNode("x")),zn.appendChild(a("br"));zn.appendChild(document.createTextNode("x"))}g(e.measure,zn);var n=zn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),E(e.measure),n||1}function ir(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");g(e.measure,n);var i=t.getBoundingClientRect(),o=(i.right-i.left)/10;return o>2&&(e.cachedCharWidth=o),o||10}function _a(e){for(var t=e.display,n={},i={},o=t.gutters.clientLeft,I=t.gutters.firstChild,z=0;I;I=I.nextSibling,++z){var Y=e.display.gutterSpecs[z].className;n[Y]=I.offsetLeft+I.clientLeft+o,i[Y]=I.clientWidth}return{fixedPos:ba(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function ba(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ds(e){var t=tr(e.display),n=e.options.lineWrapping,i=n&&Math.max(5,e.display.scroller.clientWidth/ir(e.display)-3);return function(o){if(cn(e.doc,o))return 0;var I=0;if(o.widgets)for(var z=0;z<o.widgets.length;z++)o.widgets[z].height&&(I+=o.widgets[z].height);return n?I+(Math.ceil(o.text.length/i)||1)*t:I+t}}function Ea(e){var t=e.doc,n=ds(e);t.iter(function(i){var o=n(i);o!=i.height&&Kt(i,o)})}function Kn(e,t,n,i){var o=e.display;if(!n&&ye(t).getAttribute("cm-not-content")=="true")return null;var I,z,Y=o.lineSpace.getBoundingClientRect();try{I=t.clientX-Y.left,z=t.clientY-Y.top}catch(ve){return null}var q=va(e,I,z),ee;if(i&&q.xRel>0&&(ee=it(e.doc,q.line).text).length==q.ch){var he=B(ee,ee.length,e.options.tabSize)-ee.length;q=De(q.line,Math.max(0,Math.round((I-qa(e.display).left)/ir(e.display))-he))}return q}function Vn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,i=0;i<n.length;i++)if(t-=n[i].size,t<0)return i}function rn(e,t,n,i){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),i||(i=0);var o=e.display;if(i&&n<o.viewTo&&(o.updateLineNumbers==null||o.updateLineNumbers>t)&&(o.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=o.viewTo)Si&&kn(e.doc,t)<o.viewTo&&Pn(e);else if(n<=o.viewFrom)Si&&vn(e.doc,n+i)>o.viewFrom?Pn(e):(o.viewFrom+=i,o.viewTo+=i);else if(t<=o.viewFrom&&n>=o.viewTo)Pn(e);else if(t<=o.viewFrom){var I=zr(e,n,n+i,1);I?(o.view=o.view.slice(I.index),o.viewFrom=I.lineN,o.viewTo+=i):Pn(e)}else if(n>=o.viewTo){var z=zr(e,t,t,-1);z?(o.view=o.view.slice(0,z.index),o.viewTo=z.lineN):Pn(e)}else{var Y=zr(e,t,t,-1),q=zr(e,n,n+i,1);Y&&q?(o.view=o.view.slice(0,Y.index).concat(nn(e,Y.lineN,q.lineN)).concat(o.view.slice(q.index)),o.viewTo+=i):Pn(e)}var ee=o.externalMeasured;ee&&(n<ee.lineN?ee.lineN+=i:t<ee.lineN+ee.size&&(o.externalMeasured=null))}function Dn(e,t,n){e.curOp.viewChanged=!0;var i=e.display,o=e.display.externalMeasured;if(o&&t>=o.lineN&&t<o.lineN+o.size&&(i.externalMeasured=null),t<i.viewFrom||t>=i.viewTo)return;var I=i.view[Vn(e,t)];if(I.node==null)return;var z=I.changes||(I.changes=[]);te(z,n)==-1&&z.push(n)}function Pn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function zr(e,t,n,i){var o=Vn(e,t),I,z=e.display.view;if(!Si||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var Y=e.display.viewFrom,q=0;q<o;q++)Y+=z[q].size;if(Y!=t){if(i>0){if(o==z.length-1)return null;I=Y+z[o].size-t,o++}else I=Y-t;t+=I,n+=I}for(;kn(e.doc,n)!=n;){if(o==(i<0?0:z.length-1))return null;n+=i*z[o-(i<0?1:0)].size,o+=i}return{index:o,lineN:n}}function Vo(e,t,n){var i=e.display,o=i.view;o.length==0||t>=i.viewTo||n<=i.viewFrom?(i.view=nn(e,t,n),i.viewFrom=t):(i.viewFrom>t?i.view=nn(e,t,i.viewFrom).concat(i.view):i.viewFrom<t&&(i.view=i.view.slice(Vn(e,t))),i.viewFrom=t,i.viewTo<n?i.view=i.view.concat(nn(e,i.viewTo,n)):i.viewTo>n&&(i.view=i.view.slice(0,Vn(e,n)))),i.viewTo=n}function fs(e){for(var t=e.display.view,n=0,i=0;i<t.length;i++){var o=t[i];!o.hidden&&(!o.node||o.changes)&&++n}return n}function Er(e){e.display.input.showSelection(e.display.input.prepareSelection())}function ps(e,t){t===void 0&&(t=!0);for(var n=e.doc,i={},o=i.cursors=document.createDocumentFragment(),I=i.selection=document.createDocumentFragment(),z=0;z<n.sel.ranges.length;z++){if(!t&&z==n.sel.primIndex)continue;var Y=n.sel.ranges[z];if(Y.from().line>=e.display.viewTo||Y.to().line<e.display.viewFrom)continue;var q=Y.empty();(q||e.options.showCursorWhenSelecting)&&ms(e,Y.head,o),q||Xo(e,Y,I)}return i}function ms(e,t,n){var i=yn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),o=n.appendChild(a("div","\xA0","CodeMirror-cursor"));if(o.style.left=i.left+"px",o.style.top=i.top+"px",o.style.height=Math.max(0,i.bottom-i.top)*e.options.cursorHeight+"px",i.other){var I=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));I.style.display="",I.style.left=i.other.left+"px",I.style.top=i.other.top+"px",I.style.height=(i.other.bottom-i.other.top)*.85+"px"}}function Kr(e,t){return e.top-t.top||e.left-t.left}function Xo(e,t,n){var i=e.display,o=e.doc,I=document.createDocumentFragment(),z=qa(e.display),Y=z.left,q=Math.max(i.sizerWidth,Gn(e)-i.sizer.offsetLeft)-z.right,ee=o.direction=="ltr";function he(ct,St,Gt,jt){St<0&&(St=0),St=Math.round(St),jt=Math.round(jt),I.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+ct+`px;
|
|
top: `+St+"px; width: "+(Gt==null?q-ct:Gt)+`px;
|
|
height: `+(jt-St)+"px"))}function ve(ct,St,Gt){var jt=it(o,ct),Zt=jt.text.length,Ti,Gi;function Li(Ni,on){return ma(e,De(ct,Ni),"div",jt,on)}function hn(Ni,on,Yi){var ji=cs(e,jt,null,Ni),Ui=on=="ltr"==(Yi=="after")?"left":"right",ki=Yi=="after"?ji.begin:ji.end-(/\s/.test(jt.text.charAt(ji.end-1))?2:1);return Li(ki,Ui)[Ui]}var sn=ut(jt,o.direction);return lt(sn,St||0,Gt==null?Zt:Gt,function(Ni,on,Yi,ji){var Ui=Yi=="ltr",ki=Li(Ni,Ui?"left":"right"),ln=Li(on-1,Ui?"right":"left"),mr=St==null&&Ni==0,jn=Gt==null&&on==Zt,Ji=ji==0,Sn=!sn||ji==sn.length-1;if(ln.top-ki.top<=3){var zi=(ee?mr:jn)&&Ji,Va=(ee?jn:mr)&&Sn,In=zi?Y:(Ui?ki:ln).left,Jn=Va?q:(Ui?ln:ki).right;he(In,ki.top,Jn-In,ki.bottom)}else{var Zn,qi,gr,Xa;Ui?(Zn=ee&&mr&&Ji?Y:ki.left,qi=ee?q:hn(Ni,Yi,"before"),gr=ee?Y:hn(on,Yi,"after"),Xa=ee&&jn&&Sn?q:ln.right):(Zn=ee?hn(Ni,Yi,"before"):Y,qi=!ee&&mr&&Ji?q:ki.right,gr=!ee&&jn&&Sn?Y:ln.left,Xa=ee?hn(on,Yi,"after"):q),he(Zn,ki.top,qi-Zn,ki.bottom),ki.bottom<ln.top&&he(Y,ki.bottom,null,ln.top),he(gr,ln.top,Xa-gr,ln.bottom)}(!Ti||Kr(ki,Ti)<0)&&(Ti=ki),Kr(ln,Ti)<0&&(Ti=ln),(!Gi||Kr(ki,Gi)<0)&&(Gi=ki),Kr(ln,Gi)<0&&(Gi=ln)}),{start:Ti,end:Gi}}var Ce=t.from(),we=t.to();if(Ce.line==we.line)ve(Ce.line,Ce.ch,we.ch);else{var Ne=it(o,Ce.line),Ke=it(o,we.line),Je=Ri(Ne)==Ri(Ke),ht=ve(Ce.line,Ce.ch,Je?Ne.text.length+1:null).end,_t=ve(we.line,Je?0:null,we.ch).start;Je&&(ht.top<_t.top-2?(he(ht.right,ht.top,null,ht.bottom),he(Y,_t.top,_t.left,_t.bottom)):he(ht.right,ht.top,_t.left-ht.right,ht.bottom)),ht.bottom<_t.top&&he(Y,ht.bottom,null,_t.top)}n.appendChild(I)}function xa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||nr(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function gs(e){e.state.focused||(e.display.input.focus(),Ta(e))}function vs(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,nr(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Oe(e,"focus",e,t),e.state.focused=!0,M(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),k&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),xa(e)}function nr(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Oe(e,"blur",e,t),e.state.focused=!1,T(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Vr(e){for(var t=e.display,n=t.lineDiv.offsetTop,i=0;i<t.view.length;i++){var o=t.view[i],I=e.options.lineWrapping,z=void 0,Y=0;if(o.hidden)continue;if(V&&H<8){var q=o.node.offsetTop+o.node.offsetHeight;z=q-n,n=q}else{var ee=o.node.getBoundingClientRect();z=ee.bottom-ee.top,!I&&o.text.firstChild&&(Y=o.text.firstChild.getBoundingClientRect().right-ee.left-1)}var he=o.line.height-z;if((he>.005||he<-.005)&&(Kt(o.line,z),ys(o.line),o.rest))for(var ve=0;ve<o.rest.length;ve++)ys(o.rest[ve]);if(Y>e.display.sizerWidth){var Ce=Math.ceil(Y/ir(e.display));Ce>e.display.maxLineLength&&(e.display.maxLineLength=Ce,e.display.maxLine=o.line,e.display.maxLineChanged=!0)}}}function ys(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],i=n.node.parentNode;i&&(n.height=i.offsetHeight)}}function Xr(e,t,n){var i=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;i=Math.floor(i-Wr(e));var o=n&&n.bottom!=null?n.bottom:i+e.wrapper.clientHeight,I=Nt(t,i),z=Nt(t,o);if(n&&n.ensure){var Y=n.ensure.from.line,q=n.ensure.to.line;Y<I?(I=Y,z=Nt(t,Ki(it(t,Y))+e.wrapper.clientHeight)):Math.min(q,t.lastLine())>=z&&(I=Nt(t,Ki(it(t,q))-e.wrapper.clientHeight),z=q)}return{from:I,to:Math.max(z,I+1)}}function Yo(e,t){if(Ge(e,"scrollCursorIntoView"))return;var n=e.display,i=n.sizer.getBoundingClientRect(),o=null;if(t.top+i.top<0?o=!0:t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(o=!1),o!=null&&!h){var I=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Wr(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Tn(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(I),I.scrollIntoView(o),e.display.lineSpace.removeChild(I)}}function $o(e,t,n,i){i==null&&(i=0);var o;!e.options.lineWrapping&&t==n&&(t=t.ch?De(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?De(t.line,t.ch+1,"before"):t);for(var I=0;I<5;I++){var z=!1,Y=yn(e,t),q=!n||n==t?Y:yn(e,n);o={left:Math.min(Y.left,q.left),top:Math.min(Y.top,q.top)-i,right:Math.max(Y.left,q.left),bottom:Math.max(Y.bottom,q.bottom)+i};var ee=wa(e,o),he=e.doc.scrollTop,ve=e.doc.scrollLeft;if(ee.scrollTop!=null&&(Tr(e,ee.scrollTop),Math.abs(e.doc.scrollTop-he)>1&&(z=!0)),ee.scrollLeft!=null&&(Xn(e,ee.scrollLeft),Math.abs(e.doc.scrollLeft-ve)>1&&(z=!0)),!z)break}return o}function Qo(e,t){var n=wa(e,t);n.scrollTop!=null&&Tr(e,n.scrollTop),n.scrollLeft!=null&&Xn(e,n.scrollLeft)}function wa(e,t){var n=e.display,i=tr(e.display);t.top<0&&(t.top=0);var o=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,I=da(e),z={};t.bottom-t.top>I&&(t.bottom=t.top+I);var Y=e.doc.height+ca(n),q=t.top<i,ee=t.bottom>Y-i;if(t.top<o)z.scrollTop=q?0:t.top;else if(t.bottom>o+I){var he=Math.min(t.top,(ee?Y:t.bottom)-I);he!=o&&(z.scrollTop=he)}var ve=e.options.fixedGutter?0:n.gutters.offsetWidth,Ce=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ve,we=Gn(e)-n.gutters.offsetWidth,Ne=t.right-t.left>we;return Ne&&(t.right=t.left+we),t.left<10?z.scrollLeft=0:t.left<Ce?z.scrollLeft=Math.max(0,t.left+ve-(Ne?0:10)):t.right>we+Ce-3&&(z.scrollLeft=t.right+(Ne?0:10)-we),z}function Sa(e,t){if(t==null)return;Yr(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function rr(e){Yr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function xr(e,t,n){(t!=null||n!=null)&&Yr(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Jo(e,t){Yr(e),e.curOp.scrollToPos=t}function Yr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=us(e,t.from),i=us(e,t.to);_s(e,n,i,t.margin)}}function _s(e,t,n,i){var o=wa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-i,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+i});xr(e,o.scrollLeft,o.scrollTop)}function Tr(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||Ra(e,{top:t}),bs(e,t,!0),D&&Ra(e),Cr(e,100)}function bs(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Xn(e,t,n,i){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!i)return;e.doc.scrollLeft=t,Ss(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function wr(e){var t=e.display,n=t.gutters.offsetWidth,i=Math.round(e.doc.height+ca(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:i,scrollHeight:i+Tn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Yn=function(e,t,n){this.cm=n;var i=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=o.tabIndex=-1,e(i),e(o),Ie(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),Ie(o,"scroll",function(){o.clientWidth&&t(o.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,V&&H<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Yn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?i+"px":"0";var o=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+o)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?i+"px":"0",this.horiz.style.left=e.barLeft+"px";var I=e.viewWidth-e.barLeft-(n?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+I)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(i==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?i:0,bottom:t?i:0}},Yn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Yn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Yn.prototype.zeroWidthHack=function(){var e=u&&!c?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new J,this.disableVert=new J},Yn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function i(){var o=e.getBoundingClientRect(),I=n=="vert"?document.elementFromPoint(o.right-1,(o.top+o.bottom)/2):document.elementFromPoint((o.right+o.left)/2,o.bottom-1);I!=e?e.style.pointerEvents="none":t.set(1e3,i)}t.set(1e3,i)},Yn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Sr=function(){};Sr.prototype.update=function(){return{bottom:0,right:0}},Sr.prototype.setScrollLeft=function(){},Sr.prototype.setScrollTop=function(){},Sr.prototype.clear=function(){};function ar(e,t){t||(t=wr(e));var n=e.display.barWidth,i=e.display.barHeight;Es(e,t);for(var o=0;o<4&&n!=e.display.barWidth||i!=e.display.barHeight;o++)n!=e.display.barWidth&&e.options.lineWrapping&&Vr(e),Es(e,wr(e)),n=e.display.barWidth,i=e.display.barHeight}function Es(e,t){var n=e.display,i=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px",n.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=i.bottom+"px",n.scrollbarFiller.style.width=i.right+"px"):n.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=i.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var xs={native:Yn,null:Sr};function Ts(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&T(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new xs[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ie(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?Xn(e,t):Tr(e,t)},e),e.display.scrollbars.addClass&&M(e.display.wrapper,e.display.scrollbars.addClass)}var Zo=0;function $n(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:++Zo},mn(e.curOp)}function Qn(e){var t=e.curOp;t&&Io(t,function(n){for(var i=0;i<n.ops.length;i++)n.ops[i].cm.curOp=null;qo(n)})}function qo(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var i=0;i<t.length;i++)tl(t[i]);for(var o=0;o<t.length;o++)il(t[o]);for(var I=0;I<t.length;I++)nl(t[I]);for(var z=0;z<t.length;z++)rl(t[z])}function el(e){var t=e.cm,n=t.display;sl(t),e.updateMaxLine&&qn(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new $r(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Ca(e.cm,e.update)}function il(e){var t=e.cm,n=t.display;e.updatedDisplay&&Vr(t),e.barMeasure=wr(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ts(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Tn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Gn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Xn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==P();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&ar(t,e.barMeasure),e.updatedDisplay&&Oa(t,e.barMeasure),e.selectionChanged&&xa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&gs(e.cm)}function rl(e){var t=e.cm,n=t.display,i=t.doc;if(e.updatedDisplay&&ws(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&bs(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Xn(t,e.scrollLeft,!0,!0),e.scrollToPos){var o=$o(t,_(i,e.scrollToPos.from),_(i,e.scrollToPos.to),e.scrollToPos.margin);Yo(t,o)}var I=e.maybeHiddenMarkers,z=e.maybeUnhiddenMarkers;if(I)for(var Y=0;Y<I.length;++Y)I[Y].lines.length||Oe(I[Y],"hide");if(z)for(var q=0;q<z.length;++q)z[q].lines.length&&Oe(z[q],"unhide");n.wrapper.offsetHeight&&(i.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Oe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function un(e,t){if(e.curOp)return t();$n(e);try{return t()}finally{Qn(e)}}function Hi(e,t){return function(){if(e.curOp)return t.apply(e,arguments);$n(e);try{return t.apply(e,arguments)}finally{Qn(e)}}}function Zi(e){return function(){if(this.curOp)return e.apply(this,arguments);$n(this);try{return e.apply(this,arguments)}finally{Qn(this)}}}function Wi(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);$n(t);try{return e.apply(this,arguments)}finally{Qn(t)}}}function Cr(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,U(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,i=Me(e,t.highlightFrontier),o=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),function(I){if(i.line>=e.display.viewFrom){var z=I.styles,Y=I.text.length>e.options.maxHighlightLength?At(t.mode,i.state):null,q=le(e,I,i,!0);Y&&(i.state=Y),I.styles=q.styles;var ee=I.styleClasses,he=q.classes;he?I.styleClasses=he:ee&&(I.styleClasses=null);for(var ve=!z||z.length!=I.styles.length||ee!=he&&(!ee||!he||ee.bgClass!=he.bgClass||ee.textClass!=he.textClass),Ce=0;!ve&&Ce<z.length;++Ce)ve=z[Ce]!=I.styles[Ce];ve&&o.push(i.line),I.stateAfter=i.save(),i.nextLine()}else I.text.length<=e.options.maxHighlightLength&&ot(e,I.text,i),I.stateAfter=i.line%5==0?i.save():null,i.nextLine();if(+new Date>n)return Cr(e,e.options.workDelay),!0}),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),o.length&&un(e,function(){for(var I=0;I<o.length;I++)Dn(e,o[I],"text")})}var $r=function(e,t,n){var i=e.display;this.viewport=t,this.visible=Xr(i,e.doc,t),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=Gn(e),this.force=n,this.dims=_a(e),this.events=[]};$r.prototype.signal=function(e,t){fe(e,t)&&this.events.push(arguments)},$r.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Oe.apply(null,this.events[e])};function sl(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Tn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Tn(e)+"px",t.scrollbarsClipped=!0)}function ol(e){if(e.hasFocus())return null;var t=P();if(!t||!b(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var i=window.getSelection();i.anchorNode&&i.extend&&b(e.display.lineDiv,i.anchorNode)&&(n.anchorNode=i.anchorNode,n.anchorOffset=i.anchorOffset,n.focusNode=i.focusNode,n.focusOffset=i.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==P())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&b(document.body,e.anchorNode)&&b(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function Ca(e,t){var n=e.display,i=e.doc;if(t.editorIsHidden)return Pn(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&fs(e)==0)return!1;Cs(e)&&(Pn(e),t.dims=_a(e));var o=i.first+i.size,I=Math.max(t.visible.from-e.options.viewportMargin,i.first),z=Math.min(o,t.visible.to+e.options.viewportMargin);n.viewFrom<I&&I-n.viewFrom<20&&(I=Math.max(i.first,n.viewFrom)),n.viewTo>z&&n.viewTo-z<20&&(z=Math.min(o,n.viewTo)),Si&&(I=kn(e.doc,I),z=vn(e.doc,z));var Y=I!=n.viewFrom||z!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vo(e,I,z),n.viewOffset=Ki(it(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var q=fs(e);if(!Y&&q==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var ee=ol(e);return q>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),q>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(ee),E(n.cursorDiv),E(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,Y&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Cr(e,400)),n.updateLineNumbers=null,!0}function ws(e,t){for(var n=t.viewport,i=!0;;i=!1){if(!i||!e.options.lineWrapping||t.oldDisplayWidth==Gn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ca(e.display)-da(e),n.top)}),t.visible=Xr(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else i&&(t.visible=Xr(e.display,e.doc,n));if(!Ca(e,t))break;Vr(e);var o=wr(e);Er(e),ar(e,o),Oa(e,o),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 Ra(e,t){var n=new $r(e,t);if(Ca(e,n)){Vr(e),ws(e,n);var i=wr(e);Er(e),ar(e,i),Oa(e,i),n.finish()}}function ul(e,t,n){var i=e.display,o=e.options.lineNumbers,I=i.lineDiv,z=I.firstChild;function Y(Ne){var Ke=Ne.nextSibling;return k&&u&&e.display.currentWheelTarget==Ne?Ne.style.display="none":Ne.parentNode.removeChild(Ne),Ke}for(var q=i.view,ee=i.viewFrom,he=0;he<q.length;he++){var ve=q[he];if(!ve.hidden)if(!ve.node||ve.node.parentNode!=I){var Ce=No(e,ve,ee,n);I.insertBefore(Ce,z)}else{for(;z!=ve.node;)z=Y(z);var we=o&&t!=null&&t<=ee&&ve.lineNumber;ve.changes&&(te(ve.changes,"gutter")>-1&&(we=!1),Ya(e,ve,ee,n)),we&&(E(ve.lineNumber),ve.lineNumber.appendChild(document.createTextNode(oi(e.options,ee)))),z=ve.node.nextSibling}ee+=ve.size}for(;z;)z=Y(z)}function Aa(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Oa(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Tn(e)+"px"}function Ss(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var i=ba(t)-t.scroller.scrollLeft+e.doc.scrollLeft,o=t.gutters.offsetWidth,I=i+"px",z=0;z<n.length;z++)if(!n[z].hidden){e.options.fixedGutter&&(n[z].gutter&&(n[z].gutter.style.left=I),n[z].gutterBackground&&(n[z].gutterBackground.style.left=I));var Y=n[z].alignable;if(Y)for(var q=0;q<Y.length;q++)Y[q].style.left=I}e.options.fixedGutter&&(t.gutters.style.left=i+o+"px")}function Cs(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=oi(e.options,t.first+t.size-1),i=e.display;if(n.length!=i.lineNumChars){var o=i.measure.appendChild(a("div",[a("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),I=o.firstChild.offsetWidth,z=o.offsetWidth-I;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(I,i.lineGutter.offsetWidth-z)+1,i.lineNumWidth=i.lineNumInnerWidth+z,i.lineNumChars=i.lineNumInnerWidth?n.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",Aa(e.display),!0}return!1}function La(e,t){for(var n=[],i=!1,o=0;o<e.length;o++){var I=e[o],z=null;if(typeof I!="string"&&(z=I.style,I=I.className),I=="CodeMirror-linenumbers")if(t)i=!0;else continue;n.push({className:I,style:z})}return t&&!i&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Rs(e){var t=e.gutters,n=e.gutterSpecs;E(t),e.lineGutter=null;for(var i=0;i<n.length;++i){var o=n[i],I=o.className,z=o.style,Y=t.appendChild(a("div",null,"CodeMirror-gutter "+I));z&&(Y.style.cssText=z),I=="CodeMirror-linenumbers"&&(e.lineGutter=Y,Y.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Aa(e)}function Rr(e){Rs(e.display),rn(e),Ss(e)}function hl(e,t,n,i){var o=this;this.input=n,o.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=m("div",null,"CodeMirror-code"),o.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=a("div",null,"CodeMirror-cursors"),o.measure=a("div",null,"CodeMirror-measure"),o.lineMeasure=a("div",null,"CodeMirror-measure"),o.lineSpace=m("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var I=m("div",[o.lineSpace],"CodeMirror-lines");o.mover=a("div",[I],null,"position: relative"),o.sizer=a("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=a("div",null,null,"position: absolute; height: "+ae+"px; width: 1px;"),o.gutters=a("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=a("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=a("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),V&&H<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),!k&&!(D&&s)&&(o.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(o.wrapper):e(o.wrapper)),o.viewFrom=o.viewTo=t.first,o.reportedViewFrom=o.reportedViewTo=t.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=La(i.gutters,i.lineNumbers),Rs(o),n.init(o)}var Qr=0,dn=null;V?dn=-.53:D?dn=15:y?dn=-.7:p&&(dn=-1/3);function As(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function cl(e){var t=As(e);return t.x*=dn,t.y*=dn,t}function Os(e,t){var n=As(t),i=n.x,o=n.y,I=e.display,z=I.scroller,Y=z.scrollWidth>z.clientWidth,q=z.scrollHeight>z.clientHeight;if(!(i&&Y||o&&q))return;if(o&&u&&k){e:for(var ee=t.target,he=I.view;ee!=z;ee=ee.parentNode)for(var ve=0;ve<he.length;ve++)if(he[ve].node==ee){e.display.currentWheelTarget=ee;break e}}if(i&&!D&&!v&&dn!=null){o&&q&&Tr(e,Math.max(0,z.scrollTop+o*dn)),Xn(e,Math.max(0,z.scrollLeft+i*dn)),(!o||o&&q)&&ie(t),I.wheelStartX=null;return}if(o&&dn!=null){var Ce=o*dn,we=e.doc.scrollTop,Ne=we+I.wrapper.clientHeight;Ce<0?we=Math.max(0,we+Ce-50):Ne=Math.min(e.doc.height,Ne+Ce+50),Ra(e,{top:we,bottom:Ne})}Qr<20&&(I.wheelStartX==null?(I.wheelStartX=z.scrollLeft,I.wheelStartY=z.scrollTop,I.wheelDX=i,I.wheelDY=o,setTimeout(function(){if(I.wheelStartX==null)return;var Ke=z.scrollLeft-I.wheelStartX,Je=z.scrollTop-I.wheelStartY,ht=Je&&I.wheelDY&&Je/I.wheelDY||Ke&&I.wheelDX&&Ke/I.wheelDX;if(I.wheelStartX=I.wheelStartY=null,!ht)return;dn=(dn*Qr+ht)/(Qr+1),++Qr},200)):(I.wheelDX+=i,I.wheelDY+=o))}var fn=function(e,t){this.ranges=e,this.primIndex=t};fn.prototype.primary=function(){return this.ranges[this.primIndex]},fn.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],i=e.ranges[t];if(!pi(n.anchor,i.anchor)||!pi(n.head,i.head))return!1}return!0},fn.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new gi(Ei(this.ranges[t].anchor),Ei(this.ranges[t].head));return new fn(e,this.primIndex)},fn.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},fn.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var i=this.ranges[n];if(gt(t,i.from())>=0&>(e,i.to())<=0)return n}return-1};var gi=function(e,t){this.anchor=e,this.head=t};gi.prototype.from=function(){return vi(this.anchor,this.head)},gi.prototype.to=function(){return wi(this.anchor,this.head)},gi.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function _n(e,t,n){var i=e&&e.options.selectionsMayTouch,o=t[n];t.sort(function(Ce,we){return gt(Ce.from(),we.from())}),n=te(t,o);for(var I=1;I<t.length;I++){var z=t[I],Y=t[I-1],q=gt(Y.to(),z.from());if(i&&!z.empty()?q>0:q>=0){var ee=vi(Y.from(),z.from()),he=wi(Y.to(),z.to()),ve=Y.empty()?z.from()==z.head:Y.from()==Y.head;I<=n&&--n,t.splice(--I,2,new gi(ve?he:ee,ve?ee:he))}}return new fn(t,n)}function Mn(e,t){return new fn([new gi(e,t||e)],0)}function Nn(e){return e.text?De(e.from.line+e.text.length-1,Se(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ls(e,t){if(gt(e,t.from)<0)return e;if(gt(e,t.to)<=0)return Nn(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=Nn(t).ch-t.to.ch),De(n,i)}function Ia(e,t){for(var n=[],i=0;i<e.sel.ranges.length;i++){var o=e.sel.ranges[i];n.push(new gi(Ls(o.anchor,t),Ls(o.head,t)))}return _n(e.cm,n,e.sel.primIndex)}function Is(e,t,n){return e.line==t.line?De(n.line,e.ch-t.ch+n.ch):De(n.line+(e.line-t.line),e.ch)}function dl(e,t,n){for(var i=[],o=De(e.first,0),I=o,z=0;z<t.length;z++){var Y=t[z],q=Is(Y.from,o,I),ee=Is(Nn(Y),o,I);if(o=Y.to,I=ee,n=="around"){var he=e.sel.ranges[z],ve=gt(he.head,he.anchor)<0;i[z]=new gi(ve?ee:q,ve?q:ee)}else i[z]=new gi(q,q)}return new fn(i,e.sel.primIndex)}function ka(e){e.doc.mode=Dt(e.options,e.doc.modeOption),Ar(e)}function Ar(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,Cr(e,100),e.state.modeGen++,e.curOp&&rn(e)}function ks(e,t){return t.from.ch==0&&t.to.ch==0&&Se(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Da(e,t,n,i){function o(_t){return n?n[_t]:null}function I(_t,ct,St){Vi(_t,ct,St,i),Xi(_t,"change",_t,t)}function z(_t,ct){for(var St=[],Gt=_t;Gt<ct;++Gt)St.push(new Rn(ee[Gt],o(Gt),i));return St}var Y=t.from,q=t.to,ee=t.text,he=it(e,Y.line),ve=it(e,q.line),Ce=Se(ee),we=o(ee.length-1),Ne=q.line-Y.line;if(t.full)e.insert(0,z(0,ee.length)),e.remove(ee.length,e.size-ee.length);else if(ks(e,t)){var Ke=z(0,ee.length-1);I(ve,ve.text,we),Ne&&e.remove(Y.line,Ne),Ke.length&&e.insert(Y.line,Ke)}else if(he==ve)if(ee.length==1)I(he,he.text.slice(0,Y.ch)+Ce+he.text.slice(q.ch),we);else{var Je=z(1,ee.length-1);Je.push(new Rn(Ce+he.text.slice(q.ch),we,i)),I(he,he.text.slice(0,Y.ch)+ee[0],o(0)),e.insert(Y.line+1,Je)}else if(ee.length==1)I(he,he.text.slice(0,Y.ch)+ee[0]+ve.text.slice(q.ch),o(0)),e.remove(Y.line+1,Ne);else{I(he,he.text.slice(0,Y.ch)+ee[0],o(0)),I(ve,Ce+ve.text.slice(q.ch),we);var ht=z(1,ee.length-1);Ne>1&&e.remove(Y.line+1,Ne-1),e.insert(Y.line+1,ht)}Xi(e,"change",e,t)}function Un(e,t,n){function i(o,I,z){if(o.linked)for(var Y=0;Y<o.linked.length;++Y){var q=o.linked[Y];if(q.doc==I)continue;var ee=z&&q.sharedHist;if(n&&!ee)continue;t(q.doc,ee),i(q.doc,o,ee)}}i(e,null,!0)}function Ds(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ea(e),ka(e),Ps(e),e.options.lineWrapping||qn(e),e.options.mode=t.modeOption,rn(e)}function Ps(e){(e.doc.direction=="rtl"?M:T)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){un(e,function(){Ps(e),rn(e)})}function Jr(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 Pa(e,t){var n={from:Ei(t.from),to:Nn(t),text:fi(e,t.from,t.to)};return Us(e,n,t.from.line,t.to.line+1),Un(e,function(i){return Us(i,n,t.from.line,t.to.line+1)},!0),n}function Ms(e){for(;e.length;){var t=Se(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Ms(e.done),Se(e.done);if(e.done.length&&!Se(e.done).ranges)return Se(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Se(e.done)}function Ns(e,t,n,i){var o=e.history;o.undone.length=0;var I=+new Date,z,Y;if((o.lastOp==i||o.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&o.lastModTime>I-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(z=pl(o,o.lastOp==i)))Y=Se(z.changes),gt(t.from,t.to)==0&>(t.from,Y.to)==0?Y.to=Nn(t):z.changes.push(Pa(e,t));else{var q=Se(o.done);for((!q||!q.ranges)&&Zr(e.sel,o.done),z={changes:[Pa(e,t)],generation:o.generation},o.done.push(z);o.done.length>o.undoDepth;)o.done.shift(),o.done[0].ranges||o.done.shift()}o.done.push(n),o.generation=++o.maxGeneration,o.lastModTime=o.lastSelTime=I,o.lastOp=o.lastSelOp=i,o.lastOrigin=o.lastSelOrigin=t.origin,Y||Oe(e,"historyAdded")}function ml(e,t,n,i){var o=t.charAt(0);return o=="*"||o=="+"&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,i){var o=e.history,I=i&&i.origin;n==o.lastSelOp||I&&o.lastSelOrigin==I&&(o.lastModTime==o.lastSelTime&&o.lastOrigin==I||ml(e,I,Se(o.done),t))?o.done[o.done.length-1]=t:Zr(t,o.done),o.lastSelTime=+new Date,o.lastSelOrigin=I,o.lastSelOp=n,i&&i.clearRedo!==!1&&Ms(o.undone)}function Zr(e,t){var n=Se(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Us(e,t,n,i){var o=t["spans_"+e.id],I=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,i),function(z){z.markedSpans&&((o||(o=t["spans_"+e.id]={}))[I]=z.markedSpans),++I})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var i=[],o=0;o<t.text.length;++o)i.push(vl(n[o]));return i}function Fs(e,t){var n=yl(e,t),i=Fi(e,t);if(!n)return i;if(!i)return n;for(var o=0;o<n.length;++o){var I=n[o],z=i[o];if(I&&z){e:for(var Y=0;Y<z.length;++Y){for(var q=z[Y],ee=0;ee<I.length;++ee)if(I[ee].marker==q.marker)continue e;I.push(q)}}else z&&(n[o]=z)}return n}function sr(e,t,n){for(var i=[],o=0;o<e.length;++o){var I=e[o];if(I.ranges){i.push(n?fn.prototype.deepCopy.call(I):I);continue}var z=I.changes,Y=[];i.push({changes:Y});for(var q=0;q<z.length;++q){var ee=z[q],he=void 0;if(Y.push({from:ee.from,to:ee.to,text:ee.text}),t)for(var ve in ee)(he=ve.match(/^spans_(\d+)$/))&&(te(t,Number(he[1]))>-1&&(Se(Y)[ve]=ee[ve],delete ee[ve]))}}return i}function Ma(e,t,n,i){if(i){var o=e.anchor;if(n){var I=gt(t,o)<0;I!=gt(n,o)<0?(o=t,t=n):I!=gt(t,n)<0&&(t=n)}return new gi(o,t)}else return new gi(n||t,t)}function qr(e,t,n,i,o){o==null&&(o=e.cm&&(e.cm.display.shift||e.extend)),Qi(e,new fn([Ma(e.sel.primary(),t,n,o)],0),i)}function Bs(e,t,n){for(var i=[],o=e.cm&&(e.cm.display.shift||e.extend),I=0;I<e.sel.ranges.length;I++)i[I]=Ma(e.sel.ranges[I],t[I],null,o);var z=_n(e.cm,i,e.sel.primIndex);Qi(e,z,n)}function Na(e,t,n,i){var o=e.sel.ranges.slice(0);o[t]=n,Qi(e,_n(e.cm,o,e.sel.primIndex),i)}function js(e,t,n,i){Qi(e,Mn(t,n),i)}function _l(e,t,n){var i={ranges:t.ranges,update:function(o){this.ranges=[];for(var I=0;I<o.length;I++)this.ranges[I]=new gi(_(e,o[I].anchor),_(e,o[I].head))},origin:n&&n.origin};return Oe(e,"beforeSelectionChange",e,i),e.cm&&Oe(e.cm,"beforeSelectionChange",e.cm,i),i.ranges!=t.ranges?_n(e.cm,i.ranges,i.ranges.length-1):t}function Hs(e,t,n){var i=e.history.done,o=Se(i);o&&o.ranges?(i[i.length-1]=t,ea(e,t,n)):Qi(e,t,n)}function Qi(e,t,n){ea(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function ea(e,t,n){(fe(e,"beforeSelectionChange")||e.cm&&fe(e.cm,"beforeSelectionChange"))&&(t=_l(e,t,n));var i=n&&n.bias||(gt(t.primary().head,e.sel.primary().head)<0?-1:1);Ws(e,zs(e,t,i,!0)),!(n&&n.scroll===!1)&&e.cm&&rr(e.cm)}function Ws(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,be(e.cm)),Xi(e,"cursorActivity",e)}function Gs(e){Ws(e,zs(e,e.sel,null,!1))}function zs(e,t,n,i){for(var o,I=0;I<t.ranges.length;I++){var z=t.ranges[I],Y=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[I],q=ta(e,z.anchor,Y&&Y.anchor,n,i),ee=ta(e,z.head,Y&&Y.head,n,i);(o||q!=z.anchor||ee!=z.head)&&(o||(o=t.ranges.slice(0,I)),o[I]=new gi(q,ee))}return o?_n(e.cm,o,t.primIndex):t}function or(e,t,n,i,o){var I=it(e,t.line);if(I.markedSpans)for(var z=0;z<I.markedSpans.length;++z){var Y=I.markedSpans[z],q=Y.marker,ee="selectLeft"in q?!q.selectLeft:q.inclusiveLeft,he="selectRight"in q?!q.selectRight:q.inclusiveRight;if((Y.from==null||(ee?Y.from<=t.ch:Y.from<t.ch))&&(Y.to==null||(he?Y.to>=t.ch:Y.to>t.ch))){if(o&&(Oe(q,"beforeCursorEnter"),q.explicitlyCleared))if(I.markedSpans){--z;continue}else break;if(!q.atomic)continue;if(n){var ve=q.find(i<0?1:-1),Ce=void 0;if((i<0?he:ee)&&(ve=Ks(e,ve,-i,ve&&ve.line==t.line?I:null)),ve&&ve.line==t.line&&(Ce=gt(ve,n))&&(i<0?Ce<0:Ce>0))return or(e,ve,t,i,o)}var we=q.find(i<0?-1:1);return(i<0?ee:he)&&(we=Ks(e,we,i,we.line==t.line?I:null)),we?or(e,we,t,i,o):null}}return t}function ta(e,t,n,i,o){var I=i||1,z=or(e,t,n,I,o)||!o&&or(e,t,n,I,!0)||or(e,t,n,-I,o)||!o&&or(e,t,n,-I,!0);return z||(e.cantEdit=!0,De(e.first,0))}function Ks(e,t,n,i){return n<0&&t.ch==0?t.line>e.first?_(e,De(t.line-1)):null:n>0&&t.ch==(i||it(e,t.line)).text.length?t.line<e.first+e.size-1?De(t.line+1,0):null:new De(t.line,t.ch+n)}function Vs(e){e.setSelection(De(e.firstLine(),0),De(e.lastLine()),de)}function Xs(e,t,n){var i={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return i.canceled=!0}};return n&&(i.update=function(o,I,z,Y){o&&(i.from=_(e,o)),I&&(i.to=_(e,I)),z&&(i.text=z),Y!==void 0&&(i.origin=Y)}),Oe(e,"beforeChange",e,i),e.cm&&Oe(e.cm,"beforeChange",e.cm,i),i.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:i.from,to:i.to,text:i.text,origin:i.origin}}function lr(e,t,n){if(e.cm){if(!e.cm.curOp)return Hi(e.cm,lr)(e,t,n);if(e.cm.state.suppressEdits)return}if((fe(e,"beforeChange")||e.cm&&fe(e.cm,"beforeChange"))&&(t=Xs(e,t,!0),!t))return;var i=yi&&!n&&en(e,t.from,t.to);if(i)for(var o=i.length-1;o>=0;--o)Ys(e,{from:i[o].from,to:i[o].to,text:o?[""]:t.text,origin:t.origin});else Ys(e,t)}function Ys(e,t){if(t.text.length==1&&t.text[0]==""&>(t.from,t.to)==0)return;var n=Ia(e,t);Ns(e,t,n,e.cm?e.cm.curOp.id:NaN),Or(e,t,n,Fi(e,t));var i=[];Un(e,function(o,I){!I&&te(i,o.history)==-1&&(Zs(o.history,t),i.push(o.history)),Or(o,t,null,Fi(o,t))})}function ia(e,t,n){var i=e.cm&&e.cm.state.suppressEdits;if(i&&!n)return;for(var o=e.history,I,z=e.sel,Y=t=="undo"?o.done:o.undone,q=t=="undo"?o.undone:o.done,ee=0;ee<Y.length&&!(I=Y[ee],n?I.ranges&&!I.equals(e.sel):!I.ranges);ee++);if(ee==Y.length)return;for(o.lastOrigin=o.lastSelOrigin=null;;)if(I=Y.pop(),I.ranges){if(Zr(I,q),n&&!I.equals(e.sel)){Qi(e,I,{clearRedo:!1});return}z=I}else if(i){Y.push(I);return}else break;var he=[];Zr(z,q),q.push({changes:he,generation:o.generation}),o.generation=I.generation||++o.maxGeneration;for(var ve=fe(e,"beforeChange")||e.cm&&fe(e.cm,"beforeChange"),Ce=function(Ke){var Je=I.changes[Ke];if(Je.origin=t,ve&&!Xs(e,Je,!1))return Y.length=0,{};he.push(Pa(e,Je));var ht=Ke?Ia(e,Je):Se(Y);Or(e,Je,ht,Fs(e,Je)),!Ke&&e.cm&&e.cm.scrollIntoView({from:Je.from,to:Nn(Je)});var _t=[];Un(e,function(ct,St){!St&&te(_t,ct.history)==-1&&(Zs(ct.history,Je),_t.push(ct.history)),Or(ct,Je,null,Fs(ct,Je))})},we=I.changes.length-1;we>=0;--we){var Ne=Ce(we);if(Ne)return Ne.v}}function $s(e,t){if(t==0)return;if(e.first+=t,e.sel=new fn(je(e.sel.ranges,function(o){return new gi(De(o.anchor.line+t,o.anchor.ch),De(o.head.line+t,o.head.ch))}),e.sel.primIndex),e.cm){rn(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,i=n.viewFrom;i<n.viewTo;i++)Dn(e.cm,i,"gutter")}}function Or(e,t,n,i){if(e.cm&&!e.cm.curOp)return Hi(e.cm,Or)(e,t,n,i);if(t.to.line<e.first){$s(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 o=t.text.length-1-(e.first-t.from.line);$s(e,o),t={from:De(e.first,0),to:De(t.to.line+o,t.to.ch),text:[Se(t.text)],origin:t.origin}}var I=e.lastLine();t.to.line>I&&(t={from:t.from,to:De(I,it(e,I).text.length),text:[t.text[0]],origin:t.origin}),t.removed=fi(e,t.from,t.to),n||(n=Ia(e,t)),e.cm?bl(e.cm,t,i):Da(e,t,i),ea(e,n,de),e.cantEdit&&ta(e,De(e.firstLine(),0))&&(e.cantEdit=!1)}function bl(e,t,n){var i=e.doc,o=e.display,I=t.from,z=t.to,Y=!1,q=I.line;e.options.lineWrapping||(q=Et(Ri(it(i,I.line))),i.iter(q,z.line+1,function(we){if(we==o.maxLine)return Y=!0,!0})),i.sel.contains(t.from,t.to)>-1&&be(e),Da(i,t,n,ds(e)),e.options.lineWrapping||(i.iter(q,I.line+t.text.length,function(we){var Ne=Wn(we);Ne>o.maxLineLength&&(o.maxLine=we,o.maxLineLength=Ne,o.maxLineChanged=!0,Y=!1)}),Y&&(e.curOp.updateMaxLine=!0)),zt(i,I.line),Cr(e,400);var ee=t.text.length-(z.line-I.line)-1;t.full?rn(e):I.line==z.line&&t.text.length==1&&!ks(e.doc,t)?Dn(e,I.line,"text"):rn(e,I.line,z.line+1,ee);var he=fe(e,"changes"),ve=fe(e,"change");if(ve||he){var Ce={from:I,to:z,text:t.text,removed:t.removed,origin:t.origin};ve&&Xi(e,"change",e,Ce),he&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Ce)}e.display.selForContextMenu=null}function ur(e,t,n,i,o){var I;i||(i=n),gt(i,n)<0&&(I=[i,n],n=I[0],i=I[1]),typeof t=="string"&&(t=e.splitLines(t)),lr(e,{from:n,to:i,text:t,origin:o})}function Qs(e,t,n,i){n<e.line?e.line+=i:t<e.line&&(e.line=t,e.ch=0)}function Js(e,t,n,i){for(var o=0;o<e.length;++o){var I=e[o],z=!0;if(I.ranges){I.copied||(I=e[o]=I.deepCopy(),I.copied=!0);for(var Y=0;Y<I.ranges.length;Y++)Qs(I.ranges[Y].anchor,t,n,i),Qs(I.ranges[Y].head,t,n,i);continue}for(var q=0;q<I.changes.length;++q){var ee=I.changes[q];if(n<ee.from.line)ee.from=De(ee.from.line+i,ee.from.ch),ee.to=De(ee.to.line+i,ee.to.ch);else if(t<=ee.to.line){z=!1;break}}z||(e.splice(0,o+1),o=0)}}function Zs(e,t){var n=t.from.line,i=t.to.line,o=t.text.length-(i-n)-1;Js(e.done,n,i,o),Js(e.undone,n,i,o)}function Lr(e,t,n,i){var o=t,I=t;return typeof t=="number"?I=it(e,K(e,t)):o=Et(t),o==null?null:(i(I,o)&&e.cm&&Dn(e.cm,o,n),I)}function Ir(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}Ir.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,i=e+t;n<i;++n){var o=this.lines[n];this.height-=o.height,et(o),Xi(o,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var i=0;i<t.length;++i)t[i].parent=this},iterN:function(e,t,n){for(var i=e+t;e<i;++e)if(n(this.lines[e]))return!0}};function kr(e){this.children=e;for(var t=0,n=0,i=0;i<e.length;++i){var o=e[i];t+=o.chunkSize(),n+=o.height,o.parent=this}this.size=t,this.height=n,this.parent=null}kr.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<o){var I=Math.min(t,o-e),z=i.height;if(i.removeInner(e,I),this.height-=z-i.height,o==I&&(this.children.splice(n--,1),i.parent=null),(t-=I)==0)break;e=0}else e-=o}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Ir))){var Y=[];this.collapse(Y),this.children=[new Ir(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,n){this.size+=t.length,this.height+=n;for(var i=0;i<this.children.length;++i){var o=this.children[i],I=o.chunkSize();if(e<=I){if(o.insertInner(e,t,n),o.lines&&o.lines.length>50){for(var z=o.lines.length%25+25,Y=z;Y<o.lines.length;){var q=new Ir(o.lines.slice(Y,Y+=25));o.height-=q.height,this.children.splice(++i,0,q),q.parent=this}o.lines=o.lines.slice(0,z),this.maybeSpill()}break}e-=I}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new kr(t);if(e.parent){e.size-=n.size,e.height-=n.height;var o=te(e.parent.children,e);e.parent.children.splice(o+1,0,n)}else{var i=new kr(e.children);i.parent=e,e.children=[i,n],e=i}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var i=0;i<this.children.length;++i){var o=this.children[i],I=o.chunkSize();if(e<I){var z=Math.min(t,I-e);if(o.iterN(e,z,n))return!0;if((t-=z)==0)break;e=0}else e-=I}}};var Dr=function(e,t,n){if(n)for(var i in n)n.hasOwnProperty(i)&&(this[i]=n[i]);this.doc=e,this.node=t};Dr.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,i=Et(n);if(i==null||!t)return;for(var o=0;o<t.length;++o)t[o]==this&&t.splice(o--,1);t.length||(n.widgets=null);var I=_r(this);Kt(n,Math.max(0,n.height-I)),e&&(un(e,function(){qs(e,n,-I),Dn(e,i,"widget")}),Xi(e,"lineWidgetCleared",e,this,i))},Dr.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,i=this.line;this.height=null;var o=_r(this)-t;if(!o)return;cn(this.doc,i)||Kt(i,i.height+o),n&&un(n,function(){n.curOp.forceUpdate=!0,qs(n,i,o),Xi(n,"lineWidgetChanged",n,e,Et(i))})},pe(Dr);function qs(e,t,n){Ki(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Sa(e,n)}function El(e,t,n,i){var o=new Dr(e,n,i),I=e.cm;return I&&o.noHScroll&&(I.display.alignWidgets=!0),Lr(e,t,"widget",function(z){var Y=z.widgets||(z.widgets=[]);if(o.insertAt==null?Y.push(o):Y.splice(Math.min(Y.length-1,Math.max(0,o.insertAt)),0,o),o.line=z,I&&!cn(e,z)){var q=Ki(z)<e.scrollTop;Kt(z,z.height+_r(o)),q&&Sa(I,o.height),I.curOp.forceUpdate=!0}return!0}),I&&Xi(I,"lineWidgetAdded",I,o,typeof t=="number"?t:Et(t)),o}var eo=0,Fn=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++eo};Fn.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&$n(e),fe(this,"clear")){var n=this.find();n&&Xi(this,"clear",n.from,n.to)}for(var i=null,o=null,I=0;I<this.lines.length;++I){var z=this.lines[I],Y=mt(z.markedSpans,this);e&&!this.collapsed?Dn(e,Et(z),"text"):e&&(Y.to!=null&&(o=Et(z)),Y.from!=null&&(i=Et(z))),z.markedSpans=Wt(z.markedSpans,Y),Y.from==null&&this.collapsed&&!cn(this.doc,z)&&e&&Kt(z,tr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var q=0;q<this.lines.length;++q){var ee=Ri(this.lines[q]),he=Wn(ee);he>e.display.maxLineLength&&(e.display.maxLine=ee,e.display.maxLineLength=he,e.display.maxLineChanged=!0)}i!=null&&e&&this.collapsed&&rn(e,i,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Gs(e.doc)),e&&Xi(e,"markerCleared",e,this,i,o),t&&Qn(e),this.parent&&this.parent.clear()},Fn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,i,o=0;o<this.lines.length;++o){var I=this.lines[o],z=mt(I.markedSpans,this);if(z.from!=null&&(n=De(t?I:Et(I),z.from),e==-1))return n;if(z.to!=null&&(i=De(t?I:Et(I),z.to),e==1))return i}return n&&{from:n,to:i}},Fn.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,i=this.doc.cm;if(!t||!i)return;un(i,function(){var o=t.line,I=Et(t.line),z=fa(i,I);if(z&&(rs(z),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!cn(n.doc,o)&&n.height!=null){var Y=n.height;n.height=null;var q=_r(n)-Y;q&&Kt(o,o.height+q)}Xi(i,"markerChanged",i,e)})},Fn.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||te(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Fn.prototype.detachLine=function(e){if(this.lines.splice(te(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},pe(Fn);function hr(e,t,n,i,o){if(i&&i.shared)return xl(e,t,n,i,o);if(e.cm&&!e.cm.curOp)return Hi(e.cm,hr)(e,t,n,i,o);var I=new Fn(e,o),z=gt(t,n);if(i&&S(i,I,!1),z>0||z==0&&I.clearWhenEmpty!==!1)return I;if(I.replacedWith&&(I.collapsed=!0,I.widgetNode=m("span",[I.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||I.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(I.widgetNode.insertLeft=!0)),I.collapsed){if(Pi(e,t.line,t,n,I)||t.line!=n.line&&Pi(e,n.line,t,n,I))throw new Error("Inserting collapsed marker partially overlapping an existing one");Jt()}I.addToHistory&&Ns(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var Y=t.line,q=e.cm,ee;if(e.iter(Y,n.line+1,function(ve){q&&I.collapsed&&!q.options.lineWrapping&&Ri(ve)==q.display.maxLine&&(ee=!0),I.collapsed&&Y!=t.line&&Kt(ve,0),$t(ve,new wt(I,Y==t.line?t.ch:null,Y==n.line?n.ch:null)),++Y}),I.collapsed&&e.iter(t.line,n.line+1,function(ve){cn(e,ve)&&Kt(ve,0)}),I.clearOnEnter&&Ie(I,"beforeCursorEnter",function(){return I.clear()}),I.readOnly&&(bi(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),I.collapsed&&(I.id=++eo,I.atomic=!0),q){if(ee&&(q.curOp.updateMaxLine=!0),I.collapsed)rn(q,t.line,n.line+1);else if(I.className||I.startStyle||I.endStyle||I.css||I.attributes||I.title)for(var he=t.line;he<=n.line;he++)Dn(q,he,"text");I.atomic&&Gs(q.doc),Xi(q,"markerAdded",q,I)}return I}var Pr=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};Pr.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Xi(this,"clear")},Pr.prototype.find=function(e,t){return this.primary.find(e,t)},pe(Pr);function xl(e,t,n,i,o){i=S(i),i.shared=!1;var I=[hr(e,t,n,i,o)],z=I[0],Y=i.widgetNode;return Un(e,function(q){Y&&(i.widgetNode=Y.cloneNode(!0)),I.push(hr(q,_(q,t),_(q,n),i,o));for(var ee=0;ee<q.linked.length;++ee)if(q.linked[ee].isParent)return;z=Se(I)}),new Pr(I,z)}function to(e){return e.findMarks(De(e.first,0),e.clipPos(De(e.lastLine())),function(t){return t.parent})}function Tl(e,t){for(var n=0;n<t.length;n++){var i=t[n],o=i.find(),I=e.clipPos(o.from),z=e.clipPos(o.to);if(gt(I,z)){var Y=hr(e,I,z,i.primary,i.primary.type);i.markers.push(Y),Y.parent=i}}}function wl(e){for(var t=function(i){var o=e[i],I=[o.primary.doc];Un(o.primary.doc,function(q){return I.push(q)});for(var z=0;z<o.markers.length;z++){var Y=o.markers[z];te(I,Y.doc)==-1&&(Y.parent=null,o.markers.splice(z--,1))}},n=0;n<e.length;n++)t(n)}var Sl=0,an=function(e,t,n,i,o){if(!(this instanceof an))return new an(e,t,n,i,o);n==null&&(n=0),kr.call(this,[new Ir([new Rn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var I=De(n,0);this.sel=Mn(I),this.history=new Jr(null),this.id=++Sl,this.modeOption=t,this.lineSep=i,this.direction=o=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Da(this,{from:I,to:I,text:e}),Qi(this,Mn(I),de)};an.prototype=Qe(kr.prototype,{constructor:an,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,i=0;i<t.length;++i)n+=t[i].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=ri(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Wi(function(e){var t=De(this.first,0),n=this.first+this.size-1;lr(this,{from:t,to:De(n,it(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&xr(this.cm,0,0),Qi(this,Mn(t),de)}),replaceRange:function(e,t,n,i){t=_(this,t),n=n?_(this,n):t,ur(this,e,t,n,i)},getRange:function(e,t,n){var i=fi(this,_(this,e),_(this,t));return n===!1?i:i.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(ti(this,e))return it(this,e)},getLineNumber:function(e){return Et(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=it(this,e)),Ri(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return _(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Wi(function(e,t,n){js(this,_(this,typeof e=="number"?De(e,t||0):e),null,n)}),setSelection:Wi(function(e,t,n){js(this,_(this,e),_(this,t||e),n)}),extendSelection:Wi(function(e,t,n){qr(this,_(this,e),t&&_(this,t),n)}),extendSelections:Wi(function(e,t){Bs(this,N(this,e),t)}),extendSelectionsBy:Wi(function(e,t){var n=je(this.sel.ranges,e);Bs(this,N(this,n),t)}),setSelections:Wi(function(e,t,n){if(!e.length)return;for(var i=[],o=0;o<e.length;o++)i[o]=new gi(_(this,e[o].anchor),_(this,e[o].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Qi(this,_n(this.cm,i,t),n)}),addSelection:Wi(function(e,t,n){var i=this.sel.ranges.slice(0);i.push(new gi(_(this,e),_(this,t||e))),Qi(this,_n(this.cm,i,i.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,i=0;i<t.length;i++){var o=fi(this,t[i].from(),t[i].to());n=n?n.concat(o):o}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,i=0;i<n.length;i++){var o=fi(this,n[i].from(),n[i].to());e!==!1&&(o=o.join(e||this.lineSeparator())),t[i]=o}return t},replaceSelection:function(e,t,n){for(var i=[],o=0;o<this.sel.ranges.length;o++)i[o]=e;this.replaceSelections(i,t,n||"+input")},replaceSelections:Wi(function(e,t,n){for(var i=[],o=this.sel,I=0;I<o.ranges.length;I++){var z=o.ranges[I];i[I]={from:z.from(),to:z.to(),text:this.splitLines(e[I]),origin:n}}for(var Y=t&&t!="end"&&dl(this,i,t),q=i.length-1;q>=0;q--)lr(this,i[q]);Y?Hs(this,Y):this.cm&&rr(this.cm)}),undo:Wi(function(){ia(this,"undo")}),redo:Wi(function(){ia(this,"redo")}),undoSelection:Wi(function(){ia(this,"undo",!0)}),redoSelection:Wi(function(){ia(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,i=0;i<e.done.length;i++)e.done[i].ranges||++t;for(var o=0;o<e.undone.length;o++)e.undone[o].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Jr(this.history.maxGeneration),Un(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:sr(this.history.done),undone:sr(this.history.undone)}},setHistory:function(e){var t=this.history=new Jr(this.history.maxGeneration);t.done=sr(e.done.slice(0),null,!0),t.undone=sr(e.undone.slice(0),null,!0)},setGutterMarker:Wi(function(e,t,n){return Lr(this,e,"gutter",function(i){var o=i.gutterMarkers||(i.gutterMarkers={});return o[t]=n,!n&&Ze(o)&&(i.gutterMarkers=null),!0})}),clearGutter:Wi(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&Lr(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Ze(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!ti(this,e))return null;if(t=e,e=it(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:Wi(function(e,t,n){return Lr(this,e,t=="gutter"?"gutter":"class",function(i){var o=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!i[o])i[o]=n;else{if(R(n).test(i[o]))return!1;i[o]+=" "+n}return!0})}),removeLineClass:Wi(function(e,t,n){return Lr(this,e,t=="gutter"?"gutter":"class",function(i){var o=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",I=i[o];if(I)if(n==null)i[o]=null;else{var z=I.match(R(n));if(!z)return!1;var Y=z.index+z[0].length;i[o]=I.slice(0,z.index)+(!z.index||Y==I.length?"":" ")+I.slice(Y)||null}else return!1;return!0})}),addLineWidget:Wi(function(e,t,n){return El(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return hr(this,_(this,e),_(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=_(this,e),hr(this,e,e,n,"bookmark")},findMarksAt:function(e){e=_(this,e);var t=[],n=it(this,e.line).markedSpans;if(n)for(var i=0;i<n.length;++i){var o=n[i];(o.from==null||o.from<=e.ch)&&(o.to==null||o.to>=e.ch)&&t.push(o.marker.parent||o.marker)}return t},findMarks:function(e,t,n){e=_(this,e),t=_(this,t);var i=[],o=e.line;return this.iter(e.line,t.line+1,function(I){var z=I.markedSpans;if(z)for(var Y=0;Y<z.length;Y++){var q=z[Y];!(q.to!=null&&o==e.line&&e.ch>=q.to||q.from==null&&o!=e.line||q.from!=null&&o==t.line&&q.from>=t.ch)&&(!n||n(q.marker))&&i.push(q.marker.parent||q.marker)}++o}),i},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var i=0;i<n.length;++i)n[i].from!=null&&e.push(n[i].marker)}),e},posFromIndex:function(e){var t,n=this.first,i=this.lineSeparator().length;return this.iter(function(o){var I=o.text.length+i;if(I>e)return t=e,!0;e-=I,++n}),_(this,De(n,t))},indexFromPos:function(e){e=_(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(i){t+=i.text.length+n}),t},copy:function(e){var t=new an(ri(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var i=new an(ri(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:e.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Tl(i,to(this)),i},unlinkDoc:function(e){if(e instanceof Ai&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(to(this));break}if(e.history==this.history){var i=[e.id];Un(e,function(o){return i.push(o.id)},!0),e.history=new Jr(null),e.history.done=sr(this.history.done,i),e.history.undone=sr(this.history.undone,i)}},iterLinkedDocs:function(e){Un(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):tt(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Wi(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)})}),an.prototype.eachLine=an.prototype.iter;var io=0;function Cl(e){var t=this;if(no(t),Ge(t,e)||On(t.display,e))return;ie(e),V&&(io=+new Date);var n=Kn(t,e,!0),i=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(i&&i.length&&window.FileReader&&window.File)for(var o=i.length,I=Array(o),z=0,Y=function(){++z==o&&Hi(t,function(){n=_(t.doc,n);var we={from:n,to:n,text:t.doc.splitLines(I.filter(function(Ne){return Ne!=null}).join(t.doc.lineSeparator())),origin:"paste"};lr(t.doc,we),Hs(t.doc,Mn(_(t.doc,n),_(t.doc,Nn(we))))})()},q=function(we,Ne){if(t.options.allowDropFileTypes&&te(t.options.allowDropFileTypes,we.type)==-1){Y();return}var Ke=new FileReader;Ke.onerror=function(){return Y()},Ke.onload=function(){var Je=Ke.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Je)){Y();return}I[Ne]=Je,Y()},Ke.readAsText(we)},ee=0;ee<i.length;ee++)q(i[ee],ee);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var he=e.dataTransfer.getData("Text");if(he){var ve;if(t.state.draggingText&&!t.state.draggingText.copy&&(ve=t.listSelections()),ea(t.doc,Mn(n,n)),ve)for(var Ce=0;Ce<ve.length;++Ce)ur(t.doc,"",ve[Ce].anchor,ve[Ce].head,"drag");t.replaceSelection(he,"around","paste"),t.display.input.focus()}}catch(we){}}}function Rl(e,t){if(V&&(!e.state.draggingText||+new Date-io<100)){ge(t);return}if(Ge(e,t)||On(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!p){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",v&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),v&&n.parentNode.removeChild(n)}}function Al(e,t){var n=Kn(e,t);if(!n)return;var i=document.createDocumentFragment();ms(e,n,i),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),g(e.display.dragCursor,i)}function no(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ro(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],i=0;i<t.length;i++){var o=t[i].CodeMirror;o&&n.push(o)}n.length&&n[0].operation(function(){for(var I=0;I<n.length;I++)e(n[I])})}var ao=!1;function Ol(){if(ao)return;Ll(),ao=!0}function Ll(){var e;Ie(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ro(Il)},100))}),Ie(window,"blur",function(){return ro(nr)})}function Il(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Bn={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"},Mr=0;Mr<10;Mr++)Bn[Mr+48]=Bn[Mr+96]=String(Mr);for(var na=65;na<=90;na++)Bn[na]=String.fromCharCode(na);for(var Nr=1;Nr<=12;Nr++)Bn[Nr+111]=Bn[Nr+63235]="F"+Nr;var Ln={};Ln.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"},Ln.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"},Ln.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"},Ln.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"]},Ln.default=u?Ln.macDefault:Ln.pcDefault;function kl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,i,o,I,z=0;z<t.length-1;z++){var Y=t[z];if(/^(cmd|meta|m)$/i.test(Y))I=!0;else if(/^a(lt)?$/i.test(Y))n=!0;else if(/^(c|ctrl|control)$/i.test(Y))i=!0;else if(/^s(hift)?$/i.test(Y))o=!0;else throw new Error("Unrecognized modifier name: "+Y)}return n&&(e="Alt-"+e),i&&(e="Ctrl-"+e),I&&(e="Cmd-"+e),o&&(e="Shift-"+e),e}function Dl(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(i=="..."){delete e[n];continue}for(var o=je(n.split(" "),kl),I=0;I<o.length;I++){var z=void 0,Y=void 0;I==o.length-1?(Y=o.join(" "),z=i):(Y=o.slice(0,I+1).join(" "),z="...");var q=t[Y];if(!q)t[Y]=z;else if(q!=z)throw new Error("Inconsistent bindings for "+Y)}delete e[n]}for(var ee in t)e[ee]=t[ee];return e}function cr(e,t,n,i){t=ra(t);var o=t.call?t.call(e,i):t[e];if(o===!1)return"nothing";if(o==="...")return"multi";if(o!=null&&n(o))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return cr(e,t.fallthrough,n,i);for(var I=0;I<t.fallthrough.length;I++){var z=cr(e,t.fallthrough[I],n,i);if(z)return z}}}function so(e){var t=typeof e=="string"?e:Bn[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function oo(e,t,n){var i=e;return t.altKey&&i!="Alt"&&(e="Alt-"+e),(w?t.metaKey:t.ctrlKey)&&i!="Ctrl"&&(e="Ctrl-"+e),(w?t.ctrlKey:t.metaKey)&&i!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&i!="Shift"&&(e="Shift-"+e),e}function lo(e,t){if(v&&e.keyCode==34&&e.char)return!1;var n=Bn[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),oo(n,e,t))}function ra(e){return typeof e=="string"?Ln[e]:e}function dr(e,t){for(var n=e.doc.sel.ranges,i=[],o=0;o<n.length;o++){for(var I=t(n[o]);i.length&>(I.from,Se(i).to)<=0;){var z=i.pop();if(gt(z.from,I.from)<0){I.from=z.from;break}}i.push(I)}un(e,function(){for(var Y=i.length-1;Y>=0;Y--)ur(e.doc,"",i[Y].from,i[Y].to,"+delete");rr(e)})}function Ua(e,t,n){var i=Fe(e.text,t+n,n);return i<0||i>e.text.length?null:i}function Fa(e,t,n){var i=Ua(e,t.ch,n);return i==null?null:new De(t.line,i,n<0?"after":"before")}function Ba(e,t,n,i,o){if(e){t.doc.direction=="rtl"&&(o=-o);var I=ut(n,t.doc.direction);if(I){var z=o<0?Se(I):I[0],Y=o<0==(z.level==1),q=Y?"after":"before",ee;if(z.level>0||t.doc.direction=="rtl"){var he=er(t,n);ee=o<0?n.text.length-1:0;var ve=wn(t,he,ee).top;ee=ft(function(Ce){return wn(t,he,Ce).top==ve},o<0==(z.level==1)?z.from:z.to-1,ee),q=="before"&&(ee=Ua(n,ee,1))}else ee=o<0?z.to:z.from;return new De(i,ee,q)}}return new De(i,o<0?n.text.length:0,o<0?"before":"after")}function Pl(e,t,n,i){var o=ut(t,e.doc.direction);if(!o)return Fa(t,n,i);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var I=dt(o,n.ch,n.sticky),z=o[I];if(e.doc.direction=="ltr"&&z.level%2==0&&(i>0?z.to>n.ch:z.from<n.ch))return Fa(t,n,i);var Y=function(ht,_t){return Ua(t,ht instanceof De?ht.ch:ht,_t)},q,ee=function(ht){return e.options.lineWrapping?(q=q||er(e,t),cs(e,t,q,ht)):{begin:0,end:t.text.length}},he=ee(n.sticky=="before"?Y(n,-1):n.ch);if(e.doc.direction=="rtl"||z.level==1){var ve=z.level==1==i<0,Ce=Y(n,ve?1:-1);if(Ce!=null&&(ve?Ce<=z.to&&Ce<=he.end:Ce>=z.from&&Ce>=he.begin)){var we=ve?"before":"after";return new De(n.line,Ce,we)}}var Ne=function(ht,_t,ct){for(var St=function(Ti,Gi){return Gi?new De(n.line,Y(Ti,1),"before"):new De(n.line,Ti,"after")};ht>=0&&ht<o.length;ht+=_t){var Gt=o[ht],jt=_t>0==(Gt.level!=1),Zt=jt?ct.begin:Y(ct.end,-1);if(Gt.from<=Zt&&Zt<Gt.to)return St(Zt,jt);if(Zt=jt?Gt.from:Y(Gt.to,-1),ct.begin<=Zt&&Zt<ct.end)return St(Zt,jt)}},Ke=Ne(I+i,i,he);if(Ke)return Ke;var Je=i>0?he.end:Y(he.begin,-1);return Je!=null&&!(i>0&&Je==t.text.length)&&(Ke=Ne(i>0?0:o.length-1,i,ee(Je)),Ke)?Ke:null}var Ur={selectAll:Vs,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),de)},killLine:function(e){return dr(e,function(t){if(t.empty()){var n=it(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:De(t.head.line+1,0)}:{from:t.head,to:De(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return dr(e,function(t){return{from:De(t.from().line,0),to:_(e.doc,De(t.to().line+1,0))}})},delLineLeft:function(e){return dr(e,function(t){return{from:De(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return dr(e,function(t){var n=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:n},"div");return{from:i,to:t.from()}})},delWrappedLineRight:function(e){return dr(e,function(t){var n=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:i}})},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(De(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(De(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return uo(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ho(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Ml(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},Te)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},Te)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:n},"div");return i.ch<e.getLine(i.line).search(/\S/)?ho(e,t.head):i},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=[],n=e.listSelections(),i=e.options.tabSize,o=0;o<n.length;o++){var I=n[o].from(),z=B(e.getLine(I.line),I.ch,i);t.push(se(i-z%i))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return un(e,function(){for(var t=e.listSelections(),n=[],i=0;i<t.length;i++){if(!t[i].empty())continue;var o=t[i].head,I=it(e.doc,o.line).text;if(I){if(o.ch==I.length&&(o=new De(o.line,o.ch-1)),o.ch>0)o=new De(o.line,o.ch+1),e.replaceRange(I.charAt(o.ch-1)+I.charAt(o.ch-2),De(o.line,o.ch-2),o,"+transpose");else if(o.line>e.doc.first){var z=it(e.doc,o.line-1).text;z&&(o=new De(o.line,1),e.replaceRange(I.charAt(0)+e.doc.lineSeparator()+z.charAt(z.length-1),De(o.line-1,z.length-1),o,"+transpose"))}}n.push(new gi(o,o))}e.setSelections(n)})},newlineAndIndent:function(e){return un(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var i=0;i<t.length;i++)e.indentLine(t[i].from().line,null,!0);rr(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function uo(e,t){var n=it(e.doc,t),i=Ri(n);return i!=n&&(t=Et(i)),Ba(!0,e,i,t,1)}function Ml(e,t){var n=it(e.doc,t),i=En(n);return i!=n&&(t=Et(i)),Ba(!0,e,n,t,-1)}function ho(e,t){var n=uo(e,t.line),i=it(e.doc,n.line),o=ut(i,e.doc.direction);if(!o||o[0].level==0){var I=Math.max(n.ch,i.text.search(/\S/)),z=t.line==n.line&&t.ch<=I&&t.ch;return De(n.line,z?0:I,n.sticky)}return n}function aa(e,t,n){if(typeof t=="string"&&(t=Ur[t],!t))return!1;e.display.input.ensurePolled();var i=e.display.shift,o=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),o=t(e)!=_e}finally{e.display.shift=i,e.state.suppressEdits=!1}return o}function Nl(e,t,n){for(var i=0;i<e.state.keyMaps.length;i++){var o=cr(t,e.state.keyMaps[i],n,e);if(o)return o}return e.options.extraKeys&&cr(t,e.options.extraKeys,n,e)||cr(t,e.options.keyMap,n,e)}var Ul=new J;function Fr(e,t,n,i){var o=e.state.keySeq;if(o){if(so(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==o&&(e.state.keySeq=null,e.display.input.reset())}),co(e,o+" "+t,n,i))return!0}return co(e,t,n,i)}function co(e,t,n,i){var o=Nl(e,t,i);return o=="multi"&&(e.state.keySeq=t),o=="handled"&&Xi(e,"keyHandled",e,t,n),(o=="handled"||o=="multi")&&(ie(n),xa(e)),!!o}function fo(e,t){var n=lo(t,!0);return n?t.shiftKey&&!e.state.keySeq?Fr(e,"Shift-"+n,t,function(i){return aa(e,i,!0)})||Fr(e,n,t,function(i){if(typeof i=="string"?/^go[A-Z]/.test(i):i.motion)return aa(e,i)}):Fr(e,n,t,function(i){return aa(e,i)}):!1}function Fl(e,t,n){return Fr(e,"'"+n+"'",t,function(i){return aa(e,i,!0)})}var ja=null;function po(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=P(),Ge(t,e))return;V&&H<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var i=fo(t,e);v&&(ja=i?n:null,!i&&n==88&&!Ct&&(u?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!u&&!i&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;M(t,"CodeMirror-crosshair");function n(i){(i.keyCode==18||!i.altKey)&&(T(t,"CodeMirror-crosshair"),nt(document,"keyup",n),nt(document,"mouseover",n))}Ie(document,"keyup",n),Ie(document,"mouseover",n)}function mo(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ge(this,e)}function go(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(On(t.display,e)||Ge(t,e)||e.ctrlKey&&!e.altKey||u&&e.metaKey)return;var n=e.keyCode,i=e.charCode;if(v&&n==ja){ja=null,ie(e);return}if(v&&(!e.which||e.which<10)&&fo(t,e))return;var o=String.fromCharCode(i==null?n:i);if(o=="\b")return;if(Fl(t,e,o))return;t.display.input.onKeyPress(e)}var jl=400,Ha=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ha.prototype.compare=function(e,t,n){return this.time+jl>e&>(t,this.pos)==0&&n==this.button};var Br,jr;function Hl(e,t){var n=+new Date;return jr&&jr.compare(n,e,t)?(Br=jr=null,"triple"):Br&&Br.compare(n,e,t)?(jr=new Ha(n,e,t),Br=null,"double"):(Br=new Ha(n,e,t),jr=null,"single")}function vo(e){var t=this,n=t.display;if(Ge(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,On(n,e)){k||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Wa(t,e))return;var i=Kn(t,e),o=Le(e),I=i?Hl(i,o):"single";if(window.focus(),o==1&&t.state.selectingText&&t.state.selectingText(e),i&&Wl(t,o,i,I,e))return;o==1?i?zl(t,i,I,e):ye(e)==n.scroller&&ie(e):o==2?(i&&qr(t.doc,i),setTimeout(function(){return n.input.focus()},20)):o==3&&(A?t.display.input.onContextMenu(e):vs(t))}function Wl(e,t,n,i,o){var I="Click";return i=="double"?I="Double"+I:i=="triple"&&(I="Triple"+I),I=(t==1?"Left":t==2?"Middle":"Right")+I,Fr(e,oo(I,o),o,function(z){if(typeof z=="string"&&(z=Ur[z]),!z)return!1;var Y=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Y=z(e,n)!=_e}finally{e.state.suppressEdits=!1}return Y})}function Gl(e,t,n){var i=e.getOption("configureMouse"),o=i?i(e,t,n):{};if(o.unit==null){var I=f?n.shiftKey&&n.metaKey:n.altKey;o.unit=I?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(o.extend==null||e.doc.extend)&&(o.extend=e.doc.extend||n.shiftKey),o.addNew==null&&(o.addNew=u?n.metaKey:n.ctrlKey),o.moveOnDrag==null&&(o.moveOnDrag=!(u?n.altKey:n.ctrlKey)),o}function zl(e,t,n,i){V?setTimeout(U(gs,e),0):e.curOp.focus=P();var o=Gl(e,n,i),I=e.doc.sel,z;e.options.dragDrop&&Be&&!e.isReadOnly()&&n=="single"&&(z=I.contains(t))>-1&&(gt((z=I.ranges[z]).from(),t)<0||t.xRel>0)&&(gt(z.to(),t)>0||t.xRel<0)?Kl(e,i,t,o):Vl(e,i,t,o)}function Kl(e,t,n,i){var o=e.display,I=!1,z=Hi(e,function(ee){k&&(o.scroller.draggable=!1),e.state.draggingText=!1,nt(o.wrapper.ownerDocument,"mouseup",z),nt(o.wrapper.ownerDocument,"mousemove",Y),nt(o.scroller,"dragstart",q),nt(o.scroller,"drop",z),I||(ie(ee),i.addNew||qr(e.doc,n,null,null,i.extend),k&&!p||V&&H==9?setTimeout(function(){o.wrapper.ownerDocument.body.focus({preventScroll:!0}),o.input.focus()},20):o.input.focus())}),Y=function(ee){I=I||Math.abs(t.clientX-ee.clientX)+Math.abs(t.clientY-ee.clientY)>=10},q=function(){return I=!0};k&&(o.scroller.draggable=!0),e.state.draggingText=z,z.copy=!i.moveOnDrag,o.scroller.dragDrop&&o.scroller.dragDrop(),Ie(o.wrapper.ownerDocument,"mouseup",z),Ie(o.wrapper.ownerDocument,"mousemove",Y),Ie(o.scroller,"dragstart",q),Ie(o.scroller,"drop",z),vs(e),setTimeout(function(){return o.input.focus()},20)}function yo(e,t,n){if(n=="char")return new gi(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new gi(De(t.line,0),_(e.doc,De(t.line+1,0)));var i=n(e,t);return new gi(i.from,i.to)}function Vl(e,t,n,i){var o=e.display,I=e.doc;ie(t);var z,Y,q=I.sel,ee=q.ranges;if(i.addNew&&!i.extend?(Y=I.sel.contains(n),Y>-1?z=ee[Y]:z=new gi(n,n)):(z=I.sel.primary(),Y=I.sel.primIndex),i.unit=="rectangle")i.addNew||(z=new gi(n,n)),n=Kn(e,t,!0,!0),Y=-1;else{var he=yo(e,n,i.unit);i.extend?z=Ma(z,he.anchor,he.head,i.extend):z=he}i.addNew?Y==-1?(Y=ee.length,Qi(I,_n(e,ee.concat([z]),Y),{scroll:!1,origin:"*mouse"})):ee.length>1&&ee[Y].empty()&&i.unit=="char"&&!i.extend?(Qi(I,_n(e,ee.slice(0,Y).concat(ee.slice(Y+1)),0),{scroll:!1,origin:"*mouse"}),q=I.sel):Na(I,Y,z,Ee):(Y=0,Qi(I,new fn([z],0),Ee),q=I.sel);var ve=n;function Ce(ct){if(gt(ve,ct)==0)return;if(ve=ct,i.unit=="rectangle"){for(var St=[],Gt=e.options.tabSize,jt=B(it(I,n.line).text,n.ch,Gt),Zt=B(it(I,ct.line).text,ct.ch,Gt),Ti=Math.min(jt,Zt),Gi=Math.max(jt,Zt),Li=Math.min(n.line,ct.line),hn=Math.min(e.lastLine(),Math.max(n.line,ct.line));Li<=hn;Li++){var sn=it(I,Li).text,Ni=me(sn,Ti,Gt);Ti==Gi?St.push(new gi(De(Li,Ni),De(Li,Ni))):sn.length>Ni&&St.push(new gi(De(Li,Ni),De(Li,me(sn,Gi,Gt))))}St.length||St.push(new gi(n,n)),Qi(I,_n(e,q.ranges.slice(0,Y).concat(St),Y),{origin:"*mouse",scroll:!1}),e.scrollIntoView(ct)}else{var on=z,Yi=yo(e,ct,i.unit),ji=on.anchor,Ui;gt(Yi.anchor,ji)>0?(Ui=Yi.head,ji=vi(on.from(),Yi.anchor)):(Ui=Yi.anchor,ji=wi(on.to(),Yi.head));var ki=q.ranges.slice(0);ki[Y]=Xl(e,new gi(_(I,ji),Ui)),Qi(I,_n(e,ki,Y),Ee)}}var we=o.wrapper.getBoundingClientRect(),Ne=0;function Ke(ct){var St=++Ne,Gt=Kn(e,ct,!0,i.unit=="rectangle");if(!Gt)return;if(gt(Gt,ve)!=0){e.curOp.focus=P(),Ce(Gt);var jt=Xr(o,I);(Gt.line>=jt.to||Gt.line<jt.from)&&setTimeout(Hi(e,function(){Ne==St&&Ke(ct)}),150)}else{var Zt=ct.clientY<we.top?-20:ct.clientY>we.bottom?20:0;Zt&&setTimeout(Hi(e,function(){if(Ne!=St)return;o.scroller.scrollTop+=Zt,Ke(ct)}),50)}}function Je(ct){e.state.selectingText=!1,Ne=Infinity,ct&&(ie(ct),o.input.focus()),nt(o.wrapper.ownerDocument,"mousemove",ht),nt(o.wrapper.ownerDocument,"mouseup",_t),I.history.lastSelOrigin=null}var ht=Hi(e,function(ct){ct.buttons===0||!Le(ct)?Je(ct):Ke(ct)}),_t=Hi(e,Je);e.state.selectingText=_t,Ie(o.wrapper.ownerDocument,"mousemove",ht),Ie(o.wrapper.ownerDocument,"mouseup",_t)}function Xl(e,t){var n=t.anchor,i=t.head,o=it(e.doc,n.line);if(gt(n,i)==0&&n.sticky==i.sticky)return t;var I=ut(o);if(!I)return t;var z=dt(I,n.ch,n.sticky),Y=I[z];if(Y.from!=n.ch&&Y.to!=n.ch)return t;var q=z+(Y.from==n.ch==(Y.level!=1)?0:1);if(q==0||q==I.length)return t;var ee;if(i.line!=n.line)ee=(i.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var he=dt(I,i.ch,i.sticky),ve=he-z||(i.ch-n.ch)*(Y.level==1?-1:1);he==q-1||he==q?ee=ve<0:ee=ve>0}var Ce=I[q+(ee?-1:0)],we=ee==(Ce.level==1),Ne=we?Ce.from:Ce.to,Ke=we?"after":"before";return n.ch==Ne&&n.sticky==Ke?t:new gi(new De(n.line,Ne,Ke),i)}function _o(e,t,n,i){var o,I;if(t.touches)o=t.touches[0].clientX,I=t.touches[0].clientY;else try{o=t.clientX,I=t.clientY}catch(Ce){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&ie(t);var z=e.display,Y=z.lineDiv.getBoundingClientRect();if(I>Y.bottom||!fe(e,n))return ue(t);I-=Y.top-z.viewOffset;for(var q=0;q<e.display.gutterSpecs.length;++q){var ee=z.gutters.childNodes[q];if(ee&&ee.getBoundingClientRect().right>=o){var he=Nt(e.doc,I),ve=e.display.gutterSpecs[q];return Oe(e,n,e,he,ve.className,t),ue(t)}}}function Wa(e,t){return _o(e,t,"gutterClick",!0)}function bo(e,t){if(On(e.display,t)||Yl(e,t))return;if(Ge(e,t,"contextmenu"))return;A||e.display.input.onContextMenu(t)}function Yl(e,t){return fe(e,"gutterContextMenu")?_o(e,t,"gutterContextMenu",!1):!1}function Eo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),br(e)}var fr={toString:function(){return"CodeMirror.Init"}},xo={},sa={};function $l(e){var t=e.optionHandlers;function n(i,o,I,z){e.defaults[i]=o,I&&(t[i]=z?function(Y,q,ee){ee!=fr&&I(Y,q,ee)}:I)}e.defineOption=n,e.Init=fr,n("value","",function(i,o){return i.setValue(o)},!0),n("mode",null,function(i,o){i.doc.modeOption=o,ka(i)},!0),n("indentUnit",2,ka,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(i){Ar(i),br(i),rn(i)},!0),n("lineSeparator",null,function(i,o){if(i.doc.lineSep=o,!o)return;var I=[],z=i.doc.first;i.doc.iter(function(q){for(var ee=0;;){var he=q.text.indexOf(o,ee);if(he==-1)break;ee=he+o.length,I.push(De(z,he))}z++});for(var Y=I.length-1;Y>=0;Y--)ur(i.doc,o,I[Y],De(I[Y].line,I[Y].ch+o.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(i,o,I){i.state.specialChars=new RegExp(o.source+(o.test(" ")?"":"| "),"g"),I!=fr&&i.refresh()}),n("specialCharPlaceholder",ci,function(i){return i.refresh()},!0),n("electricChars",!0),n("inputStyle",s?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(i,o){return i.getInputField().spellcheck=o},!0),n("autocorrect",!1,function(i,o){return i.getInputField().autocorrect=o},!0),n("autocapitalize",!1,function(i,o){return i.getInputField().autocapitalize=o},!0),n("rtlMoveVisually",!O),n("wholeLineUpdateBefore",!0),n("theme","default",function(i){Eo(i),Rr(i)},!0),n("keyMap","default",function(i,o,I){var z=ra(o),Y=I!=fr&&ra(I);Y&&Y.detach&&Y.detach(i,z),z.attach&&z.attach(i,Y||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(i,o){i.display.gutterSpecs=La(o,i.options.lineNumbers),Rr(i)},!0),n("fixedGutter",!0,function(i,o){i.display.gutters.style.left=o?ba(i.display)+"px":"0",i.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(i){return ar(i)},!0),n("scrollbarStyle","native",function(i){Ts(i),ar(i),i.display.scrollbars.setScrollTop(i.doc.scrollTop),i.display.scrollbars.setScrollLeft(i.doc.scrollLeft)},!0),n("lineNumbers",!1,function(i,o){i.display.gutterSpecs=La(i.options.gutters,o),Rr(i)},!0),n("firstLineNumber",1,Rr,!0),n("lineNumberFormatter",function(i){return i},Rr,!0),n("showCursorWhenSelecting",!1,Er,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(i,o){o=="nocursor"&&(nr(i),i.display.input.blur()),i.display.input.readOnlyChanged(o)}),n("screenReaderLabel",null,function(i,o){o=o===""?null:o,i.display.input.screenReaderLabelChanged(o)}),n("disableInput",!1,function(i,o){o||i.display.input.reset()},!0),n("dragDrop",!0,Ql),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,Er,!0),n("singleCursorHeightPerLine",!0,Er,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Ar,!0),n("addModeClass",!1,Ar,!0),n("pollInterval",100),n("undoDepth",200,function(i,o){return i.doc.history.undoDepth=o}),n("historyEventDelay",1250),n("viewportMargin",10,function(i){return i.refresh()},!0),n("maxHighlightLength",1e4,Ar,!0),n("moveInputWithCursor",!0,function(i,o){o||i.display.input.resetPosition()}),n("tabindex",null,function(i,o){return i.display.input.getField().tabIndex=o||""}),n("autofocus",null),n("direction","ltr",function(i,o){return i.doc.setDirection(o)},!0),n("phrases",null)}function Ql(e,t,n){var i=n&&n!=fr;if(!t!=!i){var o=e.display.dragFunctions,I=t?Ie:nt;I(e.display.scroller,"dragstart",o.start),I(e.display.scroller,"dragenter",o.enter),I(e.display.scroller,"dragover",o.over),I(e.display.scroller,"dragleave",o.leave),I(e.display.scroller,"drop",o.drop)}}function Jl(e){e.options.lineWrapping?(M(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(T(e.display.wrapper,"CodeMirror-wrap"),qn(e)),Ea(e),rn(e),br(e),setTimeout(function(){return ar(e)},100)}function Ai(e,t){var n=this;if(!(this instanceof Ai))return new Ai(e,t);this.options=t=t?S(t):{},S(xo,t,!1);var i=t.value;typeof i=="string"?i=new an(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var o=new Ai.inputStyles[t.inputStyle](this),I=this.display=new hl(e,i,o,t);I.wrapper.CodeMirror=this,Eo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ts(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 J,keySeq:null,specialChars:null},t.autofocus&&!s&&I.input.focus(),V&&H<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Ol(),$n(this),this.curOp.forceUpdate=!0,Ds(this,i),t.autofocus&&!s||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ta(n)},20):nr(this);for(var z in sa)sa.hasOwnProperty(z)&&sa[z](this,t[z],fr);Cs(this),t.finishInit&&t.finishInit(this);for(var Y=0;Y<Ga.length;++Y)Ga[Y](this);Qn(this),k&&t.lineWrapping&&getComputedStyle(I.lineDiv).textRendering=="optimizelegibility"&&(I.lineDiv.style.textRendering="auto")}Ai.defaults=xo,Ai.optionHandlers=sa;function Zl(e){var t=e.display;Ie(t.scroller,"mousedown",Hi(e,vo)),V&&H<11?Ie(t.scroller,"dblclick",Hi(e,function(q){if(Ge(e,q))return;var ee=Kn(e,q);if(!ee||Wa(e,q)||On(e.display,q))return;ie(q);var he=e.findWordAt(ee);qr(e.doc,he.anchor,he.head)})):Ie(t.scroller,"dblclick",function(q){return Ge(e,q)||ie(q)}),Ie(t.scroller,"contextmenu",function(q){return bo(e,q)}),Ie(t.input.getField(),"contextmenu",function(q){t.scroller.contains(q.target)||bo(e,q)});var n,i={end:0};function o(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),i=t.activeTouch,i.end=+new Date)}function I(q){if(q.touches.length!=1)return!1;var ee=q.touches[0];return ee.radiusX<=1&&ee.radiusY<=1}function z(q,ee){if(ee.left==null)return!0;var he=ee.left-q.left,ve=ee.top-q.top;return he*he+ve*ve>20*20}Ie(t.scroller,"touchstart",function(q){if(!Ge(e,q)&&!I(q)&&!Wa(e,q)){t.input.ensurePolled(),clearTimeout(n);var ee=+new Date;t.activeTouch={start:ee,moved:!1,prev:ee-i.end<=300?i:null},q.touches.length==1&&(t.activeTouch.left=q.touches[0].pageX,t.activeTouch.top=q.touches[0].pageY)}}),Ie(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ie(t.scroller,"touchend",function(q){var ee=t.activeTouch;if(ee&&!On(t,q)&&ee.left!=null&&!ee.moved&&new Date-ee.start<300){var he=e.coordsChar(t.activeTouch,"page"),ve;!ee.prev||z(ee,ee.prev)?ve=new gi(he,he):!ee.prev.prev||z(ee,ee.prev.prev)?ve=e.findWordAt(he):ve=new gi(De(he.line,0),_(e.doc,De(he.line+1,0))),e.setSelection(ve.anchor,ve.head),e.focus(),ie(q)}o()}),Ie(t.scroller,"touchcancel",o),Ie(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Tr(e,t.scroller.scrollTop),Xn(e,t.scroller.scrollLeft,!0),Oe(e,"scroll",e))}),Ie(t.scroller,"mousewheel",function(q){return Os(e,q)}),Ie(t.scroller,"DOMMouseScroll",function(q){return Os(e,q)}),Ie(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(q){Ge(e,q)||ge(q)},over:function(q){Ge(e,q)||(Al(e,q),ge(q))},start:function(q){return Rl(e,q)},drop:Hi(e,Cl),leave:function(q){Ge(e,q)||no(e)}};var Y=t.input.getField();Ie(Y,"keyup",function(q){return mo.call(e,q)}),Ie(Y,"keydown",Hi(e,po)),Ie(Y,"keypress",Hi(e,go)),Ie(Y,"focus",function(q){return Ta(e,q)}),Ie(Y,"blur",function(q){return nr(e,q)})}var Ga=[];Ai.defineInitHook=function(e){return Ga.push(e)};function Hr(e,t,n,i){var o=e.doc,I;n==null&&(n="add"),n=="smart"&&(o.mode.indent?I=Me(e,t).state:n="prev");var z=e.options.tabSize,Y=it(o,t),q=B(Y.text,null,z);Y.stateAfter&&(Y.stateAfter=null);var ee=Y.text.match(/^\s*/)[0],he;if(!i&&!/\S/.test(Y.text))he=0,n="not";else if(n=="smart"&&(he=o.mode.indent(I,Y.text.slice(ee.length),Y.text),he==_e||he>150)){if(!i)return;n="prev"}n=="prev"?t>o.first?he=B(it(o,t-1).text,null,z):he=0:n=="add"?he=q+e.options.indentUnit:n=="subtract"?he=q-e.options.indentUnit:typeof n=="number"&&(he=q+n),he=Math.max(0,he);var ve="",Ce=0;if(e.options.indentWithTabs)for(var we=Math.floor(he/z);we;--we)Ce+=z,ve+=" ";if(Ce<he&&(ve+=se(he-Ce)),ve!=ee)return ur(o,ve,De(t,0),De(t,ee.length),"+input"),Y.stateAfter=null,!0;for(var Ne=0;Ne<o.sel.ranges.length;Ne++){var Ke=o.sel.ranges[Ne];if(Ke.head.line==t&&Ke.head.ch<ee.length){var Je=De(t,ee.length);Na(o,Ne,new gi(Je,Je));break}}}var bn=null;function oa(e){bn=e}function za(e,t,n,i,o){var I=e.doc;e.display.shift=!1,i||(i=I.sel);var z=+new Date-200,Y=o=="paste"||e.state.pasteIncoming>z,q=tt(t),ee=null;if(Y&&i.ranges.length>1)if(bn&&bn.text.join(`
|
|
`)==t){if(i.ranges.length%bn.text.length==0){ee=[];for(var he=0;he<bn.text.length;he++)ee.push(I.splitLines(bn.text[he]))}}else q.length==i.ranges.length&&e.options.pasteLinesPerSelection&&(ee=je(q,function(ht){return[ht]}));for(var ve=e.curOp.updateInput,Ce=i.ranges.length-1;Ce>=0;Ce--){var we=i.ranges[Ce],Ne=we.from(),Ke=we.to();we.empty()&&(n&&n>0?Ne=De(Ne.line,Ne.ch-n):e.state.overwrite&&!Y?Ke=De(Ke.line,Math.min(it(I,Ke.line).text.length,Ke.ch+Se(q).length)):Y&&bn&&bn.lineWise&&bn.text.join(`
|
|
`)==q.join(`
|
|
`)&&(Ne=Ke=De(Ne.line,0)));var Je={from:Ne,to:Ke,text:ee?ee[Ce%ee.length]:q,origin:o||(Y?"paste":e.state.cutIncoming>z?"cut":"+input")};lr(e.doc,Je),Xi(e,"inputRead",e,Je)}t&&!Y&&wo(e,t),rr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ve),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function To(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&un(t,function(){return za(t,n,0,null,"paste")}),!0}function wo(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,i=n.ranges.length-1;i>=0;i--){var o=n.ranges[i];if(o.head.ch>100||i&&n.ranges[i-1].head.line==o.head.line)continue;var I=e.getModeAt(o.head),z=!1;if(I.electricChars){for(var Y=0;Y<I.electricChars.length;Y++)if(t.indexOf(I.electricChars.charAt(Y))>-1){z=Hr(e,o.head.line,"smart");break}}else I.electricInput&&(I.electricInput.test(it(e.doc,o.head.line).text.slice(0,o.head.ch))&&(z=Hr(e,o.head.line,"smart")));z&&Xi(e,"electricInput",e,o.head.line)}}function So(e){for(var t=[],n=[],i=0;i<e.doc.sel.ranges.length;i++){var o=e.doc.sel.ranges[i].head.line,I={anchor:De(o,0),head:De(o+1,0)};n.push(I),t.push(e.getRange(I.anchor,I.head))}return{text:t,ranges:n}}function Co(e,t,n,i){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",i?"":"off"),e.setAttribute("spellcheck",!!t)}function Ro(){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 k?e.style.width="1000px":e.setAttribute("wrap","off"),d&&(e.style.border="1px solid black"),Co(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(i,o){var I=this.options,z=I[i];if(I[i]==o&&i!="mode")return;I[i]=o,t.hasOwnProperty(i)&&Hi(this,t[i])(this,o,z),Oe(this,"optionChange",this,i)},getOption:function(i){return this.options[i]},getDoc:function(){return this.doc},addKeyMap:function(i,o){this.state.keyMaps[o?"push":"unshift"](ra(i))},removeKeyMap:function(i){for(var o=this.state.keyMaps,I=0;I<o.length;++I)if(o[I]==i||o[I].name==i)return o.splice(I,1),!0},addOverlay:Zi(function(i,o){var I=i.token?i:e.getMode(this.options,i);if(I.startState)throw new Error("Overlays may not be stateful.");We(this.state.overlays,{mode:I,modeSpec:i,opaque:o&&o.opaque,priority:o&&o.priority||0},function(z){return z.priority}),this.state.modeGen++,rn(this)}),removeOverlay:Zi(function(i){for(var o=this.state.overlays,I=0;I<o.length;++I){var z=o[I].modeSpec;if(z==i||typeof i=="string"&&z.name==i){o.splice(I,1),this.state.modeGen++,rn(this);return}}}),indentLine:Zi(function(i,o,I){typeof o!="string"&&typeof o!="number"&&(o==null?o=this.options.smartIndent?"smart":"prev":o=o?"add":"subtract"),ti(this.doc,i)&&Hr(this,i,o,I)}),indentSelection:Zi(function(i){for(var o=this.doc.sel.ranges,I=-1,z=0;z<o.length;z++){var Y=o[z];if(Y.empty())Y.head.line>I&&(Hr(this,Y.head.line,i,!0),I=Y.head.line,z==this.doc.sel.primIndex&&rr(this));else{var q=Y.from(),ee=Y.to(),he=Math.max(I,q.line);I=Math.min(this.lastLine(),ee.line-(ee.ch?0:1))+1;for(var ve=he;ve<I;++ve)Hr(this,ve,i);var Ce=this.doc.sel.ranges;q.ch==0&&o.length==Ce.length&&Ce[z].from().ch>0&&Na(this.doc,z,new gi(q,Ce[z].to()),de)}}}),getTokenAt:function(i,o){return xt(this,i,o)},getLineTokens:function(i,o){return xt(this,De(i),o,!0)},getTokenTypeAt:function(i){i=_(this.doc,i);var o=Ae(this,it(this.doc,i.line)),I=0,z=(o.length-1)/2,Y=i.ch,q;if(Y==0)q=o[2];else for(;;){var ee=I+z>>1;if((ee?o[ee*2-1]:0)>=Y)z=ee;else if(o[ee*2+1]<Y)I=ee+1;else{q=o[ee*2+2];break}}var he=q?q.indexOf("overlay "):-1;return he<0?q:he==0?null:q.slice(0,he-1)},getModeAt:function(i){var o=this.doc.mode;return o.innerMode?e.innerMode(o,this.getTokenAt(i).state).mode:o},getHelper:function(i,o){return this.getHelpers(i,o)[0]},getHelpers:function(i,o){var I=[];if(!n.hasOwnProperty(o))return I;var z=n[o],Y=this.getModeAt(i);if(typeof Y[o]=="string")z[Y[o]]&&I.push(z[Y[o]]);else if(Y[o])for(var q=0;q<Y[o].length;q++){var ee=z[Y[o][q]];ee&&I.push(ee)}else Y.helperType&&z[Y.helperType]?I.push(z[Y.helperType]):z[Y.name]&&I.push(z[Y.name]);for(var he=0;he<z._global.length;he++){var ve=z._global[he];ve.pred(Y,this)&&te(I,ve.val)==-1&&I.push(ve.val)}return I},getStateAfter:function(i,o){var I=this.doc;return i=K(I,i==null?I.first+I.size-1:i),Me(this,i+1,o).state},cursorCoords:function(i,o){var I,z=this.doc.sel.primary();return i==null?I=z.head:typeof i=="object"?I=_(this.doc,i):I=i?z.from():z.to(),yn(this,I,o||"page")},charCoords:function(i,o){return ma(this,_(this.doc,i),o||"page")},coordsChar:function(i,o){return i=ls(this,i,o||"page"),va(this,i.left,i.top)},lineAtHeight:function(i,o){return i=ls(this,{top:i,left:0},o||"page").top,Nt(this.doc,i+this.display.viewOffset)},heightAtLine:function(i,o,I){var z=!1,Y;if(typeof i=="number"){var q=this.doc.first+this.doc.size-1;i<this.doc.first?i=this.doc.first:i>q&&(i=q,z=!0),Y=it(this.doc,i)}else Y=i;return Gr(this,Y,{top:0,left:0},o||"page",I||z).top+(z?this.doc.height-Ki(Y):0)},defaultTextHeight:function(){return tr(this.display)},defaultCharWidth:function(){return ir(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(i,o,I,z,Y){var q=this.display;i=yn(this,_(this.doc,i));var ee=i.bottom,he=i.left;if(o.style.position="absolute",o.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(o),q.sizer.appendChild(o),z=="over")ee=i.top;else if(z=="above"||z=="near"){var ve=Math.max(q.wrapper.clientHeight,this.doc.height),Ce=Math.max(q.sizer.clientWidth,q.lineSpace.clientWidth);(z=="above"||i.bottom+o.offsetHeight>ve)&&i.top>o.offsetHeight?ee=i.top-o.offsetHeight:i.bottom+o.offsetHeight<=ve&&(ee=i.bottom),he+o.offsetWidth>Ce&&(he=Ce-o.offsetWidth)}o.style.top=ee+"px",o.style.left=o.style.right="",Y=="right"?(he=q.sizer.clientWidth-o.offsetWidth,o.style.right="0px"):(Y=="left"?he=0:Y=="middle"&&(he=(q.sizer.clientWidth-o.offsetWidth)/2),o.style.left=he+"px"),I&&Qo(this,{left:he,top:ee,right:he+o.offsetWidth,bottom:ee+o.offsetHeight})},triggerOnKeyDown:Zi(po),triggerOnKeyPress:Zi(go),triggerOnKeyUp:mo,triggerOnMouseDown:Zi(vo),execCommand:function(i){if(Ur.hasOwnProperty(i))return Ur[i].call(null,this)},triggerElectric:Zi(function(i){wo(this,i)}),findPosH:function(i,o,I,z){var Y=1;o<0&&(Y=-1,o=-o);for(var q=_(this.doc,i),ee=0;ee<o&&!(q=Ka(this.doc,q,Y,I,z),q.hitSide);++ee);return q},moveH:Zi(function(i,o){var I=this;this.extendSelectionsBy(function(z){return I.display.shift||I.doc.extend||z.empty()?Ka(I.doc,z.head,i,o,I.options.rtlMoveVisually):i<0?z.from():z.to()},Te)}),deleteH:Zi(function(i,o){var I=this.doc.sel,z=this.doc;I.somethingSelected()?z.replaceSelection("",null,"+delete"):dr(this,function(Y){var q=Ka(z,Y.head,i,o,!1);return i<0?{from:q,to:Y.head}:{from:Y.head,to:q}})}),findPosV:function(i,o,I,z){var Y=1,q=z;o<0&&(Y=-1,o=-o);for(var ee=_(this.doc,i),he=0;he<o;++he){var ve=yn(this,ee,"div");if(q==null?q=ve.left:ve.left=q,ee=Ao(this,ve,Y,I),ee.hitSide)break}return ee},moveV:Zi(function(i,o){var I=this,z=this.doc,Y=[],q=!this.display.shift&&!z.extend&&z.sel.somethingSelected();if(z.extendSelectionsBy(function(he){if(q)return i<0?he.from():he.to();var ve=yn(I,he.head,"div");he.goalColumn!=null&&(ve.left=he.goalColumn),Y.push(ve.left);var Ce=Ao(I,ve,i,o);return o=="page"&&he==z.sel.primary()&&Sa(I,ma(I,Ce,"div").top-ve.top),Ce},Te),Y.length)for(var ee=0;ee<z.sel.ranges.length;ee++)z.sel.ranges[ee].goalColumn=Y[ee]}),findWordAt:function(i){var o=this.doc,I=it(o,i.line).text,z=i.ch,Y=i.ch;if(I){var q=this.getHelper(i,"wordChars");(i.sticky=="before"||Y==I.length)&&z?--z:++Y;for(var ee=I.charAt(z),he=Ye(ee,q)?function(ve){return Ye(ve,q)}:/\s/.test(ee)?function(ve){return/\s/.test(ve)}:function(ve){return!/\s/.test(ve)&&!Ye(ve)};z>0&&he(I.charAt(z-1));)--z;for(;Y<I.length&&he(I.charAt(Y));)++Y}return new gi(De(i.line,z),De(i.line,Y))},toggleOverwrite:function(i){if(i!=null&&i==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?M(this.display.cursorDiv,"CodeMirror-overwrite"):T(this.display.cursorDiv,"CodeMirror-overwrite"),Oe(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==P()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Zi(function(i,o){xr(this,i,o)}),getScrollInfo:function(){var i=this.display.scroller;return{left:i.scrollLeft,top:i.scrollTop,height:i.scrollHeight-Tn(this)-this.display.barHeight,width:i.scrollWidth-Tn(this)-this.display.barWidth,clientHeight:da(this),clientWidth:Gn(this)}},scrollIntoView:Zi(function(i,o){i==null?(i={from:this.doc.sel.primary().head,to:null},o==null&&(o=this.options.cursorScrollMargin)):typeof i=="number"?i={from:De(i,0),to:null}:i.from==null&&(i={from:i,to:null}),i.to||(i.to=i.from),i.margin=o||0,i.from.line!=null?Jo(this,i):_s(this,i.from,i.to,i.margin)}),setSize:Zi(function(i,o){var I=this,z=function(q){return typeof q=="number"||/^\d+$/.test(String(q))?q+"px":q};i!=null&&(this.display.wrapper.style.width=z(i)),o!=null&&(this.display.wrapper.style.height=z(o)),this.options.lineWrapping&&as(this);var Y=this.display.viewFrom;this.doc.iter(Y,this.display.viewTo,function(q){if(q.widgets){for(var ee=0;ee<q.widgets.length;ee++)if(q.widgets[ee].noHScroll){Dn(I,Y,"widget");break}}++Y}),this.curOp.forceUpdate=!0,Oe(this,"refresh",this)}),operation:function(i){return un(this,i)},startOperation:function(){return $n(this)},endOperation:function(){return Qn(this)},refresh:Zi(function(){var i=this.display.cachedTextHeight;rn(this),this.curOp.forceUpdate=!0,br(this),xr(this,this.doc.scrollLeft,this.doc.scrollTop),Aa(this.display),(i==null||Math.abs(i-tr(this.display))>.5||this.options.lineWrapping)&&Ea(this),Oe(this,"refresh",this)}),swapDoc:Zi(function(i){var o=this.doc;return o.cm=null,this.state.selectingText&&this.state.selectingText(),Ds(this,i),br(this),this.display.input.reset(),xr(this,i.scrollLeft,i.scrollTop),this.curOp.forceScroll=!0,Xi(this,"swapDoc",this,o),o}),phrase:function(i){var o=this.options.phrases;return o&&Object.prototype.hasOwnProperty.call(o,i)?o[i]:i},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}},pe(e),e.registerHelper=function(i,o,I){n.hasOwnProperty(i)||(n[i]=e[i]={_global:[]}),n[i][o]=I},e.registerGlobalHelper=function(i,o,I,z){e.registerHelper(i,o,z),n[i]._global.push({pred:I,val:z})}}function Ka(e,t,n,i,o){var I=t,z=n,Y=it(e,t.line),q=o&&e.direction=="rtl"?-n:n;function ee(){var _t=t.line+q;return _t<e.first||_t>=e.first+e.size?!1:(t=new De(_t,t.ch,t.sticky),Y=it(e,_t))}function he(_t){var ct;if(i=="codepoint"){var St=Y.text.charCodeAt(t.ch+(i>0?0:-1));isNaN(St)?ct=null:ct=new De(t.line,Math.max(0,Math.min(Y.text.length,t.ch+n*(St>=55296&&St<56320?2:1))),-n)}else o?ct=Pl(e.cm,Y,t,n):ct=Fa(Y,t,n);if(ct==null)if(!_t&&ee())t=Ba(o,e.cm,Y,t.line,q);else return!1;else t=ct;return!0}if(i=="char"||i=="codepoint")he();else if(i=="column")he(!0);else if(i=="word"||i=="group")for(var ve=null,Ce=i=="group",we=e.cm&&e.cm.getHelper(t,"wordChars"),Ne=!0;!(n<0&&!he(!Ne));Ne=!1){var Ke=Y.text.charAt(t.ch)||`
|
|
`,Je=Ye(Ke,we)?"w":Ce&&Ke==`
|
|
`?"n":!Ce||/\s/.test(Ke)?null:"p";if(Ce&&!Ne&&!Je&&(Je="s"),ve&&ve!=Je){n<0&&(n=1,he(),t.sticky="after");break}if(Je&&(ve=Je),n>0&&!he(!Ne))break}var ht=ta(e,t,I,z,!0);return pi(I,ht)&&(ht.hitSide=!0),ht}function Ao(e,t,n,i){var o=e.doc,I=t.left,z;if(i=="page"){var Y=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),q=Math.max(Y-.5*tr(e.display),3);z=(n>0?t.bottom:t.top)+n*q}else i=="line"&&(z=n>0?t.bottom+3:t.top-3);for(var ee;!(ee=va(e,I,z),!ee.outside);){if(n<0?z<=0:z>=o.height){ee.hitSide=!0;break}z+=n*5}return ee}var _i=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new J,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};_i.prototype.init=function(e){var t=this,n=this,i=n.cm,o=n.div=e.lineDiv;Co(o,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize);function I(Y){for(var q=Y.target;q;q=q.parentNode){if(q==o)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(q.className))break}return!1}Ie(o,"paste",function(Y){if(!I(Y)||Ge(i,Y)||To(Y,i))return;H<=11&&setTimeout(Hi(i,function(){return t.updateFromDOM()}),20)}),Ie(o,"compositionstart",function(Y){t.composing={data:Y.data,done:!1}}),Ie(o,"compositionupdate",function(Y){t.composing||(t.composing={data:Y.data,done:!1})}),Ie(o,"compositionend",function(Y){t.composing&&(Y.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ie(o,"touchstart",function(){return n.forceCompositionEnd()}),Ie(o,"input",function(){t.composing||t.readFromDOMSoon()});function z(Y){if(!I(Y)||Ge(i,Y))return;if(i.somethingSelected())oa({lineWise:!1,text:i.getSelections()}),Y.type=="cut"&&i.replaceSelection("",null,"cut");else if(i.options.lineWiseCopyCut){var q=So(i);oa({lineWise:!0,text:q.text}),Y.type=="cut"&&i.operation(function(){i.setSelections(q.ranges,0,de),i.replaceSelection("",null,"cut")})}else return;if(Y.clipboardData){Y.clipboardData.clearData();var ee=bn.text.join(`
|
|
`);if(Y.clipboardData.setData("Text",ee),Y.clipboardData.getData("Text")==ee){Y.preventDefault();return}}var he=Ro(),ve=he.firstChild;i.display.lineSpace.insertBefore(he,i.display.lineSpace.firstChild),ve.value=bn.text.join(`
|
|
`);var Ce=document.activeElement;X(ve),setTimeout(function(){i.display.lineSpace.removeChild(he),Ce.focus(),Ce==o&&n.showPrimarySelection()},50)}Ie(o,"copy",z),Ie(o,"cut",z)},_i.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},_i.prototype.prepareSelection=function(){var e=ps(this.cm,!1);return e.focus=document.activeElement==this.div,e},_i.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},_i.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},_i.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),i=n.from(),o=n.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||o.line<t.display.viewFrom){e.removeAllRanges();return}var I=la(t,e.anchorNode,e.anchorOffset),z=la(t,e.focusNode,e.focusOffset);if(I&&!I.bad&&z&&!z.bad&>(vi(I,z),i)==0&>(wi(I,z),o)==0)return;var Y=t.display.view,q=i.line>=t.display.viewFrom&&Oo(t,i)||{node:Y[0].measure.map[2],offset:0},ee=o.line<t.display.viewTo&&Oo(t,o);if(!ee){var he=Y[Y.length-1].measure,ve=he.maps?he.maps[he.maps.length-1]:he.map;ee={node:ve[ve.length-1],offset:ve[ve.length-2]-ve[ve.length-3]}}if(!q||!ee){e.removeAllRanges();return}var Ce=e.rangeCount&&e.getRangeAt(0),we;try{we=r(q.node,q.offset,ee.offset,ee.node)}catch(Ne){}we&&(!D&&t.state.focused?(e.collapse(q.node,q.offset),we.collapsed||(e.removeAllRanges(),e.addRange(we))):(e.removeAllRanges(),e.addRange(we)),Ce&&e.anchorNode==null?e.addRange(Ce):D&&this.startGracePeriod()),this.rememberSelection()},_i.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)},_i.prototype.showMultipleSelections=function(e){g(this.cm.display.cursorDiv,e.cursors),g(this.cm.display.selectionDiv,e.selection)},_i.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},_i.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return b(this.div,t)},_i.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},_i.prototype.blur=function(){this.div.blur()},_i.prototype.getField=function(){return this.div},_i.prototype.supportsTouch=function(){return!0},_i.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():un(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)},_i.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},_i.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(l&&y&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=la(t,e.anchorNode,e.anchorOffset),i=la(t,e.focusNode,e.focusOffset);n&&i&&un(t,function(){Qi(t.doc,Mn(n,i),de),(n.bad||i.bad)&&(t.curOp.selectionChanged=!0)})},_i.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),i=n.from(),o=n.to();if(i.ch==0&&i.line>e.firstLine()&&(i=De(i.line-1,it(e.doc,i.line-1).length)),o.ch==it(e.doc,o.line).text.length&&o.line<e.lastLine()&&(o=De(o.line+1,0)),i.line<t.viewFrom||o.line>t.viewTo-1)return!1;var I,z,Y;i.line==t.viewFrom||(I=Vn(e,i.line))==0?(z=Et(t.view[0].line),Y=t.view[0].node):(z=Et(t.view[I].line),Y=t.view[I-1].node.nextSibling);var q=Vn(e,o.line),ee,he;if(q==t.view.length-1?(ee=t.viewTo-1,he=t.lineDiv.lastChild):(ee=Et(t.view[q+1].line)-1,he=t.view[q+1].node.previousSibling),!Y)return!1;for(var ve=e.doc.splitLines(tu(e,Y,he,z,ee)),Ce=fi(e.doc,De(z,0),De(ee,it(e.doc,ee).text.length));ve.length>1&&Ce.length>1;)if(Se(ve)==Se(Ce))ve.pop(),Ce.pop(),ee--;else if(ve[0]==Ce[0])ve.shift(),Ce.shift(),z++;else break;for(var we=0,Ne=0,Ke=ve[0],Je=Ce[0],ht=Math.min(Ke.length,Je.length);we<ht&&Ke.charCodeAt(we)==Je.charCodeAt(we);)++we;for(var _t=Se(ve),ct=Se(Ce),St=Math.min(_t.length-(ve.length==1?we:0),ct.length-(Ce.length==1?we:0));Ne<St&&_t.charCodeAt(_t.length-Ne-1)==ct.charCodeAt(ct.length-Ne-1);)++Ne;if(ve.length==1&&Ce.length==1&&z==i.line)for(;we&&we>i.ch&&_t.charCodeAt(_t.length-Ne-1)==ct.charCodeAt(ct.length-Ne-1);)we--,Ne++;ve[ve.length-1]=_t.slice(0,_t.length-Ne).replace(/^\u200b+/,""),ve[0]=ve[0].slice(we).replace(/\u200b+$/,"");var Gt=De(z,we),jt=De(ee,Ce.length?Se(Ce).length-Ne:0);if(ve.length>1||ve[0]||gt(Gt,jt))return ur(e.doc,ve,Gt,jt,"+input"),!0},_i.prototype.ensurePolled=function(){this.forceCompositionEnd()},_i.prototype.reset=function(){this.forceCompositionEnd()},_i.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},_i.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)},_i.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&un(this.cm,function(){return rn(e.cm)})},_i.prototype.setUneditable=function(e){e.contentEditable="false"},_i.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Hi(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},_i.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},_i.prototype.onContextMenu=function(){},_i.prototype.resetPosition=function(){},_i.prototype.needsContentAttribute=!0;function Oo(e,t){var n=fa(e,t.line);if(!n||n.hidden)return null;var i=it(e.doc,t.line),o=es(n,i,t.line),I=ut(i,e.doc.direction),z="left";if(I){var Y=dt(I,t.ch);z=Y%2?"right":"left"}var q=ns(o.map,t.ch,z);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 pr(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,i,o){var I="",z=!1,Y=e.doc.lineSeparator(),q=!1;function ee(we){return function(Ne){return Ne.id==we}}function he(){z&&(I+=Y,q&&(I+=Y),z=q=!1)}function ve(we){we&&(he(),I+=we)}function Ce(we){if(we.nodeType==1){var Ne=we.getAttribute("cm-text");if(Ne){ve(Ne);return}var Ke=we.getAttribute("cm-marker"),Je;if(Ke){var ht=e.findMarks(De(i,0),De(o+1,0),ee(+Ke));ht.length&&(Je=ht[0].find(0))&&ve(fi(e.doc,Je.from,Je.to).join(Y));return}if(we.getAttribute("contenteditable")=="false")return;var _t=/^(pre|div|p|li|table|br)$/i.test(we.nodeName);if(!/^br$/i.test(we.nodeName)&&we.textContent.length==0)return;_t&&he();for(var ct=0;ct<we.childNodes.length;ct++)Ce(we.childNodes[ct]);/^(pre|p)$/i.test(we.nodeName)&&(q=!0),_t&&(z=!0)}else we.nodeType==3&&ve(we.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Ce(t),t==n);)t=t.nextSibling,q=!1;return I}function la(e,t,n){var i;if(t==e.display.lineDiv){if(i=e.display.lineDiv.childNodes[n],!i)return pr(e.clipPos(De(e.display.viewTo-1)),!0);t=null,n=0}else for(i=t;;i=i.parentNode){if(!i||i==e.display.lineDiv)return null;if(i.parentNode&&i.parentNode==e.display.lineDiv)break}for(var o=0;o<e.display.view.length;o++){var I=e.display.view[o];if(I.node==i)return iu(I,t,n)}}function iu(e,t,n){var i=e.text.firstChild,o=!1;if(!t||!b(i,t))return pr(De(Et(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[n],n=0,!t)){var I=e.rest?Se(e.rest):e.line;return pr(De(Et(I),I.text.length),o)}var z=t.nodeType==3?t:null,Y=t;for(!z&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(z=t.firstChild,n&&(n=z.nodeValue.length));Y.parentNode!=i;)Y=Y.parentNode;var q=e.measure,ee=q.maps;function he(Je,ht,_t){for(var ct=-1;ct<(ee?ee.length:0);ct++)for(var St=ct<0?q.map:ee[ct],Gt=0;Gt<St.length;Gt+=3){var jt=St[Gt+2];if(jt==Je||jt==ht){var Zt=Et(ct<0?e.line:e.rest[ct]),Ti=St[Gt]+_t;return(_t<0||jt!=Je)&&(Ti=St[Gt+(_t?1:0)]),De(Zt,Ti)}}}var ve=he(z,Y,n);if(ve)return pr(ve,o);for(var Ce=Y.nextSibling,we=z?z.nodeValue.length-n:0;Ce;Ce=Ce.nextSibling){if(ve=he(Ce,Ce.firstChild,0),ve)return pr(De(ve.line,ve.ch-we),o);we+=Ce.textContent.length}for(var Ne=Y.previousSibling,Ke=n;Ne;Ne=Ne.previousSibling){if(ve=he(Ne,Ne.firstChild,-1),ve)return pr(De(ve.line,ve.ch+Ke),o);Ke+=Ne.textContent.length}}var Mi=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new J,this.hasSelection=!1,this.composing=null};Mi.prototype.init=function(e){var t=this,n=this,i=this.cm;this.createField(e);var o=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),d&&(o.style.width="0px"),Ie(o,"input",function(){V&&H>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ie(o,"paste",function(z){if(Ge(i,z)||To(z,i))return;i.state.pasteIncoming=+new Date,n.fastPoll()});function I(z){if(Ge(i,z))return;if(i.somethingSelected())oa({lineWise:!1,text:i.getSelections()});else if(i.options.lineWiseCopyCut){var Y=So(i);oa({lineWise:!0,text:Y.text}),z.type=="cut"?i.setSelections(Y.ranges,null,de):(n.prevInput="",o.value=Y.text.join(`
|
|
`),X(o))}else return;z.type=="cut"&&(i.state.cutIncoming=+new Date)}Ie(o,"cut",I),Ie(o,"copy",I),Ie(e.scroller,"paste",function(z){if(On(e,z)||Ge(i,z))return;if(!o.dispatchEvent){i.state.pasteIncoming=+new Date,n.focus();return}var Y=new Event("paste");Y.clipboardData=z.clipboardData,o.dispatchEvent(Y)}),Ie(e.lineSpace,"selectstart",function(z){On(e,z)||ie(z)}),Ie(o,"compositionstart",function(){var z=i.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:z,range:i.markText(z,i.getCursor("to"),{className:"CodeMirror-composing"})}}),Ie(o,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Mi.prototype.createField=function(e){this.wrapper=Ro(),this.textarea=this.wrapper.firstChild},Mi.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Mi.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,i=ps(e);if(e.options.moveInputWithCursor){var o=yn(e,n.sel.primary().head,"div"),I=t.wrapper.getBoundingClientRect(),z=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,o.top+z.top-I.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,o.left+z.left-I.left))}return i},Mi.prototype.showSelection=function(e){var t=this.cm,n=t.display;g(n.cursorDiv,e.cursors),g(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Mi.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&X(this.textarea),V&&H>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",V&&H>=9&&(this.hasSelection=null))},Mi.prototype.getField=function(){return this.textarea},Mi.prototype.supportsTouch=function(){return!1},Mi.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!s||P()!=this.textarea))try{this.textarea.focus()}catch(e){}},Mi.prototype.blur=function(){this.textarea.blur()},Mi.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Mi.prototype.receivedFocus=function(){this.slowPoll()},Mi.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()})},Mi.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var i=t.poll();!i&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},Mi.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||ke(n)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var o=n.value;if(o==i&&!t.somethingSelected())return!1;if(V&&H>=9&&this.hasSelection===o||u&&/[\uf700-\uf7ff]/.test(o))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var I=o.charCodeAt(0);if(I==8203&&!i&&(i="\u200B"),I==8666)return this.reset(),this.cm.execCommand("undo")}for(var z=0,Y=Math.min(i.length,o.length);z<Y&&i.charCodeAt(z)==o.charCodeAt(z);)++z;return un(t,function(){za(t,o.slice(z),i.length-z,null,e.composing?"*compose":null),o.length>1e3||o.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=o,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Mi.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Mi.prototype.onKeyPress=function(){V&&H>=9&&(this.hasSelection=null),this.fastPoll()},Mi.prototype.onContextMenu=function(e){var t=this,n=t.cm,i=n.display,o=t.textarea;t.contextMenuPending&&t.contextMenuPending();var I=Kn(n,e),z=i.scroller.scrollTop;if(!I||v)return;var Y=n.options.resetSelectionOnContextMenu;Y&&n.doc.sel.contains(I)==-1&&Hi(n,Qi)(n.doc,Mn(I),de);var q=o.style.cssText,ee=t.wrapper.style.cssText,he=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",o.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-he.top-5)+"px; left: "+(e.clientX-he.left-5)+`px;
|
|
z-index: 1000; background: `+(V?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ve;k&&(ve=window.scrollY),i.input.focus(),k&&window.scrollTo(null,ve),i.input.reset(),n.somethingSelected()||(o.value=t.prevInput=" "),t.contextMenuPending=we,i.selForContextMenu=n.doc.sel,clearTimeout(i.detectingSelectAll);function Ce(){if(o.selectionStart!=null){var Ke=n.somethingSelected(),Je="\u200B"+(Ke?o.value:"");o.value="\u21DA",o.value=Je,t.prevInput=Ke?"":"\u200B",o.selectionStart=1,o.selectionEnd=Je.length,i.selForContextMenu=n.doc.sel}}function we(){if(t.contextMenuPending!=we)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ee,o.style.cssText=q,V&&H<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=z),o.selectionStart!=null){(!V||V&&H<9)&&Ce();var Ke=0,Je=function(){i.selForContextMenu==n.doc.sel&&o.selectionStart==0&&o.selectionEnd>0&&t.prevInput=="\u200B"?Hi(n,Vs)(n):Ke++<10?i.detectingSelectAll=setTimeout(Je,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(Je,200)}}if(V&&H>=9&&Ce(),A){ge(e);var Ne=function(){nt(window,"mouseup",Ne),setTimeout(we,20)};Ie(window,"mouseup",Ne)}else setTimeout(we,50)},Mi.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Mi.prototype.setUneditable=function(){},Mi.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?S(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=P();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function i(){e.value=Y.getValue()}var o;if(e.form&&(Ie(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var I=e.form;o=I.submit;try{var z=I.submit=function(){i(),I.submit=o,I.submit(),I.submit=z}}catch(q){}}t.finishInit=function(q){q.save=i,q.getTextArea=function(){return e},q.toTextArea=function(){q.toTextArea=isNaN,i(),e.parentNode.removeChild(q.getWrapperElement()),e.style.display="",e.form&&(nt(e.form,"submit",i),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=o))}},e.style.display="none";var Y=Ai(function(q){return e.parentNode.insertBefore(q,e.nextSibling)},t);return Y}function ru(e){e.off=nt,e.on=Ie,e.wheelEventPixels=cl,e.Doc=an,e.splitLines=tt,e.countColumn=B,e.findColumn=me,e.isWordChar=Ue,e.Pass=_e,e.signal=Oe,e.Line=Rn,e.changeEnd=Nn,e.scrollbarModel=xs,e.Pos=De,e.cmpPos=gt,e.modes=Qt,e.mimeModes=Tt,e.resolveMode=xe,e.getMode=Dt,e.modeExtensions=Ut,e.extendMode=Ft,e.copyState=At,e.startState=di,e.innerMode=ei,e.commands=Ur,e.keyMap=Ln,e.keyName=lo,e.isModifierKey=so,e.lookupKey=cr,e.normalizeKeyMap=Dl,e.StringStream=Bt,e.SharedTextMarker=Pr,e.TextMarker=Fn,e.LineWidget=Dr,e.e_preventDefault=ie,e.e_stopPropagation=re,e.e_stop=ge,e.addClass=M,e.contains=b,e.rmClass=T,e.keyNames=Bn}$l(Ai),ql(Ai);var au="iter insert remove copy getEditor constructor".split(" ");for(var ua in an.prototype)an.prototype.hasOwnProperty(ua)&&te(au,ua)<0&&(Ai.prototype[ua]=function(e){return function(){return e.apply(this.doc,arguments)}}(an.prototype[ua]));return pe(an),Ai.inputStyles={textarea:Mi,contenteditable:_i},Ai.defineMode=function(e){!Ai.defaults.mode&&e!="null"&&(Ai.defaults.mode=e),qe.apply(this,arguments)},Ai.defineMIME=Oi,Ai.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ai.defineMIME("text/plain","null"),Ai.defineExtension=function(e,t){Ai.prototype[e]=t},Ai.defineDocExtension=function(e,t){an.prototype[e]=t},Ai.fromTextArea=nu,ru(Ai),Ai.version="5.58.2",Ai})},Y1PL:function(Mt,st,ne){"use strict";ne.r(st),ne.d(st,"ResizableTextArea",function(){return te});var oe=ne("wx14"),Z=ne("1OyB"),D=ne("vuIU"),$=ne("Ji7U"),j=ne("LK+K"),F=ne("q1tI"),V=ne("VTBJ"),H=ne("rePB"),k=ne("Zm9Q"),L=ne("Kwbf"),y=ne("c+Xe"),v=ne("m+aA"),p=ne("bdgK"),c=new Map;function h(de){de.forEach(function(Ee){var Te,me=Ee.target;(Te=c.get(me))===null||Te===void 0||Te.forEach(function(ce){return ce(me)})})}var d=new p.default(h),l=null,s=null;function u(de,Ee){c.has(de)||(c.set(de,new Set),d.observe(de)),c.get(de).add(Ee)}function f(de,Ee){c.has(de)&&(c.get(de).delete(Ee),c.get(de).size||(d.unobserve(de),c.delete(de)))}var O=function(de){Object($.a)(Te,de);var Ee=Object(j.a)(Te);function Te(){return Object(Z.a)(this,Te),Ee.apply(this,arguments)}return Object(D.a)(Te,[{key:"render",value:function(){return this.props.children}}]),Te}(F.Component),x=F.createContext(null);function w(de){var Ee=de.children,Te=de.onBatchResize,me=F.useRef(0),ce=F.useRef([]),se=F.useContext(x),Se=F.useCallback(function(je,We,Xe){me.current+=1;var Qe=me.current;ce.current.push({size:je,element:We,data:Xe}),Promise.resolve().then(function(){Qe===me.current&&(Te==null||Te(ce.current),ce.current=[])}),se==null||se(je,We,Xe)},[Te,se]);return F.createElement(x.Provider,{value:Se},Ee)}function A(de){var Ee=de.children,Te=de.disabled,me=F.useRef(null),ce=F.useRef(null),se=F.useContext(x),Se=F.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),je=F.isValidElement(Ee)&&Object(y.c)(Ee),We=je?Ee.ref:null,Xe=F.useMemo(function(){return Object(y.a)(We,me)},[We,me]),Qe=F.useRef(de);Qe.current=de;var Pe=F.useCallback(function(Ue){var Ye=Qe.current,Ze=Ye.onResize,Ve=Ye.data,He=Ue.getBoundingClientRect(),Fe=He.width,ft=He.height,lt=Ue.offsetWidth,rt=Ue.offsetHeight,dt=Math.floor(Fe),bt=Math.floor(ft);if(Se.current.width!==dt||Se.current.height!==bt||Se.current.offsetWidth!==lt||Se.current.offsetHeight!==rt){var ut={width:dt,height:bt,offsetWidth:lt,offsetHeight:rt};Se.current=ut;var at=lt===Math.round(Fe)?Fe:lt,Ie=rt===Math.round(ft)?ft:rt,yt=Object(V.a)(Object(V.a)({},ut),{},{offsetWidth:at,offsetHeight:Ie});se==null||se(yt,Ue,Ve),Ze&&Promise.resolve().then(function(){Ze(yt,Ue)})}},[]);return F.useEffect(function(){var Ue=Object(v.a)(me.current)||Object(v.a)(ce.current);return Ue&&!Te&&u(Ue,Pe),function(){return f(Ue,Pe)}},[me.current,Te]),F.createElement(O,{ref:ce},je?F.cloneElement(Ee,{ref:Xe}):Ee)}var R="rc-observer-key";function T(de){var Ee=de.children,Te=Object(k.a)(Ee);return Te.map(function(me,ce){var se=(me==null?void 0:me.key)||"".concat(R,"-").concat(ce);return F.createElement(A,Object(oe.a)({},de,{key:se}),me)})}T.Collection=w;var E=T,g=ne("bT9E"),a=ne("TSYQ"),m=ne.n(a),r=`
|
|
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
|
|
`,b=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],P={},M;function W(de){var Ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=de.getAttribute("id")||de.getAttribute("data-reactid")||de.getAttribute("name");if(Ee&&P[Te])return P[Te];var me=window.getComputedStyle(de),ce=me.getPropertyValue("box-sizing")||me.getPropertyValue("-moz-box-sizing")||me.getPropertyValue("-webkit-box-sizing"),se=parseFloat(me.getPropertyValue("padding-bottom"))+parseFloat(me.getPropertyValue("padding-top")),Se=parseFloat(me.getPropertyValue("border-bottom-width"))+parseFloat(me.getPropertyValue("border-top-width")),je=b.map(function(Xe){return"".concat(Xe,":").concat(me.getPropertyValue(Xe))}).join(";"),We={sizingStyle:je,paddingSize:se,borderSize:Se,boxSizing:ce};return Ee&&Te&&(P[Te]=We),We}function X(de){var Ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;M||(M=document.createElement("textarea"),M.setAttribute("tab-index","-1"),M.setAttribute("aria-hidden","true"),document.body.appendChild(M)),de.getAttribute("wrap")?M.setAttribute("wrap",de.getAttribute("wrap")):M.removeAttribute("wrap");var ce=W(de,Ee),se=ce.paddingSize,Se=ce.borderSize,je=ce.boxSizing,We=ce.sizingStyle;M.setAttribute("style","".concat(We,";").concat(r)),M.value=de.value||de.placeholder||"";var Xe=Number.MIN_SAFE_INTEGER,Qe=Number.MAX_SAFE_INTEGER,Pe=M.scrollHeight,Ue;if(je==="border-box"?Pe+=Se:je==="content-box"&&(Pe-=se),Te!==null||me!==null){M.value=" ";var Ye=M.scrollHeight-se;Te!==null&&(Xe=Ye*Te,je==="border-box"&&(Xe=Xe+se+Se),Pe=Math.max(Xe,Pe)),me!==null&&(Qe=Ye*me,je==="border-box"&&(Qe=Qe+se+Se),Ue=Pe>Qe?"":"hidden",Pe=Math.min(Qe,Pe))}return{height:Pe,minHeight:Xe,maxHeight:Qe,overflowY:Ue,resize:"none"}}var U=ne("Gytx"),S=ne.n(U),B;(function(de){de[de.NONE=0]="NONE",de[de.RESIZING=1]="RESIZING",de[de.RESIZED=2]="RESIZED"})(B||(B={}));var J=function(de){Object($.a)(Te,de);var Ee=Object(j.a)(Te);function Te(me){var ce;return Object(Z.a)(this,Te),ce=Ee.call(this,me),ce.nextFrameActionId=void 0,ce.resizeFrameId=void 0,ce.textArea=void 0,ce.saveTextArea=function(se){ce.textArea=se},ce.handleResize=function(se){var Se=ce.state.resizeStatus,je=ce.props,We=je.autoSize,Xe=je.onResize;if(Se!==B.NONE)return;typeof Xe=="function"&&Xe(se),We&&ce.resizeOnNextFrame()},ce.resizeOnNextFrame=function(){cancelAnimationFrame(ce.nextFrameActionId),ce.nextFrameActionId=requestAnimationFrame(ce.resizeTextarea)},ce.resizeTextarea=function(){var se=ce.props.autoSize;if(!se||!ce.textArea)return;var Se=se.minRows,je=se.maxRows,We=X(ce.textArea,!1,Se,je);ce.setState({textareaStyles:We,resizeStatus:B.RESIZING},function(){cancelAnimationFrame(ce.resizeFrameId),ce.resizeFrameId=requestAnimationFrame(function(){ce.setState({resizeStatus:B.RESIZED},function(){ce.resizeFrameId=requestAnimationFrame(function(){ce.setState({resizeStatus:B.NONE}),ce.fixFirefoxAutoScroll()})})})})},ce.renderTextArea=function(){var se=ce.props,Se=se.prefixCls,je=Se===void 0?"rc-textarea":Se,We=se.autoSize,Xe=se.onResize,Qe=se.className,Pe=se.disabled,Ue=ce.state,Ye=Ue.textareaStyles,Ze=Ue.resizeStatus,Ve=Object(g.a)(ce.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),He=m()(je,Qe,Object(H.a)({},"".concat(je,"-disabled"),Pe));"value"in Ve&&(Ve.value=Ve.value||"");var Fe=Object(V.a)(Object(V.a)(Object(V.a)({},ce.props.style),Ye),Ze===B.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return F.createElement(E,{onResize:ce.handleResize,disabled:!(We||Xe)},F.createElement("textarea",Object(oe.a)({},Ve,{className:He,style:Fe,ref:ce.saveTextArea})))},ce.state={textareaStyles:{},resizeStatus:B.NONE},ce}return Object(D.a)(Te,[{key:"componentDidUpdate",value:function(ce){(ce.value!==this.props.value||!S()(ce.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var ce=this.textArea.selectionStart,se=this.textArea.selectionEnd;this.textArea.setSelectionRange(ce,se)}}catch(Se){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Te}(F.Component),te=J,ae=function(de){Object($.a)(Te,de);var Ee=Object(j.a)(Te);function Te(me){var ce;Object(Z.a)(this,Te),ce=Ee.call(this,me),ce.resizableTextArea=void 0,ce.focus=function(){ce.resizableTextArea.textArea.focus()},ce.saveTextArea=function(Se){ce.resizableTextArea=Se},ce.handleChange=function(Se){var je=ce.props.onChange;ce.setValue(Se.target.value,function(){ce.resizableTextArea.resizeTextarea()}),je&&je(Se)},ce.handleKeyDown=function(Se){var je=ce.props,We=je.onPressEnter,Xe=je.onKeyDown;Se.keyCode===13&&We&&We(Se),Xe&&Xe(Se)};var se=typeof me.value=="undefined"||me.value===null?me.defaultValue:me.value;return ce.state={value:se},ce}return Object(D.a)(Te,[{key:"setValue",value:function(ce,se){"value"in this.props||this.setState({value:ce},se)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return F.createElement(te,Object(oe.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ce){return"value"in ce?{value:ce.value}:null}}]),Te}(F.Component),_e=st.default=ae},ZW9T:function(Mt,st,ne){"use strict";ne.d(st,"a",function(){return X});var oe=ne("k1fw"),Z=ne("miYZ"),D=ne("tsqr"),$=ne("rAM+"),j=ne("tJVT"),F=ne("PpiC"),V=ne("q1tI"),H=ne.n(V),k=ne("bdgK"),L=ne("oBTY"),y=ne("9og8"),v=ne("WmNS"),p=ne.n(v),c={keywords:["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"]},h={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
|
|
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
|
|
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},d={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","for","friend","gcnew","generic","goto","if","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`)},{label:"#include",content:'include "$0"'},{label:"printf",content:"printf($0)"},{label:"main",content:["int main () {"," $0","}"].join(`
|
|
`)},{label:"for",content:["for( ; ; ){"," $0","}"].join(`
|
|
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
|
|
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
|
|
`)},{label:"#include <iostream>",content:["#include <iostream>"].join(`
|
|
`)},{label:"#include <vector>",content:["#include <vector>"].join(`
|
|
`)},{label:"#include <sstream>",content:["#include <sstream>"].join(`
|
|
`)},{label:"#include <string>",content:["#include <string>"].join(`
|
|
`)},{label:"#include <cmath>",content:["#include <cmath>"].join(`
|
|
`)}]},l={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
|
|
`)}]},s=ne("5VLF"),u=ne.n(s),f={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},O=function(S,B){return B.map(function(J){return{label:J,kind:S.languages.CompletionItemKind.Keyword,insertText:J}})},x=function(S){return Object.keys(f.tables).map(function(B){return{label:B,kind:S.languages.CompletionItemKind.Variable,insertText:B}})},w=function(S,B){var J=f.tables[S];return J?J.map(function(te){return{label:te,kind:B.languages.CompletionItemKind.Field,insertText:te}}):[]};function A(U,S,B,J,te){var ae=S.getWordUntilPosition(B),_e={startLineNumber:B.lineNumber,endLineNumber:B.lineNumber,startColumn:ae.startColumn,endColumn:ae.endColumn},de=J.map(function(Ee){return{label:Ee,kind:U.languages.CompletionItemKind.Keyword,insertText:Ee,insertTextRules:U.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:_e}});return te.map(function(Ee){de.push(Object(oe.a)(Object(oe.a)({},Ee),{},{range:_e}))}),de}var R=function(U){f.languages.map(function(te){return U.languages.registerDocumentFormattingEditProvider(te,{provideDocumentFormattingEdits:function(_e,de,Ee){return Object(y.a)(p.a.mark(function Te(){var me;return p.a.wrap(function(se){for(;;)switch(se.prev=se.next){case 0:return me=u()(_e.getValue(),{indent_size:"2",indent_char:" ",max_preserve_newlines:"2",preserve_newlines:!0,keep_array_indentation:!0,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:"0",indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1}),se.abrupt("return",[{range:_e.getFullModelRange(),text:me}]);case 2:case"end":return se.stop()}},Te)}))()}}),te});var S=d.quickKey.map(function(te){return{label:te.label,kind:U.languages.CompletionItemKind.Method,insertText:te.content,insertTextRules:U.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),B=l.quickKey.map(function(te){return{label:te.label,kind:U.languages.CompletionItemKind.Method,insertText:te.content,insertTextRules:U.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),J=h.quickKey.map(function(te){return{label:te.label,kind:U.languages.CompletionItemKind.Method,insertText:te.content,insertTextRules:U.languages.CompletionItemInsertTextRule.InsertAsSnippet}});U.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(L.a)(d.keywords),Object(L.a)(d.quickKey.map(function(te){return te.label}))),provideCompletionItems:function(ae,_e){var de=ae.getValueInRange({startLineNumber:_e.lineNumber,startColumn:1,endLineNumber:_e.lineNumber,endColumn:_e.column}),Ee=de.match(/cu/gim);console.log("match:",Ee,_e,de,ae);var Te=[],me=_e.lineNumber,ce=_e.column,se=ae.getValueInRange({startLineNumber:me,startColumn:0,endLineNumber:me,endColumn:ce}),Se=se.trim().split(/\s+/),je=Se[Se.length-1];if(je.endsWith(".")){var We=je.slice(0,je.length-1);Object.keys(f.tables).includes(We)&&(Te=Object(L.a)(w(We,U)))}else je==="."?Te=[]:Te=[].concat(Object(L.a)(x(U)),Object(L.a)(O(U,d.keywords)),Object(L.a)(S));return{suggestions:Te}}}),U.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(L.a)(c.keywords)),provideCompletionItems:function(ae,_e){var de=ae.getValueInRange({startLineNumber:_e.lineNumber,startColumn:1,endLineNumber:_e.lineNumber,endColumn:_e.column}),Ee=de.match(/cu/gim);console.log("match:",Ee,_e,de,ae);var Te=[],me=_e.lineNumber,ce=_e.column,se=ae.getValueInRange({startLineNumber:me,startColumn:0,endLineNumber:me,endColumn:ce}),Se=se.trim().split(/\s+/),je=Se[Se.length-1];if(je.endsWith(".")){var We=je.slice(0,je.length-1);Object.keys(f.tables).includes(We)&&(Te=Object(L.a)(w(We,U)))}else je==="."?Te=[]:Te=[].concat(Object(L.a)(x(U)),Object(L.a)(O(U,c.keywords)));return{suggestions:Te}}}),U.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(L.a)(h.keywords)),provideCompletionItems:function(ae,_e){var de=[],Ee=_e.lineNumber,Te=_e.column,me=ae.getValueInRange({startLineNumber:Ee,startColumn:0,endLineNumber:Ee,endColumn:Te}),ce=me.trim().split(/\s+/),se=ce[ce.length-1];if(se.endsWith(".")){var Se=se.slice(0,se.length-1);Object.keys(f.tables).includes(Se)&&(de=Object(L.a)(w(Se,U)))}else se==="."?de=[]:de=[].concat(Object(L.a)(x(U)),Object(L.a)(O(U,h.keywords)),Object(L.a)(J));return{suggestions:de}}}),U.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(L.a)(l.keywords)),provideCompletionItems:function(ae,_e){var de=[],Ee=_e.lineNumber,Te=_e.column,me=ae.getValueInRange({startLineNumber:Ee,startColumn:0,endLineNumber:Ee,endColumn:Te}),ce=me.trim().split(/\s+/),se=ce[ce.length-1];if(se.endsWith(".")){var Se=se.slice(0,se.length-1);Object.keys(f.tables).includes(Se)&&(de=Object(L.a)(w(Se,U)))}else se==="."?de=[]:de=[].concat(Object(L.a)(x(U)),Object(L.a)(O(U,l.keywords)),Object(L.a)(B));return{suggestions:de}}})},T="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",E=ne("LvDl"),g=ne("+ua5");function a(U){return/^\d+$/.test(U)?"".concat(U,"px"):U}function m(){}var r=!1,b={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function P(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],S=U;if(Array.isArray(U)){for(var B=0;B<U.length;B++){var J=b[U[B]];if(J)return J}return S[0]}return b[S]||S}var M=null,W=st.b=function(U){var S=U.width,B=S===void 0?"100%":S,J=U.height,te=J===void 0?"100%":J,ae=U.value,_e=U.language,de=_e===void 0?"javascript":_e,Ee=U.style,Te=Ee===void 0?{}:Ee,me=U.options,ce=me===void 0?{}:me,se=U.overrideServices,Se=se===void 0?{}:se,je=U.theme,We=je===void 0?"vs-dark":je,Xe=U.onEditBlur,Qe=U.onSave,Pe=U.autoHeight,Ue=Pe===void 0?!1:Pe,Ye=U.forbidCopy,Ze=Ye===void 0?!1:Ye,Ve=U.onChange,He=Ve===void 0?m:Ve,Fe=U.editorDidMount,ft=Fe===void 0?m:Fe,lt=U.onFocus,rt=lt===void 0?m:lt,dt=U.filename,bt=dt===void 0?"educoder.txt":dt,ut=U.errorLine,at=U.errorContent,Ie=at===void 0?"":at,yt=Object(F.a)(U,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),nt=Object(V.useRef)(),Oe=Object(V.useRef)({}),Ge=Object(V.useRef)(),be=Object(V.useRef)(!1),fe=Object(V.useRef)(),pe=Object(V.useState)(!1),ie=Object(j.a)(pe,2),re=ie[0],ue=ie[1];function ge(){var xe;return nt.current&&(xe=new k.default(function(Dt){var Ut=Object($.a)(Dt),Ft;try{for(Ut.s();!(Ft=Ut.n()).done;){var At=Ft.value;(At.target.offsetHeight>0||At.target.offsetWidth>0)&&Oe.current.instance.layout()}}catch(ei){Ut.e(ei)}finally{Ut.f()}}),xe.observe(nt.current)),xe}function ye(){D.b.warn(decodeURIComponent(T))}var Le=function(){var Dt=Oe.current.instance;if(ae!=null&&Dt&&re){var Ut=Dt.getModel();Ut&&ae!==Ut.getValue()&&(r=!0,Ut.setValue(ae),Dt.layout(),r=!1)}};Object(V.useEffect)(function(){Ge.current&&clearTimeout(Ge.current),Ge.current=setTimeout(function(){Le()},500)},[ae,re,Oe.current]),Object(V.useEffect)(function(){if(ut&&Oe.current&&Oe.current.instance){var xe=Oe.current.instance;xe.changeViewZones(function(Ut){var Ft=document.createElement("div");Ft.style.padding="10px 20px",Ft.style.width="calc(100% - 20px)",Ft.className="my-error-line-wrp",Ft.innerHTML=Ie,Ut.addZone({afterLineNumber:ut||11,heightInLines:3,domNode:Ft})});var Dt={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};xe.addOverlayWidget(Dt),xe.revealPositionInCenter({lineNumber:20,column:1})}},[ut,Oe.current,re]);function Be(){var xe=Oe.current.instance;if(xe){var Dt=xe.getSelection(),Ut=Oe.current.pastePos||{},Ft=new M.Range(Ut.startLineNumber||Dt.endLineNumber,Ut.startColumn||Dt.endColumn,Ut.endLineNumber||Dt.endLineNumber,Ut.endColumn||Dt.endColumn);setTimeout(function(){xe.executeEdits("",[{range:Ft,text:""}])},300)}}function pt(xe){(window.navigator.platform.match("Mac")?xe.metaKey:xe.ctrlKey)&&xe.keyCode==83&&(xe.preventDefault(),Qe())}var It=function(){if(Ue&&Oe.current.instance){var Dt=Oe.current.instance.getContentHeight();qe(Dt<te?te:Dt)}else qe(te)};function Lt(xe){var Dt=document.createEvent("MouseEvents");Dt.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),xe.dispatchEvent(Dt)}function Vt(xe,Dt){var Ut=window.URL||window.webkitURL||window,Ft=new Blob([Dt]),At=document.createElementNS("http://www.w3.org/1999/xhtml","a");At.href=Ut.createObjectURL(Ft),At.download=xe,Lt(At)}Object(V.useEffect)(function(){It()},[It]),Object(V.useEffect)(function(){nt.current&&!re&&ne.e(27).then(ne.t.bind(null,"M/lh",7)).then(function(xe){try{M=xe,Oe.current.instance=M.editor.create(nt.current,{value:ae,language:P(de),theme:We,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},Se);var Dt=Oe.current.instance;if(ft(Dt,M),setTimeout(function(){It(),Oe.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Vt(bt||"educoder.txt",Dt.getValue())}})},500),Oe.current.subscription=Dt.onDidChangeModelContent(function(Ft){be.current?clearTimeout(fe.current):(It(),He(Dt.getValue(),Ft)),fe.current=setTimeout(function(){be.current=!1},500)}),window.Monaco||R(M),Ze&&(Dt.addCommand(M.KeyMod.CtrlCmd|M.KeyMod.Shift|M.KeyCode.KEY_V,function(){return ye(),null}),Dt.addCommand(M.KeyMod.CtrlCmd|M.KeyCode.KEY_C,function(){return ye(),null})),window.Monaco=M,Xe&&Dt.onDidBlurEditorWidget(function(){Xe(Dt.getValue())}),rt&&Dt.onDidFocusEditorText(function(){rt(Dt.getValue())}),Ze){Dt.addCommand(M.KeyMod.CtrlCmd|M.KeyCode.KEY_V,function(){return ye(),null}),Dt.onDidPaste(function(Ft){Oe.current.pastePos=Ft});try{window.addEventListener("paste",Be)}catch(Ft){}}var Ut=ge();return ue(!0),function(){var Ft=Oe.current.instance;Ft.dispose();var At=Ft.getModel();At&&At.dispose(),Oe.current.subscription&&Oe.current.subscription.dispose(),Ze&&window.removeEventListener("paste",Be),Ut.unobserve(nt.current)}}catch(Ft){}})},[]),Object(V.useEffect)(function(){var xe=Oe.current.instance;if(xe&&re)return document.addEventListener("keydown",pt,!1),function(){document.removeEventListener("keydown",pt)}},[Qe,re]),Object(V.useEffect)(function(){var xe=Oe.current.instance;if(xe&&re){var Dt=P(de);M.editor.setModelLanguage(xe.getModel(),Dt),console.log("language:",de,xe.getModel(),Dt)}},[de,re]),Object(V.useEffect)(function(){var xe=Oe.current.instance;xe&&re&&M.editor.setTheme(We)},[We,re]),Object(V.useEffect)(function(){var xe=Oe.current.instance;xe&&re&&(xe.updateOptions(Object(oe.a)({},ce)),setTimeout(function(){xe.getModel().updateOptions(Object(oe.a)({},ce))},200))},[JSON.stringify(ce),re]),Object(V.useEffect)(function(){var xe=Oe.current.instance;xe&&re&&xe.layout()},[B,te,re]);var tt=Object(V.useState)(a(B)),ke=Object(j.a)(tt,2),Ct=ke[0],Rt=ke[1],ni=Object(V.useState)(a(te)),Qt=Object(j.a)(ni,2),Tt=Qt[0],qe=Qt[1],Oi=Object(oe.a)(Object(oe.a)({},Te),{},{width:Ct,height:Tt});return H.a.createElement("div",{className:"my-monaco-editor",ref:nt,style:Oi})};function X(U){var S=U.width,B=S===void 0?"100%":S,J=U.height,te=J===void 0?"100%":J,ae=U.original,_e=U.modified,de=U.language,Ee=U.options,Te=Ee===void 0?{}:Ee,me=Object(V.useRef)(),ce=Object(V.useState)(null),se=Object(j.a)(ce,2),Se=se[0],je=se[1];function We(Ue){var Ye;return me.current&&(Ye=new k.default(function(Ze){var Ve=Object($.a)(Ze),He;try{for(Ve.s();!(He=Ve.n()).done;){var Fe=He.value;(Fe.target.offsetHeight>0||Fe.target.offsetWidth>0)&&Ue.layout()}}catch(ft){Ve.e(ft)}finally{Ve.f()}}),Ye.observe(me.current)),Ye}Object(V.useEffect)(function(){me.current&&ne.e(27).then(ne.t.bind(null,"M/lh",7)).then(function(Ue){M=Ue;var Ye=M.editor.createDiffEditor(me.current,Object(oe.a)(Object(oe.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},Te),{},{wordWrap:!0}));je(Ye);var Ze=We(Ye);return function(){Ye.dispose();var Ve=Ye.getModel();Ve&&Ve.dispose(),Ze.unobserve(me.current)}})},[]),Object(V.useEffect)(function(){Se&&Se.setModel({original:M.editor.createModel(ae,de),modified:M.editor.createModel(_e,de)})},[ae,_e,de,Se]);var Xe=a(B),Qe=a(te),Pe={width:Xe,height:Qe};return H.a.createElement("div",{className:"my-diff-editor",ref:me,style:Pe})}},ZpRC:function(Mt,st,ne){"use strict";function oe(y){return typeof y=="object"&&y!=null&&y.nodeType===1}function Z(y,v){return(!v||y!=="hidden")&&y!=="visible"&&y!=="clip"}function D(y,v){if(y.clientHeight<y.scrollHeight||y.clientWidth<y.scrollWidth){var p=getComputedStyle(y,null);return Z(p.overflowY,v)||Z(p.overflowX,v)||function(c){var h=function(d){if(!d.ownerDocument||!d.ownerDocument.defaultView)return null;try{return d.ownerDocument.defaultView.frameElement}catch(l){return null}}(c);return!!h&&(h.clientHeight<c.scrollHeight||h.clientWidth<c.scrollWidth)}(y)}return!1}function $(y,v,p,c,h,d,l,s){return d<y&&l>v||d>y&&l<v?0:d<=y&&s<=p||l>=v&&s>=p?d-y-c:l>v&&s<p||d<y&&s>p?l-v+h:0}var j=function(y,v){var p=window,c=v.scrollMode,h=v.block,d=v.inline,l=v.boundary,s=v.skipOverflowHiddenElements,u=typeof l=="function"?l:function(Ye){return Ye!==l};if(!oe(y))throw new TypeError("Invalid target");for(var f=document.scrollingElement||document.documentElement,O=[],x=y;oe(x)&&u(x);){if((x=x.parentElement)===f){O.push(x);break}x!=null&&x===document.body&&D(x)&&!D(document.documentElement)||x!=null&&D(x,s)&&O.push(x)}for(var w=p.visualViewport?p.visualViewport.width:innerWidth,A=p.visualViewport?p.visualViewport.height:innerHeight,R=window.scrollX||pageXOffset,T=window.scrollY||pageYOffset,E=y.getBoundingClientRect(),g=E.height,a=E.width,m=E.top,r=E.right,b=E.bottom,P=E.left,M=h==="start"||h==="nearest"?m:h==="end"?b:m+g/2,W=d==="center"?P+a/2:d==="end"?r:P,X=[],U=0;U<O.length;U++){var S=O[U],B=S.getBoundingClientRect(),J=B.height,te=B.width,ae=B.top,_e=B.right,de=B.bottom,Ee=B.left;if(c==="if-needed"&&m>=0&&P>=0&&b<=A&&r<=w&&m>=ae&&b<=de&&P>=Ee&&r<=_e)return X;var Te=getComputedStyle(S),me=parseInt(Te.borderLeftWidth,10),ce=parseInt(Te.borderTopWidth,10),se=parseInt(Te.borderRightWidth,10),Se=parseInt(Te.borderBottomWidth,10),je=0,We=0,Xe="offsetWidth"in S?S.offsetWidth-S.clientWidth-me-se:0,Qe="offsetHeight"in S?S.offsetHeight-S.clientHeight-ce-Se:0;if(f===S)je=h==="start"?M:h==="end"?M-A:h==="nearest"?$(T,T+A,A,ce,Se,T+M,T+M+g,g):M-A/2,We=d==="start"?W:d==="center"?W-w/2:d==="end"?W-w:$(R,R+w,w,me,se,R+W,R+W+a,a),je=Math.max(0,je+T),We=Math.max(0,We+R);else{je=h==="start"?M-ae-ce:h==="end"?M-de+Se+Qe:h==="nearest"?$(ae,de,J,ce,Se+Qe,M,M+g,g):M-(ae+J/2)+Qe/2,We=d==="start"?W-Ee-me:d==="center"?W-(Ee+te/2)+Xe/2:d==="end"?W-_e+se+Xe:$(Ee,_e,te,me,se+Xe,W,W+a,a);var Pe=S.scrollLeft,Ue=S.scrollTop;M+=Ue-(je=Math.max(0,Math.min(Ue+je,S.scrollHeight-J+Qe))),W+=Pe-(We=Math.max(0,Math.min(Pe+We,S.scrollWidth-te+Xe)))}X.push({el:S,top:je,left:We})}return X};function F(y){return y===Object(y)&&Object.keys(y).length!==0}function V(y,v){v===void 0&&(v="auto");var p="scrollBehavior"in document.body.style;y.forEach(function(c){var h=c.el,d=c.top,l=c.left;h.scroll&&p?h.scroll({top:d,left:l,behavior:v}):(h.scrollTop=d,h.scrollLeft=l)})}function H(y){return y===!1?{block:"end",inline:"nearest"}:F(y)?y:{block:"start",inline:"nearest"}}function k(y,v){var p=!y.ownerDocument.documentElement.contains(y);if(F(v)&&typeof v.behavior=="function")return v.behavior(p?[]:j(y,v));if(p)return;var c=H(v);return V(j(y,c),c.behavior)}var L=st.a=k},bT9E:function(Mt,st,ne){"use strict";ne.d(st,"a",function(){return Z});var oe=ne("VTBJ");function Z(D,$){var j=Object(oe.a)({},D);return Array.isArray($)&&$.forEach(function(F){delete j[F]}),j}},c5Ni:function(Mt,st,ne){},dejd:function(Mt,st,ne){},dmUQ:function(Mt,st,ne){"use strict";var oe=ne("Ff2n"),Z=ne("rePB"),D=ne("1OyB"),$=ne("vuIU"),j=ne("Ji7U"),F=ne("md7G"),V=ne("foSv"),H=ne("q1tI"),k=ne.n(H),L=ne("TSYQ"),y=ne.n(L),v=ne("4IlW");function p(g,a){var m=Object.keys(g);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(g);a&&(r=r.filter(function(b){return Object.getOwnPropertyDescriptor(g,b).enumerable})),m.push.apply(m,r)}return m}function c(g){for(var a=1;a<arguments.length;a++){var m=arguments[a]!=null?arguments[a]:{};a%2?p(Object(m),!0).forEach(function(r){Object(Z.a)(g,r,m[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(m)):p(Object(m)).forEach(function(r){Object.defineProperty(g,r,Object.getOwnPropertyDescriptor(m,r))})}return g}function h(g){var a=d();return function(){var r=Object(V.a)(g),b;if(a){var P=Object(V.a)(this).constructor;b=Reflect.construct(r,arguments,P)}else b=r.apply(this,arguments);return Object(F.a)(this,b)}}function d(){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(g){return!1}}function l(){}function s(g){g.preventDefault()}var u=function(a){return a.replace(/[^\w.-]+/g,"")},f=200,O=600,x=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,w=function(a){return a!=null},A=function(a,m){return m===a||typeof m=="number"&&typeof a=="number"&&isNaN(m)&&isNaN(a)},R=function(g){Object(j.a)(m,g);var a=h(m);function m(r){var b;Object(D.a)(this,m),b=a.call(this,r),b.onKeyDown=function(W){var X=b.props,U=X.onKeyDown,S=X.onPressEnter;if(W.keyCode===v.a.UP){var B=b.getRatio(W);b.up(W,B,null),b.stop()}else if(W.keyCode===v.a.DOWN){var J=b.getRatio(W);b.down(W,J,null),b.stop()}else W.keyCode===v.a.ENTER&&S&&S(W);if(b.recordCursorPosition(),b.lastKeyCode=W.keyCode,U){for(var te=arguments.length,ae=new Array(te>1?te-1:0),_e=1;_e<te;_e++)ae[_e-1]=arguments[_e];U.apply(void 0,[W].concat(ae))}},b.onKeyUp=function(W){var X=b.props.onKeyUp;if(b.stop(),b.recordCursorPosition(),X){for(var U=arguments.length,S=new Array(U>1?U-1:0),B=1;B<U;B++)S[B-1]=arguments[B];X.apply(void 0,[W].concat(S))}},b.onChange=function(W){var X=b.props.onChange;b.state.focused&&(b.inputting=!0),b.rawInput=b.props.parser(b.getValueFromEvent(W)),b.setState({inputValue:b.rawInput}),X(b.toNumber(b.rawInput))},b.onMouseUp=function(){var W=b.props.onMouseUp;b.recordCursorPosition(),W&&W.apply(void 0,arguments)},b.onFocus=function(){var W;b.setState({focused:!0}),(W=b.props).onFocus.apply(W,arguments)},b.onBlur=function(){var W=b.props.onBlur;b.inputting=!1,b.setState({focused:!1});var X=b.getCurrentValidValue(b.state.inputValue),U=b.setValue(X,l);if(W){var S=b.input.value,B=b.getInputDisplayValue({focus:!1,value:U});b.input.value=B&&Number(B),W.apply(void 0,arguments),b.input.value=S}},b.getRatio=function(W){var X=1;return W.metaKey||W.ctrlKey?X=.1:W.shiftKey&&(X=10),X},b.getFullNum=function(W){return isNaN(W)?W:/e/i.test(String(W))?Number(W).toFixed(18).replace(/\.?0+$/,""):W},b.getPrecision=function(W){if(w(b.props.precision))return b.props.precision;var X=String(W);if(X.indexOf("e-")>=0)return parseInt(X.slice(X.indexOf("e-")+2),10);var U=0;return X.indexOf(".")>=0&&(U=X.length-X.indexOf(".")-1),U},b.getInputDisplayValue=function(W){var X=W||b.state,U=X.focused,S=X.inputValue,B=X.value,J;U?J=S:J=b.toPrecisionAsStep(B),J==null&&(J="");var te=b.formatWrapper(J);return w(b.props.decimalSeparator)&&(te=te.toString().replace(".",b.props.decimalSeparator)),te},b.recordCursorPosition=function(){try{b.cursorStart=b.input.selectionStart,b.cursorEnd=b.input.selectionEnd,b.currentValue=b.input.value,b.cursorBefore=b.input.value.substring(0,b.cursorStart),b.cursorAfter=b.input.value.substring(b.cursorEnd)}catch(W){}},b.restoreByAfter=function(W){if(W===void 0)return!1;var X=b.input.value,U=X.lastIndexOf(W);if(U===-1)return!1;var S=b.cursorBefore.length;return b.lastKeyCode===v.a.DELETE&&b.cursorBefore.charAt(S-1)===W[0]?(b.fixCaret(S,S),!0):U+W.length===X.length?(b.fixCaret(U,U),!0):!1},b.partRestoreByAfter=function(W){return W===void 0?!1:Array.prototype.some.call(W,function(X,U){var S=W.substring(U);return b.restoreByAfter(S)})},b.isNotCompleteNumber=function(W){return isNaN(W)||W===""||W===null||W&&W.toString().indexOf(".")===W.toString().length-1},b.stop=function(){b.autoStepTimer&&clearTimeout(b.autoStepTimer)},b.down=function(W,X,U){b.pressingUpOrDown=!0,b.step("down",W,X,U)},b.up=function(W,X,U){b.pressingUpOrDown=!0,b.step("up",W,X,U)},b.saveInput=function(W){b.input=W};var P=r.value;P===void 0&&(P=r.defaultValue),b.state={focused:r.autoFocus};var M=b.getValidValue(b.toNumber(P));return b.state=c(c({},b.state),{},{inputValue:b.toPrecisionAsStep(M),value:M}),b}return Object($.a)(m,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(b){var P=this.props,M=P.value,W=P.onChange,X=P.max,U=P.min,S=this.state.focused;if(b){if(!A(b.value,M)||!A(b.max,X)||!A(b.min,U)){var B=S?M:this.getValidValue(M),J;this.pressingUpOrDown?J=B:this.inputting?J=this.rawInput:J=this.toPrecisionAsStep(B),this.setState({value:B,inputValue:J})}var te="value"in this.props?M:this.state.value;"max"in this.props&&b.max!==X&&typeof te=="number"&&te>X&&W&&W(X),"min"in this.props&&b.min!==U&&typeof te=="number"&&te<U&&W&&W(U)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ae=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===v.a.BACKSPACE?ae=this.cursorStart-1:this.lastKeyCode===v.a.DELETE&&(ae=this.cursorStart):ae=this.input.value.length,this.fixCaret(ae,ae)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case v.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case v.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(_e){}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(b){var P=b;return P===""?P="":this.isNotCompleteNumber(parseFloat(P))?P=this.state.value:P=this.getValidValue(P),this.toNumber(P)}},{key:"getValueFromEvent",value:function(b){var P=b.target.value.trim().replace(/。/g,".");return w(this.props.decimalSeparator)&&(P=P.replace(this.props.decimalSeparator,".")),P}},{key:"getValidValue",value:function(b){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,W=parseFloat(b);return isNaN(W)?b:(W<P&&(W=P),W>M&&(W=M),W)}},{key:"setValue",value:function(b,P){var M=this.props.precision,W=this.isNotCompleteNumber(parseFloat(b))?null:parseFloat(b),X=this.state.value,U=X===void 0?null:X,S=this.state.inputValue,B=S===void 0?null:S,J=typeof W=="number"?W.toFixed(M):"".concat(W),te=W!==U||J!=="".concat(B);return"value"in this.props?(B=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:B},P)):this.setState({value:W,inputValue:this.toPrecisionAsStep(b)},P),te&&this.props.onChange(W),W}},{key:"getMaxPrecision",value:function(b){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,M=this.props,W=M.precision,X=M.step;if(w(W))return W;var U=this.getPrecision(P),S=this.getPrecision(X),B=this.getPrecision(b);return b?Math.max(B,U+S):U+S}},{key:"getPrecisionFactor",value:function(b){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,M=this.getMaxPrecision(b,P);return Math.pow(10,M)}},{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(b){return this.props.formatter?this.props.formatter(b):b}},{key:"toPrecisionAsStep",value:function(b){if(this.isNotCompleteNumber(b)||b==="")return b;var P=Math.abs(this.getMaxPrecision(b));return isNaN(P)?b.toString():Number(b).toFixed(P)}},{key:"toNumber",value:function(b){var P=this.props.precision,M=this.state.focused,W=b&&b.length>16&&M;return this.isNotCompleteNumber(b)||W?b:w(P)?Math.round(b*Math.pow(10,P))/Math.pow(10,P):Number(b)}},{key:"upStep",value:function(b,P){var M=this.props.step,W=this.getPrecisionFactor(b,P),X=Math.abs(this.getMaxPrecision(b,P)),U=((W*b+W*M*P)/W).toFixed(X);return this.toNumber(U)}},{key:"downStep",value:function(b,P){var M=this.props.step,W=this.getPrecisionFactor(b,P),X=Math.abs(this.getMaxPrecision(b,P)),U=((W*b-W*M*P)/W).toFixed(X);return this.toNumber(U)}},{key:"step",value:function(b,P){var M=this,W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,X=arguments.length>3?arguments[3]:void 0;this.stop(),P&&(P.persist(),P.preventDefault());var U=this.props;if(U.disabled)return;var S=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(S))return;var B=this["".concat(b,"Step")](S,W),J=B>U.max||B<U.min;if(B>U.max?B=U.max:B<U.min&&(B=U.min),this.setValue(B,null),this.setState({focused:!0},function(){M.pressingUpOrDown=!1}),J)return;this.autoStepTimer=setTimeout(function(){M[b](P,W,!0)},X?f:O)}},{key:"fixCaret",value:function(b,P){if(b===void 0||P===void 0||!this.input||!this.input.value)return;try{var M=this.input.selectionStart,W=this.input.selectionEnd;(b!==M||P!==W)&&this.input.setSelectionRange(b,P)}catch(X){}}},{key:"render",value:function(){var b,P=this.props,M=P.prefixCls,W=P.disabled,X=P.readOnly,U=P.useTouch,S=P.autoComplete,B=P.upHandler,J=P.downHandler,te=P.className,ae=P.max,_e=P.min,de=P.style,Ee=P.title,Te=P.onMouseEnter,me=P.onMouseLeave,ce=P.onMouseOver,se=P.onMouseOut,Se=P.required,je=P.onClick,We=P.tabIndex,Xe=P.type,Qe=P.placeholder,Pe=P.id,Ue=P.inputMode,Ye=P.pattern,Ze=P.step,Ve=P.maxLength,He=P.autoFocus,Fe=P.name,ft=P.onPaste,lt=P.onInput,rt=Object(oe.a)(P,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),dt=this.state,bt=dt.value,ut=dt.focused,at=y()(M,(b={},Object(Z.a)(b,te,!!te),Object(Z.a)(b,"".concat(M,"-disabled"),W),Object(Z.a)(b,"".concat(M,"-focused"),ut),b)),Ie={};Object.keys(rt).forEach(function(ge){(ge.substr(0,5)==="data-"||ge.substr(0,5)==="aria-"||ge==="role")&&(Ie[ge]=rt[ge])});var yt=!X&&!W,nt=this.getInputDisplayValue(null),Oe=(bt||bt===0)&&(isNaN(bt)||Number(bt)>=ae),Ge=(bt||bt===0)&&(isNaN(bt)||Number(bt)<=_e),be=Oe||W||X,fe=Ge||W||X,pe=y()("".concat(M,"-handler"),"".concat(M,"-handler-up"),Object(Z.a)({},"".concat(M,"-handler-up-disabled"),be)),ie=y()("".concat(M,"-handler"),"".concat(M,"-handler-down"),Object(Z.a)({},"".concat(M,"-handler-down-disabled"),fe)),re=U?{onTouchStart:be?l:this.up,onTouchEnd:this.stop}:{onMouseDown:be?l:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ue=U?{onTouchStart:fe?l:this.down,onTouchEnd:this.stop}:{onMouseDown:fe?l:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return k.a.createElement("div",{className:at,style:de,title:Ee,onMouseEnter:Te,onMouseLeave:me,onMouseOver:ce,onMouseOut:se,onFocus:function(){return null},onBlur:function(){return null}},k.a.createElement("div",{className:"".concat(M,"-handler-wrap")},k.a.createElement("span",Object.assign({unselectable:"on"},re,{role:"button","aria-label":"Increase Value","aria-disabled":be,className:pe}),B||k.a.createElement("span",{unselectable:"on",className:"".concat(M,"-handler-up-inner"),onClick:s})),k.a.createElement("span",Object.assign({unselectable:"on"},ue,{role:"button","aria-label":"Decrease Value","aria-disabled":fe,className:ie}),J||k.a.createElement("span",{unselectable:"on",className:"".concat(M,"-handler-down-inner"),onClick:s}))),k.a.createElement("div",{className:"".concat(M,"-input-wrap")},k.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":_e,"aria-valuemax":ae,"aria-valuenow":bt,required:Se,type:Xe,placeholder:Qe,onPaste:ft,onClick:je,onMouseUp:this.onMouseUp,className:"".concat(M,"-input"),tabIndex:We,autoComplete:S,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:yt?this.onKeyDown:l,onKeyUp:yt?this.onKeyUp:l,autoFocus:He,maxLength:Ve,readOnly:X,disabled:W,max:ae,min:_e,step:Ze,name:Fe,title:Ee,id:Pe,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(nt),pattern:Ye,inputMode:Ue,onInput:lt},Ie))))}}]),m}(k.a.Component);R.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:x,min:-x,step:1,style:{},onChange:l,onKeyDown:l,onPressEnter:l,onFocus:l,onBlur:l,parser:u,required:!1,autoComplete:"off"};var T=R,E=st.a=T},fcSX:function(Mt,st,ne){"use strict";var oe=ne("Ff2n"),Z=ne("1OyB"),D=ne("vuIU"),$=ne("Ji7U"),j=ne("md7G"),F=ne("foSv"),V=ne("1W/9"),H=ne("q1tI"),k=ne("rePB"),L=ne("JX7q"),y=ne("TSYQ"),v=ne.n(y),p=ne("qx4F"),c=ne("4IlW");function h(W){return Array.isArray(W)?W:[W]}var d={transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend"},l=Object.keys(d).filter(function(W){if(typeof document=="undefined")return!1;var X=document.getElementsByTagName("html")[0];return W in(X?X.style:{})})[0],s=d[l];function u(W,X,U,S){W.addEventListener?W.addEventListener(X,U,S):W.attachEvent&&W.attachEvent("on".concat(X),U)}function f(W,X,U,S){W.removeEventListener?W.removeEventListener(X,U,S):W.attachEvent&&W.detachEvent("on".concat(X),U)}function O(W,X){var U=typeof W=="function"?W(X):W;return Array.isArray(U)?U.length===2?U:[U[0],U[1]]:[U]}var x=function(X){return!isNaN(parseFloat(X))&&isFinite(X)},w=!(typeof window!="undefined"&&window.document&&window.document.createElement),A=function W(X,U,S,B){if(!U||U===document||U instanceof Document)return!1;if(U===X.parentNode)return!0;var J=Math.max(Math.abs(S),Math.abs(B))===Math.abs(B),te=Math.max(Math.abs(S),Math.abs(B))===Math.abs(S),ae=U.scrollHeight-U.clientHeight,_e=U.scrollWidth-U.clientWidth,de=document.defaultView.getComputedStyle(U),Ee=de.overflowY==="auto"||de.overflowY==="scroll",Te=de.overflowX==="auto"||de.overflowX==="scroll",me=ae&&Ee,ce=_e&&Te;return J&&(!me||me&&(U.scrollTop>=ae&&B<0||U.scrollTop<=0&&B>0))||te&&(!ce||ce&&(U.scrollLeft>=_e&&S<0||U.scrollLeft<=0&&S>0))?W(X,U.parentNode,S,B):!1};function R(W){var X=T();return function(){var S=Object(F.a)(W),B;if(X){var J=Object(F.a)(this).constructor;B=Reflect.construct(S,arguments,J)}else B=S.apply(this,arguments);return Object(j.a)(this,B)}}function T(){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(W){return!1}}var E={},g=function(W){Object($.a)(U,W);var X=R(U);function U(S){var B;return Object(Z.a)(this,U),B=X.call(this,S),B.domFocus=function(){B.dom&&B.dom.focus()},B.removeStartHandler=function(J){if(J.touches.length>1)return;B.startPos={x:J.touches[0].clientX,y:J.touches[0].clientY}},B.removeMoveHandler=function(J){if(J.changedTouches.length>1)return;var te=J.currentTarget,ae=J.changedTouches[0].clientX-B.startPos.x,_e=J.changedTouches[0].clientY-B.startPos.y;(te===B.maskDom||te===B.handlerDom||te===B.contentDom&&A(te,J.target,ae,_e))&&J.cancelable&&J.preventDefault()},B.transitionEnd=function(J){var te=J.target;f(te,s,B.transitionEnd),te.style.transition=""},B.onKeyDown=function(J){if(J.keyCode===c.a.ESC){var te=B.props.onClose;J.stopPropagation(),te&&te(J)}},B.onWrapperTransitionEnd=function(J){var te=B.props,ae=te.open,_e=te.afterVisibleChange;J.target===B.contentWrapper&&J.propertyName.match(/transform$/)&&(B.dom.style.transition="",!ae&&B.getCurrentDrawerSome()&&(document.body.style.overflowX="",B.maskDom&&(B.maskDom.style.left="",B.maskDom.style.width="")),_e&&_e(!!ae))},B.openLevelTransition=function(){var J=B.props,te=J.open,ae=J.width,_e=J.height,de=B.getHorizontalBoolAndPlacementName(),Ee=de.isHorizontal,Te=de.placementName,me=B.contentDom?B.contentDom.getBoundingClientRect()[Ee?"width":"height"]:0,ce=(Ee?ae:_e)||me;B.setLevelAndScrolling(te,Te,ce)},B.setLevelTransform=function(J,te,ae,_e){var de=B.props,Ee=de.placement,Te=de.levelMove,me=de.duration,ce=de.ease,se=de.showMask;B.levelDom.forEach(function(Se){Se.style.transition="transform ".concat(me," ").concat(ce),u(Se,s,B.transitionEnd);var je=J?ae:0;if(Te){var We=O(Te,{target:Se,open:J});je=J?We[0]:We[1]||0}var Xe=typeof je=="number"?"".concat(je,"px"):je,Qe=Ee==="left"||Ee==="top"?Xe:"-".concat(Xe);Qe=se&&Ee==="right"&&_e?"calc(".concat(Qe," + ").concat(_e,"px)"):Qe,Se.style.transform=je?"".concat(te,"(").concat(Qe,")"):""})},B.setLevelAndScrolling=function(J,te,ae){var _e=B.props.onChange;if(!w){var de=document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth?Object(p.a)(!0):0;B.setLevelTransform(J,te,ae,de),B.toggleScrollingToDrawerAndBody(de)}_e&&_e(J)},B.toggleScrollingToDrawerAndBody=function(J){var te=B.props,ae=te.getOpenCount,_e=te.getContainer,de=te.showMask,Ee=te.open,Te=_e&&_e(),me=ae&&ae();if(Te&&Te.parentNode===document.body&&de){var ce=["touchstart"],se=[document.body,B.maskDom,B.handlerDom,B.contentDom];Ee&&document.body.style.overflow!=="hidden"?(J&&B.addScrollingEffect(J),me===1&&(document.body.style.overflow="hidden"),document.body.style.touchAction="none",se.forEach(function(Se,je){if(!Se)return;u(Se,ce[je]||"touchmove",je?B.removeMoveHandler:B.removeStartHandler,B.passive)})):B.getCurrentDrawerSome()&&(me||(document.body.style.overflow=""),document.body.style.touchAction="",J&&B.remScrollingEffect(J),se.forEach(function(Se,je){if(!Se)return;f(Se,ce[je]||"touchmove",je?B.removeMoveHandler:B.removeStartHandler,B.passive)}))}},B.addScrollingEffect=function(J){var te=B.props,ae=te.placement,_e=te.duration,de=te.ease,Ee=te.getOpenCount,Te=te.switchScrollingEffect,me=Ee&&Ee();me===1&&Te();var ce="width ".concat(_e," ").concat(de),se="transform ".concat(_e," ").concat(de);B.dom.style.transition="none";switch(ae){case"right":B.dom.style.transform="translateX(-".concat(J,"px)");break;case"top":case"bottom":B.dom.style.width="calc(100% - ".concat(J,"px)"),B.dom.style.transform="translateZ(0)";break;default:break}clearTimeout(B.timeout),B.timeout=setTimeout(function(){B.dom&&(B.dom.style.transition="".concat(se,",").concat(ce),B.dom.style.width="",B.dom.style.transform="")})},B.remScrollingEffect=function(J){var te=B.props,ae=te.placement,_e=te.duration,de=te.ease,Ee=te.getOpenCount,Te=te.switchScrollingEffect,me=Ee&&Ee();me||Te(!0),l&&(document.body.style.overflowX="hidden"),B.dom.style.transition="none";var ce,se="width ".concat(_e," ").concat(de),Se="transform ".concat(_e," ").concat(de);switch(ae){case"left":{B.dom.style.width="100%",se="width 0s ".concat(de," ").concat(_e);break}case"right":{B.dom.style.transform="translateX(".concat(J,"px)"),B.dom.style.width="100%",se="width 0s ".concat(de," ").concat(_e),B.maskDom&&(B.maskDom.style.left="-".concat(J,"px"),B.maskDom.style.width="calc(100% + ".concat(J,"px)"));break}case"top":case"bottom":{B.dom.style.width="calc(100% + ".concat(J,"px)"),B.dom.style.height="100%",B.dom.style.transform="translateZ(0)",ce="height 0s ".concat(de," ").concat(_e);break}default:break}clearTimeout(B.timeout),B.timeout=setTimeout(function(){B.dom&&(B.dom.style.transition="".concat(Se,",").concat(ce?"".concat(ce,","):"").concat(se),B.dom.style.transform="",B.dom.style.width="",B.dom.style.height="")})},B.getCurrentDrawerSome=function(){return!Object.keys(E).some(function(J){return E[J]})},B.getLevelDom=function(J){var te=J.level,ae=J.getContainer;if(w)return;var _e=ae&&ae(),de=_e?_e.parentNode:null;if(B.levelDom=[],te==="all"){var Ee=de?Array.prototype.slice.call(de.children):[];Ee.forEach(function(Te){Te.nodeName!=="SCRIPT"&&Te.nodeName!=="STYLE"&&Te.nodeName!=="LINK"&&Te!==_e&&B.levelDom.push(Te)})}else te&&h(te).forEach(function(Te){document.querySelectorAll(Te).forEach(function(me){B.levelDom.push(me)})})},B.getHorizontalBoolAndPlacementName=function(){var J=B.props.placement,te=J==="left"||J==="right",ae="translate".concat(te?"X":"Y");return{isHorizontal:te,placementName:ae}},B.state={_self:Object(L.a)(B)},B}return Object(D.a)(U,[{key:"componentDidMount",value:function(){var B=this;if(!w){var J=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){return J=!0,null}}))}catch(Ee){}this.passive=J?{passive:!1}:!1}var te=this.props,ae=te.open,_e=te.getContainer,de=_e&&_e();this.drawerId="drawer_id_".concat(Number((Date.now()+Math.random()).toString().replace(".",Math.round(Math.random()*9).toString())).toString(16)),this.getLevelDom(this.props),ae&&(de&&de.parentNode===document.body&&(E[this.drawerId]=ae),this.openLevelTransition(),this.forceUpdate(function(){B.domFocus()}))}},{key:"componentDidUpdate",value:function(B){var J=this.props,te=J.open,ae=J.getContainer,_e=ae&&ae();te!==B.open&&(te&&this.domFocus(),_e&&_e.parentNode===document.body&&(E[this.drawerId]=!!te),this.openLevelTransition())}},{key:"componentWillUnmount",value:function(){var B=this.props,J=B.getOpenCount,te=B.open,ae=B.switchScrollingEffect,_e=typeof J=="function"&&J();delete E[this.drawerId],te&&(this.setLevelTransform(!1),document.body.style.touchAction=""),_e||(document.body.style.overflow="",ae(!0))}},{key:"render",value:function(){var B,J=this,te=this.props,ae=te.className,_e=te.children,de=te.style,Ee=te.width,Te=te.height,me=te.defaultOpen,ce=te.open,se=te.prefixCls,Se=te.placement,je=te.level,We=te.levelMove,Xe=te.ease,Qe=te.duration,Pe=te.getContainer,Ue=te.handler,Ye=te.onChange,Ze=te.afterVisibleChange,Ve=te.showMask,He=te.maskClosable,Fe=te.maskStyle,ft=te.onClose,lt=te.onHandleClick,rt=te.keyboard,dt=te.getOpenCount,bt=te.switchScrollingEffect,ut=Object(oe.a)(te,["className","children","style","width","height","defaultOpen","open","prefixCls","placement","level","levelMove","ease","duration","getContainer","handler","onChange","afterVisibleChange","showMask","maskClosable","maskStyle","onClose","onHandleClick","keyboard","getOpenCount","switchScrollingEffect"]),at=this.dom?ce:!1,Ie=v()(se,(B={},Object(k.a)(B,"".concat(se,"-").concat(Se),!0),Object(k.a)(B,"".concat(se,"-open"),at),Object(k.a)(B,ae||"",!!ae),Object(k.a)(B,"no-mask",!Ve),B)),yt=this.getHorizontalBoolAndPlacementName(),nt=yt.placementName,Oe=Se==="left"||Se==="top"?"-100%":"100%",Ge=at?"":"".concat(nt,"(").concat(Oe,")"),be=Ue&&H.cloneElement(Ue,{onClick:function(pe){Ue.props.onClick&&Ue.props.onClick(),lt&<(pe)},ref:function(pe){J.handlerDom=pe}});return H.createElement("div",Object.assign({},ut,{tabIndex:-1,className:Ie,style:de,ref:function(pe){J.dom=pe},onKeyDown:at&&rt?this.onKeyDown:void 0,onTransitionEnd:this.onWrapperTransitionEnd}),Ve&&H.createElement("div",{className:"".concat(se,"-mask"),onClick:He?ft:void 0,style:Fe,ref:function(pe){J.maskDom=pe}}),H.createElement("div",{className:"".concat(se,"-content-wrapper"),style:{transform:Ge,msTransform:Ge,width:x(Ee)?"".concat(Ee,"px"):Ee,height:x(Te)?"".concat(Te,"px"):Te},ref:function(pe){J.contentWrapper=pe}},H.createElement("div",{className:"".concat(se,"-content"),ref:function(pe){J.contentDom=pe},onTouchStart:at&&Ve?this.removeStartHandler:void 0,onTouchMove:at&&Ve?this.removeMoveHandler:void 0},_e),be))}}],[{key:"getDerivedStateFromProps",value:function(B,J){var te=J.prevProps,ae=J._self,_e={prevProps:B};if(te!==void 0){var de=B.placement,Ee=B.level;de!==te.placement&&(ae.contentDom=null),Ee!==te.level&&ae.getLevelDom(B)}return _e}}]),U}(H.Component);g.defaultProps={switchScrollingEffect:function(){}};var a=g;function m(W){var X=r();return function(){var S=Object(F.a)(W),B;if(X){var J=Object(F.a)(this).constructor;B=Reflect.construct(S,arguments,J)}else B=S.apply(this,arguments);return Object(j.a)(this,B)}}function r(){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(W){return!1}}var b=function(W){Object($.a)(U,W);var X=m(U);function U(S){var B;Object(Z.a)(this,U),B=X.call(this,S),B.onHandleClick=function(te){var ae=B.props,_e=ae.onHandleClick,de=ae.open;if(_e&&_e(te),typeof de=="undefined"){var Ee=B.state.open;B.setState({open:!Ee})}},B.onClose=function(te){var ae=B.props,_e=ae.onClose,de=ae.open;_e&&_e(te),typeof de=="undefined"&&B.setState({open:!1})};var J=typeof S.open!="undefined"?S.open:!!S.defaultOpen;return B.state={open:J},"onMaskClick"in S&&console.warn("`onMaskClick` are removed, please use `onClose` instead."),B}return Object(D.a)(U,[{key:"render",value:function(){var B=this,J=this.props,te=J.defaultOpen,ae=J.getContainer,_e=J.wrapperClassName,de=J.forceRender,Ee=J.handler,Te=Object(oe.a)(J,["defaultOpen","getContainer","wrapperClassName","forceRender","handler"]),me=this.state.open;if(!ae)return H.createElement("div",{className:_e,ref:function(Se){B.dom=Se}},H.createElement(a,Object.assign({},Te,{open:me,handler:Ee,getContainer:function(){return B.dom},onClose:this.onClose,onHandleClick:this.onHandleClick})));var ce=!!Ee||de;return H.createElement(V.a,{visible:me,forceRender:ce,getContainer:ae,wrapperClassName:_e},function(se){var Se=se.visible,je=se.afterClose,We=Object(oe.a)(se,["visible","afterClose"]);return H.createElement(a,Object.assign({},Te,We,{open:Se!==void 0?Se:me,afterVisibleChange:je!==void 0?je:Te.afterVisibleChange,handler:Ee,onClose:B.onClose,onHandleClick:B.onHandleClick}))})}}],[{key:"getDerivedStateFromProps",value:function(B,J){var te=J.prevProps,ae={prevProps:B};return typeof te!="undefined"&&B.open!==te.open&&(ae.open=B.open),ae}}]),U}(H.Component);b.defaultProps={prefixCls:"drawer",placement:"left",getContainer:"body",defaultOpen:!1,level:"all",duration:".3s",ease:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",onChange:function(){},afterVisibleChange:function(){},handler:H.createElement("div",{className:"drawer-handle"},H.createElement("i",{className:"drawer-handle-icon"})),showMask:!0,maskClosable:!0,maskStyle:{},wrapperClassName:"",className:"",keyboard:!0,forceRender:!1};var P=b,M=st.a=P},kSUc:function(Mt,st,ne){},kqOp:function(Mt,st,ne){"use strict";ne.d(st,"a",function(){return L});var oe=ne("0Owb"),Z=ne("fWQN"),D=ne("mtLc"),$=ne("yKVA"),j=ne("879j"),F=ne("q1tI"),V=ne.n(F),H=ne("Ot1p"),k="\u2581",L=function(y){Object($.a)(p,y);var v=Object(j.a)(p);function p(){var c;Object(Z.a)(this,p);for(var h=arguments.length,d=new Array(h),l=0;l<h;l++)d[l]=arguments[l];return c=v.call.apply(v,[this].concat(d)),c.getChCountBeforeCursor=function(s,u){for(var f=u.line,O=0,x=0;x<f;x++)O+=s.getLine(x).split(k).length-1;var w=s.getLine(f).substring(0,u.ch);return O+=w.split(k).length-1,O},c.onCMBeforeChange=function(s,u){var f=s.getRange(u.from,u.to),O=0;if(u.text.forEach(function(R){O+=R.split(k).length-1}),f&&f.indexOf(k)!=-1){var x=f.split(k).length-1,w=c.getChCountBeforeCursor(s,u.from);console.log("\u5220\u9664".concat(x,"\u4E2A\uFF0C \u4E4B\u524D\u6709").concat(w,"\u4E2A\uFF0C\u65B0\u589E").concat(O,"\u4E2A")),c.props.deleteEmptyDisabled?u.cancel():c.props.onPlaceholderChange&&c.props.onPlaceholderChange(w,x,O)}else if(O){var A=c.getChCountBeforeCursor(s,u.from);console.log("\u65B0\u589E".concat(O,"\u4E2A\uFF0C\u4E4B\u524D\u6709").concat(A,"\u4E2A")),c.props.onPlaceholderChange&&c.props.onPlaceholderChange(A,0,O)}},c}return Object(D.a)(p,[{key:"render",value:function(){return V.a.createElement(H.a,Object(oe.a)({},this.props,{onCMBeforeChange:this.onCMBeforeChange}))}}]),p}(F.Component)},lZu9:function(Mt,st,ne){(function(oe){oe(ne("VrN/"),ne("1eCo"),ne("8EBN"))})(function(oe){"use strict";oe.defineMode("markdown",function(Z,D){var $=oe.getMode(Z,"text/html"),j=$.name=="null";function F(U){if(oe.findModeByName){var S=oe.findModeByName(U);S&&(U=S.mime||S.mimes[0])}var B=oe.getMode(Z,U);return B.name=="null"?null:B}D.highlightFormatting===void 0&&(D.highlightFormatting=!1),D.maxBlockquoteDepth===void 0&&(D.maxBlockquoteDepth=0),D.taskLists===void 0&&(D.taskLists=!1),D.strikethrough===void 0&&(D.strikethrough=!1),D.emoji===void 0&&(D.emoji=!1),D.fencedCodeBlockHighlighting===void 0&&(D.fencedCodeBlockHighlighting=!0),D.fencedCodeBlockDefaultMode===void 0&&(D.fencedCodeBlockDefaultMode="text/plain"),D.xml===void 0&&(D.xml=!0),D.tokenTypeOverrides===void 0&&(D.tokenTypeOverrides={});var V={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 V)V.hasOwnProperty(H)&&D.tokenTypeOverrides[H]&&(V[H]=D.tokenTypeOverrides[H]);var k=/^([*\-_])(?:\s*\1){2,}\s*$/,L=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,y=/^\[(x| )\](?=\s)/i,v=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,p=/^ {0,3}(?:\={1,}|-{2,})\s*$/,c=/^[^#!\[\]*_\\<>` "'(~:]+/,h=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,d=/^\s*\[[^\]]+?\]:.*$/,l=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,s=" ";function u(U,S,B){return S.f=S.inline=B,B(U,S)}function f(U,S,B){return S.f=S.block=B,B(U,S)}function O(U){return!U||!/\S/.test(U.string)}function x(U){if(U.linkTitle=!1,U.linkHref=!1,U.linkText=!1,U.em=!1,U.strong=!1,U.strikethrough=!1,U.quote=0,U.indentedCode=!1,U.f==A){var S=j;if(!S){var B=oe.innerMode($,U.htmlState);S=B.mode.name=="xml"&&B.state.tagStart===null&&!B.state.context&&B.state.tokenize.isInText}S&&(U.f=g,U.block=w,U.htmlState=null)}return U.trailingSpace=0,U.trailingSpaceNewLine=!1,U.prevLine=U.thisLine,U.thisLine={stream:null},null}function w(U,S){var B=U.column()===S.indentation,J=O(S.prevLine.stream),te=S.indentedCode,ae=S.prevLine.hr,_e=S.list!==!1,de=(S.listStack[S.listStack.length-1]||0)+3;S.indentedCode=!1;var Ee=S.indentation;if(S.indentationDiff===null&&(S.indentationDiff=S.indentation,_e)){for(S.list=null;Ee<S.listStack[S.listStack.length-1];)S.listStack.pop(),S.listStack.length?S.indentation=S.listStack[S.listStack.length-1]:S.list=!1;S.list!==!1&&(S.indentationDiff=Ee-S.listStack[S.listStack.length-1])}var Te=!J&&!ae&&!S.prevLine.header&&(!_e||!te)&&!S.prevLine.fencedCodeEnd,me=(S.list===!1||ae||J)&&S.indentation<=de&&U.match(k),ce=null;if(S.indentationDiff>=4&&(te||S.prevLine.fencedCodeEnd||S.prevLine.header||J))return U.skipToEnd(),S.indentedCode=!0,V.code;if(U.eatSpace())return null;if(B&&S.indentation<=de&&(ce=U.match(v))&&ce[1].length<=6)return S.quote=0,S.header=ce[1].length,S.thisLine.header=!0,D.highlightFormatting&&(S.formatting="header"),S.f=S.inline,T(S);if(S.indentation<=de&&U.eat(">"))return S.quote=B?1:S.quote+1,D.highlightFormatting&&(S.formatting="quote"),U.eatSpace(),T(S);if(!me&&!S.setext&&B&&S.indentation<=de&&(ce=U.match(L))){var se=ce[1]?"ol":"ul";return S.indentation=Ee+U.current().length,S.list=!0,S.quote=0,S.listStack.push(S.indentation),S.em=!1,S.strong=!1,S.code=!1,S.strikethrough=!1,D.taskLists&&U.match(y,!1)&&(S.taskList=!0),S.f=S.inline,D.highlightFormatting&&(S.formatting=["list","list-"+se]),T(S)}else{if(B&&S.indentation<=de&&(ce=U.match(h,!0)))return S.quote=0,S.fencedEndRE=new RegExp(ce[1]+"+ *$"),S.localMode=D.fencedCodeBlockHighlighting&&F(ce[2]||D.fencedCodeBlockDefaultMode),S.localMode&&(S.localState=oe.startState(S.localMode)),S.f=S.block=R,D.highlightFormatting&&(S.formatting="code-block"),S.code=-1,T(S);if(S.setext||(!Te||!_e)&&!S.quote&&S.list===!1&&!S.code&&!me&&!d.test(U.string)&&(ce=U.lookAhead(1))&&(ce=ce.match(p)))return S.setext?(S.header=S.setext,S.setext=0,U.skipToEnd(),D.highlightFormatting&&(S.formatting="header")):(S.header=ce[0].charAt(0)=="="?1:2,S.setext=S.header),S.thisLine.header=!0,S.f=S.inline,T(S);if(me)return U.skipToEnd(),S.hr=!0,S.thisLine.hr=!0,V.hr;if(U.peek()==="[")return u(U,S,P)}return u(U,S,S.inline)}function A(U,S){var B=$.token(U,S.htmlState);if(!j){var J=oe.innerMode($,S.htmlState);(J.mode.name=="xml"&&J.state.tagStart===null&&!J.state.context&&J.state.tokenize.isInText||S.md_inside&&U.current().indexOf(">")>-1)&&(S.f=g,S.block=w,S.htmlState=null)}return B}function R(U,S){var B=S.listStack[S.listStack.length-1]||0,J=S.indentation<B,te=B+3;if(S.fencedEndRE&&S.indentation<=te&&(J||U.match(S.fencedEndRE))){D.highlightFormatting&&(S.formatting="code-block");var ae;return J||(ae=T(S)),S.localMode=S.localState=null,S.block=w,S.f=g,S.fencedEndRE=null,S.code=0,S.thisLine.fencedCodeEnd=!0,J?f(U,S,S.block):ae}else return S.localMode?S.localMode.token(U,S.localState):(U.skipToEnd(),V.code)}function T(U){var S=[];if(U.formatting){S.push(V.formatting),typeof U.formatting=="string"&&(U.formatting=[U.formatting]);for(var B=0;B<U.formatting.length;B++)S.push(V.formatting+"-"+U.formatting[B]),U.formatting[B]==="header"&&S.push(V.formatting+"-"+U.formatting[B]+"-"+U.header),U.formatting[B]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=U.quote?S.push(V.formatting+"-"+U.formatting[B]+"-"+U.quote):S.push("error"))}if(U.taskOpen)return S.push("meta"),S.length?S.join(" "):null;if(U.taskClosed)return S.push("property"),S.length?S.join(" "):null;if(U.linkHref?S.push(V.linkHref,"url"):(U.strong&&S.push(V.strong),U.em&&S.push(V.em),U.strikethrough&&S.push(V.strikethrough),U.emoji&&S.push(V.emoji),U.linkText&&S.push(V.linkText),U.code&&S.push(V.code),U.image&&S.push(V.image),U.imageAltText&&S.push(V.imageAltText,"link"),U.imageMarker&&S.push(V.imageMarker)),U.header&&S.push(V.header,V.header+"-"+U.header),U.quote&&(S.push(V.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=U.quote?S.push(V.quote+"-"+U.quote):S.push(V.quote+"-"+D.maxBlockquoteDepth)),U.list!==!1){var J=(U.listStack.length-1)%3;J?J===1?S.push(V.list2):S.push(V.list3):S.push(V.list1)}return U.trailingSpaceNewLine?S.push("trailing-space-new-line"):U.trailingSpace&&S.push("trailing-space-"+(U.trailingSpace%2?"a":"b")),S.length?S.join(" "):null}function E(U,S){return U.match(c,!0)?T(S):void 0}function g(U,S){var B=S.text(U,S);if(typeof B!="undefined")return B;if(S.list)return S.list=null,T(S);if(S.taskList){var J=U.match(y,!0)[1]===" ";return J?S.taskOpen=!0:S.taskClosed=!0,D.highlightFormatting&&(S.formatting="task"),S.taskList=!1,T(S)}if(S.taskOpen=!1,S.taskClosed=!1,S.header&&U.match(/^#+$/,!0))return D.highlightFormatting&&(S.formatting="header"),T(S);var te=U.next();if(S.linkTitle){S.linkTitle=!1;var ae=te;te==="("&&(ae=")"),ae=(ae+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var _e="^\\s*(?:[^"+ae+"\\\\]+|\\\\\\\\|\\\\.)"+ae;if(U.match(new RegExp(_e),!0))return V.linkHref}if(te==="`"){var de=S.formatting;D.highlightFormatting&&(S.formatting="code"),U.eatWhile("`");var Ee=U.current().length;if(S.code==0&&(!S.quote||Ee==1))return S.code=Ee,T(S);if(Ee==S.code){var Te=T(S);return S.code=0,Te}else return S.formatting=de,T(S)}else if(S.code)return T(S);if(te==="\\"&&(U.next(),D.highlightFormatting)){var me=T(S),ce=V.formatting+"-escape";return me?me+" "+ce:ce}if(te==="!"&&U.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return S.imageMarker=!0,S.image=!0,D.highlightFormatting&&(S.formatting="image"),T(S);if(te==="["&&S.imageMarker&&U.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return S.imageMarker=!1,S.imageAltText=!0,D.highlightFormatting&&(S.formatting="image"),T(S);if(te==="]"&&S.imageAltText){D.highlightFormatting&&(S.formatting="image");var me=T(S);return S.imageAltText=!1,S.image=!1,S.inline=S.f=m,me}if(te==="["&&!S.image)return S.linkText&&U.match(/^.*?\]/)||(S.linkText=!0,D.highlightFormatting&&(S.formatting="link")),T(S);if(te==="]"&&S.linkText){D.highlightFormatting&&(S.formatting="link");var me=T(S);return S.linkText=!1,S.inline=S.f=U.match(/\(.*?\)| ?\[.*?\]/,!1)?m:g,me}if(te==="<"&&U.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){S.f=S.inline=a,D.highlightFormatting&&(S.formatting="link");var me=T(S);return me?me+=" ":me="",me+V.linkInline}if(te==="<"&&U.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){S.f=S.inline=a,D.highlightFormatting&&(S.formatting="link");var me=T(S);return me?me+=" ":me="",me+V.linkEmail}if(D.xml&&te==="<"&&U.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var se=U.string.indexOf(">",U.pos);if(se!=-1){var Se=U.string.substring(U.start,se);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Se)&&(S.md_inside=!0)}return U.backUp(1),S.htmlState=oe.startState($),f(U,S,A)}if(D.xml&&te==="<"&&U.match(/^\/\w*?>/))return S.md_inside=!1,"tag";if(te==="*"||te==="_"){for(var je=1,We=U.pos==1?" ":U.string.charAt(U.pos-2);je<3&&U.eat(te);)je++;var Xe=U.peek()||" ",Qe=!/\s/.test(Xe)&&(!l.test(Xe)||/\s/.test(We)||l.test(We)),Pe=!/\s/.test(We)&&(!l.test(We)||/\s/.test(Xe)||l.test(Xe)),Ue=null,Ye=null;if(je%2&&(!S.em&&Qe&&(te==="*"||!Pe||l.test(We))?Ue=!0:S.em==te&&Pe&&(te==="*"||!Qe||l.test(Xe))&&(Ue=!1)),je>1&&(!S.strong&&Qe&&(te==="*"||!Pe||l.test(We))?Ye=!0:S.strong==te&&Pe&&(te==="*"||!Qe||l.test(Xe))&&(Ye=!1)),Ye!=null||Ue!=null){D.highlightFormatting&&(S.formatting=Ue==null?"strong":Ye==null?"em":"strong em"),Ue===!0&&(S.em=te),Ye===!0&&(S.strong=te);var Te=T(S);return Ue===!1&&(S.em=!1),Ye===!1&&(S.strong=!1),Te}}else if(te===" "&&(U.eat("*")||U.eat("_"))){if(U.peek()===" ")return T(S);U.backUp(1)}if(D.strikethrough){if(te==="~"&&U.eatWhile(te)){if(S.strikethrough){D.highlightFormatting&&(S.formatting="strikethrough");var Te=T(S);return S.strikethrough=!1,Te}else if(U.match(/^[^\s]/,!1))return S.strikethrough=!0,D.highlightFormatting&&(S.formatting="strikethrough"),T(S)}else if(te===" "&&U.match(/^~~/,!0)){if(U.peek()===" ")return T(S);U.backUp(2)}}if(D.emoji&&te===":"&&U.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){S.emoji=!0,D.highlightFormatting&&(S.formatting="emoji");var Ze=T(S);return S.emoji=!1,Ze}return te===" "&&(U.match(/^ +$/,!1)?S.trailingSpace++:S.trailingSpace&&(S.trailingSpaceNewLine=!0)),T(S)}function a(U,S){var B=U.next();if(B===">"){S.f=S.inline=g,D.highlightFormatting&&(S.formatting="link");var J=T(S);return J?J+=" ":J="",J+V.linkInline}return U.match(/^[^>]+/,!0),V.linkInline}function m(U,S){if(U.eatSpace())return null;var B=U.next();return B==="("||B==="["?(S.f=S.inline=b(B==="("?")":"]"),D.highlightFormatting&&(S.formatting="link-string"),S.linkHref=!0,T(S)):"error"}var r={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function b(U){return function(S,B){var J=S.next();if(J===U){B.f=B.inline=g,D.highlightFormatting&&(B.formatting="link-string");var te=T(B);return B.linkHref=!1,te}return S.match(r[U]),B.linkHref=!0,T(B)}}function P(U,S){return U.match(/^([^\]\\]|\\.)*\]:/,!1)?(S.f=M,U.next(),D.highlightFormatting&&(S.formatting="link"),S.linkText=!0,T(S)):u(U,S,g)}function M(U,S){if(U.match(/^\]:/,!0)){S.f=S.inline=W,D.highlightFormatting&&(S.formatting="link");var B=T(S);return S.linkText=!1,B}return U.match(/^([^\]\\]|\\.)+/,!0),V.linkText}function W(U,S){return U.eatSpace()?null:(U.match(/^[^\s]+/,!0),U.peek()===void 0?S.linkTitle=!0:U.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),S.f=S.inline=g,V.linkHref+" url")}var X={startState:function(){return{f:w,prevLine:{stream:null},thisLine:{stream:null},block:w,htmlState:null,indentation:0,inline:g,text:E,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(U){return{f:U.f,prevLine:U.prevLine,thisLine:U.thisLine,block:U.block,htmlState:U.htmlState&&oe.copyState($,U.htmlState),indentation:U.indentation,localMode:U.localMode,localState:U.localMode?oe.copyState(U.localMode,U.localState):null,inline:U.inline,text:U.text,formatting:!1,linkText:U.linkText,linkTitle:U.linkTitle,linkHref:U.linkHref,code:U.code,em:U.em,strong:U.strong,strikethrough:U.strikethrough,emoji:U.emoji,header:U.header,setext:U.setext,hr:U.hr,taskList:U.taskList,list:U.list,listStack:U.listStack.slice(0),quote:U.quote,indentedCode:U.indentedCode,trailingSpace:U.trailingSpace,trailingSpaceNewLine:U.trailingSpaceNewLine,md_inside:U.md_inside,fencedEndRE:U.fencedEndRE}},token:function(U,S){if(S.formatting=!1,U!=S.thisLine.stream){if(S.header=0,S.hr=!1,U.match(/^\s*$/,!0))return x(S),null;if(S.prevLine=S.thisLine,S.thisLine={stream:U},S.taskList=!1,S.trailingSpace=0,S.trailingSpaceNewLine=!1,!S.localState&&(S.f=S.block,S.f!=A)){var B=U.match(/^\s*/,!0)[0].replace(/\t/g,s).length;if(S.indentation=B,S.indentationDiff=null,B>0)return null}}return S.f(U,S)},innerMode:function(U){return U.block==A?{state:U.htmlState,mode:$}:U.localState?{state:U.localState,mode:U.localMode}:{state:U,mode:X}},indent:function(U,S,B){return U.block==A&&$.indent?$.indent(U.htmlState,S,B):U.localState&&U.localMode.indent?U.localMode.indent(U.localState,S,B):oe.Pass},blankLine:x,getType:T,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return X},"xml"),oe.defineMIME("text/markdown","markdown"),oe.defineMIME("text/x-markdown","markdown")})},osHv:function(Mt,st,ne){(function(oe){oe(ne("VrN/"))})(function(oe){"use strict";var Z=oe.Pos;function D(l,s){return l.line-s.line||l.ch-s.ch}var $="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",j=$+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",F=new RegExp("<(/?)(["+$+"]["+j+"]*)","g");function V(l,s,u,f){this.line=s,this.ch=u,this.cm=l,this.text=l.getLine(s),this.min=f?Math.max(f.from,l.firstLine()):l.firstLine(),this.max=f?Math.min(f.to-1,l.lastLine()):l.lastLine()}function H(l,s){var u=l.cm.getTokenTypeAt(Z(l.line,s));return u&&/\btag\b/.test(u)}function k(l){return l.line>=l.max?void 0:(l.ch=0,l.text=l.cm.getLine(++l.line),!0)}function L(l){return l.line<=l.min?void 0:(l.text=l.cm.getLine(--l.line),l.ch=l.text.length,!0)}function y(l){for(;;){var s=l.text.indexOf(">",l.ch);if(s==-1){if(k(l))continue;return}if(!H(l,s+1)){l.ch=s+1;continue}var u=l.text.lastIndexOf("/",s),f=u>-1&&!/\S/.test(l.text.slice(u+1,s));return l.ch=s+1,f?"selfClose":"regular"}}function v(l){for(;;){var s=l.ch?l.text.lastIndexOf("<",l.ch-1):-1;if(s==-1){if(L(l))continue;return}if(!H(l,s+1)){l.ch=s;continue}F.lastIndex=s,l.ch=s;var u=F.exec(l.text);if(u&&u.index==s)return u}}function p(l){for(;;){F.lastIndex=l.ch;var s=F.exec(l.text);if(!s){if(k(l))continue;return}if(!H(l,s.index+1)){l.ch=s.index+1;continue}return l.ch=s.index+s[0].length,s}}function c(l){for(;;){var s=l.ch?l.text.lastIndexOf(">",l.ch-1):-1;if(s==-1){if(L(l))continue;return}if(!H(l,s+1)){l.ch=s;continue}var u=l.text.lastIndexOf("/",s),f=u>-1&&!/\S/.test(l.text.slice(u+1,s));return l.ch=s+1,f?"selfClose":"regular"}}function h(l,s){for(var u=[];;){var f=p(l),O,x=l.line,w=l.ch-(f?f[0].length:0);if(!f||!(O=y(l)))return;if(O=="selfClose")continue;if(f[1]){for(var A=u.length-1;A>=0;--A)if(u[A]==f[2]){u.length=A;break}if(A<0&&(!s||s==f[2]))return{tag:f[2],from:Z(x,w),to:Z(l.line,l.ch)}}else u.push(f[2])}}function d(l,s){for(var u=[];;){var f=c(l);if(!f)return;if(f=="selfClose"){v(l);continue}var O=l.line,x=l.ch,w=v(l);if(!w)return;if(w[1])u.push(w[2]);else{for(var A=u.length-1;A>=0;--A)if(u[A]==w[2]){u.length=A;break}if(A<0&&(!s||s==w[2]))return{tag:w[2],from:Z(l.line,l.ch),to:Z(O,x)}}}}oe.registerHelper("fold","xml",function(l,s){for(var u=new V(l,s.line,0);;){var f=p(u);if(!f||u.line!=s.line)return;var O=y(u);if(!O)return;if(!f[1]&&O!="selfClose"){var x=Z(u.line,u.ch),w=h(u,f[2]);return w&&D(w.from,x)>0?{from:x,to:w.from}:null}}}),oe.findMatchingTag=function(l,s,u){var f=new V(l,s.line,s.ch,u);if(f.text.indexOf(">")==-1&&f.text.indexOf("<")==-1)return;var O=y(f),x=O&&Z(f.line,f.ch),w=O&&v(f);if(!O||!w||D(f,s)>0)return;var A={from:Z(f.line,f.ch),to:x,tag:w[2]};return O=="selfClose"?{open:A,close:null,at:"open"}:w[1]?{open:d(f,w[2]),close:A,at:"close"}:(f=new V(l,x.line,x.ch,u),{open:A,close:h(f,w[2]),at:"open"})},oe.findEnclosingTag=function(l,s,u,f){for(var O=new V(l,s.line,s.ch,u);;){var x=d(O,f);if(!x)break;var w=new V(l,s.line,s.ch,u),A=h(w,x.tag);if(A)return{open:x,close:A}}},oe.scanForClosingTag=function(l,s,u,f){var O=new V(l,s.line,s.ch,f?{from:0,to:f}:null);return h(O,u)}})},p5ED:function(Mt,st,ne){"use strict";var oe=ne("+L6B"),Z=ne("2/Rp"),D=ne("5Dmo"),$=ne("3S7+"),j=ne("k1fw"),F=ne("tJVT"),V=ne("q1tI"),H=ne.n(V),k=ne("vHTk"),L=ne.n(k),y=ne("yEEn"),v=ne("ZW9T"),p=ne("1vsH");st.a=function(c){var h=c.name,d=c.data,l=c.theme,s=c.type,u=c.filename,f=c.monacoEditor,O=c.className,x=c.style,w=c.close,A=c.onClose,R=c.hasMask,T=Object(V.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),E=Object(F.a)(T,2),g=E[0],a=E[1],m=Object(V.useState)(""),r=Object(F.a)(m,2),b=r[0],P=r[1],M,W=1024*1024,X=10*W,U=Object(V.useRef)();s==="office"&&(M=Object(p.T)(d).filesize,M>X&&(s="other")),u&&(f.filename=u),Object(V.useEffect)(function(){var J,te,ae=(J=document.cookie)===null||J===void 0||((te=J.replace(/\s/g,""))===null||te===void 0)?void 0:te.split(";");ae==null||ae.map(function(_e){var de=_e.split("=");de[0]==="_educoder_session"&&P(de[1])})},[]);var S=function(){if(d.startsWith("http")||d.startsWith("/")){B();return}Object(p.z)(u||"educoder",d,u)},B=function(){Object(p.x)(u||h,d)};return console.log("data:",d,"fileanme:",u," name:",h),H.a.createElement("div",{style:Object(j.a)({},x||{}),className:"".concat(R&&L.a.bgBlack," ").concat(s?L.a.wrp:"hide")},w&&H.a.createElement("div",{className:L.a.close,ref:U},H.a.createElement($.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return U.current}},H.a.createElement("span",{onClick:B},H.a.createElement("i",{className:"icon-quxiaozhiding"}))),H.a.createElement($.a,{title:"\u5173\u95ED",getPopupContainer:function(){return U.current}},H.a.createElement("span",{className:"",onClick:A},H.a.createElement("i",{className:"icon-guanbi1"})))),H.a.createElement("div",{className:"".concat(L.a[O]," ").concat(O," ").concat(L.a.monaco," ").concat(s==="txt"?"show":"hide")},s==="txt"&&H.a.createElement(v.b,f)),s==="audio"&&H.a.createElement("audio",{src:"".concat(d!=null&&d.startsWith("/")||(d==null?void 0:d.indexOf("https://"))>-1?d:"data:audio/mp3;base64,").concat(d),autoPlay:!0}),s==="video"&&H.a.createElement(H.a.Fragment,null,d!=null&&d.startsWith("/")?H.a.createElement("video",{controls:!0,src:"".concat(d),autoPlay:!0}):H.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(d),autoPlay:!0})),s==="html"&&H.a.createElement("iframe",{src:d+"&disposition=inline"}),s==="pdf"&&H.a.createElement("embed",{className:L.a.embed,src:d}),s==="image"&&H.a.createElement(H.a.Fragment,null,H.a.createElement("img",{src:"".concat(d!=null&&d.startsWith("/")||(d==null?void 0:d.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(d)})),s==="other"&&H.a.createElement("div",null,H.a.createElement(Z.a,{type:"primary",size:"large",onClick:S},H.a.createElement(y.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(s==="download"||s==="office")&&H.a.createElement(Z.a,{type:"primary",size:"large",onClick:S},H.a.createElement(y.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(Mt,st,ne){},pr0Y:function(Mt,st,ne){"use strict";ne.r(st);var oe=ne("+L6B"),Z=ne("2/Rp"),D=ne("5NDa"),$=ne("5rEg"),j=ne("5Dmo"),F=ne("3S7+"),V=ne("14J3"),H=ne("BMrR"),k=ne("jCWc"),L=ne("kPKH"),y=ne("sPJy"),v=ne("bE4q"),p=ne("/zsF"),c=ne("PArb"),h=ne("miYZ"),d=ne("tsqr"),l=ne("9og8"),s=ne("k1fw"),u=ne("oBTY"),f=ne("y8nQ"),O=ne("Vl3Y"),x=ne("tJVT"),w=ne("PpiC"),A=ne("B9cy"),R=ne("Ol7k"),T=ne("lUTK"),E=ne("BvKs"),g=ne("WmNS"),a=ne.n(g),m=ne("q1tI"),r=ne.n(m),b=ne("Ty5D"),P=ne("55Ip"),M=ne("9kvl"),W=ne("w5pM"),X=ne("tgas"),U=ne("giR+"),S=ne("fyUT"),B=ne("sRBo"),J=ne("kaz8"),te=ne("2qtc"),ae=ne("kLXV"),_e=ne("V0Rq"),de=ne("Ot1p"),Ee=ne("9Bee"),Te=ne("LuLp"),me=ne.n(Te),ce=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],se=function(ke,Ct){var Rt=ke.problemset,ni=ke.globalSetting,Qt=ke.loading,Tt=ke.dispatch,qe=ke.onRef,Oi=qe===void 0?function(){}:qe,xe=ke.editData,Dt=Object(w.a)(ke,["problemset","globalSetting","loading","dispatch","onRef","editData"]),Ut=Object(m.useState)([]),Ft=Object(x.a)(Ut,2),At=Ft[0],ei=Ft[1],di=Object(m.useState)(),Bt=Object(x.a)(di,2),it=Bt[0],fi=Bt[1],ri=Object(m.useState)([]),Kt=Object(x.a)(ri,2),Et=Kt[0],Nt=Kt[1],ti=Object(m.useState)(""),oi=Object(x.a)(ti,2),De=oi[0],gt=oi[1],pi=Object(m.useState)(5),Ei=Object(x.a)(pi,2),wi=Ei[0],vi=Ei[1],K=Object(m.useState)(!1),_=Object(x.a)(K,2),C=_[0],N=_[1],Q=Object(b.i)();Object(m.useEffect)(function(){ei(["","","",""])},[]),Object(m.useEffect)(function(){if(!(xe!=null&&xe.question_choices)){N(!0);return}gt(xe==null?void 0:xe.question_title),vi(parseInt(xe==null?void 0:xe.question_score)),ei(xe==null?void 0:xe.question_choices.map(function($e){return $e.choice_text}));var Re=[];xe==null||xe.standard_answer.map(function($e,ze){Re.push($e-1)}),Nt(Re)},[xe]),Object(m.useImperativeHandle)(Ct,function(){return{onSave:G,isEdit:C}});var G=function(){var Re=Object(l.a)(a.a.mark(function $e(){var ze,xt,vt;return a.a.wrap(function(Pt){for(;;)switch(Pt.prev=Pt.next){case 0:if(De){Pt.next=3;break}return d.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),Pt.abrupt("return",!1);case 3:if(ze=At.findIndex(function(zt){return!zt}),!(ze>-1)){Pt.next=7;break}return d.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(ce[ze]," \u9009\u9879\u7684\u5185\u5BB9")),Pt.abrupt("return",!1);case 7:if(Et.length){Pt.next=10;break}return d.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),Pt.abrupt("return",!1);case 10:if(!(Et.length<1)){Pt.next=13;break}return d.b.info("\u8BF7\u9009\u62E9\u7B54\u6848"),Pt.abrupt("return",!1);case 13:if(xt=At.map(function(zt,yi){return{choice_text:zt,is_answer:Et.includes(yi)?yi+1:0}}),!xe.question_id){Pt.next=20;break}return Pt.next=17,Tt({type:"exercise/editExerciseQuestion",payload:{id:xe.question_id,question_title:De,question_type:1,question_score:"5.0",question_choices:xt.map(function(zt){return zt.choice_text}),standard_answers:xt.filter(function(zt){return zt.is_answer}).map(function(zt){return zt.is_answer})}});case 17:vt=Pt.sent,Pt.next=23;break;case 20:return Pt.next=22,Tt({type:"exercise/addExerciseQuestion",payload:{categoryId:Q.categoryId,question_title:De,question_type:1,question_score:"5.0",question_choices:xt.map(function(zt){return zt.choice_text}),standard_answers:xt.filter(function(zt){return zt.is_answer}).map(function(zt){return zt.is_answer})}});case 22:vt=Pt.sent;case 23:vt.status===0&&(d.b.success("\u4FDD\u5B58\u6210\u529F"),N(!1),Tt({type:"exercise/editExercise",payload:Object(s.a)({},Q)}));case 24:case"end":return Pt.stop()}},$e)}));return function(){return Re.apply(this,arguments)}}(),le=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],Ae=function(){var Re=Object(l.a)(a.a.mark(function $e(ze){return a.a.wrap(function(vt){for(;;)switch(vt.prev=vt.next){case 0:vt.t0=ze.id,vt.next=vt.t0==="del"?3:vt.t0==="up"||vt.t0==="down"?5:vt.t0==="edit"?9:11;break;case 3:return ae.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(l.a)(a.a.mark(function Pt(){return a.a.wrap(function(yi){for(;;)switch(yi.prev=yi.next){case 0:return yi.next=2,Object(_e.n)({id:xe.question_id});case 2:Tt({type:"exercise/editExercise",payload:Object(s.a)({},Q)});case 3:case"end":return yi.stop()}},Pt)}))()}}),vt.abrupt("break",11);case 5:return vt.next=7,Tt({type:"exercise/exeriseMoveUpDown",payload:{id:xe.question_id,opr:ze.id}});case 7:return Tt({type:"exercise/editExercise",payload:Object(s.a)({},Q)}),vt.abrupt("break",11);case 9:return N(!0),vt.abrupt("break",11);case 11:case"end":return vt.stop()}},$e)}));return function(ze){return Re.apply(this,arguments)}}(),Me=function(){var $e;return r.a.createElement("aside",null,r.a.createElement("div",{className:me.a.questionType},r.a.createElement("div",null,r.a.createElement("span",{className:"font16 c-blue"},xe.key,"\u3001\u591A\u9009\u9898"),"\uFF08",xe.question_score,"\u5206\uFF09"),!xe.hideAction&&le.map(function(ze,xt){return ze.id==="up"&&xe.key===1||ze.id==="down"&&xe.key===xe.len?null:r.a.createElement(F.a,{key:xt,placement:"bottom",title:ze.name},r.a.createElement("span",{onClick:function(){return Ae(ze)},className:ze.icon}))})),r.a.createElement("div",{className:"mt5"},r.a.createElement(Ee.a,{value:xe.question_title})),r.a.createElement("div",{className:me.a.questionChoices},xe==null||(($e=xe.question_choices)===null||$e===void 0)?void 0:$e.map(function(ze,xt){return r.a.createElement(H.a,null,r.a.createElement(L.a,null,r.a.createElement(J.a,{key:xt,checked:xe.standard_answer.includes(xt+1),disabled:!0},ce[xt],".")),r.a.createElement(L.a,{flex:"1"},r.a.createElement("span",{className:"c-black font14"},r.a.createElement(Ee.a,{value:ze.choice_text}))))})))},ot=function(){return r.a.createElement("aside",null,r.a.createElement("div",{className:me.a.questionType},r.a.createElement("div",null,r.a.createElement("span",{className:"font16 c-blue"},"\u9009\u62E9\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09")),r.a.createElement("p",{className:me.a.titleWrap},r.a.createElement("span",{className:me.a.required},"*"),r.a.createElement("span",{className:me.a.title},"\u9898\u5E72\uFF1A")),r.a.createElement(de.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:De,onChange:function(ze){return gt(ze)}}),At.map(function($e,ze){return r.a.createElement("div",{className:me.a.choiceWrap,key:ze},r.a.createElement(F.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},r.a.createElement("div",{className:"".concat(me.a.answer," ").concat(Et.includes(ze)?me.a.activeAnswer:""),onClick:function(){Et.includes(ze)?Nt(Et.filter(function(vt){return vt!==ze})):Nt([].concat(Object(u.a)(Et),[ze]))}},ce[ze])),r.a.createElement("div",{className:me.a.editorWrap},it===ze?r.a.createElement(de.a,{id:"single-question-option-".concat(ze),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:$e,onChange:function(vt){At[ze]=vt,ei(At)}}):r.a.createElement("div",{className:me.a.htmlWrap,onClick:function(){return fi(ze)}},r.a.createElement(Ee.a,{value:$e}))),ze>1&&r.a.createElement(F.a,{title:"\u5220\u9664"},r.a.createElement("i",{className:"".concat(me.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return ei(At.filter(function(vt,hi){return hi!==ze}))}})),ze<7&&ze===At.length-1&&r.a.createElement(F.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},r.a.createElement("i",{className:"".concat(me.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return ei([].concat(Object(u.a)(At),[""]))}})))}),r.a.createElement("p",{className:"c-orange"},"\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\u8F93\u5165\u6846\u53EF\u8BBE\u7F6E\u7B54\u6848\uFF1B\u9009\u4E2D\u7684\u9009\u9879\u5373\u4E3A\u6B63\u786E\u7B54\u6848\uFF0C\u9009\u62E9\u591A\u4E2A\u7B54\u6848\u5373\u4E3A\u591A\u9009\u9898"),r.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",r.a.createElement(S.a,{value:wi,max:1e4,min:-1,onChange:function(ze){vi(ze)}})," \u5206"),r.a.createElement("aside",{className:"tr"},xe.question_id&&r.a.createElement(Z.a,{type:"default",onClick:function(){return N(!1)}},"\u53D6\u6D88"),r.a.createElement(Z.a,{className:"ml20",type:"primary",onClick:function(){return G()}},"\u4FDD\u5B58")))};return r.a.createElement("section",{className:me.a.wrap},!C&&Me(),C&&ot())},Se=Object(M.a)(function(tt){var ke=tt.problemset,Ct=tt.loading,Rt=tt.globalSetting;return{problemset:ke,globalSetting:Rt,loading:Ct.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(se)),je=ne("7Kak"),We=ne("9yH6"),Xe=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Qe=function(ke,Ct){var Rt=ke.problemset,ni=ke.globalSetting,Qt=ke.loading,Tt=ke.dispatch,qe=ke.onRef,Oi=qe===void 0?function(){}:qe,xe=ke.editData,Dt=Object(w.a)(ke,["problemset","globalSetting","loading","dispatch","onRef","editData"]),Ut=Object(m.useState)([]),Ft=Object(x.a)(Ut,2),At=Ft[0],ei=Ft[1],di=Object(m.useState)(),Bt=Object(x.a)(di,2),it=Bt[0],fi=Bt[1],ri=Object(m.useState)([]),Kt=Object(x.a)(ri,2),Et=Kt[0],Nt=Kt[1],ti=Object(m.useState)(""),oi=Object(x.a)(ti,2),De=oi[0],gt=oi[1],pi=Object(m.useState)(0),Ei=Object(x.a)(pi,2),wi=Ei[0],vi=Ei[1],K=Object(m.useState)(!1),_=Object(x.a)(K,2),C=_[0],N=_[1],Q=Object(b.i)();Object(m.useEffect)(function(){ei(["","","",""])},[]),Object(m.useEffect)(function(){if(!(xe!=null&&xe.question_choices)){N(!0);return}gt(xe==null?void 0:xe.question_title),vi(parseInt(xe==null?void 0:xe.question_score)),ei(xe==null?void 0:xe.question_choices.map(function($e){return $e.choice_text}));var Re=[];xe==null||xe.standard_answer.map(function($e,ze){Re.push($e-1)}),Nt(Re)},[xe]),Object(m.useImperativeHandle)(Ct,function(){return{onSave:G,isEdit:C}});var G=function(){var Re=Object(l.a)(a.a.mark(function $e(){var ze,xt,vt;return a.a.wrap(function(Pt){for(;;)switch(Pt.prev=Pt.next){case 0:if(De){Pt.next=3;break}return d.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),Pt.abrupt("return",!1);case 3:if(ze=At.findIndex(function(zt){return!zt}),!(ze>-1)){Pt.next=7;break}return d.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(Xe[ze]," \u9009\u9879\u7684\u5185\u5BB9")),Pt.abrupt("return",!1);case 7:if(Et.length){Pt.next=10;break}return d.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),Pt.abrupt("return",!1);case 10:if(!(Et.length<1)){Pt.next=13;break}return d.b.info("\u8BF7\u9009\u62E9\u7B54\u6848"),Pt.abrupt("return",!1);case 13:if(xt=At.map(function(zt,yi){return{choice_text:zt,is_answer:Et.includes(yi)?yi+1:0}}),!xe.question_id){Pt.next=20;break}return Pt.next=17,Object(X.u)({id:xe.question_id,question_title:De,question_type:1,question_score:wi,question_choices:xt.map(function(zt){return zt.choice_text}),standard_answers:xt.filter(function(zt){return zt.is_answer}).map(function(zt){return zt.is_answer})});case 17:vt=Pt.sent,Pt.next=23;break;case 20:return Pt.next=22,Object(X.a)({exercise_bank_id:Q.topicId,question_title:De,question_type:1,question_score:"5.0",question_choices:xt.map(function(zt){return zt.choice_text}),standard_answers:xt.filter(function(zt){return zt.is_answer}).map(function(zt){return zt.is_answer})});case 22:vt=Pt.sent;case 23:return vt.status===0&&(d.b.success("\u4FDD\u5B58\u6210\u529F"),N(!1)),Pt.next=26,Tt({type:"polls/getExerciseBanks",payload:Object(s.a)({},Q)});case 26:case"end":return Pt.stop()}},$e)}));return function(){return Re.apply(this,arguments)}}(),le=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],Ae=function(){var Re=Object(l.a)(a.a.mark(function $e(ze){return a.a.wrap(function(vt){for(;;)switch(vt.prev=vt.next){case 0:vt.t0=ze.id,vt.next=vt.t0==="del"?3:vt.t0==="up"||vt.t0==="down"?5:vt.t0==="edit"?9:11;break;case 3:return ae.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(l.a)(a.a.mark(function Pt(){return a.a.wrap(function(yi){for(;;)switch(yi.prev=yi.next){case 0:return yi.next=2,Object(X.e)({pollsId:xe.question_id});case 2:Tt({type:"polls/getExerciseBanks",payload:Object(s.a)({},Q)});case 3:case"end":return yi.stop()}},Pt)}))()}}),vt.abrupt("break",11);case 5:return vt.next=7,Object(X.j)({exerciseId:xe==null?void 0:xe.question_id,opr:ze.id});case 7:return Tt({type:"polls/getExerciseBanks",payload:Object(s.a)({},Q)}),vt.abrupt("break",11);case 9:return N(!0),vt.abrupt("break",11);case 11:case"end":return vt.stop()}},$e)}));return function(ze){return Re.apply(this,arguments)}}(),Me=function(){var $e;return r.a.createElement("aside",null,r.a.createElement("div",{className:me.a.questionType},r.a.createElement("div",null,r.a.createElement("span",{className:"font16 c-blue"},xe.key,"\u3001\u5355\u9009\u9898"),"\uFF08",xe.question_score,"\u5206\uFF09"),!xe.hideAction&&le.map(function(ze,xt){return ze.id==="up"&&xe.key===1||ze.id==="down"&&xe.key===xe.len?null:r.a.createElement(F.a,{key:xt,placement:"bottom",title:ze.name},r.a.createElement("span",{onClick:function(){return Ae(ze)},className:ze.icon}))})),r.a.createElement("div",{className:"mt5"},r.a.createElement(Ee.a,{value:xe.question_title})),r.a.createElement("div",{className:me.a.questionChoices},xe==null||(($e=xe.question_choices)===null||$e===void 0)?void 0:$e.map(function(ze,xt){return r.a.createElement(H.a,null,r.a.createElement(L.a,null,r.a.createElement(We.a,{key:xt,checked:xe.standard_answer.includes(xt+1),disabled:!0},Xe[xt],".")),r.a.createElement(L.a,{flex:"1"},r.a.createElement("span",{className:"c-black font14"},r.a.createElement(Ee.a,{value:ze.choice_text}))))})))},ot=function(){return r.a.createElement("aside",null,r.a.createElement("div",{className:me.a.questionType},r.a.createElement("div",null,r.a.createElement("span",{className:"font16 c-blue"},"\u9009\u62E9\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09")),r.a.createElement("p",{className:me.a.titleWrap},r.a.createElement("span",{className:me.a.required},"*"),r.a.createElement("span",{className:me.a.title},"\u9898\u5E72\uFF1A")),r.a.createElement(de.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:De,onChange:function(ze){return gt(ze)}}),At.map(function($e,ze){return r.a.createElement("div",{className:me.a.choiceWrap,key:ze},r.a.createElement(F.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},r.a.createElement("div",{className:"".concat(me.a.answer," ").concat(Et.includes(ze)?me.a.activeAnswer:""),onClick:function(){Et.includes(ze)?Nt(Et.filter(function(vt){return vt!==ze})):Nt([].concat(Object(u.a)(Et),[ze]))}},Xe[ze])),r.a.createElement("div",{className:me.a.editorWrap},it===ze?r.a.createElement(de.a,{id:"single-question-option-".concat(ze),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:$e,onChange:function(vt){At[ze]=vt,ei(At)}}):r.a.createElement("div",{className:me.a.htmlWrap,onClick:function(){return fi(ze)}},r.a.createElement(Ee.a,{value:$e}))),ze>1&&r.a.createElement(F.a,{title:"\u5220\u9664"},r.a.createElement("i",{className:"".concat(me.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return ei(At.filter(function(vt,hi){return hi!==ze}))}})),ze<7&&ze===At.length-1&&r.a.createElement(F.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},r.a.createElement("i",{className:"".concat(me.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return ei([].concat(Object(u.a)(At),[""]))}})))}),r.a.createElement("p",{className:"c-orange"},"\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\u8F93\u5165\u6846\u53EF\u8BBE\u7F6E\u7B54\u6848\uFF1B\u9009\u4E2D\u7684\u9009\u9879\u5373\u4E3A\u6B63\u786E\u7B54\u6848\uFF0C\u9009\u62E9\u591A\u4E2A\u7B54\u6848\u5373\u4E3A\u591A\u9009\u9898"),r.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",r.a.createElement(S.a,{value:wi,max:1e4,min:-1,onChange:function(ze){vi(ze)}})," \u5206"),r.a.createElement("aside",{className:"tr"},xe.question_id&&r.a.createElement(Z.a,{type:"default",onClick:function(){return N(!1)}},"\u53D6\u6D88"),r.a.createElement(Z.a,{className:"ml20",type:"primary",onClick:function(){return G()}},"\u4FDD\u5B58")))};return r.a.createElement("section",{className:me.a.wrap},!C&&Me(),C&&ot())},Pe=Object(M.a)(function(tt){var ke=tt.problemset,Ct=tt.loading,Rt=tt.globalSetting;return{problemset:ke,globalSetting:Rt,loading:Ct.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Qe)),Ue=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Ye=function(ke,Ct){var Rt=ke.problemset,ni=ke.globalSetting,Qt=ke.loading,Tt=ke.dispatch,qe=ke.onRef,Oi=qe===void 0?function(){}:qe,xe=ke.editData,Dt=Object(w.a)(ke,["problemset","globalSetting","loading","dispatch","onRef","editData"]),Ut=Object(m.useState)(),Ft=Object(x.a)(Ut,2),At=Ft[0],ei=Ft[1],di=Object(m.useState)(""),Bt=Object(x.a)(di,2),it=Bt[0],fi=Bt[1],ri=Object(m.useState)(!1),Kt=Object(x.a)(ri,2),Et=Kt[0],Nt=Kt[1],ti=Object(m.useState)(5),oi=Object(x.a)(ti,2),De=oi[0],gt=oi[1],pi=Object(b.i)();Object(m.useEffect)(function(){if(!(xe!=null&&xe.question_choices)){Nt(!0);return}fi(xe==null?void 0:xe.question_title),gt(xe==null?void 0:xe.question_score),ei(xe.standard_answer[0]+"")},[xe]),Object(m.useImperativeHandle)(Ct,function(){return{onSave:Ei,isEdit:Et}});var Ei=function(){var C=Object(l.a)(a.a.mark(function N(){var Q,G;return a.a.wrap(function(Ae){for(;;)switch(Ae.prev=Ae.next){case 0:if(it){Ae.next=3;break}return d.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),Ae.abrupt("return",!1);case 3:if(At){Ae.next=6;break}return d.b.info("\u8BF7\u5148\u70B9\u51FB\u9009\u62E9\u672C\u9009\u62E9\u9898\u7684\u6B63\u786E\u9009\u9879"),Ae.abrupt("return",!1);case 6:if(Q=[{choice_text:"\u6B63\u786E",is_answer:At==="1"?1:0},{choice_text:"\u9519\u8BEF",is_answer:At==="2"?2:0}],!xe.question_id){Ae.next=13;break}return Ae.next=10,Object(X.u)({id:xe.question_id,question_title:it,question_type:2,question_score:De,question_choices:Q.map(function(Me){return Me.choice_text}),standard_answers:Q.filter(function(Me){return Me.is_answer}).map(function(Me){return Me.is_answer})});case 10:G=Ae.sent,Ae.next=16;break;case 13:return Ae.next=15,Object(X.a)({exercise_bank_id:pi.topicId,question_title:it,question_type:2,question_score:De,question_choices:Q.map(function(Me){return Me.choice_text}),standard_answers:Q.filter(function(Me){return Me.is_answer}).map(function(Me){return Me.is_answer})});case 15:G=Ae.sent;case 16:return G.status===0&&(d.b.success("\u4FDD\u5B58\u6210\u529F"),Nt(!1)),Tt({type:"polls/getExerciseBanks",payload:Object(s.a)({},pi)}),Ae.abrupt("return",{name:it,choices:Q});case 19:case"end":return Ae.stop()}},N)}));return function(){return C.apply(this,arguments)}}(),wi=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],vi=function(){var C=Object(l.a)(a.a.mark(function N(Q){return a.a.wrap(function(le){for(;;)switch(le.prev=le.next){case 0:le.t0=Q.id,le.next=le.t0==="del"?3:le.t0==="up"||le.t0==="down"?5:le.t0==="edit"?9:11;break;case 3:return ae.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(l.a)(a.a.mark(function Me(){return a.a.wrap(function(Re){for(;;)switch(Re.prev=Re.next){case 0:return Re.next=2,Object(X.e)({pollsId:xe.question_id});case 2:Tt({type:"polls/getExerciseBanks",payload:Object(s.a)({},pi)});case 3:case"end":return Re.stop()}},Me)}))()}}),le.abrupt("break",11);case 5:return le.next=7,Object(X.j)({exerciseId:xe==null?void 0:xe.question_id,opr:Q.id});case 7:return Tt({type:"polls/getExerciseBanks",payload:Object(s.a)({},pi)}),le.abrupt("break",11);case 9:return Nt(!0),le.abrupt("break",11);case 11:case"end":return le.stop()}},N)}));return function(Q){return C.apply(this,arguments)}}(),K=function(){var N;return r.a.createElement("aside",null,r.a.createElement("div",{className:me.a.questionType},r.a.createElement("div",null,r.a.createElement("span",{className:"font16 c-blue"},xe.key,"\u3001\u5224\u65AD\u9898"),"\uFF08",xe.question_score,"\u5206\uFF09"),!xe.hideAction&&wi.map(function(Q,G){return Q.id==="up"&&xe.key===1||Q.id==="down"&&xe.key===xe.len?null:r.a.createElement(F.a,{key:G,placement:"bottom",title:Q.name},r.a.createElement("span",{onClick:function(){return vi(Q)},className:Q.icon}))})),r.a.createElement("div",{className:"mt5"},xe.question_title),r.a.createElement("div",{className:me.a.questionChoices},xe==null||((N=xe.question_choices)===null||N===void 0)?void 0:N.map(function(Q,G){return r.a.createElement(We.a,{key:G,checked:xe.standard_answer.includes(G+1),disabled:!0},Ue[G],". ",r.a.createElement("span",{className:"c-black font14"},Q.choice_text))})))},_=function(){return r.a.createElement("aside",null,r.a.createElement("div",null,r.a.createElement("span",{className:"font16 c-blue"},"\u5224\u65AD\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09"),r.a.createElement("p",{className:me.a.titleWrap},r.a.createElement("span",{className:me.a.required},"*"),r.a.createElement("span",{className:me.a.title},"\u9898\u5E72\uFF1A")),r.a.createElement(de.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:it,onChange:function(Q){return fi(Q)}}),r.a.createElement("p",{className:me.a.titleWrap},r.a.createElement("span",{className:me.a.required},"*"),r.a.createElement("span",{className:me.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",r.a.createElement("span",{className:me.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),r.a.createElement(We.a.Group,{buttonStyle:"solid",value:At,onChange:function(Q){return ei(Q.target.value)}},r.a.createElement(We.a.Button,{value:"1",className:"".concat(me.a.radio," mr40")},"\u6B63\u786E"),r.a.createElement(We.a.Button,{value:"2",className:me.a.radio},"\u9519\u8BEF")),r.a.createElement("p",{className:"c-orange"},"\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\uFF0C\u53EF\u4EE5\u76F4\u63A5\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848"),r.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",r.a.createElement(S.a,{value:De,max:1e4,min:-1,onChange:function(Q){gt(Q)}})," \u5206"),r.a.createElement("aside",{className:"tr"},xe.question_id&&r.a.createElement(Z.a,{type:"default",onClick:function(){return Nt(!1)}},"\u53D6\u6D88"),r.a.createElement(Z.a,{className:"ml20",type:"primary",onClick:function(){return Ei()}},"\u4FDD\u5B58")))};return r.a.createElement("section",{className:me.a.wrap},!Et&&K(),Et&&_())},Ze=Object(M.a)(function(tt){var ke=tt.problemset,Ct=tt.loading,Rt=tt.globalSetting;return{problemset:ke,globalSetting:Rt,loading:Ct.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Ye)),Ve=ne("kqOp"),He=ne("7qnI"),Fe=ne("1vsH"),ft=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],lt=function(ke,Ct){var Rt=ke.problemset,ni=ke.globalSetting,Qt=ke.loading,Tt=ke.dispatch,qe=ke.editData,Oi=Object(w.a)(ke,["problemset","globalSetting","loading","dispatch","editData"]),xe=Object(m.useState)(""),Dt=Object(x.a)(xe,2),Ut=Dt[0],Ft=Dt[1],At=Object(m.useState)(""),ei=Object(x.a)(At,2),di=ei[0],Bt=ei[1],it=Object(m.useState)([]),fi=Object(x.a)(it,2),ri=fi[0],Kt=fi[1],Et=Object(m.useState)(""),Nt=Object(x.a)(Et,2),ti=Nt[0],oi=Nt[1],De=Object(m.useState)(),gt=Object(x.a)(De,2),pi=gt[0],Ei=gt[1],wi=Object(m.useState)(!1),vi=Object(x.a)(wi,2),K=vi[0],_=vi[1],C=Object(m.useState)(5),N=Object(x.a)(C,2),Q=N[0],G=N[1],le=Object(m.useState)(!1),Ae=Object(x.a)(le,2),Me=Ae[0],ot=Ae[1],Re=Object(b.i)();Object(m.useEffect)(function(){if(!(qe!=null&&qe.question_title)){ot(!0);return}Ft(qe==null?void 0:qe.question_title),Ei(qe==null?void 0:qe.is_ordered),G(qe==null?void 0:qe.question_score);var Jt=qe==null?void 0:qe.standard_answer.map(function(wt){return wt.answer_text});Kt(Jt)},[Rt.editData]),Object(m.useEffect)(function(){_(!1)},[Me]),Object(m.useImperativeHandle)(Ct,function(){return{onSave:$e,isEdit:Me}});var $e=function(){var Jt=Object(l.a)(a.a.mark(function wt(){var mt,Wt,$t;return a.a.wrap(function(Ht){for(;;)switch(Ht.prev=Ht.next){case 0:if(mt=[],Wt=!1,ri.forEach(function(Fi,Di){mt.push({choice_id:Di+1,answer_text:[]}),Fi.forEach(function(en,gn){mt[Di].answer_text.push(en),(!en||!Object(Fe.db)(en,1e4))&&(oi("".concat(Di,"-").concat(gn)),d.b.info(en?"\u7B54\u6848\u4E0D\u80FD\u8D85\u8FC710000\u5B57\u7B26":"\u7B54\u6848\uFF1A\u4E0D\u80FD\u4E3A\u7A7A"),Wt=!0)})}),!Wt){Ht.next=5;break}return Ht.abrupt("return",!1);case 5:if(!qe.question_id){Ht.next=11;break}return Ht.next=8,Object(X.u)({id:qe.question_id,question_title:Ut,question_type:3,question_score:Q,is_ordered:pi,standard_answers:mt});case 8:$t=Ht.sent,Ht.next=14;break;case 11:return Ht.next=13,Object(X.a)({exercise_bank_id:Re.topicId,question_title:Ut,question_type:3,question_score:Q,is_ordered:pi,standard_answers:mt});case 13:$t=Ht.sent;case 14:return $t.status===0&&(d.b.success("\u4FDD\u5B58\u6210\u529F"),ot(!1)),Tt({type:"polls/getExerciseBanks",payload:Object(s.a)({},Re)}),Ht.abrupt("return",{name:Ut,analysis:di,standard_answers:mt,is_ordered:pi});case 17:case"end":return Ht.stop()}},wt)}));return function(){return Jt.apply(this,arguments)}}(),ze=function(wt,mt,Wt){var $t=ri.slice();if(mt&&$t.splice(wt,mt),Wt&&K)for(var ai=0;ai<Wt;ai++)$t.splice(wt+ai,0,[""]);_(!0),Kt($t)},xt=function(wt,mt,Wt){oi("");var $t=ri.slice();$t[wt][mt]=Wt,Kt($t)},vt=function(wt){var mt=ri.slice();mt[wt]=[].concat(Object(u.a)(mt[wt]),[""]),Kt(mt)},hi=function(wt,mt){var Wt=ri.slice();if(!Wt[wt][mt]){Wt[wt]=Wt[wt].filter(function($t,ai){return ai!==mt}),Kt(Wt);return}ae.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:me.a.modal,onOk:function(){Wt[wt]=Wt[wt].filter(function(ai,Ht){return Ht!==mt}),Kt(Wt)}})},Pt=function(wt){ae.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:me.a.modal,onOk:function(){var Wt=ri.slice();Wt=ri.filter(function($t,ai){return wt!==ai}),Kt(Wt)}})},zt=function(){return r.a.createElement("aside",null,r.a.createElement("div",{className:me.a.questionType},r.a.createElement("div",null,r.a.createElement("span",{className:"font16 c-blue"},"\u586B\u7A7A\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u5141\u8BB8\u624B\u52A8\u8C03\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848 \uFF1B\u652F\u6301\u6700\u591A5\u4E2A\u7A7A\uFF0C\u6BCF\u7A7A\u5F97\u5206\u6309\u7167\u672C\u9898\u7684\u603B\u5206\u5E73\u5747\u8BA1\u7B97\uFF09")),r.a.createElement("div",null,r.a.createElement(Ve.a,{id:"completion-question-tittle",placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE",height:155,defaultValue:Ut,onChange:function(mt){return Ft(mt)},showNullButton:!0,onPlaceholderChange:ze})),r.a.createElement("div",{className:"mt20"},ri.map(function(wt,mt){return r.a.createElement(He.a,{key:mt,answers:wt,index:mt,is_md:!0,activeOptionErrorIndex:ti,onAnswerChange:xt,addChildAnswer:vt,deleteChildAnswer:hi,deleteChildAnswermain:Pt})})),r.a.createElement("div",{className:"mt20"},ri.length>1&&r.a.createElement("span",null,r.a.createElement(J.a,{checked:pi,onChange:function(mt){return Ei(mt.target.checked)},className:"".concat(me.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),r.a.createElement("span",{className:"".concat(me.a.color999," font12")},"\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"))),r.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",r.a.createElement(S.a,{value:Q,max:1e4,min:-1,onChange:function(mt){G(mt)}})," \u5206"),r.a.createElement("aside",{className:"tr"},qe.question_id&&r.a.createElement(Z.a,{type:"default",onClick:function(){return ot(!1)}},"\u53D6\u6D88"),r.a.createElement(Z.a,{className:"ml20",type:"primary",onClick:function(){return $e()}},"\u4FDD\u5B58")))},yi=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],Si=function(){var Jt=Object(l.a)(a.a.mark(function wt(mt){return a.a.wrap(function($t){for(;;)switch($t.prev=$t.next){case 0:$t.t0=mt.id,$t.next=$t.t0==="del"?3:$t.t0==="up"||$t.t0==="down"?5:$t.t0==="edit"?9:11;break;case 3:return ae.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(l.a)(a.a.mark(function Ht(){return a.a.wrap(function(Di){for(;;)switch(Di.prev=Di.next){case 0:return Di.next=2,Object(X.e)({pollsId:qe.question_id});case 2:Tt({type:"polls/getExerciseBanks",payload:Object(s.a)({},Re)});case 3:case"end":return Di.stop()}},Ht)}))()}}),$t.abrupt("break",11);case 5:return $t.next=7,Object(X.j)({exerciseId:qe==null?void 0:qe.question_id,opr:mt.id});case 7:return Tt({type:"polls/getExerciseBanks",payload:Object(s.a)({},Re)}),$t.abrupt("break",11);case 9:return ot(!0),$t.abrupt("break",11);case 11:case"end":return $t.stop()}},wt)}));return function(mt){return Jt.apply(this,arguments)}}(),bi=function(){var wt;return r.a.createElement("aside",null,r.a.createElement("div",{className:me.a.questionType},r.a.createElement("div",null,r.a.createElement("span",{className:"font16 c-blue"},qe.key,"\u3001\u586B\u7A7A\u9898"),"\uFF08",qe.question_score,"\u5206\uFF09"),!qe.hideAction&&yi.map(function(mt,Wt){return mt.id==="up"&&qe.key===1||mt.id==="down"&&qe.key===qe.len?null:r.a.createElement(F.a,{key:Wt,placement:"bottom",title:mt.name},r.a.createElement("span",{onClick:function(){return Si(mt)},className:mt.icon}))})),r.a.createElement("div",{className:"mt5"},qe.question_title),r.a.createElement("div",{className:me.a.questionChoices},qe==null||((wt=qe.standard_answer)===null||wt===void 0)?void 0:wt.map(function(mt,Wt){return r.a.createElement(H.a,null,r.a.createElement(L.a,null,"\u7B54\u6848\uFF08\u586B\u7A7A",mt.choice_id,"\uFF09\uFF1A"),r.a.createElement(L.a,{flex:"1"},r.a.createElement($.a,{key:Wt,checked:qe.standard_answer.includes(Wt),disabled:!0,value:mt.answer_text})))})))};return r.a.createElement("section",{className:me.a.wrap},!Me&&bi(),Me&&zt())},rt=Object(M.a)(function(tt){var ke=tt.problemset,Ct=tt.loading,Rt=tt.globalSetting;return{problemset:ke,globalSetting:Rt,loading:Ct.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(lt)),dt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],bt=function(ke,Ct){var Rt=ke.problemset,ni=ke.globalSetting,Qt=ke.loading,Tt=ke.dispatch,qe=ke.onRef,Oi=qe===void 0?function(){}:qe,xe=ke.editData,Dt=Object(w.a)(ke,["problemset","globalSetting","loading","dispatch","onRef","editData"]),Ut=Object(m.useState)(""),Ft=Object(x.a)(Ut,2),At=Ft[0],ei=Ft[1],di=Object(m.useState)(""),Bt=Object(x.a)(di,2),it=Bt[0],fi=Bt[1],ri=Object(m.useState)(""),Kt=Object(x.a)(ri,2),Et=Kt[0],Nt=Kt[1],ti=Object(m.useState)(5),oi=Object(x.a)(ti,2),De=oi[0],gt=oi[1],pi=Object(m.useState)(!1),Ei=Object(x.a)(pi,2),wi=Ei[0],vi=Ei[1],K=Object(b.i)();Object(m.useEffect)(function(){var le;if(!(xe!=null&&xe.question_title)){vi(!0);return}ei(xe==null?void 0:xe.question_title),Nt(xe==null||((le=xe.standard_answer)===null||le===void 0)?void 0:le[0]),gt(xe==null?void 0:xe.question_score)},[Rt.editData]),Object(m.useImperativeHandle)(Ct,function(){return{onSave:_,isEdit:wi}});var _=function(){var le=Object(l.a)(a.a.mark(function Ae(){var Me;return a.a.wrap(function(Re){for(;;)switch(Re.prev=Re.next){case 0:if(At){Re.next=3;break}return d.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),Re.abrupt("return",!1);case 3:if(!xe.question_id){Re.next=9;break}return Re.next=6,Object(X.u)({id:xe.question_id,question_title:At,question_type:4,question_score:De,standard_answers:[Et]});case 6:Me=Re.sent,Re.next=12;break;case 9:return Re.next=11,Object(X.a)({exercise_bank_id:K.topicId,question_title:At,question_type:4,question_score:De,standard_answers:[Et]});case 11:Me=Re.sent;case 12:return Me.status===0&&(d.b.success("\u4FDD\u5B58\u6210\u529F"),vi(!1),Tt({type:"polls/getExerciseBanks",payload:Object(s.a)({},K)})),Re.abrupt("return",{name:At,answer_texts:[Et],analysis:it});case 14:case"end":return Re.stop()}},Ae)}));return function(){return le.apply(this,arguments)}}(),C=function(){return r.a.createElement("aside",null,r.a.createElement("div",{className:me.a.questionType},r.a.createElement("div",null,r.a.createElement("span",{className:"font16 c-blue"},"\u7B80\u7B54\u9898"),"\uFF08\u4E3B\u89C2\u9898\uFF0C\u672A\u4F5C\u7B54\u7684\u60C5\u51B5\u4E0B\u81EA\u52A8\u8BC4\u4E3A\u96F6\u5206\uFF09")),r.a.createElement(de.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:At,onChange:function(Me){return ei(Me)}}),r.a.createElement("p",{className:me.a.titleWrap},r.a.createElement("span",{className:me.a.title},"\u53C2\u8003\u7B54\u6848\uFF1A")),r.a.createElement(de.a,{id:"single-question-reference-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848",defaultValue:Et,onChange:function(Me){return Nt(Me)}}),r.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",r.a.createElement(S.a,{value:De,max:1e4,min:-1,onChange:function(Me){gt(Me)}})," \u5206"),r.a.createElement("aside",{className:"tr"},xe.question_id&&r.a.createElement(Z.a,{type:"default",onClick:function(){return vi(!1)}},"\u53D6\u6D88"),r.a.createElement(Z.a,{className:"ml20",type:"primary",onClick:function(){return _()}},"\u4FDD\u5B58")))},N=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],Q=function(){var le=Object(l.a)(a.a.mark(function Ae(Me){return a.a.wrap(function(Re){for(;;)switch(Re.prev=Re.next){case 0:Re.t0=Me.id,Re.next=Re.t0==="del"?3:Re.t0==="up"||Re.t0==="down"?5:Re.t0==="edit"?9:11;break;case 3:return ae.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(l.a)(a.a.mark(function ze(){return a.a.wrap(function(vt){for(;;)switch(vt.prev=vt.next){case 0:return vt.next=2,Object(X.e)({pollsId:xe.question_id});case 2:Tt({type:"polls/getExerciseBanks",payload:Object(s.a)({},K)});case 3:case"end":return vt.stop()}},ze)}))()}}),Re.abrupt("break",11);case 5:return Re.next=7,Object(X.j)({exerciseId:xe==null?void 0:xe.question_id,opr:Me.id});case 7:return Tt({type:"polls/getExerciseBanks",payload:Object(s.a)({},K)}),Re.abrupt("break",11);case 9:return vi(!0),Re.abrupt("break",11);case 11:case"end":return Re.stop()}},Ae)}));return function(Me){return le.apply(this,arguments)}}(),G=function(){return r.a.createElement("aside",null,r.a.createElement("div",{className:me.a.questionType},r.a.createElement("div",null,r.a.createElement("span",{className:"font16 c-blue"},xe.key,"\u3001\u7B80\u7B54\u9898"),"\uFF08",xe.question_score,"\u5206\uFF09"),!xe.hideAction&&N.map(function(Ae,Me){return Ae.id==="up"&&xe.key===1||Ae.id==="down"&&xe.key===xe.len?null:r.a.createElement(F.a,{key:Me,placement:"bottom",title:Ae.name},r.a.createElement("span",{onClick:function(){return Q(Ae)},className:Ae.icon}))})),r.a.createElement("div",{className:"mt5"},xe.question_title),r.a.createElement("div",{className:me.a.questionChoices},r.a.createElement("p",null,r.a.createElement("strong",null,"\u53C2\u8003\u7B54\u6848\uFF1A")),r.a.createElement(Ee.a,{value:Et})))};return r.a.createElement("section",{className:me.a.wrap},!wi&&G(),wi&&C())},ut=Object(M.a)(function(tt){var ke=tt.problemset,Ct=tt.loading,Rt=tt.globalSetting;return{problemset:ke,globalSetting:Rt,loading:Ct.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(bt)),at=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Ie=function(ke,Ct){var Rt=ke.problemset,ni=ke.globalSetting,Qt=ke.loading,Tt=ke.dispatch,qe=ke.editData,Oi=Object(w.a)(ke,["problemset","globalSetting","loading","dispatch","editData"]),xe=Object(m.useState)(""),Dt=Object(x.a)(xe,2),Ut=Dt[0],Ft=Dt[1],At=Object(m.useState)(""),ei=Object(x.a)(At,2),di=ei[0],Bt=ei[1],it=Object(m.useState)(""),fi=Object(x.a)(it,2),ri=fi[0],Kt=fi[1],Et=Object(m.useState)([]),Nt=Object(x.a)(Et,2),ti=Nt[0],oi=Nt[1],De=Object(m.useState)(""),gt=Object(x.a)(De,2),pi=gt[0],Ei=gt[1],wi=Object(m.useState)(),vi=Object(x.a)(wi,2),K=vi[0],_=vi[1],C=Object(m.useState)(!1),N=Object(x.a)(C,2),Q=N[0],G=N[1],le=Object(m.useState)([]),Ae=Object(x.a)(le,2),Me=Ae[0],ot=Ae[1],Re=Object(m.useState)(!1),$e=Object(x.a)(Re,2),ze=$e[0],xt=$e[1],vt=Object(b.i)();Object(m.useEffect)(function(){var bi;qe.edit&&xt(!0),Ft(qe.shixun_name),Bt(qe.question_title);var Jt=[];(bi=qe.shixun)===null||bi===void 0||bi.map(function(wt){Jt.push(wt.challenge_score)}),ot(Jt)},[qe]),Object(m.useEffect)(function(){G(!1)},[ze]),Object(m.useImperativeHandle)(Ct,function(){return{onSave:hi,isEdit:ze}});var hi=function(){var bi=Object(l.a)(a.a.mark(function Jt(){var wt,mt,Wt;return a.a.wrap(function(ai){for(;;)switch(ai.prev=ai.next){case 0:if(wt=[],mt=!1,!mt){ai.next=4;break}return ai.abrupt("return",!1);case 4:if(!qe.question_id){ai.next=10;break}return ai.next=7,Object(X.u)({id:qe.question_id,question_title:di,shixun_name:Ut,shixun_id:qe.shixun_id,question_type:5,question_scores:Me});case 7:Wt=ai.sent,ai.next=13;break;case 10:return ai.next=12,Object(X.a)({exercise_bank_id:vt.topicId,question_title:di,shixun_name:Ut,shixun_id:qe.shixun_id,question_type:5,question_scores:Me});case 12:Wt=ai.sent;case 13:return Wt.status===0&&(d.b.success("\u4FDD\u5B58\u6210\u529F"),xt(!1)),ai.next=16,Tt({type:"polls/getExerciseBanks",payload:Object(s.a)({},vt)});case 16:return ai.abrupt("return",{name:di,analysis:ri,standard_answers:wt,is_ordered:K});case 17:case"end":return ai.stop()}},Jt)}));return function(){return bi.apply(this,arguments)}}(),Pt=function(){var Jt;return r.a.createElement("aside",null,r.a.createElement("div",{className:me.a.questionType},r.a.createElement("div",null,r.a.createElement("span",{className:"font16 c-blue"},"\u5B9E\u8BAD\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u5141\u8BB8\u624B\u52A8\u8C03\u5206\uFF09")),r.a.createElement("div",{className:"mt10"},r.a.createElement($.a,{defaultValue:Ut,onChange:function(mt){Ft(mt.target.value)}})),r.a.createElement("div",{className:"mt10"},r.a.createElement(de.a,{id:"single-question-option-0",height:155,placeholder:"\u8BF7\u8F93\u5165\u5B9E\u8BAD\u9898\u5B8C\u6210\u8981\u6C42",defaultValue:di,onChange:function(mt){Bt(mt)}})),r.a.createElement("div",{className:"mt20"},(Jt=qe.shixun)===null||Jt===void 0?void 0:Jt.map(function(wt,mt){return r.a.createElement(H.a,{gutter:[20,20]},r.a.createElement(L.a,{flex:"1"},mt+1,".",wt.challenge_name),r.a.createElement(L.a,null,r.a.createElement(S.a,{defaultValue:Me[mt],onChange:function($t){Me[mt]=$t,ot(Me),console.log("srore:L",Me[mt])}})))})),r.a.createElement("div",{className:"mt20"},ti.length>1&&r.a.createElement("span",null,r.a.createElement(J.a,{checked:K,onChange:function(mt){return _(mt.target.checked)},className:"".concat(me.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),r.a.createElement("span",{className:"".concat(me.a.color999," font12")},"\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"))),r.a.createElement("aside",{className:"tr"},!(qe!=null&&qe.edit)&&r.a.createElement(Z.a,{type:"default",onClick:function(){return xt(!1)}},"\u53D6\u6D88"),r.a.createElement(Z.a,{className:"ml20",type:"primary",onClick:function(){return hi()}},"\u4FDD\u5B58")))},zt=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],yi=function(){var bi=Object(l.a)(a.a.mark(function Jt(wt){return a.a.wrap(function(Wt){for(;;)switch(Wt.prev=Wt.next){case 0:Wt.t0=wt.id,Wt.next=Wt.t0==="del"?3:Wt.t0==="up"||Wt.t0==="down"?5:Wt.t0==="edit"?9:11;break;case 3:return ae.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(l.a)(a.a.mark(function ai(){return a.a.wrap(function(Fi){for(;;)switch(Fi.prev=Fi.next){case 0:return Fi.next=2,Object(X.e)({pollsId:qe.question_id});case 2:Tt({type:"polls/getExerciseBanks",payload:Object(s.a)({},vt)});case 3:case"end":return Fi.stop()}},ai)}))()}}),Wt.abrupt("break",11);case 5:return Wt.next=7,Object(X.j)({exerciseId:qe==null?void 0:qe.question_id,opr:wt.id});case 7:return Tt({type:"polls/getExerciseBanks",payload:Object(s.a)({},vt)}),Wt.abrupt("break",11);case 9:return xt(!0),Wt.abrupt("break",11);case 11:case"end":return Wt.stop()}},Jt)}));return function(wt){return bi.apply(this,arguments)}}(),Si=function(){var Jt;return r.a.createElement("aside",null,r.a.createElement("div",{className:me.a.questionType},r.a.createElement("div",null,r.a.createElement("span",{className:"font16 c-blue"},qe.key,"\u3001\u5B9E\u8BAD\u9898"),"\uFF08",qe.question_score,"\u5206\uFF09"),r.a.createElement("div",{className:"tr"},r.a.createElement(P.a,{target:"_blank",to:"/shixuns/".concat(qe.shixun_identifier,"/challenges")},"\u5B9E\u8BAD\u8BE6\u60C5"),!qe.hideAction&&zt.map(function(wt,mt){return wt.id==="up"&&qe.key===1||wt.id==="down"&&qe.key===qe.len?null:r.a.createElement(F.a,{key:mt,placement:"bottom",title:wt.name},r.a.createElement("span",{onClick:function(){return yi(wt)},className:wt.icon}))}))),r.a.createElement("div",{className:"font16"},qe.shixun_name),r.a.createElement("div",{className:"mt30"}),(Jt=qe.shixun)===null||Jt===void 0?void 0:Jt.map(function(wt,mt){return r.a.createElement("div",{key:mt},"\u7B2C",mt+1,"\u5173 ",r.a.createElement("span",{className:"ml10"},wt.challenge_name)," ",r.a.createElement("span",{className:"ml10"},wt.challenge_score))}))};return r.a.createElement("section",{className:me.a.wrap},!ze&&Si(),ze&&Pt())},yt=Object(M.a)(function(tt){var ke=tt.problemset,Ct=tt.loading,Rt=tt.globalSetting;return{problemset:ke,globalSetting:Rt,loading:Ct.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Ie)),nt=ne("bbsP"),Oe=ne("/wGt"),Ge=ne("DjyN"),be=ne("NUBc"),fe=ne("uSYw"),pe=ne.n(fe),ie=$.a.Search,re=[{id:"type",name:"\u7B5B\u9009",children:[{name:"\u5168\u90E8\u5B9E\u8BAD",id:"all",type:"type"},{name:"\u6211\u7684\u5B9E\u8BAD",id:"mine",type:"type"}]},{id:"diff",name:"\u96BE\u5EA6",children:[{name:"\u5168\u90E8",id:"",type:"diff"},{name:"\u521D\u7EA7",id:1,type:"diff"},{name:"\u4E2D\u7EA7",id:2,type:"diff"},{name:"\u4E2D\u9AD8\u7EA7",id:3,type:"diff"},{name:"\u9AD8\u7EA7",id:4,type:"diff"}]}],ue=function(ke){var Ct,Rt=ke.classroomList,ni=ke.loading,Qt=ke.dispatch,Tt=ke.callback,qe=Object(b.i)(),Oi=Object(b.h)(),xe=Rt.actionTabs,Dt=O.a.useForm(),Ut=Object(x.a)(Dt,1),Ft=Ut[0],At=Rt.shixunLists,ei=Object(m.useState)([]),di=Object(x.a)(ei,2),Bt=di[0],it=di[1],fi=Object(m.useState)({page:1,type:"all",diff:"",status:"published",order:"desc",limit:20,sort:"publish_time",no_jupyter:1}),ri=Object(x.a)(fi,2),Kt=ri[0],Et=ri[1];return Object(m.useEffect)(function(){Qt({type:"classroomList/getShixunLists",payload:Object(s.a)({},Kt)})},[qe.categoryId]),Object(m.useEffect)(function(){it([])},[Rt.actionTabs.key]),Rt.actionTabs.key!=="\u9009\u7528\u5B9E\u8DF5\u9879\u76EE"?null:r.a.createElement(Oe.a,{title:"\u9009\u7528\u5B9E\u8DF5\u9879\u76EE",placement:"bottom",height:"100%",closable:!1,visible:Rt.actionTabs.key==="\u9009\u7528\u5B9E\u8DF5\u9879\u76EE",key:"bottom",className:pe.a.drawer,footer:r.a.createElement("div",{className:"tc"},r.a.createElement(Z.a,{size:"large",onClick:function(){Qt({type:"classroomList/setActionTabs",payload:{key:""}})},style:{marginRight:8}},"\u53D6\u6D88"),r.a.createElement(Z.a,{size:"large",onClick:Object(l.a)(a.a.mark(function Nt(){var ti;return a.a.wrap(function(De){for(;;)switch(De.prev=De.next){case 0:Bt.length>1?d.b.error("\u53EA\u80FD\u9009\u62E9\u4E00\u4E2A\u5B9E\u8DF5\u9879\u76EE"):Bt.length===0?d.b.error("\u8BF7\u9009\u62E9\u5B9E\u8DF5\u9879\u76EE"):(Tt&&Tt(At==null||((ti=At.shixun_list)===null||ti===void 0)?void 0:ti.filter(function(gt){return gt.id===Bt[0]})[0]),Qt({type:"classroomList/setActionTabs",payload:{key:""}}));case 1:case"end":return De.stop()}},Nt)})),type:"primary"},"\u786E\u5B9A"))},r.a.createElement("section",{className:"tc"},r.a.createElement(ie,{placeholder:"\u5B9E\u8BAD\u4FE1\u606F/\u9662\u6821\u540D\u79F0/\u521B\u5EFA\u8005",enterButton:"\u641C\u7D22",size:"large",className:pe.a.search,onSearch:function(ti){Kt.keyword=ti,Qt({type:"classroomList/getShixunLists",payload:Object(s.a)({},Kt)})}})),r.a.createElement("section",{className:"edu-container"},re.map(function(Nt,ti){var oi;return r.a.createElement("ul",{className:pe.a.menu,key:ti},r.a.createElement("li",null,Nt.name),Nt==null||((oi=Nt.children)===null||oi===void 0)?void 0:oi.map(function(De,gt){return r.a.createElement("li",{key:gt,className:Kt[Nt.id]==De.id?pe.a.actived:"",onClick:function(){Kt[Nt.id]=De.id,Et(Object(s.a)({},Kt)),Qt({type:"classroomList/getShixunLists",payload:Object(s.a)({},Kt)})}},r.a.createElement("strong",null,De.name))}))}),At==null||((Ct=At.shixun_list)===null||Ct===void 0)?void 0:Ct.map(function(Nt,ti){return r.a.createElement("div",{className:pe.a.listItem,key:ti},r.a.createElement(J.a,{checked:Bt.includes(Nt.id),value:Nt.id,onChange:function(De){var gt=Bt.indexOf(Nt.id);Bt.indexOf(Nt.id)>-1?it(Bt.filter(function(pi){return pi!==Nt.id})):it(Bt.concat(Nt.id))}}),r.a.createElement("div",{className:pe.a.info},r.a.createElement("div",{className:pe.a.title},r.a.createElement("div",{className:pe.a.titleLeft},r.a.createElement("strong",{className:"font16",dangerouslySetInnerHTML:{__html:Nt.title}}))),r.a.createElement("div",{className:"flex-wrp mt10 font14 c-light-black"},r.a.createElement("span",{className:pe.a.description,dangerouslySetInnerHTML:{__html:Nt.description}})),r.a.createElement("div",{className:" mt15"},Nt.challenge_names.map(function(oi,De){return r.a.createElement("span",{key:De,className:"mr30"},"\u7B2C",De+1,"\u5173 ",oi," ")})),r.a.createElement(c.a,{dashed:!0}),r.a.createElement("div",{className:"c-light-black mt20"},r.a.createElement("span",null,Nt.author_name),r.a.createElement("span",{className:"ml15 mr15"},"|"),r.a.createElement("span",null,Nt.author_school_name),r.a.createElement("span",{className:"ml15 mr15"},"|"),r.a.createElement("span",null,"\u96BE\u5EA6\u7CFB\u6570:",Nt.level),r.a.createElement("span",{className:"ml15 mr15"},"|"),r.a.createElement("span",null,"\u5B66\u4E60\u4EBA\u6570:"),r.a.createElement("span",null,Nt.study_count))))}),r.a.createElement("p",null)),r.a.createElement("div",{className:"tc"},r.a.createElement(be.a,{defaultCurrent:1,hideOnSinglePage:!0,defaultPageSize:20,showQuickJumper:!0,total:At==null?void 0:At.shixuns_count,onChange:function(ti){Kt.page=ti,it([]),Qt({type:"classroomList/getShixunLists",payload:Object(s.a)({},Kt)})}})))},ge=Object(M.a)(function(tt){var ke=tt.classroomList,Ct=tt.loading;return{classroomList:ke,loading:Ct}})(ue),ye=ne("uLbx"),Le=ne.n(ye),Be=E.a.SubMenu,pt=R.a.Content,It=R.a.Sider,Lt=function(ke){var Ct,Rt,ni,Qt,Tt,qe,Oi,xe,Dt,Ut,Ft,At,ei,di,Bt,it,fi,ri,Kt,Et,Nt,ti,oi,De,gt,pi,Ei,wi,vi,K,_,C,N,Q,G,le,Ae,Me,ot,Re,$e,ze,xt,vt,hi,Pt,zt,yi,Si,bi,Jt,wt,mt,Wt,$t,ai,Ht=ke.polls,Fi=ke.globalSetting,Di=ke.loading,en=ke.user,gn=ke.dispatch,Cn=Object(w.a)(ke,["polls","globalSetting","loading","user","dispatch"]),xi=Object(b.i)(),li=Object(b.h)(),Ci=en.userInfo,qt=O.a.useForm(),Ii=Object(x.a)(qt,1),ui=Ii[0],pn=Object(m.useState)([]),Pi=Object(x.a)(pn,2),Ri=Pi[0],En=Pi[1],xn=Object(m.useState)(!1),kn=Object(x.a)(xn,2),vn=kn[0],cn=kn[1],Hn=[{name:"\u9009\u62E9\u9898",id:0},{name:"\u5224\u65AD\u9898",id:2},{name:"\u586B\u7A7A\u9898",id:3},{name:"\u7B80\u7B54\u9898",id:4},{name:"\u5B9E\u8BAD\u9898",id:5}],Ki=Object(m.useRef)();Object(m.useEffect)(function(){var Vi;if((Vi=Ht.exerciseBanks)!==null&&Vi!==void 0&&Vi.exercise_questions){var et,kt,Ot,Xt,Yt;En(Object(u.a)((et=Ht.exerciseBanks)===null||et===void 0?void 0:et.exercise_questions)),ui.setFieldsValue({exercise_name:(kt=Ht.exerciseBanks)===null||kt===void 0||((Ot=kt.exercise)===null||Ot===void 0)?void 0:Ot.exercise_name,exercise_description:(Xt=Ht.exerciseBanks)===null||Xt===void 0||((Yt=Xt.exercise)===null||Yt===void 0)?void 0:Yt.exercise_description})}},[Ht.exerciseBanks]),Object(m.useEffect)(function(){gn({type:"polls/getExerciseBanks",payload:Object(s.a)({},xi)})},[xi.categoryId]);var Wn=function(){var Vi=Object(l.a)(a.a.mark(function et(){var kt,Ot,Xt;return a.a.wrap(function(ci){for(;;)switch(ci.prev=ci.next){case 0:return ci.next=2,ui.validateFields();case 2:return Xt=ui.getFieldValue(),Xt.is_md=!0,Xt.topicId=(kt=Ht.exerciseBanks)===null||kt===void 0||((Ot=kt.exercise)===null||Ot===void 0)?void 0:Ot.id,cn(!1),ci.next=8,Object(X.v)(Object(s.a)({},Xt));case 8:gn({type:"polls/getExerciseBanks",payload:Object(s.a)({},xi)});case 9:case"end":return ci.stop()}},et)}));return function(){return Vi.apply(this,arguments)}}(),qn=function(){var Vi=Object(l.a)(a.a.mark(function et(kt){var Ot;return a.a.wrap(function(Yt){for(;;)switch(Yt.prev=Yt.next){case 0:return Yt.next=2,Ki==null?void 0:Ki.current;case 2:if(Ot=Yt.sent,!(Ot!=null&&Ot.isEdit)){Yt.next=6;break}return d.b.error("\u4E0D\u80FD\u540C\u65F6\u7F16\u8F91\u4E24\u9898"),Yt.abrupt("return");case 6:kt===5?gn({type:"classroomList/setActionTabs",payload:{key:"\u9009\u7528\u5B9E\u8DF5\u9879\u76EE"}}):En([].concat(Object(u.a)(Ri),[{question_type:kt}]));case 7:case"end":return Yt.stop()}},et)}));return function(kt){return Vi.apply(this,arguments)}}(),Rn=function(){return Ri==null?void 0:Ri.map(function(et,kt){if(et.key=kt+1,et.len=Ri.length,et.question_type===0)return r.a.createElement("aside",null,r.a.createElement(Pe,{ref:Ki,editData:et}),r.a.createElement(c.a,null));if(et.question_type===1)return r.a.createElement("aside",null,r.a.createElement(Se,{ref:Ki,editData:et}),r.a.createElement(c.a,null));if(et.question_type===2)return r.a.createElement("aside",null,r.a.createElement(Ze,{ref:Ki,editData:et}),r.a.createElement(c.a,null));if(et.question_type===3)return r.a.createElement("aside",null,r.a.createElement(rt,{editData:et}),r.a.createElement(c.a,null));if(et.question_type===4)return r.a.createElement("aside",null,r.a.createElement(ut,{editData:et}),r.a.createElement(c.a,null));if(et.question_type===5)return r.a.createElement("aside",null,r.a.createElement(yt,{editData:et}),r.a.createElement(c.a,null))})};return r.a.createElement("section",{className:"edu-container"},r.a.createElement("section",{className:"animated fadeIn"},r.a.createElement("aside",{className:"mt10"},Ci&&r.a.createElement(v.a,{separator:">"},r.a.createElement(v.a.Item,null,r.a.createElement(P.a,{to:"/users/".concat(Ci.login,"/topics/personal")},"\u6211\u7684\u9898\u5E93")),r.a.createElement(v.a.Item,null,r.a.createElement(P.a,{to:"/users/".concat(Ci==null?void 0:Ci.login,"/topics/").concat(xi.topicId,"/").concat(xi.topictype,"/exercise/detail")},"\u8BE6\u60C5")),r.a.createElement(v.a.Item,null,"\u7F16\u8F91"))),r.a.createElement("aside",{className:[Le.a.title,"mt20"].join(" ")},r.a.createElement(H.a,{style:{width:"100%"},align:"middle"},r.a.createElement(L.a,{flex:"1"},r.a.createElement("strong",{className:"font20 ml5"},"\u7F16\u8F91\u8BD5\u5377"),r.a.createElement(Fe.m,{status:[(Ct=Ht.exerciseBanks)!==null&&Ct!==void 0&&(Rt=Ct.exercise)!==null&&Rt!==void 0&&Rt.is_public?"\u516C\u5F00":"\u79C1\u6709"]})),r.a.createElement(L.a,null,r.a.createElement(P.a,{className:"font16 c-light-black",to:"/users/".concat(Ci.login,"/topics/personal")},"\u8FD4\u56DE"))))),r.a.createElement("section",{className:[Le.a.bg,"pt30","pl30","pr30","pb30","mt20"].join(" ")},!vn&&r.a.createElement("aside",null,r.a.createElement("div",{className:Le.a.containerDesc},r.a.createElement("div",null,(ni=Ht.exerciseBanks)===null||ni===void 0||((Qt=ni.exercise)===null||Qt===void 0)?void 0:Qt.exercise_name),r.a.createElement("div",null,r.a.createElement(F.a,{title:"\u7F16\u8F91"},r.a.createElement("span",{onClick:function(){return cn(!0)},className:"iconfont c-green ml30 icon-bianjishijuan3x"})))),r.a.createElement("div",{className:"c-light-black"},(Tt=Ht.exerciseBanks)===null||Tt===void 0||((qe=Tt.exercise)===null||qe===void 0)?void 0:qe.exercise_description)),vn&&r.a.createElement(O.a,{layout:"vertical",form:ui},r.a.createElement(O.a.Item,{name:"exercise_name",label:"\u8BD5\u5377\u6807\u9898\uFF1A",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BD5\u5377\u6807\u9898"}]},r.a.createElement($.a,{maxLength:60,placeholder:"\u8BD5\u5377\u6807\u9898\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26"})),r.a.createElement(O.a.Item,{label:"\u8BD5\u5377\u987B\u77E5\uFF1A",name:"exercise_description"},r.a.createElement($.a.TextArea,{rows:6,placeholder:"\u8BF7\u5728\u6B64\u8F93\u5165\u672C\u6B21\u8BD5\u5377\u7B54\u9898\u7684\u76F8\u5173\u8BF4\u660E\uFF0C\u6700\u5927\u9650\u5236100\u4E2A\u5B57\u7B26"})),r.a.createElement(O.a.Item,{className:"tr"},r.a.createElement(Z.a,{type:"primary",onClick:function(){Wn()}},"\u4FDD\u5B58")))),r.a.createElement("p",{className:"mt10",style:{display:"flex"}},r.a.createElement("span",{className:"fl",style:{flex:"1"}},!!((Oi=Ht.exerciseBanks)!==null&&Oi!==void 0&&(xe=Oi.exercise_types)!==null&&xe!==void 0&&xe.q_singles)&&r.a.createElement("span",{className:"ml20"},"\u5355\u9009\u9898",(Dt=Ht.exerciseBanks)===null||Dt===void 0||((Ut=Dt.exercise_types)===null||Ut===void 0)?void 0:Ut.q_singles,"\u9898\uFF0C\u5171",(Ft=Ht.exerciseBanks)===null||Ft===void 0||((At=Ft.exercise_types)===null||At===void 0)?void 0:At.q_singles_scores,"\u5206"),!!((ei=Ht.exerciseBanks)!==null&&ei!==void 0&&(di=ei.exercise_types)!==null&&di!==void 0&&di.q_doubles)&&r.a.createElement("span",{className:"ml20"},"\u591A\u9009\u9898",(Bt=Ht.exerciseBanks)===null||Bt===void 0||((it=Bt.exercise_types)===null||it===void 0)?void 0:it.q_doubles,"\u9898\uFF0C\u5171",(fi=Ht.exerciseBanks)===null||fi===void 0||((ri=fi.exercise_types)===null||ri===void 0)?void 0:ri.q_doubles_scores,"\u5206"),!!((Kt=Ht.exerciseBanks)!==null&&Kt!==void 0&&(Et=Kt.exercise_types)!==null&&Et!==void 0&&Et.q_judges)&&r.a.createElement("span",{className:"ml20"},"\u5224\u65AD\u9898",(Nt=Ht.exerciseBanks)===null||Nt===void 0||((ti=Nt.exercise_types)===null||ti===void 0)?void 0:ti.q_judges,"\u9898\uFF0C\u5171",(oi=Ht.exerciseBanks)===null||oi===void 0||((De=oi.exercise_types)===null||De===void 0)?void 0:De.q_judges_scores,"\u5206"),!!((gt=Ht.exerciseBanks)!==null&>!==void 0&&(pi=gt.exercise_types)!==null&&pi!==void 0&&pi.q_nulls)&&r.a.createElement("span",{className:"ml20"},"\u586B\u7A7A\u9898",(Ei=Ht.exerciseBanks)===null||Ei===void 0||((wi=Ei.exercise_types)===null||wi===void 0)?void 0:wi.q_nulls,"\u9898\uFF0C\u5171",(vi=Ht.exerciseBanks)===null||vi===void 0||((K=vi.exercise_types)===null||K===void 0)?void 0:K.q_nulls_scores,"\u5206"),!!((_=Ht.exerciseBanks)!==null&&_!==void 0&&(C=_.exercise_types)!==null&&C!==void 0&&C.q_mains)&&r.a.createElement("span",{className:"ml20"},"\u7B80\u7B54\u9898",(N=Ht.exerciseBanks)===null||N===void 0||((Q=N.exercise_types)===null||Q===void 0)?void 0:Q.q_mains,"\u9898\uFF0C\u5171",(G=Ht.exerciseBanks)===null||G===void 0||((le=G.exercise_types)===null||le===void 0)?void 0:le.q_mains_scores,"\u5206"),!!((Ae=Ht.exerciseBanks)!==null&&Ae!==void 0&&(Me=Ae.exercise_types)!==null&&Me!==void 0&&Me.q_shixuns)&&r.a.createElement("span",{className:"ml20"},"\u5B9E\u8BAD\u9898",(ot=Ht.exerciseBanks)===null||ot===void 0||((Re=ot.exercise_types)===null||Re===void 0)?void 0:Re.q_shixuns,"\u9898\uFF0C\u5171",($e=Ht.exerciseBanks)===null||$e===void 0||((ze=$e.exercise_types)===null||ze===void 0)?void 0:ze.q_shixuns_scores,"\u5206"),!!((xt=Ht.exerciseBanks)!==null&&xt!==void 0&&(vt=xt.exercise_types)!==null&&vt!==void 0&&vt.q_pros)&&r.a.createElement("span",{className:"ml20"},"\u7F16\u7A0B\u9898",(hi=Ht.exerciseBanks)===null||hi===void 0||((Pt=hi.exercise_types)===null||Pt===void 0)?void 0:Pt.q_pros,"\u9898\uFF0C\u5171",(zt=Ht.exerciseBanks)===null||zt===void 0||((yi=zt.exercise_types)===null||yi===void 0)?void 0:yi.q_pros_scores,"\u5206")),r.a.createElement("span",{className:"fr"},!!((Si=Ht.exerciseBanks)!==null&&Si!==void 0&&(bi=Si.exercise_types)!==null&&bi!==void 0&&bi.q_counts)&&r.a.createElement("span",null,"\u5408\u8BA1 ",r.a.createElement("span",{className:"color-blue"},(Jt=Ht.exerciseBanks)===null||Jt===void 0||((wt=Jt.exercise_types)===null||wt===void 0)?void 0:wt.q_counts)," \u9898\uFF0C \u5171 ",r.a.createElement("span",{className:"".concat(((mt=Ht.exerciseBanks)===null||mt===void 0||((Wt=mt.exercise_types)===null||Wt===void 0)?void 0:Wt.q_scores)>100?"color-red font-bd":"color-orange")},($t=Ht.exerciseBanks)===null||$t===void 0||((ai=$t.exercise_types)===null||ai===void 0)?void 0:ai.q_scores)," \u5206"))),Ri!=""&&r.a.createElement("section",{className:[Le.a.bg,"pt30","pl20","pr20","pb20","mt20"].join(" ")},Rn()),r.a.createElement("section",{style:{display:"flex"},className:[Le.a.bg,"pt30","pl30","pr30","pb30","mt20"].join(" ")},r.a.createElement("div",{style:{flex:"1"}},Hn.map(function(Vi,et){return r.a.createElement(Z.a,{className:"mr20",type:"primary",onClick:function(){return qn(Vi.id)}},r.a.createElement(W.a,{className:"mr5"}),Vi.name)}))),r.a.createElement(ge,{callback:function(et){Ri.push({shixun:et.challenge_names.map(function(kt){return{challenge_name:kt,challenge_score:5}}),shixun_name:et.title,shixun_id:et.id,question_type:5,edit:!0}),En(Object(u.a)(Ri))}}))},Vt=st.default=Object(M.a)(function(tt){var ke=tt.polls,Ct=tt.loading,Rt=tt.user,ni=tt.globalSetting;return{polls:ke,globalSetting:ni,user:Rt,loading:Ct.effects}})(Lt)},psGv:function(Mt,st,ne){var oe,Z;(function(){var D;(function(){"use strict";var V=[,,function(y){function v(h){this.__parent=h,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}v.prototype.clone_empty=function(){var h=new v(this.__parent);return h.set_indent(this.__indent_count,this.__alignment_count),h},v.prototype.item=function(h){return h<0?this.__items[this.__items.length+h]:this.__items[h]},v.prototype.has_match=function(h){for(var d=this.__items.length-1;d>=0;d--)if(this.__items[d].match(h))return!0;return!1},v.prototype.set_indent=function(h,d){this.is_empty()&&(this.__indent_count=h||0,this.__alignment_count=d||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},v.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},v.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},v.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var h=this.__parent.current_line;return h.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),h.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),h.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,h.__items[0]===" "&&(h.__items.splice(0,1),h.__character_count-=1),!0}return!1},v.prototype.is_empty=function(){return this.__items.length===0},v.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},v.prototype.push=function(h){this.__items.push(h);var d=h.lastIndexOf(`
|
|
`);d!==-1?this.__character_count=h.length-d:this.__character_count+=h.length},v.prototype.pop=function(){var h=null;return this.is_empty()||(h=this.__items.pop(),this.__character_count-=h.length),h},v.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},v.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},v.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},v.prototype.toString=function(){var h="";return this.is_empty()?this.__parent.indent_empty_lines&&(h=this.__parent.get_indent_string(this.__indent_count)):(h=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),h+=this.__items.join("")),h};function p(h,d){this.__cache=[""],this.__indent_size=h.indent_size,this.__indent_string=h.indent_char,h.indent_with_tabs||(this.__indent_string=new Array(h.indent_size+1).join(h.indent_char)),d=d||"",h.indent_level>0&&(d=new Array(h.indent_level+1).join(this.__indent_string)),this.__base_string=d,this.__base_string_length=d.length}p.prototype.get_indent_size=function(h,d){var l=this.__base_string_length;return d=d||0,h<0&&(l=0),l+=h*this.__indent_size,l+=d,l},p.prototype.get_indent_string=function(h,d){var l=this.__base_string;return d=d||0,h<0&&(h=0,l=""),d+=h*this.__indent_size,this.__ensure_cache(d),l+=this.__cache[d],l},p.prototype.__ensure_cache=function(h){for(;h>=this.__cache.length;)this.__add_column()},p.prototype.__add_column=function(){var h=this.__cache.length,d=0,l="";this.__indent_size&&h>=this.__indent_size&&(d=Math.floor(h/this.__indent_size),h-=d*this.__indent_size,l=new Array(d+1).join(this.__indent_string)),h&&(l+=new Array(h+1).join(" ")),this.__cache.push(l)};function c(h,d){this.__indent_cache=new p(h,d),this.raw=!1,this._end_with_newline=h.end_with_newline,this.indent_size=h.indent_size,this.wrap_line_length=h.wrap_line_length,this.indent_empty_lines=h.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new v(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}c.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},c.prototype.get_line_number=function(){return this.__lines.length},c.prototype.get_indent_string=function(h,d){return this.__indent_cache.get_indent_string(h,d)},c.prototype.get_indent_size=function(h,d){return this.__indent_cache.get_indent_size(h,d)},c.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},c.prototype.add_new_line=function(h){return this.is_empty()||!h&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},c.prototype.get_code=function(h){this.trim(!0);var d=this.current_line.pop();d&&(d[d.length-1]===`
|
|
`&&(d=d.replace(/\n+$/g,"")),this.current_line.push(d)),this._end_with_newline&&this.__add_outputline();var l=this.__lines.join(`
|
|
`);return h!==`
|
|
`&&(l=l.replace(/[\n]/g,h)),l},c.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},c.prototype.set_indent=function(h,d){return h=h||0,d=d||0,this.next_line.set_indent(h,d),this.__lines.length>1?(this.current_line.set_indent(h,d),!0):(this.current_line.set_indent(),!1)},c.prototype.add_raw_token=function(h){for(var d=0;d<h.newlines;d++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(h.whitespace_before),this.current_line.push(h.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},c.prototype.add_token=function(h){this.__add_space_before_token(),this.current_line.push(h),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},c.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},c.prototype.remove_indent=function(h){for(var d=this.__lines.length;h<d;)this.__lines[h]._remove_indent(),h++;this.current_line._remove_wrap_indent()},c.prototype.trim=function(h){for(h=h===void 0?!1:h,this.current_line.trim();h&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},c.prototype.just_added_newline=function(){return this.current_line.is_empty()},c.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},c.prototype.ensure_empty_line_above=function(h,d){for(var l=this.__lines.length-2;l>=0;){var s=this.__lines[l];if(s.is_empty())break;if(s.item(0).indexOf(h)!==0&&s.item(-1)!==d){this.__lines.splice(l+1,0,new v(this)),this.previous_line=this.__lines[this.__lines.length-2];break}l--}},y.exports.Output=c},function(y){function v(p,c,h,d){this.type=p,this.text=c,this.comments_before=null,this.newlines=h||0,this.whitespace_before=d||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}y.exports.Token=v},,,function(y){function v(h,d){this.raw_options=p(h,d),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}v.prototype._get_array=function(h,d){var l=this.raw_options[h],s=d||[];return typeof l=="object"?l!==null&&typeof l.concat=="function"&&(s=l.concat()):typeof l=="string"&&(s=l.split(/[^a-zA-Z0-9_\/\-]+/)),s},v.prototype._get_boolean=function(h,d){var l=this.raw_options[h],s=l===void 0?!!d:!!l;return s},v.prototype._get_characters=function(h,d){var l=this.raw_options[h],s=d||"";return typeof l=="string"&&(s=l.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),s},v.prototype._get_number=function(h,d){var l=this.raw_options[h];d=parseInt(d,10),isNaN(d)&&(d=0);var s=parseInt(l,10);return isNaN(s)&&(s=d),s},v.prototype._get_selection=function(h,d,l){var s=this._get_selection_list(h,d,l);if(s.length!==1)throw new Error("Invalid Option Value: The option '"+h+`' can only be one of the following values:
|
|
`+d+`
|
|
You passed in: '`+this.raw_options[h]+"'");return s[0]},v.prototype._get_selection_list=function(h,d,l){if(!d||d.length===0)throw new Error("Selection list cannot be empty.");if(l=l||[d[0]],!this._is_valid_selection(l,d))throw new Error("Invalid Default Value!");var s=this._get_array(h,l);if(!this._is_valid_selection(s,d))throw new Error("Invalid Option Value: The option '"+h+`' can contain only the following values:
|
|
`+d+`
|
|
You passed in: '`+this.raw_options[h]+"'");return s},v.prototype._is_valid_selection=function(h,d){return h.length&&d.length&&!h.some(function(l){return d.indexOf(l)===-1})};function p(h,d){var l={};h=c(h);var s;for(s in h)s!==d&&(l[s]=h[s]);if(d&&h[d])for(s in h[d])l[s]=h[d][s];return l}function c(h){var d={},l;for(l in h){var s=l.replace(/-/g,"_");d[s]=h[l]}return d}y.exports.Options=v,y.exports.normalizeOpts=c,y.exports.mergeOpts=p},,function(y){var v=RegExp.prototype.hasOwnProperty("sticky");function p(c){this.__input=c||"",this.__input_length=this.__input.length,this.__position=0}p.prototype.restart=function(){this.__position=0},p.prototype.back=function(){this.__position>0&&(this.__position-=1)},p.prototype.hasNext=function(){return this.__position<this.__input_length},p.prototype.next=function(){var c=null;return this.hasNext()&&(c=this.__input.charAt(this.__position),this.__position+=1),c},p.prototype.peek=function(c){var h=null;return c=c||0,c+=this.__position,c>=0&&c<this.__input_length&&(h=this.__input.charAt(c)),h},p.prototype.__match=function(c,h){c.lastIndex=h;var d=c.exec(this.__input);return d&&!(v&&c.sticky)&&(d.index!==h&&(d=null)),d},p.prototype.test=function(c,h){return h=h||0,h+=this.__position,h>=0&&h<this.__input_length?!!this.__match(c,h):!1},p.prototype.testChar=function(c,h){var d=this.peek(h);return c.lastIndex=0,d!==null&&c.test(d)},p.prototype.match=function(c){var h=this.__match(c,this.__position);return h?this.__position+=h[0].length:h=null,h},p.prototype.read=function(c,h,d){var l="",s;return c&&(s=this.match(c),s&&(l+=s[0])),h&&(s||!c)&&(l+=this.readUntil(h,d)),l},p.prototype.readUntil=function(c,h){var d="",l=this.__position;c.lastIndex=this.__position;var s=c.exec(this.__input);return s?(l=s.index,h&&(l+=s[0].length)):l=this.__input_length,d=this.__input.substring(this.__position,l),this.__position=l,d},p.prototype.readUntilAfter=function(c){return this.readUntil(c,!0)},p.prototype.get_regexp=function(c,h){var d=null,l="g";return h&&v&&(l="y"),typeof c=="string"&&c!==""?d=new RegExp(c,l):c&&(d=new RegExp(c.source,l)),d},p.prototype.get_literal_regexp=function(c){return RegExp(c.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},p.prototype.peekUntilAfter=function(c){var h=this.__position,d=this.readUntilAfter(c);return this.__position=h,d},p.prototype.lookBack=function(c){var h=this.__position-1;return h>=c.length&&this.__input.substring(h-c.length,h).toLowerCase()===c},y.exports.InputScanner=p},function(y,v,p){var c=p(8).InputScanner,h=p(3).Token,d=p(10).TokenStream,l=p(11).WhitespacePattern,s={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},u=function(f,O){this._input=new c(f),this._options=O||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new l(this._input)};u.prototype.tokenize=function(){this._input.restart(),this.__tokens=new d,this._reset();for(var f,O=new h(s.START,""),x=null,w=[],A=new d;O.type!==s.EOF;){for(f=this._get_next_token(O,x);this._is_comment(f);)A.add(f),f=this._get_next_token(O,x);A.isEmpty()||(f.comments_before=A,A=new d),f.parent=x,this._is_opening(f)?(w.push(x),x=f):x&&this._is_closing(f,x)&&(f.opened=x,x.closed=f,x=w.pop(),f.parent=x),f.previous=O,O.next=f,this.__tokens.add(f),O=f}return this.__tokens},u.prototype._is_first_token=function(){return this.__tokens.isEmpty()},u.prototype._reset=function(){},u.prototype._get_next_token=function(f,O){this._readWhitespace();var x=this._input.read(/.+/g);return x?this._create_token(s.RAW,x):this._create_token(s.EOF,"")},u.prototype._is_comment=function(f){return!1},u.prototype._is_opening=function(f){return!1},u.prototype._is_closing=function(f,O){return!1},u.prototype._create_token=function(f,O){var x=new h(f,O,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return x},u.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},y.exports.Tokenizer=u,y.exports.TOKEN=s},function(y){function v(p){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=p}v.prototype.restart=function(){this.__position=0},v.prototype.isEmpty=function(){return this.__tokens_length===0},v.prototype.hasNext=function(){return this.__position<this.__tokens_length},v.prototype.next=function(){var p=null;return this.hasNext()&&(p=this.__tokens[this.__position],this.__position+=1),p},v.prototype.peek=function(p){var c=null;return p=p||0,p+=this.__position,p>=0&&p<this.__tokens_length&&(c=this.__tokens[p]),c},v.prototype.add=function(p){this.__parent_token&&(p.parent=this.__parent_token),this.__tokens.push(p),this.__tokens_length+=1},y.exports.TokenStream=v},function(y,v,p){var c=p(12).Pattern;function h(d,l){c.call(this,d,l),l?this._line_regexp=this._input.get_regexp(l._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}h.prototype=new c,h.prototype.__set_whitespace_patterns=function(d,l){d+="\\t ",l+="\\n\\r",this._match_pattern=this._input.get_regexp("["+d+l+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+l+"]")},h.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var d=this._input.read(this._match_pattern);if(d===" ")this.whitespace_before_token=" ";else if(d){var l=this.__split(this._newline_regexp,d);this.newline_count=l.length-1,this.whitespace_before_token=l[this.newline_count]}return d},h.prototype.matching=function(d,l){var s=this._create();return s.__set_whitespace_patterns(d,l),s._update(),s},h.prototype._create=function(){return new h(this._input,this)},h.prototype.__split=function(d,l){d.lastIndex=0;for(var s=0,u=[],f=d.exec(l);f;)u.push(l.substring(s,f.index)),s=f.index+f[0].length,f=d.exec(l);return s<l.length?u.push(l.substring(s,l.length)):u.push(""),u},y.exports.WhitespacePattern=h},function(y){function v(p,c){this._input=p,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,c&&(this._starting_pattern=this._input.get_regexp(c._starting_pattern,!0),this._match_pattern=this._input.get_regexp(c._match_pattern,!0),this._until_pattern=this._input.get_regexp(c._until_pattern),this._until_after=c._until_after)}v.prototype.read=function(){var p=this._input.read(this._starting_pattern);return(!this._starting_pattern||p)&&(p+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),p},v.prototype.read_match=function(){return this._input.match(this._match_pattern)},v.prototype.until_after=function(p){var c=this._create();return c._until_after=!0,c._until_pattern=this._input.get_regexp(p),c._update(),c},v.prototype.until=function(p){var c=this._create();return c._until_after=!1,c._until_pattern=this._input.get_regexp(p),c._update(),c},v.prototype.starting_with=function(p){var c=this._create();return c._starting_pattern=this._input.get_regexp(p,!0),c._update(),c},v.prototype.matching=function(p){var c=this._create();return c._match_pattern=this._input.get_regexp(p,!0),c._update(),c},v.prototype._create=function(){return new v(this._input,this)},v.prototype._update=function(){},y.exports.Pattern=v},function(y){function v(p,c){p=typeof p=="string"?p:p.source,c=typeof c=="string"?c:c.source,this.__directives_block_pattern=new RegExp(p+/ beautify( \w+[:]\w+)+ /.source+c,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(p+/\sbeautify\signore:end\s/.source+c,"g")}v.prototype.get_directives=function(p){if(!p.match(this.__directives_block_pattern))return null;var c={};this.__directive_pattern.lastIndex=0;for(var h=this.__directive_pattern.exec(p);h;)c[h[1]]=h[2],h=this.__directive_pattern.exec(p);return c},v.prototype.readIgnored=function(p){return p.readUntilAfter(this.__directives_end_ignore_pattern)},y.exports.Directives=v},function(y,v,p){var c=p(12).Pattern,h={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function d(l,s){c.call(this,l,s),this.__template_pattern=null,this._disabled=Object.assign({},h),this._excluded=Object.assign({},h),s&&(this.__template_pattern=this._input.get_regexp(s.__template_pattern),this._excluded=Object.assign(this._excluded,s._excluded),this._disabled=Object.assign(this._disabled,s._disabled));var u=new c(l);this.__patterns={handlebars_comment:u.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:u.starting_with(/{{{/).until_after(/}}}/),handlebars:u.starting_with(/{{/).until_after(/}}/),php:u.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:u.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:u.starting_with(/{%/).until_after(/%}/),django_value:u.starting_with(/{{/).until_after(/}}/),django_comment:u.starting_with(/{#/).until_after(/#}/),smarty:u.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:u.starting_with(/{\*/).until_after(/\*}/),smarty_literal:u.starting_with(/{literal}/).until_after(/{\/literal}/)}}d.prototype=new c,d.prototype._create=function(){return new d(this._input,this)},d.prototype._update=function(){this.__set_templated_pattern()},d.prototype.disable=function(l){var s=this._create();return s._disabled[l]=!0,s._update(),s},d.prototype.read_options=function(l){var s=this._create();for(var u in h)s._disabled[u]=l.templating.indexOf(u)===-1;return s._update(),s},d.prototype.exclude=function(l){var s=this._create();return s._excluded[l]=!0,s._update(),s},d.prototype.read=function(){var l="";this._match_pattern?l=this._input.read(this._starting_pattern):l=this._input.read(this._starting_pattern,this.__template_pattern);for(var s=this._read_template();s;)this._match_pattern?s+=this._input.read(this._match_pattern):s+=this._input.readUntil(this.__template_pattern),l+=s,s=this._read_template();return this._until_after&&(l+=this._input.readUntilAfter(this._until_pattern)),l},d.prototype.__set_templated_pattern=function(){var l=[];this._disabled.php||l.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||l.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||l.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(l.push(this.__patterns.django._starting_pattern.source),l.push(this.__patterns.django_value._starting_pattern.source),l.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||l.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&l.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+l.join("|")+")")},d.prototype._read_template=function(){var l="",s=this._input.peek();if(s==="<"){var u=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&u==="?"&&(l=l||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&u==="%"&&(l=l||this.__patterns.erb.read())}else s==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(l=l||this.__patterns.handlebars_comment.read(),l=l||this.__patterns.handlebars_unescaped.read(),l=l||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(l=l||this.__patterns.django_value.read()),this._excluded.django||(l=l||this.__patterns.django_comment.read(),l=l||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(l=l||this.__patterns.smarty_comment.read(),l=l||this.__patterns.smarty_literal.read(),l=l||this.__patterns.smarty.read()));return l},y.exports.TemplatablePattern=d},,,,function(y,v,p){var c=p(19).Beautifier,h=p(20).Options;function d(l,s,u,f){var O=new c(l,s,u,f);return O.beautify()}y.exports=d,y.exports.defaultOptions=function(){return new h}},function(y,v,p){var c=p(20).Options,h=p(2).Output,d=p(21).Tokenizer,l=p(21).TOKEN,s=/\r\n|[\r\n]/,u=/\r\n|[\r\n]/g,f=function(m,r){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=m.max_preserve_newlines,this.preserve_newlines=m.preserve_newlines,this._output=new h(m,r)};f.prototype.current_line_has_match=function(m){return this._output.current_line.has_match(m)},f.prototype.set_space_before_token=function(m,r){this._output.space_before_token=m,this._output.non_breaking_space=r},f.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},f.prototype.add_raw_token=function(m){this._output.add_raw_token(m)},f.prototype.print_preserved_newlines=function(m){var r=0;m.type!==l.TEXT&&m.previous.type!==l.TEXT&&(r=m.newlines?1:0),this.preserve_newlines&&(r=m.newlines<this.max_preserve_newlines+1?m.newlines:this.max_preserve_newlines+1);for(var b=0;b<r;b++)this.print_newline(b>0);return r!==0},f.prototype.traverse_whitespace=function(m){return m.whitespace_before||m.newlines?(this.print_preserved_newlines(m)||(this._output.space_before_token=!0),!0):!1},f.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},f.prototype.print_newline=function(m){this._output.add_new_line(m)},f.prototype.print_token=function(m){m.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(m.text))},f.prototype.indent=function(){this.indent_level++},f.prototype.get_full_indent=function(m){return m=this.indent_level+(m||0),m<1?"":this._output.get_indent_string(m)};var O=function(m){for(var r=null,b=m.next;b.type!==l.EOF&&m.closed!==b;){if(b.type===l.ATTRIBUTE&&b.text==="type"){b.next&&b.next.type===l.EQUALS&&b.next.next&&b.next.next.type===l.VALUE&&(r=b.next.next.text);break}b=b.next}return r},x=function(m,r){var b=null,P=null;return r.closed?(m==="script"?b="text/javascript":m==="style"&&(b="text/css"),b=O(r)||b,b.search("text/css")>-1?P="css":b.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?P="javascript":b.search(/(text|application|dojo)\/(x-)?(html)/)>-1?P="html":b.search(/test\/null/)>-1&&(P="null"),P):null};function w(m,r){return r.indexOf(m)!==-1}function A(m,r,b){this.parent=m||null,this.tag=r?r.tag_name:"",this.indent_level=b||0,this.parser_token=r||null}function R(m){this._printer=m,this._current_frame=null}R.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},R.prototype.record_tag=function(m){var r=new A(this._current_frame,m,this._printer.indent_level);this._current_frame=r},R.prototype._try_pop_frame=function(m){var r=null;return m&&(r=m.parser_token,this._printer.indent_level=m.indent_level,this._current_frame=m.parent),r},R.prototype._get_frame=function(m,r){for(var b=this._current_frame;b&&!(m.indexOf(b.tag)!==-1);){if(r&&r.indexOf(b.tag)!==-1){b=null;break}b=b.parent}return b},R.prototype.try_pop=function(m,r){var b=this._get_frame([m],r);return this._try_pop_frame(b)},R.prototype.indent_to_tag=function(m){var r=this._get_frame(m);r&&(this._printer.indent_level=r.indent_level)};function T(m,r,b,P){this._source_text=m||"",r=r||{},this._js_beautify=b,this._css_beautify=P,this._tag_stack=null;var M=new c(r,"html");this._options=M,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,"force".length)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,"preserve".length)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}T.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var m=this._source_text,r=this._options.eol;this._options.eol==="auto"&&(r=`
|
|
`,m&&s.test(m)&&(r=m.match(s)[0])),m=m.replace(u,`
|
|
`);var b=m.match(/^[\t ]*/)[0],P={text:"",type:""},M=new E,W=new f(this._options,b),X=new d(m,this._options).tokenize();this._tag_stack=new R(W);for(var U=null,S=X.next();S.type!==l.EOF;)S.type===l.TAG_OPEN||S.type===l.COMMENT?(U=this._handle_tag_open(W,S,M,P),M=U):S.type===l.ATTRIBUTE||S.type===l.EQUALS||S.type===l.VALUE||S.type===l.TEXT&&!M.tag_complete?U=this._handle_inside_tag(W,S,M,X):S.type===l.TAG_CLOSE?U=this._handle_tag_close(W,S,M):S.type===l.TEXT?U=this._handle_text(W,S,M):W.add_raw_token(S),P=U,S=X.next();var B=W._output.get_code(r);return B},T.prototype._handle_tag_close=function(m,r,b){var P={text:r.text,type:r.type};return m.alignment_size=0,b.tag_complete=!0,m.set_space_before_token(r.newlines||r.whitespace_before!=="",!0),b.is_unformatted?m.add_raw_token(r):(b.tag_start_char==="<"&&(m.set_space_before_token(r.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&b.has_wrapped_attrs&&m.print_newline(!1)),m.print_token(r)),b.indent_content&&!(b.is_unformatted||b.is_content_unformatted)&&(m.indent(),b.indent_content=!1),!b.is_inline_element&&!(b.is_unformatted||b.is_content_unformatted)&&m.set_wrap_point(),P},T.prototype._handle_inside_tag=function(m,r,b,P){var M=b.has_wrapped_attrs,W={text:r.text,type:r.type};if(m.set_space_before_token(r.newlines||r.whitespace_before!=="",!0),b.is_unformatted)m.add_raw_token(r);else if(b.tag_start_char==="{"&&r.type===l.TEXT)m.print_preserved_newlines(r)?(r.newlines=0,m.add_raw_token(r)):m.print_token(r);else{if(r.type===l.ATTRIBUTE?(m.set_space_before_token(!0),b.attr_count+=1):(r.type===l.EQUALS||r.type===l.VALUE&&r.previous.type===l.EQUALS)&&m.set_space_before_token(!1),r.type===l.ATTRIBUTE&&b.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(m.traverse_whitespace(r),M=M||r.newlines!==0),this._is_wrap_attributes_force)){var X=b.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&b.attr_count===1){var U=!0,S=0,B;do{if(B=P.peek(S),B.type===l.ATTRIBUTE){U=!1;break}S+=1}while(S<4&&B.type!==l.EOF&&B.type!==l.TAG_CLOSE);X=!U}X&&(m.print_newline(!1),M=!0)}m.print_token(r),M=M||m.previous_token_wrapped(),b.has_wrapped_attrs=M}return W},T.prototype._handle_text=function(m,r,b){var P={text:r.text,type:"TK_CONTENT"};return b.custom_beautifier_name?this._print_custom_beatifier_text(m,r,b):b.is_unformatted||b.is_content_unformatted?m.add_raw_token(r):(m.traverse_whitespace(r),m.print_token(r)),P},T.prototype._print_custom_beatifier_text=function(m,r,b){var P=this;if(r.text!==""){var M=r.text,W,X=1,U="",S="";b.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?W=this._js_beautify:b.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?W=this._css_beautify:b.custom_beautifier_name==="html"&&(W=function(de,Ee){var Te=new T(de,Ee,P._js_beautify,P._css_beautify);return Te.beautify()}),this._options.indent_scripts==="keep"?X=0:this._options.indent_scripts==="separate"&&(X=-m.indent_level);var B=m.get_full_indent(X);if(M=M.replace(/\n[ \t]*$/,""),b.custom_beautifier_name!=="html"&&M[0]==="<"&&M.match(/^(<!--|<!\[CDATA\[)/)){var J=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(M);if(!J){m.add_raw_token(r);return}U=B+J[1]+`
|
|
`,M=J[4],J[5]&&(S=B+J[5]),M=M.replace(/\n[ \t]*$/,""),(J[2]||J[3].indexOf(`
|
|
`)!==-1)&&(J=J[3].match(/[ \t]+$/),J&&(r.whitespace_before=J[0]))}if(M)if(W){var te=function(){this.eol=`
|
|
`};te.prototype=this._options.raw_options;var ae=new te;M=W(B+M,ae)}else{var _e=r.whitespace_before;_e&&(M=M.replace(new RegExp(`
|
|
(`+_e+")?","g"),`
|
|
`)),M=B+M.replace(/\n/g,`
|
|
`+B)}U&&(M?M=U+M+`
|
|
`+S:M=U+S),m.print_newline(!1),M&&(r.text=M,r.whitespace_before="",r.newlines=0,m.add_raw_token(r),m.print_newline(!0))}},T.prototype._handle_tag_open=function(m,r,b,P){var M=this._get_tag_open_token(r);return(b.is_unformatted||b.is_content_unformatted)&&!b.is_empty_element&&r.type===l.TAG_OPEN&&r.text.indexOf("</")===0?(m.add_raw_token(r),M.start_tag_token=this._tag_stack.try_pop(M.tag_name)):(m.traverse_whitespace(r),this._set_tag_position(m,r,M,b,P),M.is_inline_element||m.set_wrap_point(),m.print_token(r)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(M.alignment_size=r.text.length+1),!M.tag_complete&&!M.is_unformatted&&(m.alignment_size=M.alignment_size),M};var E=function(m,r){if(this.parent=m||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",!r)this.tag_complete=!0;else{var b;this.tag_start_char=r.text[0],this.text=r.text,this.tag_start_char==="<"?(b=r.text.match(/^<([^\s>]*)/),this.tag_check=b?b[1]:""):(b=r.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=b?b[1]:"",(r.text.startsWith("{{#>")||r.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&r.next!==null?this.tag_check=r.next.text.split(" ")[0]:this.tag_check=r.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),r.type===l.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||r.closed&&r.closed.text==="/>";var P=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(P=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(P)))}};T.prototype._get_tag_open_token=function(m){var r=new E(this._tag_stack.get_parser_token(),m);return r.alignment_size=this._options.wrap_attributes_indent_size,r.is_end_tag=r.is_end_tag||w(r.tag_check,this._options.void_elements),r.is_empty_element=r.tag_complete||r.is_start_tag&&r.is_end_tag,r.is_unformatted=!r.tag_complete&&w(r.tag_check,this._options.unformatted),r.is_content_unformatted=!r.is_empty_element&&w(r.tag_check,this._options.content_unformatted),r.is_inline_element=w(r.tag_name,this._options.inline)||r.tag_name.includes("-")||r.tag_start_char==="{",r},T.prototype._set_tag_position=function(m,r,b,P,M){if(b.is_empty_element||(b.is_end_tag?b.start_tag_token=this._tag_stack.try_pop(b.tag_name):(this._do_optional_end_element(b)&&(b.is_inline_element||m.print_newline(!1)),this._tag_stack.record_tag(b),(b.tag_name==="script"||b.tag_name==="style")&&!(b.is_unformatted||b.is_content_unformatted)&&(b.custom_beautifier_name=x(b.tag_check,r)))),w(b.tag_check,this._options.extra_liners)&&(m.print_newline(!1),m._output.just_added_blankline()||m.print_newline(!0)),b.is_empty_element){if(b.tag_start_char==="{"&&b.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),b.indent_content=!0;var W=m.current_line_has_match(/{{#if/);W||m.print_newline(!1)}b.tag_name==="!--"&&M.type===l.TAG_CLOSE&&P.is_end_tag&&b.text.indexOf(`
|
|
`)===-1||(b.is_inline_element||b.is_unformatted||m.print_newline(!1),this._calcluate_parent_multiline(m,b))}else if(b.is_end_tag){var X=!1;X=b.start_tag_token&&b.start_tag_token.multiline_content,X=X||!b.is_inline_element&&!(P.is_inline_element||P.is_unformatted)&&!(M.type===l.TAG_CLOSE&&b.start_tag_token===P)&&M.type!=="TK_CONTENT",(b.is_content_unformatted||b.is_unformatted)&&(X=!1),X&&m.print_newline(!1)}else b.indent_content=!b.custom_beautifier_name,b.tag_start_char==="<"&&(b.tag_name==="html"?b.indent_content=this._options.indent_inner_html:b.tag_name==="head"?b.indent_content=this._options.indent_head_inner_html:b.tag_name==="body"&&(b.indent_content=this._options.indent_body_inner_html)),!(b.is_inline_element||b.is_unformatted)&&(M.type!=="TK_CONTENT"||b.is_content_unformatted)&&m.print_newline(!1),this._calcluate_parent_multiline(m,b)},T.prototype._calcluate_parent_multiline=function(m,r){r.parent&&m._output.just_added_newline()&&!((r.is_inline_element||r.is_unformatted)&&r.parent.is_inline_element)&&(r.parent.multiline_content=!0)};var g=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"],a=["a","audio","del","ins","map","noscript","video"];T.prototype._do_optional_end_element=function(m){var r=null;if(m.is_empty_element||!m.is_start_tag||!m.parent)return;if(m.tag_name==="body")r=r||this._tag_stack.try_pop("head");else if(m.tag_name==="li")r=r||this._tag_stack.try_pop("li",["ol","ul"]);else if(m.tag_name==="dd"||m.tag_name==="dt")r=r||this._tag_stack.try_pop("dt",["dl"]),r=r||this._tag_stack.try_pop("dd",["dl"]);else if(m.parent.tag_name==="p"&&g.indexOf(m.tag_name)!==-1){var b=m.parent.parent;(!b||a.indexOf(b.tag_name)===-1)&&(r=r||this._tag_stack.try_pop("p"))}else m.tag_name==="rp"||m.tag_name==="rt"?(r=r||this._tag_stack.try_pop("rt",["ruby","rtc"]),r=r||this._tag_stack.try_pop("rp",["ruby","rtc"])):m.tag_name==="optgroup"?r=r||this._tag_stack.try_pop("optgroup",["select"]):m.tag_name==="option"?r=r||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):m.tag_name==="colgroup"?r=r||this._tag_stack.try_pop("caption",["table"]):m.tag_name==="thead"?(r=r||this._tag_stack.try_pop("caption",["table"]),r=r||this._tag_stack.try_pop("colgroup",["table"])):m.tag_name==="tbody"||m.tag_name==="tfoot"?(r=r||this._tag_stack.try_pop("caption",["table"]),r=r||this._tag_stack.try_pop("colgroup",["table"]),r=r||this._tag_stack.try_pop("thead",["table"]),r=r||this._tag_stack.try_pop("tbody",["table"])):m.tag_name==="tr"?(r=r||this._tag_stack.try_pop("caption",["table"]),r=r||this._tag_stack.try_pop("colgroup",["table"]),r=r||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(m.tag_name==="th"||m.tag_name==="td")&&(r=r||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),r=r||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return m.parent=this._tag_stack.get_parser_token(),r},y.exports.Beautifier=T},function(y,v,p){var c=p(6).Options;function h(d){c.call(this,d,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}h.prototype=new c,y.exports.Options=h},function(y,v,p){var c=p(9).Tokenizer,h=p(9).TOKEN,d=p(13).Directives,l=p(14).TemplatablePattern,s=p(12).Pattern,u={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:h.START,RAW:h.RAW,EOF:h.EOF},f=new d(/<\!--/,/-->/),O=function(x,w){c.call(this,x,w),this._current_tag_name="";var A=new l(this._input).read_options(this._options),R=new s(this._input);if(this.__patterns={word:A.until(/[\n\r\t <]/),single_quote:A.until_after(/'/),double_quote:A.until_after(/"/),attribute:A.until(/[\n\r\t =>]|\/>/),element_name:A.until(/[\n\r\t >\/]/),handlebars_comment:R.starting_with(/{{!--/).until_after(/--}}/),handlebars:R.starting_with(/{{/).until_after(/}}/),handlebars_open:R.until(/[\n\r\t }]/),handlebars_raw_close:R.until(/}}/),comment:R.starting_with(/<!--/).until_after(/-->/),cdata:R.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:R.starting_with(/<!\[/).until_after(/]>/),processing:R.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var T=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=R.matching(T).until_after(T)}};O.prototype=new c,O.prototype._is_comment=function(x){return!1},O.prototype._is_opening=function(x){return x.type===u.TAG_OPEN},O.prototype._is_closing=function(x,w){return x.type===u.TAG_CLOSE&&w&&((x.text===">"||x.text==="/>")&&w.text[0]==="<"||x.text==="}}"&&w.text[0]==="{"&&w.text[1]==="{")},O.prototype._reset=function(){this._current_tag_name=""},O.prototype._get_next_token=function(x,w){var A=null;this._readWhitespace();var R=this._input.peek();return R===null?this._create_token(u.EOF,""):(A=A||this._read_open_handlebars(R,w),A=A||this._read_attribute(R,x,w),A=A||this._read_close(R,w),A=A||this._read_raw_content(R,x,w),A=A||this._read_content_word(R),A=A||this._read_comment_or_cdata(R),A=A||this._read_processing(R),A=A||this._read_open(R,w),A=A||this._create_token(u.UNKNOWN,this._input.next()),A)},O.prototype._read_comment_or_cdata=function(x){var w=null,A=null,R=null;if(x==="<"){var T=this._input.peek(1);T==="!"&&(A=this.__patterns.comment.read(),A?(R=f.get_directives(A),R&&R.ignore==="start"&&(A+=f.readIgnored(this._input))):A=this.__patterns.cdata.read()),A&&(w=this._create_token(u.COMMENT,A),w.directives=R)}return w},O.prototype._read_processing=function(x){var w=null,A=null,R=null;if(x==="<"){var T=this._input.peek(1);(T==="!"||T==="?")&&(A=this.__patterns.conditional_comment.read(),A=A||this.__patterns.processing.read()),A&&(w=this._create_token(u.COMMENT,A),w.directives=R)}return w},O.prototype._read_open=function(x,w){var A=null,R=null;return w||x==="<"&&(A=this._input.next(),this._input.peek()==="/"&&(A+=this._input.next()),A+=this.__patterns.element_name.read(),R=this._create_token(u.TAG_OPEN,A)),R},O.prototype._read_open_handlebars=function(x,w){var A=null,R=null;return w||this._options.indent_handlebars&&x==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(A=this.__patterns.handlebars_comment.read(),A=A||this.__patterns.handlebars.read(),R=this._create_token(u.COMMENT,A)):(A=this.__patterns.handlebars_open.read(),R=this._create_token(u.TAG_OPEN,A))),R},O.prototype._read_close=function(x,w){var A=null,R=null;return w&&(w.text[0]==="<"&&(x===">"||x==="/"&&this._input.peek(1)===">")?(A=this._input.next(),x==="/"&&(A+=this._input.next()),R=this._create_token(u.TAG_CLOSE,A)):w.text[0]==="{"&&x==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),R=this._create_token(u.TAG_CLOSE,"}}"))),R},O.prototype._read_attribute=function(x,w,A){var R=null,T="";if(A&&A.text[0]==="<")if(x==="=")R=this._create_token(u.EQUALS,this._input.next());else if(x==='"'||x==="'"){var E=this._input.next();x==='"'?E+=this.__patterns.double_quote.read():E+=this.__patterns.single_quote.read(),R=this._create_token(u.VALUE,E)}else T=this.__patterns.attribute.read(),T&&(w.type===u.EQUALS?R=this._create_token(u.VALUE,T):R=this._create_token(u.ATTRIBUTE,T));return R},O.prototype._is_content_unformatted=function(x){return this._options.void_elements.indexOf(x)===-1&&(this._options.content_unformatted.indexOf(x)!==-1||this._options.unformatted.indexOf(x)!==-1)},O.prototype._read_raw_content=function(x,w,A){var R="";if(A&&A.text[0]==="{")R=this.__patterns.handlebars_raw_close.read();else if(w.type===u.TAG_CLOSE&&w.opened.text[0]==="<"&&w.text[0]!=="/"){var T=w.opened.text.substr(1).toLowerCase();if(T==="script"||T==="style"){var E=this._read_comment_or_cdata(x);if(E)return E.type=u.TEXT,E;R=this._input.readUntil(new RegExp("</"+T+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(T)&&(R=this._input.readUntil(new RegExp("</"+T+"[\\n\\r\\t ]*?>","ig")))}return R?this._create_token(u.TEXT,R):null},O.prototype._read_content_word=function(x){var w="";if(this._options.unformatted_content_delimiter&&(x===this._options.unformatted_content_delimiter[0]&&(w=this.__patterns.unformatted_content_delimiter.read())),w||(w=this.__patterns.word.read()),w)return this._create_token(u.TEXT,w)},y.exports.Tokenizer=O,y.exports.TOKEN=u}],H={};function k(y){var v=H[y];if(v!==void 0)return v.exports;var p=H[y]={exports:{}};return V[y](p,p.exports,k),p.exports}var L=k(18);D=L})();var $=D;if(!0)!(oe=[ne,ne("6UM0"),ne("TXwP")],Z=function(V){var H=ne("6UM0"),k=ne("TXwP");return{html_beautify:function(L,y){return $(L,y,H.js_beautify,k.css_beautify)}}}.apply(st,oe),Z!==void 0&&(Mt.exports=Z));else var j,F})()},"rAM+":function(Mt,st,ne){"use strict";ne.d(st,"a",function(){return Z});var oe=ne("Qw5x");function Z(D,$){var j;if(typeof Symbol=="undefined"||D[Symbol.iterator]==null){if(Array.isArray(D)||(j=Object(oe.a)(D))||$&&D&&typeof D.length=="number"){j&&(D=j);var F=0,V=function(){};return{s:V,n:function(){return F>=D.length?{done:!0}:{done:!1,value:D[F++]}},e:function(v){throw v},f:V}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var H=!0,k=!1,L;return{s:function(){j=D[Symbol.iterator]()},n:function(){var v=j.next();return H=v.done,v},e:function(v){k=!0,L=v},f:function(){try{!H&&j.return!=null&&j.return()}finally{if(k)throw L}}}}},rUJ1:function(Mt,st){const ne=/[&<>"']/,oe=/[&<>"']/g,Z=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,$={"&":"&","<":"<",">":">",'"':""","'":"'"},j=R=>$[R];function F(R,T){if(T){if(ne.test(R))return R.replace(oe,j)}else if(Z.test(R))return R.replace(D,j);return R}const V=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function H(R){return R.replace(V,(T,E)=>(E=E.toLowerCase(),E==="colon"?":":E.charAt(0)==="#"?E.charAt(1)==="x"?String.fromCharCode(parseInt(E.substring(2),16)):String.fromCharCode(+E.substring(1)):""))}const k=/(^|[^\[])\^/g;function L(R,T){R=R.source||R,T=T||"";const E={replace:(g,a)=>(a=a.source||a,a=a.replace(k,"$1"),R=R.replace(g,a),E),getRegex:()=>new RegExp(R,T)};return E}const y=/[^\w:]/g,v=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function p(R,T,E){if(R){let g;try{g=decodeURIComponent(H(E)).replace(y,"").toLowerCase()}catch(a){return null}if(g.indexOf("javascript:")===0||g.indexOf("vbscript:")===0||g.indexOf("data:")===0)return null}T&&!v.test(E)&&(E=s(T,E));try{E=encodeURI(E).replace(/%25/g,"%")}catch(g){return null}return E}const c={},h=/^[^:]+:\/*[^/]*$/,d=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function s(R,T){c[" "+R]||(h.test(R)?c[" "+R]=R+"/":c[" "+R]=x(R,"/",!0)),R=c[" "+R];const E=R.indexOf(":")===-1;return T.substring(0,2)==="//"?E?T:R.replace(d,"$1")+T:T.charAt(0)==="/"?E?T:R.replace(l,"$1")+T:R+T}const u={exec:function(){}};function f(R){let T=1,E,g;for(;T<arguments.length;T++){E=arguments[T];for(g in E)Object.prototype.hasOwnProperty.call(E,g)&&(R[g]=E[g])}return R}function O(R,T){const E=R.replace(/\|/g,(m,r,b)=>{let P=!1,M=r;for(;--M>=0&&b[M]==="\\";)P=!P;return P?"|":" |"}),g=E.split(/ \|/);let a=0;if(g.length>T)g.splice(T);else for(;g.length<T;)g.push("");for(;a<g.length;a++)g[a]=g[a].trim().replace(/\\\|/g,"|");return g}function x(R,T,E){const g=R.length;if(g===0)return"";let a=0;for(;a<g;){const m=R.charAt(g-a-1);if(m===T&&!E)a++;else if(m!==T&&E)a++;else break}return R.substr(0,g-a)}function w(R,T){if(R.indexOf(T[1])===-1)return-1;const E=R.length;let g=0,a=0;for(;a<E;a++)if(R[a]==="\\")a++;else if(R[a]===T[0])g++;else if(R[a]===T[1]&&(g--,g<0))return a;return-1}function A(R){R&&R.sanitize&&!R.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")}Mt.exports={escape:F,unescape:H,edit:L,cleanUrl:p,resolveUrl:s,noopTest:u,merge:f,splitCells:O,rtrim:x,findClosingBracket:w,checkSanitizeDeprecation:A}},uLbx:function(Mt,st,ne){Mt.exports={flex_box_center:"flex_box_center___1paSn",flex_space_between:"flex_space_between___36S3i",flex_box_vertical_center:"flex_box_vertical_center___3ccMy",flex_box_center_end:"flex_box_center_end___31AGp",flex_box_column:"flex_box_column___1cfjg",bg:"bg___1_34e",containerTitle:"containerTitle___3x8NS",containerDesc:"containerDesc___j5b4j",listItem:"listItem___3eFKb",info:"info___1lfiH",title:"title___1_ERY",titleLeft:"titleLeft___MRBRV",titleRight:"titleRight___XliYN",acitons:"acitons___3Fqbt"}},uSYw:function(Mt,st,ne){Mt.exports={flex_box_center:"flex_box_center___1Yp6V",flex_space_between:"flex_space_between___15-lw",flex_box_vertical_center:"flex_box_vertical_center___3Z69M",flex_box_center_end:"flex_box_center_end___mA7IH",flex_box_column:"flex_box_column___3xASj",wrp:"wrp___2ltDQ",drawer:"drawer___3_MCx",menu:"menu___aAo09",actived:"actived___3DNqM",actived2:"actived2___3JLKu",listItem:"listItem___39GLP",info:"info___1GUGE",title:"title___1wRiz",titleLeft:"titleLeft___1BA1e",titleRight:"titleRight___2w3Ba",search:"search___vFEeF",description:"description___29YXF",menuCourse:"menuCourse___2vc01"}},ulZh:function(Mt,st,ne){typeof window!="undefined"&&function(Z,D){Mt.exports=D()}(this,function(){return function(oe){var Z={};function D($){if(Z[$])return Z[$].exports;var j=Z[$]={i:$,l:!1,exports:{}};return oe[$].call(j.exports,j,j.exports,D),j.l=!0,j.exports}return D.m=oe,D.c=Z,D.d=function($,j,F){D.o($,j)||Object.defineProperty($,j,{enumerable:!0,get:F})},D.r=function($){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty($,Symbol.toStringTag,{value:"Module"}),Object.defineProperty($,"__esModule",{value:!0})},D.t=function($,j){if(j&1&&($=D($)),j&8)return $;if(j&4&&typeof $=="object"&&$&&$.__esModule)return $;var F=Object.create(null);if(D.r(F),Object.defineProperty(F,"default",{enumerable:!0,value:$}),j&2&&typeof $!="string")for(var V in $)D.d(F,V,function(H){return $[H]}.bind(null,V));return F},D.n=function($){var j=$&&$.__esModule?function(){return $.default}:function(){return $};return D.d(j,"a",j),j},D.o=function($,j){return Object.prototype.hasOwnProperty.call($,j)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(oe,Z,D){"use strict";var $=Object.prototype.hasOwnProperty,j="~";function F(){}Object.create&&(F.prototype=Object.create(null),new F().__proto__||(j=!1));function V(y,v,p){this.fn=y,this.context=v,this.once=p||!1}function H(y,v,p,c,h){if(typeof p!="function")throw new TypeError("The listener must be a function");var d=new V(p,c||y,h),l=j?j+v:v;return y._events[l]?y._events[l].fn?y._events[l]=[y._events[l],d]:y._events[l].push(d):(y._events[l]=d,y._eventsCount++),y}function k(y,v){--y._eventsCount===0?y._events=new F:delete y._events[v]}function L(){this._events=new F,this._eventsCount=0}L.prototype.eventNames=function(){var v=[],p,c;if(this._eventsCount===0)return v;for(c in p=this._events)$.call(p,c)&&v.push(j?c.slice(1):c);return Object.getOwnPropertySymbols?v.concat(Object.getOwnPropertySymbols(p)):v},L.prototype.listeners=function(v){var p=j?j+v:v,c=this._events[p];if(!c)return[];if(c.fn)return[c.fn];for(var h=0,d=c.length,l=new Array(d);h<d;h++)l[h]=c[h].fn;return l},L.prototype.listenerCount=function(v){var p=j?j+v:v,c=this._events[p];return c?c.fn?1:c.length:0},L.prototype.emit=function(v,p,c,h,d,l){var s=j?j+v:v;if(!this._events[s])return!1;var u=this._events[s],f=arguments.length,O,x;if(u.fn){u.once&&this.removeListener(v,u.fn,void 0,!0);switch(f){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,p),!0;case 3:return u.fn.call(u.context,p,c),!0;case 4:return u.fn.call(u.context,p,c,h),!0;case 5:return u.fn.call(u.context,p,c,h,d),!0;case 6:return u.fn.call(u.context,p,c,h,d,l),!0}for(x=1,O=new Array(f-1);x<f;x++)O[x-1]=arguments[x];u.fn.apply(u.context,O)}else{var w=u.length,A;for(x=0;x<w;x++){u[x].once&&this.removeListener(v,u[x].fn,void 0,!0);switch(f){case 1:u[x].fn.call(u[x].context);break;case 2:u[x].fn.call(u[x].context,p);break;case 3:u[x].fn.call(u[x].context,p,c);break;case 4:u[x].fn.call(u[x].context,p,c,h);break;default:if(!O)for(A=1,O=new Array(f-1);A<f;A++)O[A-1]=arguments[A];u[x].fn.apply(u[x].context,O)}}}return!0},L.prototype.on=function(v,p,c){return H(this,v,p,c,!1)},L.prototype.once=function(v,p,c){return H(this,v,p,c,!0)},L.prototype.removeListener=function(v,p,c,h){var d=j?j+v:v;if(!this._events[d])return this;if(!p)return k(this,d),this;var l=this._events[d];if(l.fn)l.fn===p&&(!h||l.once)&&(!c||l.context===c)&&k(this,d);else{for(var s=0,u=[],f=l.length;s<f;s++)(l[s].fn!==p||h&&!l[s].once||c&&l[s].context!==c)&&u.push(l[s]);u.length?this._events[d]=u.length===1?u[0]:u:k(this,d)}return this},L.prototype.removeAllListeners=function(v){var p;return v?(p=j?j+v:v,this._events[p]&&k(this,p)):(this._events=new F,this._eventsCount=0),this},L.prototype.off=L.prototype.removeListener,L.prototype.addListener=L.prototype.on,L.prefixed=j,L.EventEmitter=L,oe.exports=L},"./node_modules/url-toolkit/src/url-toolkit.js":function(oe,Z,D){(function($){var j=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,F=/^([^\/?#]*)([^]*)$/,V=/(?:\/|^)\.(?=\/)/g,H=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,k={buildAbsoluteURL:function(L,y,v){if(v=v||{},L=L.trim(),y=y.trim(),!y){if(!v.alwaysNormalize)return L;var p=k.parseURL(L);if(!p)throw new Error("Error trying to parse base URL.");return p.path=k.normalizePath(p.path),k.buildURLFromParts(p)}var c=k.parseURL(y);if(!c)throw new Error("Error trying to parse relative URL.");if(c.scheme)return v.alwaysNormalize?(c.path=k.normalizePath(c.path),k.buildURLFromParts(c)):y;var h=k.parseURL(L);if(!h)throw new Error("Error trying to parse base URL.");if(!h.netLoc&&h.path&&h.path[0]!=="/"){var d=F.exec(h.path);h.netLoc=d[1],h.path=d[2]}h.netLoc&&!h.path&&(h.path="/");var l={scheme:h.scheme,netLoc:c.netLoc,path:null,params:c.params,query:c.query,fragment:c.fragment};if(!c.netLoc&&(l.netLoc=h.netLoc,c.path[0]!=="/"))if(!c.path)l.path=h.path,c.params||(l.params=h.params,c.query||(l.query=h.query));else{var s=h.path,u=s.substring(0,s.lastIndexOf("/")+1)+c.path;l.path=k.normalizePath(u)}return l.path===null&&(l.path=v.alwaysNormalize?k.normalizePath(c.path):c.path),k.buildURLFromParts(l)},parseURL:function(L){var y=j.exec(L);return y?{scheme:y[1]||"",netLoc:y[2]||"",path:y[3]||"",params:y[4]||"",query:y[5]||"",fragment:y[6]||""}:null},normalizePath:function(L){for(L=L.split("").reverse().join("").replace(V,"");L.length!==(L=L.replace(H,"")).length;);return L.split("").reverse().join("")},buildURLFromParts:function(L){return L.scheme+L.netLoc+L.path+L.params+L.query+L.fragment}};oe.exports=k})(this)},"./node_modules/webworkify-webpack/index.js":function(oe,Z,D){function $(v){var p={};function c(d){if(p[d])return p[d].exports;var l=p[d]={i:d,l:!1,exports:{}};return v[d].call(l.exports,l,l.exports,c),l.l=!0,l.exports}c.m=v,c.c=p,c.i=function(d){return d},c.d=function(d,l,s){c.o(d,l)||Object.defineProperty(d,l,{configurable:!1,enumerable:!0,get:s})},c.r=function(d){Object.defineProperty(d,"__esModule",{value:!0})},c.n=function(d){var l=d&&d.__esModule?function(){return d.default}:function(){return d};return c.d(l,"a",l),l},c.o=function(d,l){return Object.prototype.hasOwnProperty.call(d,l)},c.p="/",c.oe=function(d){throw console.error(d),d};var h=c(c.s=ENTRY_MODULE);return h.default||h}var j="[\\.|\\-|\\+|\\w|/|@]+",F="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+j+").*?\\)";function V(v){return(v+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function H(v){return!isNaN(1*v)}function k(v,p,c){var h={};h[c]=[];var d=p.toString(),l=d.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!l)return h;for(var s=l[1],u=new RegExp("(\\\\n|\\W)"+V(s)+F,"g"),f;f=u.exec(d);){if(f[3]==="dll-reference")continue;h[c].push(f[3])}for(u=new RegExp("\\("+V(s)+'\\("(dll-reference\\s('+j+'))"\\)\\)'+F,"g");f=u.exec(d);)v[f[2]]||(h[c].push(f[1]),v[f[2]]=D(f[1]).m),h[f[2]]=h[f[2]]||[],h[f[2]].push(f[4]);for(var O=Object.keys(h),x=0;x<O.length;x++)for(var w=0;w<h[O[x]].length;w++)H(h[O[x]][w])&&(h[O[x]][w]=1*h[O[x]][w]);return h}function L(v){var p=Object.keys(v);return p.reduce(function(c,h){return c||v[h].length>0},!1)}function y(v,p){for(var c={main:[p]},h={main:[]},d={main:{}};L(c);)for(var l=Object.keys(c),s=0;s<l.length;s++){var u=l[s],f=c[u],O=f.pop();if(d[u]=d[u]||{},d[u][O]||!v[u][O])continue;d[u][O]=!0,h[u]=h[u]||[],h[u].push(O);for(var x=k(v,v[u][O],u),w=Object.keys(x),A=0;A<w.length;A++)c[w[A]]=c[w[A]]||[],c[w[A]]=c[w[A]].concat(x[w[A]])}return h}oe.exports=function(v,p){p=p||{};var c={main:D.m},h=p.all?{main:Object.keys(c.main)}:y(c,v),d="";Object.keys(h).filter(function(O){return O!=="main"}).forEach(function(O){for(var x=0;h[O][x];)x++;h[O].push(x),c[O][x]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",d=d+"var "+O+" = ("+$.toString().replace("ENTRY_MODULE",JSON.stringify(x))+")({"+h[O].map(function(w){return""+JSON.stringify(w)+": "+c[O][w].toString()}).join(",")+`});
|
|
`}),d=d+"new (("+$.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+h.main.map(function(O){return""+JSON.stringify(O)+": "+c.main[O].toString()}).join(",")+"}))(self);";var l=new window.Blob([d],{type:"text/javascript"});if(p.bare)return l;var s=window.URL||window.webkitURL||window.mozURL||window.msURL,u=s.createObjectURL(l),f=new window.Worker(u);return f.objectURL=u,f}},"./src/config.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"hlsDefaultConfig",function(){return A}),D.d(Z,"mergeConfig",function(){return T}),D.d(Z,"enableStreamingMode",function(){return E});var $=D("./src/controller/abr-controller.ts"),j=D("./src/controller/audio-stream-controller.ts"),F=D("./src/controller/audio-track-controller.ts"),V=D("./src/controller/subtitle-stream-controller.ts"),H=D("./src/controller/subtitle-track-controller.ts"),k=D("./src/controller/buffer-controller.ts"),L=D("./src/controller/timeline-controller.ts"),y=D("./src/controller/cap-level-controller.ts"),v=D("./src/controller/fps-controller.ts"),p=D("./src/controller/eme-controller.ts"),c=D("./src/controller/cmcd-controller.ts"),h=D("./src/utils/xhr-loader.ts"),d=D("./src/utils/fetch-loader.ts"),l=D("./src/utils/cues.ts"),s=D("./src/utils/mediakeys-helper.ts"),u=D("./src/utils/logger.ts");function f(){return f=Object.assign||function(g){for(var a=1;a<arguments.length;a++){var m=arguments[a];for(var r in m)Object.prototype.hasOwnProperty.call(m,r)&&(g[r]=m[r])}return g},f.apply(this,arguments)}function O(g,a){var m=Object.keys(g);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(g);a&&(r=r.filter(function(b){return Object.getOwnPropertyDescriptor(g,b).enumerable})),m.push.apply(m,r)}return m}function x(g){for(var a=1;a<arguments.length;a++){var m=arguments[a]!=null?arguments[a]:{};a%2?O(Object(m),!0).forEach(function(r){w(g,r,m[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(m)):O(Object(m)).forEach(function(r){Object.defineProperty(g,r,Object.getOwnPropertyDescriptor(m,r))})}return g}function w(g,a,m){return a in g?Object.defineProperty(g,a,{value:m,enumerable:!0,configurable:!0,writable:!0}):g[a]=m,g}var A=x(x({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:h.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:$.default,bufferController:k.default,capLevelController:y.default,fpsController:v.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:s.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},R()),{},{subtitleStreamController:V.SubtitleStreamController,subtitleTrackController:H.default,timelineController:L.TimelineController,audioStreamController:j.default,audioTrackController:F.default,emeController:p.default,cmcdController:c.default});function R(){return{cueHandler:l.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 T(g,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 f({},g,a)}function E(g){var a=g.loader;if(a!==d.default&&a!==h.default)u.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),g.progressive=!1;else{var m=Object(d.fetchSupported)();m&&(g.loader=d.default,g.progressive=!0,g.enableSoftwareAES=!0,u.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(oe,Z,D){"use strict";D.r(Z);var $=D("./src/polyfills/number.ts"),j=D("./src/utils/ewma-bandwidth-estimator.ts"),F=D("./src/events.ts"),V=D("./src/utils/buffer-helper.ts"),H=D("./src/errors.ts"),k=D("./src/types/loader.ts"),L=D("./src/utils/logger.ts");function y(c,h){for(var d=0;d<h.length;d++){var l=h[d];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(c,l.key,l)}}function v(c,h,d){return h&&y(c.prototype,h),d&&y(c,d),c}var p=function(){function c(d){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=d;var l=d.config;this.bwEstimator=new j.default(l.abrEwmaSlowVoD,l.abrEwmaFastVoD,l.abrEwmaDefaultEstimate),this.registerListeners()}var h=c.prototype;return h.registerListeners=function(){var l=this.hls;l.on(F.Events.FRAG_LOADING,this.onFragLoading,this),l.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(F.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(F.Events.ERROR,this.onError,this)},h.unregisterListeners=function(){var l=this.hls;l.off(F.Events.FRAG_LOADING,this.onFragLoading,this),l.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(F.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(F.Events.ERROR,this.onError,this)},h.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},h.onFragLoading=function(l,s){var u=s.frag;if(u.type===k.PlaylistLevelType.MAIN&&!this.timer){var f;this.fragCurrent=u,this.partCurrent=(f=s.part)!=null?f:null,this.timer=self.setInterval(this.onCheck,100)}},h.onLevelLoaded=function(l,s){var u=this.hls.config;s.details.live?this.bwEstimator.update(u.abrEwmaSlowLive,u.abrEwmaFastLive):this.bwEstimator.update(u.abrEwmaSlowVoD,u.abrEwmaFastVoD)},h._abandonRulesCheck=function(){var l=this.fragCurrent,s=this.partCurrent,u=this.hls,f=u.autoLevelEnabled,O=u.config,x=u.media;if(!l||!x)return;var w=s?s.stats:l.stats,A=s?s.duration:l.duration;if(w.aborted){L.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!f||x.paused||!x.playbackRate||!x.readyState)return;var R=performance.now()-w.loading.start,T=Math.abs(x.playbackRate);if(R<=500*A/T)return;var E=u.levels,g=u.minAutoLevel,a=E[l.level],m=w.total||Math.max(w.loaded,Math.round(A*a.maxBitrate/8)),r=Math.max(1,w.bwEstimate?w.bwEstimate/8:w.loaded*1e3/R),b=(m-w.loaded)/r,P=x.currentTime,M=(V.BufferHelper.bufferInfo(x,P,O.maxBufferHole).end-P)/T;if(M>=2*A/T||b<=M)return;var W=Number.POSITIVE_INFINITY,X;for(X=l.level-1;X>g;X--){var U=E[X].maxBitrate;if(W=A*U/(8*.8*r),W<M)break}if(W>=b)return;var S=this.bwEstimator.getEstimate();L.logger.warn("Fragment "+l.sn+(s?" part "+s.index:"")+" of level "+l.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+X+`
|
|
Current BW estimate: `+(Object($.isFiniteNumber)(S)?(S/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+b.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+W.toFixed(3)+` s
|
|
Time to underbuffer: `+M.toFixed(3)+" s"),u.nextLoadLevel=X,this.bwEstimator.sample(R,w.loaded),this.clearTimer(),l.loader&&(this.fragCurrent=this.partCurrent=null,l.loader.abort()),u.trigger(F.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:l,part:s,stats:w})},h.onFragLoaded=function(l,s){var u=s.frag,f=s.part;if(u.type===k.PlaylistLevelType.MAIN&&Object($.isFiniteNumber)(u.sn)){var O=f?f.stats:u.stats,x=f?f.duration:u.duration;if(this.clearTimer(),this.lastLoadedFragLevel=u.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var w=this.hls.levels[u.level],A=(w.loaded?w.loaded.bytes:0)+O.loaded,R=(w.loaded?w.loaded.duration:0)+x;w.loaded={bytes:A,duration:R},w.realBitrate=Math.round(8*A/R)}if(u.bitrateTest){var T={stats:O,frag:u,part:f,id:u.type};this.onFragBuffered(F.Events.FRAG_BUFFERED,T),u.bitrateTest=!1}}},h.onFragBuffered=function(l,s){var u=s.frag,f=s.part,O=f?f.stats:u.stats;if(O.aborted)return;if(u.type!==k.PlaylistLevelType.MAIN||u.sn==="initSegment")return;var x=O.parsing.end-O.loading.start;this.bwEstimator.sample(x,O.loaded),O.bwEstimate=this.bwEstimator.getEstimate(),u.bitrateTest?this.bitrateTestDelay=x/1e3:this.bitrateTestDelay=0},h.onError=function(l,s){switch(s.details){case H.ErrorDetails.FRAG_LOAD_ERROR:case H.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},h.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},h.getNextABRAutoLevel=function(){var l=this.fragCurrent,s=this.partCurrent,u=this.hls,f=u.maxAutoLevel,O=u.config,x=u.minAutoLevel,w=u.media,A=s?s.duration:l?l.duration:0,R=w?w.currentTime:0,T=w&&w.playbackRate!==0?Math.abs(w.playbackRate):1,E=this.bwEstimator?this.bwEstimator.getEstimate():O.abrEwmaDefaultEstimate,g=(V.BufferHelper.bufferInfo(w,R,O.maxBufferHole).end-R)/T,a=this.findBestLevel(E,x,f,g,O.abrBandWidthFactor,O.abrBandWidthUpFactor);if(a>=0)return a;L.logger.trace((g?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var m=A?Math.min(A,O.maxStarvationDelay):O.maxStarvationDelay,r=O.abrBandWidthFactor,b=O.abrBandWidthUpFactor;if(!g){var P=this.bitrateTestDelay;if(P){var M=A?Math.min(A,O.maxLoadingDelay):O.maxLoadingDelay;m=M-P,L.logger.trace("bitrate test took "+Math.round(1e3*P)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*m)+" ms"),r=b=1}}return a=this.findBestLevel(E,x,f,g+m,r,b),Math.max(a,0)},h.findBestLevel=function(l,s,u,f,O,x){for(var w,A=this.fragCurrent,R=this.partCurrent,T=this.lastLoadedFragLevel,E=this.hls.levels,g=E[T],a=!!(g!=null&&(w=g.details)!==null&&w!==void 0&&w.live),m=g==null?void 0:g.codecSet,r=R?R.duration:A?A.duration:0,b=u;b>=s;b--){var P=E[b];if(!P||m&&P.codecSet!==m)continue;var M=P.details,W=(R?M==null?void 0:M.partTarget:M==null?void 0:M.averagetargetduration)||r,X=void 0;b<=T?X=O*l:X=x*l;var U=E[b].maxBitrate,S=U*W/X;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+b+"/"+Math.round(X)+"/"+U+"/"+W+"/"+f+"/"+S),X>U&&(!S||a&&!this.bitrateTestDelay||S<f))return b}return-1},v(c,[{key:"nextAutoLevel",get:function(){var l=this._nextAutoLevel,s=this.bwEstimator;if(l!==-1&&(!s||!s.canEstimate()))return l;var u=this.getNextABRAutoLevel();return l!==-1&&(u=Math.min(l,u)),u},set:function(l){this._nextAutoLevel=l}}]),c}();Z.default=p},"./src/controller/audio-stream-controller.ts":function(oe,Z,D){"use strict";D.r(Z);var $=D("./src/polyfills/number.ts"),j=D("./src/controller/base-stream-controller.ts"),F=D("./src/events.ts"),V=D("./src/utils/buffer-helper.ts"),H=D("./src/controller/fragment-tracker.ts"),k=D("./src/types/level.ts"),L=D("./src/types/loader.ts"),y=D("./src/loader/fragment.ts"),v=D("./src/demux/chunk-cache.ts"),p=D("./src/demux/transmuxer-interface.ts"),c=D("./src/types/transmuxer.ts"),h=D("./src/controller/fragment-finders.ts"),d=D("./src/utils/discontinuities.ts"),l=D("./src/errors.ts"),s=D("./src/utils/logger.ts");function u(){return u=Object.assign||function(A){for(var R=1;R<arguments.length;R++){var T=arguments[R];for(var E in T)Object.prototype.hasOwnProperty.call(T,E)&&(A[E]=T[E])}return A},u.apply(this,arguments)}function f(A,R){A.prototype=Object.create(R.prototype),A.prototype.constructor=A,O(A,R)}function O(A,R){return O=Object.setPrototypeOf||function(E,g){return E.__proto__=g,E},O(A,R)}var x=100,w=function(A){f(R,A);function R(E,g){var a;return a=A.call(this,E,g,"[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 T=R.prototype;return T.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},T._registerListeners=function(){var g=this.hls;g.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),g.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),g.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),g.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.on(F.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),g.on(F.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),g.on(F.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),g.on(F.Events.ERROR,this.onError,this),g.on(F.Events.BUFFER_RESET,this.onBufferReset,this),g.on(F.Events.BUFFER_CREATED,this.onBufferCreated,this),g.on(F.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),g.on(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),g.on(F.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T._unregisterListeners=function(){var g=this.hls;g.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),g.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),g.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),g.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.off(F.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),g.off(F.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),g.off(F.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),g.off(F.Events.ERROR,this.onError,this),g.off(F.Events.BUFFER_RESET,this.onBufferReset,this),g.off(F.Events.BUFFER_CREATED,this.onBufferCreated,this),g.off(F.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),g.off(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),g.off(F.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T.onInitPtsFound=function(g,a){var m=a.frag,r=a.id,b=a.initPTS;if(r==="main"){var P=m.cc;this.initPTS[m.cc]=b,this.log("InitPTS for cc: "+P+" found from main: "+b),this.videoTrackCC=P,this.state===j.State.WAITING_INIT_PTS&&this.tick()}},T.startLoad=function(g){if(!this.levels){this.startPosition=g,this.state=j.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(x),this.fragLoadError=0,a>0&&g===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=j.State.IDLE):(this.loadedmetadata=!1,this.state=j.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=g,this.tick()},T.doTick=function(){switch(this.state){case j.State.IDLE:this.doTickIdle();break;case j.State.WAITING_TRACK:{var g,a=this.levels,m=this.trackId,r=a==null||((g=a[m])===null||g===void 0)?void 0:g.details;if(r){if(this.waitForCdnTuneIn(r))break;this.state=j.State.WAITING_INIT_PTS}break}case j.State.FRAG_LOADING_WAITING_RETRY:{var b,P=performance.now(),M=this.retryDate;(!M||P>=M||(b=this.media)!==null&&b!==void 0&&b.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=j.State.IDLE);break}case j.State.WAITING_INIT_PTS:{var W=this.waitingData;if(W){var X=W.frag,U=W.part,S=W.cache,B=W.complete;if(this.initPTS[X.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=j.State.FRAG_LOADING;var J=S.flush(),te={frag:X,part:U,payload:J,networkDetails:null};this._handleFragmentLoadProgress(te),B&&A.prototype._handleFragmentLoadComplete.call(this,te)}else if(this.videoTrackCC!==this.waitingVideoCC)s.logger.log("Waiting fragment cc ("+X.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ae=this.getLoadPosition(),_e=V.BufferHelper.bufferInfo(this.mediaBuffer,ae,this.config.maxBufferHole),de=Object(h.fragmentWithinToleranceTest)(_e.end,this.config.maxFragLookUpTolerance,X);de<0&&(s.logger.log("Waiting fragment cc ("+X.cc+") @ "+X.start+" cancelled because another fragment at "+_e.end+" is needed"),this.clearWaitingFragment())}}else this.state=j.State.IDLE}}this.onTickEnd()},T.clearWaitingFragment=function(){var g=this.waitingData;g&&(this.fragmentTracker.removeFragment(g.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=j.State.IDLE)},T.onTickEnd=function(){var g=this.media;if(!g||!g.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:g,m=a.buffered;!this.loadedmetadata&&m.length&&(this.loadedmetadata=!0),this.lastCurrentTime=g.currentTime},T.doTickIdle=function(){var g,a,m=this.hls,r=this.levels,b=this.media,P=this.trackId,M=m.config;if(!r||!r[P])return;if(!b&&(this.startFragRequested||!M.startFragPrefetch))return;var W=r[P],X=W.details;if(!X||X.live&&this.levelLastLoaded!==P||this.waitForCdnTuneIn(X)){this.state=j.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,y.ElementaryStreamTypes.AUDIO,L.PlaylistLevelType.AUDIO));var U=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,L.PlaylistLevelType.AUDIO);if(U===null)return;var S=U.len,B=this.getMaxBufferLength(),J=this.audioSwitch;if(S>=B&&!J)return;if(!J&&this._streamEnded(U,X)){m.trigger(F.Events.BUFFER_EOS,{type:"audio"}),this.state=j.State.ENDED;return}var te=X.fragments,ae=te[0].start,_e=U.end;if(J){var de=this.getLoadPosition();_e=de,X.PTSKnown&&de<ae&&((U.end>ae||U.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),b.currentTime=ae+.05))}var Ee=this.getNextFragment(_e,X);if(!Ee){this.bufferFlushed=!0;return}((g=Ee.decryptdata)===null||g===void 0?void 0:g.keyFormat)==="identity"&&!((a=Ee.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Ee,X):this.loadFragment(Ee,X,_e)},T.getMaxBufferLength=function(){var g=A.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,L.PlaylistLevelType.MAIN);return a===null?g:Math.max(g,a.len)},T.onMediaDetaching=function(){this.videoBuffer=null,A.prototype.onMediaDetaching.call(this)},T.onAudioTracksUpdated=function(g,a){var m=a.audioTracks;this.resetTransmuxer(),this.levels=m.map(function(r){return new k.Level(r)})},T.onAudioTrackSwitching=function(g,a){var m=!!a.url;this.trackId=a.id;var r=this.fragCurrent;r!=null&&r.loader&&r.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),m?this.setInterval(x):this.resetTransmuxer(),m?(this.audioSwitch=!0,this.state=j.State.IDLE):this.state=j.State.STOPPED,this.tick()},T.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},T.onLevelLoaded=function(g,a){this.mainDetails=a.details},T.onAudioTrackLoaded=function(g,a){var m,r=this.levels,b=a.details,P=a.id;if(!r){this.warn("Audio tracks were reset while loading level "+P);return}this.log("Track "+P+" loaded ["+b.startSN+","+b.endSN+"],duration:"+b.totalduration);var M=r[P],W=0;if(b.live||(m=M.details)!==null&&m!==void 0&&m.live){var X=this.mainDetails;if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed||!X)return;!M.details&&b.hasProgramDateTime&&X.hasProgramDateTime?(Object(d.alignMediaPlaylistByPDT)(b,X),W=b.fragments[0].start):W=this.alignPlaylists(b,M.details)}M.details=b,this.levelLastLoaded=P,!this.startFragRequested&&(this.mainDetails||!b.live)&&this.setStartPosition(M.details,W),this.state===j.State.WAITING_TRACK&&!this.waitForCdnTuneIn(b)&&(this.state=j.State.IDLE),this.tick()},T._handleFragmentLoadProgress=function(g){var a,m=g.frag,r=g.part,b=g.payload,P=this.config,M=this.trackId,W=this.levels;if(!W){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+m.sn+" of level "+m.level+" will not be buffered");return}var X=W[M];console.assert(X,"Audio track is defined on fragment load progress");var U=X.details;console.assert(U,"Audio track details are defined on fragment load progress");var S=P.defaultAudioCodec||X.audioCodec||"mp4a.40.2",B=this.transmuxer;B||(B=this.transmuxer=new p.default(this.hls,L.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var J=this.initPTS[m.cc],te=(a=m.initSegment)===null||a===void 0?void 0:a.data;if(J!==void 0){var ae=!1,_e=r?r.index:-1,de=_e!==-1,Ee=new c.ChunkMetadata(m.level,m.sn,m.stats.chunkCount,b.byteLength,_e,de);B.push(b,te,S,"",m,r,U.totalduration,ae,Ee,J)}else{s.logger.log("Unknown video PTS for cc "+m.cc+", waiting for video PTS before demuxing audio frag "+m.sn+" of ["+U.startSN+" ,"+U.endSN+"],track "+M);var Te=this.waitingData=this.waitingData||{frag:m,part:r,cache:new v.default,complete:!1},me=Te.cache;me.push(new Uint8Array(b)),this.waitingVideoCC=this.videoTrackCC,this.state=j.State.WAITING_INIT_PTS}},T._handleFragmentLoadComplete=function(g){if(this.waitingData){this.waitingData.complete=!0;return}A.prototype._handleFragmentLoadComplete.call(this,g)},T.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},T.onBufferCreated=function(g,a){var m=a.tracks.audio;m&&(this.mediaBuffer=m.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},T.onFragBuffered=function(g,a){var m=a.frag,r=a.part;if(m.type!==L.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(m)){this.warn("Fragment "+m.sn+(r?" p: "+r.index:"")+" of level "+m.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}m.sn!=="initSegment"&&(this.fragPrevious=m,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(F.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(m,r)},T.onError=function(g,a){switch(a.details){case l.ErrorDetails.FRAG_LOAD_ERROR:case l.ErrorDetails.FRAG_LOAD_TIMEOUT:case l.ErrorDetails.KEY_LOAD_ERROR:case l.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.AUDIO,a);break;case l.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case l.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==j.State.ERROR&&this.state!==j.State.STOPPED&&(this.state=a.fatal?j.State.ERROR:j.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case l.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===j.State.PARSING||this.state===j.State.PARSED)){var m=!0,r=this.getFwdBufferInfo(this.mediaBuffer,L.PlaylistLevelType.AUDIO);r&&r.len>.5&&(m=!this.reduceMaxBufferLength(r.len)),m&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},T.onBufferFlushed=function(g,a){var m=a.type;m===y.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},T._handleTransmuxComplete=function(g){var a,m="audio",r=this.hls,b=g.remuxResult,P=g.chunkMeta,M=this.getCurrentContext(P);if(!M){this.warn("The loading context changed while buffering fragment "+P.sn+" of level "+P.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(P.level);return}var W=M.frag,X=M.part,U=b.audio,S=b.text,B=b.id3,J=b.initSegment;if(this.fragContextChanged(W))return;if(this.state=j.State.PARSING,this.audioSwitch&&U&&this.completeAudioSwitch(),J!=null&&J.tracks&&(this._bufferInitSegment(J.tracks,W,P),r.trigger(F.Events.FRAG_PARSING_INIT_SEGMENT,{frag:W,id:m,tracks:J.tracks})),U){var te=U.startPTS,ae=U.endPTS,_e=U.startDTS,de=U.endDTS;X&&(X.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:te,endPTS:ae,startDTS:_e,endDTS:de}),W.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,te,ae,_e,de),this.bufferFragmentData(U,W,X,P)}if(B!=null&&(a=B.samples)!==null&&a!==void 0&&a.length){var Ee=u({frag:W,id:m},B);r.trigger(F.Events.FRAG_PARSING_METADATA,Ee)}if(S){var Te=u({frag:W,id:m},S);r.trigger(F.Events.FRAG_PARSING_USERDATA,Te)}},T._bufferInitSegment=function(g,a,m){if(this.state!==j.State.PARSING)return;g.video&&delete g.video;var r=g.audio;if(!r)return;r.levelCodec=r.codec,r.id="audio",this.log("Init audio buffer, container:"+r.container+", codecs[parsed]=["+r.codec+"]"),this.hls.trigger(F.Events.BUFFER_CODECS,g);var b=r.initSegment;if(b!=null&&b.byteLength){var P={type:"audio",frag:a,part:null,chunkMeta:m,parent:a.type,data:b};this.hls.trigger(F.Events.BUFFER_APPENDING,P)}this.tick()},T.loadFragment=function(g,a,m){var r=this.fragmentTracker.getState(g);this.fragCurrent=g,(this.audioSwitch||r===H.FragmentState.NOT_LOADED||r===H.FragmentState.PARTIAL)&&(g.sn==="initSegment"?this._loadInitSegment(g):a.live&&!Object($.isFiniteNumber)(this.initPTS[g.cc])?(this.log("Waiting for video PTS in continuity counter "+g.cc+" of live stream before loading audio fragment "+g.sn+" of level "+this.trackId),this.state=j.State.WAITING_INIT_PTS):(this.startFragRequested=!0,A.prototype.loadFragment.call(this,g,a,m)))},T.completeAudioSwitch=function(){var g=this.hls,a=this.media,m=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,g.trigger(F.Events.AUDIO_TRACK_SWITCHED,{id:m})},R}(j.default);Z.default=w},"./src/controller/audio-track-controller.ts":function(oe,Z,D){"use strict";D.r(Z);var $=D("./src/events.ts"),j=D("./src/errors.ts"),F=D("./src/controller/base-playlist-controller.ts"),V=D("./src/types/loader.ts");function H(p,c){for(var h=0;h<c.length;h++){var d=c[h];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(p,d.key,d)}}function k(p,c,h){return c&&H(p.prototype,c),h&&H(p,h),p}function L(p,c){p.prototype=Object.create(c.prototype),p.prototype.constructor=p,y(p,c)}function y(p,c){return y=Object.setPrototypeOf||function(d,l){return d.__proto__=l,d},y(p,c)}var v=function(p){L(c,p);function c(d){var l;return l=p.call(this,d,"[audio-track-controller]")||this,l.tracks=[],l.groupId=null,l.tracksInGroup=[],l.trackId=-1,l.trackName="",l.selectDefaultTrack=!0,l.registerListeners(),l}var h=c.prototype;return h.registerListeners=function(){var l=this.hls;l.on($.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on($.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.on($.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on($.Events.ERROR,this.onError,this)},h.unregisterListeners=function(){var l=this.hls;l.off($.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off($.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.off($.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off($.Events.ERROR,this.onError,this)},h.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,p.prototype.destroy.call(this)},h.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},h.onManifestParsed=function(l,s){this.tracks=s.audioTracks||[]},h.onAudioTrackLoaded=function(l,s){var u=s.id,f=s.details,O=this.tracksInGroup[u];if(!O){this.warn("Invalid audio track id "+u);return}var x=O.details;O.details=s.details,this.log("audioTrack "+u+" loaded ["+f.startSN+"-"+f.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,s,x))},h.onLevelLoading=function(l,s){this.switchLevel(s.level)},h.onLevelSwitching=function(l,s){this.switchLevel(s.level)},h.switchLevel=function(l){var s=this.hls.levels[l];if(!(s!=null&&s.audioGroupIds))return;var u=s.audioGroupIds[s.urlId];if(this.groupId!==u){this.groupId=u;var f=this.tracks.filter(function(x){return!u||x.groupId===u});this.selectDefaultTrack&&!f.some(function(x){return x.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=f;var O={audioTracks:f};this.log("Updating audio tracks, "+f.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger($.Events.AUDIO_TRACKS_UPDATED,O),this.selectInitialTrack()}},h.onError=function(l,s){if(p.prototype.onError.call(this,l,s),s.fatal||!s.context)return;s.context.type===V.PlaylistContextType.AUDIO_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},h.setAudioTrack=function(l){var s=this.tracksInGroup;if(l<0||l>=s.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var u=s[this.trackId];this.log("Now switching to audio-track index "+l);var f=s[l],O=f.id,x=f.groupId,w=x===void 0?"":x,A=f.name,R=f.type,T=f.url;if(this.trackId=l,this.trackName=A,this.selectDefaultTrack=!1,this.hls.trigger($.Events.AUDIO_TRACK_SWITCHING,{id:O,groupId:w,name:A,type:R,url:T}),f.details&&!f.details.live)return;var E=this.switchParams(f.url,u==null?void 0:u.details);this.loadPlaylist(E)},h.selectInitialTrack=function(){var l=this.tracksInGroup;console.assert(l.length,"Initial audio track should be selected when tracks are known");var s=this.trackName,u=this.findTrackId(s)||this.findTrackId();u!==-1?this.setAudioTrack(u):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger($.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},h.findTrackId=function(l){for(var s=this.tracksInGroup,u=0;u<s.length;u++){var f=s[u];if((!this.selectDefaultTrack||f.default)&&(!l||l===f.name))return f.id}return-1},h.loadPlaylist=function(l){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var u=s.id,f=s.groupId,O=s.url;if(l)try{O=l.addDirectives(O)}catch(x){this.warn("Could not construct new URL with HLS Delivery Directives: "+x)}this.log("loading audio-track playlist for id: "+u),this.clearTimer(),this.hls.trigger($.Events.AUDIO_TRACK_LOADING,{url:O,id:u,groupId:f,deliveryDirectives:l||null})}},k(c,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(l){this.selectDefaultTrack=!1,this.setAudioTrack(l)}}]),c}(F.default);Z.default=v},"./src/controller/base-playlist-controller.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return k});var $=D("./src/polyfills/number.ts"),j=D("./src/types/level.ts"),F=D("./src/controller/level-helper.ts"),V=D("./src/utils/logger.ts"),H=D("./src/errors.ts"),k=function(){function L(v,p){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=V.logger.log.bind(V.logger,p+":"),this.warn=V.logger.warn.bind(V.logger,p+":"),this.hls=v}var y=L.prototype;return y.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},y.onError=function(p,c){c.fatal&&c.type===H.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},y.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},y.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},y.stopLoad=function(){this.canLoad=!1,this.clearTimer()},y.switchParams=function(p,c){var h=c==null?void 0:c.renditionReports;if(h)for(var d=0;d<h.length;d++){var l=h[d],s=""+l.URI;if(s===p.substr(-s.length)){var u=parseInt(l["LAST-MSN"]),f=parseInt(l["LAST-PART"]);if(c&&this.hls.config.lowLatencyMode){var O=Math.min(c.age-c.partTarget,c.targetduration);f!==void 0&&O>c.partTarget&&(f+=1)}if(Object($.isFiniteNumber)(u))return new j.HlsUrlParameters(u,Object($.isFiniteNumber)(f)?f:void 0,j.HlsSkip.No)}}},y.loadPlaylist=function(p){},y.shouldLoadTrack=function(p){return this.canLoad&&p&&!!p.url&&(!p.details||p.details.live)},y.playlistLoaded=function(p,c,h){var d=this,l=c.details,s=c.stats,u=s.loading.end?Math.max(0,self.performance.now()-s.loading.end):0;if(l.advancedDateTime=Date.now()-u,l.live||h!=null&&h.live){if(l.reloaded(h),h&&this.log("live playlist "+p+" "+(l.advanced?"REFRESHED "+l.lastPartSn+"-"+l.lastPartIndex:"MISSED")),h&&l.fragments.length>0&&Object(F.mergeDetails)(h,l),!this.canLoad||!l.live)return;var f,O=void 0,x=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var w=this.hls.config.lowLatencyMode,A=l.lastPartSn,R=l.endSN,T=l.lastPartIndex,E=T!==-1,g=A===R,a=w?0:T;E?(O=g?R+1:A,x=g?a:T+1):O=R+1;var m=l.age,r=m+l.ageHeader,b=Math.min(r-l.partTarget,l.targetduration*1.5);if(b>0){if(h&&b>h.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+h.tuneInGoal+" to: "+b+" with playlist age: "+l.age),b=0;else{var P=Math.floor(b/l.targetduration);if(O+=P,x!==void 0){var M=Math.round(b%l.targetduration/l.partTarget);x+=M}this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+m.toFixed(2)+"s goal: "+b+" skip sn "+P+" to part "+x)}l.tuneInGoal=b}if(f=this.getDeliveryDirectives(l,c.deliveryDirectives,O,x),w||!g){this.loadPlaylist(f);return}}else f=this.getDeliveryDirectives(l,c.deliveryDirectives,O,x);var W=Object(F.computeReloadInterval)(l,s);O!==void 0&&l.canBlockReload&&(W-=l.partTarget||1),this.log("reload live playlist "+p+" in "+Math.round(W)+" ms"),this.timer=self.setTimeout(function(){return d.loadPlaylist(f)},W)}else this.clearTimer()},y.getDeliveryDirectives=function(p,c,h,d){var l=Object(j.getSkipValue)(p,h);return c!=null&&c.skip&&p.deltaUpdateFailed&&(h=c.msn,d=c.part,l=j.HlsSkip.No),new j.HlsUrlParameters(h,d,l)},y.retryLoadingOrFail=function(p){var c=this,h=this.hls.config,d=this.retryCount<h.levelLoadingMaxRetry;if(d){var l;if(this.retryCount++,p.details.indexOf("LoadTimeOut")>-1&&(l=p.context)!==null&&l!==void 0&&l.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+p.details+'"'),this.loadPlaylist();else{var s=Math.min(Math.pow(2,this.retryCount)*h.levelLoadingRetryDelay,h.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return c.loadPlaylist()},s),this.warn("retry playlist loading #"+this.retryCount+" in "+s+' ms after "'+p.details+'"')}}else this.warn('cannot recover from error "'+p.details+'"'),this.clearTimer(),p.fatal=!0;return d},L}()},"./src/controller/base-stream-controller.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"State",function(){return R}),D.d(Z,"default",function(){return T});var $=D("./src/polyfills/number.ts"),j=D("./src/task-loop.ts"),F=D("./src/controller/fragment-tracker.ts"),V=D("./src/utils/buffer-helper.ts"),H=D("./src/utils/logger.ts"),k=D("./src/events.ts"),L=D("./src/errors.ts"),y=D("./src/types/transmuxer.ts"),v=D("./src/utils/mp4-tools.ts"),p=D("./src/utils/discontinuities.ts"),c=D("./src/controller/fragment-finders.ts"),h=D("./src/controller/level-helper.ts"),d=D("./src/loader/fragment-loader.ts"),l=D("./src/crypt/decrypter.ts"),s=D("./src/utils/time-ranges.ts"),u=D("./src/types/loader.ts");function f(E,g){for(var a=0;a<g.length;a++){var m=g[a];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(E,m.key,m)}}function O(E,g,a){return g&&f(E.prototype,g),a&&f(E,a),E}function x(E){if(E===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return E}function w(E,g){E.prototype=Object.create(g.prototype),E.prototype.constructor=E,A(E,g)}function A(E,g){return A=Object.setPrototypeOf||function(m,r){return m.__proto__=r,m},A(E,g)}var R={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"},T=function(E){w(g,E);function g(m,r,b){var P;return P=E.call(this)||this,P.hls=void 0,P.fragPrevious=null,P.fragCurrent=null,P.fragmentTracker=void 0,P.transmuxer=null,P._state=R.STOPPED,P.media=void 0,P.mediaBuffer=void 0,P.config=void 0,P.bitrateTest=!1,P.lastCurrentTime=0,P.nextLoadPosition=0,P.startPosition=0,P.loadedmetadata=!1,P.fragLoadError=0,P.retryDate=0,P.levels=null,P.fragmentLoader=void 0,P.levelLastLoaded=null,P.startFragRequested=!1,P.decrypter=void 0,P.initPTS=[],P.onvseeking=null,P.onvended=null,P.logPrefix="",P.log=void 0,P.warn=void 0,P.logPrefix=b,P.log=H.logger.log.bind(H.logger,b+":"),P.warn=H.logger.warn.bind(H.logger,b+":"),P.hls=m,P.fragmentLoader=new d.default(m.config),P.fragmentTracker=r,P.config=m.config,P.decrypter=new l.default(m,m.config),m.on(k.Events.KEY_LOADED,P.onKeyLoaded,x(P)),P}var a=g.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(r){},a.stopLoad=function(){this.fragmentLoader.abort();var r=this.fragCurrent;r&&this.fragmentTracker.removeFragment(r),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=R.STOPPED},a._streamEnded=function(r,b){var P=this.fragCurrent,M=this.fragmentTracker;if(!b.live&&P&&P.sn===b.endSN&&!r.nextStart){var W=M.getState(P);return W===F.FragmentState.PARTIAL||W===F.FragmentState.OK}return!1},a.onMediaAttached=function(r,b){var P=this.media=this.mediaBuffer=b.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),P.addEventListener("seeking",this.onvseeking),P.addEventListener("ended",this.onvended);var M=this.config;this.levels&&M.autoStartLoad&&this.state===R.STOPPED&&this.startLoad(M.startPosition)},a.onMediaDetaching=function(){var r=this.media;r!=null&&r.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),r&&(r.removeEventListener("seeking",this.onvseeking),r.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 r=this.config,b=this.fragCurrent,P=this.media,M=this.mediaBuffer,W=this.state,X=P?P.currentTime:0,U=V.BufferHelper.bufferInfo(M||P,X,r.maxBufferHole);if(this.log("media seeking to "+(Object($.isFiniteNumber)(X)?X.toFixed(3):X)+", state: "+W),W===R.ENDED)this.resetLoadingState();else if(b&&!U.len){var S=r.maxFragLookUpTolerance,B=b.start-S,J=b.start+b.duration+S,te=X>J;(X<B||te)&&(te&&b.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),b.loader.abort()),this.resetLoadingState())}P&&(this.lastCurrentTime=X),!this.loadedmetadata&&!U.len&&(this.nextLoadPosition=this.startPosition=X),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(r,b){if(this.state!==R.KEY_LOADING||b.frag!==this.fragCurrent||!this.levels)return;this.state=R.IDLE;var P=this.levels[b.frag.level].details;P&&this.loadFragment(b.frag,P,b.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),E.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=R.STOPPED,this.hls.off(k.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,E.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(r,b){this.log("Loading key for "+r.sn+" of ["+b.startSN+"-"+b.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+r.level),this.state=R.KEY_LOADING,this.fragCurrent=r,this.hls.trigger(k.Events.KEY_LOADING,{frag:r})},a.loadFragment=function(r,b,P){this._loadFragForPlayback(r,b,P)},a._loadFragForPlayback=function(r,b,P){var M=this,W=function(U){if(M.fragContextChanged(r)){M.warn("Fragment "+r.sn+(U.part?" p: "+U.part.index:"")+" of level "+r.level+" was dropped during download."),M.fragmentTracker.removeFragment(r);return}r.stats.chunkCount++,M._handleFragmentLoadProgress(U)};this._doFragLoad(r,b,P,W).then(function(X){if(!X)return;M.fragLoadError=0;var U=M.state;if(M.fragContextChanged(r)){(U===R.FRAG_LOADING||U===R.BACKTRACKING||!M.fragCurrent&&U===R.PARSING)&&(M.fragmentTracker.removeFragment(r),M.state=R.IDLE);return}if("payload"in X&&(M.log("Loaded fragment "+r.sn+" of level "+r.level),M.hls.trigger(k.Events.FRAG_LOADED,X),M.state===R.BACKTRACKING)){M.fragmentTracker.backtrack(r,X),M.resetFragmentLoading(r);return}M._handleFragmentLoadComplete(X)}).catch(function(X){M.warn(X),M.resetFragmentLoading(r)})},a.flushMainBuffer=function(r,b,P){if(P===void 0&&(P=null),!(r-b))return;var M={startOffset:r,endOffset:b,type:P};this.fragLoadError=0,this.hls.trigger(k.Events.BUFFER_FLUSHING,M)},a._loadInitSegment=function(r){var b=this;this._doFragLoad(r).then(function(P){if(!P||b.fragContextChanged(r)||!b.levels)throw new Error("init load aborted");return P}).then(function(P){var M=b.hls,W=P.payload,X=r.decryptdata;if(W&&W.byteLength>0&&X&&X.key&&X.iv&&X.method==="AES-128"){var U=self.performance.now();return b.decrypter.webCryptoDecrypt(new Uint8Array(W),X.key.buffer,X.iv.buffer).then(function(S){var B=self.performance.now();return M.trigger(k.Events.FRAG_DECRYPTED,{frag:r,payload:S,stats:{tstart:U,tdecrypt:B}}),P.payload=S,P})}return P}).then(function(P){var M=b.fragCurrent,W=b.hls,X=b.levels;if(!X)throw new Error("init load aborted, missing levels");var U=X[r.level].details;console.assert(U,"Level details are defined when init segment is loaded");var S=r.stats;b.state=R.IDLE,b.fragLoadError=0,r.data=new Uint8Array(P.payload),S.parsing.start=S.buffering.start=self.performance.now(),S.parsing.end=S.buffering.end=self.performance.now(),P.frag===M&&W.trigger(k.Events.FRAG_BUFFERED,{stats:S,frag:M,part:null,id:r.type}),b.tick()}).catch(function(P){b.warn(P),b.resetFragmentLoading(r)})},a.fragContextChanged=function(r){var b=this.fragCurrent;return!r||!b||r.level!==b.level||r.sn!==b.sn||r.urlId!==b.urlId},a.fragBufferedComplete=function(r,b){var P=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+r.type+" sn: "+r.sn+(b?" part: "+b.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+r.level+" "+s.default.toString(V.BufferHelper.getBuffered(P))),this.state=R.IDLE,this.tick()},a._handleFragmentLoadComplete=function(r){var b=this.transmuxer;if(!b)return;var P=r.frag,M=r.part,W=r.partsLoaded,X=!W||W.length===0||W.some(function(S){return!S}),U=new y.ChunkMetadata(P.level,P.sn,P.stats.chunkCount+1,0,M?M.index:-1,!X);b.flush(U)},a._handleFragmentLoadProgress=function(r){},a._doFragLoad=function(r,b,P,M){var W=this;if(P===void 0&&(P=null),!this.levels)throw new Error("frag load aborted, missing levels");if(P=Math.max(r.start,P||0),this.config.lowLatencyMode&&b){var X=b.partList;if(X&&M){P>r.end&&b.fragmentHint&&(r=b.fragmentHint);var U=this.getNextPart(X,r,P);if(U>-1){var S=X[U];return this.log("Loading part sn: "+r.sn+" p: "+S.index+" cc: "+r.cc+" of playlist ["+b.startSN+"-"+b.endSN+"] parts [0-"+U+"-"+(X.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+r.level+", target: "+parseFloat(P.toFixed(3))),this.nextLoadPosition=S.start+S.duration,this.state=R.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:r,part:X[U],targetBufferTime:P}),this.doFragPartsLoad(r,X,U,M).catch(function(B){return W.handleFragLoadError(B)})}else if(!r.url||this.loadedEndOfParts(X,P))return Promise.resolve(null)}}return this.log("Loading fragment "+r.sn+" cc: "+r.cc+" "+(b?"of ["+b.startSN+"-"+b.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+r.level+", target: "+parseFloat(P.toFixed(3))),Object($.isFiniteNumber)(r.sn)&&!this.bitrateTest&&(this.nextLoadPosition=r.start+r.duration),this.state=R.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:r,targetBufferTime:P}),this.fragmentLoader.load(r,M).catch(function(B){return W.handleFragLoadError(B)})},a.doFragPartsLoad=function(r,b,P,M){var W=this;return new Promise(function(X,U){var S=[],B=function J(te){var ae=b[te];W.fragmentLoader.loadPart(r,ae,M).then(function(_e){S[ae.index]=_e;var de=_e.part;W.hls.trigger(k.Events.FRAG_LOADED,_e);var Ee=b[te+1];if(Ee&&Ee.fragment===r)J(te+1);else return X({frag:r,part:de,partsLoaded:S})}).catch(U)};B(P)})},a.handleFragLoadError=function(r){var b=r.data;return b&&b.details===L.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(b.frag,b.part):this.hls.trigger(k.Events.ERROR,b),null},a._handleTransmuxerFlush=function(r){var b=this.getCurrentContext(r);if(!b||this.state!==R.PARSING){this.fragCurrent||(this.state=R.IDLE);return}var P=b.frag,M=b.part,W=b.level,X=self.performance.now();P.stats.parsing.end=X,M&&(M.stats.parsing.end=X),this.updateLevelTiming(P,M,W,r.partial)},a.getCurrentContext=function(r){var b=this.levels,P=r.level,M=r.sn,W=r.part;if(!b||!b[P])return this.warn("Levels object was unset while buffering fragment "+M+" of level "+P+". The current chunk will not be buffered."),null;var X=b[P],U=W>-1?Object(h.getPartWith)(X,M,W):null,S=U?U.fragment:Object(h.getFragmentWithSN)(X,M,this.fragCurrent);return S?{frag:S,part:U,level:X}:null},a.bufferFragmentData=function(r,b,P,M){if(!r||this.state!==R.PARSING)return;var W=r.data1,X=r.data2,U=W;if(W&&X&&(U=Object(v.appendUint8Array)(W,X)),!U||!U.length)return;var S={type:r.type,frag:b,part:P,chunkMeta:M,parent:b.type,data:U};this.hls.trigger(k.Events.BUFFER_APPENDING,S),r.dropped&&r.independent&&!P&&this.flushBufferGap(b)},a.flushBufferGap=function(r){var b=this.media;if(!b)return;if(!V.BufferHelper.isBuffered(b,b.currentTime)){this.flushMainBuffer(0,r.start);return}var P=b.currentTime,M=V.BufferHelper.bufferInfo(b,P,0),W=r.duration,X=Math.min(this.config.maxFragLookUpTolerance*2,W*.25),U=Math.max(Math.min(r.start-X,M.end-X),P+X);r.start-U>X&&this.flushMainBuffer(U,r.start)},a.getFwdBufferInfo=function(r,b){var P=this.config,M=this.getLoadPosition();if(!Object($.isFiniteNumber)(M))return null;var W=V.BufferHelper.bufferInfo(r,M,P.maxBufferHole);if(W.len===0&&W.nextStart!==void 0){var X=this.fragmentTracker.getBufferedFrag(M,b);if(X&&W.nextStart<X.end)return V.BufferHelper.bufferInfo(r,M,Math.max(W.nextStart,P.maxBufferHole))}return W},a.getMaxBufferLength=function(r){var b=this.config,P;return r?P=Math.max(8*b.maxBufferSize/r,b.maxBufferLength):P=b.maxBufferLength,Math.min(P,b.maxMaxBufferLength)},a.reduceMaxBufferLength=function(r){var b=this.config,P=r||b.maxBufferLength;return b.maxMaxBufferLength>=P?(b.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+b.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(r,b){var P,M,W=b.fragments,X=W.length;if(!X)return null;var U=this.config,S=W[0].start,B;if(b.live){var J=U.initialLiveManifestSize;if(X<J)return this.warn("Not enough fragments to start playback (have: "+X+", need: "+J+")"),null;!b.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(B=this.getInitialLiveFragment(b,W),this.startPosition=B?this.hls.liveSyncPosition||B.start:r)}else r<=S&&(B=W[0]);if(!B){var te=U.lowLatencyMode?b.partEnd:b.fragmentEnd;B=this.getFragmentAtPosition(r,te,b)}return(P=B)!==null&&P!==void 0&&P.initSegment&&!((M=B)!==null&&M!==void 0&&M.initSegment.data)&&!this.bitrateTest&&(B=B.initSegment),B},a.getNextPart=function(r,b,P){for(var M=-1,W=!1,X=!0,U=0,S=r.length;U<S;U++){var B=r[U];if(X=X&&!B.independent,M>-1&&P<B.start)break;var J=B.loaded;!J&&(W||B.independent||X)&&B.fragment===b&&(M=U),W=J}return M},a.loadedEndOfParts=function(r,b){var P=r[r.length-1];return P&&b>P.start&&P.loaded},a.getInitialLiveFragment=function(r,b){var P=this.fragPrevious,M=null;if(P){if(r.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+P.programDateTime),M=Object(c.findFragmentByPDT)(b,P.endProgramDateTime,this.config.maxFragLookUpTolerance)),!M){var W=P.sn+1;if(W>=r.startSN&&W<=r.endSN){var X=b[W-r.startSN];P.cc===X.cc&&(M=X,this.log("Live playlist, switching playlist, load frag with next SN: "+M.sn))}M||(M=Object(c.findFragWithCC)(b,P.cc),M&&this.log("Live playlist, switching playlist, load frag with same CC: "+M.sn))}}else{var U=this.hls.liveSyncPosition;U!==null&&(M=this.getFragmentAtPosition(U,this.bitrateTest?r.fragmentEnd:r.edge,r))}return M},a.getFragmentAtPosition=function(r,b,P){var M=this.config,W=this.fragPrevious,X=P.fragments,U=P.endSN,S=P.fragmentHint,B=M.maxFragLookUpTolerance,J=!!(M.lowLatencyMode&&P.partList&&S);J&&S&&!this.bitrateTest&&(X=X.concat(S),U=S.sn);var te;if(r<b){var ae=r>b-B?0:B;te=Object(c.findFragmentByPTS)(W,X,r,ae)}else te=X[X.length-1];if(te){var _e=te.sn-P.startSN,de=W&&te.level===W.level,Ee=X[_e+1],Te=this.fragmentTracker.getState(te);if(Te===F.FragmentState.BACKTRACKED){te=null;for(var me=_e;X[me]&&this.fragmentTracker.getState(X[me])===F.FragmentState.BACKTRACKED;)W?te=X[me--]:te=X[--me];te||(te=Ee)}else W&&te.sn===W.sn&&!J&&(de&&(te.sn<U&&this.fragmentTracker.getState(Ee)!==F.FragmentState.OK?(this.log("SN "+te.sn+" just loaded, load next one: "+Ee.sn),te=Ee):te=null))}return te},a.synchronizeToLiveEdge=function(r){var b=this.config,P=this.media;if(!P)return;var M=this.hls.liveSyncPosition,W=P.currentTime,X=r.fragments[0].start,U=r.edge,S=W>=X-b.maxFragLookUpTolerance&&W<=U;if(M!==null&&P.duration>M&&(W<M||!S)){var B=b.liveMaxLatencyDuration!==void 0?b.liveMaxLatencyDuration:b.liveMaxLatencyDurationCount*r.targetduration;(!S&&P.readyState<4||W<U-B)&&(this.loadedmetadata||(this.nextLoadPosition=M),P.readyState&&(this.warn("Playback: "+W.toFixed(3)+" is located too far from the end of live sliding playlist: "+U+", reset currentTime to : "+M.toFixed(3)),P.currentTime=M))}},a.alignPlaylists=function(r,b){var P=this.levels,M=this.levelLastLoaded,W=this.fragPrevious,X=M!==null?P[M]:null,U=r.fragments.length;if(!U)return this.warn("No fragments in live playlist"),0;var S=r.fragments[0].start,B=!b,J=r.alignedSliding&&Object($.isFiniteNumber)(S);if(B||!J&&!S){Object(p.alignStream)(W,X,r);var te=r.fragments[0].start;return this.log("Live playlist sliding: "+te.toFixed(2)+" start-sn: "+(b?b.startSN:"na")+"->"+r.startSN+" prev-sn: "+(W?W.sn:"na")+" fragments: "+U),te}return S},a.waitForCdnTuneIn=function(r){var b=3;return r.live&&r.canBlockReload&&r.tuneInGoal>Math.max(r.partHoldBack,r.partTarget*b)},a.setStartPosition=function(r,b){var P=this.startPosition;if(P<b&&(P=-1),P===-1||this.lastCurrentTime===-1){var M=r.startTimeOffset;Object($.isFiniteNumber)(M)?(P=b+M,M<0&&(P+=r.totalduration),P=Math.min(Math.max(b,P),b+r.totalduration),this.log("Start time offset "+M+" found in playlist, adjust startPosition to "+P),this.startPosition=P):r.live?P=this.hls.liveSyncPosition||b:this.startPosition=P=0,this.lastCurrentTime=P}this.nextLoadPosition=P},a.getLoadPosition=function(){var r=this.media,b=0;return this.loadedmetadata&&r?b=r.currentTime:this.nextLoadPosition&&(b=this.nextLoadPosition),b},a.handleFragLoadAborted=function(r,b){this.transmuxer&&r.sn!=="initSegment"&&r.stats.aborted&&(this.warn("Fragment "+r.sn+(b?" part"+b.index:"")+" of level "+r.level+" was aborted"),this.resetFragmentLoading(r))},a.resetFragmentLoading=function(r){(!this.fragCurrent||!this.fragContextChanged(r))&&(this.state=R.IDLE)},a.onFragmentOrKeyLoadError=function(r,b){if(b.fatal)return;var P=b.frag;if(!P||P.type!==r)return;var M=this.fragCurrent;console.assert(M&&P.sn===M.sn&&P.level===M.level&&P.urlId===M.urlId,"Frag load error must match current frag to retry");var W=this.config;if(this.fragLoadError+1<=W.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(P.level))return;var X=Math.min(Math.pow(2,this.fragLoadError)*W.fragLoadingRetryDelay,W.fragLoadingMaxRetryTimeout);this.warn("Fragment "+P.sn+" of "+r+" "+P.level+" failed to load, retrying in "+X+"ms"),this.retryDate=self.performance.now()+X,this.fragLoadError++,this.state=R.FRAG_LOADING_WAITING_RETRY}else b.levelRetry?(r===u.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=R.IDLE):(H.logger.error(b.details+" reaches max retry, redispatch as fatal ..."),b.fatal=!0,this.hls.stopLoad(),this.state=R.ERROR)},a.afterBufferFlushed=function(r,b,P){if(!r)return;var M=V.BufferHelper.getBuffered(r);this.fragmentTracker.detectEvictedFragments(b,M,P),this.state===R.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=R.IDLE},a.resetLiveStartWhenNotLoaded=function(r){if(!this.loadedmetadata){this.startFragRequested=!1;var b=this.levels?this.levels[r].details:null;if(b!=null&&b.live)return this.startPosition=-1,this.setStartPosition(b,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(r,b,P,M){var W=this,X=P.details;console.assert(!!X,"level.details must be defined");var U=Object.keys(r.elementaryStreams).reduce(function(S,B){var J=r.elementaryStreams[B];if(J){var te=J.endPTS-J.startPTS;if(te<=0)return W.warn("Could not parse fragment "+r.sn+" "+B+" duration reliably ("+te+") resetting transmuxer to fallback to playlist timing"),W.resetTransmuxer(),S||!1;var ae=M?0:Object(h.updateFragPTSDTS)(X,r,J.startPTS,J.endPTS,J.startDTS,J.endDTS);return W.hls.trigger(k.Events.LEVEL_PTS_UPDATED,{details:X,level:P,drift:ae,type:B,frag:r,start:J.startPTS,end:J.endPTS}),!0}return S},!1);U?(this.state=R.PARSED,this.hls.trigger(k.Events.FRAG_PARSED,{frag:r,part:b})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},O(g,[{key:"state",get:function(){return this._state},set:function(r){var b=this._state;b!==r&&(this._state=r,this.log(b+"->"+r))}}]),g}(j.default)},"./src/controller/buffer-controller.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return c});var $=D("./src/polyfills/number.ts"),j=D("./src/events.ts"),F=D("./src/utils/logger.ts"),V=D("./src/errors.ts"),H=D("./src/utils/buffer-helper.ts"),k=D("./src/utils/mediasource-helper.ts"),L=D("./src/loader/fragment.ts"),y=D("./src/controller/buffer-operation-queue.ts"),v=Object(k.getMediaSource)(),p=/([ha]vc.)(?:\.[^.,]+)+/,c=function(){function h(l){var s=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 u=s.hls,f=s.media,O=s.mediaSource;F.logger.log("[buffer-controller]: Media source opened"),f&&(s.updateMediaElementDuration(),u.trigger(j.Events.MEDIA_ATTACHED,{media:f})),O&&O.removeEventListener("sourceopen",s._onMediaSourceOpen),s.checkPendingTracks()},this._onMediaSourceClose=function(){F.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){F.logger.log("[buffer-controller]: Media source ended")},this.hls=l,this._initSourceBuffer(),this.registerListeners()}var d=h.prototype;return d.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},d.destroy=function(){this.unregisterListeners(),this.details=null},d.registerListeners=function(){var s=this.hls;s.on(j.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(j.Events.BUFFER_RESET,this.onBufferReset,this),s.on(j.Events.BUFFER_APPENDING,this.onBufferAppending,this),s.on(j.Events.BUFFER_CODECS,this.onBufferCodecs,this),s.on(j.Events.BUFFER_EOS,this.onBufferEos,this),s.on(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),s.on(j.Events.LEVEL_UPDATED,this.onLevelUpdated,this),s.on(j.Events.FRAG_PARSED,this.onFragParsed,this),s.on(j.Events.FRAG_CHANGED,this.onFragChanged,this)},d.unregisterListeners=function(){var s=this.hls;s.off(j.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(j.Events.BUFFER_RESET,this.onBufferReset,this),s.off(j.Events.BUFFER_APPENDING,this.onBufferAppending,this),s.off(j.Events.BUFFER_CODECS,this.onBufferCodecs,this),s.off(j.Events.BUFFER_EOS,this.onBufferEos,this),s.off(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),s.off(j.Events.LEVEL_UPDATED,this.onLevelUpdated,this),s.off(j.Events.FRAG_PARSED,this.onFragParsed,this),s.off(j.Events.FRAG_CHANGED,this.onFragChanged,this)},d._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new y.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},d.onManifestParsed=function(s,u){var f=2;(u.audio&&!u.video||!u.altAudio)&&(f=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=f,this.details=null,F.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},d.onMediaAttaching=function(s,u){var f=this.media=u.media;if(f&&v){var O=this.mediaSource=new v;O.addEventListener("sourceopen",this._onMediaSourceOpen),O.addEventListener("sourceended",this._onMediaSourceEnded),O.addEventListener("sourceclose",this._onMediaSourceClose),f.src=self.URL.createObjectURL(O),this._objectUrl=f.src}},d.onMediaDetaching=function(){var s=this.media,u=this.mediaSource,f=this._objectUrl;if(u){if(F.logger.log("[buffer-controller]: media source detaching"),u.readyState==="open")try{u.endOfStream()}catch(O){F.logger.warn("[buffer-controller]: onMediaDetaching: "+O.message+" while calling endOfStream")}this.onBufferReset(),u.removeEventListener("sourceopen",this._onMediaSourceOpen),u.removeEventListener("sourceended",this._onMediaSourceEnded),u.removeEventListener("sourceclose",this._onMediaSourceClose),s&&(f&&self.URL.revokeObjectURL(f),s.src===f?(s.removeAttribute("src"),s.load()):F.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(j.Events.MEDIA_DETACHED,void 0)},d.onBufferReset=function(){var s=this;this.getSourceBufferTypes().forEach(function(u){var f=s.sourceBuffer[u];try{f&&(s.removeBufferListeners(u),s.mediaSource&&s.mediaSource.removeSourceBuffer(f),s.sourceBuffer[u]=void 0)}catch(O){F.logger.warn("[buffer-controller]: Failed to reset the "+u+" buffer",O)}}),this._initSourceBuffer()},d.onBufferCodecs=function(s,u){var f=this,O=this.getSourceBufferTypes().length;if(Object.keys(u).forEach(function(x){if(O){var w=f.tracks[x];if(w&&typeof w.buffer.changeType=="function"){var A=u[x],R=A.codec,T=A.levelCodec,E=A.container,g=(w.levelCodec||w.codec).replace(p,"$1"),a=(T||R).replace(p,"$1");if(g!==a){var m=E+";codecs="+(T||R);f.appendChangeType(x,m)}}}else f.pendingTracks[x]=u[x]}),O)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},d.appendChangeType=function(s,u){var f=this,O=this.operationQueue,x={execute:function(){var A=f.sourceBuffer[s];A&&(F.logger.log("[buffer-controller]: changing "+s+" sourceBuffer type to "+u),A.changeType(u)),O.shiftAndExecuteNext(s)},onStart:function(){},onComplete:function(){},onError:function(A){F.logger.warn("[buffer-controller]: Failed to change "+s+" SourceBuffer type",A)}};O.append(x,s)},d.onBufferAppending=function(s,u){var f=this,O=this.hls,x=this.operationQueue,w=this.tracks,A=u.data,R=u.type,T=u.frag,E=u.part,g=u.chunkMeta,a=g.buffering[R],m=self.performance.now();a.start=m;var r=T.stats.buffering,b=E?E.stats.buffering:null;r.start===0&&(r.start=m),b&&b.start===0&&(b.start=m);var P=w.audio,M=R==="audio"&&g.id===1&&(P==null?void 0:P.container)==="audio/mpeg",W={execute:function(){if(a.executeStart=self.performance.now(),M){var U=f.sourceBuffer[R];if(U){var S=T.start-U.timestampOffset;Math.abs(S)>=.1&&(F.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+T.start+" (delta: "+S+") sn: "+T.sn+")"),U.timestampOffset=T.start)}}f.appendExecutor(A,R)},onStart:function(){},onComplete:function(){var U=self.performance.now();a.executeEnd=a.end=U,r.first===0&&(r.first=U),b&&b.first===0&&(b.first=U);var S=f.sourceBuffer,B={};for(var J in S)B[J]=H.BufferHelper.getBuffered(S[J]);f.appendError=0,f.hls.trigger(j.Events.BUFFER_APPENDED,{type:R,frag:T,part:E,chunkMeta:g,parent:T.type,timeRanges:B})},onError:function(U){F.logger.error("[buffer-controller]: Error encountered while trying to append to the "+R+" SourceBuffer",U);var S={type:V.ErrorTypes.MEDIA_ERROR,parent:T.type,details:V.ErrorDetails.BUFFER_APPEND_ERROR,err:U,fatal:!1};U.code===DOMException.QUOTA_EXCEEDED_ERR?S.details=V.ErrorDetails.BUFFER_FULL_ERROR:(f.appendError++,S.details=V.ErrorDetails.BUFFER_APPEND_ERROR,f.appendError>O.config.appendErrorMaxRetry&&(F.logger.error("[buffer-controller]: Failed "+O.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),S.fatal=!0)),O.trigger(j.Events.ERROR,S)}};x.append(W,R)},d.onBufferFlushing=function(s,u){var f=this,O=this.operationQueue,x=function(A){return{execute:f.removeExecutor.bind(f,A,u.startOffset,u.endOffset),onStart:function(){},onComplete:function(){f.hls.trigger(j.Events.BUFFER_FLUSHED,{type:A})},onError:function(T){F.logger.warn("[buffer-controller]: Failed to remove from "+A+" SourceBuffer",T)}}};u.type?O.append(x(u.type),u.type):this.getSourceBufferTypes().forEach(function(w){O.append(x(w),w)})},d.onFragParsed=function(s,u){var f=this,O=u.frag,x=u.part,w=[],A=x?x.elementaryStreams:O.elementaryStreams;A[L.ElementaryStreamTypes.AUDIOVIDEO]?w.push("audiovideo"):(A[L.ElementaryStreamTypes.AUDIO]&&w.push("audio"),A[L.ElementaryStreamTypes.VIDEO]&&w.push("video"));var R=function(){var E=self.performance.now();O.stats.buffering.end=E,x&&(x.stats.buffering.end=E);var g=x?x.stats:O.stats;f.hls.trigger(j.Events.FRAG_BUFFERED,{frag:O,part:x,stats:g,id:O.type})};w.length===0&&F.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+O.type+" level: "+O.level+" sn: "+O.sn),this.blockBuffers(R,w)},d.onFragChanged=function(s,u){this.flushBackBuffer()},d.onBufferEos=function(s,u){var f=this,O=this.getSourceBufferTypes().reduce(function(x,w){var A=f.sourceBuffer[w];return(!u.type||u.type===w)&&(A&&!A.ended&&(A.ended=!0,F.logger.log("[buffer-controller]: "+w+" sourceBuffer now EOS"))),x&&!!(!A||A.ended)},!0);O&&this.blockBuffers(function(){var x=f.mediaSource;if(!x||x.readyState!=="open")return;x.endOfStream()})},d.onLevelUpdated=function(s,u){var f=u.details;if(!f.fragments.length)return;this.details=f,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},d.flushBackBuffer=function(){var s=this.hls,u=this.details,f=this.media,O=this.sourceBuffer;if(!f||u===null)return;var x=this.getSourceBufferTypes();if(!x.length)return;var w=u.live&&s.config.liveBackBufferLength!==null?s.config.liveBackBufferLength:s.config.backBufferLength;if(!Object($.isFiniteNumber)(w)||w<0)return;var A=f.currentTime,R=u.levelTargetDuration,T=Math.max(w,R),E=Math.floor(A/R)*R-T;x.forEach(function(g){var a=O[g];if(a){var m=H.BufferHelper.getBuffered(a);m.length>0&&E>m.start(0)&&(s.trigger(j.Events.BACK_BUFFER_REACHED,{bufferEnd:E}),u.live&&s.trigger(j.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:E}),s.trigger(j.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:E,type:g}))}})},d.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var s=this.details,u=this.hls,f=this.media,O=this.mediaSource,x=s.fragments[0].start+s.totalduration,w=f.duration,A=Object($.isFiniteNumber)(O.duration)?O.duration:0;s.live&&u.config.liveDurationInfinity?(F.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),O.duration=Infinity,this.updateSeekableRange(s)):(x>A&&x>w||!Object($.isFiniteNumber)(w))&&(F.logger.log("[buffer-controller]: Updating Media Source duration to "+x.toFixed(3)),O.duration=x)},d.updateSeekableRange=function(s){var u=this.mediaSource,f=s.fragments,O=f.length;if(O&&s.live&&u!==null&&u!==void 0&&u.setLiveSeekableRange){var x=Math.max(0,f[0].start),w=Math.max(x,x+s.totalduration);u.setLiveSeekableRange(x,w)}},d.checkPendingTracks=function(){var s=this.bufferCodecEventsExpected,u=this.operationQueue,f=this.pendingTracks,O=Object.keys(f).length;if(O&&!s||O===2){this.createSourceBuffers(f),this.pendingTracks={};var x=this.getSourceBufferTypes();if(x.length===0){this.hls.trigger(j.Events.ERROR,{type:V.ErrorTypes.MEDIA_ERROR,details:V.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}x.forEach(function(w){u.executeNext(w)})}},d.createSourceBuffers=function(s){var u=this.sourceBuffer,f=this.mediaSource;if(!f)throw Error("createSourceBuffers called when mediaSource was null");var O=0;for(var x in s)if(!u[x]){var w=s[x];if(!w)throw Error("source buffer exists for track "+x+", however track does not");var A=w.levelCodec||w.codec,R=w.container+";codecs="+A;F.logger.log("[buffer-controller]: creating sourceBuffer("+R+")");try{var T=u[x]=f.addSourceBuffer(R),E=x;this.addBufferListener(E,"updatestart",this._onSBUpdateStart),this.addBufferListener(E,"updateend",this._onSBUpdateEnd),this.addBufferListener(E,"error",this._onSBUpdateError),this.tracks[x]={buffer:T,codec:A,container:w.container,levelCodec:w.levelCodec,id:w.id},O++}catch(g){F.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+g.message),this.hls.trigger(j.Events.ERROR,{type:V.ErrorTypes.MEDIA_ERROR,details:V.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:g,mimeType:R})}}O&&this.hls.trigger(j.Events.BUFFER_CREATED,{tracks:this.tracks})},d._onSBUpdateStart=function(s){var u=this.operationQueue,f=u.current(s);f.onStart()},d._onSBUpdateEnd=function(s){var u=this.operationQueue,f=u.current(s);f.onComplete(),u.shiftAndExecuteNext(s)},d._onSBUpdateError=function(s,u){F.logger.error("[buffer-controller]: "+s+" SourceBuffer error",u),this.hls.trigger(j.Events.ERROR,{type:V.ErrorTypes.MEDIA_ERROR,details:V.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var f=this.operationQueue.current(s);f&&f.onError(u)},d.removeExecutor=function(s,u,f){var O=this.media,x=this.mediaSource,w=this.operationQueue,A=this.sourceBuffer,R=A[s];if(!O||!x||!R){F.logger.warn("[buffer-controller]: Attempting to remove from the "+s+" SourceBuffer, but it does not exist"),w.shiftAndExecuteNext(s);return}var T=Object($.isFiniteNumber)(O.duration)?O.duration:Infinity,E=Object($.isFiniteNumber)(x.duration)?x.duration:Infinity,g=Math.max(0,u),a=Math.min(f,T,E);a>g?(F.logger.log("[buffer-controller]: Removing ["+g+","+a+"] from the "+s+" SourceBuffer"),console.assert(!R.updating,s+" sourceBuffer must not be updating"),R.remove(g,a)):w.shiftAndExecuteNext(s)},d.appendExecutor=function(s,u){var f=this.operationQueue,O=this.sourceBuffer,x=O[u];if(!x){F.logger.warn("[buffer-controller]: Attempting to append to the "+u+" SourceBuffer, but it does not exist"),f.shiftAndExecuteNext(u);return}x.ended=!1,console.assert(!x.updating,u+" sourceBuffer must not be updating"),x.appendBuffer(s)},d.blockBuffers=function(s,u){var f=this;if(u===void 0&&(u=this.getSourceBufferTypes()),!u.length){F.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(s);return}var O=this.operationQueue,x=u.map(function(w){return O.appendBlocker(w)});Promise.all(x).then(function(){s(),u.forEach(function(w){var A=f.sourceBuffer[w];(!A||!A.updating)&&O.shiftAndExecuteNext(w)})})},d.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},d.addBufferListener=function(s,u,f){var O=this.sourceBuffer[s];if(!O)return;var x=f.bind(this,s);this.listeners[s].push({event:u,listener:x}),O.addEventListener(u,x)},d.removeBufferListeners=function(s){var u=this.sourceBuffer[s];if(!u)return;this.listeners[s].forEach(function(f){u.removeEventListener(f.event,f.listener)})},h}()},"./src/controller/buffer-operation-queue.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return j});var $=D("./src/utils/logger.ts"),j=function(){function F(H){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=H}var V=F.prototype;return V.append=function(k,L){var y=this.queues[L];y.push(k),y.length===1&&this.buffers[L]&&this.executeNext(L)},V.insertAbort=function(k,L){var y=this.queues[L];y.unshift(k),this.executeNext(L)},V.appendBlocker=function(k){var L,y=new Promise(function(p){L=p}),v={execute:L,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(v,k),y},V.executeNext=function(k){var L=this.buffers,y=this.queues,v=L[k],p=y[k];if(p.length){var c=p[0];try{c.execute()}catch(h){$.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),c.onError(h),(!v||!v.updating)&&(p.shift(),this.executeNext(k))}}},V.shiftAndExecuteNext=function(k){this.queues[k].shift(),this.executeNext(k)},V.current=function(k){return this.queues[k][0]},F}()},"./src/controller/cap-level-controller.ts":function(oe,Z,D){"use strict";D.r(Z);var $=D("./src/events.ts");function j(H,k){for(var L=0;L<k.length;L++){var y=k[L];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(H,y.key,y)}}function F(H,k,L){return k&&j(H.prototype,k),L&&j(H,L),H}var V=function(){function H(L){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=L,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var k=H.prototype;return k.setStreamController=function(y){this.streamController=y},k.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},k.registerListeners=function(){var y=this.hls;y.on($.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.on($.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.on($.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.unregisterListener=function(){var y=this.hls;y.off($.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.off($.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.off($.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.onFpsDropLevelCapping=function(y,v){H.isLevelAllowed(v.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(v.droppedLevel)},k.onMediaAttaching=function(y,v){this.media=v.media instanceof HTMLVideoElement?v.media:null},k.onManifestParsed=function(y,v){var p=this.hls;this.restrictedLevels=[],this.firstLevel=v.firstLevel,p.config.capLevelToPlayerSize&&v.video&&this.startCapping()},k.onBufferCodecs=function(y,v){var p=this.hls;p.config.capLevelToPlayerSize&&v.video&&this.startCapping()},k.onMediaDetaching=function(){this.stopCapping()},k.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var y=this.hls.levels;if(y.length){var v=this.hls;v.autoLevelCapping=this.getMaxLevel(y.length-1),v.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=v.autoLevelCapping}}},k.getMaxLevel=function(y){var v=this,p=this.hls.levels;if(!p.length)return-1;var c=p.filter(function(h,d){return H.isLevelAllowed(d,v.restrictedLevels)&&d<=y});return this.clientRect=null,H.getMaxLevelByMediaSize(c,this.mediaWidth,this.mediaHeight)},k.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()},k.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},k.getDimensions=function(){if(this.clientRect)return this.clientRect;var y=this.media,v={width:0,height:0};if(y){var p=y.getBoundingClientRect();v.width=p.width,v.height=p.height,!v.width&&!v.height&&(v.width=p.right-p.left||y.width||0,v.height=p.bottom-p.top||y.height||0)}return this.clientRect=v,v},H.isLevelAllowed=function(y,v){return v===void 0&&(v=[]),v.indexOf(y)===-1},H.getMaxLevelByMediaSize=function(y,v,p){if(!y||!y.length)return-1;for(var c=function(u,f){return f?u.width!==f.width||u.height!==f.height:!0},h=y.length-1,d=0;d<y.length;d+=1){var l=y[d];if((l.width>=v||l.height>=p)&&c(l,y[d+1])){h=d;break}}return h},F(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 y=1;try{y=self.devicePixelRatio}catch(v){}return y}}]),H}();Z.default=V},"./src/controller/cmcd-controller.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return c});var $=D("./src/events.ts"),j=D("./src/types/cmcd.ts"),F=D("./src/utils/buffer-helper.ts"),V=D("./src/utils/logger.ts");function H(h,d){for(var l=0;l<d.length;l++){var s=d[l];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(h,s.key,s)}}function k(h,d,l){return d&&H(h.prototype,d),l&&H(h,l),h}function L(h,d){var l=typeof Symbol!="undefined"&&h[Symbol.iterator]||h["@@iterator"];if(l)return(l=l.call(h)).next.bind(l);if(Array.isArray(h)||(l=y(h))||d&&h&&typeof h.length=="number"){l&&(h=l);var s=0;return function(){return s>=h.length?{done:!0}:{done:!1,value:h[s++]}}}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 y(h,d){if(!h)return;if(typeof h=="string")return v(h,d);var l=Object.prototype.toString.call(h).slice(8,-1);if(l==="Object"&&h.constructor&&(l=h.constructor.name),l==="Map"||l==="Set")return Array.from(h);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return v(h,d)}function v(h,d){(d==null||d>h.length)&&(d=h.length);for(var l=0,s=new Array(d);l<d;l++)s[l]=h[l];return s}function p(){return p=Object.assign||function(h){for(var d=1;d<arguments.length;d++){var l=arguments[d];for(var s in l)Object.prototype.hasOwnProperty.call(l,s)&&(h[s]=l[s])}return h},p.apply(this,arguments)}var c=function(){function h(l){var s=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(){s.initialized&&(s.starved=!0),s.buffering=!0},this.onPlaying=function(){s.initialized||(s.initialized=!0),s.buffering=!1},this.applyPlaylistData=function(O){try{s.apply(O,{ot:j.CMCDObjectType.MANIFEST,su:!s.initialized})}catch(x){V.logger.warn("Could not generate manifest CMCD data.",x)}},this.applyFragmentData=function(O){try{var x=O.frag,w=s.hls.levels[x.level],A=s.getObjectType(x),R={d:x.duration*1e3,ot:A};(A===j.CMCDObjectType.VIDEO||A===j.CMCDObjectType.AUDIO||A==j.CMCDObjectType.MUXED)&&(R.br=w.bitrate/1e3,R.tb=s.getTopBandwidth(A),R.bl=s.getBufferLength(A)),s.apply(O,R)}catch(T){V.logger.warn("Could not generate segment CMCD data.",T)}},this.hls=l;var u=this.config=l.config,f=u.cmcd;f!=null&&(u.pLoader=this.createPlaylistLoader(),u.fLoader=this.createFragmentLoader(),this.sid=f.sessionId||h.uuid(),this.cid=f.contentId,this.useHeaders=f.useHeaders===!0,this.registerListeners())}var d=h.prototype;return d.registerListeners=function(){var s=this.hls;s.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on($.Events.MEDIA_DETACHED,this.onMediaDetached,this),s.on($.Events.BUFFER_CREATED,this.onBufferCreated,this)},d.unregisterListeners=function(){var s=this.hls;s.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off($.Events.MEDIA_DETACHED,this.onMediaDetached,this),s.off($.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},d.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},d.onMediaAttached=function(s,u){this.media=u.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},d.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},d.onBufferCreated=function(s,u){var f,O;this.audioBuffer=(f=u.tracks.audio)===null||f===void 0?void 0:f.buffer,this.videoBuffer=(O=u.tracks.video)===null||O===void 0?void 0:O.buffer},d.createData=function(){var s;return{v:j.CMCDVersion,sf:j.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(s=this.media)===null||s===void 0?void 0:s.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},d.apply=function(s,u){u===void 0&&(u={}),p(u,this.createData());var f=u.ot===j.CMCDObjectType.INIT||u.ot===j.CMCDObjectType.VIDEO||u.ot===j.CMCDObjectType.MUXED;if(this.starved&&f&&(u.bs=!0,u.su=!0,this.starved=!1),u.su==null&&(u.su=this.buffering),this.useHeaders){var O=h.toHeaders(u);if(!Object.keys(O).length)return;s.headers||(s.headers={}),p(s.headers,O)}else{var x=h.toQuery(u);if(!x)return;s.url=h.appendQueryToUri(s.url,x)}},d.getObjectType=function(s){var u=s.type;return u==="subtitle"?j.CMCDObjectType.TIMED_TEXT:s.sn==="initSegment"?j.CMCDObjectType.INIT:u==="audio"?j.CMCDObjectType.AUDIO:u==="main"?this.hls.audioTracks.length?j.CMCDObjectType.VIDEO:j.CMCDObjectType.MUXED:void 0},d.getTopBandwidth=function(s){for(var u=0,f=s===j.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,O=L(f),x;!(x=O()).done;){var w=x.value;w.bitrate>u&&(u=w.bitrate)}return u>0?u:NaN},d.getBufferLength=function(s){var u=this.hls.media,f=s===j.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!f||!u)return NaN;var O=F.BufferHelper.bufferInfo(f,u.currentTime,this.config.maxBufferHole);return O.len*1e3},d.createPlaylistLoader=function(){var s=this.config.pLoader,u=this.applyPlaylistData,f=s||this.config.loader;return function(){function O(w){this.loader=void 0,this.loader=new f(w)}var x=O.prototype;return x.destroy=function(){this.loader.destroy()},x.abort=function(){this.loader.abort()},x.load=function(A,R,T){u(A),this.loader.load(A,R,T)},k(O,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),O}()},d.createFragmentLoader=function(){var s=this.config.fLoader,u=this.applyFragmentData,f=s||this.config.loader;return function(){function O(w){this.loader=void 0,this.loader=new f(w)}var x=O.prototype;return x.destroy=function(){this.loader.destroy()},x.abort=function(){this.loader.abort()},x.load=function(A,R,T){u(A),this.loader.load(A,R,T)},k(O,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),O}()},h.uuid=function(){var s=URL.createObjectURL(new Blob),u=s.toString();return URL.revokeObjectURL(s),u.substr(u.lastIndexOf("/")+1)},h.serialize=function(s){for(var u=[],f=function(M){return!Number.isNaN(M)&&M!=null&&M!==""&&M!==!1},O=function(M){return Math.round(M)},x=function(M){return O(M/100)*100},w=function(M){return encodeURIComponent(M)},A={br:O,d:O,bl:x,dl:x,mtp:x,nor:w,rtp:x,tb:O},R=Object.keys(s||{}).sort(),T=L(R),E;!(E=T()).done;){var g=E.value,a=s[g];if(!f(a))continue;if(g==="v"&&a===1)continue;if(g=="pr"&&a===1)continue;var m=A[g];m&&(a=m(a));var r=typeof a,b=void 0;g==="ot"||g==="sf"||g==="st"?b=g+"="+a:r==="boolean"?b=g:r==="number"?b=g+"="+a:b=g+"="+JSON.stringify(a),u.push(b)}return u.join(",")},h.toHeaders=function(s){for(var u=Object.keys(s),f={},O=["Object","Request","Session","Status"],x=[{},{},{},{}],w={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},A=0,R=u;A<R.length;A++){var T=R[A],E=w[T]!=null?w[T]:1;x[E][T]=s[T]}for(var g=0;g<x.length;g++){var a=h.serialize(x[g]);a&&(f["CMCD-"+O[g]]=a)}return f},h.toQuery=function(s){return"CMCD="+encodeURIComponent(h.serialize(s))},h.appendQueryToUri=function(s,u){if(!u)return s;var f=s.includes("?")?"&":"?";return""+s+f+u},h}()},"./src/controller/eme-controller.ts":function(oe,Z,D){"use strict";D.r(Z);var $=D("./src/events.ts"),j=D("./src/errors.ts"),F=D("./src/utils/logger.ts"),V=D("./src/utils/mediakeys-helper.ts");function H(c,h){for(var d=0;d<h.length;d++){var l=h[d];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(c,l.key,l)}}function k(c,h,d){return h&&H(c.prototype,h),d&&H(c,d),c}var L=3,y=function(h,d,l){var s={audioCapabilities:[],videoCapabilities:[]};return h.forEach(function(u){s.audioCapabilities.push({contentType:'audio/mp4; codecs="'+u+'"',robustness:l.audioRobustness||""})}),d.forEach(function(u){s.videoCapabilities.push({contentType:'video/mp4; codecs="'+u+'"',robustness:l.videoRobustness||""})}),[s]},v=function(h,d,l,s){switch(h){case V.KeySystems.WIDEVINE:return y(d,l,s);default:throw new Error("Unknown key-system: "+h)}},p=function(){function c(d){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=d,this._config=d.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 h=c.prototype;return h.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},h._registerListeners=function(){this.hls.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on($.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this)},h._unregisterListeners=function(){this.hls.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off($.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this)},h.getLicenseServerUrl=function(l){switch(l){case V.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+l+'"')},h._attemptKeySystemAccess=function(l,s,u){var f=this,O=v(l,s,u,this._drmSystemOptions);F.logger.log("Requesting encrypted media key-system access");var x=this.requestMediaKeySystemAccess(l,O);this.mediaKeysPromise=x.then(function(w){return f._onMediaKeySystemAccessObtained(l,w)}),x.catch(function(w){F.logger.error('Failed to obtain key-system "'+l+'" access:',w)})},h._onMediaKeySystemAccessObtained=function(l,s){var u=this;F.logger.log('Access for key-system "'+l+'" obtained');var f={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:s,mediaKeySystemDomain:l};this._mediaKeysList.push(f);var O=Promise.resolve().then(function(){return s.createMediaKeys()}).then(function(x){return f.mediaKeys=x,F.logger.log('Media-keys created for key-system "'+l+'"'),u._onMediaKeysCreated(),x});return O.catch(function(x){F.logger.error("Failed to create media-keys:",x)}),O},h._onMediaKeysCreated=function(){var l=this;this._mediaKeysList.forEach(function(s){s.mediaKeysSession||(s.mediaKeysSession=s.mediaKeys.createSession(),l._onNewMediaKeySession(s.mediaKeysSession))})},h._onNewMediaKeySession=function(l){var s=this;F.logger.log("New key-system session "+l.sessionId),l.addEventListener("message",function(u){s._onKeySessionMessage(l,u.message)},!1)},h._onKeySessionMessage=function(l,s){F.logger.log("Got EME message event, creating license request"),this._requestLicense(s,function(u){F.logger.log("Received license data (length: "+(u&&u.byteLength)+"), updating key-session"),l.update(u)})},h.onMediaEncrypted=function(l){var s=this;if(F.logger.log('Media is encrypted using "'+l.initDataType+'" init data type'),!this.mediaKeysPromise){F.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger($.Events.ERROR,{type:j.ErrorTypes.KEY_SYSTEM_ERROR,details:j.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var u=function(O){if(!s._media)return;s._attemptSetMediaKeys(O),s._generateRequestWithPreferredKeySession(l.initDataType,l.initData)};this.mediaKeysPromise.then(u).catch(u)},h._attemptSetMediaKeys=function(l){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var s=this._mediaKeysList[0];if(!s||!s.mediaKeys){F.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger($.Events.ERROR,{type:j.ErrorTypes.KEY_SYSTEM_ERROR,details:j.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}F.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(s.mediaKeys),this._hasSetMediaKeys=!0}},h._generateRequestWithPreferredKeySession=function(l,s){var u=this,f=this._mediaKeysList[0];if(!f){F.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger($.Events.ERROR,{type:j.ErrorTypes.KEY_SYSTEM_ERROR,details:j.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(f.mediaKeysSessionInitialized){F.logger.warn("Key-Session already initialized but requested again");return}var O=f.mediaKeysSession;if(!O){F.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger($.Events.ERROR,{type:j.ErrorTypes.KEY_SYSTEM_ERROR,details:j.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!s){F.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger($.Events.ERROR,{type:j.ErrorTypes.KEY_SYSTEM_ERROR,details:j.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}F.logger.log('Generating key-session request for "'+l+'" init data type'),f.mediaKeysSessionInitialized=!0,O.generateRequest(l,s).then(function(){F.logger.debug("Key-session generation succeeded")}).catch(function(x){F.logger.error("Error generating key-session request:",x),u.hls.trigger($.Events.ERROR,{type:j.ErrorTypes.KEY_SYSTEM_ERROR,details:j.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},h._createLicenseXhr=function(l,s,u){var f=new XMLHttpRequest;f.responseType="arraybuffer",f.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,f,l,s,u);var O=this._licenseXhrSetup;if(O)try{O.call(this.hls,f,l),O=void 0}catch(x){F.logger.error(x)}try{f.readyState||f.open("POST",l,!0),O&&O.call(this.hls,f,l)}catch(x){throw new Error("issue setting up KeySystem license XHR "+x)}return f},h._onLicenseRequestReadyStageChange=function(l,s,u,f){switch(l.readyState){case 4:if(l.status===200){this._requestLicenseFailureCount=0,F.logger.log("License request succeeded");var O=l.response,x=this._licenseResponseCallback;if(x)try{O=x.call(this.hls,l,s)}catch(A){F.logger.error(A)}f(O)}else{if(F.logger.error("License Request XHR failed ("+s+"). Status: "+l.status+" ("+l.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>L){this.hls.trigger($.Events.ERROR,{type:j.ErrorTypes.KEY_SYSTEM_ERROR,details:j.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var w=L-this._requestLicenseFailureCount+1;F.logger.warn("Retrying license request, "+w+" attempts left"),this._requestLicense(u,f)}break}},h._generateLicenseRequestChallenge=function(l,s){switch(l.mediaKeySystemDomain){case V.KeySystems.WIDEVINE:return s}throw new Error("unsupported key-system: "+l.mediaKeySystemDomain)},h._requestLicense=function(l,s){F.logger.log("Requesting content license for key-system");var u=this._mediaKeysList[0];if(!u){F.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger($.Events.ERROR,{type:j.ErrorTypes.KEY_SYSTEM_ERROR,details:j.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var f=this.getLicenseServerUrl(u.mediaKeySystemDomain),O=this._createLicenseXhr(f,l,s);F.logger.log("Sending license request to URL: "+f);var x=this._generateLicenseRequestChallenge(u,l);O.send(x)}catch(w){F.logger.error("Failure requesting DRM license: "+w),this.hls.trigger($.Events.ERROR,{type:j.ErrorTypes.KEY_SYSTEM_ERROR,details:j.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},h.onMediaAttached=function(l,s){if(!this._emeEnabled)return;var u=s.media;this._media=u,u.addEventListener("encrypted",this._onMediaEncrypted)},h.onMediaDetached=function(){var l=this._media,s=this._mediaKeysList;if(!l)return;l.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(s.map(function(u){if(u.mediaKeysSession)return u.mediaKeysSession.close().catch(function(){})})).then(function(){return l.setMediaKeys(null)}).catch(function(){})},h.onManifestParsed=function(l,s){if(!this._emeEnabled)return;var u=s.levels.map(function(O){return O.audioCodec}).filter(function(O){return!!O}),f=s.levels.map(function(O){return O.videoCodec}).filter(function(O){return!!O});this._attemptKeySystemAccess(V.KeySystems.WIDEVINE,u,f)},k(c,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),c}();Z.default=p},"./src/controller/fps-controller.ts":function(oe,Z,D){"use strict";D.r(Z);var $=D("./src/events.ts"),j=D("./src/utils/logger.ts"),F=function(){function V(k){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=k,this.registerListeners()}var H=V.prototype;return H.setStreamController=function(L){this.streamController=L},H.registerListeners=function(){this.hls.on($.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},H.unregisterListeners=function(){this.hls.off($.Events.MEDIA_ATTACHING,this.onMediaAttaching)},H.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},H.onMediaAttaching=function(L,y){var v=this.hls.config;if(v.capLevelOnFPSDrop){var p=y.media instanceof self.HTMLVideoElement?y.media:null;this.media=p,p&&typeof p.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),v.fpsDroppedMonitoringPeriod)}},H.checkFPS=function(L,y,v){var p=performance.now();if(y){if(this.lastTime){var c=p-this.lastTime,h=v-this.lastDroppedFrames,d=y-this.lastDecodedFrames,l=1e3*h/c,s=this.hls;if(s.trigger($.Events.FPS_DROP,{currentDropped:h,currentDecoded:d,totalDroppedFrames:v}),l>0&&h>s.config.fpsDroppedMonitoringThreshold*d){var u=s.currentLevel;j.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(s.autoLevelCapping===-1||s.autoLevelCapping>=u)&&(u=u-1,s.trigger($.Events.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:s.currentLevel}),s.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=p,this.lastDroppedFrames=v,this.lastDecodedFrames=y}},H.checkFPSInterval=function(){var L=this.media;if(L)if(this.isVideoPlaybackQualityAvailable){var y=L.getVideoPlaybackQuality();this.checkFPS(L,y.totalVideoFrames,y.droppedVideoFrames)}else this.checkFPS(L,L.webkitDecodedFrameCount,L.webkitDroppedFrameCount)},V}();Z.default=F},"./src/controller/fragment-finders.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"findFragmentByPDT",function(){return F}),D.d(Z,"findFragmentByPTS",function(){return V}),D.d(Z,"fragmentWithinToleranceTest",function(){return H}),D.d(Z,"pdtWithinToleranceTest",function(){return k}),D.d(Z,"findFragWithCC",function(){return L});var $=D("./src/polyfills/number.ts"),j=D("./src/utils/binary-search.ts");function F(y,v,p){if(v===null||!Array.isArray(y)||!y.length||!Object($.isFiniteNumber)(v))return null;var c=y[0].programDateTime;if(v<(c||0))return null;var h=y[y.length-1].endProgramDateTime;if(v>=(h||0))return null;p=p||0;for(var d=0;d<y.length;++d){var l=y[d];if(k(v,p,l))return l}return null}function V(y,v,p,c){p===void 0&&(p=0),c===void 0&&(c=0);var h=null;if(y?h=v[y.sn-v[0].sn+1]||null:p===0&&v[0].start===0&&(h=v[0]),h&&H(p,c,h)===0)return h;var d=j.default.search(v,H.bind(null,p,c));return d||h}function H(y,v,p){y===void 0&&(y=0),v===void 0&&(v=0);var c=Math.min(v,p.duration+(p.deltaPTS?p.deltaPTS:0));return p.start+p.duration-c<=y?1:p.start-c>y&&p.start?-1:0}function k(y,v,p){var c=Math.min(v,p.duration+(p.deltaPTS?p.deltaPTS:0))*1e3,h=p.endProgramDateTime||0;return h-c>y}function L(y,v){return j.default.search(y,function(p){return p.cc<v?1:p.cc>v?-1:0})}},"./src/controller/fragment-tracker.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"FragmentState",function(){return F}),D.d(Z,"FragmentTracker",function(){return V});var $=D("./src/events.ts"),j=D("./src/types/loader.ts"),F;(function(L){L.NOT_LOADED="NOT_LOADED",L.BACKTRACKED="BACKTRACKED",L.APPENDING="APPENDING",L.PARTIAL="PARTIAL",L.OK="OK"})(F||(F={}));var V=function(){function L(v){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=v,this._registerListeners()}var y=L.prototype;return y._registerListeners=function(){var p=this.hls;p.on($.Events.BUFFER_APPENDED,this.onBufferAppended,this),p.on($.Events.FRAG_BUFFERED,this.onFragBuffered,this),p.on($.Events.FRAG_LOADED,this.onFragLoaded,this)},y._unregisterListeners=function(){var p=this.hls;p.off($.Events.BUFFER_APPENDED,this.onBufferAppended,this),p.off($.Events.FRAG_BUFFERED,this.onFragBuffered,this),p.off($.Events.FRAG_LOADED,this.onFragLoaded,this)},y.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},y.getAppendedFrag=function(p,c){if(c===j.PlaylistLevelType.MAIN){var h=this.activeFragment,d=this.activeParts;if(!h)return null;if(d)for(var l=d.length;l--;){var s=d[l],u=s?s.end:h.appendedPTS;if(s.start<=p&&u!==void 0&&p<=u)return l>9&&(this.activeParts=d.slice(l-9)),s}else if(h.start<=p&&h.appendedPTS!==void 0&&p<=h.appendedPTS)return h}return this.getBufferedFrag(p,c)},y.getBufferedFrag=function(p,c){for(var h=this.fragments,d=Object.keys(h),l=d.length;l--;){var s=h[d[l]];if((s==null?void 0:s.body.type)===c&&s.buffered){var u=s.body;if(u.start<=p&&p<=u.end)return u}}return null},y.detectEvictedFragments=function(p,c,h){var d=this;Object.keys(this.fragments).forEach(function(l){var s=d.fragments[l];if(!s)return;if(!s.buffered){s.body.type===h&&d.removeFragment(s.body);return}var u=s.range[p];if(!u)return;u.time.some(function(f){var O=!d.isTimeBuffered(f.startPTS,f.endPTS,c);return O&&d.removeFragment(s.body),O})})},y.detectPartialFragments=function(p){var c=this,h=this.timeRanges,d=p.frag,l=p.part;if(!h||d.sn==="initSegment")return;var s=k(d),u=this.fragments[s];if(!u)return;Object.keys(h).forEach(function(f){var O=d.elementaryStreams[f];if(!O)return;var x=h[f],w=l!==null||O.partial===!0;u.range[f]=c.getBufferedTimes(d,l,w,x)}),u.backtrack=u.loaded=null,Object.keys(u.range).length?u.buffered=!0:this.removeFragment(u.body)},y.fragBuffered=function(p){var c=k(p),h=this.fragments[c];h&&(h.backtrack=h.loaded=null,h.buffered=!0)},y.getBufferedTimes=function(p,c,h,d){for(var l={time:[],partial:h},s=c?c.start:p.start,u=c?c.end:p.end,f=p.minEndPTS||u,O=p.maxStartPTS||s,x=0;x<d.length;x++){var w=d.start(x)-this.bufferPadding,A=d.end(x)+this.bufferPadding;if(O>=w&&f<=A){l.time.push({startPTS:Math.max(s,d.start(x)),endPTS:Math.min(u,d.end(x))});break}else if(s<A&&u>w)l.partial=!0,l.time.push({startPTS:Math.max(s,d.start(x)),endPTS:Math.min(u,d.end(x))});else if(u<=w)break}return l},y.getPartialFragment=function(p){var c=null,h,d,l,s=0,u=this.bufferPadding,f=this.fragments;return Object.keys(f).forEach(function(O){var x=f[O];if(!x)return;H(x)&&(d=x.body.start-u,l=x.body.end+u,p>=d&&p<=l&&(h=Math.min(p-d,l-p),s<=h&&(c=x.body,s=h)))}),c},y.getState=function(p){var c=k(p),h=this.fragments[c];return h?h.buffered?H(h)?F.PARTIAL:F.OK:h.backtrack?F.BACKTRACKED:F.APPENDING:F.NOT_LOADED},y.backtrack=function(p,c){var h=k(p),d=this.fragments[h];if(!d||d.backtrack)return null;var l=d.backtrack=c||d.loaded;return d.loaded=null,l},y.getBacktrackData=function(p){var c=k(p),h=this.fragments[c];if(h){var d,l=h.backtrack;if(l!=null&&(d=l.payload)!==null&&d!==void 0&&d.byteLength)return l;this.removeFragment(p)}return null},y.isTimeBuffered=function(p,c,h){for(var d,l,s=0;s<h.length;s++){if(d=h.start(s)-this.bufferPadding,l=h.end(s)+this.bufferPadding,p>=d&&c<=l)return!0;if(c<=d)return!1}return!1},y.onFragLoaded=function(p,c){var h=c.frag,d=c.part;if(h.sn==="initSegment"||h.bitrateTest||d)return;var l=k(h);this.fragments[l]={body:h,loaded:c,backtrack:null,buffered:!1,range:Object.create(null)}},y.onBufferAppended=function(p,c){var h=this,d=c.frag,l=c.part,s=c.timeRanges;if(d.type===j.PlaylistLevelType.MAIN)if(this.activeFragment=d,l){var u=this.activeParts;u||(this.activeParts=u=[]),u.push(l)}else this.activeParts=null;this.timeRanges=s,Object.keys(s).forEach(function(f){var O=s[f];if(h.detectEvictedFragments(f,O),!l)for(var x=0;x<O.length;x++)d.appendedPTS=Math.max(O.end(x),d.appendedPTS||0)})},y.onFragBuffered=function(p,c){this.detectPartialFragments(c)},y.hasFragment=function(p){var c=k(p);return!!this.fragments[c]},y.removeFragmentsInRange=function(p,c,h){var d=this;Object.keys(this.fragments).forEach(function(l){var s=d.fragments[l];if(!s)return;if(s.buffered){var u=s.body;u.type===h&&u.start<c&&u.end>p&&d.removeFragment(u)}})},y.removeFragment=function(p){var c=k(p);p.stats.loaded=0,p.clearElementaryStreamInfo(),delete this.fragments[c]},y.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},L}();function H(L){var y,v;return L.buffered&&(((y=L.range.video)===null||y===void 0?void 0:y.partial)||((v=L.range.audio)===null||v===void 0?void 0:v.partial))}function k(L){return L.type+"_"+L.level+"_"+L.urlId+"_"+L.sn}},"./src/controller/gap-controller.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"STALL_MINIMUM_DURATION_MS",function(){return H}),D.d(Z,"MAX_START_GAP_JUMP",function(){return k}),D.d(Z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return L}),D.d(Z,"SKIP_BUFFER_RANGE_START",function(){return y}),D.d(Z,"default",function(){return v});var $=D("./src/utils/buffer-helper.ts"),j=D("./src/errors.ts"),F=D("./src/events.ts"),V=D("./src/utils/logger.ts"),H=250,k=2,L=.1,y=.05,v=function(){function p(h,d,l,s){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=h,this.media=d,this.fragmentTracker=l,this.hls=s}var c=p.prototype;return c.destroy=function(){this.hls=this.fragmentTracker=this.media=null},c.poll=function(d){var l=this.config,s=this.media,u=this.stalled,f=s.currentTime,O=s.seeking,x=this.seeking&&!O,w=!this.seeking&&O;if(this.seeking=O,f!==d){if(this.moved=!0,u!==null){if(this.stallReported){var A=self.performance.now()-u;V.logger.warn("playback not stuck anymore @"+f+", after "+Math.round(A)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((w||x)&&(this.stalled=null),s.paused||s.ended||s.playbackRate===0||!$.BufferHelper.getBuffered(s).length)return;var R=$.BufferHelper.bufferInfo(s,f,0),T=R.len>0,E=R.nextStart||0;if(!T&&!E)return;if(O){var g=R.len>k,a=!E||E-f>k&&!this.fragmentTracker.getPartialFragment(f);if(g||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var m,r=Math.max(E,R.start||0)-f,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,P=b==null||((m=b.details)===null||m===void 0)?void 0:m.live,M=P?b.details.targetduration*2:k;if(r>0&&r<=M){this._trySkipBufferHole(null);return}}var W=self.performance.now();if(u===null){this.stalled=W;return}var X=W-u;!O&&X>=H&&this._reportStall(R.len);var U=$.BufferHelper.bufferInfo(s,f,l.maxBufferHole);this._tryFixBufferStall(U,X)},c._tryFixBufferStall=function(d,l){var s=this.config,u=this.fragmentTracker,f=this.media,O=f.currentTime,x=u.getPartialFragment(O);if(x){var w=this._trySkipBufferHole(x);if(w)return}d.len>s.maxBufferHole&&l>s.highBufferWatchdogPeriod*1e3&&(V.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},c._reportStall=function(d){var l=this.hls,s=this.media,u=this.stallReported;u||(this.stallReported=!0,V.logger.warn("Playback stalling at @"+s.currentTime+" due to low buffer (buffer="+d+")"),l.trigger(F.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:d}))},c._trySkipBufferHole=function(d){for(var l=this.config,s=this.hls,u=this.media,f=u.currentTime,O=0,x=$.BufferHelper.getBuffered(u),w=0;w<x.length;w++){var A=x.start(w);if(f+l.maxBufferHole>=O&&f<A){var R=Math.max(A+y,u.currentTime+L);return V.logger.warn("skipping hole, adjusting currentTime from "+f+" to "+R),this.moved=!0,this.stalled=null,u.currentTime=R,d&&s.trigger(F.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+f+" to "+R,frag:d}),R}O=x.end(w)}return 0},c._tryNudgeBuffer=function(){var d=this.config,l=this.hls,s=this.media,u=s.currentTime,f=(this.nudgeRetry||0)+1;if(this.nudgeRetry=f,f<d.nudgeMaxRetry){var O=u+f*d.nudgeOffset;V.logger.warn("Nudging 'currentTime' from "+u+" to "+O),s.currentTime=O,l.trigger(F.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else V.logger.error("Playhead still not moving while enough data buffered @"+u+" after "+d.nudgeMaxRetry+" nudges"),l.trigger(F.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},p}()},"./src/controller/id3-track-controller.ts":function(oe,Z,D){"use strict";D.r(Z);var $=D("./src/events.ts"),j=D("./src/utils/texttrack-utils.ts"),F=D("./src/demux/id3.ts"),V=.25,H=function(){function k(y){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=y,this._registerListeners()}var L=k.prototype;return L.destroy=function(){this._unregisterListeners()},L._registerListeners=function(){var v=this.hls;v.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),v.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),v.on($.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),v.on($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L._unregisterListeners=function(){var v=this.hls;v.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),v.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),v.off($.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),v.off($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L.onMediaAttached=function(v,p){this.media=p.media},L.onMediaDetaching=function(){if(!this.id3Track)return;Object(j.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},L.getID3Track=function(v){if(!this.media)return;for(var p=0;p<v.length;p++){var c=v[p];if(c.kind==="metadata"&&c.label==="id3")return Object(j.sendAddTrackEvent)(c,this.media),c}return this.media.addTextTrack("metadata","id3")},L.onFragParsingMetadata=function(v,p){if(!this.media)return;var c=p.frag,h=p.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var d=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,l=0;l<h.length;l++){var s=F.getID3Frames(h[l].data);if(s){var u=h[l].pts,f=l<h.length-1?h[l+1].pts:c.end,O=f-u;O<=0&&(f=u+V);for(var x=0;x<s.length;x++){var w=s[x];if(!F.isTimeStampFrame(w)){var A=new d(u,f,"");A.value=w,this.id3Track.addCue(A)}}}}},L.onBufferFlushing=function(v,p){var c=p.startOffset,h=p.endOffset,d=p.type;if(!d||d==="audio"){var l=this.id3Track;l&&Object(j.removeCuesInRange)(l,c,h)}},k}();Z.default=H},"./src/controller/latency-controller.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return k});var $=D("./src/errors.ts"),j=D("./src/events.ts"),F=D("./src/utils/logger.ts");function V(L,y){for(var v=0;v<y.length;v++){var p=y[v];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(L,p.key,p)}}function H(L,y,v){return y&&V(L.prototype,y),v&&V(L,v),L}var k=function(){function L(v){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=v,this.config=v.config,this.registerListeners()}var y=L.prototype;return y.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},y.registerListeners=function(){this.hls.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(j.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(j.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){this.hls.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(j.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(j.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(j.Events.ERROR,this.onError)},y.onMediaAttached=function(p,c){this.media=c.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},y.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},y.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},y.onLevelUpdated=function(p,c){var h=c.details;this.levelDetails=h,h.advanced&&this.timeupdate(),!h.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},y.onError=function(p,c){if(c.details!==$.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,F.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},y.timeupdate=function(){var p=this.media,c=this.levelDetails;if(!p||!c)return;this.currentTime=p.currentTime;var h=this.computeLatency();if(h===null)return;this._latency=h;var d=this.config,l=d.lowLatencyMode,s=d.maxLiveSyncPlaybackRate;if(!l||s===1)return;var u=this.targetLatency;if(u===null)return;var f=h-u,O=Math.min(this.maxLatency,u+c.targetduration),x=f<O;if(c.live&&x&&f>.05&&this.forwardBufferLength>1){var w=Math.min(2,Math.max(1,s)),A=Math.round(2/(1+Math.exp(-.75*f-this.edgeStalled))*20)/20;p.playbackRate=Math.min(w,Math.max(1,A))}else p.playbackRate!==1&&p.playbackRate!==0&&(p.playbackRate=1)},y.estimateLiveEdge=function(){var p=this.levelDetails;return p===null?null:p.edge+p.age},y.computeLatency=function(){var p=this.estimateLiveEdge();return p===null?null:p-this.currentTime},H(L,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var p=this.config,c=this.levelDetails;return p.liveMaxLatencyDuration!==void 0?p.liveMaxLatencyDuration:c?p.liveMaxLatencyDurationCount*c.targetduration:0}},{key:"targetLatency",get:function(){var p=this.levelDetails;if(p===null)return null;var c=p.holdBack,h=p.partHoldBack,d=p.targetduration,l=this.config,s=l.liveSyncDuration,u=l.liveSyncDurationCount,f=l.lowLatencyMode,O=this.hls.userConfig,x=f&&h||c;(O.liveSyncDuration||O.liveSyncDurationCount||x===0)&&(x=s!==void 0?s:u*d);var w=d,A=1;return x+Math.min(this.stallCount*A,w)}},{key:"liveSyncPosition",get:function(){var p=this.estimateLiveEdge(),c=this.targetLatency,h=this.levelDetails;if(p===null||c===null||h===null)return null;var d=h.edge,l=p-c-this.edgeStalled,s=d-h.totalduration,u=d-(this.config.lowLatencyMode&&h.partTarget||h.targetduration);return Math.min(Math.max(s,l),u)}},{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 c=(this.config.lowLatencyMode&&p.partTarget||p.targetduration)*3;return Math.max(p.age-c,0)}},{key:"forwardBufferLength",get:function(){var p=this.media,c=this.levelDetails;if(!p||!c)return 0;var h=p.buffered.length;return h?p.buffered.end(h-1):c.edge-this.currentTime}}]),L}()},"./src/controller/level-controller.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return l});var $=D("./src/types/level.ts"),j=D("./src/events.ts"),F=D("./src/errors.ts"),V=D("./src/utils/codecs.ts"),H=D("./src/controller/level-helper.ts"),k=D("./src/controller/base-playlist-controller.ts"),L=D("./src/types/loader.ts");function y(){return y=Object.assign||function(s){for(var u=1;u<arguments.length;u++){var f=arguments[u];for(var O in f)Object.prototype.hasOwnProperty.call(f,O)&&(s[O]=f[O])}return s},y.apply(this,arguments)}function v(s,u){for(var f=0;f<u.length;f++){var O=u[f];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(s,O.key,O)}}function p(s,u,f){return u&&v(s.prototype,u),f&&v(s,f),s}function c(s,u){s.prototype=Object.create(u.prototype),s.prototype.constructor=s,h(s,u)}function h(s,u){return h=Object.setPrototypeOf||function(O,x){return O.__proto__=x,O},h(s,u)}var d=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),l=function(s){c(u,s);function u(O){var x;return x=s.call(this,O,"[level-controller]")||this,x._levels=[],x._firstLevel=-1,x._startLevel=void 0,x.currentLevelIndex=-1,x.manualLevelIndex=-1,x.onParsedComplete=void 0,x._registerListeners(),x}var f=u.prototype;return f._registerListeners=function(){var x=this.hls;x.on(j.Events.MANIFEST_LOADED,this.onManifestLoaded,this),x.on(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),x.on(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),x.on(j.Events.FRAG_LOADED,this.onFragLoaded,this),x.on(j.Events.ERROR,this.onError,this)},f._unregisterListeners=function(){var x=this.hls;x.off(j.Events.MANIFEST_LOADED,this.onManifestLoaded,this),x.off(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),x.off(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),x.off(j.Events.FRAG_LOADED,this.onFragLoaded,this),x.off(j.Events.ERROR,this.onError,this)},f.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,s.prototype.destroy.call(this)},f.startLoad=function(){var x=this._levels;x.forEach(function(w){w.loadError=0}),s.prototype.startLoad.call(this)},f.onManifestLoaded=function(x,w){var A=[],R=[],T=[],E,g={},a,m=!1,r=!1,b=!1;if(w.levels.forEach(function(X){var U=X.attrs;m=m||!!(X.width&&X.height),r=r||!!X.videoCodec,b=b||!!X.audioCodec,d&&X.audioCodec&&X.audioCodec.indexOf("mp4a.40.34")!==-1&&(X.audioCodec=void 0);var S=X.bitrate+"-"+X.attrs.RESOLUTION+"-"+X.attrs.CODECS;a=g[S],a?a.url.push(X.url):(a=new $.Level(X),g[S]=a,A.push(a)),U&&(U.AUDIO&&Object(H.addGroupId)(a,"audio",U.AUDIO),U.SUBTITLES&&Object(H.addGroupId)(a,"text",U.SUBTITLES))}),(m||r)&&b&&(A=A.filter(function(X){var U=X.videoCodec,S=X.width,B=X.height;return!!U||!!(S&&B)})),A=A.filter(function(X){var U=X.audioCodec,S=X.videoCodec;return(!U||Object(V.isCodecSupportedInMp4)(U,"audio"))&&(!S||Object(V.isCodecSupportedInMp4)(S,"video"))}),w.audioTracks&&(R=w.audioTracks.filter(function(X){return!X.audioCodec||Object(V.isCodecSupportedInMp4)(X.audioCodec,"audio")}),Object(H.assignTrackIdsByGroup)(R)),w.subtitles&&(T=w.subtitles,Object(H.assignTrackIdsByGroup)(T)),A.length>0){E=A[0].bitrate,A.sort(function(X,U){return X.bitrate-U.bitrate}),this._levels=A;for(var P=0;P<A.length;P++)if(A[P].bitrate===E){this._firstLevel=P,this.log("manifest loaded, "+A.length+" level(s) found, first bitrate: "+E);break}var M=b&&!r,W={levels:A,audioTracks:R,subtitleTracks:T,firstLevel:this._firstLevel,stats:w.stats,audio:b,video:r,altAudio:!M&&R.some(function(X){return!!X.url})};this.hls.trigger(j.Events.MANIFEST_PARSED,W),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(j.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:w.url,reason:"no level with compatible codecs found in manifest"})},f.onError=function(x,w){if(s.prototype.onError.call(this,x,w),w.fatal)return;var A=w.context,R=this._levels[this.currentLevelIndex];if(A&&(A.type===L.PlaylistContextType.AUDIO_TRACK&&R.audioGroupIds&&A.groupId===R.audioGroupIds[R.urlId]||A.type===L.PlaylistContextType.SUBTITLE_TRACK&&R.textGroupIds&&A.groupId===R.textGroupIds[R.urlId])){this.redundantFailover(this.currentLevelIndex);return}var T=!1,E=!0,g;switch(w.details){case F.ErrorDetails.FRAG_LOAD_ERROR:case F.ErrorDetails.FRAG_LOAD_TIMEOUT:case F.ErrorDetails.KEY_LOAD_ERROR:case F.ErrorDetails.KEY_LOAD_TIMEOUT:if(w.frag){var a=this._levels[w.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(g=w.frag.level)):g=w.frag.level}break;case F.ErrorDetails.LEVEL_LOAD_ERROR:case F.ErrorDetails.LEVEL_LOAD_TIMEOUT:A&&(A.deliveryDirectives&&(E=!1),g=A.level),T=!0;break;case F.ErrorDetails.REMUX_ALLOC_ERROR:g=w.level,T=!0;break}g!==void 0&&this.recoverLevel(w,g,T,E)},f.recoverLevel=function(x,w,A,R){var T=x.details,E=this._levels[w];if(E.loadError++,A){var g=this.retryLoadingOrFail(x);if(g)x.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(R){var a=E.url.length;if(a>1&&E.loadError<a)x.levelRetry=!0,this.redundantFailover(w);else if(this.manualLevelIndex===-1){var m=w===0?this._levels.length-1:w-1;this.currentLevelIndex!==m&&this._levels[m].loadError===0&&(this.warn(T+": switch to "+m),x.levelRetry=!0,this.hls.nextAutoLevel=m)}}},f.redundantFailover=function(x){var w=this._levels[x],A=w.url.length;if(A>1){var R=(w.urlId+1)%A;this.warn("Switching to redundant URL-id "+R),this._levels.forEach(function(T){T.urlId=R}),this.level=x}},f.onFragLoaded=function(x,w){var A=w.frag;if(A!==void 0&&A.type===L.PlaylistLevelType.MAIN){var R=this._levels[A.level];R!==void 0&&(R.fragmentError=0,R.loadError=0)}},f.onLevelLoaded=function(x,w){var A,R=w.level,T=w.details,E=this._levels[R];if(!E){var g;this.warn("Invalid level index "+R),(g=w.deliveryDirectives)!==null&&g!==void 0&&g.skip&&(T.deltaUpdateFailed=!0);return}R===this.currentLevelIndex?(E.fragmentError===0&&(E.loadError=0,this.retryCount=0),this.playlistLoaded(R,w,E.details)):(A=w.deliveryDirectives)!==null&&A!==void 0&&A.skip&&(T.deltaUpdateFailed=!0)},f.onAudioTrackSwitched=function(x,w){var A=this.hls.levels[this.currentLevelIndex];if(!A)return;if(A.audioGroupIds){for(var R=-1,T=this.hls.audioTracks[w.id].groupId,E=0;E<A.audioGroupIds.length;E++)if(A.audioGroupIds[E]===T){R=E;break}R!==A.urlId&&(A.urlId=R,this.startLoad())}},f.loadPlaylist=function(x){var w=this.currentLevelIndex,A=this._levels[w];if(this.canLoad&&A&&A.url.length>0){var R=A.urlId,T=A.url[R];if(x)try{T=x.addDirectives(T)}catch(E){this.warn("Could not construct new URL with HLS Delivery Directives: "+E)}this.log("Attempt loading level index "+w+(x?" at sn "+x.msn+" part "+x.part:"")+" with URL-id "+R+" "+T),this.clearTimer(),this.hls.trigger(j.Events.LEVEL_LOADING,{url:T,level:w,id:R,deliveryDirectives:x||null})}},f.removeLevel=function(x,w){var A=function(E,g){return g!==w},R=this._levels.filter(function(T,E){return E!==x?!0:T.url.length>1&&w!==void 0?(T.url=T.url.filter(A),T.audioGroupIds&&(T.audioGroupIds=T.audioGroupIds.filter(A)),T.textGroupIds&&(T.textGroupIds=T.textGroupIds.filter(A)),T.urlId=0,!0):!1}).map(function(T,E){var g=T.details;return g!=null&&g.fragments&&g.fragments.forEach(function(a){a.level=E}),T});this._levels=R,this.hls.trigger(j.Events.LEVELS_UPDATED,{levels:R})},p(u,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(x){var w,A=this._levels;if(A.length===0)return;if(this.currentLevelIndex===x&&(w=A[x])!==null&&w!==void 0&&w.details)return;if(x<0||x>=A.length){var R=x<0;if(this.hls.trigger(j.Events.ERROR,{type:F.ErrorTypes.OTHER_ERROR,details:F.ErrorDetails.LEVEL_SWITCH_ERROR,level:x,fatal:R,reason:"invalid level idx"}),R)return;x=Math.min(x,A.length-1)}this.clearTimer();var T=this.currentLevelIndex,E=A[T],g=A[x];this.log("switching to level "+x+" from "+T),this.currentLevelIndex=x;var a=y({},g,{level:x,maxBitrate:g.maxBitrate,uri:g.uri,urlId:g.urlId});delete a._urlId,this.hls.trigger(j.Events.LEVEL_SWITCHING,a);var m=g.details;if(!m||m.live){var r=this.switchParams(g.uri,E==null?void 0:E.details);this.loadPlaylist(r)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(x){this.manualLevelIndex=x,this._startLevel===void 0&&(this._startLevel=x),x!==-1&&(this.level=x)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(x){this._firstLevel=x}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var x=this.hls.config.startLevel;return x!==void 0?x:this._firstLevel}else return this._startLevel},set:function(x){this._startLevel=x}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(x){this.level=x,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=x)}}]),u}(k.default)},"./src/controller/level-helper.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"addGroupId",function(){return F}),D.d(Z,"assignTrackIdsByGroup",function(){return V}),D.d(Z,"updatePTS",function(){return H}),D.d(Z,"updateFragPTSDTS",function(){return L}),D.d(Z,"mergeDetails",function(){return y}),D.d(Z,"mapPartIntersection",function(){return v}),D.d(Z,"mapFragmentIntersection",function(){return p}),D.d(Z,"adjustSliding",function(){return c}),D.d(Z,"addSliding",function(){return h}),D.d(Z,"computeReloadInterval",function(){return d}),D.d(Z,"getFragmentWithSN",function(){return l}),D.d(Z,"getPartWith",function(){return s});var $=D("./src/polyfills/number.ts"),j=D("./src/utils/logger.ts");function F(u,f,O){switch(f){case"audio":u.audioGroupIds||(u.audioGroupIds=[]),u.audioGroupIds.push(O);break;case"text":u.textGroupIds||(u.textGroupIds=[]),u.textGroupIds.push(O);break}}function V(u){var f={};u.forEach(function(O){var x=O.groupId||"";O.id=f[x]=f[x]||0,f[x]++})}function H(u,f,O){var x=u[f],w=u[O];k(x,w)}function k(u,f){var O=f.startPTS;if(Object($.isFiniteNumber)(O)){var x=0,w;f.sn>u.sn?(x=O-u.start,w=u):(x=u.start-O,w=f),w.duration!==x&&(w.duration=x)}else if(f.sn>u.sn){var A=u.cc===f.cc;A&&u.minEndPTS?f.start=u.start+(u.minEndPTS-u.start):f.start=u.start+u.duration}else f.start=Math.max(u.start-f.duration,0)}function L(u,f,O,x,w,A){var R=x-O;R<=0&&(j.logger.warn("Fragment should have a positive duration",f),x=O+f.duration,A=w+f.duration);var T=O,E=x,g=f.startPTS,a=f.endPTS;if(Object($.isFiniteNumber)(g)){var m=Math.abs(g-O);Object($.isFiniteNumber)(f.deltaPTS)?f.deltaPTS=Math.max(m,f.deltaPTS):f.deltaPTS=m,T=Math.max(O,g),O=Math.min(O,g),w=Math.min(w,f.startDTS),E=Math.min(x,a),x=Math.max(x,a),A=Math.max(A,f.endDTS)}f.duration=x-O;var r=O-f.start;f.appendedPTS=x,f.start=f.startPTS=O,f.maxStartPTS=T,f.startDTS=w,f.endPTS=x,f.minEndPTS=E,f.endDTS=A;var b=f.sn;if(!u||b<u.startSN||b>u.endSN)return 0;var P,M=b-u.startSN,W=u.fragments;for(W[M]=f,P=M;P>0;P--)k(W[P],W[P-1]);for(P=M;P<W.length-1;P++)k(W[P],W[P+1]);return u.fragmentHint&&k(W[W.length-1],u.fragmentHint),u.PTSKnown=u.alignedSliding=!0,r}function y(u,f){for(var O=null,x=u.fragments,w=x.length-1;w>=0;w--){var A=x[w].initSegment;if(A){O=A;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;var R=0,T;if(p(u,f,function(P,M){P.relurl&&(R=P.cc-M.cc),Object($.isFiniteNumber)(P.startPTS)&&Object($.isFiniteNumber)(P.endPTS)&&(M.start=M.startPTS=P.startPTS,M.startDTS=P.startDTS,M.appendedPTS=P.appendedPTS,M.maxStartPTS=P.maxStartPTS,M.endPTS=P.endPTS,M.endDTS=P.endDTS,M.minEndPTS=P.minEndPTS,M.duration=P.endPTS-P.startPTS,M.duration&&(T=M),f.PTSKnown=f.alignedSliding=!0),M.elementaryStreams=P.elementaryStreams,M.loader=P.loader,M.stats=P.stats,M.urlId=P.urlId,P.initSegment&&(M.initSegment=P.initSegment,O=P.initSegment)}),O){var E=f.fragmentHint?f.fragments.concat(f.fragmentHint):f.fragments;E.forEach(function(P){var M;(!P.initSegment||P.initSegment.relurl===((M=O)===null||M===void 0?void 0:M.relurl))&&(P.initSegment=O)})}if(f.skippedSegments&&(f.deltaUpdateFailed=f.fragments.some(function(P){return!P}),f.deltaUpdateFailed)){j.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var g=f.skippedSegments;g--;)f.fragments.shift();f.startSN=f.fragments[0].sn,f.startCC=f.fragments[0].cc}var a=f.fragments;if(R){j.logger.warn("discontinuity sliding from playlist, take drift into account");for(var m=0;m<a.length;m++)a[m].cc+=R}f.skippedSegments&&(f.startCC=f.fragments[0].cc),v(u.partList,f.partList,function(P,M){M.elementaryStreams=P.elementaryStreams,M.stats=P.stats}),T?L(f,T,T.startPTS,T.endPTS,T.startDTS,T.endDTS):c(u,f),a.length&&(f.totalduration=f.edge-a[0].start),f.driftStartTime=u.driftStartTime,f.driftStart=u.driftStart;var r=f.advancedDateTime;if(f.advanced&&r){var b=f.edge;f.driftStart||(f.driftStartTime=r,f.driftStart=b),f.driftEndTime=r,f.driftEnd=b}else f.driftEndTime=u.driftEndTime,f.driftEnd=u.driftEnd,f.advancedDateTime=u.advancedDateTime}function v(u,f,O){if(u&&f)for(var x=0,w=0,A=u.length;w<=A;w++){var R=u[w],T=f[w+x];R&&T&&R.index===T.index&&R.fragment.sn===T.fragment.sn?O(R,T):x--}}function p(u,f,O){for(var x=f.skippedSegments,w=Math.max(u.startSN,f.startSN)-f.startSN,A=(u.fragmentHint?1:0)+(x?f.endSN:Math.min(u.endSN,f.endSN))-f.startSN,R=f.startSN-u.startSN,T=f.fragmentHint?f.fragments.concat(f.fragmentHint):f.fragments,E=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,g=w;g<=A;g++){var a=E[R+g],m=T[g];x&&!m&&g<x&&(m=f.fragments[g]=a),a&&m&&O(a,m)}}function c(u,f){var O=f.startSN+f.skippedSegments-u.startSN,x=u.fragments;if(O<0||O>=x.length)return;h(f,x[O].start)}function h(u,f){if(f){for(var O=u.fragments,x=u.skippedSegments;x<O.length;x++)O[x].start+=f;u.fragmentHint&&(u.fragmentHint.start+=f)}}function d(u,f){var O=1e3*u.levelTargetDuration,x=O/2,w=u.age,A=w>0&&w<O*3,R=f.loading.end-f.loading.start,T,E=u.availabilityDelay;if(u.updated===!1)if(A){var g=333*u.misses;T=Math.max(Math.min(x,R*2),g),u.availabilityDelay=(u.availabilityDelay||0)+T}else T=x;else A?(E=Math.min(E||O/2,w),u.availabilityDelay=E,T=E+O-w):T=O-R;return Math.round(T)}function l(u,f,O){if(!u||!u.details)return null;var x=u.details,w=x.fragments[f-x.startSN];return w||(w=x.fragmentHint,w&&w.sn===f?w:f<x.startSN&&O&&O.sn===f?O:null)}function s(u,f,O){if(!u||!u.details)return null;var x=u.details.partList;if(x)for(var w=x.length;w--;){var A=x[w];if(A.index===O&&A.fragment.sn===f)return A}return null}},"./src/controller/stream-controller.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return x});var $=D("./src/polyfills/number.ts"),j=D("./src/controller/base-stream-controller.ts"),F=D("./src/is-supported.ts"),V=D("./src/events.ts"),H=D("./src/utils/buffer-helper.ts"),k=D("./src/controller/fragment-tracker.ts"),L=D("./src/types/loader.ts"),y=D("./src/loader/fragment.ts"),v=D("./src/demux/transmuxer-interface.ts"),p=D("./src/types/transmuxer.ts"),c=D("./src/controller/gap-controller.ts"),h=D("./src/errors.ts"),d=D("./src/utils/logger.ts");function l(w,A){for(var R=0;R<A.length;R++){var T=A[R];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(w,T.key,T)}}function s(w,A,R){return A&&l(w.prototype,A),R&&l(w,R),w}function u(w,A){w.prototype=Object.create(A.prototype),w.prototype.constructor=w,f(w,A)}function f(w,A){return f=Object.setPrototypeOf||function(T,E){return T.__proto__=E,T},f(w,A)}var O=100,x=function(w){u(A,w);function A(T,E){var g;return g=w.call(this,T,E,"[stream-controller]")||this,g.audioCodecSwap=!1,g.gapController=null,g.level=-1,g._forceStartLoad=!1,g.altAudio=!1,g.audioOnly=!1,g.fragPlaying=null,g.onvplaying=null,g.onvseeked=null,g.fragLastKbps=0,g.stalled=!1,g.couldBacktrack=!1,g.audioCodecSwitch=!1,g.videoBuffer=null,g._registerListeners(),g}var R=A.prototype;return R._registerListeners=function(){var E=this.hls;E.on(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.on(V.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.on(V.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.on(V.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.on(V.Events.LEVEL_LOADING,this.onLevelLoading,this),E.on(V.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.on(V.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),E.on(V.Events.ERROR,this.onError,this),E.on(V.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),E.on(V.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),E.on(V.Events.BUFFER_CREATED,this.onBufferCreated,this),E.on(V.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),E.on(V.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),E.on(V.Events.FRAG_BUFFERED,this.onFragBuffered,this)},R._unregisterListeners=function(){var E=this.hls;E.off(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.off(V.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.off(V.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.off(V.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.off(V.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.off(V.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),E.off(V.Events.ERROR,this.onError,this),E.off(V.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),E.off(V.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),E.off(V.Events.BUFFER_CREATED,this.onBufferCreated,this),E.off(V.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),E.off(V.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),E.off(V.Events.FRAG_BUFFERED,this.onFragBuffered,this)},R.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},R.startLoad=function(E){if(this.levels){var g=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(O),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var m=a.startLevel;m===-1&&(a.config.testBandwidth?(m=0,this.bitrateTest=!0):m=a.nextAutoLevel),this.level=a.nextLoadLevel=m,this.loadedmetadata=!1}g>0&&E===-1&&(this.log("Override startPosition with lastCurrentTime @"+g.toFixed(3)),E=g),this.state=j.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=E,this.tick()}else this._forceStartLoad=!0,this.state=j.State.STOPPED},R.stopLoad=function(){this._forceStartLoad=!1,w.prototype.stopLoad.call(this)},R.doTick=function(){switch(this.state){case j.State.IDLE:this.doTickIdle();break;case j.State.WAITING_LEVEL:{var E,g=this.levels,a=this.level,m=g==null||((E=g[a])===null||E===void 0)?void 0:E.details;if(m&&(!m.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(m))break;this.state=j.State.IDLE;break}break}case j.State.FRAG_LOADING_WAITING_RETRY:{var r,b=self.performance.now(),P=this.retryDate;(!P||b>=P||(r=this.media)!==null&&r!==void 0&&r.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=j.State.IDLE)}break;default:break}this.onTickEnd()},R.onTickEnd=function(){w.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},R.doTickIdle=function(){var E,g,a=this.hls,m=this.levelLastLoaded,r=this.levels,b=this.media,P=a.config,M=a.nextLoadLevel;if(m===null||!b&&(this.startFragRequested||!P.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!r||!r[M])return;var W=r[M];this.level=a.nextLoadLevel=M;var X=W.details;if(!X||this.state===j.State.WAITING_LEVEL||X.live&&this.levelLastLoaded!==M){this.state=j.State.WAITING_LEVEL;return}var U=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:b,L.PlaylistLevelType.MAIN);if(U===null)return;var S=U.len,B=this.getMaxBufferLength(W.maxBitrate);if(S>=B)return;if(this._streamEnded(U,X)){var J={};this.altAudio&&(J.type="video"),this.hls.trigger(V.Events.BUFFER_EOS,J),this.state=j.State.ENDED;return}var te=U.end,ae=this.getNextFragment(te,X);if(this.couldBacktrack&&!this.fragPrevious&&ae&&ae.sn!=="initSegment"){var _e=ae.sn-X.startSN;_e>1&&(ae=X.fragments[_e-1],this.fragmentTracker.removeFragment(ae))}if(ae&&this.fragmentTracker.getState(ae)===k.FragmentState.OK&&this.nextLoadPosition>te){var de=this.audioOnly&&!this.altAudio?y.ElementaryStreamTypes.AUDIO:y.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(b,de,L.PlaylistLevelType.MAIN),ae=this.getNextFragment(this.nextLoadPosition,X)}if(!ae)return;ae.initSegment&&!ae.initSegment.data&&!this.bitrateTest&&(ae=ae.initSegment),((E=ae.decryptdata)===null||E===void 0?void 0:E.keyFormat)==="identity"&&!((g=ae.decryptdata)!==null&&g!==void 0&&g.key)?this.loadKey(ae,X):this.loadFragment(ae,X,te)},R.loadFragment=function(E,g,a){var m,r=this.fragmentTracker.getState(E);if(this.fragCurrent=E,r===k.FragmentState.BACKTRACKED){var b=this.fragmentTracker.getBacktrackData(E);if(b){this._handleFragmentLoadProgress(b),this._handleFragmentLoadComplete(b);return}else r=k.FragmentState.NOT_LOADED}r===k.FragmentState.NOT_LOADED||r===k.FragmentState.PARTIAL?E.sn==="initSegment"?this._loadInitSegment(E):this.bitrateTest?(E.bitrateTest=!0,this.log("Fragment "+E.sn+" of level "+E.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(E)):(this.startFragRequested=!0,w.prototype.loadFragment.call(this,E,g,a)):r===k.FragmentState.APPENDING?this.reduceMaxBufferLength(E.duration)&&this.fragmentTracker.removeFragment(E):((m=this.media)===null||m===void 0?void 0:m.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},R.getAppendedFrag=function(E){var g=this.fragmentTracker.getAppendedFrag(E,L.PlaylistLevelType.MAIN);return g&&"fragment"in g?g.fragment:g},R.getBufferedFrag=function(E){return this.fragmentTracker.getBufferedFrag(E,L.PlaylistLevelType.MAIN)},R.followingBufferedFrag=function(E){return E?this.getBufferedFrag(E.end+.5):null},R.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},R.nextLevelSwitch=function(){var E=this.levels,g=this.media;if(g!=null&&g.readyState){var a,m=this.getAppendedFrag(g.currentTime);if(m&&m.start>1&&this.flushMainBuffer(0,m.start-1),!g.paused&&E){var r=this.hls.nextLoadLevel,b=E[r],P=this.fragLastKbps;P&&this.fragCurrent?a=this.fragCurrent.duration*b.maxBitrate/(1e3*P)+1:a=0}else a=0;var M=this.getBufferedFrag(g.currentTime+a);if(M){var W=this.followingBufferedFrag(M);if(W){this.abortCurrentFrag();var X=W.maxStartPTS?W.maxStartPTS:W.start,U=W.duration,S=Math.max(M.end,X+Math.min(Math.max(U-this.config.maxFragLookUpTolerance,U*.5),U*.75));this.flushMainBuffer(S,Number.POSITIVE_INFINITY)}}}},R.abortCurrentFrag=function(){var E=this.fragCurrent;this.fragCurrent=null,E!=null&&E.loader&&E.loader.abort(),this.state===j.State.KEY_LOADING&&(this.state=j.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},R.flushMainBuffer=function(E,g){w.prototype.flushMainBuffer.call(this,E,g,this.altAudio?"video":null)},R.onMediaAttached=function(E,g){w.prototype.onMediaAttached.call(this,E,g);var a=g.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new c.default(this.config,a,this.fragmentTracker,this.hls)},R.onMediaDetaching=function(){var E=this.media;E&&(E.removeEventListener("playing",this.onvplaying),E.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),w.prototype.onMediaDetaching.call(this)},R.onMediaPlaying=function(){this.tick()},R.onMediaSeeked=function(){var E=this.media,g=E?E.currentTime:null;Object($.isFiniteNumber)(g)&&this.log("Media seeked to "+g.toFixed(3)),this.tick()},R.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(V.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},R.onManifestParsed=function(E,g){var a=!1,m=!1,r;g.levels.forEach(function(b){r=b.audioCodec,r&&(r.indexOf("mp4a.40.2")!==-1&&(a=!0),r.indexOf("mp4a.40.5")!==-1&&(m=!0))}),this.audioCodecSwitch=a&&m&&!Object(F.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=g.levels,this.startFragRequested=!1},R.onLevelLoading=function(E,g){var a=this.levels;if(!a||this.state!==j.State.IDLE)return;var m=a[g.level];(!m.details||m.details.live&&this.levelLastLoaded!==g.level||this.waitForCdnTuneIn(m.details))&&(this.state=j.State.WAITING_LEVEL)},R.onLevelLoaded=function(E,g){var a,m=this.levels,r=g.level,b=g.details,P=b.totalduration;if(!m){this.warn("Levels were reset while loading level "+r);return}this.log("Level "+r+" loaded ["+b.startSN+","+b.endSN+"], cc ["+b.startCC+", "+b.endCC+"] duration:"+P);var M=this.fragCurrent;M&&(this.state===j.State.FRAG_LOADING||this.state===j.State.FRAG_LOADING_WAITING_RETRY)&&(M.level!==g.level&&M.loader&&(this.state=j.State.IDLE,M.loader.abort()));var W=m[r],X=0;if(b.live||(a=W.details)!==null&&a!==void 0&&a.live){if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed)return;X=this.alignPlaylists(b,W.details)}if(W.details=b,this.levelLastLoaded=r,this.hls.trigger(V.Events.LEVEL_UPDATED,{details:b,level:r}),this.state===j.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(b))return;this.state=j.State.IDLE}this.startFragRequested?b.live&&this.synchronizeToLiveEdge(b):this.setStartPosition(b,X),this.tick()},R._handleFragmentLoadProgress=function(E){var g,a=E.frag,m=E.part,r=E.payload,b=this.levels;if(!b){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var P=b[a.level],M=P.details;if(!M){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var W=P.videoCodec,X=M.PTSKnown||!M.live,U=(g=a.initSegment)===null||g===void 0?void 0:g.data,S=this._getAudioCodec(P),B=this.transmuxer=this.transmuxer||new v.default(this.hls,L.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),J=m?m.index:-1,te=J!==-1,ae=new p.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,r.byteLength,J,te),_e=this.initPTS[a.cc];B.push(r,U,S,W,a,m,M.totalduration,X,ae,_e)},R.onAudioTrackSwitching=function(E,g){var a=this.altAudio,m=!!g.url,r=g.id;if(!m){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var b=this.fragCurrent;b!=null&&b.loader&&(this.log("Switching to main audio track, cancel main fragment load"),b.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var P=this.hls;a&&P.trigger(V.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),P.trigger(V.Events.AUDIO_TRACK_SWITCHED,{id:r})}},R.onAudioTrackSwitched=function(E,g){var a=g.id,m=!!this.hls.audioTracks[a].url;if(m){var r=this.videoBuffer;r&&this.mediaBuffer!==r&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=r)}this.altAudio=m,this.tick()},R.onBufferCreated=function(E,g){var a=g.tracks,m,r,b=!1;for(var P in a){var M=a[P];if(M.id==="main"){if(r=P,m=M,P==="video"){var W=a[P];W&&(this.videoBuffer=W.buffer)}}else b=!0}b&&m?(this.log("Alternate track found, use "+r+".buffered to schedule main fragment loading"),this.mediaBuffer=m.buffer):this.mediaBuffer=this.media},R.onFragBuffered=function(E,g){var a=g.frag,m=g.part;if(a&&a.type!==L.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(m?" p: "+m.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===j.State.PARSED&&(this.state=j.State.IDLE);return}var r=m?m.stats:a.stats;this.fragLastKbps=Math.round(8*r.total/(r.buffering.end-r.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,m)},R.onError=function(E,g){switch(g.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(L.PlaylistLevelType.MAIN,g);break;case h.ErrorDetails.LEVEL_LOAD_ERROR:case h.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==j.State.ERROR&&(g.fatal?(this.warn(""+g.details),this.state=j.State.ERROR):!g.levelRetry&&this.state===j.State.WAITING_LEVEL&&(this.state=j.State.IDLE));break;case h.ErrorDetails.BUFFER_FULL_ERROR:if(g.parent==="main"&&(this.state===j.State.PARSING||this.state===j.State.PARSED)){var a=!0,m=this.getFwdBufferInfo(this.media,L.PlaylistLevelType.MAIN);m&&m.len>.5&&(a=!this.reduceMaxBufferLength(m.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},R.checkBuffer=function(){var E=this.media,g=this.gapController;if(!E||!g||!E.readyState)return;var a=H.BufferHelper.getBuffered(E);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):g.poll(this.lastCurrentTime),this.lastCurrentTime=E.currentTime},R.onFragLoadEmergencyAborted=function(){this.state=j.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},R.onBufferFlushed=function(E,g){var a=g.type;if(a!==y.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var m=(a===y.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(m,a,L.PlaylistLevelType.MAIN)}},R.onLevelsUpdated=function(E,g){this.levels=g.levels},R.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},R.seekToStartPos=function(){var E=this.media,g=E.currentTime,a=this.startPosition;if(a>=0&&g<a){if(E.seeking){d.logger.log("could not seek to "+a+", already seeking at "+g);return}var m=H.BufferHelper.getBuffered(E),r=m.length?m.start(0):0,b=r-a;b>0&&(b<this.config.maxBufferHole||b<this.config.maxFragLookUpTolerance)&&(d.logger.log("adjusting start position by "+b+" to match buffer start"),a+=b,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+g),E.currentTime=a}},R._getAudioCodec=function(E){var g=this.config.defaultAudioCodec||E.audioCodec;return this.audioCodecSwap&&g&&(this.log("Swapping audio codec"),g.indexOf("mp4a.40.5")!==-1?g="mp4a.40.2":g="mp4a.40.5"),g},R._loadBitrateTestFrag=function(E){var g=this;this._doFragLoad(E).then(function(a){var m=g.hls;if(!a||m.nextLoadLevel||g.fragContextChanged(E))return;g.fragLoadError=0,g.state=j.State.IDLE,g.startFragRequested=!1,g.bitrateTest=!1;var r=E.stats;r.parsing.start=r.parsing.end=r.buffering.start=r.buffering.end=self.performance.now(),m.trigger(V.Events.FRAG_LOADED,a)})},R._handleTransmuxComplete=function(E){var g,a="main",m=this.hls,r=E.remuxResult,b=E.chunkMeta,P=this.getCurrentContext(b);if(!P){this.warn("The loading context changed while buffering fragment "+b.sn+" of level "+b.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(b.level);return}var M=P.frag,W=P.part,X=P.level,U=r.video,S=r.text,B=r.id3,J=r.initSegment,te=this.altAudio?void 0:r.audio;if(this.fragContextChanged(M))return;if(this.state=j.State.PARSING,J){J.tracks&&(this._bufferInitSegment(X,J.tracks,M,b),m.trigger(V.Events.FRAG_PARSING_INIT_SEGMENT,{frag:M,id:a,tracks:J.tracks}));var ae=J.initPTS,_e=J.timescale;Object($.isFiniteNumber)(ae)&&(this.initPTS[M.cc]=ae,m.trigger(V.Events.INIT_PTS_FOUND,{frag:M,id:a,initPTS:ae,timescale:_e}))}if(U&&r.independent!==!1){if(X.details){var de=U.startPTS,Ee=U.endPTS,Te=U.startDTS,me=U.endDTS;if(W)W.elementaryStreams[U.type]={startPTS:de,endPTS:Ee,startDTS:Te,endDTS:me};else if(U.firstKeyFrame&&U.independent&&(this.couldBacktrack=!0),U.dropped&&U.independent){var ce=this.getLoadPosition()+this.config.maxBufferHole;if(ce<de){this.backtrack(M);return}M.setElementaryStreamInfo(U.type,M.start,Ee,M.start,me,!0)}M.setElementaryStreamInfo(U.type,de,Ee,Te,me),this.bufferFragmentData(U,M,W,b)}}else if(r.independent===!1){this.backtrack(M);return}if(te){var se=te.startPTS,Se=te.endPTS,je=te.startDTS,We=te.endDTS;W&&(W.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:se,endPTS:Se,startDTS:je,endDTS:We}),M.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,se,Se,je,We),this.bufferFragmentData(te,M,W,b)}if(B!=null&&(g=B.samples)!==null&&g!==void 0&&g.length){var Xe={frag:M,id:a,samples:B.samples};m.trigger(V.Events.FRAG_PARSING_METADATA,Xe)}if(S){var Qe={frag:M,id:a,samples:S.samples};m.trigger(V.Events.FRAG_PARSING_USERDATA,Qe)}},R._bufferInitSegment=function(E,g,a,m){var r=this;if(this.state!==j.State.PARSING)return;this.audioOnly=!!g.audio&&!g.video,this.altAudio&&!this.audioOnly&&delete g.audio;var b=g.audio,P=g.video,M=g.audiovideo;if(b){var W=E.audioCodec,X=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(W&&(W.indexOf("mp4a.40.5")!==-1?W="mp4a.40.2":W="mp4a.40.5"),b.metadata.channelCount!==1&&X.indexOf("firefox")===-1&&(W="mp4a.40.5")),X.indexOf("android")!==-1&&b.container!=="audio/mpeg"&&(W="mp4a.40.2",this.log("Android: force audio codec to "+W)),E.audioCodec&&E.audioCodec!==W&&this.log('Swapping manifest audio codec "'+E.audioCodec+'" for "'+W+'"'),b.levelCodec=W,b.id="main",this.log("Init audio buffer, container:"+b.container+", codecs[selected/level/parsed]=["+(W||"")+"/"+(E.audioCodec||"")+"/"+b.codec+"]")}P&&(P.levelCodec=E.videoCodec,P.id="main",this.log("Init video buffer, container:"+P.container+", codecs[level/parsed]=["+(E.videoCodec||"")+"/"+P.codec+"]")),M&&this.log("Init audiovideo buffer, container:"+M.container+", codecs[level/parsed]=["+(E.attrs.CODECS||"")+"/"+M.codec+"]"),this.hls.trigger(V.Events.BUFFER_CODECS,g),Object.keys(g).forEach(function(U){var S=g[U],B=S.initSegment;B!=null&&B.byteLength&&r.hls.trigger(V.Events.BUFFER_APPENDING,{type:U,data:B,frag:a,part:null,chunkMeta:m,parent:a.type})}),this.tick()},R.backtrack=function(E){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(E);var g=this.fragmentTracker.backtrack(E);this.fragPrevious=null,this.nextLoadPosition=E.start,g?this.resetFragmentLoading(E):this.state=j.State.BACKTRACKING},R.checkFragmentChanged=function(){var E=this.media,g=null;if(E&&E.readyState>1&&E.seeking===!1){var a=E.currentTime;if(H.BufferHelper.isBuffered(E,a)?g=this.getAppendedFrag(a):H.BufferHelper.isBuffered(E,a+.1)&&(g=this.getAppendedFrag(a+.1)),g){var m=this.fragPlaying,r=g.level;(!m||g.sn!==m.sn||m.level!==r||g.urlId!==m.urlId)&&(this.hls.trigger(V.Events.FRAG_CHANGED,{frag:g}),(!m||m.level!==r)&&this.hls.trigger(V.Events.LEVEL_SWITCHED,{level:r}),this.fragPlaying=g)}}},s(A,[{key:"nextLevel",get:function(){var E=this.nextBufferedFrag;return E?E.level:-1}},{key:"currentLevel",get:function(){var E=this.media;if(E){var g=this.getAppendedFrag(E.currentTime);if(g)return g.level}return-1}},{key:"nextBufferedFrag",get:function(){var E=this.media;if(E){var g=this.getAppendedFrag(E.currentTime);return this.followingBufferedFrag(g)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),A}(j.default)},"./src/controller/subtitle-stream-controller.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"SubtitleStreamController",function(){return u});var $=D("./src/events.ts"),j=D("./src/utils/logger.ts"),F=D("./src/utils/buffer-helper.ts"),V=D("./src/controller/fragment-finders.ts"),H=D("./src/utils/discontinuities.ts"),k=D("./src/controller/level-helper.ts"),L=D("./src/controller/fragment-tracker.ts"),y=D("./src/controller/base-stream-controller.ts"),v=D("./src/types/loader.ts"),p=D("./src/types/level.ts");function c(f,O){for(var x=0;x<O.length;x++){var w=O[x];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(f,w.key,w)}}function h(f,O,x){return O&&c(f.prototype,O),x&&c(f,x),f}function d(f,O){f.prototype=Object.create(O.prototype),f.prototype.constructor=f,l(f,O)}function l(f,O){return l=Object.setPrototypeOf||function(w,A){return w.__proto__=A,w},l(f,O)}var s=500,u=function(f){d(O,f);function O(w,A){var R;return R=f.call(this,w,A,"[subtitle-stream-controller]")||this,R.levels=[],R.currentTrackId=-1,R.tracksBuffered=[],R.mainDetails=null,R._registerListeners(),R}var x=O.prototype;return x.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},x._registerListeners=function(){var A=this.hls;A.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on($.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.on($.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.on($.Events.ERROR,this.onError,this),A.on($.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.on($.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.on($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.on($.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.on($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},x._unregisterListeners=function(){var A=this.hls;A.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off($.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.off($.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.off($.Events.ERROR,this.onError,this),A.off($.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.off($.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.off($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.off($.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.off($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},x.startLoad=function(){this.stopLoad(),this.state=y.State.IDLE,this.setInterval(s),this.tick()},x.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},x.onLevelLoaded=function(A,R){this.mainDetails=R.details},x.onSubtitleFragProcessed=function(A,R){var T=R.frag,E=R.success;if(this.fragPrevious=T,this.state=y.State.IDLE,!E)return;var g=this.tracksBuffered[this.currentTrackId];if(!g)return;for(var a,m=T.start,r=0;r<g.length;r++)if(m>=g[r].start&&m<=g[r].end){a=g[r];break}var b=T.start+T.duration;a?a.end=b:(a={start:m,end:b},g.push(a)),this.fragmentTracker.fragBuffered(T)},x.onBufferFlushing=function(A,R){var T=R.startOffset,E=R.endOffset;if(T===0&&E!==Number.POSITIVE_INFINITY){var g=this.currentTrackId,a=this.levels;if(!a.length||!a[g]||!a[g].details)return;var m=a[g].details,r=m.targetduration,b=E-r;if(b<=0)return;R.endOffsetSubtitles=Math.max(0,b),this.tracksBuffered.forEach(function(P){for(var M=0;M<P.length;){if(P[M].end<=b){P.shift();continue}else if(P[M].start<b)P[M].start=b;else break;M++}}),this.fragmentTracker.removeFragmentsInRange(T,b,v.PlaylistLevelType.SUBTITLE)}},x.onError=function(A,R){var T,E=R.frag;if(!E||E.type!==v.PlaylistLevelType.SUBTITLE)return;(T=this.fragCurrent)!==null&&T!==void 0&&T.loader&&this.fragCurrent.loader.abort(),this.state=y.State.IDLE},x.onSubtitleTracksUpdated=function(A,R){var T=this,E=R.subtitleTracks;this.tracksBuffered=[],this.levels=E.map(function(g){return new p.Level(g)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(g){T.tracksBuffered[g.id]=[]}),this.mediaBuffer=null},x.onSubtitleTrackSwitch=function(A,R){if(this.currentTrackId=R.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var T=this.levels[this.currentTrackId];T!=null&&T.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,T&&this.setInterval(s)},x.onSubtitleTrackLoaded=function(A,R){var T,E=R.details,g=R.id,a=this.currentTrackId,m=this.levels;if(!m.length)return;var r=m[a];if(g>=m.length||g!==a||!r)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,E.live||(T=r.details)!==null&&T!==void 0&&T.live){var b=this.mainDetails;if(E.deltaUpdateFailed||!b)return;var P=b.fragments[0];if(!r.details)E.hasProgramDateTime&&b.hasProgramDateTime?Object(H.alignMediaPlaylistByPDT)(E,b):P&&Object(k.addSliding)(E,P.start);else{var M=this.alignPlaylists(E,r.details);M===0&&P&&Object(k.addSliding)(E,P.start)}}if(r.details=E,this.levelLastLoaded=g,this.tick(),E.live&&!this.fragCurrent&&this.media&&this.state===y.State.IDLE){var W=Object(V.findFragmentByPTS)(null,E.fragments,this.media.currentTime,0);W||(this.warn("Subtitle playlist not aligned with playback"),r.details=void 0)}},x._handleFragmentLoadComplete=function(A){var R=A.frag,T=A.payload,E=R.decryptdata,g=this.hls;if(this.fragContextChanged(R))return;if(T&&T.byteLength>0&&E&&E.key&&E.iv&&E.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(T),E.key.buffer,E.iv.buffer).then(function(m){var r=performance.now();g.trigger($.Events.FRAG_DECRYPTED,{frag:R,payload:m,stats:{tstart:a,tdecrypt:r}})})}},x.doTick=function(){if(!this.media){this.state=y.State.IDLE;return}if(this.state===y.State.IDLE){var A,R=this.currentTrackId,T=this.levels;if(!T.length||!T[R]||!T[R].details)return;var E=T[R].details,g=E.targetduration,a=this.config,m=this.media,r=F.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,m.currentTime-g,a.maxBufferHole),b=r.end,P=r.len,M=this.getMaxBufferLength()+g;if(P>M)return;console.assert(E,"Subtitle track details are defined on idle subtitle stream controller tick");var W=E.fragments,X=W.length,U=E.edge,S,B=this.fragPrevious;if(b<U){var J=a.maxFragLookUpTolerance;B&&E.hasProgramDateTime&&(S=Object(V.findFragmentByPDT)(W,B.endProgramDateTime,J)),S||(S=Object(V.findFragmentByPTS)(B,W,b,J),!S&&B&&B.start<W[0].start&&(S=W[0]))}else S=W[X-1];(A=S)!==null&&A!==void 0&&A.encrypted?(j.logger.log("Loading key for "+S.sn),this.state=y.State.KEY_LOADING,this.hls.trigger($.Events.KEY_LOADING,{frag:S})):S&&this.fragmentTracker.getState(S)===L.FragmentState.NOT_LOADED&&this.loadFragment(S,E,b)}},x.loadFragment=function(A,R,T){this.fragCurrent=A,f.prototype.loadFragment.call(this,A,R,T)},h(O,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),O}(y.default)},"./src/controller/subtitle-track-controller.ts":function(oe,Z,D){"use strict";D.r(Z);var $=D("./src/events.ts"),j=D("./src/utils/texttrack-utils.ts"),F=D("./src/controller/base-playlist-controller.ts"),V=D("./src/types/loader.ts");function H(c,h){for(var d=0;d<h.length;d++){var l=h[d];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(c,l.key,l)}}function k(c,h,d){return h&&H(c.prototype,h),d&&H(c,d),c}function L(c,h){c.prototype=Object.create(h.prototype),c.prototype.constructor=c,y(c,h)}function y(c,h){return y=Object.setPrototypeOf||function(l,s){return l.__proto__=s,l},y(c,h)}var v=function(c){L(h,c);function h(l){var s;return s=c.call(this,l,"[subtitle-track-controller]")||this,s.media=null,s.tracks=[],s.groupId=null,s.tracksInGroup=[],s.trackId=-1,s.selectDefaultTrack=!0,s.queuedDefaultTrack=-1,s.trackChangeListener=function(){return s.onTextTracksChanged()},s.asyncPollTrackChange=function(){return s.pollTrackChange(0)},s.useTextTrackPolling=!1,s.subtitlePollingInterval=-1,s.subtitleDisplay=!0,s.registerListeners(),s}var d=h.prototype;return d.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,c.prototype.destroy.call(this)},d.registerListeners=function(){var s=this.hls;s.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on($.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on($.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.on($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),s.on($.Events.ERROR,this.onError,this)},d.unregisterListeners=function(){var s=this.hls;s.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off($.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off($.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.off($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),s.off($.Events.ERROR,this.onError,this)},d.onMediaAttached=function(s,u){if(this.media=u.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)},d.pollTrackChange=function(s){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,s)},d.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 s=p(this.media.textTracks);s.forEach(function(u){Object(j.clearCurrentCues)(u)}),this.subtitleTrack=-1,this.media=null},d.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},d.onManifestParsed=function(s,u){this.tracks=u.subtitleTracks},d.onSubtitleTrackLoaded=function(s,u){var f=u.id,O=u.details,x=this.trackId,w=this.tracksInGroup[x];if(!w){this.warn("Invalid subtitle track id "+f);return}var A=w.details;w.details=u.details,this.log("subtitle track "+f+" loaded ["+O.startSN+"-"+O.endSN+"]"),f===this.trackId&&(this.retryCount=0,this.playlistLoaded(f,u,A))},d.onLevelLoading=function(s,u){this.switchLevel(u.level)},d.onLevelSwitching=function(s,u){this.switchLevel(u.level)},d.switchLevel=function(s){var u=this.hls.levels[s];if(!(u!=null&&u.textGroupIds))return;var f=u.textGroupIds[u.urlId];if(this.groupId!==f){var O=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,x=this.tracks.filter(function(R){return!f||R.groupId===f});this.tracksInGroup=x;var w=this.findTrackId(O==null?void 0:O.name)||this.findTrackId();this.groupId=f;var A={subtitleTracks:x};this.log("Updating subtitle tracks, "+x.length+' track(s) found in "'+f+'" group-id'),this.hls.trigger($.Events.SUBTITLE_TRACKS_UPDATED,A),w!==-1&&this.setSubtitleTrack(w,O)}},d.findTrackId=function(s){for(var u=this.tracksInGroup,f=0;f<u.length;f++){var O=u[f];if((!this.selectDefaultTrack||O.default)&&(!s||s===O.name))return O.id}return-1},d.onError=function(s,u){if(c.prototype.onError.call(this,s,u),u.fatal||!u.context)return;u.context.type===V.PlaylistContextType.SUBTITLE_TRACK&&u.context.id===this.trackId&&u.context.groupId===this.groupId&&this.retryLoadingOrFail(u)},d.loadPlaylist=function(s){var u=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(u)){var f=u.id,O=u.groupId,x=u.url;if(s)try{x=s.addDirectives(x)}catch(w){this.warn("Could not construct new URL with HLS Delivery Directives: "+w)}this.log("Loading subtitle playlist for id "+f),this.hls.trigger($.Events.SUBTITLE_TRACK_LOADING,{url:x,id:f,groupId:O,deliveryDirectives:s||null})}},d.toggleTrackModes=function(s){var u=this,f=this.media,O=this.subtitleDisplay,x=this.trackId;if(!f)return;var w=p(f.textTracks),A=w.filter(function(E){return E.groupId===u.groupId});if(s===-1)[].slice.call(w).forEach(function(E){E.mode="disabled"});else{var R=A[x];R&&(R.mode="disabled")}var T=A[s];T&&(T.mode=O?"showing":"hidden")},d.setSubtitleTrack=function(s,u){var f,O=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=s;return}if(this.trackId!==s&&this.toggleTrackModes(s),this.trackId===s&&(s===-1||(f=O[s])!==null&&f!==void 0&&f.details)||s<-1||s>=O.length)return;this.clearTimer();var x=O[s];if(this.log("Switching to subtitle track "+s),this.trackId=s,x){var w=x.id,A=x.groupId,R=A===void 0?"":A,T=x.name,E=x.type,g=x.url;this.hls.trigger($.Events.SUBTITLE_TRACK_SWITCH,{id:w,groupId:R,name:T,type:E,url:g});var a=this.switchParams(x.url,u==null?void 0:u.details);this.loadPlaylist(a)}else this.hls.trigger($.Events.SUBTITLE_TRACK_SWITCH,{id:s})},d.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var s=-1,u=p(this.media.textTracks),f=0;f<u.length;f++)if(u[f].mode==="hidden")s=f;else if(u[f].mode==="showing"){s=f;break}this.subtitleTrack!==s&&(this.subtitleTrack=s)},k(h,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(s){this.selectDefaultTrack=!1;var u=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(s,u)}}]),h}(F.default);function p(c){for(var h=[],d=0;d<c.length;d++){var l=c[d];l.kind==="subtitles"&&l.label&&h.push(c[d])}return h}Z.default=v},"./src/controller/timeline-controller.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"TimelineController",function(){return p});var $=D("./src/polyfills/number.ts"),j=D("./src/events.ts"),F=D("./src/utils/cea-608-parser.ts"),V=D("./src/utils/output-filter.ts"),H=D("./src/utils/webvtt-parser.ts"),k=D("./src/utils/texttrack-utils.ts"),L=D("./src/utils/imsc1-ttml-parser.ts"),y=D("./src/types/loader.ts"),v=D("./src/utils/logger.ts"),p=function(){function l(u){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=d(),this.captionsProperties=void 0,this.hls=u,this.config=u.config,this.Cues=u.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 f=new V.default(this,"textTrack1"),O=new V.default(this,"textTrack2"),x=new V.default(this,"textTrack3"),w=new V.default(this,"textTrack4");this.cea608Parser1=new F.default(1,f,O),this.cea608Parser2=new F.default(3,x,w)}u.on(j.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(j.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.on(j.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.on(j.Events.FRAG_LOADING,this.onFragLoading,this),u.on(j.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(j.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.on(j.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.on(j.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(j.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.on(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var s=l.prototype;return s.destroy=function(){var f=this.hls;f.off(j.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),f.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(j.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.off(j.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),f.off(j.Events.FRAG_LOADING,this.onFragLoading,this),f.off(j.Events.FRAG_LOADED,this.onFragLoaded,this),f.off(j.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),f.off(j.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),f.off(j.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),f.off(j.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),f.off(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},s.addCues=function(f,O,x,w,A){for(var R=!1,T=A.length;T--;){var E=A[T],g=h(E[0],E[1],O,x);if(g>=0&&(E[0]=Math.min(E[0],O),E[1]=Math.max(E[1],x),R=!0,g/(x-O)>.5))return}if(R||A.push([O,x]),this.config.renderTextTracksNatively){var a=this.captionsTracks[f];this.Cues.newCue(a,O,x,w)}else{var m=this.Cues.newCue(null,O,x,w);this.hls.trigger(j.Events.CUES_PARSED,{type:"captions",cues:m,track:f})}},s.onInitPtsFound=function(f,O){var x=this,w=O.frag,A=O.id,R=O.initPTS,T=O.timescale,E=this.unparsedVttFrags;A==="main"&&(this.initPTS[w.cc]=R,this.timescale[w.cc]=T),E.length&&(this.unparsedVttFrags=[],E.forEach(function(g){x.onFragLoaded(j.Events.FRAG_LOADED,g)}))},s.getExistingTrack=function(f){var O=this.media;if(O)for(var x=0;x<O.textTracks.length;x++){var w=O.textTracks[x];if(w[f])return w}return null},s.createCaptionsTrack=function(f){this.config.renderTextTracksNatively?this.createNativeTrack(f):this.createNonNativeTrack(f)},s.createNativeTrack=function(f){if(this.captionsTracks[f])return;var O=this.captionsProperties,x=this.captionsTracks,w=this.media,A=O[f],R=A.label,T=A.languageCode,E=this.getExistingTrack(f);if(E)x[f]=E,Object(k.clearCurrentCues)(x[f]),Object(k.sendAddTrackEvent)(x[f],w);else{var g=this.createTextTrack("captions",R,T);g&&(g[f]=!0,x[f]=g)}},s.createNonNativeTrack=function(f){if(this.nonNativeCaptionsTracks[f])return;var O=this.captionsProperties[f];if(!O)return;var x=O.label,w={_id:f,label:x,kind:"captions",default:O.media?!!O.media.default:!1,closedCaptions:O.media};this.nonNativeCaptionsTracks[f]=w,this.hls.trigger(j.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[w]})},s.createTextTrack=function(f,O,x){var w=this.media;return w?w.addTextTrack(f,O,x):void 0},s.onMediaAttaching=function(f,O){this.media=O.media,this._cleanTracks()},s.onMediaDetaching=function(){var f=this.captionsTracks;Object.keys(f).forEach(function(O){Object(k.clearCurrentCues)(f[O]),delete f[O]}),this.nonNativeCaptionsTracks={}},s.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=d(),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())},s._cleanTracks=function(){var f=this.media;if(!f)return;var O=f.textTracks;if(O)for(var x=0;x<O.length;x++)Object(k.clearCurrentCues)(O[x])},s.onSubtitleTracksUpdated=function(f,O){var x=this;this.textTracks=[];var w=O.subtitleTracks||[],A=w.some(function(g){return g.textCodec===L.IMSC1_CODEC});if(this.config.enableWebVTT||A&&this.config.enableIMSC1){var R=this.tracks&&w&&this.tracks.length===w.length;if(this.tracks=w||[],this.config.renderTextTracksNatively){var T=this.media?this.media.textTracks:[];this.tracks.forEach(function(g,a){var m;if(a<T.length){for(var r=null,b=0;b<T.length;b++)if(c(T[b],g)){r=T[b];break}r&&(m=r)}m?Object(k.clearCurrentCues)(m):(m=x.createTextTrack("subtitles",g.name,g.lang),m&&(m.mode="disabled")),m&&(m.groupId=g.groupId,x.textTracks.push(m))})}else if(!R&&this.tracks&&this.tracks.length){var E=this.tracks.map(function(g){return{label:g.name,kind:g.type.toLowerCase(),default:g.default,subtitleTrack:g}});this.hls.trigger(j.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:E})}}},s.onManifestLoaded=function(f,O){var x=this;this.config.enableCEA708Captions&&O.captions&&O.captions.forEach(function(w){var A=/(?:CC|SERVICE)([1-4])/.exec(w.instreamId);if(!A)return;var R="textTrack"+A[1],T=x.captionsProperties[R];if(!T)return;T.label=w.name,w.lang&&(T.languageCode=w.lang),T.media=w})},s.onFragLoading=function(f,O){var x=this.cea608Parser1,w=this.cea608Parser2,A=this.lastSn,R=this.lastPartIndex;if(!this.enabled||!(x&&w))return;if(O.frag.type===y.PlaylistLevelType.MAIN){var T,E,g=O.frag.sn,a=(T=O==null||((E=O.part)===null||E===void 0)?void 0:E.index)!=null?T:-1;g===A+1||g===A&&a===R+1||(x.reset(),w.reset()),this.lastSn=g,this.lastPartIndex=a}},s.onFragLoaded=function(f,O){var x=O.frag,w=O.payload,A=this.initPTS,R=this.unparsedVttFrags;if(x.type===y.PlaylistLevelType.SUBTITLE)if(w.byteLength){if(!Object($.isFiniteNumber)(A[x.cc])){R.push(O),A.length&&this.hls.trigger(j.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:x,error:new Error("Missing initial subtitle PTS")});return}var T=x.decryptdata;if(T==null||T.key==null||T.method!=="AES-128"){var E=this.tracks[x.level],g=this.vttCCs;g[x.cc]||(g[x.cc]={start:x.start,prevCC:this.prevCC,new:!0},this.prevCC=x.cc),E&&E.textCodec===L.IMSC1_CODEC?this._parseIMSC1(x,w):this._parseVTTs(x,w,g)}}else this.hls.trigger(j.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:x,error:new Error("Empty subtitle payload")})},s._parseIMSC1=function(f,O){var x=this,w=this.hls;Object(L.parseIMSC1)(O,this.initPTS[f.cc],this.timescale[f.cc],function(A){x._appendCues(A,f.level),w.trigger(j.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:f})},function(A){v.logger.log("Failed to parse IMSC1: "+A),w.trigger(j.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:A})})},s._parseVTTs=function(f,O,x){var w=this,A=this.hls;Object(H.parseWebVTT)(O,this.initPTS[f.cc],this.timescale[f.cc],x,f.cc,f.start,function(R){w._appendCues(R,f.level),A.trigger(j.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:f})},function(R){w._fallbackToIMSC1(f,O),v.logger.log("Failed to parse VTT cue: "+R),A.trigger(j.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:R})})},s._fallbackToIMSC1=function(f,O){var x=this,w=this.tracks[f.level];w.textCodec||Object(L.parseIMSC1)(O,this.initPTS[f.cc],this.timescale[f.cc],function(){w.textCodec=L.IMSC1_CODEC,x._parseIMSC1(f,O)},function(){w.textCodec="wvtt"})},s._appendCues=function(f,O){var x=this.hls;if(this.config.renderTextTracksNatively){var w=this.textTracks[O];if(w.mode==="disabled")return;f.forEach(function(T){return Object(k.addCueToTrack)(w,T)})}else{var A=this.tracks[O],R=A.default?"default":"subtitles"+O;x.trigger(j.Events.CUES_PARSED,{type:"subtitles",cues:f,track:R})}},s.onFragDecrypted=function(f,O){var x=O.frag;if(x.type===y.PlaylistLevelType.SUBTITLE){if(!Object($.isFiniteNumber)(this.initPTS[x.cc])){this.unparsedVttFrags.push(O);return}this.onFragLoaded(j.Events.FRAG_LOADED,O)}},s.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},s.onFragParsingUserdata=function(f,O){var x=this.cea608Parser1,w=this.cea608Parser2;if(!this.enabled||!(x&&w))return;for(var A=0;A<O.samples.length;A++){var R=O.samples[A].bytes;if(R){var T=this.extractCea608Data(R);x.addData(O.samples[A].pts,T[0]),w.addData(O.samples[A].pts,T[1])}}},s.onBufferFlushing=function(f,O){var x=O.startOffset,w=O.endOffset,A=O.endOffsetSubtitles,R=O.type,T=this.media;if(!T||T.currentTime<w)return;if(!R||R==="video"){var E=this.captionsTracks;Object.keys(E).forEach(function(a){return Object(k.removeCuesInRange)(E[a],x,w)})}if(this.config.renderTextTracksNatively&&(x===0&&A!==void 0)){var g=this.textTracks;Object.keys(g).forEach(function(a){return Object(k.removeCuesInRange)(g[a],x,A)})}},s.extractCea608Data=function(f){for(var O=f[0]&31,x=2,w=[[],[]],A=0;A<O;A++){var R=f[x++],T=127&f[x++],E=127&f[x++],g=(4&R)!==0,a=3&R;if(T===0&&E===0)continue;g&&((a===0||a===1)&&(w[a].push(T),w[a].push(E)))}return w},l}();function c(l,s){return l&&l.label===s.name&&!(l.textTrack1||l.textTrack2)}function h(l,s,u,f){return Math.min(s,f)-Math.max(l,u)}function d(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return $});var $=function(){function j(V,H){this.subtle=void 0,this.aesIV=void 0,this.subtle=V,this.aesIV=H}var F=j.prototype;return F.decrypt=function(H,k){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},k,H)},j}()},"./src/crypt/aes-decryptor.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"removePadding",function(){return j}),D.d(Z,"default",function(){return F});var $=D("./src/utils/typed-array.ts");function j(V){var H=V.byteLength,k=H&&new DataView(V.buffer).getUint8(H-1);return k?Object($.sliceUint8)(V,0,H-k):V}var F=function(){function V(){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=V.prototype;return H.uint8ArrayToUint32Array_=function(L){for(var y=new DataView(L),v=new Uint32Array(4),p=0;p<4;p++)v[p]=y.getUint32(p*4);return v},H.initTable=function(){var L=this.sBox,y=this.invSBox,v=this.subMix,p=v[0],c=v[1],h=v[2],d=v[3],l=this.invSubMix,s=l[0],u=l[1],f=l[2],O=l[3],x=new Uint32Array(256),w=0,A=0,R=0;for(R=0;R<256;R++)R<128?x[R]=R<<1:x[R]=R<<1^283;for(R=0;R<256;R++){var T=A^A<<1^A<<2^A<<3^A<<4;T=T>>>8^T&255^99,L[w]=T,y[T]=w;var E=x[w],g=x[E],a=x[g],m=x[T]*257^T*16843008;p[w]=m<<24|m>>>8,c[w]=m<<16|m>>>16,h[w]=m<<8|m>>>24,d[w]=m,m=a*16843009^g*65537^E*257^w*16843008,s[T]=m<<24|m>>>8,u[T]=m<<16|m>>>16,f[T]=m<<8|m>>>24,O[T]=m,w?(w=E^x[x[x[a^E]]],A^=x[x[A]]):w=A=1}},H.expandKey=function(L){for(var y=this.uint8ArrayToUint32Array_(L),v=!0,p=0;p<y.length&&v;)v=y[p]===this.key[p],p++;if(v)return;this.key=y;var c=this.keySize=y.length;if(c!==4&&c!==6&&c!==8)throw new Error("Invalid aes key size="+c);var h=this.ksRows=(c+6+1)*4,d,l,s=this.keySchedule=new Uint32Array(h),u=this.invKeySchedule=new Uint32Array(h),f=this.sBox,O=this.rcon,x=this.invSubMix,w=x[0],A=x[1],R=x[2],T=x[3],E,g;for(d=0;d<h;d++){if(d<c){E=s[d]=y[d];continue}g=E,d%c===0?(g=g<<8|g>>>24,g=f[g>>>24]<<24|f[g>>>16&255]<<16|f[g>>>8&255]<<8|f[g&255],g^=O[d/c|0]<<24):c>6&&d%c===4&&(g=f[g>>>24]<<24|f[g>>>16&255]<<16|f[g>>>8&255]<<8|f[g&255]),s[d]=E=(s[d-c]^g)>>>0}for(l=0;l<h;l++)d=h-l,l&3?g=s[d]:g=s[d-4],l<4||d<=4?u[l]=g:u[l]=w[f[g>>>24]]^A[f[g>>>16&255]]^R[f[g>>>8&255]]^T[f[g&255]],u[l]=u[l]>>>0},H.networkToHostOrderSwap=function(L){return L<<24|(L&65280)<<8|(L&16711680)>>8|L>>>24},H.decrypt=function(L,y,v){for(var p=this.keySize+6,c=this.invKeySchedule,h=this.invSBox,d=this.invSubMix,l=d[0],s=d[1],u=d[2],f=d[3],O=this.uint8ArrayToUint32Array_(v),x=O[0],w=O[1],A=O[2],R=O[3],T=new Int32Array(L),E=new Int32Array(T.length),g,a,m,r,b,P,M,W,X,U,S,B,J,te,ae=this.networkToHostOrderSwap;y<T.length;){for(X=ae(T[y]),U=ae(T[y+1]),S=ae(T[y+2]),B=ae(T[y+3]),b=X^c[0],P=B^c[1],M=S^c[2],W=U^c[3],J=4,te=1;te<p;te++)g=l[b>>>24]^s[P>>16&255]^u[M>>8&255]^f[W&255]^c[J],a=l[P>>>24]^s[M>>16&255]^u[W>>8&255]^f[b&255]^c[J+1],m=l[M>>>24]^s[W>>16&255]^u[b>>8&255]^f[P&255]^c[J+2],r=l[W>>>24]^s[b>>16&255]^u[P>>8&255]^f[M&255]^c[J+3],b=g,P=a,M=m,W=r,J=J+4;g=h[b>>>24]<<24^h[P>>16&255]<<16^h[M>>8&255]<<8^h[W&255]^c[J],a=h[P>>>24]<<24^h[M>>16&255]<<16^h[W>>8&255]<<8^h[b&255]^c[J+1],m=h[M>>>24]<<24^h[W>>16&255]<<16^h[b>>8&255]<<8^h[P&255]^c[J+2],r=h[W>>>24]<<24^h[b>>16&255]<<16^h[P>>8&255]<<8^h[M&255]^c[J+3],E[y]=ae(g^x),E[y+1]=ae(r^w),E[y+2]=ae(m^A),E[y+3]=ae(a^R),x=X,w=U,A=S,R=B,y=y+4}return E.buffer},V}()},"./src/crypt/decrypter.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return y});var $=D("./src/crypt/aes-crypto.ts"),j=D("./src/crypt/fast-aes-key.ts"),F=D("./src/crypt/aes-decryptor.ts"),V=D("./src/utils/logger.ts"),H=D("./src/utils/mp4-tools.ts"),k=D("./src/utils/typed-array.ts"),L=16,y=function(){function v(c,h,d){var l=d===void 0?{}:d,s=l.removePKCS7Padding,u=s===void 0?!0:s;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=c,this.config=h,this.removePKCS7Padding=u,u)try{var f=self.crypto;f&&(this.subtle=f.subtle||f.webkitSubtle)}catch(O){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var p=v.prototype;return p.destroy=function(){this.observer=null},p.isSync=function(){return this.config.enableSoftwareAES},p.flush=function(){var h=this.currentResult;if(!h){this.reset();return}var d=new Uint8Array(h);return this.reset(),this.removePKCS7Padding?Object(F.removePadding)(d):d},p.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},p.decrypt=function(h,d,l,s){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(h),d,l);var u=this.flush();u&&s(u.buffer)}else this.webCryptoDecrypt(new Uint8Array(h),d,l).then(s)},p.softwareDecrypt=function(h,d,l){var s=this.currentIV,u=this.currentResult,f=this.remainderData;this.logOnce("JS AES decrypt"),f&&(h=Object(H.appendUint8Array)(f,h),this.remainderData=null);var O=this.getValidChunk(h);if(!O.length)return null;s&&(l=s);var x=this.softwareDecrypter;x||(x=this.softwareDecrypter=new F.default),x.expandKey(d);var w=u;return this.currentResult=x.decrypt(O.buffer,0,l),this.currentIV=Object(k.sliceUint8)(O,-16).buffer,w||null},p.webCryptoDecrypt=function(h,d,l){var s=this,u=this.subtle;return(this.key!==d||!this.fastAesKey)&&(this.key=d,this.fastAesKey=new j.default(u,d)),this.fastAesKey.expandKey().then(function(f){if(!u)return Promise.reject(new Error("web crypto not initialized"));var O=new $.default(u,l);return O.decrypt(h.buffer,f)}).catch(function(f){return s.onWebCryptoError(f,h,d,l)})},p.onWebCryptoError=function(h,d,l,s){return V.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",h),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(d,l,s)},p.getValidChunk=function(h){var d=h,l=h.length-h.length%L;return l!==h.length&&(d=Object(k.sliceUint8)(h,0,l),this.remainderData=Object(k.sliceUint8)(h,l)),d},p.logOnce=function(h){if(!this.logEnabled)return;V.logger.log("[decrypter.ts]: "+h),this.logEnabled=!1},v}()},"./src/crypt/fast-aes-key.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return $});var $=function(){function j(V,H){this.subtle=void 0,this.key=void 0,this.subtle=V,this.key=H}var F=j.prototype;return F.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},j}()},"./src/demux/aacdemuxer.ts":function(oe,Z,D){"use strict";D.r(Z);var $=D("./src/demux/base-audio-demuxer.ts"),j=D("./src/demux/adts.ts"),F=D("./src/utils/logger.ts"),V=D("./src/demux/id3.ts");function H(y,v){y.prototype=Object.create(v.prototype),y.prototype.constructor=y,k(y,v)}function k(y,v){return k=Object.setPrototypeOf||function(c,h){return c.__proto__=h,c},k(y,v)}var L=function(y){H(v,y);function v(c,h){var d;return d=y.call(this)||this,d.observer=void 0,d.config=void 0,d.observer=c,d.config=h,d}var p=v.prototype;return p.resetInitSegment=function(h,d,l){y.prototype.resetInitSegment.call(this,h,d,l),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:h,duration:l,inputTimeScale:9e4,dropped:0}},v.probe=function(h){if(!h)return!1;for(var d=V.getID3Data(h,0)||[],l=d.length,s=h.length;l<s;l++)if(j.probe(h,l))return F.logger.log("ADTS sync word found !"),!0;return!1},p.canParse=function(h,d){return j.canParse(h,d)},p.appendFrame=function(h,d,l){j.initTrackConfig(h,this.observer,d,l,h.manifestCodec);var s=j.appendFrame(h,d,l,this.initPTS,this.frameIndex);if(s&&s.missing===0)return s},v}($.default);L.minProbeByteLength=9,Z.default=L},"./src/demux/adts.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"getAudioConfig",function(){return V}),D.d(Z,"isHeaderPattern",function(){return H}),D.d(Z,"getHeaderLength",function(){return k}),D.d(Z,"getFullFrameLength",function(){return L}),D.d(Z,"canGetFrameLength",function(){return y}),D.d(Z,"isHeader",function(){return v}),D.d(Z,"canParse",function(){return p}),D.d(Z,"probe",function(){return c}),D.d(Z,"initTrackConfig",function(){return h}),D.d(Z,"getFrameDuration",function(){return d}),D.d(Z,"parseFrameHeader",function(){return l}),D.d(Z,"appendFrame",function(){return s});var $=D("./src/utils/logger.ts"),j=D("./src/errors.ts"),F=D("./src/events.ts");function V(u,f,O,x){var w,A,R,T,E=navigator.userAgent.toLowerCase(),g=x,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];w=((f[O+2]&192)>>>6)+1;var m=(f[O+2]&60)>>>2;if(m>a.length-1){u.trigger(F.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+m});return}return R=(f[O+2]&1)<<2,R|=(f[O+3]&192)>>>6,$.logger.log("manifest codec:"+x+", ADTS type:"+w+", samplingIndex:"+m),/firefox/i.test(E)?m>=6?(w=5,T=new Array(4),A=m-3):(w=2,T=new Array(2),A=m):E.indexOf("android")!==-1?(w=2,T=new Array(2),A=m):(w=5,T=new Array(4),x&&(x.indexOf("mp4a.40.29")!==-1||x.indexOf("mp4a.40.5")!==-1)||!x&&m>=6?A=m-3:((x&&x.indexOf("mp4a.40.2")!==-1&&(m>=6&&R===1||/vivaldi/i.test(E))||!x&&R===1)&&(w=2,T=new Array(2)),A=m)),T[0]=w<<3,T[0]|=(m&14)>>1,T[1]|=(m&1)<<7,T[1]|=R<<3,w===5&&(T[1]|=(A&14)>>1,T[2]=(A&1)<<7,T[2]|=2<<2,T[3]=0),{config:T,samplerate:a[m],channelCount:R,codec:"mp4a.40."+w,manifestCodec:g}}function H(u,f){return u[f]===255&&(u[f+1]&246)===240}function k(u,f){return u[f+1]&1?7:9}function L(u,f){return(u[f+3]&3)<<11|u[f+4]<<3|(u[f+5]&224)>>>5}function y(u,f){return f+5<u.length}function v(u,f){return f+1<u.length&&H(u,f)}function p(u,f){return y(u,f)&&H(u,f)&&L(u,f)<=u.length-f}function c(u,f){if(v(u,f)){var O=k(u,f);if(f+O>=u.length)return!1;var x=L(u,f);if(x<=O)return!1;var w=f+x;return w===u.length||v(u,w)}return!1}function h(u,f,O,x,w){if(!u.samplerate){var A=V(f,O,x,w);if(!A)return;u.config=A.config,u.samplerate=A.samplerate,u.channelCount=A.channelCount,u.codec=A.codec,u.manifestCodec=A.manifestCodec,$.logger.log("parsed codec:"+u.codec+", rate:"+A.samplerate+", channels:"+A.channelCount)}}function d(u){return 1024*9e4/u}function l(u,f,O,x,w){var A=k(u,f),R=L(u,f);if(R-=A,R>0){var T=O+x*w;return{headerLength:A,frameLength:R,stamp:T}}}function s(u,f,O,x,w){var A=d(u.samplerate),R=l(f,O,x,w,A);if(R){var T=R.frameLength,E=R.headerLength,g=R.stamp,a=E+T,m=Math.max(0,O+a-f.length),r;m?(r=new Uint8Array(a-E),r.set(f.subarray(O+E,f.length),0)):r=f.subarray(O+E,O+a);var b={unit:r,pts:g};return m||u.samples.push(b),{sample:b,length:a,missing:m}}}},"./src/demux/base-audio-demuxer.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"initPTSFn",function(){return L});var $=D("./src/polyfills/number.ts"),j=D("./src/demux/id3.ts"),F=D("./src/demux/dummy-demuxed-track.ts"),V=D("./src/utils/mp4-tools.ts"),H=D("./src/utils/typed-array.ts"),k=function(){function y(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var v=y.prototype;return v.resetInitSegment=function(c,h,d){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},v.resetTimeStamp=function(){},v.resetContiguity=function(){},v.canParse=function(c,h){return!1},v.appendFrame=function(c,h,d){},v.demux=function(c,h){this.cachedData&&(c=Object(V.appendUint8Array)(this.cachedData,c),this.cachedData=null);var d=j.getID3Data(c,0),l=d?d.length:0,s,u,f=this._audioTrack,O=this._id3Track,x=d?j.getTimeStamp(d):void 0,w=c.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=L(x,h)),d&&d.length>0&&O.samples.push({pts:this.initPTS,dts:this.initPTS,data:d}),u=this.initPTS;l<w;){if(this.canParse(c,l)){var A=this.appendFrame(f,c,l);A?(this.frameIndex++,u=A.sample.pts,l+=A.length,s=l):l=w}else j.canParse(c,l)?(d=j.getID3Data(c,l),O.samples.push({pts:u,dts:u,data:d}),l+=d.length,s=l):l++;if(l===w&&s!==w){var R=Object(H.sliceUint8)(c,s);this.cachedData?this.cachedData=Object(V.appendUint8Array)(this.cachedData,R):this.cachedData=R}}return{audioTrack:f,avcTrack:Object(F.dummyTrack)(),id3Track:O,textTrack:Object(F.dummyTrack)()}},v.demuxSampleAes=function(c,h,d){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},v.flush=function(c){var h=this.cachedData;return h&&(this.cachedData=null,this.demux(h,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(F.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(F.dummyTrack)()}},v.destroy=function(){},y}(),L=function(v,p){return Object($.isFiniteNumber)(v)?v*90:p*9e4};Z.default=k},"./src/demux/chunk-cache.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return $});var $=function(){function F(){this.chunks=[],this.dataLength=0}var V=F.prototype;return V.push=function(k){this.chunks.push(k),this.dataLength+=k.length},V.flush=function(){var k=this.chunks,L=this.dataLength,y;if(k.length)k.length===1?y=k[0]:y=j(k,L);else return new Uint8Array(0);return this.reset(),y},V.reset=function(){this.chunks.length=0,this.dataLength=0},F}();function j(F,V){for(var H=new Uint8Array(V),k=0,L=0;L<F.length;L++){var y=F[L];H.set(y,k),k+=y.length}return H}},"./src/demux/dummy-demuxed-track.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"dummyTrack",function(){return $});function $(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(oe,Z,D){"use strict";D.r(Z);var $=D("./src/utils/logger.ts"),j=function(){function F(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 V=F.prototype;return V.loadWord=function(){var k=this.data,L=this.bytesAvailable,y=k.byteLength-L,v=new Uint8Array(4),p=Math.min(4,L);if(p===0)throw new Error("no bytes available");v.set(k.subarray(y,y+p)),this.word=new DataView(v.buffer).getUint32(0),this.bitsAvailable=p*8,this.bytesAvailable-=p},V.skipBits=function(k){var L;this.bitsAvailable>k?(this.word<<=k,this.bitsAvailable-=k):(k-=this.bitsAvailable,L=k>>3,k-=L>>3,this.bytesAvailable-=L,this.loadWord(),this.word<<=k,this.bitsAvailable-=k)},V.readBits=function(k){var L=Math.min(this.bitsAvailable,k),y=this.word>>>32-L;return k>32&&$.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=L,this.bitsAvailable>0?this.word<<=L:this.bytesAvailable>0&&this.loadWord(),L=k-L,L>0&&this.bitsAvailable?y<<L|this.readBits(L):y},V.skipLZ=function(){var k;for(k=0;k<this.bitsAvailable;++k)if((this.word&2147483648>>>k)!==0)return this.word<<=k,this.bitsAvailable-=k,k;return this.loadWord(),k+this.skipLZ()},V.skipUEG=function(){this.skipBits(1+this.skipLZ())},V.skipEG=function(){this.skipBits(1+this.skipLZ())},V.readUEG=function(){var k=this.skipLZ();return this.readBits(k+1)-1},V.readEG=function(){var k=this.readUEG();return 1&k?1+k>>>1:-1*(k>>>1)},V.readBoolean=function(){return this.readBits(1)===1},V.readUByte=function(){return this.readBits(8)},V.readUShort=function(){return this.readBits(16)},V.readUInt=function(){return this.readBits(32)},V.skipScalingList=function(k){for(var L=8,y=8,v,p=0;p<k;p++)y!==0&&(v=this.readEG(),y=(L+v+256)%256),L=y===0?L:y},V.readSPS=function(){var k=0,L=0,y=0,v=0,p,c,h,d=this.readUByte.bind(this),l=this.readBits.bind(this),s=this.readUEG.bind(this),u=this.readBoolean.bind(this),f=this.skipBits.bind(this),O=this.skipEG.bind(this),x=this.skipUEG.bind(this),w=this.skipScalingList.bind(this);d();var A=d();if(l(5),f(3),d(),x(),A===100||A===110||A===122||A===244||A===44||A===83||A===86||A===118||A===128){var R=s();if(R===3&&f(1),x(),x(),f(1),u())for(c=R!==3?8:12,h=0;h<c;h++)u()&&(h<6?w(16):w(64))}x();var T=s();if(T===0)s();else if(T===1)for(f(1),O(),O(),p=s(),h=0;h<p;h++)O();x(),f(1);var E=s(),g=s(),a=l(1);a===0&&f(1),f(1),u()&&(k=s(),L=s(),y=s(),v=s());var m=[1,1];if(u()&&u()){var r=d();switch(r){case 1:m=[1,1];break;case 2:m=[12,11];break;case 3:m=[10,11];break;case 4:m=[16,11];break;case 5:m=[40,33];break;case 6:m=[24,11];break;case 7:m=[20,11];break;case 8:m=[32,11];break;case 9:m=[80,33];break;case 10:m=[18,11];break;case 11:m=[15,11];break;case 12:m=[64,33];break;case 13:m=[160,99];break;case 14:m=[4,3];break;case 15:m=[3,2];break;case 16:m=[2,1];break;case 255:{m=[d()<<8|d(),d()<<8|d()];break}}}return{width:Math.ceil((E+1)*16-k*2-L*2),height:(2-a)*(g+1)*16-(a?2:4)*(y+v),pixelRatio:m}},V.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},F}();Z.default=j},"./src/demux/id3.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"isHeader",function(){return $}),D.d(Z,"isFooter",function(){return j}),D.d(Z,"getID3Data",function(){return F}),D.d(Z,"canParse",function(){return H}),D.d(Z,"getTimeStamp",function(){return k}),D.d(Z,"isTimeStampFrame",function(){return L}),D.d(Z,"getID3Frames",function(){return v}),D.d(Z,"decodeFrame",function(){return p}),D.d(Z,"utf8ArrayToStr",function(){return s}),D.d(Z,"testables",function(){return u});var $=function(w,A){return A+10<=w.length&&(w[A]===73&&w[A+1]===68&&w[A+2]===51&&(w[A+3]<255&&w[A+4]<255&&(w[A+6]<128&&w[A+7]<128&&w[A+8]<128&&w[A+9]<128)))},j=function(w,A){return A+10<=w.length&&(w[A]===51&&w[A+1]===68&&w[A+2]===73&&(w[A+3]<255&&w[A+4]<255&&(w[A+6]<128&&w[A+7]<128&&w[A+8]<128&&w[A+9]<128)))},F=function(w,A){for(var R=A,T=0;$(w,A);){T+=10;var E=V(w,A+6);T+=E,j(w,A+10)&&(T+=10),A+=T}return T>0?w.subarray(R,R+T):void 0},V=function(w,A){var R=0;return R=(w[A]&127)<<21,R|=(w[A+1]&127)<<14,R|=(w[A+2]&127)<<7,R|=w[A+3]&127,R},H=function(w,A){return $(w,A)&&V(w,A+6)+10<=w.length-A},k=function(w){for(var A=v(w),R=0;R<A.length;R++){var T=A[R];if(L(T))return l(T)}return},L=function(w){return w&&w.key==="PRIV"&&w.info==="com.apple.streaming.transportStreamTimestamp"},y=function(w){var A=String.fromCharCode(w[0],w[1],w[2],w[3]),R=V(w,4),T=10;return{type:A,size:R,data:w.subarray(T,T+R)}},v=function(w){for(var A=0,R=[];$(w,A);){var T=V(w,A+6);A+=10;for(var E=A+T;A+8<E;){var g=y(w.subarray(A)),a=p(g);a&&R.push(a),A+=g.size+10}j(w,A)&&(A+=10)}return R},p=function(w){return w.type==="PRIV"?c(w):w.type[0]==="W"?d(w):h(w)},c=function(w){if(w.size<2)return;var A=s(w.data,!0),R=new Uint8Array(w.data.subarray(A.length+1));return{key:w.type,info:A,data:R.buffer}},h=function(w){if(w.size<2)return;if(w.type==="TXXX"){var A=1,R=s(w.data.subarray(A),!0);A+=R.length+1;var T=s(w.data.subarray(A));return{key:w.type,info:R,data:T}}var E=s(w.data.subarray(1));return{key:w.type,data:E}},d=function(w){if(w.type==="WXXX"){if(w.size<2)return;var A=1,R=s(w.data.subarray(A),!0);A+=R.length+1;var T=s(w.data.subarray(A));return{key:w.type,info:R,data:T}}var E=s(w.data);return{key:w.type,data:E}},l=function(w){if(w.data.byteLength===8){var A=new Uint8Array(w.data),R=A[3]&1,T=(A[4]<<23)+(A[5]<<15)+(A[6]<<7)+A[7];return T/=45,R&&(T+=4772185884e-2),Math.round(T)}return},s=function(w,A){A===void 0&&(A=!1);var R=O();if(R){var T=R.decode(w);if(A){var E=T.indexOf("\0");return E!==-1?T.substring(0,E):T}return T.replace(/\0/g,"")}for(var g=w.length,a,m,r,b="",P=0;P<g;){if(a=w[P++],a===0&&A)return b;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:b+=String.fromCharCode(a);break;case 12:case 13:m=w[P++],b+=String.fromCharCode((a&31)<<6|m&63);break;case 14:m=w[P++],r=w[P++],b+=String.fromCharCode((a&15)<<12|(m&63)<<6|(r&63)<<0);break;default:}}return b},u={decodeTextFrame:h},f;function O(){return!f&&typeof self.TextDecoder!="undefined"&&(f=new self.TextDecoder("utf-8")),f}},"./src/demux/mp3demuxer.ts":function(oe,Z,D){"use strict";D.r(Z);var $=D("./src/demux/base-audio-demuxer.ts"),j=D("./src/demux/id3.ts"),F=D("./src/utils/logger.ts"),V=D("./src/demux/mpegaudio.ts");function H(y,v){y.prototype=Object.create(v.prototype),y.prototype.constructor=y,k(y,v)}function k(y,v){return k=Object.setPrototypeOf||function(c,h){return c.__proto__=h,c},k(y,v)}var L=function(y){H(v,y);function v(){return y.apply(this,arguments)||this}var p=v.prototype;return p.resetInitSegment=function(h,d,l){y.prototype.resetInitSegment.call(this,h,d,l),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:h,duration:l,inputTimeScale:9e4,dropped:0}},v.probe=function(h){if(!h)return!1;for(var d=j.getID3Data(h,0)||[],l=d.length,s=h.length;l<s;l++)if(V.probe(h,l))return F.logger.log("MPEG Audio sync word found !"),!0;return!1},p.canParse=function(h,d){return V.canParse(h,d)},p.appendFrame=function(h,d,l){return this.initPTS===null?void 0:V.appendFrame(h,d,l,this.initPTS,this.frameIndex)},v}($.default);L.minProbeByteLength=4,Z.default=L},"./src/demux/mp4demuxer.ts":function(oe,Z,D){"use strict";D.r(Z);var $=D("./src/utils/mp4-tools.ts"),j=D("./src/demux/dummy-demuxed-track.ts"),F=function(){function V(k,L){this.remainderData=null,this.config=void 0,this.config=L}var H=V.prototype;return H.resetTimeStamp=function(){},H.resetInitSegment=function(){},H.resetContiguity=function(){},V.probe=function(L){return Object($.findBox)({data:L,start:0,end:Math.min(L.length,16384)},["moof"]).length>0},H.demux=function(L){var y=L,v=Object(j.dummyTrack)();if(this.config.progressive){this.remainderData&&(y=Object($.appendUint8Array)(this.remainderData,L));var p=Object($.segmentValidRange)(y);this.remainderData=p.remainder,v.samples=p.valid||new Uint8Array}else v.samples=y;return{audioTrack:Object(j.dummyTrack)(),avcTrack:v,id3Track:Object(j.dummyTrack)(),textTrack:Object(j.dummyTrack)()}},H.flush=function(){var L=Object(j.dummyTrack)();return L.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(j.dummyTrack)(),avcTrack:L,id3Track:Object(j.dummyTrack)(),textTrack:Object(j.dummyTrack)()}},H.demuxSampleAes=function(L,y,v){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},H.destroy=function(){},V}();F.minProbeByteLength=1024,Z.default=F},"./src/demux/mpegaudio.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"appendFrame",function(){return k}),D.d(Z,"parseHeader",function(){return L}),D.d(Z,"isHeaderPattern",function(){return y}),D.d(Z,"isHeader",function(){return v}),D.d(Z,"canParse",function(){return p}),D.d(Z,"probe",function(){return c});var $=null,j=[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],F=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],V=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],H=[0,1,1,4];function k(h,d,l,s,u){if(l+24>d.length)return;var f=L(d,l);if(f&&l+f.frameLength<=d.length){var O=f.samplesPerFrame*9e4/f.sampleRate,x=s+u*O,w={unit:d.subarray(l,l+f.frameLength),pts:x,dts:x};return h.config=[],h.channelCount=f.channelCount,h.samplerate=f.sampleRate,h.samples.push(w),{sample:w,length:f.frameLength,missing:0}}}function L(h,d){var l=h[d+1]>>3&3,s=h[d+1]>>1&3,u=h[d+2]>>4&15,f=h[d+2]>>2&3;if(l!==1&&u!==0&&u!==15&&f!==3){var O=h[d+2]>>1&1,x=h[d+3]>>6,w=l===3?3-s:s===3?3:4,A=j[w*14+u-1]*1e3,R=l===3?0:l===2?1:2,T=F[R*3+f],E=x===3?1:2,g=V[l][s],a=H[s],m=g*8*a,r=Math.floor(g*A/T+O)*a;if($===null){var b=navigator.userAgent||"",P=b.match(/Chrome\/(\d+)/i);$=P?parseInt(P[1]):0}var M=!!$&&$<=87;return M&&s===2&&A>=224e3&&x===0&&(h[d+3]=h[d+3]|128),{sampleRate:T,channelCount:E,frameLength:r,samplesPerFrame:m}}}function y(h,d){return h[d]===255&&(h[d+1]&224)===224&&(h[d+1]&6)!==0}function v(h,d){return d+1<h.length&&y(h,d)}function p(h,d){var l=4;return y(h,d)&&l<=h.length-d}function c(h,d){if(d+1<h.length&&y(h,d)){var l=4,s=L(h,d),u=l;s!=null&&s.frameLength&&(u=s.frameLength);var f=d+u;return f===h.length||v(h,f)}return!1}},"./src/demux/sample-aes.ts":function(oe,Z,D){"use strict";D.r(Z);var $=D("./src/crypt/decrypter.ts"),j=D("./src/demux/tsdemuxer.ts"),F=function(){function V(k,L,y){this.keyData=void 0,this.decrypter=void 0,this.keyData=y,this.decrypter=new $.default(k,L,{removePKCS7Padding:!1})}var H=V.prototype;return H.decryptBuffer=function(L,y){this.decrypter.decrypt(L,this.keyData.key.buffer,this.keyData.iv.buffer,y)},H.decryptAacSample=function(L,y,v,p){var c=L[y].unit,h=c.subarray(16,c.length-c.length%16),d=h.buffer.slice(h.byteOffset,h.byteOffset+h.length),l=this;this.decryptBuffer(d,function(s){var u=new Uint8Array(s);c.set(u,16),p||l.decryptAacSamples(L,y+1,v)})},H.decryptAacSamples=function(L,y,v){for(;;y++){if(y>=L.length){v();return}if(L[y].unit.length<32)continue;var p=this.decrypter.isSync();if(this.decryptAacSample(L,y,v,p),!p)return}},H.getAvcEncryptedData=function(L){for(var y=Math.floor((L.length-48)/160)*16+16,v=new Int8Array(y),p=0,c=32;c<=L.length-16;c+=160,p+=16)v.set(L.subarray(c,c+16),p);return v},H.getAvcDecryptedUnit=function(L,y){for(var v=new Uint8Array(y),p=0,c=32;c<=L.length-16;c+=160,p+=16)L.set(v.subarray(p,p+16),c);return L},H.decryptAvcSample=function(L,y,v,p,c,h){var d=Object(j.discardEPB)(c.data),l=this.getAvcEncryptedData(d),s=this;this.decryptBuffer(l.buffer,function(u){c.data=s.getAvcDecryptedUnit(d,u),h||s.decryptAvcSamples(L,y,v+1,p)})},H.decryptAvcSamples=function(L,y,v,p){if(L instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;y++,v=0){if(y>=L.length){p();return}for(var c=L[y].units;!(v>=c.length);v++){var h=c[v];if(h.data.length<=48||h.type!==1&&h.type!==5)continue;var d=this.decrypter.isSync();if(this.decryptAvcSample(L,y,v,p,h,d),!d)return}}},V}();Z.default=F},"./src/demux/transmuxer-interface.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return c});var $=D("./node_modules/webworkify-webpack/index.js"),j=D.n($),F=D("./src/events.ts"),V=D("./src/demux/transmuxer.ts"),H=D("./src/utils/logger.ts"),k=D("./src/errors.ts"),L=D("./src/utils/mediasource-helper.ts"),y=D("./node_modules/eventemitter3/index.js"),v=D.n(y),p=Object(L.getMediaSource)()||{isTypeSupported:function(){return!1}},c=function(){function h(l,s,u,f){var O=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=l,this.id=s,this.onTransmuxComplete=u,this.onFlush=f;var x=l.config,w=function(g,a){a=a||{},a.frag=O.frag,a.id=O.id,l.trigger(g,a)};this.observer=new y.EventEmitter,this.observer.on(F.Events.FRAG_DECRYPTED,w),this.observer.on(F.Events.ERROR,w);var A={mp4:p.isTypeSupported("video/mp4"),mpeg:p.isTypeSupported("audio/mpeg"),mp3:p.isTypeSupported('audio/mp4; codecs="mp3"')},R=navigator.vendor;if(x.enableWorker&&typeof Worker!="undefined"){H.logger.log("demuxing in webworker");var T;try{T=this.worker=$("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),T.addEventListener("message",this.onwmsg),T.onerror=function(E){l.trigger(F.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(E.message+" ("+E.filename+":"+E.lineno+")")})},T.postMessage({cmd:"init",typeSupported:A,vendor:R,id:s,config:JSON.stringify(x)})}catch(E){H.logger.warn("Error in worker:",E),H.logger.error("Error while initializing DemuxerWorker, fallback to inline"),T&&self.URL.revokeObjectURL(T.objectURL),this.transmuxer=new V.default(this.observer,A,x,R,s),this.worker=null}}else this.transmuxer=new V.default(this.observer,A,x,R,s)}var d=h.prototype;return d.destroy=function(){var s=this.worker;if(s)s.removeEventListener("message",this.onwmsg),s.terminate(),this.worker=null;else{var u=this.transmuxer;u&&(u.destroy(),this.transmuxer=null)}var f=this.observer;f&&f.removeAllListeners(),this.observer=null},d.push=function(s,u,f,O,x,w,A,R,T,E){var g=this;T.transmuxing.start=self.performance.now();var a=this.transmuxer,m=this.worker,r=w?w.start:x.start,b=x.decryptdata,P=this.frag,M=!(P&&x.cc===P.cc),W=!(P&&T.level===P.level),X=P?T.sn-P.sn:-1,U=this.part?T.part-this.part.index:1,S=!W&&(X===1||X===0&&U===1),B=self.performance.now();(W||X||x.stats.parsing.start===0)&&(x.stats.parsing.start=B),w&&(U||!S)&&(w.stats.parsing.start=B);var J=new V.TransmuxState(M,S,R,W,r);if(!S||M){H.logger.log("[transmuxer-interface, "+x.type+"]: Starting new transmux session for sn: "+T.sn+" p: "+T.part+" level: "+T.level+" id: "+T.id+`
|
|
discontinuity: `+M+`
|
|
trackSwitch: `+W+`
|
|
contiguous: `+S+`
|
|
accurateTimeOffset: `+R+`
|
|
timeOffset: `+r);var te=new V.TransmuxConfig(f,O,u,A,E);this.configureTransmuxer(te)}if(this.frag=x,this.part=w,m)m.postMessage({cmd:"demux",data:s,decryptdata:b,chunkMeta:T,state:J},s instanceof ArrayBuffer?[s]:[]);else if(a){var ae=a.push(s,b,T,J);Object(V.isPromise)(ae)?ae.then(function(_e){g.handleTransmuxComplete(_e)}):this.handleTransmuxComplete(ae)}},d.flush=function(s){var u=this;s.transmuxing.start=self.performance.now();var f=this.transmuxer,O=this.worker;if(O)O.postMessage({cmd:"flush",chunkMeta:s});else if(f){var x=f.flush(s);Object(V.isPromise)(x)?x.then(function(w){u.handleFlushResult(w,s)}):this.handleFlushResult(x,s)}},d.handleFlushResult=function(s,u){var f=this;s.forEach(function(O){f.handleTransmuxComplete(O)}),this.onFlush(u)},d.onWorkerMessage=function(s){var u=s.data,f=this.hls;switch(u.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.id=this.id,f.trigger(u.event,u.data);break}}},d.configureTransmuxer=function(s){var u=this.worker,f=this.transmuxer;u?u.postMessage({cmd:"configure",config:s}):f&&f.configure(s)},d.handleTransmuxComplete=function(s){s.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(s)},h}()},"./src/demux/transmuxer-worker.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return k});var $=D("./src/demux/transmuxer.ts"),j=D("./src/events.ts"),F=D("./src/utils/logger.ts"),V=D("./node_modules/eventemitter3/index.js"),H=D.n(V);function k(c){var h=new V.EventEmitter,d=function(s,u){c.postMessage({event:s,data:u})};h.on(j.Events.FRAG_DECRYPTED,d),h.on(j.Events.ERROR,d),c.addEventListener("message",function(l){var s=l.data;switch(s.cmd){case"init":{var u=JSON.parse(s.config);c.transmuxer=new $.default(h,s.typeSupported,u,s.vendor,s.id),Object(F.enableLogs)(u.debug),d("init",null);break}case"configure":{c.transmuxer.configure(s.config);break}case"demux":{var f=c.transmuxer.push(s.data,s.decryptdata,s.chunkMeta,s.state);Object($.isPromise)(f)?f.then(function(w){L(c,w)}):L(c,f);break}case"flush":{var O=s.chunkMeta,x=c.transmuxer.flush(O);Object($.isPromise)(x)?x.then(function(w){v(c,w,O)}):v(c,x,O);break}default:break}})}function L(c,h){if(p(h.remuxResult))return;var d=[],l=h.remuxResult,s=l.audio,u=l.video;s&&y(d,s),u&&y(d,u),c.postMessage({event:"transmuxComplete",data:h},d)}function y(c,h){h.data1&&c.push(h.data1.buffer),h.data2&&c.push(h.data2.buffer)}function v(c,h,d){h.forEach(function(l){L(c,l)}),c.postMessage({event:"flush",data:d})}function p(c){return!c.audio&&!c.video&&!c.text&&!c.id3&&!c.initSegment}},"./src/demux/transmuxer.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return u}),D.d(Z,"isPromise",function(){return x}),D.d(Z,"TransmuxConfig",function(){return w}),D.d(Z,"TransmuxState",function(){return A});var $=D("./src/events.ts"),j=D("./src/errors.ts"),F=D("./src/crypt/decrypter.ts"),V=D("./src/demux/aacdemuxer.ts"),H=D("./src/demux/mp4demuxer.ts"),k=D("./src/demux/tsdemuxer.ts"),L=D("./src/demux/mp3demuxer.ts"),y=D("./src/remux/mp4-remuxer.ts"),v=D("./src/remux/passthrough-remuxer.ts"),p=D("./src/demux/chunk-cache.ts"),c=D("./src/utils/mp4-tools.ts"),h=D("./src/utils/logger.ts"),d;try{d=self.performance.now.bind(self.performance)}catch(R){h.logger.debug("Unable to use Performance API on this environment"),d=self.Date.now}var l=[{demux:k.default,remux:y.default},{demux:H.default,remux:v.default},{demux:V.default,remux:y.default},{demux:L.default,remux:y.default}],s=1024;l.forEach(function(R){var T=R.demux;s=Math.max(s,T.minProbeByteLength)});var u=function(){function R(E,g,a,m,r){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=E,this.typeSupported=g,this.config=a,this.vendor=m,this.id=r}var T=R.prototype;return T.configure=function(g){this.transmuxConfig=g,this.decrypter&&this.decrypter.reset()},T.push=function(g,a,m,r){var b=this,P=m.transmuxing;P.executeStart=d();var M=new Uint8Array(g),W=this.cache,X=this.config,U=this.currentTransmuxState,S=this.transmuxConfig;r&&(this.currentTransmuxState=r);var B=f(M,a);if(B&&B.method==="AES-128"){var J=this.getDecrypter();if(X.enableSoftwareAES){var te=J.softwareDecrypt(M,B.key.buffer,B.iv.buffer);if(!te)return P.executeEnd=d(),O(m);M=new Uint8Array(te)}else return this.decryptionPromise=J.webCryptoDecrypt(M,B.key.buffer,B.iv.buffer).then(function(Ue){var Ye=b.push(Ue,null,m);return b.decryptionPromise=null,Ye}),this.decryptionPromise}var ae=r||U,_e=ae.contiguous,de=ae.discontinuity,Ee=ae.trackSwitch,Te=ae.accurateTimeOffset,me=ae.timeOffset,ce=S.audioCodec,se=S.videoCodec,Se=S.defaultInitPts,je=S.duration,We=S.initSegmentData;if((de||Ee)&&this.resetInitSegment(We,ce,se,je),de&&this.resetInitialTimestamp(Se),_e||this.resetContiguity(),this.needsProbing(M,de,Ee)){if(W.dataLength){var Xe=W.flush();M=Object(c.appendUint8Array)(Xe,M)}this.configureTransmuxer(M,S)}var Qe=this.transmux(M,B,me,Te,m),Pe=this.currentTransmuxState;return Pe.contiguous=!0,Pe.discontinuity=!1,Pe.trackSwitch=!1,P.executeEnd=d(),Qe},T.flush=function(g){var a=this,m=g.transmuxing;m.executeStart=d();var r=this.decrypter,b=this.cache,P=this.currentTransmuxState,M=this.decryptionPromise;if(M)return M.then(function(){return a.flush(g)});var W=[],X=P.timeOffset;if(r){var U=r.flush();U&&W.push(this.push(U,null,g))}var S=b.dataLength;b.reset();var B=this.demuxer,J=this.remuxer;if(!B||!J)return S>=s&&this.observer.emit($.Events.ERROR,$.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),m.executeEnd=d(),[O(g)];var te=B.flush(X);return x(te)?te.then(function(ae){return a.flushRemux(W,ae,g),W}):(this.flushRemux(W,te,g),W)},T.flushRemux=function(g,a,m){var r=a.audioTrack,b=a.avcTrack,P=a.id3Track,M=a.textTrack,W=this.currentTransmuxState,X=W.accurateTimeOffset,U=W.timeOffset;h.logger.log("[transmuxer.ts]: Flushed fragment "+m.sn+(m.part>-1?" p: "+m.part:"")+" of level "+m.level);var S=this.remuxer.remux(r,b,P,M,U,X,!0,this.id);g.push({remuxResult:S,chunkMeta:m}),m.transmuxing.executeEnd=d()},T.resetInitialTimestamp=function(g){var a=this.demuxer,m=this.remuxer;if(!a||!m)return;a.resetTimeStamp(g),m.resetTimeStamp(g)},T.resetContiguity=function(){var g=this.demuxer,a=this.remuxer;if(!g||!a)return;g.resetContiguity(),a.resetNextTimestamp()},T.resetInitSegment=function(g,a,m,r){var b=this.demuxer,P=this.remuxer;if(!b||!P)return;b.resetInitSegment(a,m,r),P.resetInitSegment(g,a,m)},T.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},T.transmux=function(g,a,m,r,b){var P;return a&&a.method==="SAMPLE-AES"?P=this.transmuxSampleAes(g,a,m,r,b):P=this.transmuxUnencrypted(g,m,r,b),P},T.transmuxUnencrypted=function(g,a,m,r){var b=this.demuxer.demux(g,a,!1,!this.config.progressive),P=b.audioTrack,M=b.avcTrack,W=b.id3Track,X=b.textTrack,U=this.remuxer.remux(P,M,W,X,a,m,!1,this.id);return{remuxResult:U,chunkMeta:r}},T.transmuxSampleAes=function(g,a,m,r,b){var P=this;return this.demuxer.demuxSampleAes(g,a,m).then(function(M){var W=P.remuxer.remux(M.audioTrack,M.avcTrack,M.id3Track,M.textTrack,m,r,!1,P.id);return{remuxResult:W,chunkMeta:b}})},T.configureTransmuxer=function(g,a){for(var m=this.config,r=this.observer,b=this.typeSupported,P=this.vendor,M=a.audioCodec,W=a.defaultInitPts,X=a.duration,U=a.initSegmentData,S=a.videoCodec,B,J=0,te=l.length;J<te;J++)if(l[J].demux.probe(g)){B=l[J];break}B||(h.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),B={demux:H.default,remux:v.default});var ae=this.demuxer,_e=this.remuxer,de=B.remux,Ee=B.demux;(!_e||!(_e instanceof de))&&(this.remuxer=new de(r,m,b,P)),(!ae||!(ae instanceof Ee))&&(this.demuxer=new Ee(r,m,b),this.probe=Ee.probe),this.resetInitSegment(U,M,S,X),this.resetInitialTimestamp(W)},T.needsProbing=function(g,a,m){return!this.demuxer||!this.remuxer||a||m},T.getDecrypter=function(){var g=this.decrypter;return g||(g=this.decrypter=new F.default(this.observer,this.config)),g},R}();function f(R,T){var E=null;return R.byteLength>0&&T!=null&&T.key!=null&&T.iv!==null&&T.method!=null&&(E=T),E}var O=function(T){return{remuxResult:{},chunkMeta:T}};function x(R){return"then"in R&&R.then instanceof Function}var w=function(T,E,g,a,m){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=T,this.videoCodec=E,this.initSegmentData=g,this.duration=a,this.defaultInitPts=m},A=function(T,E,g,a,m){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=T,this.contiguous=E,this.accurateTimeOffset=g,this.trackSwitch=a,this.timeOffset=m}},"./src/demux/tsdemuxer.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"discardEPB",function(){return O});var $=D("./src/demux/adts.ts"),j=D("./src/demux/mpegaudio.ts"),F=D("./src/demux/exp-golomb.ts"),V=D("./src/demux/id3.ts"),H=D("./src/demux/sample-aes.ts"),k=D("./src/events.ts"),L=D("./src/utils/mp4-tools.ts"),y=D("./src/utils/logger.ts"),v=D("./src/errors.ts"),p={video:1,audio:2,id3:3,text:4},c=function(){function x(A,R,T){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=A,this.config=R,this.typeSupported=T}x.probe=function(R){var T=x.syncOffset(R);return T<0?!1:(T&&y.logger.warn("MPEG2-TS detected but first sync word found @ offset "+T+", junk ahead ?"),!0)},x.syncOffset=function(R){for(var T=Math.min(1e3,R.length-3*188),E=0;E<T;){if(R[E]===71&&R[E+188]===71&&R[E+2*188]===71)return E;E++}return-1},x.createTrack=function(R,T){return{container:R==="video"||R==="audio"?"video/mp2t":void 0,type:R,id:p[R],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:R==="audio"?T:void 0}};var w=x.prototype;return w.resetInitSegment=function(R,T,E){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=x.createTrack("video",E),this._audioTrack=x.createTrack("audio",E),this._id3Track=x.createTrack("id3",E),this._txtTrack=x.createTrack("text",E),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=R,this.videoCodec=T,this._duration=E},w.resetTimeStamp=function(){},w.resetContiguity=function(){var R=this._audioTrack,T=this._avcTrack,E=this._id3Track;R&&(R.pesData=null),T&&(T.pesData=null),E&&(E.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},w.demux=function(R,T,E,g){E===void 0&&(E=!1),g===void 0&&(g=!1),E||(this.sampleAes=null);var a,m=this._avcTrack,r=this._audioTrack,b=this._id3Track,P=m.pid,M=m.pesData,W=r.pid,X=b.pid,U=r.pesData,S=b.pesData,B=!1,J=this.pmtParsed,te=this._pmtId,ae=R.length;if(this.remainderData&&(R=Object(L.appendUint8Array)(this.remainderData,R),ae=R.length,this.remainderData=null),ae<188&&!g)return this.remainderData=R,{audioTrack:r,avcTrack:m,id3Track:b,textTrack:this._txtTrack};var _e=Math.max(0,x.syncOffset(R));ae-=(ae+_e)%188,ae<R.byteLength&&!g&&(this.remainderData=new Uint8Array(R.buffer,ae,R.buffer.byteLength-ae));for(var de=_e;de<ae;de+=188)if(R[de]===71){var Ee=!!(R[de+1]&64),Te=((R[de+1]&31)<<8)+R[de+2],me=(R[de+3]&48)>>4,ce=void 0;if(me>1){if(ce=de+5+R[de+4],ce===de+188)continue}else ce=de+4;switch(Te){case P:Ee&&(M&&(a=s(M))&&this.parseAVCPES(a,!1),M={data:[],size:0}),M&&(M.data.push(R.subarray(ce,de+188)),M.size+=de+188-ce);break;case W:Ee&&(U&&(a=s(U))&&(r.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),U={data:[],size:0}),U&&(U.data.push(R.subarray(ce,de+188)),U.size+=de+188-ce);break;case X:Ee&&(S&&(a=s(S))&&this.parseID3PES(a),S={data:[],size:0}),S&&(S.data.push(R.subarray(ce,de+188)),S.size+=de+188-ce);break;case 0:Ee&&(ce+=R[ce]+1),te=this._pmtId=d(R,ce);break;case te:{Ee&&(ce+=R[ce]+1);var se=l(R,ce,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,E);P=se.avc,P>0&&(m.pid=P),W=se.audio,W>0&&(r.pid=W,r.isAAC=se.isAAC),X=se.id3,X>0&&(b.pid=X),B&&!J&&(y.logger.log("reparse from beginning"),B=!1,de=_e-188),J=this.pmtParsed=!0;break}case 17:case 8191:break;default:B=!0;break}}else this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});m.pesData=M,r.pesData=U,b.pesData=S;var Se={audioTrack:r,avcTrack:m,id3Track:b,textTrack:this._txtTrack};return g&&this.extractRemainingSamples(Se),Se},w.flush=function(){var R=this.remainderData;this.remainderData=null;var T;return R?T=this.demux(R,-1,!1,!0):T={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(T),this.sampleAes?this.decrypt(T,this.sampleAes):T},w.extractRemainingSamples=function(R){var T=R.audioTrack,E=R.avcTrack,g=R.id3Track,a=E.pesData,m=T.pesData,r=g.pesData,b;a&&(b=s(a))?(this.parseAVCPES(b,!0),E.pesData=null):E.pesData=a,m&&(b=s(m))?(T.isAAC?this.parseAACPES(b):this.parseMPEGPES(b),T.pesData=null):(m!=null&&m.size&&y.logger.log("last AAC PES packet truncated,might overlap between fragments"),T.pesData=m),r&&(b=s(r))?(this.parseID3PES(b),g.pesData=null):g.pesData=r},w.demuxSampleAes=function(R,T,E){var g=this.demux(R,E,!0,!this.config.progressive),a=this.sampleAes=new H.default(this.observer,this.config,T);return this.decrypt(g,a)},w.decrypt=function(R,T){return new Promise(function(E){var g=R.audioTrack,a=R.avcTrack;g.samples&&g.isAAC?T.decryptAacSamples(g.samples,0,function(){a.samples?T.decryptAvcSamples(a.samples,0,0,function(){E(R)}):E(R)}):a.samples&&T.decryptAvcSamples(a.samples,0,0,function(){E(R)})})},w.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},w.parseAVCPES=function(R,T){var E=this,g=this._avcTrack,a=this.parseAVCNALu(R.data),m=!1,r=this.avcSample,b,P=!1;R.data=null,r&&a.length&&!g.audFound&&(u(r,g),r=this.avcSample=h(!1,R.pts,R.dts,"")),a.forEach(function(M){switch(M.type){case 1:{b=!0,r||(r=E.avcSample=h(!0,R.pts,R.dts,"")),m&&(r.debug+="NDR "),r.frame=!0;var W=M.data;if(P&&W.length>4){var X=new F.default(W).readSliceType();(X===2||X===4||X===7||X===9)&&(r.key=!0)}break}case 5:b=!0,r||(r=E.avcSample=h(!0,R.pts,R.dts,"")),m&&(r.debug+="IDR "),r.key=!0,r.frame=!0;break;case 6:{b=!0,m&&r&&(r.debug+="SEI ");var U=new F.default(O(M.data));U.readUByte();for(var S=0,B=0,J=!1,te=0;!J&&U.bytesAvailable>1;){S=0;do te=U.readUByte(),S+=te;while(te===255);B=0;do te=U.readUByte(),B+=te;while(te===255);if(S===4&&U.bytesAvailable!==0){J=!0;var ae=U.readUByte();if(ae===181){var _e=U.readUShort();if(_e===49){var de=U.readUInt();if(de===1195456820){var Ee=U.readUByte();if(Ee===3){for(var Te=U.readUByte(),me=U.readUByte(),ce=31&Te,se=[Te,me],Se=0;Se<ce;Se++)se.push(U.readUByte()),se.push(U.readUByte()),se.push(U.readUByte());f(E._txtTrack.samples,{type:3,pts:R.pts,bytes:se})}}}}}else if(S===5&&U.bytesAvailable!==0){if(J=!0,B>16){for(var je=[],We=0;We<16;We++)je.push(U.readUByte().toString(16)),(We===3||We===5||We===7||We===9)&&je.push("-");for(var Xe=B-16,Qe=new Uint8Array(Xe),Pe=0;Pe<Xe;Pe++)Qe[Pe]=U.readUByte();f(E._txtTrack.samples,{pts:R.pts,payloadType:S,uuid:je.join(""),userData:Object(V.utf8ArrayToStr)(Qe),userDataBytes:Qe})}}else if(B<U.bytesAvailable)for(var Ue=0;Ue<B;Ue++)U.readUByte()}break}case 7:if(b=!0,P=!0,m&&r&&(r.debug+="SPS "),!g.sps){var Ye=new F.default(M.data),Ze=Ye.readSPS();g.width=Ze.width,g.height=Ze.height,g.pixelRatio=Ze.pixelRatio,g.sps=[M.data],g.duration=E._duration;for(var Ve=M.data.subarray(1,4),He="avc1.",Fe=0;Fe<3;Fe++){var ft=Ve[Fe].toString(16);ft.length<2&&(ft="0"+ft),He+=ft}g.codec=He}break;case 8:b=!0,m&&r&&(r.debug+="PPS "),g.pps||(g.pps=[M.data]);break;case 9:b=!1,g.audFound=!0,r&&u(r,g),r=E.avcSample=h(!1,R.pts,R.dts,m?"AUD ":"");break;case 12:b=!1;break;default:b=!1,r&&(r.debug+="unknown NAL "+M.type+" ");break}if(r&&b){var lt=r.units;lt.push(M)}}),T&&r&&(u(r,g),this.avcSample=null)},w.getLastNalUnit=function(){var R,T=this.avcSample,E;if(!T||T.units.length===0){var g=this._avcTrack.samples;T=g[g.length-1]}if((R=T)!==null&&R!==void 0&&R.units){var a=T.units;E=a[a.length-1]}return E},w.parseAVCNALu=function(R){var T=R.byteLength,E=this._avcTrack,g=E.naluState||0,a=g,m=[],r=0,b,P,M,W=-1,X=0;for(g===-1&&(W=0,X=R[0]&31,g=0,r=1);r<T;){if(b=R[r++],!g){g=b?0:1;continue}if(g===1){g=b?0:2;continue}if(!b)g=3;else if(b===1){if(W>=0){var U={data:R.subarray(W,r-g-1),type:X};m.push(U)}else{var S=this.getLastNalUnit();if(S&&(a&&r<=4-a&&(S.state&&(S.data=S.data.subarray(0,S.data.byteLength-a))),P=r-g-1,P>0)){var B=new Uint8Array(S.data.byteLength+P);B.set(S.data,0),B.set(R.subarray(0,P),S.data.byteLength),S.data=B,S.state=0}}r<T?(M=R[r]&31,W=r,X=M,g=0):g=-1}else g=0}if(W>=0&&g>=0){var J={data:R.subarray(W,T),type:X,state:g};m.push(J)}if(m.length===0){var te=this.getLastNalUnit();if(te){var ae=new Uint8Array(te.data.byteLength+R.byteLength);ae.set(te.data,0),ae.set(R,te.data.byteLength),te.data=ae}}return E.naluState=g,m},w.parseAACPES=function(R){var T=0,E=this._audioTrack,g=this.aacOverFlow,a=R.data;if(g){this.aacOverFlow=null;var m=g.sample.unit.byteLength,r=Math.min(g.missing,m),b=m-r;g.sample.unit.set(a.subarray(0,r),b),E.samples.push(g.sample),T=g.missing}var P,M;for(P=T,M=a.length;P<M-1&&!$.isHeader(a,P);P++);if(P!==T){var W,X;if(P<M-1?(W="AAC PES did not start with ADTS header,offset:"+P,X=!1):(W="no ADTS header found in AAC PES",X=!0),y.logger.warn("parsing error:"+W),this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.FRAG_PARSING_ERROR,fatal:X,reason:W}),X)return}$.initTrackConfig(E,this.observer,a,P,this.audioCodec);var U;if(R.pts!==void 0)U=R.pts;else if(g){var S=$.getFrameDuration(E.samplerate);U=g.sample.pts+S}else{y.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var B=0;P<M;)if($.isHeader(a,P)){if(P+5<M){var J=$.appendFrame(E,a,P,U,B);if(J)if(J.missing)this.aacOverFlow=J;else{P+=J.length,B++;continue}}break}else P++},w.parseMPEGPES=function(R){var T=R.data,E=T.length,g=0,a=0,m=R.pts;if(m===void 0){y.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<E;)if(j.isHeader(T,a)){var r=j.appendFrame(this._audioTrack,T,a,m,g);if(r)a+=r.length,g++;else break}else a++},w.parseID3PES=function(R){if(R.pts===void 0){y.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(R)},x}();c.minProbeByteLength=188;function h(x,w,A,R){return{key:x,frame:!1,pts:w,dts:A,units:[],debug:R,length:0}}function d(x,w){return(x[w+10]&31)<<8|x[w+11]}function l(x,w,A,R){var T={audio:-1,avc:-1,id3:-1,isAAC:!0},E=(x[w+1]&15)<<8|x[w+2],g=w+3+E-4,a=(x[w+10]&15)<<8|x[w+11];for(w+=12+a;w<g;){var m=(x[w+1]&31)<<8|x[w+2];switch(x[w]){case 207:if(!R){y.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:T.audio===-1&&(T.audio=m);break;case 21:T.id3===-1&&(T.id3=m);break;case 219:if(!R){y.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:T.avc===-1&&(T.avc=m);break;case 3:case 4:A?T.audio===-1&&(T.audio=m,T.isAAC=!1):y.logger.log("MPEG audio found, not supported in this browser");break;case 36:y.logger.warn("Unsupported HEVC stream type found");break;default:break}w+=((x[w+3]&15)<<8|x[w+4])+5}return T}function s(x){var w=0,A,R,T,E,g,a=x.data;if(!x||x.size===0)return null;for(;a[0].length<19&&a.length>1;){var m=new Uint8Array(a[0].length+a[1].length);m.set(a[0]),m.set(a[1],a[0].length),a[0]=m,a.splice(1,1)}A=a[0];var r=(A[0]<<16)+(A[1]<<8)+A[2];if(r===1){if(R=(A[4]<<8)+A[5],R&&R>x.size-6)return null;var b=A[7];b&192&&(E=(A[9]&14)*536870912+(A[10]&255)*4194304+(A[11]&254)*16384+(A[12]&255)*128+(A[13]&254)/2,b&64?(g=(A[14]&14)*536870912+(A[15]&255)*4194304+(A[16]&254)*16384+(A[17]&255)*128+(A[18]&254)/2,E-g>60*9e4&&(y.logger.warn(Math.round((E-g)/9e4)+"s delta between PTS and DTS, align them"),E=g)):g=E),T=A[8];var P=T+9;if(x.size<=P)return null;x.size-=P;for(var M=new Uint8Array(x.size),W=0,X=a.length;W<X;W++){A=a[W];var U=A.byteLength;if(P)if(P>U){P-=U;continue}else A=A.subarray(P),U-=P,P=0;M.set(A,w),w+=U}return R&&(R-=T+3),{data:M,pts:E,dts:g,len:R}}return null}function u(x,w){if(x.units.length&&x.frame){if(x.pts===void 0){var A=w.samples,R=A.length;if(R){var T=A[R-1];x.pts=T.pts,x.dts=T.dts}else{w.dropped++;return}}w.samples.push(x)}x.debug.length&&y.logger.log(x.pts+"/"+x.dts+":"+x.debug)}function f(x,w){var A=x.length;if(A>0){if(w.pts>=x[A-1].pts)x.push(w);else for(var R=A-1;R>=0;R--)if(w.pts<x[R].pts){x.splice(R,0,w);break}}else x.push(w)}function O(x){for(var w=x.byteLength,A=[],R=1;R<w-2;)x[R]===0&&x[R+1]===0&&x[R+2]===3?(A.push(R+2),R+=2):R++;if(A.length===0)return x;var T=w-A.length,E=new Uint8Array(T),g=0;for(R=0;R<T;g++,R++)g===A[0]&&(g++,A.shift()),E[R]=x[g];return E}Z.default=c},"./src/errors.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"ErrorTypes",function(){return $}),D.d(Z,"ErrorDetails",function(){return j});var $;(function(F){F.NETWORK_ERROR="networkError",F.MEDIA_ERROR="mediaError",F.KEY_SYSTEM_ERROR="keySystemError",F.MUX_ERROR="muxError",F.OTHER_ERROR="otherError"})($||($={}));var j;(function(F){F.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",F.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",F.KEY_SYSTEM_NO_SESSION="keySystemNoSession",F.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",F.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",F.MANIFEST_LOAD_ERROR="manifestLoadError",F.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",F.MANIFEST_PARSING_ERROR="manifestParsingError",F.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",F.LEVEL_EMPTY_ERROR="levelEmptyError",F.LEVEL_LOAD_ERROR="levelLoadError",F.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",F.LEVEL_SWITCH_ERROR="levelSwitchError",F.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",F.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",F.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",F.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",F.FRAG_LOAD_ERROR="fragLoadError",F.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",F.FRAG_DECRYPT_ERROR="fragDecryptError",F.FRAG_PARSING_ERROR="fragParsingError",F.REMUX_ALLOC_ERROR="remuxAllocError",F.KEY_LOAD_ERROR="keyLoadError",F.KEY_LOAD_TIMEOUT="keyLoadTimeOut",F.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",F.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",F.BUFFER_APPEND_ERROR="bufferAppendError",F.BUFFER_APPENDING_ERROR="bufferAppendingError",F.BUFFER_STALLED_ERROR="bufferStalledError",F.BUFFER_FULL_ERROR="bufferFullError",F.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",F.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",F.INTERNAL_EXCEPTION="internalException",F.INTERNAL_ABORTED="aborted",F.UNKNOWN="unknown"})(j||(j={}))},"./src/events.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"Events",function(){return $});var $;(function(j){j.MEDIA_ATTACHING="hlsMediaAttaching",j.MEDIA_ATTACHED="hlsMediaAttached",j.MEDIA_DETACHING="hlsMediaDetaching",j.MEDIA_DETACHED="hlsMediaDetached",j.BUFFER_RESET="hlsBufferReset",j.BUFFER_CODECS="hlsBufferCodecs",j.BUFFER_CREATED="hlsBufferCreated",j.BUFFER_APPENDING="hlsBufferAppending",j.BUFFER_APPENDED="hlsBufferAppended",j.BUFFER_EOS="hlsBufferEos",j.BUFFER_FLUSHING="hlsBufferFlushing",j.BUFFER_FLUSHED="hlsBufferFlushed",j.MANIFEST_LOADING="hlsManifestLoading",j.MANIFEST_LOADED="hlsManifestLoaded",j.MANIFEST_PARSED="hlsManifestParsed",j.LEVEL_SWITCHING="hlsLevelSwitching",j.LEVEL_SWITCHED="hlsLevelSwitched",j.LEVEL_LOADING="hlsLevelLoading",j.LEVEL_LOADED="hlsLevelLoaded",j.LEVEL_UPDATED="hlsLevelUpdated",j.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",j.LEVELS_UPDATED="hlsLevelsUpdated",j.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",j.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",j.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",j.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",j.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",j.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",j.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",j.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",j.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",j.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",j.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",j.CUES_PARSED="hlsCuesParsed",j.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",j.INIT_PTS_FOUND="hlsInitPtsFound",j.FRAG_LOADING="hlsFragLoading",j.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",j.FRAG_LOADED="hlsFragLoaded",j.FRAG_DECRYPTED="hlsFragDecrypted",j.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",j.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",j.FRAG_PARSING_METADATA="hlsFragParsingMetadata",j.FRAG_PARSED="hlsFragParsed",j.FRAG_BUFFERED="hlsFragBuffered",j.FRAG_CHANGED="hlsFragChanged",j.FPS_DROP="hlsFpsDrop",j.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",j.ERROR="hlsError",j.DESTROYING="hlsDestroying",j.KEY_LOADING="hlsKeyLoading",j.KEY_LOADED="hlsKeyLoaded",j.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",j.BACK_BUFFER_REACHED="hlsBackBufferReached"})($||($={}))},"./src/hls.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return x});var $=D("./node_modules/url-toolkit/src/url-toolkit.js"),j=D.n($),F=D("./src/loader/playlist-loader.ts"),V=D("./src/loader/key-loader.ts"),H=D("./src/controller/id3-track-controller.ts"),k=D("./src/controller/latency-controller.ts"),L=D("./src/controller/level-controller.ts"),y=D("./src/controller/fragment-tracker.ts"),v=D("./src/controller/stream-controller.ts"),p=D("./src/is-supported.ts"),c=D("./src/utils/logger.ts"),h=D("./src/config.ts"),d=D("./node_modules/eventemitter3/index.js"),l=D.n(d),s=D("./src/events.ts"),u=D("./src/errors.ts");function f(w,A){for(var R=0;R<A.length;R++){var T=A[R];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(w,T.key,T)}}function O(w,A,R){return A&&f(w.prototype,A),R&&f(w,R),w}var x=function(){w.isSupported=function(){return Object(p.isSupported)()};function w(R){R===void 0&&(R={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new d.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 T=this.config=Object(h.mergeConfig)(w.DefaultConfig,R);this.userConfig=R,Object(c.enableLogs)(T.debug),this._autoLevelCapping=-1,T.progressive&&Object(h.enableStreamingMode)(T);var E=T.abrController,g=T.bufferController,a=T.capLevelController,m=T.fpsController,r=this.abrController=new E(this),b=this.bufferController=new g(this),P=this.capLevelController=new a(this),M=new m(this),W=new F.default(this),X=new V.default(this),U=new H.default(this),S=this.levelController=new L.default(this),B=new y.FragmentTracker(this),J=this.streamController=new v.default(this,B);P.setStreamController(J),M.setStreamController(J);var te=[S,J];this.networkControllers=te;var ae=[W,X,r,b,P,M,U,B];this.audioTrackController=this.createController(T.audioTrackController,null,te),this.createController(T.audioStreamController,B,te),this.subtitleTrackController=this.createController(T.subtitleTrackController,null,te),this.createController(T.subtitleStreamController,B,te),this.createController(T.timelineController,null,ae),this.emeController=this.createController(T.emeController,null,ae),this.cmcdController=this.createController(T.cmcdController,null,ae),this.latencyController=this.createController(k.default,null,ae),this.coreComponents=ae}var A=w.prototype;return A.createController=function(T,E,g){if(T){var a=E?new T(this,E):new T(this);return g&&g.push(a),a}return null},A.on=function(T,E,g){g===void 0&&(g=this),this._emitter.on(T,E,g)},A.once=function(T,E,g){g===void 0&&(g=this),this._emitter.once(T,E,g)},A.removeAllListeners=function(T){this._emitter.removeAllListeners(T)},A.off=function(T,E,g,a){g===void 0&&(g=this),this._emitter.off(T,E,g,a)},A.listeners=function(T){return this._emitter.listeners(T)},A.emit=function(T,E,g){return this._emitter.emit(T,E,g)},A.trigger=function(T,E){if(this.config.debug)return this.emit(T,T,E);try{return this.emit(T,T,E)}catch(g){c.logger.error("An internal error happened while handling event "+T+'. Error message: "'+g.message+'". Here is a stacktrace:',g),this.trigger(s.Events.ERROR,{type:u.ErrorTypes.OTHER_ERROR,details:u.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:T,error:g})}return!1},A.listenerCount=function(T){return this._emitter.listenerCount(T)},A.destroy=function(){c.logger.log("destroy"),this.trigger(s.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(T){return T.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(T){return T.destroy()}),this.coreComponents.length=0},A.attachMedia=function(T){c.logger.log("attachMedia"),this._media=T,this.trigger(s.Events.MEDIA_ATTACHING,{media:T})},A.detachMedia=function(){c.logger.log("detachMedia"),this.trigger(s.Events.MEDIA_DETACHING,void 0),this._media=null},A.loadSource=function(T){this.stopLoad();var E=this.media,g=this.url,a=this.url=$.buildAbsoluteURL(self.location.href,T,{alwaysNormalize:!0});c.logger.log("loadSource:"+a),E&&g&&g!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(E)),this.trigger(s.Events.MANIFEST_LOADING,{url:T})},A.startLoad=function(T){T===void 0&&(T=-1),c.logger.log("startLoad("+T+")"),this.networkControllers.forEach(function(E){E.startLoad(T)})},A.stopLoad=function(){c.logger.log("stopLoad"),this.networkControllers.forEach(function(T){T.stopLoad()})},A.swapAudioCodec=function(){c.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},A.recoverMediaError=function(){c.logger.log("recoverMediaError");var T=this._media;this.detachMedia(),T&&this.attachMedia(T)},A.removeLevel=function(T,E){E===void 0&&(E=0),this.levelController.removeLevel(T,E)},O(w,[{key:"levels",get:function(){var T=this.levelController.levels;return T||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(T){c.logger.log("set currentLevel:"+T),this.loadLevel=T,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(T){c.logger.log("set nextLevel:"+T),this.levelController.manualLevel=T,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(T){c.logger.log("set loadLevel:"+T),this.levelController.manualLevel=T}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(T){this.levelController.nextLoadLevel=T}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(T){c.logger.log("set firstLevel:"+T),this.levelController.firstLevel=T}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(T){c.logger.log("set startLevel:"+T),T!==-1&&(T=Math.max(T,this.minAutoLevel)),this.levelController.startLevel=T}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(T){var E=!!T;E!==this.config.capLevelToPlayerSize&&(E?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=E)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(T){this._autoLevelCapping!==T&&(c.logger.log("set autoLevelCapping:"+T),this._autoLevelCapping=T)}},{key:"bandwidthEstimate",get:function(){var T=this.abrController.bwEstimator;return T?T.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var T=this.levels,E=this.config.minAutoBitrate;if(!T)return 0;for(var g=T.length,a=0;a<g;a++)if(T[a].maxBitrate>E)return a;return 0}},{key:"maxAutoLevel",get:function(){var T=this.levels,E=this.autoLevelCapping,g;return E===-1&&T&&T.length?g=T.length-1:g=E,g}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(T){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,T)}},{key:"audioTracks",get:function(){var T=this.audioTrackController;return T?T.audioTracks:[]}},{key:"audioTrack",get:function(){var T=this.audioTrackController;return T?T.audioTrack:-1},set:function(T){var E=this.audioTrackController;E&&(E.audioTrack=T)}},{key:"subtitleTracks",get:function(){var T=this.subtitleTrackController;return T?T.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var T=this.subtitleTrackController;return T?T.subtitleTrack:-1},set:function(T){var E=this.subtitleTrackController;E&&(E.subtitleTrack=T)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var T=this.subtitleTrackController;return T?T.subtitleDisplay:!1},set:function(T){var E=this.subtitleTrackController;E&&(E.subtitleDisplay=T)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(T){this.config.lowLatencyMode=T}},{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 s.Events}},{key:"ErrorTypes",get:function(){return u.ErrorTypes}},{key:"ErrorDetails",get:function(){return u.ErrorDetails}},{key:"DefaultConfig",get:function(){return w.defaultConfig?w.defaultConfig:h.hlsDefaultConfig},set:function(T){w.defaultConfig=T}}]),w}();x.defaultConfig=void 0},"./src/is-supported.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"isSupported",function(){return F}),D.d(Z,"changeTypeSupported",function(){return V});var $=D("./src/utils/mediasource-helper.ts");function j(){return self.SourceBuffer||self.WebKitSourceBuffer}function F(){var H=Object($.getMediaSource)();if(!H)return!1;var k=j(),L=H&&typeof H.isTypeSupported=="function"&&H.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!k||k.prototype&&typeof k.prototype.appendBuffer=="function"&&typeof k.prototype.remove=="function";return!!L&&!!y}function V(){var H,k=j();return typeof(k==null||((H=k.prototype)===null||H===void 0)?void 0:H.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return c}),D.d(Z,"LoadError",function(){return d});var $=D("./src/polyfills/number.ts"),j=D("./src/errors.ts");function F(l,s){l.prototype=Object.create(s.prototype),l.prototype.constructor=l,y(l,s)}function V(l){var s=typeof Map=="function"?new Map:void 0;return V=function(f){if(f===null||!L(f))return f;if(typeof f!="function")throw new TypeError("Super expression must either be null or a function");if(typeof s!="undefined"){if(s.has(f))return s.get(f);s.set(f,O)}function O(){return H(f,arguments,v(this).constructor)}return O.prototype=Object.create(f.prototype,{constructor:{value:O,enumerable:!1,writable:!0,configurable:!0}}),y(O,f)},V(l)}function H(l,s,u){return k()?H=Reflect.construct:H=function(O,x,w){var A=[null];A.push.apply(A,x);var R=Function.bind.apply(O,A),T=new R;return w&&y(T,w.prototype),T},H.apply(null,arguments)}function k(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function L(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function y(l,s){return y=Object.setPrototypeOf||function(f,O){return f.__proto__=O,f},y(l,s)}function v(l){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(u){return u.__proto__||Object.getPrototypeOf(u)},v(l)}var p=Math.pow(2,17),c=function(){function l(u){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=u}var s=l.prototype;return s.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},s.abort=function(){this.loader&&this.loader.abort()},s.load=function(f,O){var x=this,w=f.url;if(!w)return Promise.reject(new d({type:j.ErrorTypes.NETWORK_ERROR,details:j.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:f,networkDetails:null},"Fragment does not have a "+(w?"part list":"url")));this.abort();var A=this.config,R=A.fLoader,T=A.loader;return new Promise(function(E,g){x.loader&&x.loader.destroy();var a=x.loader=f.loader=R?new R(A):new T(A),m=h(f),r={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:p};f.stats=a.stats,a.load(m,r,{onSuccess:function(P,M,W,X){x.resetLoader(f,a),E({frag:f,part:null,payload:P.data,networkDetails:X})},onError:function(P,M,W){x.resetLoader(f,a),g(new d({type:j.ErrorTypes.NETWORK_ERROR,details:j.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:f,response:P,networkDetails:W}))},onAbort:function(P,M,W){x.resetLoader(f,a),g(new d({type:j.ErrorTypes.NETWORK_ERROR,details:j.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:f,networkDetails:W}))},onTimeout:function(P,M,W){x.resetLoader(f,a),g(new d({type:j.ErrorTypes.NETWORK_ERROR,details:j.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:f,networkDetails:W}))},onProgress:function(P,M,W,X){O&&O({frag:f,part:null,payload:W,networkDetails:X})}})})},s.loadPart=function(f,O,x){var w=this;this.abort();var A=this.config,R=A.fLoader,T=A.loader;return new Promise(function(E,g){w.loader&&w.loader.destroy();var a=w.loader=f.loader=R?new R(A):new T(A),m=h(f,O),r={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:p};O.stats=a.stats,a.load(m,r,{onSuccess:function(P,M,W,X){w.resetLoader(f,a),w.updateStatsFromPart(f,O);var U={frag:f,part:O,payload:P.data,networkDetails:X};x(U),E(U)},onError:function(P,M,W){w.resetLoader(f,a),g(new d({type:j.ErrorTypes.NETWORK_ERROR,details:j.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:f,part:O,response:P,networkDetails:W}))},onAbort:function(P,M,W){f.stats.aborted=O.stats.aborted,w.resetLoader(f,a),g(new d({type:j.ErrorTypes.NETWORK_ERROR,details:j.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:f,part:O,networkDetails:W}))},onTimeout:function(P,M,W){w.resetLoader(f,a),g(new d({type:j.ErrorTypes.NETWORK_ERROR,details:j.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:f,part:O,networkDetails:W}))}})})},s.updateStatsFromPart=function(f,O){var x=f.stats,w=O.stats,A=w.total;if(x.loaded+=w.loaded,A){var R=Math.round(f.duration/O.duration),T=Math.min(Math.round(x.loaded/A),R),E=R-T,g=E*Math.round(x.loaded/T);x.total=x.loaded+g}else x.total=Math.max(x.loaded,x.total);var a=x.loading,m=w.loading;a.start?a.first+=m.first-m.start:(a.start=m.start,a.first=m.first),a.end=m.end},s.resetLoader=function(f,O){f.loader=null,this.loader===O&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),O.destroy()},l}();function h(l,s){s===void 0&&(s=null);var u=s||l,f={frag:l,part:s,responseType:"arraybuffer",url:u.url,headers:{},rangeStart:0,rangeEnd:0},O=u.byteRangeStartOffset,x=u.byteRangeEndOffset;return Object($.isFiniteNumber)(O)&&Object($.isFiniteNumber)(x)&&(f.rangeStart=O,f.rangeEnd=x),f}var d=function(l){F(s,l);function s(u){for(var f,O=arguments.length,x=new Array(O>1?O-1:0),w=1;w<O;w++)x[w-1]=arguments[w];return f=l.call.apply(l,[this].concat(x))||this,f.data=void 0,f.data=u,f}return s}(V(Error))},"./src/loader/fragment.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"ElementaryStreamTypes",function(){return c}),D.d(Z,"BaseSegment",function(){return h}),D.d(Z,"Fragment",function(){return d}),D.d(Z,"Part",function(){return l});var $=D("./src/polyfills/number.ts"),j=D("./node_modules/url-toolkit/src/url-toolkit.js"),F=D.n(j),V=D("./src/utils/logger.ts"),H=D("./src/loader/level-key.ts"),k=D("./src/loader/load-stats.ts");function L(s,u){s.prototype=Object.create(u.prototype),s.prototype.constructor=s,y(s,u)}function y(s,u){return y=Object.setPrototypeOf||function(O,x){return O.__proto__=x,O},y(s,u)}function v(s,u){for(var f=0;f<u.length;f++){var O=u[f];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(s,O.key,O)}}function p(s,u,f){return u&&v(s.prototype,u),f&&v(s,f),s}var c;(function(s){s.AUDIO="audio",s.VIDEO="video",s.AUDIOVIDEO="audiovideo"})(c||(c={}));var h=function(){function s(f){var O;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(O={},O[c.AUDIO]=null,O[c.VIDEO]=null,O[c.AUDIOVIDEO]=null,O),this.baseurl=f}var u=s.prototype;return u.setByteRange=function(O,x){var w=O.split("@",2),A=[];w.length===1?A[0]=x?x.byteRangeEndOffset:0:A[0]=parseInt(w[1]),A[1]=parseInt(w[0])+A[0],this._byteRange=A},p(s,[{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(j.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(O){this._url=O}}]),s}(),d=function(s){L(u,s);function u(O,x){var w;return w=s.call(this,x)||this,w._decryptdata=null,w.rawProgramDateTime=null,w.programDateTime=null,w.tagList=[],w.duration=0,w.sn=0,w.levelkey=void 0,w.type=void 0,w.loader=null,w.level=-1,w.cc=0,w.startPTS=void 0,w.endPTS=void 0,w.appendedPTS=void 0,w.startDTS=void 0,w.endDTS=void 0,w.start=0,w.deltaPTS=void 0,w.maxStartPTS=void 0,w.minEndPTS=void 0,w.stats=new k.LoadStats,w.urlId=0,w.data=void 0,w.bitrateTest=!1,w.title=null,w.initSegment=null,w.type=O,w}var f=u.prototype;return f.createInitializationVector=function(x){for(var w=new Uint8Array(16),A=12;A<16;A++)w[A]=x>>8*(15-A)&255;return w},f.setDecryptDataFromLevelKey=function(x,w){var A=x;return(x==null?void 0:x.method)==="AES-128"&&x.uri&&!x.iv&&(A=H.LevelKey.fromURI(x.uri),A.method=x.method,A.iv=this.createInitializationVector(w),A.keyFormat="identity"),A},f.setElementaryStreamInfo=function(x,w,A,R,T,E){E===void 0&&(E=!1);var g=this.elementaryStreams,a=g[x];if(!a){g[x]={startPTS:w,endPTS:A,startDTS:R,endDTS:T,partial:E};return}a.startPTS=Math.min(a.startPTS,w),a.endPTS=Math.max(a.endPTS,A),a.startDTS=Math.min(a.startDTS,R),a.endDTS=Math.max(a.endDTS,T)},f.clearElementaryStreamInfo=function(){var x=this.elementaryStreams;x[c.AUDIO]=null,x[c.VIDEO]=null,x[c.AUDIOVIDEO]=null},p(u,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var x=this.sn;typeof x!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&V.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),x=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,x)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object($.isFiniteNumber)(this.programDateTime))return null;var x=Object($.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+x*1e3}},{key:"encrypted",get:function(){var x;return!!((x=this.decryptdata)!==null&&x!==void 0&&x.keyFormat&&this.decryptdata.uri)}}]),u}(h),l=function(s){L(u,s);function u(f,O,x,w,A){var R;R=s.call(this,x)||this,R.fragOffset=0,R.duration=0,R.gap=!1,R.independent=!1,R.relurl=void 0,R.fragment=void 0,R.index=void 0,R.stats=new k.LoadStats,R.duration=f.decimalFloatingPoint("DURATION"),R.gap=f.bool("GAP"),R.independent=f.bool("INDEPENDENT"),R.relurl=f.enumeratedString("URI"),R.fragment=O,R.index=w;var T=f.enumeratedString("BYTERANGE");return T&&R.setByteRange(T,A),A&&(R.fragOffset=A.fragOffset+A.duration),R}return p(u,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var O=this.elementaryStreams;return!!(O.audio||O.video||O.audiovideo)}}]),u}(h)},"./src/loader/key-loader.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return V});var $=D("./src/events.ts"),j=D("./src/errors.ts"),F=D("./src/utils/logger.ts"),V=function(){function H(L){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=L,this._registerListeners()}var k=H.prototype;return k._registerListeners=function(){this.hls.on($.Events.KEY_LOADING,this.onKeyLoading,this)},k._unregisterListeners=function(){this.hls.off($.Events.KEY_LOADING,this.onKeyLoading)},k.destroy=function(){this._unregisterListeners();for(var y in this.loaders){var v=this.loaders[y];v&&v.destroy()}this.loaders={}},k.onKeyLoading=function(y,v){var p=v.frag,c=p.type,h=this.loaders[c];if(!p.decryptdata){F.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var d=p.decryptdata.uri;if(d!==this.decrypturl||this.decryptkey===null){var l=this.hls.config;if(h&&(F.logger.warn("abort previous key loader for type:"+c),h.abort()),!d){F.logger.warn("key uri is falsy");return}var s=l.loader,u=p.loader=this.loaders[c]=new s(l);this.decrypturl=d,this.decryptkey=null;var f={url:d,frag:p,responseType:"arraybuffer"},O={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},x={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(f,O,x)}else this.decryptkey&&(p.decryptdata.key=this.decryptkey,this.hls.trigger($.Events.KEY_LOADED,{frag:p}))},k.loadsuccess=function(y,v,p){var c=p.frag;if(!c.decryptdata){F.logger.error("after key load, decryptdata unset");return}this.decryptkey=c.decryptdata.key=new Uint8Array(y.data),c.loader=null,delete this.loaders[c.type],this.hls.trigger($.Events.KEY_LOADED,{frag:c})},k.loaderror=function(y,v){var p=v.frag,c=p.loader;c&&c.abort(),delete this.loaders[p.type],this.hls.trigger($.Events.ERROR,{type:j.ErrorTypes.NETWORK_ERROR,details:j.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:p,response:y})},k.loadtimeout=function(y,v){var p=v.frag,c=p.loader;c&&c.abort(),delete this.loaders[p.type],this.hls.trigger($.Events.ERROR,{type:j.ErrorTypes.NETWORK_ERROR,details:j.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:p})},H}()},"./src/loader/level-details.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"LevelDetails",function(){return H});var $=D("./src/polyfills/number.ts");function j(k,L){for(var y=0;y<L.length;y++){var v=L[y];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(k,v.key,v)}}function F(k,L,y){return L&&j(k.prototype,L),y&&j(k,y),k}var V=10,H=function(){function k(y){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=y}var L=k.prototype;return L.reloaded=function(v){if(!v){this.advanced=!0,this.updated=!0;return}var p=this.lastPartSn-v.lastPartSn,c=this.lastPartIndex-v.lastPartIndex;this.updated=this.endSN!==v.endSN||!!c||!!p,this.advanced=this.endSN>v.endSN||p>0||p===0&&c>0,this.updated||this.advanced?this.misses=Math.floor(v.misses*.6):this.misses=v.misses+1,this.availabilityDelay=v.availabilityDelay},F(k,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object($.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||V}},{key:"drift",get:function(){var v=this.driftEndTime-this.driftStartTime;if(v>0){var p=this.driftEnd-this.driftStart;return p*1e3/v}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var v;return(v=this.partList)!==null&&v!==void 0&&v.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var v;return(v=this.fragments)!==null&&v!==void 0&&v.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var v;return(v=this.partList)!==null&&v!==void 0&&v.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var v;return(v=this.partList)!==null&&v!==void 0&&v.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),k}()},"./src/loader/level-key.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"LevelKey",function(){return H});var $=D("./node_modules/url-toolkit/src/url-toolkit.js"),j=D.n($);function F(k,L){for(var y=0;y<L.length;y++){var v=L[y];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(k,v.key,v)}}function V(k,L,y){return L&&F(k.prototype,L),y&&F(k,y),k}var H=function(){k.fromURL=function(y,v){return new k(y,v)},k.fromURI=function(y){return new k(y)};function k(L,y){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,y?this._uri=Object($.buildAbsoluteURL)(L,y,{alwaysNormalize:!0}):this._uri=L}return V(k,[{key:"uri",get:function(){return this._uri}}]),k}()},"./src/loader/load-stats.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"LoadStats",function(){return $});var $=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(oe,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return u});var $=D("./src/polyfills/number.ts"),j=D("./node_modules/url-toolkit/src/url-toolkit.js"),F=D.n(j),V=D("./src/loader/fragment.ts"),H=D("./src/loader/level-details.ts"),k=D("./src/loader/level-key.ts"),L=D("./src/utils/attr-list.ts"),y=D("./src/utils/logger.ts"),v=D("./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,c=/#EXT-X-MEDIA:(.*)/g,h=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),d=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("|")),l=/\.(mp4|m4s|m4v|m4a)$/i;function s(A){var R,T;return l.test((R=(T=j.parseURL(A))===null||T===void 0?void 0:T.path)!=null?R:"")}var u=function(){function A(){}return A.findGroup=function(T,E){for(var g=0;g<T.length;g++){var a=T[g];if(a.id===E)return a}},A.convertAVC1ToAVCOTI=function(T){var E=T.split(".");if(E.length>2){var g=E.shift()+".";return g+=parseInt(E.shift()).toString(16),g+=("000"+parseInt(E.shift()).toString(16)).substr(-4),g}return T},A.resolve=function(T,E){return j.buildAbsoluteURL(E,T,{alwaysNormalize:!0})},A.parseMasterPlaylist=function(T,E){var g=[],a={},m=!1;p.lastIndex=0;for(var r;(r=p.exec(T))!=null;)if(r[1]){var b=new L.AttrList(r[1]),P={attrs:b,bitrate:b.decimalInteger("AVERAGE-BANDWIDTH")||b.decimalInteger("BANDWIDTH"),name:b.NAME,url:A.resolve(r[2],E)},M=b.decimalResolution("RESOLUTION");M&&(P.width=M.width,P.height=M.height),f((b.CODECS||"").split(/[ ,]+/).filter(function(X){return X}),P),P.videoCodec&&P.videoCodec.indexOf("avc1")!==-1&&(P.videoCodec=A.convertAVC1ToAVCOTI(P.videoCodec)),g.push(P)}else if(r[3]){var W=new L.AttrList(r[3]);W["DATA-ID"]&&(m=!0,a[W["DATA-ID"]]=W)}return{levels:g,sessionData:m?a:null}},A.parseMasterPlaylistMedia=function(T,E,g,a){a===void 0&&(a=[]);var m,r=[],b=0;for(c.lastIndex=0;(m=c.exec(T))!==null;){var P=new L.AttrList(m[1]);if(P.TYPE===g){var M={attrs:P,bitrate:0,id:b++,groupId:P["GROUP-ID"],instreamId:P["INSTREAM-ID"],name:P.NAME||P.LANGUAGE||"",type:g,default:P.bool("DEFAULT"),autoselect:P.bool("AUTOSELECT"),forced:P.bool("FORCED"),lang:P.LANGUAGE,url:P.URI?A.resolve(P.URI,E):""};if(a.length){var W=A.findGroup(a,M.groupId)||a[0];O(M,W,"audioCodec"),O(M,W,"textCodec")}r.push(M)}}return r},A.parseLevelPlaylist=function(T,E,g,a,m){var r=new H.LevelDetails(E),b=r.fragments,P=null,M=0,W=0,X=0,U=0,S=null,B=new V.Fragment(a,E),J,te,ae,_e=-1,de=!1;for(h.lastIndex=0,r.m3u8=T;(J=h.exec(T))!==null;){de&&(de=!1,B=new V.Fragment(a,E),B.start=X,B.sn=M,B.cc=U,B.level=g,P&&(B.initSegment=P,B.rawProgramDateTime=P.rawProgramDateTime));var Ee=J[1];if(Ee){B.duration=parseFloat(Ee);var Te=(" "+J[2]).slice(1);B.title=Te||null,B.tagList.push(Te?["INF",Ee,Te]:["INF",Ee])}else if(J[3])Object($.isFiniteNumber)(B.duration)&&(B.start=X,ae&&(B.levelkey=ae),B.sn=M,B.level=g,B.cc=U,B.urlId=m,b.push(B),B.relurl=(" "+J[3]).slice(1),w(B,S),S=B,X+=B.duration,M++,W=0,de=!0);else if(J[4]){var me=(" "+J[4]).slice(1);S?B.setByteRange(me,S):B.setByteRange(me)}else if(J[5])B.rawProgramDateTime=(" "+J[5]).slice(1),B.tagList.push(["PROGRAM-DATE-TIME",B.rawProgramDateTime]),_e===-1&&(_e=b.length);else{if(J=J[0].match(d),!J){y.logger.warn("No matches on slow regex match for level playlist!");continue}for(te=1;te<J.length&&!(typeof J[te]!="undefined");te++);var ce=(" "+J[te]).slice(1),se=(" "+J[te+1]).slice(1),Se=J[te+2]?(" "+J[te+2]).slice(1):"";switch(ce){case"PLAYLIST-TYPE":r.type=se.toUpperCase();break;case"MEDIA-SEQUENCE":M=r.startSN=parseInt(se);break;case"SKIP":{var je=new L.AttrList(se),We=je.decimalInteger("SKIPPED-SEGMENTS");if(Object($.isFiniteNumber)(We)){r.skippedSegments=We;for(var Xe=We;Xe--;)b.unshift(null);M+=We}var Qe=je.enumeratedString("RECENTLY-REMOVED-DATERANGES");Qe&&(r.recentlyRemovedDateranges=Qe.split(" "));break}case"TARGETDURATION":r.targetduration=parseFloat(se);break;case"VERSION":r.version=parseInt(se);break;case"EXTM3U":break;case"ENDLIST":r.live=!1;break;case"#":(se||Se)&&B.tagList.push(Se?[se,Se]:[se]);break;case"DIS":U++;case"GAP":B.tagList.push([ce]);break;case"BITRATE":B.tagList.push([ce,se]);break;case"DISCONTINUITY-SEQ":U=parseInt(se);break;case"KEY":{var Pe,Ue=new L.AttrList(se),Ye=Ue.enumeratedString("METHOD"),Ze=Ue.URI,Ve=Ue.hexadecimalInteger("IV"),He=Ue.enumeratedString("KEYFORMATVERSIONS"),Fe=Ue.enumeratedString("KEYID"),ft=(Pe=Ue.enumeratedString("KEYFORMAT"))!=null?Pe:"identity",lt=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(lt.indexOf(ft)>-1){y.logger.warn("Keyformat "+ft+" is not supported from the manifest");continue}else if(ft!=="identity")continue;Ye&&(ae=k.LevelKey.fromURL(E,Ze),Ze&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ye)>=0&&(ae.method=Ye,ae.keyFormat=ft,Fe&&(ae.keyID=Fe),He&&(ae.keyFormatVersions=He),ae.iv=Ve));break}case"START":{var rt=new L.AttrList(se),dt=rt.decimalFloatingPoint("TIME-OFFSET");Object($.isFiniteNumber)(dt)&&(r.startTimeOffset=dt);break}case"MAP":{var bt=new L.AttrList(se);B.relurl=bt.URI,bt.BYTERANGE&&B.setByteRange(bt.BYTERANGE),B.level=g,B.sn="initSegment",ae&&(B.levelkey=ae),B.initSegment=null,P=B,de=!0;break}case"SERVER-CONTROL":{var ut=new L.AttrList(se);r.canBlockReload=ut.bool("CAN-BLOCK-RELOAD"),r.canSkipUntil=ut.optionalFloat("CAN-SKIP-UNTIL",0),r.canSkipDateRanges=r.canSkipUntil>0&&ut.bool("CAN-SKIP-DATERANGES"),r.partHoldBack=ut.optionalFloat("PART-HOLD-BACK",0),r.holdBack=ut.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var at=new L.AttrList(se);r.partTarget=at.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ie=r.partList;Ie||(Ie=r.partList=[]);var yt=W>0?Ie[Ie.length-1]:void 0,nt=W++,Oe=new V.Part(new L.AttrList(se),B,E,nt,yt);Ie.push(Oe),B.duration+=Oe.duration;break}case"PRELOAD-HINT":{var Ge=new L.AttrList(se);r.preloadHint=Ge;break}case"RENDITION-REPORT":{var be=new L.AttrList(se);r.renditionReports=r.renditionReports||[],r.renditionReports.push(be);break}default:y.logger.warn("line parsed but not handled: "+J);break}}}S&&!S.relurl?(b.pop(),X-=S.duration,r.partList&&(r.fragmentHint=S)):r.partList&&(w(B,S),B.cc=U,r.fragmentHint=B);var fe=b.length,pe=b[0],ie=b[fe-1];if(X+=r.skippedSegments*r.targetduration,X>0&&fe&&ie){r.averagetargetduration=X/fe;var re=ie.sn;r.endSN=re!=="initSegment"?re:0,pe&&(r.startCC=pe.cc,pe.initSegment||r.fragments.every(function(ue){return ue.relurl&&s(ue.relurl)})&&(y.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),B=new V.Fragment(a,E),B.relurl=ie.relurl,B.level=g,B.sn="initSegment",pe.initSegment=B,r.needSidxRanges=!0))}else r.endSN=0,r.startCC=0;return r.fragmentHint&&(X+=r.fragmentHint.duration),r.totalduration=X,r.endCC=U,_e>0&&x(b,_e),r},A}();function f(A,R){["video","audio","text"].forEach(function(T){var E=A.filter(function(a){return Object(v.isCodecType)(a,T)});if(E.length){var g=E.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});R[T+"Codec"]=g.length>0?g[0]:E[0],A=A.filter(function(a){return E.indexOf(a)===-1})}}),R.unknownCodecs=A}function O(A,R,T){var E=R[T];E&&(A[T]=E)}function x(A,R){for(var T=A[R],E=R;E--;){var g=A[E];if(!g)return;g.programDateTime=T.programDateTime-g.duration*1e3,T=g}}function w(A,R){A.rawProgramDateTime?A.programDateTime=Date.parse(A.rawProgramDateTime):R!=null&&R.programDateTime&&(A.programDateTime=R.endProgramDateTime),Object($.isFiniteNumber)(A.programDateTime)||(A.programDateTime=null,A.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(oe,Z,D){"use strict";D.r(Z);var $=D("./src/polyfills/number.ts"),j=D("./src/events.ts"),F=D("./src/errors.ts"),V=D("./src/utils/logger.ts"),H=D("./src/utils/mp4-tools.ts"),k=D("./src/loader/m3u8-parser.ts"),L=D("./src/types/loader.ts"),y=D("./src/utils/attr-list.ts");function v(h){var d=h.type;switch(d){case L.PlaylistContextType.AUDIO_TRACK:return L.PlaylistLevelType.AUDIO;case L.PlaylistContextType.SUBTITLE_TRACK:return L.PlaylistLevelType.SUBTITLE;default:return L.PlaylistLevelType.MAIN}}function p(h,d){var l=h.url;return(l===void 0||l.indexOf("data:")===0)&&(l=d.url),l}var c=function(){function h(l){this.hls=void 0,this.loaders=Object.create(null),this.hls=l,this.registerListeners()}var d=h.prototype;return d.registerListeners=function(){var s=this.hls;s.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(j.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on(j.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),s.on(j.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},d.unregisterListeners=function(){var s=this.hls;s.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(j.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off(j.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),s.off(j.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},d.createInternalLoader=function(s){var u=this.hls.config,f=u.pLoader,O=u.loader,x=f||O,w=new x(u);return s.loader=w,this.loaders[s.type]=w,w},d.getInternalLoader=function(s){return this.loaders[s.type]},d.resetInternalLoader=function(s){this.loaders[s]&&delete this.loaders[s]},d.destroyInternalLoaders=function(){for(var s in this.loaders){var u=this.loaders[s];u&&u.destroy(),this.resetInternalLoader(s)}},d.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},d.onManifestLoading=function(s,u){var f=u.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:L.PlaylistContextType.MANIFEST,url:f,deliveryDirectives:null})},d.onLevelLoading=function(s,u){var f=u.id,O=u.level,x=u.url,w=u.deliveryDirectives;this.load({id:f,groupId:null,level:O,responseType:"text",type:L.PlaylistContextType.LEVEL,url:x,deliveryDirectives:w})},d.onAudioTrackLoading=function(s,u){var f=u.id,O=u.groupId,x=u.url,w=u.deliveryDirectives;this.load({id:f,groupId:O,level:null,responseType:"text",type:L.PlaylistContextType.AUDIO_TRACK,url:x,deliveryDirectives:w})},d.onSubtitleTrackLoading=function(s,u){var f=u.id,O=u.groupId,x=u.url,w=u.deliveryDirectives;this.load({id:f,groupId:O,level:null,responseType:"text",type:L.PlaylistContextType.SUBTITLE_TRACK,url:x,deliveryDirectives:w})},d.load=function(s){var u,f=this.hls.config,O=this.getInternalLoader(s);if(O){var x=O.context;if(x&&x.url===s.url){V.logger.trace("[playlist-loader]: playlist request ongoing");return}V.logger.log("[playlist-loader]: aborting previous loader for type: "+s.type),O.abort()}var w,A,R,T;switch(s.type){case L.PlaylistContextType.MANIFEST:w=f.manifestLoadingMaxRetry,A=f.manifestLoadingTimeOut,R=f.manifestLoadingRetryDelay,T=f.manifestLoadingMaxRetryTimeout;break;case L.PlaylistContextType.LEVEL:case L.PlaylistContextType.AUDIO_TRACK:case L.PlaylistContextType.SUBTITLE_TRACK:w=0,A=f.levelLoadingTimeOut;break;default:w=f.levelLoadingMaxRetry,A=f.levelLoadingTimeOut,R=f.levelLoadingRetryDelay,T=f.levelLoadingMaxRetryTimeout;break}if(O=this.createInternalLoader(s),(u=s.deliveryDirectives)!==null&&u!==void 0&&u.part){var E;if(s.type===L.PlaylistContextType.LEVEL&&s.level!==null?E=this.hls.levels[s.level].details:s.type===L.PlaylistContextType.AUDIO_TRACK&&s.id!==null?E=this.hls.audioTracks[s.id].details:s.type===L.PlaylistContextType.SUBTITLE_TRACK&&s.id!==null&&(E=this.hls.subtitleTracks[s.id].details),E){var g=E.partTarget,a=E.targetduration;g&&a&&(A=Math.min(Math.max(g*3,a*.8)*1e3,A))}}var m={timeout:A,maxRetry:w,retryDelay:R,maxRetryDelay:T,highWaterMark:0},r={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};O.load(s,m,r)},d.loadsuccess=function(s,u,f,O){if(O===void 0&&(O=null),f.isSidxRequest){this.handleSidxRequest(s,f),this.handlePlaylistLoaded(s,u,f,O);return}this.resetInternalLoader(f.type);var x=s.data;if(x.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(s,f,"no EXTM3U delimiter",O);return}u.parsing.start=performance.now(),x.indexOf("#EXTINF:")>0||x.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(s,u,f,O):this.handleMasterPlaylist(s,u,f,O)},d.loaderror=function(s,u,f){f===void 0&&(f=null),this.handleNetworkError(u,f,!1,s)},d.loadtimeout=function(s,u,f){f===void 0&&(f=null),this.handleNetworkError(u,f,!0)},d.handleMasterPlaylist=function(s,u,f,O){var x=this.hls,w=s.data,A=p(s,f),R=k.default.parseMasterPlaylist(w,A),T=R.levels,E=R.sessionData;if(!T.length){this.handleManifestParsingError(s,f,"no level found in manifest",O);return}var g=T.map(function(M){return{id:M.attrs.AUDIO,audioCodec:M.audioCodec}}),a=T.map(function(M){return{id:M.attrs.SUBTITLES,textCodec:M.textCodec}}),m=k.default.parseMasterPlaylistMedia(w,A,"AUDIO",g),r=k.default.parseMasterPlaylistMedia(w,A,"SUBTITLES",a),b=k.default.parseMasterPlaylistMedia(w,A,"CLOSED-CAPTIONS");if(m.length){var P=m.some(function(M){return!M.url});!P&&T[0].audioCodec&&!T[0].attrs.AUDIO&&(V.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),m.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new y.AttrList({}),bitrate:0,url:""}))}x.trigger(j.Events.MANIFEST_LOADED,{levels:T,audioTracks:m,subtitles:r,captions:b,url:A,stats:u,networkDetails:O,sessionData:E})},d.handleTrackOrLevelPlaylist=function(s,u,f,O){var x=this.hls,w=f.id,A=f.level,R=f.type,T=p(s,f),E=Object($.isFiniteNumber)(w)?w:0,g=Object($.isFiniteNumber)(A)?A:E,a=v(f),m=k.default.parseLevelPlaylist(s.data,T,g,a,E);if(!m.fragments.length){x.trigger(j.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:T,reason:"no fragments found in level",level:typeof f.level=="number"?f.level:void 0});return}if(R===L.PlaylistContextType.MANIFEST){var r={attrs:new y.AttrList({}),bitrate:0,details:m,name:"",url:T};x.trigger(j.Events.MANIFEST_LOADED,{levels:[r],audioTracks:[],url:T,stats:u,networkDetails:O,sessionData:null})}if(u.parsing.end=performance.now(),m.needSidxRanges){var b,P=(b=m.fragments[0].initSegment)===null||b===void 0?void 0:b.url;this.load({url:P,isSidxRequest:!0,type:R,level:A,levelDetails:m,id:w,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}f.levelDetails=m,this.handlePlaylistLoaded(s,u,f,O)},d.handleSidxRequest=function(s,u){var f=Object(H.parseSegmentIndex)(new Uint8Array(s.data));if(!f)return;var O=f.references,x=u.levelDetails;O.forEach(function(w,A){var R=w.info,T=x.fragments[A];T.byteRange.length===0&&T.setByteRange(String(1+R.end-R.start)+"@"+String(R.start)),T.initSegment&&T.initSegment.setByteRange(String(f.moovEndOffset)+"@0")})},d.handleManifestParsingError=function(s,u,f,O){this.hls.trigger(j.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:u.type===L.PlaylistContextType.MANIFEST,url:s.url,reason:f,response:s,context:u,networkDetails:O})},d.handleNetworkError=function(s,u,f,O){f===void 0&&(f=!1),V.logger.warn("[playlist-loader]: A network "+(f?"timeout":"error")+" occurred while loading "+s.type+" level: "+s.level+" id: "+s.id+' group-id: "'+s.groupId+'"');var x=F.ErrorDetails.UNKNOWN,w=!1,A=this.getInternalLoader(s);switch(s.type){case L.PlaylistContextType.MANIFEST:x=f?F.ErrorDetails.MANIFEST_LOAD_TIMEOUT:F.ErrorDetails.MANIFEST_LOAD_ERROR,w=!0;break;case L.PlaylistContextType.LEVEL:x=f?F.ErrorDetails.LEVEL_LOAD_TIMEOUT:F.ErrorDetails.LEVEL_LOAD_ERROR,w=!1;break;case L.PlaylistContextType.AUDIO_TRACK:x=f?F.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:F.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,w=!1;break;case L.PlaylistContextType.SUBTITLE_TRACK:x=f?F.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:F.ErrorDetails.SUBTITLE_LOAD_ERROR,w=!1;break}A&&this.resetInternalLoader(s.type);var R={type:F.ErrorTypes.NETWORK_ERROR,details:x,fatal:w,url:s.url,loader:A,context:s,networkDetails:u};O&&(R.response=O),this.hls.trigger(j.Events.ERROR,R)},d.handlePlaylistLoaded=function(s,u,f,O){var x=f.type,w=f.level,A=f.id,R=f.groupId,T=f.loader,E=f.levelDetails,g=f.deliveryDirectives;if(!(E!=null&&E.targetduration)){this.handleManifestParsingError(s,f,"invalid target duration",O);return}if(!T)return;E.live&&(T.getCacheAge&&(E.ageHeader=T.getCacheAge()||0),(!T.getCacheAge||isNaN(E.ageHeader))&&(E.ageHeader=0));switch(x){case L.PlaylistContextType.MANIFEST:case L.PlaylistContextType.LEVEL:this.hls.trigger(j.Events.LEVEL_LOADED,{details:E,level:w||0,id:A||0,stats:u,networkDetails:O,deliveryDirectives:g});break;case L.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(j.Events.AUDIO_TRACK_LOADED,{details:E,id:A||0,groupId:R||"",stats:u,networkDetails:O,deliveryDirectives:g});break;case L.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(j.Events.SUBTITLE_TRACK_LOADED,{details:E,id:A||0,groupId:R||"",stats:u,networkDetails:O,deliveryDirectives:g});break}},h}();Z.default=c},"./src/polyfills/number.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"isFiniteNumber",function(){return $}),D.d(Z,"MAX_SAFE_INTEGER",function(){return j});var $=Number.isFinite||function(F){return typeof F=="number"&&isFinite(F)},j=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(oe,Z,D){"use strict";D.r(Z);var $=function(){function j(){}return j.getSilentFrame=function(V,H){switch(V){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},j}();Z.default=$},"./src/remux/mp4-generator.ts":function(oe,Z,D){"use strict";D.r(Z);var $=Math.pow(2,32)-1,j=function(){function F(){}return F.init=function(){F.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 F.types)F.types.hasOwnProperty(H)&&(F.types[H]=[H.charCodeAt(0),H.charCodeAt(1),H.charCodeAt(2),H.charCodeAt(3)]);var k=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),L=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);F.HDLR_TYPES={video:k,audio:L};var y=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),v=new Uint8Array([0,0,0,0,0,0,0,0]);F.STTS=F.STSC=F.STCO=v,F.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),F.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),F.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),F.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var p=new Uint8Array([105,115,111,109]),c=new Uint8Array([97,118,99,49]),h=new Uint8Array([0,0,0,1]);F.FTYP=F.box(F.types.ftyp,p,h,p,c),F.DINF=F.box(F.types.dinf,F.box(F.types.dref,y))},F.box=function(H){for(var k=8,L=arguments.length,y=new Array(L>1?L-1:0),v=1;v<L;v++)y[v-1]=arguments[v];for(var p=y.length,c=p;p--;)k+=y[p].byteLength;var h=new Uint8Array(k);for(h[0]=k>>24&255,h[1]=k>>16&255,h[2]=k>>8&255,h[3]=k&255,h.set(H,4),p=0,k=8;p<c;p++)h.set(y[p],k),k+=y[p].byteLength;return h},F.hdlr=function(H){return F.box(F.types.hdlr,F.HDLR_TYPES[H])},F.mdat=function(H){return F.box(F.types.mdat,H)},F.mdhd=function(H,k){k*=H;var L=Math.floor(k/($+1)),y=Math.floor(k%($+1));return F.box(F.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,L>>24,L>>16&255,L>>8&255,L&255,y>>24,y>>16&255,y>>8&255,y&255,85,196,0,0]))},F.mdia=function(H){return F.box(F.types.mdia,F.mdhd(H.timescale,H.duration),F.hdlr(H.type),F.minf(H))},F.mfhd=function(H){return F.box(F.types.mfhd,new Uint8Array([0,0,0,0,H>>24,H>>16&255,H>>8&255,H&255]))},F.minf=function(H){return H.type==="audio"?F.box(F.types.minf,F.box(F.types.smhd,F.SMHD),F.DINF,F.stbl(H)):F.box(F.types.minf,F.box(F.types.vmhd,F.VMHD),F.DINF,F.stbl(H))},F.moof=function(H,k,L){return F.box(F.types.moof,F.mfhd(H),F.traf(L,k))},F.moov=function(H){for(var k=H.length,L=[];k--;)L[k]=F.trak(H[k]);return F.box.apply(null,[F.types.moov,F.mvhd(H[0].timescale,H[0].duration)].concat(L).concat(F.mvex(H)))},F.mvex=function(H){for(var k=H.length,L=[];k--;)L[k]=F.trex(H[k]);return F.box.apply(null,[F.types.mvex].concat(L))},F.mvhd=function(H,k){k*=H;var L=Math.floor(k/($+1)),y=Math.floor(k%($+1)),v=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,L>>24,L>>16&255,L>>8&255,L&255,y>>24,y>>16&255,y>>8&255,y&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 F.box(F.types.mvhd,v)},F.sdtp=function(H){var k=H.samples||[],L=new Uint8Array(4+k.length),y,v;for(y=0;y<k.length;y++)v=k[y].flags,L[y+4]=v.dependsOn<<4|v.isDependedOn<<2|v.hasRedundancy;return F.box(F.types.sdtp,L)},F.stbl=function(H){return F.box(F.types.stbl,F.stsd(H),F.box(F.types.stts,F.STTS),F.box(F.types.stsc,F.STSC),F.box(F.types.stsz,F.STSZ),F.box(F.types.stco,F.STCO))},F.avc1=function(H){var k=[],L=[],y,v,p;for(y=0;y<H.sps.length;y++)v=H.sps[y],p=v.byteLength,k.push(p>>>8&255),k.push(p&255),k=k.concat(Array.prototype.slice.call(v));for(y=0;y<H.pps.length;y++)v=H.pps[y],p=v.byteLength,L.push(p>>>8&255),L.push(p&255),L=L.concat(Array.prototype.slice.call(v));var c=F.box(F.types.avcC,new Uint8Array([1,k[3],k[4],k[5],252|3,224|H.sps.length].concat(k).concat([H.pps.length]).concat(L))),h=H.width,d=H.height,l=H.pixelRatio[0],s=H.pixelRatio[1];return F.box(F.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,h>>8&255,h&255,d>>8&255,d&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),c,F.box(F.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),F.box(F.types.pasp,new Uint8Array([l>>24,l>>16&255,l>>8&255,l&255,s>>24,s>>16&255,s>>8&255,s&255])))},F.esds=function(H){var k=H.config.length;return new Uint8Array([0,0,0,0,3,23+k,0,1,0,4,15+k,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([k]).concat(H.config).concat([6,1,2]))},F.mp4a=function(H){var k=H.samplerate;return F.box(F.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,k>>8&255,k&255,0,0]),F.box(F.types.esds,F.esds(H)))},F.mp3=function(H){var k=H.samplerate;return F.box(F.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,k>>8&255,k&255,0,0]))},F.stsd=function(H){return H.type==="audio"?!H.isAAC&&H.codec==="mp3"?F.box(F.types.stsd,F.STSD,F.mp3(H)):F.box(F.types.stsd,F.STSD,F.mp4a(H)):F.box(F.types.stsd,F.STSD,F.avc1(H))},F.tkhd=function(H){var k=H.id,L=H.duration*H.timescale,y=H.width,v=H.height,p=Math.floor(L/($+1)),c=Math.floor(L%($+1));return F.box(F.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,0,0,0,0,p>>24,p>>16&255,p>>8&255,p&255,c>>24,c>>16&255,c>>8&255,c&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,y>>8&255,y&255,0,0,v>>8&255,v&255,0,0]))},F.traf=function(H,k){var L=F.sdtp(H),y=H.id,v=Math.floor(k/($+1)),p=Math.floor(k%($+1));return F.box(F.types.traf,F.box(F.types.tfhd,new Uint8Array([0,0,0,0,y>>24,y>>16&255,y>>8&255,y&255])),F.box(F.types.tfdt,new Uint8Array([1,0,0,0,v>>24,v>>16&255,v>>8&255,v&255,p>>24,p>>16&255,p>>8&255,p&255])),F.trun(H,L.length+16+20+8+16+8+8),L)},F.trak=function(H){return H.duration=H.duration||4294967295,F.box(F.types.trak,F.tkhd(H),F.mdia(H))},F.trex=function(H){var k=H.id;return F.box(F.types.trex,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},F.trun=function(H,k){var L=H.samples||[],y=L.length,v=12+16*y,p=new Uint8Array(v),c,h,d,l,s,u;for(k+=8+v,p.set([0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255],0),c=0;c<y;c++)h=L[c],d=h.duration,l=h.size,s=h.flags,u=h.cts,p.set([d>>>24&255,d>>>16&255,d>>>8&255,d&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,s.degradPrio&240<<8,s.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*c);return F.box(F.types.trun,p)},F.initSegment=function(H){F.types||F.init();var k=F.moov(H),L=new Uint8Array(F.FTYP.byteLength+k.byteLength);return L.set(F.FTYP),L.set(k,F.FTYP.byteLength),L},F}();j.types=void 0,j.HDLR_TYPES=void 0,j.STTS=void 0,j.STSC=void 0,j.STCO=void 0,j.STSZ=void 0,j.VMHD=void 0,j.SMHD=void 0,j.STSD=void 0,j.FTYP=void 0,j.DINF=void 0,Z.default=j},"./src/remux/mp4-remuxer.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return u}),D.d(Z,"normalizePts",function(){return f});var $=D("./src/polyfills/number.ts"),j=D("./src/remux/aac-helper.ts"),F=D("./src/remux/mp4-generator.ts"),V=D("./src/events.ts"),H=D("./src/errors.ts"),k=D("./src/utils/logger.ts"),L=D("./src/types/loader.ts"),y=D("./src/utils/timescale-conversion.ts");function v(){return v=Object.assign||function(A){for(var R=1;R<arguments.length;R++){var T=arguments[R];for(var E in T)Object.prototype.hasOwnProperty.call(T,E)&&(A[E]=T[E])}return A},v.apply(this,arguments)}var p=10*1e3,c=1024,h=1152,d=null,l=null,s=!1,u=function(){function A(T,E,g,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=T,this.config=E,this.typeSupported=g,this.ISGenerated=!1,d===null){var m=navigator.userAgent||"",r=m.match(/Chrome\/(\d+)/i);d=r?parseInt(r[1]):0}if(l===null){var b=navigator.userAgent.match(/Safari\/(\d+)/i);l=b?parseInt(b[1]):0}s=!!d&&d<75||!!l&&l<600}var R=A.prototype;return R.destroy=function(){},R.resetTimeStamp=function(E){k.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=E},R.resetNextTimestamp=function(){k.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},R.resetInitSegment=function(){k.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},R.getVideoStartPts=function(E){var g=!1,a=E.reduce(function(m,r){var b=r.pts-m;return b<-4294967296?(g=!0,f(m,r.pts)):b>0?m:r.pts},E[0].pts);return g&&k.logger.debug("PTS rollover detected"),a},R.remux=function(E,g,a,m,r,b,P,M){var W,X,U,S,B,J,te=r,ae=r,_e=E.pid>-1,de=g.pid>-1,Ee=g.samples.length,Te=E.samples.length>0,me=Ee>1,ce=(!_e||Te)&&(!de||me)||this.ISGenerated||P;if(ce){this.ISGenerated||(U=this.generateIS(E,g,r));var se=this.isVideoContiguous,Se=-1;if(me&&(Se=O(g.samples),!se&&this.config.forceKeyFrameOnDiscontinuity))if(J=!0,Se>0){k.logger.warn("[mp4-remuxer]: Dropped "+Se+" out of "+Ee+" video samples due to a missing keyframe");var je=this.getVideoStartPts(g.samples);g.samples=g.samples.slice(Se),g.dropped+=Se,ae+=(g.samples[0].pts-je)/(g.timescale||9e4)}else Se===-1&&(k.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ee+" video samples"),J=!1);if(this.ISGenerated){if(Te&&me){var We=this.getVideoStartPts(g.samples),Xe=f(E.samples[0].pts,We)-We,Qe=Xe/g.inputTimeScale;te+=Math.max(0,Qe),ae+=Math.max(0,-Qe)}if(Te){if(E.samplerate||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),U=this.generateIS(E,g,r)),X=this.remuxAudio(E,te,this.isAudioContiguous,b,de||me||M===L.PlaylistLevelType.AUDIO?ae:void 0),me){var Pe=X?X.endPTS-X.startPTS:0;g.inputTimeScale||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),U=this.generateIS(E,g,r)),W=this.remuxVideo(g,ae,se,Pe)}}else me&&(W=this.remuxVideo(g,ae,se,0));W&&(W.firstKeyFrame=Se,W.independent=Se!==-1)}}return this.ISGenerated&&(a.samples.length&&(B=this.remuxID3(a,r)),m.samples.length&&(S=this.remuxText(m,r))),{audio:X,video:W,initSegment:U,independent:J,text:S,id3:B}},R.generateIS=function(E,g,a){var m=E.samples,r=g.samples,b=this.typeSupported,P={},M=!Object($.isFiniteNumber)(this._initPTS),W="audio/mp4",X,U,S;if(M&&(X=U=Infinity),E.config&&m.length&&(E.timescale=E.samplerate,E.isAAC||(b.mpeg?(W="audio/mpeg",E.codec=""):b.mp3&&(E.codec="mp3")),P.audio={id:"audio",container:W,codec:E.codec,initSegment:!E.isAAC&&b.mpeg?new Uint8Array(0):F.default.initSegment([E]),metadata:{channelCount:E.channelCount}},M&&(S=E.inputTimeScale,X=U=m[0].pts-Math.round(S*a))),g.sps&&g.pps&&r.length&&(g.timescale=g.inputTimeScale,P.video={id:"main",container:"video/mp4",codec:g.codec,initSegment:F.default.initSegment([g]),metadata:{width:g.width,height:g.height}},M)){S=g.inputTimeScale;var B=this.getVideoStartPts(r),J=Math.round(S*a);U=Math.min(U,f(r[0].dts,B)-J),X=Math.min(X,B-J)}if(Object.keys(P).length)return this.ISGenerated=!0,M&&(this._initPTS=X,this._initDTS=U),{tracks:P,initPTS:X,timescale:S}},R.remuxVideo=function(E,g,a,m){var r=E.inputTimeScale,b=E.samples,P=[],M=b.length,W=this._initPTS,X=this.nextAvcDts,U=8,S,B,J,te=Number.POSITIVE_INFINITY,ae=Number.NEGATIVE_INFINITY,_e=0,de=!1;if(!a||X===null){var Ee=g*r,Te=b[0].pts-f(b[0].dts,b[0].pts);X=Ee-Te}for(var me=0;me<M;me++){var ce=b[me];if(ce.pts=f(ce.pts-W,X),ce.dts=f(ce.dts-W,X),ce.dts>ce.pts){var se=9e4*.2;_e=Math.max(Math.min(_e,ce.pts-ce.dts),-1*se)}ce.dts<b[me>0?me-1:me].dts&&(de=!0)}de&&b.sort(function(Vt,tt){var ke=Vt.dts-tt.dts,Ct=Vt.pts-tt.pts;return ke||Ct}),B=b[0].dts,J=b[b.length-1].dts;var Se=Math.round((J-B)/(M-1));if(_e<0){if(_e<Se*-2){k.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(y.toMsFromMpegTsClock)(-Se,!0)+" ms");for(var je=_e,We=0;We<M;We++)b[We].dts=je=Math.max(je,b[We].pts-Se),b[We].pts=Math.max(je,b[We].pts)}else{k.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(y.toMsFromMpegTsClock)(_e,!0)+" ms to overcome this issue");for(var Xe=0;Xe<M;Xe++)b[Xe].dts=b[Xe].dts+_e}B=b[0].dts}if(a){var Qe=B-X,Pe=Qe>Se,Ue=Qe<-1;if(Pe||Ue){Pe?k.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(Qe,!0)+" ms ("+Qe+"dts) hole between fragments detected, filling it"):k.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(-Qe,!0)+" ms ("+Qe+"dts) overlapping between fragments detected"),B=X;var Ye=b[0].pts-Qe;b[0].dts=B,b[0].pts=Ye,k.logger.log("Video: First PTS/DTS adjusted: "+Object(y.toMsFromMpegTsClock)(Ye,!0)+"/"+Object(y.toMsFromMpegTsClock)(B,!0)+", delta: "+Object(y.toMsFromMpegTsClock)(Qe,!0)+" ms")}}s&&(B=Math.max(0,B));for(var Ze=0,Ve=0,He=0;He<M;He++){for(var Fe=b[He],ft=Fe.units,lt=ft.length,rt=0,dt=0;dt<lt;dt++)rt+=ft[dt].data.length;Ve+=rt,Ze+=lt,Fe.length=rt,Fe.dts=Math.max(Fe.dts,B),Fe.pts=Math.max(Fe.pts,Fe.dts,0),te=Math.min(Fe.pts,te),ae=Math.max(Fe.pts,ae)}J=b[M-1].dts;var bt=Ve+4*Ze+8,ut;try{ut=new Uint8Array(bt)}catch(Vt){this.observer.emit(V.Events.ERROR,V.Events.ERROR,{type:H.ErrorTypes.MUX_ERROR,details:H.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:bt,reason:"fail allocating video mdat "+bt});return}var at=new DataView(ut.buffer);at.setUint32(0,bt),ut.set(F.default.types.mdat,4);for(var Ie=0;Ie<M;Ie++){for(var yt=b[Ie],nt=yt.units,Oe=0,Ge=0,be=nt.length;Ge<be;Ge++){var fe=nt[Ge],pe=fe.data,ie=fe.data.byteLength;at.setUint32(U,ie),U+=4,ut.set(pe,U),U+=ie,Oe+=4+ie}if(Ie<M-1)S=b[Ie+1].dts-yt.dts;else{var re=this.config,ue=yt.dts-b[Ie>0?Ie-1:Ie].dts;if(re.stretchShortVideoTrack&&this.nextAudioPts!==null){var ge=Math.floor(re.maxBufferHole*r),ye=(m?te+m*r:this.nextAudioPts)-yt.pts;ye>ge?(S=ye-ue,S<0&&(S=ue),k.logger.log("[mp4-remuxer]: It is approximately "+ye/90+" ms to the next segment; using duration "+S/90+" ms for the last video frame.")):S=ue}else S=ue}var Le=Math.round(yt.pts-yt.dts);P.push(new x(yt.key,S,Oe,Le))}if(P.length&&d&&d<70){var Be=P[0].flags;Be.dependsOn=2,Be.isNonSync=0}console.assert(S!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=X=J+S,this.isVideoContiguous=!0;var pt=F.default.moof(E.sequenceNumber++,B,v({},E,{samples:P})),It="video",Lt={data1:pt,data2:ut,startPTS:te/r,endPTS:(ae+S)/r,startDTS:B/r,endDTS:X/r,type:It,hasAudio:!1,hasVideo:!0,nb:P.length,dropped:E.dropped};return E.samples=[],E.dropped=0,console.assert(ut.length,"MDAT length must not be zero"),Lt},R.remuxAudio=function(E,g,a,m,r){var b=E.inputTimeScale,P=E.samplerate?E.samplerate:b,M=b/P,W=E.isAAC?c:h,X=W*M,U=this._initPTS,S=!E.isAAC&&this.typeSupported.mpeg,B=[],J=E.samples,te=S?0:8,ae=this.nextAudioPts||-1,_e=g*b;if(this.isAudioContiguous=a=a||J.length&&ae>0&&(m&&Math.abs(_e-ae)<9e3||Math.abs(f(J[0].pts-U,_e)-ae)<20*X),J.forEach(function(pe){pe.pts=f(pe.pts-U,_e)}),!a||ae<0){if(J=J.filter(function(pe){return pe.pts>=0}),!J.length)return;r===0?ae=0:m?ae=Math.max(0,_e):ae=J[0].pts}if(E.isAAC)for(var de=r!==void 0,Ee=this.config.maxAudioFramesDrift,Te=0,me=ae;Te<J.length;Te++){var ce=J[Te],se=ce.pts,Se=se-me,je=Math.abs(1e3*Se/b);if(Se<=-Ee*X&&de)Te===0&&(k.logger.warn("Audio frame @ "+(se/b).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Se/b)+" ms."),this.nextAudioPts=ae=me=se);else if(Se>=Ee*X&&je<p&&de){var We=Math.round(Se/X);me=se-We*X,me<0&&(We--,me+=X),Te===0&&(this.nextAudioPts=ae=me),k.logger.warn("[mp4-remuxer]: Injecting "+We+" audio frame @ "+(me/b).toFixed(3)+"s due to "+Math.round(1e3*Se/b)+" ms gap.");for(var Xe=0;Xe<We;Xe++){var Qe=Math.max(me,0),Pe=j.default.getSilentFrame(E.manifestCodec||E.codec,E.channelCount);Pe||(k.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Pe=ce.unit.subarray()),J.splice(Te,0,{unit:Pe,pts:Qe}),me+=X,Te++}}ce.pts=me,me+=X}for(var Ue=null,Ye=null,Ze,Ve=0,He=J.length;He--;)Ve+=J[He].unit.byteLength;for(var Fe=0,ft=J.length;Fe<ft;Fe++){var lt=J[Fe],rt=lt.unit,dt=lt.pts;if(Ye!==null){var bt=B[Fe-1];bt.duration=Math.round((dt-Ye)/M)}else if(a&&E.isAAC&&(dt=ae),Ue=dt,Ve>0){Ve+=te;try{Ze=new Uint8Array(Ve)}catch(pe){this.observer.emit(V.Events.ERROR,V.Events.ERROR,{type:H.ErrorTypes.MUX_ERROR,details:H.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ve,reason:"fail allocating audio mdat "+Ve});return}if(!S){var ut=new DataView(Ze.buffer);ut.setUint32(0,Ve),Ze.set(F.default.types.mdat,4)}}else return;Ze.set(rt,te);var at=rt.byteLength;te+=at,B.push(new x(!0,W,at,0)),Ye=dt}var Ie=B.length;if(!Ie)return;var yt=B[B.length-1];this.nextAudioPts=ae=Ye+M*yt.duration;var nt=S?new Uint8Array(0):F.default.moof(E.sequenceNumber++,Ue/M,v({},E,{samples:B}));E.samples=[];var Oe=Ue/b,Ge=ae/b,be="audio",fe={data1:nt,data2:Ze,startPTS:Oe,endPTS:Ge,startDTS:Oe,endDTS:Ge,type:be,hasAudio:!0,hasVideo:!1,nb:Ie};return this.isAudioContiguous=!0,console.assert(Ze.length,"MDAT length must not be zero"),fe},R.remuxEmptyAudio=function(E,g,a,m){var r=E.inputTimeScale,b=E.samplerate?E.samplerate:r,P=r/b,M=this.nextAudioPts,W=(M!==null?M:m.startDTS*r)+this._initDTS,X=m.endDTS*r+this._initDTS,U=P*c,S=Math.ceil((X-W)/U),B=j.default.getSilentFrame(E.manifestCodec||E.codec,E.channelCount);if(k.logger.warn("[mp4-remuxer]: remux empty Audio"),!B){k.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var J=[],te=0;te<S;te++){var ae=W+te*U;J.push({unit:B,pts:ae,dts:ae})}return E.samples=J,this.remuxAudio(E,g,a,!1)},R.remuxID3=function(E,g){var a=E.samples.length;if(!a)return;for(var m=E.inputTimeScale,r=this._initPTS,b=this._initDTS,P=0;P<a;P++){var M=E.samples[P];M.pts=f(M.pts-r,g*m)/m,M.dts=f(M.dts-b,g*m)/m}var W=E.samples;return E.samples=[],{samples:W}},R.remuxText=function(E,g){var a=E.samples.length;if(!a)return;for(var m=E.inputTimeScale,r=this._initPTS,b=0;b<a;b++){var P=E.samples[b];P.pts=f(P.pts-r,g*m)/m}E.samples.sort(function(W,X){return W.pts-X.pts});var M=E.samples;return E.samples=[],{samples:M}},A}();function f(A,R){var T;if(R===null)return A;for(R<A?T=-8589934592:T=8589934592;Math.abs(A-R)>4294967296;)A+=T;return A}function O(A){for(var R=0;R<A.length;R++)if(A[R].key)return R;return-1}var x=function(R,T,E,g){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=T,this.size=E,this.cts=g,this.flags=new w(R)},w=function(R){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=R?2:1,this.isNonSync=R?0:1}},"./src/remux/passthrough-remuxer.ts":function(oe,Z,D){"use strict";D.r(Z);var $=D("./src/polyfills/number.ts"),j=D("./src/utils/mp4-tools.ts"),F=D("./src/loader/fragment.ts"),V=D("./src/utils/logger.ts"),H=function(){function y(){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 v=y.prototype;return v.destroy=function(){},v.resetTimeStamp=function(c){this.initPTS=c,this.lastEndDTS=null},v.resetNextTimestamp=function(){this.lastEndDTS=null},v.resetInitSegment=function(c,h,d){this.audioCodec=h,this.videoCodec=d,this.generateInitSegment(c),this.emitInitSegment=!0},v.generateInitSegment=function(c){var h=this.audioCodec,d=this.videoCodec;if(!c||!c.byteLength){this.initTracks=void 0,this.initData=void 0;return}var l=this.initData=Object(j.parseInitSegment)(c);h||(h=L(l.audio,F.ElementaryStreamTypes.AUDIO)),d||(d=L(l.video,F.ElementaryStreamTypes.VIDEO));var s={};l.audio&&l.video?s.audiovideo={container:"video/mp4",codec:h+","+d,initSegment:c,id:"main"}:l.audio?s.audio={container:"audio/mp4",codec:h,initSegment:c,id:"audio"}:l.video?s.video={container:"video/mp4",codec:d,initSegment:c,id:"main"}:V.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=s},v.remux=function(c,h,d,l,s){var u=this.initPTS,f=this.lastEndDTS,O={audio:void 0,video:void 0,text:l,id3:d,initSegment:void 0};Object($.isFiniteNumber)(f)||(f=this.lastEndDTS=s||0);var x=h.samples;if(!x||!x.length)return O;var w={initPTS:void 0,timescale:1},A=this.initData;if((!A||!A.length)&&(this.generateInitSegment(x),A=this.initData),!A||!A.length)return V.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),O;this.emitInitSegment&&(w.tracks=this.initTracks,this.emitInitSegment=!1),Object($.isFiniteNumber)(u)||(this.initPTS=w.initPTS=u=k(A,x,f));var R=Object(j.getDuration)(x,A),T=f,E=R+T;Object(j.offsetStartDTS)(A,x,u),R>0?this.lastEndDTS=E:(V.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var g=!!A.audio,a=!!A.video,m="";g&&(m+="audio"),a&&(m+="video");var r={data1:x,startPTS:T,startDTS:T,endPTS:E,endDTS:E,type:m,hasAudio:g,hasVideo:a,nb:1,dropped:0};return O.audio=r.type==="audio"?r:void 0,O.video=r.type!=="audio"?r:void 0,O.text=l,O.id3=d,O.initSegment=w,O},y}(),k=function(v,p,c){return Object(j.getStartDTS)(v,p)-c};function L(y,v){var p=y==null?void 0:y.codec;return p&&p.length>4?p:p==="hvc1"?"hvc1.1.c.L120.90":p==="av01"?"av01.0.04M.08":p==="avc1"||v===F.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Z.default=H},"./src/task-loop.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return $});var $=function(){function j(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var F=j.prototype;return F.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},F.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},F.onHandlerDestroyed=function(){},F.hasInterval=function(){return!!this._tickInterval},F.hasNextTick=function(){return!!this._tickTimer},F.setInterval=function(H){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,H),!0)},F.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},F.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},F.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},F.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},F.doTick=function(){},j}()},"./src/types/cmcd.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"CMCDVersion",function(){return $}),D.d(Z,"CMCDObjectType",function(){return j}),D.d(Z,"CMCDStreamingFormat",function(){return F}),D.d(Z,"CMCDStreamType",function(){return V});var $=1,j;(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"})(j||(j={}));var F;(function(H){H.DASH="d",H.HLS="h",H.SMOOTH="s",H.OTHER="o"})(F||(F={}));var V;(function(H){H.VOD="v",H.LIVE="l"})(V||(V={}))},"./src/types/level.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"HlsSkip",function(){return F}),D.d(Z,"getSkipValue",function(){return V}),D.d(Z,"HlsUrlParameters",function(){return H}),D.d(Z,"Level",function(){return k});function $(L,y){for(var v=0;v<y.length;v++){var p=y[v];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(L,p.key,p)}}function j(L,y,v){return y&&$(L.prototype,y),v&&$(L,v),L}var F;(function(L){L.No="",L.Yes="YES",L.v2="v2"})(F||(F={}));function V(L,y){var v=L.canSkipUntil,p=L.canSkipDateRanges,c=L.endSN,h=y!==void 0?y-c:0;return v&&h<v?p?F.v2:F.Yes:F.No}var H=function(){function L(v,p,c){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=v,this.part=p,this.skip=c}var y=L.prototype;return y.addDirectives=function(p){var c=new self.URL(p);return this.msn!==void 0&&c.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&c.searchParams.set("_HLS_part",this.part.toString()),this.skip&&c.searchParams.set("_HLS_skip",this.skip),c.toString()},L}(),k=function(){function L(y){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=[y.url],this.attrs=y.attrs,this.bitrate=y.bitrate,y.details&&(this.details=y.details),this.id=y.id||0,this.name=y.name,this.width=y.width||0,this.height=y.height||0,this.audioCodec=y.audioCodec,this.videoCodec=y.videoCodec,this.unknownCodecs=y.unknownCodecs,this.codecSet=[y.videoCodec,y.audioCodec].filter(function(v){return v}).join(",").replace(/\.[^.,]+/g,"")}return j(L,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(v){var p=v%this.url.length;this._urlId!==p&&(this.details=void 0,this._urlId=p)}}]),L}()},"./src/types/loader.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"PlaylistContextType",function(){return $}),D.d(Z,"PlaylistLevelType",function(){return j});var $;(function(F){F.MANIFEST="manifest",F.LEVEL="level",F.AUDIO_TRACK="audioTrack",F.SUBTITLE_TRACK="subtitleTrack"})($||($={}));var j;(function(F){F.MAIN="main",F.AUDIO="audio",F.SUBTITLE="subtitle"})(j||(j={}))},"./src/types/transmuxer.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"ChunkMetadata",function(){return $});var $=function(V,H,k,L,y,v){L===void 0&&(L=0),y===void 0&&(y=-1),v===void 0&&(v=!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=j(),this.buffering={audio:j(),video:j(),audiovideo:j()},this.level=V,this.sn=H,this.id=k,this.size=L,this.part=y,this.partial=v};function j(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"AttrList",function(){return F});var $=/^(\d+)x(\d+)$/,j=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,F=function(){function V(k){typeof k=="string"&&(k=V.parseAttrList(k));for(var L in k)k.hasOwnProperty(L)&&(this[L]=k[L])}var H=V.prototype;return H.decimalInteger=function(L){var y=parseInt(this[L],10);return y>Number.MAX_SAFE_INTEGER?Infinity:y},H.hexadecimalInteger=function(L){if(this[L]){var y=(this[L]||"0x").slice(2);y=(y.length&1?"0":"")+y;for(var v=new Uint8Array(y.length/2),p=0;p<y.length/2;p++)v[p]=parseInt(y.slice(p*2,p*2+2),16);return v}else return null},H.hexadecimalIntegerAsNumber=function(L){var y=parseInt(this[L],16);return y>Number.MAX_SAFE_INTEGER?Infinity:y},H.decimalFloatingPoint=function(L){return parseFloat(this[L])},H.optionalFloat=function(L,y){var v=this[L];return v?parseFloat(v):y},H.enumeratedString=function(L){return this[L]},H.bool=function(L){return this[L]==="YES"},H.decimalResolution=function(L){var y=$.exec(this[L]);return y===null?void 0:{width:parseInt(y[1],10),height:parseInt(y[2],10)}},V.parseAttrList=function(L){var y,v={},p='"';for(j.lastIndex=0;(y=j.exec(L))!==null;){var c=y[2];c.indexOf(p)===0&&c.lastIndexOf(p)===c.length-1&&(c=c.slice(1,-1)),v[y[1]]=c}return v},V}()},"./src/utils/binary-search.ts":function(oe,Z,D){"use strict";D.r(Z);var $={search:function(F,V){for(var H=0,k=F.length-1,L=null,y=null;H<=k;){L=(H+k)/2|0,y=F[L];var v=V(y);if(v>0)H=L+1;else if(v<0)k=L-1;else return y}return null}};Z.default=$},"./src/utils/buffer-helper.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"BufferHelper",function(){return F});var $=D("./src/utils/logger.ts"),j={length:0,start:function(){return 0},end:function(){return 0}},F=function(){function V(){}return V.isBuffered=function(k,L){try{if(k){for(var y=V.getBuffered(k),v=0;v<y.length;v++)if(L>=y.start(v)&&L<=y.end(v))return!0}}catch(p){}return!1},V.bufferInfo=function(k,L,y){try{if(k){var v=V.getBuffered(k),p=[],c;for(c=0;c<v.length;c++)p.push({start:v.start(c),end:v.end(c)});return this.bufferedInfo(p,L,y)}}catch(h){}return{len:0,start:L,end:L,nextStart:void 0}},V.bufferedInfo=function(k,L,y){L=Math.max(0,L),k.sort(function(w,A){var R=w.start-A.start;return R||A.end-w.end});var v=[];if(y)for(var p=0;p<k.length;p++){var c=v.length;if(c){var h=v[c-1].end;k[p].start-h<y?k[p].end>h&&(v[c-1].end=k[p].end):v.push(k[p])}else v.push(k[p])}else v=k;for(var d=0,l,s=L,u=L,f=0;f<v.length;f++){var O=v[f].start,x=v[f].end;if(L+y>=O&&L<x)s=O,u=x,d=u-L;else if(L+y<O){l=O;break}}return{len:d,start:s||0,end:u||0,nextStart:l}},V.getBuffered=function(k){try{return k.buffered}catch(L){return $.logger.log("failed to get media.buffered",L),j}},V}()},"./src/utils/cea-608-parser.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"Row",function(){return u}),D.d(Z,"CaptionScreen",function(){return f});var $=D("./src/utils/logger.ts"),j={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},F=function(E){var g=E;return j.hasOwnProperty(E)&&(g=j[E]),String.fromCharCode(g)},V=15,H=100,k={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},L={17:2,18:4,21:6,22:8,23:10,19:13,20:15},y={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},v={25:2,26:4,29:6,30:8,31:10,27:13,28:15},p=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],c;(function(T){T[T.ERROR=0]="ERROR",T[T.TEXT=1]="TEXT",T[T.WARNING=2]="WARNING",T[T.INFO=2]="INFO",T[T.DEBUG=3]="DEBUG",T[T.DATA=3]="DATA"})(c||(c={}));var h=function(){function T(){this.time=null,this.verboseLevel=c.ERROR}var E=T.prototype;return E.log=function(a,m){this.verboseLevel>=a&&$.logger.log(this.time+" ["+a+"] "+m)},T}(),d=function(E){for(var g=[],a=0;a<E.length;a++)g.push(E[a].toString(16));return g},l=function(){function T(g,a,m,r,b){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=g||"white",this.underline=a||!1,this.italics=m||!1,this.background=r||"black",this.flash=b||!1}var E=T.prototype;return E.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},E.setStyles=function(a){for(var m=["foreground","underline","italics","background","flash"],r=0;r<m.length;r++){var b=m[r];a.hasOwnProperty(b)&&(this[b]=a[b])}},E.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},E.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},E.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},E.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},T}(),s=function(){function T(g,a,m,r,b,P){this.uchar=void 0,this.penState=void 0,this.uchar=g||" ",this.penState=new l(a,m,r,b,P)}var E=T.prototype;return E.reset=function(){this.uchar=" ",this.penState.reset()},E.setChar=function(a,m){this.uchar=a,this.penState.copy(m)},E.setPenState=function(a){this.penState.copy(a)},E.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},E.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},E.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},T}(),u=function(){function T(g){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 s);this.logger=g,this.pos=0,this.currPenState=new l}var E=T.prototype;return E.equals=function(a){for(var m=!0,r=0;r<H;r++)if(!this.chars[r].equals(a.chars[r])){m=!1;break}return m},E.copy=function(a){for(var m=0;m<H;m++)this.chars[m].copy(a.chars[m])},E.isEmpty=function(){for(var a=!0,m=0;m<H;m++)if(!this.chars[m].isEmpty()){a=!1;break}return a},E.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(c.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>H&&(this.logger.log(c.DEBUG,"Too large cursor position "+this.pos),this.pos=H)},E.moveCursor=function(a){var m=this.pos+a;if(a>1)for(var r=this.pos+1;r<m+1;r++)this.chars[r].setPenState(this.currPenState);this.setCursor(m)},E.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},E.insertChar=function(a){a>=144&&this.backSpace();var m=F(a);if(this.pos>=H){this.logger.log(c.ERROR,"Cannot insert "+a.toString(16)+" ("+m+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(m,this.currPenState),this.moveCursor(1)},E.clearFromPos=function(a){var m;for(m=a;m<H;m++)this.chars[m].reset()},E.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},E.clearToEndOfRow=function(){this.clearFromPos(this.pos)},E.getTextString=function(){for(var a=[],m=!0,r=0;r<H;r++){var b=this.chars[r].uchar;b!==" "&&(m=!1),a.push(b)}return m?"":a.join("")},E.setPenStyles=function(a){this.currPenState.setStyles(a);var m=this.chars[this.pos];m.setPenState(this.currPenState)},T}(),f=function(){function T(g){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<V;a++)this.rows.push(new u(g));this.logger=g,this.currRow=V-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var E=T.prototype;return E.reset=function(){for(var a=0;a<V;a++)this.rows[a].clear();this.currRow=V-1},E.equals=function(a){for(var m=!0,r=0;r<V;r++)if(!this.rows[r].equals(a.rows[r])){m=!1;break}return m},E.copy=function(a){for(var m=0;m<V;m++)this.rows[m].copy(a.rows[m])},E.isEmpty=function(){for(var a=!0,m=0;m<V;m++)if(!this.rows[m].isEmpty()){a=!1;break}return a},E.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},E.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},E.insertChar=function(a){var m=this.rows[this.currRow];m.insertChar(a)},E.setPen=function(a){var m=this.rows[this.currRow];m.setPenStyles(a)},E.moveCursor=function(a){var m=this.rows[this.currRow];m.moveCursor(a)},E.setCursor=function(a){this.logger.log(c.INFO,"setCursor: "+a);var m=this.rows[this.currRow];m.setCursor(a)},E.setPAC=function(a){this.logger.log(c.INFO,"pacData = "+JSON.stringify(a));var m=a.row-1;if(this.nrRollUpRows&&m<this.nrRollUpRows-1&&(m=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==m){for(var r=0;r<V;r++)this.rows[r].clear();var b=this.currRow+1-this.nrRollUpRows,P=this.lastOutputScreen;if(P){var M=P.rows[b].cueStartTime,W=this.logger.time;if(M&&W!==null&&M<W)for(var X=0;X<this.nrRollUpRows;X++)this.rows[m-this.nrRollUpRows+X+1].copy(P.rows[b+X])}}this.currRow=m;var U=this.rows[this.currRow];if(a.indent!==null){var S=a.indent,B=Math.max(S-1,0);U.setCursor(a.indent),a.color=U.chars[B].penState.foreground}var J={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(J)},E.setBkgData=function(a){this.logger.log(c.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},E.setRollUpRows=function(a){this.nrRollUpRows=a},E.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(c.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(c.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,m=this.rows.splice(a,1)[0];m.clear(),this.rows.splice(this.currRow,0,m),this.logger.log(c.INFO,"Rolling up")},E.getDisplayText=function(a){a=a||!1;for(var m=[],r="",b=-1,P=0;P<V;P++){var M=this.rows[P].getTextString();M&&(b=P+1,a?m.push("Row "+b+": '"+M+"'"):m.push(M.trim()))}return m.length>0&&(a?r="["+m.join(" | ")+"]":r=m.join(`
|
|
`)),r},E.getTextAndFormat=function(){return this.rows},T}(),O=function(){function T(g,a,m){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=g,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new f(m),this.nonDisplayedMemory=new f(m),this.lastOutputScreen=new f(m),this.currRollUpRow=this.displayedMemory.rows[V-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=m}var E=T.prototype;return E.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[V-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},E.getHandler=function(){return this.outputFilter},E.setHandler=function(a){this.outputFilter=a},E.setPAC=function(a){this.writeScreen.setPAC(a)},E.setBkgData=function(a){this.writeScreen.setBkgData(a)},E.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(c.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},E.insertChars=function(a){for(var m=0;m<a.length;m++)this.writeScreen.insertChar(a[m]);var r=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(c.INFO,r+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(c.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},E.ccRCL=function(){this.logger.log(c.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},E.ccBS=function(){if(this.logger.log(c.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},E.ccAOF=function(){},E.ccAON=function(){},E.ccDER=function(){this.logger.log(c.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},E.ccRU=function(a){this.logger.log(c.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},E.ccFON=function(){this.logger.log(c.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},E.ccRDC=function(){this.logger.log(c.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},E.ccTR=function(){this.logger.log(c.INFO,"TR"),this.setMode("MODE_TEXT")},E.ccRTD=function(){this.logger.log(c.INFO,"RTD"),this.setMode("MODE_TEXT")},E.ccEDM=function(){this.logger.log(c.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},E.ccCR=function(){this.logger.log(c.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},E.ccENM=function(){this.logger.log(c.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},E.ccEOC=function(){if(this.logger.log(c.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(c.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},E.ccTO=function(a){this.logger.log(c.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},E.ccMIDROW=function(a){var m={flash:!1};if(m.underline=a%2===1,m.italics=a>=46,m.italics)m.foreground="white";else{var r=Math.floor(a/2)-16,b=["white","green","blue","cyan","red","yellow","magenta"];m.foreground=b[r]}this.logger.log(c.INFO,"MIDROW: "+JSON.stringify(m)),this.writeScreen.setPen(m)},E.outputDataUpdate=function(a){a===void 0&&(a=!1);var m=this.logger.time;if(m===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=m:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,m,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:m),this.lastOutputScreen.copy(this.displayedMemory))},E.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},T}(),x=function(){function T(g,a,m){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var r=new h;this.channels=[null,new O(g,a,r),new O(g+1,m,r)],this.cmdHistory=R(),this.logger=r}var E=T.prototype;return E.getHandler=function(a){return this.channels[a].getHandler()},E.setHandler=function(a,m){this.channels[a].setHandler(m)},E.addData=function(a,m){var r,b,P,M=!1;this.logger.time=a;for(var W=0;W<m.length;W+=2){if(b=m[W]&127,P=m[W+1]&127,b===0&&P===0)continue;if(this.logger.log(c.DATA,"["+d([m[W],m[W+1]])+"] -> ("+d([b,P])+")"),r=this.parseCmd(b,P),r||(r=this.parseMidrow(b,P)),r||(r=this.parsePAC(b,P)),r||(r=this.parseBackgroundAttributes(b,P)),!r&&(M=this.parseChars(b,P),M)){var X=this.currentChannel;if(X&&X>0){var U=this.channels[X];U.insertChars(M)}else this.logger.log(c.WARNING,"No channel found yet. TEXT-MODE?")}!r&&!M&&this.logger.log(c.WARNING,"Couldn't parse cleaned data "+d([b,P])+" orig: "+d([m[W],m[W+1]]))}},E.parseCmd=function(a,m){var r=this.cmdHistory,b=(a===20||a===28||a===21||a===29)&&m>=32&&m<=47,P=(a===23||a===31)&&m>=33&&m<=35;if(!(b||P))return!1;if(A(a,m,r))return w(null,null,r),this.logger.log(c.DEBUG,"Repeated command ("+d([a,m])+") is dropped"),!0;var M=a===20||a===21||a===23?1:2,W=this.channels[M];return a===20||a===21||a===28||a===29?m===32?W.ccRCL():m===33?W.ccBS():m===34?W.ccAOF():m===35?W.ccAON():m===36?W.ccDER():m===37?W.ccRU(2):m===38?W.ccRU(3):m===39?W.ccRU(4):m===40?W.ccFON():m===41?W.ccRDC():m===42?W.ccTR():m===43?W.ccRTD():m===44?W.ccEDM():m===45?W.ccCR():m===46?W.ccENM():m===47&&W.ccEOC():W.ccTO(m-32),w(a,m,r),this.currentChannel=M,!0},E.parseMidrow=function(a,m){var r=0;if((a===17||a===25)&&m>=32&&m<=47){if(a===17?r=1:r=2,r!==this.currentChannel)return this.logger.log(c.ERROR,"Mismatch channel in midrow parsing"),!1;var b=this.channels[r];return b?(b.ccMIDROW(m),this.logger.log(c.DEBUG,"MIDROW ("+d([a,m])+")"),!0):!1}return!1},E.parsePAC=function(a,m){var r,b=this.cmdHistory,P=(a>=17&&a<=23||a>=25&&a<=31)&&m>=64&&m<=127,M=(a===16||a===24)&&m>=64&&m<=95;if(!(P||M))return!1;if(A(a,m,b))return w(null,null,b),!0;var W=a<=23?1:2;m>=64&&m<=95?r=W===1?k[a]:y[a]:r=W===1?L[a]:v[a];var X=this.channels[W];return X?(X.setPAC(this.interpretPAC(r,m)),w(a,m,b),this.currentChannel=W,!0):!1},E.interpretPAC=function(a,m){var r,b={color:null,italics:!1,indent:null,underline:!1,row:a};return m>95?r=m-96:r=m-64,b.underline=(r&1)===1,r<=13?b.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(b.italics=!0,b.color="white"):b.indent=Math.floor((r-16)/2)*4,b},E.parseChars=function(a,m){var r,b=null,P=null;if(a>=25?(r=2,P=a-8):(r=1,P=a),P>=17&&P<=19){var M;P===17?M=m+80:P===18?M=m+112:M=m+144,this.logger.log(c.INFO,"Special char '"+F(M)+"' in channel "+r),b=[M]}else a>=32&&a<=127&&(b=m===0?[a]:[a,m]);if(b){var W=d(b);this.logger.log(c.DEBUG,"Char codes = "+W.join(",")),w(a,m,this.cmdHistory)}return b},E.parseBackgroundAttributes=function(a,m){var r=(a===16||a===24)&&m>=32&&m<=47,b=(a===23||a===31)&&m>=45&&m<=47;if(!(r||b))return!1;var P,M={};a===16||a===24?(P=Math.floor((m-32)/2),M.background=p[P],m%2===1&&(M.background=M.background+"_semi")):m===45?M.background="transparent":(M.foreground="black",m===47&&(M.underline=!0));var W=a<=23?1:2,X=this.channels[W];return X.setBkgData(M),w(a,m,this.cmdHistory),!0},E.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var m=this.channels[a];m&&m.reset()}this.cmdHistory=R()},E.cueSplitAtTime=function(a){for(var m=0;m<this.channels.length;m++){var r=this.channels[m];r&&r.cueSplitAtTime(a)}},T}();function w(T,E,g){g.a=T,g.b=E}function A(T,E,g){return g.a===T&&g.b===E}function R(){return{a:null,b:null}}Z.default=x},"./src/utils/codecs.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"isCodecType",function(){return j}),D.d(Z,"isCodecSupportedInMp4",function(){return F});var $={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 j(V,H){var k=$[H];return!!k&&k[V.slice(0,4)]===!0}function F(V,H){return MediaSource.isTypeSupported((H||"video")+'/mp4;codecs="'+V+'"')}},"./src/utils/cues.ts":function(oe,Z,D){"use strict";D.r(Z);var $=D("./src/utils/vttparser.ts"),j=D("./src/utils/webvtt-parser.ts"),F=D("./src/utils/texttrack-utils.ts"),V=/\s/,H={newCue:function(L,y,v,p){for(var c=[],h,d,l,s,u,f=self.VTTCue||self.TextTrackCue,O=0;O<p.rows.length;O++)if(h=p.rows[O],l=!0,s=0,u="",!h.isEmpty()){for(var x=0;x<h.chars.length;x++)V.test(h.chars[x].uchar)&&l?s++:(u+=h.chars[x].uchar,l=!1);h.cueStartTime=y,y===v&&(v+=1e-4),s>=16?s--:s++;var w=Object($.fixLineBreaks)(u.trim()),A=Object(j.generateCueId)(y,v,w);(!L||!L.cues||!L.cues.getCueById(A))&&(d=new f(y,v,w),d.id=A,d.line=O+1,d.align="left",d.position=10+Math.min(80,Math.floor(s*8/32)*10),c.push(d))}return L&&c.length&&(c.sort(function(R,T){return R.line==="auto"||T.line==="auto"?0:R.line>8&&T.line>8?T.line-R.line:R.line-T.line}),c.forEach(function(R){return Object(F.addCueToTrack)(L,R)})),c}};Z.default=H},"./src/utils/discontinuities.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"findFirstFragWithCC",function(){return V}),D.d(Z,"shouldAlignOnDiscontinuities",function(){return H}),D.d(Z,"findDiscontinuousReferenceFrag",function(){return k}),D.d(Z,"adjustSlidingStart",function(){return y}),D.d(Z,"alignStream",function(){return v}),D.d(Z,"alignPDT",function(){return c}),D.d(Z,"alignFragmentByPDTDelta",function(){return h}),D.d(Z,"alignMediaPlaylistByPDT",function(){return d});var $=D("./src/polyfills/number.ts"),j=D("./src/utils/logger.ts"),F=D("./src/controller/level-helper.ts");function V(l,s){for(var u=null,f=0,O=l.length;f<O;f++){var x=l[f];if(x&&x.cc===s){u=x;break}}return u}function H(l,s,u){return!!(s.details&&(u.endCC>u.startCC||l&&l.cc<u.startCC))}function k(l,s){var u=l.fragments,f=s.fragments;if(!f.length||!u.length){j.logger.log("No fragments to align");return}var O=V(u,f[0].cc);if(!O||O&&!O.startPTS){j.logger.log("No frag in previous level to align on");return}return O}function L(l,s){if(l){var u=l.start+s;l.start=l.startPTS=u,l.endPTS=u+l.duration}}function y(l,s){for(var u=s.fragments,f=0,O=u.length;f<O;f++)L(u[f],l);s.fragmentHint&&L(s.fragmentHint,l),s.alignedSliding=!0}function v(l,s,u){if(!s)return;p(l,u,s),!u.alignedSliding&&s.details&&c(u,s.details),!u.alignedSliding&&s.details&&!u.skippedSegments&&Object(F.adjustSliding)(s.details,u)}function p(l,s,u){if(H(l,u,s)){var f=k(u.details,s);f&&Object($.isFiniteNumber)(f.start)&&(j.logger.log("Adjusting PTS using last level due to CC increase within current level "+s.url),y(f.start,s))}}function c(l,s){if(!s.fragments.length||!l.hasProgramDateTime||!s.hasProgramDateTime)return;var u=s.fragments[0].programDateTime,f=l.fragments[0].programDateTime,O=(f-u)/1e3+s.fragments[0].start;O&&Object($.isFiniteNumber)(O)&&(j.logger.log("Adjusting PTS using programDateTime delta "+(f-u)+"ms, sliding:"+O.toFixed(3)+" "+l.url+" "),y(O,l))}function h(l,s){var u=l.programDateTime;if(!u)return;var f=(u-s)/1e3;l.start=l.startPTS=f,l.endPTS=f+l.duration}function d(l,s){if(!s.fragments.length||!l.hasProgramDateTime||!s.hasProgramDateTime)return;var u=s.fragments[0].programDateTime,f=s.fragments[0].start,O=u-f*1e3;l.fragments.forEach(function(x){h(x,O)}),l.fragmentHint&&h(l.fragmentHint,O),l.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(oe,Z,D){"use strict";D.r(Z);var $=D("./src/utils/ewma.ts"),j=function(){function F(H,k,L){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=L,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new $.default(H),this.fast_=new $.default(k)}var V=F.prototype;return V.update=function(k,L){var y=this.slow_,v=this.fast_;this.slow_.halfLife!==k&&(this.slow_=new $.default(k,y.getEstimate(),y.getTotalWeight())),this.fast_.halfLife!==L&&(this.fast_=new $.default(L,v.getEstimate(),v.getTotalWeight()))},V.sample=function(k,L){k=Math.max(k,this.minDelayMs_);var y=8*L,v=k/1e3,p=y/v;this.fast_.sample(v,p),this.slow_.sample(v,p)},V.canEstimate=function(){var k=this.fast_;return k&&k.getTotalWeight()>=this.minWeight_},V.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},V.destroy=function(){},F}();Z.default=j},"./src/utils/ewma.ts":function(oe,Z,D){"use strict";D.r(Z);var $=function(){function j(V,H,k){H===void 0&&(H=0),k===void 0&&(k=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=V,this.alpha_=V?Math.exp(Math.log(.5)/V):0,this.estimate_=H,this.totalWeight_=k}var F=j.prototype;return F.sample=function(H,k){var L=Math.pow(this.alpha_,H);this.estimate_=k*(1-L)+L*this.estimate_,this.totalWeight_+=H},F.getTotalWeight=function(){return this.totalWeight_},F.getEstimate=function(){if(this.alpha_){var H=1-Math.pow(this.alpha_,this.totalWeight_);if(H)return this.estimate_/H}return this.estimate_},j}();Z.default=$},"./src/utils/fetch-loader.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"fetchSupported",function(){return h});var $=D("./src/polyfills/number.ts"),j=D("./src/loader/load-stats.ts"),F=D("./src/demux/chunk-cache.ts");function V(f,O){f.prototype=Object.create(O.prototype),f.prototype.constructor=f,v(f,O)}function H(f){var O=typeof Map=="function"?new Map:void 0;return H=function(w){if(w===null||!y(w))return w;if(typeof w!="function")throw new TypeError("Super expression must either be null or a function");if(typeof O!="undefined"){if(O.has(w))return O.get(w);O.set(w,A)}function A(){return k(w,arguments,p(this).constructor)}return A.prototype=Object.create(w.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),v(A,w)},H(f)}function k(f,O,x){return L()?k=Reflect.construct:k=function(A,R,T){var E=[null];E.push.apply(E,R);var g=Function.bind.apply(A,E),a=new g;return T&&v(a,T.prototype),a},k.apply(null,arguments)}function L(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(f){return!1}}function y(f){return Function.toString.call(f).indexOf("[native code]")!==-1}function v(f,O){return v=Object.setPrototypeOf||function(w,A){return w.__proto__=A,w},v(f,O)}function p(f){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(x){return x.__proto__||Object.getPrototypeOf(x)},p(f)}function c(){return c=Object.assign||function(f){for(var O=1;O<arguments.length;O++){var x=arguments[O];for(var w in x)Object.prototype.hasOwnProperty.call(x,w)&&(f[w]=x[w])}return f},c.apply(this,arguments)}function h(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(f){}return!1}var d=function(){function f(x){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=x.fetchSetup||s,this.controller=new self.AbortController,this.stats=new j.LoadStats}var O=f.prototype;return O.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},O.abortInternal=function(){var w=this.response;(!w||!w.ok)&&(this.stats.aborted=!0,this.controller.abort())},O.abort=function(){var w;this.abortInternal(),(w=this.callbacks)!==null&&w!==void 0&&w.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},O.load=function(w,A,R){var T=this,E=this.stats;if(E.loading.start)throw new Error("Loader can only be used once.");E.loading.start=self.performance.now();var g=l(w,this.controller.signal),a=R.onProgress,m=w.responseType==="arraybuffer",r=m?"byteLength":"length";this.context=w,this.config=A,this.callbacks=R,this.request=this.fetchSetup(w,g),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){T.abortInternal(),R.onTimeout(E,w,T.response)},A.timeout),self.fetch(this.request).then(function(b){if(T.response=T.loader=b,!b.ok){var P=b.status,M=b.statusText;throw new u(M||"fetch, bad network response",P,b)}return E.loading.first=Math.max(self.performance.now(),E.loading.start),E.total=parseInt(b.headers.get("Content-Length")||"0"),a&&Object($.isFiniteNumber)(A.highWaterMark)?T.loadProgressively(b,E,w,A.highWaterMark,a):m?b.arrayBuffer():b.text()}).then(function(b){var P=T.response;self.clearTimeout(T.requestTimeout),E.loading.end=Math.max(self.performance.now(),E.loading.first),E.loaded=E.total=b[r];var M={url:P.url,data:b};a&&!Object($.isFiniteNumber)(A.highWaterMark)&&a(E,w,b,P),R.onSuccess(M,E,w,P)}).catch(function(b){if(self.clearTimeout(T.requestTimeout),E.aborted)return;var P=b.code||0;R.onError({code:P,text:b.message},w,b.details)})},O.getCacheAge=function(){var w=null;if(this.response){var A=this.response.headers.get("age");w=A?parseFloat(A):null}return w},O.loadProgressively=function(w,A,R,T,E){T===void 0&&(T=0);var g=new F.default,a=w.body.getReader(),m=function r(){return a.read().then(function(b){if(b.done)return g.dataLength&&E(A,R,g.flush(),w),Promise.resolve(new ArrayBuffer(0));var P=b.value,M=P.length;return A.loaded+=M,M<T||g.dataLength?(g.push(P),g.dataLength>=T&&E(A,R,g.flush(),w)):E(A,R,P,w),r()}).catch(function(){return Promise.reject()})};return m()},f}();function l(f,O){var x={method:"GET",mode:"cors",credentials:"same-origin",signal:O,headers:new self.Headers(c({},f.headers))};return f.rangeEnd&&x.headers.set("Range","bytes="+f.rangeStart+"-"+String(f.rangeEnd-1)),x}function s(f,O){return new self.Request(f.url,O)}var u=function(f){V(O,f);function O(x,w,A){var R;return R=f.call(this,x)||this,R.code=void 0,R.details=void 0,R.code=w,R.details=A,R}return O}(H(Error));Z.default=d},"./src/utils/imsc1-ttml-parser.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"IMSC1_CODEC",function(){return y}),D.d(Z,"parseIMSC1",function(){return h});var $=D("./src/utils/mp4-tools.ts"),j=D("./src/utils/vttparser.ts"),F=D("./src/utils/vttcue.ts"),V=D("./src/demux/id3.ts"),H=D("./src/utils/timescale-conversion.ts"),k=D("./src/utils/webvtt-parser.ts");function L(){return L=Object.assign||function(T){for(var E=1;E<arguments.length;E++){var g=arguments[E];for(var a in g)Object.prototype.hasOwnProperty.call(g,a)&&(T[a]=g[a])}return T},L.apply(this,arguments)}var y="stpp.ttml.im1t",v=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,p=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,c={left:"start",center:"center",right:"end",start:"start",end:"end"};function h(T,E,g,a,m){var r=Object($.findBox)(new Uint8Array(T),["mdat"]);if(r.length===0){m(new Error("Could not parse IMSC1 mdat"));return}var b=r[0],P=Object(V.utf8ArrayToStr)(new Uint8Array(T,b.start,b.end-b.start)),M=Object(H.toTimescaleFromScale)(E,1,g);try{a(d(P,M))}catch(W){m(W)}}function d(T,E){var g=new DOMParser,a=g.parseFromString(T,"text/xml"),m=a.getElementsByTagName("tt")[0];if(!m)throw new Error("Invalid ttml");var r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},b=Object.keys(r).reduce(function(U,S){return U[S]=m.getAttribute("ttp:"+S)||r[S],U},{}),P=m.getAttribute("xml:space")!=="preserve",M=s(l(m,"styling","style")),W=s(l(m,"layout","region")),X=l(m,"body","[begin]");return[].map.call(X,function(U){var S=u(U,P);if(!S||!U.hasAttribute("begin"))return null;var B=w(U.getAttribute("begin"),b),J=w(U.getAttribute("dur"),b),te=w(U.getAttribute("end"),b);if(B===null)throw x(U);if(te===null){if(J===null)throw x(U);te=B+J}var ae=new F.default(B-E,te-E,S);ae.id=Object(k.generateCueId)(ae.startTime,ae.endTime,ae.text);var _e=W[U.getAttribute("region")],de=M[U.getAttribute("style")];ae.position=10,ae.size=80;var Ee=f(_e,de),Te=Ee.textAlign;if(Te){var me=c[Te];me&&(ae.lineAlign=me),ae.align=Te}return L(ae,Ee),ae}).filter(function(U){return U!==null})}function l(T,E,g){var a=T.getElementsByTagName(E)[0];return a?[].slice.call(a.querySelectorAll(g)):[]}function s(T){return T.reduce(function(E,g){var a=g.getAttribute("xml:id");return a&&(E[a]=g),E},{})}function u(T,E){return[].slice.call(T.childNodes).reduce(function(g,a,m){var r;return a.nodeName==="br"&&m?g+`
|
|
`:(r=a.childNodes)!==null&&r!==void 0&&r.length?u(a,E):E?g+a.textContent.trim().replace(/\s+/g," "):g+a.textContent},"")}function f(T,E){var g="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(m,r){var b=O(E,g,r)||O(T,g,r);return b&&(m[r]=b),m},{})}function O(T,E,g){return T.hasAttributeNS(E,g)?T.getAttributeNS(E,g):null}function x(T){return new Error("Could not parse ttml timestamp "+T)}function w(T,E){if(!T)return null;var g=Object(j.parseTimeStamp)(T);return g===null&&(v.test(T)?g=A(T,E):p.test(T)&&(g=R(T,E))),g}function A(T,E){var g=v.exec(T),a=(g[4]|0)+(g[5]|0)/E.subFrameRate;return(g[1]|0)*3600+(g[2]|0)*60+(g[3]|0)+a/E.frameRate}function R(T,E){var g=p.exec(T),a=Number(g[1]),m=g[2];switch(m){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/E.frameRate;case"t":return a/E.tickRate}return a}},"./src/utils/logger.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"enableLogs",function(){return k}),D.d(Z,"logger",function(){return L});var $=function(){},j={trace:$,debug:$,log:$,warn:$,info:$,error:$},F=j;function V(y){var v=self.console[y];return v?v.bind(self.console,"["+y+"] >"):$}function H(y){for(var v=arguments.length,p=new Array(v>1?v-1:0),c=1;c<v;c++)p[c-1]=arguments[c];p.forEach(function(h){F[h]=y[h]?y[h].bind(y):V(h)})}function k(y){if(self.console&&y===!0||typeof y=="object"){H(y,"debug","log","info","warn","error");try{F.log()}catch(v){F=j}}else F=j}var L=F},"./src/utils/mediakeys-helper.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"KeySystems",function(){return $}),D.d(Z,"requestMediaKeySystemAccess",function(){return j});var $;(function(F){F.WIDEVINE="com.widevine.alpha",F.PLAYREADY="com.microsoft.playready"})($||($={}));var j=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"getMediaSource",function(){return $});function $(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"bin2str",function(){return H}),D.d(Z,"readUint16",function(){return k}),D.d(Z,"readUint32",function(){return L}),D.d(Z,"writeUint32",function(){return y}),D.d(Z,"findBox",function(){return v}),D.d(Z,"parseSegmentIndex",function(){return p}),D.d(Z,"parseInitSegment",function(){return c}),D.d(Z,"getStartDTS",function(){return h}),D.d(Z,"getDuration",function(){return d}),D.d(Z,"computeRawDurationFromSamples",function(){return l}),D.d(Z,"offsetStartDTS",function(){return s}),D.d(Z,"segmentValidRange",function(){return u}),D.d(Z,"appendUint8Array",function(){return f});var $=D("./src/utils/typed-array.ts"),j=D("./src/loader/fragment.ts"),F=Math.pow(2,32)-1,V=[].push;function H(O){return String.fromCharCode.apply(null,O)}function k(O,x){"data"in O&&(x+=O.start,O=O.data);var w=O[x]<<8|O[x+1];return w<0?65536+w:w}function L(O,x){"data"in O&&(x+=O.start,O=O.data);var w=O[x]<<24|O[x+1]<<16|O[x+2]<<8|O[x+3];return w<0?4294967296+w:w}function y(O,x,w){"data"in O&&(x+=O.start,O=O.data),O[x]=w>>24,O[x+1]=w>>16&255,O[x+2]=w>>8&255,O[x+3]=w&255}function v(O,x){var w=[];if(!x.length)return w;var A,R,T;"data"in O?(A=O.data,R=O.start,T=O.end):(A=O,R=0,T=A.byteLength);for(var E=R;E<T;){var g=L(A,E),a=H(A.subarray(E+4,E+8)),m=g>1?E+g:T;if(a===x[0])if(x.length===1)w.push({data:A,start:E+8,end:m});else{var r=v({data:A,start:E+8,end:m},x.slice(1));r.length&&V.apply(w,r)}E=m}return w}function p(O){var x=v(O,["moov"]),w=x[0],A=w?w.end:null,R=v(O,["sidx"]);if(!R||!R[0])return null;var T=[],E=R[0],g=E.data[0],a=g===0?8:16,m=L(E,a);a+=4;var r=0,b=0;g===0?a+=8:a+=16,a+=2;var P=E.end+b,M=k(E,a);a+=2;for(var W=0;W<M;W++){var X=a,U=L(E,X);X+=4;var S=U&2147483647,B=(U&2147483648)>>>31;if(B===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var J=L(E,X);X+=4,T.push({referenceSize:S,subsegmentDuration:J,info:{duration:J/m,start:P,end:P+S-1}}),P+=S,X+=4,a=X}return{earliestPresentationTime:r,timescale:m,version:g,referencesCount:M,references:T,moovEndOffset:A}}function c(O){for(var x=[],w=v(O,["moov","trak"]),A=0;A<w.length;A++){var R=w[A],T=v(R,["tkhd"])[0];if(T){var E=T.data[T.start],g=E===0?12:20,a=L(T,g),m=v(R,["mdia","mdhd"])[0];if(m){E=m.data[m.start],g=E===0?12:20;var r=L(m,g),b=v(R,["mdia","hdlr"])[0];if(b){var P=H(b.data.subarray(b.start+8,b.start+12)),M={soun:j.ElementaryStreamTypes.AUDIO,vide:j.ElementaryStreamTypes.VIDEO}[P];if(M){var W=v(R,["mdia","minf","stbl","stsd"])[0],X=void 0;W&&(X=H(W.data.subarray(W.start+12,W.start+16))),x[a]={timescale:r,type:M},x[M]={timescale:r,id:a,codec:X}}}}}}var U=v(O,["moov","mvex","trex"]);return U.forEach(function(S){var B=L(S,4),J=x[B];J&&(J.default={duration:L(S,12),flags:L(S,20)})}),x}function h(O,x){return v(x,["moof","traf"]).reduce(function(w,A){var R=v(A,["tfdt"])[0],T=R.data[R.start],E=v(A,["tfhd"]).reduce(function(g,a){var m=L(a,4),r=O[m];if(r){var b=L(R,4);T===1&&(b*=Math.pow(2,32),b+=L(R,8));var P=r.timescale||9e4,M=b/P;if(isFinite(M)&&(g===null||M<g))return M}return g},null);return E!==null&&isFinite(E)&&(w===null||E<w)?E:w},null)||0}function d(O,x){for(var w=0,A=0,R=0,T=v(O,["moof","traf"]),E=0;E<T.length;E++){var g=T[E],a=v(g,["tfhd"])[0],m=L(a,4),r=x[m];if(!r)continue;var b=r.default,P=L(a,0)|(b==null?void 0:b.flags),M=b==null?void 0:b.duration;P&8&&(P&2?M=L(a,12):M=L(a,8));for(var W=r.timescale||9e4,X=v(g,["trun"]),U=0;U<X.length;U++){if(M){var S=L(X[U],4);w=M*S}else w=l(X[U]);r.type===j.ElementaryStreamTypes.VIDEO?A+=w/W:r.type===j.ElementaryStreamTypes.AUDIO&&(R+=w/W)}}if(A===0&&R===0){var B=p(O);if(B!=null&&B.references)return B.references.reduce(function(J,te){return J+te.info.duration||0},0)}return A||R}function l(O){var x=L(O,0),w=8;x&1&&(w+=4),x&4&&(w+=4);for(var A=0,R=L(O,4),T=0;T<R;T++){if(x&256){var E=L(O,w);A+=E,w+=4}x&512&&(w+=4),x&1024&&(w+=4),x&2048&&(w+=4)}return A}function s(O,x,w){v(x,["moof","traf"]).forEach(function(A){v(A,["tfhd"]).forEach(function(R){var T=L(R,4),E=O[T];if(!E)return;var g=E.timescale||9e4;v(A,["tfdt"]).forEach(function(a){var m=a.data[a.start],r=L(a,4);if(m===0)y(a,4,r-w*g);else{r*=Math.pow(2,32),r+=L(a,8),r-=w*g,r=Math.max(r,0);var b=Math.floor(r/(F+1)),P=Math.floor(r%(F+1));y(a,4,b),y(a,8,P)}})})})}function u(O){var x={valid:null,remainder:null},w=v(O,["moof"]);if(w){if(w.length<2)return x.remainder=O,x}else return x;var A=w[w.length-1];return x.valid=Object($.sliceUint8)(O,0,A.start-8),x.remainder=Object($.sliceUint8)(O,A.start-8),x}function f(O,x){var w=new Uint8Array(O.length+x.length);return w.set(O),w.set(x,O.length),w}},"./src/utils/output-filter.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return $});var $=function(){function j(V,H){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=V,this.trackName=H}var F=j.prototype;return F.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},F.newCue=function(H,k,L){(this.startTime===null||this.startTime>H)&&(this.startTime=H),this.endTime=k,this.screen=L,this.timelineController.createCaptionsTrack(this.trackName)},F.reset=function(){this.cueRanges=[]},j}()},"./src/utils/texttrack-utils.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"sendAddTrackEvent",function(){return j}),D.d(Z,"addCueToTrack",function(){return F}),D.d(Z,"clearCurrentCues",function(){return V}),D.d(Z,"removeCuesInRange",function(){return H}),D.d(Z,"getCuesInRange",function(){return L});var $=D("./src/utils/logger.ts");function j(y,v){var p;try{p=new Event("addtrack")}catch(c){p=document.createEvent("Event"),p.initEvent("addtrack",!1,!1)}p.track=y,v.dispatchEvent(p)}function F(y,v){var p=y.mode;if(p==="disabled"&&(y.mode="hidden"),y.cues&&!y.cues.getCueById(v.id))try{if(y.addCue(v),!y.cues.getCueById(v.id))throw new Error("addCue is failed for: "+v)}catch(h){$.logger.debug("[texttrack-utils]: "+h);var c=new self.TextTrackCue(v.startTime,v.endTime,v.text);c.id=v.id,y.addCue(c)}p==="disabled"&&(y.mode=p)}function V(y){var v=y.mode;if(v==="disabled"&&(y.mode="hidden"),y.cues)for(var p=y.cues.length;p--;)y.removeCue(y.cues[p]);v==="disabled"&&(y.mode=v)}function H(y,v,p){var c=y.mode;if(c==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var h=L(y.cues,v,p),d=0;d<h.length;d++)y.removeCue(h[d]);c==="disabled"&&(y.mode=c)}function k(y,v){if(v<y[0].startTime)return 0;var p=y.length-1;if(v>y[p].endTime)return-1;for(var c=0,h=p;c<=h;){var d=Math.floor((h+c)/2);if(v<y[d].startTime)h=d-1;else if(v>y[d].startTime&&c<p)c=d+1;else return d}return y[c].startTime-v<v-y[h].startTime?c:h}function L(y,v,p){var c=[],h=k(y,v);if(h>-1)for(var d=h,l=y.length;d<l;d++){var s=y[d];if(s.startTime>=v&&s.endTime<=p)c.push(s);else if(s.startTime>p)return c}return c}},"./src/utils/time-ranges.ts":function(oe,Z,D){"use strict";D.r(Z);var $={toString:function(F){for(var V="",H=F.length,k=0;k<H;k++)V+="["+F.start(k).toFixed(3)+","+F.end(k).toFixed(3)+"]";return V}};Z.default=$},"./src/utils/timescale-conversion.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"toTimescaleFromBase",function(){return j}),D.d(Z,"toTimescaleFromScale",function(){return F}),D.d(Z,"toMsFromMpegTsClock",function(){return V}),D.d(Z,"toMpegTsClockFromTimescale",function(){return H});var $=9e4;function j(k,L,y,v){y===void 0&&(y=1),v===void 0&&(v=!1);var p=k*L*y;return v?Math.round(p):p}function F(k,L,y,v){return y===void 0&&(y=1),v===void 0&&(v=!1),j(k,L,1/y,v)}function V(k,L){return L===void 0&&(L=!1),j(k,1e3,1/$,L)}function H(k,L){return L===void 0&&(L=1),j(k,$,1/L)}},"./src/utils/typed-array.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"sliceUint8",function(){return $});function $(j,F,V){return Uint8Array.prototype.slice?j.slice(F,V):new Uint8Array(Array.prototype.slice.call(j,F,V))}},"./src/utils/vttcue.ts":function(oe,Z,D){"use strict";D.r(Z),Z.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var $=["","lr","rl"],j=["start","middle","end","left","right"];function F(y,v){if(typeof v!="string")return!1;if(!Array.isArray(y))return!1;var p=v.toLowerCase();return~y.indexOf(p)?p:!1}function V(y){return F($,y)}function H(y){return F(j,y)}function k(y){for(var v=arguments.length,p=new Array(v>1?v-1:0),c=1;c<v;c++)p[c-1]=arguments[c];for(var h=1;h<arguments.length;h++){var d=arguments[h];for(var l in d)y[l]=d[l]}return y}function L(y,v,p){var c=this,h={enumerable:!0};c.hasBeenReset=!1;var d="",l=!1,s=y,u=v,f=p,O=null,x="",w=!0,A="auto",R="start",T=50,E="middle",g=50,a="middle";Object.defineProperty(c,"id",k({},h,{get:function(){return d},set:function(r){d=""+r}})),Object.defineProperty(c,"pauseOnExit",k({},h,{get:function(){return l},set:function(r){l=!!r}})),Object.defineProperty(c,"startTime",k({},h,{get:function(){return s},set:function(r){if(typeof r!="number")throw new TypeError("Start time must be set to a number.");s=r,this.hasBeenReset=!0}})),Object.defineProperty(c,"endTime",k({},h,{get:function(){return u},set:function(r){if(typeof r!="number")throw new TypeError("End time must be set to a number.");u=r,this.hasBeenReset=!0}})),Object.defineProperty(c,"text",k({},h,{get:function(){return f},set:function(r){f=""+r,this.hasBeenReset=!0}})),Object.defineProperty(c,"region",k({},h,{get:function(){return O},set:function(r){O=r,this.hasBeenReset=!0}})),Object.defineProperty(c,"vertical",k({},h,{get:function(){return x},set:function(r){var b=V(r);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");x=b,this.hasBeenReset=!0}})),Object.defineProperty(c,"snapToLines",k({},h,{get:function(){return w},set:function(r){w=!!r,this.hasBeenReset=!0}})),Object.defineProperty(c,"line",k({},h,{get:function(){return A},set:function(r){if(typeof r!="number"&&r!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");A=r,this.hasBeenReset=!0}})),Object.defineProperty(c,"lineAlign",k({},h,{get:function(){return R},set:function(r){var b=H(r);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");R=b,this.hasBeenReset=!0}})),Object.defineProperty(c,"position",k({},h,{get:function(){return T},set:function(r){if(r<0||r>100)throw new Error("Position must be between 0 and 100.");T=r,this.hasBeenReset=!0}})),Object.defineProperty(c,"positionAlign",k({},h,{get:function(){return E},set:function(r){var b=H(r);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");E=b,this.hasBeenReset=!0}})),Object.defineProperty(c,"size",k({},h,{get:function(){return g},set:function(r){if(r<0||r>100)throw new Error("Size must be between 0 and 100.");g=r,this.hasBeenReset=!0}})),Object.defineProperty(c,"align",k({},h,{get:function(){return a},set:function(r){var b=H(r);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");a=b,this.hasBeenReset=!0}})),c.displayState=void 0}return L.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},L}()},"./src/utils/vttparser.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"parseTimeStamp",function(){return F}),D.d(Z,"fixLineBreaks",function(){return v}),D.d(Z,"VTTParser",function(){return p});var $=D("./src/utils/vttcue.ts"),j=function(){function c(){}var h=c.prototype;return h.decode=function(l,s){if(!l)return"";if(typeof l!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(l))},c}();function F(c){function h(l,s,u,f){return(l|0)*3600+(s|0)*60+(u|0)+parseFloat(f||0)}var d=c.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return d?parseFloat(d[2])>59?h(d[2],d[3],0,d[4]):h(d[1],d[2],d[3],d[4]):null}var V=function(){function c(){this.values=Object.create(null)}var h=c.prototype;return h.set=function(l,s){!this.get(l)&&s!==""&&(this.values[l]=s)},h.get=function(l,s,u){return u?this.has(l)?this.values[l]:s[u]:this.has(l)?this.values[l]:s},h.has=function(l){return l in this.values},h.alt=function(l,s,u){for(var f=0;f<u.length;++f)if(s===u[f]){this.set(l,s);break}},h.integer=function(l,s){/^-?\d+$/.test(s)&&this.set(l,parseInt(s,10))},h.percent=function(l,s){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(s)){var u=parseFloat(s);if(u>=0&&u<=100)return this.set(l,u),!0}return!1},c}();function H(c,h,d,l){var s=l?c.split(l):[c];for(var u in s){if(typeof s[u]!="string")continue;var f=s[u].split(d);if(f.length!==2)continue;var O=f[0],x=f[1];h(O,x)}}var k=new $.default(0,0,""),L=k.align==="middle"?"middle":"center";function y(c,h,d){var l=c;function s(){var O=F(c);if(O===null)throw new Error("Malformed timestamp: "+l);return c=c.replace(/^[^\sa-zA-Z-]+/,""),O}function u(O,x){var w=new V;H(O,function(T,E){var g;switch(T){case"region":for(var a=d.length-1;a>=0;a--)if(d[a].id===E){w.set(T,d[a].region);break}break;case"vertical":w.alt(T,E,["rl","lr"]);break;case"line":g=E.split(","),w.integer(T,g[0]),w.percent(T,g[0])&&w.set("snapToLines",!1),w.alt(T,g[0],["auto"]),g.length===2&&w.alt("lineAlign",g[1],["start",L,"end"]);break;case"position":g=E.split(","),w.percent(T,g[0]),g.length===2&&w.alt("positionAlign",g[1],["start",L,"end","line-left","line-right","auto"]);break;case"size":w.percent(T,E);break;case"align":w.alt(T,E,["start",L,"end","left","right"]);break}},/:/,/\s/),x.region=w.get("region",null),x.vertical=w.get("vertical","");var A=w.get("line","auto");A==="auto"&&k.line===-1&&(A=-1),x.line=A,x.lineAlign=w.get("lineAlign","start"),x.snapToLines=w.get("snapToLines",!0),x.size=w.get("size",100),x.align=w.get("align",L);var R=w.get("position","auto");R==="auto"&&k.position===50&&(R=x.align==="start"||x.align==="left"?0:x.align==="end"||x.align==="right"?100:50),x.position=R}function f(){c=c.replace(/^\s+/,"")}if(f(),h.startTime=s(),f(),c.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+l);c=c.substr(3),f(),h.endTime=s(),f(),u(c,h)}function v(c){return c.replace(/<br(?: \/)?>/gi,`
|
|
`)}var p=function(){function c(){this.state="INITIAL",this.buffer="",this.decoder=new j,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var h=c.prototype;return h.parse=function(l){var s=this;l&&(s.buffer+=s.decoder.decode(l,{stream:!0}));function u(){var R=s.buffer,T=0;for(R=v(R);T<R.length&&R[T]!=="\r"&&R[T]!==`
|
|
`;)++T;var E=R.substr(0,T);return R[T]==="\r"&&++T,R[T]===`
|
|
`&&++T,s.buffer=R.substr(T),E}function f(R){H(R,function(T,E){},/:/)}try{var O="";if(s.state==="INITIAL"){if(!/\r\n|\n/.test(s.buffer))return this;O=u();var x=O.match(/^()?WEBVTT([ \t].*)?$/);if(!x||!x[0])throw new Error("Malformed WebVTT signature.");s.state="HEADER"}for(var w=!1;s.buffer;){if(!/\r\n|\n/.test(s.buffer))return this;w?w=!1:O=u();switch(s.state){case"HEADER":/:/.test(O)?f(O):O||(s.state="ID");continue;case"NOTE":O||(s.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(O)){s.state="NOTE";break}if(!O)continue;if(s.cue=new $.default(0,0,""),s.state="CUE",O.indexOf("-->")===-1){s.cue.id=O;continue}case"CUE":if(!s.cue){s.state="BADCUE";continue}try{y(O,s.cue,s.regionList)}catch(R){s.cue=null,s.state="BADCUE";continue}s.state="CUETEXT";continue;case"CUETEXT":{var A=O.indexOf("-->")!==-1;if(!O||A&&(w=!0)){s.oncue&&s.cue&&s.oncue(s.cue),s.cue=null,s.state="ID";continue}if(s.cue===null)continue;s.cue.text&&(s.cue.text+=`
|
|
`),s.cue.text+=O}continue;case"BADCUE":O||(s.state="ID")}}}catch(R){s.state==="CUETEXT"&&s.cue&&s.oncue&&s.oncue(s.cue),s.cue=null,s.state=s.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},h.flush=function(){var l=this;try{if((l.cue||l.state==="HEADER")&&(l.buffer+=`
|
|
|
|
`,l.parse()),l.state==="INITIAL"||l.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(s){l.onparsingerror&&l.onparsingerror(s)}return l.onflush&&l.onflush(),this},c}()},"./src/utils/webvtt-parser.ts":function(oe,Z,D){"use strict";D.r(Z),D.d(Z,"generateCueId",function(){return p}),D.d(Z,"parseWebVTT",function(){return h});var $=D("./src/polyfills/number.ts"),j=D("./src/utils/vttparser.ts"),F=D("./src/demux/id3.ts"),V=D("./src/utils/timescale-conversion.ts"),H=D("./src/remux/mp4-remuxer.ts"),k=/\r\n|\n\r|\n|\r/g,L=function(l,s,u){return u===void 0&&(u=0),l.substr(u,s.length)===s},y=function(l){var s=parseInt(l.substr(-3)),u=parseInt(l.substr(-6,2)),f=parseInt(l.substr(-9,2)),O=l.length>9?parseInt(l.substr(0,l.indexOf(":"))):0;if(!Object($.isFiniteNumber)(s)||!Object($.isFiniteNumber)(u)||!Object($.isFiniteNumber)(f)||!Object($.isFiniteNumber)(O))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+l);return s+=1e3*u,s+=60*1e3*f,s+=60*60*1e3*O,s},v=function(l){for(var s=5381,u=l.length;u;)s=s*33^l.charCodeAt(--u);return(s>>>0).toString()};function p(d,l,s){return v(d.toString())+v(l.toString())+v(s)}var c=function(l,s,u){var f=l[s],O=l[f.prevCC];if(!O||!O.new&&f.new){l.ccOffset=l.presentationOffset=f.start,f.new=!1;return}for(;(x=O)!==null&&x!==void 0&&x.new;){var x;l.ccOffset+=f.start-O.start,f.new=!1,f=O,O=l[f.prevCC]}l.presentationOffset=u};function h(d,l,s,u,f,O,x,w){var A=new j.VTTParser,R=Object(F.utf8ArrayToStr)(new Uint8Array(d)).trim().replace(k,`
|
|
`).split(`
|
|
`),T=[],E=Object(V.toMpegTsClockFromTimescale)(l,s),g="00:00.000",a=0,m=0,r,b=!0,P=!1;A.oncue=function(M){var W=u[f],X=u.ccOffset,U=(a-E)/9e4;if(W!=null&&W.new&&(m!==void 0?X=u.ccOffset=W.start:c(u,f,U)),U&&(X=U-u.presentationOffset),P){var S=M.endTime-M.startTime,B=Object(H.normalizePts)((M.startTime+X-m)*9e4,O*9e4)/9e4;M.startTime=B,M.endTime=B+S}var J=M.text.trim();M.text=decodeURIComponent(encodeURIComponent(J)),M.id||(M.id=p(M.startTime,M.endTime,J)),M.endTime>0&&T.push(M)},A.onparsingerror=function(M){r=M},A.onflush=function(){if(r){w(r);return}x(T)},R.forEach(function(M){if(b)if(L(M,"X-TIMESTAMP-MAP=")){b=!1,P=!0,M.substr(16).split(",").forEach(function(W){L(W,"LOCAL:")?g=W.substr(6):L(W,"MPEGTS:")&&(a=parseInt(W.substr(7)))});try{m=y(g)/1e3}catch(W){P=!1,r=W}return}else M===""&&(b=!1);A.parse(M+`
|
|
`)}),A.flush()}},"./src/utils/xhr-loader.ts":function(oe,Z,D){"use strict";D.r(Z);var $=D("./src/utils/logger.ts"),j=D("./src/loader/load-stats.ts"),F=/^age:\s*[\d.]+\s*$/m,V=function(){function H(L){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=L?L.xhrSetup:null,this.stats=new j.LoadStats,this.retryDelay=0}var k=H.prototype;return k.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},k.abortInternal=function(){var y=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),y&&(y.onreadystatechange=null,y.onprogress=null,y.readyState!==4&&(this.stats.aborted=!0,y.abort()))},k.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},k.load=function(y,v,p){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=y,this.config=v,this.callbacks=p,this.retryDelay=v.retryDelay,this.loadInternal()},k.loadInternal=function(){var y=this.config,v=this.context;if(!y)return;var p=this.loader=new self.XMLHttpRequest,c=this.stats;c.loading.first=0,c.loaded=0;var h=this.xhrSetup;try{if(h)try{h(p,v.url)}catch(s){p.open("GET",v.url,!0),h(p,v.url)}p.readyState||p.open("GET",v.url,!0);var d=this.context.headers;if(d)for(var l in d)p.setRequestHeader(l,d[l])}catch(s){this.callbacks.onError({code:p.status,text:s.message},v,p);return}v.rangeEnd&&p.setRequestHeader("Range","bytes="+v.rangeStart+"-"+(v.rangeEnd-1)),p.onreadystatechange=this.readystatechange.bind(this),p.onprogress=this.loadprogress.bind(this),p.responseType=v.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout),p.send()},k.readystatechange=function(){var y=this.context,v=this.loader,p=this.stats;if(!y||!v)return;var c=v.readyState,h=this.config;if(p.aborted)return;if(c>=2)if(self.clearTimeout(this.requestTimeout),p.loading.first===0&&(p.loading.first=Math.max(self.performance.now(),p.loading.start)),c===4){v.onreadystatechange=null,v.onprogress=null;var d=v.status;if(d>=200&&d<300){p.loading.end=Math.max(self.performance.now(),p.loading.first);var l,s;if(y.responseType==="arraybuffer"?(l=v.response,s=l.byteLength):(l=v.responseText,s=l.length),p.loaded=p.total=s,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(p,y,l,v),!this.callbacks)return;var f={url:v.responseURL,data:l};this.callbacks.onSuccess(f,p,y,v)}else p.retry>=h.maxRetry||d>=400&&d<499?($.logger.error(d+" while loading "+y.url),this.callbacks.onError({code:d,text:v.statusText},y,v)):($.logger.warn(d+" while loading "+y.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,h.maxRetryDelay),p.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),h.timeout)},k.loadtimeout=function(){$.logger.warn("timeout while loading "+this.context.url);var y=this.callbacks;y&&(this.abortInternal(),y.onTimeout(this.stats,this.context,this.loader))},k.loadprogress=function(y){var v=this.stats;v.loaded=y.loaded,y.lengthComputable&&(v.total=y.total)},k.getCacheAge=function(){var y=null;if(this.loader&&F.test(this.loader.getAllResponseHeaders())){var v=this.loader.getResponseHeader("age");y=v?parseFloat(v):null}return y},H}();Z.default=V}}).default})},vHTk:function(Mt,st,ne){Mt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|